@jiaozhiye/qm-design-react 1.9.12 → 1.9.13
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/form/src/form.d.ts +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.full.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/lib/index.full.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("QmDesign",["react"],t):"object"==typeof exports?exports.QmDesign=t(require("react")):e.QmDesign=t(e.React)}("undefined"!=typeof self?self:this,(e=>(()=>{"use strict";var t={442:t=>{t.exports=e}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};n.r(i),n.d(i,{Affix:()=>L.Affix,Alert:()=>L.Alert,Anchor:()=>L.Anchor,AutoComplete:()=>L.AutoComplete,Avatar:()=>L.Avatar,BackTop:()=>L.BackTop,Badge:()=>L.Badge,Breadcrumb:()=>L.Breadcrumb,Button:()=>L.Button,Calendar:()=>$,Card:()=>L.Card,Carousel:()=>L.Carousel,Cascader:()=>L.Cascader,Checkbox:()=>L.Checkbox,Col:()=>L.Col,Collapse:()=>L.Collapse,Comment:()=>L.Comment,ConfigProvider:()=>L.ConfigProvider,DatePicker:()=>j,DcpAnchor:()=>nr,DcpButton:()=>xe,DcpCollapse:()=>je,DcpConfigProvider:()=>ee,DcpCopyToClipboard:()=>kc,DcpCountup:()=>ht,DcpCropper:()=>vl,DcpDivider:()=>ke,DcpDownload:()=>Ut,DcpDrawer:()=>hr,DcpEmpty:()=>bt,DcpForm:()=>Go,DcpGuideTracker:()=>Su,DcpLazyLoad:()=>Ru,DcpModal:()=>Er,DcpPrint:()=>Jd,DcpRangeTableHelper:()=>ld,DcpScrollbar:()=>_t,DcpSearchHelper:()=>Gc,DcpSearchTree:()=>Dl,DcpSignature:()=>Vu,DcpSpace:()=>Ce,DcpSpin:()=>St,DcpSplit:()=>lt,DcpTable:()=>Bc,DcpTabs:()=>cr,DcpTinymce:()=>ml,DcpTour:()=>kd,DcpTransition:()=>_d,DcpTreeHelper:()=>rd,DcpTreeTableHelper:()=>ed,DcpUploadFile:()=>xl,DcpUploadImg:()=>Il,DcpWatermark:()=>wu,Descriptions:()=>L.Descriptions,Divider:()=>L.Divider,Drawer:()=>L.Drawer,Dropdown:()=>L.Dropdown,Empty:()=>L.Empty,Form:()=>L.Form,Grid:()=>L.Grid,Image:()=>L.Image,Input:()=>L.Input,InputNumber:()=>L.InputNumber,Layout:()=>L.Layout,List:()=>L.List,Mentions:()=>L.Mentions,Menu:()=>L.Menu,Modal:()=>L.Modal,PageHeader:()=>L.PageHeader,Pagination:()=>L.Pagination,Popconfirm:()=>L.Popconfirm,Popover:()=>L.Popover,Progress:()=>L.Progress,QmAnchor:()=>nr,QmButton:()=>xe,QmCollapse:()=>je,QmConfigProvider:()=>ee,QmCopyToClipboard:()=>kc,QmCountup:()=>ht,QmCropper:()=>vl,QmDivider:()=>ke,QmDownload:()=>Ut,QmDrawer:()=>hr,QmEmpty:()=>bt,QmForm:()=>Go,QmGuideTracker:()=>Su,QmLazyLoad:()=>Ru,QmModal:()=>Er,QmPrint:()=>Jd,QmRangeTableHelper:()=>ld,QmScrollbar:()=>_t,QmSearchHelper:()=>Gc,QmSearchTree:()=>Dl,QmSignature:()=>Vu,QmSpace:()=>Ce,QmSpin:()=>St,QmSplit:()=>lt,QmTable:()=>Bc,QmTabs:()=>cr,QmTinymce:()=>ml,QmTour:()=>kd,QmTransition:()=>_d,QmTreeHelper:()=>rd,QmTreeTableHelper:()=>ed,QmUploadFile:()=>xl,QmUploadImg:()=>Il,QmWatermark:()=>wu,Radio:()=>L.Radio,Rate:()=>L.Rate,Result:()=>L.Result,Row:()=>L.Row,Segmented:()=>L.Segmented,Select:()=>L.Select,Skeleton:()=>L.Skeleton,Slider:()=>L.Slider,Space:()=>L.Space,Spin:()=>L.Spin,Statistic:()=>L.Statistic,Steps:()=>L.Steps,Switch:()=>L.Switch,Table:()=>L.Table,Tabs:()=>L.Tabs,Tag:()=>L.Tag,TimePicker:()=>B,Timeline:()=>L.Timeline,Tooltip:()=>L.Tooltip,Transfer:()=>L.Transfer,Tree:()=>L.Tree,TreeSelect:()=>L.TreeSelect,Typography:()=>L.Typography,Upload:()=>L.Upload,message:()=>L.message,notification:()=>L.notification,pinyin:()=>ei,version:()=>zu});var a=n(442),o=n.n(a);const l=require("prop-types");var s=n.n(l);const c=(0,a.createContext)({locale:"zh-cn",size:"middle"}),d=require("dayjs");var u=n.n(d);const p={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?"},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:"删除文件"},uploadCropper:{dragableText:"拖放或点击",pasteText:"Ctrl+V 粘贴",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},tour:{prevStep:"上一步",nextStep:"下一步",finish:"结束引导"},guideTracker:{addButton:"添 加",editButton:"保 存",closeButton:"关 闭",finishButton:"结束并保存",label:"新手引导录入",currentStep:"当前步骤:"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"搜索{text}",searchAreaText:"搜索{text},用逗号隔开",gtPlaceholder:"大于",ltPlaceholder:"小于",eqPlaceholder:"等于",neqPlaceholder:"不等于",text:"筛选",nullValue:"空值"},screen:{full:"全屏",cancelFull:"取消全屏"},import:{text:"导 入",textNoSpace:"导入",success:"成功导入 {total} 条记录",error:"导入失败,请检查字段名和数据格式是否正确",settingTitle:"导入设置",importType:"导入模式",insertPos:"插入位置",fillText:"新增",addText:"追加",insertText:"插入"},export:{text:"导 出",textNoSpace:"导出",closeButton:"关 闭",settingTitle:"导出设置",fileName:"文件名",fileType:"文件类型",sheetName:"标题",all:"全部",selected:"选中",custom:"自定义",footSummation:"底部合计",useStyle:"使用样式",warnText:"暂无表格数据或正在导出"},clipboard:{text:"粘 贴",textNoSpace:"粘贴",success:"成功粘贴 {total} 条记录",settingTitle:"粘贴设置",rowIndex:"粘贴起始行",colIndex:"粘贴起始列",content:"粘贴内容",placeholder:"请在此处 ctrl+v 粘贴数据",supportText:"说明:只支持粘贴 Excel 数据"},mergeCell:{cancel:"恢复",confirm:"合并"},print:{text:"打印"},refresh:{text:"刷新"},toolbox:{text:"工具箱"},selectCollection:{text:"行选集合",settingTitle:"行选列表",closeButton:"关 闭"},groupSummary:{text:"汇总",settingTitle:"汇总设置",savedSetting:"保存的汇总设置",saveButton:"保 存",closeButton:"关 闭",confirmButton:"显示汇总",removeText:"移除",configText:"配置名称",resultText:"汇总结果",sumText:"列值汇总",maxText:"列最大值",minText:"列最小值",avgText:"列平均值",countText:"条数汇总",operation:"操作",index:"序号",groupItem:"分组项",summaryColumn:"汇总列",calcFormula:"计算公式"},highSearch:{text:"高级检索",settingTitle:"高级检索设置",searchButton:"开始检索",closeButton:"关 闭",removeText:"移除",andText:"并且",orText:"或者",gtText:"大于",ltText:"小于",gteText:"大于等于",lteText:"小于等于",eqText:"等于",neqText:"不等于",inText:"包含",ninText:"不包含",likeText:"模糊匹配",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",tabPanes:["查找条件","更多条件"],matchCase:"大小写匹配",matchFullchar:"全字符匹配",clear:"清空条件",queryPrev:"查找上一个",queryNext:"查找下一个"}}}};require("dayjs/locale/zh-cn");let h=p;function m(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,r)=>t[r])):e}const f=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const[n,i]=t;let a;const o=n.split(".");let l=h;for(let e=0,t=o.length;e<t;e++){if(a=l[o[e]],e===t-1)return m(a,i);if(!a)return"";l=a}return""},g=e=>{h=e||h,h.name&&u().locale(h.name)};class b extends Error{constructor(e){super(e),this.name="QmDesignError"}}function y(e,t){throw new b(`[${e}] ${t}`)}function v(e,t){console.warn(new b(`[${e}] ${t}`))}const x=e=>["","small","middle","large"].includes(e),E=require("dayjs/plugin/localeData");var S=n.n(E);const w=require("dayjs/plugin/advancedFormat");var C=n.n(w);const T=require("dayjs/plugin/customParseFormat");var N=n.n(T);const I=require("dayjs/plugin/quarterOfYear");var R=n.n(I);const P=require("dayjs/plugin/weekOfYear");var O=n.n(P);const k=require("dayjs/plugin/weekday");var A=n.n(k);u().extend(S()),u().extend(C()),u().extend(N()),u().extend(R()),u().extend(O()),u().extend(A());const L=require("antd"),F=require("rc-picker/es/generate/dayjs");var H=n.n(F);const _=require("antd/es/calendar/generateCalendar");var D=n.n(_);require("antd/es/calendar/style");const $=D()(H()),q=require("antd/es/date-picker/generatePicker");var M=n.n(q);require("antd/es/date-picker/style/index");const j=M()(H());function K(){return K=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},K.apply(this,arguments)}const V=a.forwardRef(((e,t)=>a.createElement(j,K({},e,{picker:"time",mode:void 0,ref:t}))));V.displayName="TimePicker";const z=a.forwardRef(((e,t)=>a.createElement(j.RangePicker,K({},e,{picker:"time",mode:void 0,ref:t}))));z.displayName="RangePicker",V.RangePicker=z;const B=V,U={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?"},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"},uploadCropper:{dragableText:"Drop or click",pasteText:"Ctrl+V Paste",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},tour:{prevStep:"Prev",nextStep:"Next",finish:"Finish"},guideTracker:{addButton:"Add To",editButton:"Save",closeButton:"Close",finishButton:"Finish And Save",label:"Operation guide collection",currentStep:"Current Step: "},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Search {text}",searchAreaText:"Search {text}, separated by commas",gtPlaceholder:"is greater than",ltPlaceholder:"is lesser than",eqPlaceholder:"is equal to",neqPlaceholder:"is not equal to",text:"Filter",nullValue:"Null Value"},screen:{full:"Full Screen",cancelFull:"Cancel Full Screen"},import:{text:"Import",textNoSpace:"Import",success:"Successfully imported {total} records",error:"Import failed, please check that the field name and data format are correct.",settingTitle:"Import setting",importType:"Import type",insertPos:"Insertion position",fillText:"fill",addText:"add",insertText:"insert"},export:{text:"Export",textNoSpace:"Export",closeButton:"Close",settingTitle:"Export setting",fileName:"File name",fileType:"File type",sheetName:"Title",all:"All",selected:"Selected",custom:"Custom",footSummation:"Summation",useStyle:"Use style",warnText:"No table data or exporting"},clipboard:{text:"Paste",textNoSpace:"Paste",success:"Successfully paste {total} records",settingTitle:"Paste setting",rowIndex:"Start row index",colIndex:"Start col index",content:"content",placeholder:"Please paste data here with ctrl+v",supportText:"Note: only excel data can be pasted"},mergeCell:{cancel:"reset",confirm:"merge"},print:{text:"Print"},refresh:{text:"Reload"},toolbox:{text:"Tool box"},selectCollection:{text:"Selected row collection",settingTitle:"Selected row list",closeButton:"Close"},groupSummary:{text:"Summary",settingTitle:"Summary setting",savedSetting:"Saved configuration",saveButton:"Save",closeButton:"Close",confirmButton:"Show summary",removeText:"Remove",configText:"Configuration name",resultText:"Summary result",sumText:"column value summary",maxText:"column max value",minText:"column min value",avgText:"column avg value",countText:"records summary",operation:"Operation",index:"Index",groupItem:"Group item",summaryColumn:"Summary column",calcFormula:"Calculate formula"},highSearch:{text:"Super search",settingTitle:"Super search setting",searchButton:"Start search",closeButton:"Close",removeText:"Remove",andText:"and",orText:"or",gtText:"is greater than",ltText:"is lesser than",gteText:"is equal or greater than",lteText:"is equal or lesser than",eqText:"is equal to",neqText:"is not equal to",inText:"include",ninText:"not include",likeText:"fuzzy matching",configText:"Configuration name",saveButton:"Save",savedSetting:"Saved configuration",operation:"Operation",bracket:"Bracket",fieldName:"Field name",fieldType:"Field type",expression:"Expression",condition:"Condition value",logic:"Logic",noEmpty:"Can not be empty"},fastSearch:{text:"Records location search",settingTitle:"Records location search setting",closeButton:"Close",savedSetting:"Saved configuration",queryCondition:"Please enter query condition",notMatch:"There are no qualified records!",toTheEnd:"It has been found to the end. Do you want to find it from the beginning?",toStart:"The start has been found. Do you want to start from the end?",tabPanes:["Search condition","More conditions"],matchCase:"Case matching",matchFullchar:"Full character matching",clear:"Clear condition",queryPrev:"Find previous",queryNext:"Find next"}}}},W=require("antd/es/locale/zh_CN");var G=n.n(W);const Y=require("antd/es/locale/en_GB");var X=n.n(Y);function Q(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Z={[U.name]:{qm:U,antd:X()},[p.name]:{qm:p,antd:G()}};class J extends a.Component{constructor(e){super(e),this.state={value:{locale:e.locale,size:e.size,global:e.global}},g(Object.assign({},Z,e.global.langPackage)[e.locale].qm)}static getDerivedStateFromProps(e,t){const{locale:r,size:n}=t.value,{locale:i,size:a,global:o}=e;return i!==r&&g(Object.assign({},Z,o.langPackage)[i].qm),i!==r||a!==n?{value:Object.assign({},t.value,{locale:i,size:a})}:null}render(){const{global:e}=this.props,{value:t}=this.state,r=Object.assign({},Z,e.langPackage);return o().createElement(c.Provider,{value:t},o().createElement(L.ConfigProvider,{locale:r[t.locale].antd,componentSize:t.size,autoInsertSpaceInButton:e.autoInsertSpaceInButton},this.props.children))}}Q(J,"propTypes",{locale:s().string,size:(e,t,r)=>{if(!x(e[t]||""))return y("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},theme:s().string,global:s().object}),Q(J,"defaultProps",{locale:"zh-cn",size:"middle",global:{}});const ee=J,te=require("omit.js");var re=n.n(te);const ne=require("lodash-es"),ie="undefined"==typeof window,ae=e=>o().isValidElement(e),oe=e=>ae(e)&&e.type===o().Fragment,le=()=>{},se=()=>!0,ce=async e=>new Promise((t=>setTimeout(t,e))),de=e=>{Promise.resolve().then(e)},ue=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),pe=e=>!!(!e&&0!==e||(0,ne.isArray)(e)&&!e.length||(0,ne.isPlainObject)(e)&&!Object.keys(e).length),he=(e,t)=>t.split(".").reduce(((e,t)=>e?.[t]),e),me=(e,t,r)=>{const n=t.split(".");let i=e;for(let e=0;e<n.length-1;e++){const t=n[e];i[t]&&(0,ne.isPlainObject)(i[t])||(i[t]={}),i=i[t]}i[n[n.length-1]]=r},fe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if((0,ne.isPlainObject)(e)||(0,ne.isArray)(e)){const r=Array.isArray(e),n=r?[]:{};if(t.get(e))return e;t.set(e,n);const i=r?void 0:Object.keys(e);return function(e,t){let r=-1;const n=e.length;for(;++r<n;)t(e[r],r)}(i||e,((r,a)=>{i&&(a=r),n[a]=fe(e[a],t)})),n}return e},ge=e=>(0,ne.isNumber)(e)?`${e}px`:e.toString();function be(){return be=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},be.apply(this,arguments)}function ye(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ve extends a.Component{constructor(){super(...arguments),ye(this,"context",void 0),ye(this,"state",{isLoading:!1}),ye(this,"clickHandle",(async e=>{this.setState({isLoading:!0});try{await(this.props.click?.(e))}catch(e){v("Button","`click`方法执行出错")}this.setState({isLoading:!1})}))}render(){const{size:e,loading:t,authConfig:r,click:n,confirm:i}=this.props,{isLoading:a}=this.state,l=e||this.context.size||"",s=(0,ne.isFunction)(n)?{onClick:this.clickHandle}:null,c={...re()(this.props,["authConfig","click","confirm"]),size:l,loading:a||t||!1,...s};if(r){const{visible:e=1,disabled:t}=r||{};if(!e)return null;t&&(c.disabled=!0)}return i?o().createElement(L.Popconfirm,{title:i.title||f("qm.button.confirmTitle"),disabled:c.disabled,onConfirm:e=>{i.onConfirm?.(),c.onClick?.(e)},onCancel:e=>{i.onCancel?.(e)}},o().createElement(L.Button,be({},c,{onClick:le}),this.props.children)):o().createElement(L.Button,c,this.props.children)}}ye(ve,"propTypes",{click:s().func,confirm:s().shape({title:s().node,onConfirm:s().func,onCancel:s().func})}),ye(ve,"contextType",c);const xe=ve;function Ee(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Se=function(e){return e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small",e}(Se||{});class we extends a.Component{constructor(){super(...arguments),Ee(this,"context",void 0)}render(){const{size:e}=this.props,t=e||this.context.size||"",r=(0,ne.isNumber)(e)?e:Se[e||t||"default"],n={...this.props,size:r};return o().createElement(L.Space,n,this.props.children)}}Ee(we,"contextType",c);const Ce=we,Te=require("classnames");var Ne=n.n(Te);const Ie=e=>`qm-${e}`,Re=require("@ant-design/icons");function Pe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Oe extends a.Component{constructor(){super(...arguments),Pe(this,"context",void 0),Pe(this,"clickHandle",(()=>{const{collapse:e,onCollapseChange:t=le}=this.props;t(!e)}))}render(){const{size:e,label:t,extra:r,collapse:n,bordered:i,disabled:a,id:l,className:s,style:c}=this.props,d=e||this.context.size||"",u=Ie("divider"),p={[u]:!0,[`${u}-borderless`]:!i,[`${u}--lg`]:"large"===d,[`${u}--sm`]:"small"===d};return o().createElement("div",{id:l,className:Ne()(p,s),style:c},o().createElement("span",{className:Ne()(`${u}__title`)},t),o().createElement("div",{className:Ne()(`${u}__extra`)},r),void 0!==n&&o().createElement(L.Button,{type:"link",className:Ne()(`${u}__collapse`),disabled:a,onClick:this.clickHandle},f(n?"qm.divider.collect":"qm.divider.spread"),n?o().createElement(Re.UpOutlined,null):o().createElement(Re.DownOutlined,null)))}}Pe(Oe,"contextType",c),Pe(Oe,"propTypes",{label:s().string,size:(e,t,r)=>{if(!x(e[t]||""))return y("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},extra:s().oneOfType([s().element,s().string]),collapse:s().bool,bordered:s().bool}),Pe(Oe,"defaultProps",{bordered:!0});const ke=Oe,Ae=()=>({height:0,opacity:0}),Le=(e,t)=>"height"===t.propertyName,Fe={motionName:"rc-collapse-motion",onEnterStart:Ae,onEnterActive:e=>({height:e.scrollHeight,opacity:1}),onLeaveStart:e=>({height:e.offsetHeight}),onLeaveActive:Ae,onEnterEnd:Le,onLeaveEnd:Le,motionDeadline:500,leavedClassName:"rc-collapse-content-hidden"},He=require("rc-motion");var _e=n.n(He);const De=o().forwardRef(((e,t)=>{const{forceRender:r,className:n,style:i,boxStyle:a,isActive:l}=e,[s,c]=o().useState(l||r);if(o().useEffect((()=>{(r||l)&&c(!0)}),[r,l]),!s)return null;const d=Ie("collapse");return o().createElement("div",{ref:t,className:Ne()(`${d}-content`,{[`${d}-content-active`]:l,[`${d}-content-inactive`]:!l},n),style:i},o().createElement("div",{className:`${d}-content-box`,style:a},e.children))}));De.displayName="PanelContent";const $e=De;function qe(){return qe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qe.apply(this,arguments)}const Me=e=>{const{defaultActive:t,label:r,extra:n,className:i,style:a,containerStyle:l,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:p}=e,[h,m]=o().useState(!!t),f=Ie("collapse"),g=Ne()({[`${f}`]:!0,[`${f}-active`]:h,[`${f}-disabled`]:c},i);return o().createElement("div",{className:g,style:a},o().createElement(ke,{label:r,extra:n,collapse:h,bordered:s,disabled:c,onCollapseChange:e=>{m(e),p?.(e)}}),o().createElement(_e(),qe({visible:h},Fe,{leavedClassName:`${f}-content-hidden`,forceRender:d,removeOnLeave:u}),((t,r)=>{let{className:n,style:i}=t;return o().createElement($e,{ref:r,prefixCls:f,className:n,style:i,boxStyle:l,isActive:h,forceRender:d},e.children)})))};Me.displayName="QmCollapse";const je=Me,Ke=o().createContext(void 0);function Ve(e,t){((t,r)=>{const n=a.useRef(!0);a.useEffect((()=>(t=>{if(!t)return e()})(n.current)),r),a.useEffect((()=>(n.current=!1,()=>{n.current=!0})),[])})(0,t)}const ze=(e,t,r)=>{e&&t&&r&&e.addEventListener(t,r,!1)},Be=(e,t,r)=>{e&&t&&r&&e.removeEventListener(t,r,!1)},Ue=e=>e.stopPropagation(),We=e=>e.preventDefault(),Ge=(e,t)=>{if(ie||!e||!t)return null;"float"===(t=ue(t))&&(t="cssFloat");try{const r=e.style[t];if(r)return r;const n=window.getComputedStyle(e);return n?n[t]:""}catch(r){return e.style[t]}},Ye=(e,t,r)=>{!ie&&e&&t&&((0,ne.isPlainObject)(t)?Object.keys(t).forEach((r=>{Ye(e,r,t[r])})):(t=ue(t),e.style[t]=r))},Xe=e=>{let t=0,r=e;for(;r;)t+=r.offsetTop,r=r.offsetParent;return t},Qe=(e,t)=>Math.abs(Xe(e)-Xe(t)),Ze=e=>{let t=0,r=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,r+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:r}},Je=(e,t)=>{let r=e;for(;r;){if(r.classList?.contains(t))return r;r=r.parentNode}return null},et=(e,t)=>{if(ie||!e||!t)return!1;let r=e;for(;r;){if(r===t)return!0;r=r.parentNode}return!1},tt=e=>{const{minValues:t,onDragChange:r,onDragging:n}=e,{splitRef:i,direction:a}=o().useContext(Ke),l=o().useRef(ie?null:document.onselectstart),s=o().useMemo((()=>"horizontal"===a),[a]),c=o().useMemo((()=>s?"X":"Y"),[s]),d=o().useRef({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),u=e=>{d.current=Object.assign({},d.current,e)},p=e=>{if(1!==e.buttons)return h();const r=e[`page${c}`]-d.current[`start${c}`],i=[t[0],d.current[`containerSize${c}`]-t[1]];let a=d.current[`firstElementSize${c}`]+r;a=Math.max(i[0],a),a=Math.min(i[1],a),n(a)},h=()=>{u({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),r(!1),Be(document,"mousemove",p),Be(document,"mouseup",h),m()},m=()=>{document.onselectstart!==l.current&&(document.onselectstart=l.current)},g=Ie("split"),b={[`${g}__resize-bar`]:!0,vertical:"vertical"===a,horizontal:"horizontal"===a};return o().createElement("div",{className:Ne()(b),title:f("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=i.current,n=t.children[0];u({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),ze(document,"mousemove",p),ze(document,"mouseup",h),r(!0),l.current=document.onselectstart,document.onselectstart=()=>!1}})};tt.displayName="ResizeBar";const rt=tt,nt=o().forwardRef(((e,t)=>{const{offset:r,className:n,style:i}=e,{direction:a,dragging:l}=o().useContext(Ke),s="vertical"===a?"height":"width",c=Ie("split-pane"),d={[c]:!0,isLocked:l,horizontal:"horizontal"===a,vertical:"vertical"===a,[n]:!!n},u=void 0!==r?{[s]:ge(r)}:{flex:1,[s]:0};return o().createElement("div",{ref:t,className:Ne()(d),style:{...u,...i}},e.children)}));nt.displayName="QmSplitPane";const it=nt;function at(){return at=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},at.apply(this,arguments)}const ot=e=>{const{direction:t="horizontal",defaultValue:r="50%",uniqueKey:n,className:i,style:a,onDragStart:l,onDrag:s=le,onDragEnd:d}=e,{global:u}=o().useContext(c),p=o().useRef(null),h=o().useRef(null),m=e=>Number(e)>0?`${e}px`:(e=>["px","em","vw","vh","%"].some((t=>e.endsWith(t))))(e.toString())?e.toString():`${Number.parseFloat(e)}px`,f=e=>Number.parseInt(e,10),g=e=>{const t=Number.parseInt(e.props?.min||0);return t>=0?t:0},b=o().useMemo((()=>n?`split_${n}`:""),[n]),[y,v]=o().useState(!1),[x,E]=o().useState(m(r));Ve((()=>{y?l?.(f(x)):(d?.(f(x)),localStorage.setItem(b,x),C(b,x))}),[y]),o().useEffect((()=>{S()}),[]);const S=()=>{if(!b)return;const e=localStorage.getItem(b);e?E(m(e)):w(b).then((e=>{localStorage.setItem(b,m(e||r)),S()})).catch((()=>{}))},w=async e=>{const t=u?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},C=async(e,t)=>{const r=u?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},T=o().useMemo((()=>({splitRef:p,direction:t,dragging:y})),[t,y]),N=[];o().Children.map(e.children,(e=>{ae(e)&&!oe(e)&&"QmSplitPane"===e.type?.displayName&&N.push(e)}));const[I,R]=N,P=o().useMemo((()=>[g(I),g(R)]),[I,R]),O=Ie("split"),k={[O]:!0,vertical:"vertical"===t};return o().createElement(Ke.Provider,{value:T},o().createElement("div",{ref:p,className:Ne()(k,i),style:a},o().createElement(it,at({},I.props,{ref:h,offset:x})),o().createElement(rt,{minValues:P,onDragChange:e=>v(e),onDragging:e=>{E(`${e}px`),s(e)}}),o().createElement(it,R.props)))};ot.Pane=it,ot.displayName="QmSplit";const lt=ot,st=require("react-countup");var ct=n.n(st);function dt(){return dt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},dt.apply(this,arguments)}function ut(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class pt extends a.Component{constructor(){super(...arguments),ut(this,"context",void 0)}render(){const{size:e,className:t,style:r}=this.props,n=e||this.context.size||"",i=Ie("countup"),a={[i]:!0,[`${i}--lg`]:"large"===n,[`${i}--sm`]:"small"===n};return o().createElement(ct(),dt({},this.props,{className:Ne()(a,t),style:r}),this.props.children)}}ut(pt,"defaultProps",{duration:2}),ut(pt,"contextType",c);const ht=pt;function mt(){return mt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mt.apply(this,arguments)}function ft(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class gt extends a.Component{constructor(){super(...arguments),ft(this,"context",void 0)}render(){const{size:e,className:t}=this.props,r=e||this.context.size||"",n=Ie("empty"),i={...this.props,image:L.Empty.PRESENTED_IMAGE_SIMPLE},a={[n]:!0,[`${n}--lg`]:"large"===r,[`${n}--sm`]:"small"===r};return o().createElement(L.Empty,mt({},i,{className:Ne()(a,t)}))}}ft(gt,"contextType",c),ft(gt,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const bt=gt;class yt extends a.Component{render(){const{fullHeight:e,className:t,style:r={}}=this.props,n=Ie("spin"),i={[`${n}-full-height`]:e},a={wrapperClassName:Ne()(i,t),...re()(this.props,["fullHeight"]),style:{...r,maxHeight:"none"}};return o().createElement(L.Spin,a,this.props.children)}}var vt,xt,Et;vt=yt,Et={tip:"Loading...",fullHeight:!1},(xt=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(xt="defaultProps"))in vt?Object.defineProperty(vt,xt,{value:Et,enumerable:!0,configurable:!0,writable:!0}):vt[xt]=Et;const St=yt,wt=o().createContext(void 0),Ct=require("resize-observer-polyfill");var Tt=n.n(Ct);const Nt=function(e){for(const t of e){const e=t.target.__resizeListeners__||[];Array.isArray(e)&&e.length&&e.forEach((e=>e(t)))}},It=function(e,t){!ie&&e&&(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new(Tt())(Nt),e.__ro__.observe(e)),e.__resizeListeners__.push(t))},Rt=function(e,t){e&&e.__resizeListeners__&&(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||e.__ro__?.disconnect())};function Pt(e){const[t,r]=a.useState({width:0,height:0});return a.useEffect((()=>{const t=e.current,n=e=>{const{width:t,height:n}=e.contentRect;r({width:t,height:n})};return t&&It(t,n),()=>{t&&Rt(t,n)}}),[e]),t}function Ot(e,t){var r=this;const n=a.useRef(null);a.useEffect((()=>()=>{clearTimeout(n.current),n.current=null}),[]);const i=a.useCallback((function(){for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];n.current&&clearTimeout(n.current),n.current=setTimeout((()=>e.apply(r,a)),t)}),[e,t]);return i}const kt=6,At={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"}},Lt=e=>{const{thumb:t,always:r,barSize:n=kt,direction:i="vertical",onDrag:a=le}=e,{dragging:l,scrollbarElement:s,wrapElement:c}=o().useContext(wt),d=At[i],u=o().useRef(t),p=o().useRef(null),h=o().useRef(null),m=o().useRef({}),f=o().useRef(!1),g=o().useRef(!1),b=o().useRef(ie?null:document.onselectstart),[y,v]=o().useState(!1);o().useEffect((()=>{u.current=t}),[t]),o().useEffect((()=>{const e=s.current;return ze(e,"mousemove",w),ze(e,"mouseleave",C),()=>{S(),Be(document,"mouseup",E),Be(e,"mousemove",w),Be(e,"mouseleave",C)}}),[]);const x=e=>{if(!p.current||!h.current)return;if(!f.current)return;const t=m.current[d.axis];if(!t)return;const r=100*(-1*(p.current.getBoundingClientRect()[d.direction]-e[d.client])-(h.current[d.offset]-t))/p.current[d.offset];c.current[d.scroll]=r*c.current[d.scrollSize]/100,a(!0)},E=()=>{f.current=!1,m.current={[d.axis]:0},Be(document,"mousemove",x),Be(document,"mouseup",E),S(),g.current&&v(!1),a(!1)},S=()=>{document.onselectstart!==b.current&&(document.onselectstart=b.current)},w=()=>{g.current=!1,v(!!u.current.size)},C=()=>{g.current=!0,v(f.current)},T=Ie("scrollbar"),N={[`${T}__bar`]:!0,"is-vertical":"vertical"===i,"is-horizontal":"horizontal"===i},I={[d.reverse]:n},R={[d.size]:t.size,transform:`translate${d.axis}(${t.offset}%)`};return o().createElement(_d,{name:"fade",in:r||l||y,timeout:300},o().createElement("div",{ref:p,className:Ne()(N),style:I},o().createElement("div",{ref:h,className:`${T}__thumb`,style:R,onMouseDown:e=>{e.stopPropagation(),ze(document,"mousemove",x),ze(document,"mouseup",E),f.current=!0,b.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(m.current={[d.axis]:t[d.offset]-(e[d.client]-t.getBoundingClientRect()[d.direction])})}})))},Ft=20,Ht=o().forwardRef(((e,t)=>{const{wrapClassName:r,wrapStyle:n,barWidth:i,always:a,native:l,minSize:s=Ft,onScroll:c}=e,d=o().useRef(null),u=o().useRef(null),p=o().useRef(null),[h,m]=o().useState({size:0,offset:0,ratio:1}),[f,g]=o().useState({size:0,offset:0,ratio:1}),[b,y]=o().useState(!1),x=Pt(d),E=Pt(p);Ve((()=>{!l&&S()}),[E.width,E.height,x.width,x.height]);const S=Ot((()=>{if(!u.current)return;const e=u.current.offsetHeight-4,t=u.current.offsetWidth-4,r=e**2/u.current.scrollHeight,n=t**2/u.current.scrollWidth,i=Math.max(r,s),a=Math.max(n,s),o=r/(e-r)/(i/(e-i)),l=n/(t-n)/(a/(t-a)),c=i+4<e?i:0,d=a+4<t?a:0,p=100*u.current.scrollTop/e*o,b=100*u.current.scrollLeft/t*l;m(Object.assign({},h,{size:d,ratio:l,offset:b})),g(Object.assign({},f,{size:c,ratio:o,offset:p}))}),5),w=e=>{y(e)},C=e=>{(0,ne.isNumber)(e)?u.current.scrollTop=e:v("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=e=>{(0,ne.isNumber)(e)?u.current.scrollLeft=e:v("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};o().useImperativeHandle(t,(()=>({container:d.current,scrollTop:u.current?.scrollTop||0,scrollLeft:u.current?.scrollLeft||0,SET_SCROLL_TOP:C,SET_SCROLL_LEFT:T})));const N=o().useMemo((()=>({dragging:b,scrollbarElement:d,wrapElement:u})),[b]),I=Ie("scrollbar"),R={[`${I}__wrap`]:!0,[`${I}__wrap--hidden`]:!l};return o().createElement("div",{ref:d,className:Ne()(I,e.className),style:e.style},o().createElement("div",{ref:u,className:Ne()(R,r),style:n,onScroll:e=>{const{scrollTop:t,scrollLeft:r}=e.target;!l&&(()=>{if(!u.current)return;const e=u.current.offsetHeight-4,t=u.current.offsetWidth-4,r=100*u.current.scrollTop/e*f.ratio,n=100*u.current.scrollLeft/t*h.ratio;m(Object.assign({},h,{offset:n})),g(Object.assign({},f,{offset:r}))})(),c?.({scrollTop:t,scrollLeft:r})}},o().createElement("div",{ref:p,className:`${I}__view`},e.children)),!l&&o().createElement(wt.Provider,{value:N},o().createElement(Lt,{direction:"horizontal",thumb:h,barSize:i,always:a,onDrag:w}),o().createElement(Lt,{direction:"vertical",thumb:f,barSize:i,always:a,onDrag:w})))}));Ht.displayName="QmScrollbar";const _t=Ht,Dt=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const r=window.URL.createObjectURL(e);let n=document.createElement("a");n.href=r,n.download=decodeURI(t),n.click(),n=null}};function $t(){return $t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$t.apply(this,arguments)}function qt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Mt=async(e,t)=>{let{fileName:r,headers:n,params:i}=t;const a=i?new URLSearchParams(i).toString():"",o=a?e.includes("?")?"&":"?":"",l=await fetch(e+`${o+a}`,{method:"GET",headers:n});if(!l.ok)throw new Error(f("qm.download.error"));const s=await l.blob(),c=l.headers.get("content-disposition"),d=r||(c?c.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));Dt(s,d)};class jt extends a.Component{constructor(){super(...arguments),qt(this,"context",void 0),qt(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:i=[],fileSize:a,maxCount:o,fileList:l=[],beforeUpload:s}=this.props,c=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),d=!a||e.size/1024/1024<a,u=!(o>1)||l.length<o,p=c&&d&&u;if(c||L.message.warning(f("qm.upload.tooltip",{type:i.join(",")})),d||L.message.warning(f("qm.upload.sizeLimit",{size:a})),u||L.message.warning(f("qm.upload.countLimit",{count:o})),!p)return L.Upload.LIST_IGNORE;if(s){const i=s(e,t);if(!0===i)return r(e);if(!1===i)return n("not upload");if(i&&"function"==typeof i.then)try{r(await i)}catch(e){n(e)}}else r(e)})))),qt(this,"doDownload",(async e=>{const{downloadWithHeaders:t,headers:r}=this.props;try{e.url&&await Mt(e.url,{fileName:e.name,...t?{headers:r}:null})}catch(e){L.message.error(f("qm.download.error"))}}))}get $size(){return this.context.size??""}render(){const{fileList:e=[],button:t={},fileDirection:r,disabled:n,readOnly:i,className:a,onPreview:l,onChange:s}=this.props,c=Ie("upload-file"),d={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}--horizontal`]:"horizontal"===r};return o().createElement(L.Upload,$t({className:Ne()(d,a)},re()(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,disabled:n||i,onChange:s,onPreview:async e=>{if("function"==typeof l)return l(e,(t=>this.doDownload(t||e)));n||await this.doDownload(e)},onDownload:async e=>{await this.doDownload(e)}}),this.props.children||i&&e.length?this.props.children:o().createElement(L.Button,{type:t.type??"default",icon:t.icon??o().createElement(Re.UploadOutlined,null),disabled:n||i},t.text||f("qm.upload.text")))}}qt(jt,"contextType",c),qt(jt,"defaultProps",{name:"file",multiple:!0,fileDirection:"vertical",showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}});const Kt=jt;function Vt(){return Vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Vt.apply(this,arguments)}function zt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Bt extends a.Component{constructor(){super(...arguments),zt(this,"context",void 0),zt(this,"state",{loading:!1}),zt(this,"downloadHandle",(async()=>{this.setState({loading:!0});try{const{action:e,fileName:t,headers:r,params:n,beforeDownload:i=se}=this.props,a=(0,ne.isString)(e)?e:await this.getActionUrl();if(!a)return v("Download","参数 `action` 有误!");if(!i(a))return;await Mt(a,{fileName:t,headers:r,params:n}),await ce(100),this.props.onSuccess?.(),L.message.success(f("qm.download.success"))}catch(e){this.props.onError?.(e),L.message.error(f("qm.download.error"))}this.setState({loading:!1})}))}async getActionUrl(){const e=this.props.action;if(e.api)try{const t=await e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}render(){const{size:e}=this.props,{loading:t}=this.state,r=e||this.context.size||"",n=re()(this.props,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return o().createElement(L.Button,Vt({},n,{size:r,loading:t,onClick:this.downloadHandle}),this.props.children)}}zt(Bt,"propTypes",{action:s().oneOfType([s().string,s().shape({api:s().func.isRequired,params:s().object})]),size:(e,t,r)=>{if(!x(e[t]||""))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},fileName:s().string,headers:s().object,withCredentials:s().bool,params:s().object,beforeDownload:s().func,onSuccess:s().func,onError:s().func}),zt(Bt,"defaultProps",{icon:o().createElement(Re.DownloadOutlined,null),children:f("qm.download.text"),withCredentials:!1}),zt(Bt,"contextType",c);const Ut=Bt,Wt=require("add-dom-event-listener");var Gt=n.n(Wt);const Yt=require("scroll-into-view-if-needed");var Xt=n.n(Yt);class Qt extends a.Component{renderLabel(){const{activeKey:e,labels:t,onTabClick:r}=this.props;return t.map(((t,n)=>{const i={item:!0,actived:n===e};return o().createElement("div",{key:n,className:Ne()(i),onClick:e=>r(n,e)},o().createElement("span",null,t))}))}render(){return o().createElement(o().Fragment,null,this.renderLabel())}}const Zt=Qt;class Jt extends a.Component{render(){const{label:e,showDivider:t,className:r,style:n}=this.props,i=Ie("anchor-item"),a={[i]:!0};return o().createElement("div",{className:Ne()(a,r),style:n},t&&o().createElement(ke,{label:e,style:{marginBottom:10}}),this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Jt,"displayName","QmAnchorItem");const er=Jt;function tr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class rr extends a.Component{get __is_conf(){return!!this.props.labelList?.length}constructor(e){super(e),tr(this,"context",void 0),tr(this,"currentState","ready"),tr(this,"itemsTotal",void 0),tr(this,"timer",void 0),tr(this,"scrollEvent",void 0),tr(this,"scrollRef",(0,a.createRef)()),tr(this,"onScrollHandle",(e=>{if("ready"!==this.currentState)return;const t=this.findCurrentIndex(e.target.scrollTop);-1!==t&&this.setState({activeKey:t})})),tr(this,"onTabClickHandle",(e=>{const t=this.getTargetElement(e);t&&(this.setState({activeKey:e}),this.currentState="stop",this.timer&&clearTimeout(this.timer),Xt()(t,{block:"start",behavior:"smooth",boundary:this.scrollRef.current}),this.timer=setTimeout((()=>this.currentState="ready"),500))})),tr(this,"SCROLL_TO_ITEM",(e=>{e=(e=e<0?0:e)>this.itemsTotal?this.itemsTotal:e,this.onTabClickHandle(e)})),this.state={activeKey:e.defaultActiveIndex||0}}componentDidMount(){this.initialHandle(),this.scrollEvent=Gt()(this.scrollRef.current,"scroll",(0,ne.throttle)(this.onScrollHandle,60))}componentWillUnmount(){this.scrollEvent.remove()}initialHandle(){const{activeKey:e}=this.state;e>0&&(this.scrollRef.current.scrollTop=Qe(this.getTargetElement(e),this.scrollRef.current))}createDistances(){const{labelList:e=[]}=this.props;return(this.__is_conf?e.map((e=>document.getElementById(e.id))):Array.from(this.scrollRef.current?.children||[])).map((e=>Qe(e,this.scrollRef.current)))}findCurrentIndex(e){const t=Math.abs(e),r=this.createDistances();let n=-1;for(let e=0;e<r.length;e++){const i=r[e],a=r[e+1]||1e4;t>=i-1&&t<a&&(n=e)}return n}getTargetElement(e){const{labelList:t=[]}=this.props;return this.__is_conf?document.getElementById(t[e].id):this.scrollRef.current.children[e]}render(){const{activeKey:e}=this.state,{size:t,labelWidth:r,tabPosition:n,labelList:i=[],onTabClick:a,className:l,style:s}=this.props,c=t||this.context.size||"",d=Ie("anchor"),u={[d]:!0,[`${d}-left`]:"left"===n,[`${d}-top`]:"top"===n,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c},p=[];o().Children.map(this.props.children,(e=>{ae(e)&&!oe(e)&&"QmAnchorItem"===e.type?.displayName&&p.push(e)}));const h=this.__is_conf?i.map((e=>e.label)):p.map((e=>e.props.label)),m=this.__is_conf?i.map((e=>e.id)):p.map(((e,t)=>e.props["data-id"]||t.toString()));return this.itemsTotal=h.length,o().createElement("div",{className:Ne()(u,l),style:s},o().createElement("div",{className:Ne()("anchor-nav"),style:{width:r?ge(r):""}},o().createElement(Zt,{activeKey:e,labels:h,onTabClick:(e,t)=>{this.onTabClickHandle(e),a?.({label:h[e],id:m[e]},t)}})),o().createElement("div",{ref:this.scrollRef,className:Ne()("anchor-container")},this.__is_conf?this.props.children:p))}}tr(rr,"Item",er),tr(rr,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},labelWidth:(e,t,r)=>{if("number"!=typeof(n=e[t])&&void 0!==n&&!["px","rem","em","vw","vh","%"].some((e=>n.endsWith(e)))&&!n.startsWith("calc"))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.");var n},labelList:s().arrayOf(s().shape({id:s().string,label:s().string}))}),tr(rr,"defaultProps",{tabPosition:"left"}),tr(rr,"contextType",c);const nr=rr;class ir extends a.Component{render(){return o().createElement(L.Tabs.TabPane,this.props,this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ir,"displayName","QmTabPane");const ar=ir;function or(){return or=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},or.apply(this,arguments)}function lr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class sr extends a.Component{constructor(){super(...arguments),lr(this,"context",void 0)}render(){const{items:e,size:t,tabPosition:r,tabBarGutter:n,className:i,authConfig:a}=this.props,l=t||this.context.size||"",s=Ie("tabs"),c={[s]:!0,[`${s}--lg`]:"large"===l,[`${s}--sm`]:"small"===l},d={...re()(this.props,["items","authConfig"]),size:l,tabBarGutter:n??(["top","bottom"].includes(r)?30:0)},u=[];o().Children.map(this.props.children,(e=>{ae(e)&&!oe(e)&&"QmTabPane"===e.type?.displayName&&u.push(e)}));const p=e?[...e]:u.map((e=>{let{key:t,props:r}=e;return{key:t,label:r.tab,disabled:r.disabled,closable:r.closable,forceRender:r.forceRender,children:r.children}}));if(a){const{fieldList:e=[]}=a||{};for(let t=0;t<p.length;t++){const r=p[t],n=e.find((e=>e.dataIndex===r.key)),{visible:i=1,disabled:a}=n||{};i?a&&(r.disabled=!0):(p.splice(t,1),t--)}}return o().createElement(L.Tabs,or({},d,{items:p,className:Ne()(c,i)}))}}lr(sr,"TabPane",ar),lr(sr,"contextType",c),lr(sr,"defaultProps",{tabPosition:"top"});const cr=sr;function dr(){return dr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},dr.apply(this,arguments)}function ur(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class pr extends a.Component{constructor(){super(...arguments),ur(this,"context",void 0),ur(this,"titleRef",o().createRef()),ur(this,"$drawer",null),ur(this,"opened",!1),ur(this,"state",{fullscreen:!1,spinning:!1,sloading:!1}),ur(this,"afterVisibleChange",(e=>{const{loading:t}=this.props;e?(this.opened=!0,(0,ne.isUndefined)(t)&&setTimeout((()=>this.setState({spinning:!1})),100)):(this.props.onClosed?.(),this.setState({fullscreen:!1}))})),ur(this,"toggleHandle",(()=>{this.$drawer=Je(this.titleRef.current,"ant-drawer-content-wrapper"),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),ur(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),ur(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}componentWillUnmount(){this.$drawer=null}componentDidUpdate(e,t){const{visible:r,open:n,loading:i,destroyOnClose:a}=this.props,o=n??r,l=e.open??e.visible,{fullscreen:s}=this.state;o&&o!==l&&(!a&&this.opened||(0,ne.isUndefined)(i)&&this.setState({spinning:!0})),this.$drawer&&s!==t.fullscreen&&Ye(this.$drawer,s?{width:"100%"}:{width:ge(this.props.width||"72%")})}renderTitle(){const{fullscreen:e}=this.state,{title:t,showHeader:r,showFullScreen:n}=this.props;return o().createElement(o().Fragment,null,o().createElement("span",{ref:this.titleRef,className:Ne()("text")},r&&t),n&&o().createElement("button",{type:"button",className:Ne()("full-screen"),onClick:this.toggleHandle},o().createElement(e?Re.FullscreenExitOutlined:Re.FullscreenOutlined)))}render(){const{spinning:e,sloading:t}=this.state,{visible:r,open:n,size:i,className:a,loading:l,showHeader:s,maskClosable:c,onClose:d}=this.props,u=this.context.global,p=i||this.context.size||"",h=Ie("drawer"),m={[h]:!0,"no-header":!s,[`${h}--lg`]:"large"===p,[`${h}--sm`]:"small"===p};return o().createElement(L.Drawer,dr({},re()(this.props,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:n??r,maskClosable:c??u?.maskClosable??!1,className:Ne()(m,a),title:this.renderTitle(),footer:null,onClose:d,afterOpenChange:this.afterVisibleChange}),this.props.children,(l||t||e)&&o().createElement(St,{spinning:!0,className:Ne()("spinning")}))}}ur(pr,"contextType",c),ur(pr,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Drawer","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:s().bool}),ur(pr,"defaultProps",{width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null});const hr=pr,mr=require("react-draggable");var fr=n.n(mr);function gr(){return gr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},gr.apply(this,arguments)}function br(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const yr="10vh";var vr=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none",e}(vr||{});class xr extends a.Component{constructor(){super(...arguments),br(this,"context",void 0),br(this,"$event",null),br(this,"draggleRef",o().createRef()),br(this,"opened",!1),br(this,"state",{fullscreen:!1,spinning:!1,sloading:!1,disabled:!0,bounds:{left:0,top:0,bottom:0,right:0},position:void 0}),br(this,"addMouseDownEvent",(()=>{this.$event||(this.$event=Gt()(document.body,"mousedown",Ue))})),br(this,"removeMouseDownEvent",(()=>{this.$event&&(this.$event?.remove(),this.$event=null)})),br(this,"onStart",((e,t)=>{const{clientWidth:r,clientHeight:n}=window.document.documentElement,i=this.draggleRef.current.getBoundingClientRect();i&&this.setState({bounds:{left:-i.left+t.x,right:r-(i.right-t.x)-1,top:-i.top+t.y,bottom:n-(i.bottom-t.y)-1}})})),br(this,"toggleHandle",(e=>{const t=Je(e.target,"ant-modal");if(!t)return;const r=t.querySelector(".ant-modal-body"),{width:n,height:i,showHeader:a}=this.props,{fullscreen:o}=this.state;o?(Ye(t,{width:ge(n||"60%"),height:"auto",top:yr}),Ye(r,{height:i?ge(i):this.defaultHeight,maxHeight:"auto"===i?this.defaultHeight:""})):(Ye(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Ye(r,{height:`calc(100vh - ${vr[a?this.$size:"none"]}px)`,maxHeight:""})),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),br(this,"afterVisibleChange",(()=>{const{onClosed:e}=this.props;e?.(),this.setState({fullscreen:!1})})),br(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),br(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}get $size(){const{size:e}=this.props;return e||this.context.size||""}get defaultHeight(){return`calc(100vh - ${yr} - ${yr} - ${vr[this.props.showHeader?this.$size:"none"]}px)`}componentDidUpdate(e,t){const{visible:r,open:n,loading:i,stopMouseDownEvent:a,destroyOnClose:o}=this.props,l=n??r,s=e.open??e.visible,{fullscreen:c}=this.state;if(l&&l!==s){if(!o&&this.opened||(0,ne.isUndefined)(i)&&this.setState({spinning:!0}),a&&this.addMouseDownEvent(),!o&&this.opened)return;setTimeout((()=>{this.opened=!0,(0,ne.isUndefined)(i)&&this.setState({spinning:!1})}),400)}l||this.removeMouseDownEvent(),c!==t.fullscreen&&(c?this.setState({position:{x:0,y:0}}):this.setState({position:void 0}))}renderTitle(){const{fullscreen:e,disabled:t}=this.state,{title:r,showHeader:n,showFullScreen:i}=this.props;return o().createElement("div",{onMouseOver:()=>{t&&this.setState({disabled:!1})},onMouseOut:()=>{this.setState({disabled:!0})}},o().createElement("span",{className:Ne()("text")},n&&r),i&&o().createElement("button",{type:"button",className:Ne()("full-screen"),onClick:this.toggleHandle},o().createElement(e?Re.FullscreenExitOutlined:Re.FullscreenOutlined)))}render(){const{spinning:e,sloading:t,fullscreen:r,disabled:n,bounds:i,position:a}=this.state,{visible:l,open:s,height:c,className:d,loading:u,draggable:p,showHeader:h,maskClosable:m,bodyStyle:f,onClose:g}=this.props,b=this.context.global,y=Ie("modal"),v={height:c?ge(c):this.defaultHeight,maxHeight:"auto"===c?this.defaultHeight:"",overflow:"auto"},x={[y]:!0,"no-header":!h,[`${y}--lg`]:"large"===this.$size,[`${y}--sm`]:"small"===this.$size};return o().createElement(L.Modal,gr({},re()(this.props,["visible","loading","showFullScreen","maskClosable","stopMouseDownEvent","onClose","onClosed"]),{open:s??l,maskClosable:m??b?.maskClosable??!1,className:Ne()(x,d),title:this.renderTitle(),footer:null,bodyStyle:Object.assign({},v,f),onCancel:g,afterClose:this.afterVisibleChange,modalRender:e=>o().createElement(fr(),{disabled:!p||n||r,bounds:i,position:a,onStart:(e,t)=>this.onStart(e,t)},o().createElement("div",{ref:this.draggleRef},e))}),this.props.children,(u||t||e)&&o().createElement(St,{spinning:!0,className:Ne()("spinning")}))}}br(xr,"contextType",c),br(xr,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Modal","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:s().bool}),br(xr,"defaultProps",{width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:yr}});const Er=xr,Sr=require("memoize-one");var wr=n.n(Sr);const Cr=(0,a.createContext)(void 0),Tr=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],Nr={operations:function(e){const t=e.split(" "),r=[];let n=0;r[n]=[];for(let e=0;e<t.length;e++)Tr.includes(t[e])?(r[n]=r[n].join(" "),n++,r[n]=[]):r[n].push(t[e]);return r[n]=r[n].join(" "),r},number_operations:function(e){return this.operations(e).length},string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";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 r=0,n=(e=Array.isArray(e)?e:[e]).length;r<n;r++)t+="number"==typeof e[r]?e[r]:"'"+e[r]+"'",r<n-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,r){return e.split(t).join(r)},replace_symbols:function(e){return e=this.find_replace(e," AND "," && "),e=this.find_replace(e," and "," && "),e=this.find_replace(e," OR "," || "),e=this.find_replace(e," or "," || "),e=this.find_replace(e," <> "," != "),e=this.find_replace(e," LIKE "," like "),e=this.find_replace(e," LIKES "," likes "),e=this.find_replace(e," IN "," in "),this.find_replace(e," NIN "," nin ")}},Ir=["==","<",">","<=",">=","!=","like","likes","in","nin"],Rr=function(e,t){let r="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?r+=" "+e[t]+" ":r+=e[t];const n=r.split(" ").filter((e=>""!==e));for(let e=0;e<n.length;e++)Ir.includes(n[e])&&("this"!=n[e-1]?n[e-1]=t+"."+n[e-1]:n[e-1]=t),Ir.includes(n[e])&&(n.splice(e-1,3,`__query__(${n[e-1]}, '${n[e]}', ${n[e+1]})`),e-=2);return n.join(" ")},Pr=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,Or=["string","number","boolean","symbol"],kr=e=>Or.includes(typeof e),Ar=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Lr=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(Pr,"\\$1"),"i");window.__query__=function(){return((e,t,r)=>{e=e??"";let n=!0;switch(t){case"like":n=null!==e.toString().match(Lr(r));break;case"likes":n=r.split(/,|,/).some((t=>null!==e.toString().match(Lr(t))));break;case"in":kr(r)&&(r=[r]),Array.isArray(r)&&(n=Array.isArray(e)?r.every((t=>e.includes(t))):r.includes(e));break;case"nin":kr(r)&&(r=[r]),Array.isArray(r)&&(n=!(Array.isArray(e)?r.some((t=>e.includes(t))):r.includes(e)));break;case"!=":case"<>":n=(Ar(e)?e.slice(0,10):e)!=r;break;case"<":n=(Ar(e)?e.slice(0,10):e)<r;break;case"<=":n=(Ar(e)?e.slice(0,10):e)<=r;break;case">":n=(Ar(e)?e.slice(0,10):e)>r;break;case">=":n=(Ar(e)?e.slice(0,10):e)>=r;break;default:n=(Ar(e)?e.slice(0,10):e)==r}return n})(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])};const Fr=Nr.stringify,Hr=Nr.array_format,_r=function(e){let t=0;const r=e.length;for(let n=0;n<r;n++){const r=e.charAt(n);"("===r&&t++,")"===r&&t--}return 0===t},Dr=(e,t,r)=>{let n=[];t=Nr.replace_symbols(t);try{if(r){const r=new Function("record",`return ${Rr(t,"record")};`);n=gn(e,(e=>r(e)))}else{const r=new Function("array","i",`return ${Rr(t,"array[i]")};`);for(let t=0,i=e.length;t<i;t++)r(e,t)&&n.push(e[t])}}catch(t){v("Table","组件 `initialFilter` 参数有误!"),n=e}return n},$r=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...$r(e.children)):t.push(e)})),t},qr=e=>e.filter((e=>(e.children&&(e.children=qr(e.children)),!e.hidden&&!e.noAuth))),Mr=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Mr(e.children))})),t},jr=(e,t)=>e.map((e=>(e.children&&(e.children=jr(e.children,t)),t?.(e),e))),Kr=(e,t)=>{for(const r of e){if(r.dataIndex===t)return r;if(r.children){const e=Kr(r.children,t);if(e)return e}}return null},Vr=e=>{const t=e.children;return t?t[0].children?Vr(t[0]):t[0]:e},zr=e=>{const t=e.children;return t?t[t.length-1].children?zr(t[t.length-1]):t[t.length-1]:e},Br=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Ur=(e,t)=>{for(const r of e){if(r.rowKey===t)return r;if(r.children){const e=Ur(r.children,t);if(e)return e}}return null},Wr=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Wr(e.children))})),t},Gr=e=>{let t=1;const r=(e,n)=>{if(n&&(e.level=n.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((n=>{e.fixed?n.fixed=e.fixed:delete n.fixed,r(n,e),t+=n.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,r(e,null)}));const n=[];for(let e=0;e<t;e++)n.push([]);return Mr(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n},Yr=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{left:0,top:0};if(e){const n=e.parentNode;if(r.top+=e.offsetTop,r.left+=e.offsetLeft,n&&n!==document.documentElement&&n!==document.body&&(r.top-=n.scrollTop,r.left-=n.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return Yr(e.offsetParent,t,r)}return r},Xr=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,Qr=(e,t)=>(0,ne.transform)(e,((e,r,n)=>{(0,ne.isEqual)(r,t[n])||(e[n]=(0,ne.isPlainObject)(r)&&(0,ne.isPlainObject)(t[n])?Qr(r,t[n]):r)})),Zr=(e,t)=>(0,ne.get)(e,t)??"",Jr=(e,t,r,n)=>{n>=0&&null!=r&&(r=Number(r).toFixed(n)),(0,ne.set)(e,t,r??"")},en=(e,t)=>{if(!t.includes("|"))return Zr(e,t);const r=[];return t.split("|").forEach((t=>{t&&r.push(Zr(e,t))})),r.every((e=>!e))?"":r.join(" | ")},tn=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),rn=e=>{const t=(e=e.toString()).split("."),r="-"===t[0].charAt(0)?"-":"";let n=r?t[0].slice(1):t[0],i="";for(;n.length>3;)i=`,${n.slice(-3)}${i}`,n=n.slice(0,n.length-3);return n&&(i=n+i),`${r}${i}${t[1]?`.${t[1]}`:""}`},nn=(e,t)=>{const r=e.toString();if(!tn(r)||0===t)return e;const n=Number.parseFloat(r).toString(),i=n.indexOf(".");if(-1===i)return n+"."+"0".repeat(t);const a=Math.max(0,t-(n.length-i-1));return n+"0".repeat(a)},an=(e,t)=>e?u()(e,t):null,on=(e,t)=>e?u()(e).format(t):"",ln=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=(new Date).getTime();return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))},sn=e=>{const t=[];if(o().isValidElement(e)){const{children:r}=e.props;o().Children.forEach(r,(e=>{t.push(...sn(e))}))}else t.push(e);return t},cn=e=>sn(e).join(""),dn=e=>e.filter((e=>!e._group)),un=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="";if(Array.isArray(e)){let n=0;for(let i=0,a=e.length;i<a;i++){const a=e[i];if(!a.fieldName)continue;const o=Array.isArray(a.condition)?Hr(a.condition):Fr(a.condition,"^");r+=`${a.bracketLeft} ${t?`${a.fieldName}|${a.fieldType}`:a.fieldName} ${a.expression} ${o} ${a.bracketRight} ${a.logic} `,n=a.logic.length}r=r.slice(0,-1*n-2)}else{const n=5;for(const n in e){const[i,a]=n.includes("|")?n.split("|"):[n,""],o=e[n];for(const e in o)r+=`${t?`${i}|${a}`:i} ${e} ${Array.isArray(o[e])?Hr(o[e]):Fr(o[e],"^")} and `}r=r.slice(0,-1*n)}return r.replace(/\s+/g," ").trim()},pn=function(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((r=>{const n=JSON.stringify((t=>{const r=[];return e.forEach((e=>r.push(Zr(t,e)))),r})(r));t[n]=t[n]||[],t[n].push(r)})),Object.keys(t).map((e=>t[e]))},hn=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].dataIndex===t)return[e[r]];if(Array.isArray(e[r].children)){const n=hn(e[r].children,t);if(n)return[e[r],n].flat()}}},mn=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].rowKey===t)return[t];if(Array.isArray(e[r].children)){const n=mn(e[r].children,t);if(n)return[e[r].rowKey,n].flat()}}},fn=(e,t)=>{for(const r of e){if(Array.isArray(r.children)){const e=fn(r.children,t);if(e)return e}if(t(r))return r}return null},gn=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&gn(e.children,t),t(e)||e.children&&e.children.length))),bn=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),yn=80,vn="1",xn="0",En=400,Sn=["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"],wn={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let Cn=function(e){return e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year",e}({}),Tn=function(e){return e.date="YYYY-MM-DD HH:mm:ss",e.datetime="YYYY-MM-DD HH:mm:ss",e.exactdate="YYYY-MM-DD",e.week="YYYY-wo",e.month="YYYY-MM",e.quarter="YYYY-[Q]Q",e.year="YYYY",e}({}),Nn=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const In={items:s().arrayOf(s().shape({type:s().string.isRequired,fieldName:s().string.isRequired})),initialValues:s().object,initialExtras:s().object,layout:s().oneOf(["horizontal","vertical"]),size:(e,t,r)=>{if(!x(e[t]||""))return y("Form","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},cols:s().number,customClass:s().string,compactMode:s().bool,labelWidth:s().oneOfType([s().number,s().string]),labelAlign:s().oneOf(["left","right"]),labelWrap:s().bool,formType:s().oneOf(["default","search","onlyShow"]),disabled:s().bool,uniqueKey:s().string,defaultRows:s().number,defaultExpand:s().bool,searchButtonCols:s().number,scrollToFirstError:s().bool,authConfig:s().object,isAutoFocus:s().bool,isCollapse:s().bool,isFieldsDefine:s().bool,isSearchBtn:s().bool,isSubmitBtn:s().bool,fieldsChange:s().func,onValuesChange:s().func,onFieldsChange:s().func,onFinish:s().func,onFinishFailed:s().func,onReset:s().func,onCollapse:s().func},Rn={layout:"horizontal",labelWidth:yn,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:le,onFieldsChange:le,onFinish:le,onFinishFailed:le,onReset:le,onCollapse:le},Pn=(e,t)=>{if(!e)return null;if(t===Tn.week){const t=e.match(/^(\d{4})-(\d+)/);return t?u()().year(Number(t[1])).week(Number(t[2])):null}if(t===Tn.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?u()().year(Number(t[1])).quarter(Number(t[2])):null}return u()(e,t)},On=(e,t)=>e?u()(e).format(t):"",kn=e=>""===e||null==e,An=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let n="";for(let t=0,i=r.length;t<i;t++)n+=(e[r[t].trim()]??"")+(t===i-1?"":" | ");return n},Ln=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const i=t[n].split("|"),a=r[n].split("|");i.forEach(((t,r)=>e[t]=e[a[r]]))}else e[t[n]]=e[r[n]]},Fn=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const i=t[n].split("|"),a=r[n].split("|");i.forEach(((t,r)=>e[t]=e[a[r]]))}else e[t[n]]=e[r[n]]},Hn=(e,t,r)=>e.map((e=>{const n={value:e[t],text:e[r]};return e.disabled&&(n.disabled=!0),e.isLeaf&&(n.isLeaf=!0),!(0,ne.isUndefined)(e.selectable)&&(n.selectable=e.selectable),Array.isArray(e.children)&&(n.children=Hn(e.children,t,r)),n})),_n=(e,t)=>{for(const r of e){if(r.value===t)return r;if(Array.isArray(r.children)){const e=_n(r.children,t);if(e)return e}}return null},Dn=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=[];return e.forEach((e=>{e.value==t.split(",")[r]&&n.push(e),Array.isArray(e.children)&&n.push(...Dn(e.children,t,r+1))})),n},$n=e=>ae(e)||"string"==typeof e,qn=e=>ae(e)?sn(e).join(""):e??"",Mn=(e,t,r,n)=>{const i={};return i.filters=e.filters?.filter((e=>"1"===e.isQuery)).map((e=>{const t={type:e.type,label:e.label,fieldName:e.fieldName,options:{}};return Array.isArray(e.dicData)&&(t.options.itemList=e.dicData),t}))||[],i.table={columns:e.columns||[],rowKey:e.valueName},i.fieldsDefine={valueKey:e.valueKey||e.valueName},i.fieldAliasMap={[n?"textKey":t]:e.displayName[0],[n?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(i.table.fetch={api:r(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(i.echoRequest={fetchApi:r(e.echoSetting.api),formatter:t=>Object.assign({},t,{[e.echoSetting.paramKey]:t.key??t.keys}),dataKey:e.echoSetting.dataKey},e.echoSetting.displayKey&&(i.echoRequest.fieldAliasMap={[n?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(i.tree={fetch:{api:r(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{const t={};return e.treeSetting.relativeTable?.forEach((e=>t[e.tableField]=e.treeField)),t}}),e.emmediateSetting&&(i.columns=e.emmediateSetting.columns,i.request={fetchApi:r(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),i},jn={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"}},Kn="阿",Vn="鿿",zn=1,Bn=2,Un=3;let Wn,Gn=null;function Yn(e){return e||null===Gn?("object"==typeof Intl&&Intl.Collator?(Wn=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Gn=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Gn=!1,Gn):Gn}function Xn(e){const t=jn.UNIHANS,r=jn.PINYINS,n=jn.EXCEPTIONS,i={source:e};if(e in n)return i.type=Bn,i.target=n[e],i;let a,o=-1;if(e.charCodeAt(0)<256)return i.type=zn,i.target=e,i;if(a=Wn.compare(e,Kn),a<0)return i.type=Un,i.target=e,i;if(0===a)i.type=Bn,o=0;else{if(a=Wn.compare(e,Vn),a>0)return i.type=Un,i.target=e,i;0===a&&(i.type=Bn,o=t.length-1)}if(i.type=Bn,o<0){let r=0,n=t.length-1;for(;r<=n;){o=~~((r+n)/2);const i=t[o];if(a=Wn.compare(e,i),0===a)break;a>0?r=o+1:n=o-1}}return a<0&&o--,i.target=r[o],i.target||(i.type=Un,i.target=i.source),i}function Qn(e){return"string"==typeof e&&Yn()?e.split("").map((e=>Xn(e))):e}const Zn={isSupported:Yn,parse:Qn,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(jn)})))},genToken:Xn,convertToPinyin:(e,t,r)=>Qn(e).map((e=>t&&e.type===Bn?e.target.toLowerCase():e.target)).join(r||"")},Jn={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}};Zn.isSupported()&&Jn.shouldPatch(Zn.genToken)&&Zn.patchDict(Jn);const ei=Zn,ti=e=>{const{value:t,bordered:r}=e;return o().createElement(L.Input,{value:t,title:t,bordered:r,readOnly:!0})};ti.displayName="FormItemView";const ri=ti;function ni(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ii(){return ii=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ii.apply(this,arguments)}const{Option:ai}=L.Select,oi=e=>{const{$$form:t}=o().useContext(Cr),{value:r,items:n,multiple:i,loading:a,onChange:l,onValuesChange:s}=e,{fieldName:c,options:d={},style:u={},placeholder:p=f("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,readOnly:g,disabled:b}=e.option,{itemList:y=[],filterable:v=!0,listHeight:x=En,collapseTags:E,maxTagTextLength:S,openPyt:w=!0}=d,C=pe(y)?n:y,T=e=>C.find((t=>t.value===e))?.text||e?.toString()||"",N=e=>i?e?.map((e=>T(e))).join(",")||"":T(e);return t.isOnlyShow?o().createElement(ri,{value:N(r),bordered:h}):o().createElement(L.Select,ii({value:r,mode:i?"multiple":void 0,popupClassName:`form-popper__${c}`,placeholder:p,style:u,loading:a,bordered:h,allowClear:m,disabled:b,showSearch:v,listHeight:x,maxTagCount:E?"responsive":void 0,maxTagTextLength:S},i?{title:N(r)}:null,{filterOption:(e,t)=>{const r=t?.children?.toString()||"",n=ei.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(w?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{l?.(e),s(e,N(e),C)})(e)}}),C.map((e=>o().createElement(ai,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class li extends a.Component{constructor(){super(...arguments),ni(this,"context",void 0),ni(this,"state",{itemList:[],loading:!1}),ni(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:i="value",textKey:a="text",callback:o}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,n)??[],r=t.map((e=>({value:e[i],text:e[a]})));this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,ne.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:r}=this.state,{type:n,label:i,tooltip:a,fieldName:l,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,buttonAfter:h,validateTrigger:m,rules:f=[],onChange:g=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(i),className:Ne()(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ge(d)},required:e.getFormItemRequired(f)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:l,noStyle:!0,rules:f,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(i)}},o().createElement(oi,{option:this.props.option,items:t,loading:r,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{g(t,r,n),e.setViewValue(l,r)}}))),h&&o().createElement(L.Col,null,e.renderFormItemButton(l,h)),p&&o().createElement(L.Col,{flex:ge(p.labelWidth||yn)},e.renderFormItemExtra({fieldName:l,...p}))))}}ni(li,"contextType",Cr);const si=li;function ci(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const di=e=>{const{$$form:t}=o().useContext(Cr),{value:r,onChange:n,onValuesChange:i}=e,{label:a,options:l={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:p=xn,trueValue:h=vn}=l;return o().createElement(L.Checkbox,{checked:r===h,style:s,disabled:d||t.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{n?.(e),i(e,f(e===h?"am.form.trueText":"am.form.falseText"))})(t?h:p)}},u?a:null)};class ui extends a.Component{constructor(){super(...arguments),ci(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option,{labelToCheckbox:m}=l;return o().createElement(L.Form.Item,{label:m?" ":e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(di,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...d}))))}}ci(ui,"contextType",Cr);const pi=ui,hi=require("react-sortablejs");function mi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class fi extends a.Component{constructor(){super(...arguments),mi(this,"context",void 0),mi(this,"linkRef",o().createRef()),mi(this,"state",{visible:!1}),mi(this,"getFormFieldsConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),mi(this,"saveFormFieldsConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),mi(this,"resetFieldsHandle",(e=>{const t=e.map((e=>{const t=this.props.items.find((t=>t.fieldName===e.fieldName))||fe(e);return Object.assign(t,{hidden:e.hidden})}));this.changeHandle(t),this.setLocalFields(t)}))}get formUniqueKey(){return this.props.uniqueKey?`form_${this.props.uniqueKey}`:""}componentDidMount(){this.initLocalfields()}getLocalFields(){if(!this.formUniqueKey)return;const e=JSON.parse(localStorage.getItem(this.formUniqueKey));return e||this.getFormFieldsConfig(this.formUniqueKey).then((e=>{e?(localStorage.setItem(this.formUniqueKey,JSON.stringify(e)),this.initLocalfields()):this.context.global?.getComponentConfigApi&&this.setLocalFields(this.props.items)})).catch((()=>{})),e?(0,ne.xor)(e.map((e=>e.fieldName)),this.props.items.map((e=>e.fieldName))).length>0?this.props.items.map((t=>{const{fieldName:r}=t,n=e.find((e=>e.fieldName===r));return n?((0,ne.isUndefined)(n.hidden)||(t.hidden=n.hidden),t):t})):e.map((e=>({...this.props.items.find((t=>t.fieldName===e.fieldName)),...e}))):void 0}setLocalFields(e){if(!this.formUniqueKey)return;const t=e.map((e=>{const t={};return(0,ne.isUndefined)(e.hidden)||(t.hidden=e.hidden),{fieldName:e.fieldName,...t}})),r=JSON.parse(localStorage.getItem(this.formUniqueKey));(0,ne.isEqual)(t,r)||(localStorage.setItem(this.formUniqueKey,JSON.stringify(t)),this.saveFormFieldsConfig(this.formUniqueKey,t))}initLocalfields(){const e=this.getLocalFields();e&&this.changeHandle(e)}changeHandle(e){const{fieldsChange:t}=this.props;t?.([...e])}popupRender(){const{items:e}=this.props;return o().createElement(Cr.Consumer,null,(t=>{const r=t.$$form;return o().createElement("div",{className:Ne()("ant-dropdown-menu","fields-list")},o().createElement("div",{className:"reset"},o().createElement(xe,{type:"text",size:"small",onClick:()=>this.resetFieldsHandle(r.getOriginItems())},f("qm.table.columnFilter.reset"))),o().createElement(hi.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:e,setList:t=>{const n=t.map((e=>e.fieldName)),i=e.map((e=>e.fieldName));if((0,ne.isEqual)(n,i))return;r.setExpandHandle(!0);const a=bn(t);this.changeHandle(a),this.setLocalFields(a)}},e.map((t=>o().createElement("li",{key:t.fieldName,className:"item",style:t.noAuth?{display:"none"}:void 0},o().createElement(L.Checkbox,{disabled:t.rules?.findIndex((e=>e.required))>-1,checked:!t.hidden,onChange:r=>{const{checked:n}=r.target;t.hidden=!n,this.changeHandle(e),this.setLocalFields(e)}}),o().createElement(Re.HolderOutlined,{className:"handle",title:f("qm.form.draggable")}),o().createElement("span",{className:"title"},r.getFormItemLabel(t.label)))))))}))}render(){const{visible:e}=this.state,t=Ie("form-fields-filter");return o().createElement(Cr.Consumer,null,(r=>{const{$size:n}=r.$$form,i={[t]:!0,[`${t}--lg`]:"large"===n,[`${t}--sm`]:"small"===n};return o().createElement(L.Dropdown,{open:e,trigger:["click"],dropdownRender:()=>this.popupRender(),overlayClassName:Ne()(i),placement:"bottomRight",overlayStyle:{minWidth:150},getPopupContainer:()=>this.linkRef.current,onOpenChange:e=>{this.setState({visible:e})}},o().createElement("a",{ref:this.linkRef,style:{padding:"5px 0"}},o().createElement(Re.UnorderedListOutlined,null)))}))}}mi(fi,"contextType",c);const gi=fi;function bi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const yi=o().forwardRef(((e,t)=>{const{$$form:r}=o().useContext(Cr),{value:n,onChange:i,onValuesChange:a}=e,{options:l={},style:s={},placeholder:c=f("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h,onBlur:m=le,onEnter:g=le}=e.option,{prefix:b,suffix:y,password:v,maxLength:x,pattern:E,toUpper:S,toTrim:w,autoFocus:C,autoComplete:T,secretType:N}=l,I=N&&(p||h),R=o().useRef(),P=e=>{i?.(e),a(e)},O=v?L.Input.Password:L.Input,k=I?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return 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}(n,N):n;return r.isOnlyShow?o().createElement(ri,{value:(e=>e&&v?new Array(e.length).fill("*").join(""):e)(k),bordered:d}):o().createElement(O,{ref:e=>{R.current=e,"function"==typeof t&&t(e)},value:k,autoComplete:v?"new-password":T,autoFocus:C,placeholder:c,style:s,title:v?"":k,prefix:b,suffix:y,maxLength:x,bordered:d,allowClear:u,readOnly:p,disabled:h,onBlur:t=>{let r=t.target.value??"";if(w){const e=r.trim();r!==e&&(r=e,P(r))}(t=>{const{onBlur:r}=e;r?.(t)})(r),m(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;g(t),r.isFilterType&&(r.SUBMIT_FORM(),R.current?.blur())}},onChange:e=>{let t=e.target.value;(0,ne.isRegExp)(E)&&(t=E.test(t)?t:n??""),S&&(t=t.toUpperCase()),P(t)}})}));yi.displayName="VInput";class vi extends a.Component{constructor(){super(...arguments),bi(this,"context",void 0),bi(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(yi,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),u&&o().createElement(L.Col,null,e.renderFormItemButton(i,u)),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...d}))))}}bi(vi,"contextType",Cr);const xi=vi;function Ei(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Si=e=>{const{$$form:t}=o().useContext(Cr),{value:r=[],onChange:n,onValuesChange:i}=e,{options:a={},placeholder:l=f("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{prefix:p,suffix:h,maxLength:m}=a,g=e=>{const t=e.every((e=>!e))?[]:e;n?.(t),i(t,b(t))},b=e=>e.join(" - ");return t.isOnlyShow?o().createElement(ri,{value:b(r),bordered:s}):o().createElement(L.Input.Group,null,o().createElement(L.Input,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:l[0],prefix:p,suffix:h,maxLength:m,allowClear:c,bordered:s,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([t,r[1]])}}),o().createElement(L.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),o().createElement(L.Input,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:l[1],prefix:p,suffix:h,maxLength:m,bordered:s,allowClear:c,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([r[0],t])}}))};class wi extends a.Component{constructor(){super(...arguments),Ei(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,labelWidth:l=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(s),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(l)},required:e.getFormItemRequired(u)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Si,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(i,t)}}))),c&&o().createElement(L.Col,{flex:ge(c.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...c}))))}}Ei(wi,"contextType",Cr);const Ci=wi,Ti=require("big.js");var Ni=n.n(Ti);function Ii(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ri=o().forwardRef(((e,t)=>{const{$$form:r}=o().useContext(Cr),{value:n,onChange:i,onValuesChange:a}=e,{options:l={},style:s={},placeholder:c=f("qm.form.inputPlaceholder"),bordered:d=!0,readOnly:u,disabled:p,onBlur:h=le,onEnter:m=le}=e.option,{step:g=1,min:b,max:y,precision:v,autoFocus:x,stringMode:E,textAlign:S="left",controls:w=!0,formatter:C,parser:T}=l,N=o().useRef(),I=o().useRef(n),R=e=>{const t=kn(e)?"":(0,ne.isNumber)(e)?e.toFixed(v):new(Ni())(e).toFixed(v);return"function"==typeof C?C(t):t},P={[S]:!0,controls:w};return r.isOnlyShow?o().createElement(ri,{value:R(n),bordered:d}):o().createElement(L.InputNumber,{ref:e=>{N.current=e,"function"==typeof t&&t(e)},value:n,className:Ne()(P),placeholder:c,style:{width:"100%",...s},step:g,min:b,max:y,controls:w,precision:v,autoFocus:x,stringMode:E,formatter:C,parser:T,bordered:d,readOnly:u,disabled:p,onBlur:()=>{de((()=>{(t=>{const{onBlur:r}=e;r?.(t)})(I.current),h(I.current)}))},onKeyUp:e=>{13===e.keyCode&&(m(n),r.isFilterType&&(r.SUBMIT_FORM(),N.current?.blur()))},onChange:e=>{const t=e??"";!E&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{I.current=e,i?.(e),a(e,R(e))})(t)}})}));Ri.displayName="VInputNumber";class Pi extends a.Component{constructor(){super(...arguments),Ii(this,"context",void 0),Ii(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ri,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&o().createElement(L.Col,null,e.renderFormItemButton(i,u)),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Ii(Pi,"contextType",Cr);const Oi=Pi;function ki(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ai=e=>{const{$$form:t}=o().useContext(Cr),{value:r=[],onChange:n,onValuesChange:i}=e,{options:a={},placeholder:l=f("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{step:p=1,min:h=0,max:m,textAlign:g="left",controls:b=!0,precision:y,formatter:v,parser:x}=a,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),S(e)},S=e=>{const t=e.every((e=>null===e))?[]:[...e];n?.(t),i(t,w(t))},w=e=>kn(e)?"":e.map((e=>kn(e)?"":Number(e).toFixed(y))),C={[g]:!0,controls:b};return t.isOnlyShow?o().createElement(ri,{value:w(r),bordered:s}):o().createElement(L.Input.Group,null,o().createElement(L.InputNumber,{value:r[0],className:Ne()("site-input-left",C),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:l[0],step:p,min:h,max:m,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{S([e,r[1]])},onBlur:()=>{E(r)}}),o().createElement(L.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),o().createElement(L.InputNumber,{value:r[1],className:Ne()("site-input-right",C),style:{width:"calc(50% - 5px)"},placeholder:l[1],step:p,min:h,max:m,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{S([r[0],e])},onBlur:()=>{E(r)}}))};class Li extends a.Component{constructor(){super(...arguments),ki(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,labelWidth:l=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(s),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(l)},required:e.getFormItemRequired(u)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ai,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(i,t)}}))),c&&o().createElement(L.Col,{flex:ge(c.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...c}))))}}ki(Li,"contextType",Cr);const Fi=Li;let Hi=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});function _i(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:Di}=L.Input;class $i extends a.Component{constructor(e){var t;super(e),t=this,_i(this,"context",void 0),_i(this,"deriveParams",void 0),_i(this,"valueKey",void 0),_i(this,"_is_change",!1),_i(this,"_record",void 0),_i(this,"_prevValue",null),_i(this,"state",{visible:!1,loading:!1}),_i(this,"getSearchHelper",wr()((e=>Object.assign({},this.props.helperConfig,e)))),_i(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),_i(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||v("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||v("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&v("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),_i(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),_i(this,"getDerivedSearchHelper",(()=>this.searchHelper)),_i(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:i,triggeredChange:a,fieldAliasMap:o,extraAliasMap:l}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},c="function"==typeof l?l():l||{},d=this.getItemValue();if(!e||pe(d))return this._prevValue=void 0;this.setState({loading:!0});try{const o=await e(r({...t,key:d}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,ne.get)(o.data,n)??[];if(e[0]){const t=e[0];if(s&&Ln(t,this.alias,s),c&&Fn(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,a){const e=An(t,this.alias[this.props.option.fieldName]);this.triggerChange(e),this.searchHelperChangeHandle(e)}i?.([t])}}}catch(e){}this.setState({loading:!1})})),_i(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),_i(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,{filterAliasMap:r}=this.searchHelper,n=""!==e?e:void 0,i=("function"==typeof r?r():r)||[],a={[t]:n};return(Array.isArray(i)?i:[i]).forEach((e=>{if((0,ne.isPlainObject)(e))for(const t in e)a[t]="function"==typeof e[t]?e[t](n):n;else a[e]=n})),a})),_i(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=se,formatter:i=(e=>e)}=t.fetch;return new Promise((async(a,o)=>{const l=(0,ne.merge)({},this.searchHelper.table.fetch.params,{...r,...i(this.createFilters(e))},{currentPage:1,pageSize:500});if(!n(l))return o();this.setState({loading:!0});try{const e=await t.fetch.api(l);200===e.code?a(Array.isArray(e.data)?e.data:(0,ne.get)(e.data,t.fetch.dataKey)??[]):o()}catch(e){o(e)}finally{de((()=>this.setState({loading:!1})))}}))})),_i(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const i=An(e,this.alias[n]);void 0!==i&&(t.SET_FIELDS_VALUE({[n]:i}),n===r&&t.setViewValue(r,i))}for(const r in this.extras){const n=An(e,this.extras[r]);void 0!==n&&t.SET_FIELDS_EXTRA({[r]:n})}})),_i(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1?arguments[1]:void 0;const{fieldName:n}=t.props.option,i=e.filter((e=>An(e,t.alias[n])?.toString().toLowerCase().includes(r.toLowerCase())));if(1===i.length)return t.closeSearchHelper(i[0]);t.openSearchHelper(r)})),_i(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:r}=this.context,{beforeOpen:n}=this.searchHelper,i=(n??se)(r.state.formData);i?.then?i.then((()=>{this.todoOpen(e),t?.()})).catch((()=>{})):!1!==i&&(this.todoOpen(e),t?.())})),_i(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:An(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:An(e,this.extras[r])});const n=An(e,this.alias[r]);this.triggerChange(n),this.searchHelperChangeHandle(n);const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>i?.(e)),200)}))})),_i(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)})),_i(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;if(this.triggerChange(""),null!==this._record){for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}})),_i(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),_i(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e)})),_i(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),_i(this,"focus",(()=>{const{type:e}=this.props.option;this[`${e}_Ref`].focus({cursor:"end"})})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:t,loading:r}=this.state,{value:n}=this.props,{type:i,fieldName:a,options:l={},searchHelper:s={},style:c={},placeholder:d=f("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{prefix:g,suffix:b,maxLength:y}=l,v={visible:t,title:f("qm.searchHelper.text"),width:s.width??"60%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${Hi[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:Object.assign({},this.deriveParams,s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?o().createElement(ri,{value:n,bordered:u}):o().createElement(o().Fragment,null,o().createElement(Di,{ref:e=>this[`${i}_Ref`]=e,value:n,title:n,loading:r,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:p,readOnly:h,disabled:m,onBlur:e=>{const{value:r}=e.target,{onlySelect:n=!0,table:i}=this.searchHelper;this.triggerBlur(r),this._is_change&&!t&&(r?n?i?.fetch?.api&&this.getSearchHelperTableData(r).then((e=>this.resetSearchHelperValue(e,r))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(r):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:r}=e.target;!t&&this.openSearchHelper(r)}},onDoubleClick:e=>{const{value:t}=e.target;this.openSearchHelper(t)},onChange:e=>{const{value:t}=e.target;this.triggerChange(t),this._is_change=!0},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):de((()=>this.clearSearchHelperValue())))}}),o().createElement(Er,v,o().createElement(Gc,x)))}}_i($i,"contextType",Cr);class qi extends a.Component{constructor(e,t){let{$$form:r}=t;super(e),_i(this,"context",void 0),_i(this,"promiseRef",void 0),_i(this,"searchRef",void 0),_i(this,"state",{searchHelper:{}}),_i(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),_i(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,a)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Mn(Object.assign({},o.data,n),i,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else a()}catch(e){a()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[]}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(d),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement($i,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e.setViewValue(a,t)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(a,p)),u&&o().createElement(L.Col,{flex:ge(u.labelWidth||yn)},e.renderFormItemExtra({fieldName:a,...u}))))}}_i(qi,"contextType",Cr);const Mi=qi;function ji(){return ji=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ji.apply(this,arguments)}function Ki(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Vi=e=>{class t extends a.Component{constructor(){var e;super(...arguments),e=this,Ki(this,"startClick",void 0),Ki(this,"event1",null),Ki(this,"event2",null),Ki(this,"$el",null),Ki(this,"omitClassNames",[]),Ki(this,"state",{clickOutside:!1}),Ki(this,"mousedownHandler",(e=>{this.startClick=e})),Ki(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),Ki(this,"documentHandler",((e,t)=>{const r=e.target,n=t?.target,i=!r||!n,a=this.$el?.contains(r)||this.$el?.contains(n),o=this.$el===r,l=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),s=l.some((e=>e?.contains(r)))||l.includes(n);let c;c=!(i||a||o||s),this.setState({clickOutside:c})})),Ki(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),Ki(this,"setOmitClassNames",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.omitClassNames=t}))}componentDidMount(){this.event1=Gt()(document,"mousedown",this.mousedownHandler),this.event2=Gt()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){this.event1?.remove(),this.event2?.remove()}render(){const{forwardedRef:t}=this.props,{clickOutside:r}=this.state;return o().createElement(e,ji({ref:t},this.props,{clickOutside:r,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return Ki(t,"displayName",`OutsideClick(${e.displayName||e.name})`),o().forwardRef(((e,r)=>o().createElement(t,ji({},e,{forwardedRef:r}))))},zi=require("rc-trigger");var Bi,Ui,Wi=n.n(zi);function Gi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let Yi=Vi((Ui=class extends a.Component{constructor(e){var t;super(e),t=this,Gi(this,"context",void 0),Gi(this,"searchRef",o().createRef()),Gi(this,"_records",[]),Gi(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Gi(this,"getSearchHelper",wr()((e=>Object.assign({},this.props.helperConfig,e)))),Gi(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||v("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||v("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Gi(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Gi(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Gi(this,"setItemList",(e=>{this.setState({itemList:e})})),Gi(this,"setRecords",(e=>{this._records=e})),Gi(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Gi(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Gi(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??se)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Gi(this,"closeSearchHelper",(function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=t.alias;t.setRecords((0,ne.uniqBy)([...t._records.filter((e=>r.includes(e[n]))),...e],n));const i=t.recordsToDict();t.setItemList(i),t.triggerChange(i.map((e=>e.value)));const{closed:a}=t.searchHelper;t.setVisible(!1,(()=>{setTimeout((()=>a?.(t._records)),200)}))})),Gi(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(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:r=[]}=e,{value:n=[],clickOutside:i}=this.props;(0,ne.isEqual)((0,ne.intersection)(r,n),n)||(0,ne.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:i=(e=>e),dataKey:a,callback:o,fieldAliasMap:l}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},s="function"==typeof l?l():l||{},{value:c}=this.props;if(r&&!pe(c)){this.setState({loading:!0});try{const l=await r(i({...n,keys:c}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,ne.get)(l.data,a)??[];r.forEach((r=>{s?.valueKey&&s.valueKey!==t&&(r[t]=r[s.valueKey]),s?.textKey&&s.textKey!==e&&(r[e]=r[s.textKey])})),r=r.filter((e=>c.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(c),o?.(r)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:t,visible2:r,loading:n,itemList:i}=this.state,{value:a}=this.props,{fieldName:l,options:s={},searchHelper:c={},style:d={},placeholder:u=f("qm.form.selectPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:t,title:f("qm.searchHelper.text"),width:c.width??"60%",wrapClassName:`form-popper__${l}`,loading:!1,bodyStyle:{paddingBottom:`${Hi[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,ne.merge)({},c.initialValue),defaultSelectedKeys:a,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=i.filter((e=>a?.includes(e.value))),S=o().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>o().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):o().createElement("li",{className:"ant-dropdown-menu-item"},f("qm.table.config.emptyText"))),w=this.searchRef.current?this.searchRef.current.offsetWidth:300,C=Ie("form-multiple-search-helper"),{size:T}=e.context,N={[C]:!0,[`${C}--lg`]:"large"===T,[`${C}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${C}`]);const I=i.filter((e=>a?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?o().createElement(ri,{value:I,bordered:p}):o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},o().createElement(Wi(),{popupVisible:!g&&r,popup:S,popupClassName:Ne()(N),popupStyle:{minWidth:w},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:wn,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement(L.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:a,placeholder:u,loading:n,bordered:p,allowClear:h,disabled:g,style:{width:"100%",...d},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},i.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:g,icon:o().createElement(Re.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),o().createElement(Er,v,o().createElement(Gc,x)))}},Gi(Ui,"contextType",Cr),Bi=Ui))||Bi;class Xi extends a.Component{constructor(e,t){let{$$form:r}=t;super(e),Gi(this,"context",void 0),Gi(this,"promiseRef",void 0),Gi(this,"state",{searchHelper:{}}),Gi(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),Gi(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,a)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Mn(Object.assign({},o.data,n),i,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else a()}catch(e){a()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(d),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(Yi,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(a,r)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(a,p)),u&&o().createElement(L.Col,{flex:ge(u.labelWidth||yn)},e.renderFormItemExtra({fieldName:a,...u}))))}}Gi(Xi,"contextType",Cr);const Qi=Xi;function Zi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:Ji}=L.Input;class ea extends a.Component{constructor(e){super(e),Zi(this,"context",void 0),Zi(this,"valueKey",void 0),Zi(this,"_record",void 0),Zi(this,"_prevValue",null),Zi(this,"state",{visible:!1,loading:!1}),Zi(this,"getSearchHelper",wr()((e=>Object.assign({},this.props.helperConfig,e)))),Zi(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Zi(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||v("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||v("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&v("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Zi(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),Zi(this,"getDerivedSearchHelper",(()=>this.searchHelper)),Zi(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:i,triggeredChange:a,fieldAliasMap:o,extraAliasMap:l}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},c="function"==typeof l?l():l||{},d=this.getItemValue();if(!e||pe(d))return this._prevValue=void 0;this.setState({loading:!0});try{const o=await e(r({...t,key:d}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,ne.get)(o.data,n)??[];if(e[0]){const t=e[0];if(s&&Ln(t,this.alias,s),c&&Fn(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,a){const e=An(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}i?.([t])}}}catch(e){}this.setState({loading:!1})})),Zi(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const i=An(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:i}),n===r&&t.setViewValue(r,i)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:An(e,this.extras[r])})})),Zi(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??se)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Zi(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:An(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:An(e,this.extras[r])});const n=An(e,this.alias[r]);this.triggerChange(n);const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>i?.(e)),200)}))})),Zi(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")})),Zi(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),Zi(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:t,loading:r}=this.state,{value:n=""}=this.props,{type:i,fieldName:a,options:l={},searchHelper:s={},style:c={},placeholder:d=f("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{prefix:g,suffix:b,maxLength:y}=l,v={visible:t,title:f("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${Hi[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:(0,ne.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}};return e.isOnlyShow?o().createElement(ri,{value:n,bordered:u}):o().createElement(o().Fragment,null,o().createElement(Ji,{ref:e=>this[`${i}_Ref`]=e,value:n,title:n,loading:r,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:p,readOnly:h,disabled:m,onBlur:e=>{const{value:t}=e.target;this.triggerBlur(t)},onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onDoubleClick:e=>{this.openSearchHelper()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),o().createElement(Er,v,o().createElement(ed,x)))}}Zi(ea,"contextType",Cr);class ta extends a.Component{constructor(e,t){let{$$form:r}=t;super(e),Zi(this,"context",void 0),Zi(this,"promiseRef",void 0),Zi(this,"state",{searchHelper:{}}),Zi(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),Zi(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,a)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Mn(Object.assign({},o.data,n),i,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else a()}catch(e){a()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(d),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(ea,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r)=>{f(t,r),e.setViewValue(a,t)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(a,p)),u&&o().createElement(L.Col,{flex:ge(u.labelWidth||yn)},e.renderFormItemExtra({fieldName:a,...u}))))}}Zi(ta,"contextType",Cr);const ra=ta;var na,ia;function aa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let oa=Vi((ia=class extends a.Component{constructor(e){var t;super(e),t=this,aa(this,"context",void 0),aa(this,"searchRef",o().createRef()),aa(this,"_records",[]),aa(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),aa(this,"getSearchHelper",wr()((e=>Object.assign({},this.props.helperConfig,e)))),aa(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||v("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||v("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),aa(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),aa(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),aa(this,"setItemList",(e=>{this.setState({itemList:e})})),aa(this,"setRecords",(e=>{this._records=e})),aa(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),aa(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),aa(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??se)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),aa(this,"closeSearchHelper",(function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=t.alias;t.setRecords((0,ne.uniqBy)([...t._records.filter((e=>r.includes(e[n]))),...e],n));const i=t.recordsToDict();t.setItemList(i),t.triggerChange(i.map((e=>e.value)));const{closed:a}=t.searchHelper;t.setVisible(!1,(()=>{setTimeout((()=>a?.(t._records)),200)}))})),aa(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(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:r=[]}=e,{value:n=[],clickOutside:i}=this.props;(0,ne.isEqual)((0,ne.intersection)(r,n),n)||(0,ne.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:i=(e=>e),dataKey:a,fieldAliasMap:o}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},l="function"==typeof o?o():o||{},{value:s}=this.props;if(r&&!pe(s)){this.setState({loading:!0});try{const o=await r(i({...n,keys:s}));if(200===o.code){let r=Array.isArray(o.data)?o.data:(0,ne.get)(o.data,a)??[];r.forEach((r=>{l?.valueKey&&l.valueKey!==t&&(r[t]=r[l.valueKey]),l?.textKey&&l.textKey!==e&&(r[e]=r[l.textKey])})),r=r.filter((e=>s.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(s)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:t,visible2:r,loading:n,itemList:i}=this.state,{value:a}=this.props,{fieldName:l,options:s={},searchHelper:c={},style:d={},placeholder:u=f("qm.form.selectPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:t,title:f("qm.searchHelper.text"),width:c.width??"65%",wrapClassName:`form-popper__${l}`,loading:!1,bodyStyle:{paddingBottom:`${Hi[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,ne.merge)({},c.initialValue),defaultSelectedKeys:a,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=i.filter((e=>a?.includes(e.value))),S=o().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>o().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):o().createElement("li",{className:"ant-dropdown-menu-item"},f("qm.table.config.emptyText"))),w=this.searchRef.current?this.searchRef.current.offsetWidth:300,C=Ie("form-multiple-tree-table-helper"),{size:T}=e.context,N={[C]:!0,[`${C}--lg`]:"large"===T,[`${C}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${C}`]);const I=i.filter((e=>a?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?o().createElement(ri,{value:I,bordered:p}):o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},o().createElement(Wi(),{popupVisible:!g&&r,popup:S,popupClassName:Ne()(N),popupStyle:{minWidth:w},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:wn,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement(L.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:a,placeholder:u,loading:n,bordered:p,allowClear:h,disabled:g,style:{width:"100%",...d},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},i.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:g,icon:o().createElement(Re.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),o().createElement(Er,v,o().createElement(ed,x)))}},aa(ia,"contextType",Cr),na=ia))||na;class la extends a.Component{constructor(e,t){let{$$form:r}=t;super(e),aa(this,"context",void 0),aa(this,"promiseRef",void 0),aa(this,"state",{searchHelper:{}}),aa(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),aa(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,a)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Mn(Object.assign({},o.data,n),i,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else a()}catch(e){a()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(d),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(oa,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(a,r)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(a,p)),u&&o().createElement(L.Col,{flex:ge(u.labelWidth||yn)},e.renderFormItemExtra({fieldName:a,...u}))))}}aa(la,"contextType",Cr);const sa=la;function ca(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const da=new Array(2).fill("");class ua extends a.Component{constructor(e){var t;super(e),t=this,ca(this,"context",void 0),ca(this,"_is_change",!1),ca(this,"_ceho_data",void 0),ca(this,"_records",[]),ca(this,"_is_clear",!1),ca(this,"state",{visible:!1,loading:!1,itemList:[],textValue:da}),ca(this,"getSearchHelper",wr()((e=>Object.assign({},this.props.helperConfig,e)))),ca(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||v("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||v("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),ca(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),ca(this,"setItemList",(e=>{this.setState({itemList:e})})),ca(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ca(this,"setTextValue",(e=>{this.setState({textValue:e})})),ca(this,"setRecords",(e=>{this._records=e})),ca(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),ca(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;this._is_change=!1,t?.(e),r(e,this.createViewText(),this._records)})),ca(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(da),this.triggerChange([])})),ca(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:r}=this.alias,n=e.map((e=>({value:e[t],text:e[r]})));this.setRecords(e),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>i?.(this._records)),200)}))})),ca(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??se)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),ca(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,r=pe(e)?void 0:e;return{[t]:r}})),ca(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=se,formatter:i=(e=>e)}=t.fetch;return new Promise((async(a,o)=>{const l=(0,ne.merge)({},this.searchHelper.table.fetch.params,{...r,...i(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!n(l))return o();this.setState({loading:!0});const e=await t.fetch.api(l);if(de((()=>this.setState({loading:!1}))),200===e.code)return a(Array.isArray(e.data)?e.data:(0,ne.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}o()}))})),ca(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{textValue:r}=t.state,{textKey:n}=t.alias,i=e.filter((e=>{const t=e[n]?.toString().toLowerCase();return r.some((e=>t?.includes(e.toLowerCase())))}));if(2===i.length)return t.closeSearchHelper(i);t.openSearchHelper()})),ca(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:r=[]}=this.props;(0,ne.isEqual)((0,ne.intersection)(t,r),r)||(0,ne.isEqual)(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:n}=this.context,{fieldName:i}=this.props.option;if(!(0,ne.isEqual)(n[i],this._ceho_data)&&(this._ceho_data=n[i],this.setItemList(n[i]),r.length)){const e=da.map(((e,t)=>n[i].find((e=>e.value===r[t]))?.text??""));this.setTextValue(e)}}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:i=(e=>e),dataKey:a,fieldAliasMap:o}=this.searchHelper.echoRequest||{},l="function"==typeof o?o():o||{},{value:s}=this.props;if(r&&!pe(s)){this.setState({loading:!0});try{const o=await r(i({...n,keys:s}));if(200===o.code){let r=Array.isArray(o.data)?o.data:(0,ne.get)(o.data,a)??[];r.forEach((r=>{l?.valueKey&&l.valueKey!==t&&(r[t]=r[l.valueKey]),l?.textKey&&l.textKey!==e&&(r[e]=r[l.textKey])})),r=r.filter((e=>s.includes(e[t]))).slice(0,2);const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.setViewValue()}}catch(e){}this.setState({loading:!1})}}createViewText(){const{textKey:e}=this.alias;return this._records.map((t=>t[e])).join(" - ")}render(){const{$$form:e}=this.context,{value:t=[]}=this.props,{visible:r,loading:n,textValue:i}=this.state,{fieldName:a,options:l={},searchHelper:s={},placeholder:c=f("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:p}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,m=i.every((e=>kn(e)))?"":i.join(" - "),g={visible:r,title:f("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${Hi[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},b={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:(0,ne.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?o().createElement(ri,{value:m,bordered:d}):o().createElement(o().Fragment,null,o().createElement(L.Input.Group,null,o().createElement(L.Input,{value:i[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:p,onBlur:e=>{const{value:t}=e.target;this._is_change&&!r&&(t?i.every((e=>!!e))&&this.searchHelper.table?.fetch?.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;h||(this._is_change=!0,this.setTextValue([t,i[1]]))}}),o().createElement(L.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:p,readOnly:!0}),o().createElement(L.Input.Search,{value:i[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:n,bordered:d,allowClear:!0,readOnly:u,disabled:p,onBlur:e=>{const{value:t}=e.target;this._is_change&&!r&&(t?i.every((e=>!!e))&&this.searchHelper.table?.fetch?.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:h||(this._is_change=!0,this.setTextValue([i[0],t]))},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),o().createElement(Er,g,o().createElement(ld,b)))}}ca(ua,"contextType",Cr);class pa extends a.Component{constructor(e,t){let{$$form:r}=t;super(e),ca(this,"context",void 0),ca(this,"promiseRef",void 0),ca(this,"state",{searchHelper:{}}),ca(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),ca(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,a)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Mn(Object.assign({},o.data,n),i,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else a()}catch(e){a()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(ua,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{m(t,n),e.setViewValue(a,r)}}))),u&&o().createElement(L.Col,null,e.renderFormItemButton(a,u)),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:a,...d}))))}}ca(pa,"contextType",Cr);const ha=pa;function ma(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const fa=e=>{const{$$form:t}=o().useContext(Cr),{value:r,items:n,onChange:i,onValuesChange:a}=e,{options:l={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:p=[]}=l,h=pe(p)?n:p,m=e=>h.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return t.isOnlyShow?o().createElement(ri,{value:m(r),bordered:c}):o().createElement(L.Checkbox.Group,{value:r,style:{width:"100%",...s},disabled:u,onChange:e=>{(e=>{i?.(e),a(e,m(e))})(e)}},h.map((e=>o().createElement(L.Checkbox,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class ga extends a.Component{constructor(){super(...arguments),ma(this,"context",void 0),ma(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,ne.isEqual)(t,r)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:i="value",textKey:a="text",callback:o}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,n)??[],r=t.map((e=>({value:e[i],text:e[a]})));this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(d),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(c)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(fa,{option:this.props.option,items:t,onValuesChange:(t,r)=>{m(t),e.setViewValue(a,r)}}))),u&&o().createElement(L.Col,{flex:ge(u.labelWidth||yn)},e.renderFormItemExtra({fieldName:a,...u}))))}}ma(ga,"contextType",Cr);const ba=ga;function ya(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const va=e=>{const{$$form:t}=o().useContext(Cr),{value:r,onChange:n,onValuesChange:i}=e,{options:a={},style:l={},allowClear:s=!0,readOnly:c,disabled:d=t.isFormDisabled}=e.option,{allowHalf:u,count:p=5,tooltips:h}=a;return o().createElement(L.Rate,{value:r,count:p,style:l,allowHalf:u,allowClear:s,tooltips:h,disabled:d||t.isOnlyShow,onChange:e=>{(e=>{var t;n?.(e),i(e,(t=e,h?h[Math.ceil(t)-1]:t.toString()))})(e)}})};class xa extends a.Component{constructor(){super(...arguments),ya(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(va,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...d}))))}}ya(xa,"contextType",Cr);const Ea=xa;function Sa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const wa=e=>{const{$$form:t}=o().useContext(Cr),{value:r,items:n,onChange:i,onValuesChange:a}=e,{options:l={},style:s={},bordered:c=!1,readOnly:d,disabled:u=t.isFormDisabled}=e.option,{itemList:p=[]}=l,h=pe(p)?n:p,m=e=>h.find((t=>t.value===e))?.text??"";return t.isOnlyShow?o().createElement(ri,{value:m(r),bordered:c}):o().createElement(L.Radio.Group,{value:r,style:{width:"100%",...s},disabled:u||t.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{i?.(e),a(e,m(e))})(t)}},h.map((e=>o().createElement(L.Radio,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Ca extends a.Component{constructor(){super(...arguments),Sa(this,"context",void 0),Sa(this,"state",{itemList:[]}),Sa(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:i="value",textKey:a="text",callback:o}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,n)??[],r=t.map((e=>({value:e[i],text:e[a]})));this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,ne.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(d),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(c)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(wa,{option:this.props.option,items:t,onValuesChange:(t,r)=>{m(t),e.setViewValue(a,r)}}))),u&&o().createElement(L.Col,{flex:ge(u.labelWidth||yn)},e.renderFormItemExtra({fieldName:a,...u}))))}}Sa(Ca,"contextType",Cr);const Ta=Ca;function Na(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ia=e=>{const{$$form:t}=o().useContext(Cr),{value:r,onChange:n,onValuesChange:i}=e,{label:a,options:l={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:p=xn,trueValue:h=vn}=l;return o().createElement(o().Fragment,null,o().createElement(L.Switch,{checked:r===h,style:s,disabled:d||t.isOnlyShow,checkedChildren:o().createElement(Re.CheckOutlined,null),unCheckedChildren:o().createElement(Re.CloseOutlined,null),onChange:e=>{(e=>{n?.(e),i(e,f(e===h?"am.form.trueText":"am.form.falseText"))})(e?h:p)}}),u?o().createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},a):null)};class Ra extends a.Component{constructor(){super(...arguments),Na(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option,{labelToSwitch:m}=l;return o().createElement(L.Form.Item,{label:m?" ":e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ia,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Na(Ra,"contextType",Cr);const Pa=Ra;function Oa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ka=e=>{const{$$form:t}=o().useContext(Cr),{value:r,onChange:n,onValuesChange:i}=e,{options:a={},style:l={},placeholder:s=f("qm.form.inputPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:p,onBlur:h=le,onEnter:m=le}=e.option,{showCount:g,maxLength:b,autoSize:y}=a,v=Object.assign({},{minRows:1,maxRows:3},y);return o().createElement(L.Input.TextArea,{value:r,placeholder:s,style:l,maxLength:b,showCount:g,autoSize:v,bordered:c,allowClear:d,readOnly:u||t.isOnlyShow,disabled:p,onBlur:t=>{const{value:r}=t.target;(t=>{const{onBlur:r}=e;r?.(t)})(r),h(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;m(t)}},onChange:e=>{const{value:t}=e.target;(e=>{n?.(e),i(e)})(t)}})};class Aa extends a.Component{constructor(){super(...arguments),Oa(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(ka,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,t)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Oa(Aa,"contextType",Cr);const La=Aa;function Fa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ha=e=>{const{$$form:t}=o().useContext(Cr),{value:r,onChange:n,onValuesChange:i}=e,{fieldName:a,options:l={},style:s={},placeholder:c=f("qm.form.datePlaceholder"),bordered:d=!0,allowClear:p=!0,readOnly:h,disabled:m}=e.option,{dateType:g="date",format:b,disabledDate:y,minDateTime:v,maxDateTime:x,shortCuts:E=!0}=l,S=o().createRef(),w=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),n?.(e),i(e,C(e))},C=e=>kn(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,T=e=>{let t=On(u()().subtract(e,"day"),Tn[g]);"date"===g&&(t=t.slice(0,10)),w(t),S.current.blur(),S.current.focus()};return t.isOnlyShow?o().createElement(ri,{value:C(r),bordered:d}):o().createElement(j,{ref:S,style:{width:"100%",...s},popupClassName:`form-popper__${a}`,picker:Cn[g],format:b,bordered:d,showToday:!1,showTime:"datetime"===g&&{defaultValue:u()("00:00:00","HH:mm:ss")},allowClear:p,disabled:m,inputReadOnly:h,disabledDate:y??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[v,x])),renderExtraFooter:E?()=>o().createElement(o().Fragment,null,o().createElement(L.Tag,{color:"processing",onClick:()=>T(0)},f("qm.form.datePickers")[0]),o().createElement(L.Tag,{color:"processing",onClick:()=>T(1)},f("qm.form.datePickers")[1]),o().createElement(L.Tag,{color:"processing",onClick:()=>T(7)},f("qm.form.datePickers")[2]),o().createElement(L.Tag,{color:"processing",onClick:()=>T(30)},f("qm.form.datePickers")[3])):void 0,value:Pn(r,Tn[g]),onChange:(e,t)=>{w(On(e,Tn[g]))}})};class _a extends a.Component{constructor(){super(...arguments),Fa(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ha,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Fa(_a,"contextType",Cr);const Da=_a;function $a(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const qa=e=>[u()().subtract(e,"day"),u()()],Ma=e=>{const{$$form:t}=o().useContext(Cr),{value:r,onChange:n,onValuesChange:i}=e,{fieldName:a,options:l={},style:s={},placeholder:c=f("qm.form.daterangePlaceholder"),bordered:d=!0,allowClear:p=!0,readOnly:h,disabled:m=t.isFormDisabled}=e.option,{dateType:g="date",format:b,disableds:y=[!1,!1],allowEmpty:v,disabledDate:x,minDateTime:E,maxDateTime:S,shortCuts:w=!0}=l,C={[f("qm.form.dateRangePickers")[0]]:qa(7),[f("qm.form.dateRangePickers")[1]]:qa(30),[f("qm.form.dateRangePickers")[2]]:qa(90),[f("qm.form.dateRangePickers")[3]]:qa(180)},T=e=>kn(e)?"":e.map((e=>["date","exactdate"].includes(g)?e?.slice(0,10):e)).join(" - ");return t.isOnlyShow?o().createElement(ri,{value:T(r),bordered:d}):o().createElement(j.RangePicker,{style:{width:"100%",...s},popupClassName:`form-popper__${a}`,picker:Cn[g],format:b,bordered:d,showTime:"datetime"===g&&{defaultValue:[u()("00:00:00","HH:mm:ss"),u()("23:59:59","HH:mm:ss")]},allowClear:p,allowEmpty:v,disabled:m?[!0,!0]:y,inputReadOnly:h,disabledDate:x??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[E,S])),ranges:w?C:void 0,value:pe(r)?null:[Pn(r?.[0],Tn[g]),Pn(r?.[1],Tn[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=[]),n?.(e),i(e,T(e))})([On(e?.[0],Tn[g]),On(e?.[1],Tn[g])])}})};class ja extends a.Component{constructor(){super(...arguments),$a(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ma,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...d}))))}}$a(ja,"contextType",Cr);const Ka=ja;function Va(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const za=e=>{const{$$form:t}=o().useContext(Cr),{value:r,onChange:n,onValuesChange:i}=e,{fieldName:a,options:l={},style:s={},placeholder:c=f("qm.form.timePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h}=e.option,{timeType:m="hour-minute-second",hourStep:g=1,minuteStep:b=1,secondStep:y=1}=l;return t.isOnlyShow?o().createElement(ri,{value:r,bordered:d}):o().createElement(B,{style:{width:"100%",...s},popupClassName:`form-popper__${a}`,bordered:d,showNow:!0,hourStep:g,minuteStep:b,secondStep:y,allowClear:u,disabled:h,inputReadOnly:p,format:Nn[m],value:Pn(r,Nn[m]),onChange:(e,t)=>{(e=>{const t=On(e,Nn[m]);n?.(t),i(t)})(e)}})};class Ba extends a.Component{constructor(){super(...arguments),Va(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(za,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,t)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Va(Ba,"contextType",Cr);const Ua=Ba;function Wa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ga=e=>{const{$$form:t}=o().useContext(Cr),{value:r,onChange:n,onValuesChange:i}=e,{fieldName:a,options:l={},style:s={},placeholder:c=f("qm.form.timerangePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h=t.isFormDisabled}=e.option,{timeType:m="hour-minute-second",disableds:g=[!1,!1],allowEmpty:b,hourStep:y=1,minuteStep:v=1,secondStep:x=1}=l,E=e=>kn(e)?"":e.join(" - ");return t.isOnlyShow?o().createElement(ri,{value:E(r),bordered:d}):o().createElement(B.RangePicker,{style:{width:"100%",...s},popupClassName:`form-popper__${a}`,bordered:d,showNow:!1,hourStep:y,minuteStep:v,secondStep:x,allowClear:u,allowEmpty:b,disabled:h?[!0,!0]:g,inputReadOnly:p,format:Nn[m],value:pe(r)?null:[Pn(r?.[0],Nn[m]),Pn(r?.[1],Nn[m])],onChange:(e,t)=>{(e=>{const t=[On(e?.[0],Nn[m]),On(e?.[1],Nn[m])];n?.(t),i(t,E(t))})(e)}})};class Ya extends a.Component{constructor(){super(...arguments),Wa(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ga,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Wa(Ya,"contextType",Cr);const Xa=Ya;function Qa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Za extends a.Component{constructor(e){super(e),Qa(this,"context",void 0),Qa(this,"searchRef",o().createRef()),Qa(this,"valueKey",void 0),Qa(this,"_clicking",!1),Qa(this,"_record",void 0),Qa(this,"_prevValue",null),Qa(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),Qa(this,"getSearchHelper",wr()(((e,t)=>Object.assign({},this.props.helperConfig,e,t)))),Qa(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e,options:t,searchHelper:r}=this.props.option,{fieldAliasMap:n,fieldsDefine:i,echoRequest:a}=this.searchHelper;if(n||v("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),i){const e=["valueKey","displayKey","extraKey"];for(const t in i)e.includes(t)&&(this[t]=i[t])}Object.keys(this.alias).includes(e)||v("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),a&&!this.valueKey&&v("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!r&&v("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),Qa(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),Qa(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:i,triggeredChange:a,fieldAliasMap:o,extraAliasMap:l}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},c="function"==typeof l?l():l||{},d=this.getItemValue();if(!e||pe(d))return this._prevValue=void 0;try{const o=await e(r({...t,key:d}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,ne.get)(o.data,n)??[];if(e[0]){const t=e[0];if(s&&Ln(t,this.alias,s),c&&Fn(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,a){const e=An(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}i?.([t])}}}catch(e){}})),Qa(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias){const i=An(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:i}),n===r&&t.setViewValue(r,i)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:An(e,this.extras[r])})})),Qa(this,"fetchHandle",(0,ne.debounce)(this.getItemList,200)),Qa(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Qa(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),Qa(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),Qa(this,"clickHandle",((e,t)=>{const{$$form:r}=this.context,{fieldName:n}=this.props.option;for(const t in this.alias)t!==n&&r.SET_FIELDS_VALUE({[t]:An(e,this.alias[t])});for(const t in this.extras)r.SET_FIELDS_EXTRA({[t]:An(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const i=An(e,this.alias[n]);this.triggerChange(i),this.setState({inputText:void 0}),t&&t()})),this.initialHandle()}get searchHelper(){return this.getSearchHelper(this.props.option.options,this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(e){const t=e.option.searchHelper?.request?.params||e.option.request?.params,r=this.props.option.searchHelper?.request?.params||this.props.option.request?.params;if((0,ne.isEqual)(t,r)||this.getItemList(),null===this._prevValue)return;const n=this.getItemValue();this._prevValue!==n&&n!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=n}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:r,params:n={},formatter:i=(e=>e),dataKey:a}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const o=await r(i({...n,[t]:e}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,ne.get)(o.data,a)??[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}render(){const{$$form:e}=this.context,{visible:t,loading:r,itemList:n,inputText:i}=this.state,{value:a}=this.props,{fieldName:l,options:s={},style:d={},placeholder:u=f("qm.form.inputPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:g}=this.props.option,{listHeight:b=En}=s,{hideHeader:y,onlySelect:v=!0}=this.searchHelper||s,x=this.searchHelper.columns||[],E=Ie("form-immediate"),S=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,w=o().createElement(L.Spin,{spinning:r},n.length?o().createElement("table",{cellSpacing:0,cellPadding:0,className:Ne()("table")},!y&&o().createElement("thead",null,o().createElement("tr",null,x.filter((e=>!e.hidden)).map((e=>o().createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),o().createElement("tbody",null,n.map(((e,t)=>o().createElement("tr",{key:t,className:this.state.activeIndex===t?"active":"",onMouseEnter:()=>{this.setState({activeIndex:t})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},x.filter((e=>!e.hidden)).map((t=>o().createElement("td",{key:t.dataIndex},(0,ne.get)(e,t.dataIndex))))))))):o().createElement(bt,null));return o().createElement(c.Consumer,null,(r=>{const s={[E]:!0,[`${E}--lg`]:"large"===r?.size,[`${E}--sm`]:"small"===r?.size};return e.isOnlyShow?o().createElement(ri,{value:a,bordered:p}):o().createElement(Wi(),{action:g?[]:["click"],popupVisible:!g&&t,popup:w,popupClassName:Ne()(s,`form-popper__${l}`),popupStyle:{minWidth:S,maxHeight:b},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:wn,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement(L.Input,{ref:this.searchRef,placeholder:u,allowClear:h,bordered:p,readOnly:m,disabled:g,style:{width:"100%",...d},value:i??a,title:a,onFocus:()=>{!n.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(n[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 r=40===e.keyCode?++t%n.length:(--t+n.length)%n.length;this.setState({activeIndex:r})}},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)}}))}))}}Qa(Za,"contextType",Cr);class Ja extends a.Component{constructor(e,t){let{$$form:r}=t;super(e),Qa(this,"context",void 0),Qa(this,"promiseRef",void 0),Qa(this,"state",{searchHelper:{}}),Qa(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),Qa(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,a)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Mn(Object.assign({},o.data,n),i,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else a()}catch(e){a()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(d),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(Za,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";f(t,arguments.length>1?arguments[1]:void 0),e.setViewValue(a,t)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(a,p)),u&&o().createElement(L.Col,{flex:ge(u.labelWidth||yn)},e.renderFormItemExtra({fieldName:a,...u}))))}}Qa(Ja,"contextType",Cr);const eo=Ja;function to(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ro extends a.Component{constructor(){super(...arguments),to(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,fieldName:n,className:i,style:a={},collapse:l={}}=this.props.option,{expand:s}=e.state,{showLimit:c,remarkItems:d=[],onCollapse:u=le}=l,p=[];if(d.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===n))??[],r=c??t.length-1;t.slice(r+1).forEach((t=>{const r=d.find((e=>e.fieldName===t.fieldName));if(!r)return;const n=r.showLabel?`${t.label}:`:"",i=e.getViewValue(t.fieldName)??"";""!==i&&p.push({...t,text:`${n}${i}`})}))}return o().createElement(L.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},o().createElement(ke,{id:n,label:r,className:i,extra:p.map((e=>e.text)).join(" | "),style:{...a},collapse:s[n],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[n]:t})}))),u(t)}}))}}to(ro,"contextType",Cr);const no=ro;function io(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ao(){return ao=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ao.apply(this,arguments)}const oo=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:oo(e.children,t,r,n)}:e)),lo=e=>{const{$$form:t}=o().useContext(Cr),{value:r,items:n,multiple:i,loading:a,onChange:l,onValuesChange:s}=e,{fieldName:c,options:d={},style:u={},placeholder:p=f("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,asyncLoad:g,readOnly:b,disabled:y}=e.option,{itemList:v,filterable:x=!0,listHeight:E=En,checkStrictly:S,checkStrategy:w="SHOW_CHILD",collapseTags:C,defaultExpandAll:T=!g,defaultExpandedKeys:N,openPyt:I=!0}=d,[R,P]=o().useState(pe(v)?n:v);Ve((()=>{P(pe(v)?n:v)}),[v,n]);const O=e=>_n(R,e)?.text||e?.toString()||"",k=e=>i?e?.map((e=>O(e))).join(",")||"":O(e);return t.isOnlyShow?o().createElement(ri,{value:k(r),bordered:h}):o().createElement(L.TreeSelect,ao({fieldNames:{label:"text",value:"value",children:"children"},value:r,multiple:i,treeCheckable:i,treeCheckStrictly:S,showCheckedStrategy:L.TreeSelect[w],popupClassName:`form-popper__${c}`,placeholder:p,listHeight:E,style:u,loading:a,bordered:h,allowClear:m,disabled:y,treeDefaultExpandAll:T,treeDefaultExpandedKeys:N,showSearch:x,maxTagCount:C?"responsive":void 0,loadData:g?async e=>{let{key:t,children:r}=e;if(!g||r)return;const{fetchApi:n,params:i,dataKey:a,textKey:o="text",valueKey:l="value",callback:s,formatter:c=(e=>e)}=g;if(n)try{const e=await n(c({...i,[l]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,a)??[],n=oo(R,t,l,Hn(r,l,o));P(n),s?.(r)}}catch(e){}}:void 0,treeData:R},i?{title:k(r)}:null,{filterTreeNode:(e,t)=>{const r=t?.text?.toString()||"",n=ei.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(I?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{l?.(e),s(e,k(e),R)})(e)}}))};class so extends a.Component{constructor(){super(...arguments),io(this,"context",void 0),io(this,"state",{itemList:[],loading:!1}),io(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:i="value",textKey:a="text",callback:o}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,n)??[],r=Hn(t,i,a);this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,ne.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:r}=this.state,{type:n,label:i,tooltip:a,fieldName:l,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(i),className:Ne()(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ge(d)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},o().createElement(lo,{option:this.props.option,items:t,loading:r,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(l,r)}}))),p&&o().createElement(L.Col,{flex:ge(p.labelWidth||yn)},e.renderFormItemExtra({fieldName:l,...p}))))}}io(so,"contextType",Cr);const co=so;function uo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function po(){return po=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},po.apply(this,arguments)}const ho=e=>{const{$$form:t}=o().useContext(Cr),{value:r,multiple:n,items:i}=e,{fieldName:a,options:l={},style:s={},placeholder:c=f("qm.form.selectPlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h}=e.option,{changeOnSelect:m,checkStrictly:g,checkStrategy:b="SHOW_PARENT",filterable:y=!0,openPyt:v=!0}=l,{itemList:x=[]}=l,E=pe(x)?i:x,S=e=>Dn(E,e??"").map((e=>e.text)).join("/"),w=e=>n?e?.map((e=>S(e))).join(",")||"":S(e);return t.isOnlyShow?o().createElement(ri,{value:w(r),bordered:d}):o().createElement(L.Cascader,po({value:(e=>pe(e)?[]:n?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:E,multiple:n,maxTagCount:"responsive",changeOnSelect:m||g,showCheckedStrategy:L.Cascader[b],popupClassName:`form-popper__${a}`,placeholder:c,style:s,bordered:d,allowClear:u,disabled:h,showSearch:y&&{filter:(e,t)=>t.some((t=>{const r=t?.text?.toString()||"",n=ei.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(v?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))}},n?{title:w(r)}:null,{onChange:t=>{(t=>{const{onChange:r,onValuesChange:n}=e;r?.(t),n(t,w(t),E)})(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return n?e.map((e=>e.join(","))):e.join(",")}(t))}}))};class mo extends a.Component{constructor(){super(...arguments),uo(this,"context",void 0),uo(this,"state",{itemList:[],loading:!1}),uo(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:i="value",textKey:a="text",callback:o}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,n)??[],r=Hn(t,i,a);this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,ne.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:t}=this.props,{itemList:r}=this.state,{type:n,label:i,tooltip:a,fieldName:l,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(i),className:Ne()(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ge(d)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},o().createElement(ho,{option:this.props.option,multiple:t,items:r,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(l,r)}}))),p&&o().createElement(L.Col,{flex:ge(p.labelWidth||yn)},e.renderFormItemExtra({fieldName:l,...p}))))}}uo(mo,"contextType",Cr);const fo=mo,go=require("china-area-data");var bo=n.n(go);function yo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const vo=["110000","120000","310000","500000"],xo=["810000","820000"],Eo=[{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"}],So=[{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"}],wo=e=>ei.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),Co=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(!(r>2)&&e[t])return("86"===t?Object.keys(e[t]).filter((e=>![...vo,...xo].includes(e))):Object.keys(e[t])).map((n=>({l:wo(e[t][n].slice(0,1)).toUpperCase(),n:e[t][n],c:n,p:t,children:Co(e,n,r+1)})))},To=(e,t)=>t.map((t=>({l:wo(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class No extends a.Component{constructor(e){super(e),yo(this,"context",void 0),yo(this,"searchRef",o().createRef()),yo(this,"scrollRef",o().createRef()),yo(this,"zxsAndGa",void 0),yo(this,"provinces",void 0),yo(this,"allCities",void 0),yo(this,"letterCities",void 0),yo(this,"state",{visible:!1,select_type:"0",active_key:""}),yo(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),yo(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)})),this.zxsAndGa=this.createZxsAndGa(),this.provinces=this.createProvince(),this.allCities=this.createAllCity(),this.letterCities=this.createCity()}componentDidMount(){this.setInputReadonly()}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),Xt()(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){return this.allCities.find((t=>t.c===e))?.n||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:To(bo(),vo)},{l:"Z2",n:"港澳",c:"",p:"",children:To(bo(),xo)}]}createProvince(){return(Co(bo(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return So.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...vo,...xo].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return o().createElement(L.Radio.Group,{size:"small",buttonStyle:"solid",value:e,onChange:e=>{const{value:t}=e.target;this.setState({select_type:t,active_key:""},(()=>{this.scrollRef.current.scrollTop=0}))}},o().createElement(L.Radio.Button,{value:"0"},f("qm.form.citySelectType.0")),o().createElement(L.Radio.Button,{value:"1"},f("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:t}=this.state;return("0"===t?Eo:So).map((t=>o().createElement("li",{key:t.value,className:Ne()({tag:!0,actived:t.value===e}),onClick:()=>this.scrollHandle(t.value.toString())},t.text)))}renderSelect(){const{value:e}=this.props;return o().createElement(L.Select,{size:"small",placeholder:f("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>(t?.children?.toString()||"").toLowerCase().indexOf(e.toLowerCase())>=0,value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>o().createElement(L.Select.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:t}=this.state;return("0"===t?this.provinces:this.letterCities).map(((t,r)=>o().createElement("div",{key:r},o().createElement("dt",{ref:e=>this[`${t.l}Ref`]=e},t.n,":"),o().createElement("dd",null,t.children?.map((t=>o().createElement("li",{key:t.c,className:Ne()({actived:t.c===e}),onClick:()=>this.clickHadnle(t.c)},t.n)))))))}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:r}=this.props,{fieldName:n,options:i={},style:a={},placeholder:l=f("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:d=!0,readOnly:u,disabled:p}=this.props.option,h=Ie("form-city-select"),m=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=this.createTextValue(r),b=o().createElement("div",{className:"container",style:{...a}},o().createElement("div",{className:"city-drop"},o().createElement("div",{className:"city-drop-toper"},o().createElement("div",{className:"city-drop-toper__type"},this.renderType()),o().createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),o().createElement("div",{className:"city-drop-letter"},this.renderLetter()),o().createElement("div",{ref:this.scrollRef,className:"city-drop-list"},o().createElement("dl",null,this.renderCity(r)))));return o().createElement(c.Consumer,null,(r=>{const i={[h]:!0,[`${h}--lg`]:"large"===r?.size,[`${h}--sm`]:"small"===r?.size};return e.isOnlyShow?o().createElement(ri,{value:g,bordered:s}):o().createElement(Wi(),{action:p?[]:["click"],popupVisible:!p&&t,popup:b,popupClassName:Ne()(i,`form-popper__${n}`),popupStyle:{minWidth:m},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:wn,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement(L.Input,{ref:this.searchRef,placeholder:l,allowClear:d,bordered:s,readOnly:u,disabled:p,style:{width:"100%",...a},value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}}))}))}}yo(No,"contextType",Cr);class Io extends a.Component{constructor(){super(...arguments),yo(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(No,{option:this.props.option,onValuesChange:(t,r)=>{h(t,r),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...d}))))}}yo(Io,"contextType",Cr);const Ro=Io;function Po(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Oo=(e,t)=>{if(e[t])return Object.keys(e[t]).map((r=>({text:e[t][r],value:r,children:Oo(e,r)})))};class ko extends a.Component{constructor(e){super(e),Po(this,"context",void 0),Po(this,"searchRef",o().createRef()),Po(this,"prevText",void 0),Po(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Po(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const t=Oo(bo(),"86")||[];this.state={results:t,visible:!1,values:[],tabs:[t.map((e=>({text:e.text,value:e.value})))],activeName:"0"}}componentDidMount(){this.initial(),this.setInputReadonly()}componentDidUpdate(e){const{value:t}=e,{value:r}=this.props;t!==r&&this.state.values.join(",")!==(r??"")&&this.initial()}get isFetch(){return!!this.props.option.request?.fetchApi}get level(){let{selectLevel:e=0}=this.props.option.options||{};return(e<1||e>3)&&(e=3),this.isFetch?4:e}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>this.state.tabs[t]?.find((t=>t.value===e))?.text)).join("/")}initial(){const{value:e}=this.props,t=e?e.split(","):[];this.setState({values:t},(()=>{this.createTabs(),this.createActiveName(t.length?t.length-1:0)}))}createActiveName(e){this.setState({activeName:e.toString()})}createTabs(){const{results:e,values:t}=this.state;if(!e.length)return;const r=this.state.tabs.slice(0,1);for(let n=0;n<t.length;n++){const i=_n(e,t[n]);if(i&&pe(i.children)){this.isFetch&&this.getStreetList(t[n]);break}Array.isArray(i?.children)&&(r[n+1]=i?.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:r})}async getStreetList(e){const{request:t={}}=this.props.option,{fetchApi:r,formatter:n=(e=>e),dataKey:i,valueKey:a="value",textKey:o="text"}=t;if(r)try{const t=await r(n({code:e}));if(200===t.code){const e=Array.isArray(t.data)?t.data:(0,ne.get)(t.data,i)??[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[o],value:e[a]})))]})))}}catch(e){}}renderTabs(){const{values:e}=this.state,t=this.state.tabs.map(((t,r)=>{const n=t.find((t=>t.value===e[r]))?.text||`${f("qm.form.selectPlaceholder").replace("...","")}(${f("qm.form.regionSelectLabel")[r]})`;return o().createElement(cr.TabPane,{key:r.toString(),tab:n},o().createElement("div",{className:"region-box"},t.map((t=>o().createElement("span",{key:t.value,className:Ne()({"region-box__item":!0,actived:e.includes(t.value.toString())}),title:t.text,onClick:()=>{let{values:e}=this.state;e[r]=t.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)}))}},t.text)))))}));return t.length?o().createElement(cr,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},t):o().createElement(bt,null)}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:r}=this.props,{fieldName:n,options:i={},style:a={},placeholder:l=f("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:d=!0,readOnly:u,disabled:p}=this.props.option,h=Ie("form-region-select"),m=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=o().createElement("div",{className:"container"},this.renderTabs());let b=this.prevText;if(!t){const e=this.createTextValue(r);(""===e||e.split("/").every((e=>""!==e)))&&(b=e,this.prevText=b)}return o().createElement(c.Consumer,null,(r=>{const i={[h]:!0,[`${h}--lg`]:"large"===r?.size,[`${h}--sm`]:"small"===r?.size};return e.isOnlyShow?o().createElement(ri,{value:b,bordered:s}):o().createElement(Wi(),{action:p?[]:["click"],popupVisible:!p&&t,popup:g,popupClassName:Ne()(i,`form-popper__${n}`),popupStyle:{minWidth:m},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:wn,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement(L.Input,{ref:this.searchRef,placeholder:l,allowClear:d,bordered:s,style:{width:"100%",...a},readOnly:u,disabled:p,value:b,title:b,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&de((()=>this.initial()))}}))}))}}Po(ko,"contextType",Cr);class Ao extends a.Component{constructor(){super(...arguments),Po(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(ko,{option:this.props.option,onValuesChange:(t,r)=>{h(t,r),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Po(Ao,"contextType",Cr);const Lo=Ao;function Fo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ho=e=>{const{$$form:t}=o().useContext(Cr),{value:r,onChange:n,onValuesChange:i}=e,{options:a={},upload:l={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:p=1,fileTypes:h,fileSize:m,fileDirection:g,onPreview:b,onRemove:y}=a,{action:v,headers:x,params:E,withCredentials:S=!1,dataKey:w="",downloadWithHeaders:C,fieldAliasMap:T,beforeUpload:N,button:I}=l,R="function"==typeof T?T():T||{};return o().createElement(xl,{name:"file",action:v,multiple:u,headers:x,data:E,withCredentials:S,downloadWithHeaders:C,beforeUpload:N,maxCount:p,fileTypes:h,fileSize:m,fileDirection:g,disabled:c,readOnly:t.isOnlyShow||d,button:I,showUploadList:{showDownloadIcon:!0,downloadIcon:o().createElement(Re.DownloadOutlined,null)},fileList:r,onChange:e=>{let{file:t,fileList:r}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in R)r[n]=e[n]||t.data?.[R[n]]||"";return e.response&&200!==t.code&&L.message.error(t.message||f("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(w?(0,ne.get)(t.data,w):t.data)||"",status:e.status}}));n?.(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onPreview:b,onRemove:y})};class _o extends a.Component{constructor(){super(...arguments),Fo(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ho,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,"")}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Fo(_o,"contextType",Cr);const Do=_o;function $o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const qo=e=>{const{$$form:t}=o().useContext(Cr),{value:r,onChange:n,onValuesChange:i}=e,{options:a={},upload:l={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:p=1,fixedSize:h,quality:m,openCropper:g,fileTypes:b,fileSize:y,onRemove:v}=a,{action:x,headers:E,params:S,withCredentials:w=!1,dataKey:C="",popupClassName:T,fieldAliasMap:N,beforeUpload:I}=l,R="function"==typeof N?N():N||{};return o().createElement(Il,{name:"file",action:x,multiple:u,headers:E,data:S,withCredentials:w,popupClassName:T,beforeUpload:I,maxCount:p,fixedSize:h,quality:m,openCropper:g,fileTypes:b,fileSize:y,disabled:c,readOnly:t.isOnlyShow||d,fileList:r,onChange:e=>{let{file:t,fileList:r}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in R)r[n]=e[n]||t.data?.[R[n]]||"";return e.response&&200!==t.code&&L.message.error(t.message||f("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(C?(0,ne.get)(t.data,C):t.data)||"",status:e.status}}));n?.(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onRemove:v})};class Mo extends a.Component{constructor(){super(...arguments),$o(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(qo,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,"")}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...d}))))}}$o(Mo,"contextType",Cr);const jo=Mo;function Ko(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Vo=e=>{const{$$form:t}=o().useContext(Cr),{value:r,onChange:n,onValuesChange:i}=e,{options:a={},upload:l,style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{tinymce:u,thresholdSize:p,onResizeEditor:h}=a;return o().createElement(ml,{value:r,tinymce:u,upload:l,thresholdSize:p,style:{width:"100%",...s},disabled:d||c||t.isOnlyShow,onResizeEditor:h,onChange:e=>{(e=>{n?.(e),i(e)})(e)}})};class zo extends a.Component{constructor(){super(...arguments),Ko(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Vo,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,t)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||yn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Ko(zo,"contextType",Cr);const Bo=zo;function Uo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Wo extends a.Component{constructor(e){super(e),Uo(this,"context",void 0),Uo(this,"provide",{$$form:this,echo_data:{}}),Uo(this,"_initialValues",void 0),Uo(this,"_initialOthers",void 0),Uo(this,"_initialExtras",void 0),Uo(this,"_fieldAuth",{}),Uo(this,"wrapperRef",o().createRef()),Uo(this,"formRef",o().createRef()),Uo(this,"originItems",[]),Uo(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),Uo(this,"resizeObserveHandler",(()=>{const e=this.wrapperRef.current?.offsetWidth;if(void 0===e||0===e||this.props.cols>0)return;let t=Math.floor(e/300);t=24%t==0?t:t-1,t=t<1?1:t,t=t>8?8:t,t!==this.state.flexCols&&this.setState({flexCols:t})})),Uo(this,"resizeListenerHandle",(0,ne.debounce)(this.resizeObserveHandler,10)),Uo(this,"getFormItems",wr()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),Uo(this,"getFlattenItems",wr()((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{(0,ne.isPlainObject)(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t}))),Uo(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),Uo(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),Uo(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),Uo(this,"finishFailedHandle",(e=>{let{values:t,errorFields:r}=e;this.props.onFinishFailed?.(r)})),Uo(this,"openValidateInfo",(e=>{const t=o().createElement("ul",null,e.map((e=>{const{label:t}=this.formItems.find((t=>t.fieldName===e.name[0]));return o().createElement("li",{key:e.name[0],style:{color:"#ff4d4f"}},"[",("string"==typeof t?`${t}: `:"")+e.errors.join(","),"]")})));L.notification.error({message:f("qm.form.validatePrompt"),description:t,duration:10})})),Uo(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Xt()(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})})),this.createOriginItems(),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){return this.props.size??this.context.size??""}get verticalLayout(){return"vertical"===this.props.layout}get formItems(){return this.getFormItems(this.props.items)}get flattenItems(){return this.getFlattenItems(this.formItems)}get dividers(){return this.formItems.filter((e=>"DIVIDER"===e.type))}get isFilterType(){return"search"===this.props.formType}get isOnlyShow(){return"onlyShow"===this.props.formType}get isFormDisabled(){return this.props.disabled}get isCompactMode(){const e=this.context.global;return this.props.compactMode??("small"===this.$size&&!!e?.compactModeInSmallSize)}get showDividerCollapse(){return this.dividers.some((e=>!!e.collapse))}get showFilterCollapse(){return this.props.isCollapse&&this.formItems.length>=this.state.flexCols}componentDidMount(){this.checkFieldNames(),this.initialHandle(),this.createInputFocus(),this.bindResizeEvent(),this.resizeObserveHandler()}componentDidUpdate(e,t){this.props.items!==e.items&&this.checkFieldNames()}componentWillUnmount(){this.removeResizeEvent()}bindResizeEvent(){It(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){Rt(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&&v("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).some((e=>e.required))}createOtherValue(e){const t=this.flattenItems.map((e=>e.fieldName)),r={};for(const n in e)t.includes(n)||(r[n]=e[n]);return Object.assign({},r)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,ne.isPlainObject)(e.extra))).forEach((r=>{t[r.fieldName]=e[r.fieldName]??""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>(0,ne.isPlainObject)(e.collapse))).forEach((t=>{e[t.fieldName]=t.collapse.defaultExpand??!1})),Object.assign({},e)}getInitialValue(e,t){const{type:r,options:n}=e;return t=t??void 0,Sn.includes(r)&&(t=t??[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=t??n?.falseValue??xn),t}createFormValue(e){const t={};return this.flattenItems.forEach((r=>{t[r.fieldName]=this.getInitialValue(r,e[r.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=fe(this.props.items)}getOriginItems(){return this.originItems}setViewValue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";t!==this.getViewValue(e)&&this.setState((r=>({viewData:Object.assign({},r.viewData,{[e]:t})})))}getViewValue(e){return this.state.viewData[e]??""}setExpandHandle(e){this.setState({collapse:e}),de((()=>this.props.onCollapse?.(this.state.collapse)))}createInputFocus(){const{isAutoFocus:e}=this.props;if(!e||this.isOnlyShow)return;const{type:t,fieldName:r}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!r||setTimeout((()=>this.CREATE_FOCUS(r)))}getFormItemLabel(e){if($n(e))return qn(e);if((0,ne.isPlainObject)(e)){const{fieldName:t,label:r,options:n={}}=e;if($n(r))return qn(r);const{itemList:i=[]}=n,a=this.formRef.current?.getFieldsValue([t])[t]??this._initialValues[t]??i[0]?.value;return i.find((e=>e.value===a))?.text||""}return""}getBlockDerivedItems(){const e=[];for(let t=0,r=this.dividers.length;t<r;t++){const r=this.formItems.findIndex((e=>e===this.dividers[t]));let n=this.formItems.findIndex((e=>e===this.dividers[t+1]));n=n>-1?n:void 0,e.push(this.formItems.slice(r,n).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay(e){let{type:t,fieldName:r}=e;if("DIVIDER"===t)return!0;const n=this.getBlockDerivedItems();for(let e=0,t=n.length;e<t;e++){const t=n[e],i=this.dividers.find((e=>e.fieldName===t[0].fieldName)),a=i?.collapse?.showLimit??t.length-1;for(let e=1;e<t.length;e++)if(t[e].fieldName===r&&e>a)return this.state.expand[t[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const r=e[t];if(kn(r)&&(e[t]=""),Array.isArray(r)&&r.forEach(((r,n)=>{kn(r)&&(e[t][n]="")})),t.includes("|")&&Array.isArray(r)){const[n,i]=t.split("|");e[n]=r[0]??"",e[i]=r[1]??""}}if(this.isFilterType)for(const t in e)pe(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}async createFormAuth(){const{authConfig:e}=this.props;if(!e)return;let t=re()(e,["fetch"]);if(e.fetch){const{api:r,params:n,dataKey:i}=e.fetch;try{const e=await r(n);200===e.code&&(t=(i?(0,ne.get)(e.data,i):e.data)??{})}catch(e){}}if(Array.isArray(t.fieldList)){const e=this.props.items.map((e=>{const{fieldName:r}=e,n=t.fieldList.find((e=>e.dataIndex===r));if(n){const t=this.originItems.find((e=>e.fieldName===r)),{visible:i=1,disabled:a,secretName:o}=n;i||(e.noAuth=!0,t.noAuth=!0),a&&(e.disabled=!0,t.disabled=!0),o&&(e.options?e.options.secretType=o:e.options={secretType:o},t.options=Object.assign({},t.options,{secretType:o})),this.setFieldAuth(r,{visible:i,disabled:a,secretName:o})}return e}));this.props.fieldsChange?.(e)}}INPUT(e){return o().createElement(xi,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return o().createElement(Ci,{option:e})}INPUT_NUMBER(e){return o().createElement(Oi,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return o().createElement(Fi,{option:e})}SEARCH_HELPER(e){return o().createElement(Mi,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return o().createElement(Qi,{option:e})}TREE_TABLE_HELPER(e){return o().createElement(ra,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return o().createElement(sa,{option:e})}RANGE_SEARCH_HELPER(e){return o().createElement(ha,{option:e})}CHECKBOX(e){return o().createElement(pi,{option:e})}MULTIPLE_CHECKBOX(e){return o().createElement(ba,{option:e})}RATE(e){return o().createElement(Ea,{option:e})}RADIO(e){return o().createElement(Ta,{option:e})}SWITCH(e){return o().createElement(Pa,{option:e})}TEXT_AREA(e){return o().createElement(La,{option:e})}DATE(e){return o().createElement(Da,{option:e})}RANGE_DATE(e){return o().createElement(Ka,{option:e})}TIME(e){return o().createElement(Ua,{option:e})}RANGE_TIME(e){return o().createElement(Xa,{option:e})}SELECT(e){return o().createElement(si,{option:e})}MULTIPLE_SELECT(e){return o().createElement(si,{option:e,multiple:!0})}IMMEDIATE(e){return o().createElement(eo,{option:e})}DIVIDER(e){return o().createElement(no,{option:e})}TREE_SELECT(e){return o().createElement(co,{option:e})}MULTIPLE_TREE_SELECT(e){return o().createElement(co,{option:e,multiple:!0})}CASCADER(e){return o().createElement(fo,{option:e})}MULTIPLE_CASCADER(e){return o().createElement(fo,{option:e,multiple:!0})}CITY_SELECT(e){return o().createElement(Ro,{option:e})}REGION_SELECT(e){return o().createElement(Lo,{option:e})}UPLOAD_FILE(e){return o().createElement(Do,{option:e})}UPLOAD_IMG(e){return o().createElement(jo,{option:e})}TINYMCE(e){return o().createElement(Bo,{option:e})}renderFormLabel(e){if($n(e)||!(0,ne.isPlainObject)(e))return e;const{type:t,fieldName:r,label:n,options:i={},onChange:a=le}=e,{itemList:l=[]}=i;return"SELECT"===t?o().createElement(L.Form.Item,{name:r,noStyle:!0},o().createElement(oi,{option:e,items:l,loading:!1,onValuesChange:(e,t)=>a(e,t)})):"CHECKBOX"===t?o().createElement(o().Fragment,null,o().createElement("span",{style:{paddingRight:5}},n),o().createElement(L.Form.Item,{name:r,noStyle:!0},o().createElement(di,{option:e,onValuesChange:e=>a(e)}))):null}renderFormItemExtra(e){const{fieldName:t,isTooltip:r,style:n={},render:i}=e,{extra:a}=this.state;if(r)return o().createElement(L.Tooltip,{className:"extra-tooltip",title:a[t]},o().createElement(Re.ExclamationCircleOutlined,{style:{marginLeft:4}}));const l=this.formItems.find((e=>e.fieldName===t));return o().createElement("div",{className:"extra-text",title:i?"":a[t],style:n},o().createElement("span",{className:"extra-overflow-cut"},i?i(l,this):a[t]))}renderFormItemButton(e,t){const r=this.formItems.find((t=>t.fieldName===e)),n="function"==typeof t?t(r):t;return this.isOnlyShow?null:n}renderFormItem(e){const{label:t,fieldName:r,invisible:n,tooltip:i,className:a,labelWidth:l=this.props.labelWidth,rules:s=[],style:c={},render:d}=e;return pe(this.state.formData)?null:o().createElement(L.Form.Item,{label:this.renderFormLabel(t),name:r,rules:s,tooltip:i,hidden:n,className:Ne()(a),style:{width:"100%",...c},labelCol:{flex:this.verticalLayout?"initial":ge(l)}},d?.(e,this))}createFormItem(e){return(0,ne.isFunction)(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(v("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:t,defaultRows:r,isFieldsDefine:n}=this.props,i=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:r=0}=e;for(let e=0;e<t;e++)i.push({});i.push(e);for(let e=0;e<r;e++)i.push({})}));const a=24/e,l=[],s=i.reduce(((e,t)=>{const{selfCol:r=1}=t,n=e+r;return l.push(n),n}),0),c=r>Math.ceil(s/e)?Math.ceil(s/e):r,d=[],u=i.map(((t,r)=>{let{selfCol:n=1}=t;const{type:i,fieldName:s}=t;n=n>=24||"DIVIDER"===i||"TINYMCE"===i?e:n;const u=!(!this.state.collapse&&this.showFilterCollapse)||l[r]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(t);return u&&d.push(l[r]),o().createElement(L.Col,{key:s??r,className:s,span:n*a,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:p?"block":"none"}},i?this.createFormItem(fe(t)):null)}));return n&&"default"===t&&u.push(o().createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...u,this.createSearchButtonLayout(d[d.length-1])]}createSearchButtonLayout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{flexCols:t,collapse:r}=this.state,{searchButtonCols:n,isSearchBtn:i,isFieldsDefine:a=!0}=this.props;if(!this.isFilterType)return null;const l=24/t,s=n||1,c=t-e%t-s;return i?o().createElement(L.Col,{key:"-",span:s*l,offset:c*l,style:{textAlign:"right"}},o().createElement(L.Space,{style:{marginBottom:12}},o().createElement(xe,{type:"primary",size:this.$size,icon:o().createElement(Re.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},f("qm.form.search")),o().createElement(xe,{size:this.$size,icon:o().createElement(Re.ReloadOutlined,null),onClick:()=>this.RESET_FORM()},f("qm.form.reset")),a?this.createFieldsDefine():null,this.showFilterCollapse&&o().createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?o().createElement(Re.UpOutlined,null):o().createElement(Re.DownOutlined,null)," ",f(r?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:t,isSubmitBtn:r}=this.props;if(this.isFilterType)return null;const n=24/e;return r&&"default"===t?o().createElement(L.Row,{gutter:0},o().createElement(L.Col,{key:"-",span:n},o().createElement(L.Form.Item,null,o().createElement(L.Space,{style:{marginBottom:12}},o().createElement(xe,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},f("qm.form.save")),o().createElement(xe,{size:this.$size,onClick:()=>this.RESET_FORM()},f("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:t,fieldsChange:r}=this.props;return o().createElement(gi,{uniqueKey:e,items:t,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((async(e,t)=>{const[r,n]=await this.VALIDATE_FIELDS(),i=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>this[`${e.fieldName}_Ref`]?.searchRef._is_change)).map((e=>({name:[e.fieldName],errors:[f("qm.form.searchHelperTips")],warnings:[]})));r||i.length?t((r||[]).concat(i)):e(n)}))}SET_FIELDS_VALUE(e){this.formRef.current.setFieldsValue(e),this.set_fields_other(e)}GET_FIELDS_VALUE(e){return e?Object.assign({},this.get_fields_other(e),this.formRef.current.getFieldsValue(e)):Object.assign({},this.state.other,this.formRef.current.getFieldsValue(!0))}async GET_FORM_DATA(){try{const e=await this.formValidate();return[null,Object.assign({},this.get_fields_other(),this.formatFormValue(e))]}catch(e){return this.props.scrollToFirstError&&this.scrollToField(e[0].name[0]),[e,null]}}async VALIDATE_FIELDS(e){try{return[null,await this.formRef.current.validateFields(e)]}catch({errorFields:e}){return this.isCompactMode&&this.openValidateInfo(e),[e,null]}}SET_FIELDS_EXTRA(e){this.setState((t=>({extra:Object.assign({},t.extra,e)})))}SET_FIELDS_ECHO(e){Object.keys(e).length&&(Object.assign(this.provide,{echo_data:Object.assign({},this.provide.echo_data,e)}),this.forceUpdate())}GET_FIELDS_EXTRA(e){if(!e)return this.state.extra;const t={};return e.forEach((e=>{t[e]=this.state.extra[e]})),t}GET_FIELDS_TOUCHED(e){return this.formRef.current.isFieldsTouched(e)}async SUBMIT_FORM(){try{await this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}RESET_FORM(){const e=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),t=this.flattenItems.map((e=>e.fieldName)).filter((t=>!e.includes(t)));t.length&&this.formRef.current.resetFields(t),this.setState((e=>{const t=Object.keys(e.other),r=Object.keys(this._initialOthers),n=t.filter((e=>!r.includes(e))),i={};return n.forEach((e=>i[e]=void 0)),{other:Object.assign({},this._initialOthers,i)}})),this.setState({extra:Object.assign({},this._initialExtras)}),this.props.onReset?.()}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){v("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,r){const{items:n,fieldsChange:i}=this.props,a=n.find((t=>t.fieldName===e));if(!a)return v("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!(0,ne.isPlainObject)(t))return v("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(a.noAuth)return v("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const r in t)r&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===r||(0,ne.set)(a,r,t[r]));r&&(i?i([...n]):v("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:t,layout:r,disabled:n,labelWidth:i,labelAlign:a,labelWrap:l,customClass:s}=this.props,c=Ie("form"),d={required:"${label}"+f("qm.form.requiredTips")},u={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}__only-show`]:this.isOnlyShow,[`${c}__compact`]:this.isCompactMode,[s]:!!s};return o().createElement("div",{ref:this.wrapperRef,className:Ne()(u,e),style:t},o().createElement(L.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:r,labelAlign:a,labelWrap:l,colon:!1,disabled:n,labelCol:{flex:this.verticalLayout?"initial":ge(i)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},o().createElement(Cr.Provider,{value:this.provide},o().createElement(L.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}Uo(Wo,"contextType",c),Uo(Wo,"propTypes",In),Uo(Wo,"defaultProps",Rn);const Go=Wo,Yo={onActivate:l.func,onAddUndo:l.func,onBeforeAddUndo:l.func,onBeforeExecCommand:l.func,onBeforeGetContent:l.func,onBeforeRenderUI:l.func,onBeforeSetContent:l.func,onBeforePaste:l.func,onBlur:l.func,onChange:l.func,onClearUndos:l.func,onClick:l.func,onContextMenu:l.func,onCommentChange:l.func,onCopy:l.func,onCut:l.func,onDblclick:l.func,onDeactivate:l.func,onDirty:l.func,onDrag:l.func,onDragDrop:l.func,onDragEnd:l.func,onDragGesture:l.func,onDragOver:l.func,onDrop:l.func,onExecCommand:l.func,onFocus:l.func,onFocusIn:l.func,onFocusOut:l.func,onGetContent:l.func,onHide:l.func,onInit:l.func,onKeyDown:l.func,onKeyPress:l.func,onKeyUp:l.func,onLoadContent:l.func,onMouseDown:l.func,onMouseEnter:l.func,onMouseLeave:l.func,onMouseMove:l.func,onMouseOut:l.func,onMouseOver:l.func,onMouseUp:l.func,onNodeChange:l.func,onObjectResizeStart:l.func,onObjectResized:l.func,onObjectSelected:l.func,onPaste:l.func,onPostProcess:l.func,onPostRender:l.func,onPreProcess:l.func,onProgressState:l.func,onRedo:l.func,onRemove:l.func,onReset:l.func,onSaveContent:l.func,onSelectionChange:l.func,onSetAttrib:l.func,onSetContent:l.func,onShow:l.func,onSubmit:l.func,onUndo:l.func,onVisualAid:l.func,onSkinLoadError:l.func,onThemeLoadError:l.func,onModelLoadError:l.func,onPluginLoadError:l.func,onIconsLoadError:l.func,onLanguageLoadError:l.func},Xo={apiKey:l.string,id:l.string,inline:l.bool,init:l.object,initialValue:l.string,onEditorChange:l.func,value:l.string,tagName:l.string,cloudChannel:l.string,plugins:l.oneOfType([l.string,l.array]),toolbar:l.oneOfType([l.string,l.array]),disabled:l.bool,textareaName:l.string,tinymceScriptSrc:l.string,rollback:l.oneOfType([l.number,l.oneOf([!1])]),scriptLoading:l.shape({async:l.bool,defer:l.bool,delay:l.number}),...Yo},Qo=e=>"function"==typeof e,Zo=e=>e in Yo,Jo=e=>e.substr(2),el=(e,t,r,n,i)=>((t,r,n,i,a,o,l)=>{const s=Object.keys(a).filter(Zo),c=Object.keys(o).filter(Zo),d=s.filter((e=>void 0===o[e])),u=c.filter((e=>void 0===a[e]));d.forEach((e=>{const t=Jo(e),r=l[t];n(t,r),delete l[t]})),u.forEach((n=>{const i=((t,r)=>n=>t(r)?.(n,e))(t,n),a=Jo(n);l[a]=i,r(a,i)}))})(i,e.on.bind(e),e.off.bind(e),0,t,r,n);let tl=0;const rl=e=>{const t=Date.now(),r=Math.floor(1e9*Math.random());return tl++,e+"_"+r+tl+String(t)},nl=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),il=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),al=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},ol=()=>({listeners:[],scriptId:rl("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),ll=(()=>{let e=ol();return{load:(t,r,n,i,a,o)=>{const l=()=>((t,r,n,i,a,o)=>{const l=r.createElement("script");l.referrerPolicy="origin",l.type="application/javascript",l.id=t,l.src=n,l.async=i,l.defer=a;const s=()=>{l.removeEventListener("load",s),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};l.addEventListener("load",s),r.head&&r.head.appendChild(l)})(e.scriptId,t,r,n,i);e.scriptLoaded?o():(e.listeners.push(o),e.scriptLoading||(e.scriptLoading=!0,a>0?setTimeout(l,a):l()))},reinitialize:()=>{e=ol()}}})(),sl=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function cl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class dl extends a.Component{constructor(e){var t;super(e),t=this,cl(this,"editor",void 0),cl(this,"id",void 0),cl(this,"elementRef",void 0),cl(this,"inline",void 0),cl(this,"currentContent",void 0),cl(this,"boundHandlers",void 0),cl(this,"rollbackTimer",void 0),cl(this,"valueCursor",void 0),cl(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})),cl(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){}})),cl(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),cl(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))}})),cl(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),cl(this,"initialise",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const r=t.elementRef.current;if(!r)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,r=e.parentNode;for(;null!=r;)t=r,r=t.parentNode;return t===e.ownerDocument}return e.isConnected})(r)){if(0===e)setTimeout((()=>t.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>t.initialise(e+1)),100)}return}const n=sl(t.view);if(!n)throw new Error("tinymce should have been loaded into global scope");const i={...t.props.init,selector:void 0,target:r,readonly:t.props.disabled,inline:t.inline,plugins:(a=t.props.init?.plugins,o=t.props.plugins,il(a).concat(il(o))),toolbar:t.props.toolbar??t.props.init?.toolbar,setup:e=>{t.editor=e,t.bindHandlers({}),t.inline&&!nl(r)&&e.once("PostRender",(r=>{e.setContent(t.getInitialValue(),{no_events:!0})})),t.props.init&&Qo(t.props.init.setup)&&t.props.init.setup(e)},init_instance_callback:e=>{const r=t.getInitialValue();t.currentContent=t.currentContent??e.getContent(),t.currentContent!==r&&(t.currentContent=r,e.setContent(r),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const n=t.props.disabled??!1;al(t.editor,n?"readonly":"design"),t.props.init&&Qo(t.props.init.init_instance_callback)&&t.props.init.init_instance_callback(e)}};var a,o;t.inline||(r.style.visibility=""),nl(r)&&(r.value=t.getInitialValue()),n.init(i)})),this.id=this.props.id||rl("tiny-react"),this.elementRef=a.createRef(),this.inline=this.props.inline??this.props.init?.inline??!1,this.boundHandlers={}}get view(){return this.elementRef.current?.ownerDocument.defaultView??window}componentDidUpdate(e){if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(e),this.editor.initialized)){if(this.currentContent=this.currentContent??this.editor.getContent(),"string"==typeof this.props.initialValue&&this.props.initialValue!==e.initialValue)this.editor.setContent(this.props.initialValue),this.editor.undoManager.clear(),this.editor.undoManager.add(),this.editor.setDirty(!1);else if("string"==typeof this.props.value&&this.props.value!==this.currentContent){const e=this.editor;e.undoManager.transact((()=>{let t;if(!this.inline||e.hasFocus())try{t=e.selection.getBookmark(3)}catch(e){}const r=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const n of[t,r])if(n)try{e.selection.moveToBookmark(n),this.valueCursor=n;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;al(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==sl(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&ll.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),this.props.scriptLoading?.async??!1,this.props.scriptLoading?.defer??!1,this.props.scriptLoading?.delay??0,this.initialise)}componentWillUnmount(){const e=this.editor;e&&(e.off(this.changeEvents(),this.handleEditorChange),e.off(this.beforeInputEvent(),this.handleBeforeInput),e.off("keypress",this.handleEditorChangeSpecial),e.off("keydown",this.handleBeforeInputSpecial),e.off("NewBlock",this.handleEditorChange),Object.keys(this.boundHandlers).forEach((t=>{e.off(t,this.boundHandlers[t])})),this.boundHandlers={},e.remove(),this.editor=void 0)}render(){return this.inline?this.renderInline():this.renderIframe()}changeEvents(){const e=sl(this.view)?.Env?.browser?.isIE();return e?"change keyup compositionend setcontent CommentChange":"change input compositionend setcontent CommentChange"}beforeInputEvent(){return window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges?"beforeinput SelectionChange":"SelectionChange"}renderInline(){const{tagName:e="div"}=this.props;return a.createElement(e,{ref:this.elementRef,id:this.id})}renderIframe(){return a.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){el(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,r=t(e),n=t(this.props);!r&&n?(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)):r&&!n&&(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))}}}function ul(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}cl(dl,"propTypes",Xo),cl(dl,"defaultProps",{cloudChannel:"6"});var pl=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(pl||{});class hl extends a.Component{constructor(){super(...arguments),ul(this,"context",void 0),ul(this,"defaultOption",{height:400,plugins:"preview importcss searchreplace autolink save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap quickbars emoticons",menubar:"file edit view insert format tools table help",toolbar:"undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl"})}render(){const{size:e,className:t,style:r,tinymce:n={},upload:i={},thresholdSize:a=.5,tinymceScriptSrc:l,disabled:s,value:c,onResizeEditor:d,onChange:u}=this.props,p=this.context.global,h=this.context.locale,m=e||this.context.size||"",g=Ie("tinymce"),b={[g]:!0,[`${g}--lg`]:"large"===m,[`${g}--sm`]:"small"===m},y={init:{height:n.height||this.defaultOption.height,plugins:n.plugins||this.defaultOption.plugins,toolbar:n.toolbar||this.defaultOption.toolbar,menubar:n.menubar||this.defaultOption.menubar,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:pl[h],skin:"tinymce-5",...re()(n,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>new Promise((async(t,r)=>{const{action:n,headers:o,dataKey:l}=i,s=`data:image/jpeg;base64,${e.base64()}`,c=new FormData;c.append("file",e.blob(),e.filename());const d=e.blob().size;if(n&&d/1024/1024>a)try{const e=await fetch(n,{method:"POST",body:c,headers:o});if(!e.ok)throw new Error(f("qm.upload.uploadError"));const r=await e.json();200===r.code&&t(l?(0,ne.get)(r.data,l):r.data)}catch(e){L.message.error(f("qm.uploadCropper.uploadError"))}else t(s)})),setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:r,offsetHeight:n}=e.editorContainer;d?.({width:r,height:n},t)}))}},value:c,disabled:s,tinymceScriptSrc:l||p?.tinymce?.scriptSrc||void 0,onEditorChange:(e,t)=>{u?.(t.getContent(),t)}};return o().createElement("div",{className:Ne()(b,t),style:r},o().createElement(dl,y))}}ul(hl,"contextType",c),ul(hl,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Tinymce","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const ml=hl,fl=require("cropperjs");var gl=n.n(fl);function bl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class yl extends a.Component{constructor(){super(...arguments),bl(this,"imgRef",o().createRef()),bl(this,"cropper",void 0)}componentDidMount(){const{className:e,style:t,src:r,alt:n,imgStyle:i,...a}=this.props,o={};for(const e in a)void 0!==this.props[e]&&(o[e]=this.props[e]);this.cropper=new(gl())(this.imgRef.current,o)}componentWillUnmount(){this.destroy(),this.cropper=null}reset(){return this.cropper.reset()}clear(){return this.cropper.clear()}initCrop(){return this.cropper.crop()}replace(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.cropper.replace(e,t)}enable(){return this.cropper.enable()}disable(){return this.cropper.disable()}destroy(){return this.cropper.destroy()}move(e,t){return this.cropper.move(e,t)}moveTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.moveTo(e,t)}relativeZoom(e,t){return this.cropper.zoom(e,t)}zoomTo(e,t){return this.cropper.zoomTo(e,t)}rotate(e){return this.cropper.rotate(e)}rotateTo(e){return this.cropper.rotateTo(e)}scaleX(e){return this.cropper.scaleX(e)}scaleY(e){return this.cropper.scaleY(e)}scale(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.scale(e,t)}getData(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.cropper.getData(e)}setData(e){return this.cropper.setData(e)}getContainerData(){return this.cropper.getContainerData()}getImageData(){return this.cropper.getImageData()}getCanvasData(){return this.cropper.getCanvasData()}setCanvasData(e){return this.cropper.setCanvasData(e)}getCropBoxData(){return this.cropper.getCropBoxData()}setCropBoxData(e){return this.cropper.setCropBoxData(e)}getCroppedCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.cropper.getCroppedCanvas(e)}setAspectRatio(e){return this.cropper.setAspectRatio(e)}setDragMode(e){return this.cropper.setDragMode(e)}render(){const{className:e,style:t,src:r,alt:n,imgStyle:i}=this.props,a=Ie("cropper"),l={[a]:!0};return o().createElement("div",{className:Ne()(l,e),style:t},o().createElement("img",{ref:this.imgRef,src:r,alt:n,style:{maxWidth:"100%",...i}}))}}bl(yl,"defaultProps",{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});const vl=yl,xl=Kt;function El(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Sl extends a.Component{constructor(){super(...arguments),El(this,"context",void 0),El(this,"cropperRef",o().createRef()),El(this,"beforeUploadRef",void 0),El(this,"fileRef",void 0),El(this,"resolveRef",void 0),El(this,"rejectRef",void 0),El(this,"state",{src:""}),El(this,"confirmHandle",(async()=>{const{quality:e}=this.props,{type:t,name:r,uid:n}=this.fileRef;this.cropperRef.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===t?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((async e=>{let i=new File([e],r,{type:t});Object.assign(i,{uid:n});const{fileTypes:a=[],fileSize:o}=this.props;if(a.length&&!a.includes(i.name.slice(i.name.lastIndexOf(".")+1).toLowerCase()))return L.message.warning(f("qm.upload.tooltip",{type:a.join(",")})),this.rejectRef("file type is error");if("function"!=typeof this.beforeUploadRef)return this.resolveRef(i);const l=this.beforeUploadRef(i,[i]);if("boolean"==typeof l||l){if(!0===l)return this.resolveRef(i);if(!1===l)return this.rejectRef("not upload");if(l&&"function"==typeof l.then)try{const e=await l,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(i=e),this.resolveRef(i)}catch(e){this.rejectRef(e)}}else v("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),t,e),await ce(100),this.onClose()})),El(this,"onOk",(()=>{this.confirmHandle()})),El(this,"onClose",(()=>{this.setSrc("")}))}get previewSize(){const{fixedSize:e}=this.props;return{width:"380px",height:e?`calc(380px * ${e[1]/e[0]})`:"auto"}}setSrc(e){this.setState({src:e})}renderUpload(){const{children:e,beforeCrop:t}=this.props,r=Array.isArray(e)?e[0]:e;if(!r)return null;const{beforeUpload:n,...i}=r.props;return this.beforeUploadRef=n,o().createElement(r.type,{...i,beforeUpload:(e,r)=>new Promise((async(n,i)=>{const a=()=>n(L.Upload.LIST_IGNORE);if(t&&!await t(e,r))return void a();this.fileRef=e,this.resolveRef=n,this.rejectRef=a;const o=new FileReader;o.onload=()=>{this.setSrc(o.result),o.onload=null},o.readAsDataURL(e)}))})}scaleHandle(e){this.cropperRef.current.relativeZoom(e,void 0)}rotateHandle(e){this.cropperRef.current.rotate(e)}renderCropper(){const{fixedSize:e}=this.props;return o().createElement("div",{className:"cropper-preview"},o().createElement("div",{className:"cropper-area"},o().createElement("div",{className:"img-cropper"},o().createElement(vl,{ref:this.cropperRef,aspectRatio:e?e[0]/e[1]:e,src:this.state.src,dragMode:"move",preview:".preview"})),o().createElement("div",{className:"actions"},o().createElement(L.Space,{size:"small"},o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Re.ZoomInOutlined,null),onClick:()=>this.scaleHandle(.2)},f("qm.uploadCropper.zoomIn")),o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Re.ZoomOutOutlined,null),onClick:()=>this.scaleHandle(-.2)},f("qm.uploadCropper.zoomOut")),o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Re.RotateRightOutlined,null),onClick:()=>this.rotateHandle(90)},f("qm.uploadCropper.rotatePlus")),o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Re.RotateLeftOutlined,null),onClick:()=>this.rotateHandle(-90)},f("qm.uploadCropper.rotateSubtract"))))),o().createElement("div",{className:"preview-area"},o().createElement("div",{className:"preview",style:this.previewSize})))}render(){const{className:e}=this.props,{src:t}=this.state,r=Ie("cropper-preview");return o().createElement(o().Fragment,null,this.renderUpload(),t&&o().createElement(L.Modal,{open:!0,wrapClassName:Ne()(r,e),title:f("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:this.onOk,onCancel:this.onClose,maskClosable:!1,destroyOnClose:!0},this.renderCropper()))}}El(Sl,"contextType",c);const wl=Sl;function Cl(){return Cl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Cl.apply(this,arguments)}function Tl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Nl extends a.Component{constructor(){super(...arguments),Tl(this,"context",void 0),Tl(this,"state",{previewVisible:!1,currentIndex:0}),Tl(this,"isFocused",!1),Tl(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:i=[],fileSize:a,beforeUpload:o}=this.props,l=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),s=!a||e.size/1024/1024<a,c=l&&s;if(l||L.message.warning(f("qm.upload.tooltip",{type:i.join(",")})),s||L.message.warning(f("qm.upload.sizeLimit",{size:a})),!c)return L.Upload.LIST_IGNORE;if(o){const i=o(e,t);if(!0===i)return r(e);if(!1===i)return n("not upload");if(i&&"function"==typeof i.then)try{r(await i)}catch(e){n(e)}}else r(e)})))),Tl(this,"handlePreview",(e=>{this.setState({currentIndex:this.props.fileList?.findIndex((t=>t.url===e.url))||0,previewVisible:!0})})),Tl(this,"handlePaste",(async e=>{const{fileList:t=[],action:r,data:n,headers:i,onChange:a}=this.props;if(this.isFocused&&this.showUploadButton&&r)for(const o of e.clipboardData.items)if("file"===o.kind&&o.type.startsWith("image/")){const e=o.getAsFile(),l=Date.now(),s=new File([e],`screenshot-${l}.png`,{type:e.type});Object.assign(s,{uid:`rc-upload-${l}`});try{await this.beforeUpload(s,[...t,s]);const e=new FormData;if(e.append("file",s),n)for(const t in n)e.append(t,n[t]);const o="string"==typeof r?r:await r(s),l=await fetch(o,{method:"POST",body:e,headers:i});if(!l.ok)throw new Error(f("qm.upload.uploadError"));const c=await l.json();a?.({file:s,fileList:[...t,{uid:s.uid,lastModified:s.lastModified,lastModifiedDate:s.lastModifiedDate,name:s.name,type:s.type,size:s.size,response:c,status:"done",percent:100,originFileObj:s}]})}catch(e){}}}))}get $size(){return this.context.size??""}get showUploadButton(){const e=this.props.fileList?.length??0;return!this.props.maxCount||e<this.props.maxCount}componentDidMount(){document.addEventListener("paste",this.handlePaste)}componentDidUpdate(e){const{fileList:t}=e,{fileList:r}=this.props;t===r||this.showUploadButton||(this.isFocused=!1)}componentWillUnmount(){document.removeEventListener("paste",this.handlePaste)}render(){const{previewVisible:e,currentIndex:t}=this.state,{fileList:r=[],fixedSize:n,quality:i,fileTypes:a,fileSize:l,disabled:s,readOnly:c,className:d,popupClassName:u,openCropper:p,beforeCrop:h}=this.props,m=Ie("upload-img"),g={[m]:!0,[`${m}--lg`]:"large"===this.$size,[`${m}--sm`]:"small"===this.$size},b=s||c,y=o().createElement(L.Upload,Cl({className:Ne()(g,d)},re()(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,disabled:b,onPreview:this.handlePreview,showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,t,r,n)=>o().createElement("div",{className:"upload-item"},e,!b&&o().createElement(Re.CloseOutlined,{title:f("qm.upload.remove"),className:"icon",onClick:()=>n.remove()}))}),!this.showUploadButton||c&&r.length?null:o().createElement(o().Fragment,null,o().createElement("p",{className:"ant-upload-drag-icon"},o().createElement(Re.InboxOutlined,null)),o().createElement("p",{className:"ant-upload-text"},f("qm.uploadCropper.dragableText")),o().createElement("button",{className:Ne()("ant-upload-button",{disabled:b}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{this.isFocused=!0},onBlur:()=>{this.isFocused=!1}},f("qm.uploadCropper.pasteText"))));return o().createElement(o().Fragment,null,p?o().createElement(wl,{className:u,fixedSize:n,quality:i,fileTypes:a,fileSize:l,beforeCrop:h},y):y,o().createElement("div",{style:{display:"none"}},o().createElement(L.Image.PreviewGroup,{preview:{visible:e,current:t,rootClassName:u,onVisibleChange:e=>{this.setState({previewVisible:e})}}},r.map((e=>o().createElement(L.Image,{key:e.uid,src:e.url,alt:""}))))))}}Tl(Nl,"contextType",c),Tl(Nl,"defaultProps",{name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0});const Il=Nl,Rl=(e,t,r)=>{let n;for(let i=0;i<e.length;i++){const a=e[i];if(a.children)if(a.children.some((e=>e[r]===t)))n=a[r];else{const e=Rl(a.children,t,r);e&&(n=e)}}return n},Pl=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Pl(e.children,t),t(e)||e.children&&e.children.length))),Ol=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Ol(e.children,t)),t(e)&&r.push(e)})),r},kl=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=kl(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},Al=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:Al(e.children,t,r,n)}:e)),Ll=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Ll(e.children,t)),Array.isArray(e.children)&&e.children.length&&r.push(e[t])})),r},Fl=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][r]===t)return[t];if(Array.isArray(e[n].children)){const i=Fl(e[n].children,t,r);if(i)return[e[n][r],i].flat()}}},Hl=(e,t)=>{const r=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...Hl(e,t)))),r},_l=o().forwardRef(((e,t)=>{const{className:r,style:n,filterable:i=!0,multiple:a,draggable:l,dataSource:s,fetch:d,asyncLoad:u,checkStrictly:p,checkStrategy:h="SHOW_CHILD",placeholder:m=f("qm.form.inputPlaceholder"),fieldsDefine:g,value:b,height:y,defaultSelectedKeys:v=[],defaultExpandAll:x=!0,showSearchBar:E=!0,showCollapse:S=!0,onSelectChange:w,onCheckChange:C,onDragStart:T,onDragChange:N,onExpand:I}=e,{size:R}=o().useContext(c),P=o().useMemo((()=>e.size??R??""),[e.size,R]),O=g?.valueKey||"value",k=g?.textKey||"text",A=o().useRef(null),F=Pt(A),[H,_]=o().useState(y),[D,$]=o().useState(!1),q=Ot((()=>{_(A.current.offsetHeight-Z.current.offsetHeight-10)}),5);Ve((()=>{y||q()}),[F.height]);const[M,j]=o().useState([]),[K,V]=o().useState({}),[z,B]=o().useState([]),[U,W]=o().useState([]),[G,Y]=o().useState(""),[X,Q]=o().useState(x),Z=o().useRef(null),J=o().useRef([]),ee=o().useRef([]);o().useEffect((()=>{Array.isArray(s)&&(te(s),B(re(s)),V({}))}),[s]),o().useEffect((()=>{oe()}),[]),Ve((()=>{oe()}),[d?.params]),Ve((()=>{W(ae())}),[K]),o().useImperativeHandle(t,(()=>({INSERT_RECORD:(e,t)=>{const r=Array.isArray(t)?t:[t],n=kl(M,(t=>e===t[O]));n&&(Array.isArray(n.children)?n.children.push(...r):n.children=[...r],te([...M]))},REMOVE_RECORD:e=>{const t=Rl(M,e,O);if(void 0===t&&M.find((t=>t[O]===e)))te(M.filter((t=>t[O]!==e)));else{const r=kl(M,(e=>t===e[O]));if(!r)return;const n=r.children?.findIndex((t=>e===t[O]));n>=0&&(r.children.splice(n,1),te([...M]))}},UPDATE_RECORD:(e,t)=>{const r=kl(M,(t=>e===t[O]));r&&((0,ne.merge)(r,t),te([...M]))}})));const te=e=>{j(e),J.current=e,ee.current=Ll(e,O)},re=e=>{if(a)return v;const t=Ol(e,(e=>v.includes(e[k])));return 1===t.length?[t[0][O]]:[]},ie=e=>Fl(M,e,O)?.slice(0,-1)||[],ae=()=>{if(x)return ee.current;const e=[];return z.forEach((t=>{if(a){if("SHOW_ALL"===h&&!ee.current.includes(t)&&e.push(...ie(t)),"SHOW_CHILD"===h&&e.push(...ie(t)),"SHOW_PARENT"===h){const r=_n(M,t);if(r){const n=ie(t),i=Hl(r,O);e.push(...n,...[t,...i].filter((e=>ee.current.includes(e))))}}}else e.push(...ie(t))})),[...new Set(e)]},oe=async()=>{if(!d)return;const{api:e,params:t,dataKey:r,afterFetch:n,callback:i}=d;try{$(!0);const a=await e(t);if(200===a.code){let e=Array.isArray(a.data)?a.data:(0,ne.get)(a.data,r)??[];e="function"==typeof n?await n(e):e,te(e),B(re(e)),V({}),i?.(e)}}catch(e){}$(!1)},le=e=>`${e}|${ei.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,se=Ie("search-tree"),ce={[se]:!0,[`${se}--lg`]:"large"===P,[`${se}--sm`]:"small"===P};return o().createElement("div",{ref:A,className:Ne()(ce,r),style:n},o().createElement("div",{ref:Z,className:"topper"},E&&o().createElement(L.Input.Search,{value:G,size:P,placeholder:m,allowClear:!0,onChange:e=>(e=>{if(!i)return;const t=Pl(J.current,(t=>{if(!e)return!0;const r=t[k]||"";return-1!==le(r).indexOf(e)}));Y(e),j(t),x||e?W(Ll(t,O)):V({})})(e.target.value)}),S&&o().createElement("a",{className:"trigger",onClick:()=>{Q(!X),W(X?[]:ee.current)}},X?o().createElement(Re.UpOutlined,null):o().createElement(Re.DownOutlined,null)," ",f(X?"qm.form.collect":"qm.form.spread"))),o().createElement(St,{spinning:D},o().createElement(L.Tree,{fieldNames:{title:k,key:O,children:"children"},multiple:a,draggable:l,blockNode:l,checkable:a,selectable:!a,height:H,disabled:e.disabled,checkStrictly:p,selectedKeys:b??z,checkedKeys:b??z,expandedKeys:U,treeData:M,loadData:u?async e=>{let{key:t,children:r}=e;if(!d||r)return;const{api:n,params:i,dataKey:a,formatter:o=(e=>e),afterFetch:l}=d;try{const e=await n(o({...i,[O]:t}));if(200===e.code){let r=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,a)??[];r="function"==typeof l?await l(r):r;const n=Al(J.current,t,O,r);te(n)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!G)return!1;const t=e[k]||"";return-1!==le(t).indexOf(G)},onDragStart:T,onDragEnter:e=>{W(e.expandedKeys)},onDrop:e=>{const t=e.node.key,r=e.dragNode.key,n=e.node.pos.split("-"),i=e.dropPosition-Number(n[n.length-1]),a=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][O]===t)return r(e[n],n,e);e[n].children&&a(e[n].children,t,r)}},o=[...M];let l;if(a(o,r,((e,t,r)=>{r.splice(t,1),l=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===i)a(o,t,(e=>{e.children=e.children||[],e.children.unshift(l)}));else{let e,r=[];a(o,t,((t,n,i)=>{r=i,e=n})),-1===i?r.splice(e,0,l):r.splice(e+1,0,l)}else a(o,t,(e=>{e.children=e.children||[],e.children.unshift(l)}));te(o)},onDragEnd:e=>{N?.(e,M)},onExpand:(e,t)=>{pe(e)&&Q(!1),ee.current.every((t=>e.includes(t)))&&Q(!0),W(e),I?.(e,t)},onSelect:e=>{B(e);const t=Ol(J.current,(t=>e.includes((0,ne.get)(t,O))));w?.(a?t:t[0])},onCheck:e=>{p&&(e=e.checked),B(e),"SHOW_CHILD"===h&&(e=e.filter((e=>!ee.current.includes(e)))),"SHOW_PARENT"===h&&(e=e.filter(((e,t,r)=>!r.includes(Rl(M,e,O)))));const t=Ol(J.current,(t=>e.includes((0,ne.get)(t,O))));C?.(a?t:t[0])}})))}));_l.displayName="QmSearchTree";const Dl=_l,$l=(0,a.createContext)(void 0),ql={dataIndex:s().string.isRequired,title:s().string.isRequired,description:s().string,colSpan:s().number,width:s().number,minWidth:s().number,fixed:s().oneOf(["left","right"]),align:s().oneOf(["left","center","right"]),theadAlign:s().oneOf(["left","center","right"]),printFixed:s().bool,hidden:s().bool,noAuth:s().bool,noFixed:s().bool,ellipsis:s().bool,className:s().string,theadClassName:s().string,children:s().array,sorter:s().oneOfType([s().bool,s().func]),filter:s().shape({type:s().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:s().arrayOf(s().shape({text:s().string,value:s().oneOfType([s().string,s().number])})),style:s().object}),precision:s().number,displayPrecision:s().number,formatType:s().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:s().bool,canCopy:s().bool,editRender:s().func,dictItems:s().arrayOf(s().shape({text:s().string,value:s().oneOfType([s().string,s().number])})),summation:s().shape({sumBySelection:s().bool,displayWhenNotSelect:s().bool,dataKey:s().string,unit:s().string,render:s().func}),groupSummary:s().shape({dataKey:s().string,unit:s().string,render:s().func}),shouldCellUpdate:s().func,headRender:s().func,render:s().func},Ml=(s().arrayOf(s().shape(ql)).isRequired,s().func,s().array,s().oneOfType([s().string,s().func]).isRequired,s().number,s().bool,s().bool,s().shape({api:s().func.isRequired,params:s().object.isRequired,formatter:s().func,beforeFetch:s().func,afterFetch:s().func,stopToFirst:s().bool,dataKey:s().string,callback:s().func}),s().bool,s().bool,s().string,s().string,s().bool,s().bool,s().bool,s().bool,s().oneOfType([s().object,s().func]),s().oneOfType([s().object,s().func]),s().array,s().func,s().bool,s().bool,s().object,s().object,s().shape({type:s().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:s().array,selectedRowKeys:s().array,hideSelectAll:s().bool,checkStrictly:s().bool,filterable:s().bool,selectByClickRow:s().bool,selectFirstRowOnChange:s().bool,clearableAfterFetched:s().bool,selectAllOnCurrentPage:s().bool,fetchSelectedRows:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),fetchAllRowKeys:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),disabled:s().func,onChange:s().func,onSelect:s().func,onSelectAll:s().func}),s().shape({currentRowKey:s().oneOfType([s().number,s().string]),disabled:s().func,onChange:s().func}),s().shape({virtual:s().bool,expandIconColumn:s().string}),s().shape({defaultExpandAllRows:s().bool,defaultExpandedRowKeys:s().array,expandedRowKeys:s().array,hideExpandAll:s().bool,rowExpandable:s().func,expandedRowClassName:s().string,expandedRowRender:s().func,onExpand:s().func,onChange:s().func}),s().shape({groupItems:s().arrayOf(s().shape({dataIndex:s().string.isRequired,titleIndex:s().string,color:s().string,backgroundColor:s().string})),fetch:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),onChange:s().func}),s().func,s().bool,s().bool,s().bool,s().bool,s().shape({current:s().number,pageSize:s().number,pageSizeOptions:s().array,showSizeChanger:s().bool,showQuickJumper:s().bool}),s().shape({fileName:s().string,fetch:s().shape({api:s().func.isRequired,params:s().object}),beforeExport:s().func,cellStyle:s().bool,hideIcon:s().bool}),s().shape({showLogo:s().bool}),s().shape({fetch:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),fieldList:s().arrayOf(s().object)}),s().shape({position:s().oneOf(["top","bottom"]),hideAlert:s().bool,hideClearButton:s().bool}),s().oneOf(["left","right"]),s().func,s().func,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().func,s().func,s().func,s().func,s().func,s().func,s().func,s().func,s().func,s().func,10),jl="1",Kl="0",Vl="YYYY-MM-DD",zl="YYYY-MM-DD HH:mm:ss",Bl="YYYYMMDDHHmmss",Ul={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let Wl=function(e){return e.left="flex-start",e.right="flex-end",e}({}),Gl=[];const Yl={getFocusInstance:function(){return Gl[0]??null},getInstance:function(e){return Gl.find((t=>t.id===e))??null},focus:function(e){const t=this.getInstance(e);t&&0!==Gl.findIndex((e=>e===t))&&(this.deregister(e),Gl=[t,...Gl])},register:function(e,t){e&&t&&(null!==this.getInstance(e)&&this.deregister(e),Gl=[{id:e,vm:t},...Gl])},deregister:function(e){e&&(Gl=Gl.filter((t=>t.id!==e)))}};function Xl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ql=class{constructor(){Xl(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),Xl(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),Xl(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)})),Xl(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),Xl(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)})),Xl(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),Xl(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)})),Xl(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),Xl(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),Xl(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),Xl(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),Xl(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),Xl(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),Xl(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]})),Xl(this,"destroy",(()=>{for(const e in this)this[e]=null}))}},Zl={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:150,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored"};let Jl;const es=()=>{if(ie)return 0;if(void 0!==Jl)return Jl;const e=document.createElement("div");e.className="qm-scrollbar__wrap",e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);const t=e.offsetWidth;e.style.overflow="scroll";const r=document.createElement("div");r.style.width="100%",e.appendChild(r);const n=r.offsetWidth;return e.parentNode?.removeChild(e),Jl=t-n,Jl},ts=e=>e.map((e=>{const t={...e};return t.children&&(t.children.forEach((e=>{t.fixed?e.fixed=t.fixed:delete e.fixed})),t.children=ts(t.children)),t})),rs=(e,t)=>{const{fetch:r,columns:n,height:i,minHeight:a,maxHeight:l,border:s=!0,rowSelection:c,summation:d,expandable:u,treeConfig:p,webPagination:h,scrollPagination:m,dragMergeCell:g,showSuperSearch:b,showFastSearch:y,showGroupSummary:v,showTableImport:x,showClipboard:E,showSelectCollection:S,footRender:w}=e,{tableRef:C,tableFullData:T,tableData:N,selectionKeys:I,sorter:R,filters:P,superFilters:O,pagination:k}=t,{selectionRows:A,summaries:L}=C.current,{expandIconColumn:F=""}=p||{},H=o().useMemo((()=>!!r?.api),[r?.api]),_=o().useMemo((()=>!H&&!!h),[H,h]),D=o().useMemo((()=>H&&!!m),[H,m]),$=o().useMemo((()=>(H||_)&&!D),[H,_,D]),q=o().useMemo((()=>!!(i||a||l)),[i,a,l]),M=o().useMemo((()=>(e=>{const t=(e=>{const t=[],r=[],n=[];for(let i=0;i<e.length;i++){const a=e[i];"left"===a.fixed?t.push(a):"right"===a.fixed?r.push(a):n.push(a)}return[...t,...n,...r]})(ts(e)),r=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:Zl.selectionColumn,title:"radio"===t?f("qm.table.config.selectionText"):"",width:Zl.selectionColumnWidth,fixed:"left",type:t}})(c),n=(i=u,i?.expandedRowRender?{dataIndex:Zl.expandableColumn,title:"",width:Zl.selectionColumnWidth,fixed:"left",type:"expand"}:null);var i;return r&&t.unshift(r),n&&t.unshift(n),qr(t)})(n)),[n]),j=o().useMemo((()=>$r(M)),[M]),K=o().useMemo((()=>j.filter((e=>"function"==typeof e.editRender))),[j]),V=o().useMemo((()=>j.filter((e=>!!e.summation))),[j]),z=o().useMemo((()=>j.filter((e=>"left"===e.fixed))),[j]),B=o().useMemo((()=>j.filter((e=>"right"===e.fixed))),[j]),U=o().useMemo((()=>{const e=j.filter((e=>![Zl.expandableColumn,Zl.selectionColumn,Zl.operationColumn].includes(e.dataIndex)));return F&&e.some((e=>e.dataIndex===F))?F:e[0]?.dataIndex??""}),[j,F]),W=o().useMemo((()=>V.length>0),[V]),G=o().useMemo((()=>!!w||W),[w,W]),Y=o().useMemo((()=>Gr(M).length>1),[M]),X=o().useMemo((()=>s||Y),[s,Y]),Q=o().useMemo((()=>j.some((e=>e.sorter))),[j]),Z=o().useMemo((()=>j.some((e=>e.filter))),[j]),J=o().useMemo((()=>V.some((e=>!!e.summation.dataKey))),[V]),ee=o().useMemo((()=>!H&&!!x),[H,x]),te=o().useMemo((()=>!!E&&K.length>0),[E,K]),re=o().useMemo((()=>!!S&&"checkbox"===c?.type),[S,c]),ne=o().useMemo((()=>!!b&&Z),[b,Z]),ie=o().useMemo((()=>!H&&!!y&&Z),[H,y,Z]),ae=o().useMemo((()=>!!v&&j.some((e=>!!e.groupSummary))),[j]),oe=o().useMemo((()=>!!d?.groupItems?.length),[d]),le=o().useMemo((()=>!!g&&!H&&!h),[g,H,h]),se=o().useMemo((()=>T.some((e=>Array.isArray(e.children)))),[T]),ce=o().useMemo((()=>!N.length),[N]),de=o().useMemo((()=>(()=>{const e={};return V.forEach((t=>{const{dataIndex:r,precision:n,displayPrecision:i,summation:a}=t,{sumBySelection:o,displayWhenNotSelect:l,unit:s}=a,c=oe?dn(C.current.tableFullData):C.current.tableFullData,d=!A.length&&!!l;let u=(!o||d?c:A).reduce(((e,t)=>{if(t?.[Zl.summaryIgnore])return e;const n=Zr(t,r);return tn(n)?e.plus(n):e}),new(Ni())(0));!Object.keys(L).includes(r)||o&&!d||(u=new(Ni())(Zr(L,r))),Jr(e,r,u.toNumber());let p=n>=0?u.toFixed(n):u.toString();i>=0&&""!==p&&(p=nn(p,i)),p=rn(p),Jr(e,`${r}_text`,s?`${p} ${s}`:p)})),[e]})()),[N,I,L]),ue=o().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(V)),[V]),pe=o().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((r=>{null!==e[r]&&t.push(`${r}|${e[r]}`)})),t.join(",")})(R),t=((e,t)=>{const r=[];if(Object.keys(e).length)for(const t in e){const[n,i]=Zl.showFilterType?t.split("|"):[t,""],a=e[t];Object.keys(a).forEach((e=>{r.push({type:i,bracketLeft:"",fieldName:n,expression:e,value:a[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{r.push({type:Zl.showFilterType?e.fieldType:"",bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),r.length&&(r[r.length-1].logic=""),r})(P,O);return{...e?{[Zl.sorterFieldName]:e}:null,...t.length?{[Zl.filterFieldName]:t}:null,...ue?{[Zl.groupSummary.summaryFieldName]:ue,usedJH:1}:null,...r?.params??null,[Zl.currentPageName]:k.current,[Zl.pageSizeName]:k.pageSize}}),[r?.params,k.current,k.pageSize,R,P,O,ue]);return{isFetch:H,isWebPagination:_,isScrollPagination:D,showPagination:$,shouldUpdateHeight:q,tableColumns:M,flattenColumns:j,editableColumns:K,summationColumns:V,leftFixedColumns:z,rightFixedColumns:B,treeExpandIndex:U,showSummary:W,showFooter:G,isHeadGroup:Y,bordered:X,isHeadSorter:Q,isHeadFilter:Z,isServiceSummation:J,isSelectCollection:re,isTableImport:ee,isTableClipboard:te,isSuperSearch:ne,isFastSearch:ie,isGroupSummary:ae,isGroupSubtotal:oe,isDragMergeCell:le,isTreeTable:se,isTableEmpty:ce,summationRows:de,fetchParams:pe}},ns=require("react-dom");var is=n.n(ns);function as(e){const t=a.useRef();t.current=e;const r=a.useCallback((function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.current?.(...r)}),[]);return r}const os=(e,t)=>{const r=a.useRef(!0);a.useLayoutEffect((()=>e(r.current)),t),a.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function ls(e,t){os((t=>{if(!t)return e()}),t)}const ss=(e,t)=>{const{rowKey:r,dataSource:n,summation:i,fetch:a,initialSorter:l,initialFilter:s,rowSelection:c,expandable:d,treeConfig:u,authConfig:p,ignorePageIndex:h,columnsChange:m,onChange:f,onDataChange:g,onDataLoad:b,onScrollEnd:y,onFetchError:x}=e,{getRowKey:E,tableRef:S,tableElementRef:w,tableBodyRef:C,$size:T,tableColumns:N,flattenColumns:I,tableFullData:R,pagination:P,layout:O,filters:k,sorter:A,superFilters:L,fetchParams:F,selectionKeys:H,rowExpandedKeys:_,highlightKey:D,summationColumns:$,shouldUpdateHeight:q,isFetch:M,isTreeTable:j,isWebPagination:K,isScrollPagination:V,isServiceSummation:z,isGroupSubtotal:B,doLayout:U,setTableData:W,setTableFlatColumns:G,setTableFullData:Y,setTableOriginData:X,setAllTableData:Q,setDeriveRowKeys:Z,setPagination:J,setSpinning:ee,setSorter:te,setFilters:ie,setSuperFilters:ae,setSelectionKeys:oe,setRowExpandedKeys:le,setHighlightKey:ce,setSelectionRows:de,setScrollXLoad:ue,setScrollYLoad:he,setScrollXStore:me,setScrollYStore:fe,computeVirtualX:ge,computeVirtualY:be,setFieldAuth:ye,setResizeState:ve,setSummaries:xe,setPermission:Ee,setRecordsMap:Se,resetTableScroll:we,clearElementStore:Ce,clearRecordsMap:Te}=t,{store:Ne}=S.current,Ie=Number.parseInt(o().version)>=18?is().flushSync:null,Re=Pt(w),Pe=o().useRef({...F}),Oe=o().useRef(new Map),ke=o().useRef(!1);Ve((()=>{U(),_e(),S.current.scrollXLoad&&De()}),[N,T,O.tableAutoHeight]),ls((()=>{Ae()}),[Re]),Ve((()=>{bt(),yt(),vt(),M||(K&&st(),rt(n)),l&&te(l),s&&ie(s)}),[n,a?.params]),Ve((()=>{const e=Ze(F,Pe.current);e||M&&c?.clearableAfterFetched&&xt(),!e&&F[Zl.currentPageName]>1&&!a?.stopToFirst?st():M&&et(),Pe.current=F}),[F]),Ve((()=>{K&&ht(),V||we(),Ye()}),[P.current,P.pageSize]),Ve((()=>{M||Le(R.length),U()}),[R]),Ve((()=>{j&&u?.virtual&&(ct(),ht())}),[_]);const Ae=()=>{const{scrollXLoad:e,scrollYLoad:t,resizeState:r}=S.current,{height:n}=r,{width:i,height:a}=Re,o=a!==n;U(),e&&De(),o&&q&&t&&ht(),ve(Object.assign({},r,{width:i,height:a}))},Le=e=>{e!==P.total&&J((t=>Object.assign({},t,{total:e})))},Fe=e=>{ke.current=e},He=Ot((e=>{at(),y?.(e)})),_e=()=>{ue(I.length>Zl.virtualScrollX)},De=()=>{$e(),qe()},$e=()=>{const{scrollXLoad:e,scrollXStore:t}=S.current;if(!e)return;const r=[],n=[],i=[];for(let e=0;e<I.length;e++){const a=I[e];a.fixed?"left"===a.fixed?r.push(a):i.push(a):e>=t.startIndex&&e<t.endIndex&&n.push(a)}Ie?queueMicrotask((()=>Ie((()=>G([...r,...n,...i]))))):G([...r,...n,...i])},qe=()=>{const{elementStore:e,scrollXStore:t,scrollXLoad:r}=S.current,{tableBodyWidth:n,gutterWidth:i}=O;if(!r)return;const a=`${I.slice(0,t.startIndex).filter((e=>!e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)}px`,o=`${scrollY?n-i:n}px`;e.$tableBody.style.marginLeft=a,e.$tableXspace.style.width=o},Me=e=>B?je(Ke(e,0)):e,je=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...je(e.children)),delete e.children,t.push(e)})),t},Ke=(e,t)=>{const n=i.groupItems?.[t];return n?pn(e,[n.dataIndex]).map((e=>{const i={children:Ke(e,t+1),_group:n.dataIndex};return"function"!=typeof r&&Jr(i,r.toString(),ln()),n.titleIndex&&Jr(i,n.titleIndex,Zr(e[0],n.titleIndex)),Jr(i,n.dataIndex,Zr(e[0],n.dataIndex)),$.forEach((e=>{const{dataIndex:t}=e,r=i.children?.reduce(((e,r)=>{if(r[Zl.summaryIgnore])return e;const n=Number(Zr(r,t));return Number.isNaN(n)?e:e+n}),0);Jr(i,t,r)})),i})):(e.forEach(((t,r)=>{t._rowSpan=0===r?e.length:0,t._colSpan=1})),e)},ze=e=>{oe(e),de((e=>{const{selectionRows:t,allTableData:r,recordsMap:n}=S.current;if(M)return[...t.filter((t=>e.includes(E(t,t.index)))),...r.filter((r=>{const n=E(r,r.index);return e.includes(n)&&-1===t.findIndex((e=>E(e,e.index)===n))}))];const i=[];for(let t=0,r=e.length;t<r;t++){const r=e[t];n.has(r)&&i.push(n.get(r))}return i})(e))},Be=e=>{const{type:t,checkStrictly:r=!0}=c||{},n=Array.isArray(e)?e:H;let i=[];return S.current.treeTable&&!r&&n.forEach((e=>{i.push(...((e,t)=>{const{disabled:r}=c||{},{deriveRowKeys:n,recordsMap:i}=S.current,a=Ur(n,e);let o=[];if(!a)return o;const l=We(a?.children||[]);return o=[...new Set([...t,...l])],r&&(o=o.filter((e=>!i.has(e)||!r(i.get(e))))),(mn(n,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Ur(n,e),r=t?.children?.every((e=>o.includes(e.rowKey)));o=r?[...o,e]:o.filter((t=>t!==e))})),o})(e,n))})),i="radio"===t?n.slice(0,1):[...new Set([...n,...i])],i},Ue=e=>{const{allRowKeys:t,flattenRowKeys:r}=S.current,{defaultExpandAllRows:n,expandedRowRender:i}=d||{},a=Array.isArray(e)?e:_;if(S.current.treeTable){i&&v("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...H];D&&e.unshift(D);let o=[];return e.forEach((e=>{const t=mn(S.current.deriveRowKeys,e)||[];o.push(...t.length>1?t.slice(0,-1).reverse():t)})),o=n?t:[...new Set([...a,...o])],o.filter((e=>!r.includes(e)))}return d?n?t.slice(0):[...a]:[]},We=e=>{const t=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&t.push(...We(e[r].children)),t.push(e[r].rowKey);return t},Ge=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Ge(e.children,t)),e.rowKey===t&&e.parentRowKey&&r.push(e.parentRowKey)})),r.length&&r.push(...Ge(e,r[r.length-1])),r},Ye=Ot((()=>{f?.(P,Qe(k),Xe(A),L,{currentDataSource:ut()})})),Xe=e=>{const t={};for(const r in e)null!==e[r]&&(t[r]=e[r]);return t},Qe=e=>{const t={};for(const r in e){if(!r.includes("|"))continue;const[n,i]=r.split("|");t[Zl.showFilterType?`${n}|${i}`:n]=e[r]}return t},Ze=(e,t)=>{const r=Object.keys(Qr(e,t));return 1===r.length&&(r.includes(Zl.currentPageName)||r.includes(Zl.pageSizeName))},Je=as((async()=>{if(!a)return;const{formatter:e=(e=>e),beforeFetch:t=se,afterFetch:r,callback:n}=a;if(!t(F))return;const o=!!i?.fetch?.api;ee(!0);try{const[t,l]=o?await Promise.all([a.api(e(F)),i.fetch.api(e(F))]):[await a.api(e(F))];if(S.current.unMounted)return;if(o?200===t.code&&200===l.code:200===t.code){const e=a.dataKey??Zl.dataKey;let i=(0,ne.get)(t.data,e)??[];i="function"==typeof r?await r(i):i;const o=(0,ne.get)(t.data,e.replace(/[^.]+$/,Zl.totalKey))||i.length||0,s=Math.max(Math.ceil(o/P.pageSize),1);if(F[Zl.currentPageName]>s)return ot({...P,current:s});rt(ke.current?S.current.tableFullData.concat(i):i),Le(o),nt(l?.data||t.data),n?.(t.data,t)}}catch(e){x?.(e)}((e,t)=>Object.prototype.hasOwnProperty.call(e,"stopToFirst"))(a)&&(a.stopToFirst=!1),ee(!1),Fe(!1)})),et=Ot(Je),tt=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=tt(e.children)),e.index=t,h||(e.pageIndex=(e=>{const{current:t,pageSize:r}=P;return!M||V?e:(t-1)*r+e})(t)),e))),rt=e=>{const t=Me(tt(e));mt(t),ft(t),gt(),ze(Be()),le(Ue()),it(),b?.(t)},nt=e=>{if(!z)return;const t=i?.fetch?.dataKey??Zl.summationKey,r=(t?(0,ne.get)(e,t):e)??{},n={};$.filter((e=>!!e.summation.dataKey)).forEach((e=>{Jr(n,e.dataIndex,Number(Zr(r,e.summation.dataKey)))})),xe(n)},it=()=>{const{type:e,selectFirstRowOnChange:t}=c||{};if("radio"===e&&t){const e=ut();if(e.length){const t=E(e[0],e[0].index);ze([t])}else ze([])}},at=()=>{if(!V)return;const e=lt();ke.current||P.current>=e||(Fe(!0),ot({...P,current:P.current+1}))},ot=e=>{let{current:t,pageSize:r}=e;J((e=>Object.assign({},e,{current:t,pageSize:r})))},lt=()=>{const{pageSize:e,total:t}=P;return Math.ceil(t/e)||1},st=()=>{ot(Object.assign({},P,{current:1}))},ct=()=>{if(!S.current.treeTable||!u?.virtual)return;const e=dt(S.current.deriveRowKeys,(()=>{const{allTableData:e,allRowKeys:t}=S.current,{rowExpandable:r}=d||{},n=[];return"function"==typeof r&&e.forEach(((e,i)=>!r(e)&&n.push(t[i]))),n.length?_.filter((e=>!n.includes(e))):_})());Oe.current.clear(),e.forEach(((e,t)=>Oe.current.set(e,t)))},dt=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...dt(e.children,t)),(void 0===e.parentRowKey||t.includes(e.parentRowKey)&&e.rowKeyPath.split("#").slice(0,-1).every((e=>t.findIndex((t=>t==e))>-1)))&&r.push(e.rowKey)})),r},ut=()=>K?(()=>{const{current:e,pageSize:t}=P;return S.current.tableFullData.slice((e-1)*t,e*t)})():S.current.tableFullData,pt=e=>{const{scrollYLoad:t,scrollYStore:r}=S.current;if(!t)return W(e);const{startIndex:n,endIndex:i}=r;Ie?queueMicrotask((()=>Ie((()=>W(e.slice(n,i)))))):W(e.slice(n,i))},ht=()=>{let e=ut();S.current.treeTable&&u?.virtual&&(e=(e=>{const{allTableData:t,allRowKeys:r}=S.current,n=[];for(let e=0,i=r.length;e<i;e++){const i=r[e];Oe.current.has(i)&&n.push(t[e])}return n})()),he(e.length>Zl.virtualScrollY),pt(e),(e=>{const{elementStore:t,scrollYStore:r,scrollYLoad:n}=S.current,{startIndex:i,rowHeight:a}=r;if(!n)return;const o=`${Math.max(0,i*a)}px`,l=e.length*a+"px";t.$tableBody.style.marginTop=o,t.$tableYspace.style.height=l})(e)},mt=e=>{Y(e),Q(e),Z(e),ct(),ht()},ft=e=>{X(e)},gt=()=>{const{allTableData:e}=S.current;Te(),e.forEach((e=>Se(E(e,e.index),e)))},bt=()=>{te({})},yt=()=>{ie({})},vt=()=>{ae([])},xt=()=>{ze([])};return{initialTable:()=>{(async()=>{if(!p)return;let t=re()(p,["fetch"]);if(p.fetch){const{api:e,params:r,dataKey:n}=p.fetch;try{const i=await e(r);200===i.code&&(t=(n?(0,ne.get)(i.data,n):i.data)??{})}catch(e){}}if(Object.keys(t).length){const{isExport:e=1,isImport:r=1,isPrint:n=1}=t;Ee((t=>Object.assign({},t,{export:!!e,import:!!r,print:!!n})))}if(Array.isArray(t.fieldList)){const{originColumns:r}=S.current,n=jr(e.columns,(e=>{const{dataIndex:n}=e,i=t.fieldList.find((e=>e.dataIndex===n));if(i){const{visible:t=1,disabled:a,secretName:o}=i,l=Kr(r,n);ye(n,{visible:t,disabled:a,secretName:o}),t||(e.noAuth=!0,l.noAuth=!0),o&&(e.formatType=`secret-${o}`,l.formatType=`secret-${o}`)}}));m?.(n)}})(),D&&C.current.setClickedValues([D,""]),"radio"===c?.type&&H.length&&C.current.setClickedValues([H[0],""]),_e(),M?Je():rt(n)},checkDataIndex:()=>{const e=I.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&v("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:mt,getTableData:Je,handleTableData:pt,createTableData:rt,createGroupData:Me,createSelectionKeys:Be,createRowExpandedKeys:Ue,setSelectionKeysEffect:ze,findParentRowKeys:Ge,getAllChildRowKeys:We,doFieldValidate:(e,t,r,n)=>{if(!Array.isArray(e))return v("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Ne.removeFromRequired({x:r,y:n}),Ne.removeFromValidate({x:r,y:n}),e.forEach((e=>{e.required&&pe(t)&&Ne.addToRequired({x:r,y:n,text:e.message}),"function"!=typeof e.validator||e.validator?.(t)||Ne.addToValidate({x:r,y:n,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:r,updated:n,removed:i}=Ne.state,a=(0,ne.intersection)(r,i),o=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:o(e),validate:o(t),inserted:r.filter((e=>!a.includes(e))),updated:n.filter((e=>![...(0,ne.intersection)(n,r),...(0,ne.intersection)(n,i)].includes(e))),removed:i.filter((e=>!a.includes(e)))}},dataChange:()=>{g?.(S.current.tableFullData)},tableChange:Ye,toLastPage:()=>{const e=lt();P.current!==e&&ot(Object.assign({},P,{current:e}))},toFirstPage:st,getPageCount:lt,pagerChangeHandle:ot,triggerScrollXEvent:e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollXStore:t}=S.current,{startIndex:r,endIndex:n,offsetSize:i}=t,{toVisibleIndex:a,visibleSize:o}=ge(e,O.tableWidth),l=Math.max(0,a-1-i),s=a+o+i;(a<=r||a>=n-o-1)&&(r===l&&n===s||(me(Object.assign({},t,{startIndex:l,endIndex:s})),De()))}(e)},triggerScrollYEvent:e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollYStore:t}=S.current,{startIndex:r,endIndex:n,offsetSize:i,visibleSize:a,rowHeight:o}=t,{toVisibleIndex:l}=be(e,o),s=Math.max(0,l-1-i),c=l+a+i;(l<=r||l>=n-a-1)&&(r===s&&n===c||(fe(Object.assign({},t,{startIndex:s,endIndex:c})),ht()))}(e)},scrollBottomDebouncer:He,clearTableSorter:bt,clearTableFilter:yt,clearSuperFilters:vt,clearRowSelection:xt,clearRowHighlight:()=>{ce("")},clearTableLog:()=>{Ne.clearAllLog()},destroy:()=>{Ce(),Ne.destroy(),Yl.deregister(S.current.uid)}}},cs=(e,t)=>{const{height:r,minHeight:n,maxHeight:i,ellipsis:a,showHeader:l,spanMethod:s}=e,{getRowKey:c,tableRef:d,$size:u,tableColumns:p,flattenColumns:h,leftFixedColumns:m,layout:f,scrollX:g,scrollY:b,tableData:y,showFooter:v,showPagination:x,isWebPagination:E,isFullScreen:S,setLayout:w,setScrollX:C,setScrollY:T,setElementStore:N,setScrollXStore:I,setScrollYStore:R,setShouldToTop:P}=t,O=o().useRef(b),k=o().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=f,a={};return n&&Object.assign(a,{minHeight:`${Xr(n)}px`}),i&&Object.assign(a,{maxHeight:`${Xr(i)}px`}),S?{...a,maxHeight:"",minHeight:"",height:`${e}px`}:r?{...a,height:"auto"!==r?`${Xr(r)}px`:`${t}px`}:a}),[r,i,n,S,f]),A=()=>{const{elementStore:e,scrollYLoad:t,resizeState:r}=d.current;if(!e.$table.offsetParent)return;const n=e.$table.offsetHeight,i=l?e.$header.offsetHeight:f.headerHeight,a=v?e.$footer.offsetHeight:f.footerHeight,o=n-i-a,s=e.$tableBody.offsetHeight,c=t||s>o;let u=0;if(S){const t=e.$toper?e.$toper.offsetHeight+Ml:0,n=e.$pager?e.$pager.offsetHeight+Ml:0;u=r.winHeight-t-n-20}(t||o!==f.viewportHeight)&&F(o),O.current=c,T(c),w((e=>Object.assign({},e,{headerHeight:i,footerHeight:a,viewportHeight:o,tableBodyHeight:s,tableFullHeight:u})))},L=(e,t)=>{const r=e+t;let n=-1,i=0,a=0;for(let t=0,o=h.length;t<o;t++){const o=h[t];if(i+=o.width||o.renderWidth,-1===n&&e<i&&(n=t),n>=0&&(a++,i>r))break}return{toVisibleIndex:Math.max(0,n),visibleSize:Math.max(8,a)}},F=e=>{const{scrollBarRef:t,scrollYStore:r,isIE:n}=d.current,i=t.current.scrollTop,{rowHeight:a}=r,{toVisibleIndex:o}=H(i,a),l=Math.max(8,Math.ceil(e/a)+2),s=n?5:0,c=Math.max(0,o-1-s),u=Math.max(o+l+s,r.endIndex);R(Object.assign({},r,{visibleSize:l,offsetSize:s,startIndex:c,endIndex:u}))},H=(e,t)=>{const r=Math.floor(e/t);return{toVisibleIndex:Math.max(0,r)}},_=(e,t)=>{const{elementStore:r,scrollYStore:n,allTableData:i}=d.current,a=r.$tableBody.parentNode.parentNode;if(void 0!==t&&t>=0)a.scrollTop=t*n.rowHeight;else{const t=(E?Wr(y):i).findIndex((t=>e===c(t,t.index)));a.scrollTop=(t<0?0:t)*n.rowHeight}};return{createElementStore:e=>{Object.keys(e).forEach((t=>{N(t,e[t])}))},tableStyles:k,getSpan:(e,t,r,n,i)=>{let a=1,o=1;if("function"==typeof s){const l=s({row:e,column:t,rowIndex:r,columnIndex:n,tableData:i});Array.isArray(l)?(a=l[0],o=l[1]):(0,ne.isPlainObject)(l)&&(a=l.rowSpan,o=l.colSpan)}const{mergeCells:l}=d.current;if(l.length>0){const e=l.find((e=>e.row===r&&e.col===n));e&&(a=e.rowSpan,o=e.colSpan)}return{rowSpan:a,colSpan:o}},getStickyLeft:e=>{h.findIndex((t=>t.dataIndex===e))<0&&(e=Vr(Kr(p,e)).dataIndex);let t=0;for(let r=0;r<h.length;r++){const n=h[r];if(n.dataIndex===e)break;t+=n.width||n.renderWidth||0}return t},getStickyRight:(e,t)=>{h.findIndex((t=>t.dataIndex===e))<0&&(e=zr(Kr(p,e)).dataIndex);const r="thead"===t?(e=>{if(!e.some((e=>e.colSpan>0)))return e;const t=[];let r=[];return e.forEach((e=>{e.colSpan>0&&r.length>0&&(t.push(r),r=[]),r.push(e)})),r.length>0&&t.push(r),t.map((e=>{const[t,r]=e.reduce(((e,t)=>(t.colSpan>0?e[0].push(t):e[1].push(t),e)),[[],[]]);return[...r,...t.reverse()]})).flat()})(h):h;let n=0;for(let t=r.length-1;t>=0;t--){const i=r[t];if(i.dataIndex===e)break;n+=i.width||i.renderWidth||0}return n},scrollXToColumn:(e,t)=>{const{elementStore:r}=d.current,n=void 0===t?h.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const i=m.map((e=>e.width||e.renderWidth||Zl.defaultColumnWidth)).reduce(((e,t)=>e+t),0);r.$tableBody.parentNode.parentNode.scrollLeft=r.$tableBody.querySelectorAll("tbody > tr > td")[n].offsetLeft-i},scrollYToRecord:_,rowInViewport:e=>{const{elementStore:t,scrollYStore:r}=d.current,{viewportHeight:n,gutterWidth:i}=f,a=e*r.rowHeight,o=t.$tableBody.parentNode.parentNode;return!(a<o.scrollTop||a+r.rowHeight>o.scrollTop+(g?n-i:n))},calcTableHeight:()=>{if("auto"!==r)return;const{elementStore:e,resizeState:t}=d.current,n=t.winHeight-e.$table.getBoundingClientRect().top-(x?Hi["small"!==u?"middle":u]+Ml:0)-Ml;w((e=>Object.assign({},e,{tableAutoHeight:n})))},resetTableScroll:()=>{const{shouldToTop:e}=d.current;e&&_("",0),P(!0)},computeVirtualX:L,computeVirtualY:H,doLayout:()=>{a?A():de((()=>A())),(()=>{const{elementStore:e,scrollXLoad:t}=d.current,r=e.$table.clientWidth,n=O.current?f.gutterWidth:0,{defaultColumnWidth:i}=Zl,a=[];let o=0;if(h.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,o+=e.width):(e.renderWidth=void 0,a.push(e))})),a.length>0){const e=h.reduce(((e,t)=>e+(t.width||t.minWidth||i)),0);if(e<=r-n){C(!1);const t=r-n-e;if(1===a.length)a[0].renderWidth=(a[0].minWidth||i)+t;else{const e=t/a.reduce(((e,t)=>e+(t.minWidth||i)),0);let r=0;a.forEach(((t,n)=>{if(0===n)return;const a=Math.floor((t.minWidth||i)*e);r+=a,t.renderWidth=(t.minWidth||i)+a})),a[0].renderWidth=(a[0].minWidth||i)+t-r}}else C(!0),a.forEach((e=>{e.renderWidth=e.minWidth||i}));w((t=>({...t,tableBodyWidth:Math.max(e,r)})))}else o=h.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||i)),0),C(o>r),w((e=>({...e,tableBodyWidth:o})));w((e=>({...e,tableWidth:r}))),t&&(e=>{const{scrollXStore:t,isIE:r,scrollBarRef:n}=d.current,i=n.current.scrollLeft,{toVisibleIndex:a,visibleSize:o}=L(i,e),l=r?5:0,s=Math.max(0,a-1-l),c=Math.max(a+o+l,t.endIndex);I(Object.assign({},t,{visibleSize:o,offsetSize:l,startIndex:s,endIndex:c}))})(r)})()}}},ds=e=>{const{total:t}=e,{tableRef:r,selectionKeys:n,isHeadSorter:i,isHeadFilter:a,isTreeTable:l,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearRowSelection:u,clearRowHighlight:p}=o().useContext($l),{infoBarConfig:h,rowSelection:m,rowHighlight:g}=r.current.props,{allTableData:b,invalidRowKeys:y}=r.current,{hideAlert:v,hideClearButton:x}=h||{},E=o().useMemo((()=>!v),[v]),S=o().useMemo((()=>!x&&!!(i||a||m||g)),[x,i,a,m,g]),w=Ie("table"),C={[`${w}__alert`]:!0};return E?o().createElement("div",{className:Ne()(C)},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.InfoCircleFilled,null)),o().createElement("span",null,f("qm.table.alert.total",{total:l?b.length:t}),m?`,${f("qm.table.alert.selected",{total:Math.max(n.length-y.length,0)})}`:""),S&&o().createElement("em",{onClick:()=>{c(),d(),u(),p(),de((()=>s()))}},f("qm.table.alert.clear"))):null},us=o().forwardRef(((e,t)=>{const{isFullScreen:r,open:n=!0}=e,{setFullScreen:i}=o().useContext($l),a=()=>{i(!r)};o().useImperativeHandle(t,(()=>({clickHandle:a})));const l=Ie("table");return n?o().createElement("span",{className:`${l}-full-screen`,title:f(r?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>a()},o().createElement("i",{className:"svgicon icon"},r?o().createElement(Re.FullscreenExitOutlined,null):o().createElement(Re.FullscreenOutlined,null))):null}));us.displayName="FullScreen";const ps=us,hs=o().forwardRef(((e,t)=>{const{open:r=!0}=e,{getTableData:n}=o().useContext($l),i=()=>{n()};o().useImperativeHandle(t,(()=>({clickHandle:i})));const a=Ie("table");return r?o().createElement("span",{className:`${a}-reload`,title:f("qm.table.refresh.text"),onClick:()=>i()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.ReloadOutlined,null))):null}));hs.displayName="Reload";const ms=hs,fs=()=>{const e={dateFormat:e=>{const t=e?u()(e).format(Vl):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?u()(e).format(zl):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?u()(e).format(zl.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>tn(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>rn(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,r,n)=>{const{dictItems:i,precision:a,displayPrecision:o,formatType:l,editRender:s}=r,c=i||s?.(n,r)?.items||[];let d=c.find((e=>e.value==t))?.text??t??"";if(Array.isArray(t)&&(d=t.map((e=>c.find((t=>t.value==e))?.text??e)).join(",")),a>=0&&""!==d&&(d=tn(d)?new(Ni())(d).toFixed(a):d),o>=0&&""!==d&&(d=nn(d,o)),l){const t=e[`${ue(l)}Format`];t?d=t(d):v("Table","字段的格式化类型 `formatType` 配置不正确")}return d},r=e=>ae(e)?sn(e).join(""):e??"";return{renderText:t,getTitleFromCellNode:r,getTitleFromCellValue:(e,n,i,a)=>{const o=Zr(e,n.dataIndex),l=n.render?n.render(o,e,n,i,a):t(o,n,e);return r(l)}}},gs=o().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,{global:i}=o().useContext(c),{tableRef:a,flattenColumns:l,summationRows:s,showSummary:d,getSpan:u}=o().useContext($l),{tablePrint:p,showHeader:h}=a.current.props,{getTitleFromCellValue:m}=fs(),g=i?.print?.leftLogo??"",b=i?.print?.rightLogo??"",y=!(!g&&!b),v=o().useMemo((()=>fe(Br(r,[Zl.expandableColumn,Zl.selectionColumn,Zl.operationColumn]))),[r]),x=o().useMemo((()=>fe(Br(l,[Zl.expandableColumn,Zl.selectionColumn,Zl.operationColumn]))),[l]),E=o().useMemo((()=>fe(r.filter((e=>e.printFixed)))),[r]),S=e=>{const t=Object.assign({},hn(v,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?S(t):t},w=(e,t)=>(0,ne.map)((0,ne.groupBy)((0,ne.flatten)(e),t),(0,ne.spread)((function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return(0,ne.mergeWith)(...r,((e,r)=>{if(Array.isArray(e))return w(e.concat(r),t)}))}))),C=()=>{const{allTableData:e}=a.current,t=(e=>{const t=[];let r=[],n=0,i=0;for(;i<e.length;){const a=e[i];n+=a.width||a.renderWidth||a.minWidth||Zl.defaultColumnWidth,n<=Zl.printWidth?(r.push(a),i===e.length-1&&t.push(r),i++):i>0?(e.splice(0,i),E.length&&e.unshift(...E),t.push(r),r=[],n=0,i=0):(a.width=Zl.printWidth,r.push(a),t.push(r),i++)}return t})([...x]),r=(e=>{const t=[];return e.forEach((e=>{let r=[];e.forEach((e=>{1===e.level?r.push(e):r.push(S(e))})),r=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const r=e.filter((e=>e.dataIndex===t));return r.length<=1?r[0]:w(r,"dataIndex")[0]})))(r),t.push(Gr(r))})),t})(t);let n=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n</style>","</head>","<body>"].join("");for(let i=0;i<t.length;i++)n+=T(r[i],t[i],e),n+='<div class="page-break"></div>';return n+"</body></html>"},T=(e,t,r)=>{const{showLogo:n=!0}=p;let i='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return i+=`<colgroup>${t.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||Zl.defaultColumnWidth}px">`})).join("")}</colgroup>`,h&&(i+=["<thead>",n&&y?`<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">',g?`<img src="${g}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',b?`<img src="${b}" border="0" height="38" />`:"","</td>","</tr>","</table>"].join("")}</th></tr>`:"",e.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${cn(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),r.length&&(i+=`<tbody>${r.map((e=>`<tr>${t.map(((t,n)=>{const{rowSpan:i,colSpan:a}=u(e,t,e.index,n,r);return i&&a?`<td rowspan="${i}" colspan="${a}">${m(e,t,e.index,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),d&&s.length&&(i+=["<tfoot>",s.map((e=>`<tr>${t.map(((t,n)=>{const{dataIndex:i,summation:a}=t,o=a?.render?a.render(r):Zr(e,`${i}_text`);return`<td>${0===n&&""===o?f("qm.table.config.summaryText"):ae(o)?sn(o).join(""):o}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i},N=()=>{((e,t)=>{const{filename:r,type:n,isDownload:i}={filename:"print",type:"html",isDownload:!1},a=`${r}.${n}`;if(window.Blob){const e=new Blob([t],{type:`text/${n}`});if(!i)return Promise.resolve({type:n,content:t,blob:e});Dt(e,a)}})(0,C())?.then((e=>{let{content:t,blob:r}=e,n=document.createElement("iframe");n.setAttribute("frameborder","0"),n.setAttribute("width","100%"),n.setAttribute("height","0"),n.style.display="none",document.body.appendChild(n),a.current.isIE?(n.contentDocument.write(t),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(r))}))};o().useImperativeHandle(t,(()=>({clickHandle:N})));const I=Ie("table");return n?o().createElement("span",{className:`${I}-print`,title:f("qm.table.print.text"),onClick:()=>N()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.PrinterOutlined,null))):null}));gs.displayName="TablePrint";const bs=gs,ys=require("exceljs");var vs=n.n(ys);const xs="606060",Es="thin",Ss="d4d4d4",ws=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Cs=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Ts=()=>({top:{style:Es,color:{argb:Ss}},left:{style:Es,color:{argb:Ss}},bottom:{style:Es,color:{argb:Ss}},right:{style:Es,color:{argb:Ss}}}),Ns=e=>{const{children:t}=e;return t&&t.length?Ns(t[0]):e},Is=e=>{const{precision:t,formatType:r}=e,n=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===r?{numFmt:n?`0${n}%`:"0%"}:"finance"===r?{numFmt:n?`#,##0${n}`:"#,##0"}:n?{numFmt:`0${n}`}:null},Rs=()=>{const{tableRef:e,getSpan:t,showSummary:r,isHeadGroup:n}=o().useContext($l),{spanMethod:i,showHeader:a}=e.current.props,l=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(o,l,s,c)=>{const{columns:d,footSummation:u}=o,{scrollYStore:{rowHeight:p}}=e.current,h=$r(d),m=Gr(d),g=[],b=[],y=[],v=[];let x=0;const E={};h.forEach((e=>{const{dataIndex:t,width:r,minWidth:n,renderWidth:i}=e;E[t]=cn(e.title),y.push({key:t,width:(r||i||n||Zl.defaultColumnWidth)/8})})),a&&(n?m.forEach(((e,t)=>{const r={};e.forEach((e=>{const{colSpan:n,rowSpan:i}=e,a=Ns(e),o=h.findIndex((e=>{let{dataIndex:t}=e;return t===a.dataIndex}));r[a.dataIndex]=cn(e.title),0!==n&&(n>1||i>1)&&v.push({s:{r:t,c:o},e:{r:t+i-1,c:o+n-1}})})),g.push(r)})):(h.forEach(((e,t)=>{const{colSpan:r,rowSpan:n}=e;(r>1||n>1)&&v.push({s:{r:x,c:t},e:{r:x+n-1,c:t+r-1}})})),g.push(E)),x+=g.length);const S=l.map(((e,r)=>{const n={};return h.forEach(((a,o)=>{if("function"==typeof i){const{rowSpan:n,colSpan:i}=t(e,a,r,o,l);(i>1||n>1)&&v.push({s:{r:r+x,c:o},e:{r:r+x+n-1,c:o+i-1}})}const s=["percent","finance"].includes(a.formatType);n[a.dataIndex]=s?Zr(e,a.dataIndex):c(e,r,a,o)})),n}));x+=S.length,r&&u&&s(h,l).forEach(((e,t)=>{const r={};h.forEach(((t,n)=>{const{dataIndex:i,summation:a}=t,o=a?.render?a.render(l):Zr(e,i);r[i]=0===n&&""===o?f("qm.table.config.summaryText"):ae(o)?sn(o).join(""):o})),b.push(r)}));const{sheetName:w,useStyle:C}=o,T=new(vs().Workbook),N=T.addWorksheet(w);N.columns=y,a&&N.addRows(g).forEach((e=>{C&&ws(e,p),e.eachCell((e=>{const t=N.getColumn(e.col),r=Kr(d,t.key),{align:n,theadAlign:i}=r;Cs(e,i||n),C&&Object.assign(e,{font:{bold:!0,color:{argb:xs}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Ts()})}))})),N.addRows(S).forEach((e=>{C&&ws(e,p),e.eachCell((e=>{const t=N.getColumn(e.col),r=Kr(d,t.key),{align:n}=r;Cs(e,n),Object.assign(e,Is(r)),C&&Object.assign(e,{font:{color:{argb:xs}},border:Ts()})}))})),r&&u&&N.addRows(b).forEach((e=>{C&&ws(e,p),e.eachCell((e=>{const t=N.getColumn(e.col),r=Kr(d,t.key),{align:n}=r;Cs(e,n),Object.assign(e,Is(r)),C&&Object.assign(e,{font:{color:{argb:xs}},border:Ts()})}))})),v.forEach((e=>{let{s:t,e:r}=e;N.mergeCells(t.r+1,t.c+1,r.r+1,r.c+1)}));const I=await T.xlsx.writeBuffer();return new Blob([I],{type:"application/octet-stream"})},exportCSV:(e,t)=>{const r=e=>{let t=e;const r=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),n=-1!==e.indexOf('"');return n&&(t=t.replace(/"/g,'""')),(r||n)&&(t='"'+t+'"'),t},n="\ufeff"+(e=>{let t,n,i,a,o="";for(t=0;t<e.rows.length;t+=1){for(i=e.rows[t],n=0;n<i.cells.length;n+=1)a=i.cells[n],o=o+(n?",":"")+r(a.textContent.trim());o+="\r\n"}return o})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var i;return((e,t,r)=>{t=t||"",r=r||512;const n=window.atob(e),i=[];let a;for(a=0;a<n.length;a+=r){const e=n.slice(a,a+r),t=new Array(e.length);let o;for(o=0;o<e.length;o+=1)t[o]=e.charCodeAt(o);const l=new window.Uint8Array(t);i.push(l)}return new window.Blob(i,{type:t})})((i=n,window.btoa(unescape(encodeURIComponent(i)))),"application/csv")},importXLSX:(e,t)=>{const{columns:r,file:n}=e,i=$r(r),a=new FileReader;a.onerror=()=>{L.message.error(f("qm.table.import.error"))},a.onload=e=>{const r=i.map((e=>cn(e.title))),n=new(vs().Workbook),a=e.target;a?n.xlsx.load(a.result).then((e=>{const n=e.worksheets[0];if(n){const e=n.getSheetValues(),a=e.findIndex((e=>e&&e.length>0)),o=e[a],s=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(r,o);if(s){const n=e.slice(a+1).map((e=>{const t={};e.forEach(((e,r)=>{let n=e;Array.isArray(n?.richText)&&(n=n.richText.map((e=>e.text)).join("")),(0,ne.isPlainObject)(n)&&"text"in n&&(n=n.text),(0,ne.isDate)(n)&&(n=on(n,zl)),n?.formula&&(n=n.result??n.value),t[o[r]]=n}));const n={};return r.forEach(((e,r)=>{const{dataIndex:a,dictItems:o}=i[r];Array.isArray(o)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>l(o,e))).filter((e=>""!==e)):t[e]=l(o,t[e])),Jr(n,a,t[e])})),n}));t?.(n)}else L.message.error(f("qm.table.import.error"))}else L.message.error(f("qm.table.import.error"))})):L.message.error(f("qm.table.import.error"))},a.readAsArrayBuffer(n)}}},Ps=e=>{const{fileType:t,onChange:r}=e;let n,i;const a=Ie("table"),l=e=>{const t=e.name,r=t.lastIndexOf("."),n=t.substring(r+1,t.length);return{filename:t.substring(0,r),type:n}};return o().createElement(xe,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return n||(n=document.createElement("form"),i=document.createElement("input"),n.className=`${a}--file-form`,i.name="file",i.type="file",n.appendChild(i),document.body.appendChild(n)),new Promise(((e,r)=>{const a=!t.type;i.multiple=!!t.multiple,i.accept=a?"":`.${t.type}`,i.onchange=o=>{const{files:s}=o.target,c=s[0];let d="";if(!a)for(let e=0;e<s.length;e++){const{type:r}=l(s[e]);if(t.type!==r){d=r;break}}d?(L.message.warning(f("qm.upload.notType",{type:d})),r()):e(c),document.body.removeChild(n),n=null,i=null},n.reset(),i.click()}))})({type:t});r?.(e.name,e)}catch(e){}})()},f("qm.upload.text"))},Os=e=>{const{columns:t,onClose:r}=e,{tableRef:n,createTableData:i,dataChange:a}=o().useContext($l),{beforeTableImport:l}=n.current.props,{importXLSX:s}=Rs(),c=o().useRef(null),[d,u]=o().useState(!1),[p,h]=o().useState(!0),m=e=>e.filter((e=>![Zl.expandableColumn,Zl.selectionColumn,"index","pageIndex",Zl.operationColumn].includes(e.dataIndex))),[g,b]=o().useState([{type:"INPUT",label:f("qm.table.export.fileName"),fieldName:"fileName",render:(e,t)=>{const{fileName:r}=t.GET_FIELDS_VALUE(["fileName"]);return o().createElement(o().Fragment,null,r?o().createElement("span",null,r):o().createElement(Ps,{fileType:t.state.formData.fileType,onChange:(e,r)=>{t.SET_FIELDS_VALUE({fileName:e,file:r}),r&&h(!1)}}))}},{type:"SELECT",label:f("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:f("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:f("qm.table.import.fillText"),value:"fill"},{text:f("qm.table.import.addText"),value:"add"},{text:f("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{g.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,b([...g])}},{type:"INPUT_NUMBER",label:f("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:1,max:n.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]),y=Ie("table");return o().createElement("div",{className:`${y}-import__setting`},o().createElement(Go,{ref:c,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:{posIndex:"条"},items:g,cols:1,labelWidth:100}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(xe,{onClick:()=>r(),style:{marginRight:8}},f("qm.table.export.closeButton")),o().createElement(xe,{type:"primary",loading:d,disabled:p,onClick:()=>(async()=>{const[e,o]=await c.current.GET_FORM_DATA();e||(u(!0),s({columns:m(t),file:o.file},(async e=>{const{tableFullData:t,store:s}=n.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof l)try{e=await l(e)}catch(e){}if("fill"===o.importType&&i(e),"add"===o.importType&&i([...t,...e]),"insert"===o.importType){const{tableFullData:t}=n.current,r=o.posIndex,a=t.slice(0,r).concat(e).concat(t.slice(r));i(a)}e.forEach((e=>{s.addToInserted(e)})),a(),L.message.success(f("qm.table.import.success",{total:e.length})),u(!1),r()})))})()},f("qm.table.import.text"))))},ks=o().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,[i,a]=o().useState(!1),l=()=>{a(!0)};o().useImperativeHandle(t,(()=>({clickHandle:l})));const s=Ie("table"),c={[`${s}-import`]:!0},d={visible:i,title:f("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>a(!1)};return o().createElement(o().Fragment,null,n&&o().createElement("span",{className:Ne()(c),title:f("qm.table.import.textNoSpace"),onClick:()=>l()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.ImportOutlined,null))),o().createElement(Er,d,o().createElement(Os,{columns:r,onClose:()=>a(!1)})))}));ks.displayName="TableImport";const As=ks,Ls=e=>{const{columns:t,onChange:r}=e,{$size:n}=o().useContext($l),i=o().useRef([]),[a,l]=o().useState(!1),[s,c]=o().useState(t);Ve((()=>{u()}),[s]),o().useEffect((()=>{d()}),[t]);const d=()=>{const e=[];t.forEach(((r,n)=>{const i=r.colSpan;i>1&&t.slice(n+1,n+i).every((e=>{let{colSpan:t}=e;return 0===t}))&&e.push(t.slice(n,n+i))})),i.current=e},u=()=>{const e=[];s.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=i.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...i.current[a].map(((e,r)=>{let{dataIndex:n}=e;const i=s.find((e=>e.dataIndex===n));return r>0&&void 0!==t.hidden&&(i.hidden=t.hidden),i})))})),r?.(e)},p=Ie("table"),h={[`${p}__popper`]:!0,"column-filter__popper":!0,[`${p}--lg`]:"large"===n,[`${p}--sm`]:"small"===n},m=[`${p}-column-filter`,{selected:a}];return o().createElement(Wi(),{action:["click"],popupVisible:a,popup:o().createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},o().createElement("div",{className:"main"},o().createElement(hi.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:s,setList:e=>{const t=e.map((e=>e.dataIndex)),r=s.map((e=>e.dataIndex));(0,ne.isEqual)(t,r)||c(bn(e))}},s.map((e=>((e,t)=>{const{colSpan:r}=e;if(0===r)return o().createElement("li",{key:e.dataIndex,style:{display:"none"}});const n=["svgicon","handle","main-handle"];return o().createElement("li",{key:e.dataIndex,className:"item"},o().createElement(L.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,c([...s])}}),o().createElement("i",{className:Ne()(n),title:f("qm.table.columnFilter.draggable")},o().createElement(Re.HolderOutlined,null)),o().createElement("span",{className:"text"},cn(e.title)))})(e)))))),popupClassName:Ne()(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{l(e)},builtinPlacements:Ul,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement("span",{className:Ne()(m),title:f("qm.table.columnFilter.text")},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.SettingOutlined,null)),o().createElement("span",null,f("qm.table.columnFilter.text"))))},Fs=e=>{const{defaultValue:t,onClose:r,onOk:n}=e,{tableRef:i,selectionKeys:a,pagination:l,showSummary:s}=o().useContext($l),{rowSelection:c}=i.current.props,d=o().useRef(null),[p,h]=o().useState(!1),m=o().useMemo((()=>Object.assign({},{fileName:`${u()().format(Bl)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:a.length?"selected":"all","startIndex|endIndex":[1,l.total],footSummation:s?1:0,useStyle:0},t,{columns:fe(t.columns||[])})),[]),[g,b]=o().useState([{type:"INPUT",label:f("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:f("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:f("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:f("qm.table.export.all"),value:"all"},{text:f("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==c?.type},{text:f("qm.table.export.custom"),value:"custom"}]},onChange:e=>{g.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,b([...g])}},options:{min:1},disabled:!0},{type:"INPUT",label:f("qm.table.columnFilter.text"),fieldName:"columns",render:(e,t)=>o().createElement(Ls,{columns:t.state.formData.columns,onChange:e=>{t.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:f("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!s,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:f("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]),y=Ie("table");return o().createElement("div",{className:`${y}-export__setting`},o().createElement(Go,{ref:d,initialValues:m,items:g,cols:1,labelWidth:100}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(xe,{onClick:()=>r(),style:{marginRight:8}},f("qm.table.export.closeButton")),o().createElement(xe,{type:"primary",loading:p,onClick:()=>(async()=>{const[e,t]=await d.current.GET_FORM_DATA();if(!e){h(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);n(t),await ce(1e3),h(!1),r()}})()},f("qm.table.export.text"))))},Hs=o().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,{global:i}=o().useContext(c),{tableRef:a,flattenColumns:l,pagination:s,fetchParams:d,isFetch:p,isGroupSubtotal:h,showSummary:m,getSpan:g}=o().useContext($l),{exportExcel:b,fetch:y,showHeader:v}=a.current.props,{getTitleFromCellValue:x}=fs(),[E,S]=o().useState(!1),[w,C]=o().useState(!1),T=o().useMemo((()=>!!b?.fetch?.api),[b]),N=o().useMemo((()=>!s.total||w),[s.total,w]),I=o().useMemo((()=>Br(r,[Zl.expandableColumn,Zl.selectionColumn,Zl.operationColumn])),[r]),R=o().useMemo((()=>Br(l,[Zl.expandableColumn,Zl.selectionColumn,Zl.operationColumn])),[l]),P=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return e.map(((e,n)=>{const i={...e,index:n,pageIndex:n},a=t?`${t}-${i.index+1}`:`${i.index+1}`;return i.indexPath=a,i._level=r,Array.isArray(e.children)&&(i.children=P(e.children,a,r+1)),R.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&Jr(i,t,Zr(i,t))})),i}))},O=(e,t)=>{const r={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:n}=e,i=(h?dn(t):t).reduce(((e,t)=>{if(t?.[Zl.summaryIgnore])return e;const r=Number(Zr(t,n));return Number.isNaN(r)?e:e+r}),0);Jr(r,n,i)})),[r]},k=(e,t,r,n)=>{const{precision:i,formatType:a}=r;let o=x(e,r,t,n);return i>=0&&!a&&""!==o&&(o=Number(o)),o},{exportXLSX:A,exportCSV:F}=Rs(),H=async e=>{const{api:t,formatter:r=(e=>e),afterFetch:n,dataKey:i}=y;let a=[];try{C(!0);const o=await t({...r(d),[Zl.currentPageName]:1,[Zl.pageSizeName]:e??s.total});if(200===o.code){let e=Array.isArray(o.data)?o.data:(0,ne.get)(o.data,i)??[];e="function"==typeof n?await n(e):e,a=Wr(P(e))}}catch(e){}return C(!1),a},_=e=>{const t=i?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},D=b?.fileName??`${u()().format(Bl)}.xlsx`,$=D.slice(D.lastIndexOf(".")+1).toLowerCase(),q=()=>{if(N)return L.message.warning(f("qm.table.export.warnText"));T?(async e=>{C(!0);try{const{api:t,params:r}=b.fetch,n=await t({columns:R.map((e=>{const{title:t,dataIndex:r,hidden:n}=e,{type:i}=e.filter||{};return{title:t,dataIndex:r,type:i,hidden:n}})),...d,...r,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[Zl.currentPageName]:void 0,[Zl.pageSizeName]:void 0});n.data&&(Dt(n.data,e),_(e))}catch(e){}C(!1)})(D):S(!0)};o().useImperativeHandle(t,(()=>({clickHandle:q})));const M=Ie("table"),j={[`${M}-export`]:!0},K={visible:E,title:f("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>S(!1)},V={fileName:D.slice(0,D.lastIndexOf(".")),fileType:$,columns:I,useStyle:b?.cellStyle?1:0};return o().createElement(o().Fragment,null,n&&o().createElement("span",{className:Ne()(j),title:f("qm.table.export.textNoSpace"),onClick:()=>q()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.DownloadOutlined,null))),o().createElement(Er,K,o().createElement(Fs,{defaultValue:V,onClose:()=>S(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:r,exportType:n,startIndex:i=1,endIndex:o}=e,{allTableData:l,selectionRows:s}=a.current;let c=[];if(p?("all"===n&&(c=await H()),"custom"===n&&(c=await H(o),c=c.slice(i-1))):("all"===n&&(c=l.slice(0)),"custom"===n&&(c=l.slice(i-1,o||void 0))),"selected"===n&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof b?.beforeExport)try{c=b?.beforeExport(c)}catch(e){}if("xlsx"===r){const r=await A(e,c,O,k);Dt(r,`${t}.xlsx`),_(`${t}.xlsx`)}if("csv"===r){const r=F(e,((e,t)=>{const{columns:r,footSummation:n}=e,i=Gr(r),a=$r(r);let o='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return o+=`<colgroup>${a.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||Zl.defaultColumnWidth}px">`})).join("")}</colgroup>`,v&&(o+=["<thead>",i.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${cn(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(o+=`<tbody>${t.map((e=>`<tr>${a.map(((r,n)=>{const{rowSpan:i,colSpan:a}=g(e,r,e.index,n,t);return i&&a?`<td rowspan="${i}" colspan="${a}">${k(e,e.index,r,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),m&&n&&(o+=["<tfoot>",O(a,t).map((e=>`<tr>${a.map(((r,n)=>{const{dataIndex:i,summation:a}=r,o=a?.render?a.render(t):Zr(e,i);return`<td>${0===n&&""===o?f("qm.table.config.summaryText"):ae(o)?sn(o).join(""):o}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),o+="</table>",o})(e,c));Dt(r,`${t}.csv`),_(`${t}.csv`)}})(Object.assign({},e,{columns:qr(e.columns)}))}})))}));Hs.displayName="TableExport";const _s=Hs,Ds=e=>{const{columns:t,onClose:r}=e,{tableRef:n,tableBodyRef:i,dataChange:a}=o().useContext($l),{beforeClipboard:l}=n.current.props,s=o().useRef(null),[c,d]=o().useState([{type:"INPUT_NUMBER",label:f("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:f("qm.table.clipboard.colIndex"),fieldName:"colIndex",options:{itemList:t.map(((e,t)=>({value:t,text:cn(e.title)})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:f("qm.table.clipboard.content"),fieldName:"content",placeholder:f("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[u,p]=o().useState(!1),h=Ie("table");return o().createElement("div",{className:`${h}-clipboard__setting`},o().createElement("h3",{className:"info"},f("qm.table.clipboard.supportText")),o().createElement(Go,{ref:s,initialValues:{},initialExtras:{rowIndex:"行",colIndex:"列"},items:c,cols:1,labelWidth:100}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(xe,{onClick:()=>r(),style:{marginRight:8}},f("qm.table.export.closeButton")),o().createElement(xe,{type:"primary",loading:u,onClick:()=>(async()=>{const[e,o]=await s.current.GET_FORM_DATA();if(e)return;const{tableFullData:c,store:d}=n.current;p(!0);const u=o.content.trim().replace(/(\r|\n)$/,"");let h=u.replace(/"[^"]+"/g,"^");(u.match(/"[^"]+"/g)?.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," ")))||[]).forEach((e=>{h=h.replace(/\^/,e)}));let m=h.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof l)try{m=await l(m,m[0].map(((e,r)=>t[o.colIndex+r].dataIndex)))}catch(e){}m.forEach(((e,r)=>{e.forEach(((e,i)=>{const a=c[o.rowIndex-1+r],l=t[o.colIndex+i];if(a&&l){let t=!1;if(l.editRender){const e=l.editRender(a,l);t=!(e.disabled||e.extra?.disabled||n.current.fieldAuth[l.dataIndex]?.disabled)}t&&l.dictItems&&(t=l.dictItems.some((t=>t.value==e))),t&&(Jr(a,l.dataIndex,e),d.addToUpdated(a))}}))})),i.current.forceUpdate(),a(),L.message.success(f("qm.table.clipboard.success",{total:m.length})),p(!1),r()})()},f("qm.table.clipboard.text"))))},$s=o().forwardRef(((e,t)=>{const{open:r=!0}=e,{flattenColumns:n}=o().useContext($l),[i,a]=o().useState(!1),l=o().useMemo((()=>(e=>e.filter((e=>![Zl.expandableColumn,Zl.selectionColumn,"index","pageIndex",Zl.operationColumn].includes(e.dataIndex))))(n)),[n]),s=()=>{a(!0)};o().useImperativeHandle(t,(()=>({clickHandle:s})));const c=Ie("table"),d={[`${c}-clipboard`]:!0},u={visible:i,title:f("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>a(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:Ne()(d),title:f("qm.table.clipboard.textNoSpace"),onClick:()=>s()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.CopyOutlined,null))),o().createElement(Er,u,o().createElement(Ds,{columns:l,onClose:()=>a(!1)})))}));$s.displayName="TableClipboard";const qs=$s,Ms=e=>{const{columns:t,onClose:r}=e,{tableRef:n,$size:i,selectionKeys:a,setSelectionKeysEffect:l}=o().useContext($l),{rowKey:s}=n.current.props,c=o().useRef(null),d=Pt(c),u=e=>e.map((e=>{const t={dataIndex:e.dataIndex,title:e.title,width:e.width,minWidth:e.minWidth,precision:e.precision,dictItems:e.dictItems??[],render:e.render};return Array.isArray(e.children)&&(t.children=u(e.children)),t})),[p,h]=o().useState([{title:f("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...u(t.filter((e=>![Zl.expandableColumn,Zl.selectionColumn,"index","pageIndex",Zl.operationColumn].includes(e.dataIndex))))]),[m]=o().useState(n.current.selectionRows.map((e=>({...e,children:void 0})))),[g,b]=o().useState(300),y=Ot((()=>{const e=c.current;b(e.offsetHeight-2*Hi[i]-30)}),5);return Ve((()=>{y()}),[d.width]),o().createElement("div",{ref:c,style:{height:"100%"}},o().createElement(zc,{size:i,columns:p,dataSource:m,rowKey:s,height:g,rowSelection:{type:"checkbox",selectedRowKeys:a,onChange:e=>l(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>h(e)}),o().createElement("div",{style:{height:10}}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(xe,{onClick:()=>r()},f("qm.table.selectCollection.closeButton"))))},js=o().forwardRef(((e,t)=>{const{columns:r,open:n=!0}=e,{tableRef:i,getRowKey:a,selectionKeys:l,isFetch:s,isTableEmpty:c,setSelectionKeysEffect:d,setSelectionRows:u}=o().useContext($l),{rowSelection:p}=i.current.props,[h,m]=o().useState(!1),g=o().useRef(!1);Ve((()=>{!g.current&&b()}),[c]);const b=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=p;if(s&&e)try{const r=await e.api(Object.assign({},{selectedKeys:l},e.params));if(200===r.code){let n=Array.isArray(r.data)?r.data:(0,ne.get)(r.data,e.dataKey)??[];n=n.filter((e=>!t(e))),d(n.map(((e,t)=>a(e,t)))),u(n),g.current=!0}}catch(e){}},y=()=>{m(!0)};o().useImperativeHandle(t,(()=>({clickHandle:y})));const v=Ie("table"),x={visible:h,title:f("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>m(!1)};return o().createElement(o().Fragment,null,n&&o().createElement("span",{className:`${v}-select-collection`,title:f("qm.table.selectCollection.text"),onClick:()=>y()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.CheckSquareOutlined,null))),o().createElement(Er,x,o().createElement(Ms,{columns:r,onClose:()=>m(!1)})))}));js.displayName="SelectCollection";const Ks=js,Vs=require("localforage");var zs=n.n(Vs);const Bs=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(e),Us=e=>{const{onClose:t}=e,{global:r}=o().useContext(c),{tableRef:n,getRowKey:i,$size:a,flattenColumns:l,pagination:s,setPagination:d,scrollYToRecord:u,setHighlightKey:p,setShouldToTop:h,isTreeTable:m,isWebPagination:g}=o().useContext($l),{uniqueKey:b}=n.current.props,y=o().useRef(null),x=o().useRef(null),E=o().useRef([]),S=o().useRef(""),w=o().useRef(-1),C=o().useRef("stop");Ve((()=>{const{current:e,pageSize:t}=s,r=n.current.tableFullData.slice((e-1)*t,e*t),a=Wr(r).findIndex((e=>i(e,e.index)===S.current));u("",a)}),[s.current]);const T=e=>{let t;switch(e){case"text":case"textarea":default:t="INPUT";break;case"number":t="INPUT_NUMBER";break;case"date":t="DATE";break;case"checkbox":case"radio":t="SELECT"}return t},N=e=>e.filter((e=>e?.dataIndex)).map((e=>({type:T(e.filter.type),fieldName:e.dataIndex,label:cn(e.title),tooltip:e.description,options:{dateType:"exactdate",itemList:e.dictItems??[]},onChange:async()=>{const[e,t]=await y.current.GET_FORM_DATA(),[r,n]=await x.current.GET_FORM_DATA(),i=(0,ne.omitBy)(Object.assign({},t,n),pe);O(i)}}))),I={case:0,fullchar:0},R=o().useMemo((()=>l.filter((e=>![Zl.expandableColumn,Zl.selectionColumn,"index","pageIndex",Zl.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[l]),[P,O]=o().useState({}),[k,A]=o().useState(I),[F]=o().useState(N([R[0]])),[H]=o().useState(N(R.slice(1))),[_,D]=o().useState(0),$=o().useMemo((()=>!Object.keys(P).length),[P]);Ve((()=>{C.current="ready"}),[P,k]);const q=e=>{A(Object.assign({},k,e))},M=(e,t,r)=>new Promise(((n,i)=>{L.Modal.confirm({title:f("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),n()},onCancel:()=>{r(),n()}})})),j=async e=>{if(!Object.keys(P).length)return L.Modal.warning({title:f("qm.button.confirmPrompt"),content:f("qm.table.fastSearch.queryCondition")});if("ready"===C.current&&(C.current="stop",E.current=(e=>{const{allTableData:t}=n.current,r=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];let a=!0;for(const t in e){const{type:r}=R.find((e=>e.dataIndex===t)).filter;let n=Zr(i,t),o=!0;if("text"===r||"textarea"===r?o=new RegExp(k.fullchar?`^${e[t]}$`:e[t],k.case?"":"i").test(n):(n=Bs(n)?n.slice(0,10):n,o=n==e[t]),!o){a=!1;break}}a&&r.push(i)}return r})(P),D(E.current.length)),!E.current.length)return p(""),L.Modal.warning({title:f("qm.button.confirmPrompt"),content:f("qm.table.fastSearch.notMatch")});"next"===e&&(w.current=w.current<0?0:w.current+1,w.current>E.current.length-1&&await M(f("qm.table.fastSearch.toTheEnd"),(()=>w.current=0),(()=>w.current=E.current.length-1))),"prev"===e&&(w.current=w.current<0?E.current.length-1:w.current-1,w.current<0&&await M(f("qm.table.fastSearch.toStart"),(()=>w.current=E.current.length-1),(()=>w.current=0)));const t=E.current[w.current],r=i(t,t.index);let a=t.index;if(m&&g){const e=mn(n.current.deriveRowKeys,r)[0];a=n.current.tableFullData.findIndex((t=>i(t,t.index)===e))}((e,t)=>{if(S.current=e,g){const{pageSize:e}=s,r=Math.ceil((t+1)/e);h(!1),d(Object.assign({},s,{current:r}))}else u(e)})(r,a),p(r)},K=()=>{y.current.RESET_FORM(),x.current.RESET_FORM()},V=o().useMemo((()=>b?`fastSearch_${b}`:""),[b]),[z,B]=o().useState([]),[U,W]=o().useState(""),[G,Y]=o().useState("");Ve((()=>{if(G){const{filters:e,config:t}=z.find((e=>e.value===G)).list;y.current.SET_FIELDS_VALUE(re()(e,H.map((e=>e.fieldName)))),x.current.SET_FIELDS_VALUE(re()(e,F.map((e=>e.fieldName)))),O(e),A(t)}else K(),O({}),A(I)}),[G]),o().useEffect((()=>{X()}),[]);const X=async()=>{if(!V)return;let e=await zs().getItem(V);e||(e=await Q(V),Array.isArray(e)&&await zs().setItem(V,e)),Array.isArray(e)&&e.length&&(B(e),Y(e[0].value))},Q=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},Z=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},J=Ie("table");return o().createElement("div",{className:`${J}-fast-search__setting`},o().createElement("div",{className:"main"},o().createElement("div",{className:"top"},o().createElement("div",{className:"container"},o().createElement(cr,{defaultActiveKey:"1",size:"small",tabBarExtraContent:o().createElement("span",null,f("qm.table.alert.total",{total:_}))},o().createElement(cr.TabPane,{tab:f("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},o().createElement(Go,{ref:y,items:F,cols:1,labelWidth:110})),o().createElement(cr.TabPane,{tab:f("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},o().createElement(Go,{ref:x,items:H,cols:1,labelWidth:110})))),o().createElement("div",{className:"saved line"},o().createElement("div",{className:"form-wrap"},o().createElement(L.Input,{size:a,value:U,placeholder:f("qm.table.highSearch.configText"),disabled:$,onChange:e=>{const{value:t}=e.target;W(t)}}),o().createElement(xe,{type:"primary",disabled:!U||$,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!V)return v("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=ln(),t=[...z,{text:U,value:e,list:{filters:P,config:k}}];B(t),Y(e),W(""),await zs().setItem(V,t),await Z(V,t)})()},f("qm.table.highSearch.saveButton"))),o().createElement("div",{className:"card-wrap"},o().createElement("h5",{style:{height:`${Zl.rowHeightMaps[a]}px`}},o().createElement("span",null,f("qm.table.fastSearch.savedSetting"))),o().createElement("ul",null,z.map((e=>o().createElement("li",{key:e.value,className:Ne()({selected:e.value===G}),title:e.text,onClick:()=>(e=>{Y(e!==G?e:"")})(e.value)},o().createElement("span",{className:"title"},e.text),o().createElement("i",{className:"svgicon close",title:f("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=z.filter((t=>t.value!==e));B(t),e===G&&Y(""),await zs().setItem(V,t),await Z(V,t)})(e.value)}},o().createElement(Re.CloseCircleOutlined,null))))),!z.length&&o().createElement("div",{style:{padding:Ml}},o().createElement(bt,null)))))),o().createElement("div",{className:"bottom"},o().createElement("div",null,o().createElement(L.Checkbox,{checked:!!k.case,onChange:e=>q({case:e.target.checked})},f("qm.table.fastSearch.matchCase")),o().createElement(L.Checkbox,{checked:!!k.fullchar,onChange:e=>q({fullchar:e.target.checked})},f("qm.table.fastSearch.matchFullchar"))),o().createElement("div",null,o().createElement(xe,{onClick:()=>K()},f("qm.table.fastSearch.clear"))))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${Hi[a]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(xe,{onClick:()=>t(),style:{marginRight:8}},f("qm.table.fastSearch.closeButton")),o().createElement(xe,{type:"primary",style:{marginRight:8},onClick:()=>j("prev")},f("qm.table.fastSearch.queryPrev")),o().createElement(xe,{type:"primary",onClick:()=>j("next")},f("qm.table.fastSearch.queryNext"))))},Ws=o().forwardRef(((e,t)=>{const{open:r=!0}=e,{$size:n}=o().useContext($l),[i,a]=o().useState(!1),l=()=>{a(!0)};o().useImperativeHandle(t,(()=>({clickHandle:l})));const s=Ie("table"),c={visible:i,title:f("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${Hi[n]+20}px`},onClose:()=>a(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:`${s}-super-search`,title:f("qm.table.fastSearch.text"),onClick:()=>l()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.MonitorOutlined,null))),o().createElement(Er,c,o().createElement(Us,{onClose:()=>a(!1)})))}));Ws.displayName="FastSearch";const Gs=Ws,Ys=e=>{const{columns:t,group:r,summary:n}=e,{tableRef:i,$size:a,pagination:l,fetchParams:s,isFetch:c}=o().useContext($l),{fetch:d}=i.current.props,p=e=>{const r=t.find((t=>t.dataIndex===e));return{title:r.title,precision:r.precision,dictItems:r.dictItems??[]}},h=r.map((e=>({dataIndex:e.group,...p(e.group)}))),m=n.map((e=>e.summary===Zl.groupSummary.total.value?{dataIndex:e.summary,title:Zl.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...p(e.summary),formula:e.formula})),g=o().useMemo((()=>Object.assign({},s,{[Zl.sorterFieldName]:void 0,[Zl.groupSummary.summaryFieldName]:n.map((e=>`${e.formula}|${e.summary}`)).join(","),[Zl.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[Zl.currentPageName]:1})),[s,r,n]),[b,y]=o().useState(((e,r)=>[{title:f("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...r.map((e=>{const r=t.find((t=>t.dataIndex===e.dataIndex))?.groupSummary;let n=r?{summation:r}:null;return e.dataIndex===Zl.groupSummary.total.value&&(n={dataIndex:Zl.groupSummary.recordTotalIndex,summation:{render:()=>l.total}}),{...e,..."count"===e.formula||"sum"===e.formula?n:null}}))])(h,m)),[v]=o().useState(c?[]:(e=>{const t=pn(e,r.map((e=>e.group))),i=[];return t.forEach((e=>{const t={};b.forEach((r=>{const{dataIndex:n}=r;"index"!==n&&Jr(t,n,Zr(e[0],n))})),n.forEach((r=>{const n=r.summary!==Zl.groupSummary.total.value?r.summary:Zl.groupSummary.recordTotalIndex,i=r.formula;"count"===i&&Jr(t,n,e.length),"sum"===i&&Jr(t,n,(0,ne.sumBy)(e,n)),"max"===i&&Jr(t,n,(0,ne.maxBy)(e,n)[n]),"min"===i&&Jr(t,n,(0,ne.minBy)(e,n)[n]),"avg"===i&&Jr(t,n,((0,ne.sumBy)(e,n)/e.length).toFixed(2))})),i.push(t)})),i})(i.current.tableFullData)),x={size:a,height:400,...c?{fetch:{api:d.api,params:g,dataKey:d?.dataKey}}:{dataSource:v},columns:b,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${u()().format(Bl)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>y(e)};return o().createElement(zc,x)},Xs=e=>{const{onClose:t}=e,{global:r}=o().useContext(c),{tableRef:n,$size:i,flattenColumns:a}=o().useContext($l),{uniqueKey:l}=n.current.props,s=o().useRef(null),d=o().useRef(null),[u,p]=o().useState(!1),[h,m]=o().useState([]),[g,b]=o().useState(""),[y,x]=o().useState("");Ve((()=>{if(y){const{group:e,summary:t}=h.find((e=>e.value===y)).list;I(e),k(t)}else{const e=_();I(e?.group||[]),k(e?.summary||[])}}),[y]),o().useEffect((()=>{D()}),[]);const E=o().useMemo((()=>l?`summary_${l}`:""),[l]),S=o().useMemo((()=>a.filter((e=>![Zl.expandableColumn,Zl.selectionColumn,"index","pageIndex",Zl.operationColumn].includes(e.dataIndex)))),[a]),w=S.filter((e=>!e.groupSummary)).map((e=>({text:cn(e.title),value:e.dataIndex}))),C=[Zl.groupSummary.total,...S.filter((e=>!!e.groupSummary)).map((e=>({text:cn(e.title),value:e.dataIndex})))],T=[{text:f("qm.table.groupSummary.sumText"),value:"sum"},{text:f("qm.table.groupSummary.maxText"),value:"max"},{text:f("qm.table.groupSummary.minText"),value:"min"},{text:f("qm.table.groupSummary.avgText"),value:"avg"},{text:f("qm.table.groupSummary.countText"),value:"count"}],[N,I]=o().useState([]),[R,P]=o().useState([{title:f("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>o().createElement("div",null,o().createElement(xe,{type:"text",onClick:()=>{s.current.REMOVE_RECORDS(t)}},f("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:f("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:w.map((e=>({...e,disabled:N.findIndex((t=>t.group===e.value))>-1})))})}]),[O,k]=o().useState([]),[A,F]=o().useState([{title:f("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>o().createElement("div",null,o().createElement(xe,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(t)}},f("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:f("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:C.map((e=>({...e,disabled:O.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:f("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===Zl.groupSummary.total.value?T.slice(T.length-1):T})}]),H=o().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]),_=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},D=async()=>{if(!E)return;const e=_();if(e){const{group:t,summary:r}=e;I(t),k(r)}let t=await zs().getItem(E);t||(t=await $(E),Array.isArray(t)&&await zs().setItem(E,t)),Array.isArray(t)&&t.length&&(m(t),!e&&x(t[0].value))},$=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},q=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},M=Ie("table"),j={visible:u,title:f("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>p(!1)};return o().createElement("div",{className:`${M}-group-summary__setting`},o().createElement("div",{className:"main"},o().createElement("div",{style:{width:"30%"}},o().createElement(zc,{ref:s,size:i,columns:R,dataSource:N,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>P(e),onDataChange:e=>{I(e)}},o().createElement(xe,{type:"primary",icon:o().createElement(Re.PlusOutlined,null),onClick:()=>{s.current.INSERT_RECORDS({})},style:{marginRight:0}}))),o().createElement("div",{className:"container line"},o().createElement(zc,{ref:d,size:i,columns:A,dataSource:O,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>F(e),onDataChange:e=>{k(e)}},o().createElement(xe,{type:"primary",icon:o().createElement(Re.PlusOutlined,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),o().createElement("div",{className:"saved line"},o().createElement("div",{className:"form-wrap"},o().createElement(L.Input,{size:i,value:g,placeholder:f("qm.table.groupSummary.configText"),disabled:H,onChange:e=>{const{value:t}=e.target;b(t)}}),o().createElement(xe,{type:"primary",disabled:!g||H,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return v("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=ln(),t=[...h,{text:g,value:e,list:{group:N.filter((e=>!!e.group)),summary:O.filter((e=>!!e.summary))}}];m(t),x(e),b(""),await zs().setItem(E,t),await q(E,t)})()},f("qm.table.groupSummary.saveButton"))),o().createElement("div",{className:"card-wrap"},o().createElement("h5",{style:{height:`${Zl.rowHeightMaps[i]}px`}},o().createElement("span",null,f("qm.table.groupSummary.savedSetting"))),o().createElement("ul",null,h.map((e=>o().createElement("li",{key:e.value,className:Ne()({selected:e.value===y}),title:e.text,onClick:()=>(e=>{x(e!==y?e:"")})(e.value)},o().createElement("span",{className:"title"},e.text),o().createElement("i",{className:"svgicon close",title:f("qm.table.groupSummary.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=h.filter((t=>t.value!==e));m(t),e===y&&x(""),await zs().setItem(E,t),await q(E,t)})(e.value)}},o().createElement(Re.CloseCircleOutlined,null))))),!h.length&&o().createElement("div",{style:{padding:Ml}},o().createElement(bt,null)))))),o().createElement(Er,j,o().createElement(Ys,{columns:S,group:N,summary:O})),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(xe,{onClick:()=>t(),style:{marginRight:8}},f("qm.table.groupSummary.closeButton")),o().createElement(xe,{type:"primary",disabled:H,onClick:()=>(E&&sessionStorage.setItem(E,JSON.stringify({group:N.filter((e=>!!e.group)),summary:O.filter((e=>!!e.summary))})),void p(!0))},f("qm.table.groupSummary.confirmButton"))))},Qs=o().forwardRef(((e,t)=>{const{open:r=!0}=e,[n,i]=o().useState(!1),a=()=>{i(!0)};o().useImperativeHandle(t,(()=>({clickHandle:a})));const l=Ie("table"),s={visible:n,title:f("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:`${l}-group-summary`,title:f("qm.table.groupSummary.text"),onClick:()=>a()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.PieChartOutlined,null))),o().createElement(Er,s,o().createElement(Xs,{onClose:()=>i(!1)})))}));Qs.displayName="GroupSummary";const Zs=Qs,Js=e=>{const{onClose:t}=e,{global:r}=o().useContext(c),{tableRef:n,$size:i,flattenColumns:a,setSuperFilters:l,clearTableFilter:s}=o().useContext($l),{uniqueKey:d}=n.current.props,u=o().useRef(null),[p,h]=o().useState([]),[m,g]=o().useState([]),[b,y]=o().useState(""),[x,E]=o().useState("");Ve((()=>{h(x?m.find((e=>e.value===x)).list:_()||[])}),[x]),o().useEffect((()=>{D()}),[]);const S=o().useMemo((()=>d?`superSearch_${d}`:""),[d]),w=o().useMemo((()=>a.filter((e=>!!e.filter))),[a]),C=un(p),T=o().useMemo((()=>!(C&&_r(C))),[C]),N=o().useMemo((()=>!!p.length&&T),[p,T]),I=[{value:"and",text:f("qm.table.highSearch.andText")},{value:"or",text:f("qm.table.highSearch.orText")}],R=a.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:cn(e.title)}))),P=e=>["in","nin"].includes(e),O=(e,t)=>{let r;switch(e){case"number":r="number";break;case"date":r="date";break;case"checkbox":case"radio":r=t?"select-multiple":"select";break;default:r="text"}return r},k=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:f("qm.table.highSearch.gtText")},{value:"<",text:f("qm.table.highSearch.ltText")},{value:">=",text:f("qm.table.highSearch.gteText")},{value:"<=",text:f("qm.table.highSearch.lteText")},{value:"==",text:f("qm.table.highSearch.eqText")},{value:"!=",text:f("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":t=[{value:"in",text:f("qm.table.highSearch.inText")},{value:"nin",text:f("qm.table.highSearch.ninText")},{value:"==",text:f("qm.table.highSearch.eqText")},{value:"!=",text:f("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:f("qm.table.highSearch.likeText")},{value:"==",text:f("qm.table.highSearch.eqText")},{value:"!=",text:f("qm.table.highSearch.neqText")}]}return t},[A,F]=o().useState([{title:f("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>o().createElement("div",null,o().createElement(xe,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(t)}},f("qm.table.highSearch.removeText")))},{title:f("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,t)=>o().createElement("span",{style:{fontSize:"20px"}},e)},{title:f("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,editRender:e=>({type:"select",editable:!0,items:R,rules:[{required:!0,message:f("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{const r=Object.values(t)[0],n=w.find((e=>e.dataIndex===r))?.filter.type,i=k(n);e.fieldType=n,e.expression=r?i[0]?.value:"",e.condition=P(e.expression)?[]:"",r||(e.bracketLeft=e.bracketRight="")}})},{title:f("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:f("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{const t=w.find((t=>t.dataIndex===e.fieldName))?.filter.type;return{type:"select",editable:!0,items:k(t),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=P(e.expression)?[]:""}}}},{title:f("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{const t=w.find((t=>t.dataIndex===e.fieldName)),r=t?.filter.type,n=t?.filter?.items??t?.dictItems??[];return{type:O(r,P(e.expression)),editable:!0,items:n,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:f("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,t)=>o().createElement("span",{style:{fontSize:"20px"}},e)},{title:f("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,editRender:e=>({type:"select",editable:!0,items:I,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),H=()=>{S&&sessionStorage.setItem(S,JSON.stringify(p.filter((e=>!!e.fieldName))))},_=()=>{if(!S)return;const e=sessionStorage.getItem(S);return e?JSON.parse(e):null},D=async()=>{if(!S)return;const e=_();e&&h(e);let t=await zs().getItem(S);t||(t=await $(S),Array.isArray(t)&&await zs().setItem(S,t)),Array.isArray(t)&&t.length&&(g(t),!e&&E(t[0].value))},$=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},q=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},M=Ie("table");return o().createElement("div",{className:`${M}-super-search__setting`},o().createElement("div",{className:"main"},o().createElement("div",{className:"container"},o().createElement(zc,{ref:u,size:i,columns:A,dataSource:p,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>F(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(r)&&("bracketLeft"===r&&(e[r]=e[r]?"":"("),"bracketRight"===r&&(e[r]=e[r]?"":")"),h([...p]))},onDataChange:e=>{h(e)}},o().createElement(xe,{type:"primary",icon:o().createElement(Re.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),Zl.highSearch.showSQL&&C&&o().createElement("code",{className:"lang-js"},C)),o().createElement("div",{className:"saved line"},o().createElement("div",{className:"form-wrap"},o().createElement(L.Input,{size:i,value:b,placeholder:f("qm.table.highSearch.configText"),disabled:T,onChange:e=>{const{value:t}=e.target;y(t)}}),o().createElement(xe,{type:"primary",disabled:!b||T,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!S)return v("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=ln(),t=[...m,{text:b,value:e,list:p.filter((e=>!!e.fieldName))}];g(t),E(e),y(""),await zs().setItem(S,t),await q(S,t)})()},f("qm.table.highSearch.saveButton"))),o().createElement("div",{className:"card-wrap"},o().createElement("h5",{style:{height:`${Zl.rowHeightMaps[i]}px`}},o().createElement("span",null,f("qm.table.highSearch.savedSetting"))),o().createElement("ul",null,m.map((e=>o().createElement("li",{key:e.value,className:Ne()({selected:e.value===x}),title:e.text,onClick:()=>(e=>{E(e!==x?e:"")})(e.value)},o().createElement("span",{className:"title"},e.text),o().createElement("i",{className:"svgicon close",title:f("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=m.filter((t=>t.value!==e));g(t),e===x&&E(""),await zs().setItem(S,t),await q(S,t)})(e.value)}},o().createElement(Re.CloseCircleOutlined,null))))),!m.length&&o().createElement("div",{style:{padding:Ml}},o().createElement(bt,null)))))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(xe,{onClick:()=>t(),style:{marginRight:8}},f("qm.table.highSearch.closeButton")),o().createElement(xe,{type:"primary",disabled:N,onClick:()=>(s(),l(p.map((e=>re()(e,["index","pageIndex"])))),H(),void t())},f("qm.table.highSearch.searchButton"))))},ec=o().forwardRef(((e,t)=>{const{open:r=!0}=e,[n,i]=o().useState(!1),a=()=>{i(!0)};o().useImperativeHandle(t,(()=>({clickHandle:a})));const l=Ie("table"),s={visible:n,title:f("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:`${l}-super-search`,title:f("qm.table.highSearch.text"),onClick:()=>a()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.FunnelPlotOutlined,null))),o().createElement(Er,s,o().createElement(Js,{onClose:()=>i(!1)})))}));ec.displayName="SuperSearch";const tc=ec,rc=o().forwardRef(((e,t)=>{const{tableColumns:r,showFullScreen:n,showReload:i,showPrint:a,showImport:l,showExport:s,showClipboard:d,showCollection:u,showFastSearch:p,showSuperSearch:h,showGroupSummary:m,showToolBox:g}=e,{global:b}=o().useContext(c),{tableRef:y,isFullScreen:x,$size:E}=o().useContext($l),{uniqueKey:S,exportExcel:w}=y.current.props,C=o().useRef(null),T=o().useRef(null),N=o().useRef(null),I=o().useRef(null),R=o().useRef(null),P=o().useRef(null),O=o().useRef(null),k=o().useRef(null),A=o().useRef(null),F=o().useRef(null),H=o().useRef(!1),_=o().useMemo((()=>S?`toolBox_${S}`:""),[S]),[D,$]=o().useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,groupSummary:!1}),q={fullScreen:n,reload:i,print:a,import:l,export:s&&!w?.hideIcon,clipboard:d,collection:u,fastSearch:p,superSearch:h,groupSummary:m},[M,j]=o().useState(!1);Ve((()=>{H.current&&(V(),H.current=!1)}),[D]),o().useEffect((()=>{K()}),[]),o().useImperativeHandle(t,(()=>({exportHandle:()=>{if(!R.current)return v("Table","执行导出需要配置 `exportExcel` 参数");R.current.clickHandle()}})));const K=()=>{if(!_||!g)return;const e=JSON.parse(localStorage.getItem(_));e||z(_).then((e=>{e&&($(Object.assign({},D,e)),localStorage.setItem(_,JSON.stringify(e)))})).catch((()=>{})),e&&$(Object.assign({},D,e))},V=()=>{if(!_||!g)return;const e={};for(const t in D)D[t]&&(e[t]=D[t]);localStorage.setItem(_,JSON.stringify(e)),B(_,e)},z=async e=>{const t=b?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},B=async(e,t)=>{const r=b?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},U=async e=>{j(!1),await ce(100),e.current.clickHandle()},W=(e,t)=>{H.current=!0,$(Object.assign({},D,{[t]:e}))},G=Ie("table"),Y={"top-toolbox__popper":!0,[`${G}--lg`]:"large"===E,[`${G}--sm`]:"small"===E};return o().createElement(o().Fragment,null,n&&o().createElement(ps,{ref:C,isFullScreen:x,open:!g||D.fullScreen}),i&&o().createElement(ms,{ref:T,open:!g||D.reload}),a&&o().createElement(bs,{ref:N,tableColumns:r,open:!g||D.print}),l&&o().createElement(As,{ref:I,tableColumns:r,open:!g||D.import}),s&&o().createElement(_s,{ref:R,tableColumns:r,open:(!g||D.export)&&!w?.hideIcon}),d&&o().createElement(qs,{ref:P,open:!g||D.clipboard}),u&&o().createElement(Ks,{ref:O,columns:r,open:!g||D.collection}),p&&o().createElement(Gs,{ref:k,open:!g||D.fastSearch}),m&&o().createElement(Zs,{ref:A,open:!g||D.groupSummary}),h&&o().createElement(tc,{ref:F,open:!g||D.superSearch}),g&&o().createElement(L.Dropdown,{open:M,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.fullScreen,style:{marginRight:6},onChange:e=>W(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.screen.full"))),onClick:()=>U(C)},{key:"reload",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.reload,style:{marginRight:6},onChange:e=>W(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.refresh.text"))),onClick:()=>U(T)},{key:"print",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.print,style:{marginRight:6},onChange:e=>W(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.print.text"))),onClick:()=>U(N)},{key:"import",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.import,style:{marginRight:6},onChange:e=>W(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.import.textNoSpace"))),onClick:()=>U(I)},{key:"export",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.export,style:{marginRight:6},onChange:e=>W(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.export.textNoSpace"))),onClick:()=>U(R)},{key:"clipboard",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.clipboard,style:{marginRight:6},onChange:e=>W(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.clipboard.textNoSpace"))),onClick:()=>U(P)},{key:"collection",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.collection,style:{marginRight:6},onChange:e=>W(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.selectCollection.text"))),onClick:()=>U(O)},{key:"fastSearch",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.fastSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.fastSearch.text"))),onClick:()=>U(k)},{key:"groupSummary",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.groupSummary,style:{marginRight:6},onChange:e=>W(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.groupSummary.text"))),onClick:()=>U(A)},{key:"superSearch",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.superSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.highSearch.text"))),onClick:()=>U(F)}];return o().createElement(L.Menu,{items:e.filter((e=>q[e.key]))})})(),overlayClassName:Ne()(Y),overlayStyle:{minWidth:120},onOpenChange:e=>{j(e)}},o().createElement("span",{className:`${G}-toolbox`,title:f("qm.table.toolbox.text")},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.AppstoreAddOutlined,null)))))}));rc.displayName="ToolBox";const nc=rc,ic=(e,t)=>e.map((e=>(e.children&&(e.children=ic(e.children,t)),t(e)))),ac=o().forwardRef(((e,t)=>{const{columns:r}=e,{global:n}=o().useContext(c),{tableRef:i,$size:a}=o().useContext($l),{showColumnDefine:l,uniqueKey:s,onlyShowIcon:d,columnsChange:u}=i.current.props,p=o().useRef([]),[h,m]=o().useState(!1),g=o().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)))(r)),[r]),b=o().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(r)),[r]),y=o().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(r)),[r]),v=o().useMemo((()=>s?`table_${s}`:""),[s]);Ve((()=>{E(r)}),[r]),o().useLayoutEffect((()=>{S()}),[]),o().useImperativeHandle(t,(()=>({initialHandler:S})));const x=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=x(e.children)),void 0!==e.hidden&&(t.hidden=e.hidden),void 0!==e.fixed&&(t.fixed=e.fixed),void 0!==e.width&&(t.width=e.width),void 0!==e.renderWidth&&(t.renderWidth=e.renderWidth),{dataIndex:e.dataIndex,...t}})),E=e=>{if(!v)return;const t=x(e),r=JSON.parse(localStorage.getItem(v));i.current.columnsDefined&&!(0,ne.isEqual)(t,r)&&(localStorage.setItem(v,JSON.stringify(t)),(async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(v,t))},S=()=>{const e=(()=>{if(!v)return;const e=JSON.parse(localStorage.getItem(v));return e||(async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}})(v).then((e=>{e?(localStorage.setItem(v,JSON.stringify(e)),S()):n?.getComponentConfigApi&&E(r)})).catch((()=>{})),e?(0,ne.xor)(Mr(e).map((e=>e.dataIndex)),Mr(r).map((e=>e.dataIndex))).length>0?ic(r,(t=>{const r=Kr(e,t.dataIndex);return r&&(void 0!==r.hidden&&(t.hidden=r.hidden),void 0!==r.fixed&&(t.fixed=r.fixed),void 0!==r.width&&(t.width=r.width),void 0!==r.renderWidth&&(t.renderWidth=r.renderWidth)),t})):ic(e,(e=>{const t=Kr(r,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)})):void 0})();var t;e&&(t=w(e),p.current=t,u?.(e))},w=e=>{const t=[];return e.filter((e=>!e.noAuth)).forEach(((r,n)=>{const i=r.colSpan;i>1&&e.slice(n+1,n+i).every((e=>{let{colSpan:t}=e;return 0===t}))&&t.push(e.slice(n,n+i))})),t},C=e=>{const t=[];e.forEach((r=>{const{colSpan:n,dataIndex:i}=r;if(0===n)return;if(1===n)return t.push(r);const a=p.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(i)));if(-1===a)return t.push(r);t.push(...p.current[a].map(((t,n)=>{let{dataIndex:i}=t;const a=e.find((e=>e.dataIndex===i));return n>0&&(void 0!==r.hidden&&(a.hidden=r.hidden),void 0!==r.fixed?a.fixed=r.fixed:a.fixed&&delete a.fixed),a})))})),r.forEach(((e,r)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(r,0,e)})),u?.(t)},T=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,C(r))},N=(e,t)=>{const{colSpan:n,noFixed:i}=e;if(0===n)return o().createElement("li",{key:e.dataIndex,style:{display:"none"}});const a=cn(e.title),l=["svgicon","handle",`${t}-handle`],s=o().createElement("li",{key:e.dataIndex,className:"item"},o().createElement(L.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,C(r)}}),o().createElement("i",{className:Ne()(l),title:f("qm.table.columnFilter.draggable")},o().createElement(Re.HolderOutlined,null)),o().createElement("span",{className:"text",title:a},a),"main"===t?o().createElement("span",{className:Ne()("fixed",i?"disabled":"")},o().createElement("i",{className:"svgicon",title:f("qm.table.columnFilter.fixedLeft"),onClick:()=>T(e,"left")},o().createElement(Re.StepBackwardOutlined,null)),o().createElement("i",{className:"svgicon",title:f("qm.table.columnFilter.fixedRight"),onClick:()=>T(e,"right")},o().createElement(Re.StepForwardOutlined,null))):"sub"!==t?o().createElement("span",{className:Ne()("fixed",i?"disabled":"")},o().createElement("i",{className:"svgicon",title:f("qm.table.columnFilter.cancelFixed"),onClick:()=>T(e)},o().createElement(Re.CloseCircleOutlined,null))):null);return!e.hidden&&e.children?.length?o().createElement(L.Popover,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:I(e.children,e.dataIndex)},s):s},I=(e,t)=>o().createElement("div",{className:"column-filter--wrap"},o().createElement(hi.ReactSortable,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:n=>{const i=n.map((e=>e.dataIndex)),a=e.map((e=>e.dataIndex));(0,ne.isEqual)(i,a)||((e,t)=>{Kr(r,t).children=e,u?.([...r])})(bn(n),t)}},e.map((e=>N(e,"sub"))))),R=Ie("table"),P={[`${R}__popper`]:!0,"column-filter__popper":!0,[`${R}--lg`]:"large"===a,[`${R}--sm`]:"small"===a},O=[`${R}-column-filter`,{selected:h}];return l?o().createElement(Wi(),{action:["click"],popupVisible:h,popup:o().createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},o().createElement("div",{className:"reset"},o().createElement(xe,{type:"text",size:"small",onClick:()=>{const e=t=>t.map((t=>{const n=Kr(r,t.dataIndex)||fe(t);return t.children&&(n.children=e(t.children)),Object.assign(n,{hidden:t.hidden,fixed:t.fixed,width:t.width})}));u?.(e(i.current.originColumns))}},f("qm.table.columnFilter.reset"))),o().createElement("div",{className:"left"},o().createElement(hi.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:g,setList:e=>{const t=e.map((e=>e.dataIndex)),r=g.map((e=>e.dataIndex));(0,ne.isEqual)(t,r)||C([...bn(e),...y,...b])}},g.map((e=>N(e,"left"))))),o().createElement("div",{className:"divider"}),o().createElement("div",{className:"main"},o().createElement(hi.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),r=y.map((e=>e.dataIndex));(0,ne.isEqual)(t,r)||C([...g,...bn(e),...b])}},y.map((e=>N(e,"main"))))),o().createElement("div",{className:"divider"}),o().createElement("div",{className:"right"},o().createElement(hi.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:b,setList:e=>{const t=e.map((e=>e.dataIndex)),r=b.map((e=>e.dataIndex));(0,ne.isEqual)(t,r)||C([...g,...y,...bn(e)])}},b.map((e=>N(e,"right")))))),popupClassName:Ne()(P),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{m(e)},builtinPlacements:Ul,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},o().createElement("span",{className:Ne()(O),title:d?f("qm.table.columnFilter.text"):void 0},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.SettingOutlined,null)),!d&&o().createElement("span",null,f("qm.table.columnFilter.text")))):null}));ac.displayName="ColumnFilter";const oc=ac,lc=()=>o().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().createElement("path",{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}));function sc(){return sc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sc.apply(this,arguments)}const cc=e=>{const{column:t,filters:r}=e,{$size:n,setFilters:i,clearSuperFilters:a}=o().useContext($l),l=o().useRef(null),s=o().useRef(null),c=o().useRef(null),[d,u]=o().useState(!1),[p,h]=o().useState(!1),[m,g]=o().useState({}),b=o().useMemo((()=>{const{dataIndex:e,filter:r}=t;return`${e}|${r.type}`}),[t]),y=o().useMemo((()=>{let e=!1;for(const t in r[b])if(!pe(r[b][t])||p){e=!0;break}return e}),[b,r,p]);o().useEffect((()=>{d&&setTimeout((()=>x()),50)}),[d]),o().useEffect((()=>{(0,ne.isEqual)(m[b],r[b])||g({[b]:r[b]||{}}),h(""===r[b]?.["=="])}),[r]);const x=()=>{switch(t.filter.type){case"text":l.current.focus();break;case"number":s.current.focus();break;case"textarea":c.current.focus()}},E=e=>{e&&g(e),a(),i((e=>{for(const t in e){for(const r in e[t])if(pe(e[t][r])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][r])continue;delete e[t][r]}Object.keys(e[t]).length||delete e[t]}return e})({...r,...m,...e})),u(!1)},S={text:e=>o().createElement(o().Fragment,null,o().createElement(L.Input,{ref:l,size:n,placeholder:f("qm.table.filter.searchText",{text:cn(e.title)}),style:{width:"180px"},value:m[b]?.like??"",disabled:p,onChange:e=>{const{value:t}=e.target;g((e=>Object.assign({},e,{[b]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&E()}}),o().createElement("div",{style:{marginTop:8}},o().createElement(L.Checkbox,{checked:p,onChange:e=>{const{checked:t}=e.target,r=t?"":null;g((e=>Object.assign({},e,{[b]:{"==":r,like:null}}))),h(t)}},f("qm.table.filter.nullValue")))),textarea:e=>o().createElement(o().Fragment,null,o().createElement(L.Input.TextArea,{ref:c,size:n,placeholder:f("qm.table.filter.searchAreaText",{text:cn(e.title)}),style:{width:"220px"},value:m[b]?.likes??"",disabled:p,onChange:e=>{const{value:t}=e.target;g((e=>Object.assign({},e,{[b]:{likes:t||null}})))},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||(e.preventDefault(),E())}}),o().createElement("div",{style:{marginTop:8}},o().createElement(L.Checkbox,{checked:p,onChange:e=>{const{checked:t}=e.target,r=t?"":null;g((e=>Object.assign({},e,{[b]:{"==":r,like:null}}))),h(t)}},f("qm.table.filter.nullValue")))),number:e=>{const t=e=>({value:m[b]?.[e]??"",size:n,onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||g((r=>Object.assign({},r,{[b]:Object.assign({},r[b],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return o().createElement("ul",null,o().createElement("li",null,o().createElement("span",null,"> "),o().createElement(L.InputNumber,sc({ref:s},t(">"),{placeholder:f("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"< "),o().createElement(L.InputNumber,sc({},t("<"),{placeholder:f("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"= "),o().createElement(L.InputNumber,sc({},t("=="),{placeholder:f("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"!="),o().createElement(L.InputNumber,sc({},t("!="),{placeholder:f("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const t=e=>({value:an(m[b]?.[e],Vl),format:Vl,size:n,onChange:t=>{g((r=>Object.assign({},r,{[b]:Object.assign({},r[b],{[e]:on(t,Vl)})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return o().createElement("ul",null,o().createElement("li",null,o().createElement("span",null,"> "),o().createElement(j,sc({},t(">"),{placeholder:f("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"< "),o().createElement(j,sc({},t("<"),{placeholder:f("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"= "),o().createElement(j,sc({},t("=="),{placeholder:f("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"!="),o().createElement(j,sc({},t("!="),{placeholder:f("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return o().createElement("ul",null,o().createElement(L.Radio.Group,{style:{width:"100%"},value:m[b]?.["=="],onChange:e=>{const{value:t}=e.target;g((e=>Object.assign({},e,{[b]:{"==":t}})))}},n.map((e=>o().createElement("li",{key:e.value},o().createElement(L.Radio,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return o().createElement("ul",null,o().createElement(L.Checkbox.Group,{style:{width:"100%"},value:m[b]?.in,onChange:e=>{g((t=>Object.assign({},t,{[b]:{in:e}})))}},n.map((e=>o().createElement("li",{key:e.value},o().createElement(L.Checkbox,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return o().createElement("div",{style:{height:200,...t.style}},o().createElement(Dl,{multiple:!0,value:m[b]?.in||[],dataSource:n,onCheckChange:e=>{const t=e.map((e=>e.value));g((e=>Object.assign({},e,{[b]:{in:t}})))}}))}},w=Ie("table"),C={"head-filter__popper":!0,[`${w}--lg`]:"large"===n,[`${w}--sm`]:"small"===n},T=["cell--filter",{selected:d,actived:y}];return o().createElement(Wi(),{action:["click"],popupVisible:d,popup:(()=>{const e=t.filter.type,r=S[e];return r?o().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},o().createElement("div",null,r(t)),o().createElement(L.Space,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},o().createElement(xe,{size:n,onClick:()=>{E({[b]:{}})}},f("qm.table.filter.reset")),o().createElement(xe,{type:"primary",size:n,onClick:()=>E()},f("qm.table.filter.search")))):(v("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:Ne()(C),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{u(e)},builtinPlacements:Ul,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},o().createElement("div",{className:Ne()(T),title:f("qm.table.filter.text"),onClick:e=>e.stopPropagation()},o().createElement("span",{className:"svgicon icon"},o().createElement(lc,null))))},dc=e=>{const{column:t}=e,{tableRef:r,bordered:n}=o().useContext($l),{columns:i,resizable:a,columnsChange:l=le}=r.current.props,s=o().useMemo((()=>zr(t)),[t]),c={resizable:!0,"is--line":a&&!n};return o().createElement("div",{className:Ne()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n}=r.current,a=n.$resizableBar,o=t.offsetWidth/2,c=e.clientX,d=Yr(t,n.$table).left-n.$tableBody.parentNode.parentNode.scrollLeft+o;n.$table.classList.add("c--resize"),a.style.left=`${d}px`,a.style.display="block";const u=s.width||s.renderWidth;let p=u;return document.onmousemove=function(e){if("number"!=typeof u)return;const t=e.clientX-c,r=u+t;r<(s.minWidth||Zl.defaultColumnWidth)||(p=Math.floor(r),a.style.left=`${t+d}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),a.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(Kr(i,s.dataIndex).width=p,l([...i]))},!1}})},uc=e=>{const{selectionKeys:t}=e,{tableRef:r,getRowKey:n,pagination:i,fetchParams:a,setSelectionKeysEffect:l,setInvalidRowKeys:s,setSpinning:c,isFetch:d,isWebPagination:u}=o().useContext($l),{rowSelection:p}=r.current.props,{fetchAllRowKeys:h,selectAllOnCurrentPage:m,filterable:g,onSelectAll:b}=p,y=o().useRef([]),v=o().useMemo((()=>d&&!!h),[d,h]),x=o().useMemo((()=>!v&&!!m),[v,m]),E=o().useMemo((()=>(g??!0)&&!x),[g,x]),S=()=>{const{tableFullData:e}=r.current,{current:t,pageSize:n}=i;return u?e.slice((t-1)*n,t*n):e},w=(()=>{const{allTableData:e,allRowKeys:t,selectionRows:i}=r.current,{disabled:a}=p;if(v)return y.current.length?y.current:(0,ne.union)(t,i.map((e=>n(e,e.index))));if(!x)return a?t.filter(((t,r)=>!a(e[r]))):t;const o=a?S().filter((e=>!a(e))).map((e=>n(e,e.index))):S().map((e=>n(e,e.index)));return(0,ne.union)(o,i.map((e=>n(e,e.index))))})(),C=t.filter((e=>!w.includes(e))),T=t.length-C.length,N=T>0&&T<w.length,I=!!T&&T===w.length;s(C);const R=async()=>{const e=h;let t=[];c(!0);try{const r=await e.api(a);if(200===r.code){t=Array.isArray(r.data)?r.data:(0,ne.get)(r.data,e.dataKey)??[];const{disabled:i}=p;i&&(t=(0,ne.xor)(t,S().filter((e=>i(e))).map((e=>n(e,e.index))))),y.current=t}}catch(e){}return c(!1),t},P=async e=>{let t=[];t=v?e?await R():[]:e?w.slice(0):[],t=[...new Set([...t,...C])],l(t),b?.(e,t)};return o().createElement("div",{className:"cell--selection"},o().createElement(L.Checkbox,{checked:I,indeterminate:N,disabled:!w.length,onChange:e=>P(e.target.checked)}),E&&o().createElement(L.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:f("qm.table.selection.all"),onClick:()=>{P(!0)}},{key:2,label:f("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=v?(0,ne.xor)(t,await R()):(0,ne.xor)(t,w),e=[...new Set([...e,...C])],l(e)})()},{key:3,label:f("qm.table.selection.clear"),onClick:()=>{P(!1)}}];return o().createElement(L.Menu,{items:e})})()},o().createElement(Re.DownOutlined,{className:"svgicon icon"})),x&&o().createElement(L.Tooltip,{placement:"top",title:f("qm.table.selection.currentPage")},o().createElement(Re.InfoCircleOutlined,{className:"info"})))},pc=e=>{const{style:t}=e,{tableRef:r,isTreeTable:n,setRowExpandedKeys:i}=o().useContext($l),{expandable:a}=r.current.props,[l,s]=o().useState(a?.defaultExpandAllRows||!1);Ve((()=>{const{allRowKeys:e,flattenRowKeys:t}=r.current;i(l?e.filter((e=>!(n&&t.includes(e)))):[])}),[l]);const c=Ie("expand"),d={[`${c}--icon`]:!0,expanded:l,collapsed:!l};return o().createElement("span",{className:Ne()(d),title:"",onClick:e=>{e.stopPropagation(),s(!l)},style:t})},hc=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),mc=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),fc=e=>{const{tableColumns:t,sorter:r,filters:n}=e,{tableRef:i,layout:a,scrollY:l,flattenColumns:s,superFilters:c,selectionKeys:d,rightFixedColumns:u,treeExpandIndex:p,isFetch:h,isTreeTable:m,isGroupSubtotal:g,tableChange:b,setSorter:y,setElementStore:v,resetTableScroll:x,getStickyLeft:E,getStickyRight:S,createGroupData:w,createTableFullData:C}=o().useContext($l),{ellipsis:T,resizable:N,multipleSort:I,rowSelection:R,expandable:P}=i.current.props,[O,k]=Zl.sortDirections,{tableOriginData:A}=i.current,F=o().useRef(null),H=o().useMemo((()=>A.some((e=>Array.isArray(e.children)))),[A]),_=o().useMemo((()=>!h),[h]),D=o().useMemo((()=>!h),[h]),$=o().useMemo((()=>!P?.hideExpandAll),[P]),q=o().useMemo((()=>!(!R||(h?!R.selectAllOnCurrentPage&&!R.fetchAllRowKeys:R.hideSelectAll))),[h,R]);Ve((()=>{B(),b(),x()}),[r]),Ve((()=>{G(),b(),x()}),[n]),Ve((()=>{G(),b(),x()}),[c]),o().useEffect((()=>{M(),!pe(r)&&de((()=>B())),!pe(n)&&de((()=>G()))}),[]);const M=()=>{v("$header",F.current)},j=e=>{const{dataIndex:t,type:n,sorter:i,title:a,description:l}=e;if(t===Zl.selectionColumn&&"checkbox"===n){if("checkbox"===n)return o().createElement("div",{className:"cell"},q?o().createElement(uc,{selectionKeys:d}):f("qm.table.config.selectionText"));if("radio"===n)return o().createElement("div",{className:"cell"},a)}const s=[];return s.push(o().createElement("div",{key:0,className:"cell",title:cn(a)},m&&t===p&&$?o().createElement(pc,null):null,t===Zl.expandableColumn&&$?o().createElement(pc,null):a)),l&&s.push(o().createElement(L.Tooltip,{key:1,placement:"top",title:l},o().createElement(Re.InfoCircleOutlined,{className:"tip"}))),i&&s.push(K(r[t])),s},K=e=>{const t=["svgicon cell--sorter__asc",{actived:e===O}],r=["svgicon cell--sorter__desc",{actived:e===k}];return o().createElement("div",{key:2,className:"cell--sorter",title:f("qm.table.sorter.text")},o().createElement("span",{className:Ne()(t)},o().createElement(hc,null)),o().createElement("span",{className:Ne()(r)},o().createElement(mc,null)))},V=e=>o().createElement(cc,{column:e,filters:n}),z=(e,t)=>{const{sorter:n,dataIndex:i}=t;if(n){const e=r[i],t=e?e===k?null:k:O;I?(delete r[i],y(Object.assign({},r,{[i]:t}))):y(Object.assign({},{[i]:t}))}},B=()=>{_&&U()},U=e=>{const t=(0,ne.pickBy)(r,(e=>null!==e));for(const e in t){const r=s.find((t=>t.dataIndex===e));r?W(r,t[e]):delete t[e]}e||Object.keys(t).length||W({dataIndex:"index"},O)},W=(e,t)=>{const{tableFullData:r}=i.current,{dataIndex:n,sorter:a}=e,o=(e,r)=>{const i=Zr(e,n),a=Zr(r,n);return Number.isNaN(i-a)?t===O?i.toString().localeCompare(a.toString()):a.toString().localeCompare(i.toString()):t===O?i-a:a-i},l=g?w(dn(r).sort("function"==typeof a?a:o)):r.sort("function"==typeof a?a:o).slice(0);C(l)},G=()=>{D&&Y()},Y=()=>{const e=c.length?un(c):un(n),t=""!==e?g?w(Dr(dn(A),e,H)):Dr(A,e,H):A;C(t),U(!0)},X=Gr(t),Q=Ie("table"),{tableBodyWidth:Z}=a;return o().createElement("div",{ref:F,className:`${Q}--header-wrapper`},o().createElement("table",{className:`${Q}--header`,cellSpacing:"0",cellPadding:"0",style:{width:Z?`${Z}px`:""}},(()=>{const{gutterWidth:e}=a;return o().createElement("colgroup",null,s.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return o().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})})),l&&o().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),o().createElement("thead",null,(e=>{const{isIE:t}=i.current,n=["gutter",{"cell-fix-right":!!u.length}],s=t?null:{right:u.length?0:""};return e.map(((e,t)=>o().createElement("tr",{key:t,className:"header--row"},e.map(((t,n)=>((e,t,n)=>{const{isIE:s}=i.current,{gutterWidth:c}=a,{dataIndex:d,colSpan:u,rowSpan:p,fixed:h,align:m,theadAlign:f,theadClassName:g="",sorter:b,filter:y,required:v,headRender:x}=e;if(0===u)return null;const w=f||m,C=["header--column",{"col--ellipsis":e.ellipsis??T,"col--center":"center"===w,"col--right":"right"===w,"column--required":!!v,"column-has-sorter":b,"column-has-filter":y,"column--sort":!!r[d],"cell-fix-left":!s&&"left"===h,"cell-fix-right":!s&&"right"===h,"cell-fix-left-last":!s&&"left"===h&&!n[t+(u??1)]?.fixed,"cell-fix-right-first":!s&&"right"===h&&!n[t-1]?.fixed,[g]:!!g}],I=s?null:{left:"left"===h?`${E(d)}px`:"",right:"right"===h?`${S(d,"thead")+(l?c:0)}px`:""},R=N&&![Zl.expandableColumn,Zl.selectionColumn].includes(d);return o().createElement("th",{key:d,className:Ne()(C),colSpan:u,rowSpan:p,style:{...I},onClick:t=>z(t,e)},o().createElement("div",{className:"cell--wrapper"},x?o().createElement("div",{className:"cell--text cell"},x(e,i.current.tableFullData)):o().createElement(o().Fragment,null,o().createElement("div",{className:"cell--text"},j(e)),y?V(e):null)),R&&o().createElement(dc,{column:e}))})(t,n,e))),l&&o().createElement("th",{className:Ne()(n),style:{...s}}))))})(X))))},gc=o().createContext([]);function bc(){const[,e]=a.useReducer((e=>e+1),0);return e}function yc(){const{locale:e}=a.useContext(c);return{t:f,$locale:e}}const vc=e=>{const{selectionKeys:t,column:r,record:n,rowKey:i}=e,{tableRef:a,isTreeTable:l,getAllChildRowKeys:s}=o().useContext($l),{rowSelection:c}=a.current.props,d=o().useMemo((()=>r.type||""),[r.type]),u=e=>{const r=c.checkStrictly??!0;if(!l||r)return!1;const n=Ur(a.current.deriveRowKeys,e);return((e,t)=>{const r=new Set(t);let n=!1,i=!1;for(const t of e)if(r.has(t)?n=!0:i=!0,n&&i)break;return n&&i})(s(n?.children??[]),t)};return"radio"===d?(()=>{const e=c.disabled,r=e?.(n),a=!r&&t[0]===i;return o().createElement(L.Radio,{checked:a,disabled:r})})():(()=>{const e=c.disabled,r=e?.(n),a=!!t.includes(i);return o().createElement(L.Checkbox,{checked:a,indeterminate:u(i),disabled:r})})()},xc=e=>{const{record:t,rowKey:r,style:n}=e,{tableRef:i,rowExpandedKeys:a,setRowExpandedKeys:l}=o().useContext($l),{expandable:s={}}=i.current.props,[c]=o().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(t)),d=o().useMemo((()=>a.includes(r)),[a,r]);Ve((()=>{s.onExpand?.(d,t)}),[d]);const u=Ie("expand"),p={[`${u}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return o().createElement("span",{className:Ne()(p),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?a.filter((e=>e!==r)):[...a,r];l(t)},style:n})},Ec=o().forwardRef(((e,t)=>{const{size:r,defaultValue:n,value:i,min:a,max:l,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:p,stringMode:h,allowClear:m,readOnly:f,disabled:g,formatter:b=(e=>e.toString()),parser:y=(e=>e),onFocus:v}=e,x=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>l&&(t=l.toString()),t&&Number(t)<a&&(t=a.toString()),p>=0&&""!==t&&(t=new(Ni())(t).toFixed(p)),t},E=void 0!==i,[S,w]=o().useState(n??""),C=b(E?i:S),T=y(C);return Ve((()=>{e.onChange?.(T)}),[S]),o().createElement(L.Input,{ref:t,size:r,value:C,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:m,readOnly:f,disabled:g,onChange:t=>{const r=y(t.target.value);let n=/^-?\d*(\.\d*)?$/.test(r)||""===r||"-"===r;if(0===p&&r.includes(".")&&(n=!1),a>=0&&r.startsWith("-")&&(n=!1),n){if(!h&&(Number(r)>Number.MAX_SAFE_INTEGER||Number(r)<Number.MIN_SAFE_INTEGER))return;(t=>{E?e.onChange?.(t):w(t)})(r)}},onFocus:v,onBlur:()=>{const t=x(T);e.onBlur?.(t,T)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(x(T),T)}})}));Ec.displayName="InputNumber";const Sc=Ec;function wc(){return wc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},wc.apply(this,arguments)}const{Search:Cc}=L.Input,Tc=o().forwardRef(((e,t)=>{const{column:r,record:n,rowKey:i,columnKey:a}=e,{tableRef:l,tableBodyRef:s,$size:c,flattenColumns:d,updateTableData:u,doFieldValidate:p,dataChange:h}=o().useContext($l),m=o().useContext(gc),g=bc(),{store:b,fieldAuth:y}=l.current,x=r.editRender?.(n,r)||{},E=o().useRef(null),S=o().useRef(null),w=o().useRef(null),C=o().useRef(null),T=o().useRef(null),N=o().useRef(!1),I=o().useRef({}),R=o().useRef({}),P=o().useRef([]),[O,k]=o().useState(!1),[A,F]=o().useState(!1),[H,_]=o().useState(!1),[D,$]=o().useState(x.items||[]),[q,M]=o().useState(),K=(x.editable||(0,ne.isEqual)(m,[i,a]))&&!x.disabled&&!y[a]?.disabled,V=`${i}|${a}`,z=2===m.length?`${m[0]}|${m[1]}`:"",U=![...b.state.required,...b.state.validate].some((e=>{let{x:t,y:r}=e;return t===i&&r===a})),W=b.state.required.find((e=>{let{x:t,y:r}=e;return t===i&&r===a}))?.text||"",G=b.state.validate.find((e=>{let{x:t,y:r}=e;return t===i&&r===a}))?.text||"",Y=b.state.edited.some((e=>{let{x:t,y:r}=e;return t===i&&r===a})),X=K||!U||O||H||A,Q=!!x.helper?.combinedDataIndex&&("search-helper"===x.type||"tree-helper"===x.type),Z=x.type?.endsWith("multiple");o().useEffect((()=>{X&&z===V&&re()}),[m]),o().useLayoutEffect((()=>{const{items:e}=x;Z&&e&&te(e.map((e=>({[R.current.valueKey]:e.value,[R.current.textKey]:e.text}))))}),[]);const J=()=>{u(),h()},ee=(e,t)=>{k(e),t?.()},te=e=>{P.current=e},re=()=>{const{type:e}=x;switch(e){case"text":S.current?.focus();break;case"number":w.current?.select();break;case"search-helper":C.current?.focus();break;case"tree-helper":T.current?.focus()}};o().useImperativeHandle(t,(()=>({focus:re})));const ie=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0,cancelable:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0,cancelable:!0}))},ae=(e,t,r)=>{const{cornerSign:n=!0}=x.extra||{};b.addToUpdated(e),n&&b.addToEdited({x:t,y:r})},oe=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"",le={text:(e,t,r)=>{const{dataIndex:n}=t,{type:l,extra:s={},rules:d=[],onInput:u,onChange:h,onEnter:m,onBlur:b}=x,y=Zr(e,n),v=Object.assign({},{minRows:1,maxRows:4},s.autoSize),E=r?{rows:v.minRows,autoSize:v}:null,w=s.password?L.Input.Password:r?L.Input.TextArea:L.Input;return o().createElement(w,wc({ref:S,size:c,value:y,maxLength:s.maxLength,showCount:s.showCount},E,{autoComplete:s.password?"new-password":"off",placeholder:s.placeholder||f("qm.table.editable.inputPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,suffix:s.suffix,onChange:t=>{const r=t.target.value??"";Jr(e,n,r),p(d,r,i,a),g(),u?.({[V]:r}),N.current=!0},onFocus:()=>F(!0),onBlur:t=>{F(!1);const r=t.target.value??"";N.current&&(N.current=!1,ae(e,i,a),h?.({[V]:r},e),b?.({[V]:r},e),J())},onKeyUp:t=>{if(13===t.keyCode&&!t.shiftKey){const r=t.target.value??"";m?.({[V]:r},e)}},onKeyDown:e=>{r&&13===e.keyCode&&!e.shiftKey&&m&&e.preventDefault()}}))},textarea:(e,t)=>le.text(e,t,!0),number:(e,t)=>{const{dataIndex:r,precision:n,formatType:l}=t,{type:s,extra:d={},rules:u=[],onInput:h,onChange:m,onEnter:b,onBlur:y}=x,v=Zr(e,r);let E,S;return"finance"===l&&(E=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},S=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===l&&(E=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new(Ni())(e).times(100).toNumber()}`,S=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(Ni())(e).times(.01).toString()),o().createElement(Sc,{ref:w,size:c,value:v,min:d.min,max:d.max,precision:n,stringMode:d.stringMode,prefix:d.prefix,suffix:d.suffix??("percent"===l?"%":void 0),placeholder:d.placeholder||f("qm.table.editable.inputPlaceholder"),maxLength:d.maxLength,allowClear:d.allowClear,readOnly:d.readOnly,disabled:d.disabled,formatter:E,parser:S,onChange:t=>{Jr(e,r,t),p(u,t,i,a),g(),h?.({[V]:t}),N.current=!0},onFocus:()=>F(!0),onBlur:(t,n)=>{if(F(!1),!N.current)return;N.current=!1;let o=d.stringMode?t:oe(t);"percent"===l&&"."===n.charAt(n.length-1)&&(o=Number(t)/100),Jr(e,r,o),ae(e,i,a),m?.({[V]:o},e),y?.({[V]:o},e),J()},onEnter:(t,r)=>{let n=d.stringMode?t:oe(t);"percent"===l&&"."===r.charAt(r.length-1)&&(n=Number(t)/100),b?.({[V]:n},e)}})},select:(e,t,r)=>{const{dataIndex:n,dictItems:s=[]}=t,{type:d,extra:u={},rules:h=[],items:m,onChange:g,onEnter:b}=x,{elementStore:y}=l.current,v=m||s,E=Zr(e,n);let S=E;return o().createElement(L.Select,{mode:r?"multiple":void 0,size:c,popupClassName:"table-editable__popper",value:E||void 0,placeholder:u.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:u.allowClear,listHeight:u.listHeight,maxTagCount:u.collapseTags?"responsive":void 0,maxTagTextLength:u.maxTagTextLength,disabled:u.disabled,style:{width:"100%"},showSearch:u.filterable??!0,filterOption:(e,t)=>{const r=t?.children?.toString()||"";return`${r}|${ei.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{Jr(e,n,t),p(h,t,i,a),ae(e,i,a),g?.({[V]:t},e),J()},onSelect:e=>{S=e},onInputKeyDown:t=>{13===t.keyCode&&de((()=>b?.({[V]:S},e)))}},v.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>le.select(e,t,!0),date:(e,t,r)=>{const{dataIndex:n}=t,{type:l,extra:s={},rules:d=[],onChange:u}=x,h=r||"exactdate",m=Zr(e,n);return o().createElement(j,{size:c,popupClassName:"table-editable__popper",value:an(m,Tn[h])??void 0,picker:Cn[h],format:s.format,showTime:"datetime"===h,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:r}=s;return t&&r?e.isBefore(t,"day")||e.isAfter(r,"day"):t?e.isBefore(t,"day"):!!r&&e.isAfter(r,"day")})(e),placeholder:s.placeholder,allowClear:s.allowClear,disabled:s.disabled,style:{width:"100%"},onChange:t=>{const r=on(t,Tn[h]);Jr(e,n,r),p(d,r,i,a),ae(e,i,a),u?.({[V]:r},e),J()}})},datetime:(e,t)=>le.date(e,t,"datetime"),month:(e,t)=>le.date(e,t,"month"),year:(e,t)=>le.date(e,t,"year"),time:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},rules:s=[],onChange:d}=x,u="HH:mm:ss",h=Zr(e,r);return o().createElement(B,{size:c,popupClassName:"table-editable__popper",value:an(h,u)??void 0,format:l.format||u,placeholder:l.placeholder,allowClear:l.allowClear,disabled:l.disabled,style:{width:"100%"},onChange:t=>{const n=on(t,u);Jr(e,r,n),p(s,n,i,a),ae(e,i,a),d?.({[V]:n},e),J()}})},checkbox:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},rules:s=[],onChange:c}=x,{trueValue:d=jl,falseValue:u=Kl,disabled:h}=l,m=Zr(e,r);return o().createElement(L.Checkbox,{checked:m===d,disabled:h,onChange:t=>{const n=t.target.checked?d:u;Jr(e,r,n),p(s,n,i,a),ae(e,i,a),c?.({[V]:n},e),J()}})},switch:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},rules:s=[],onChange:c}=x,{trueValue:d=jl,falseValue:u=Kl,disabled:h}=l,m=Zr(e,r);return o().createElement(L.Switch,{checked:m===d,disabled:h,onChange:t=>{const n=t?d:u;Jr(e,r,n),p(s,n,i,a),ae(e,i,a),c?.({[V]:n},e),J()}})},"search-helper":(e,t)=>{const{dataIndex:r,precision:n}=t,{type:l,extra:s={},rules:u=[],helper:h={},onInput:m,onChange:g,onEnter:b}=x,y=en(e,Q?h.combinedDataIndex:r),S=h.fieldAliasMap;S||v("Table","helper 需要配置 `fieldAliasMap` 选项");const w="function"==typeof S?S():S||{};Object.keys(w).includes(r)||v("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Q&&(h.combinedDataIndex.split("|").every((e=>Object.keys(w).includes(e)))||v("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),w[r].includes("|")&&v("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const T=e=>{const{filterAliasMap:t}=h,n=""!==e?e:void 0,i=("function"==typeof t?t():t)||[],a={[r]:n};return(Array.isArray(i)?i:[i]).forEach((e=>{if((0,ne.isPlainObject)(e))for(const t in e)a[t]="function"==typeof e[t]?e[t](n):n;else a[e]=n})),a},R=e=>{const{autoQueryAssign:t=!0}=h;t&&(I.current=T(e)),k(!0)},P=(r,n)=>{const{beforeOpen:i}=h,a=(i??se)({[V]:y},e,t);a?.then?a.then((()=>{R(r),n?.()})).catch((()=>{})):!1!==a&&(R(r),n?.())},A=e=>{const t={};for(const n in w){const i=w[n];n!==r&&(t[n]=en(e,i))}const n=w[r]?en(e,w[r]):"";F(n,t);const{closed:i}=h;ee(!1,(()=>ie(E.current))),re(),i?.(e)},L=()=>{const{onlySelect:e=!0}=h;N.current&&F(e?"":y),ee(!1,(()=>ie(E.current)))},F=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;if((0,ne.isPlainObject)(o)&&Object.keys(o).length)for(const t in o){const r=o[t],n=d.find((e=>e.dataIndex===t));if(n){Jr(e,t,r,n.precision);const a=n.editRender?.(e,n);a&&Array.isArray(a.rules)&&p(a.rules,r,i,t)}else Jr(e,t,r)}Q&&!t&&((e,t,r,n)=>{if(!t.includes("|"))return Jr(e,t,"",void 0);const i="".split("|")||[];t.split("|").forEach(((t,r)=>{t&&Jr(e,t,i[r]?.trim())}))})(e,h.combinedDataIndex),Jr(e,r,t,n),p(u,t,i,a),ae(e,i,a),g?.({[V]:t},e),J(),I.current={},N.current=!1,M(void 0)},H={visible:O,title:f("qm.searchHelper.text"),width:h.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Hi[c]+20}px`},onClose:()=>{L()}},D={...h,size:c,initialValue:Object.assign({},I.current,h.initialValue),onClose:e=>{e?A(e):L()}};return o().createElement(o().Fragment,null,o().createElement(Cc,{ref:C,value:q??y,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,onBlur:e=>{const{value:t}=e.target,{onlySelect:n=!0,table:i}=h;if(N.current&&!O)return t&&n&&i?.fetch?.api?(e=>{const{table:t,initialValue:r={}}=h,{beforeFetch:n=se}=t.fetch;return new Promise((async(i,a)=>{const o=(0,ne.merge)({},t.fetch.params,{...r,...T(e)},{currentPage:1,pageSize:500});if(!n(o))return a();_(!0);try{const e=await t.fetch.api(o);200===e.code?i(Array.isArray(e.data)?e.data:(0,ne.get)(e.data,t.fetch.dataKey)??[]):a()}catch(e){a(e)}finally{de((()=>_(!1)))}}))})(t).then((e=>function(){let e=arguments.length>1?arguments[1]:void 0;const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter((t=>en(t,w[r]).toString().includes(e)));if(1===t.length)return A(t[0]);P(e)}(e,t))).catch((()=>F(""))):void F(t)},onChange:e=>{const{value:t}=e.target;m?.({[V]:t}),N.current=!0,M(t)},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";b?.({[V]:r},e)}},onDoubleClick:e=>{const{value:t}=e.target;P(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&P(e)}}),o().createElement(Er,H,o().createElement(Gc,D)))},"search-helper-multiple":(e,t)=>{const{dataIndex:r}=t,{type:n,items:l=[],extra:s={},rules:d=[],helper:u={},onInput:h,onChange:m,onEnter:g}=x,b=Zr(e,r),y=u.fieldAliasMap;y||v("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof y?y():y||{};Object.keys(S).includes("valueKey")&&Object.keys(S).includes("textKey")||v("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=S;const w=r=>{const{beforeOpen:n}=u,i=(n??se)({[V]:b},e,t);i?.then?i.then((()=>{k(!0),r?.()})).catch((()=>{})):!1!==i&&(k(!0),r?.())},C=()=>{ee(!1,(()=>ie(E.current)))},T=t=>{Jr(e,r,t),p(d,t,i,a),ae(e,i,a),m?.({[V]:t},e,P.current),J()},N={visible:O,title:f("qm.searchHelper.text"),width:u.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Hi[c]+20}px`},onClose:()=>{C()}},I={...u,size:c,multiple:!0,initialValue:(0,ne.merge)({},u.initialValue),defaultSelectedKeys:b,onClose:(e,t)=>{e?((e,t)=>{const{textKey:r,valueKey:n}=S;te((0,ne.uniqBy)([...P.current.filter((e=>t.includes(e[n]))),...e],n));const i=P.current.map((e=>({text:e[r],value:e[n]}))),a=(0,ne.uniqBy)([...i,...l],"value").filter((e=>t.includes(e.value)));$(a),T(a.map((e=>e.value)));const{closed:o}=u;ee(!1,(()=>ie(E.current))),o?.(P.current)})(e,t):C()}};return o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{className:"ant-input-wrapper ant-input-group"},o().createElement(L.Select,{mode:"multiple",open:!1,value:b,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,maxTagCount:s.collapseTags?"responsive":void 0,maxTagTextLength:s.maxTagTextLength,disabled:s.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&g?.({[V]:b},e)},onDoubleClick:()=>{s.disabled||w()},onChange:e=>{const{valueKey:t}=S;te(P.current.filter((r=>e.includes(r[t])))),T(e)}},D.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text)))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:s.disabled,icon:o().createElement(Re.SearchOutlined,null),onClick:()=>{w()}})))),o().createElement(Er,N,o().createElement(Gc,I)))},"tree-helper":(e,t)=>{const{dataIndex:r,precision:n}=t,{type:l,extra:s={},rules:u=[],helper:h={},onChange:m,onEnter:g}=x,b=en(e,Q?h.combinedDataIndex:r),y=h.fieldAliasMap;y||v("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof y?y():y||{};Object.keys(S).includes(r)||v("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Q&&(h.combinedDataIndex.split("|").every((e=>Object.keys(S).includes(e)))||v("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),S[r].includes("|")&&v("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const w=r=>{const{beforeOpen:n}=h,i=(n??se)({[V]:b},e,t);i?.then?i.then((()=>{k(!0),r?.()})).catch((()=>{})):!1!==i&&(k(!0),r?.())},C=()=>{ee(!1,(()=>ie(E.current)))},N=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;if((0,ne.isPlainObject)(o)&&Object.keys(o).length)for(const t in o){const r=o[t],n=d.find((e=>e.dataIndex===t));if(n){Jr(e,t,r,n.precision);const a=n.editRender?.(e,n);a&&Array.isArray(a.rules)&&p(a.rules,r,i,t)}else Jr(e,t,r)}Jr(e,r,t,n),p(u,t,i,a),ae(e,i,a),m?.({[V]:t},e),J()},I={visible:O,title:f("qm.searchHelper.text"),width:h.width??"30%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Hi[c]+20}px`},onClose:()=>{C()}},R={...h,defaultSelectedKeys:[b],size:c,onClose:e=>{e?(e=>{const t={};for(const n in S){const i=S[n];n!==r&&(t[n]=en(e,i))}const n=S[r]?en(e,S[r]):"";N(n,t);const{closed:i}=h;ee(!1,(()=>ie(E.current))),re(),i?.(e)})(e):C()}};return o().createElement(o().Fragment,null,o().createElement(Cc,{ref:T,value:b,allowClear:s.allowClear??!0,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";g?.({[V]:r},e)}},onDoubleClick:()=>{w()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?w():N(""))}}),o().createElement(Er,I,o().createElement(rd,R)))},"tree-helper-multiple":(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},items:s=[],rules:d=[],helper:u={},onInput:h,onChange:m,onEnter:g}=x,b=Zr(e,r),y=u.fieldAliasMap;y||v("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof y?y():y||{};Object.keys(S).includes("valueKey")&&Object.keys(S).includes("textKey")||v("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=S;const w=r=>{const{beforeOpen:n}=u,i=(n??se)({[V]:b},e,t);i?.then?i.then((()=>{k(!0),r?.()})).catch((()=>{})):!1!==i&&(k(!0),r?.())},C=()=>{ee(!1,(()=>ie(E.current)))},T=t=>{Jr(e,r,t),p(d,t,i,a),ae(e,i,a),m?.({[V]:t},e,P.current),J()},N={visible:O,title:f("qm.searchHelper.text"),width:u.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Hi[c]+20}px`},onClose:()=>{C()}},I={...u,size:c,multiple:!0,initialValue:(0,ne.merge)({},u.initialValue),defaultSelectedKeys:b,onClose:e=>{e?(e=>{const{textKey:t,valueKey:r}=S;te(e);const n=P.current.map((e=>({text:e[t],value:e[r]})));$(n),T(n.map((e=>e.value)));const{closed:i}=u;ee(!1,(()=>ie(E.current))),i?.(P.current)})(e):C()}};return o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{className:"ant-input-wrapper ant-input-group"},o().createElement(L.Select,{mode:"multiple",open:!1,value:b,placeholder:l.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:l.allowClear,maxTagCount:l.collapseTags?"responsive":void 0,maxTagTextLength:l.maxTagTextLength,disabled:l.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&g?.({[V]:b},e)},onDoubleClick:()=>{l.disabled||w()},onChange:e=>{const{valueKey:t}=S;te(P.current.filter((r=>e.includes(r[t])))),T(e)}},D.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text)))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:l.disabled,icon:o().createElement(Re.SearchOutlined,null),onClick:()=>{w()}})))),o().createElement(Er,N,o().createElement(rd,I)))}};return o().createElement(o().Fragment,null,X?(()=>{const{type:e}=x,t=le[e];if(!t)return v("Table","单元格编辑的类型 `type` 配置不正确"),null;const i=["cell--edit",{"is-error":!U}];return o().createElement("div",{ref:E,className:Ne()(i)},t(n,r),!U&&o().createElement("div",{className:"cell-error"},W||G))})():(()=>{const{extra:t={}}=x;return o().createElement("span",{style:{color:t.disabledColor}},e.children)})(),Y&&o().createElement("i",{className:"cell--sign"}))}));Tc.displayName="CellEdit";const Nc=Tc,Ic=require("copy-to-clipboard");var Rc=n.n(Ic);const Pc=function(e){if(!o().isValidElement(e))return null;for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return o().cloneElement(e,...r)},Oc=e=>{const{text:t,options:r,showMessage:n=!0,onCopy:i}=e;return Pc(e.children,{onClick:a=>{const l=o().Children.only(e.children),s=Rc()(t,r);i?.(t,s),s&&n&&L.message.success(f("qm.clipboard.success")),l&&l.props&&"function"==typeof l.props.onClick&&l.props.onClick(a)}})};Oc.displayName="QmCopyToClipboard";const kc=Oc,Ac=o().forwardRef(((e,t)=>{const{column:r,row:n,rowIndex:i,columnIndex:l,rowKey:s,depth:c,showTitle:d}=e,{tableRef:u,flattenColumns:p,selectionKeys:h,treeExpandIndex:m,updateMark:f,isTreeTable:g}=o().useContext($l),{treeConfig:b}=u.current.props,{dataIndex:y,canCopy:v,render:x,editRender:E,shouldCellUpdate:S}=r,{t:w}=yc(),{renderText:C,getTitleFromCellNode:T}=fs(),N=o().useRef(null),[I,R]=function(e,c,d){const u=a.useRef({});return"value"in u.current&&!((e,t)=>{if(S){const[,r]=e,[,n]=t;return S(n,r)}return!function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=new Set;return function e(t,i){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(n.has(t))return!1;if(t===i)return!0;if(r&&a>1)return!1;n.add(t);const o=a+1;if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],i[r],o))return!1;return!0}if(t&&i&&"object"==typeof t&&"object"==typeof i){const r=Object.keys(t);return r.length===Object.keys(i).length&&r.every((r=>e(t[r],i[r],o)))}return!1}(e,t)}(e,t)})(u.current.condition,c)||(u.current.value=(()=>{const e=Zr(n,y),a=x?x(e,n,r,i,l):C(e,r,n);return[a,E?o().createElement(Nc,{ref:t,column:r,record:n,rowKey:s,columnKey:y},a):null]})(),u.current.condition=c),u.current.value}(0,[f,(e=>{const t={};for(let r=0;r<p.length;r++){const{dataIndex:n}=p[r];[Zl.expandableColumn,Zl.selectionColumn,"index","pageIndex",Zl.operationColumn].includes(n)||me(t,n,he(e,n))}return t})(n),x,E]);o().useEffect((()=>{if([Zl.expandableColumn,Zl.selectionColumn,Zl.operationColumn].includes(y))return;const e=N.current.parentNode;d?e.title=T(I):e.removeAttribute("title")}),[d,I]);const P=e=>Array.isArray(e.children);return o().createElement("div",{ref:N,className:"cell"},(()=>{if(y===Zl.expandableColumn)return o().createElement(xc,{record:n,rowKey:s});if(y===Zl.selectionColumn)return o().createElement(vc,{selectionKeys:h,column:r,record:n,rowKey:s});if(R)return R;if(g&&y===m)return o().createElement(o().Fragment,null,(e=b?.virtual?n._level:c)?o().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*Zl.treeTable.textIndent+"px"}}):null,o().createElement(xc,{key:"expand",record:n,rowKey:s,style:P(n)?{}:{visibility:"hidden"}}),I);var e;if(v){const e=T(I);return o().createElement("div",{className:"cell--copy"},o().createElement("span",{className:"text"},I),e&&o().createElement(kc,{text:e},o().createElement(Re.CopyOutlined,{className:"icon",title:w("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return I})())}));Ac.displayName="Cell";const Lc=Ac;function Fc(){return Fc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Fc.apply(this,arguments)}const Hc=o().forwardRef(((e,t)=>{const{tableFlatColumns:r,tableData:n}=e,{getRowKey:i,tableRef:l,flattenColumns:s,editableColumns:c,leftFixedColumns:d,rightFixedColumns:u,sorter:p,layout:h,showFooter:m,scrollX:g,scrollY:b,selectionKeys:y,rowExpandedKeys:v,highlightKey:x,isPingLeft:E,isPingRight:S,isTableEmpty:w,isTreeTable:C,isGroupSubtotal:T,isWebPagination:N,isDragMergeCell:I,setElementStore:R,createTableFullData:P,setSelectionKeysEffect:O,setHighlightKey:k,getStickyLeft:A,getStickyRight:L,scrollXToColumn:F,scrollYToRecord:H,rowInViewport:_,dataChange:D,setPingLeft:$,setPingRight:q,setFullScreen:M,findParentRowKeys:j,getAllChildRowKeys:K,triggerScrollXEvent:V,triggerScrollYEvent:z,scrollBottomDebouncer:B}=o().useContext($l),{height:U,minHeight:W,maxHeight:G,rowHeight:Y,rowSelection:X,rowHighlight:Q,treeConfig:Z,expandable:J,stripe:ee,summation:te,rowStyle:re,cellStyle:ie,spanMethod:ae,nativeScrollBar:oe,ellipsis:ce,showHeader:de,rowDraggable:ue,onRowClick:pe,onRowDblclick:he,onRowContextmenu:me,onRowEnter:fe}=l.current.props,ge=o().useRef(null),be=o().useRef({}),ye=o().useRef(null),ve=o().useRef(null),Ee=o().useRef({prevST:0,prevSL:0}),{dragStart:Se,renderDragPanel:we,closeDragPanel:Ce}=(()=>{const{tableRef:e,layout:t,flattenColumns:r,isDragMergeCell:n}=o().useContext($l),{mergeCells:i=[],onMergeChange:a}=e.current.props,[l,s]=o().useState(!1),c=o().useRef(null),d=o().useRef(null),u=o().useRef({x:0,y:0,disX:0,disY:0}),p=Ie("table");Ve((()=>{n||x()}),[n]);const h=()=>{x(),Ye(c.current,{display:"none"})},m=e=>{const t=[];for(let r=0;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push([e.row+r,e.col+n]);return t},g=()=>{u.current={x:0,y:0,disX:0,disY:0},d.current&&!E(d.current)||(d.current=null,h()),s(!0),document.removeEventListener("mousemove",b)},b=e=>{const{pageX:r,pageY:n}=e,{x:i,y:a,disX:o,disY:l}=u.current;let s=o,d=l,p=r-i,h=n-a;return p<0&&(p=Math.abs(p),s=o-p,Ye(c.current,{left:`${s}px`})),h<0&&(h=Math.abs(h),d=l-h,Ye(c.current,{top:`${d+t.headerHeight}px`})),Ye(c.current,{width:`${p}px`,height:`${h}px`}),y(s,d,p,h),!1},y=Ot(((t,n,i,a)=>{const{allTableData:o,scrollYStore:l}=e.current;let s=-1,c=-1,u=-1,p=-1;for(let e=0;e<o.length;e++)n>l.rowHeight*e&&n<l.rowHeight*(e+1)&&(s=e),n+a>l.rowHeight*e&&n+a<l.rowHeight*(e+1)&&(c=e);let h=0;for(let e=0;e<r.length;e++)t>h&&t<h+S(r[e])&&(u=e),t+i>h&&t+i<h+S(r[e])&&(p=e),h+=S(r[e]);const m={row:s,col:u,rowSpan:c-s+1,colSpan:p-u+1};(0,ne.isEqual)(d,m)||(d.current=m,v(s,c,u,p))}),5),v=(t,r,n,i)=>{const{elementStore:a,scrollYStore:o}=e.current,l=a.$tableBody.querySelectorAll("tbody > tr");for(let e=0;e<l.length;e++){const a=l[e].children;for(let l=0;l<a.length;l++)if(a[l].classList.remove("selected"),(t!==r||n!==i)&&e+o.startIndex>=t&&e+o.startIndex<=r){const e=Number(a[l].getAttribute("colspan")),t=Number(a[l].getAttribute("data-index")),r=e>1?t+e-1:t;r>=n&&r<=i&&a[l].classList.add("selected")}}},x=()=>{const{elementStore:t}=e.current,r=t.$tableBody.querySelectorAll("tbody > tr");for(let e=0;e<r.length;e++){const t=r[e].children;for(let e=0;e<t.length;e++)t[e].classList.remove("selected")}},E=e=>1===e.rowSpan&&1===e.colSpan,S=e=>e.width||e.renderWidth||e.minWidth||Zl.defaultColumnWidth;return{dragStart:r=>{const{pageX:n,pageY:i}=r,{elementStore:a}=e.current,{x:o,y:l}=Ze(a.$table),{scrollLeft:p,scrollTop:h}=a.$tableBody.parentNode.parentNode;d.current=null,u.current={x:n,y:i,disX:n+p-o,disY:i+h-(l+t.headerHeight)},Ye(c.current,{width:0,height:0,left:n-o+"px",top:i-l+"px",display:"block"}),x(),s(!1),document.addEventListener("mousemove",b,{passive:!0}),document.addEventListener("mouseup",g,{passive:!0,once:!0})},renderDragPanel:()=>o().createElement("div",{ref:c,className:`${p}--merge-cell`,onMouseDown:e=>e.stopPropagation()},l&&o().createElement(o().Fragment,null,o().createElement(xe,{size:"small",className:"btn cancel",onClick:()=>{if(d.current&&!E(d.current)){const e=m(d.current),t=i.findIndex((t=>{const r=m(t);return(0,ne.intersectionWith)(r,e,ne.isEqual).length===r.length}));-1!==t&&a?.(i.filter(((e,r)=>r!==t)))}h()}},f("qm.table.mergeCell.cancel")),o().createElement(xe,{size:"small",type:"primary",className:"btn confirm",onClick:()=>{if(d.current&&!E(d.current)){const e=m(d.current);let t=!1;for(let r=0;r<i.length;r++)(0,ne.intersectionWith)(m(i[r]),e,ne.isEqual).length&&(t=!0);t||a?.([...i,d.current])}h()}},f("qm.table.mergeCell.confirm")))),closeDragPanel:h}})(),Te=l.current.scrollXLoad?r:s,Re=o().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:r,tableFullHeight:n,tableAutoHeight:i}=h,a={};return w&&Object.assign(a,{minHeight:"100px"}),W&&Object.assign(a,{minHeight:Xr(W)-e-r+"px"}),G&&Object.assign(a,{maxHeight:Xr(G)-e-r+"px"}),U||n||i?{...a,maxHeight:"",minHeight:"",height:`${t}px`}:a}),[U,G,W,w,h]),Pe=o().useMemo((()=>{const{scrollYStore:e}=l.current,{viewportHeight:t,gutterWidth:r}=h;return Math.floor((g?t-r:t)/e.rowHeight)}),[h,g]),[Oe,ke]=o().useState([]),Ae=bc(),Le=function(e,t){const[r,n]=a.useState(!1);return a.useEffect((()=>{let r;const i=e.current,a=e=>{r=e},o=e=>{((e,r)=>{const a=e.target,o=r?.target,l=!a||!o,s=i?.contains(a)||i?.contains(o),c=i===a,d=t?.map((e=>Array.from(document.querySelectorAll(e)))).flat()||[],u=d.some((e=>e?.contains(a)))||d.includes(o);n(!(l||s||c||u))})(e,r)};return i&&(ze(document,"mousedown",a),ze(document,"mouseup",o)),()=>{i&&(Be(document,"mousedown",a),Be(document,"mouseup",o))}}),[e]),r}(ge,[".table-editable__popper"]);o().useImperativeHandle(t,(()=>({setClickedValues:De,createFocus:_e,forceUpdate:Ae}))),Ve((()=>{Le&&(De([]),I&&Ce())}),[Le]),Ve((()=>{Oe.length&&Yl.focus(l.current.uid)}),[Oe]),o().useEffect((()=>{He();const e=Gt()(document,"keydown",Fe);return()=>e.remove()}),[]);const Fe=as((e=>{const{keyCode:t}=e;if(l.current.uid===Yl.getFocusInstance()?.id&&(27===t&&(De([]),k(""),M(!1)),Oe.length&&(et(document.activeElement,ge.current)||"INPUT"!==document.activeElement?.tagName))){if(13===t&&("radio"===X?.type||Q)){const t=y[0]??x??null,r=n.find((e=>i(e,e.index)===t))??null;r&&fe?.(r,e)}if(38===t||40===t){We(e);const{allTableData:r}=l.current,a=N?Wr(n):r,o=a.length;let s=a.findIndex((e=>i(e,e.index)===Oe[0]));const c=38===t?(--s+o)%o:++s%o,d=a[c],u=i(d,d.index);"radio"!==X?.type||X.disabled?.(d)||O([u]),Q&&!Q.disabled?.(d)&&k(u),_(c)||(38===t&&H(u,c),40===t&&H(u,Pe>c+1?0:c+1-Pe)),De([u,Oe[1]])}if(9===t){if(We(e),!c.length)return De([]);const t=c.length;let r=c.findIndex((e=>e.dataIndex===Oe[1]));const n=++r%t,i=c[n].dataIndex;De([Oe[0],i]),F(i)}}})),He=()=>{R("$tableBody",ge.current),R("$tableXspace",ye.current),R("$tableYspace",ve.current)},_e=(e,t)=>{be.current[`${e}-${t}`]?.focus()},De=e=>{(0,ne.isEqual)(e,Oe)||ke(e)},$e=(e,t,r)=>r?[...t,e]:t.filter((t=>t!==e)),qe=(e,t,r)=>{const{disabled:n}=X||{},{deriveRowKeys:i,recordsMap:a}=l.current,o=Ur(i,e);let s=[];const c=K(o?.children||[]);return s=r?[...new Set([...t,e,...c])]:t.filter((t=>![e,...c].includes(t))),n&&(s=s.filter((e=>!a.has(e)||!n(a.get(e))))),(mn(i,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Ur(i,e),r=t?.children?.every((e=>s.includes(e.rowKey)));s=r?[...s,e]:s.filter((t=>t!==e))})),s},Me=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=[];return e.forEach((e=>{const n=e.index,a=i(e,e.index);if(r.push(je(e,n,a,t)),J?.expandedRowRender){const{expandedRowClassName:t,rowExpandable:i=se}=J;v.includes(a)&&i(e)&&r.push(o().createElement("tr",{key:`expand_${a}`,className:"body--row-expanded"},o().createElement("td",{colSpan:Te.length,className:"body--column",style:{paddingLeft:X?2*Zl.selectionColumnWidth:Zl.selectionColumnWidth}},o().createElement("div",{className:Ne()("cell",t)},J.expandedRowRender(e,n)))))}if(!Z?.virtual&&(e=>Array.isArray(e.children))(e)){const n="function"!=typeof J?.rowExpandable||J.rowExpandable(e);v.includes(a)&&n&&r.push(...Me(e.children,t+1))}})),r},je=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const i=["body--row",{"body--row-striped":ee&&t%2!=0,"body--row-selected":y.includes(r),"body--row-current":x===r,...T?Xe(e._group):null}];return o().createElement("tr",{key:r,className:Ne()(i)},Te.map(((i,a)=>Ke(i,a,e,t,r,n))))},Ke=(e,t,r,n,a,s)=>{const{isIE:c}=l.current,{dataIndex:h,fixed:m,align:f,className:g="",editRender:b}=e,{rowSpan:v,colSpan:x}=Ue(r,e,n,t);if(!v||!x)return null;const E=e.ellipsis??ce,S=!c&&"left"===m,w=!c&&"right"===m,N=["body--column",{"col--ellipsis":E,"col--center":"center"===f,"col--right":"right"===f,"column--sort":!!p[h],"cell-fix-left":S,"cell-fix-right":w,"cell-fix-left-last":S&&d[d.length-x]?.dataIndex===h,"cell-fix-right-first":w&&u[0]?.dataIndex===h,[g]:!!g}],I=w&&x>1?Te.slice(t+1,t+x).reduce(((e,t)=>e+(t.width||t.renderWidth||0)),0):0,R=c?null:{left:S?`${A(h)}px`:"",right:w?L(h)-I+"px":""},P=re?"function"==typeof re?re(r,n):re:null,F=ie?"function"==typeof ie?ie(r,e,n,t):ie:null,H=T?Ge(r._group):null,_=Object.assign({},R,Y?{height:Y}:null,H,P,F);if(b){const{extra:t}=b(r,e)||{};t?.disabledBackgroundColor&&Object.assign(_,{backgroundColor:t?.disabledBackgroundColor})}return o().createElement("td",{key:h,rowSpan:v>1?v:void 0,colSpan:x>1?x:void 0,"data-index":t,className:Ne()(N),style:_,onClick:t=>((e,t,r)=>{const{dataIndex:n}=r;if([Zl.expandableColumn,Zl.operationColumn].includes(n))return;const a=i(t,t.index);De([a,n]);const o=r.editRender?.(t,r),l=o&&!o.disabled,{type:s,selectByClickRow:c=!0,disabled:d=le}=X||{};!s||d(t)||l||(c||n===Zl.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:n=!0,onSelect:i}=X||{};if("radio"===r&&O([e]),"checkbox"===r){const r=!y.includes(e),a=C&&!n?qe(e,y,r):$e(e,y,r);O(a),i?.(r,t,a)}})(a,t),[Zl.selectionColumn].includes(n)||(!Q||Q.disabled?.(t)||l||k(a),pe?.(t,r,e))})(t,r,e),onDoubleClick:t=>((e,t,r)=>{const{dataIndex:n}=r;[Zl.expandableColumn,Zl.selectionColumn,Zl.operationColumn].includes(n)||he?.(t,r,e)})(t,r,e),onContextMenu:t=>((e,t,r)=>{const{dataIndex:n}=r;[Zl.expandableColumn,Zl.selectionColumn,Zl.operationColumn].includes(n)||me?.(t,r,e)})(t,r,e)},o().createElement(Lc,{ref:e=>be.current[`${a}-${h}`]=e,row:r,column:e,rowIndex:n,columnIndex:t,rowKey:a,depth:s,showTitle:E}))},Ue=(e,t,r,i)=>{let a=1,o=1;if("function"==typeof ae){const l=ae({row:e,column:t,rowIndex:r,columnIndex:i,tableData:n});if(Array.isArray(l)?(a=l[0],o=l[1]):(0,ne.isPlainObject)(l)&&(a=l.rowSpan,o=l.colSpan),e===n[0]&&0===a){a=1;for(let e=1;e<n.length;e++){const{rowSpan:r}=Ue(n[e],t,n[e].index,i);if(r>0)break;a++}}}const{mergeCells:s}=l.current;if(s.length>0){const e=s.find((e=>e.row===r&&e.col===i));e&&(a=e.rowSpan,o=e.colSpan)}return{rowSpan:a,colSpan:o}},Ge=e=>{const{backgroundColor:t,color:r}=te.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:r}},Xe=e=>{const t=te.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},Qe=Ie("table"),Je=I?{onMouseDown:Se}:null;return o().createElement(o().Fragment,null,o().createElement(_t,{ref:l.current.scrollBarRef,wrapClassName:`${Qe}--body-wrapper`,wrapStyle:Re,native:oe,onScroll:e=>{const{elementStore:t,scrollXLoad:r,scrollYLoad:n}=l.current,{prevST:i,prevSL:a}=Ee.current,o=b?h.gutterWidth:0,{scrollTop:s,scrollLeft:c}=e;if(c!==a){de&&(t.$header.scrollLeft=c),m&&(t.$footer.scrollLeft=c);const e=c>0,r=Math.ceil(c)+h.tableWidth<h.tableBodyWidth+o;E!==e&&$(e),S!==r&&q(r)}if(n&&s!==i&&z(s),r&&c!==a&&V(c),b&&s!==i){const r=t.$tableYspace.offsetHeight||t.$tableBody.offsetHeight;Math.ceil(s)+h.viewportHeight-o>=r&&B({type:"scroll",target:e,preventDefault:le,stopPropagation:le})}Ee.current.prevST=s,Ee.current.prevSL=c}},o().createElement("div",{ref:ve,className:"body--y-space"}),o().createElement("div",{ref:ye,className:"body--x-space",style:{width:b?h.tableBodyWidth-h.gutterWidth:h.tableBodyWidth}}),o().createElement(gc.Provider,{value:Oe},o().createElement("table",Fc({ref:ge,className:`${Qe}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0"},Je,{style:{width:0}}),o().createElement("colgroup",null,Te.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return o().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})}))),ue?o().createElement(hi.ReactSortable,{itemKey:e=>i(e,e.index),tag:"tbody",animation:200,list:n,setList:e=>{const t=e.map((e=>i(e,e.index))),r=n.map((e=>i(e,e.index)));if((0,ne.isEqual)(t,r))return;const a=bn(e),o=[];l.current.tableFullData.forEach((e=>{n.includes(e)?o.push(a.shift()):o.push(e)})),P(o),D()}},n.map((e=>je(e,e.index,i(e,e.index))))):o().createElement("tbody",null,Me(n))))),I&&we())}));Hc.displayName="TableBody";const _c=Hc,Dc=e=>{const{summationRows:t}=e,{tableRef:r,sorter:n,layout:i,scrollY:a,flattenColumns:l,leftFixedColumns:s,rightFixedColumns:c,setElementStore:d,getStickyLeft:u,getStickyRight:p}=o().useContext($l),{footRender:h}=r.current.props,m=o().useRef(null);o().useEffect((()=>{g()}),[]);const g=()=>{d("$footer",m.current)},b=Ie("table"),{tableBodyWidth:y}=i;return o().createElement("div",{ref:m,className:`${b}--footer-wrapper`},h?h(l,r.current.tableFullData):o().createElement("table",{className:`${b}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:y?`${y}px`:""}},(()=>{const{gutterWidth:e}=i;return o().createElement("colgroup",null,l.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return o().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})})),a&&o().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),o().createElement("tfoot",null,(()=>{const{isIE:e}=r.current,d=["gutter",{"cell-fix-right":!!c.length}],h=e?null:{right:c.length?0:""};return t.map(((e,t)=>o().createElement("tr",{key:t,className:"footer--row"},l.map(((t,l)=>((e,t,l)=>{const{isIE:d}=r.current,{gutterWidth:h}=i,{dataIndex:m,fixed:g,align:b,summation:y}=e,v=["footer--column","col--ellipsis",{"col--center":"center"===b,"col--right":"right"===b,"column--sort":!!n[m],"cell-fix-left":!d&&"left"===g,"cell-fix-right":!d&&"right"===g,"cell-fix-left-last":!d&&"left"===g&&s[s.length-1]?.dataIndex===m,"cell-fix-right-first":!d&&"right"===g&&c[0]?.dataIndex===m}],x=d?null:{left:"left"===g?`${u(m)}px`:"",right:"right"===g?`${p(m)+(a?h:0)}px`:""},E=y?.render?y.render(r.current.tableFullData):Zr(t,`${m}_text`),S=0===l&&""===E?f("qm.table.config.summaryText"):E;return o().createElement("td",{key:m,title:S,className:Ne()(v),style:{...x}},o().createElement("div",{className:"cell"},S))})(t,e,l))),a&&o().createElement("td",{className:Ne()(d),style:{...h}}))))})())))};var $c=function(e){return e.small="small",e.middle="default",e.large="default",e}($c||{});const qc=e=>{const{current:t,pageSize:r,total:n,onChange:i}=e,{global:a}=o().useContext(c),{tableRef:l,$size:s,setElementStore:d}=o().useContext($l),{uniqueKey:u,paginationConfig:p,infoBarConfig:h}=l.current.props,m=o().useRef(null),f=o().useMemo((()=>u?`tablePager_${u}`:""),[u]);o().useEffect((()=>{g(),x()}),[]);const g=()=>{d("$pager",m.current)},b=p?.showSizeChanger??Zl.pagination.showSizeChanger,y=p?.showQuickJumper??Zl.pagination.showQuickJumper,v=p?.pageSizeOptions||a?.table?.pagination?.pageSizeOptions||Zl.pagination.pageSizeOptions,x=async()=>{if(!f)return;const e=await E(f);e&&e!==r&&(i(t,e),localStorage.setItem(f,e.toString()))},E=async e=>{const t=a?.getComponentConfigApi;if(t&&!localStorage.getItem(f))try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},S=Ie("table"),w={[`${S}-pager`]:!0};return o().createElement("div",{ref:m,className:Ne()(w)},o().createElement("div",{className:"pager-alert"},"bottom"===h?.position&&o().createElement(ds,{total:n})),o().createElement(L.Pagination,{size:$c[s],showSizeChanger:b,showQuickJumper:y,pageSizeOptions:v,current:t,pageSize:r,total:n,onChange:(e,t)=>{i(e,t)},onShowSizeChange:(e,t)=>{f&&((async(e,t)=>{const r=a?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(f,t),localStorage.setItem(f,`${t}`))}}))},Mc=()=>{const{layout:e}=o().useContext($l),t=o().useMemo((()=>{const{headerHeight:t,viewportHeight:r}=e;return{top:`${t}px`,height:`${r}px`}}),[e]),r=Ie("table");return o().createElement("div",{className:`${r}--empty`,style:t},o().createElement(bt,null))},jc=()=>{const{setElementStore:e}=o().useContext($l),t=o().useRef(null);o().useEffect((()=>{r()}),[]);const r=()=>{e("$resizableBar",t.current)},n=Ie("table");return o().createElement("div",{ref:t,className:`${n}--resizable-bar`})};function Kc(){return Kc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Kc.apply(this,arguments)}const Vc=o().forwardRef(((e,t)=>{const{rowKey:r,columns:n,loading:i,resizable:a,customClass:l,tablePrint:s,exportExcel:d,infoBarConfig:u,topSpaceAlign:p,showTableInfo:h,showFullScreen:m,showRefresh:f,showToolBox:g,showHeader:b}=e,{size:y}=o().useContext(c),x=o().useMemo((()=>e.size??y??""),[e.size,y]),E=o().useRef(null),S=o().useRef(null),w=o().useRef(null),C=o().useRef(null),T=o().useRef(null),N=o().useCallback(((e,t)=>{const n="function"==typeof r?r(e,t):e[r];return void 0===n?(v("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n}),[r]),{tableRef:I,tableFullData:R,setElementStore:P,setOriginColumns:O,setTableFullData:k,setTableOriginData:A,setAllTableData:L,setDeriveRowKeys:F,setInvalidRowKeys:H,setFieldAuth:_,setMergeCells:D,setColumnsDefined:$,setScrollXStore:q,setScrollYStore:M,setScrollXLoad:j,setScrollYLoad:K,setResizeState:V,setHandleState:z,setSummaries:B,setSelectionRows:U,setShouldToTop:W,setRecordsMap:G,setUnMounted:Y,setHandleChange:X,clearElementStore:Q,clearRecordsMap:Z}=((e,t)=>{let{getRowKey:r,$size:n}=t;const{rowHeight:i,dynamicThead:a}=e,l=o().useRef({props:e,uid:ln(),elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},mergeCells:[],columnsDefined:!a,scrollBarRef:o().createRef(),scrollXStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0},scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:i||Zl.rowHeightMaps[n]},store:new Ql,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},treeTable:!1,scrollXLoad:!1,scrollYLoad:!1,shouldToTop:!0,selectionRows:[],recordsMap:new Map,unMounted:!1,isHandleChange:!0,isIE:!ie&&/MSIE|Trident/.test(navigator.userAgent)});(e=>{l.current.props=e})(e);const s=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return e.map((e=>{const o=r(e,e.index),l=n?`${n}#${o}`:`${o}`,c=i?`${i}-${e.index+1}`:`${e.index+1}`,d={level:a,rowKey:o,rowKeyPath:l,indexPath:c};return e.indexPath=c,e._level=a,Array.isArray(e.children)&&(d.children=s(e.children,o,l,c,a+1)),t?Object.assign({},d,{parentRowKey:t}):d}))},c=e=>{const t=[];return e.forEach((e=>{Array.isArray(e.children)?t.push(...c(e.children)):t.push(e.rowKey)})),t};return{tableRef:l,...l.current,setElementStore:(e,t)=>{l.current.elementStore[e]=t},setOriginColumns:e=>{l.current.originColumns=e},setTableFullData:e=>{l.current.tableFullData=e},setTableOriginData:e=>{l.current.tableOriginData=e},setAllTableData:e=>{const t=Wr(e);l.current.allTableData=t,l.current.allRowKeys=t.map((e=>r(e,e.index)))},setDeriveRowKeys:e=>{const t=l.current.tableFullData.some((e=>Array.isArray(e.children)));l.current.treeTable=t,l.current.deriveRowKeys=t?s(e,""):[],l.current.flattenRowKeys=t?c(l.current.deriveRowKeys):[]},setInvalidRowKeys:e=>{l.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{l.current.fieldAuth[e]=t},setMergeCells:e=>{const t=[];e.forEach((e=>{t.push(e);for(let r=1;r<e.colSpan;r++)for(let n=0;n<e.rowSpan;n++)t.push({row:e.row+n,col:e.col+r,rowSpan:0,colSpan:0});for(let r=1;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push({row:e.row+r,col:e.col+n,rowSpan:0,colSpan:0})})),l.current.mergeCells=t},setColumnsDefined:e=>{l.current.columnsDefined=e},setScrollXStore:e=>{l.current.scrollXStore=e},setScrollYStore:e=>{l.current.scrollYStore=e},setResizeState:e=>{l.current.resizeState=e},setHandleState:e=>{l.current.handleState=e},setSummaries:e=>{l.current.summaries=e},setScrollXLoad:e=>{l.current.scrollXLoad=e},setScrollYLoad:e=>{l.current.scrollYLoad=e},setShouldToTop:e=>{l.current.shouldToTop=e},setSelectionRows:e=>{l.current.selectionRows=e},setRecordsMap:(e,t)=>{l.current.recordsMap.set(e,t)},setUnMounted:e=>{l.current.unMounted=e},setHandleChange:e=>{l.current.isHandleChange=e},clearElementStore:()=>{for(const e in l.current.elementStore)l.current.elementStore[e]=null},clearRecordsMap:()=>{l.current.recordsMap.clear()}}})(e,{getRowKey:N,$size:x}),{tableData:J,setTableData:ee,tableFlatColumns:te,setTableFlatColumns:re,filters:ae,setFilters:oe,sorter:le,setSorter:se,superFilters:ce,setSuperFilters:de,pagination:ue,setPagination:pe,selectionKeys:he,setSelectionKeys:me,rowExpandedKeys:ge,setRowExpandedKeys:be,highlightKey:ye,setHighlightKey:ve,updateMark:xe,forceUpdate:Ee,layout:Se,setLayout:we,permission:Ce,setPermission:Te,spinning:Re,setSpinning:Pe,scrollX:Oe,setScrollX:ke,scrollY:Ae,setScrollY:Le,isPingLeft:Fe,setPingLeft:He,isPingRight:_e,setPingRight:De,isFullScreen:$e,setFullScreen:qe,updateTableData:Me}=(e=>{const{uniqueKey:t,nativeScrollBar:r,initialSorter:n={},initialFilter:i={},paginationConfig:a,rowSelection:l,expandable:s,rowHighlight:d}=e,{global:u}=o().useContext(c),p={current:a?.current??Zl.pagination.current,pageSize:(()=>{if(t)return Number(localStorage.getItem(`tablePager_${t}`))||void 0})()??a?.pageSize??u?.table?.pagination?.pageSize??Zl.pagination.pageSize,total:0},h=l?.selectedRowKeys??l?.defaultSelectedRowKeys??[],m=s?.expandedRowKeys??s?.defaultExpandedRowKeys??[],[f,g]=o().useState([]),[b,y]=o().useState([]),[v,x]=o().useReducer(((e,t)=>(0,ne.isEqual)(e,t)?e:t),i),[E,S]=o().useReducer(((e,t)=>(0,ne.isEqual)(e,t)?e:t),n),[w,C]=o().useReducer(((e,t)=>(0,ne.isEqual)(e,t)?e:t),[]),[T,N]=o().useState(p),[I,R]=o().useReducer(((e,t)=>(0,ne.isEqual)(e,t)?e:t),h),[P,O]=o().useReducer(((e,t)=>(0,ne.isEqual)(e,t)?e:t),m),[k,A]=o().useState(d?.currentRowKey??""),[L,F]=o().useReducer((e=>e+1),0),[H,_]=o().useState({gutterWidth:r?es():0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[D,$]=o().useState({export:!0,import:!0,print:!0}),[q,M]=o().useState(!1),[j,K]=o().useState(!1),[V,z]=o().useState(!1),[B,U]=o().useState(!1),[W,G]=o().useState(!1),[Y,X]=o().useState(!1);return{tableData:f,setTableData:g,tableFlatColumns:b,setTableFlatColumns:y,filters:v,setFilters:x,sorter:E,setSorter:S,superFilters:w,setSuperFilters:C,pagination:T,setPagination:N,selectionKeys:I,setSelectionKeys:R,rowExpandedKeys:P,setRowExpandedKeys:O,highlightKey:k,setHighlightKey:A,updateMark:L,forceUpdate:F,layout:H,permission:D,setPermission:$,setLayout:_,spinning:q,setSpinning:M,scrollX:j,setScrollX:K,scrollY:V,setScrollY:z,isPingLeft:B,setPingLeft:U,isPingRight:W,setPingRight:G,isFullScreen:Y,setFullScreen:X,updateTableData:()=>{g([...f])}}})(e),{isFetch:je,isWebPagination:Ke,isScrollPagination:ze,showPagination:Be,shouldUpdateHeight:Ue,tableColumns:We,flattenColumns:Ge,editableColumns:Ye,summationColumns:Xe,leftFixedColumns:Qe,rightFixedColumns:Ze,treeExpandIndex:Je,showSummary:et,showFooter:tt,isHeadGroup:rt,bordered:nt,isHeadSorter:it,isHeadFilter:at,isServiceSummation:ot,isSelectCollection:lt,isTableImport:st,isTableClipboard:ct,isSuperSearch:dt,isFastSearch:ut,isGroupSummary:pt,isGroupSubtotal:ht,isDragMergeCell:mt,isTreeTable:ft,isTableEmpty:gt,summationRows:bt,fetchParams:yt}=rs(e,{getRowKey:N,tableRef:I,tableFullData:R,tableData:J,sorter:le,filters:ae,superFilters:ce,selectionKeys:he,pagination:ue}),{createElementStore:vt,tableStyles:xt,getSpan:Et,getStickyLeft:wt,getStickyRight:Ct,scrollXToColumn:Tt,scrollYToRecord:Nt,rowInViewport:It,calcTableHeight:Rt,resetTableScroll:Pt,computeVirtualX:Ot,computeVirtualY:kt,doLayout:At}=cs(e,{getRowKey:N,tableRef:I,$size:x,tableColumns:We,flattenColumns:Ge,leftFixedColumns:Qe,layout:Se,scrollX:Oe,scrollY:Ae,tableData:J,showFooter:tt,showPagination:Be,isWebPagination:Ke,isFullScreen:$e,setLayout:we,setScrollX:ke,setScrollY:Le,setElementStore:P,setScrollXStore:q,setScrollYStore:M,setShouldToTop:W}),{initialTable:Lt,checkDataIndex:Ft,createTableFullData:Ht,getTableData:_t,handleTableData:Dt,createTableData:$t,createGroupData:qt,createSelectionKeys:Mt,createRowExpandedKeys:jt,setSelectionKeysEffect:Kt,findParentRowKeys:Vt,getAllChildRowKeys:zt,doFieldValidate:Bt,getTableLog:Ut,dataChange:Wt,tableChange:Gt,toLastPage:Yt,toFirstPage:Xt,getPageCount:Qt,pagerChangeHandle:Zt,triggerScrollXEvent:Jt,triggerScrollYEvent:er,scrollBottomDebouncer:tr,clearTableSorter:rr,clearTableFilter:nr,clearSuperFilters:ir,clearRowSelection:ar,clearRowHighlight:or,clearTableLog:lr,destroy:sr}=ss(e,{getRowKey:N,tableRef:I,tableElementRef:S,tableBodyRef:w,$size:x,tableColumns:We,flattenColumns:Ge,tableFullData:R,pagination:ue,layout:Se,filters:ae,sorter:le,superFilters:ce,fetchParams:yt,selectionKeys:he,rowExpandedKeys:ge,highlightKey:ye,summationColumns:Xe,shouldUpdateHeight:Ue,isFetch:je,isTreeTable:ft,isWebPagination:Ke,isScrollPagination:ze,isServiceSummation:ot,isGroupSubtotal:ht,doLayout:At,setTableData:ee,setTableFlatColumns:re,setTableFullData:k,setTableOriginData:A,setAllTableData:L,setDeriveRowKeys:F,setPagination:pe,setSpinning:Pe,setSorter:se,setFilters:oe,setSuperFilters:de,setSelectionKeys:me,setRowExpandedKeys:be,setHighlightKey:ve,setSelectionRows:U,setScrollXLoad:j,setScrollYLoad:K,setScrollXStore:q,setScrollYStore:M,computeVirtualX:Ot,computeVirtualY:kt,setFieldAuth:_,setResizeState:V,setSummaries:B,setPermission:Te,setRecordsMap:G,resetTableScroll:Pt,clearElementStore:Q,clearRecordsMap:Z});((e,t)=>{const{columns:r,summation:n,rowSelection:i,expandable:a,rowHighlight:l,mergeCells:s=[]}=e,{tableRef:c,topElementRef:d,tableElementRef:u,tableBodyRef:p,$size:h,scrollX:m,pagination:f,selectionKeys:g,rowExpandedKeys:b,highlightKey:y,summationRows:x,showSummary:E,isWebPagination:S,isScrollPagination:w,isTreeTable:C,checkDataIndex:T,toLastPage:N,toFirstPage:I,getPageCount:R,setHandleState:P,scrollYToRecord:O,setSelectionKeysEffect:k,setOriginColumns:A,setRowExpandedKeys:L,setHighlightKey:F,setResizeState:H,setMergeCells:_,setPingRight:D,setUnMounted:$,setHandleChange:q,calcTableHeight:M,createSelectionKeys:j,createRowExpandedKeys:K,createElementStore:V,triggerScrollYEvent:z,initialTable:B,destroy:U}=t,{elementStore:W,handleState:G,scrollYLoad:Y}=c.current,X=o().useRef(x);Ve((()=>{if(!i)return;const{onChange:e}=i;"radio"===i.type&&p.current.setClickedValues(g.length?[g[0],""]:[]),c.current.isHandleChange&&e?.(g,c.current.selectionRows),q(!0)}),[g]),Ve((()=>{if(!a)return;const{allTableData:e,allRowKeys:t}=c.current,{onChange:r}=a;r?.(b,b.map((r=>e[t.findIndex((e=>e===r))])))}),[b]),Ve((()=>{const{allTableData:e,allRowKeys:t}=c.current;C&&L(K()),l&&(p.current.setClickedValues(y?[y,""]:[]),l.onChange?.(y,e[t.findIndex((e=>e===y))]??null))}),[y]),Ve((()=>{(0,ne.isEqual)(x,X.current)||(X.current=x,E&&n&&n.onChange?.(x))}),[x]),Ve((()=>{const e=j(i.selectedRowKeys);(0,ne.isEqual)(e,g)||(k(e),C&&L(K()))}),[i?.selectedRowKeys]),Ve((()=>{const e=K(a.expandedRowKeys);(0,ne.isEqual)(e,b)||L(e)}),[a?.expandedRowKeys]),Ve((()=>{const{currentRowKey:e}=l;e!==y&&F(e??"")}),[l?.currentRowKey]),Ve((()=>{const{insert:e,remove:t}=G;e&&(S&&("after"===e?N():I()),O("","after"===e?1e5:0)),t&&f.current>R()&&N(),(e||t)&&P({insert:null,remove:!1})}),[f.total]),Ve((()=>{Y&&z(W.$tableBody.parentNode.parentNode.scrollTop)}),[Y]),Ve((()=>{D(m)}),[m]),Ve((()=>{M()}),[h]),Ve((()=>{_(s),p.current.forceUpdate()}),[s]),Ve((()=>{Y&&(e.height||e.maxHeight||v("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||v("Table","必须设置组件参数 `ellipsis`")),w&&(e.height||e.maxHeight||v("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[Y,w]);const Q=()=>{const{resizeState:e}=c.current,{winHeight:t}=e,r=window.innerHeight;r!==t&&(H(Object.assign({},e,{winHeight:r})),M())};o().useEffect((()=>(V({$toper:d.current,$table:u.current}),A(fe(r)),B(),_(s),window.addEventListener("resize",Q,!1),M(),T(),()=>{U(),window.removeEventListener("resize",Q),$(!0)})),[])})(e,{tableRef:I,topElementRef:E,tableElementRef:S,tableBodyRef:w,$size:x,scrollX:Oe,pagination:ue,selectionKeys:he,rowExpandedKeys:ge,highlightKey:ye,showSummary:et,summationRows:bt,isWebPagination:Ke,isScrollPagination:ze,isTreeTable:ft,checkDataIndex:Ft,toLastPage:Yt,toFirstPage:Xt,getPageCount:Qt,setHandleState:z,scrollYToRecord:Nt,setOriginColumns:O,setSelectionKeysEffect:Kt,setRowExpandedKeys:be,setHighlightKey:ve,setResizeState:V,setMergeCells:D,setPingRight:De,setUnMounted:Y,setHandleChange:X,calcTableHeight:Rt,createSelectionKeys:Mt,createRowExpandedKeys:jt,createElementStore:vt,triggerScrollYEvent:er,initialTable:Lt,destroy:sr});const cr=o().useMemo((()=>({getRowKey:N,tableRef:I,tableBodyRef:w,$size:x,flattenColumns:Ge,editableColumns:Ye,leftFixedColumns:Qe,rightFixedColumns:Ze,treeExpandIndex:Je,sorter:le,filters:ae,superFilters:ce,layout:Se,bordered:nt,showFooter:tt,showSummary:et,summationRows:bt,scrollX:Oe,scrollY:Ae,pagination:ue,fetchParams:yt,selectionKeys:he,rowExpandedKeys:ge,highlightKey:ye,updateMark:xe,isFetch:je,isPingLeft:Fe,isPingRight:_e,isHeadSorter:it,isHeadFilter:at,isFullScreen:$e,isTableEmpty:gt,isHeadGroup:rt,isTreeTable:ft,isGroupSubtotal:ht,isWebPagination:Ke,isDragMergeCell:mt,dataChange:Wt,tableChange:Gt,getTableData:_t,setElementStore:P,createTableFullData:Ht,updateTableData:Me,setSorter:se,setFilters:oe,setSuperFilters:de,setHighlightKey:ve,setRowExpandedKeys:be,setSelectionRows:U,setSelectionKeysEffect:Kt,setInvalidRowKeys:H,getSpan:Et,getStickyLeft:wt,getStickyRight:Ct,scrollXToColumn:Tt,scrollYToRecord:Nt,rowInViewport:It,setPagination:pe,setPingLeft:He,setPingRight:De,setSpinning:Pe,setFullScreen:qe,setShouldToTop:W,doFieldValidate:Bt,createTableData:$t,createGroupData:qt,findParentRowKeys:Vt,getAllChildRowKeys:zt,triggerScrollXEvent:Jt,triggerScrollYEvent:er,scrollBottomDebouncer:tr,resetTableScroll:Pt,clearTableSorter:rr,clearTableFilter:nr,clearSuperFilters:ir,clearRowSelection:ar,clearRowHighlight:or})),[x,Ge,Ye,Qe,Ze,Je,le,ae,ce,Se,nt,tt,et,bt,Oe,Ae,ue,yt,he,ge,ye,xe,je,Fe,_e,it,at,$e,gt,rt,ft,ht,Ke,mt]);((e,t)=>{const{getRowKey:r,tableRef:n,toolBoxRef:i,tableBodyRef:a,columnFilterRef:l,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:p,rowExpandedKeys:h,highlightKey:m,isFetch:f,dataChange:g,getTableData:b,handleTableData:y,createTableData:x,createTableFullData:E,calcTableHeight:S,scrollXToColumn:w,scrollYToRecord:C,doFieldValidate:T,setTableOriginData:N,setHandleState:I,setColumnsDefined:R,setSelectionKeysEffect:P,setRowExpandedKeys:O,setHighlightKey:k,setSelectionRows:A,setOriginColumns:L,setHandleChange:F,forceUpdate:H,getTableLog:_,clearRowSelection:D,clearRowHighlight:$,clearTableSorter:q,clearTableFilter:M,clearSuperFilters:j,clearTableLog:K}=t,{columns:V,columnsChange:z}=n.current.props,B=(e,t,n)=>e.filter((e=>{const i=r(e,e.index);e.children&&(e.children=B(e.children,t,n));const a=t.includes(i);return a&&n?.(e,i),!a}));o().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{S()},DO_REFRESH:async e=>{f&&(await b(),e?.())},GET_LOG:()=>_(),GET_FETCH_PARAMS:()=>{const e={};for(const t in u)Object.keys(d).includes(t)||(e[t]=u[t]);return e},CLEAR_TABLE_DATA:()=>{f||(D(),$(),q(),M(),j(),K(),x([]))},CLEAR_LOG:()=>{K()},CREATE_FOCUS:(e,t)=>{a.current.createFocus(e,t)},FORCE_UPDATE:()=>{H()},DO_EXPORT:()=>{i.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{w(e)},SET_SELECTION:function(e){!(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&!(0,ne.isEqual)(e,p)&&F(!1),P(e)},SET_HIGHLIGHT:e=>{k(e)},SET_EXPANDABLE:e=>{O(e)},SET_SELECTION_ROWS:e=>{A(e)},SET_TABLE_DATA:e=>{y(e)},DEFINE_INITIAL_COLUMNS:e=>{L(e),R(!0),l.current.initialHandler()},SET_TABLE_COLUMN:(e,t,r)=>{const n=Kr(V,e);if(!n)return v("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,ne.isPlainObject)(t))return v("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(n.noAuth)return v("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,ne.set)(n,e,t[e]);r&&(z?z([...V]):v("Table","需要设置 `columnsChange` 参数"),H())},INSERT_RECORDS:(e,t)=>{const{store:i,tableFullData:a}=n.current,o=(Array.isArray(e)?e:[e]).filter((e=>(0,ne.isPlainObject)(e)));if(!o.length)return;o.forEach((e=>{s.forEach((t=>{const{dataIndex:r}=t;[Zl.expandableColumn,Zl.selectionColumn,Zl.operationColumn].includes(r)||Jr(e,r,Zr(e,r))})),i.addToInserted(e)}));const l="before"===t?.mode,c=void 0===t?.parentRowKey,d=a;if(c)l?d.unshift(...o):d.push(...o);else{const e=fn(a,(e=>t.parentRowKey===r(e,e.index)));e&&(Array.isArray(e.children)?l?e.children.unshift(...o):e.children.push(...o):e.children=o)}x(d),c&&I(Object.assign({},n.current.handleState,{insert:l?"before":"after"})),H(),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:i}=n.current,a=(Array.isArray(e)?e:[e]).map((e=>(0,ne.isPlainObject)(e)?r(e,e.index):e));if(!a.length)return;let o=!1;const l=B(i,a,((e,r)=>{t.addToRemoved(e),c.forEach((n=>{const{dataIndex:i,editRender:a}=n,o=a?.(e,n);if(!o)return;const{rules:l=[],disabled:s}=o;!s&&l.length&&(t.removeFromRequired({x:r,y:i}),t.removeFromValidate({x:r,y:i}),t.removeFromEdited({x:r,y:i}))})),o=!0}));o&&(E(l),P(p.filter((e=>!a.includes(e)))),a.includes(m)&&$(),O(h.filter((e=>!a.includes(e)))),I(Object.assign({},n.current.handleState,{remove:!0})),g(),setTimeout((()=>{N(B(n.current.tableOriginData,a))})))},VALIDATE_FIELDS:(e,t)=>{n.current.allTableData.forEach((n=>{c.forEach((i=>{const{dataIndex:a,editRender:o}=i,l=o?.(n,i);if(!l)return;const s=r(n,n.index);if(e&&!e.includes(s))return;if(t&&!t.includes(a))return;const{rules:c=[],disabled:d}=l;!d&&c.length&&T(c,Zr(n,a),s,a)}))}));const{required:i,validate:a}=_(),o=[...i,...a];return o.length&&C(o[0].rowKey),H(),{required:i,validate:a}}})))})(t,{getRowKey:N,tableRef:I,toolBoxRef:C,tableBodyRef:w,columnFilterRef:T,flattenColumns:Ge,editableColumns:Ye,pagination:ue,fetchParams:yt,selectionKeys:he,rowExpandedKeys:ge,highlightKey:ye,isFetch:je,dataChange:Wt,getTableData:_t,handleTableData:Dt,createTableData:$t,createTableFullData:Ht,calcTableHeight:Rt,scrollXToColumn:Tt,scrollYToRecord:Nt,doFieldValidate:Bt,setTableOriginData:A,setHandleState:z,setColumnsDefined:$,setSelectionKeysEffect:Kt,setRowExpandedKeys:be,setHighlightKey:ve,setSelectionRows:U,setOriginColumns:O,setHandleChange:X,forceUpdate:Ee,getTableLog:Ut,clearRowSelection:ar,clearRowHighlight:or,clearTableSorter:rr,clearTableFilter:nr,clearSuperFilters:ir,clearTableLog:lr}),o().useEffect((()=>{Yl.register(I.current.uid,t??{current:null})}),[]);const dr=Ie("table"),ur={[`${dr}--wrapper`]:!0,[`${dr}--lg`]:"large"===x,[`${dr}--sm`]:"small"===x,[`${dr}--maximize`]:$e,[l]:!!l},pr={[dr]:!0,"is--border":nt,"is--fixed":Qe.length||Ze.length,"is--sortable":it,"is--filterable":at,"is--head-group":rt,"is--merge-cell":mt,"is--ping-left":Fe,"is--ping-right":_e};return o().createElement($l.Provider,{value:cr},o().createElement("div",{className:Ne()(ur)},h&&o().createElement("div",{ref:E,className:`${dr}-top`},o().createElement("div",{className:`${dr}-top__space`},"bottom"!==u?.position&&o().createElement(ds,{total:ue.total}),o().createElement("div",{className:`${dr}-top__space-slot`,style:{justifyContent:Wl[p]}},e.children)),o().createElement("div",{className:`${dr}-top__actions`},o().createElement(nc,{ref:C,showFullScreen:m,showReload:f&&je,showPrint:Ce.print&&!!s,showImport:Ce.import&&st,showExport:Ce.export&&!!d,showClipboard:ct,showCollection:lt,showFastSearch:ut,showSuperSearch:dt,showGroupSummary:pt,showToolBox:g,tableColumns:We}),o().createElement(oc,{ref:T,columns:n}))),o().createElement(St,{spinning:i??Re},o().createElement("div",{ref:S,className:Ne()(pr),style:xt},o().createElement("div",{className:`${dr}--main-wrapper`},b&&o().createElement(fc,{tableColumns:We,sorter:le,filters:ae}),o().createElement(_c,{ref:w,tableFlatColumns:te,tableData:J}),tt&&o().createElement(Dc,{summationRows:bt})),nt&&o().createElement("div",{className:`${dr}--border-line`}),gt&&o().createElement(Mc,null),a&&o().createElement(jc,null))),Be&&o().createElement(qc,Kc({},ue,{onChange:(e,t)=>Zt({current:e,pageSize:t})}))))}));Vc.defaultProps={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},Vc.displayName="QmTable";const zc=Vc,Bc=zc;function Uc(){return Uc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Uc.apply(this,arguments)}const Wc=e=>{const{uniqueKey:t,multiple:r,initialValue:n,selectionRows:i,defaultSelectedKeys:a=[],filters:l=[],table:s={},className:d,style:u,onClose:p}=e,{size:h}=o().useContext(c),m=o().useMemo((()=>e.size??h??""),[e.size,h]),g=o().useRef(null),b=o().useRef(null),y=o().useRef(null),v=Pt(g),[x,E]=o().useState(s),[S,w]=o().useState(),[C,T]=o().useState(a),[N,I]=o().useState(!1),[R,P]=o().useState(300),[O,k]=o().useState(l),[A,L]=o().useState([{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>o().createElement("span",null,e+1)},...s.columns||[]]),[F,H]=o().useState((0,ne.merge)({},s.fetch?.params,n)),[_,D]=o().useState([]),$=()=>{const e=g.current,t=e.querySelector(".form-wrap");P(e.offsetHeight-t.offsetHeight-2*Hi[m]-30)},q=Ot($,5);Ve((()=>{q()}),[v.width]),Ve((()=>{(0,ne.isEqual)(l,O)||k(l)}),[l]),o().useEffect((()=>{M()}),[F]),o().useEffect((()=>{i&&y.current.SET_SELECTION_ROWS(i)}),[i]),o().useEffect((()=>{n&&b.current?.SET_FIELDS_VALUE(n)}),[]);const M=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:n,dataKey:i,beforeFetch:a=se}=t;if(a(F)){I(!0);try{const e=await n(F);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,i)??[];r||(T([]),await ce(0)),D(t)}}catch(e){}I(!1)}},j=e=>{r||(w(e),p(e))},K=e=>{H(Object.assign({},F,e))},V=Ie("search-helper"),z={[`${V}--wrapper`]:!0},B=x.webPagination?{dataSource:_,loading:N,webPagination:!0}:{fetch:{...x.fetch,params:F}};return o().createElement("div",{ref:g,className:Ne()(z,d),style:u},o().createElement("div",{className:"form-wrap"},O.length?o().createElement(Go,{ref:b,items:O,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(e),onCollapse:()=>$(),onFinish:e=>K(e),onReset:async()=>{const[e,t]=await b.current.GET_FORM_DATA();e||K(t)}}):null),o().createElement("div",null,o().createElement(Bc,Uc({ref:y,uniqueKey:t,height:R,columns:A,rowKey:x.rowKey||"pageIndex"},B,{rowSelection:{type:r?"checkbox":"radio",clearableAfterFetched:!r,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:C,onChange:(e,t)=>{T(e),w(r?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>L(e),onRowDblclick:j,onRowEnter:j}))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Hi[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(xe,{onClick:()=>p(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(xe,{type:"primary",disabled:!S,onClick:()=>p(S,r?C:void 0)},f("qm.dialog.confirm"))))};Wc.displayName="SearchHelper";const Gc=Wc;function Yc(){return Yc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yc.apply(this,arguments)}const Xc=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Xc(e.children)),e.children&&t.push(e.value)})),t},Qc=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=Qc(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},Zc=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Zc(e.children,t),t(e)||e.children&&e.children.length))),Jc=e=>{const{uniqueKey:t,multiple:r,initialValue:n,selectionRows:i,defaultSelectedKeys:a=[],filters:l=[],table:s={},tree:d={},className:u,style:p,onClose:h}=e,{size:m}=o().useContext(c),g=o().useMemo((()=>e.size??m??""),[e.size,m]),b=o().useRef(null),y=o().useRef(null),x=o().useRef(null),E=Pt(b),[S,w]=o().useState(s),[C,T]=o().useState(),[N,I]=o().useState(a),[R,P]=o().useState(!1),[O,k]=o().useState(300),[A,F]=o().useState(300),[H,_]=o().useState(l),[D,$]=o().useState([{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>o().createElement("span",null,e+1)},...s.columns||[]]),[q,M]=o().useState((0,ne.merge)({},s.fetch?.params,n)),[j,K]=o().useState([]),V=()=>{const e=b.current,t=e.querySelector(".form-wrap"),r=e.querySelector(".input-wrap");k(e.offsetHeight-r.offsetHeight-10),F(e.offsetHeight-t.offsetHeight-2*Hi[g]-30)},z=Ot(V,5);Ve((()=>{z()}),[E.width]),Ve((()=>{(0,ne.isEqual)(l,H)||_(l)}),[l]),o().useEffect((()=>{B()}),[q]),o().useEffect((()=>{i&&x.current.SET_SELECTION_ROWS(i)}),[i]),o().useEffect((()=>{n&&y.current?.SET_FIELDS_VALUE(n),re()}),[]);const B=async()=>{const{webPagination:e,fetch:t}=S;if(!e||!t?.api)return;const{api:n,dataKey:i,beforeFetch:a=se}=t;if(a(q)){P(!0);try{const e=await n(q);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,i)??[];r||(I([]),await ce(0)),K(t)}}catch(e){}P(!1)}},U=e=>{r||(T(e),h(e))},W=e=>{M(Object.assign({},q,e))},[G,Y]=o().useState([]),[X,Q]=o().useState([]),[Z,J]=o().useState(""),ee=o().useRef(G),te=o().useRef([]);Ve((()=>{Q(Xc(G))}),[G]);const re=async()=>{if(!d.fetch)return;const{api:e,params:t,dataKey:r,valueKey:n="value",textKey:i="text"}=d.fetch;try{const a=await e(t);if(200===a.code){const e=Array.isArray(a.data)?a.data:(0,ne.get)(a.data,r)??[],t=Hn(e,n,i);Y(t),ee.current=t,te.current=e}}catch(e){}},ie=e=>`${e}|${ei.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ae=Ie("tree-table-helper"),oe={[`${ae}--wrapper`]:!0},le=S.webPagination?{dataSource:j,loading:R,webPagination:!0}:{fetch:{...S.fetch,params:q}};return o().createElement("div",{ref:b,className:Ne()(oe,u),style:p},o().createElement(lt,{defaultValue:200,style:{height:"100%"}},o().createElement(lt.Pane,{min:100,style:{overflowY:"auto"}},o().createElement(L.Input.Search,{className:"input-wrap",value:Z,style:{marginBottom:8},placeholder:f("qm.form.inputPlaceholder"),allowClear:!0,onChange:e=>(e=>{const t=Zc(ee.current,(t=>{if(!e)return!0;const r=t.text||"";return-1!==ie(r).indexOf(e)}));J(e),Y(t)})(e.target.value)}),o().createElement(L.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:O,defaultExpandAll:!0,expandedKeys:X,treeData:G,filterTreeNode:e=>{if(!Z)return!1;const t=e.text||"";return-1!==ie(t).indexOf(Z)},onExpand:e=>{Q(e)},onSelect:e=>{const{valueKey:t="value"}=d.fetch;(e=>{if(!d.tableParamsMap)return v("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,r={};for(const n in t)r[n]=(0,ne.get)(e,t[n]);W(r)})(Qc(te.current,(r=>(0,ne.get)(r,t)===e[0]))||{})}})),o().createElement(lt.Pane,{className:"split-pane"},o().createElement("div",{className:"form-wrap"},H.length?o().createElement(Go,{ref:y,items:H,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>_(e),onCollapse:()=>V(),onFinish:e=>W(e),onReset:async()=>{const[e,t]=await y.current.GET_FORM_DATA();e||W(t)}}):null),o().createElement("div",null,o().createElement(Bc,Yc({ref:x,uniqueKey:t,height:A,columns:D,rowKey:S.rowKey||"pageIndex"},le,{rowSelection:{type:r?"checkbox":"radio",clearableAfterFetched:!r,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:N,onChange:(e,t)=>{I(e),T(r?t:t[0])}},paginationConfig:S.paginationConfig,columnsChange:e=>$(e),onRowDblclick:U,onRowEnter:U}))))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Hi[g]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(xe,{onClick:()=>h(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(xe,{type:"primary",disabled:!C,onClick:()=>h(C,r?N:void 0)},f("qm.dialog.confirm"))))};Jc.displayName="TreeTableHelper";const ed=Jc,td=e=>{const{multiple:t,tree:r={},defaultSelectedKeys:n,className:i,style:a,onClose:l}=e,{size:s}=o().useContext(c),d=o().useMemo((()=>e.size??s??""),[e.size,s]),[u,p]=o().useState(),[h]=o().useState(r.fetch?.params),m=Ie("tree-helper"),g={[`${m}--wrapper`]:!0},b=r.fetch?{...re()(r.fetch,["params","valueKey","textKey"]),params:h}:void 0;return o().createElement("div",{className:Ne()(g,i),style:a},o().createElement(Dl,{multiple:t,fetch:b,fieldsDefine:{valueKey:r.fetch?.valueKey,textKey:r.fetch?.textKey},asyncLoad:r.asyncLoad,checkStrictly:r.checkStrictly,checkStrategy:r.checkStrategy,defaultSelectedKeys:n,defaultExpandAll:r.defaultExpandAll,onSelectChange:e=>p(e),onCheckChange:e=>p(e)}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Hi[d]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(xe,{onClick:()=>l(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(xe,{type:"primary",disabled:!u,onClick:()=>l(u)},f("qm.dialog.confirm"))))};td.displayName="TreeHelper";const rd=td;function nd(){return nd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},nd.apply(this,arguments)}const id="_startSign",ad="_endSign",od=e=>{const{uniqueKey:t,initialValue:r,filters:n=[],table:i={},onClose:a}=e,{size:l}=o().useContext(c),s=o().useMemo((()=>e.size??l??""),[e.size,l]),d=o().useRef(null),u=o().useRef(null),p=o().useRef(null),h=Pt(d),[m,g]=o().useState(i),[b,y]=o().useState(!1),[v,x]=o().useState([]),[E,S]=o().useState(300),[w,C]=o().useState(n),[T,N]=o().useState([{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>o().createElement("span",null,e+1)},{title:f("qm.form.rangeSearchHelper")[0],dataIndex:id,width:80,align:"right",render:(e,t)=>o().createElement("span",{className:"icon-sign"},e)},...i.columns||[],{title:f("qm.form.rangeSearchHelper")[1],dataIndex:ad,fixed:"right",width:80,render:(e,t)=>o().createElement("span",{className:"icon-sign"},e)}]),[I,R]=o().useState((0,ne.merge)({},i.fetch?.params,r)),[P,O]=o().useState([]),k=o().useMemo((()=>v.map((e=>e?.pageIndex))),[v]),A=o().useMemo((()=>2===k.length&&k.every((e=>void 0!==e))),[k]),F=()=>{const e=d.current.parentNode.children[0],t=e.querySelector(".form-wrap");S(e.offsetHeight-t.offsetHeight-2*Hi[s]-30)},H=Ot(F,5);Ve((()=>{H()}),[h.width]),Ve((()=>{(0,ne.isEqual)(n,w)||C(n)}),[n]),o().useEffect((()=>{_()}),[I]);const _=async()=>{const{webPagination:e,fetch:t}=m;if(!e||!t?.api)return;const{api:r,dataKey:n,beforeFetch:i=se}=t;if(i(I)){y(!0);try{const e=await r(I);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,n)??[];O(t)}}catch(e){}y(!1)}},D=(e,t)=>{delete e[t]},$=()=>{v.forEach((e=>{e&&(D(e,id),D(e,ad))})),x([])},q=e=>{$(),R(Object.assign({},I,e))},M=Ie("range-helper"),j=m.webPagination?{dataSource:P,loading:b,webPagination:!0}:{fetch:{...m.fetch,params:I}};return o().createElement("div",{ref:d,className:`${M}--wrapper`},o().createElement("div",{className:"form-wrap"},w.length?o().createElement(Go,{ref:u,items:w,initialValues:r,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>C(e),onCollapse:()=>F(),onFinish:e=>q(e),onReset:async()=>{const[e,t]=await u.current.GET_FORM_DATA();e||q(t)}}):null),o().createElement("div",null,o().createElement(Bc,nd({ref:p,height:E,columns:T,rowKey:m.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=k[0]&&e.pageIndex<=k[1]?{backgroundColor:"#f5f5f5"}:{}},j,{columnsChange:e=>N(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;[id,ad].includes(r)&&(r===id&&(e[r]?(D(e,r),x([void 0,v[1]])):e.pageIndex>k[1]?L.message.warning(f("qm.searchHelper.rangeStartTip")):(v[0]&&D(v[0],r),e[r]="[",x([e,v[1]]))),r===ad&&(e[r]?(D(e,r),x([v[0],void 0])):e.pageIndex<k[0]?L.message.warning(f("qm.searchHelper.rangeEndTip")):(v[1]&&D(v[1],r),e[r]="]",x([v[0],e]))),p.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===k[0]&&(e[id]="["),e.pageIndex===k[1]&&(e[ad]="]")}))}}),o().createElement(xe,{type:"primary",icon:o().createElement(Re.ClearOutlined,null),title:f("qm.table.alert.clear"),onClick:()=>$()}))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Hi[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(xe,{onClick:()=>a(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(xe,{type:"primary",disabled:!A,onClick:()=>a(v.map((e=>(e=>{const t={};for(const r in e)[id,ad].includes(r)||(t[r]=e[r]);return t})(e))))},f("qm.dialog.confirm"))))};od.displayName="RangeTableHelper";const ld=od,sd=e=>null!=e;function cd(e,t,r,n){const[i,a]=o().useState(void 0);o().useLayoutEffect((()=>{const t="function"==typeof e?e():e;a(t||null)}));const[l,s]=o().useState(null),c=as((()=>{if(i){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,{top:n,right:i,bottom:a,left:o}=e.getBoundingClientRect();return n>=0&&o>=0&&i<=t&&a<=r})(i)&&t&&i.scrollIntoView(n);const{left:e,top:r,width:a,height:o}=i.getBoundingClientRect(),l={left:e,top:r,width:a,height:o,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(l)?l:e))}else s(null)}));return o().useLayoutEffect((()=>(c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)})),[i,t,c]),[o().useMemo((()=>{if(!l)return l;const e=r?.offset||6,t=r?.radius||2;return{left:l.left-e,top:l.top-e,width:l.width+2*e,height:l.height+2*e,radius:t}}),[l,r]),i]}function dd(e){return void 0!==e}function ud(e,t){const{defaultValue:r,value:n,onChange:i,postState:o}=t||{},[l,s]=a.useState((()=>dd(n)?n:dd(r)?"function"==typeof r?r():r:"function"==typeof e?e():e)),c=dd(n)?n:l,d=o?o(c):c,u=as(i),[p,h]=a.useState([c]);return ls((()=>{const e=p[0];l!==e&&u(l,e)}),[p]),ls((()=>{dd(n)||s(n)}),[n]),[d,as((e=>{s(e),h([c])}))]}const pd={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},hd={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"]}},md=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function fd(e){const{arrowWidth:t,autoAdjustOverflow:r,arrowPointAtCenter:n,offset:i,borderRadius:a,visibleFirst:o}=e,l=t/2,s={};return Object.keys(pd).forEach((e=>{const c={...n&&hd[e]||pd[e],offset:[0,0],dynamicInset:!0};switch(s[e]=c,md.has(e)&&(c.autoArrow=!1),e){case"top":case"topLeft":case"topRight":c.offset[1]=-l-i;break;case"bottom":case"bottomLeft":case"bottomRight":c.offset[1]=l+i;break;case"left":case"leftTop":case"leftBottom":c.offset[0]=-l-i;break;case"right":case"rightTop":case"rightBottom":c.offset[0]=l+i}const d=function(e){const{contentRadius:t,limitVerticalRadius:r}=e,n=t>12?t+2:12;return{arrowOffsetHorizontal:n,arrowOffsetVertical:r?8:n}}({contentRadius:a,limitVerticalRadius:!0});if(n)switch(e){case"topLeft":case"bottomLeft":c.offset[0]=-d.arrowOffsetHorizontal-l;break;case"topRight":case"bottomRight":c.offset[0]=d.arrowOffsetHorizontal+l;break;case"leftTop":case"rightTop":c.offset[1]=-d.arrowOffsetHorizontal-l;break;case"leftBottom":case"rightBottom":c.offset[1]=d.arrowOffsetHorizontal+l}c.overflow=function(e,t,r,n){if(!1===n)return{adjustX:!1,adjustY:!1};const i=n&&"object"==typeof n?n:{},a={};switch(e){case"top":case"bottom":a.shiftX=2*t.arrowOffsetHorizontal+r,a.shiftY=!0,a.adjustY=!0;break;case"left":case"right":a.shiftY=2*t.arrowOffsetVertical+r,a.shiftX=!0,a.adjustX=!0}const o={...a,...i};return o.shiftX||(o.adjustX=!0),o.shiftY||(o.adjustY=!0),o}(e,d,t,r),o&&(c.htmlRegion="visibleFirst")})),s}const gd=require("@rc-component/portal");var bd=n.n(gd);const yd=require("@rc-component/trigger");var vd=n.n(yd);const xd=require("rc-util/lib/hooks/useId");var Ed=n.n(xd);function Sd(){return Sd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Sd.apply(this,arguments)}const wd={fill:"transparent",pointerEvents:"auto"},Cd=e=>{const{prefixCls:t,rootClassName:r,pos:n,showMask:i,style:a={},fill:l="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${t}-mask-${Ed()()}`,p="object"==typeof c?c?.placeholder:c;return o().createElement(bd(),{open:s,autoLock:!0},o().createElement("div",{className:Ne()(`${t}-mask`,r),style:{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none",...a}},i?o().createElement("svg",{style:{width:"100%",height:"100%"}},o().createElement("defs",null,o().createElement("mask",{id:u},o().createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),n&&o().createElement("rect",{x:n.left,y:n.top,rx:n.radius,width:n.width,height:n.height,fill:"black",className:p?`${t}-placeholder-animated`:""}))),o().createElement("rect",Sd({},n?null:wd,{x:"0",y:"0",width:"100%",height:"100%",fill:l,mask:`url(#${u})`})),n&&o().createElement(o().Fragment,null,o().createElement("rect",Sd({},wd,{x:"0",y:"0",width:"100%",height:`${n.top}px`})),o().createElement("rect",Sd({},wd,{x:"0",y:"0",width:n.left,height:"100%"})),o().createElement("rect",Sd({},wd,{x:"0",y:n.top+n.height,width:"100%",height:`calc(100vh - ${n.top+n.height}px)`})),o().createElement("rect",Sd({},wd,{x:n.left+n.width,y:"0",width:`calc(100vw - ${n.left+n.width}px)`,height:"100%"})))):null))},Td=e=>{const{prefixCls:t,zIndex:r,open:n,onPause:i,onPlay:a}=e,[l,s]=ud(void 0,{value:n,postState:e=>e??!0}),c=o().useRef(null),d=o().useRef(!1),u=as((e=>{p(e),e.shiftKey&&32===e.keyCode&&h()}));o().useEffect((()=>{const e=Gt()(document,"keyup",u);return()=>e.remove()}),[]);const p=e=>{e.stopPropagation(),e.preventDefault()},h=()=>{d.current?d.current=!1:(s(!l),l?i?.():a?.())};return o().createElement("div",{ref:c,className:`${t}-control`,style:{zIndex:r+1},onMouseDown:e=>{p(e);const t=c.current,r=t.offsetWidth,n=t.offsetHeight,i=window.innerWidth,a=window.innerHeight,o=e.clientX-Ze(t).x,l=e.clientY-Ze(t).y;return document.onmousemove=e=>{let s=e.clientX-o,c=e.clientY-l;s<0&&(s=0),s>i-r-1&&(s=i-r-1),c<0&&(c=0),c>a-n-1&&(c=a-n-1),Ye(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>h()},l?o().createElement(Re.PauseOutlined,null):o().createElement(Re.CaretRightOutlined,null))},Nd=e=>{const{prefixCls:t,current:r,total:n=0,cover:i,title:a,description:l,helper:s={},type:c,zIndex:d,onClose:u,onPrev:p,onNext:h,onFinish:m,className:f,indicatorsRender:g}=e,{t:b}=yc(),y="primary"!==c?"primary":"default",v=as((e=>{w(e),40===e.keyCode&&(r<n-1?h?.():m?.()),38===e.keyCode&&r>0&&p?.()}));o().useEffect((()=>{const e=Gt()(document,"keyup",v);return()=>e.remove()}),[]);const x=sd(i)?o().createElement("div",{className:`${t}-cover`},i):null,E=sd(l)?o().createElement("div",{className:`${t}-description`},l):null;let S;S=g?g(r,n):[...Array.from({length:n}).keys()].map(((e,n)=>o().createElement("span",{key:e,className:Ne()(n===r&&`${t}-indicator-active`,`${t}-indicator`)})));const w=e=>{e.stopPropagation(),e.preventDefault()};return o().createElement("div",{className:Ne()(`${t}-content`,f)},o().createElement("div",{className:`${t}-inner`},o().createElement(Re.CloseOutlined,{className:`${t}-close`,onClick:u}),s.content&&o().createElement(L.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},o().createElement(Re.QuestionCircleOutlined,{className:Ne()(`${t}-close`,"help-icon")})),x,o().createElement("div",{className:`${t}-header`},o().createElement("div",{className:`${t}-title`},a)),E,o().createElement("div",{className:`${t}-footer`},n>1&&o().createElement("div",{className:`${t}-indicators`},S),o().createElement(Ce,{className:`${t}-buttons`},0!==r?o().createElement(xe,{className:`${t}-prev-btn`,size:"small",onMouseDown:w,onClick:p},b("qm.tour.prevStep")):null,r===n-1?o().createElement(xe,{className:`${t}-finish-btn`,type:y,size:"small",onClick:m},b("qm.tour.finish")):o().createElement(xe,{className:`${t}-next-btn`,type:y,size:"small",onMouseDown:w,onClick:h},b("qm.tour.nextStep"))))))},Id=e=>{const{current:t,renderPanel:r}=e;return o().createElement(o().Fragment,null,"function"==typeof r?r(e,t):o().createElement(Nd,e))};function Rd(){return Rd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Rd.apply(this,arguments)}const Pd={left:"50%",top:"50%",width:1,height:1},Od=o().forwardRef(((e,t)=>{const{steps:r=[],defaultCurrent:n,current:i,onChange:a,onClose:l,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:p=!0,control:h=!0,overlayClassName:m,overlayStyle:f,placement:g,helper:b,zIndex:y,renderPanel:v,indicatorsRender:x,gap:E,animated:S=!0,scrollIntoViewOptions:w=!0,...C}=e,T=o().useRef(),[N,I]=ud(0,{value:i,defaultValue:n}),[R,P]=ud(void 0,{value:c,postState:e=>!(N<0||N>=r.length)&&(e??!1)}),[O,k]=ud(1051,{value:y,defaultValue:y}),[A,L]=o().useState(),F=o().useRef(R);o().useLayoutEffect((()=>{R&&!F.current&&I(0),F.current=R,L(R)}),[R]),o().useImperativeHandle(t,(()=>({OPEN:()=>P(!0),CLOSE:()=>P(!1),SET_ZINDEX:e=>k(e)})));const{target:H,type:_,placement:D,trigger:$,delay:q,style:M,arrow:j,className:K,mask:V,scrollIntoViewOptions:z,zIndex:B,action:U}=r[N]||{},W=B||O,G=_||d,Y=R&&(V??u),X=z??w,[Q,Z]=cd(H,!!c,E,X),J=((e,t,r)=>r??t??(null===e?"center":"bottom"))(Z,g,D),ee=!!Z&&(void 0===j?p:j),te="object"==typeof ee&&ee.pointAtCenter;o().useLayoutEffect((()=>{T.current?.forceAlign()}),[te,N]),Ve((()=>{R&&(ie(),U?.(Z,N))}),[R,Z]);const re=e=>{I(e),a?.(e)},ne=()=>{P(!1),l?.(N)},ie=()=>{if(!Z)return;const e=[];!function t(r){if(1===r.nodeType){var n;"INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName||"none"===Ge(n=r,"display")||"hidden"===Ge(n,"visibility")||"0"===Ge(n,"opacity")||e.push(r);for(const e of Array.from(r.childNodes))t(e)}}(Z),e.length&&e[0].focus()};if(void 0===Z)return null;const ae=async()=>{if(!$||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),r=Z.offsetWidth,n=Z.offsetHeight,[i,a]=[e+r/2,t+n/2],o=new MouseEvent($,{bubbles:!0,cancelable:!0,button:0,clientX:i,clientY:a}),l=document.elementFromPoint(i,a);l&&(l.dispatchEvent(o),await ce(q??320))},oe="boolean"==typeof Y?Y:!!Y,le="boolean"==typeof Y?void 0:Y,se=Object.assign({},f,M),de=Ie("tour"),ue=[{[`${de}-primary`]:"primary"===G},m,K],pe=fd({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return o().createElement(o().Fragment,null,o().createElement(Cd,{zIndex:W,prefixCls:de,pos:Q,showMask:oe,style:le?.style,fill:le?.color,open:A,animated:S,rootClassName:m}),o().createElement(vd(),Rd({ref:T},C,{zIndex:W,builtinPlacements:pe,popupStyle:se,popupPlacement:J,popupVisible:A,popupClassName:Ne()(ue),prefixCls:de,popup:()=>o().createElement(Id,Rd({key:"content",arrow:ee,prefixCls:de,total:r.length,helper:b,renderPanel:v,indicatorsRender:x,onPrev:async()=>{await ae(),re(N-1)},onNext:async()=>{await ae(),re(N+1)},onClose:ne,current:N,onFinish:()=>{ne(),s?.()}},Object.assign({},r[N],{zIndex:W,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Z||document.body,forceRender:!1,destroyPopupOnHide:!0}),o().createElement(bd(),{open:A,autoLock:!0},o().createElement("div",{className:Ne()(m,`${de}-target-placeholder`),style:{...Q||Pd,position:"fixed",pointerEvents:"none"}}))),h&&o().createElement(bd(),{open:R},o().createElement(Td,{zIndex:W,prefixCls:de,onPause:()=>L(!1),onPlay:()=>L(!0)})))}));Od.displayName="QmTour";const kd=Od,Ad=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],Ld=e=>({_s:e,status:Ad[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),Fd=e=>e?6:5,Hd=(e,t,r,n,i)=>{clearTimeout(n.current);const a=Ld(e);t(a),r.current=a,i?.({current:a})},_d=e=>{const{name:t,in:r,timeout:n,preEnter:i=!0,preExit:l}=e,[s,c]=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enter:t=!0,exit:r=!0,preEnter:n,preExit:i,timeout:o,initialEntered:l,mountOnEnter:s,unmountOnExit:c,onStateChange:d}=e||{},[u,p]=(0,a.useState)((()=>Ld(l?2:Fd(s)))),h=(0,a.useRef)(u),m=(0,a.useRef)(),[f,g]=(e=>(0,ne.isPlainObject)(e)?[e.enter,e.exit]:[e,e])(o),b=(0,a.useCallback)((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return Fd(t)}})(h.current._s,c);e&&Hd(e,p,h,m,d)}),[d,c]),y=(0,a.useCallback)((e=>{const a=e=>{switch(Hd(e,p,h,m,d),e){case 1:f>=0&&(m.current=setTimeout(b,f));break;case 4:g>=0&&(m.current=setTimeout(b,g));break;case 0:case 3:m.current=setTimeout((()=>a(e+1)),0)}},o=h.current.isEnter;"boolean"!=typeof e&&(e=!o),e?!o&&a(t?n?0:1:2):o&&a(r?i?3:4:Fd(c))}),[b,d,t,r,n,i,f,g,c]);return(0,a.useEffect)((()=>()=>clearTimeout(m.current)),[]),[u,y,b]}({timeout:n,preEnter:i,preExit:l,initialEntered:r});return ls((()=>{c()}),[r]),o().createElement(o().Fragment,null,o().Children.map(e.children,(e=>o().isValidElement(e)?Pc(e,{className:Ne()(e.props.className,t,s.status)}):e)))},Dd={previewWidth:1100,defaultDistance:.45,logoHeight:60},$d=(0,a.createContext)(void 0);var qd=null;function Md(){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),r=e.match(/MSIE\D?\d+/i),n=e.match(/OPR\D?\d+/i),i=e.match(/Firefox\D?\d+/i),a=e.match(/x64/i);if(!t&&!r&&a)return!0;if(i){if((i=i[0].match(/\d+/))[0]>=41||a)return!0}else if(n){if((n=n[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!r){var o=e.match(/Chrome\D?\d+/i);if(o&&(o=o[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function jd(e,t){var r;try{var n=navigator.userAgent,i=!!n.match(/MSIE/i)||!!n.match(/Trident/i);if(Md()){try{r=getCLodop()}catch(e){}if(!r&&"complete"!==document.readyState)return void L.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!r)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(i&&n.match(/x64/i),e||t?r=i?e:t:qd?r=qd:((r=document.createElement("object")).setAttribute("width",0),r.setAttribute("height",0),r.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),i?r.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):r.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(r),qd=r),!r||!r.VERSION)return n.indexOf("Chrome"),n.indexOf("Firefox"),r;return r.VERSION<"6.2.2.6"&&Md(),r}catch(e){L.message.error("getLodop 出错:"+e)}}Md();const Kd=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:r}=window.screen;if(t&&r)e[0]=t,e[1]=r;else{let t=document.createElement("DIV");t.style.cssText="width: 1in; height: 1in; position: absolute; left: 0px; top: 0px; z-index: -1; visibility: hidden;",document.body.appendChild(t),e[0]=parseInt(t.offsetWidth.toString()),e[1]=parseInt(t.offsetHeight.toString()),t.parentNode?.removeChild(t),t=null}return e})()[0];return Math.ceil(t)},Vd=o().forwardRef(((e,t)=>{const{templateRender:r,directPrint:n}=e,{global:i}=o().useContext(c),{$$preview:a}=o().useContext($d),{state:l,isWindowsPrinter:s,pageSize:d}=a,u=o().useRef(null),p=o().useRef({}),h=o().useRef([]),m=o().useRef([]),f=o().useRef([]),[g,b]=o().useState(!0);o().useImperativeHandle(t,(()=>({createPreviewDom:k,createExportHtml:L,createPrintHtml:A,SHOW_PREVIEW:F,DIRECT_PRINT:H}))),Ve((()=>{O()}),[l.form.printerType,l.form.setting.direction,l.form.setting.distance,l.form.setting.fixedLogo]),o().useEffect((()=>{p.current.templateEl=u.current.querySelector(".origin-template").children[0],p.current.previewEl=u.current.querySelector(".workspace")}),[]);const y=o().useMemo((()=>{const{form:{setting:{direction:e}}}=l,t=s?10*Dd.defaultDistance+10*Dd.defaultDistance:0;return("vertical"===e?d[0]:d[1])-t}),[l,s,d]),x=o().useMemo((()=>{const{form:{setting:{direction:e}}}=l,t=s?10*Dd.defaultDistance+10*Dd.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[l,s,d]),E=o().useMemo((()=>{const{form:{setting:{distance:e}}}=l;return Kd(y-10*(e.left-Dd.defaultDistance)-10*(e.right-Dd.defaultDistance))}),[l,y]),S=o().useMemo((()=>{const{form:{setting:{distance:e}}}=l;return Kd(x-10*(e.top-Dd.defaultDistance)-10*(e.bottom-Dd.defaultDistance))}),[l,x]),w=l.form.scale,C=o().useMemo((()=>{const{form:{setting:{distance:e}}}=l;return{left:Kd(10*e.left),right:Kd(10*e.right),top:Kd(10*e.top),bottom:Kd(10*e.bottom)}}),[l]),T=o().useMemo((()=>{const{form:{printerType:e}}=l,{left:t,right:r,top:n,bottom:i}=C,a=E+t+r,o=Dd.previewWidth-a<=0?0:(Dd.previewWidth-a)/2,s=Math.abs((1-w)*a/2);let c=0;return w>1&&(c=s>o?-1*o:-1*s),w<1&&(c=a-2*s>Dd.previewWidth?0:o>0?s:(Dd.previewWidth-(a-2*s))/2),{width:`${E}px`,height:"stylus"===e?"auto":S+"px",paddingLeft:`${t}px`,paddingRight:`${r}px`,paddingTop:`${n}px`,paddingBottom:`${i}px`,transform:`translateX(${c}px) scale(${w})`,opacity:g?0:1}}),[l,g,C,w,S,E]),N=(h.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{const e=i?.print?.leftLogo??"",t=i?.print?.rightLogo??"";return[`<tr style="height: ${Dd.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',e?`<img src="${e}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',t?`<img src="${t}" border="0" height="46" />`:"","</td>","</tr>"].join("")}),I=()=>{let e='<tr style="height: 0;">';for(let t=0;t<24;t++)e+=`<td width="${100/24}%" style="width: ${100/24}%; padding: 0;"></td>`;return e+="</tr>",e},R=()=>{let e=document.createElement("tr");var t,r;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=I().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(r=p.current.templateEl.children[0]).children[0]?r.insertBefore(t,r.children[0]):r.appendChild(t),e=null},P=()=>{const e=p.current.templateEl.children[0].children,t=[],r=[];for(let n=0;n<e.length;n++){if("template-cols"===e[n].getAttribute("type"))continue;const i=e[n].clientHeight;e[n].style.height=i+"px",r.push(i),t.push(e[n].outerHTML)}m.current=r,h.current=t},O=()=>{if(!h.current.length)return;const{form:{setting:e,printerType:t}}=l;if(n)return f.current.push([I(),N(),...h.current]);const r=e.fixedLogo?S-Dd.logoHeight:S;let i=[];if(f.current=[],"stylus"===t)f.current.push([I(),...e.fixedLogo?[N()]:[],...h.current]);else{let t=0;for(let n=0,a=m.current.length;n<a;n++){const o=h.current[n],l=m.current[n];e.fixedLogo||0!==n||(t+=Dd.logoHeight),t+=l,t<=r?i.push(o):(f.current.push([I(),...e.fixedLogo?[N()]:[],...i]),i=[],t=0,n-=1),n===a-1&&i.length&&f.current.push([I(),...e.fixedLogo?[N()]:[],...i])}}e.fixedLogo||f.current[0]?.splice(1,0,N());for(let e=0,t=f.current.length;e<t&&e!==t-1;e++)f.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');a.setState({currentPage:1,totalPage:f.current.length}),k()},k=()=>{const{currentPage:e}=l;let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;t+=f.current[e-1]?.join("")??"",t+="</table>",p.current.previewEl.innerHTML=t,p.current.previewEl.parentNode.scrollTop=0},A=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;if(void 0!==e)t+=[...f.current[e-1]].join("");else for(let e=0;e<f.current.length;e++)t+=f.current[e].join("");return t+="</table>",t},L=()=>{const e=[];for(let t=0;t<h.current.length;t++)e[t]=h.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+N()+I()+e.join("")+"</table>"},F=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return _();p.current.previewEl.innerHTML||(R(),await ce(0),P(),O(),b(!1))},H=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return _();R(),await ce(0),P(),O(),b(!1),a.doPrint(A()),await ce(0),a.doClose()},_=()=>{v("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},D=Ie("print-container"),$={[D]:!0,"no-visible":n};return o().createElement("div",{ref:u,className:Ne()($)},o().createElement(St,{wrapperClassName:"spin",spinning:g,tip:"Loading..."},o().createElement("div",{className:"preview"},o().createElement("div",{className:"origin-template",style:{width:`${E}px`,marginLeft:`-${Math.floor(E/2)}px`}},r?.()),o().createElement("div",{className:"workspace",style:T}))))}));Vd.displayName="Container";const zd=Vd;function Bd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ud extends a.Component{constructor(){super(...arguments),Bd(this,"context",void 0),Bd(this,"formRef",o().createRef()),Bd(this,"createFormList",(()=>[{type:"DIVIDER",fieldName:"_1",label:f("qm.print.setPanel.printParameter")},{type:"SELECT",label:f("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:f("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:f("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:f("qm.print.setPanel.vertical"),value:"vertical"},{text:f("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:f("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:f("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:f("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:f("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:Dd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:Dd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:Dd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:Dd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]}])),Bd(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})})),Bd(this,"getInitialExtra",(()=>({disleft:f("qm.print.setPanel.sizeUnit"),disright:f("qm.print.setPanel.sizeUnit"),distop:f("qm.print.setPanel.sizeUnit"),disbottom:f("qm.print.setPanel.sizeUnit")}))),Bd(this,"state",{formList:this.createFormList()}),Bd(this,"confirmHandle",(async()=>{const[e,t]=await this.formRef.current.GET_FORM_DATA();e||(this.props.onChange({distance:{left:t.disleft,right:t.disright,top:t.distop,bottom:t.disbottom},pageSize:t.pageSize,direction:t.direction,doubleSide:t.doubleSide,doubleSideType:t.doubleSideType,fixedLogo:t.fixedLogo}),this.cancelHandle())})),Bd(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return o().createElement(o().Fragment,null,o().createElement(Go,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(xe,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},f("qm.dialog.close")),o().createElement(xe,{type:"primary",onClick:()=>this.confirmHandle()},f("qm.dialog.confirm"))))}}Bd(Ud,"contextType",c);const Wd=Ud;function Gd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Yd extends a.Component{constructor(){super(...arguments),Gd(this,"context",void 0),Gd(this,"provide",{$$preview:this}),Gd(this,"containRef",o().createRef()),Gd(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:Dd.defaultDistance,right:Dd.defaultDistance,top:Dd.defaultDistance,bottom:Dd.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),Gd(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),Gd(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),Gd(this,"printClickHandle",(async()=>{if(this.doPrint(this.containRef.current.createPrintHtml(this.state.printPage)),this.props.uniqueKey)try{const e={...this.state.form,printerName:this.printerItems.find((e=>e.value===this.state.form.printerName)).text};await zs().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),Gd(this,"doClose",(()=>{this.props.onClose?.()})),Gd(this,"getPrintConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),Gd(this,"savePrintConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),Gd(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 ')),Gd(this,"doPrint",(e=>{const t=jd();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:i,printerName:a,printerType:o,copies:l}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Dd,{left:d,right:u,top:p,bottom:h}=i.distance;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(a),t.SET_PRINT_COPIES(l),i.doubleSide&&("auto"===i.doubleSideType?(t.SET_PRINT_MODE("PRINT_DUPLEX",2),t.SET_PRINT_MODE("PRINT_DEFAULTSOURCE",1)):t.SET_PRINT_MODE("DOUBLE_SIDED_PRINT",1)),t.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW",1),"laser"===o&&("vertical"===i.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===i.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===o&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(p-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==o?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?n&&this.doClose():L.message.error(f("qm.print.printError"))},t.PRINT()})),Gd(this,"doExport",(e=>{const t=jd();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:i}}=this.state;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?n&&this.doClose():L.message.error(f("qm.print.exportError"))},t.ADD_PRINT_TABLE(0,0,"RightMargin: 0","BottomMargin: 0",this.createStyle()+e),t.SET_SAVE_MODE("Orientation","vertical"===i.direction?1:2),t.SAVE_TO_FILE(`${u()().format("YYYYMMDDHHmmss")}.xlsx`)}))}get printerTypeItems(){return[{text:f("qm.print.laserPrinter"),value:"laser"},{text:f("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=jd(),t=[{text:f("qm.print.defaultPrinter"),value:-1}];try{const r=e.GET_PRINTER_COUNT();for(let n=0;n<r;n++)t.push({text:e.GET_PRINTER_NAME(n),value:n})}catch(e){v("Print","[ClientPrint]: 请安装 LODOP 打印插件")}return t}get isWindowsPrinter(){const{form:{printerName:e}}=this.state;return!/OneNote|Microsoft|Fax/.test(this.printerItems.find((t=>t.value===e)).text)}get pageSize(){return this.state.form.setting.pageSize.split("*").map((e=>Number(e)))}get printerKey(){return this.props.uniqueKey?`print_${this.props.uniqueKey}`:""}async componentDidMount(){if(this.props.uniqueKey)try{let e=await zs().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,ne.isPlainObject)(e)&&await zs().setItem(this.printerKey,e)),(0,ne.isPlainObject)(e)&&Object.keys(e).length&&(0,ne.merge)(this.state.form,{...e,printerName:this.printerItems.find((t=>t.text===e.printerName))?.value??-1})}catch(e){}}render(){const{preview:e,templateRender:t}=this.props,{visible:r,form:n,currentPage:i,totalPage:a,printPage:l}=this.state,s=Ie("print-preview"),c={visible:r,title:f("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?o().createElement(o().Fragment,null,o().createElement("div",{className:Ne()(d)},o().createElement("div",{className:"outer"},o().createElement("div",{className:"header"},o().createElement("span",null,f("qm.print.printer"),":",o().createElement(L.Select,{value:n.printerName,onChange:e=>{this.setState((t=>(0,ne.merge)({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",null,f("qm.print.type"),":",o().createElement(L.Select,{value:n.printerType,onChange:e=>{this.setState((t=>(0,ne.merge)({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",null,f("qm.print.copies"),":",o().createElement(L.InputNumber,{value:n.copies,min:1,precision:0,onChange:e=>{this.setState((t=>(0,ne.merge)({},t,{form:{copies:e??1}})))},style:{width:"50px"}})),o().createElement("span",null,f("qm.print.printPage.0"),o().createElement(L.InputNumber,{value:l,min:1,max:a,precision:0,onChange:e=>{this.setState({printPage:e??void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),f("qm.print.printPage.1")),o().createElement("span",null,o().createElement(L.Pagination,{size:"small",current:i,pageSize:1,total:a,onChange:this.pageChangeHandle})),o().createElement("span",null,o().createElement(xe,{type:"text",icon:o().createElement(Re.SettingOutlined,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},f("qm.print.setting"))),o().createElement("span",null,o().createElement(xe,{type:"text",icon:o().createElement(Re.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},f("qm.print.export"))),o().createElement("span",null,o().createElement(xe,{icon:o().createElement(Re.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},f("qm.print.print")))),o().createElement("div",{className:"main"},o().createElement($d.Provider,{value:this.provide},o().createElement(zd,{ref:this.containRef,templateRender:t,directPrint:!1}))),o().createElement("div",{className:"footer"},o().createElement("span",null,f("qm.print.scale"),":",o().createElement(L.Slider,{value:n.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>(0,ne.merge)({},t,{form:{scale:e}})))}}),o().createElement("em",{className:"scale-text"},`${Math.floor(100*n.scale)}%`)),o().createElement("span",null,f("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),o().createElement("span",null,f("qm.print.pageNumber"),":",f("qm.print.pagination",{currentPage:i,totalPage:a}))))),o().createElement(Er,c,o().createElement(Wd,{setting:n.setting,onChange:e=>{this.setState((t=>(0,ne.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):o().createElement($d.Provider,{value:this.provide},o().createElement(zd,{ref:this.containRef,templateRender:t,directPrint:!0}))}}Gd(Yd,"contextType",c);const Xd=Yd;function Qd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Zd extends a.Component{constructor(){super(...arguments),Qd(this,"context",void 0),Qd(this,"previewRef",o().createRef()),Qd(this,"state",{visible:!1,loading:!1}),Qd(this,"clickHandle",(async()=>{this.setState({loading:!0});try{const e=await(this.props.click?.());if(this.setState({loading:!1}),"boolean"==typeof e&&!e)return;await this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),Qd(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:t,uniqueKey:r,defaultConfig:n,preview:i,closeAfterPrint:a}=this.props,l={visible:e,title:f("qm.print.preview"),width:`${Dd.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:t,uniqueKey:r,defaultConfig:n,preview:i,closeAfterPrint:a,onClose:()=>{this.setState({visible:!1})}};return i?o().createElement(Er,l,o().createElement(Xd,s)):e?o().createElement(Xd,s):null})),Qd(this,"DO_PRINT",(async()=>{const{preview:e}=this.props;await ce(0),this.setState({visible:!0}),await ce(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:t,icon:r,type:n,disabled:i,shape:a}=this.props,l={size:t||this.context.size||"",type:n,shape:a,icon:r,loading:e,disabled:i,click:this.clickHandle};return o().createElement(o().Fragment,null,this.props.children&&o().createElement(xe,l,this.props.children),this.createRender())}}Qd(Zd,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Print","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},templateRender:s().elementType}),Qd(Zd,"defaultProps",{preview:!0,type:"primary",icon:o().createElement(Re.PrinterOutlined,null)}),Qd(Zd,"contextType",c);const Jd=Zd;function eu(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function tu(e){const t=eu(e);return t?t.frameElement:null}function ru(e){const t=au(e);return nu([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function nu(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 iu(e,t){const r=tu(e);if(r&&r!==t){const n=[e.getBoundingClientRect()];let i=r,a=!1;for(;i;){const e=ru(i);if(n.push(e),i=tu(i),a)break;i&&eu(i)===t&&(a=!0)}return nu(n)}return e.getBoundingClientRect()}function au(e){const t=window.getComputedStyle(e);return{borderLeft:parseInt(t.borderLeftWidth,10),borderRight:parseInt(t.borderRightWidth,10),borderTop:parseInt(t.borderTopWidth,10),borderBottom:parseInt(t.borderBottomWidth,10),marginLeft:parseInt(t.marginLeft,10),marginRight:parseInt(t.marginRight,10),marginTop:parseInt(t.marginTop,10),marginBottom:parseInt(t.marginBottom,10),paddingLeft:parseInt(t.paddingLeft,10),paddingRight:parseInt(t.paddingRight,10),paddingTop:parseInt(t.paddingTop,10),paddingBottom:parseInt(t.paddingBottom,10)}}function ou(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const lu=Object.assign;class su{constructor(e,t){ou(this,"node",void 0),ou(this,"border",void 0),ou(this,"padding",void 0),ou(this,"content",void 0),this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=pu.border,this.padding.style.borderColor=pu.padding,this.content.style.backgroundColor=pu.background,lu(this.node.style,{borderColor:pu.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){uu(t,"margin",this.node),uu(t,"border",this.border),uu(t,"padding",this.padding),lu(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"}),lu(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class cu{constructor(e,t){ou(this,"tip",void 0),ou(this,"nameSpan",void 0),ou(this,"dimSpan",void 0),this.tip=e.createElement("div"),lu(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),lu(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),lu(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,r){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(r)+"px"}updatePosition(e,t){const r=this.tip.getBoundingClientRect(),n=function(e,t,r){const n=Math.max(r.height,20),i=Math.max(r.width,60);let a;a=e.top+e.height+n<=t.top+t.height?e.top+e.height<t.top+0?t.top+5:e.top+e.height+5:e.top-n<=t.top+t.height?e.top-n-5<t.top+5?t.top+5:e.top-n-5:t.top+t.height-n-5;let o=e.left+5;return e.left<t.left&&(o=t.left+5),e.left+i>t.left+t.width&&(o=t.left+t.width-i-5),a+="px",o+="px",{style:{top:a,left:o}}}(e,t,{width:r.width,height:r.height});lu(this.tip.style,n.style)}}class du{constructor(){ou(this,"window",void 0),ou(this,"tipBoundsWindow",void 0),ou(this,"container",void 0),ou(this,"tip",void 0),ou(this,"rects",void 0);const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const r=e.document;this.container=r.createElement("div"),this.container.style.zIndex="10000000",this.tip=new cu(r,this.container),this.rects=[],r.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 r=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>r.length;){const e=this.rects.pop();e?.remove()}if(0===r.length)return;for(;this.rects.length<r.length;)this.rects.push(new su(this.window.document,this.container));const n={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};r.forEach(((e,t)=>{const r=iu(e,this.window),i=au(e);n.top=Math.min(n.top,r.top-i.marginTop),n.right=Math.max(n.right,r.left+r.width+i.marginRight),n.bottom=Math.max(n.bottom,r.top+r.height+i.marginBottom),n.left=Math.min(n.left,r.left-i.marginLeft),this.rects[t].update(r,i)})),t||(t=r[0].nodeName.toLowerCase(),r[0]),this.tip.updateText(t,n.right-n.left,n.bottom-n.top);const i=iu(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:n.top,left:n.left,height:n.bottom-n.top,width:n.right-n.left},{top:i.top+this.tipBoundsWindow.scrollY,left:i.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function uu(e,t,r){lu(r.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const pu={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 hu=null,mu=null;function fu(){null!=window.document&&(hu=null,null!==mu&&(mu.remove(),mu=null))}function gu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class bu{constructor(e){gu(this,"_isRunning",void 0),gu(this,"_selectIgnore",void 0),gu(this,"_lastHoveredNode",null),gu(this,"excludeSelectors",void 0),gu(this,"onSelect",void 0),gu(this,"iframesListeningTo",new Set),gu(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),gu(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),gu(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),gu(this,"onPointerMove",(e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>et(t,window.document.querySelector(e)))))return this._selectIgnore=!0,fu();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 r;r=[t],null,!1,null!=window.document?(null!==hu&&clearTimeout(hu),null!=r&&(null===mu&&(mu=new du),mu.inspect(r,null))):null!=r&&null!=r[0]&&console.error("showNativeHighlight",r[0])}})),gu(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),gu(this,"selectFiberForNode",(0,ne.throttle)((e=>{this._selectIgnore||this.onSelect?.(e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;let r=e;const n=[];for(;r!==t&&null!==r;){let e=r.tagName.toLowerCase();const t=/(?:\b|\w+-)(actived?|select(ed)?|focus(ed)?|open(ed)?)$/;for(let e=0,n=Array.from(r.classList).reverse();e<n.length;e++)t.test(n[e])&&r.classList.remove(n[e]);if(r.id&&/^rc-\w+/.test(r.id)&&r.removeAttribute("id"),r.id)e+=`#${r.id}`;else{const t=Array.from(r.parentElement.children).filter((e=>e.tagName===r.tagName)),n=r.className.trim();if(t.filter((e=>e.className.includes(n))).length<=1){if(n){const t=n.split(/\s+/);let r="";for(let e=0;e<t.length;e++)/^ant-col-\d+$/.test(t[e])||(r+=`.${t[e]}`);e+=r}}else r.getAttribute("name")?e+=`[name=${r.getAttribute("name")}]`:e+=`:nth-of-type(${t.indexOf(r)+1})`}r.nodeType!==Node.TEXT_NODE&&n.unshift(e),r=r.parentElement}return n.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(){fu(),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 yu(e){return document.querySelector(e)}const vu=e=>{const{action:t,onConfirm:r,onCancel:n,onFinish:i}=e,{t:a}=yc();return o().createElement(o().Fragment,null,o().createElement("div",{style:{height:100}},a("qm.table.config.emptyText")),o().createElement(Ce,{style:{width:"100%",justifyContent:"flex-end"}},o().createElement(xe,{size:"small",onClick:()=>n?.()},a("qm.guideTracker.closeButton")),o().createElement(xe,{size:"small",onClick:()=>r?.()},a("add"===t?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),o().createElement(xe,{size:"small",onClick:()=>i?.()},a("qm.guideTracker.finishButton"))))},xu={left:"50%",top:"50%",width:1,height:1},Eu=o().forwardRef(((e,t)=>{const{open:r,current:n,defaultCurrent:i,steps:a=[],placement:l="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:p,zIndex:h,helper:m={},selectFilter:f=(e=>e),onSelect:g,onChange:b,onClose:y,onFinish:v}=e,{t:x}=yc(),E=o().useRef(),S=o().useRef(a.length),[w,C]=ud(0,{value:n,defaultValue:i}),[T,N]=ud(void 0,{value:r,postState:e=>e??!1}),[I,R]=ud(1051,{value:h,defaultValue:h}),[P,O]=o().useState({}),[k,A]=o().useState(!1),[F,H]=o().useState(T),[_,D]=o().useState(!1),[$,q]=cd(P.node,!!r),[M,j]=o().useState(22),K=o().useRef(!1),V=o().useMemo((()=>w>=a.length?"add":"edit"),[w,a]),z=o().useMemo((()=>`${w+1} / ${a.length}`),[w,a]);o().useLayoutEffect((()=>{E.current=new bu({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),O({id:ln(),node:e,path:t}),C(S.current),A(!0),U(),g?.(t,e)}})}),[]),o().useEffect((()=>(T?B():U(),T?setTimeout((()=>H(!0)),16):H(!1),()=>{U()})),[T]),o().useEffect((()=>{S.current=a.length}),[a]);const B=()=>{E.current.startHandle()},U=()=>{E.current.stopHandle()},W=e=>{e.stopPropagation(),e.preventDefault()};o().useImperativeHandle(t,(()=>({OPEN:()=>N(!0),CLOSE:()=>N(!1),GET_CURRENT_STEP:()=>({current:w,selector:P.path})})));const G=Ie("guide-tracker"),Y=[{[`${G}-primary`]:!0}],X=fd({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return o().createElement(o().Fragment,null,o().createElement(vd(),{zIndex:I,builtinPlacements:X,popupPlacement:l,popupVisible:T&&k,popupClassName:Ne()(Y,c),popupStyle:d,prefixCls:G,popup:()=>{const e=()=>{A(!1),B()};return o().createElement("div",{className:`${G}-content`},o().createElement("div",{className:`${G}-inner`},o().createElement(Re.CloseOutlined,{className:`${G}-close`,onClick:()=>{y?.(w),e()}}),o().createElement(L.Dropdown,{open:_,trigger:["click"],dropdownRender:()=>a.length?o().createElement("div",{className:"ant-dropdown-menu step-list"},o().createElement(hi.ReactSortable,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.id)),r=a.map((e=>e.id));if((0,ne.isEqual)(t,r))return;const n=t.findIndex((e=>e===P.id)),i=-1!==n?n:w;C(i),b?.(bn(e),i)}},a.map(((e,t)=>o().createElement("li",{key:t,className:Ne()("item",{actived:e.id===P.id})},o().createElement(Re.HolderOutlined,{className:"handle",title:x("qm.form.draggable")}),o().createElement("span",{className:"box"},o().createElement("span",{className:"title",title:e.title,onClick:()=>{t!==w&&(O({id:e.id,node:yu(e.selector),path:e.selector}),C(t),j(22===M?M+1:M-1),b?.(a,t))}},e.title),o().createElement(L.Popconfirm,{title:x("qm.button.confirmTitle"),zIndex:I+1,onConfirm:()=>{const r=a.filter((t=>t.id!==e.id)),n=t===w;let i=t<=w?w-1:w;if(i=i<0?0:i,i=i>r.length?r.length:i,n&&r[i]){const{id:e,selector:t}=r[i];O({id:e,node:yu(t),path:t})}C(i),b?.(r,i)}},o().createElement(Re.CloseOutlined,{className:"close-icon"})))))))):o().createElement(o().Fragment,null),overlayClassName:`${G}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:I},onOpenChange:e=>D(e)},o().createElement(Re.MenuOutlined,{className:Ne()(`${G}-close`,"menu-icon"),style:{width:M}})),m.content&&o().createElement(L.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:I},content:m.content,title:m.title},o().createElement(Re.QuestionCircleOutlined,{className:Ne()(`${G}-close`,"help-icon")})),o().createElement("div",{className:"panel-label"},o().createElement("span",{className:"title"},x("qm.guideTracker.label")),o().createElement("span",{className:"step"},x("qm.guideTracker.currentStep"),z)),p?p({id:P.id,selector:P.path,actionStatus:V,DO_CLOSE:e},w):o().createElement(vu,{action:V,onConfirm:()=>{b?.("add"===V?[...a,{id:P.id,selector:P.path,title:"Guide Title"}]:[...a],w),e()},onCancel:()=>{y?.(w),e()},onFinish:()=>{e(),y?.(w),v?.()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},o().createElement(bd(),{open:T&&k,autoLock:!0},o().createElement("div",{className:Ne()(`${G}-target-placeholder`),style:{...$||xu,position:"fixed",zIndex:I-1,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:W,onClick:W}))),s&&o().createElement(bd(),{open:F},o().createElement(Td,{zIndex:I,prefixCls:G,onPause:()=>{K.current=k,A(!1),U()},onPlay:()=>{K.current?A(!0):B()}})))}));Eu.displayName="QmGuideTracker";const Su=Eu,wu=e=>{const{content:t,image:r,width:n,height:i,font:l={},gap:s=[100,100],offset:c=[50,50],rotate:d=-22,zIndex:u=9,alpha:p=1,antiTamper:h=!0,grayscale:m,className:f,style:g}=e,b=o().useRef(null),y=o().useRef(new Map),v=l.fontSize??16,x=l.fontWeight??"normal",E=l.fontStyle??"normal",S=l.fontFamily??"sans-serif",w=l.color??"rgba(0, 0, 0, 0.15)",C=l.textAlign??"center",T=Array.isArray(t)?t:[t],N=s[0],I=s[1],R=N/2,P=I/2,O=c[0]??R,k=c[1]??P,A=o().useMemo((()=>{const e=O-R,t=k-P;return{position:"absolute",left:e>0?`${e}px`:0,top:t>0?`${t}px`:0,width:e>0?`calc(100% - ${e}px)`:"100%",height:t>0?`calc(100% - ${t}px)`:"100%",pointerEvents:"none",backgroundRepeat:"repeat",backgroundPosition:`${e>0?0:e}px ${t>0?0:t}px`,zIndex:u}}),[R,P,O,k,u]),L=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const a=(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),[o,l]=(e=>{let t=120,a=64;if(!r&&e.measureText){e.font=`${v}px ${S}`;const r=T.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...r)),a=v*T.length+3*(T.length-1)}return[n??t,i??a]})(t),s=o*a,c=l*a,u=(N+o)*a,h=(I+l)*a,f=N/2*a,g=I/2*a,R=u/2,P=h/2,O=2*(N+o);e.width=2*u,e.height=2*h,t.globalAlpha=p,t.save(),t.translate(R,P),t.rotate(Math.PI/180*d),t.translate(-R,-P);const k=()=>{t.restore(),t.drawImage(e,0,0,u,h,u,h,u,h),m&&(e=>{const t=e.getContext("2d");if(!t)return;const r=t.getImageData(0,0,e.width,e.height),{data:n}=r;for(let e=0;e<n.length;e+=4){const t=(n[e]+n[e+1]+n[e+2])/3;n[e]=t,n[e+1]=t,n[e+2]=t}t.putImageData(r,0,0)})(e),((e,t)=>{if(b.current){const r=y.current.get(b.current);r&&(b.current.contains(r)&&b.current.removeChild(r),y.current.delete(b.current));const n=document.createElement("div");n.setAttribute("style",(e=>Object.entries(e).map((e=>{let[t,r]=e;return`${n=t,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${r}`;var n})).join(";"))({...A,backgroundImage:`url('${e}')`,backgroundSize:`${t}px`})),b.current?.append(n),y.current.set(b.current,n)}})(e.toDataURL(),O)},L=()=>{const e=Number(v)*a;t.font=`${E} normal ${x} ${e}px/${l}px ${S}`,t.fillStyle=w,t.textAlign=C,t.textBaseline="top",t.translate(s/2,0),T.forEach(((r,n)=>{t.fillText(r??"",f,g+n*(e+3*a))})),k()};if(r){const e=new Image;e.onload=()=>{t.drawImage(e,f,g,s,c),k()},e.onerror=()=>{L()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=r}else L()},F=e=>Array.from(y.current.values()).includes(e);o().useEffect((()=>{L()}),[t,r,n,i,l,s,c,d,u,p,h,m]),function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=window&&"MutationObserver"in window,i=a.useRef(),o=()=>{i.current&&(i.current.disconnect(),i.current=void 0)};a.useEffect((()=>(o(),n&&e.current&&(i.current=new MutationObserver(t),i.current.observe(e.current,r)),()=>o())),[e])}(b,(e=>{if(h)for(const t of e){const e=Array.from(t.removedNodes).some((e=>F(e))),r="attributes"===t.type&&F(t.target);if(e||r){L();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const H=Ie("watermark");return o().createElement("div",{ref:b,className:Ne()(H,f),style:{position:"relative",...g}},e.children)},Cu=new Map,Tu=new WeakMap;let Nu=0;function Iu(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:undefined;if(void 0===window.IntersectionObserver&&void 0!==n){const i=e.getBoundingClientRect();return t(n,{isIntersecting:n,target:e,intersectionRatio:"number"==typeof r.threshold?r.threshold:0,time:0,boundingClientRect:i,intersectionRect:i,rootBounds:i}),()=>{}}const{id:i,observer:a,elements:o}=function(e){const t=function(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(r=e.root,r?(Tu.has(r)||(Nu+=1,Tu.set(r,Nu.toString())),Tu.get(r)):"0"):e[t]}`;var r})).toString()}(e);let r=Cu.get(t);if(!r){const n=new Map;let i=[];const a=new IntersectionObserver((t=>{t.forEach((t=>{const r=t.isIntersecting&&i.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=r),n.get(t.target)?.forEach((e=>{e(r,t)}))}))}),e);i=a.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),r={id:t,observer:a,elements:n},Cu.set(t,r)}return r}(r),l=o.get(e)||[];return o.has(e)||o.set(e,l),l.push(t),a.observe(e),function(){l.splice(l.indexOf(t),1),0===l.length&&(o.delete(e),a.unobserve(e)),0===o.size&&(a.disconnect(),Cu.delete(i))}}const Ru=e=>{const{forceRender:t,height:r,placeholder:n=null,unmountIfInvisible:i,className:a,style:l}=e,{ref:s,inView:c,entry:d}=function(){let{root:e,rootMargin:t,threshold:r,triggerOnce:n,fallbackInView:i,trackVisibility:a,skip:l,delay:s,onChange:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[d,u]=o().useState(null),[p,h]=o().useState({inView:!1,entry:void 0}),m=o().useRef(c);o().useEffect((()=>{if(l||!d)return;let o;return o=Iu(d,((e,t)=>{h({inView:e,entry:t}),m.current?.(e,t),t.isIntersecting&&n&&o&&(o(),o=void 0)}),{root:e,rootMargin:t,threshold:r,trackVisibility:a,delay:s},i),()=>{o&&o()}}),[Array.isArray(r)?r.toString():r,d,e,t,n,l,a,i,s]);const f=p.entry?.target,g=o().useRef();d||!f||n||l||g.current===f||(g.current=f,h({inView:!1,entry:void 0}));const b=[u,p.inView,p.entry];return b.ref=b[0],b.inView=b[1],b.entry=b[2],b}(Object.assign({},e,{triggerOnce:!i}));o().useEffect((()=>{r||v("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u=Ie("lazy-load"),p={[u]:!0};return o().createElement("div",{ref:s,className:Ne()(p,a),style:l},t||c?e.children:o().createElement("div",{className:"placeholder",style:{height:r}},n))},Pu=require("html2canvas");var Ou=n.n(Pu);function ku(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Au{constructor(e,t,r,n){if(ku(this,"x",void 0),ku(this,"y",void 0),ku(this,"pressure",void 0),ku(this,"time",void 0),isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=r||0,this.time=n||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 Lu{static fromPoints(e,t){const r=this.calculateControlPoints(e[0],e[1],e[2]).c2,n=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new Lu(e[1],r,n,e[2],t.start,t.end)}static calculateControlPoints(e,t,r){const n=e.x-t.x,i=e.y-t.y,a=t.x-r.x,o=t.y-r.y,l=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+r.x)/2,d=(t.y+r.y)/2,u=Math.sqrt(n*n+i*i),p=Math.sqrt(a*a+o*o),h=p/(u+p),m=c+(l-c)*h,f=d+(s-d)*h,g=t.x-m,b=t.y-f;return{c1:new Au(l+g,s+b),c2:new Au(c+g,d+b)}}constructor(e,t,r,n,i,a){this.startPoint=e,this.control2=t,this.control1=r,this.endPoint=n,this.startWidth=i,this.endWidth=a}length(){let e,t,r=0;for(let n=0;n<=10;n+=1){const i=n/10,a=this.point(i,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),o=this.point(i,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(n>0){const n=a-e,i=o-t;r+=Math.sqrt(n*n+i*i)}e=a,t=o}return r}point(e,t,r,n,i){return t*(1-e)*(1-e)*(1-e)+3*r*(1-e)*(1-e)*e+3*n*(1-e)*e*e+i*e*e*e}}function Fu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Hu{constructor(e,t){var r=this;Fu(this,"canvas",void 0),Fu(this,"ctx",void 0),Fu(this,"textInput",void 0),Fu(this,"width",320),Fu(this,"height",200),Fu(this,"ratio",Math.max(window.devicePixelRatio||1,1)),Fu(this,"penColor","rgba(0,0,0,1)"),Fu(this,"backgroundColor","rgba(0,0,0,0)"),Fu(this,"canAddHistory",!1),Fu(this,"mode",void 0),Fu(this,"openSmooth",!0),Fu(this,"dotSize",0),Fu(this,"throttle",16),Fu(this,"minDistance",5),Fu(this,"velocityFilterWeight",.7),Fu(this,"compositeOperation","source-over"),Fu(this,"minWidth",.5),Fu(this,"maxWidth",2.5),Fu(this,"fontSize",16),Fu(this,"eraserSize",20),Fu(this,"lineHeight",1.25),Fu(this,"degreeOfBlur",5),Fu(this,"textInputPos",{x:0,y:0}),Fu(this,"isMobile",/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile/i.test(navigator.userAgent)),Fu(this,"onStart",(()=>{})),Fu(this,"onEnd",(()=>{})),Fu(this,"_drawingStroke",!1),Fu(this,"_lastPoints",[]),Fu(this,"_data",[]),Fu(this,"_historyList",[]),Fu(this,"_lastVelocity",0),Fu(this,"_lastWidth",0),Fu(this,"_strokeMoveUpdate",void 0),Fu(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)})),Fu(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))})),Fu(this,"addListener",(()=>{this.removeListener(),this.canvas.style.touchAction="none",this.canvas.style.userSelect="none",this.isMobile&&("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)})),Fu(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)})),Fu(this,"_isLeftButtonPressed",((e,t)=>"touches"in e?!!e.touches.length:t?1===e.buttons:!(1&~e.buttons))),Fu(this,"_pointerEventToSignatureEvent",(e=>({event:e,type:e.type,x:"touches"in e?e.touches[0]?.clientX:e.clientX,y:"touches"in e?e.touches[0]?.clientY:e.clientY,pressure:"pressure"in e?e.pressure:0}))),Fu(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}))),Fu(this,"_strokeBegin",(e=>{this._drawingStroke=!0;const t=this._getPointGroupOptions(),r={...t,points:[]};this._data.push(r),this._reset(t),this._strokeUpdate(e,!1)})),Fu(this,"_strokeUpdate",(function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!r._drawingStroke)return;if(0===r._data.length)return void r._strokeBegin(e);const n=r._createPoint(e.x,e.y,e.pressure),i=r._data[r._data.length-1],a=i.points,o=a.length>0&&a[a.length-1],l=!!o&&n.distanceTo(o)<=r.minDistance,s=r._getPointGroupOptions(i);if(!o||!o||!l){const e=r._addPoint(n,s);t&&(o?e&&r._drawCurve(e,s):r._drawDot(n,s)),a.push({time:n.time,x:n.x,y:n.y,pressure:n.pressure})}})),Fu(this,"_strokeEnd",(function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r._drawingStroke&&(t&&r._strokeUpdate(e),r._drawingStroke=!1)})),Fu(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})),Fu(this,"_drawDot",((e,t)=>{const r=this.ctx,n=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;r.beginPath(),this._drawCurveSegment(e.x,e.y,n),r.closePath(),r.fillStyle=t.penColor,r.fill()})),Fu(this,"_drawCurve",((e,t)=>{const r=this.ctx,n=e.endWidth-e.startWidth,i=2*Math.ceil(e.length());r.beginPath(),r.fillStyle=t.penColor;for(let r=0;r<i;r+=1){const a=r/i,o=a*a,l=o*a,s=1-a,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*a*e.control1.x,u+=3*s*o*e.control2.x,u+=l*e.endPoint.x;let p=d*e.startPoint.y;p+=3*c*a*e.control1.y,p+=3*s*o*e.control2.y,p+=l*e.endPoint.y;const h=Math.min(e.startWidth+l*n,t.maxWidth);this._drawCurveSegment(u,p,h)}r.closePath(),r.fill()})),Fu(this,"_drawCurveSegment",((e,t,r)=>{const n=this.ctx;n.moveTo(e,t),n.arc(e,t,r,0,2*Math.PI,!1)})),Fu(this,"_createPoint",((e,t,r)=>{const n=this.canvas.getBoundingClientRect();return new Au(e-n.left,t-n.top,r,(new Date).getTime())})),Fu(this,"_createPointByEvent",(e=>this._createPoint(e.x,e.y,e.pressure))),Fu(this,"_addPoint",((e,t)=>{const{_lastPoints:r}=this;if(r.push(e),r.length>2){3===r.length&&r.unshift(r[0]);const e=this._calculateCurveWidths(r[1],r[2],t),n=Lu.fromPoints(r,e);return r.shift(),n}return null})),Fu(this,"_strokeWidth",((e,t)=>Math.max(t.maxWidth/(e+1),t.minWidth))),Fu(this,"_calculateCurveWidths",((e,t,r)=>{const n=r.velocityFilterWeight*t.velocityFrom(e)+(1-r.velocityFilterWeight)*this._lastVelocity,i=this._strokeWidth(n,r),a={end:i,start:this._lastWidth};return this._lastVelocity=n,this._lastWidth=i,a})),Fu(this,"onDrawStart",(e=>{e.preventDefault(),this._isLeftButtonPressed(e,!0)&&!this._drawingStroke&&(this._strokeBegin(this._pointerEventToSignatureEvent(e)),this.ctx.strokeStyle=this.penColor,this.ctx.lineWidth=this.maxWidth,"line"===this.mode&&this.createPencil(e),"eraser"===this.mode&&this.createEraser(e),"text"===this.mode&&this.createTextInput(e),this.onStart?.(e))})),Fu(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)))})),Fu(this,"onDrawEnd",(e=>{this._isLeftButtonPressed(e)||(this._strokeEnd(this._pointerEventToSignatureEvent(e)),"text"!==this.mode&&this.addHistory(),this.onEnd?.(e))})),Fu(this,"onInputBlur",(e=>{this.textInput.classList.remove("show"),this.drawHandler(e),this.textInput.innerText="",this.addHistory()})),Fu(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})),Fu(this,"drawSquare",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:i}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,r,n-t,i-r),this.ctx.stroke(),this.ctx.restore()})),Fu(this,"drawRound",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:i}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),a=Math.min(n,t),o=Math.min(i,r),l=.5*(Math.max(n,t)-a),s=.5*(Math.max(i,r)-o),c=a+l,d=o+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,l,s,0,0,2*Math.PI),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()})),Fu(this,"drawArrow",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:i}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),a=180*Math.atan2(r-i,t-n)/Math.PI,o=(a+25)*Math.PI/180,l=(a-25)*Math.PI/180,s=15*Math.cos(o),c=15*Math.sin(o),d=15*Math.cos(l),u=15*Math.sin(l);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,r),this.ctx.lineTo(n,i),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(n,i);const p=n+s,h=i+c;this.ctx.lineTo(p,h);const m=n+d,f=i+u;this.ctx.lineTo(m,f),this.ctx.lineTo(n,i),this.ctx.fill(),this.ctx.restore()})),Fu(this,"getAxisColor",((e,t,r)=>{const n=e.width,i=e.data,a=[];return a[0]=i[4*(r*n+t)],a[1]=i[4*(r*n+t)+1],a[2]=i[4*(r*n+t)+2],a[3]=i[4*(r*n+t)+3],a})),Fu(this,"setAxisColor",((e,t,r,n)=>{const i=e.width,a=e.data;a[4*(r*i+t)]=n[0],a[4*(r*i+t)+1]=n[1],a[4*(r*i+t)+2]=n[2],a[4*(r*i+t)+3]=n[3]})),Fu(this,"drawMosaic",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),n=this.ctx.getImageData(t*this.ratio,r*this.ratio,this.maxWidth*this.ratio,this.maxWidth*this.ratio),i=n.width,a=n.height,o=i/this.degreeOfBlur,l=a/this.degreeOfBlur;for(let e=0;e<l;e++)for(let t=0;t<o;t++){const r=this.getAxisColor(n,t*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur),e*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur));for(let i=0;i<this.degreeOfBlur;i++)for(let a=0;a<this.degreeOfBlur;a++)this.setAxisColor(n,t*this.degreeOfBlur+a,e*this.degreeOfBlur+i,r)}this.ctx.putImageData(n,t*this.ratio,r*this.ratio)})),Fu(this,"drawText",(e=>{const{x:t,y:r}=this.textInputPos;if(0===t&&0===r)return;this.ctx.lineWidth=1,this.ctx.fillStyle=this.penColor,this.ctx.textBaseline="middle",this.ctx.font=`bold ${this.fontSize}px none`;const n=this.fontSize*this.lineHeight,i=this.width-t,a=e.target.innerText,o=[];let l="";for(let e=0;e<a.length;e++){const t=l+a[e];this.ctx.measureText(t).width>i&&l.length>0?(o.push(l),l=a[e]):l=t}o.push(l),o.forEach(((e,i)=>{this.ctx.fillText(e,t+1,r+i*n+2)})),this.ctx.restore(),this.textInputPos={x:0,y:0}})),Fu(this,"createPencil",(e=>{if(this.openSmooth||!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,r)})),Fu(this,"drawPencil",(e=>{const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.lineTo(t,r),this.ctx.stroke(),this.ctx.restore()})),Fu(this,"createEraser",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,r)})),Fu(this,"drawEraser",(e=>{const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.globalCompositeOperation="destination-out",this.ctx.lineCap="round",this.ctx.lineWidth=this.eraserSize,this.ctx.lineTo(t,r),this.ctx.stroke(),this.ctx.globalCompositeOperation="source-over"})),Fu(this,"drawLine",(e=>{this.openSmooth?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this.drawPencil(e)})),Fu(this,"createTextInput",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];0!=this.textInputPos.x&&0!=this.textInputPos.y&&this.textInputPos.x!=t&&this.textInputPos.y!=r?this.textInput.blur():(this.textInput.classList.add("show"),this.setInputStyle(e),this.textInput.focus())})),Fu(this,"setInputStyle",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];this.textInput.style.left=t+"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=r-Math.floor((this.textInput.offsetHeight-2)/2)+"px",this.textInputPos={x:t,y:r}})),Fu(this,"drawBgColor",(()=>{this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height))})),Fu(this,"clearWorkSpace",(()=>{this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)})),Fu(this,"addHistory",(()=>{this.canAddHistory&&(this.canAddHistory=!1,this._historyList.push(this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height)))})),Fu(this,"getLastHistory",(()=>this._historyList[this._historyList.length-1])),Fu(this,"setLastHistory",(()=>{const e=this.getLastHistory();e?this.ctx.putImageData(e,0,0):this.clearWorkSpace()})),Fu(this,"clear",(()=>{this.clearWorkSpace(),this.drawBgColor(),this._historyList=[],this._data=[],this._reset(this._getPointGroupOptions())})),Fu(this,"undo",(()=>{const e=this._historyList[this._historyList.length-2];e?(this.ctx.putImageData(e,0,0),this._historyList.pop()):this.clear()})),Fu(this,"setDrawMode",(e=>{this.mode=e})),Fu(this,"setLineWidth",(e=>{this.maxWidth=e})),Fu(this,"setPenColor",(e=>{this.penColor=e})),Fu(this,"setFontSize",(e=>{this.fontSize=e})),Fu(this,"isEmpty",(()=>{const e=document.createElement("canvas"),t=e.getContext("2d");return e.width=this.canvas.width,e.height=this.canvas.height,this.backgroundColor?(t.fillStyle=this.backgroundColor,t.fillRect(0,0,e.width,e.height)):1!==this.ratio&&t.scale(this.ratio,this.ratio),e.toDataURL()===this.canvas.toDataURL()})),Fu(this,"toDataURL",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(r.canvas.width===r.width)return r.canvas.toDataURL(e,t);const n=document.createElement("canvas");return n.width=r.width,n.height=r.height,n.getContext("2d").drawImage(r.canvas,0,0,n.width,n.height),n.toDataURL(e,t)})),Fu(this,"getPNG",(()=>this.toDataURL())),Fu(this,"getJPG",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;return r.toDataURL("image/jpeg",e)})),Fu(this,"destroy",(()=>{this.removeListener();for(const e in this)this[e]=null})),this.initial(e,t)}initial(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e&&(this.canvas=e,this.ctx=e.getContext("2d"),this.textInput=document.createElement("div"),this.width=t.width||e.clientWidth||this.width,this.height=t.height||e.clientHeight||this.height,this.penColor=t.penColor||this.penColor,this.fontSize=t.fontSize||this.fontSize,this.backgroundColor=t.backgroundColor||this.backgroundColor,this.mode=t.mode||this.mode,this.openSmooth=void 0===t.openSmooth?this.openSmooth:!!t.openSmooth,this._strokeMoveUpdate=this.throttle?function(e){let t,r,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,a=0,o=null;const l=()=>{a=Date.now(),o=null,t=e.apply(r,n),o||(r=null,n=[])};return function(){const s=Date.now(),c=i-(s-a);r=this;for(var d=arguments.length,u=new Array(d),p=0;p<d;p++)u[p]=arguments[p];return n=u,c<=0||c>i?(o&&(clearTimeout(o),o=null),a=s,t=e.apply(r,n),o||(r=null,n=[])):o||(o=window.setTimeout(l,c)),t}}(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()}}Fu(Hu,"dataURLToBlob",(e=>{const t=e.split(";base64,"),r=t[0].split(":")[1],n=window.atob(t[1]),i=n.length,a=new Uint8Array(i);for(let e=0;e<i;++e)a[e]=n.charCodeAt(e);return new Blob([a],{type:r})})),Fu(Hu,"canvasToDataURL",(e=>e.toDataURL("image/png",1))),Fu(Hu,"canvasToBlob",(e=>new Promise(((t,r)=>{e.toBlob((e=>e?t(e):r(null)),"image/png",1)}))));const _u=Hu,Du=()=>o().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),$u=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),qu=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Mu=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),ju=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Ku=o().forwardRef(((e,t)=>{const{open:r,width:n,height:i,imageName:a,penColor:l,minWidth:s,maxWidth:c,backgroundColor:d,className:p,style:h,onOk:m,onCancel:f}=e,{t:g}=yc(),b=o().useRef(),y=o().useRef(null),x=o().useRef(null),E=o().useRef(null),S=[2,4,6],w=[14,16,18,20,24,28],C=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[T,N]=ud(void 0,{value:r,postState:e=>e??!1}),I=o().useMemo((()=>!!e.children),[e.children]),[R,P]=o().useState(I?"square":"line"),[O,k]=o().useState(S[0]),[A,F]=o().useState(I?C[0]:C[4]),[H,_]=o().useState(w[1]),[D,$]=o().useState("bottomLeft"),[q,M]=o().useState(!1),[j,K]=o().useState(!1);o().useEffect((()=>{const e={width:n??x.current?.offsetWidth,height:i??x.current?.offsetHeight,maxWidth:O,mode:R,penColor:A,fontSize:H,backgroundColor:d,openSmooth:!I};return e.openSmooth&&Object.assign(e,{penColor:l,minWidth:s,maxWidth:c}),b.current=new _u(y.current,e),()=>b.current.destroy()}),[]);const V=e=>{const[t,r]=[n??x.current?.offsetWidth,i??x.current?.offsetHeight],{width:a,height:o}=b.current;let l=!1;t&&t!==a&&(b.current.width=t,l=!0),r&&r!==o&&(b.current.height=r,l=!0),(l||e)&&b.current.update()};Ve((()=>{I&&T&&V()}),[T,I]),Ve((()=>{b.current.setDrawMode(R)}),[R]),Ve((()=>{b.current.setLineWidth(O)}),[O]),Ve((()=>{b.current.setPenColor(A)}),[A]),Ve((()=>{b.current.setFontSize(H)}),[H]);const z=async()=>{const e=I?x.current.parentNode:y.current;if(e)try{const t=await Ou()(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return _u.canvasToDataURL(t)}catch(e){v("Signature","生成合成图片失败!")}},B=()=>{b.current.clear(),f?.()};o().useImperativeHandle(t,(()=>({OPEN:()=>N(!0),CLOSE:()=>N(!1),CLEAR:()=>b.current.clear(),IS_EMPTY:()=>b.current.isEmpty(),UPDATE:V,GET_DATE_URL:z})));const U=e=>{e&&$((()=>{const e=E.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},W=e=>o().createElement("div",{className:Ne()("ant-dropdown-menu","content")},"text"!==e?o().createElement("div",{className:"lineWidth"},S.map((e=>o().createElement("span",{key:e,className:Ne()("dot",`s${e}`,{active:e===O}),onClick:()=>k(e)})))):o().createElement("div",{className:"fontSize"},o().createElement(L.Select,{size:"small",value:H,options:w.map((e=>({value:e,label:e.toString()}))),onChange:e=>_(e)})),o().createElement("span",{className:"divider"}),o().createElement("div",{className:"penColor"},C.map((e=>o().createElement("span",{key:e,className:Ne()("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>F(e)},o().createElement(Re.CheckOutlined,{className:"icon"})))))),G=Ie("signature"),Y={[G]:!0,"is-annotation":I},X=n?{...h,width:n}:h;return o().createElement("div",{className:Ne()(Y,p),style:X},I&&o().createElement(o().Fragment,null,o().createElement("div",{ref:x,className:"content"},e.children),j&&o().createElement(St,{spinning:!0,className:"spinning"})),o().createElement("div",{className:Ne()("signature",{show:T})},o().createElement("canvas",{ref:y,className:R}),I&&o().createElement("div",{ref:E,className:"signature__tool-bar"},o().createElement("div",{className:"wrapper"},o().createElement("div",{className:Ne()("actions",{hidden:q})},o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("square")},o().createElement(Re.BorderOutlined,null))),o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("round")},o().createElement(Du,null))),o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("arrow")},o().createElement(qu,null))),o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("line")},o().createElement(Re.EditOutlined,null))),o().createElement(L.Dropdown,{dropdownRender:()=>W("text"),overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("text")},o().createElement($u,null))),o().createElement("button",{className:"btn",onClick:async()=>{await(async()=>{K(!0);const e=await z();if(e){const t=a?a.slice(0,a.lastIndexOf(".")>0?a.lastIndexOf("."):void 0):u()().format(Bl);Dt(_u.dataURLToBlob(e),`${t}.png`)}K(!1)})(),B()}},o().createElement(Re.DownloadOutlined,null)),o().createElement("button",{className:"btn",onClick:()=>P("eraser")},o().createElement(Mu,null)),o().createElement("button",{className:"btn",onClick:()=>b.current.undo()},o().createElement(ju,null)),o().createElement("button",{className:"btn",onClick:()=>b.current.clear()},o().createElement(Re.ClearOutlined,null)),o().createElement("span",{className:"divider"}),o().createElement("button",{className:"btn",onClick:()=>f?.()},o().createElement(Re.CloseOutlined,null)),o().createElement("button",{className:"btn",onClick:async()=>{K(!0),await ce(10);const e=await z();K(!1),B(),m?.(e)}},o().createElement(Re.CheckOutlined,null))),o().createElement("button",{className:"btn btn-fold",title:g(q?"qm.divider.spread":"qm.divider.collect"),onClick:()=>M(!q)},q?o().createElement(Re.LeftOutlined,null):o().createElement(Re.RightOutlined,null))))))}));Ku.displayName="QmSignature";const Vu=Ku,zu="1.9.12";return i})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("QmDesign",["react"],t):"object"==typeof exports?exports.QmDesign=t(require("react")):e.QmDesign=t(e.React)}("undefined"!=typeof self?self:this,(e=>(()=>{"use strict";var t={442:t=>{t.exports=e}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};n.r(i),n.d(i,{Affix:()=>L.Affix,Alert:()=>L.Alert,Anchor:()=>L.Anchor,AutoComplete:()=>L.AutoComplete,Avatar:()=>L.Avatar,BackTop:()=>L.BackTop,Badge:()=>L.Badge,Breadcrumb:()=>L.Breadcrumb,Button:()=>L.Button,Calendar:()=>$,Card:()=>L.Card,Carousel:()=>L.Carousel,Cascader:()=>L.Cascader,Checkbox:()=>L.Checkbox,Col:()=>L.Col,Collapse:()=>L.Collapse,Comment:()=>L.Comment,ConfigProvider:()=>L.ConfigProvider,DatePicker:()=>j,DcpAnchor:()=>ar,DcpButton:()=>xe,DcpCollapse:()=>je,DcpConfigProvider:()=>ee,DcpCopyToClipboard:()=>kc,DcpCountup:()=>ht,DcpCropper:()=>El,DcpDivider:()=>ke,DcpDownload:()=>Gt,DcpDrawer:()=>fr,DcpEmpty:()=>bt,DcpForm:()=>Xo,DcpGuideTracker:()=>Su,DcpLazyLoad:()=>Ru,DcpModal:()=>wr,DcpPrint:()=>Jd,DcpRangeTableHelper:()=>ld,DcpScrollbar:()=>$t,DcpSearchHelper:()=>Gc,DcpSearchTree:()=>ql,DcpSignature:()=>Vu,DcpSpace:()=>Ce,DcpSpin:()=>St,DcpSplit:()=>lt,DcpTable:()=>Bc,DcpTabs:()=>ur,DcpTinymce:()=>gl,DcpTour:()=>kd,DcpTransition:()=>_d,DcpTreeHelper:()=>rd,DcpTreeTableHelper:()=>ed,DcpUploadFile:()=>Sl,DcpUploadImg:()=>Pl,DcpWatermark:()=>wu,Descriptions:()=>L.Descriptions,Divider:()=>L.Divider,Drawer:()=>L.Drawer,Dropdown:()=>L.Dropdown,Empty:()=>L.Empty,Form:()=>L.Form,Grid:()=>L.Grid,Image:()=>L.Image,Input:()=>L.Input,InputNumber:()=>L.InputNumber,Layout:()=>L.Layout,List:()=>L.List,Mentions:()=>L.Mentions,Menu:()=>L.Menu,Modal:()=>L.Modal,PageHeader:()=>L.PageHeader,Pagination:()=>L.Pagination,Popconfirm:()=>L.Popconfirm,Popover:()=>L.Popover,Progress:()=>L.Progress,QmAnchor:()=>ar,QmButton:()=>xe,QmCollapse:()=>je,QmConfigProvider:()=>ee,QmCopyToClipboard:()=>kc,QmCountup:()=>ht,QmCropper:()=>El,QmDivider:()=>ke,QmDownload:()=>Gt,QmDrawer:()=>fr,QmEmpty:()=>bt,QmForm:()=>Xo,QmGuideTracker:()=>Su,QmLazyLoad:()=>Ru,QmModal:()=>wr,QmPrint:()=>Jd,QmRangeTableHelper:()=>ld,QmScrollbar:()=>$t,QmSearchHelper:()=>Gc,QmSearchTree:()=>ql,QmSignature:()=>Vu,QmSpace:()=>Ce,QmSpin:()=>St,QmSplit:()=>lt,QmTable:()=>Bc,QmTabs:()=>ur,QmTinymce:()=>gl,QmTour:()=>kd,QmTransition:()=>_d,QmTreeHelper:()=>rd,QmTreeTableHelper:()=>ed,QmUploadFile:()=>Sl,QmUploadImg:()=>Pl,QmWatermark:()=>wu,Radio:()=>L.Radio,Rate:()=>L.Rate,Result:()=>L.Result,Row:()=>L.Row,Segmented:()=>L.Segmented,Select:()=>L.Select,Skeleton:()=>L.Skeleton,Slider:()=>L.Slider,Space:()=>L.Space,Spin:()=>L.Spin,Statistic:()=>L.Statistic,Steps:()=>L.Steps,Switch:()=>L.Switch,Table:()=>L.Table,Tabs:()=>L.Tabs,Tag:()=>L.Tag,TimePicker:()=>B,Timeline:()=>L.Timeline,Tooltip:()=>L.Tooltip,Transfer:()=>L.Transfer,Tree:()=>L.Tree,TreeSelect:()=>L.TreeSelect,Typography:()=>L.Typography,Upload:()=>L.Upload,message:()=>L.message,notification:()=>L.notification,pinyin:()=>ri,version:()=>zu});var a=n(442),o=n.n(a);const l=require("prop-types");var s=n.n(l);const c=(0,a.createContext)({locale:"zh-cn",size:"middle"}),d=require("dayjs");var u=n.n(d);const p={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?"},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:"删除文件"},uploadCropper:{dragableText:"拖放或点击",pasteText:"Ctrl+V 粘贴",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},tour:{prevStep:"上一步",nextStep:"下一步",finish:"结束引导"},guideTracker:{addButton:"添 加",editButton:"保 存",closeButton:"关 闭",finishButton:"结束并保存",label:"新手引导录入",currentStep:"当前步骤:"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"搜索{text}",searchAreaText:"搜索{text},用逗号隔开",gtPlaceholder:"大于",ltPlaceholder:"小于",eqPlaceholder:"等于",neqPlaceholder:"不等于",text:"筛选",nullValue:"空值"},screen:{full:"全屏",cancelFull:"取消全屏"},import:{text:"导 入",textNoSpace:"导入",success:"成功导入 {total} 条记录",error:"导入失败,请检查字段名和数据格式是否正确",settingTitle:"导入设置",importType:"导入模式",insertPos:"插入位置",fillText:"新增",addText:"追加",insertText:"插入"},export:{text:"导 出",textNoSpace:"导出",closeButton:"关 闭",settingTitle:"导出设置",fileName:"文件名",fileType:"文件类型",sheetName:"标题",all:"全部",selected:"选中",custom:"自定义",footSummation:"底部合计",useStyle:"使用样式",warnText:"暂无表格数据或正在导出"},clipboard:{text:"粘 贴",textNoSpace:"粘贴",success:"成功粘贴 {total} 条记录",settingTitle:"粘贴设置",rowIndex:"粘贴起始行",colIndex:"粘贴起始列",content:"粘贴内容",placeholder:"请在此处 ctrl+v 粘贴数据",supportText:"说明:只支持粘贴 Excel 数据"},mergeCell:{cancel:"恢复",confirm:"合并"},print:{text:"打印"},refresh:{text:"刷新"},toolbox:{text:"工具箱"},selectCollection:{text:"行选集合",settingTitle:"行选列表",closeButton:"关 闭"},groupSummary:{text:"汇总",settingTitle:"汇总设置",savedSetting:"保存的汇总设置",saveButton:"保 存",closeButton:"关 闭",confirmButton:"显示汇总",removeText:"移除",configText:"配置名称",resultText:"汇总结果",sumText:"列值汇总",maxText:"列最大值",minText:"列最小值",avgText:"列平均值",countText:"条数汇总",operation:"操作",index:"序号",groupItem:"分组项",summaryColumn:"汇总列",calcFormula:"计算公式"},highSearch:{text:"高级检索",settingTitle:"高级检索设置",searchButton:"开始检索",closeButton:"关 闭",removeText:"移除",andText:"并且",orText:"或者",gtText:"大于",ltText:"小于",gteText:"大于等于",lteText:"小于等于",eqText:"等于",neqText:"不等于",inText:"包含",ninText:"不包含",likeText:"模糊匹配",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",tabPanes:["查找条件","更多条件"],matchCase:"大小写匹配",matchFullchar:"全字符匹配",clear:"清空条件",queryPrev:"查找上一个",queryNext:"查找下一个"}}}};require("dayjs/locale/zh-cn");let h=p;function m(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,r)=>t[r])):e}const f=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const[n,i]=t;let a;const o=n.split(".");let l=h;for(let e=0,t=o.length;e<t;e++){if(a=l[o[e]],e===t-1)return m(a,i);if(!a)return"";l=a}return""},g=e=>{h=e||h,h.name&&u().locale(h.name)};class b extends Error{constructor(e){super(e),this.name="QmDesignError"}}function y(e,t){throw new b(`[${e}] ${t}`)}function v(e,t){console.warn(new b(`[${e}] ${t}`))}const x=e=>["","small","middle","large"].includes(e),E=require("dayjs/plugin/localeData");var S=n.n(E);const w=require("dayjs/plugin/advancedFormat");var C=n.n(w);const T=require("dayjs/plugin/customParseFormat");var N=n.n(T);const I=require("dayjs/plugin/quarterOfYear");var R=n.n(I);const P=require("dayjs/plugin/weekOfYear");var O=n.n(P);const k=require("dayjs/plugin/weekday");var A=n.n(k);u().extend(S()),u().extend(C()),u().extend(N()),u().extend(R()),u().extend(O()),u().extend(A());const L=require("antd"),F=require("rc-picker/es/generate/dayjs");var H=n.n(F);const _=require("antd/es/calendar/generateCalendar");var D=n.n(_);require("antd/es/calendar/style");const $=D()(H()),q=require("antd/es/date-picker/generatePicker");var M=n.n(q);require("antd/es/date-picker/style/index");const j=M()(H());function K(){return K=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},K.apply(this,arguments)}const V=a.forwardRef(((e,t)=>a.createElement(j,K({},e,{picker:"time",mode:void 0,ref:t}))));V.displayName="TimePicker";const z=a.forwardRef(((e,t)=>a.createElement(j.RangePicker,K({},e,{picker:"time",mode:void 0,ref:t}))));z.displayName="RangePicker",V.RangePicker=z;const B=V,U={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?"},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"},uploadCropper:{dragableText:"Drop or click",pasteText:"Ctrl+V Paste",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},tour:{prevStep:"Prev",nextStep:"Next",finish:"Finish"},guideTracker:{addButton:"Add To",editButton:"Save",closeButton:"Close",finishButton:"Finish And Save",label:"Operation guide collection",currentStep:"Current Step: "},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Search {text}",searchAreaText:"Search {text}, separated by commas",gtPlaceholder:"is greater than",ltPlaceholder:"is lesser than",eqPlaceholder:"is equal to",neqPlaceholder:"is not equal to",text:"Filter",nullValue:"Null Value"},screen:{full:"Full Screen",cancelFull:"Cancel Full Screen"},import:{text:"Import",textNoSpace:"Import",success:"Successfully imported {total} records",error:"Import failed, please check that the field name and data format are correct.",settingTitle:"Import setting",importType:"Import type",insertPos:"Insertion position",fillText:"fill",addText:"add",insertText:"insert"},export:{text:"Export",textNoSpace:"Export",closeButton:"Close",settingTitle:"Export setting",fileName:"File name",fileType:"File type",sheetName:"Title",all:"All",selected:"Selected",custom:"Custom",footSummation:"Summation",useStyle:"Use style",warnText:"No table data or exporting"},clipboard:{text:"Paste",textNoSpace:"Paste",success:"Successfully paste {total} records",settingTitle:"Paste setting",rowIndex:"Start row index",colIndex:"Start col index",content:"content",placeholder:"Please paste data here with ctrl+v",supportText:"Note: only excel data can be pasted"},mergeCell:{cancel:"reset",confirm:"merge"},print:{text:"Print"},refresh:{text:"Reload"},toolbox:{text:"Tool box"},selectCollection:{text:"Selected row collection",settingTitle:"Selected row list",closeButton:"Close"},groupSummary:{text:"Summary",settingTitle:"Summary setting",savedSetting:"Saved configuration",saveButton:"Save",closeButton:"Close",confirmButton:"Show summary",removeText:"Remove",configText:"Configuration name",resultText:"Summary result",sumText:"column value summary",maxText:"column max value",minText:"column min value",avgText:"column avg value",countText:"records summary",operation:"Operation",index:"Index",groupItem:"Group item",summaryColumn:"Summary column",calcFormula:"Calculate formula"},highSearch:{text:"Super search",settingTitle:"Super search setting",searchButton:"Start search",closeButton:"Close",removeText:"Remove",andText:"and",orText:"or",gtText:"is greater than",ltText:"is lesser than",gteText:"is equal or greater than",lteText:"is equal or lesser than",eqText:"is equal to",neqText:"is not equal to",inText:"include",ninText:"not include",likeText:"fuzzy matching",configText:"Configuration name",saveButton:"Save",savedSetting:"Saved configuration",operation:"Operation",bracket:"Bracket",fieldName:"Field name",fieldType:"Field type",expression:"Expression",condition:"Condition value",logic:"Logic",noEmpty:"Can not be empty"},fastSearch:{text:"Records location search",settingTitle:"Records location search setting",closeButton:"Close",savedSetting:"Saved configuration",queryCondition:"Please enter query condition",notMatch:"There are no qualified records!",toTheEnd:"It has been found to the end. Do you want to find it from the beginning?",toStart:"The start has been found. Do you want to start from the end?",tabPanes:["Search condition","More conditions"],matchCase:"Case matching",matchFullchar:"Full character matching",clear:"Clear condition",queryPrev:"Find previous",queryNext:"Find next"}}}},W=require("antd/es/locale/zh_CN");var G=n.n(W);const Y=require("antd/es/locale/en_GB");var X=n.n(Y);function Q(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Z={[U.name]:{qm:U,antd:X()},[p.name]:{qm:p,antd:G()}};class J extends a.Component{constructor(e){super(e),this.state={value:{locale:e.locale,size:e.size,global:e.global}},g(Object.assign({},Z,e.global.langPackage)[e.locale].qm)}static getDerivedStateFromProps(e,t){const{locale:r,size:n}=t.value,{locale:i,size:a,global:o}=e;return i!==r&&g(Object.assign({},Z,o.langPackage)[i].qm),i!==r||a!==n?{value:Object.assign({},t.value,{locale:i,size:a})}:null}render(){const{global:e}=this.props,{value:t}=this.state,r=Object.assign({},Z,e.langPackage);return o().createElement(c.Provider,{value:t},o().createElement(L.ConfigProvider,{locale:r[t.locale].antd,componentSize:t.size,autoInsertSpaceInButton:e.autoInsertSpaceInButton},this.props.children))}}Q(J,"propTypes",{locale:s().string,size:(e,t,r)=>{if(!x(e[t]||""))return y("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},theme:s().string,global:s().object}),Q(J,"defaultProps",{locale:"zh-cn",size:"middle",global:{}});const ee=J,te=require("omit.js");var re=n.n(te);const ne=require("lodash-es"),ie="undefined"==typeof window,ae=e=>o().isValidElement(e),oe=e=>ae(e)&&e.type===o().Fragment,le=()=>{},se=()=>!0,ce=async e=>new Promise((t=>setTimeout(t,e))),de=e=>{Promise.resolve().then(e)},ue=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),pe=e=>!!(!e&&0!==e||(0,ne.isArray)(e)&&!e.length||(0,ne.isPlainObject)(e)&&!Object.keys(e).length),he=(e,t)=>t.split(".").reduce(((e,t)=>e?.[t]),e),me=(e,t,r)=>{const n=t.split(".");let i=e;for(let e=0;e<n.length-1;e++){const t=n[e];i[t]&&(0,ne.isPlainObject)(i[t])||(i[t]={}),i=i[t]}i[n[n.length-1]]=r},fe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if((0,ne.isPlainObject)(e)||(0,ne.isArray)(e)){const r=Array.isArray(e),n=r?[]:{};if(t.get(e))return e;t.set(e,n);const i=r?void 0:Object.keys(e);return function(e,t){let r=-1;const n=e.length;for(;++r<n;)t(e[r],r)}(i||e,((r,a)=>{i&&(a=r),n[a]=fe(e[a],t)})),n}return e},ge=e=>(0,ne.isNumber)(e)?`${e}px`:e.toString();function be(){return be=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},be.apply(this,arguments)}function ye(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ve extends a.Component{constructor(){super(...arguments),ye(this,"context",void 0),ye(this,"state",{isLoading:!1}),ye(this,"clickHandle",(async e=>{this.setState({isLoading:!0});try{await(this.props.click?.(e))}catch(e){v("Button","`click`方法执行出错")}this.setState({isLoading:!1})}))}render(){const{size:e,loading:t,authConfig:r,click:n,confirm:i}=this.props,{isLoading:a}=this.state,l=e||this.context.size||"",s=(0,ne.isFunction)(n)?{onClick:this.clickHandle}:null,c={...re()(this.props,["authConfig","click","confirm"]),size:l,loading:a||t||!1,...s};if(r){const{visible:e=1,disabled:t}=r||{};if(!e)return null;t&&(c.disabled=!0)}return i?o().createElement(L.Popconfirm,{title:i.title||f("qm.button.confirmTitle"),disabled:c.disabled,onConfirm:e=>{i.onConfirm?.(),c.onClick?.(e)},onCancel:e=>{i.onCancel?.(e)}},o().createElement(L.Button,be({},c,{onClick:le}),this.props.children)):o().createElement(L.Button,c,this.props.children)}}ye(ve,"propTypes",{click:s().func,confirm:s().shape({title:s().node,onConfirm:s().func,onCancel:s().func})}),ye(ve,"contextType",c);const xe=ve;function Ee(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Se=function(e){return e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small",e}(Se||{});class we extends a.Component{constructor(){super(...arguments),Ee(this,"context",void 0)}render(){const{size:e}=this.props,t=e||this.context.size||"",r=(0,ne.isNumber)(e)?e:Se[e||t||"default"],n={...this.props,size:r};return o().createElement(L.Space,n,this.props.children)}}Ee(we,"contextType",c);const Ce=we,Te=require("classnames");var Ne=n.n(Te);const Ie=e=>`qm-${e}`,Re=require("@ant-design/icons");function Pe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Oe extends a.Component{constructor(){super(...arguments),Pe(this,"context",void 0),Pe(this,"clickHandle",(()=>{const{collapse:e,onCollapseChange:t=le}=this.props;t(!e)}))}render(){const{size:e,label:t,extra:r,collapse:n,bordered:i,disabled:a,id:l,className:s,style:c}=this.props,d=e||this.context.size||"",u=Ie("divider"),p={[u]:!0,[`${u}-borderless`]:!i,[`${u}--lg`]:"large"===d,[`${u}--sm`]:"small"===d};return o().createElement("div",{id:l,className:Ne()(p,s),style:c},o().createElement("span",{className:Ne()(`${u}__title`)},t),o().createElement("div",{className:Ne()(`${u}__extra`)},r),void 0!==n&&o().createElement(L.Button,{type:"link",className:Ne()(`${u}__collapse`),disabled:a,onClick:this.clickHandle},f(n?"qm.divider.collect":"qm.divider.spread"),n?o().createElement(Re.UpOutlined,null):o().createElement(Re.DownOutlined,null)))}}Pe(Oe,"contextType",c),Pe(Oe,"propTypes",{label:s().string,size:(e,t,r)=>{if(!x(e[t]||""))return y("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},extra:s().oneOfType([s().element,s().string]),collapse:s().bool,bordered:s().bool}),Pe(Oe,"defaultProps",{bordered:!0});const ke=Oe,Ae=()=>({height:0,opacity:0}),Le=(e,t)=>"height"===t.propertyName,Fe={motionName:"rc-collapse-motion",onEnterStart:Ae,onEnterActive:e=>({height:e.scrollHeight,opacity:1}),onLeaveStart:e=>({height:e.offsetHeight}),onLeaveActive:Ae,onEnterEnd:Le,onLeaveEnd:Le,motionDeadline:500,leavedClassName:"rc-collapse-content-hidden"},He=require("rc-motion");var _e=n.n(He);const De=o().forwardRef(((e,t)=>{const{forceRender:r,className:n,style:i,boxStyle:a,isActive:l}=e,[s,c]=o().useState(l||r);if(o().useEffect((()=>{(r||l)&&c(!0)}),[r,l]),!s)return null;const d=Ie("collapse");return o().createElement("div",{ref:t,className:Ne()(`${d}-content`,{[`${d}-content-active`]:l,[`${d}-content-inactive`]:!l},n),style:i},o().createElement("div",{className:`${d}-content-box`,style:a},e.children))}));De.displayName="PanelContent";const $e=De;function qe(){return qe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qe.apply(this,arguments)}const Me=e=>{const{defaultActive:t,label:r,extra:n,className:i,style:a,containerStyle:l,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:p}=e,[h,m]=o().useState(!!t),f=Ie("collapse"),g=Ne()({[`${f}`]:!0,[`${f}-active`]:h,[`${f}-disabled`]:c},i);return o().createElement("div",{className:g,style:a},o().createElement(ke,{label:r,extra:n,collapse:h,bordered:s,disabled:c,onCollapseChange:e=>{m(e),p?.(e)}}),o().createElement(_e(),qe({visible:h},Fe,{leavedClassName:`${f}-content-hidden`,forceRender:d,removeOnLeave:u}),((t,r)=>{let{className:n,style:i}=t;return o().createElement($e,{ref:r,prefixCls:f,className:n,style:i,boxStyle:l,isActive:h,forceRender:d},e.children)})))};Me.displayName="QmCollapse";const je=Me,Ke=o().createContext(void 0);function Ve(e,t){((t,r)=>{const n=a.useRef(!0);a.useEffect((()=>(t=>{if(!t)return e()})(n.current)),r),a.useEffect((()=>(n.current=!1,()=>{n.current=!0})),[])})(0,t)}const ze=(e,t,r)=>{e&&t&&r&&e.addEventListener(t,r,!1)},Be=(e,t,r)=>{e&&t&&r&&e.removeEventListener(t,r,!1)},Ue=e=>e.stopPropagation(),We=e=>e.preventDefault(),Ge=(e,t)=>{if(ie||!e||!t)return null;"float"===(t=ue(t))&&(t="cssFloat");try{const r=e.style[t];if(r)return r;const n=window.getComputedStyle(e);return n?n[t]:""}catch(r){return e.style[t]}},Ye=(e,t,r)=>{!ie&&e&&t&&((0,ne.isPlainObject)(t)?Object.keys(t).forEach((r=>{Ye(e,r,t[r])})):(t=ue(t),e.style[t]=r))},Xe=e=>{let t=0,r=e;for(;r;)t+=r.offsetTop,r=r.offsetParent;return t},Qe=(e,t)=>Math.abs(Xe(e)-Xe(t)),Ze=e=>{let t=0,r=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,r+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:r}},Je=(e,t)=>{let r=e;for(;r;){if(r.classList?.contains(t))return r;r=r.parentNode}return null},et=(e,t)=>{if(ie||!e||!t)return!1;let r=e;for(;r;){if(r===t)return!0;r=r.parentNode}return!1},tt=e=>{const{minValues:t,onDragChange:r,onDragging:n}=e,{splitRef:i,direction:a}=o().useContext(Ke),l=o().useRef(ie?null:document.onselectstart),s=o().useMemo((()=>"horizontal"===a),[a]),c=o().useMemo((()=>s?"X":"Y"),[s]),d=o().useRef({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),u=e=>{d.current=Object.assign({},d.current,e)},p=e=>{if(1!==e.buttons)return h();const r=e[`page${c}`]-d.current[`start${c}`],i=[t[0],d.current[`containerSize${c}`]-t[1]];let a=d.current[`firstElementSize${c}`]+r;a=Math.max(i[0],a),a=Math.min(i[1],a),n(a)},h=()=>{u({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),r(!1),Be(document,"mousemove",p),Be(document,"mouseup",h),m()},m=()=>{document.onselectstart!==l.current&&(document.onselectstart=l.current)},g=Ie("split"),b={[`${g}__resize-bar`]:!0,vertical:"vertical"===a,horizontal:"horizontal"===a};return o().createElement("div",{className:Ne()(b),title:f("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=i.current,n=t.children[0];u({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),ze(document,"mousemove",p),ze(document,"mouseup",h),r(!0),l.current=document.onselectstart,document.onselectstart=()=>!1}})};tt.displayName="ResizeBar";const rt=tt,nt=o().forwardRef(((e,t)=>{const{offset:r,className:n,style:i}=e,{direction:a,dragging:l}=o().useContext(Ke),s="vertical"===a?"height":"width",c=Ie("split-pane"),d={[c]:!0,isLocked:l,horizontal:"horizontal"===a,vertical:"vertical"===a,[n]:!!n},u=void 0!==r?{[s]:ge(r)}:{flex:1,[s]:0};return o().createElement("div",{ref:t,className:Ne()(d),style:{...u,...i}},e.children)}));nt.displayName="QmSplitPane";const it=nt;function at(){return at=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},at.apply(this,arguments)}const ot=e=>{const{direction:t="horizontal",defaultValue:r="50%",uniqueKey:n,className:i,style:a,onDragStart:l,onDrag:s=le,onDragEnd:d}=e,{global:u}=o().useContext(c),p=o().useRef(null),h=o().useRef(null),m=e=>Number(e)>0?`${e}px`:(e=>["px","em","vw","vh","%"].some((t=>e.endsWith(t))))(e.toString())?e.toString():`${Number.parseFloat(e)}px`,f=e=>Number.parseInt(e,10),g=e=>{const t=Number.parseInt(e.props?.min||0);return t>=0?t:0},b=o().useMemo((()=>n?`split_${n}`:""),[n]),[y,v]=o().useState(!1),[x,E]=o().useState(m(r));Ve((()=>{y?l?.(f(x)):(d?.(f(x)),localStorage.setItem(b,x),C(b,x))}),[y]),o().useEffect((()=>{S()}),[]);const S=()=>{if(!b)return;const e=localStorage.getItem(b);e?E(m(e)):w(b).then((e=>{localStorage.setItem(b,m(e||r)),S()})).catch((()=>{}))},w=async e=>{const t=u?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},C=async(e,t)=>{const r=u?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},T=o().useMemo((()=>({splitRef:p,direction:t,dragging:y})),[t,y]),N=[];o().Children.map(e.children,(e=>{ae(e)&&!oe(e)&&"QmSplitPane"===e.type?.displayName&&N.push(e)}));const[I,R]=N,P=o().useMemo((()=>[g(I),g(R)]),[I,R]),O=Ie("split"),k={[O]:!0,vertical:"vertical"===t};return o().createElement(Ke.Provider,{value:T},o().createElement("div",{ref:p,className:Ne()(k,i),style:a},o().createElement(it,at({},I.props,{ref:h,offset:x})),o().createElement(rt,{minValues:P,onDragChange:e=>v(e),onDragging:e=>{E(`${e}px`),s(e)}}),o().createElement(it,R.props)))};ot.Pane=it,ot.displayName="QmSplit";const lt=ot,st=require("react-countup");var ct=n.n(st);function dt(){return dt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},dt.apply(this,arguments)}function ut(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class pt extends a.Component{constructor(){super(...arguments),ut(this,"context",void 0)}render(){const{size:e,className:t,style:r}=this.props,n=e||this.context.size||"",i=Ie("countup"),a={[i]:!0,[`${i}--lg`]:"large"===n,[`${i}--sm`]:"small"===n};return o().createElement(ct(),dt({},this.props,{className:Ne()(a,t),style:r}),this.props.children)}}ut(pt,"defaultProps",{duration:2}),ut(pt,"contextType",c);const ht=pt;function mt(){return mt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mt.apply(this,arguments)}function ft(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class gt extends a.Component{constructor(){super(...arguments),ft(this,"context",void 0)}render(){const{size:e,className:t}=this.props,r=e||this.context.size||"",n=Ie("empty"),i={...this.props,image:L.Empty.PRESENTED_IMAGE_SIMPLE},a={[n]:!0,[`${n}--lg`]:"large"===r,[`${n}--sm`]:"small"===r};return o().createElement(L.Empty,mt({},i,{className:Ne()(a,t)}))}}ft(gt,"contextType",c),ft(gt,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const bt=gt;class yt extends a.Component{render(){const{fullHeight:e,className:t,style:r={}}=this.props,n=Ie("spin"),i={[`${n}-full-height`]:e},a={wrapperClassName:Ne()(i,t),...re()(this.props,["fullHeight"]),style:{...r,maxHeight:"none"}};return o().createElement(L.Spin,a,this.props.children)}}var vt,xt,Et;vt=yt,Et={tip:"Loading...",fullHeight:!1},(xt=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(xt="defaultProps"))in vt?Object.defineProperty(vt,xt,{value:Et,enumerable:!0,configurable:!0,writable:!0}):vt[xt]=Et;const St=yt,wt=o().createContext(void 0),Ct=require("resize-observer-polyfill");var Tt=n.n(Ct);const Nt=function(e){for(const t of e){const e=t.target.__resizeListeners__||[];Array.isArray(e)&&e.length&&e.forEach((e=>e(t)))}},It=function(e,t){!ie&&e&&(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new(Tt())(Nt),e.__ro__.observe(e)),e.__resizeListeners__.push(t))},Rt=function(e,t){e&&e.__resizeListeners__&&(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||e.__ro__?.disconnect())};function Pt(e){const[t,r]=a.useState({width:0,height:0});return a.useLayoutEffect((()=>{const t=e.current,n=e=>{const{width:t,height:n}=e.contentRect;r({width:t,height:n})};return t&&It(t,n),()=>{t&&Rt(t,n)}}),[e]),t}const Ot=(e,t)=>{const r=a.useRef(!0);a.useLayoutEffect((()=>e(r.current)),t),a.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function kt(e,t){Ot((t=>{if(!t)return e()}),t)}function At(e,t){var r=this;const n=a.useRef(null);a.useEffect((()=>()=>{clearTimeout(n.current),n.current=null}),[]);const i=a.useCallback((function(){for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];n.current&&clearTimeout(n.current),n.current=setTimeout((()=>e.apply(r,a)),t)}),[e,t]);return i}const Lt=6,Ft={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"}},Ht=e=>{const{thumb:t,always:r,barSize:n=Lt,direction:i="vertical",onDrag:a=le}=e,{dragging:l,scrollbarElement:s,wrapElement:c}=o().useContext(wt),d=Ft[i],u=o().useRef(t),p=o().useRef(null),h=o().useRef(null),m=o().useRef({}),f=o().useRef(!1),g=o().useRef(!1),b=o().useRef(ie?null:document.onselectstart),[y,v]=o().useState(!1);o().useLayoutEffect((()=>{u.current=t}),[t]),o().useEffect((()=>{const e=s.current;return ze(e,"mousemove",w),ze(e,"mouseleave",C),()=>{S(),Be(document,"mouseup",E),Be(e,"mousemove",w),Be(e,"mouseleave",C)}}),[]);const x=e=>{if(!p.current||!h.current)return;if(!f.current)return;const t=m.current[d.axis];if(!t)return;const r=100*(-1*(p.current.getBoundingClientRect()[d.direction]-e[d.client])-(h.current[d.offset]-t))/p.current[d.offset];c.current[d.scroll]=r*c.current[d.scrollSize]/100,a(!0)},E=()=>{f.current=!1,m.current={[d.axis]:0},Be(document,"mousemove",x),Be(document,"mouseup",E),S(),g.current&&v(!1),a(!1)},S=()=>{document.onselectstart!==b.current&&(document.onselectstart=b.current)},w=()=>{g.current=!1,v(!!u.current.size)},C=()=>{g.current=!0,v(f.current)},T=Ie("scrollbar"),N={[`${T}__bar`]:!0,"is-vertical":"vertical"===i,"is-horizontal":"horizontal"===i},I={[d.reverse]:n},R={[d.size]:t.size,transform:`translate${d.axis}(${t.offset}%)`};return o().createElement(_d,{name:"fade",in:r||l||y,timeout:300},o().createElement("div",{ref:p,className:Ne()(N),style:I},o().createElement("div",{ref:h,className:`${T}__thumb`,style:R,onMouseDown:e=>{e.stopPropagation(),ze(document,"mousemove",x),ze(document,"mouseup",E),f.current=!0,b.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(m.current={[d.axis]:t[d.offset]-(e[d.client]-t.getBoundingClientRect()[d.direction])})}})))},_t=20,Dt=o().forwardRef(((e,t)=>{const{wrapClassName:r,wrapStyle:n,barWidth:i,always:a,native:l,minSize:s=_t,onScroll:c}=e,d=o().useRef(null),u=o().useRef(null),p=o().useRef(null),[h,m]=o().useState({size:0,offset:0,ratio:1}),[f,g]=o().useState({size:0,offset:0,ratio:1}),[b,y]=o().useState(!1),x=Pt(d),E=Pt(p);kt((()=>{!l&&S()}),[E.width,E.height,x.width,x.height]);const S=At((()=>{if(!u.current)return;const e=u.current.offsetHeight-4,t=u.current.offsetWidth-4,r=e**2/u.current.scrollHeight,n=t**2/u.current.scrollWidth,i=Math.max(r,s),a=Math.max(n,s),o=r/(e-r)/(i/(e-i)),l=n/(t-n)/(a/(t-a)),c=i+4<e?i:0,d=a+4<t?a:0,p=100*u.current.scrollTop/e*o,b=100*u.current.scrollLeft/t*l;m(Object.assign({},h,{size:d,ratio:l,offset:b})),g(Object.assign({},f,{size:c,ratio:o,offset:p}))}),5),w=e=>{y(e)},C=e=>{(0,ne.isNumber)(e)?u.current.scrollTop=e:v("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=e=>{(0,ne.isNumber)(e)?u.current.scrollLeft=e:v("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};o().useImperativeHandle(t,(()=>({container:d.current,scrollTop:u.current?.scrollTop||0,scrollLeft:u.current?.scrollLeft||0,SET_SCROLL_TOP:C,SET_SCROLL_LEFT:T})));const N=o().useMemo((()=>({dragging:b,scrollbarElement:d,wrapElement:u})),[b]),I=Ie("scrollbar"),R={[`${I}__wrap`]:!0,[`${I}__wrap--hidden`]:!l};return o().createElement("div",{ref:d,className:Ne()(I,e.className),style:e.style},o().createElement("div",{ref:u,className:Ne()(R,r),style:n,onScroll:e=>{const{scrollTop:t,scrollLeft:r}=e.target;!l&&(()=>{if(!u.current)return;const e=u.current.offsetHeight-4,t=u.current.offsetWidth-4,r=100*u.current.scrollTop/e*f.ratio,n=100*u.current.scrollLeft/t*h.ratio;m(Object.assign({},h,{offset:n})),g(Object.assign({},f,{offset:r}))})(),c?.({scrollTop:t,scrollLeft:r})}},o().createElement("div",{ref:p,className:`${I}__view`},e.children)),!l&&o().createElement(wt.Provider,{value:N},o().createElement(Ht,{direction:"horizontal",thumb:h,barSize:i,always:a,onDrag:w}),o().createElement(Ht,{direction:"vertical",thumb:f,barSize:i,always:a,onDrag:w})))}));Dt.displayName="QmScrollbar";const $t=Dt,qt=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const r=window.URL.createObjectURL(e);let n=document.createElement("a");n.href=r,n.download=decodeURI(t),n.click(),n=null}};function Mt(){return Mt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Mt.apply(this,arguments)}function jt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Kt=async(e,t)=>{let{fileName:r,headers:n,params:i}=t;const a=i?new URLSearchParams(i).toString():"",o=a?e.includes("?")?"&":"?":"",l=await fetch(e+`${o+a}`,{method:"GET",headers:n});if(!l.ok)throw new Error(f("qm.download.error"));const s=await l.blob(),c=l.headers.get("content-disposition"),d=r||(c?c.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));qt(s,d)};class Vt extends a.Component{constructor(){super(...arguments),jt(this,"context",void 0),jt(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:i=[],fileSize:a,maxCount:o,fileList:l=[],beforeUpload:s}=this.props,c=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),d=!a||e.size/1024/1024<a,u=!(o>1)||l.length<o,p=c&&d&&u;if(c||L.message.warning(f("qm.upload.tooltip",{type:i.join(",")})),d||L.message.warning(f("qm.upload.sizeLimit",{size:a})),u||L.message.warning(f("qm.upload.countLimit",{count:o})),!p)return L.Upload.LIST_IGNORE;if(s){const i=s(e,t);if(!0===i)return r(e);if(!1===i)return n("not upload");if(i&&"function"==typeof i.then)try{r(await i)}catch(e){n(e)}}else r(e)})))),jt(this,"doDownload",(async e=>{const{downloadWithHeaders:t,headers:r}=this.props;try{e.url&&await Kt(e.url,{fileName:e.name,...t?{headers:r}:null})}catch(e){L.message.error(f("qm.download.error"))}}))}get $size(){return this.context.size??""}render(){const{fileList:e=[],button:t={},fileDirection:r,disabled:n,readOnly:i,className:a,onPreview:l,onChange:s}=this.props,c=Ie("upload-file"),d={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}--horizontal`]:"horizontal"===r};return o().createElement(L.Upload,Mt({className:Ne()(d,a)},re()(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,disabled:n||i,onChange:s,onPreview:async e=>{if("function"==typeof l)return l(e,(t=>this.doDownload(t||e)));n||await this.doDownload(e)},onDownload:async e=>{await this.doDownload(e)}}),this.props.children||i&&e.length?this.props.children:o().createElement(L.Button,{type:t.type??"default",icon:t.icon??o().createElement(Re.UploadOutlined,null),disabled:n||i},t.text||f("qm.upload.text")))}}jt(Vt,"contextType",c),jt(Vt,"defaultProps",{name:"file",multiple:!0,fileDirection:"vertical",showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}});const zt=Vt;function Bt(){return Bt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Bt.apply(this,arguments)}function Ut(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Wt extends a.Component{constructor(){super(...arguments),Ut(this,"context",void 0),Ut(this,"state",{loading:!1}),Ut(this,"downloadHandle",(async()=>{this.setState({loading:!0});try{const{action:e,fileName:t,headers:r,params:n,beforeDownload:i=se}=this.props,a=(0,ne.isString)(e)?e:await this.getActionUrl();if(!a)return v("Download","参数 `action` 有误!");if(!i(a))return;await Kt(a,{fileName:t,headers:r,params:n}),await ce(100),this.props.onSuccess?.(),L.message.success(f("qm.download.success"))}catch(e){this.props.onError?.(e),L.message.error(f("qm.download.error"))}this.setState({loading:!1})}))}async getActionUrl(){const e=this.props.action;if(e.api)try{const t=await e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}render(){const{size:e}=this.props,{loading:t}=this.state,r=e||this.context.size||"",n=re()(this.props,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return o().createElement(L.Button,Bt({},n,{size:r,loading:t,onClick:this.downloadHandle}),this.props.children)}}Ut(Wt,"propTypes",{action:s().oneOfType([s().string,s().shape({api:s().func.isRequired,params:s().object})]),size:(e,t,r)=>{if(!x(e[t]||""))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},fileName:s().string,headers:s().object,withCredentials:s().bool,params:s().object,beforeDownload:s().func,onSuccess:s().func,onError:s().func}),Ut(Wt,"defaultProps",{icon:o().createElement(Re.DownloadOutlined,null),children:f("qm.download.text"),withCredentials:!1}),Ut(Wt,"contextType",c);const Gt=Wt,Yt=require("add-dom-event-listener");var Xt=n.n(Yt);const Qt=require("scroll-into-view-if-needed");var Zt=n.n(Qt);class Jt extends a.Component{renderLabel(){const{activeKey:e,labels:t,onTabClick:r}=this.props;return t.map(((t,n)=>{const i={item:!0,actived:n===e};return o().createElement("div",{key:n,className:Ne()(i),onClick:e=>r(n,e)},o().createElement("span",null,t))}))}render(){return o().createElement(o().Fragment,null,this.renderLabel())}}const er=Jt;class tr extends a.Component{render(){const{label:e,showDivider:t,className:r,style:n}=this.props,i=Ie("anchor-item"),a={[i]:!0};return o().createElement("div",{className:Ne()(a,r),style:n},t&&o().createElement(ke,{label:e,style:{marginBottom:10}}),this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(tr,"displayName","QmAnchorItem");const rr=tr;function nr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ir extends a.Component{get __is_conf(){return!!this.props.labelList?.length}constructor(e){super(e),nr(this,"context",void 0),nr(this,"currentState","ready"),nr(this,"itemsTotal",void 0),nr(this,"timer",void 0),nr(this,"scrollEvent",void 0),nr(this,"scrollRef",(0,a.createRef)()),nr(this,"onScrollHandle",(e=>{if("ready"!==this.currentState)return;const t=this.findCurrentIndex(e.target.scrollTop);-1!==t&&this.setState({activeKey:t})})),nr(this,"onTabClickHandle",(e=>{const t=this.getTargetElement(e);t&&(this.setState({activeKey:e}),this.currentState="stop",this.timer&&clearTimeout(this.timer),Zt()(t,{block:"start",behavior:"smooth",boundary:this.scrollRef.current}),this.timer=setTimeout((()=>this.currentState="ready"),500))})),nr(this,"SCROLL_TO_ITEM",(e=>{e=(e=e<0?0:e)>this.itemsTotal?this.itemsTotal:e,this.onTabClickHandle(e)})),this.state={activeKey:e.defaultActiveIndex||0}}componentDidMount(){this.initialHandle(),this.scrollEvent=Xt()(this.scrollRef.current,"scroll",(0,ne.throttle)(this.onScrollHandle,60))}componentWillUnmount(){this.scrollEvent.remove()}initialHandle(){const{activeKey:e}=this.state;e>0&&(this.scrollRef.current.scrollTop=Qe(this.getTargetElement(e),this.scrollRef.current))}createDistances(){const{labelList:e=[]}=this.props;return(this.__is_conf?e.map((e=>document.getElementById(e.id))):Array.from(this.scrollRef.current?.children||[])).map((e=>Qe(e,this.scrollRef.current)))}findCurrentIndex(e){const t=Math.abs(e),r=this.createDistances();let n=-1;for(let e=0;e<r.length;e++){const i=r[e],a=r[e+1]||1e4;t>=i-1&&t<a&&(n=e)}return n}getTargetElement(e){const{labelList:t=[]}=this.props;return this.__is_conf?document.getElementById(t[e].id):this.scrollRef.current.children[e]}render(){const{activeKey:e}=this.state,{size:t,labelWidth:r,tabPosition:n,labelList:i=[],onTabClick:a,className:l,style:s}=this.props,c=t||this.context.size||"",d=Ie("anchor"),u={[d]:!0,[`${d}-left`]:"left"===n,[`${d}-top`]:"top"===n,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c},p=[];o().Children.map(this.props.children,(e=>{ae(e)&&!oe(e)&&"QmAnchorItem"===e.type?.displayName&&p.push(e)}));const h=this.__is_conf?i.map((e=>e.label)):p.map((e=>e.props.label)),m=this.__is_conf?i.map((e=>e.id)):p.map(((e,t)=>e.props["data-id"]||t.toString()));return this.itemsTotal=h.length,o().createElement("div",{className:Ne()(u,l),style:s},o().createElement("div",{className:Ne()("anchor-nav"),style:{width:r?ge(r):""}},o().createElement(er,{activeKey:e,labels:h,onTabClick:(e,t)=>{this.onTabClickHandle(e),a?.({label:h[e],id:m[e]},t)}})),o().createElement("div",{ref:this.scrollRef,className:Ne()("anchor-container")},this.__is_conf?this.props.children:p))}}nr(ir,"Item",rr),nr(ir,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},labelWidth:(e,t,r)=>{if("number"!=typeof(n=e[t])&&void 0!==n&&!["px","rem","em","vw","vh","%"].some((e=>n.endsWith(e)))&&!n.startsWith("calc"))return y("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.");var n},labelList:s().arrayOf(s().shape({id:s().string,label:s().string}))}),nr(ir,"defaultProps",{tabPosition:"left"}),nr(ir,"contextType",c);const ar=ir;class or extends a.Component{render(){return o().createElement(L.Tabs.TabPane,this.props,this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(or,"displayName","QmTabPane");const lr=or;function sr(){return sr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sr.apply(this,arguments)}function cr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class dr extends a.Component{constructor(){super(...arguments),cr(this,"context",void 0)}render(){const{items:e,size:t,tabPosition:r,tabBarGutter:n,className:i,authConfig:a}=this.props,l=t||this.context.size||"",s=Ie("tabs"),c={[s]:!0,[`${s}--lg`]:"large"===l,[`${s}--sm`]:"small"===l},d={...re()(this.props,["items","authConfig"]),size:l,tabBarGutter:n??(["top","bottom"].includes(r)?30:0)},u=[];o().Children.map(this.props.children,(e=>{ae(e)&&!oe(e)&&"QmTabPane"===e.type?.displayName&&u.push(e)}));const p=e?[...e]:u.map((e=>{let{key:t,props:r}=e;return{key:t,label:r.tab,disabled:r.disabled,closable:r.closable,forceRender:r.forceRender,children:r.children}}));if(a){const{fieldList:e=[]}=a||{};for(let t=0;t<p.length;t++){const r=p[t],n=e.find((e=>e.dataIndex===r.key)),{visible:i=1,disabled:a}=n||{};i?a&&(r.disabled=!0):(p.splice(t,1),t--)}}return o().createElement(L.Tabs,sr({},d,{items:p,className:Ne()(c,i)}))}}cr(dr,"TabPane",lr),cr(dr,"contextType",c),cr(dr,"defaultProps",{tabPosition:"top"});const ur=dr;function pr(){return pr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},pr.apply(this,arguments)}function hr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class mr extends a.Component{constructor(){super(...arguments),hr(this,"context",void 0),hr(this,"titleRef",o().createRef()),hr(this,"$drawer",null),hr(this,"opened",!1),hr(this,"state",{fullscreen:!1,spinning:!1,sloading:!1}),hr(this,"afterVisibleChange",(e=>{const{loading:t}=this.props;e?(this.opened=!0,(0,ne.isUndefined)(t)&&setTimeout((()=>this.setState({spinning:!1})),100)):(this.props.onClosed?.(),this.setState({fullscreen:!1}))})),hr(this,"toggleHandle",(()=>{this.$drawer=Je(this.titleRef.current,"ant-drawer-content-wrapper"),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),hr(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),hr(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}componentWillUnmount(){this.$drawer=null}componentDidUpdate(e,t){const{visible:r,open:n,loading:i,destroyOnClose:a}=this.props,o=n??r,l=e.open??e.visible,{fullscreen:s}=this.state;o&&o!==l&&(!a&&this.opened||(0,ne.isUndefined)(i)&&this.setState({spinning:!0})),this.$drawer&&s!==t.fullscreen&&Ye(this.$drawer,s?{width:"100%"}:{width:ge(this.props.width||"72%")})}renderTitle(){const{fullscreen:e}=this.state,{title:t,showHeader:r,showFullScreen:n}=this.props;return o().createElement(o().Fragment,null,o().createElement("span",{ref:this.titleRef,className:Ne()("text")},r&&t),n&&o().createElement("button",{type:"button",className:Ne()("full-screen"),onClick:this.toggleHandle},o().createElement(e?Re.FullscreenExitOutlined:Re.FullscreenOutlined)))}render(){const{spinning:e,sloading:t}=this.state,{visible:r,open:n,size:i,className:a,loading:l,showHeader:s,maskClosable:c,onClose:d}=this.props,u=this.context.global,p=i||this.context.size||"",h=Ie("drawer"),m={[h]:!0,"no-header":!s,[`${h}--lg`]:"large"===p,[`${h}--sm`]:"small"===p};return o().createElement(L.Drawer,pr({},re()(this.props,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:n??r,maskClosable:c??u?.maskClosable??!1,className:Ne()(m,a),title:this.renderTitle(),footer:null,onClose:d,afterOpenChange:this.afterVisibleChange}),this.props.children,(l||t||e)&&o().createElement(St,{spinning:!0,className:Ne()("spinning")}))}}hr(mr,"contextType",c),hr(mr,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Drawer","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:s().bool}),hr(mr,"defaultProps",{width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null});const fr=mr,gr=require("react-draggable");var br=n.n(gr);function yr(){return yr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},yr.apply(this,arguments)}function vr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const xr="10vh";var Er=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none",e}(Er||{});class Sr extends a.Component{constructor(){super(...arguments),vr(this,"context",void 0),vr(this,"$event",null),vr(this,"draggleRef",o().createRef()),vr(this,"opened",!1),vr(this,"state",{fullscreen:!1,spinning:!1,sloading:!1,disabled:!0,bounds:{left:0,top:0,bottom:0,right:0},position:void 0}),vr(this,"addMouseDownEvent",(()=>{this.$event||(this.$event=Xt()(document.body,"mousedown",Ue))})),vr(this,"removeMouseDownEvent",(()=>{this.$event&&(this.$event?.remove(),this.$event=null)})),vr(this,"onStart",((e,t)=>{const{clientWidth:r,clientHeight:n}=window.document.documentElement,i=this.draggleRef.current.getBoundingClientRect();i&&this.setState({bounds:{left:-i.left+t.x,right:r-(i.right-t.x)-1,top:-i.top+t.y,bottom:n-(i.bottom-t.y)-1}})})),vr(this,"toggleHandle",(e=>{const t=Je(e.target,"ant-modal");if(!t)return;const r=t.querySelector(".ant-modal-body"),{width:n,height:i,showHeader:a}=this.props,{fullscreen:o}=this.state;o?(Ye(t,{width:ge(n||"60%"),height:"auto",top:xr}),Ye(r,{height:i?ge(i):this.defaultHeight,maxHeight:"auto"===i?this.defaultHeight:""})):(Ye(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Ye(r,{height:`calc(100vh - ${Er[a?this.$size:"none"]}px)`,maxHeight:""})),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),vr(this,"afterVisibleChange",(()=>{const{onClosed:e}=this.props;e?.(),this.setState({fullscreen:!1})})),vr(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),vr(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}get $size(){const{size:e}=this.props;return e||this.context.size||""}get defaultHeight(){return`calc(100vh - ${xr} - ${xr} - ${Er[this.props.showHeader?this.$size:"none"]}px)`}componentDidUpdate(e,t){const{visible:r,open:n,loading:i,stopMouseDownEvent:a,destroyOnClose:o}=this.props,l=n??r,s=e.open??e.visible,{fullscreen:c}=this.state;if(l&&l!==s){if(!o&&this.opened||(0,ne.isUndefined)(i)&&this.setState({spinning:!0}),a&&this.addMouseDownEvent(),!o&&this.opened)return;setTimeout((()=>{this.opened=!0,(0,ne.isUndefined)(i)&&this.setState({spinning:!1})}),400)}l||this.removeMouseDownEvent(),c!==t.fullscreen&&(c?this.setState({position:{x:0,y:0}}):this.setState({position:void 0}))}renderTitle(){const{fullscreen:e,disabled:t}=this.state,{title:r,showHeader:n,showFullScreen:i}=this.props;return o().createElement("div",{onMouseOver:()=>{t&&this.setState({disabled:!1})},onMouseOut:()=>{this.setState({disabled:!0})}},o().createElement("span",{className:Ne()("text")},n&&r),i&&o().createElement("button",{type:"button",className:Ne()("full-screen"),onClick:this.toggleHandle},o().createElement(e?Re.FullscreenExitOutlined:Re.FullscreenOutlined)))}render(){const{spinning:e,sloading:t,fullscreen:r,disabled:n,bounds:i,position:a}=this.state,{visible:l,open:s,height:c,className:d,loading:u,draggable:p,showHeader:h,maskClosable:m,bodyStyle:f,onClose:g}=this.props,b=this.context.global,y=Ie("modal"),v={height:c?ge(c):this.defaultHeight,maxHeight:"auto"===c?this.defaultHeight:"",overflow:"auto"},x={[y]:!0,"no-header":!h,[`${y}--lg`]:"large"===this.$size,[`${y}--sm`]:"small"===this.$size};return o().createElement(L.Modal,yr({},re()(this.props,["visible","loading","showFullScreen","maskClosable","stopMouseDownEvent","onClose","onClosed"]),{open:s??l,maskClosable:m??b?.maskClosable??!1,className:Ne()(x,d),title:this.renderTitle(),footer:null,bodyStyle:Object.assign({},v,f),onCancel:g,afterClose:this.afterVisibleChange,modalRender:e=>o().createElement(br(),{disabled:!p||n||r,bounds:i,position:a,onStart:(e,t)=>this.onStart(e,t)},o().createElement("div",{ref:this.draggleRef},e))}),this.props.children,(u||t||e)&&o().createElement(St,{spinning:!0,className:Ne()("spinning")}))}}vr(Sr,"contextType",c),vr(Sr,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Modal","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:s().bool}),vr(Sr,"defaultProps",{width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:xr}});const wr=Sr,Cr=require("memoize-one");var Tr=n.n(Cr);const Nr=(0,a.createContext)(void 0),Ir=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],Rr={operations:function(e){const t=e.split(" "),r=[];let n=0;r[n]=[];for(let e=0;e<t.length;e++)Ir.includes(t[e])?(r[n]=r[n].join(" "),n++,r[n]=[]):r[n].push(t[e]);return r[n]=r[n].join(" "),r},number_operations:function(e){return this.operations(e).length},string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";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 r=0,n=(e=Array.isArray(e)?e:[e]).length;r<n;r++)t+="number"==typeof e[r]?e[r]:"'"+e[r]+"'",r<n-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,r){return e.split(t).join(r)},replace_symbols:function(e){return e=this.find_replace(e," AND "," && "),e=this.find_replace(e," and "," && "),e=this.find_replace(e," OR "," || "),e=this.find_replace(e," or "," || "),e=this.find_replace(e," <> "," != "),e=this.find_replace(e," LIKE "," like "),e=this.find_replace(e," LIKES "," likes "),e=this.find_replace(e," IN "," in "),this.find_replace(e," NIN "," nin ")}},Pr=["==","<",">","<=",">=","!=","like","likes","in","nin"],Or=function(e,t){let r="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?r+=" "+e[t]+" ":r+=e[t];const n=r.split(" ").filter((e=>""!==e));for(let e=0;e<n.length;e++)Pr.includes(n[e])&&("this"!=n[e-1]?n[e-1]=t+"."+n[e-1]:n[e-1]=t),Pr.includes(n[e])&&(n.splice(e-1,3,`__query__(${n[e-1]}, '${n[e]}', ${n[e+1]})`),e-=2);return n.join(" ")},kr=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,Ar=["string","number","boolean","symbol"],Lr=e=>Ar.includes(typeof e),Fr=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Hr=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(kr,"\\$1"),"i");window.__query__=function(){return((e,t,r)=>{e=e??"";let n=!0;switch(t){case"like":n=null!==e.toString().match(Hr(r));break;case"likes":n=r.split(/,|,/).some((t=>null!==e.toString().match(Hr(t))));break;case"in":Lr(r)&&(r=[r]),Array.isArray(r)&&(n=Array.isArray(e)?r.every((t=>e.includes(t))):r.includes(e));break;case"nin":Lr(r)&&(r=[r]),Array.isArray(r)&&(n=!(Array.isArray(e)?r.some((t=>e.includes(t))):r.includes(e)));break;case"!=":case"<>":n=(Fr(e)?e.slice(0,10):e)!=r;break;case"<":n=(Fr(e)?e.slice(0,10):e)<r;break;case"<=":n=(Fr(e)?e.slice(0,10):e)<=r;break;case">":n=(Fr(e)?e.slice(0,10):e)>r;break;case">=":n=(Fr(e)?e.slice(0,10):e)>=r;break;default:n=(Fr(e)?e.slice(0,10):e)==r}return n})(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])};const _r=Rr.stringify,Dr=Rr.array_format,$r=function(e){let t=0;const r=e.length;for(let n=0;n<r;n++){const r=e.charAt(n);"("===r&&t++,")"===r&&t--}return 0===t},qr=(e,t,r)=>{let n=[];t=Rr.replace_symbols(t);try{if(r){const r=new Function("record",`return ${Or(t,"record")};`);n=yn(e,(e=>r(e)))}else{const r=new Function("array","i",`return ${Or(t,"array[i]")};`);for(let t=0,i=e.length;t<i;t++)r(e,t)&&n.push(e[t])}}catch(t){v("Table","组件 `initialFilter` 参数有误!"),n=e}return n},Mr=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...Mr(e.children)):t.push(e)})),t},jr=e=>e.filter((e=>(e.children&&(e.children=jr(e.children)),!e.hidden&&!e.noAuth))),Kr=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Kr(e.children))})),t},Vr=(e,t)=>e.map((e=>(e.children&&(e.children=Vr(e.children,t)),t?.(e),e))),zr=(e,t)=>{for(const r of e){if(r.dataIndex===t)return r;if(r.children){const e=zr(r.children,t);if(e)return e}}return null},Br=e=>{const t=e.children;return t?t[0].children?Br(t[0]):t[0]:e},Ur=e=>{const t=e.children;return t?t[t.length-1].children?Ur(t[t.length-1]):t[t.length-1]:e},Wr=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Gr=(e,t)=>{for(const r of e){if(r.rowKey===t)return r;if(r.children){const e=Gr(r.children,t);if(e)return e}}return null},Yr=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Yr(e.children))})),t},Xr=e=>{let t=1;const r=(e,n)=>{if(n&&(e.level=n.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((n=>{e.fixed?n.fixed=e.fixed:delete n.fixed,r(n,e),t+=n.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,r(e,null)}));const n=[];for(let e=0;e<t;e++)n.push([]);return Kr(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n},Qr=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{left:0,top:0};if(e){const n=e.parentNode;if(r.top+=e.offsetTop,r.left+=e.offsetLeft,n&&n!==document.documentElement&&n!==document.body&&(r.top-=n.scrollTop,r.left-=n.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return Qr(e.offsetParent,t,r)}return r},Zr=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,Jr=(e,t)=>(0,ne.transform)(e,((e,r,n)=>{(0,ne.isEqual)(r,t[n])||(e[n]=(0,ne.isPlainObject)(r)&&(0,ne.isPlainObject)(t[n])?Jr(r,t[n]):r)})),en=(e,t)=>(0,ne.get)(e,t)??"",tn=(e,t,r,n)=>{n>=0&&null!=r&&(r=Number(r).toFixed(n)),(0,ne.set)(e,t,r??"")},rn=(e,t)=>{if(!t.includes("|"))return en(e,t);const r=[];return t.split("|").forEach((t=>{t&&r.push(en(e,t))})),r.every((e=>!e))?"":r.join(" | ")},nn=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),an=e=>{const t=(e=e.toString()).split("."),r="-"===t[0].charAt(0)?"-":"";let n=r?t[0].slice(1):t[0],i="";for(;n.length>3;)i=`,${n.slice(-3)}${i}`,n=n.slice(0,n.length-3);return n&&(i=n+i),`${r}${i}${t[1]?`.${t[1]}`:""}`},on=(e,t)=>{const r=e.toString();if(!nn(r)||0===t)return e;const n=Number.parseFloat(r).toString(),i=n.indexOf(".");if(-1===i)return n+"."+"0".repeat(t);const a=Math.max(0,t-(n.length-i-1));return n+"0".repeat(a)},ln=(e,t)=>e?u()(e,t):null,sn=(e,t)=>e?u()(e).format(t):"",cn=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=(new Date).getTime();return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))},dn=e=>{const t=[];if(o().isValidElement(e)){const{children:r}=e.props;o().Children.forEach(r,(e=>{t.push(...dn(e))}))}else t.push(e);return t},un=e=>dn(e).join(""),pn=e=>e.filter((e=>!e._group)),hn=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="";if(Array.isArray(e)){let n=0;for(let i=0,a=e.length;i<a;i++){const a=e[i];if(!a.fieldName)continue;const o=Array.isArray(a.condition)?Dr(a.condition):_r(a.condition,"^");r+=`${a.bracketLeft} ${t?`${a.fieldName}|${a.fieldType}`:a.fieldName} ${a.expression} ${o} ${a.bracketRight} ${a.logic} `,n=a.logic.length}r=r.slice(0,-1*n-2)}else{const n=5;for(const n in e){const[i,a]=n.includes("|")?n.split("|"):[n,""],o=e[n];for(const e in o)r+=`${t?`${i}|${a}`:i} ${e} ${Array.isArray(o[e])?Dr(o[e]):_r(o[e],"^")} and `}r=r.slice(0,-1*n)}return r.replace(/\s+/g," ").trim()},mn=function(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((r=>{const n=JSON.stringify((t=>{const r=[];return e.forEach((e=>r.push(en(t,e)))),r})(r));t[n]=t[n]||[],t[n].push(r)})),Object.keys(t).map((e=>t[e]))},fn=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].dataIndex===t)return[e[r]];if(Array.isArray(e[r].children)){const n=fn(e[r].children,t);if(n)return[e[r],n].flat()}}},gn=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].rowKey===t)return[t];if(Array.isArray(e[r].children)){const n=gn(e[r].children,t);if(n)return[e[r].rowKey,n].flat()}}},bn=(e,t)=>{for(const r of e){if(Array.isArray(r.children)){const e=bn(r.children,t);if(e)return e}if(t(r))return r}return null},yn=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&yn(e.children,t),t(e)||e.children&&e.children.length))),vn=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),xn=80,En="1",Sn="0",wn=400,Cn=["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"],Tn={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let Nn=function(e){return e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year",e}({}),In=function(e){return e.date="YYYY-MM-DD HH:mm:ss",e.datetime="YYYY-MM-DD HH:mm:ss",e.exactdate="YYYY-MM-DD",e.week="YYYY-wo",e.month="YYYY-MM",e.quarter="YYYY-[Q]Q",e.year="YYYY",e}({}),Rn=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const Pn={items:s().arrayOf(s().shape({type:s().string.isRequired,fieldName:s().string.isRequired})),initialValues:s().object,initialExtras:s().object,layout:s().oneOf(["horizontal","vertical"]),size:(e,t,r)=>{if(!x(e[t]||""))return y("Form","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},cols:s().number,customClass:s().string,compactMode:s().bool,labelWidth:s().oneOfType([s().number,s().string]),labelAlign:s().oneOf(["left","right"]),labelWrap:s().bool,formType:s().oneOf(["default","search","onlyShow"]),disabled:s().bool,uniqueKey:s().string,defaultRows:s().number,defaultExpand:s().bool,searchButtonCols:s().number,scrollToFirstError:s().bool,authConfig:s().object,isAutoFocus:s().bool,isCollapse:s().bool,isFieldsDefine:s().bool,isSearchBtn:s().bool,isSubmitBtn:s().bool,fieldsChange:s().func,onValuesChange:s().func,onFieldsChange:s().func,onFinish:s().func,onFinishFailed:s().func,onReset:s().func,onCollapse:s().func},On={layout:"horizontal",labelWidth:xn,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:le,onFieldsChange:le,onFinish:le,onFinishFailed:le,onReset:le,onCollapse:le},kn=(e,t)=>{if(!e)return null;if(t===In.week){const t=e.match(/^(\d{4})-(\d+)/);return t?u()().year(Number(t[1])).week(Number(t[2])):null}if(t===In.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?u()().year(Number(t[1])).quarter(Number(t[2])):null}return u()(e,t)},An=(e,t)=>e?u()(e).format(t):"",Ln=e=>""===e||null==e,Fn=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let n="";for(let t=0,i=r.length;t<i;t++)n+=(e[r[t].trim()]??"")+(t===i-1?"":" | ");return n},Hn=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const i=t[n].split("|"),a=r[n].split("|");i.forEach(((t,r)=>e[t]=e[a[r]]))}else e[t[n]]=e[r[n]]},_n=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const i=t[n].split("|"),a=r[n].split("|");i.forEach(((t,r)=>e[t]=e[a[r]]))}else e[t[n]]=e[r[n]]},Dn=(e,t,r)=>e.map((e=>{const n={value:e[t],text:e[r]};return e.disabled&&(n.disabled=!0),e.isLeaf&&(n.isLeaf=!0),!(0,ne.isUndefined)(e.selectable)&&(n.selectable=e.selectable),Array.isArray(e.children)&&(n.children=Dn(e.children,t,r)),n})),$n=(e,t)=>{for(const r of e){if(r.value===t)return r;if(Array.isArray(r.children)){const e=$n(r.children,t);if(e)return e}}return null},qn=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=[];return e.forEach((e=>{e.value==t.split(",")[r]&&n.push(e),Array.isArray(e.children)&&n.push(...qn(e.children,t,r+1))})),n},Mn=e=>ae(e)||"string"==typeof e,jn=e=>ae(e)?dn(e).join(""):e??"",Kn=(e,t,r,n)=>{const i={};return i.filters=e.filters?.filter((e=>"1"===e.isQuery)).map((e=>{const t={type:e.type,label:e.label,fieldName:e.fieldName,options:{}};return Array.isArray(e.dicData)&&(t.options.itemList=e.dicData),t}))||[],i.table={columns:e.columns||[],rowKey:e.valueName},i.fieldsDefine={valueKey:e.valueKey||e.valueName},i.fieldAliasMap={[n?"textKey":t]:e.displayName[0],[n?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(i.table.fetch={api:r(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(i.echoRequest={fetchApi:r(e.echoSetting.api),formatter:t=>Object.assign({},t,{[e.echoSetting.paramKey]:t.key??t.keys}),dataKey:e.echoSetting.dataKey},e.echoSetting.displayKey&&(i.echoRequest.fieldAliasMap={[n?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(i.tree={fetch:{api:r(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{const t={};return e.treeSetting.relativeTable?.forEach((e=>t[e.tableField]=e.treeField)),t}}),e.emmediateSetting&&(i.columns=e.emmediateSetting.columns,i.request={fetchApi:r(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),i},Vn={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"}},zn="阿",Bn="鿿",Un=1,Wn=2,Gn=3;let Yn,Xn=null;function Qn(e){return e||null===Xn?("object"==typeof Intl&&Intl.Collator?(Yn=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Xn=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Xn=!1,Xn):Xn}function Zn(e){const t=Vn.UNIHANS,r=Vn.PINYINS,n=Vn.EXCEPTIONS,i={source:e};if(e in n)return i.type=Wn,i.target=n[e],i;let a,o=-1;if(e.charCodeAt(0)<256)return i.type=Un,i.target=e,i;if(a=Yn.compare(e,zn),a<0)return i.type=Gn,i.target=e,i;if(0===a)i.type=Wn,o=0;else{if(a=Yn.compare(e,Bn),a>0)return i.type=Gn,i.target=e,i;0===a&&(i.type=Wn,o=t.length-1)}if(i.type=Wn,o<0){let r=0,n=t.length-1;for(;r<=n;){o=~~((r+n)/2);const i=t[o];if(a=Yn.compare(e,i),0===a)break;a>0?r=o+1:n=o-1}}return a<0&&o--,i.target=r[o],i.target||(i.type=Gn,i.target=i.source),i}function Jn(e){return"string"==typeof e&&Qn()?e.split("").map((e=>Zn(e))):e}const ei={isSupported:Qn,parse:Jn,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(Vn)})))},genToken:Zn,convertToPinyin:(e,t,r)=>Jn(e).map((e=>t&&e.type===Wn?e.target.toLowerCase():e.target)).join(r||"")},ti={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}};ei.isSupported()&&ti.shouldPatch(ei.genToken)&&ei.patchDict(ti);const ri=ei,ni=e=>{const{value:t,bordered:r}=e;return o().createElement(L.Input,{value:t,title:t,bordered:r,readOnly:!0})};ni.displayName="FormItemView";const ii=ni;function ai(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oi(){return oi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},oi.apply(this,arguments)}const{Option:li}=L.Select,si=e=>{const{$$form:t}=o().useContext(Nr),{value:r,items:n,multiple:i,loading:a,onChange:l,onValuesChange:s}=e,{fieldName:c,options:d={},style:u={},placeholder:p=f("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,readOnly:g,disabled:b}=e.option,{itemList:y=[],filterable:v=!0,listHeight:x=wn,collapseTags:E,maxTagTextLength:S,openPyt:w=!0}=d,C=pe(y)?n:y,T=e=>C.find((t=>t.value===e))?.text||e?.toString()||"",N=e=>i?e?.map((e=>T(e))).join(",")||"":T(e);return t.isOnlyShow?o().createElement(ii,{value:N(r),bordered:h}):o().createElement(L.Select,oi({value:r,mode:i?"multiple":void 0,popupClassName:`form-popper__${c}`,placeholder:p,style:u,loading:a,bordered:h,allowClear:m,disabled:b,showSearch:v,listHeight:x,maxTagCount:E?"responsive":void 0,maxTagTextLength:S},i?{title:N(r)}:null,{filterOption:(e,t)=>{const r=t?.children?.toString()||"",n=ri.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(w?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{l?.(e),s(e,N(e),C)})(e)}}),C.map((e=>o().createElement(li,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class ci extends a.Component{constructor(){super(...arguments),ai(this,"context",void 0),ai(this,"state",{itemList:[],loading:!1}),ai(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:i="value",textKey:a="text",callback:o}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,n)??[],r=t.map((e=>({value:e[i],text:e[a]})));this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,ne.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:r}=this.state,{type:n,label:i,tooltip:a,fieldName:l,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,buttonAfter:h,validateTrigger:m,rules:f=[],onChange:g=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(i),className:Ne()(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ge(d)},required:e.getFormItemRequired(f)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:l,noStyle:!0,rules:f,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(i)}},o().createElement(si,{option:this.props.option,items:t,loading:r,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{g(t,r,n),e.setViewValue(l,r)}}))),h&&o().createElement(L.Col,null,e.renderFormItemButton(l,h)),p&&o().createElement(L.Col,{flex:ge(p.labelWidth||xn)},e.renderFormItemExtra({fieldName:l,...p}))))}}ai(ci,"contextType",Nr);const di=ci;function ui(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const pi=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:i}=e,{label:a,options:l={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:p=Sn,trueValue:h=En}=l;return o().createElement(L.Checkbox,{checked:r===h,style:s,disabled:d||t.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{n?.(e),i(e,f(e===h?"am.form.trueText":"am.form.falseText"))})(t?h:p)}},u?a:null)};class hi extends a.Component{constructor(){super(...arguments),ui(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option,{labelToCheckbox:m}=l;return o().createElement(L.Form.Item,{label:m?" ":e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(pi,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...d}))))}}ui(hi,"contextType",Nr);const mi=hi,fi=require("react-sortablejs");function gi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class bi extends a.Component{constructor(){super(...arguments),gi(this,"context",void 0),gi(this,"linkRef",o().createRef()),gi(this,"state",{visible:!1}),gi(this,"getFormFieldsConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),gi(this,"saveFormFieldsConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),gi(this,"resetFieldsHandle",(e=>{const t=e.map((e=>{const t=this.props.items.find((t=>t.fieldName===e.fieldName))||fe(e);return Object.assign(t,{hidden:e.hidden})}));this.changeHandle(t),this.setLocalFields(t)}))}get formUniqueKey(){return this.props.uniqueKey?`form_${this.props.uniqueKey}`:""}componentDidMount(){this.initLocalfields()}getLocalFields(){if(!this.formUniqueKey)return;const e=JSON.parse(localStorage.getItem(this.formUniqueKey));return e||this.getFormFieldsConfig(this.formUniqueKey).then((e=>{e?(localStorage.setItem(this.formUniqueKey,JSON.stringify(e)),this.initLocalfields()):this.context.global?.getComponentConfigApi&&this.setLocalFields(this.props.items)})).catch((()=>{})),e?(0,ne.xor)(e.map((e=>e.fieldName)),this.props.items.map((e=>e.fieldName))).length>0?this.props.items.map((t=>{const{fieldName:r}=t,n=e.find((e=>e.fieldName===r));return n?((0,ne.isUndefined)(n.hidden)||(t.hidden=n.hidden),t):t})):e.map((e=>({...this.props.items.find((t=>t.fieldName===e.fieldName)),...e}))):void 0}setLocalFields(e){if(!this.formUniqueKey)return;const t=e.map((e=>{const t={};return(0,ne.isUndefined)(e.hidden)||(t.hidden=e.hidden),{fieldName:e.fieldName,...t}})),r=JSON.parse(localStorage.getItem(this.formUniqueKey));(0,ne.isEqual)(t,r)||(localStorage.setItem(this.formUniqueKey,JSON.stringify(t)),this.saveFormFieldsConfig(this.formUniqueKey,t))}initLocalfields(){const e=this.getLocalFields();e&&this.changeHandle(e)}changeHandle(e){const{fieldsChange:t}=this.props;t?.([...e])}popupRender(){const{items:e}=this.props;return o().createElement(Nr.Consumer,null,(t=>{const r=t.$$form;return o().createElement("div",{className:Ne()("ant-dropdown-menu","fields-list")},o().createElement("div",{className:"reset"},o().createElement(xe,{type:"text",size:"small",onClick:()=>this.resetFieldsHandle(r.getOriginItems())},f("qm.table.columnFilter.reset"))),o().createElement(fi.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:e,setList:t=>{const n=t.map((e=>e.fieldName)),i=e.map((e=>e.fieldName));if((0,ne.isEqual)(n,i))return;r.setExpandHandle(!0);const a=vn(t);this.changeHandle(a),this.setLocalFields(a)}},e.map((t=>o().createElement("li",{key:t.fieldName,className:"item",style:t.noAuth?{display:"none"}:void 0},o().createElement(L.Checkbox,{disabled:t.rules?.findIndex((e=>e.required))>-1,checked:!t.hidden,onChange:r=>{const{checked:n}=r.target;t.hidden=!n,this.changeHandle(e),this.setLocalFields(e)}}),o().createElement(Re.HolderOutlined,{className:"handle",title:f("qm.form.draggable")}),o().createElement("span",{className:"title"},r.getFormItemLabel(t.label)))))))}))}render(){const{visible:e}=this.state,t=Ie("form-fields-filter");return o().createElement(Nr.Consumer,null,(r=>{const{$size:n}=r.$$form,i={[t]:!0,[`${t}--lg`]:"large"===n,[`${t}--sm`]:"small"===n};return o().createElement(L.Dropdown,{open:e,trigger:["click"],dropdownRender:()=>this.popupRender(),overlayClassName:Ne()(i),placement:"bottomRight",overlayStyle:{minWidth:150},getPopupContainer:()=>this.linkRef.current,onOpenChange:e=>{this.setState({visible:e})}},o().createElement("a",{ref:this.linkRef,style:{padding:"5px 0"}},o().createElement(Re.UnorderedListOutlined,null)))}))}}gi(bi,"contextType",c);const yi=bi;function vi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const xi=o().forwardRef(((e,t)=>{const{$$form:r}=o().useContext(Nr),{value:n,onChange:i,onValuesChange:a}=e,{options:l={},style:s={},placeholder:c=f("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h,onBlur:m=le,onEnter:g=le}=e.option,{prefix:b,suffix:y,password:v,maxLength:x,pattern:E,toUpper:S,toTrim:w,autoFocus:C,autoComplete:T,secretType:N}=l,I=N&&(p||h),R=o().useRef(),P=e=>{i?.(e),a(e)},O=v?L.Input.Password:L.Input,k=I?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return 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}(n,N):n;return r.isOnlyShow?o().createElement(ii,{value:(e=>e&&v?new Array(e.length).fill("*").join(""):e)(k),bordered:d}):o().createElement(O,{ref:e=>{R.current=e,"function"==typeof t&&t(e)},value:k,autoComplete:v?"new-password":T,autoFocus:C,placeholder:c,style:s,title:v?"":k,prefix:b,suffix:y,maxLength:x,bordered:d,allowClear:u,readOnly:p,disabled:h,onBlur:t=>{let r=t.target.value??"";if(w){const e=r.trim();r!==e&&(r=e,P(r))}(t=>{const{onBlur:r}=e;r?.(t)})(r),m(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;g(t),r.isFilterType&&(r.SUBMIT_FORM(),R.current?.blur())}},onChange:e=>{let t=e.target.value;(0,ne.isRegExp)(E)&&(t=E.test(t)?t:n??""),S&&(t=t.toUpperCase()),P(t)}})}));xi.displayName="VInput";class Ei extends a.Component{constructor(){super(...arguments),vi(this,"context",void 0),vi(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(xi,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),u&&o().createElement(L.Col,null,e.renderFormItemButton(i,u)),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...d}))))}}vi(Ei,"contextType",Nr);const Si=Ei;function wi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ci=e=>{const{$$form:t}=o().useContext(Nr),{value:r=[],onChange:n,onValuesChange:i}=e,{options:a={},placeholder:l=f("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{prefix:p,suffix:h,maxLength:m}=a,g=e=>{const t=e.every((e=>!e))?[]:e;n?.(t),i(t,b(t))},b=e=>e.join(" - ");return t.isOnlyShow?o().createElement(ii,{value:b(r),bordered:s}):o().createElement(L.Input.Group,null,o().createElement(L.Input,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:l[0],prefix:p,suffix:h,maxLength:m,allowClear:c,bordered:s,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([t,r[1]])}}),o().createElement(L.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),o().createElement(L.Input,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:l[1],prefix:p,suffix:h,maxLength:m,bordered:s,allowClear:c,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([r[0],t])}}))};class Ti extends a.Component{constructor(){super(...arguments),wi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,labelWidth:l=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(s),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(l)},required:e.getFormItemRequired(u)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ci,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(i,t)}}))),c&&o().createElement(L.Col,{flex:ge(c.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...c}))))}}wi(Ti,"contextType",Nr);const Ni=Ti,Ii=require("big.js");var Ri=n.n(Ii);function Pi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Oi=o().forwardRef(((e,t)=>{const{$$form:r}=o().useContext(Nr),{value:n,onChange:i,onValuesChange:a}=e,{options:l={},style:s={},placeholder:c=f("qm.form.inputPlaceholder"),bordered:d=!0,readOnly:u,disabled:p,onBlur:h=le,onEnter:m=le}=e.option,{step:g=1,min:b,max:y,precision:v,autoFocus:x,stringMode:E,textAlign:S="left",controls:w=!0,formatter:C,parser:T}=l,N=o().useRef(),I=o().useRef(n),R=e=>{const t=Ln(e)?"":(0,ne.isNumber)(e)?e.toFixed(v):new(Ri())(e).toFixed(v);return"function"==typeof C?C(t):t},P={[S]:!0,controls:w};return r.isOnlyShow?o().createElement(ii,{value:R(n),bordered:d}):o().createElement(L.InputNumber,{ref:e=>{N.current=e,"function"==typeof t&&t(e)},value:n,className:Ne()(P),placeholder:c,style:{width:"100%",...s},step:g,min:b,max:y,controls:w,precision:v,autoFocus:x,stringMode:E,formatter:C,parser:T,bordered:d,readOnly:u,disabled:p,onBlur:()=>{de((()=>{(t=>{const{onBlur:r}=e;r?.(t)})(I.current),h(I.current)}))},onKeyUp:e=>{13===e.keyCode&&(m(n),r.isFilterType&&(r.SUBMIT_FORM(),N.current?.blur()))},onChange:e=>{const t=e??"";!E&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{I.current=e,i?.(e),a(e,R(e))})(t)}})}));Oi.displayName="VInputNumber";class ki extends a.Component{constructor(){super(...arguments),Pi(this,"context",void 0),Pi(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Oi,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&o().createElement(L.Col,null,e.renderFormItemButton(i,u)),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Pi(ki,"contextType",Nr);const Ai=ki;function Li(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Fi=e=>{const{$$form:t}=o().useContext(Nr),{value:r=[],onChange:n,onValuesChange:i}=e,{options:a={},placeholder:l=f("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{step:p=1,min:h=0,max:m,textAlign:g="left",controls:b=!0,precision:y,formatter:v,parser:x}=a,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),S(e)},S=e=>{const t=e.every((e=>null===e))?[]:[...e];n?.(t),i(t,w(t))},w=e=>Ln(e)?"":e.map((e=>Ln(e)?"":Number(e).toFixed(y))),C={[g]:!0,controls:b};return t.isOnlyShow?o().createElement(ii,{value:w(r),bordered:s}):o().createElement(L.Input.Group,null,o().createElement(L.InputNumber,{value:r[0],className:Ne()("site-input-left",C),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:l[0],step:p,min:h,max:m,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{S([e,r[1]])},onBlur:()=>{E(r)}}),o().createElement(L.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),o().createElement(L.InputNumber,{value:r[1],className:Ne()("site-input-right",C),style:{width:"calc(50% - 5px)"},placeholder:l[1],step:p,min:h,max:m,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{S([r[0],e])},onBlur:()=>{E(r)}}))};class Hi extends a.Component{constructor(){super(...arguments),Li(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,labelWidth:l=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(s),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(l)},required:e.getFormItemRequired(u)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Fi,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(i,t)}}))),c&&o().createElement(L.Col,{flex:ge(c.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...c}))))}}Li(Hi,"contextType",Nr);const _i=Hi;let Di=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});function $i(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:qi}=L.Input;class Mi extends a.Component{constructor(e){var t;super(e),t=this,$i(this,"context",void 0),$i(this,"deriveParams",void 0),$i(this,"valueKey",void 0),$i(this,"_is_change",!1),$i(this,"_record",void 0),$i(this,"_prevValue",null),$i(this,"state",{visible:!1,loading:!1}),$i(this,"getSearchHelper",Tr()((e=>Object.assign({},this.props.helperConfig,e)))),$i(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),$i(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||v("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||v("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&v("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),$i(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),$i(this,"getDerivedSearchHelper",(()=>this.searchHelper)),$i(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:i,triggeredChange:a,fieldAliasMap:o,extraAliasMap:l}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},c="function"==typeof l?l():l||{},d=this.getItemValue();if(!e||pe(d))return this._prevValue=void 0;this.setState({loading:!0});try{const o=await e(r({...t,key:d}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,ne.get)(o.data,n)??[];if(e[0]){const t=e[0];if(s&&Hn(t,this.alias,s),c&&_n(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,a){const e=Fn(t,this.alias[this.props.option.fieldName]);this.triggerChange(e),this.searchHelperChangeHandle(e)}i?.([t])}}}catch(e){}this.setState({loading:!1})})),$i(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),$i(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,{filterAliasMap:r}=this.searchHelper,n=""!==e?e:void 0,i=("function"==typeof r?r():r)||[],a={[t]:n};return(Array.isArray(i)?i:[i]).forEach((e=>{if((0,ne.isPlainObject)(e))for(const t in e)a[t]="function"==typeof e[t]?e[t](n):n;else a[e]=n})),a})),$i(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=se,formatter:i=(e=>e)}=t.fetch;return new Promise((async(a,o)=>{const l=(0,ne.merge)({},this.searchHelper.table.fetch.params,{...r,...i(this.createFilters(e))},{currentPage:1,pageSize:500});if(!n(l))return o();this.setState({loading:!0});try{const e=await t.fetch.api(l);200===e.code?a(Array.isArray(e.data)?e.data:(0,ne.get)(e.data,t.fetch.dataKey)??[]):o()}catch(e){o(e)}finally{de((()=>this.setState({loading:!1})))}}))})),$i(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const i=Fn(e,this.alias[n]);void 0!==i&&(t.SET_FIELDS_VALUE({[n]:i}),n===r&&t.setViewValue(r,i))}for(const r in this.extras){const n=Fn(e,this.extras[r]);void 0!==n&&t.SET_FIELDS_EXTRA({[r]:n})}})),$i(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1?arguments[1]:void 0;const{fieldName:n}=t.props.option,i=e.filter((e=>Fn(e,t.alias[n])?.toString().toLowerCase().includes(r.toLowerCase())));if(1===i.length)return t.closeSearchHelper(i[0]);t.openSearchHelper(r)})),$i(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:r}=this.context,{beforeOpen:n}=this.searchHelper,i=(n??se)(r.state.formData);i?.then?i.then((()=>{this.todoOpen(e),t?.()})).catch((()=>{})):!1!==i&&(this.todoOpen(e),t?.())})),$i(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Fn(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Fn(e,this.extras[r])});const n=Fn(e,this.alias[r]);this.triggerChange(n),this.searchHelperChangeHandle(n);const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>i?.(e)),200)}))})),$i(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)})),$i(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;if(this.triggerChange(""),null!==this._record){for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}})),$i(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),$i(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e)})),$i(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),$i(this,"focus",(()=>{const{type:e}=this.props.option;this[`${e}_Ref`].focus({cursor:"end"})})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:t,loading:r}=this.state,{value:n}=this.props,{type:i,fieldName:a,options:l={},searchHelper:s={},style:c={},placeholder:d=f("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{prefix:g,suffix:b,maxLength:y}=l,v={visible:t,title:f("qm.searchHelper.text"),width:s.width??"60%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${Di[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:Object.assign({},this.deriveParams,s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?o().createElement(ii,{value:n,bordered:u}):o().createElement(o().Fragment,null,o().createElement(qi,{ref:e=>this[`${i}_Ref`]=e,value:n,title:n,loading:r,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:p,readOnly:h,disabled:m,onBlur:e=>{const{value:r}=e.target,{onlySelect:n=!0,table:i}=this.searchHelper;this.triggerBlur(r),this._is_change&&!t&&(r?n?i?.fetch?.api&&this.getSearchHelperTableData(r).then((e=>this.resetSearchHelperValue(e,r))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(r):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:r}=e.target;!t&&this.openSearchHelper(r)}},onDoubleClick:e=>{const{value:t}=e.target;this.openSearchHelper(t)},onChange:e=>{const{value:t}=e.target;this.triggerChange(t),this._is_change=!0},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):de((()=>this.clearSearchHelperValue())))}}),o().createElement(wr,v,o().createElement(Gc,x)))}}$i(Mi,"contextType",Nr);class ji extends a.Component{constructor(e,t){let{$$form:r}=t;super(e),$i(this,"context",void 0),$i(this,"promiseRef",void 0),$i(this,"searchRef",void 0),$i(this,"state",{searchHelper:{}}),$i(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),$i(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,a)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Kn(Object.assign({},o.data,n),i,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else a()}catch(e){a()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[]}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(d),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(Mi,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e.setViewValue(a,t)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(a,p)),u&&o().createElement(L.Col,{flex:ge(u.labelWidth||xn)},e.renderFormItemExtra({fieldName:a,...u}))))}}$i(ji,"contextType",Nr);const Ki=ji;function Vi(){return Vi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Vi.apply(this,arguments)}function zi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Bi=e=>{class t extends a.Component{constructor(){var e;super(...arguments),e=this,zi(this,"startClick",void 0),zi(this,"event1",null),zi(this,"event2",null),zi(this,"$el",null),zi(this,"omitClassNames",[]),zi(this,"state",{clickOutside:!1}),zi(this,"mousedownHandler",(e=>{this.startClick=e})),zi(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),zi(this,"documentHandler",((e,t)=>{const r=e.target,n=t?.target,i=!r||!n,a=this.$el?.contains(r)||this.$el?.contains(n),o=this.$el===r,l=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),s=l.some((e=>e?.contains(r)))||l.includes(n);let c;c=!(i||a||o||s),this.setState({clickOutside:c})})),zi(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),zi(this,"setOmitClassNames",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.omitClassNames=t}))}componentDidMount(){this.event1=Xt()(document,"mousedown",this.mousedownHandler),this.event2=Xt()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){this.event1?.remove(),this.event2?.remove()}render(){const{forwardedRef:t}=this.props,{clickOutside:r}=this.state;return o().createElement(e,Vi({ref:t},this.props,{clickOutside:r,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return zi(t,"displayName",`OutsideClick(${e.displayName||e.name})`),o().forwardRef(((e,r)=>o().createElement(t,Vi({},e,{forwardedRef:r}))))},Ui=require("rc-trigger");var Wi,Gi,Yi=n.n(Ui);function Xi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let Qi=Bi((Gi=class extends a.Component{constructor(e){var t;super(e),t=this,Xi(this,"context",void 0),Xi(this,"searchRef",o().createRef()),Xi(this,"_records",[]),Xi(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Xi(this,"getSearchHelper",Tr()((e=>Object.assign({},this.props.helperConfig,e)))),Xi(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||v("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||v("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Xi(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Xi(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Xi(this,"setItemList",(e=>{this.setState({itemList:e})})),Xi(this,"setRecords",(e=>{this._records=e})),Xi(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Xi(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Xi(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??se)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Xi(this,"closeSearchHelper",(function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=t.alias;t.setRecords((0,ne.uniqBy)([...t._records.filter((e=>r.includes(e[n]))),...e],n));const i=t.recordsToDict();t.setItemList(i),t.triggerChange(i.map((e=>e.value)));const{closed:a}=t.searchHelper;t.setVisible(!1,(()=>{setTimeout((()=>a?.(t._records)),200)}))})),Xi(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(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:r=[]}=e,{value:n=[],clickOutside:i}=this.props;(0,ne.isEqual)((0,ne.intersection)(r,n),n)||(0,ne.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:i=(e=>e),dataKey:a,callback:o,fieldAliasMap:l}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},s="function"==typeof l?l():l||{},{value:c}=this.props;if(r&&!pe(c)){this.setState({loading:!0});try{const l=await r(i({...n,keys:c}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,ne.get)(l.data,a)??[];r.forEach((r=>{s?.valueKey&&s.valueKey!==t&&(r[t]=r[s.valueKey]),s?.textKey&&s.textKey!==e&&(r[e]=r[s.textKey])})),r=r.filter((e=>c.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(c),o?.(r)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:t,visible2:r,loading:n,itemList:i}=this.state,{value:a}=this.props,{fieldName:l,options:s={},searchHelper:c={},style:d={},placeholder:u=f("qm.form.selectPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:t,title:f("qm.searchHelper.text"),width:c.width??"60%",wrapClassName:`form-popper__${l}`,loading:!1,bodyStyle:{paddingBottom:`${Di[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,ne.merge)({},c.initialValue),defaultSelectedKeys:a,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=i.filter((e=>a?.includes(e.value))),S=o().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>o().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):o().createElement("li",{className:"ant-dropdown-menu-item"},f("qm.table.config.emptyText"))),w=this.searchRef.current?this.searchRef.current.offsetWidth:300,C=Ie("form-multiple-search-helper"),{size:T}=e.context,N={[C]:!0,[`${C}--lg`]:"large"===T,[`${C}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${C}`]);const I=i.filter((e=>a?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?o().createElement(ii,{value:I,bordered:p}):o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},o().createElement(Yi(),{popupVisible:!g&&r,popup:S,popupClassName:Ne()(N),popupStyle:{minWidth:w},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Tn,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement(L.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:a,placeholder:u,loading:n,bordered:p,allowClear:h,disabled:g,style:{width:"100%",...d},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},i.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:g,icon:o().createElement(Re.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),o().createElement(wr,v,o().createElement(Gc,x)))}},Xi(Gi,"contextType",Nr),Wi=Gi))||Wi;class Zi extends a.Component{constructor(e,t){let{$$form:r}=t;super(e),Xi(this,"context",void 0),Xi(this,"promiseRef",void 0),Xi(this,"state",{searchHelper:{}}),Xi(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),Xi(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,a)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Kn(Object.assign({},o.data,n),i,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else a()}catch(e){a()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(d),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(Qi,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(a,r)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(a,p)),u&&o().createElement(L.Col,{flex:ge(u.labelWidth||xn)},e.renderFormItemExtra({fieldName:a,...u}))))}}Xi(Zi,"contextType",Nr);const Ji=Zi;function ea(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:ta}=L.Input;class ra extends a.Component{constructor(e){super(e),ea(this,"context",void 0),ea(this,"valueKey",void 0),ea(this,"_record",void 0),ea(this,"_prevValue",null),ea(this,"state",{visible:!1,loading:!1}),ea(this,"getSearchHelper",Tr()((e=>Object.assign({},this.props.helperConfig,e)))),ea(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ea(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||v("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||v("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&v("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),ea(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),ea(this,"getDerivedSearchHelper",(()=>this.searchHelper)),ea(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:i,triggeredChange:a,fieldAliasMap:o,extraAliasMap:l}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},c="function"==typeof l?l():l||{},d=this.getItemValue();if(!e||pe(d))return this._prevValue=void 0;this.setState({loading:!0});try{const o=await e(r({...t,key:d}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,ne.get)(o.data,n)??[];if(e[0]){const t=e[0];if(s&&Hn(t,this.alias,s),c&&_n(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,a){const e=Fn(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}i?.([t])}}}catch(e){}this.setState({loading:!1})})),ea(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const i=Fn(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:i}),n===r&&t.setViewValue(r,i)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Fn(e,this.extras[r])})})),ea(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??se)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),ea(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Fn(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Fn(e,this.extras[r])});const n=Fn(e,this.alias[r]);this.triggerChange(n);const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>i?.(e)),200)}))})),ea(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")})),ea(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),ea(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:t,loading:r}=this.state,{value:n=""}=this.props,{type:i,fieldName:a,options:l={},searchHelper:s={},style:c={},placeholder:d=f("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{prefix:g,suffix:b,maxLength:y}=l,v={visible:t,title:f("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${Di[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:(0,ne.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}};return e.isOnlyShow?o().createElement(ii,{value:n,bordered:u}):o().createElement(o().Fragment,null,o().createElement(ta,{ref:e=>this[`${i}_Ref`]=e,value:n,title:n,loading:r,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:p,readOnly:h,disabled:m,onBlur:e=>{const{value:t}=e.target;this.triggerBlur(t)},onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onDoubleClick:e=>{this.openSearchHelper()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),o().createElement(wr,v,o().createElement(ed,x)))}}ea(ra,"contextType",Nr);class na extends a.Component{constructor(e,t){let{$$form:r}=t;super(e),ea(this,"context",void 0),ea(this,"promiseRef",void 0),ea(this,"state",{searchHelper:{}}),ea(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),ea(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,a)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Kn(Object.assign({},o.data,n),i,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else a()}catch(e){a()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(d),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(ra,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r)=>{f(t,r),e.setViewValue(a,t)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(a,p)),u&&o().createElement(L.Col,{flex:ge(u.labelWidth||xn)},e.renderFormItemExtra({fieldName:a,...u}))))}}ea(na,"contextType",Nr);const ia=na;var aa,oa;function la(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let sa=Bi((oa=class extends a.Component{constructor(e){var t;super(e),t=this,la(this,"context",void 0),la(this,"searchRef",o().createRef()),la(this,"_records",[]),la(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),la(this,"getSearchHelper",Tr()((e=>Object.assign({},this.props.helperConfig,e)))),la(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||v("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||v("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),la(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),la(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),la(this,"setItemList",(e=>{this.setState({itemList:e})})),la(this,"setRecords",(e=>{this._records=e})),la(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),la(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),la(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??se)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),la(this,"closeSearchHelper",(function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=t.alias;t.setRecords((0,ne.uniqBy)([...t._records.filter((e=>r.includes(e[n]))),...e],n));const i=t.recordsToDict();t.setItemList(i),t.triggerChange(i.map((e=>e.value)));const{closed:a}=t.searchHelper;t.setVisible(!1,(()=>{setTimeout((()=>a?.(t._records)),200)}))})),la(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(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:r=[]}=e,{value:n=[],clickOutside:i}=this.props;(0,ne.isEqual)((0,ne.intersection)(r,n),n)||(0,ne.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:i=(e=>e),dataKey:a,fieldAliasMap:o}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},l="function"==typeof o?o():o||{},{value:s}=this.props;if(r&&!pe(s)){this.setState({loading:!0});try{const o=await r(i({...n,keys:s}));if(200===o.code){let r=Array.isArray(o.data)?o.data:(0,ne.get)(o.data,a)??[];r.forEach((r=>{l?.valueKey&&l.valueKey!==t&&(r[t]=r[l.valueKey]),l?.textKey&&l.textKey!==e&&(r[e]=r[l.textKey])})),r=r.filter((e=>s.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(s)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:t,visible2:r,loading:n,itemList:i}=this.state,{value:a}=this.props,{fieldName:l,options:s={},searchHelper:c={},style:d={},placeholder:u=f("qm.form.selectPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:t,title:f("qm.searchHelper.text"),width:c.width??"65%",wrapClassName:`form-popper__${l}`,loading:!1,bodyStyle:{paddingBottom:`${Di[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,ne.merge)({},c.initialValue),defaultSelectedKeys:a,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=i.filter((e=>a?.includes(e.value))),S=o().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>o().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):o().createElement("li",{className:"ant-dropdown-menu-item"},f("qm.table.config.emptyText"))),w=this.searchRef.current?this.searchRef.current.offsetWidth:300,C=Ie("form-multiple-tree-table-helper"),{size:T}=e.context,N={[C]:!0,[`${C}--lg`]:"large"===T,[`${C}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${C}`]);const I=i.filter((e=>a?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?o().createElement(ii,{value:I,bordered:p}):o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},o().createElement(Yi(),{popupVisible:!g&&r,popup:S,popupClassName:Ne()(N),popupStyle:{minWidth:w},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Tn,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement(L.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:a,placeholder:u,loading:n,bordered:p,allowClear:h,disabled:g,style:{width:"100%",...d},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},i.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:g,icon:o().createElement(Re.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),o().createElement(wr,v,o().createElement(ed,x)))}},la(oa,"contextType",Nr),aa=oa))||aa;class ca extends a.Component{constructor(e,t){let{$$form:r}=t;super(e),la(this,"context",void 0),la(this,"promiseRef",void 0),la(this,"state",{searchHelper:{}}),la(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),la(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,a)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Kn(Object.assign({},o.data,n),i,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else a()}catch(e){a()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(d),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(sa,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(a,r)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(a,p)),u&&o().createElement(L.Col,{flex:ge(u.labelWidth||xn)},e.renderFormItemExtra({fieldName:a,...u}))))}}la(ca,"contextType",Nr);const da=ca;function ua(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const pa=new Array(2).fill("");class ha extends a.Component{constructor(e){var t;super(e),t=this,ua(this,"context",void 0),ua(this,"_is_change",!1),ua(this,"_ceho_data",void 0),ua(this,"_records",[]),ua(this,"_is_clear",!1),ua(this,"state",{visible:!1,loading:!1,itemList:[],textValue:pa}),ua(this,"getSearchHelper",Tr()((e=>Object.assign({},this.props.helperConfig,e)))),ua(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||v("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||v("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),ua(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),ua(this,"setItemList",(e=>{this.setState({itemList:e})})),ua(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ua(this,"setTextValue",(e=>{this.setState({textValue:e})})),ua(this,"setRecords",(e=>{this._records=e})),ua(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),ua(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;this._is_change=!1,t?.(e),r(e,this.createViewText(),this._records)})),ua(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(pa),this.triggerChange([])})),ua(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:r}=this.alias,n=e.map((e=>({value:e[t],text:e[r]})));this.setRecords(e),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>i?.(this._records)),200)}))})),ua(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??se)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),ua(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,r=pe(e)?void 0:e;return{[t]:r}})),ua(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=se,formatter:i=(e=>e)}=t.fetch;return new Promise((async(a,o)=>{const l=(0,ne.merge)({},this.searchHelper.table.fetch.params,{...r,...i(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!n(l))return o();this.setState({loading:!0});const e=await t.fetch.api(l);if(de((()=>this.setState({loading:!1}))),200===e.code)return a(Array.isArray(e.data)?e.data:(0,ne.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}o()}))})),ua(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{textValue:r}=t.state,{textKey:n}=t.alias,i=e.filter((e=>{const t=e[n]?.toString().toLowerCase();return r.some((e=>t?.includes(e.toLowerCase())))}));if(2===i.length)return t.closeSearchHelper(i);t.openSearchHelper()})),ua(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:r=[]}=this.props;(0,ne.isEqual)((0,ne.intersection)(t,r),r)||(0,ne.isEqual)(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:n}=this.context,{fieldName:i}=this.props.option;if(!(0,ne.isEqual)(n[i],this._ceho_data)&&(this._ceho_data=n[i],this.setItemList(n[i]),r.length)){const e=pa.map(((e,t)=>n[i].find((e=>e.value===r[t]))?.text??""));this.setTextValue(e)}}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:i=(e=>e),dataKey:a,fieldAliasMap:o}=this.searchHelper.echoRequest||{},l="function"==typeof o?o():o||{},{value:s}=this.props;if(r&&!pe(s)){this.setState({loading:!0});try{const o=await r(i({...n,keys:s}));if(200===o.code){let r=Array.isArray(o.data)?o.data:(0,ne.get)(o.data,a)??[];r.forEach((r=>{l?.valueKey&&l.valueKey!==t&&(r[t]=r[l.valueKey]),l?.textKey&&l.textKey!==e&&(r[e]=r[l.textKey])})),r=r.filter((e=>s.includes(e[t]))).slice(0,2);const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.setViewValue()}}catch(e){}this.setState({loading:!1})}}createViewText(){const{textKey:e}=this.alias;return this._records.map((t=>t[e])).join(" - ")}render(){const{$$form:e}=this.context,{value:t=[]}=this.props,{visible:r,loading:n,textValue:i}=this.state,{fieldName:a,options:l={},searchHelper:s={},placeholder:c=f("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:p}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,m=i.every((e=>Ln(e)))?"":i.join(" - "),g={visible:r,title:f("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${Di[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},b={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:(0,ne.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?o().createElement(ii,{value:m,bordered:d}):o().createElement(o().Fragment,null,o().createElement(L.Input.Group,null,o().createElement(L.Input,{value:i[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:p,onBlur:e=>{const{value:t}=e.target;this._is_change&&!r&&(t?i.every((e=>!!e))&&this.searchHelper.table?.fetch?.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;h||(this._is_change=!0,this.setTextValue([t,i[1]]))}}),o().createElement(L.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:p,readOnly:!0}),o().createElement(L.Input.Search,{value:i[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:n,bordered:d,allowClear:!0,readOnly:u,disabled:p,onBlur:e=>{const{value:t}=e.target;this._is_change&&!r&&(t?i.every((e=>!!e))&&this.searchHelper.table?.fetch?.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:h||(this._is_change=!0,this.setTextValue([i[0],t]))},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),o().createElement(wr,g,o().createElement(ld,b)))}}ua(ha,"contextType",Nr);class ma extends a.Component{constructor(e,t){let{$$form:r}=t;super(e),ua(this,"context",void 0),ua(this,"promiseRef",void 0),ua(this,"state",{searchHelper:{}}),ua(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),ua(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,a)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Kn(Object.assign({},o.data,n),i,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else a()}catch(e){a()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(c),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(ha,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{m(t,n),e.setViewValue(a,r)}}))),u&&o().createElement(L.Col,null,e.renderFormItemButton(a,u)),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:a,...d}))))}}ua(ma,"contextType",Nr);const fa=ma;function ga(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ba=e=>{const{$$form:t}=o().useContext(Nr),{value:r,items:n,onChange:i,onValuesChange:a}=e,{options:l={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:p=[]}=l,h=pe(p)?n:p,m=e=>h.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return t.isOnlyShow?o().createElement(ii,{value:m(r),bordered:c}):o().createElement(L.Checkbox.Group,{value:r,style:{width:"100%",...s},disabled:u,onChange:e=>{(e=>{i?.(e),a(e,m(e))})(e)}},h.map((e=>o().createElement(L.Checkbox,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class ya extends a.Component{constructor(){super(...arguments),ga(this,"context",void 0),ga(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,ne.isEqual)(t,r)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:i="value",textKey:a="text",callback:o}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,n)??[],r=t.map((e=>({value:e[i],text:e[a]})));this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(d),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(c)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(ba,{option:this.props.option,items:t,onValuesChange:(t,r)=>{m(t),e.setViewValue(a,r)}}))),u&&o().createElement(L.Col,{flex:ge(u.labelWidth||xn)},e.renderFormItemExtra({fieldName:a,...u}))))}}ga(ya,"contextType",Nr);const va=ya;function xa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ea=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:i}=e,{options:a={},style:l={},allowClear:s=!0,readOnly:c,disabled:d=t.isFormDisabled}=e.option,{allowHalf:u,count:p=5,tooltips:h}=a;return o().createElement(L.Rate,{value:r,count:p,style:l,allowHalf:u,allowClear:s,tooltips:h,disabled:d||t.isOnlyShow,onChange:e=>{(e=>{var t;n?.(e),i(e,(t=e,h?h[Math.ceil(t)-1]:t.toString()))})(e)}})};class Sa extends a.Component{constructor(){super(...arguments),xa(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ea,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...d}))))}}xa(Sa,"contextType",Nr);const wa=Sa;function Ca(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ta=e=>{const{$$form:t}=o().useContext(Nr),{value:r,items:n,onChange:i,onValuesChange:a}=e,{options:l={},style:s={},bordered:c=!1,readOnly:d,disabled:u=t.isFormDisabled}=e.option,{itemList:p=[]}=l,h=pe(p)?n:p,m=e=>h.find((t=>t.value===e))?.text??"";return t.isOnlyShow?o().createElement(ii,{value:m(r),bordered:c}):o().createElement(L.Radio.Group,{value:r,style:{width:"100%",...s},disabled:u||t.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{i?.(e),a(e,m(e))})(t)}},h.map((e=>o().createElement(L.Radio,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Na extends a.Component{constructor(){super(...arguments),Ca(this,"context",void 0),Ca(this,"state",{itemList:[]}),Ca(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:i="value",textKey:a="text",callback:o}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,n)??[],r=t.map((e=>({value:e[i],text:e[a]})));this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,ne.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(d),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(c)},required:e.getFormItemRequired(h)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(Ta,{option:this.props.option,items:t,onValuesChange:(t,r)=>{m(t),e.setViewValue(a,r)}}))),u&&o().createElement(L.Col,{flex:ge(u.labelWidth||xn)},e.renderFormItemExtra({fieldName:a,...u}))))}}Ca(Na,"contextType",Nr);const Ia=Na;function Ra(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Pa=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:i}=e,{label:a,options:l={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:p=Sn,trueValue:h=En}=l;return o().createElement(o().Fragment,null,o().createElement(L.Switch,{checked:r===h,style:s,disabled:d||t.isOnlyShow,checkedChildren:o().createElement(Re.CheckOutlined,null),unCheckedChildren:o().createElement(Re.CloseOutlined,null),onChange:e=>{(e=>{n?.(e),i(e,f(e===h?"am.form.trueText":"am.form.falseText"))})(e?h:p)}}),u?o().createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},a):null)};class Oa extends a.Component{constructor(){super(...arguments),Ra(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option,{labelToSwitch:m}=l;return o().createElement(L.Form.Item,{label:m?" ":e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Pa,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Ra(Oa,"contextType",Nr);const ka=Oa;function Aa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const La=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:i}=e,{options:a={},style:l={},placeholder:s=f("qm.form.inputPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:p,onBlur:h=le,onEnter:m=le}=e.option,{showCount:g,maxLength:b,autoSize:y}=a,v=Object.assign({},{minRows:1,maxRows:3},y);return o().createElement(L.Input.TextArea,{value:r,placeholder:s,style:l,maxLength:b,showCount:g,autoSize:v,bordered:c,allowClear:d,readOnly:u||t.isOnlyShow,disabled:p,onBlur:t=>{const{value:r}=t.target;(t=>{const{onBlur:r}=e;r?.(t)})(r),h(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;m(t)}},onChange:e=>{const{value:t}=e.target;(e=>{n?.(e),i(e)})(t)}})};class Fa extends a.Component{constructor(){super(...arguments),Aa(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(La,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,t)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Aa(Fa,"contextType",Nr);const Ha=Fa;function _a(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Da=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:i}=e,{fieldName:a,options:l={},style:s={},placeholder:c=f("qm.form.datePlaceholder"),bordered:d=!0,allowClear:p=!0,readOnly:h,disabled:m}=e.option,{dateType:g="date",format:b,disabledDate:y,minDateTime:v,maxDateTime:x,shortCuts:E=!0}=l,S=o().createRef(),w=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),n?.(e),i(e,C(e))},C=e=>Ln(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,T=e=>{let t=An(u()().subtract(e,"day"),In[g]);"date"===g&&(t=t.slice(0,10)),w(t),S.current.blur(),S.current.focus()};return t.isOnlyShow?o().createElement(ii,{value:C(r),bordered:d}):o().createElement(j,{ref:S,style:{width:"100%",...s},popupClassName:`form-popper__${a}`,picker:Nn[g],format:b,bordered:d,showToday:!1,showTime:"datetime"===g&&{defaultValue:u()("00:00:00","HH:mm:ss")},allowClear:p,disabled:m,inputReadOnly:h,disabledDate:y??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[v,x])),renderExtraFooter:E?()=>o().createElement(o().Fragment,null,o().createElement(L.Tag,{color:"processing",onClick:()=>T(0)},f("qm.form.datePickers")[0]),o().createElement(L.Tag,{color:"processing",onClick:()=>T(1)},f("qm.form.datePickers")[1]),o().createElement(L.Tag,{color:"processing",onClick:()=>T(7)},f("qm.form.datePickers")[2]),o().createElement(L.Tag,{color:"processing",onClick:()=>T(30)},f("qm.form.datePickers")[3])):void 0,value:kn(r,In[g]),onChange:(e,t)=>{w(An(e,In[g]))}})};class $a extends a.Component{constructor(){super(...arguments),_a(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Da,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...d}))))}}_a($a,"contextType",Nr);const qa=$a;function Ma(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ja=e=>[u()().subtract(e,"day"),u()()],Ka=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:i}=e,{fieldName:a,options:l={},style:s={},placeholder:c=f("qm.form.daterangePlaceholder"),bordered:d=!0,allowClear:p=!0,readOnly:h,disabled:m=t.isFormDisabled}=e.option,{dateType:g="date",format:b,disableds:y=[!1,!1],allowEmpty:v,disabledDate:x,minDateTime:E,maxDateTime:S,shortCuts:w=!0}=l,C={[f("qm.form.dateRangePickers")[0]]:ja(7),[f("qm.form.dateRangePickers")[1]]:ja(30),[f("qm.form.dateRangePickers")[2]]:ja(90),[f("qm.form.dateRangePickers")[3]]:ja(180)},T=e=>Ln(e)?"":e.map((e=>["date","exactdate"].includes(g)?e?.slice(0,10):e)).join(" - ");return t.isOnlyShow?o().createElement(ii,{value:T(r),bordered:d}):o().createElement(j.RangePicker,{style:{width:"100%",...s},popupClassName:`form-popper__${a}`,picker:Nn[g],format:b,bordered:d,showTime:"datetime"===g&&{defaultValue:[u()("00:00:00","HH:mm:ss"),u()("23:59:59","HH:mm:ss")]},allowClear:p,allowEmpty:v,disabled:m?[!0,!0]:y,inputReadOnly:h,disabledDate:x??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[E,S])),ranges:w?C:void 0,value:pe(r)?null:[kn(r?.[0],In[g]),kn(r?.[1],In[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=[]),n?.(e),i(e,T(e))})([An(e?.[0],In[g]),An(e?.[1],In[g])])}})};class Va extends a.Component{constructor(){super(...arguments),Ma(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ka,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Ma(Va,"contextType",Nr);const za=Va;function Ba(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ua=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:i}=e,{fieldName:a,options:l={},style:s={},placeholder:c=f("qm.form.timePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h}=e.option,{timeType:m="hour-minute-second",hourStep:g=1,minuteStep:b=1,secondStep:y=1}=l;return t.isOnlyShow?o().createElement(ii,{value:r,bordered:d}):o().createElement(B,{style:{width:"100%",...s},popupClassName:`form-popper__${a}`,bordered:d,showNow:!0,hourStep:g,minuteStep:b,secondStep:y,allowClear:u,disabled:h,inputReadOnly:p,format:Rn[m],value:kn(r,Rn[m]),onChange:(e,t)=>{(e=>{const t=An(e,Rn[m]);n?.(t),i(t)})(e)}})};class Wa extends a.Component{constructor(){super(...arguments),Ba(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ua,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,t)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Ba(Wa,"contextType",Nr);const Ga=Wa;function Ya(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Xa=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:i}=e,{fieldName:a,options:l={},style:s={},placeholder:c=f("qm.form.timerangePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h=t.isFormDisabled}=e.option,{timeType:m="hour-minute-second",disableds:g=[!1,!1],allowEmpty:b,hourStep:y=1,minuteStep:v=1,secondStep:x=1}=l,E=e=>Ln(e)?"":e.join(" - ");return t.isOnlyShow?o().createElement(ii,{value:E(r),bordered:d}):o().createElement(B.RangePicker,{style:{width:"100%",...s},popupClassName:`form-popper__${a}`,bordered:d,showNow:!1,hourStep:y,minuteStep:v,secondStep:x,allowClear:u,allowEmpty:b,disabled:h?[!0,!0]:g,inputReadOnly:p,format:Rn[m],value:pe(r)?null:[kn(r?.[0],Rn[m]),kn(r?.[1],Rn[m])],onChange:(e,t)=>{(e=>{const t=[An(e?.[0],Rn[m]),An(e?.[1],Rn[m])];n?.(t),i(t,E(t))})(e)}})};class Qa extends a.Component{constructor(){super(...arguments),Ya(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Xa,{option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Ya(Qa,"contextType",Nr);const Za=Qa;function Ja(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class eo extends a.Component{constructor(e){super(e),Ja(this,"context",void 0),Ja(this,"searchRef",o().createRef()),Ja(this,"valueKey",void 0),Ja(this,"_clicking",!1),Ja(this,"_record",void 0),Ja(this,"_prevValue",null),Ja(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),Ja(this,"getSearchHelper",Tr()(((e,t)=>Object.assign({},this.props.helperConfig,e,t)))),Ja(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e,options:t,searchHelper:r}=this.props.option,{fieldAliasMap:n,fieldsDefine:i,echoRequest:a}=this.searchHelper;if(n||v("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),i){const e=["valueKey","displayKey","extraKey"];for(const t in i)e.includes(t)&&(this[t]=i[t])}Object.keys(this.alias).includes(e)||v("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),a&&!this.valueKey&&v("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!r&&v("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),Ja(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),Ja(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:i,triggeredChange:a,fieldAliasMap:o,extraAliasMap:l}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},c="function"==typeof l?l():l||{},d=this.getItemValue();if(!e||pe(d))return this._prevValue=void 0;try{const o=await e(r({...t,key:d}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,ne.get)(o.data,n)??[];if(e[0]){const t=e[0];if(s&&Hn(t,this.alias,s),c&&_n(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,a){const e=Fn(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}i?.([t])}}}catch(e){}})),Ja(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias){const i=Fn(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:i}),n===r&&t.setViewValue(r,i)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Fn(e,this.extras[r])})})),Ja(this,"fetchHandle",(0,ne.debounce)(this.getItemList,200)),Ja(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Ja(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),Ja(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),Ja(this,"clickHandle",((e,t)=>{const{$$form:r}=this.context,{fieldName:n}=this.props.option;for(const t in this.alias)t!==n&&r.SET_FIELDS_VALUE({[t]:Fn(e,this.alias[t])});for(const t in this.extras)r.SET_FIELDS_EXTRA({[t]:Fn(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const i=Fn(e,this.alias[n]);this.triggerChange(i),this.setState({inputText:void 0}),t&&t()})),this.initialHandle()}get searchHelper(){return this.getSearchHelper(this.props.option.options,this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(e){const t=e.option.searchHelper?.request?.params||e.option.request?.params,r=this.props.option.searchHelper?.request?.params||this.props.option.request?.params;if((0,ne.isEqual)(t,r)||this.getItemList(),null===this._prevValue)return;const n=this.getItemValue();this._prevValue!==n&&n!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=n}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:r,params:n={},formatter:i=(e=>e),dataKey:a}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const o=await r(i({...n,[t]:e}));if(200===o.code){const e=Array.isArray(o.data)?o.data:(0,ne.get)(o.data,a)??[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}render(){const{$$form:e}=this.context,{visible:t,loading:r,itemList:n,inputText:i}=this.state,{value:a}=this.props,{fieldName:l,options:s={},style:d={},placeholder:u=f("qm.form.inputPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:g}=this.props.option,{listHeight:b=wn}=s,{hideHeader:y,onlySelect:v=!0}=this.searchHelper||s,x=this.searchHelper.columns||[],E=Ie("form-immediate"),S=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,w=o().createElement(L.Spin,{spinning:r},n.length?o().createElement("table",{cellSpacing:0,cellPadding:0,className:Ne()("table")},!y&&o().createElement("thead",null,o().createElement("tr",null,x.filter((e=>!e.hidden)).map((e=>o().createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),o().createElement("tbody",null,n.map(((e,t)=>o().createElement("tr",{key:t,className:this.state.activeIndex===t?"active":"",onMouseEnter:()=>{this.setState({activeIndex:t})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},x.filter((e=>!e.hidden)).map((t=>o().createElement("td",{key:t.dataIndex},(0,ne.get)(e,t.dataIndex))))))))):o().createElement(bt,null));return o().createElement(c.Consumer,null,(r=>{const s={[E]:!0,[`${E}--lg`]:"large"===r?.size,[`${E}--sm`]:"small"===r?.size};return e.isOnlyShow?o().createElement(ii,{value:a,bordered:p}):o().createElement(Yi(),{action:g?[]:["click"],popupVisible:!g&&t,popup:w,popupClassName:Ne()(s,`form-popper__${l}`),popupStyle:{minWidth:S,maxHeight:b},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Tn,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement(L.Input,{ref:this.searchRef,placeholder:u,allowClear:h,bordered:p,readOnly:m,disabled:g,style:{width:"100%",...d},value:i??a,title:a,onFocus:()=>{!n.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(n[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 r=40===e.keyCode?++t%n.length:(--t+n.length)%n.length;this.setState({activeIndex:r})}},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)}}))}))}}Ja(eo,"contextType",Nr);class to extends a.Component{constructor(e,t){let{$$form:r}=t;super(e),Ja(this,"context",void 0),Ja(this,"promiseRef",void 0),Ja(this,"state",{searchHelper:{}}),Ja(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){y("Form","搜索帮助获取定义信息的接口出错")}})),Ja(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return v("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,a)=>{try{const o=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===o.code){const r=Kn(Object.assign({},o.data,n),i,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else a()}catch(e){a()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:i,fieldName:a,invisible:l,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(n),className:Ne()(d),tooltip:i,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ge(c)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(n)}},o().createElement(eo,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";f(t,arguments.length>1?arguments[1]:void 0),e.setViewValue(a,t)}}))),p&&o().createElement(L.Col,null,e.renderFormItemButton(a,p)),u&&o().createElement(L.Col,{flex:ge(u.labelWidth||xn)},e.renderFormItemExtra({fieldName:a,...u}))))}}Ja(to,"contextType",Nr);const ro=to;function no(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class io extends a.Component{constructor(){super(...arguments),no(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,fieldName:n,className:i,style:a={},collapse:l={}}=this.props.option,{expand:s}=e.state,{showLimit:c,remarkItems:d=[],onCollapse:u=le}=l,p=[];if(d.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===n))??[],r=c??t.length-1;t.slice(r+1).forEach((t=>{const r=d.find((e=>e.fieldName===t.fieldName));if(!r)return;const n=r.showLabel?`${t.label}:`:"",i=e.getViewValue(t.fieldName)??"";""!==i&&p.push({...t,text:`${n}${i}`})}))}return o().createElement(L.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},o().createElement(ke,{id:n,label:r,className:i,extra:p.map((e=>e.text)).join(" | "),style:{...a},collapse:s[n],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[n]:t})}))),u(t)}}))}}no(io,"contextType",Nr);const ao=io;function oo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lo(){return lo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},lo.apply(this,arguments)}const so=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:so(e.children,t,r,n)}:e)),co=e=>{const{$$form:t}=o().useContext(Nr),{value:r,items:n,multiple:i,loading:a,onChange:l,onValuesChange:s}=e,{fieldName:c,options:d={},style:u={},placeholder:p=f("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,asyncLoad:g,readOnly:b,disabled:y}=e.option,{itemList:v,filterable:x=!0,listHeight:E=wn,checkStrictly:S,checkStrategy:w="SHOW_CHILD",collapseTags:C,defaultExpandAll:T=!g,defaultExpandedKeys:N,openPyt:I=!0}=d,[R,P]=o().useState(pe(v)?n:v);Ve((()=>{P(pe(v)?n:v)}),[v,n]);const O=e=>$n(R,e)?.text||e?.toString()||"",k=e=>i?e?.map((e=>O(e))).join(",")||"":O(e);return t.isOnlyShow?o().createElement(ii,{value:k(r),bordered:h}):o().createElement(L.TreeSelect,lo({fieldNames:{label:"text",value:"value",children:"children"},value:r,multiple:i,treeCheckable:i,treeCheckStrictly:S,showCheckedStrategy:L.TreeSelect[w],popupClassName:`form-popper__${c}`,placeholder:p,listHeight:E,style:u,loading:a,bordered:h,allowClear:m,disabled:y,treeDefaultExpandAll:T,treeDefaultExpandedKeys:N,showSearch:x,maxTagCount:C?"responsive":void 0,loadData:g?async e=>{let{key:t,children:r}=e;if(!g||r)return;const{fetchApi:n,params:i,dataKey:a,textKey:o="text",valueKey:l="value",callback:s,formatter:c=(e=>e)}=g;if(n)try{const e=await n(c({...i,[l]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,a)??[],n=so(R,t,l,Dn(r,l,o));P(n),s?.(r)}}catch(e){}}:void 0,treeData:R},i?{title:k(r)}:null,{filterTreeNode:(e,t)=>{const r=t?.text?.toString()||"",n=ri.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(I?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{l?.(e),s(e,k(e),R)})(e)}}))};class uo extends a.Component{constructor(){super(...arguments),oo(this,"context",void 0),oo(this,"state",{itemList:[],loading:!1}),oo(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:i="value",textKey:a="text",callback:o}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,n)??[],r=Dn(t,i,a);this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,ne.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:r}=this.state,{type:n,label:i,tooltip:a,fieldName:l,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(i),className:Ne()(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ge(d)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},o().createElement(co,{option:this.props.option,items:t,loading:r,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(l,r)}}))),p&&o().createElement(L.Col,{flex:ge(p.labelWidth||xn)},e.renderFormItemExtra({fieldName:l,...p}))))}}oo(uo,"contextType",Nr);const po=uo;function ho(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mo(){return mo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mo.apply(this,arguments)}const fo=e=>{const{$$form:t}=o().useContext(Nr),{value:r,multiple:n,items:i}=e,{fieldName:a,options:l={},style:s={},placeholder:c=f("qm.form.selectPlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:p,disabled:h}=e.option,{changeOnSelect:m,checkStrictly:g,checkStrategy:b="SHOW_PARENT",filterable:y=!0,openPyt:v=!0}=l,{itemList:x=[]}=l,E=pe(x)?i:x,S=e=>qn(E,e??"").map((e=>e.text)).join("/"),w=e=>n?e?.map((e=>S(e))).join(",")||"":S(e);return t.isOnlyShow?o().createElement(ii,{value:w(r),bordered:d}):o().createElement(L.Cascader,mo({value:(e=>pe(e)?[]:n?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:E,multiple:n,maxTagCount:"responsive",changeOnSelect:m||g,showCheckedStrategy:L.Cascader[b],popupClassName:`form-popper__${a}`,placeholder:c,style:s,bordered:d,allowClear:u,disabled:h,showSearch:y&&{filter:(e,t)=>t.some((t=>{const r=t?.text?.toString()||"",n=ri.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(v?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))}},n?{title:w(r)}:null,{onChange:t=>{(t=>{const{onChange:r,onValuesChange:n}=e;r?.(t),n(t,w(t),E)})(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return n?e.map((e=>e.join(","))):e.join(",")}(t))}}))};class go extends a.Component{constructor(){super(...arguments),ho(this,"context",void 0),ho(this,"state",{itemList:[],loading:!1}),ho(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:i="value",textKey:a="text",callback:o}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,n)??[],r=Dn(t,i,a);this.setState({itemList:r},(()=>o?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,ne.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:t}=this.props,{itemList:r}=this.state,{type:n,label:i,tooltip:a,fieldName:l,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(i),className:Ne()(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ge(d)},required:e.getFormItemRequired(m)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},o().createElement(fo,{option:this.props.option,multiple:t,items:r,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(l,r)}}))),p&&o().createElement(L.Col,{flex:ge(p.labelWidth||xn)},e.renderFormItemExtra({fieldName:l,...p}))))}}ho(go,"contextType",Nr);const bo=go,yo=require("china-area-data");var vo=n.n(yo);function xo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Eo=["110000","120000","310000","500000"],So=["810000","820000"],wo=[{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"}],Co=[{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"}],To=e=>ri.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),No=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(!(r>2)&&e[t])return("86"===t?Object.keys(e[t]).filter((e=>![...Eo,...So].includes(e))):Object.keys(e[t])).map((n=>({l:To(e[t][n].slice(0,1)).toUpperCase(),n:e[t][n],c:n,p:t,children:No(e,n,r+1)})))},Io=(e,t)=>t.map((t=>({l:To(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class Ro extends a.Component{constructor(e){super(e),xo(this,"context",void 0),xo(this,"searchRef",o().createRef()),xo(this,"scrollRef",o().createRef()),xo(this,"zxsAndGa",void 0),xo(this,"provinces",void 0),xo(this,"allCities",void 0),xo(this,"letterCities",void 0),xo(this,"state",{visible:!1,select_type:"0",active_key:""}),xo(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),xo(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)})),this.zxsAndGa=this.createZxsAndGa(),this.provinces=this.createProvince(),this.allCities=this.createAllCity(),this.letterCities=this.createCity()}componentDidMount(){this.setInputReadonly()}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),Zt()(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){return this.allCities.find((t=>t.c===e))?.n||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:Io(vo(),Eo)},{l:"Z2",n:"港澳",c:"",p:"",children:Io(vo(),So)}]}createProvince(){return(No(vo(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return Co.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...Eo,...So].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return o().createElement(L.Radio.Group,{size:"small",buttonStyle:"solid",value:e,onChange:e=>{const{value:t}=e.target;this.setState({select_type:t,active_key:""},(()=>{this.scrollRef.current.scrollTop=0}))}},o().createElement(L.Radio.Button,{value:"0"},f("qm.form.citySelectType.0")),o().createElement(L.Radio.Button,{value:"1"},f("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:t}=this.state;return("0"===t?wo:Co).map((t=>o().createElement("li",{key:t.value,className:Ne()({tag:!0,actived:t.value===e}),onClick:()=>this.scrollHandle(t.value.toString())},t.text)))}renderSelect(){const{value:e}=this.props;return o().createElement(L.Select,{size:"small",placeholder:f("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>(t?.children?.toString()||"").toLowerCase().indexOf(e.toLowerCase())>=0,value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>o().createElement(L.Select.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:t}=this.state;return("0"===t?this.provinces:this.letterCities).map(((t,r)=>o().createElement("div",{key:r},o().createElement("dt",{ref:e=>this[`${t.l}Ref`]=e},t.n,":"),o().createElement("dd",null,t.children?.map((t=>o().createElement("li",{key:t.c,className:Ne()({actived:t.c===e}),onClick:()=>this.clickHadnle(t.c)},t.n)))))))}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:r}=this.props,{fieldName:n,options:i={},style:a={},placeholder:l=f("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:d=!0,readOnly:u,disabled:p}=this.props.option,h=Ie("form-city-select"),m=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=this.createTextValue(r),b=o().createElement("div",{className:"container",style:{...a}},o().createElement("div",{className:"city-drop"},o().createElement("div",{className:"city-drop-toper"},o().createElement("div",{className:"city-drop-toper__type"},this.renderType()),o().createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),o().createElement("div",{className:"city-drop-letter"},this.renderLetter()),o().createElement("div",{ref:this.scrollRef,className:"city-drop-list"},o().createElement("dl",null,this.renderCity(r)))));return o().createElement(c.Consumer,null,(r=>{const i={[h]:!0,[`${h}--lg`]:"large"===r?.size,[`${h}--sm`]:"small"===r?.size};return e.isOnlyShow?o().createElement(ii,{value:g,bordered:s}):o().createElement(Yi(),{action:p?[]:["click"],popupVisible:!p&&t,popup:b,popupClassName:Ne()(i,`form-popper__${n}`),popupStyle:{minWidth:m},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Tn,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement(L.Input,{ref:this.searchRef,placeholder:l,allowClear:d,bordered:s,readOnly:u,disabled:p,style:{width:"100%",...a},value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}}))}))}}xo(Ro,"contextType",Nr);class Po extends a.Component{constructor(){super(...arguments),xo(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Ro,{option:this.props.option,onValuesChange:(t,r)=>{h(t,r),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...d}))))}}xo(Po,"contextType",Nr);const Oo=Po;function ko(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ao=(e,t)=>{if(e[t])return Object.keys(e[t]).map((r=>({text:e[t][r],value:r,children:Ao(e,r)})))};class Lo extends a.Component{constructor(e){super(e),ko(this,"context",void 0),ko(this,"searchRef",o().createRef()),ko(this,"prevText",void 0),ko(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),ko(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const t=Ao(vo(),"86")||[];this.state={results:t,visible:!1,values:[],tabs:[t.map((e=>({text:e.text,value:e.value})))],activeName:"0"}}componentDidMount(){this.initial(),this.setInputReadonly()}componentDidUpdate(e){const{value:t}=e,{value:r}=this.props;t!==r&&this.state.values.join(",")!==(r??"")&&this.initial()}get isFetch(){return!!this.props.option.request?.fetchApi}get level(){let{selectLevel:e=0}=this.props.option.options||{};return(e<1||e>3)&&(e=3),this.isFetch?4:e}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>this.state.tabs[t]?.find((t=>t.value===e))?.text)).join("/")}initial(){const{value:e}=this.props,t=e?e.split(","):[];this.setState({values:t},(()=>{this.createTabs(),this.createActiveName(t.length?t.length-1:0)}))}createActiveName(e){this.setState({activeName:e.toString()})}createTabs(){const{results:e,values:t}=this.state;if(!e.length)return;const r=this.state.tabs.slice(0,1);for(let n=0;n<t.length;n++){const i=$n(e,t[n]);if(i&&pe(i.children)){this.isFetch&&this.getStreetList(t[n]);break}Array.isArray(i?.children)&&(r[n+1]=i?.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:r})}async getStreetList(e){const{request:t={}}=this.props.option,{fetchApi:r,formatter:n=(e=>e),dataKey:i,valueKey:a="value",textKey:o="text"}=t;if(r)try{const t=await r(n({code:e}));if(200===t.code){const e=Array.isArray(t.data)?t.data:(0,ne.get)(t.data,i)??[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[o],value:e[a]})))]})))}}catch(e){}}renderTabs(){const{values:e}=this.state,t=this.state.tabs.map(((t,r)=>{const n=t.find((t=>t.value===e[r]))?.text||`${f("qm.form.selectPlaceholder").replace("...","")}(${f("qm.form.regionSelectLabel")[r]})`;return o().createElement(ur.TabPane,{key:r.toString(),tab:n},o().createElement("div",{className:"region-box"},t.map((t=>o().createElement("span",{key:t.value,className:Ne()({"region-box__item":!0,actived:e.includes(t.value.toString())}),title:t.text,onClick:()=>{let{values:e}=this.state;e[r]=t.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)}))}},t.text)))))}));return t.length?o().createElement(ur,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},t):o().createElement(bt,null)}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:r}=this.props,{fieldName:n,options:i={},style:a={},placeholder:l=f("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:d=!0,readOnly:u,disabled:p}=this.props.option,h=Ie("form-region-select"),m=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=o().createElement("div",{className:"container"},this.renderTabs());let b=this.prevText;if(!t){const e=this.createTextValue(r);(""===e||e.split("/").every((e=>""!==e)))&&(b=e,this.prevText=b)}return o().createElement(c.Consumer,null,(r=>{const i={[h]:!0,[`${h}--lg`]:"large"===r?.size,[`${h}--sm`]:"small"===r?.size};return e.isOnlyShow?o().createElement(ii,{value:b,bordered:s}):o().createElement(Yi(),{action:p?[]:["click"],popupVisible:!p&&t,popup:g,popupClassName:Ne()(i,`form-popper__${n}`),popupStyle:{minWidth:m},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Tn,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement(L.Input,{ref:this.searchRef,placeholder:l,allowClear:d,bordered:s,style:{width:"100%",...a},readOnly:u,disabled:p,value:b,title:b,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&de((()=>this.initial()))}}))}))}}ko(Lo,"contextType",Nr);class Fo extends a.Component{constructor(){super(...arguments),ko(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Lo,{option:this.props.option,onValuesChange:(t,r)=>{h(t,r),e.setViewValue(i,r)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...d}))))}}ko(Fo,"contextType",Nr);const Ho=Fo;function _o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Do=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:i}=e,{options:a={},upload:l={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:p=1,fileTypes:h,fileSize:m,fileDirection:g,onPreview:b,onRemove:y}=a,{action:v,headers:x,params:E,withCredentials:S=!1,dataKey:w="",downloadWithHeaders:C,fieldAliasMap:T,beforeUpload:N,button:I}=l,R="function"==typeof T?T():T||{};return o().createElement(Sl,{name:"file",action:v,multiple:u,headers:x,data:E,withCredentials:S,downloadWithHeaders:C,beforeUpload:N,maxCount:p,fileTypes:h,fileSize:m,fileDirection:g,disabled:c,readOnly:t.isOnlyShow||d,button:I,showUploadList:{showDownloadIcon:!0,downloadIcon:o().createElement(Re.DownloadOutlined,null)},fileList:r,onChange:e=>{let{file:t,fileList:r}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in R)r[n]=e[n]||t.data?.[R[n]]||"";return e.response&&200!==t.code&&L.message.error(t.message||f("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(w?(0,ne.get)(t.data,w):t.data)||"",status:e.status}}));n?.(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onPreview:b,onRemove:y})};class $o extends a.Component{constructor(){super(...arguments),_o(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Do,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,"")}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...d}))))}}_o($o,"contextType",Nr);const qo=$o;function Mo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const jo=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:i}=e,{options:a={},upload:l={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:p=1,fixedSize:h,quality:m,openCropper:g,fileTypes:b,fileSize:y,onRemove:v}=a,{action:x,headers:E,params:S,withCredentials:w=!1,dataKey:C="",popupClassName:T,fieldAliasMap:N,beforeUpload:I}=l,R="function"==typeof N?N():N||{};return o().createElement(Pl,{name:"file",action:x,multiple:u,headers:E,data:S,withCredentials:w,popupClassName:T,beforeUpload:I,maxCount:p,fixedSize:h,quality:m,openCropper:g,fileTypes:b,fileSize:y,disabled:c,readOnly:t.isOnlyShow||d,fileList:r,onChange:e=>{let{file:t,fileList:r}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in R)r[n]=e[n]||t.data?.[R[n]]||"";return e.response&&200!==t.code&&L.message.error(t.message||f("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(C?(0,ne.get)(t.data,C):t.data)||"",status:e.status}}));n?.(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onRemove:v})};class Ko extends a.Component{constructor(){super(...arguments),Mo(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(jo,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,"")}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...d}))))}}Mo(Ko,"contextType",Nr);const Vo=Ko;function zo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Bo=e=>{const{$$form:t}=o().useContext(Nr),{value:r,onChange:n,onValuesChange:i}=e,{options:a={},upload:l,style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{tinymce:u,thresholdSize:p,onResizeEditor:h}=a;return o().createElement(gl,{value:r,tinymce:u,upload:l,thresholdSize:p,style:{width:"100%",...s},disabled:d||c||t.isOnlyShow,onResizeEditor:h,onChange:e=>{(e=>{n?.(e),i(e)})(e)}})};class Uo extends a.Component{constructor(){super(...arguments),zo(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:i,invisible:a,options:l={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return o().createElement(L.Form.Item,{label:e.renderFormLabel(r),className:Ne()(c),tooltip:n,hidden:a,labelCol:{flex:e.verticalLayout?"initial":ge(s)},required:e.getFormItemRequired(p)},o().createElement(L.Row,{wrap:!1,gutter:4},o().createElement(L.Col,{flex:"auto"},o().createElement(L.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},o().createElement(Bo,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,t)}}))),d&&o().createElement(L.Col,{flex:ge(d.labelWidth||xn)},e.renderFormItemExtra({fieldName:i,...d}))))}}zo(Uo,"contextType",Nr);const Wo=Uo;function Go(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Yo extends a.Component{constructor(e){super(e),Go(this,"context",void 0),Go(this,"provide",{$$form:this,echo_data:{}}),Go(this,"_initialValues",void 0),Go(this,"_initialOthers",void 0),Go(this,"_initialExtras",void 0),Go(this,"_fieldAuth",{}),Go(this,"wrapperRef",o().createRef()),Go(this,"formRef",o().createRef()),Go(this,"originItems",[]),Go(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),Go(this,"resizeObserveHandler",(()=>{const e=this.wrapperRef.current?.offsetWidth;if(void 0===e||0===e||this.props.cols>0)return;let t=Math.floor(e/300);t=24%t==0?t:t-1,t=t<1?1:t,t=t>8?8:t,t!==this.state.flexCols&&this.setState({flexCols:t})})),Go(this,"resizeListenerHandle",(0,ne.debounce)(this.resizeObserveHandler,10)),Go(this,"getFormItems",Tr()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),Go(this,"getFlattenItems",Tr()((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{(0,ne.isPlainObject)(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t}))),Go(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),Go(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),Go(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),Go(this,"finishFailedHandle",(e=>{let{values:t,errorFields:r}=e;this.props.onFinishFailed?.(r)})),Go(this,"openValidateInfo",(e=>{const t=o().createElement("ul",null,e.map((e=>{const{label:t}=this.formItems.find((t=>t.fieldName===e.name[0]));return o().createElement("li",{key:e.name[0],style:{color:"#ff4d4f"}},"[",("string"==typeof t?`${t}: `:"")+e.errors.join(","),"]")})));L.notification.error({message:f("qm.form.validatePrompt"),description:t,duration:10})})),Go(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Zt()(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})})),this.createOriginItems(),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){return this.props.size??this.context.size??""}get verticalLayout(){return"vertical"===this.props.layout}get formItems(){return this.getFormItems(this.props.items)}get flattenItems(){return this.getFlattenItems(this.formItems)}get dividers(){return this.formItems.filter((e=>"DIVIDER"===e.type))}get isFilterType(){return"search"===this.props.formType}get isOnlyShow(){return"onlyShow"===this.props.formType}get isFormDisabled(){return this.props.disabled}get isCompactMode(){const e=this.context.global;return this.props.compactMode??("small"===this.$size&&!!e?.compactModeInSmallSize)}get showDividerCollapse(){return this.dividers.some((e=>!!e.collapse))}get showFilterCollapse(){return this.props.isCollapse&&this.formItems.length>=this.state.flexCols}componentDidMount(){this.checkFieldNames(),this.initialHandle(),this.createInputFocus(),this.bindResizeEvent(),this.resizeObserveHandler()}componentDidUpdate(e,t){this.props.items!==e.items&&this.checkFieldNames()}componentWillUnmount(){this.removeResizeEvent()}bindResizeEvent(){It(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){Rt(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&&v("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).some((e=>e.required))}createOtherValue(e){const t=this.flattenItems.map((e=>e.fieldName)),r={};for(const n in e)t.includes(n)||(r[n]=e[n]);return Object.assign({},r)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,ne.isPlainObject)(e.extra))).forEach((r=>{t[r.fieldName]=e[r.fieldName]??""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>(0,ne.isPlainObject)(e.collapse))).forEach((t=>{e[t.fieldName]=t.collapse.defaultExpand??!1})),Object.assign({},e)}getInitialValue(e,t){const{type:r,options:n}=e;return t=t??void 0,Cn.includes(r)&&(t=t??[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=t??n?.falseValue??Sn),t}createFormValue(e){const t={};return this.flattenItems.forEach((r=>{t[r.fieldName]=this.getInitialValue(r,e[r.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=fe(this.props.items)}getOriginItems(){return this.originItems}setViewValue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";t!==this.getViewValue(e)&&this.setState((r=>({viewData:Object.assign({},r.viewData,{[e]:t})})))}getViewValue(e){return this.state.viewData[e]??""}setExpandHandle(e){e!==this.state.collapse&&(this.setState({collapse:e}),this.props.onCollapse?.(e),de((()=>this.props.onCollapse?.(e))))}createInputFocus(){const{isAutoFocus:e}=this.props;if(!e||this.isOnlyShow)return;const{type:t,fieldName:r}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!r||setTimeout((()=>this.CREATE_FOCUS(r)))}getFormItemLabel(e){if(Mn(e))return jn(e);if((0,ne.isPlainObject)(e)){const{fieldName:t,label:r,options:n={}}=e;if(Mn(r))return jn(r);const{itemList:i=[]}=n,a=this.formRef.current?.getFieldsValue([t])[t]??this._initialValues[t]??i[0]?.value;return i.find((e=>e.value===a))?.text||""}return""}getBlockDerivedItems(){const e=[];for(let t=0,r=this.dividers.length;t<r;t++){const r=this.formItems.findIndex((e=>e===this.dividers[t]));let n=this.formItems.findIndex((e=>e===this.dividers[t+1]));n=n>-1?n:void 0,e.push(this.formItems.slice(r,n).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay(e){let{type:t,fieldName:r}=e;if("DIVIDER"===t)return!0;const n=this.getBlockDerivedItems();for(let e=0,t=n.length;e<t;e++){const t=n[e],i=this.dividers.find((e=>e.fieldName===t[0].fieldName)),a=i?.collapse?.showLimit??t.length-1;for(let e=1;e<t.length;e++)if(t[e].fieldName===r&&e>a)return this.state.expand[t[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const r=e[t];if(Ln(r)&&(e[t]=""),Array.isArray(r)&&r.forEach(((r,n)=>{Ln(r)&&(e[t][n]="")})),t.includes("|")&&Array.isArray(r)){const[n,i]=t.split("|");e[n]=r[0]??"",e[i]=r[1]??""}}if(this.isFilterType)for(const t in e)pe(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}async createFormAuth(){const{authConfig:e}=this.props;if(!e)return;let t=re()(e,["fetch"]);if(e.fetch){const{api:r,params:n,dataKey:i}=e.fetch;try{const e=await r(n);200===e.code&&(t=(i?(0,ne.get)(e.data,i):e.data)??{})}catch(e){}}if(Array.isArray(t.fieldList)){const e=this.props.items.map((e=>{const{fieldName:r}=e,n=t.fieldList.find((e=>e.dataIndex===r));if(n){const t=this.originItems.find((e=>e.fieldName===r)),{visible:i=1,disabled:a,secretName:o}=n;i||(e.noAuth=!0,t.noAuth=!0),a&&(e.disabled=!0,t.disabled=!0),o&&(e.options?e.options.secretType=o:e.options={secretType:o},t.options=Object.assign({},t.options,{secretType:o})),this.setFieldAuth(r,{visible:i,disabled:a,secretName:o})}return e}));this.props.fieldsChange?.(e)}}INPUT(e){return o().createElement(Si,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return o().createElement(Ni,{option:e})}INPUT_NUMBER(e){return o().createElement(Ai,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return o().createElement(_i,{option:e})}SEARCH_HELPER(e){return o().createElement(Ki,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return o().createElement(Ji,{option:e})}TREE_TABLE_HELPER(e){return o().createElement(ia,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return o().createElement(da,{option:e})}RANGE_SEARCH_HELPER(e){return o().createElement(fa,{option:e})}CHECKBOX(e){return o().createElement(mi,{option:e})}MULTIPLE_CHECKBOX(e){return o().createElement(va,{option:e})}RATE(e){return o().createElement(wa,{option:e})}RADIO(e){return o().createElement(Ia,{option:e})}SWITCH(e){return o().createElement(ka,{option:e})}TEXT_AREA(e){return o().createElement(Ha,{option:e})}DATE(e){return o().createElement(qa,{option:e})}RANGE_DATE(e){return o().createElement(za,{option:e})}TIME(e){return o().createElement(Ga,{option:e})}RANGE_TIME(e){return o().createElement(Za,{option:e})}SELECT(e){return o().createElement(di,{option:e})}MULTIPLE_SELECT(e){return o().createElement(di,{option:e,multiple:!0})}IMMEDIATE(e){return o().createElement(ro,{option:e})}DIVIDER(e){return o().createElement(ao,{option:e})}TREE_SELECT(e){return o().createElement(po,{option:e})}MULTIPLE_TREE_SELECT(e){return o().createElement(po,{option:e,multiple:!0})}CASCADER(e){return o().createElement(bo,{option:e})}MULTIPLE_CASCADER(e){return o().createElement(bo,{option:e,multiple:!0})}CITY_SELECT(e){return o().createElement(Oo,{option:e})}REGION_SELECT(e){return o().createElement(Ho,{option:e})}UPLOAD_FILE(e){return o().createElement(qo,{option:e})}UPLOAD_IMG(e){return o().createElement(Vo,{option:e})}TINYMCE(e){return o().createElement(Wo,{option:e})}renderFormLabel(e){if(Mn(e)||!(0,ne.isPlainObject)(e))return e;const{type:t,fieldName:r,label:n,options:i={},onChange:a=le}=e,{itemList:l=[]}=i;return"SELECT"===t?o().createElement(L.Form.Item,{name:r,noStyle:!0},o().createElement(si,{option:e,items:l,loading:!1,onValuesChange:(e,t)=>a(e,t)})):"CHECKBOX"===t?o().createElement(o().Fragment,null,o().createElement("span",{style:{paddingRight:5}},n),o().createElement(L.Form.Item,{name:r,noStyle:!0},o().createElement(pi,{option:e,onValuesChange:e=>a(e)}))):null}renderFormItemExtra(e){const{fieldName:t,isTooltip:r,style:n={},render:i}=e,{extra:a}=this.state;if(r)return o().createElement(L.Tooltip,{className:"extra-tooltip",title:a[t]},o().createElement(Re.ExclamationCircleOutlined,{style:{marginLeft:4}}));const l=this.formItems.find((e=>e.fieldName===t));return o().createElement("div",{className:"extra-text",title:i?"":a[t],style:n},o().createElement("span",{className:"extra-overflow-cut"},i?i(l,this):a[t]))}renderFormItemButton(e,t){const r=this.formItems.find((t=>t.fieldName===e)),n="function"==typeof t?t(r):t;return this.isOnlyShow?null:n}renderFormItem(e){const{label:t,fieldName:r,invisible:n,tooltip:i,className:a,labelWidth:l=this.props.labelWidth,rules:s=[],style:c={},render:d}=e;return pe(this.state.formData)?null:o().createElement(L.Form.Item,{label:this.renderFormLabel(t),name:r,rules:s,tooltip:i,hidden:n,className:Ne()(a),style:{width:"100%",...c},labelCol:{flex:this.verticalLayout?"initial":ge(l)}},d?.(e,this))}createFormItem(e){return(0,ne.isFunction)(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(v("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:t,defaultRows:r,isFieldsDefine:n}=this.props,i=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:r=0}=e;for(let e=0;e<t;e++)i.push({});i.push(e);for(let e=0;e<r;e++)i.push({})}));const a=24/e,l=[],s=i.reduce(((e,t)=>{const{selfCol:r=1}=t,n=e+r;return l.push(n),n}),0),c=r>Math.ceil(s/e)?Math.ceil(s/e):r,d=[],u=i.map(((t,r)=>{let{selfCol:n=1}=t;const{type:i,fieldName:s}=t;n=n>=24||"DIVIDER"===i||"TINYMCE"===i?e:n;const u=!(!this.state.collapse&&this.showFilterCollapse)||l[r]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(t);return u&&d.push(l[r]),o().createElement(L.Col,{key:s??r,className:s,span:n*a,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:p?"block":"none"}},i?this.createFormItem(fe(t)):null)}));return n&&"default"===t&&u.push(o().createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...u,this.createSearchButtonLayout(d[d.length-1])]}createSearchButtonLayout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{flexCols:t,collapse:r}=this.state,{searchButtonCols:n,isSearchBtn:i,isFieldsDefine:a=!0}=this.props;if(!this.isFilterType)return null;const l=24/t,s=n||1,c=t-e%t-s;return i?o().createElement(L.Col,{key:"-",span:s*l,offset:c*l,style:{textAlign:"right"}},o().createElement(L.Space,{style:{marginBottom:12}},o().createElement(xe,{type:"primary",size:this.$size,icon:o().createElement(Re.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},f("qm.form.search")),o().createElement(xe,{size:this.$size,icon:o().createElement(Re.ReloadOutlined,null),onClick:()=>this.RESET_FORM()},f("qm.form.reset")),a?this.createFieldsDefine():null,this.showFilterCollapse&&o().createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?o().createElement(Re.UpOutlined,null):o().createElement(Re.DownOutlined,null)," ",f(r?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:t,isSubmitBtn:r}=this.props;if(this.isFilterType)return null;const n=24/e;return r&&"default"===t?o().createElement(L.Row,{gutter:0},o().createElement(L.Col,{key:"-",span:n},o().createElement(L.Form.Item,null,o().createElement(L.Space,{style:{marginBottom:12}},o().createElement(xe,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},f("qm.form.save")),o().createElement(xe,{size:this.$size,onClick:()=>this.RESET_FORM()},f("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:t,fieldsChange:r}=this.props;return o().createElement(yi,{uniqueKey:e,items:t,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((async(e,t)=>{const[r,n]=await this.VALIDATE_FIELDS(),i=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>this[`${e.fieldName}_Ref`]?.searchRef._is_change)).map((e=>({name:[e.fieldName],errors:[f("qm.form.searchHelperTips")],warnings:[]})));r||i.length?t((r||[]).concat(i)):e(n)}))}SET_FIELDS_VALUE(e){this.formRef.current.setFieldsValue(e),this.set_fields_other(e)}GET_FIELDS_VALUE(e){return e?Object.assign({},this.get_fields_other(e),this.formRef.current.getFieldsValue(e)):Object.assign({},this.state.other,this.formRef.current.getFieldsValue(!0))}async GET_FORM_DATA(){try{const e=await this.formValidate();return[null,Object.assign({},this.get_fields_other(),this.formatFormValue(e))]}catch(e){return this.props.scrollToFirstError&&this.scrollToField(e[0].name[0]),[e,null]}}async VALIDATE_FIELDS(e){try{return[null,await this.formRef.current.validateFields(e)]}catch({errorFields:e}){return this.isCompactMode&&this.openValidateInfo(e),[e,null]}}SET_FIELDS_EXTRA(e){this.setState((t=>({extra:Object.assign({},t.extra,e)})))}SET_FIELDS_ECHO(e){Object.keys(e).length&&(Object.assign(this.provide,{echo_data:Object.assign({},this.provide.echo_data,e)}),this.forceUpdate())}GET_FIELDS_EXTRA(e){if(!e)return this.state.extra;const t={};return e.forEach((e=>{t[e]=this.state.extra[e]})),t}GET_FIELDS_TOUCHED(e){return this.formRef.current.isFieldsTouched(e)}async SUBMIT_FORM(){try{await this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}RESET_FORM(){const e=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),t=this.flattenItems.map((e=>e.fieldName)).filter((t=>!e.includes(t)));t.length&&this.formRef.current.resetFields(t),this.setState((e=>{const t=Object.keys(e.other),r=Object.keys(this._initialOthers),n=t.filter((e=>!r.includes(e))),i={};return n.forEach((e=>i[e]=void 0)),{other:Object.assign({},this._initialOthers,i)}})),this.setState({extra:Object.assign({},this._initialExtras)}),this.props.onReset?.()}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){v("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,r){const{items:n,fieldsChange:i}=this.props,a=n.find((t=>t.fieldName===e));if(!a)return v("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!(0,ne.isPlainObject)(t))return v("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(a.noAuth)return v("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const r in t)r&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===r||(0,ne.set)(a,r,t[r]));r&&(i?i([...n]):v("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:t,layout:r,disabled:n,labelWidth:i,labelAlign:a,labelWrap:l,customClass:s}=this.props,c=Ie("form"),d={required:"${label}"+f("qm.form.requiredTips")},u={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}__only-show`]:this.isOnlyShow,[`${c}__compact`]:this.isCompactMode,[s]:!!s};return o().createElement("div",{ref:this.wrapperRef,className:Ne()(u,e),style:t},o().createElement(L.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:r,labelAlign:a,labelWrap:l,colon:!1,disabled:n,labelCol:{flex:this.verticalLayout?"initial":ge(i)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},o().createElement(Nr.Provider,{value:this.provide},o().createElement(L.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}Go(Yo,"contextType",c),Go(Yo,"propTypes",Pn),Go(Yo,"defaultProps",On);const Xo=Yo,Qo={onActivate:l.func,onAddUndo:l.func,onBeforeAddUndo:l.func,onBeforeExecCommand:l.func,onBeforeGetContent:l.func,onBeforeRenderUI:l.func,onBeforeSetContent:l.func,onBeforePaste:l.func,onBlur:l.func,onChange:l.func,onClearUndos:l.func,onClick:l.func,onContextMenu:l.func,onCommentChange:l.func,onCopy:l.func,onCut:l.func,onDblclick:l.func,onDeactivate:l.func,onDirty:l.func,onDrag:l.func,onDragDrop:l.func,onDragEnd:l.func,onDragGesture:l.func,onDragOver:l.func,onDrop:l.func,onExecCommand:l.func,onFocus:l.func,onFocusIn:l.func,onFocusOut:l.func,onGetContent:l.func,onHide:l.func,onInit:l.func,onKeyDown:l.func,onKeyPress:l.func,onKeyUp:l.func,onLoadContent:l.func,onMouseDown:l.func,onMouseEnter:l.func,onMouseLeave:l.func,onMouseMove:l.func,onMouseOut:l.func,onMouseOver:l.func,onMouseUp:l.func,onNodeChange:l.func,onObjectResizeStart:l.func,onObjectResized:l.func,onObjectSelected:l.func,onPaste:l.func,onPostProcess:l.func,onPostRender:l.func,onPreProcess:l.func,onProgressState:l.func,onRedo:l.func,onRemove:l.func,onReset:l.func,onSaveContent:l.func,onSelectionChange:l.func,onSetAttrib:l.func,onSetContent:l.func,onShow:l.func,onSubmit:l.func,onUndo:l.func,onVisualAid:l.func,onSkinLoadError:l.func,onThemeLoadError:l.func,onModelLoadError:l.func,onPluginLoadError:l.func,onIconsLoadError:l.func,onLanguageLoadError:l.func},Zo={apiKey:l.string,id:l.string,inline:l.bool,init:l.object,initialValue:l.string,onEditorChange:l.func,value:l.string,tagName:l.string,cloudChannel:l.string,plugins:l.oneOfType([l.string,l.array]),toolbar:l.oneOfType([l.string,l.array]),disabled:l.bool,textareaName:l.string,tinymceScriptSrc:l.string,rollback:l.oneOfType([l.number,l.oneOf([!1])]),scriptLoading:l.shape({async:l.bool,defer:l.bool,delay:l.number}),...Qo},Jo=e=>"function"==typeof e,el=e=>e in Qo,tl=e=>e.substr(2),rl=(e,t,r,n,i)=>((t,r,n,i,a,o,l)=>{const s=Object.keys(a).filter(el),c=Object.keys(o).filter(el),d=s.filter((e=>void 0===o[e])),u=c.filter((e=>void 0===a[e]));d.forEach((e=>{const t=tl(e),r=l[t];n(t,r),delete l[t]})),u.forEach((n=>{const i=((t,r)=>n=>t(r)?.(n,e))(t,n),a=tl(n);l[a]=i,r(a,i)}))})(i,e.on.bind(e),e.off.bind(e),0,t,r,n);let nl=0;const il=e=>{const t=Date.now(),r=Math.floor(1e9*Math.random());return nl++,e+"_"+r+nl+String(t)},al=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),ol=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),ll=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},sl=()=>({listeners:[],scriptId:il("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),cl=(()=>{let e=sl();return{load:(t,r,n,i,a,o)=>{const l=()=>((t,r,n,i,a,o)=>{const l=r.createElement("script");l.referrerPolicy="origin",l.type="application/javascript",l.id=t,l.src=n,l.async=i,l.defer=a;const s=()=>{l.removeEventListener("load",s),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};l.addEventListener("load",s),r.head&&r.head.appendChild(l)})(e.scriptId,t,r,n,i);e.scriptLoaded?o():(e.listeners.push(o),e.scriptLoading||(e.scriptLoading=!0,a>0?setTimeout(l,a):l()))},reinitialize:()=>{e=sl()}}})(),dl=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function ul(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class pl extends a.Component{constructor(e){var t;super(e),t=this,ul(this,"editor",void 0),ul(this,"id",void 0),ul(this,"elementRef",void 0),ul(this,"inline",void 0),ul(this,"currentContent",void 0),ul(this,"boundHandlers",void 0),ul(this,"rollbackTimer",void 0),ul(this,"valueCursor",void 0),ul(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})),ul(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){}})),ul(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),ul(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))}})),ul(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),ul(this,"initialise",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const r=t.elementRef.current;if(!r)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,r=e.parentNode;for(;null!=r;)t=r,r=t.parentNode;return t===e.ownerDocument}return e.isConnected})(r)){if(0===e)setTimeout((()=>t.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>t.initialise(e+1)),100)}return}const n=dl(t.view);if(!n)throw new Error("tinymce should have been loaded into global scope");const i={...t.props.init,selector:void 0,target:r,readonly:t.props.disabled,inline:t.inline,plugins:(a=t.props.init?.plugins,o=t.props.plugins,ol(a).concat(ol(o))),toolbar:t.props.toolbar??t.props.init?.toolbar,setup:e=>{t.editor=e,t.bindHandlers({}),t.inline&&!al(r)&&e.once("PostRender",(r=>{e.setContent(t.getInitialValue(),{no_events:!0})})),t.props.init&&Jo(t.props.init.setup)&&t.props.init.setup(e)},init_instance_callback:e=>{const r=t.getInitialValue();t.currentContent=t.currentContent??e.getContent(),t.currentContent!==r&&(t.currentContent=r,e.setContent(r),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const n=t.props.disabled??!1;ll(t.editor,n?"readonly":"design"),t.props.init&&Jo(t.props.init.init_instance_callback)&&t.props.init.init_instance_callback(e)}};var a,o;t.inline||(r.style.visibility=""),al(r)&&(r.value=t.getInitialValue()),n.init(i)})),this.id=this.props.id||il("tiny-react"),this.elementRef=a.createRef(),this.inline=this.props.inline??this.props.init?.inline??!1,this.boundHandlers={}}get view(){return this.elementRef.current?.ownerDocument.defaultView??window}componentDidUpdate(e){if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(e),this.editor.initialized)){if(this.currentContent=this.currentContent??this.editor.getContent(),"string"==typeof this.props.initialValue&&this.props.initialValue!==e.initialValue)this.editor.setContent(this.props.initialValue),this.editor.undoManager.clear(),this.editor.undoManager.add(),this.editor.setDirty(!1);else if("string"==typeof this.props.value&&this.props.value!==this.currentContent){const e=this.editor;e.undoManager.transact((()=>{let t;if(!this.inline||e.hasFocus())try{t=e.selection.getBookmark(3)}catch(e){}const r=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const n of[t,r])if(n)try{e.selection.moveToBookmark(n),this.valueCursor=n;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;ll(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==dl(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&cl.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),this.props.scriptLoading?.async??!1,this.props.scriptLoading?.defer??!1,this.props.scriptLoading?.delay??0,this.initialise)}componentWillUnmount(){const e=this.editor;e&&(e.off(this.changeEvents(),this.handleEditorChange),e.off(this.beforeInputEvent(),this.handleBeforeInput),e.off("keypress",this.handleEditorChangeSpecial),e.off("keydown",this.handleBeforeInputSpecial),e.off("NewBlock",this.handleEditorChange),Object.keys(this.boundHandlers).forEach((t=>{e.off(t,this.boundHandlers[t])})),this.boundHandlers={},e.remove(),this.editor=void 0)}render(){return this.inline?this.renderInline():this.renderIframe()}changeEvents(){const e=dl(this.view)?.Env?.browser?.isIE();return e?"change keyup compositionend setcontent CommentChange":"change input compositionend setcontent CommentChange"}beforeInputEvent(){return window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges?"beforeinput SelectionChange":"SelectionChange"}renderInline(){const{tagName:e="div"}=this.props;return a.createElement(e,{ref:this.elementRef,id:this.id})}renderIframe(){return a.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){rl(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,r=t(e),n=t(this.props);!r&&n?(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)):r&&!n&&(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))}}}function hl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}ul(pl,"propTypes",Zo),ul(pl,"defaultProps",{cloudChannel:"6"});var ml=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(ml||{});class fl extends a.Component{constructor(){super(...arguments),hl(this,"context",void 0),hl(this,"defaultOption",{height:400,plugins:"preview importcss searchreplace autolink save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap quickbars emoticons",menubar:"file edit view insert format tools table help",toolbar:"undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl"})}render(){const{size:e,className:t,style:r,tinymce:n={},upload:i={},thresholdSize:a=.5,tinymceScriptSrc:l,disabled:s,value:c,onResizeEditor:d,onChange:u}=this.props,p=this.context.global,h=this.context.locale,m=e||this.context.size||"",g=Ie("tinymce"),b={[g]:!0,[`${g}--lg`]:"large"===m,[`${g}--sm`]:"small"===m},y={init:{height:n.height||this.defaultOption.height,plugins:n.plugins||this.defaultOption.plugins,toolbar:n.toolbar||this.defaultOption.toolbar,menubar:n.menubar||this.defaultOption.menubar,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:ml[h],skin:"tinymce-5",...re()(n,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>new Promise((async(t,r)=>{const{action:n,headers:o,dataKey:l}=i,s=`data:image/jpeg;base64,${e.base64()}`,c=new FormData;c.append("file",e.blob(),e.filename());const d=e.blob().size;if(n&&d/1024/1024>a)try{const e=await fetch(n,{method:"POST",body:c,headers:o});if(!e.ok)throw new Error(f("qm.upload.uploadError"));const r=await e.json();200===r.code&&t(l?(0,ne.get)(r.data,l):r.data)}catch(e){L.message.error(f("qm.uploadCropper.uploadError"))}else t(s)})),setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:r,offsetHeight:n}=e.editorContainer;d?.({width:r,height:n},t)}))}},value:c,disabled:s,tinymceScriptSrc:l||p?.tinymce?.scriptSrc||void 0,onEditorChange:(e,t)=>{u?.(t.getContent(),t)}};return o().createElement("div",{className:Ne()(b,t),style:r},o().createElement(pl,y))}}hl(fl,"contextType",c),hl(fl,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Tinymce","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const gl=fl,bl=require("cropperjs");var yl=n.n(bl);function vl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class xl extends a.Component{constructor(){super(...arguments),vl(this,"imgRef",o().createRef()),vl(this,"cropper",void 0)}componentDidMount(){const{className:e,style:t,src:r,alt:n,imgStyle:i,...a}=this.props,o={};for(const e in a)void 0!==this.props[e]&&(o[e]=this.props[e]);this.cropper=new(yl())(this.imgRef.current,o)}componentWillUnmount(){this.destroy(),this.cropper=null}reset(){return this.cropper.reset()}clear(){return this.cropper.clear()}initCrop(){return this.cropper.crop()}replace(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.cropper.replace(e,t)}enable(){return this.cropper.enable()}disable(){return this.cropper.disable()}destroy(){return this.cropper.destroy()}move(e,t){return this.cropper.move(e,t)}moveTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.moveTo(e,t)}relativeZoom(e,t){return this.cropper.zoom(e,t)}zoomTo(e,t){return this.cropper.zoomTo(e,t)}rotate(e){return this.cropper.rotate(e)}rotateTo(e){return this.cropper.rotateTo(e)}scaleX(e){return this.cropper.scaleX(e)}scaleY(e){return this.cropper.scaleY(e)}scale(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.scale(e,t)}getData(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.cropper.getData(e)}setData(e){return this.cropper.setData(e)}getContainerData(){return this.cropper.getContainerData()}getImageData(){return this.cropper.getImageData()}getCanvasData(){return this.cropper.getCanvasData()}setCanvasData(e){return this.cropper.setCanvasData(e)}getCropBoxData(){return this.cropper.getCropBoxData()}setCropBoxData(e){return this.cropper.setCropBoxData(e)}getCroppedCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.cropper.getCroppedCanvas(e)}setAspectRatio(e){return this.cropper.setAspectRatio(e)}setDragMode(e){return this.cropper.setDragMode(e)}render(){const{className:e,style:t,src:r,alt:n,imgStyle:i}=this.props,a=Ie("cropper"),l={[a]:!0};return o().createElement("div",{className:Ne()(l,e),style:t},o().createElement("img",{ref:this.imgRef,src:r,alt:n,style:{maxWidth:"100%",...i}}))}}vl(xl,"defaultProps",{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});const El=xl,Sl=zt;function wl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Cl extends a.Component{constructor(){super(...arguments),wl(this,"context",void 0),wl(this,"cropperRef",o().createRef()),wl(this,"beforeUploadRef",void 0),wl(this,"fileRef",void 0),wl(this,"resolveRef",void 0),wl(this,"rejectRef",void 0),wl(this,"state",{src:""}),wl(this,"confirmHandle",(async()=>{const{quality:e}=this.props,{type:t,name:r,uid:n}=this.fileRef;this.cropperRef.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===t?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((async e=>{let i=new File([e],r,{type:t});Object.assign(i,{uid:n});const{fileTypes:a=[],fileSize:o}=this.props;if(a.length&&!a.includes(i.name.slice(i.name.lastIndexOf(".")+1).toLowerCase()))return L.message.warning(f("qm.upload.tooltip",{type:a.join(",")})),this.rejectRef("file type is error");if("function"!=typeof this.beforeUploadRef)return this.resolveRef(i);const l=this.beforeUploadRef(i,[i]);if("boolean"==typeof l||l){if(!0===l)return this.resolveRef(i);if(!1===l)return this.rejectRef("not upload");if(l&&"function"==typeof l.then)try{const e=await l,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(i=e),this.resolveRef(i)}catch(e){this.rejectRef(e)}}else v("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),t,e),await ce(100),this.onClose()})),wl(this,"onOk",(()=>{this.confirmHandle()})),wl(this,"onClose",(()=>{this.setSrc("")}))}get previewSize(){const{fixedSize:e}=this.props;return{width:"380px",height:e?`calc(380px * ${e[1]/e[0]})`:"auto"}}setSrc(e){this.setState({src:e})}renderUpload(){const{children:e,beforeCrop:t}=this.props,r=Array.isArray(e)?e[0]:e;if(!r)return null;const{beforeUpload:n,...i}=r.props;return this.beforeUploadRef=n,o().createElement(r.type,{...i,beforeUpload:(e,r)=>new Promise((async(n,i)=>{const a=()=>n(L.Upload.LIST_IGNORE);if(t&&!await t(e,r))return void a();this.fileRef=e,this.resolveRef=n,this.rejectRef=a;const o=new FileReader;o.onload=()=>{this.setSrc(o.result),o.onload=null},o.readAsDataURL(e)}))})}scaleHandle(e){this.cropperRef.current.relativeZoom(e,void 0)}rotateHandle(e){this.cropperRef.current.rotate(e)}renderCropper(){const{fixedSize:e}=this.props;return o().createElement("div",{className:"cropper-preview"},o().createElement("div",{className:"cropper-area"},o().createElement("div",{className:"img-cropper"},o().createElement(El,{ref:this.cropperRef,aspectRatio:e?e[0]/e[1]:e,src:this.state.src,dragMode:"move",preview:".preview"})),o().createElement("div",{className:"actions"},o().createElement(L.Space,{size:"small"},o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Re.ZoomInOutlined,null),onClick:()=>this.scaleHandle(.2)},f("qm.uploadCropper.zoomIn")),o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Re.ZoomOutOutlined,null),onClick:()=>this.scaleHandle(-.2)},f("qm.uploadCropper.zoomOut")),o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Re.RotateRightOutlined,null),onClick:()=>this.rotateHandle(90)},f("qm.uploadCropper.rotatePlus")),o().createElement(L.Button,{type:"primary",size:"middle",icon:o().createElement(Re.RotateLeftOutlined,null),onClick:()=>this.rotateHandle(-90)},f("qm.uploadCropper.rotateSubtract"))))),o().createElement("div",{className:"preview-area"},o().createElement("div",{className:"preview",style:this.previewSize})))}render(){const{className:e}=this.props,{src:t}=this.state,r=Ie("cropper-preview");return o().createElement(o().Fragment,null,this.renderUpload(),t&&o().createElement(L.Modal,{open:!0,wrapClassName:Ne()(r,e),title:f("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:this.onOk,onCancel:this.onClose,maskClosable:!1,destroyOnClose:!0},this.renderCropper()))}}wl(Cl,"contextType",c);const Tl=Cl;function Nl(){return Nl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Nl.apply(this,arguments)}function Il(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Rl extends a.Component{constructor(){super(...arguments),Il(this,"context",void 0),Il(this,"state",{previewVisible:!1,currentIndex:0}),Il(this,"isFocused",!1),Il(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:i=[],fileSize:a,beforeUpload:o}=this.props,l=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),s=!a||e.size/1024/1024<a,c=l&&s;if(l||L.message.warning(f("qm.upload.tooltip",{type:i.join(",")})),s||L.message.warning(f("qm.upload.sizeLimit",{size:a})),!c)return L.Upload.LIST_IGNORE;if(o){const i=o(e,t);if(!0===i)return r(e);if(!1===i)return n("not upload");if(i&&"function"==typeof i.then)try{r(await i)}catch(e){n(e)}}else r(e)})))),Il(this,"handlePreview",(e=>{this.setState({currentIndex:this.props.fileList?.findIndex((t=>t.url===e.url))||0,previewVisible:!0})})),Il(this,"handlePaste",(async e=>{const{fileList:t=[],action:r,data:n,headers:i,onChange:a}=this.props;if(this.isFocused&&this.showUploadButton&&r)for(const o of e.clipboardData.items)if("file"===o.kind&&o.type.startsWith("image/")){const e=o.getAsFile(),l=Date.now(),s=new File([e],`screenshot-${l}.png`,{type:e.type});Object.assign(s,{uid:`rc-upload-${l}`});try{await this.beforeUpload(s,[...t,s]);const e=new FormData;if(e.append("file",s),n)for(const t in n)e.append(t,n[t]);const o="string"==typeof r?r:await r(s),l=await fetch(o,{method:"POST",body:e,headers:i});if(!l.ok)throw new Error(f("qm.upload.uploadError"));const c=await l.json();a?.({file:s,fileList:[...t,{uid:s.uid,lastModified:s.lastModified,lastModifiedDate:s.lastModifiedDate,name:s.name,type:s.type,size:s.size,response:c,status:"done",percent:100,originFileObj:s}]})}catch(e){}}}))}get $size(){return this.context.size??""}get showUploadButton(){const e=this.props.fileList?.length??0;return!this.props.maxCount||e<this.props.maxCount}componentDidMount(){document.addEventListener("paste",this.handlePaste)}componentDidUpdate(e){const{fileList:t}=e,{fileList:r}=this.props;t===r||this.showUploadButton||(this.isFocused=!1)}componentWillUnmount(){document.removeEventListener("paste",this.handlePaste)}render(){const{previewVisible:e,currentIndex:t}=this.state,{fileList:r=[],fixedSize:n,quality:i,fileTypes:a,fileSize:l,disabled:s,readOnly:c,className:d,popupClassName:u,openCropper:p,beforeCrop:h}=this.props,m=Ie("upload-img"),g={[m]:!0,[`${m}--lg`]:"large"===this.$size,[`${m}--sm`]:"small"===this.$size},b=s||c,y=o().createElement(L.Upload,Nl({className:Ne()(g,d)},re()(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,disabled:b,onPreview:this.handlePreview,showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,t,r,n)=>o().createElement("div",{className:"upload-item"},e,!b&&o().createElement(Re.CloseOutlined,{title:f("qm.upload.remove"),className:"icon",onClick:()=>n.remove()}))}),!this.showUploadButton||c&&r.length?null:o().createElement(o().Fragment,null,o().createElement("p",{className:"ant-upload-drag-icon"},o().createElement(Re.InboxOutlined,null)),o().createElement("p",{className:"ant-upload-text"},f("qm.uploadCropper.dragableText")),o().createElement("button",{className:Ne()("ant-upload-button",{disabled:b}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{this.isFocused=!0},onBlur:()=>{this.isFocused=!1}},f("qm.uploadCropper.pasteText"))));return o().createElement(o().Fragment,null,p?o().createElement(Tl,{className:u,fixedSize:n,quality:i,fileTypes:a,fileSize:l,beforeCrop:h},y):y,o().createElement("div",{style:{display:"none"}},o().createElement(L.Image.PreviewGroup,{preview:{visible:e,current:t,rootClassName:u,onVisibleChange:e=>{this.setState({previewVisible:e})}}},r.map((e=>o().createElement(L.Image,{key:e.uid,src:e.url,alt:""}))))))}}Il(Rl,"contextType",c),Il(Rl,"defaultProps",{name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0});const Pl=Rl,Ol=(e,t,r)=>{let n;for(let i=0;i<e.length;i++){const a=e[i];if(a.children)if(a.children.some((e=>e[r]===t)))n=a[r];else{const e=Ol(a.children,t,r);e&&(n=e)}}return n},kl=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&kl(e.children,t),t(e)||e.children&&e.children.length))),Al=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Al(e.children,t)),t(e)&&r.push(e)})),r},Ll=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=Ll(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},Fl=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:Fl(e.children,t,r,n)}:e)),Hl=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Hl(e.children,t)),Array.isArray(e.children)&&e.children.length&&r.push(e[t])})),r},_l=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][r]===t)return[t];if(Array.isArray(e[n].children)){const i=_l(e[n].children,t,r);if(i)return[e[n][r],i].flat()}}},Dl=(e,t)=>{const r=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...Dl(e,t)))),r},$l=o().forwardRef(((e,t)=>{const{className:r,style:n,filterable:i=!0,multiple:a,draggable:l,dataSource:s,fetch:d,asyncLoad:u,checkStrictly:p,checkStrategy:h="SHOW_CHILD",placeholder:m=f("qm.form.inputPlaceholder"),fieldsDefine:g,value:b,height:y,defaultSelectedKeys:v=[],defaultExpandAll:x=!0,showSearchBar:E=!0,showCollapse:S=!0,onSelectChange:w,onCheckChange:C,onDragStart:T,onDragChange:N,onExpand:I}=e,{size:R}=o().useContext(c),P=o().useMemo((()=>e.size??R??""),[e.size,R]),O=g?.valueKey||"value",k=g?.textKey||"text",A=o().useRef(null),F=Pt(A),[H,_]=o().useState(y),[D,$]=o().useState(!1),q=At((()=>{_(A.current.offsetHeight-Z.current.offsetHeight-10)}),5);kt((()=>{y||q()}),[F.height]);const[M,j]=o().useState([]),[K,V]=o().useState({}),[z,B]=o().useState([]),[U,W]=o().useState([]),[G,Y]=o().useState(""),[X,Q]=o().useState(x),Z=o().useRef(null),J=o().useRef([]),ee=o().useRef([]);o().useEffect((()=>{Array.isArray(s)&&(te(s),B(re(s)),V({}))}),[s]),o().useEffect((()=>{oe()}),[]),Ve((()=>{oe()}),[d?.params]),Ve((()=>{W(ae())}),[K]),o().useImperativeHandle(t,(()=>({INSERT_RECORD:(e,t)=>{const r=Array.isArray(t)?t:[t],n=Ll(M,(t=>e===t[O]));n&&(Array.isArray(n.children)?n.children.push(...r):n.children=[...r],te([...M]))},REMOVE_RECORD:e=>{const t=Ol(M,e,O);if(void 0===t&&M.find((t=>t[O]===e)))te(M.filter((t=>t[O]!==e)));else{const r=Ll(M,(e=>t===e[O]));if(!r)return;const n=r.children?.findIndex((t=>e===t[O]));n>=0&&(r.children.splice(n,1),te([...M]))}},UPDATE_RECORD:(e,t)=>{const r=Ll(M,(t=>e===t[O]));r&&((0,ne.merge)(r,t),te([...M]))}})));const te=e=>{j(e),J.current=e,ee.current=Hl(e,O)},re=e=>{if(a)return v;const t=Al(e,(e=>v.includes(e[k])));return 1===t.length?[t[0][O]]:[]},ie=e=>_l(M,e,O)?.slice(0,-1)||[],ae=()=>{if(x)return ee.current;const e=[];return z.forEach((t=>{if(a){if("SHOW_ALL"===h&&!ee.current.includes(t)&&e.push(...ie(t)),"SHOW_CHILD"===h&&e.push(...ie(t)),"SHOW_PARENT"===h){const r=$n(M,t);if(r){const n=ie(t),i=Dl(r,O);e.push(...n,...[t,...i].filter((e=>ee.current.includes(e))))}}}else e.push(...ie(t))})),[...new Set(e)]},oe=async()=>{if(!d)return;const{api:e,params:t,dataKey:r,afterFetch:n,callback:i}=d;try{$(!0);const a=await e(t);if(200===a.code){let e=Array.isArray(a.data)?a.data:(0,ne.get)(a.data,r)??[];e="function"==typeof n?await n(e):e,te(e),B(re(e)),V({}),i?.(e)}}catch(e){}$(!1)},le=e=>`${e}|${ri.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,se=Ie("search-tree"),ce={[se]:!0,[`${se}--lg`]:"large"===P,[`${se}--sm`]:"small"===P};return o().createElement("div",{ref:A,className:Ne()(ce,r),style:n},o().createElement("div",{ref:Z,className:"topper"},E&&o().createElement(L.Input.Search,{value:G,size:P,placeholder:m,allowClear:!0,onChange:e=>(e=>{if(!i)return;const t=kl(J.current,(t=>{if(!e)return!0;const r=t[k]||"";return-1!==le(r).indexOf(e)}));Y(e),j(t),x||e?W(Hl(t,O)):V({})})(e.target.value)}),S&&o().createElement("a",{className:"trigger",onClick:()=>{Q(!X),W(X?[]:ee.current)}},X?o().createElement(Re.UpOutlined,null):o().createElement(Re.DownOutlined,null)," ",f(X?"qm.form.collect":"qm.form.spread"))),o().createElement(St,{spinning:D},o().createElement(L.Tree,{fieldNames:{title:k,key:O,children:"children"},multiple:a,draggable:l,blockNode:l,checkable:a,selectable:!a,height:H,disabled:e.disabled,checkStrictly:p,selectedKeys:b??z,checkedKeys:b??z,expandedKeys:U,treeData:M,loadData:u?async e=>{let{key:t,children:r}=e;if(!d||r)return;const{api:n,params:i,dataKey:a,formatter:o=(e=>e),afterFetch:l}=d;try{const e=await n(o({...i,[O]:t}));if(200===e.code){let r=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,a)??[];r="function"==typeof l?await l(r):r;const n=Fl(J.current,t,O,r);te(n)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!G)return!1;const t=e[k]||"";return-1!==le(t).indexOf(G)},onDragStart:T,onDragEnter:e=>{W(e.expandedKeys)},onDrop:e=>{const t=e.node.key,r=e.dragNode.key,n=e.node.pos.split("-"),i=e.dropPosition-Number(n[n.length-1]),a=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][O]===t)return r(e[n],n,e);e[n].children&&a(e[n].children,t,r)}},o=[...M];let l;if(a(o,r,((e,t,r)=>{r.splice(t,1),l=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===i)a(o,t,(e=>{e.children=e.children||[],e.children.unshift(l)}));else{let e,r=[];a(o,t,((t,n,i)=>{r=i,e=n})),-1===i?r.splice(e,0,l):r.splice(e+1,0,l)}else a(o,t,(e=>{e.children=e.children||[],e.children.unshift(l)}));te(o)},onDragEnd:e=>{N?.(e,M)},onExpand:(e,t)=>{pe(e)&&Q(!1),ee.current.every((t=>e.includes(t)))&&Q(!0),W(e),I?.(e,t)},onSelect:e=>{B(e);const t=Al(J.current,(t=>e.includes((0,ne.get)(t,O))));w?.(a?t:t[0])},onCheck:e=>{p&&(e=e.checked),B(e),"SHOW_CHILD"===h&&(e=e.filter((e=>!ee.current.includes(e)))),"SHOW_PARENT"===h&&(e=e.filter(((e,t,r)=>!r.includes(Ol(M,e,O)))));const t=Al(J.current,(t=>e.includes((0,ne.get)(t,O))));C?.(a?t:t[0])}})))}));$l.displayName="QmSearchTree";const ql=$l,Ml=(0,a.createContext)(void 0),jl={dataIndex:s().string.isRequired,title:s().string.isRequired,description:s().string,colSpan:s().number,width:s().number,minWidth:s().number,fixed:s().oneOf(["left","right"]),align:s().oneOf(["left","center","right"]),theadAlign:s().oneOf(["left","center","right"]),printFixed:s().bool,hidden:s().bool,noAuth:s().bool,noFixed:s().bool,ellipsis:s().bool,className:s().string,theadClassName:s().string,children:s().array,sorter:s().oneOfType([s().bool,s().func]),filter:s().shape({type:s().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:s().arrayOf(s().shape({text:s().string,value:s().oneOfType([s().string,s().number])})),style:s().object}),precision:s().number,displayPrecision:s().number,formatType:s().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:s().bool,canCopy:s().bool,editRender:s().func,dictItems:s().arrayOf(s().shape({text:s().string,value:s().oneOfType([s().string,s().number])})),summation:s().shape({sumBySelection:s().bool,displayWhenNotSelect:s().bool,dataKey:s().string,unit:s().string,render:s().func}),groupSummary:s().shape({dataKey:s().string,unit:s().string,render:s().func}),shouldCellUpdate:s().func,headRender:s().func,render:s().func},Kl=(s().arrayOf(s().shape(jl)).isRequired,s().func,s().array,s().oneOfType([s().string,s().func]).isRequired,s().number,s().bool,s().bool,s().shape({api:s().func.isRequired,params:s().object.isRequired,formatter:s().func,beforeFetch:s().func,afterFetch:s().func,stopToFirst:s().bool,dataKey:s().string,callback:s().func}),s().bool,s().bool,s().string,s().string,s().bool,s().bool,s().bool,s().bool,s().oneOfType([s().object,s().func]),s().oneOfType([s().object,s().func]),s().array,s().func,s().bool,s().bool,s().object,s().object,s().shape({type:s().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:s().array,selectedRowKeys:s().array,hideSelectAll:s().bool,checkStrictly:s().bool,filterable:s().bool,selectByClickRow:s().bool,selectFirstRowOnChange:s().bool,clearableAfterFetched:s().bool,selectAllOnCurrentPage:s().bool,fetchSelectedRows:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),fetchAllRowKeys:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),disabled:s().func,onChange:s().func,onSelect:s().func,onSelectAll:s().func}),s().shape({currentRowKey:s().oneOfType([s().number,s().string]),disabled:s().func,onChange:s().func}),s().shape({virtual:s().bool,expandIconColumn:s().string}),s().shape({defaultExpandAllRows:s().bool,defaultExpandedRowKeys:s().array,expandedRowKeys:s().array,hideExpandAll:s().bool,rowExpandable:s().func,expandedRowClassName:s().string,expandedRowRender:s().func,onExpand:s().func,onChange:s().func}),s().shape({groupItems:s().arrayOf(s().shape({dataIndex:s().string.isRequired,titleIndex:s().string,color:s().string,backgroundColor:s().string})),fetch:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),onChange:s().func}),s().func,s().bool,s().bool,s().bool,s().bool,s().shape({current:s().number,pageSize:s().number,pageSizeOptions:s().array,showSizeChanger:s().bool,showQuickJumper:s().bool}),s().shape({fileName:s().string,fetch:s().shape({api:s().func.isRequired,params:s().object}),beforeExport:s().func,cellStyle:s().bool,hideIcon:s().bool}),s().shape({showLogo:s().bool}),s().shape({fetch:s().shape({api:s().func.isRequired,params:s().object,dataKey:s().string}),fieldList:s().arrayOf(s().object)}),s().shape({position:s().oneOf(["top","bottom"]),hideAlert:s().bool,hideClearButton:s().bool}),s().oneOf(["left","right"]),s().func,s().func,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().bool,s().func,s().func,s().func,s().func,s().func,s().func,s().func,s().func,s().func,s().func,10),Vl="1",zl="0",Bl="YYYY-MM-DD",Ul="YYYY-MM-DD HH:mm:ss",Wl="YYYYMMDDHHmmss",Gl={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let Yl=function(e){return e.left="flex-start",e.right="flex-end",e}({}),Xl=[];const Ql={getFocusInstance:function(){return Xl[0]??null},getInstance:function(e){return Xl.find((t=>t.id===e))??null},focus:function(e){const t=this.getInstance(e);t&&0!==Xl.findIndex((e=>e===t))&&(this.deregister(e),Xl=[t,...Xl])},register:function(e,t){e&&t&&(null!==this.getInstance(e)&&this.deregister(e),Xl=[{id:e,vm:t},...Xl])},deregister:function(e){e&&(Xl=Xl.filter((t=>t.id!==e)))}};function Zl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Jl=class{constructor(){Zl(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),Zl(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),Zl(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)})),Zl(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),Zl(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)})),Zl(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),Zl(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)})),Zl(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),Zl(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),Zl(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),Zl(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),Zl(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),Zl(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),Zl(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]})),Zl(this,"destroy",(()=>{for(const e in this)this[e]=null}))}},es={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:150,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored"};let ts;const rs=()=>{if(ie)return 0;if(void 0!==ts)return ts;const e=document.createElement("div");e.className="qm-scrollbar__wrap",e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);const t=e.offsetWidth;e.style.overflow="scroll";const r=document.createElement("div");r.style.width="100%",e.appendChild(r);const n=r.offsetWidth;return e.parentNode?.removeChild(e),ts=t-n,ts},ns=e=>e.map((e=>{const t={...e};return t.children&&(t.children.forEach((e=>{t.fixed?e.fixed=t.fixed:delete e.fixed})),t.children=ns(t.children)),t})),is=(e,t)=>{const{fetch:r,columns:n,height:i,minHeight:a,maxHeight:l,border:s=!0,rowSelection:c,summation:d,expandable:u,treeConfig:p,webPagination:h,scrollPagination:m,dragMergeCell:g,showSuperSearch:b,showFastSearch:y,showGroupSummary:v,showTableImport:x,showClipboard:E,showSelectCollection:S,footRender:w}=e,{tableRef:C,tableFullData:T,tableData:N,selectionKeys:I,sorter:R,filters:P,superFilters:O,pagination:k}=t,{selectionRows:A,summaries:L}=C.current,{expandIconColumn:F=""}=p||{},H=o().useMemo((()=>!!r?.api),[r?.api]),_=o().useMemo((()=>!H&&!!h),[H,h]),D=o().useMemo((()=>H&&!!m),[H,m]),$=o().useMemo((()=>(H||_)&&!D),[H,_,D]),q=o().useMemo((()=>!!(i||a||l)),[i,a,l]),M=o().useMemo((()=>(e=>{const t=(e=>{const t=[],r=[],n=[];for(let i=0;i<e.length;i++){const a=e[i];"left"===a.fixed?t.push(a):"right"===a.fixed?r.push(a):n.push(a)}return[...t,...n,...r]})(ns(e)),r=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:es.selectionColumn,title:"radio"===t?f("qm.table.config.selectionText"):"",width:es.selectionColumnWidth,fixed:"left",type:t}})(c),n=(i=u,i?.expandedRowRender?{dataIndex:es.expandableColumn,title:"",width:es.selectionColumnWidth,fixed:"left",type:"expand"}:null);var i;return r&&t.unshift(r),n&&t.unshift(n),jr(t)})(n)),[n]),j=o().useMemo((()=>Mr(M)),[M]),K=o().useMemo((()=>j.filter((e=>"function"==typeof e.editRender))),[j]),V=o().useMemo((()=>j.filter((e=>!!e.summation))),[j]),z=o().useMemo((()=>j.filter((e=>"left"===e.fixed))),[j]),B=o().useMemo((()=>j.filter((e=>"right"===e.fixed))),[j]),U=o().useMemo((()=>{const e=j.filter((e=>![es.expandableColumn,es.selectionColumn,es.operationColumn].includes(e.dataIndex)));return F&&e.some((e=>e.dataIndex===F))?F:e[0]?.dataIndex??""}),[j,F]),W=o().useMemo((()=>V.length>0),[V]),G=o().useMemo((()=>!!w||W),[w,W]),Y=o().useMemo((()=>Xr(M).length>1),[M]),X=o().useMemo((()=>s||Y),[s,Y]),Q=o().useMemo((()=>j.some((e=>e.sorter))),[j]),Z=o().useMemo((()=>j.some((e=>e.filter))),[j]),J=o().useMemo((()=>V.some((e=>!!e.summation.dataKey))),[V]),ee=o().useMemo((()=>!H&&!!x),[H,x]),te=o().useMemo((()=>!!E&&K.length>0),[E,K]),re=o().useMemo((()=>!!S&&"checkbox"===c?.type),[S,c]),ne=o().useMemo((()=>!!b&&Z),[b,Z]),ie=o().useMemo((()=>!H&&!!y&&Z),[H,y,Z]),ae=o().useMemo((()=>!!v&&j.some((e=>!!e.groupSummary))),[j]),oe=o().useMemo((()=>!!d?.groupItems?.length),[d]),le=o().useMemo((()=>!!g&&!H&&!h),[g,H,h]),se=o().useMemo((()=>T.some((e=>Array.isArray(e.children)))),[T]),ce=o().useMemo((()=>!N.length),[N]),de=o().useMemo((()=>(()=>{const e={};return V.forEach((t=>{const{dataIndex:r,precision:n,displayPrecision:i,summation:a}=t,{sumBySelection:o,displayWhenNotSelect:l,unit:s}=a,c=oe?pn(C.current.tableFullData):C.current.tableFullData,d=!A.length&&!!l;let u=(!o||d?c:A).reduce(((e,t)=>{if(t?.[es.summaryIgnore])return e;const n=en(t,r);return nn(n)?e.plus(n):e}),new(Ri())(0));!Object.keys(L).includes(r)||o&&!d||(u=new(Ri())(en(L,r))),tn(e,r,u.toNumber());let p=n>=0?u.toFixed(n):u.toString();i>=0&&""!==p&&(p=on(p,i)),p=an(p),tn(e,`${r}_text`,s?`${p} ${s}`:p)})),[e]})()),[N,I,L]),ue=o().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(V)),[V]),pe=o().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((r=>{null!==e[r]&&t.push(`${r}|${e[r]}`)})),t.join(",")})(R),t=((e,t)=>{const r=[];if(Object.keys(e).length)for(const t in e){const[n,i]=es.showFilterType?t.split("|"):[t,""],a=e[t];Object.keys(a).forEach((e=>{r.push({type:i,bracketLeft:"",fieldName:n,expression:e,value:a[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{r.push({type:es.showFilterType?e.fieldType:"",bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),r.length&&(r[r.length-1].logic=""),r})(P,O);return{...e?{[es.sorterFieldName]:e}:null,...t.length?{[es.filterFieldName]:t}:null,...ue?{[es.groupSummary.summaryFieldName]:ue,usedJH:1}:null,...r?.params??null,[es.currentPageName]:k.current,[es.pageSizeName]:k.pageSize}}),[r?.params,k.current,k.pageSize,R,P,O,ue]);return{isFetch:H,isWebPagination:_,isScrollPagination:D,showPagination:$,shouldUpdateHeight:q,tableColumns:M,flattenColumns:j,editableColumns:K,summationColumns:V,leftFixedColumns:z,rightFixedColumns:B,treeExpandIndex:U,showSummary:W,showFooter:G,isHeadGroup:Y,bordered:X,isHeadSorter:Q,isHeadFilter:Z,isServiceSummation:J,isSelectCollection:re,isTableImport:ee,isTableClipboard:te,isSuperSearch:ne,isFastSearch:ie,isGroupSummary:ae,isGroupSubtotal:oe,isDragMergeCell:le,isTreeTable:se,isTableEmpty:ce,summationRows:de,fetchParams:pe}},as=require("react-dom");var os=n.n(as);function ls(e){const t=a.useRef();t.current=e;const r=a.useCallback((function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.current?.(...r)}),[]);return r}const ss=(e,t)=>{const{rowKey:r,height:n,dataSource:i,summation:a,fetch:l,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,treeConfig:p,authConfig:h,ignorePageIndex:m,columnsChange:f,onChange:g,onDataChange:b,onDataLoad:y,onScrollEnd:x,onFetchError:E}=e,{getRowKey:S,tableRef:w,tableElementRef:C,tableBodyRef:T,$size:N,tableColumns:I,flattenColumns:R,tableFullData:P,pagination:O,layout:k,filters:A,sorter:L,superFilters:F,fetchParams:H,selectionKeys:_,rowExpandedKeys:D,highlightKey:$,summationColumns:q,shouldUpdateHeight:M,isFetch:j,isTreeTable:K,isWebPagination:V,isScrollPagination:z,isServiceSummation:B,isGroupSubtotal:U,doLayout:W,setTableData:G,setTableFlatColumns:Y,setTableFullData:X,setTableOriginData:Q,setAllTableData:Z,setDeriveRowKeys:J,setPagination:ee,setSpinning:te,setSorter:ie,setFilters:ae,setSuperFilters:oe,setSelectionKeys:le,setRowExpandedKeys:ce,setHighlightKey:de,setSelectionRows:ue,setScrollXLoad:he,setScrollYLoad:me,setScrollXStore:fe,setScrollYStore:ge,computeVirtualX:be,computeVirtualY:ye,setFieldAuth:ve,setResizeState:xe,setSummaries:Ee,setPermission:Se,setRecordsMap:we,resetTableScroll:Ce,clearElementStore:Te,clearRecordsMap:Ne}=t,{store:Ie}=w.current,Re=Number.parseInt(o().version)>=18?os().flushSync:null,Pe=Pt(C),Oe=o().useRef({...H}),ke=o().useRef(new Map),Ae=o().useRef(!1);kt((()=>{W(),De(),w.current.scrollXLoad&&$e()}),[I]),kt((()=>{Le()}),[Pe,N,n,k.tableAutoHeight]),Ve((()=>{yt(),vt(),xt(),j||(V&&ct(),nt(i)),s&&ie(s),c&&ae(c)}),[i,l?.params]),Ve((()=>{const e=Je(H,Oe.current);e||j&&d?.clearableAfterFetched&&Et(),!e&&H[es.currentPageName]>1&&!l?.stopToFirst?ct():j&&tt(),Oe.current=H}),[H]),Ve((()=>{V&&mt(),z||Ce(),Xe()}),[O.current,O.pageSize]),Ve((()=>{j||Fe(P.length),W()}),[P]),Ve((()=>{K&&p?.virtual&&(dt(),mt())}),[D]);const Le=()=>{const{scrollXLoad:e,scrollYLoad:t,resizeState:r}=w.current,{width:n,height:i}=r,{width:a,height:o}=Pe,l=a!==n,s=o!==i;W(),l&&e&&$e(),s&&M&&t&&mt(),xe(Object.assign({},r,{width:a,height:o}))},Fe=e=>{e!==O.total&&ee((t=>Object.assign({},t,{total:e})))},He=e=>{Ae.current=e},_e=At((e=>{ot(),x?.(e)})),De=()=>{he(R.length>es.virtualScrollX)},$e=()=>{qe(),Me()},qe=()=>{const{scrollXLoad:e,scrollXStore:t}=w.current;if(!e)return;const r=[],n=[],i=[];for(let e=0;e<R.length;e++){const a=R[e];a.fixed?"left"===a.fixed?r.push(a):i.push(a):e>=t.startIndex&&e<t.endIndex&&n.push(a)}Re?queueMicrotask((()=>Re((()=>Y([...r,...n,...i]))))):Y([...r,...n,...i])},Me=()=>{const{elementStore:e,scrollXStore:t,scrollXLoad:r}=w.current,{tableBodyWidth:n,gutterWidth:i}=k;if(!r)return;const a=`${R.slice(0,t.startIndex).filter((e=>!e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)}px`,o=`${scrollY?n-i:n}px`;e.$tableBody.style.marginLeft=a,e.$tableXspace.style.width=o},je=e=>U?Ke(ze(e,0)):e,Ke=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Ke(e.children)),delete e.children,t.push(e)})),t},ze=(e,t)=>{const n=a.groupItems?.[t];return n?mn(e,[n.dataIndex]).map((e=>{const i={children:ze(e,t+1),_group:n.dataIndex};return"function"!=typeof r&&tn(i,r.toString(),cn()),n.titleIndex&&tn(i,n.titleIndex,en(e[0],n.titleIndex)),tn(i,n.dataIndex,en(e[0],n.dataIndex)),q.forEach((e=>{const{dataIndex:t}=e,r=i.children?.reduce(((e,r)=>{if(r[es.summaryIgnore])return e;const n=Number(en(r,t));return Number.isNaN(n)?e:e+n}),0);tn(i,t,r)})),i})):(e.forEach(((t,r)=>{t._rowSpan=0===r?e.length:0,t._colSpan=1})),e)},Be=e=>{le(e),ue((e=>{const{selectionRows:t,allTableData:r,recordsMap:n}=w.current;if(j)return[...t.filter((t=>e.includes(S(t,t.index)))),...r.filter((r=>{const n=S(r,r.index);return e.includes(n)&&-1===t.findIndex((e=>S(e,e.index)===n))}))];const i=[];for(let t=0,r=e.length;t<r;t++){const r=e[t];n.has(r)&&i.push(n.get(r))}return i})(e))},Ue=e=>{const{type:t,checkStrictly:r=!0}=d||{},n=Array.isArray(e)?e:_;let i=[];return w.current.treeTable&&!r&&n.forEach((e=>{i.push(...((e,t)=>{const{disabled:r}=d||{},{deriveRowKeys:n,recordsMap:i}=w.current,a=Gr(n,e);let o=[];if(!a)return o;const l=Ge(a?.children||[]);return o=[...new Set([...t,...l])],r&&(o=o.filter((e=>!i.has(e)||!r(i.get(e))))),(gn(n,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Gr(n,e),r=t?.children?.every((e=>o.includes(e.rowKey)));o=r?[...o,e]:o.filter((t=>t!==e))})),o})(e,n))})),i="radio"===t?n.slice(0,1):[...new Set([...n,...i])],i},We=e=>{const{allRowKeys:t,flattenRowKeys:r}=w.current,{defaultExpandAllRows:n,expandedRowRender:i}=u||{},a=Array.isArray(e)?e:D;if(w.current.treeTable){i&&v("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[..._];$&&e.unshift($);let o=[];return e.forEach((e=>{const t=gn(w.current.deriveRowKeys,e)||[];o.push(...t.length>1?t.slice(0,-1).reverse():t)})),o=n?t:[...new Set([...a,...o])],o.filter((e=>!r.includes(e)))}return u?n?t.slice(0):[...a]:[]},Ge=e=>{const t=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&t.push(...Ge(e[r].children)),t.push(e[r].rowKey);return t},Ye=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Ye(e.children,t)),e.rowKey===t&&e.parentRowKey&&r.push(e.parentRowKey)})),r.length&&r.push(...Ye(e,r[r.length-1])),r},Xe=At((()=>{g?.(O,Ze(A),Qe(L),F,{currentDataSource:pt()})})),Qe=e=>{const t={};for(const r in e)null!==e[r]&&(t[r]=e[r]);return t},Ze=e=>{const t={};for(const r in e){if(!r.includes("|"))continue;const[n,i]=r.split("|");t[es.showFilterType?`${n}|${i}`:n]=e[r]}return t},Je=(e,t)=>{const r=Object.keys(Jr(e,t));return 1===r.length&&(r.includes(es.currentPageName)||r.includes(es.pageSizeName))},et=ls((async()=>{if(!l)return;const{formatter:e=(e=>e),beforeFetch:t=se,afterFetch:r,callback:n}=l;if(!t(H))return;const i=!!a?.fetch?.api;te(!0);try{const[t,o]=i?await Promise.all([l.api(e(H)),a.fetch.api(e(H))]):[await l.api(e(H))];if(w.current.unMounted)return;if(i?200===t.code&&200===o.code:200===t.code){const e=l.dataKey??es.dataKey;let i=(0,ne.get)(t.data,e)??[];i="function"==typeof r?await r(i):i;const a=(0,ne.get)(t.data,e.replace(/[^.]+$/,es.totalKey))||i.length||0,s=Math.max(Math.ceil(a/O.pageSize),1);if(H[es.currentPageName]>s)return lt({...O,current:s});nt(Ae.current?w.current.tableFullData.concat(i):i),Fe(a),it(o?.data||t.data),n?.(t.data,t)}}catch(e){E?.(e)}((e,t)=>Object.prototype.hasOwnProperty.call(e,"stopToFirst"))(l)&&(l.stopToFirst=!1),te(!1),He(!1)})),tt=At(et),rt=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=rt(e.children)),e.index=t,m||(e.pageIndex=(e=>{const{current:t,pageSize:r}=O;return!j||z?e:(t-1)*r+e})(t)),e))),nt=e=>{const t=je(rt(e));ft(t),gt(t),bt(),Be(Ue()),ce(We()),at(),y?.(t)},it=e=>{if(!B)return;const t=a?.fetch?.dataKey??es.summationKey,r=(t?(0,ne.get)(e,t):e)??{},n={};q.filter((e=>!!e.summation.dataKey)).forEach((e=>{tn(n,e.dataIndex,Number(en(r,e.summation.dataKey)))})),Ee(n)},at=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=pt();if(e.length){const t=S(e[0],e[0].index);Be([t])}else Be([])}},ot=()=>{if(!z)return;const e=st();Ae.current||O.current>=e||(He(!0),lt({...O,current:O.current+1}))},lt=e=>{let{current:t,pageSize:r}=e;ee((e=>Object.assign({},e,{current:t,pageSize:r})))},st=()=>{const{pageSize:e,total:t}=O;return Math.ceil(t/e)||1},ct=()=>{lt(Object.assign({},O,{current:1}))},dt=()=>{if(!w.current.treeTable||!p?.virtual)return;const e=ut(w.current.deriveRowKeys,(()=>{const{allTableData:e,allRowKeys:t}=w.current,{rowExpandable:r}=u||{},n=[];return"function"==typeof r&&e.forEach(((e,i)=>!r(e)&&n.push(t[i]))),n.length?D.filter((e=>!n.includes(e))):D})());ke.current.clear(),e.forEach(((e,t)=>ke.current.set(e,t)))},ut=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...ut(e.children,t)),(void 0===e.parentRowKey||t.includes(e.parentRowKey)&&e.rowKeyPath.split("#").slice(0,-1).every((e=>t.findIndex((t=>t==e))>-1)))&&r.push(e.rowKey)})),r},pt=()=>V?(()=>{const{current:e,pageSize:t}=O;return w.current.tableFullData.slice((e-1)*t,e*t)})():w.current.tableFullData,ht=e=>{const{scrollYLoad:t,scrollYStore:r}=w.current;if(!t)return G(e);const{startIndex:n,endIndex:i}=r;Re?queueMicrotask((()=>Re((()=>G(e.slice(n,i)))))):G(e.slice(n,i))},mt=()=>{let e=pt();w.current.treeTable&&p?.virtual&&(e=(e=>{const{allTableData:t,allRowKeys:r}=w.current,n=[];for(let e=0,i=r.length;e<i;e++){const i=r[e];ke.current.has(i)&&n.push(t[e])}return n})()),me(e.length>es.virtualScrollY),ht(e),(e=>{const{elementStore:t,scrollYStore:r,scrollYLoad:n}=w.current,{startIndex:i,rowHeight:a}=r;if(!n)return;const o=`${Math.max(0,i*a)}px`,l=e.length*a+"px";t.$tableBody.style.marginTop=o,t.$tableYspace.style.height=l})(e)},ft=e=>{X(e),Z(e),J(e),dt(),mt()},gt=e=>{Q(e)},bt=()=>{const{allTableData:e}=w.current;Ne(),e.forEach((e=>we(S(e,e.index),e)))},yt=()=>{ie({})},vt=()=>{ae({})},xt=()=>{oe([])},Et=()=>{Be([])};return{initialTable:()=>{(async()=>{if(!h)return;let t=re()(h,["fetch"]);if(h.fetch){const{api:e,params:r,dataKey:n}=h.fetch;try{const i=await e(r);200===i.code&&(t=(n?(0,ne.get)(i.data,n):i.data)??{})}catch(e){}}if(Object.keys(t).length){const{isExport:e=1,isImport:r=1,isPrint:n=1}=t;Se((t=>Object.assign({},t,{export:!!e,import:!!r,print:!!n})))}if(Array.isArray(t.fieldList)){const{originColumns:r}=w.current,n=Vr(e.columns,(e=>{const{dataIndex:n}=e,i=t.fieldList.find((e=>e.dataIndex===n));if(i){const{visible:t=1,disabled:a,secretName:o}=i,l=zr(r,n);ve(n,{visible:t,disabled:a,secretName:o}),t||(e.noAuth=!0,l.noAuth=!0),o&&(e.formatType=`secret-${o}`,l.formatType=`secret-${o}`)}}));f?.(n)}})(),$&&T.current.setClickedValues([$,""]),"radio"===d?.type&&_.length&&T.current.setClickedValues([_[0],""]),De(),j?et():nt(i)},checkDataIndex:()=>{const e=R.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&v("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:ft,getTableData:et,handleTableData:ht,createTableData:nt,createGroupData:je,createSelectionKeys:Ue,createRowExpandedKeys:We,setSelectionKeysEffect:Be,findParentRowKeys:Ye,getAllChildRowKeys:Ge,doFieldValidate:(e,t,r,n)=>{if(!Array.isArray(e))return v("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Ie.removeFromRequired({x:r,y:n}),Ie.removeFromValidate({x:r,y:n}),e.forEach((e=>{e.required&&pe(t)&&Ie.addToRequired({x:r,y:n,text:e.message}),"function"!=typeof e.validator||e.validator?.(t)||Ie.addToValidate({x:r,y:n,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:r,updated:n,removed:i}=Ie.state,a=(0,ne.intersection)(r,i),o=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:o(e),validate:o(t),inserted:r.filter((e=>!a.includes(e))),updated:n.filter((e=>![...(0,ne.intersection)(n,r),...(0,ne.intersection)(n,i)].includes(e))),removed:i.filter((e=>!a.includes(e)))}},dataChange:()=>{b?.(w.current.tableFullData)},tableChange:Xe,toLastPage:()=>{const e=st();O.current!==e&<(Object.assign({},O,{current:e}))},toFirstPage:ct,getPageCount:st,pagerChangeHandle:lt,triggerScrollXEvent:e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollXStore:t}=w.current,{startIndex:r,endIndex:n,offsetSize:i}=t,{toVisibleIndex:a,visibleSize:o}=be(e,k.tableWidth),l=Math.max(0,a-1-i),s=a+o+i;(a<=r||a>=n-o-1)&&(r===l&&n===s||(fe(Object.assign({},t,{startIndex:l,endIndex:s})),$e()))}(e)},triggerScrollYEvent:e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollYStore:t}=w.current,{startIndex:r,endIndex:n,offsetSize:i,visibleSize:a,rowHeight:o}=t,{toVisibleIndex:l}=ye(e,o),s=Math.max(0,l-1-i),c=l+a+i;(l<=r||l>=n-a-1)&&(r===s&&n===c||(ge(Object.assign({},t,{startIndex:s,endIndex:c})),mt()))}(e)},scrollBottomDebouncer:_e,clearTableSorter:yt,clearTableFilter:vt,clearSuperFilters:xt,clearRowSelection:Et,clearRowHighlight:()=>{de("")},clearTableLog:()=>{Ie.clearAllLog()},destroy:()=>{Te(),Ie.destroy(),Ql.deregister(w.current.uid)}}},cs=(e,t)=>{const{height:r,minHeight:n,maxHeight:i,ellipsis:a,showHeader:l,spanMethod:s}=e,{getRowKey:c,tableRef:d,$size:u,tableColumns:p,flattenColumns:h,leftFixedColumns:m,layout:f,scrollX:g,scrollY:b,tableData:y,showFooter:v,showPagination:x,isWebPagination:E,isFullScreen:S,setLayout:w,setScrollX:C,setScrollY:T,setElementStore:N,setScrollXStore:I,setScrollYStore:R,setShouldToTop:P}=t,O=o().useRef(b),k=o().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=f,a={};return n&&Object.assign(a,{minHeight:`${Zr(n)}px`}),i&&Object.assign(a,{maxHeight:`${Zr(i)}px`}),S?{...a,maxHeight:"",minHeight:"",height:`${e}px`}:r?{...a,height:"auto"!==r?`${Zr(r)}px`:`${t}px`}:a}),[r,i,n,S,f]),A=()=>{const{elementStore:e,scrollYLoad:t,resizeState:r}=d.current;if(!e.$table.offsetParent)return;const n=e.$table.offsetHeight,i=l?e.$header.offsetHeight:f.headerHeight,a=v?e.$footer.offsetHeight:f.footerHeight,o=n-i-a,s=e.$tableBody.offsetHeight,c=t||s>o;let u=0;if(S){const t=e.$toper?e.$toper.offsetHeight+Kl:0,n=e.$pager?e.$pager.offsetHeight+Kl:0;u=r.winHeight-t-n-20}(t||o!==f.viewportHeight)&&F(o),O.current=c,T(c),w((e=>Object.assign({},e,{headerHeight:i,footerHeight:a,viewportHeight:o,tableBodyHeight:s,tableFullHeight:u})))},L=(e,t)=>{const r=e+t;let n=-1,i=0,a=0;for(let t=0,o=h.length;t<o;t++){const o=h[t];if(i+=o.width||o.renderWidth,-1===n&&e<i&&(n=t),n>=0&&(a++,i>r))break}return{toVisibleIndex:Math.max(0,n),visibleSize:Math.max(8,a)}},F=e=>{const{scrollBarRef:t,scrollYStore:r,isIE:n}=d.current,i=t.current.scrollTop,{rowHeight:a}=r,{toVisibleIndex:o}=H(i,a),l=Math.max(8,Math.ceil(e/a)+2),s=n?5:0,c=Math.max(0,o-1-s),u=Math.max(o+l+s,r.endIndex);R(Object.assign({},r,{visibleSize:l,offsetSize:s,startIndex:c,endIndex:u}))},H=(e,t)=>{const r=Math.floor(e/t);return{toVisibleIndex:Math.max(0,r)}},_=(e,t)=>{const{elementStore:r,scrollYStore:n,allTableData:i}=d.current,a=r.$tableBody.parentNode.parentNode;if(void 0!==t&&t>=0)a.scrollTop=t*n.rowHeight;else{const t=(E?Yr(y):i).findIndex((t=>e===c(t,t.index)));a.scrollTop=(t<0?0:t)*n.rowHeight}};return{createElementStore:e=>{Object.keys(e).forEach((t=>{N(t,e[t])}))},tableStyles:k,getSpan:(e,t,r,n,i)=>{let a=1,o=1;if("function"==typeof s){const l=s({row:e,column:t,rowIndex:r,columnIndex:n,tableData:i});Array.isArray(l)?(a=l[0],o=l[1]):(0,ne.isPlainObject)(l)&&(a=l.rowSpan,o=l.colSpan)}const{mergeCells:l}=d.current;if(l.length>0){const e=l.find((e=>e.row===r&&e.col===n));e&&(a=e.rowSpan,o=e.colSpan)}return{rowSpan:a,colSpan:o}},getStickyLeft:e=>{h.findIndex((t=>t.dataIndex===e))<0&&(e=Br(zr(p,e)).dataIndex);let t=0;for(let r=0;r<h.length;r++){const n=h[r];if(n.dataIndex===e)break;t+=n.width||n.renderWidth||0}return t},getStickyRight:(e,t)=>{h.findIndex((t=>t.dataIndex===e))<0&&(e=Ur(zr(p,e)).dataIndex);const r="thead"===t?(e=>{if(!e.some((e=>e.colSpan>0)))return e;const t=[];let r=[];return e.forEach((e=>{e.colSpan>0&&r.length>0&&(t.push(r),r=[]),r.push(e)})),r.length>0&&t.push(r),t.map((e=>{const[t,r]=e.reduce(((e,t)=>(t.colSpan>0?e[0].push(t):e[1].push(t),e)),[[],[]]);return[...r,...t.reverse()]})).flat()})(h):h;let n=0;for(let t=r.length-1;t>=0;t--){const i=r[t];if(i.dataIndex===e)break;n+=i.width||i.renderWidth||0}return n},scrollXToColumn:(e,t)=>{const{elementStore:r}=d.current,n=void 0===t?h.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const i=m.map((e=>e.width||e.renderWidth||es.defaultColumnWidth)).reduce(((e,t)=>e+t),0);r.$tableBody.parentNode.parentNode.scrollLeft=r.$tableBody.querySelectorAll("tbody > tr > td")[n].offsetLeft-i},scrollYToRecord:_,rowInViewport:e=>{const{elementStore:t,scrollYStore:r}=d.current,{viewportHeight:n,gutterWidth:i}=f,a=e*r.rowHeight,o=t.$tableBody.parentNode.parentNode;return!(a<o.scrollTop||a+r.rowHeight>o.scrollTop+(g?n-i:n))},calcTableHeight:()=>{if("auto"!==r)return;const{elementStore:e,resizeState:t}=d.current,n=t.winHeight-e.$table.getBoundingClientRect().top-(x?Di["small"!==u?"middle":u]+Kl:0)-Kl;w((e=>Object.assign({},e,{tableAutoHeight:n})))},resetTableScroll:()=>{const{shouldToTop:e}=d.current;e&&_("",0),P(!0)},computeVirtualX:L,computeVirtualY:H,doLayout:()=>{a?A():de((()=>A())),(()=>{const{elementStore:e,scrollXLoad:t}=d.current,r=e.$table.clientWidth,n=O.current?f.gutterWidth:0,{defaultColumnWidth:i}=es,a=[];let o=0;if(h.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,o+=e.width):(e.renderWidth=void 0,a.push(e))})),a.length>0){const e=h.reduce(((e,t)=>e+(t.width||t.minWidth||i)),0);if(e<=r-n){C(!1);const t=r-n-e;if(1===a.length)a[0].renderWidth=(a[0].minWidth||i)+t;else{const e=t/a.reduce(((e,t)=>e+(t.minWidth||i)),0);let r=0;a.forEach(((t,n)=>{if(0===n)return;const a=Math.floor((t.minWidth||i)*e);r+=a,t.renderWidth=(t.minWidth||i)+a})),a[0].renderWidth=(a[0].minWidth||i)+t-r}}else C(!0),a.forEach((e=>{e.renderWidth=e.minWidth||i}));w((t=>({...t,tableBodyWidth:Math.max(e,r)})))}else o=h.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||i)),0),C(o>r),w((e=>({...e,tableBodyWidth:o})));w((e=>({...e,tableWidth:r}))),t&&(e=>{const{scrollXStore:t,isIE:r,scrollBarRef:n}=d.current,i=n.current.scrollLeft,{toVisibleIndex:a,visibleSize:o}=L(i,e),l=r?5:0,s=Math.max(0,a-1-l),c=Math.max(a+o+l,t.endIndex);I(Object.assign({},t,{visibleSize:o,offsetSize:l,startIndex:s,endIndex:c}))})(r)})()}}},ds=e=>{const{total:t}=e,{tableRef:r,selectionKeys:n,isHeadSorter:i,isHeadFilter:a,isTreeTable:l,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearRowSelection:u,clearRowHighlight:p}=o().useContext(Ml),{infoBarConfig:h,rowSelection:m,rowHighlight:g}=r.current.props,{allTableData:b,invalidRowKeys:y}=r.current,{hideAlert:v,hideClearButton:x}=h||{},E=o().useMemo((()=>!v),[v]),S=o().useMemo((()=>!x&&!!(i||a||m||g)),[x,i,a,m,g]),w=Ie("table"),C={[`${w}__alert`]:!0};return E?o().createElement("div",{className:Ne()(C)},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.InfoCircleFilled,null)),o().createElement("span",null,f("qm.table.alert.total",{total:l?b.length:t}),m?`,${f("qm.table.alert.selected",{total:Math.max(n.length-y.length,0)})}`:""),S&&o().createElement("em",{onClick:()=>{c(),d(),u(),p(),de((()=>s()))}},f("qm.table.alert.clear"))):null},us=o().forwardRef(((e,t)=>{const{isFullScreen:r,open:n=!0}=e,{setFullScreen:i}=o().useContext(Ml),a=()=>{i(!r)};o().useImperativeHandle(t,(()=>({clickHandle:a})));const l=Ie("table");return n?o().createElement("span",{className:`${l}-full-screen`,title:f(r?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>a()},o().createElement("i",{className:"svgicon icon"},r?o().createElement(Re.FullscreenExitOutlined,null):o().createElement(Re.FullscreenOutlined,null))):null}));us.displayName="FullScreen";const ps=us,hs=o().forwardRef(((e,t)=>{const{open:r=!0}=e,{getTableData:n}=o().useContext(Ml),i=()=>{n()};o().useImperativeHandle(t,(()=>({clickHandle:i})));const a=Ie("table");return r?o().createElement("span",{className:`${a}-reload`,title:f("qm.table.refresh.text"),onClick:()=>i()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.ReloadOutlined,null))):null}));hs.displayName="Reload";const ms=hs,fs=()=>{const e={dateFormat:e=>{const t=e?u()(e).format(Bl):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?u()(e).format(Ul):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?u()(e).format(Ul.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>nn(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>an(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,r,n)=>{const{dictItems:i,precision:a,displayPrecision:o,formatType:l,editRender:s}=r,c=i||s?.(n,r)?.items||[];let d=c.find((e=>e.value==t))?.text??t??"";if(Array.isArray(t)&&(d=t.map((e=>c.find((t=>t.value==e))?.text??e)).join(",")),a>=0&&""!==d&&(d=nn(d)?new(Ri())(d).toFixed(a):d),o>=0&&""!==d&&(d=on(d,o)),l){const t=e[`${ue(l)}Format`];t?d=t(d):v("Table","字段的格式化类型 `formatType` 配置不正确")}return d},r=e=>ae(e)?dn(e).join(""):e??"";return{renderText:t,getTitleFromCellNode:r,getTitleFromCellValue:(e,n,i,a)=>{const o=en(e,n.dataIndex),l=n.render?n.render(o,e,n,i,a):t(o,n,e);return r(l)}}},gs=o().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,{global:i}=o().useContext(c),{tableRef:a,flattenColumns:l,summationRows:s,showSummary:d,getSpan:u}=o().useContext(Ml),{tablePrint:p,showHeader:h}=a.current.props,{getTitleFromCellValue:m}=fs(),g=i?.print?.leftLogo??"",b=i?.print?.rightLogo??"",y=!(!g&&!b),v=o().useMemo((()=>fe(Wr(r,[es.expandableColumn,es.selectionColumn,es.operationColumn]))),[r]),x=o().useMemo((()=>fe(Wr(l,[es.expandableColumn,es.selectionColumn,es.operationColumn]))),[l]),E=o().useMemo((()=>fe(r.filter((e=>e.printFixed)))),[r]),S=e=>{const t=Object.assign({},fn(v,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?S(t):t},w=(e,t)=>(0,ne.map)((0,ne.groupBy)((0,ne.flatten)(e),t),(0,ne.spread)((function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return(0,ne.mergeWith)(...r,((e,r)=>{if(Array.isArray(e))return w(e.concat(r),t)}))}))),C=()=>{const{allTableData:e}=a.current,t=(e=>{const t=[];let r=[],n=0,i=0;for(;i<e.length;){const a=e[i];n+=a.width||a.renderWidth||a.minWidth||es.defaultColumnWidth,n<=es.printWidth?(r.push(a),i===e.length-1&&t.push(r),i++):i>0?(e.splice(0,i),E.length&&e.unshift(...E),t.push(r),r=[],n=0,i=0):(a.width=es.printWidth,r.push(a),t.push(r),i++)}return t})([...x]),r=(e=>{const t=[];return e.forEach((e=>{let r=[];e.forEach((e=>{1===e.level?r.push(e):r.push(S(e))})),r=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const r=e.filter((e=>e.dataIndex===t));return r.length<=1?r[0]:w(r,"dataIndex")[0]})))(r),t.push(Xr(r))})),t})(t);let n=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n</style>","</head>","<body>"].join("");for(let i=0;i<t.length;i++)n+=T(r[i],t[i],e),n+='<div class="page-break"></div>';return n+"</body></html>"},T=(e,t,r)=>{const{showLogo:n=!0}=p;let i='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return i+=`<colgroup>${t.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||es.defaultColumnWidth}px">`})).join("")}</colgroup>`,h&&(i+=["<thead>",n&&y?`<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">',g?`<img src="${g}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',b?`<img src="${b}" border="0" height="38" />`:"","</td>","</tr>","</table>"].join("")}</th></tr>`:"",e.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${un(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),r.length&&(i+=`<tbody>${r.map((e=>`<tr>${t.map(((t,n)=>{const{rowSpan:i,colSpan:a}=u(e,t,e.index,n,r);return i&&a?`<td rowspan="${i}" colspan="${a}">${m(e,t,e.index,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),d&&s.length&&(i+=["<tfoot>",s.map((e=>`<tr>${t.map(((t,n)=>{const{dataIndex:i,summation:a}=t,o=a?.render?a.render(r):en(e,`${i}_text`);return`<td>${0===n&&""===o?f("qm.table.config.summaryText"):ae(o)?dn(o).join(""):o}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i},N=()=>{((e,t)=>{const{filename:r,type:n,isDownload:i}={filename:"print",type:"html",isDownload:!1},a=`${r}.${n}`;if(window.Blob){const e=new Blob([t],{type:`text/${n}`});if(!i)return Promise.resolve({type:n,content:t,blob:e});qt(e,a)}})(0,C())?.then((e=>{let{content:t,blob:r}=e,n=document.createElement("iframe");n.setAttribute("frameborder","0"),n.setAttribute("width","100%"),n.setAttribute("height","0"),n.style.display="none",document.body.appendChild(n),a.current.isIE?(n.contentDocument.write(t),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(r))}))};o().useImperativeHandle(t,(()=>({clickHandle:N})));const I=Ie("table");return n?o().createElement("span",{className:`${I}-print`,title:f("qm.table.print.text"),onClick:()=>N()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.PrinterOutlined,null))):null}));gs.displayName="TablePrint";const bs=gs,ys=require("exceljs");var vs=n.n(ys);const xs="606060",Es="thin",Ss="d4d4d4",ws=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Cs=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Ts=()=>({top:{style:Es,color:{argb:Ss}},left:{style:Es,color:{argb:Ss}},bottom:{style:Es,color:{argb:Ss}},right:{style:Es,color:{argb:Ss}}}),Ns=e=>{const{children:t}=e;return t&&t.length?Ns(t[0]):e},Is=e=>{const{precision:t,formatType:r}=e,n=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===r?{numFmt:n?`0${n}%`:"0%"}:"finance"===r?{numFmt:n?`#,##0${n}`:"#,##0"}:n?{numFmt:`0${n}`}:null},Rs=()=>{const{tableRef:e,getSpan:t,showSummary:r,isHeadGroup:n}=o().useContext(Ml),{spanMethod:i,showHeader:a}=e.current.props,l=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(o,l,s,c)=>{const{columns:d,footSummation:u}=o,{scrollYStore:{rowHeight:p}}=e.current,h=Mr(d),m=Xr(d),g=[],b=[],y=[],v=[];let x=0;const E={};h.forEach((e=>{const{dataIndex:t,width:r,minWidth:n,renderWidth:i}=e;E[t]=un(e.title),y.push({key:t,width:(r||i||n||es.defaultColumnWidth)/8})})),a&&(n?m.forEach(((e,t)=>{const r={};e.forEach((e=>{const{colSpan:n,rowSpan:i}=e,a=Ns(e),o=h.findIndex((e=>{let{dataIndex:t}=e;return t===a.dataIndex}));r[a.dataIndex]=un(e.title),0!==n&&(n>1||i>1)&&v.push({s:{r:t,c:o},e:{r:t+i-1,c:o+n-1}})})),g.push(r)})):(h.forEach(((e,t)=>{const{colSpan:r,rowSpan:n}=e;(r>1||n>1)&&v.push({s:{r:x,c:t},e:{r:x+n-1,c:t+r-1}})})),g.push(E)),x+=g.length);const S=l.map(((e,r)=>{const n={};return h.forEach(((a,o)=>{if("function"==typeof i){const{rowSpan:n,colSpan:i}=t(e,a,r,o,l);(i>1||n>1)&&v.push({s:{r:r+x,c:o},e:{r:r+x+n-1,c:o+i-1}})}const s=["percent","finance"].includes(a.formatType);n[a.dataIndex]=s?en(e,a.dataIndex):c(e,r,a,o)})),n}));x+=S.length,r&&u&&s(h,l).forEach(((e,t)=>{const r={};h.forEach(((t,n)=>{const{dataIndex:i,summation:a}=t,o=a?.render?a.render(l):en(e,i);r[i]=0===n&&""===o?f("qm.table.config.summaryText"):ae(o)?dn(o).join(""):o})),b.push(r)}));const{sheetName:w,useStyle:C}=o,T=new(vs().Workbook),N=T.addWorksheet(w);N.columns=y,a&&N.addRows(g).forEach((e=>{C&&ws(e,p),e.eachCell((e=>{const t=N.getColumn(e.col),r=zr(d,t.key),{align:n,theadAlign:i}=r;Cs(e,i||n),C&&Object.assign(e,{font:{bold:!0,color:{argb:xs}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Ts()})}))})),N.addRows(S).forEach((e=>{C&&ws(e,p),e.eachCell((e=>{const t=N.getColumn(e.col),r=zr(d,t.key),{align:n}=r;Cs(e,n),Object.assign(e,Is(r)),C&&Object.assign(e,{font:{color:{argb:xs}},border:Ts()})}))})),r&&u&&N.addRows(b).forEach((e=>{C&&ws(e,p),e.eachCell((e=>{const t=N.getColumn(e.col),r=zr(d,t.key),{align:n}=r;Cs(e,n),Object.assign(e,Is(r)),C&&Object.assign(e,{font:{color:{argb:xs}},border:Ts()})}))})),v.forEach((e=>{let{s:t,e:r}=e;N.mergeCells(t.r+1,t.c+1,r.r+1,r.c+1)}));const I=await T.xlsx.writeBuffer();return new Blob([I],{type:"application/octet-stream"})},exportCSV:(e,t)=>{const r=e=>{let t=e;const r=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),n=-1!==e.indexOf('"');return n&&(t=t.replace(/"/g,'""')),(r||n)&&(t='"'+t+'"'),t},n="\ufeff"+(e=>{let t,n,i,a,o="";for(t=0;t<e.rows.length;t+=1){for(i=e.rows[t],n=0;n<i.cells.length;n+=1)a=i.cells[n],o=o+(n?",":"")+r(a.textContent.trim());o+="\r\n"}return o})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var i;return((e,t,r)=>{t=t||"",r=r||512;const n=window.atob(e),i=[];let a;for(a=0;a<n.length;a+=r){const e=n.slice(a,a+r),t=new Array(e.length);let o;for(o=0;o<e.length;o+=1)t[o]=e.charCodeAt(o);const l=new window.Uint8Array(t);i.push(l)}return new window.Blob(i,{type:t})})((i=n,window.btoa(unescape(encodeURIComponent(i)))),"application/csv")},importXLSX:(e,t)=>{const{columns:r,file:n}=e,i=Mr(r),a=new FileReader;a.onerror=()=>{L.message.error(f("qm.table.import.error"))},a.onload=e=>{const r=i.map((e=>un(e.title))),n=new(vs().Workbook),a=e.target;a?n.xlsx.load(a.result).then((e=>{const n=e.worksheets[0];if(n){const e=n.getSheetValues(),a=e.findIndex((e=>e&&e.length>0)),o=e[a],s=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(r,o);if(s){const n=e.slice(a+1).map((e=>{const t={};e.forEach(((e,r)=>{let n=e;Array.isArray(n?.richText)&&(n=n.richText.map((e=>e.text)).join("")),(0,ne.isPlainObject)(n)&&"text"in n&&(n=n.text),(0,ne.isDate)(n)&&(n=sn(n,Ul)),n?.formula&&(n=n.result??n.value),t[o[r]]=n}));const n={};return r.forEach(((e,r)=>{const{dataIndex:a,dictItems:o}=i[r];Array.isArray(o)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>l(o,e))).filter((e=>""!==e)):t[e]=l(o,t[e])),tn(n,a,t[e])})),n}));t?.(n)}else L.message.error(f("qm.table.import.error"))}else L.message.error(f("qm.table.import.error"))})):L.message.error(f("qm.table.import.error"))},a.readAsArrayBuffer(n)}}},Ps=e=>{const{fileType:t,onChange:r}=e;let n,i;const a=Ie("table"),l=e=>{const t=e.name,r=t.lastIndexOf("."),n=t.substring(r+1,t.length);return{filename:t.substring(0,r),type:n}};return o().createElement(xe,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return n||(n=document.createElement("form"),i=document.createElement("input"),n.className=`${a}--file-form`,i.name="file",i.type="file",n.appendChild(i),document.body.appendChild(n)),new Promise(((e,r)=>{const a=!t.type;i.multiple=!!t.multiple,i.accept=a?"":`.${t.type}`,i.onchange=o=>{const{files:s}=o.target,c=s[0];let d="";if(!a)for(let e=0;e<s.length;e++){const{type:r}=l(s[e]);if(t.type!==r){d=r;break}}d?(L.message.warning(f("qm.upload.notType",{type:d})),r()):e(c),document.body.removeChild(n),n=null,i=null},n.reset(),i.click()}))})({type:t});r?.(e.name,e)}catch(e){}})()},f("qm.upload.text"))},Os=e=>{const{columns:t,onClose:r}=e,{tableRef:n,createTableData:i,dataChange:a}=o().useContext(Ml),{beforeTableImport:l}=n.current.props,{importXLSX:s}=Rs(),c=o().useRef(null),[d,u]=o().useState(!1),[p,h]=o().useState(!0),m=e=>e.filter((e=>![es.expandableColumn,es.selectionColumn,"index","pageIndex",es.operationColumn].includes(e.dataIndex))),[g,b]=o().useState([{type:"INPUT",label:f("qm.table.export.fileName"),fieldName:"fileName",render:(e,t)=>{const{fileName:r}=t.GET_FIELDS_VALUE(["fileName"]);return o().createElement(o().Fragment,null,r?o().createElement("span",null,r):o().createElement(Ps,{fileType:t.state.formData.fileType,onChange:(e,r)=>{t.SET_FIELDS_VALUE({fileName:e,file:r}),r&&h(!1)}}))}},{type:"SELECT",label:f("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:f("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:f("qm.table.import.fillText"),value:"fill"},{text:f("qm.table.import.addText"),value:"add"},{text:f("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{g.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,b([...g])}},{type:"INPUT_NUMBER",label:f("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:1,max:n.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]),y=Ie("table");return o().createElement("div",{className:`${y}-import__setting`},o().createElement(Xo,{ref:c,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:{posIndex:"条"},items:g,cols:1,labelWidth:100}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(xe,{onClick:()=>r(),style:{marginRight:8}},f("qm.table.export.closeButton")),o().createElement(xe,{type:"primary",loading:d,disabled:p,onClick:()=>(async()=>{const[e,o]=await c.current.GET_FORM_DATA();e||(u(!0),s({columns:m(t),file:o.file},(async e=>{const{tableFullData:t,store:s}=n.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof l)try{e=await l(e)}catch(e){}if("fill"===o.importType&&i(e),"add"===o.importType&&i([...t,...e]),"insert"===o.importType){const{tableFullData:t}=n.current,r=o.posIndex,a=t.slice(0,r).concat(e).concat(t.slice(r));i(a)}e.forEach((e=>{s.addToInserted(e)})),a(),L.message.success(f("qm.table.import.success",{total:e.length})),u(!1),r()})))})()},f("qm.table.import.text"))))},ks=o().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,[i,a]=o().useState(!1),l=()=>{a(!0)};o().useImperativeHandle(t,(()=>({clickHandle:l})));const s=Ie("table"),c={[`${s}-import`]:!0},d={visible:i,title:f("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>a(!1)};return o().createElement(o().Fragment,null,n&&o().createElement("span",{className:Ne()(c),title:f("qm.table.import.textNoSpace"),onClick:()=>l()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.ImportOutlined,null))),o().createElement(wr,d,o().createElement(Os,{columns:r,onClose:()=>a(!1)})))}));ks.displayName="TableImport";const As=ks,Ls=e=>{const{columns:t,onChange:r}=e,{$size:n}=o().useContext(Ml),i=o().useRef([]),[a,l]=o().useState(!1),[s,c]=o().useState(t);Ve((()=>{u()}),[s]),o().useEffect((()=>{d()}),[t]);const d=()=>{const e=[];t.forEach(((r,n)=>{const i=r.colSpan;i>1&&t.slice(n+1,n+i).every((e=>{let{colSpan:t}=e;return 0===t}))&&e.push(t.slice(n,n+i))})),i.current=e},u=()=>{const e=[];s.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=i.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...i.current[a].map(((e,r)=>{let{dataIndex:n}=e;const i=s.find((e=>e.dataIndex===n));return r>0&&void 0!==t.hidden&&(i.hidden=t.hidden),i})))})),r?.(e)},p=Ie("table"),h={[`${p}__popper`]:!0,"column-filter__popper":!0,[`${p}--lg`]:"large"===n,[`${p}--sm`]:"small"===n},m=[`${p}-column-filter`,{selected:a}];return o().createElement(Yi(),{action:["click"],popupVisible:a,popup:o().createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},o().createElement("div",{className:"main"},o().createElement(fi.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:s,setList:e=>{const t=e.map((e=>e.dataIndex)),r=s.map((e=>e.dataIndex));(0,ne.isEqual)(t,r)||c(vn(e))}},s.map((e=>((e,t)=>{const{colSpan:r}=e;if(0===r)return o().createElement("li",{key:e.dataIndex,style:{display:"none"}});const n=["svgicon","handle","main-handle"];return o().createElement("li",{key:e.dataIndex,className:"item"},o().createElement(L.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,c([...s])}}),o().createElement("i",{className:Ne()(n),title:f("qm.table.columnFilter.draggable")},o().createElement(Re.HolderOutlined,null)),o().createElement("span",{className:"text"},un(e.title)))})(e)))))),popupClassName:Ne()(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{l(e)},builtinPlacements:Gl,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},o().createElement("span",{className:Ne()(m),title:f("qm.table.columnFilter.text")},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.SettingOutlined,null)),o().createElement("span",null,f("qm.table.columnFilter.text"))))},Fs=e=>{const{defaultValue:t,onClose:r,onOk:n}=e,{tableRef:i,selectionKeys:a,pagination:l,showSummary:s}=o().useContext(Ml),{rowSelection:c}=i.current.props,d=o().useRef(null),[p,h]=o().useState(!1),m=o().useMemo((()=>Object.assign({},{fileName:`${u()().format(Wl)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:a.length?"selected":"all","startIndex|endIndex":[1,l.total],footSummation:s?1:0,useStyle:0},t,{columns:fe(t.columns||[])})),[]),[g,b]=o().useState([{type:"INPUT",label:f("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:f("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:f("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:f("qm.table.export.all"),value:"all"},{text:f("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==c?.type},{text:f("qm.table.export.custom"),value:"custom"}]},onChange:e=>{g.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,b([...g])}},options:{min:1},disabled:!0},{type:"INPUT",label:f("qm.table.columnFilter.text"),fieldName:"columns",render:(e,t)=>o().createElement(Ls,{columns:t.state.formData.columns,onChange:e=>{t.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:f("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!s,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:f("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]),y=Ie("table");return o().createElement("div",{className:`${y}-export__setting`},o().createElement(Xo,{ref:d,initialValues:m,items:g,cols:1,labelWidth:100}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(xe,{onClick:()=>r(),style:{marginRight:8}},f("qm.table.export.closeButton")),o().createElement(xe,{type:"primary",loading:p,onClick:()=>(async()=>{const[e,t]=await d.current.GET_FORM_DATA();if(!e){h(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);n(t),await ce(1e3),h(!1),r()}})()},f("qm.table.export.text"))))},Hs=o().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,{global:i}=o().useContext(c),{tableRef:a,flattenColumns:l,pagination:s,fetchParams:d,isFetch:p,isGroupSubtotal:h,showSummary:m,getSpan:g}=o().useContext(Ml),{exportExcel:b,fetch:y,showHeader:v}=a.current.props,{getTitleFromCellValue:x}=fs(),[E,S]=o().useState(!1),[w,C]=o().useState(!1),T=o().useMemo((()=>!!b?.fetch?.api),[b]),N=o().useMemo((()=>!s.total||w),[s.total,w]),I=o().useMemo((()=>Wr(r,[es.expandableColumn,es.selectionColumn,es.operationColumn])),[r]),R=o().useMemo((()=>Wr(l,[es.expandableColumn,es.selectionColumn,es.operationColumn])),[l]),P=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return e.map(((e,n)=>{const i={...e,index:n,pageIndex:n},a=t?`${t}-${i.index+1}`:`${i.index+1}`;return i.indexPath=a,i._level=r,Array.isArray(e.children)&&(i.children=P(e.children,a,r+1)),R.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&tn(i,t,en(i,t))})),i}))},O=(e,t)=>{const r={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:n}=e,i=(h?pn(t):t).reduce(((e,t)=>{if(t?.[es.summaryIgnore])return e;const r=Number(en(t,n));return Number.isNaN(r)?e:e+r}),0);tn(r,n,i)})),[r]},k=(e,t,r,n)=>{const{precision:i,formatType:a}=r;let o=x(e,r,t,n);return i>=0&&!a&&""!==o&&(o=Number(o)),o},{exportXLSX:A,exportCSV:F}=Rs(),H=async e=>{const{api:t,formatter:r=(e=>e),afterFetch:n,dataKey:i}=y;let a=[];try{C(!0);const o=await t({...r(d),[es.currentPageName]:1,[es.pageSizeName]:e??s.total});if(200===o.code){let e=Array.isArray(o.data)?o.data:(0,ne.get)(o.data,i)??[];e="function"==typeof n?await n(e):e,a=Yr(P(e))}}catch(e){}return C(!1),a},_=e=>{const t=i?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},D=b?.fileName??`${u()().format(Wl)}.xlsx`,$=D.slice(D.lastIndexOf(".")+1).toLowerCase(),q=()=>{if(N)return L.message.warning(f("qm.table.export.warnText"));T?(async e=>{C(!0);try{const{api:t,params:r}=b.fetch,n=await t({columns:R.map((e=>{const{title:t,dataIndex:r,hidden:n}=e,{type:i}=e.filter||{};return{title:t,dataIndex:r,type:i,hidden:n}})),...d,...r,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[es.currentPageName]:void 0,[es.pageSizeName]:void 0});n.data&&(qt(n.data,e),_(e))}catch(e){}C(!1)})(D):S(!0)};o().useImperativeHandle(t,(()=>({clickHandle:q})));const M=Ie("table"),j={[`${M}-export`]:!0},K={visible:E,title:f("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>S(!1)},V={fileName:D.slice(0,D.lastIndexOf(".")),fileType:$,columns:I,useStyle:b?.cellStyle?1:0};return o().createElement(o().Fragment,null,n&&o().createElement("span",{className:Ne()(j),title:f("qm.table.export.textNoSpace"),onClick:()=>q()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.DownloadOutlined,null))),o().createElement(wr,K,o().createElement(Fs,{defaultValue:V,onClose:()=>S(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:r,exportType:n,startIndex:i=1,endIndex:o}=e,{allTableData:l,selectionRows:s}=a.current;let c=[];if(p?("all"===n&&(c=await H()),"custom"===n&&(c=await H(o),c=c.slice(i-1))):("all"===n&&(c=l.slice(0)),"custom"===n&&(c=l.slice(i-1,o||void 0))),"selected"===n&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof b?.beforeExport)try{c=b?.beforeExport(c)}catch(e){}if("xlsx"===r){const r=await A(e,c,O,k);qt(r,`${t}.xlsx`),_(`${t}.xlsx`)}if("csv"===r){const r=F(e,((e,t)=>{const{columns:r,footSummation:n}=e,i=Xr(r),a=Mr(r);let o='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return o+=`<colgroup>${a.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||es.defaultColumnWidth}px">`})).join("")}</colgroup>`,v&&(o+=["<thead>",i.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${un(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(o+=`<tbody>${t.map((e=>`<tr>${a.map(((r,n)=>{const{rowSpan:i,colSpan:a}=g(e,r,e.index,n,t);return i&&a?`<td rowspan="${i}" colspan="${a}">${k(e,e.index,r,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),m&&n&&(o+=["<tfoot>",O(a,t).map((e=>`<tr>${a.map(((r,n)=>{const{dataIndex:i,summation:a}=r,o=a?.render?a.render(t):en(e,i);return`<td>${0===n&&""===o?f("qm.table.config.summaryText"):ae(o)?dn(o).join(""):o}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),o+="</table>",o})(e,c));qt(r,`${t}.csv`),_(`${t}.csv`)}})(Object.assign({},e,{columns:jr(e.columns)}))}})))}));Hs.displayName="TableExport";const _s=Hs,Ds=e=>{const{columns:t,onClose:r}=e,{tableRef:n,tableBodyRef:i,dataChange:a}=o().useContext(Ml),{beforeClipboard:l}=n.current.props,s=o().useRef(null),[c,d]=o().useState([{type:"INPUT_NUMBER",label:f("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:f("qm.table.clipboard.colIndex"),fieldName:"colIndex",options:{itemList:t.map(((e,t)=>({value:t,text:un(e.title)})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:f("qm.table.clipboard.content"),fieldName:"content",placeholder:f("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[u,p]=o().useState(!1),h=Ie("table");return o().createElement("div",{className:`${h}-clipboard__setting`},o().createElement("h3",{className:"info"},f("qm.table.clipboard.supportText")),o().createElement(Xo,{ref:s,initialValues:{},initialExtras:{rowIndex:"行",colIndex:"列"},items:c,cols:1,labelWidth:100}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(xe,{onClick:()=>r(),style:{marginRight:8}},f("qm.table.export.closeButton")),o().createElement(xe,{type:"primary",loading:u,onClick:()=>(async()=>{const[e,o]=await s.current.GET_FORM_DATA();if(e)return;const{tableFullData:c,store:d}=n.current;p(!0);const u=o.content.trim().replace(/(\r|\n)$/,"");let h=u.replace(/"[^"]+"/g,"^");(u.match(/"[^"]+"/g)?.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," ")))||[]).forEach((e=>{h=h.replace(/\^/,e)}));let m=h.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof l)try{m=await l(m,m[0].map(((e,r)=>t[o.colIndex+r].dataIndex)))}catch(e){}m.forEach(((e,r)=>{e.forEach(((e,i)=>{const a=c[o.rowIndex-1+r],l=t[o.colIndex+i];if(a&&l){let t=!1;if(l.editRender){const e=l.editRender(a,l);t=!(e.disabled||e.extra?.disabled||n.current.fieldAuth[l.dataIndex]?.disabled)}t&&l.dictItems&&(t=l.dictItems.some((t=>t.value==e))),t&&(tn(a,l.dataIndex,e),d.addToUpdated(a))}}))})),i.current.forceUpdate(),a(),L.message.success(f("qm.table.clipboard.success",{total:m.length})),p(!1),r()})()},f("qm.table.clipboard.text"))))},$s=o().forwardRef(((e,t)=>{const{open:r=!0}=e,{flattenColumns:n}=o().useContext(Ml),[i,a]=o().useState(!1),l=o().useMemo((()=>(e=>e.filter((e=>![es.expandableColumn,es.selectionColumn,"index","pageIndex",es.operationColumn].includes(e.dataIndex))))(n)),[n]),s=()=>{a(!0)};o().useImperativeHandle(t,(()=>({clickHandle:s})));const c=Ie("table"),d={[`${c}-clipboard`]:!0},u={visible:i,title:f("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>a(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:Ne()(d),title:f("qm.table.clipboard.textNoSpace"),onClick:()=>s()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.CopyOutlined,null))),o().createElement(wr,u,o().createElement(Ds,{columns:l,onClose:()=>a(!1)})))}));$s.displayName="TableClipboard";const qs=$s,Ms=e=>{const{columns:t,onClose:r}=e,{tableRef:n,$size:i,selectionKeys:a,setSelectionKeysEffect:l}=o().useContext(Ml),{rowKey:s}=n.current.props,c=o().useRef(null),d=Pt(c),u=e=>e.map((e=>{const t={dataIndex:e.dataIndex,title:e.title,width:e.width,minWidth:e.minWidth,precision:e.precision,dictItems:e.dictItems??[],render:e.render};return Array.isArray(e.children)&&(t.children=u(e.children)),t})),[p,h]=o().useState([{title:f("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...u(t.filter((e=>![es.expandableColumn,es.selectionColumn,"index","pageIndex",es.operationColumn].includes(e.dataIndex))))]),[m]=o().useState(n.current.selectionRows.map((e=>({...e,children:void 0})))),[g,b]=o().useState(300),y=At((()=>{const e=c.current;b(e.offsetHeight-2*Di[i]-30)}),5);return kt((()=>{y()}),[d.width]),o().createElement("div",{ref:c,style:{height:"100%"}},o().createElement(zc,{size:i,columns:p,dataSource:m,rowKey:s,height:g,rowSelection:{type:"checkbox",selectedRowKeys:a,onChange:e=>l(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>h(e)}),o().createElement("div",{style:{height:10}}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(xe,{onClick:()=>r()},f("qm.table.selectCollection.closeButton"))))},js=o().forwardRef(((e,t)=>{const{columns:r,open:n=!0}=e,{tableRef:i,getRowKey:a,selectionKeys:l,isFetch:s,isTableEmpty:c,setSelectionKeysEffect:d,setSelectionRows:u}=o().useContext(Ml),{rowSelection:p}=i.current.props,[h,m]=o().useState(!1),g=o().useRef(!1);Ve((()=>{!g.current&&b()}),[c]);const b=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=p;if(s&&e)try{const r=await e.api(Object.assign({},{selectedKeys:l},e.params));if(200===r.code){let n=Array.isArray(r.data)?r.data:(0,ne.get)(r.data,e.dataKey)??[];n=n.filter((e=>!t(e))),d(n.map(((e,t)=>a(e,t)))),u(n),g.current=!0}}catch(e){}},y=()=>{m(!0)};o().useImperativeHandle(t,(()=>({clickHandle:y})));const v=Ie("table"),x={visible:h,title:f("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>m(!1)};return o().createElement(o().Fragment,null,n&&o().createElement("span",{className:`${v}-select-collection`,title:f("qm.table.selectCollection.text"),onClick:()=>y()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.CheckSquareOutlined,null))),o().createElement(wr,x,o().createElement(Ms,{columns:r,onClose:()=>m(!1)})))}));js.displayName="SelectCollection";const Ks=js,Vs=require("localforage");var zs=n.n(Vs);const Bs=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(e),Us=e=>{const{onClose:t}=e,{global:r}=o().useContext(c),{tableRef:n,getRowKey:i,$size:a,flattenColumns:l,pagination:s,setPagination:d,scrollYToRecord:u,setHighlightKey:p,setShouldToTop:h,isTreeTable:m,isWebPagination:g}=o().useContext(Ml),{uniqueKey:b}=n.current.props,y=o().useRef(null),x=o().useRef(null),E=o().useRef([]),S=o().useRef(""),w=o().useRef(-1),C=o().useRef("stop");Ve((()=>{const{current:e,pageSize:t}=s,r=n.current.tableFullData.slice((e-1)*t,e*t),a=Yr(r).findIndex((e=>i(e,e.index)===S.current));u("",a)}),[s.current]);const T=e=>{let t;switch(e){case"text":case"textarea":default:t="INPUT";break;case"number":t="INPUT_NUMBER";break;case"date":t="DATE";break;case"checkbox":case"radio":t="SELECT"}return t},N=e=>e.filter((e=>e?.dataIndex)).map((e=>({type:T(e.filter.type),fieldName:e.dataIndex,label:un(e.title),tooltip:e.description,options:{dateType:"exactdate",itemList:e.dictItems??[]},onChange:async()=>{const[e,t]=await y.current.GET_FORM_DATA(),[r,n]=await x.current.GET_FORM_DATA(),i=(0,ne.omitBy)(Object.assign({},t,n),pe);O(i)}}))),I={case:0,fullchar:0},R=o().useMemo((()=>l.filter((e=>![es.expandableColumn,es.selectionColumn,"index","pageIndex",es.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[l]),[P,O]=o().useState({}),[k,A]=o().useState(I),[F]=o().useState(N([R[0]])),[H]=o().useState(N(R.slice(1))),[_,D]=o().useState(0),$=o().useMemo((()=>!Object.keys(P).length),[P]);Ve((()=>{C.current="ready"}),[P,k]);const q=e=>{A(Object.assign({},k,e))},M=(e,t,r)=>new Promise(((n,i)=>{L.Modal.confirm({title:f("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),n()},onCancel:()=>{r(),n()}})})),j=async e=>{if(!Object.keys(P).length)return L.Modal.warning({title:f("qm.button.confirmPrompt"),content:f("qm.table.fastSearch.queryCondition")});if("ready"===C.current&&(C.current="stop",E.current=(e=>{const{allTableData:t}=n.current,r=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];let a=!0;for(const t in e){const{type:r}=R.find((e=>e.dataIndex===t)).filter;let n=en(i,t),o=!0;if("text"===r||"textarea"===r?o=new RegExp(k.fullchar?`^${e[t]}$`:e[t],k.case?"":"i").test(n):(n=Bs(n)?n.slice(0,10):n,o=n==e[t]),!o){a=!1;break}}a&&r.push(i)}return r})(P),D(E.current.length)),!E.current.length)return p(""),L.Modal.warning({title:f("qm.button.confirmPrompt"),content:f("qm.table.fastSearch.notMatch")});"next"===e&&(w.current=w.current<0?0:w.current+1,w.current>E.current.length-1&&await M(f("qm.table.fastSearch.toTheEnd"),(()=>w.current=0),(()=>w.current=E.current.length-1))),"prev"===e&&(w.current=w.current<0?E.current.length-1:w.current-1,w.current<0&&await M(f("qm.table.fastSearch.toStart"),(()=>w.current=E.current.length-1),(()=>w.current=0)));const t=E.current[w.current],r=i(t,t.index);let a=t.index;if(m&&g){const e=gn(n.current.deriveRowKeys,r)[0];a=n.current.tableFullData.findIndex((t=>i(t,t.index)===e))}((e,t)=>{if(S.current=e,g){const{pageSize:e}=s,r=Math.ceil((t+1)/e);h(!1),d(Object.assign({},s,{current:r}))}else u(e)})(r,a),p(r)},K=()=>{y.current.RESET_FORM(),x.current.RESET_FORM()},V=o().useMemo((()=>b?`fastSearch_${b}`:""),[b]),[z,B]=o().useState([]),[U,W]=o().useState(""),[G,Y]=o().useState("");Ve((()=>{if(G){const{filters:e,config:t}=z.find((e=>e.value===G)).list;y.current.SET_FIELDS_VALUE(re()(e,H.map((e=>e.fieldName)))),x.current.SET_FIELDS_VALUE(re()(e,F.map((e=>e.fieldName)))),O(e),A(t)}else K(),O({}),A(I)}),[G]),o().useEffect((()=>{X()}),[]);const X=async()=>{if(!V)return;let e=await zs().getItem(V);e||(e=await Q(V),Array.isArray(e)&&await zs().setItem(V,e)),Array.isArray(e)&&e.length&&(B(e),Y(e[0].value))},Q=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},Z=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},J=Ie("table");return o().createElement("div",{className:`${J}-fast-search__setting`},o().createElement("div",{className:"main"},o().createElement("div",{className:"top"},o().createElement("div",{className:"container"},o().createElement(ur,{defaultActiveKey:"1",size:"small",tabBarExtraContent:o().createElement("span",null,f("qm.table.alert.total",{total:_}))},o().createElement(ur.TabPane,{tab:f("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},o().createElement(Xo,{ref:y,items:F,cols:1,labelWidth:110})),o().createElement(ur.TabPane,{tab:f("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},o().createElement(Xo,{ref:x,items:H,cols:1,labelWidth:110})))),o().createElement("div",{className:"saved line"},o().createElement("div",{className:"form-wrap"},o().createElement(L.Input,{size:a,value:U,placeholder:f("qm.table.highSearch.configText"),disabled:$,onChange:e=>{const{value:t}=e.target;W(t)}}),o().createElement(xe,{type:"primary",disabled:!U||$,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!V)return v("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=cn(),t=[...z,{text:U,value:e,list:{filters:P,config:k}}];B(t),Y(e),W(""),await zs().setItem(V,t),await Z(V,t)})()},f("qm.table.highSearch.saveButton"))),o().createElement("div",{className:"card-wrap"},o().createElement("h5",{style:{height:`${es.rowHeightMaps[a]}px`}},o().createElement("span",null,f("qm.table.fastSearch.savedSetting"))),o().createElement("ul",null,z.map((e=>o().createElement("li",{key:e.value,className:Ne()({selected:e.value===G}),title:e.text,onClick:()=>(e=>{Y(e!==G?e:"")})(e.value)},o().createElement("span",{className:"title"},e.text),o().createElement("i",{className:"svgicon close",title:f("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=z.filter((t=>t.value!==e));B(t),e===G&&Y(""),await zs().setItem(V,t),await Z(V,t)})(e.value)}},o().createElement(Re.CloseCircleOutlined,null))))),!z.length&&o().createElement("div",{style:{padding:Kl}},o().createElement(bt,null)))))),o().createElement("div",{className:"bottom"},o().createElement("div",null,o().createElement(L.Checkbox,{checked:!!k.case,onChange:e=>q({case:e.target.checked})},f("qm.table.fastSearch.matchCase")),o().createElement(L.Checkbox,{checked:!!k.fullchar,onChange:e=>q({fullchar:e.target.checked})},f("qm.table.fastSearch.matchFullchar"))),o().createElement("div",null,o().createElement(xe,{onClick:()=>K()},f("qm.table.fastSearch.clear"))))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${Di[a]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(xe,{onClick:()=>t(),style:{marginRight:8}},f("qm.table.fastSearch.closeButton")),o().createElement(xe,{type:"primary",style:{marginRight:8},onClick:()=>j("prev")},f("qm.table.fastSearch.queryPrev")),o().createElement(xe,{type:"primary",onClick:()=>j("next")},f("qm.table.fastSearch.queryNext"))))},Ws=o().forwardRef(((e,t)=>{const{open:r=!0}=e,{$size:n}=o().useContext(Ml),[i,a]=o().useState(!1),l=()=>{a(!0)};o().useImperativeHandle(t,(()=>({clickHandle:l})));const s=Ie("table"),c={visible:i,title:f("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${Di[n]+20}px`},onClose:()=>a(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:`${s}-super-search`,title:f("qm.table.fastSearch.text"),onClick:()=>l()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.MonitorOutlined,null))),o().createElement(wr,c,o().createElement(Us,{onClose:()=>a(!1)})))}));Ws.displayName="FastSearch";const Gs=Ws,Ys=e=>{const{columns:t,group:r,summary:n}=e,{tableRef:i,$size:a,pagination:l,fetchParams:s,isFetch:c}=o().useContext(Ml),{fetch:d}=i.current.props,p=e=>{const r=t.find((t=>t.dataIndex===e));return{title:r.title,precision:r.precision,dictItems:r.dictItems??[]}},h=r.map((e=>({dataIndex:e.group,...p(e.group)}))),m=n.map((e=>e.summary===es.groupSummary.total.value?{dataIndex:e.summary,title:es.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...p(e.summary),formula:e.formula})),g=o().useMemo((()=>Object.assign({},s,{[es.sorterFieldName]:void 0,[es.groupSummary.summaryFieldName]:n.map((e=>`${e.formula}|${e.summary}`)).join(","),[es.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[es.currentPageName]:1})),[s,r,n]),[b,y]=o().useState(((e,r)=>[{title:f("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...r.map((e=>{const r=t.find((t=>t.dataIndex===e.dataIndex))?.groupSummary;let n=r?{summation:r}:null;return e.dataIndex===es.groupSummary.total.value&&(n={dataIndex:es.groupSummary.recordTotalIndex,summation:{render:()=>l.total}}),{...e,..."count"===e.formula||"sum"===e.formula?n:null}}))])(h,m)),[v]=o().useState(c?[]:(e=>{const t=mn(e,r.map((e=>e.group))),i=[];return t.forEach((e=>{const t={};b.forEach((r=>{const{dataIndex:n}=r;"index"!==n&&tn(t,n,en(e[0],n))})),n.forEach((r=>{const n=r.summary!==es.groupSummary.total.value?r.summary:es.groupSummary.recordTotalIndex,i=r.formula;"count"===i&&tn(t,n,e.length),"sum"===i&&tn(t,n,(0,ne.sumBy)(e,n)),"max"===i&&tn(t,n,(0,ne.maxBy)(e,n)[n]),"min"===i&&tn(t,n,(0,ne.minBy)(e,n)[n]),"avg"===i&&tn(t,n,((0,ne.sumBy)(e,n)/e.length).toFixed(2))})),i.push(t)})),i})(i.current.tableFullData)),x={size:a,height:400,...c?{fetch:{api:d.api,params:g,dataKey:d?.dataKey}}:{dataSource:v},columns:b,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${u()().format(Wl)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>y(e)};return o().createElement(zc,x)},Xs=e=>{const{onClose:t}=e,{global:r}=o().useContext(c),{tableRef:n,$size:i,flattenColumns:a}=o().useContext(Ml),{uniqueKey:l}=n.current.props,s=o().useRef(null),d=o().useRef(null),[u,p]=o().useState(!1),[h,m]=o().useState([]),[g,b]=o().useState(""),[y,x]=o().useState("");Ve((()=>{if(y){const{group:e,summary:t}=h.find((e=>e.value===y)).list;I(e),k(t)}else{const e=_();I(e?.group||[]),k(e?.summary||[])}}),[y]),o().useEffect((()=>{D()}),[]);const E=o().useMemo((()=>l?`summary_${l}`:""),[l]),S=o().useMemo((()=>a.filter((e=>![es.expandableColumn,es.selectionColumn,"index","pageIndex",es.operationColumn].includes(e.dataIndex)))),[a]),w=S.filter((e=>!e.groupSummary)).map((e=>({text:un(e.title),value:e.dataIndex}))),C=[es.groupSummary.total,...S.filter((e=>!!e.groupSummary)).map((e=>({text:un(e.title),value:e.dataIndex})))],T=[{text:f("qm.table.groupSummary.sumText"),value:"sum"},{text:f("qm.table.groupSummary.maxText"),value:"max"},{text:f("qm.table.groupSummary.minText"),value:"min"},{text:f("qm.table.groupSummary.avgText"),value:"avg"},{text:f("qm.table.groupSummary.countText"),value:"count"}],[N,I]=o().useState([]),[R,P]=o().useState([{title:f("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>o().createElement("div",null,o().createElement(xe,{type:"text",onClick:()=>{s.current.REMOVE_RECORDS(t)}},f("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:f("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:w.map((e=>({...e,disabled:N.findIndex((t=>t.group===e.value))>-1})))})}]),[O,k]=o().useState([]),[A,F]=o().useState([{title:f("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>o().createElement("div",null,o().createElement(xe,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(t)}},f("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:f("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:C.map((e=>({...e,disabled:O.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:f("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===es.groupSummary.total.value?T.slice(T.length-1):T})}]),H=o().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]),_=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},D=async()=>{if(!E)return;const e=_();if(e){const{group:t,summary:r}=e;I(t),k(r)}let t=await zs().getItem(E);t||(t=await $(E),Array.isArray(t)&&await zs().setItem(E,t)),Array.isArray(t)&&t.length&&(m(t),!e&&x(t[0].value))},$=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},q=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},M=Ie("table"),j={visible:u,title:f("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>p(!1)};return o().createElement("div",{className:`${M}-group-summary__setting`},o().createElement("div",{className:"main"},o().createElement("div",{style:{width:"30%"}},o().createElement(zc,{ref:s,size:i,columns:R,dataSource:N,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>P(e),onDataChange:e=>{I(e)}},o().createElement(xe,{type:"primary",icon:o().createElement(Re.PlusOutlined,null),onClick:()=>{s.current.INSERT_RECORDS({})},style:{marginRight:0}}))),o().createElement("div",{className:"container line"},o().createElement(zc,{ref:d,size:i,columns:A,dataSource:O,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>F(e),onDataChange:e=>{k(e)}},o().createElement(xe,{type:"primary",icon:o().createElement(Re.PlusOutlined,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),o().createElement("div",{className:"saved line"},o().createElement("div",{className:"form-wrap"},o().createElement(L.Input,{size:i,value:g,placeholder:f("qm.table.groupSummary.configText"),disabled:H,onChange:e=>{const{value:t}=e.target;b(t)}}),o().createElement(xe,{type:"primary",disabled:!g||H,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return v("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=cn(),t=[...h,{text:g,value:e,list:{group:N.filter((e=>!!e.group)),summary:O.filter((e=>!!e.summary))}}];m(t),x(e),b(""),await zs().setItem(E,t),await q(E,t)})()},f("qm.table.groupSummary.saveButton"))),o().createElement("div",{className:"card-wrap"},o().createElement("h5",{style:{height:`${es.rowHeightMaps[i]}px`}},o().createElement("span",null,f("qm.table.groupSummary.savedSetting"))),o().createElement("ul",null,h.map((e=>o().createElement("li",{key:e.value,className:Ne()({selected:e.value===y}),title:e.text,onClick:()=>(e=>{x(e!==y?e:"")})(e.value)},o().createElement("span",{className:"title"},e.text),o().createElement("i",{className:"svgicon close",title:f("qm.table.groupSummary.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=h.filter((t=>t.value!==e));m(t),e===y&&x(""),await zs().setItem(E,t),await q(E,t)})(e.value)}},o().createElement(Re.CloseCircleOutlined,null))))),!h.length&&o().createElement("div",{style:{padding:Kl}},o().createElement(bt,null)))))),o().createElement(wr,j,o().createElement(Ys,{columns:S,group:N,summary:O})),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(xe,{onClick:()=>t(),style:{marginRight:8}},f("qm.table.groupSummary.closeButton")),o().createElement(xe,{type:"primary",disabled:H,onClick:()=>(E&&sessionStorage.setItem(E,JSON.stringify({group:N.filter((e=>!!e.group)),summary:O.filter((e=>!!e.summary))})),void p(!0))},f("qm.table.groupSummary.confirmButton"))))},Qs=o().forwardRef(((e,t)=>{const{open:r=!0}=e,[n,i]=o().useState(!1),a=()=>{i(!0)};o().useImperativeHandle(t,(()=>({clickHandle:a})));const l=Ie("table"),s={visible:n,title:f("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:`${l}-group-summary`,title:f("qm.table.groupSummary.text"),onClick:()=>a()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.PieChartOutlined,null))),o().createElement(wr,s,o().createElement(Xs,{onClose:()=>i(!1)})))}));Qs.displayName="GroupSummary";const Zs=Qs,Js=e=>{const{onClose:t}=e,{global:r}=o().useContext(c),{tableRef:n,$size:i,flattenColumns:a,setSuperFilters:l,clearTableFilter:s}=o().useContext(Ml),{uniqueKey:d}=n.current.props,u=o().useRef(null),[p,h]=o().useState([]),[m,g]=o().useState([]),[b,y]=o().useState(""),[x,E]=o().useState("");Ve((()=>{h(x?m.find((e=>e.value===x)).list:_()||[])}),[x]),o().useEffect((()=>{D()}),[]);const S=o().useMemo((()=>d?`superSearch_${d}`:""),[d]),w=o().useMemo((()=>a.filter((e=>!!e.filter))),[a]),C=hn(p),T=o().useMemo((()=>!(C&&$r(C))),[C]),N=o().useMemo((()=>!!p.length&&T),[p,T]),I=[{value:"and",text:f("qm.table.highSearch.andText")},{value:"or",text:f("qm.table.highSearch.orText")}],R=a.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:un(e.title)}))),P=e=>["in","nin"].includes(e),O=(e,t)=>{let r;switch(e){case"number":r="number";break;case"date":r="date";break;case"checkbox":case"radio":r=t?"select-multiple":"select";break;default:r="text"}return r},k=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:f("qm.table.highSearch.gtText")},{value:"<",text:f("qm.table.highSearch.ltText")},{value:">=",text:f("qm.table.highSearch.gteText")},{value:"<=",text:f("qm.table.highSearch.lteText")},{value:"==",text:f("qm.table.highSearch.eqText")},{value:"!=",text:f("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":t=[{value:"in",text:f("qm.table.highSearch.inText")},{value:"nin",text:f("qm.table.highSearch.ninText")},{value:"==",text:f("qm.table.highSearch.eqText")},{value:"!=",text:f("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:f("qm.table.highSearch.likeText")},{value:"==",text:f("qm.table.highSearch.eqText")},{value:"!=",text:f("qm.table.highSearch.neqText")}]}return t},[A,F]=o().useState([{title:f("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>o().createElement("div",null,o().createElement(xe,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(t)}},f("qm.table.highSearch.removeText")))},{title:f("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,t)=>o().createElement("span",{style:{fontSize:"20px"}},e)},{title:f("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,editRender:e=>({type:"select",editable:!0,items:R,rules:[{required:!0,message:f("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{const r=Object.values(t)[0],n=w.find((e=>e.dataIndex===r))?.filter.type,i=k(n);e.fieldType=n,e.expression=r?i[0]?.value:"",e.condition=P(e.expression)?[]:"",r||(e.bracketLeft=e.bracketRight="")}})},{title:f("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:f("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{const t=w.find((t=>t.dataIndex===e.fieldName))?.filter.type;return{type:"select",editable:!0,items:k(t),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=P(e.expression)?[]:""}}}},{title:f("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{const t=w.find((t=>t.dataIndex===e.fieldName)),r=t?.filter.type,n=t?.filter?.items??t?.dictItems??[];return{type:O(r,P(e.expression)),editable:!0,items:n,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:f("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,t)=>o().createElement("span",{style:{fontSize:"20px"}},e)},{title:f("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,editRender:e=>({type:"select",editable:!0,items:I,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),H=()=>{S&&sessionStorage.setItem(S,JSON.stringify(p.filter((e=>!!e.fieldName))))},_=()=>{if(!S)return;const e=sessionStorage.getItem(S);return e?JSON.parse(e):null},D=async()=>{if(!S)return;const e=_();e&&h(e);let t=await zs().getItem(S);t||(t=await $(S),Array.isArray(t)&&await zs().setItem(S,t)),Array.isArray(t)&&t.length&&(g(t),!e&&E(t[0].value))},$=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},q=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},M=Ie("table");return o().createElement("div",{className:`${M}-super-search__setting`},o().createElement("div",{className:"main"},o().createElement("div",{className:"container"},o().createElement(zc,{ref:u,size:i,columns:A,dataSource:p,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>F(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(r)&&("bracketLeft"===r&&(e[r]=e[r]?"":"("),"bracketRight"===r&&(e[r]=e[r]?"":")"),h([...p]))},onDataChange:e=>{h(e)}},o().createElement(xe,{type:"primary",icon:o().createElement(Re.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),es.highSearch.showSQL&&C&&o().createElement("code",{className:"lang-js"},C)),o().createElement("div",{className:"saved line"},o().createElement("div",{className:"form-wrap"},o().createElement(L.Input,{size:i,value:b,placeholder:f("qm.table.highSearch.configText"),disabled:T,onChange:e=>{const{value:t}=e.target;y(t)}}),o().createElement(xe,{type:"primary",disabled:!b||T,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!S)return v("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=cn(),t=[...m,{text:b,value:e,list:p.filter((e=>!!e.fieldName))}];g(t),E(e),y(""),await zs().setItem(S,t),await q(S,t)})()},f("qm.table.highSearch.saveButton"))),o().createElement("div",{className:"card-wrap"},o().createElement("h5",{style:{height:`${es.rowHeightMaps[i]}px`}},o().createElement("span",null,f("qm.table.highSearch.savedSetting"))),o().createElement("ul",null,m.map((e=>o().createElement("li",{key:e.value,className:Ne()({selected:e.value===x}),title:e.text,onClick:()=>(e=>{E(e!==x?e:"")})(e.value)},o().createElement("span",{className:"title"},e.text),o().createElement("i",{className:"svgicon close",title:f("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=m.filter((t=>t.value!==e));g(t),e===x&&E(""),await zs().setItem(S,t),await q(S,t)})(e.value)}},o().createElement(Re.CloseCircleOutlined,null))))),!m.length&&o().createElement("div",{style:{padding:Kl}},o().createElement(bt,null)))))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(xe,{onClick:()=>t(),style:{marginRight:8}},f("qm.table.highSearch.closeButton")),o().createElement(xe,{type:"primary",disabled:N,onClick:()=>(s(),l(p.map((e=>re()(e,["index","pageIndex"])))),H(),void t())},f("qm.table.highSearch.searchButton"))))},ec=o().forwardRef(((e,t)=>{const{open:r=!0}=e,[n,i]=o().useState(!1),a=()=>{i(!0)};o().useImperativeHandle(t,(()=>({clickHandle:a})));const l=Ie("table"),s={visible:n,title:f("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return o().createElement(o().Fragment,null,r&&o().createElement("span",{className:`${l}-super-search`,title:f("qm.table.highSearch.text"),onClick:()=>a()},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.FunnelPlotOutlined,null))),o().createElement(wr,s,o().createElement(Js,{onClose:()=>i(!1)})))}));ec.displayName="SuperSearch";const tc=ec,rc=o().forwardRef(((e,t)=>{const{tableColumns:r,showFullScreen:n,showReload:i,showPrint:a,showImport:l,showExport:s,showClipboard:d,showCollection:u,showFastSearch:p,showSuperSearch:h,showGroupSummary:m,showToolBox:g}=e,{global:b}=o().useContext(c),{tableRef:y,isFullScreen:x,$size:E}=o().useContext(Ml),{uniqueKey:S,exportExcel:w}=y.current.props,C=o().useRef(null),T=o().useRef(null),N=o().useRef(null),I=o().useRef(null),R=o().useRef(null),P=o().useRef(null),O=o().useRef(null),k=o().useRef(null),A=o().useRef(null),F=o().useRef(null),H=o().useRef(!1),_=o().useMemo((()=>S?`toolBox_${S}`:""),[S]),[D,$]=o().useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,groupSummary:!1}),q={fullScreen:n,reload:i,print:a,import:l,export:s&&!w?.hideIcon,clipboard:d,collection:u,fastSearch:p,superSearch:h,groupSummary:m},[M,j]=o().useState(!1);Ve((()=>{H.current&&(V(),H.current=!1)}),[D]),o().useEffect((()=>{K()}),[]),o().useImperativeHandle(t,(()=>({exportHandle:()=>{if(!R.current)return v("Table","执行导出需要配置 `exportExcel` 参数");R.current.clickHandle()}})));const K=()=>{if(!_||!g)return;const e=JSON.parse(localStorage.getItem(_));e||z(_).then((e=>{e&&($(Object.assign({},D,e)),localStorage.setItem(_,JSON.stringify(e)))})).catch((()=>{})),e&&$(Object.assign({},D,e))},V=()=>{if(!_||!g)return;const e={};for(const t in D)D[t]&&(e[t]=D[t]);localStorage.setItem(_,JSON.stringify(e)),B(_,e)},z=async e=>{const t=b?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},B=async(e,t)=>{const r=b?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},U=async e=>{j(!1),await ce(100),e.current.clickHandle()},W=(e,t)=>{H.current=!0,$(Object.assign({},D,{[t]:e}))},G=Ie("table"),Y={"top-toolbox__popper":!0,[`${G}--lg`]:"large"===E,[`${G}--sm`]:"small"===E};return o().createElement(o().Fragment,null,n&&o().createElement(ps,{ref:C,isFullScreen:x,open:!g||D.fullScreen}),i&&o().createElement(ms,{ref:T,open:!g||D.reload}),a&&o().createElement(bs,{ref:N,tableColumns:r,open:!g||D.print}),l&&o().createElement(As,{ref:I,tableColumns:r,open:!g||D.import}),s&&o().createElement(_s,{ref:R,tableColumns:r,open:(!g||D.export)&&!w?.hideIcon}),d&&o().createElement(qs,{ref:P,open:!g||D.clipboard}),u&&o().createElement(Ks,{ref:O,columns:r,open:!g||D.collection}),p&&o().createElement(Gs,{ref:k,open:!g||D.fastSearch}),m&&o().createElement(Zs,{ref:A,open:!g||D.groupSummary}),h&&o().createElement(tc,{ref:F,open:!g||D.superSearch}),g&&o().createElement(L.Dropdown,{open:M,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.fullScreen,style:{marginRight:6},onChange:e=>W(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.screen.full"))),onClick:()=>U(C)},{key:"reload",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.reload,style:{marginRight:6},onChange:e=>W(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.refresh.text"))),onClick:()=>U(T)},{key:"print",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.print,style:{marginRight:6},onChange:e=>W(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.print.text"))),onClick:()=>U(N)},{key:"import",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.import,style:{marginRight:6},onChange:e=>W(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.import.textNoSpace"))),onClick:()=>U(I)},{key:"export",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.export,style:{marginRight:6},onChange:e=>W(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.export.textNoSpace"))),onClick:()=>U(R)},{key:"clipboard",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.clipboard,style:{marginRight:6},onChange:e=>W(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.clipboard.textNoSpace"))),onClick:()=>U(P)},{key:"collection",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.collection,style:{marginRight:6},onChange:e=>W(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.selectCollection.text"))),onClick:()=>U(O)},{key:"fastSearch",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.fastSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.fastSearch.text"))),onClick:()=>U(k)},{key:"groupSummary",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.groupSummary,style:{marginRight:6},onChange:e=>W(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.groupSummary.text"))),onClick:()=>U(A)},{key:"superSearch",label:o().createElement(o().Fragment,null,o().createElement(L.Checkbox,{checked:D.superSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),o().createElement("span",null,f("qm.table.highSearch.text"))),onClick:()=>U(F)}];return o().createElement(L.Menu,{items:e.filter((e=>q[e.key]))})})(),overlayClassName:Ne()(Y),overlayStyle:{minWidth:120},onOpenChange:e=>{j(e)}},o().createElement("span",{className:`${G}-toolbox`,title:f("qm.table.toolbox.text")},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.AppstoreAddOutlined,null)))))}));rc.displayName="ToolBox";const nc=rc,ic=(e,t)=>e.map((e=>(e.children&&(e.children=ic(e.children,t)),t(e)))),ac=o().forwardRef(((e,t)=>{const{columns:r}=e,{global:n}=o().useContext(c),{tableRef:i,$size:a}=o().useContext(Ml),{showColumnDefine:l,uniqueKey:s,onlyShowIcon:d,columnsChange:u}=i.current.props,p=o().useRef([]),[h,m]=o().useState(!1),g=o().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)))(r)),[r]),b=o().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(r)),[r]),y=o().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(r)),[r]),v=o().useMemo((()=>s?`table_${s}`:""),[s]);Ve((()=>{E(r)}),[r]),o().useLayoutEffect((()=>{S()}),[]),o().useImperativeHandle(t,(()=>({initialHandler:S})));const x=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=x(e.children)),void 0!==e.hidden&&(t.hidden=e.hidden),void 0!==e.fixed&&(t.fixed=e.fixed),void 0!==e.width&&(t.width=e.width),void 0!==e.renderWidth&&(t.renderWidth=e.renderWidth),{dataIndex:e.dataIndex,...t}})),E=e=>{if(!v)return;const t=x(e),r=JSON.parse(localStorage.getItem(v));i.current.columnsDefined&&!(0,ne.isEqual)(t,r)&&(localStorage.setItem(v,JSON.stringify(t)),(async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(v,t))},S=()=>{const e=(()=>{if(!v)return;const e=JSON.parse(localStorage.getItem(v));return e||(async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}})(v).then((e=>{e?(localStorage.setItem(v,JSON.stringify(e)),S()):n?.getComponentConfigApi&&E(r)})).catch((()=>{})),e?(0,ne.xor)(Kr(e).map((e=>e.dataIndex)),Kr(r).map((e=>e.dataIndex))).length>0?ic(r,(t=>{const r=zr(e,t.dataIndex);return r&&(void 0!==r.hidden&&(t.hidden=r.hidden),void 0!==r.fixed&&(t.fixed=r.fixed),void 0!==r.width&&(t.width=r.width),void 0!==r.renderWidth&&(t.renderWidth=r.renderWidth)),t})):ic(e,(e=>{const t=zr(r,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)})):void 0})();var t;e&&(t=w(e),p.current=t,u?.(e))},w=e=>{const t=[];return e.filter((e=>!e.noAuth)).forEach(((r,n)=>{const i=r.colSpan;i>1&&e.slice(n+1,n+i).every((e=>{let{colSpan:t}=e;return 0===t}))&&t.push(e.slice(n,n+i))})),t},C=e=>{const t=[];e.forEach((r=>{const{colSpan:n,dataIndex:i}=r;if(0===n)return;if(1===n)return t.push(r);const a=p.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(i)));if(-1===a)return t.push(r);t.push(...p.current[a].map(((t,n)=>{let{dataIndex:i}=t;const a=e.find((e=>e.dataIndex===i));return n>0&&(void 0!==r.hidden&&(a.hidden=r.hidden),void 0!==r.fixed?a.fixed=r.fixed:a.fixed&&delete a.fixed),a})))})),r.forEach(((e,r)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(r,0,e)})),u?.(t)},T=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,C(r))},N=(e,t)=>{const{colSpan:n,noFixed:i}=e;if(0===n)return o().createElement("li",{key:e.dataIndex,style:{display:"none"}});const a=un(e.title),l=["svgicon","handle",`${t}-handle`],s=o().createElement("li",{key:e.dataIndex,className:"item"},o().createElement(L.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,C(r)}}),o().createElement("i",{className:Ne()(l),title:f("qm.table.columnFilter.draggable")},o().createElement(Re.HolderOutlined,null)),o().createElement("span",{className:"text",title:a},a),"main"===t?o().createElement("span",{className:Ne()("fixed",i?"disabled":"")},o().createElement("i",{className:"svgicon",title:f("qm.table.columnFilter.fixedLeft"),onClick:()=>T(e,"left")},o().createElement(Re.StepBackwardOutlined,null)),o().createElement("i",{className:"svgicon",title:f("qm.table.columnFilter.fixedRight"),onClick:()=>T(e,"right")},o().createElement(Re.StepForwardOutlined,null))):"sub"!==t?o().createElement("span",{className:Ne()("fixed",i?"disabled":"")},o().createElement("i",{className:"svgicon",title:f("qm.table.columnFilter.cancelFixed"),onClick:()=>T(e)},o().createElement(Re.CloseCircleOutlined,null))):null);return!e.hidden&&e.children?.length?o().createElement(L.Popover,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:I(e.children,e.dataIndex)},s):s},I=(e,t)=>o().createElement("div",{className:"column-filter--wrap"},o().createElement(fi.ReactSortable,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:n=>{const i=n.map((e=>e.dataIndex)),a=e.map((e=>e.dataIndex));(0,ne.isEqual)(i,a)||((e,t)=>{zr(r,t).children=e,u?.([...r])})(vn(n),t)}},e.map((e=>N(e,"sub"))))),R=Ie("table"),P={[`${R}__popper`]:!0,"column-filter__popper":!0,[`${R}--lg`]:"large"===a,[`${R}--sm`]:"small"===a},O=[`${R}-column-filter`,{selected:h}];return l?o().createElement(Yi(),{action:["click"],popupVisible:h,popup:o().createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},o().createElement("div",{className:"reset"},o().createElement(xe,{type:"text",size:"small",onClick:()=>{const e=t=>t.map((t=>{const n=zr(r,t.dataIndex)||fe(t);return t.children&&(n.children=e(t.children)),Object.assign(n,{hidden:t.hidden,fixed:t.fixed,width:t.width})}));u?.(e(i.current.originColumns))}},f("qm.table.columnFilter.reset"))),o().createElement("div",{className:"left"},o().createElement(fi.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:g,setList:e=>{const t=e.map((e=>e.dataIndex)),r=g.map((e=>e.dataIndex));(0,ne.isEqual)(t,r)||C([...vn(e),...y,...b])}},g.map((e=>N(e,"left"))))),o().createElement("div",{className:"divider"}),o().createElement("div",{className:"main"},o().createElement(fi.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),r=y.map((e=>e.dataIndex));(0,ne.isEqual)(t,r)||C([...g,...vn(e),...b])}},y.map((e=>N(e,"main"))))),o().createElement("div",{className:"divider"}),o().createElement("div",{className:"right"},o().createElement(fi.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:b,setList:e=>{const t=e.map((e=>e.dataIndex)),r=b.map((e=>e.dataIndex));(0,ne.isEqual)(t,r)||C([...g,...y,...vn(e)])}},b.map((e=>N(e,"right")))))),popupClassName:Ne()(P),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{m(e)},builtinPlacements:Gl,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},o().createElement("span",{className:Ne()(O),title:d?f("qm.table.columnFilter.text"):void 0},o().createElement("i",{className:"svgicon icon"},o().createElement(Re.SettingOutlined,null)),!d&&o().createElement("span",null,f("qm.table.columnFilter.text")))):null}));ac.displayName="ColumnFilter";const oc=ac,lc=()=>o().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().createElement("path",{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}));function sc(){return sc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sc.apply(this,arguments)}const cc=e=>{const{column:t,filters:r}=e,{$size:n,setFilters:i,clearSuperFilters:a}=o().useContext(Ml),l=o().useRef(null),s=o().useRef(null),c=o().useRef(null),[d,u]=o().useState(!1),[p,h]=o().useState(!1),[m,g]=o().useState({}),b=o().useMemo((()=>{const{dataIndex:e,filter:r}=t;return`${e}|${r.type}`}),[t]),y=o().useMemo((()=>{let e=!1;for(const t in r[b])if(!pe(r[b][t])||p){e=!0;break}return e}),[b,r,p]);o().useLayoutEffect((()=>{d&&setTimeout((()=>x()),20)}),[d]),o().useEffect((()=>{(0,ne.isEqual)(m[b],r[b])||g({[b]:r[b]||{}}),h(""===r[b]?.["=="])}),[r]);const x=()=>{switch(t.filter.type){case"text":l.current.focus();break;case"number":s.current.focus();break;case"textarea":c.current.focus()}},E=e=>{e&&g(e),a(),i((e=>{for(const t in e){for(const r in e[t])if(pe(e[t][r])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][r])continue;delete e[t][r]}Object.keys(e[t]).length||delete e[t]}return e})({...r,...m,...e})),u(!1)},S={text:e=>o().createElement(o().Fragment,null,o().createElement(L.Input,{ref:l,size:n,placeholder:f("qm.table.filter.searchText",{text:un(e.title)}),style:{width:"180px"},value:m[b]?.like??"",disabled:p,onChange:e=>{const{value:t}=e.target;g((e=>Object.assign({},e,{[b]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&E()}}),o().createElement("div",{style:{marginTop:8}},o().createElement(L.Checkbox,{checked:p,onChange:e=>{const{checked:t}=e.target,r=t?"":null;g((e=>Object.assign({},e,{[b]:{"==":r,like:null}}))),h(t)}},f("qm.table.filter.nullValue")))),textarea:e=>o().createElement(o().Fragment,null,o().createElement(L.Input.TextArea,{ref:c,size:n,placeholder:f("qm.table.filter.searchAreaText",{text:un(e.title)}),style:{width:"220px"},value:m[b]?.likes??"",disabled:p,onChange:e=>{const{value:t}=e.target;g((e=>Object.assign({},e,{[b]:{likes:t||null}})))},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||(e.preventDefault(),E())}}),o().createElement("div",{style:{marginTop:8}},o().createElement(L.Checkbox,{checked:p,onChange:e=>{const{checked:t}=e.target,r=t?"":null;g((e=>Object.assign({},e,{[b]:{"==":r,like:null}}))),h(t)}},f("qm.table.filter.nullValue")))),number:e=>{const t=e=>({value:m[b]?.[e]??"",size:n,onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||g((r=>Object.assign({},r,{[b]:Object.assign({},r[b],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return o().createElement("ul",null,o().createElement("li",null,o().createElement("span",null,"> "),o().createElement(L.InputNumber,sc({ref:s},t(">"),{placeholder:f("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"< "),o().createElement(L.InputNumber,sc({},t("<"),{placeholder:f("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"= "),o().createElement(L.InputNumber,sc({},t("=="),{placeholder:f("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"!="),o().createElement(L.InputNumber,sc({},t("!="),{placeholder:f("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const t=e=>({value:ln(m[b]?.[e],Bl),format:Bl,size:n,onChange:t=>{g((r=>Object.assign({},r,{[b]:Object.assign({},r[b],{[e]:sn(t,Bl)})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return o().createElement("ul",null,o().createElement("li",null,o().createElement("span",null,"> "),o().createElement(j,sc({},t(">"),{placeholder:f("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"< "),o().createElement(j,sc({},t("<"),{placeholder:f("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"= "),o().createElement(j,sc({},t("=="),{placeholder:f("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),o().createElement("li",null,o().createElement("span",null,"!="),o().createElement(j,sc({},t("!="),{placeholder:f("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return o().createElement("ul",null,o().createElement(L.Radio.Group,{style:{width:"100%"},value:m[b]?.["=="],onChange:e=>{const{value:t}=e.target;g((e=>Object.assign({},e,{[b]:{"==":t}})))}},n.map((e=>o().createElement("li",{key:e.value},o().createElement(L.Radio,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return o().createElement("ul",null,o().createElement(L.Checkbox.Group,{style:{width:"100%"},value:m[b]?.in,onChange:e=>{g((t=>Object.assign({},t,{[b]:{in:e}})))}},n.map((e=>o().createElement("li",{key:e.value},o().createElement(L.Checkbox,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return o().createElement("div",{style:{height:200,...t.style}},o().createElement(ql,{multiple:!0,value:m[b]?.in||[],dataSource:n,onCheckChange:e=>{const t=e.map((e=>e.value));g((e=>Object.assign({},e,{[b]:{in:t}})))}}))}},w=Ie("table"),C={"head-filter__popper":!0,[`${w}--lg`]:"large"===n,[`${w}--sm`]:"small"===n},T=["cell--filter",{selected:d,actived:y}];return o().createElement(Yi(),{action:["click"],popupVisible:d,popup:(()=>{const e=t.filter.type,r=S[e];return r?o().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},o().createElement("div",null,r(t)),o().createElement(L.Space,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},o().createElement(xe,{size:n,onClick:()=>{E({[b]:{}})}},f("qm.table.filter.reset")),o().createElement(xe,{type:"primary",size:n,onClick:()=>E()},f("qm.table.filter.search")))):(v("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:Ne()(C),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{u(e)},builtinPlacements:Gl,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},o().createElement("div",{className:Ne()(T),title:f("qm.table.filter.text"),onClick:e=>e.stopPropagation()},o().createElement("span",{className:"svgicon icon"},o().createElement(lc,null))))},dc=e=>{const{column:t}=e,{tableRef:r,bordered:n}=o().useContext(Ml),{columns:i,resizable:a,columnsChange:l=le}=r.current.props,s=o().useMemo((()=>Ur(t)),[t]),c={resizable:!0,"is--line":a&&!n};return o().createElement("div",{className:Ne()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n}=r.current,a=n.$resizableBar,o=t.offsetWidth/2,c=e.clientX,d=Qr(t,n.$table).left-n.$tableBody.parentNode.parentNode.scrollLeft+o;n.$table.classList.add("c--resize"),a.style.left=`${d}px`,a.style.display="block";const u=s.width||s.renderWidth;let p=u;return document.onmousemove=function(e){if("number"!=typeof u)return;const t=e.clientX-c,r=u+t;r<(s.minWidth||es.defaultColumnWidth)||(p=Math.floor(r),a.style.left=`${t+d}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),a.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(zr(i,s.dataIndex).width=p,l([...i]))},!1}})},uc=e=>{const{selectionKeys:t}=e,{tableRef:r,getRowKey:n,pagination:i,fetchParams:a,setSelectionKeysEffect:l,setInvalidRowKeys:s,setSpinning:c,isFetch:d,isWebPagination:u}=o().useContext(Ml),{rowSelection:p}=r.current.props,{fetchAllRowKeys:h,selectAllOnCurrentPage:m,filterable:g,onSelectAll:b}=p,y=o().useRef([]),v=o().useMemo((()=>d&&!!h),[d,h]),x=o().useMemo((()=>!v&&!!m),[v,m]),E=o().useMemo((()=>(g??!0)&&!x),[g,x]),S=()=>{const{tableFullData:e}=r.current,{current:t,pageSize:n}=i;return u?e.slice((t-1)*n,t*n):e},w=(()=>{const{allTableData:e,allRowKeys:t,selectionRows:i}=r.current,{disabled:a}=p;if(v)return y.current.length?y.current:(0,ne.union)(t,i.map((e=>n(e,e.index))));if(!x)return a?t.filter(((t,r)=>!a(e[r]))):t;const o=a?S().filter((e=>!a(e))).map((e=>n(e,e.index))):S().map((e=>n(e,e.index)));return(0,ne.union)(o,i.map((e=>n(e,e.index))))})(),C=t.filter((e=>!w.includes(e))),T=t.length-C.length,N=T>0&&T<w.length,I=!!T&&T===w.length;s(C);const R=async()=>{const e=h;let t=[];c(!0);try{const r=await e.api(a);if(200===r.code){t=Array.isArray(r.data)?r.data:(0,ne.get)(r.data,e.dataKey)??[];const{disabled:i}=p;i&&(t=(0,ne.xor)(t,S().filter((e=>i(e))).map((e=>n(e,e.index))))),y.current=t}}catch(e){}return c(!1),t},P=async e=>{let t=[];t=v?e?await R():[]:e?w.slice(0):[],t=[...new Set([...t,...C])],l(t),b?.(e,t)};return o().createElement("div",{className:"cell--selection"},o().createElement(L.Checkbox,{checked:I,indeterminate:N,disabled:!w.length,onChange:e=>P(e.target.checked)}),E&&o().createElement(L.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:f("qm.table.selection.all"),onClick:()=>{P(!0)}},{key:2,label:f("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=v?(0,ne.xor)(t,await R()):(0,ne.xor)(t,w),e=[...new Set([...e,...C])],l(e)})()},{key:3,label:f("qm.table.selection.clear"),onClick:()=>{P(!1)}}];return o().createElement(L.Menu,{items:e})})()},o().createElement(Re.DownOutlined,{className:"svgicon icon"})),x&&o().createElement(L.Tooltip,{placement:"top",title:f("qm.table.selection.currentPage")},o().createElement(Re.InfoCircleOutlined,{className:"info"})))},pc=e=>{const{style:t}=e,{tableRef:r,isTreeTable:n,setRowExpandedKeys:i}=o().useContext(Ml),{expandable:a}=r.current.props,[l,s]=o().useState(a?.defaultExpandAllRows||!1);Ve((()=>{const{allRowKeys:e,flattenRowKeys:t}=r.current;i(l?e.filter((e=>!(n&&t.includes(e)))):[])}),[l]);const c=Ie("expand"),d={[`${c}--icon`]:!0,expanded:l,collapsed:!l};return o().createElement("span",{className:Ne()(d),title:"",onClick:e=>{e.stopPropagation(),s(!l)},style:t})},hc=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),mc=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),fc=e=>{const{tableColumns:t,sorter:r,filters:n}=e,{tableRef:i,layout:a,scrollY:l,flattenColumns:s,superFilters:c,selectionKeys:d,rightFixedColumns:u,treeExpandIndex:p,isFetch:h,isTreeTable:m,isGroupSubtotal:g,tableChange:b,setSorter:y,setElementStore:v,resetTableScroll:x,getStickyLeft:E,getStickyRight:S,createGroupData:w,createTableFullData:C}=o().useContext(Ml),{ellipsis:T,resizable:N,multipleSort:I,rowSelection:R,expandable:P}=i.current.props,[O,k]=es.sortDirections,{tableOriginData:A}=i.current,F=o().useRef(null),H=o().useMemo((()=>A.some((e=>Array.isArray(e.children)))),[A]),_=o().useMemo((()=>!h),[h]),D=o().useMemo((()=>!h),[h]),$=o().useMemo((()=>!P?.hideExpandAll),[P]),q=o().useMemo((()=>!(!R||(h?!R.selectAllOnCurrentPage&&!R.fetchAllRowKeys:R.hideSelectAll))),[h,R]);Ve((()=>{B(),b(),x()}),[r]),Ve((()=>{G(),b(),x()}),[n]),Ve((()=>{G(),b(),x()}),[c]),o().useEffect((()=>{M(),!pe(r)&&de((()=>B())),!pe(n)&&de((()=>G()))}),[]);const M=()=>{v("$header",F.current)},j=e=>{const{dataIndex:t,type:n,sorter:i,title:a,description:l}=e;if(t===es.selectionColumn&&"checkbox"===n){if("checkbox"===n)return o().createElement("div",{className:"cell"},q?o().createElement(uc,{selectionKeys:d}):f("qm.table.config.selectionText"));if("radio"===n)return o().createElement("div",{className:"cell"},a)}const s=[];return s.push(o().createElement("div",{key:0,className:"cell",title:un(a)},m&&t===p&&$?o().createElement(pc,null):null,t===es.expandableColumn&&$?o().createElement(pc,null):a)),l&&s.push(o().createElement(L.Tooltip,{key:1,placement:"top",title:l},o().createElement(Re.InfoCircleOutlined,{className:"tip"}))),i&&s.push(K(r[t])),s},K=e=>{const t=["svgicon cell--sorter__asc",{actived:e===O}],r=["svgicon cell--sorter__desc",{actived:e===k}];return o().createElement("div",{key:2,className:"cell--sorter",title:f("qm.table.sorter.text")},o().createElement("span",{className:Ne()(t)},o().createElement(hc,null)),o().createElement("span",{className:Ne()(r)},o().createElement(mc,null)))},V=e=>o().createElement(cc,{column:e,filters:n}),z=(e,t)=>{const{sorter:n,dataIndex:i}=t;if(n){const e=r[i],t=e?e===k?null:k:O;I?(delete r[i],y(Object.assign({},r,{[i]:t}))):y(Object.assign({},{[i]:t}))}},B=()=>{_&&U()},U=e=>{const t=(0,ne.pickBy)(r,(e=>null!==e));for(const e in t){const r=s.find((t=>t.dataIndex===e));r?W(r,t[e]):delete t[e]}e||Object.keys(t).length||W({dataIndex:"index"},O)},W=(e,t)=>{const{tableFullData:r}=i.current,{dataIndex:n,sorter:a}=e,o=(e,r)=>{const i=en(e,n),a=en(r,n);return Number.isNaN(i-a)?t===O?i.toString().localeCompare(a.toString()):a.toString().localeCompare(i.toString()):t===O?i-a:a-i},l=g?w(pn(r).sort("function"==typeof a?a:o)):r.sort("function"==typeof a?a:o).slice(0);C(l)},G=()=>{D&&Y()},Y=()=>{const e=c.length?hn(c):hn(n),t=""!==e?g?w(qr(pn(A),e,H)):qr(A,e,H):A;C(t),U(!0)},X=Xr(t),Q=Ie("table"),{tableBodyWidth:Z}=a;return o().createElement("div",{ref:F,className:`${Q}--header-wrapper`},o().createElement("table",{className:`${Q}--header`,cellSpacing:"0",cellPadding:"0",style:{width:Z?`${Z}px`:""}},(()=>{const{gutterWidth:e}=a;return o().createElement("colgroup",null,s.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return o().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})})),l&&o().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),o().createElement("thead",null,(e=>{const{isIE:t}=i.current,n=["gutter",{"cell-fix-right":!!u.length}],s=t?null:{right:u.length?0:""};return e.map(((e,t)=>o().createElement("tr",{key:t,className:"header--row"},e.map(((t,n)=>((e,t,n)=>{const{isIE:s}=i.current,{gutterWidth:c}=a,{dataIndex:d,colSpan:u,rowSpan:p,fixed:h,align:m,theadAlign:f,theadClassName:g="",sorter:b,filter:y,required:v,headRender:x}=e;if(0===u)return null;const w=f||m,C=["header--column",{"col--ellipsis":e.ellipsis??T,"col--center":"center"===w,"col--right":"right"===w,"column--required":!!v,"column-has-sorter":b,"column-has-filter":y,"column--sort":!!r[d],"cell-fix-left":!s&&"left"===h,"cell-fix-right":!s&&"right"===h,"cell-fix-left-last":!s&&"left"===h&&!n[t+(u??1)]?.fixed,"cell-fix-right-first":!s&&"right"===h&&!n[t-1]?.fixed,[g]:!!g}],I=s?null:{left:"left"===h?`${E(d)}px`:"",right:"right"===h?`${S(d,"thead")+(l?c:0)}px`:""},R=N&&![es.expandableColumn,es.selectionColumn].includes(d);return o().createElement("th",{key:d,className:Ne()(C),colSpan:u,rowSpan:p,style:{...I},onClick:t=>z(t,e)},o().createElement("div",{className:"cell--wrapper"},x?o().createElement("div",{className:"cell--text cell"},x(e,i.current.tableFullData)):o().createElement(o().Fragment,null,o().createElement("div",{className:"cell--text"},j(e)),y?V(e):null)),R&&o().createElement(dc,{column:e}))})(t,n,e))),l&&o().createElement("th",{className:Ne()(n),style:{...s}}))))})(X))))},gc=o().createContext([]);function bc(){const[,e]=a.useReducer((e=>e+1),0);return e}function yc(){const{locale:e}=a.useContext(c);return{t:f,$locale:e}}const vc=e=>{const{selectionKeys:t,column:r,record:n,rowKey:i}=e,{tableRef:a,isTreeTable:l,getAllChildRowKeys:s}=o().useContext(Ml),{rowSelection:c}=a.current.props,d=o().useMemo((()=>r.type||""),[r.type]),u=e=>{const r=c.checkStrictly??!0;if(!l||r)return!1;const n=Gr(a.current.deriveRowKeys,e);return((e,t)=>{const r=new Set(t);let n=!1,i=!1;for(const t of e)if(r.has(t)?n=!0:i=!0,n&&i)break;return n&&i})(s(n?.children??[]),t)};return"radio"===d?(()=>{const e=c.disabled,r=e?.(n),a=!r&&t[0]===i;return o().createElement(L.Radio,{checked:a,disabled:r})})():(()=>{const e=c.disabled,r=e?.(n),a=!!t.includes(i);return o().createElement(L.Checkbox,{checked:a,indeterminate:u(i),disabled:r})})()},xc=e=>{const{record:t,rowKey:r,style:n}=e,{tableRef:i,rowExpandedKeys:a,setRowExpandedKeys:l}=o().useContext(Ml),{expandable:s={}}=i.current.props,[c]=o().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(t)),d=o().useMemo((()=>a.includes(r)),[a,r]);Ve((()=>{s.onExpand?.(d,t)}),[d]);const u=Ie("expand"),p={[`${u}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return o().createElement("span",{className:Ne()(p),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?a.filter((e=>e!==r)):[...a,r];l(t)},style:n})},Ec=o().forwardRef(((e,t)=>{const{size:r,defaultValue:n,value:i,min:a,max:l,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:p,stringMode:h,allowClear:m,readOnly:f,disabled:g,formatter:b=(e=>e.toString()),parser:y=(e=>e),onFocus:v}=e,x=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>l&&(t=l.toString()),t&&Number(t)<a&&(t=a.toString()),p>=0&&""!==t&&(t=new(Ri())(t).toFixed(p)),t},E=void 0!==i,[S,w]=o().useState(n??""),C=b(E?i:S),T=y(C);return Ve((()=>{e.onChange?.(T)}),[S]),o().createElement(L.Input,{ref:t,size:r,value:C,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:m,readOnly:f,disabled:g,onChange:t=>{const r=y(t.target.value);let n=/^-?\d*(\.\d*)?$/.test(r)||""===r||"-"===r;if(0===p&&r.includes(".")&&(n=!1),a>=0&&r.startsWith("-")&&(n=!1),n){if(!h&&(Number(r)>Number.MAX_SAFE_INTEGER||Number(r)<Number.MIN_SAFE_INTEGER))return;(t=>{E?e.onChange?.(t):w(t)})(r)}},onFocus:v,onBlur:()=>{const t=x(T);e.onBlur?.(t,T)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(x(T),T)}})}));Ec.displayName="InputNumber";const Sc=Ec;function wc(){return wc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},wc.apply(this,arguments)}const{Search:Cc}=L.Input,Tc=o().forwardRef(((e,t)=>{const{column:r,record:n,rowKey:i,columnKey:a}=e,{tableRef:l,tableBodyRef:s,$size:c,flattenColumns:d,updateTableData:u,doFieldValidate:p,dataChange:h}=o().useContext(Ml),m=o().useContext(gc),g=bc(),{store:b,fieldAuth:y}=l.current,x=r.editRender?.(n,r)||{},E=o().useRef(null),S=o().useRef(null),w=o().useRef(null),C=o().useRef(null),T=o().useRef(null),N=o().useRef(!1),I=o().useRef({}),R=o().useRef({}),P=o().useRef([]),[O,k]=o().useState(!1),[A,F]=o().useState(!1),[H,_]=o().useState(!1),[D,$]=o().useState(x.items||[]),[q,M]=o().useState(),K=(x.editable||(0,ne.isEqual)(m,[i,a]))&&!x.disabled&&!y[a]?.disabled,V=`${i}|${a}`,z=2===m.length?`${m[0]}|${m[1]}`:"",U=![...b.state.required,...b.state.validate].some((e=>{let{x:t,y:r}=e;return t===i&&r===a})),W=b.state.required.find((e=>{let{x:t,y:r}=e;return t===i&&r===a}))?.text||"",G=b.state.validate.find((e=>{let{x:t,y:r}=e;return t===i&&r===a}))?.text||"",Y=b.state.edited.some((e=>{let{x:t,y:r}=e;return t===i&&r===a})),X=K||!U||O||H||A,Q=!!x.helper?.combinedDataIndex&&("search-helper"===x.type||"tree-helper"===x.type),Z=x.type?.endsWith("multiple");o().useLayoutEffect((()=>{X&&z===V&&re()}),[m]),o().useLayoutEffect((()=>{const{items:e}=x;Z&&e&&te(e.map((e=>({[R.current.valueKey]:e.value,[R.current.textKey]:e.text}))))}),[]);const J=()=>{u(),h()},ee=(e,t)=>{k(e),t?.()},te=e=>{P.current=e},re=()=>{const{type:e}=x;switch(e){case"text":S.current?.focus();break;case"number":w.current?.select();break;case"search-helper":C.current?.focus();break;case"tree-helper":T.current?.focus()}};o().useImperativeHandle(t,(()=>({focus:re})));const ie=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0,cancelable:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0,cancelable:!0}))},ae=(e,t,r)=>{const{cornerSign:n=!0}=x.extra||{};b.addToUpdated(e),n&&b.addToEdited({x:t,y:r})},oe=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"",le={text:(e,t,r)=>{const{dataIndex:n}=t,{type:l,extra:s={},rules:d=[],onInput:u,onChange:h,onEnter:m,onBlur:b}=x,y=en(e,n),v=Object.assign({},{minRows:1,maxRows:4},s.autoSize),E=r?{rows:v.minRows,autoSize:v}:null,w=s.password?L.Input.Password:r?L.Input.TextArea:L.Input;return o().createElement(w,wc({ref:S,size:c,value:y,maxLength:s.maxLength,showCount:s.showCount},E,{autoComplete:s.password?"new-password":"off",placeholder:s.placeholder||f("qm.table.editable.inputPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,suffix:s.suffix,onChange:t=>{const r=t.target.value??"";tn(e,n,r),p(d,r,i,a),g(),u?.({[V]:r}),N.current=!0},onFocus:()=>F(!0),onBlur:t=>{F(!1);const r=t.target.value??"";N.current&&(N.current=!1,ae(e,i,a),h?.({[V]:r},e),b?.({[V]:r},e),J())},onKeyUp:t=>{if(13===t.keyCode&&!t.shiftKey){const r=t.target.value??"";m?.({[V]:r},e)}},onKeyDown:e=>{r&&13===e.keyCode&&!e.shiftKey&&m&&e.preventDefault()}}))},textarea:(e,t)=>le.text(e,t,!0),number:(e,t)=>{const{dataIndex:r,precision:n,formatType:l}=t,{type:s,extra:d={},rules:u=[],onInput:h,onChange:m,onEnter:b,onBlur:y}=x,v=en(e,r);let E,S;return"finance"===l&&(E=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},S=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===l&&(E=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new(Ri())(e).times(100).toNumber()}`,S=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(Ri())(e).times(.01).toString()),o().createElement(Sc,{ref:w,size:c,value:v,min:d.min,max:d.max,precision:n,stringMode:d.stringMode,prefix:d.prefix,suffix:d.suffix??("percent"===l?"%":void 0),placeholder:d.placeholder||f("qm.table.editable.inputPlaceholder"),maxLength:d.maxLength,allowClear:d.allowClear,readOnly:d.readOnly,disabled:d.disabled,formatter:E,parser:S,onChange:t=>{tn(e,r,t),p(u,t,i,a),g(),h?.({[V]:t}),N.current=!0},onFocus:()=>F(!0),onBlur:(t,n)=>{if(F(!1),!N.current)return;N.current=!1;let o=d.stringMode?t:oe(t);"percent"===l&&"."===n.charAt(n.length-1)&&(o=Number(t)/100),tn(e,r,o),ae(e,i,a),m?.({[V]:o},e),y?.({[V]:o},e),J()},onEnter:(t,r)=>{let n=d.stringMode?t:oe(t);"percent"===l&&"."===r.charAt(r.length-1)&&(n=Number(t)/100),b?.({[V]:n},e)}})},select:(e,t,r)=>{const{dataIndex:n,dictItems:s=[]}=t,{type:d,extra:u={},rules:h=[],items:m,onChange:g,onEnter:b}=x,{elementStore:y}=l.current,v=m||s,E=en(e,n);let S=E;return o().createElement(L.Select,{mode:r?"multiple":void 0,size:c,popupClassName:"table-editable__popper",value:E||void 0,placeholder:u.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:u.allowClear,listHeight:u.listHeight,maxTagCount:u.collapseTags?"responsive":void 0,maxTagTextLength:u.maxTagTextLength,disabled:u.disabled,style:{width:"100%"},showSearch:u.filterable??!0,filterOption:(e,t)=>{const r=t?.children?.toString()||"";return`${r}|${ri.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{tn(e,n,t),p(h,t,i,a),ae(e,i,a),g?.({[V]:t},e),J()},onSelect:e=>{S=e},onInputKeyDown:t=>{13===t.keyCode&&de((()=>b?.({[V]:S},e)))}},v.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>le.select(e,t,!0),date:(e,t,r)=>{const{dataIndex:n}=t,{type:l,extra:s={},rules:d=[],onChange:u}=x,h=r||"exactdate",m=en(e,n);return o().createElement(j,{size:c,popupClassName:"table-editable__popper",value:ln(m,In[h])??void 0,picker:Nn[h],format:s.format,showTime:"datetime"===h,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:r}=s;return t&&r?e.isBefore(t,"day")||e.isAfter(r,"day"):t?e.isBefore(t,"day"):!!r&&e.isAfter(r,"day")})(e),placeholder:s.placeholder,allowClear:s.allowClear,disabled:s.disabled,style:{width:"100%"},onChange:t=>{const r=sn(t,In[h]);tn(e,n,r),p(d,r,i,a),ae(e,i,a),u?.({[V]:r},e),J()}})},datetime:(e,t)=>le.date(e,t,"datetime"),month:(e,t)=>le.date(e,t,"month"),year:(e,t)=>le.date(e,t,"year"),time:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},rules:s=[],onChange:d}=x,u="HH:mm:ss",h=en(e,r);return o().createElement(B,{size:c,popupClassName:"table-editable__popper",value:ln(h,u)??void 0,format:l.format||u,placeholder:l.placeholder,allowClear:l.allowClear,disabled:l.disabled,style:{width:"100%"},onChange:t=>{const n=sn(t,u);tn(e,r,n),p(s,n,i,a),ae(e,i,a),d?.({[V]:n},e),J()}})},checkbox:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},rules:s=[],onChange:c}=x,{trueValue:d=Vl,falseValue:u=zl,disabled:h}=l,m=en(e,r);return o().createElement(L.Checkbox,{checked:m===d,disabled:h,onChange:t=>{const n=t.target.checked?d:u;tn(e,r,n),p(s,n,i,a),ae(e,i,a),c?.({[V]:n},e),J()}})},switch:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},rules:s=[],onChange:c}=x,{trueValue:d=Vl,falseValue:u=zl,disabled:h}=l,m=en(e,r);return o().createElement(L.Switch,{checked:m===d,disabled:h,onChange:t=>{const n=t?d:u;tn(e,r,n),p(s,n,i,a),ae(e,i,a),c?.({[V]:n},e),J()}})},"search-helper":(e,t)=>{const{dataIndex:r,precision:n}=t,{type:l,extra:s={},rules:u=[],helper:h={},onInput:m,onChange:g,onEnter:b}=x,y=rn(e,Q?h.combinedDataIndex:r),S=h.fieldAliasMap;S||v("Table","helper 需要配置 `fieldAliasMap` 选项");const w="function"==typeof S?S():S||{};Object.keys(w).includes(r)||v("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Q&&(h.combinedDataIndex.split("|").every((e=>Object.keys(w).includes(e)))||v("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),w[r].includes("|")&&v("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const T=e=>{const{filterAliasMap:t}=h,n=""!==e?e:void 0,i=("function"==typeof t?t():t)||[],a={[r]:n};return(Array.isArray(i)?i:[i]).forEach((e=>{if((0,ne.isPlainObject)(e))for(const t in e)a[t]="function"==typeof e[t]?e[t](n):n;else a[e]=n})),a},R=e=>{const{autoQueryAssign:t=!0}=h;t&&(I.current=T(e)),k(!0)},P=(r,n)=>{const{beforeOpen:i}=h,a=(i??se)({[V]:y},e,t);a?.then?a.then((()=>{R(r),n?.()})).catch((()=>{})):!1!==a&&(R(r),n?.())},A=e=>{const t={};for(const n in w){const i=w[n];n!==r&&(t[n]=rn(e,i))}const n=w[r]?rn(e,w[r]):"";F(n,t);const{closed:i}=h;ee(!1,(()=>ie(E.current))),re(),i?.(e)},L=()=>{const{onlySelect:e=!0}=h;N.current&&F(e?"":y),ee(!1,(()=>ie(E.current)))},F=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;if((0,ne.isPlainObject)(o)&&Object.keys(o).length)for(const t in o){const r=o[t],n=d.find((e=>e.dataIndex===t));if(n){tn(e,t,r,n.precision);const a=n.editRender?.(e,n);a&&Array.isArray(a.rules)&&p(a.rules,r,i,t)}else tn(e,t,r)}Q&&!t&&((e,t,r,n)=>{if(!t.includes("|"))return tn(e,t,"",void 0);const i="".split("|")||[];t.split("|").forEach(((t,r)=>{t&&tn(e,t,i[r]?.trim())}))})(e,h.combinedDataIndex),tn(e,r,t,n),p(u,t,i,a),ae(e,i,a),g?.({[V]:t},e),J(),I.current={},N.current=!1,M(void 0)},H={visible:O,title:f("qm.searchHelper.text"),width:h.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Di[c]+20}px`},onClose:()=>{L()}},D={...h,size:c,initialValue:Object.assign({},I.current,h.initialValue),onClose:e=>{e?A(e):L()}};return o().createElement(o().Fragment,null,o().createElement(Cc,{ref:C,value:q??y,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,onBlur:e=>{const{value:t}=e.target,{onlySelect:n=!0,table:i}=h;if(N.current&&!O)return t&&n&&i?.fetch?.api?(e=>{const{table:t,initialValue:r={}}=h,{beforeFetch:n=se}=t.fetch;return new Promise((async(i,a)=>{const o=(0,ne.merge)({},t.fetch.params,{...r,...T(e)},{currentPage:1,pageSize:500});if(!n(o))return a();_(!0);try{const e=await t.fetch.api(o);200===e.code?i(Array.isArray(e.data)?e.data:(0,ne.get)(e.data,t.fetch.dataKey)??[]):a()}catch(e){a(e)}finally{de((()=>_(!1)))}}))})(t).then((e=>function(){let e=arguments.length>1?arguments[1]:void 0;const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter((t=>rn(t,w[r]).toString().includes(e)));if(1===t.length)return A(t[0]);P(e)}(e,t))).catch((()=>F(""))):void F(t)},onChange:e=>{const{value:t}=e.target;m?.({[V]:t}),N.current=!0,M(t)},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";b?.({[V]:r},e)}},onDoubleClick:e=>{const{value:t}=e.target;P(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&P(e)}}),o().createElement(wr,H,o().createElement(Gc,D)))},"search-helper-multiple":(e,t)=>{const{dataIndex:r}=t,{type:n,items:l=[],extra:s={},rules:d=[],helper:u={},onInput:h,onChange:m,onEnter:g}=x,b=en(e,r),y=u.fieldAliasMap;y||v("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof y?y():y||{};Object.keys(S).includes("valueKey")&&Object.keys(S).includes("textKey")||v("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=S;const w=r=>{const{beforeOpen:n}=u,i=(n??se)({[V]:b},e,t);i?.then?i.then((()=>{k(!0),r?.()})).catch((()=>{})):!1!==i&&(k(!0),r?.())},C=()=>{ee(!1,(()=>ie(E.current)))},T=t=>{tn(e,r,t),p(d,t,i,a),ae(e,i,a),m?.({[V]:t},e,P.current),J()},N={visible:O,title:f("qm.searchHelper.text"),width:u.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Di[c]+20}px`},onClose:()=>{C()}},I={...u,size:c,multiple:!0,initialValue:(0,ne.merge)({},u.initialValue),defaultSelectedKeys:b,onClose:(e,t)=>{e?((e,t)=>{const{textKey:r,valueKey:n}=S;te((0,ne.uniqBy)([...P.current.filter((e=>t.includes(e[n]))),...e],n));const i=P.current.map((e=>({text:e[r],value:e[n]}))),a=(0,ne.uniqBy)([...i,...l],"value").filter((e=>t.includes(e.value)));$(a),T(a.map((e=>e.value)));const{closed:o}=u;ee(!1,(()=>ie(E.current))),o?.(P.current)})(e,t):C()}};return o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{className:"ant-input-wrapper ant-input-group"},o().createElement(L.Select,{mode:"multiple",open:!1,value:b,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,maxTagCount:s.collapseTags?"responsive":void 0,maxTagTextLength:s.maxTagTextLength,disabled:s.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&g?.({[V]:b},e)},onDoubleClick:()=>{s.disabled||w()},onChange:e=>{const{valueKey:t}=S;te(P.current.filter((r=>e.includes(r[t])))),T(e)}},D.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text)))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:s.disabled,icon:o().createElement(Re.SearchOutlined,null),onClick:()=>{w()}})))),o().createElement(wr,N,o().createElement(Gc,I)))},"tree-helper":(e,t)=>{const{dataIndex:r,precision:n}=t,{type:l,extra:s={},rules:u=[],helper:h={},onChange:m,onEnter:g}=x,b=rn(e,Q?h.combinedDataIndex:r),y=h.fieldAliasMap;y||v("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof y?y():y||{};Object.keys(S).includes(r)||v("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Q&&(h.combinedDataIndex.split("|").every((e=>Object.keys(S).includes(e)))||v("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),S[r].includes("|")&&v("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const w=r=>{const{beforeOpen:n}=h,i=(n??se)({[V]:b},e,t);i?.then?i.then((()=>{k(!0),r?.()})).catch((()=>{})):!1!==i&&(k(!0),r?.())},C=()=>{ee(!1,(()=>ie(E.current)))},N=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;if((0,ne.isPlainObject)(o)&&Object.keys(o).length)for(const t in o){const r=o[t],n=d.find((e=>e.dataIndex===t));if(n){tn(e,t,r,n.precision);const a=n.editRender?.(e,n);a&&Array.isArray(a.rules)&&p(a.rules,r,i,t)}else tn(e,t,r)}tn(e,r,t,n),p(u,t,i,a),ae(e,i,a),m?.({[V]:t},e),J()},I={visible:O,title:f("qm.searchHelper.text"),width:h.width??"30%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Di[c]+20}px`},onClose:()=>{C()}},R={...h,defaultSelectedKeys:[b],size:c,onClose:e=>{e?(e=>{const t={};for(const n in S){const i=S[n];n!==r&&(t[n]=rn(e,i))}const n=S[r]?rn(e,S[r]):"";N(n,t);const{closed:i}=h;ee(!1,(()=>ie(E.current))),re(),i?.(e)})(e):C()}};return o().createElement(o().Fragment,null,o().createElement(Cc,{ref:T,value:b,allowClear:s.allowClear??!0,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";g?.({[V]:r},e)}},onDoubleClick:()=>{w()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?w():N(""))}}),o().createElement(wr,I,o().createElement(rd,R)))},"tree-helper-multiple":(e,t)=>{const{dataIndex:r}=t,{type:n,extra:l={},items:s=[],rules:d=[],helper:u={},onInput:h,onChange:m,onEnter:g}=x,b=en(e,r),y=u.fieldAliasMap;y||v("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof y?y():y||{};Object.keys(S).includes("valueKey")&&Object.keys(S).includes("textKey")||v("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=S;const w=r=>{const{beforeOpen:n}=u,i=(n??se)({[V]:b},e,t);i?.then?i.then((()=>{k(!0),r?.()})).catch((()=>{})):!1!==i&&(k(!0),r?.())},C=()=>{ee(!1,(()=>ie(E.current)))},T=t=>{tn(e,r,t),p(d,t,i,a),ae(e,i,a),m?.({[V]:t},e,P.current),J()},N={visible:O,title:f("qm.searchHelper.text"),width:u.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Di[c]+20}px`},onClose:()=>{C()}},I={...u,size:c,multiple:!0,initialValue:(0,ne.merge)({},u.initialValue),defaultSelectedKeys:b,onClose:e=>{e?(e=>{const{textKey:t,valueKey:r}=S;te(e);const n=P.current.map((e=>({text:e[t],value:e[r]})));$(n),T(n.map((e=>e.value)));const{closed:i}=u;ee(!1,(()=>ie(E.current))),i?.(P.current)})(e):C()}};return o().createElement(o().Fragment,null,o().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},o().createElement("span",{className:"ant-input-wrapper ant-input-group"},o().createElement(L.Select,{mode:"multiple",open:!1,value:b,placeholder:l.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:l.allowClear,maxTagCount:l.collapseTags?"responsive":void 0,maxTagTextLength:l.maxTagTextLength,disabled:l.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&g?.({[V]:b},e)},onDoubleClick:()=>{l.disabled||w()},onChange:e=>{const{valueKey:t}=S;te(P.current.filter((r=>e.includes(r[t])))),T(e)}},D.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text)))),o().createElement("span",{className:"ant-input-group-addon"},o().createElement(L.Button,{className:"ant-input-search-button",disabled:l.disabled,icon:o().createElement(Re.SearchOutlined,null),onClick:()=>{w()}})))),o().createElement(wr,N,o().createElement(rd,I)))}};return o().createElement(o().Fragment,null,X?(()=>{const{type:e}=x,t=le[e];if(!t)return v("Table","单元格编辑的类型 `type` 配置不正确"),null;const i=["cell--edit",{"is-error":!U}];return o().createElement("div",{ref:E,className:Ne()(i)},t(n,r),!U&&o().createElement("div",{className:"cell-error"},W||G))})():(()=>{const{extra:t={}}=x;return o().createElement("span",{style:{color:t.disabledColor}},e.children)})(),Y&&o().createElement("i",{className:"cell--sign"}))}));Tc.displayName="CellEdit";const Nc=Tc,Ic=require("copy-to-clipboard");var Rc=n.n(Ic);const Pc=function(e){if(!o().isValidElement(e))return null;for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return o().cloneElement(e,...r)},Oc=e=>{const{text:t,options:r,showMessage:n=!0,onCopy:i}=e;return Pc(e.children,{onClick:a=>{const l=o().Children.only(e.children),s=Rc()(t,r);i?.(t,s),s&&n&&L.message.success(f("qm.clipboard.success")),l&&l.props&&"function"==typeof l.props.onClick&&l.props.onClick(a)}})};Oc.displayName="QmCopyToClipboard";const kc=Oc,Ac=o().forwardRef(((e,t)=>{const{column:r,row:n,rowIndex:i,columnIndex:l,rowKey:s,depth:c,showTitle:d}=e,{tableRef:u,flattenColumns:p,selectionKeys:h,treeExpandIndex:m,updateMark:f,isTreeTable:g}=o().useContext(Ml),{treeConfig:b}=u.current.props,{dataIndex:y,canCopy:v,render:x,editRender:E,shouldCellUpdate:S}=r,{t:w}=yc(),{renderText:C,getTitleFromCellNode:T}=fs(),N=o().useRef(null),[I,R]=function(e,c,d){const u=a.useRef({});return"value"in u.current&&!((e,t)=>{if(S){const[,r]=e,[,n]=t;return S(n,r)}return!function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=new Set;return function e(t,i){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(n.has(t))return!1;if(t===i)return!0;if(r&&a>1)return!1;n.add(t);const o=a+1;if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],i[r],o))return!1;return!0}if(t&&i&&"object"==typeof t&&"object"==typeof i){const r=Object.keys(t);return r.length===Object.keys(i).length&&r.every((r=>e(t[r],i[r],o)))}return!1}(e,t)}(e,t)})(u.current.condition,c)||(u.current.value=(()=>{const e=en(n,y),a=x?x(e,n,r,i,l):C(e,r,n);return[a,E?o().createElement(Nc,{ref:t,column:r,record:n,rowKey:s,columnKey:y},a):null]})(),u.current.condition=c),u.current.value}(0,[f,(e=>{const t={};for(let r=0;r<p.length;r++){const{dataIndex:n}=p[r];[es.expandableColumn,es.selectionColumn,"index","pageIndex",es.operationColumn].includes(n)||me(t,n,he(e,n))}return t})(n),x,E]);o().useEffect((()=>{if([es.expandableColumn,es.selectionColumn,es.operationColumn].includes(y))return;const e=N.current.parentNode;d?e.title=T(I):e.removeAttribute("title")}),[d,I]);const P=e=>Array.isArray(e.children);return o().createElement("div",{ref:N,className:"cell"},(()=>{if(y===es.expandableColumn)return o().createElement(xc,{record:n,rowKey:s});if(y===es.selectionColumn)return o().createElement(vc,{selectionKeys:h,column:r,record:n,rowKey:s});if(R)return R;if(g&&y===m)return o().createElement(o().Fragment,null,(e=b?.virtual?n._level:c)?o().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*es.treeTable.textIndent+"px"}}):null,o().createElement(xc,{key:"expand",record:n,rowKey:s,style:P(n)?{}:{visibility:"hidden"}}),I);var e;if(v){const e=T(I);return o().createElement("div",{className:"cell--copy"},o().createElement("span",{className:"text"},I),e&&o().createElement(kc,{text:e},o().createElement(Re.CopyOutlined,{className:"icon",title:w("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return I})())}));Ac.displayName="Cell";const Lc=Ac;function Fc(){return Fc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Fc.apply(this,arguments)}const Hc=o().forwardRef(((e,t)=>{const{tableFlatColumns:r,tableData:n}=e,{getRowKey:i,tableRef:l,flattenColumns:s,editableColumns:c,leftFixedColumns:d,rightFixedColumns:u,sorter:p,layout:h,showFooter:m,scrollX:g,scrollY:b,selectionKeys:y,rowExpandedKeys:v,highlightKey:x,isPingLeft:E,isPingRight:S,isTableEmpty:w,isTreeTable:C,isGroupSubtotal:T,isWebPagination:N,isDragMergeCell:I,setElementStore:R,createTableFullData:P,setSelectionKeysEffect:O,setHighlightKey:k,getStickyLeft:A,getStickyRight:L,scrollXToColumn:F,scrollYToRecord:H,rowInViewport:_,dataChange:D,setPingLeft:$,setPingRight:q,setFullScreen:M,findParentRowKeys:j,getAllChildRowKeys:K,triggerScrollXEvent:V,triggerScrollYEvent:z,scrollBottomDebouncer:B}=o().useContext(Ml),{height:U,minHeight:W,maxHeight:G,rowHeight:Y,rowSelection:X,rowHighlight:Q,treeConfig:Z,expandable:J,stripe:ee,summation:te,rowStyle:re,cellStyle:ie,spanMethod:ae,nativeScrollBar:oe,ellipsis:ce,showHeader:de,rowDraggable:ue,onRowClick:pe,onRowDblclick:he,onRowContextmenu:me,onRowEnter:fe}=l.current.props,ge=o().useRef(null),be=o().useRef({}),ye=o().useRef(null),ve=o().useRef(null),Ee=o().useRef({prevST:0,prevSL:0}),{dragStart:Se,renderDragPanel:we,closeDragPanel:Ce}=(()=>{const{tableRef:e,layout:t,flattenColumns:r,isDragMergeCell:n}=o().useContext(Ml),{mergeCells:i=[],onMergeChange:a}=e.current.props,[l,s]=o().useState(!1),c=o().useRef(null),d=o().useRef(null),u=o().useRef({x:0,y:0,disX:0,disY:0}),p=Ie("table");Ve((()=>{n||x()}),[n]);const h=()=>{x(),Ye(c.current,{display:"none"})},m=e=>{const t=[];for(let r=0;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push([e.row+r,e.col+n]);return t},g=()=>{u.current={x:0,y:0,disX:0,disY:0},d.current&&!E(d.current)||(d.current=null,h()),s(!0),document.removeEventListener("mousemove",b)},b=e=>{const{pageX:r,pageY:n}=e,{x:i,y:a,disX:o,disY:l}=u.current;let s=o,d=l,p=r-i,h=n-a;return p<0&&(p=Math.abs(p),s=o-p,Ye(c.current,{left:`${s}px`})),h<0&&(h=Math.abs(h),d=l-h,Ye(c.current,{top:`${d+t.headerHeight}px`})),Ye(c.current,{width:`${p}px`,height:`${h}px`}),y(s,d,p,h),!1},y=At(((t,n,i,a)=>{const{allTableData:o,scrollYStore:l}=e.current;let s=-1,c=-1,u=-1,p=-1;for(let e=0;e<o.length;e++)n>l.rowHeight*e&&n<l.rowHeight*(e+1)&&(s=e),n+a>l.rowHeight*e&&n+a<l.rowHeight*(e+1)&&(c=e);let h=0;for(let e=0;e<r.length;e++)t>h&&t<h+S(r[e])&&(u=e),t+i>h&&t+i<h+S(r[e])&&(p=e),h+=S(r[e]);const m={row:s,col:u,rowSpan:c-s+1,colSpan:p-u+1};(0,ne.isEqual)(d,m)||(d.current=m,v(s,c,u,p))}),5),v=(t,r,n,i)=>{const{elementStore:a,scrollYStore:o}=e.current,l=a.$tableBody.querySelectorAll("tbody > tr");for(let e=0;e<l.length;e++){const a=l[e].children;for(let l=0;l<a.length;l++)if(a[l].classList.remove("selected"),(t!==r||n!==i)&&e+o.startIndex>=t&&e+o.startIndex<=r){const e=Number(a[l].getAttribute("colspan")),t=Number(a[l].getAttribute("data-index")),r=e>1?t+e-1:t;r>=n&&r<=i&&a[l].classList.add("selected")}}},x=()=>{const{elementStore:t}=e.current,r=t.$tableBody.querySelectorAll("tbody > tr");for(let e=0;e<r.length;e++){const t=r[e].children;for(let e=0;e<t.length;e++)t[e].classList.remove("selected")}},E=e=>1===e.rowSpan&&1===e.colSpan,S=e=>e.width||e.renderWidth||e.minWidth||es.defaultColumnWidth;return{dragStart:r=>{const{pageX:n,pageY:i}=r,{elementStore:a}=e.current,{x:o,y:l}=Ze(a.$table),{scrollLeft:p,scrollTop:h}=a.$tableBody.parentNode.parentNode;d.current=null,u.current={x:n,y:i,disX:n+p-o,disY:i+h-(l+t.headerHeight)},Ye(c.current,{width:0,height:0,left:n-o+"px",top:i-l+"px",display:"block"}),x(),s(!1),document.addEventListener("mousemove",b,{passive:!0}),document.addEventListener("mouseup",g,{passive:!0,once:!0})},renderDragPanel:()=>o().createElement("div",{ref:c,className:`${p}--merge-cell`,onMouseDown:e=>e.stopPropagation()},l&&o().createElement(o().Fragment,null,o().createElement(xe,{size:"small",className:"btn cancel",onClick:()=>{if(d.current&&!E(d.current)){const e=m(d.current),t=i.findIndex((t=>{const r=m(t);return(0,ne.intersectionWith)(r,e,ne.isEqual).length===r.length}));-1!==t&&a?.(i.filter(((e,r)=>r!==t)))}h()}},f("qm.table.mergeCell.cancel")),o().createElement(xe,{size:"small",type:"primary",className:"btn confirm",onClick:()=>{if(d.current&&!E(d.current)){const e=m(d.current);let t=!1;for(let r=0;r<i.length;r++)(0,ne.intersectionWith)(m(i[r]),e,ne.isEqual).length&&(t=!0);t||a?.([...i,d.current])}h()}},f("qm.table.mergeCell.confirm")))),closeDragPanel:h}})(),Te=l.current.scrollXLoad?r:s,Re=o().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:r,tableFullHeight:n,tableAutoHeight:i}=h,a={};return w&&Object.assign(a,{minHeight:"100px"}),W&&Object.assign(a,{minHeight:Zr(W)-e-r+"px"}),G&&Object.assign(a,{maxHeight:Zr(G)-e-r+"px"}),U||n||i?{...a,maxHeight:"",minHeight:"",height:`${t}px`}:a}),[U,G,W,w,h]),Pe=o().useMemo((()=>{const{scrollYStore:e}=l.current,{viewportHeight:t,gutterWidth:r}=h;return Math.floor((g?t-r:t)/e.rowHeight)}),[h,g]),[Oe,ke]=o().useState([]),Ae=bc(),Le=function(e,t){const[r,n]=a.useState(!1);return a.useLayoutEffect((()=>{let r;const i=e.current,a=e=>{r=e},o=e=>{((e,r)=>{const a=e.target,o=r?.target,l=!a||!o,s=i?.contains(a)||i?.contains(o),c=i===a,d=t?.map((e=>Array.from(document.querySelectorAll(e)))).flat()||[],u=d.some((e=>e?.contains(a)))||d.includes(o);n(!(l||s||c||u))})(e,r)};return i&&(ze(document,"mousedown",a),ze(document,"mouseup",o)),()=>{i&&(Be(document,"mousedown",a),Be(document,"mouseup",o))}}),[e]),r}(ge,[".table-editable__popper"]);o().useImperativeHandle(t,(()=>({setClickedValues:De,createFocus:_e,forceUpdate:Ae}))),Ve((()=>{Le&&(De([]),I&&Ce())}),[Le]),Ve((()=>{Oe.length&&Ql.focus(l.current.uid)}),[Oe]),o().useEffect((()=>{He();const e=Xt()(document,"keydown",Fe);return()=>e.remove()}),[]);const Fe=ls((e=>{const{keyCode:t}=e;if(l.current.uid===Ql.getFocusInstance()?.id&&(27===t&&(De([]),k(""),M(!1)),Oe.length&&(et(document.activeElement,ge.current)||"INPUT"!==document.activeElement?.tagName))){if(13===t&&("radio"===X?.type||Q)){const t=y[0]??x??null,r=n.find((e=>i(e,e.index)===t))??null;r&&fe?.(r,e)}if(38===t||40===t){We(e);const{allTableData:r}=l.current,a=N?Yr(n):r,o=a.length;let s=a.findIndex((e=>i(e,e.index)===Oe[0]));const c=38===t?(--s+o)%o:++s%o,d=a[c],u=i(d,d.index);"radio"!==X?.type||X.disabled?.(d)||O([u]),Q&&!Q.disabled?.(d)&&k(u),_(c)||(38===t&&H(u,c),40===t&&H(u,Pe>c+1?0:c+1-Pe)),De([u,Oe[1]])}if(9===t){if(We(e),!c.length)return De([]);const t=c.length;let r=c.findIndex((e=>e.dataIndex===Oe[1]));const n=++r%t,i=c[n].dataIndex;De([Oe[0],i]),F(i)}}})),He=()=>{R("$tableBody",ge.current),R("$tableXspace",ye.current),R("$tableYspace",ve.current)},_e=(e,t)=>{be.current[`${e}-${t}`]?.focus()},De=e=>{(0,ne.isEqual)(e,Oe)||ke(e)},$e=(e,t,r)=>r?[...t,e]:t.filter((t=>t!==e)),qe=(e,t,r)=>{const{disabled:n}=X||{},{deriveRowKeys:i,recordsMap:a}=l.current,o=Gr(i,e);let s=[];const c=K(o?.children||[]);return s=r?[...new Set([...t,e,...c])]:t.filter((t=>![e,...c].includes(t))),n&&(s=s.filter((e=>!a.has(e)||!n(a.get(e))))),(gn(i,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Gr(i,e),r=t?.children?.every((e=>s.includes(e.rowKey)));s=r?[...s,e]:s.filter((t=>t!==e))})),s},Me=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=[];return e.forEach((e=>{const n=e.index,a=i(e,e.index);if(r.push(je(e,n,a,t)),J?.expandedRowRender){const{expandedRowClassName:t,rowExpandable:i=se}=J;v.includes(a)&&i(e)&&r.push(o().createElement("tr",{key:`expand_${a}`,className:"body--row-expanded"},o().createElement("td",{colSpan:Te.length,className:"body--column",style:{paddingLeft:X?2*es.selectionColumnWidth:es.selectionColumnWidth}},o().createElement("div",{className:Ne()("cell",t)},J.expandedRowRender(e,n)))))}if(!Z?.virtual&&(e=>Array.isArray(e.children))(e)){const n="function"!=typeof J?.rowExpandable||J.rowExpandable(e);v.includes(a)&&n&&r.push(...Me(e.children,t+1))}})),r},je=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const i=["body--row",{"body--row-striped":ee&&t%2!=0,"body--row-selected":y.includes(r),"body--row-current":x===r,...T?Xe(e._group):null}];return o().createElement("tr",{key:r,className:Ne()(i)},Te.map(((i,a)=>Ke(i,a,e,t,r,n))))},Ke=(e,t,r,n,a,s)=>{const{isIE:c}=l.current,{dataIndex:h,fixed:m,align:f,className:g="",editRender:b}=e,{rowSpan:v,colSpan:x}=Ue(r,e,n,t);if(!v||!x)return null;const E=e.ellipsis??ce,S=!c&&"left"===m,w=!c&&"right"===m,N=["body--column",{"col--ellipsis":E,"col--center":"center"===f,"col--right":"right"===f,"column--sort":!!p[h],"cell-fix-left":S,"cell-fix-right":w,"cell-fix-left-last":S&&d[d.length-x]?.dataIndex===h,"cell-fix-right-first":w&&u[0]?.dataIndex===h,[g]:!!g}],I=w&&x>1?Te.slice(t+1,t+x).reduce(((e,t)=>e+(t.width||t.renderWidth||0)),0):0,R=c?null:{left:S?`${A(h)}px`:"",right:w?L(h)-I+"px":""},P=re?"function"==typeof re?re(r,n):re:null,F=ie?"function"==typeof ie?ie(r,e,n,t):ie:null,H=T?Ge(r._group):null,_=Object.assign({},R,Y?{height:Y}:null,H,P,F);if(b){const{extra:t}=b(r,e)||{};t?.disabledBackgroundColor&&Object.assign(_,{backgroundColor:t?.disabledBackgroundColor})}return o().createElement("td",{key:h,rowSpan:v>1?v:void 0,colSpan:x>1?x:void 0,"data-index":t,className:Ne()(N),style:_,onClick:t=>((e,t,r)=>{const{dataIndex:n}=r;if([es.expandableColumn,es.operationColumn].includes(n))return;const a=i(t,t.index);De([a,n]);const o=r.editRender?.(t,r),l=o&&!o.disabled,{type:s,selectByClickRow:c=!0,disabled:d=le}=X||{};!s||d(t)||l||(c||n===es.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:n=!0,onSelect:i}=X||{};if("radio"===r&&O([e]),"checkbox"===r){const r=!y.includes(e),a=C&&!n?qe(e,y,r):$e(e,y,r);O(a),i?.(r,t,a)}})(a,t),[es.selectionColumn].includes(n)||(!Q||Q.disabled?.(t)||l||k(a),pe?.(t,r,e))})(t,r,e),onDoubleClick:t=>((e,t,r)=>{const{dataIndex:n}=r;[es.expandableColumn,es.selectionColumn,es.operationColumn].includes(n)||he?.(t,r,e)})(t,r,e),onContextMenu:t=>((e,t,r)=>{const{dataIndex:n}=r;[es.expandableColumn,es.selectionColumn,es.operationColumn].includes(n)||me?.(t,r,e)})(t,r,e)},o().createElement(Lc,{ref:e=>be.current[`${a}-${h}`]=e,row:r,column:e,rowIndex:n,columnIndex:t,rowKey:a,depth:s,showTitle:E}))},Ue=(e,t,r,i)=>{let a=1,o=1;if("function"==typeof ae){const l=ae({row:e,column:t,rowIndex:r,columnIndex:i,tableData:n});if(Array.isArray(l)?(a=l[0],o=l[1]):(0,ne.isPlainObject)(l)&&(a=l.rowSpan,o=l.colSpan),e===n[0]&&0===a){a=1;for(let e=1;e<n.length;e++){const{rowSpan:r}=Ue(n[e],t,n[e].index,i);if(r>0)break;a++}}}const{mergeCells:s}=l.current;if(s.length>0){const e=s.find((e=>e.row===r&&e.col===i));e&&(a=e.rowSpan,o=e.colSpan)}return{rowSpan:a,colSpan:o}},Ge=e=>{const{backgroundColor:t,color:r}=te.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:r}},Xe=e=>{const t=te.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},Qe=Ie("table"),Je=I?{onMouseDown:Se}:null;return o().createElement(o().Fragment,null,o().createElement($t,{ref:l.current.scrollBarRef,wrapClassName:`${Qe}--body-wrapper`,wrapStyle:Re,native:oe,onScroll:e=>{const{elementStore:t,scrollXLoad:r,scrollYLoad:n}=l.current,{prevST:i,prevSL:a}=Ee.current,o=b?h.gutterWidth:0,{scrollTop:s,scrollLeft:c}=e;if(c!==a){de&&(t.$header.scrollLeft=c),m&&(t.$footer.scrollLeft=c);const e=c>0,r=Math.ceil(c)+h.tableWidth<h.tableBodyWidth+o;E!==e&&$(e),S!==r&&q(r)}if(n&&s!==i&&z(s),r&&c!==a&&V(c),b&&s!==i){const r=t.$tableYspace.offsetHeight||t.$tableBody.offsetHeight;Math.ceil(s)+h.viewportHeight-o>=r&&B({type:"scroll",target:e,preventDefault:le,stopPropagation:le})}Ee.current.prevST=s,Ee.current.prevSL=c}},o().createElement("div",{ref:ve,className:"body--y-space"}),o().createElement("div",{ref:ye,className:"body--x-space",style:{width:b?h.tableBodyWidth-h.gutterWidth:h.tableBodyWidth}}),o().createElement(gc.Provider,{value:Oe},o().createElement("table",Fc({ref:ge,className:`${Qe}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0"},Je,{style:{width:0}}),o().createElement("colgroup",null,Te.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return o().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})}))),ue?o().createElement(fi.ReactSortable,{itemKey:e=>i(e,e.index),tag:"tbody",animation:200,list:n,setList:e=>{const t=e.map((e=>i(e,e.index))),r=n.map((e=>i(e,e.index)));if((0,ne.isEqual)(t,r))return;const a=vn(e),o=[];l.current.tableFullData.forEach((e=>{n.includes(e)?o.push(a.shift()):o.push(e)})),P(o),D()}},n.map((e=>je(e,e.index,i(e,e.index))))):o().createElement("tbody",null,Me(n))))),I&&we())}));Hc.displayName="TableBody";const _c=Hc,Dc=e=>{const{summationRows:t}=e,{tableRef:r,sorter:n,layout:i,scrollY:a,flattenColumns:l,leftFixedColumns:s,rightFixedColumns:c,setElementStore:d,getStickyLeft:u,getStickyRight:p}=o().useContext(Ml),{footRender:h}=r.current.props,m=o().useRef(null);o().useEffect((()=>{g()}),[]);const g=()=>{d("$footer",m.current)},b=Ie("table"),{tableBodyWidth:y}=i;return o().createElement("div",{ref:m,className:`${b}--footer-wrapper`},h?h(l,r.current.tableFullData):o().createElement("table",{className:`${b}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:y?`${y}px`:""}},(()=>{const{gutterWidth:e}=i;return o().createElement("colgroup",null,l.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return o().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})})),a&&o().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),o().createElement("tfoot",null,(()=>{const{isIE:e}=r.current,d=["gutter",{"cell-fix-right":!!c.length}],h=e?null:{right:c.length?0:""};return t.map(((e,t)=>o().createElement("tr",{key:t,className:"footer--row"},l.map(((t,l)=>((e,t,l)=>{const{isIE:d}=r.current,{gutterWidth:h}=i,{dataIndex:m,fixed:g,align:b,summation:y}=e,v=["footer--column","col--ellipsis",{"col--center":"center"===b,"col--right":"right"===b,"column--sort":!!n[m],"cell-fix-left":!d&&"left"===g,"cell-fix-right":!d&&"right"===g,"cell-fix-left-last":!d&&"left"===g&&s[s.length-1]?.dataIndex===m,"cell-fix-right-first":!d&&"right"===g&&c[0]?.dataIndex===m}],x=d?null:{left:"left"===g?`${u(m)}px`:"",right:"right"===g?`${p(m)+(a?h:0)}px`:""},E=y?.render?y.render(r.current.tableFullData):en(t,`${m}_text`),S=0===l&&""===E?f("qm.table.config.summaryText"):E;return o().createElement("td",{key:m,title:S,className:Ne()(v),style:{...x}},o().createElement("div",{className:"cell"},S))})(t,e,l))),a&&o().createElement("td",{className:Ne()(d),style:{...h}}))))})())))};var $c=function(e){return e.small="small",e.middle="default",e.large="default",e}($c||{});const qc=e=>{const{current:t,pageSize:r,total:n,onChange:i}=e,{global:a}=o().useContext(c),{tableRef:l,$size:s,setElementStore:d}=o().useContext(Ml),{uniqueKey:u,paginationConfig:p,infoBarConfig:h}=l.current.props,m=o().useRef(null),f=o().useMemo((()=>u?`tablePager_${u}`:""),[u]);o().useEffect((()=>{g(),x()}),[]);const g=()=>{d("$pager",m.current)},b=p?.showSizeChanger??es.pagination.showSizeChanger,y=p?.showQuickJumper??es.pagination.showQuickJumper,v=p?.pageSizeOptions||a?.table?.pagination?.pageSizeOptions||es.pagination.pageSizeOptions,x=async()=>{if(!f)return;const e=await E(f);e&&e!==r&&(i(t,e),localStorage.setItem(f,e.toString()))},E=async e=>{const t=a?.getComponentConfigApi;if(t&&!localStorage.getItem(f))try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},S=Ie("table"),w={[`${S}-pager`]:!0};return o().createElement("div",{ref:m,className:Ne()(w)},o().createElement("div",{className:"pager-alert"},"bottom"===h?.position&&o().createElement(ds,{total:n})),o().createElement(L.Pagination,{size:$c[s],showSizeChanger:b,showQuickJumper:y,pageSizeOptions:v,current:t,pageSize:r,total:n,onChange:(e,t)=>{i(e,t)},onShowSizeChange:(e,t)=>{f&&((async(e,t)=>{const r=a?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(f,t),localStorage.setItem(f,`${t}`))}}))},Mc=()=>{const{layout:e}=o().useContext(Ml),t=o().useMemo((()=>{const{headerHeight:t,viewportHeight:r}=e;return{top:`${t}px`,height:`${r}px`}}),[e]),r=Ie("table");return o().createElement("div",{className:`${r}--empty`,style:t},o().createElement(bt,null))},jc=()=>{const{setElementStore:e}=o().useContext(Ml),t=o().useRef(null);o().useEffect((()=>{r()}),[]);const r=()=>{e("$resizableBar",t.current)},n=Ie("table");return o().createElement("div",{ref:t,className:`${n}--resizable-bar`})};function Kc(){return Kc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Kc.apply(this,arguments)}const Vc=o().forwardRef(((e,t)=>{const{rowKey:r,columns:n,loading:i,resizable:a,customClass:l,tablePrint:s,exportExcel:d,infoBarConfig:u,topSpaceAlign:p,showTableInfo:h,showFullScreen:m,showRefresh:f,showToolBox:g,showHeader:b}=e,{size:y}=o().useContext(c),x=o().useMemo((()=>e.size??y??""),[e.size,y]),E=o().useRef(null),S=o().useRef(null),w=o().useRef(null),C=o().useRef(null),T=o().useRef(null),N=o().useCallback(((e,t)=>{const n="function"==typeof r?r(e,t):e[r];return void 0===n?(v("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n}),[r]),{tableRef:I,tableFullData:R,setElementStore:P,setOriginColumns:O,setTableFullData:k,setTableOriginData:A,setAllTableData:L,setDeriveRowKeys:F,setInvalidRowKeys:H,setFieldAuth:_,setMergeCells:D,setColumnsDefined:$,setScrollXStore:q,setScrollYStore:M,setScrollXLoad:j,setScrollYLoad:K,setResizeState:V,setHandleState:z,setSummaries:B,setSelectionRows:U,setShouldToTop:W,setRecordsMap:G,setUnMounted:Y,setHandleChange:X,clearElementStore:Q,clearRecordsMap:Z}=((e,t)=>{let{getRowKey:r,$size:n}=t;const{rowHeight:i,dynamicThead:a}=e,l=o().useRef({props:e,uid:cn(),elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},mergeCells:[],columnsDefined:!a,scrollBarRef:o().createRef(),scrollXStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0},scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:i||es.rowHeightMaps[n]},store:new Jl,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},treeTable:!1,scrollXLoad:!1,scrollYLoad:!1,shouldToTop:!0,selectionRows:[],recordsMap:new Map,unMounted:!1,isHandleChange:!0,isIE:!ie&&/MSIE|Trident/.test(navigator.userAgent)});(e=>{l.current.props=e})(e);const s=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return e.map((e=>{const o=r(e,e.index),l=n?`${n}#${o}`:`${o}`,c=i?`${i}-${e.index+1}`:`${e.index+1}`,d={level:a,rowKey:o,rowKeyPath:l,indexPath:c};return e.indexPath=c,e._level=a,Array.isArray(e.children)&&(d.children=s(e.children,o,l,c,a+1)),t?Object.assign({},d,{parentRowKey:t}):d}))},c=e=>{const t=[];return e.forEach((e=>{Array.isArray(e.children)?t.push(...c(e.children)):t.push(e.rowKey)})),t};return{tableRef:l,...l.current,setElementStore:(e,t)=>{l.current.elementStore[e]=t},setOriginColumns:e=>{l.current.originColumns=e},setTableFullData:e=>{l.current.tableFullData=e},setTableOriginData:e=>{l.current.tableOriginData=e},setAllTableData:e=>{const t=Yr(e);l.current.allTableData=t,l.current.allRowKeys=t.map((e=>r(e,e.index)))},setDeriveRowKeys:e=>{const t=l.current.tableFullData.some((e=>Array.isArray(e.children)));l.current.treeTable=t,l.current.deriveRowKeys=t?s(e,""):[],l.current.flattenRowKeys=t?c(l.current.deriveRowKeys):[]},setInvalidRowKeys:e=>{l.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{l.current.fieldAuth[e]=t},setMergeCells:e=>{const t=[];e.forEach((e=>{t.push(e);for(let r=1;r<e.colSpan;r++)for(let n=0;n<e.rowSpan;n++)t.push({row:e.row+n,col:e.col+r,rowSpan:0,colSpan:0});for(let r=1;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push({row:e.row+r,col:e.col+n,rowSpan:0,colSpan:0})})),l.current.mergeCells=t},setColumnsDefined:e=>{l.current.columnsDefined=e},setScrollXStore:e=>{l.current.scrollXStore=e},setScrollYStore:e=>{l.current.scrollYStore=e},setResizeState:e=>{l.current.resizeState=e},setHandleState:e=>{l.current.handleState=e},setSummaries:e=>{l.current.summaries=e},setScrollXLoad:e=>{l.current.scrollXLoad=e},setScrollYLoad:e=>{l.current.scrollYLoad=e},setShouldToTop:e=>{l.current.shouldToTop=e},setSelectionRows:e=>{l.current.selectionRows=e},setRecordsMap:(e,t)=>{l.current.recordsMap.set(e,t)},setUnMounted:e=>{l.current.unMounted=e},setHandleChange:e=>{l.current.isHandleChange=e},clearElementStore:()=>{for(const e in l.current.elementStore)l.current.elementStore[e]=null},clearRecordsMap:()=>{l.current.recordsMap.clear()}}})(e,{getRowKey:N,$size:x}),{tableData:J,setTableData:ee,tableFlatColumns:te,setTableFlatColumns:re,filters:ae,setFilters:oe,sorter:le,setSorter:se,superFilters:ce,setSuperFilters:de,pagination:ue,setPagination:pe,selectionKeys:he,setSelectionKeys:me,rowExpandedKeys:ge,setRowExpandedKeys:be,highlightKey:ye,setHighlightKey:ve,updateMark:xe,forceUpdate:Ee,layout:Se,setLayout:we,permission:Ce,setPermission:Te,spinning:Re,setSpinning:Pe,scrollX:Oe,setScrollX:ke,scrollY:Ae,setScrollY:Le,isPingLeft:Fe,setPingLeft:He,isPingRight:_e,setPingRight:De,isFullScreen:$e,setFullScreen:qe,updateTableData:Me}=(e=>{const{uniqueKey:t,nativeScrollBar:r,initialSorter:n={},initialFilter:i={},paginationConfig:a,rowSelection:l,expandable:s,rowHighlight:d}=e,{global:u}=o().useContext(c),p={current:a?.current??es.pagination.current,pageSize:(()=>{if(t)return Number(localStorage.getItem(`tablePager_${t}`))||void 0})()??a?.pageSize??u?.table?.pagination?.pageSize??es.pagination.pageSize,total:0},h=l?.selectedRowKeys??l?.defaultSelectedRowKeys??[],m=s?.expandedRowKeys??s?.defaultExpandedRowKeys??[],[f,g]=o().useState([]),[b,y]=o().useState([]),[v,x]=o().useReducer(((e,t)=>(0,ne.isEqual)(e,t)?e:t),i),[E,S]=o().useReducer(((e,t)=>(0,ne.isEqual)(e,t)?e:t),n),[w,C]=o().useReducer(((e,t)=>(0,ne.isEqual)(e,t)?e:t),[]),[T,N]=o().useState(p),[I,R]=o().useReducer(((e,t)=>(0,ne.isEqual)(e,t)?e:t),h),[P,O]=o().useReducer(((e,t)=>(0,ne.isEqual)(e,t)?e:t),m),[k,A]=o().useState(d?.currentRowKey??""),[L,F]=o().useReducer((e=>e+1),0),[H,_]=o().useState({gutterWidth:r?rs():0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[D,$]=o().useState({export:!0,import:!0,print:!0}),[q,M]=o().useState(!1),[j,K]=o().useState(!1),[V,z]=o().useState(!1),[B,U]=o().useState(!1),[W,G]=o().useState(!1),[Y,X]=o().useState(!1);return{tableData:f,setTableData:g,tableFlatColumns:b,setTableFlatColumns:y,filters:v,setFilters:x,sorter:E,setSorter:S,superFilters:w,setSuperFilters:C,pagination:T,setPagination:N,selectionKeys:I,setSelectionKeys:R,rowExpandedKeys:P,setRowExpandedKeys:O,highlightKey:k,setHighlightKey:A,updateMark:L,forceUpdate:F,layout:H,permission:D,setPermission:$,setLayout:_,spinning:q,setSpinning:M,scrollX:j,setScrollX:K,scrollY:V,setScrollY:z,isPingLeft:B,setPingLeft:U,isPingRight:W,setPingRight:G,isFullScreen:Y,setFullScreen:X,updateTableData:()=>{g([...f])}}})(e),{isFetch:je,isWebPagination:Ke,isScrollPagination:ze,showPagination:Be,shouldUpdateHeight:Ue,tableColumns:We,flattenColumns:Ge,editableColumns:Ye,summationColumns:Xe,leftFixedColumns:Qe,rightFixedColumns:Ze,treeExpandIndex:Je,showSummary:et,showFooter:tt,isHeadGroup:rt,bordered:nt,isHeadSorter:it,isHeadFilter:at,isServiceSummation:ot,isSelectCollection:lt,isTableImport:st,isTableClipboard:ct,isSuperSearch:dt,isFastSearch:ut,isGroupSummary:pt,isGroupSubtotal:ht,isDragMergeCell:mt,isTreeTable:ft,isTableEmpty:gt,summationRows:bt,fetchParams:yt}=is(e,{getRowKey:N,tableRef:I,tableFullData:R,tableData:J,sorter:le,filters:ae,superFilters:ce,selectionKeys:he,pagination:ue}),{createElementStore:vt,tableStyles:xt,getSpan:Et,getStickyLeft:wt,getStickyRight:Ct,scrollXToColumn:Tt,scrollYToRecord:Nt,rowInViewport:It,calcTableHeight:Rt,resetTableScroll:Pt,computeVirtualX:Ot,computeVirtualY:kt,doLayout:At}=cs(e,{getRowKey:N,tableRef:I,$size:x,tableColumns:We,flattenColumns:Ge,leftFixedColumns:Qe,layout:Se,scrollX:Oe,scrollY:Ae,tableData:J,showFooter:tt,showPagination:Be,isWebPagination:Ke,isFullScreen:$e,setLayout:we,setScrollX:ke,setScrollY:Le,setElementStore:P,setScrollXStore:q,setScrollYStore:M,setShouldToTop:W}),{initialTable:Lt,checkDataIndex:Ft,createTableFullData:Ht,getTableData:_t,handleTableData:Dt,createTableData:$t,createGroupData:qt,createSelectionKeys:Mt,createRowExpandedKeys:jt,setSelectionKeysEffect:Kt,findParentRowKeys:Vt,getAllChildRowKeys:zt,doFieldValidate:Bt,getTableLog:Ut,dataChange:Wt,tableChange:Gt,toLastPage:Yt,toFirstPage:Xt,getPageCount:Qt,pagerChangeHandle:Zt,triggerScrollXEvent:Jt,triggerScrollYEvent:er,scrollBottomDebouncer:tr,clearTableSorter:rr,clearTableFilter:nr,clearSuperFilters:ir,clearRowSelection:ar,clearRowHighlight:or,clearTableLog:lr,destroy:sr}=ss(e,{getRowKey:N,tableRef:I,tableElementRef:S,tableBodyRef:w,$size:x,tableColumns:We,flattenColumns:Ge,tableFullData:R,pagination:ue,layout:Se,filters:ae,sorter:le,superFilters:ce,fetchParams:yt,selectionKeys:he,rowExpandedKeys:ge,highlightKey:ye,summationColumns:Xe,shouldUpdateHeight:Ue,isFetch:je,isTreeTable:ft,isWebPagination:Ke,isScrollPagination:ze,isServiceSummation:ot,isGroupSubtotal:ht,doLayout:At,setTableData:ee,setTableFlatColumns:re,setTableFullData:k,setTableOriginData:A,setAllTableData:L,setDeriveRowKeys:F,setPagination:pe,setSpinning:Pe,setSorter:se,setFilters:oe,setSuperFilters:de,setSelectionKeys:me,setRowExpandedKeys:be,setHighlightKey:ve,setSelectionRows:U,setScrollXLoad:j,setScrollYLoad:K,setScrollXStore:q,setScrollYStore:M,computeVirtualX:Ot,computeVirtualY:kt,setFieldAuth:_,setResizeState:V,setSummaries:B,setPermission:Te,setRecordsMap:G,resetTableScroll:Pt,clearElementStore:Q,clearRecordsMap:Z});((e,t)=>{const{columns:r,summation:n,rowSelection:i,expandable:a,rowHighlight:l,mergeCells:s=[]}=e,{tableRef:c,topElementRef:d,tableElementRef:u,tableBodyRef:p,$size:h,scrollX:m,pagination:f,selectionKeys:g,rowExpandedKeys:b,highlightKey:y,summationRows:x,showSummary:E,isWebPagination:S,isScrollPagination:w,isTreeTable:C,checkDataIndex:T,toLastPage:N,toFirstPage:I,getPageCount:R,setHandleState:P,scrollYToRecord:O,setSelectionKeysEffect:k,setOriginColumns:A,setRowExpandedKeys:L,setHighlightKey:F,setResizeState:H,setMergeCells:_,setPingRight:D,setUnMounted:$,setHandleChange:q,calcTableHeight:M,createSelectionKeys:j,createRowExpandedKeys:K,createElementStore:V,triggerScrollYEvent:z,initialTable:B,destroy:U}=t,{elementStore:W,handleState:G,scrollYLoad:Y}=c.current,X=o().useRef(x);Ve((()=>{if(!i)return;const{onChange:e}=i;"radio"===i.type&&p.current.setClickedValues(g.length?[g[0],""]:[]),c.current.isHandleChange&&e?.(g,c.current.selectionRows),q(!0)}),[g]),Ve((()=>{if(!a)return;const{allTableData:e,allRowKeys:t}=c.current,{onChange:r}=a;r?.(b,b.map((r=>e[t.findIndex((e=>e===r))])))}),[b]),Ve((()=>{const{allTableData:e,allRowKeys:t}=c.current;C&&L(K()),l&&(p.current.setClickedValues(y?[y,""]:[]),l.onChange?.(y,e[t.findIndex((e=>e===y))]??null))}),[y]),Ve((()=>{(0,ne.isEqual)(x,X.current)||(X.current=x,E&&n&&n.onChange?.(x))}),[x]),Ve((()=>{const e=j(i.selectedRowKeys);(0,ne.isEqual)(e,g)||(k(e),C&&L(K()))}),[i?.selectedRowKeys]),Ve((()=>{const e=K(a.expandedRowKeys);(0,ne.isEqual)(e,b)||L(e)}),[a?.expandedRowKeys]),Ve((()=>{const{currentRowKey:e}=l;e!==y&&F(e??"")}),[l?.currentRowKey]),Ve((()=>{const{insert:e,remove:t}=G;e&&(S&&("after"===e?N():I()),O("","after"===e?1e5:0)),t&&f.current>R()&&N(),(e||t)&&P({insert:null,remove:!1})}),[f.total]),Ve((()=>{Y&&z(W.$tableBody.parentNode.parentNode.scrollTop)}),[Y]),Ve((()=>{D(m)}),[m]),Ve((()=>{M()}),[h]),Ve((()=>{_(s),p.current.forceUpdate()}),[s]),Ve((()=>{Y&&(e.height||e.maxHeight||v("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||v("Table","必须设置组件参数 `ellipsis`")),w&&(e.height||e.maxHeight||v("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[Y,w]);const Q=()=>{const{resizeState:e}=c.current,{winHeight:t}=e,r=window.innerHeight;r!==t&&(H(Object.assign({},e,{winHeight:r})),M())};o().useEffect((()=>(V({$toper:d.current,$table:u.current}),A(fe(r)),B(),_(s),window.addEventListener("resize",Q,!1),M(),T(),()=>{U(),window.removeEventListener("resize",Q),$(!0)})),[])})(e,{tableRef:I,topElementRef:E,tableElementRef:S,tableBodyRef:w,$size:x,scrollX:Oe,pagination:ue,selectionKeys:he,rowExpandedKeys:ge,highlightKey:ye,showSummary:et,summationRows:bt,isWebPagination:Ke,isScrollPagination:ze,isTreeTable:ft,checkDataIndex:Ft,toLastPage:Yt,toFirstPage:Xt,getPageCount:Qt,setHandleState:z,scrollYToRecord:Nt,setOriginColumns:O,setSelectionKeysEffect:Kt,setRowExpandedKeys:be,setHighlightKey:ve,setResizeState:V,setMergeCells:D,setPingRight:De,setUnMounted:Y,setHandleChange:X,calcTableHeight:Rt,createSelectionKeys:Mt,createRowExpandedKeys:jt,createElementStore:vt,triggerScrollYEvent:er,initialTable:Lt,destroy:sr});const cr=o().useMemo((()=>({getRowKey:N,tableRef:I,tableBodyRef:w,$size:x,flattenColumns:Ge,editableColumns:Ye,leftFixedColumns:Qe,rightFixedColumns:Ze,treeExpandIndex:Je,sorter:le,filters:ae,superFilters:ce,layout:Se,bordered:nt,showFooter:tt,showSummary:et,summationRows:bt,scrollX:Oe,scrollY:Ae,pagination:ue,fetchParams:yt,selectionKeys:he,rowExpandedKeys:ge,highlightKey:ye,updateMark:xe,isFetch:je,isPingLeft:Fe,isPingRight:_e,isHeadSorter:it,isHeadFilter:at,isFullScreen:$e,isTableEmpty:gt,isHeadGroup:rt,isTreeTable:ft,isGroupSubtotal:ht,isWebPagination:Ke,isDragMergeCell:mt,dataChange:Wt,tableChange:Gt,getTableData:_t,setElementStore:P,createTableFullData:Ht,updateTableData:Me,setSorter:se,setFilters:oe,setSuperFilters:de,setHighlightKey:ve,setRowExpandedKeys:be,setSelectionRows:U,setSelectionKeysEffect:Kt,setInvalidRowKeys:H,getSpan:Et,getStickyLeft:wt,getStickyRight:Ct,scrollXToColumn:Tt,scrollYToRecord:Nt,rowInViewport:It,setPagination:pe,setPingLeft:He,setPingRight:De,setSpinning:Pe,setFullScreen:qe,setShouldToTop:W,doFieldValidate:Bt,createTableData:$t,createGroupData:qt,findParentRowKeys:Vt,getAllChildRowKeys:zt,triggerScrollXEvent:Jt,triggerScrollYEvent:er,scrollBottomDebouncer:tr,resetTableScroll:Pt,clearTableSorter:rr,clearTableFilter:nr,clearSuperFilters:ir,clearRowSelection:ar,clearRowHighlight:or})),[x,Ge,Ye,Qe,Ze,Je,le,ae,ce,Se,nt,tt,et,bt,Oe,Ae,ue,yt,he,ge,ye,xe,je,Fe,_e,it,at,$e,gt,rt,ft,ht,Ke,mt]);((e,t)=>{const{getRowKey:r,tableRef:n,toolBoxRef:i,tableBodyRef:a,columnFilterRef:l,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:p,rowExpandedKeys:h,highlightKey:m,isFetch:f,dataChange:g,getTableData:b,handleTableData:y,createTableData:x,createTableFullData:E,calcTableHeight:S,scrollXToColumn:w,scrollYToRecord:C,doFieldValidate:T,setTableOriginData:N,setHandleState:I,setColumnsDefined:R,setSelectionKeysEffect:P,setRowExpandedKeys:O,setHighlightKey:k,setSelectionRows:A,setOriginColumns:L,setHandleChange:F,forceUpdate:H,getTableLog:_,clearRowSelection:D,clearRowHighlight:$,clearTableSorter:q,clearTableFilter:M,clearSuperFilters:j,clearTableLog:K}=t,{columns:V,columnsChange:z}=n.current.props,B=(e,t,n)=>e.filter((e=>{const i=r(e,e.index);e.children&&(e.children=B(e.children,t,n));const a=t.includes(i);return a&&n?.(e,i),!a}));o().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{S()},DO_REFRESH:async e=>{f&&(await b(),e?.())},GET_LOG:()=>_(),GET_FETCH_PARAMS:()=>{const e={};for(const t in u)Object.keys(d).includes(t)||(e[t]=u[t]);return e},CLEAR_TABLE_DATA:()=>{f||(D(),$(),q(),M(),j(),K(),x([]))},CLEAR_LOG:()=>{K()},CREATE_FOCUS:(e,t)=>{a.current.createFocus(e,t)},FORCE_UPDATE:()=>{H()},DO_EXPORT:()=>{i.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{w(e)},SET_SELECTION:function(e){!(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&!(0,ne.isEqual)(e,p)&&F(!1),P(e)},SET_HIGHLIGHT:e=>{k(e)},SET_EXPANDABLE:e=>{O(e)},SET_SELECTION_ROWS:e=>{A(e)},SET_TABLE_DATA:e=>{y(e)},DEFINE_INITIAL_COLUMNS:e=>{L(e),R(!0),l.current.initialHandler()},SET_TABLE_COLUMN:(e,t,r)=>{const n=zr(V,e);if(!n)return v("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,ne.isPlainObject)(t))return v("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(n.noAuth)return v("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,ne.set)(n,e,t[e]);r&&(z?z([...V]):v("Table","需要设置 `columnsChange` 参数"),H())},INSERT_RECORDS:(e,t)=>{const{store:i,tableFullData:a}=n.current,o=(Array.isArray(e)?e:[e]).filter((e=>(0,ne.isPlainObject)(e)));if(!o.length)return;o.forEach((e=>{s.forEach((t=>{const{dataIndex:r}=t;[es.expandableColumn,es.selectionColumn,es.operationColumn].includes(r)||tn(e,r,en(e,r))})),i.addToInserted(e)}));const l="before"===t?.mode,c=void 0===t?.parentRowKey,d=a;if(c)l?d.unshift(...o):d.push(...o);else{const e=bn(a,(e=>t.parentRowKey===r(e,e.index)));e&&(Array.isArray(e.children)?l?e.children.unshift(...o):e.children.push(...o):e.children=o)}x(d),c&&I(Object.assign({},n.current.handleState,{insert:l?"before":"after"})),H(),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:i}=n.current,a=(Array.isArray(e)?e:[e]).map((e=>(0,ne.isPlainObject)(e)?r(e,e.index):e));if(!a.length)return;let o=!1;const l=B(i,a,((e,r)=>{t.addToRemoved(e),c.forEach((n=>{const{dataIndex:i,editRender:a}=n,o=a?.(e,n);if(!o)return;const{rules:l=[],disabled:s}=o;!s&&l.length&&(t.removeFromRequired({x:r,y:i}),t.removeFromValidate({x:r,y:i}),t.removeFromEdited({x:r,y:i}))})),o=!0}));o&&(E(l),P(p.filter((e=>!a.includes(e)))),a.includes(m)&&$(),O(h.filter((e=>!a.includes(e)))),I(Object.assign({},n.current.handleState,{remove:!0})),g(),setTimeout((()=>{N(B(n.current.tableOriginData,a))})))},VALIDATE_FIELDS:(e,t)=>{n.current.allTableData.forEach((n=>{c.forEach((i=>{const{dataIndex:a,editRender:o}=i,l=o?.(n,i);if(!l)return;const s=r(n,n.index);if(e&&!e.includes(s))return;if(t&&!t.includes(a))return;const{rules:c=[],disabled:d}=l;!d&&c.length&&T(c,en(n,a),s,a)}))}));const{required:i,validate:a}=_(),o=[...i,...a];return o.length&&C(o[0].rowKey),H(),{required:i,validate:a}}})))})(t,{getRowKey:N,tableRef:I,toolBoxRef:C,tableBodyRef:w,columnFilterRef:T,flattenColumns:Ge,editableColumns:Ye,pagination:ue,fetchParams:yt,selectionKeys:he,rowExpandedKeys:ge,highlightKey:ye,isFetch:je,dataChange:Wt,getTableData:_t,handleTableData:Dt,createTableData:$t,createTableFullData:Ht,calcTableHeight:Rt,scrollXToColumn:Tt,scrollYToRecord:Nt,doFieldValidate:Bt,setTableOriginData:A,setHandleState:z,setColumnsDefined:$,setSelectionKeysEffect:Kt,setRowExpandedKeys:be,setHighlightKey:ve,setSelectionRows:U,setOriginColumns:O,setHandleChange:X,forceUpdate:Ee,getTableLog:Ut,clearRowSelection:ar,clearRowHighlight:or,clearTableSorter:rr,clearTableFilter:nr,clearSuperFilters:ir,clearTableLog:lr}),o().useEffect((()=>{Ql.register(I.current.uid,t??{current:null})}),[]);const dr=Ie("table"),ur={[`${dr}--wrapper`]:!0,[`${dr}--lg`]:"large"===x,[`${dr}--sm`]:"small"===x,[`${dr}--maximize`]:$e,[l]:!!l},pr={[dr]:!0,"is--border":nt,"is--fixed":Qe.length||Ze.length,"is--sortable":it,"is--filterable":at,"is--head-group":rt,"is--merge-cell":mt,"is--ping-left":Fe,"is--ping-right":_e};return o().createElement(Ml.Provider,{value:cr},o().createElement("div",{className:Ne()(ur)},h&&o().createElement("div",{ref:E,className:`${dr}-top`},o().createElement("div",{className:`${dr}-top__space`},"bottom"!==u?.position&&o().createElement(ds,{total:ue.total}),o().createElement("div",{className:`${dr}-top__space-slot`,style:{justifyContent:Yl[p]}},e.children)),o().createElement("div",{className:`${dr}-top__actions`},o().createElement(nc,{ref:C,showFullScreen:m,showReload:f&&je,showPrint:Ce.print&&!!s,showImport:Ce.import&&st,showExport:Ce.export&&!!d,showClipboard:ct,showCollection:lt,showFastSearch:ut,showSuperSearch:dt,showGroupSummary:pt,showToolBox:g,tableColumns:We}),o().createElement(oc,{ref:T,columns:n}))),o().createElement(St,{spinning:i??Re},o().createElement("div",{ref:S,className:Ne()(pr),style:xt},o().createElement("div",{className:`${dr}--main-wrapper`},b&&o().createElement(fc,{tableColumns:We,sorter:le,filters:ae}),o().createElement(_c,{ref:w,tableFlatColumns:te,tableData:J}),tt&&o().createElement(Dc,{summationRows:bt})),nt&&o().createElement("div",{className:`${dr}--border-line`}),gt&&o().createElement(Mc,null),a&&o().createElement(jc,null))),Be&&o().createElement(qc,Kc({},ue,{onChange:(e,t)=>Zt({current:e,pageSize:t})}))))}));Vc.defaultProps={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},Vc.displayName="QmTable";const zc=Vc,Bc=zc;function Uc(){return Uc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Uc.apply(this,arguments)}const Wc=e=>{const{uniqueKey:t,multiple:r,initialValue:n,selectionRows:i,defaultSelectedKeys:a=[],filters:l=[],table:s={},className:d,style:u,onClose:p}=e,{size:h}=o().useContext(c),m=o().useMemo((()=>e.size??h??""),[e.size,h]),g=o().useRef(null),b=o().useRef(null),y=o().useRef(null),v=Pt(g),[x,E]=o().useState(s),[S,w]=o().useState(),[C,T]=o().useState(a),[N,I]=o().useState(!1),[R,P]=o().useState(300),[O,k]=o().useState(l),[A,L]=o().useState([{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>o().createElement("span",null,e+1)},...s.columns||[]]),[F,H]=o().useState((0,ne.merge)({},s.fetch?.params,n)),[_,D]=o().useState([]),$=()=>{const e=g.current,t=e.querySelector(".form-wrap");P(e.offsetHeight-t.offsetHeight-2*Di[m]-30)},q=At($,5);kt((()=>{q()}),[v.width]),Ve((()=>{(0,ne.isEqual)(l,O)||k(l)}),[l]),o().useEffect((()=>{M()}),[F]),o().useEffect((()=>{i&&y.current.SET_SELECTION_ROWS(i)}),[i]),o().useEffect((()=>{n&&b.current?.SET_FIELDS_VALUE(n)}),[]);const M=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:n,dataKey:i,beforeFetch:a=se}=t;if(a(F)){I(!0);try{const e=await n(F);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,i)??[];r||(T([]),await ce(0)),D(t)}}catch(e){}I(!1)}},j=e=>{r||(w(e),p(e))},K=e=>{H(Object.assign({},F,e))},V=Ie("search-helper"),z={[`${V}--wrapper`]:!0},B=x.webPagination?{dataSource:_,loading:N,webPagination:!0}:{fetch:{...x.fetch,params:F}};return o().createElement("div",{ref:g,className:Ne()(z,d),style:u},o().createElement("div",{className:"form-wrap"},O.length?o().createElement(Xo,{ref:b,items:O,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(e),onCollapse:()=>$(),onFinish:e=>K(e),onReset:async()=>{const[e,t]=await b.current.GET_FORM_DATA();e||K(t)}}):null),o().createElement("div",null,o().createElement(Bc,Uc({ref:y,uniqueKey:t,height:R,columns:A,rowKey:x.rowKey||"pageIndex"},B,{rowSelection:{type:r?"checkbox":"radio",clearableAfterFetched:!r,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:C,onChange:(e,t)=>{T(e),w(r?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>L(e),onRowDblclick:j,onRowEnter:j}))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Di[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(xe,{onClick:()=>p(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(xe,{type:"primary",disabled:!S,onClick:()=>p(S,r?C:void 0)},f("qm.dialog.confirm"))))};Wc.displayName="SearchHelper";const Gc=Wc;function Yc(){return Yc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yc.apply(this,arguments)}const Xc=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Xc(e.children)),e.children&&t.push(e.value)})),t},Qc=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=Qc(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},Zc=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Zc(e.children,t),t(e)||e.children&&e.children.length))),Jc=e=>{const{uniqueKey:t,multiple:r,initialValue:n,selectionRows:i,defaultSelectedKeys:a=[],filters:l=[],table:s={},tree:d={},className:u,style:p,onClose:h}=e,{size:m}=o().useContext(c),g=o().useMemo((()=>e.size??m??""),[e.size,m]),b=o().useRef(null),y=o().useRef(null),x=o().useRef(null),E=Pt(b),[S,w]=o().useState(s),[C,T]=o().useState(),[N,I]=o().useState(a),[R,P]=o().useState(!1),[O,k]=o().useState(300),[A,F]=o().useState(300),[H,_]=o().useState(l),[D,$]=o().useState([{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>o().createElement("span",null,e+1)},...s.columns||[]]),[q,M]=o().useState((0,ne.merge)({},s.fetch?.params,n)),[j,K]=o().useState([]),V=()=>{const e=b.current,t=e.querySelector(".form-wrap"),r=e.querySelector(".input-wrap");k(e.offsetHeight-r.offsetHeight-10),F(e.offsetHeight-t.offsetHeight-2*Di[g]-30)},z=At(V,5);kt((()=>{z()}),[E.width]),Ve((()=>{(0,ne.isEqual)(l,H)||_(l)}),[l]),o().useEffect((()=>{B()}),[q]),o().useEffect((()=>{i&&x.current.SET_SELECTION_ROWS(i)}),[i]),o().useEffect((()=>{n&&y.current?.SET_FIELDS_VALUE(n),re()}),[]);const B=async()=>{const{webPagination:e,fetch:t}=S;if(!e||!t?.api)return;const{api:n,dataKey:i,beforeFetch:a=se}=t;if(a(q)){P(!0);try{const e=await n(q);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,i)??[];r||(I([]),await ce(0)),K(t)}}catch(e){}P(!1)}},U=e=>{r||(T(e),h(e))},W=e=>{M(Object.assign({},q,e))},[G,Y]=o().useState([]),[X,Q]=o().useState([]),[Z,J]=o().useState(""),ee=o().useRef(G),te=o().useRef([]);Ve((()=>{Q(Xc(G))}),[G]);const re=async()=>{if(!d.fetch)return;const{api:e,params:t,dataKey:r,valueKey:n="value",textKey:i="text"}=d.fetch;try{const a=await e(t);if(200===a.code){const e=Array.isArray(a.data)?a.data:(0,ne.get)(a.data,r)??[],t=Dn(e,n,i);Y(t),ee.current=t,te.current=e}}catch(e){}},ie=e=>`${e}|${ri.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ae=Ie("tree-table-helper"),oe={[`${ae}--wrapper`]:!0},le=S.webPagination?{dataSource:j,loading:R,webPagination:!0}:{fetch:{...S.fetch,params:q}};return o().createElement("div",{ref:b,className:Ne()(oe,u),style:p},o().createElement(lt,{defaultValue:200,style:{height:"100%"}},o().createElement(lt.Pane,{min:100,style:{overflowY:"auto"}},o().createElement(L.Input.Search,{className:"input-wrap",value:Z,style:{marginBottom:8},placeholder:f("qm.form.inputPlaceholder"),allowClear:!0,onChange:e=>(e=>{const t=Zc(ee.current,(t=>{if(!e)return!0;const r=t.text||"";return-1!==ie(r).indexOf(e)}));J(e),Y(t)})(e.target.value)}),o().createElement(L.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:O,defaultExpandAll:!0,expandedKeys:X,treeData:G,filterTreeNode:e=>{if(!Z)return!1;const t=e.text||"";return-1!==ie(t).indexOf(Z)},onExpand:e=>{Q(e)},onSelect:e=>{const{valueKey:t="value"}=d.fetch;(e=>{if(!d.tableParamsMap)return v("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,r={};for(const n in t)r[n]=(0,ne.get)(e,t[n]);W(r)})(Qc(te.current,(r=>(0,ne.get)(r,t)===e[0]))||{})}})),o().createElement(lt.Pane,{className:"split-pane"},o().createElement("div",{className:"form-wrap"},H.length?o().createElement(Xo,{ref:y,items:H,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>_(e),onCollapse:()=>V(),onFinish:e=>W(e),onReset:async()=>{const[e,t]=await y.current.GET_FORM_DATA();e||W(t)}}):null),o().createElement("div",null,o().createElement(Bc,Yc({ref:x,uniqueKey:t,height:A,columns:D,rowKey:S.rowKey||"pageIndex"},le,{rowSelection:{type:r?"checkbox":"radio",clearableAfterFetched:!r,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:N,onChange:(e,t)=>{I(e),T(r?t:t[0])}},paginationConfig:S.paginationConfig,columnsChange:e=>$(e),onRowDblclick:U,onRowEnter:U}))))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Di[g]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(xe,{onClick:()=>h(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(xe,{type:"primary",disabled:!C,onClick:()=>h(C,r?N:void 0)},f("qm.dialog.confirm"))))};Jc.displayName="TreeTableHelper";const ed=Jc,td=e=>{const{multiple:t,tree:r={},defaultSelectedKeys:n,className:i,style:a,onClose:l}=e,{size:s}=o().useContext(c),d=o().useMemo((()=>e.size??s??""),[e.size,s]),[u,p]=o().useState(),[h]=o().useState(r.fetch?.params),m=Ie("tree-helper"),g={[`${m}--wrapper`]:!0},b=r.fetch?{...re()(r.fetch,["params","valueKey","textKey"]),params:h}:void 0;return o().createElement("div",{className:Ne()(g,i),style:a},o().createElement(ql,{multiple:t,fetch:b,fieldsDefine:{valueKey:r.fetch?.valueKey,textKey:r.fetch?.textKey},asyncLoad:r.asyncLoad,checkStrictly:r.checkStrictly,checkStrategy:r.checkStrategy,defaultSelectedKeys:n,defaultExpandAll:r.defaultExpandAll,onSelectChange:e=>p(e),onCheckChange:e=>p(e)}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Di[d]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(xe,{onClick:()=>l(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(xe,{type:"primary",disabled:!u,onClick:()=>l(u)},f("qm.dialog.confirm"))))};td.displayName="TreeHelper";const rd=td;function nd(){return nd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},nd.apply(this,arguments)}const id="_startSign",ad="_endSign",od=e=>{const{uniqueKey:t,initialValue:r,filters:n=[],table:i={},onClose:a}=e,{size:l}=o().useContext(c),s=o().useMemo((()=>e.size??l??""),[e.size,l]),d=o().useRef(null),u=o().useRef(null),p=o().useRef(null),h=Pt(d),[m,g]=o().useState(i),[b,y]=o().useState(!1),[v,x]=o().useState([]),[E,S]=o().useState(300),[w,C]=o().useState(n),[T,N]=o().useState([{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>o().createElement("span",null,e+1)},{title:f("qm.form.rangeSearchHelper")[0],dataIndex:id,width:80,align:"right",render:(e,t)=>o().createElement("span",{className:"icon-sign"},e)},...i.columns||[],{title:f("qm.form.rangeSearchHelper")[1],dataIndex:ad,fixed:"right",width:80,render:(e,t)=>o().createElement("span",{className:"icon-sign"},e)}]),[I,R]=o().useState((0,ne.merge)({},i.fetch?.params,r)),[P,O]=o().useState([]),k=o().useMemo((()=>v.map((e=>e?.pageIndex))),[v]),A=o().useMemo((()=>2===k.length&&k.every((e=>void 0!==e))),[k]),F=()=>{const e=d.current.parentNode.children[0],t=e.querySelector(".form-wrap");S(e.offsetHeight-t.offsetHeight-2*Di[s]-30)},H=At(F,5);kt((()=>{H()}),[h.width]),Ve((()=>{(0,ne.isEqual)(n,w)||C(n)}),[n]),o().useEffect((()=>{_()}),[I]);const _=async()=>{const{webPagination:e,fetch:t}=m;if(!e||!t?.api)return;const{api:r,dataKey:n,beforeFetch:i=se}=t;if(i(I)){y(!0);try{const e=await r(I);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,ne.get)(e.data,n)??[];O(t)}}catch(e){}y(!1)}},D=(e,t)=>{delete e[t]},$=()=>{v.forEach((e=>{e&&(D(e,id),D(e,ad))})),x([])},q=e=>{$(),R(Object.assign({},I,e))},M=Ie("range-helper"),j=m.webPagination?{dataSource:P,loading:b,webPagination:!0}:{fetch:{...m.fetch,params:I}};return o().createElement("div",{ref:d,className:`${M}--wrapper`},o().createElement("div",{className:"form-wrap"},w.length?o().createElement(Xo,{ref:u,items:w,initialValues:r,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>C(e),onCollapse:()=>F(),onFinish:e=>q(e),onReset:async()=>{const[e,t]=await u.current.GET_FORM_DATA();e||q(t)}}):null),o().createElement("div",null,o().createElement(Bc,nd({ref:p,height:E,columns:T,rowKey:m.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=k[0]&&e.pageIndex<=k[1]?{backgroundColor:"#f5f5f5"}:{}},j,{columnsChange:e=>N(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;[id,ad].includes(r)&&(r===id&&(e[r]?(D(e,r),x([void 0,v[1]])):e.pageIndex>k[1]?L.message.warning(f("qm.searchHelper.rangeStartTip")):(v[0]&&D(v[0],r),e[r]="[",x([e,v[1]]))),r===ad&&(e[r]?(D(e,r),x([v[0],void 0])):e.pageIndex<k[0]?L.message.warning(f("qm.searchHelper.rangeEndTip")):(v[1]&&D(v[1],r),e[r]="]",x([v[0],e]))),p.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===k[0]&&(e[id]="["),e.pageIndex===k[1]&&(e[ad]="]")}))}}),o().createElement(xe,{type:"primary",icon:o().createElement(Re.ClearOutlined,null),title:f("qm.table.alert.clear"),onClick:()=>$()}))),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Di[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},o().createElement(xe,{onClick:()=>a(null),style:{marginRight:8}},f("qm.dialog.cancel")),o().createElement(xe,{type:"primary",disabled:!A,onClick:()=>a(v.map((e=>(e=>{const t={};for(const r in e)[id,ad].includes(r)||(t[r]=e[r]);return t})(e))))},f("qm.dialog.confirm"))))};od.displayName="RangeTableHelper";const ld=od,sd=e=>null!=e;function cd(e,t,r,n){const[i,a]=o().useState(void 0);o().useLayoutEffect((()=>{const t="function"==typeof e?e():e;a(t||null)}));const[l,s]=o().useState(null),c=ls((()=>{if(i){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,{top:n,right:i,bottom:a,left:o}=e.getBoundingClientRect();return n>=0&&o>=0&&i<=t&&a<=r})(i)&&t&&i.scrollIntoView(n);const{left:e,top:r,width:a,height:o}=i.getBoundingClientRect(),l={left:e,top:r,width:a,height:o,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(l)?l:e))}else s(null)}));return o().useLayoutEffect((()=>(c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)})),[i,t,c]),[o().useMemo((()=>{if(!l)return l;const e=r?.offset||6,t=r?.radius||2;return{left:l.left-e,top:l.top-e,width:l.width+2*e,height:l.height+2*e,radius:t}}),[l,r]),i]}function dd(e){return void 0!==e}function ud(e,t){const{defaultValue:r,value:n,onChange:i,postState:o}=t||{},[l,s]=a.useState((()=>dd(n)?n:dd(r)?"function"==typeof r?r():r:"function"==typeof e?e():e)),c=dd(n)?n:l,d=o?o(c):c,u=ls(i),[p,h]=a.useState([c]);return kt((()=>{const e=p[0];l!==e&&u(l,e)}),[p]),kt((()=>{dd(n)||s(n)}),[n]),[d,ls((e=>{s(e),h([c])}))]}const pd={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},hd={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"]}},md=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function fd(e){const{arrowWidth:t,autoAdjustOverflow:r,arrowPointAtCenter:n,offset:i,borderRadius:a,visibleFirst:o}=e,l=t/2,s={};return Object.keys(pd).forEach((e=>{const c={...n&&hd[e]||pd[e],offset:[0,0],dynamicInset:!0};switch(s[e]=c,md.has(e)&&(c.autoArrow=!1),e){case"top":case"topLeft":case"topRight":c.offset[1]=-l-i;break;case"bottom":case"bottomLeft":case"bottomRight":c.offset[1]=l+i;break;case"left":case"leftTop":case"leftBottom":c.offset[0]=-l-i;break;case"right":case"rightTop":case"rightBottom":c.offset[0]=l+i}const d=function(e){const{contentRadius:t,limitVerticalRadius:r}=e,n=t>12?t+2:12;return{arrowOffsetHorizontal:n,arrowOffsetVertical:r?8:n}}({contentRadius:a,limitVerticalRadius:!0});if(n)switch(e){case"topLeft":case"bottomLeft":c.offset[0]=-d.arrowOffsetHorizontal-l;break;case"topRight":case"bottomRight":c.offset[0]=d.arrowOffsetHorizontal+l;break;case"leftTop":case"rightTop":c.offset[1]=-d.arrowOffsetHorizontal-l;break;case"leftBottom":case"rightBottom":c.offset[1]=d.arrowOffsetHorizontal+l}c.overflow=function(e,t,r,n){if(!1===n)return{adjustX:!1,adjustY:!1};const i=n&&"object"==typeof n?n:{},a={};switch(e){case"top":case"bottom":a.shiftX=2*t.arrowOffsetHorizontal+r,a.shiftY=!0,a.adjustY=!0;break;case"left":case"right":a.shiftY=2*t.arrowOffsetVertical+r,a.shiftX=!0,a.adjustX=!0}const o={...a,...i};return o.shiftX||(o.adjustX=!0),o.shiftY||(o.adjustY=!0),o}(e,d,t,r),o&&(c.htmlRegion="visibleFirst")})),s}const gd=require("@rc-component/portal");var bd=n.n(gd);const yd=require("@rc-component/trigger");var vd=n.n(yd);const xd=require("rc-util/lib/hooks/useId");var Ed=n.n(xd);function Sd(){return Sd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Sd.apply(this,arguments)}const wd={fill:"transparent",pointerEvents:"auto"},Cd=e=>{const{prefixCls:t,rootClassName:r,pos:n,showMask:i,style:a={},fill:l="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${t}-mask-${Ed()()}`,p="object"==typeof c?c?.placeholder:c;return o().createElement(bd(),{open:s,autoLock:!0},o().createElement("div",{className:Ne()(`${t}-mask`,r),style:{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none",...a}},i?o().createElement("svg",{style:{width:"100%",height:"100%"}},o().createElement("defs",null,o().createElement("mask",{id:u},o().createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),n&&o().createElement("rect",{x:n.left,y:n.top,rx:n.radius,width:n.width,height:n.height,fill:"black",className:p?`${t}-placeholder-animated`:""}))),o().createElement("rect",Sd({},n?null:wd,{x:"0",y:"0",width:"100%",height:"100%",fill:l,mask:`url(#${u})`})),n&&o().createElement(o().Fragment,null,o().createElement("rect",Sd({},wd,{x:"0",y:"0",width:"100%",height:`${n.top}px`})),o().createElement("rect",Sd({},wd,{x:"0",y:"0",width:n.left,height:"100%"})),o().createElement("rect",Sd({},wd,{x:"0",y:n.top+n.height,width:"100%",height:`calc(100vh - ${n.top+n.height}px)`})),o().createElement("rect",Sd({},wd,{x:n.left+n.width,y:"0",width:`calc(100vw - ${n.left+n.width}px)`,height:"100%"})))):null))},Td=e=>{const{prefixCls:t,zIndex:r,open:n,onPause:i,onPlay:a}=e,[l,s]=ud(void 0,{value:n,postState:e=>e??!0}),c=o().useRef(null),d=o().useRef(!1),u=ls((e=>{p(e),e.shiftKey&&32===e.keyCode&&h()}));o().useEffect((()=>{const e=Xt()(document,"keyup",u);return()=>e.remove()}),[]);const p=e=>{e.stopPropagation(),e.preventDefault()},h=()=>{d.current?d.current=!1:(s(!l),l?i?.():a?.())};return o().createElement("div",{ref:c,className:`${t}-control`,style:{zIndex:r+1},onMouseDown:e=>{p(e);const t=c.current,r=t.offsetWidth,n=t.offsetHeight,i=window.innerWidth,a=window.innerHeight,o=e.clientX-Ze(t).x,l=e.clientY-Ze(t).y;return document.onmousemove=e=>{let s=e.clientX-o,c=e.clientY-l;s<0&&(s=0),s>i-r-1&&(s=i-r-1),c<0&&(c=0),c>a-n-1&&(c=a-n-1),Ye(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>h()},l?o().createElement(Re.PauseOutlined,null):o().createElement(Re.CaretRightOutlined,null))},Nd=e=>{const{prefixCls:t,current:r,total:n=0,cover:i,title:a,description:l,helper:s={},type:c,zIndex:d,onClose:u,onPrev:p,onNext:h,onFinish:m,className:f,indicatorsRender:g}=e,{t:b}=yc(),y="primary"!==c?"primary":"default",v=ls((e=>{w(e),40===e.keyCode&&(r<n-1?h?.():m?.()),38===e.keyCode&&r>0&&p?.()}));o().useEffect((()=>{const e=Xt()(document,"keyup",v);return()=>e.remove()}),[]);const x=sd(i)?o().createElement("div",{className:`${t}-cover`},i):null,E=sd(l)?o().createElement("div",{className:`${t}-description`},l):null;let S;S=g?g(r,n):[...Array.from({length:n}).keys()].map(((e,n)=>o().createElement("span",{key:e,className:Ne()(n===r&&`${t}-indicator-active`,`${t}-indicator`)})));const w=e=>{e.stopPropagation(),e.preventDefault()};return o().createElement("div",{className:Ne()(`${t}-content`,f)},o().createElement("div",{className:`${t}-inner`},o().createElement(Re.CloseOutlined,{className:`${t}-close`,onClick:u}),s.content&&o().createElement(L.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},o().createElement(Re.QuestionCircleOutlined,{className:Ne()(`${t}-close`,"help-icon")})),x,o().createElement("div",{className:`${t}-header`},o().createElement("div",{className:`${t}-title`},a)),E,o().createElement("div",{className:`${t}-footer`},n>1&&o().createElement("div",{className:`${t}-indicators`},S),o().createElement(Ce,{className:`${t}-buttons`},0!==r?o().createElement(xe,{className:`${t}-prev-btn`,size:"small",onMouseDown:w,onClick:p},b("qm.tour.prevStep")):null,r===n-1?o().createElement(xe,{className:`${t}-finish-btn`,type:y,size:"small",onClick:m},b("qm.tour.finish")):o().createElement(xe,{className:`${t}-next-btn`,type:y,size:"small",onMouseDown:w,onClick:h},b("qm.tour.nextStep"))))))},Id=e=>{const{current:t,renderPanel:r}=e;return o().createElement(o().Fragment,null,"function"==typeof r?r(e,t):o().createElement(Nd,e))};function Rd(){return Rd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Rd.apply(this,arguments)}const Pd={left:"50%",top:"50%",width:1,height:1},Od=o().forwardRef(((e,t)=>{const{steps:r=[],defaultCurrent:n,current:i,onChange:a,onClose:l,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:p=!0,control:h=!0,overlayClassName:m,overlayStyle:f,placement:g,helper:b,zIndex:y,renderPanel:v,indicatorsRender:x,gap:E,animated:S=!0,scrollIntoViewOptions:w=!0,...C}=e,T=o().useRef(),[N,I]=ud(0,{value:i,defaultValue:n}),[R,P]=ud(void 0,{value:c,postState:e=>!(N<0||N>=r.length)&&(e??!1)}),[O,k]=ud(1051,{value:y,defaultValue:y}),[A,L]=o().useState(),F=o().useRef(R);o().useLayoutEffect((()=>{R&&!F.current&&I(0),F.current=R,L(R)}),[R]),o().useImperativeHandle(t,(()=>({OPEN:()=>P(!0),CLOSE:()=>P(!1),SET_ZINDEX:e=>k(e)})));const{target:H,type:_,placement:D,trigger:$,delay:q,style:M,arrow:j,className:K,mask:V,scrollIntoViewOptions:z,zIndex:B,action:U}=r[N]||{},W=B||O,G=_||d,Y=R&&(V??u),X=z??w,[Q,Z]=cd(H,!!c,E,X),J=((e,t,r)=>r??t??(null===e?"center":"bottom"))(Z,g,D),ee=!!Z&&(void 0===j?p:j),te="object"==typeof ee&&ee.pointAtCenter;o().useLayoutEffect((()=>{T.current?.forceAlign()}),[te,N]),Ve((()=>{R&&(ie(),U?.(Z,N))}),[R,Z]);const re=e=>{I(e),a?.(e)},ne=()=>{P(!1),l?.(N)},ie=()=>{if(!Z)return;const e=[];!function t(r){if(1===r.nodeType){var n;"INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName||"none"===Ge(n=r,"display")||"hidden"===Ge(n,"visibility")||"0"===Ge(n,"opacity")||e.push(r);for(const e of Array.from(r.childNodes))t(e)}}(Z),e.length&&e[0].focus()};if(void 0===Z)return null;const ae=async()=>{if(!$||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),r=Z.offsetWidth,n=Z.offsetHeight,[i,a]=[e+r/2,t+n/2],o=new MouseEvent($,{bubbles:!0,cancelable:!0,button:0,clientX:i,clientY:a}),l=document.elementFromPoint(i,a);l&&(l.dispatchEvent(o),await ce(q??320))},oe="boolean"==typeof Y?Y:!!Y,le="boolean"==typeof Y?void 0:Y,se=Object.assign({},f,M),de=Ie("tour"),ue=[{[`${de}-primary`]:"primary"===G},m,K],pe=fd({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return o().createElement(o().Fragment,null,o().createElement(Cd,{zIndex:W,prefixCls:de,pos:Q,showMask:oe,style:le?.style,fill:le?.color,open:A,animated:S,rootClassName:m}),o().createElement(vd(),Rd({ref:T},C,{zIndex:W,builtinPlacements:pe,popupStyle:se,popupPlacement:J,popupVisible:A,popupClassName:Ne()(ue),prefixCls:de,popup:()=>o().createElement(Id,Rd({key:"content",arrow:ee,prefixCls:de,total:r.length,helper:b,renderPanel:v,indicatorsRender:x,onPrev:async()=>{await ae(),re(N-1)},onNext:async()=>{await ae(),re(N+1)},onClose:ne,current:N,onFinish:()=>{ne(),s?.()}},Object.assign({},r[N],{zIndex:W,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Z||document.body,forceRender:!1,destroyPopupOnHide:!0}),o().createElement(bd(),{open:A,autoLock:!0},o().createElement("div",{className:Ne()(m,`${de}-target-placeholder`),style:{...Q||Pd,position:"fixed",pointerEvents:"none"}}))),h&&o().createElement(bd(),{open:R},o().createElement(Td,{zIndex:W,prefixCls:de,onPause:()=>L(!1),onPlay:()=>L(!0)})))}));Od.displayName="QmTour";const kd=Od,Ad=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],Ld=e=>({_s:e,status:Ad[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),Fd=e=>e?6:5,Hd=(e,t,r,n,i)=>{clearTimeout(n.current);const a=Ld(e);t(a),r.current=a,i?.({current:a})},_d=e=>{const{name:t,in:r,timeout:n,preEnter:i=!0,preExit:l}=e,[s,c]=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enter:t=!0,exit:r=!0,preEnter:n,preExit:i,timeout:o,initialEntered:l,mountOnEnter:s,unmountOnExit:c,onStateChange:d}=e||{},[u,p]=(0,a.useState)((()=>Ld(l?2:Fd(s)))),h=(0,a.useRef)(u),m=(0,a.useRef)(),[f,g]=(e=>(0,ne.isPlainObject)(e)?[e.enter,e.exit]:[e,e])(o),b=(0,a.useCallback)((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return Fd(t)}})(h.current._s,c);e&&Hd(e,p,h,m,d)}),[d,c]),y=(0,a.useCallback)((e=>{const a=e=>{switch(Hd(e,p,h,m,d),e){case 1:f>=0&&(m.current=setTimeout(b,f));break;case 4:g>=0&&(m.current=setTimeout(b,g));break;case 0:case 3:m.current=setTimeout((()=>a(e+1)),0)}},o=h.current.isEnter;"boolean"!=typeof e&&(e=!o),e?!o&&a(t?n?0:1:2):o&&a(r?i?3:4:Fd(c))}),[b,d,t,r,n,i,f,g,c]);return(0,a.useEffect)((()=>()=>clearTimeout(m.current)),[]),[u,y,b]}({timeout:n,preEnter:i,preExit:l,initialEntered:r});return kt((()=>{c()}),[r]),o().createElement(o().Fragment,null,o().Children.map(e.children,(e=>o().isValidElement(e)?Pc(e,{className:Ne()(e.props.className,t,s.status)}):e)))},Dd={previewWidth:1100,defaultDistance:.45,logoHeight:60},$d=(0,a.createContext)(void 0);var qd=null;function Md(){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),r=e.match(/MSIE\D?\d+/i),n=e.match(/OPR\D?\d+/i),i=e.match(/Firefox\D?\d+/i),a=e.match(/x64/i);if(!t&&!r&&a)return!0;if(i){if((i=i[0].match(/\d+/))[0]>=41||a)return!0}else if(n){if((n=n[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!r){var o=e.match(/Chrome\D?\d+/i);if(o&&(o=o[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function jd(e,t){var r;try{var n=navigator.userAgent,i=!!n.match(/MSIE/i)||!!n.match(/Trident/i);if(Md()){try{r=getCLodop()}catch(e){}if(!r&&"complete"!==document.readyState)return void L.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!r)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(i&&n.match(/x64/i),e||t?r=i?e:t:qd?r=qd:((r=document.createElement("object")).setAttribute("width",0),r.setAttribute("height",0),r.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),i?r.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):r.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(r),qd=r),!r||!r.VERSION)return n.indexOf("Chrome"),n.indexOf("Firefox"),r;return r.VERSION<"6.2.2.6"&&Md(),r}catch(e){L.message.error("getLodop 出错:"+e)}}Md();const Kd=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:r}=window.screen;if(t&&r)e[0]=t,e[1]=r;else{let t=document.createElement("DIV");t.style.cssText="width: 1in; height: 1in; position: absolute; left: 0px; top: 0px; z-index: -1; visibility: hidden;",document.body.appendChild(t),e[0]=parseInt(t.offsetWidth.toString()),e[1]=parseInt(t.offsetHeight.toString()),t.parentNode?.removeChild(t),t=null}return e})()[0];return Math.ceil(t)},Vd=o().forwardRef(((e,t)=>{const{templateRender:r,directPrint:n}=e,{global:i}=o().useContext(c),{$$preview:a}=o().useContext($d),{state:l,isWindowsPrinter:s,pageSize:d}=a,u=o().useRef(null),p=o().useRef({}),h=o().useRef([]),m=o().useRef([]),f=o().useRef([]),[g,b]=o().useState(!0);o().useImperativeHandle(t,(()=>({createPreviewDom:k,createExportHtml:L,createPrintHtml:A,SHOW_PREVIEW:F,DIRECT_PRINT:H}))),Ve((()=>{O()}),[l.form.printerType,l.form.setting.direction,l.form.setting.distance,l.form.setting.fixedLogo]),o().useEffect((()=>{p.current.templateEl=u.current.querySelector(".origin-template").children[0],p.current.previewEl=u.current.querySelector(".workspace")}),[]);const y=o().useMemo((()=>{const{form:{setting:{direction:e}}}=l,t=s?10*Dd.defaultDistance+10*Dd.defaultDistance:0;return("vertical"===e?d[0]:d[1])-t}),[l,s,d]),x=o().useMemo((()=>{const{form:{setting:{direction:e}}}=l,t=s?10*Dd.defaultDistance+10*Dd.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[l,s,d]),E=o().useMemo((()=>{const{form:{setting:{distance:e}}}=l;return Kd(y-10*(e.left-Dd.defaultDistance)-10*(e.right-Dd.defaultDistance))}),[l,y]),S=o().useMemo((()=>{const{form:{setting:{distance:e}}}=l;return Kd(x-10*(e.top-Dd.defaultDistance)-10*(e.bottom-Dd.defaultDistance))}),[l,x]),w=l.form.scale,C=o().useMemo((()=>{const{form:{setting:{distance:e}}}=l;return{left:Kd(10*e.left),right:Kd(10*e.right),top:Kd(10*e.top),bottom:Kd(10*e.bottom)}}),[l]),T=o().useMemo((()=>{const{form:{printerType:e}}=l,{left:t,right:r,top:n,bottom:i}=C,a=E+t+r,o=Dd.previewWidth-a<=0?0:(Dd.previewWidth-a)/2,s=Math.abs((1-w)*a/2);let c=0;return w>1&&(c=s>o?-1*o:-1*s),w<1&&(c=a-2*s>Dd.previewWidth?0:o>0?s:(Dd.previewWidth-(a-2*s))/2),{width:`${E}px`,height:"stylus"===e?"auto":S+"px",paddingLeft:`${t}px`,paddingRight:`${r}px`,paddingTop:`${n}px`,paddingBottom:`${i}px`,transform:`translateX(${c}px) scale(${w})`,opacity:g?0:1}}),[l,g,C,w,S,E]),N=(h.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{const e=i?.print?.leftLogo??"",t=i?.print?.rightLogo??"";return[`<tr style="height: ${Dd.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',e?`<img src="${e}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',t?`<img src="${t}" border="0" height="46" />`:"","</td>","</tr>"].join("")}),I=()=>{let e='<tr style="height: 0;">';for(let t=0;t<24;t++)e+=`<td width="${100/24}%" style="width: ${100/24}%; padding: 0;"></td>`;return e+="</tr>",e},R=()=>{let e=document.createElement("tr");var t,r;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=I().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(r=p.current.templateEl.children[0]).children[0]?r.insertBefore(t,r.children[0]):r.appendChild(t),e=null},P=()=>{const e=p.current.templateEl.children[0].children,t=[],r=[];for(let n=0;n<e.length;n++){if("template-cols"===e[n].getAttribute("type"))continue;const i=e[n].clientHeight;e[n].style.height=i+"px",r.push(i),t.push(e[n].outerHTML)}m.current=r,h.current=t},O=()=>{if(!h.current.length)return;const{form:{setting:e,printerType:t}}=l;if(n)return f.current.push([I(),N(),...h.current]);const r=e.fixedLogo?S-Dd.logoHeight:S;let i=[];if(f.current=[],"stylus"===t)f.current.push([I(),...e.fixedLogo?[N()]:[],...h.current]);else{let t=0;for(let n=0,a=m.current.length;n<a;n++){const o=h.current[n],l=m.current[n];e.fixedLogo||0!==n||(t+=Dd.logoHeight),t+=l,t<=r?i.push(o):(f.current.push([I(),...e.fixedLogo?[N()]:[],...i]),i=[],t=0,n-=1),n===a-1&&i.length&&f.current.push([I(),...e.fixedLogo?[N()]:[],...i])}}e.fixedLogo||f.current[0]?.splice(1,0,N());for(let e=0,t=f.current.length;e<t&&e!==t-1;e++)f.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');a.setState({currentPage:1,totalPage:f.current.length}),k()},k=()=>{const{currentPage:e}=l;let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;t+=f.current[e-1]?.join("")??"",t+="</table>",p.current.previewEl.innerHTML=t,p.current.previewEl.parentNode.scrollTop=0},A=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;if(void 0!==e)t+=[...f.current[e-1]].join("");else for(let e=0;e<f.current.length;e++)t+=f.current[e].join("");return t+="</table>",t},L=()=>{const e=[];for(let t=0;t<h.current.length;t++)e[t]=h.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+N()+I()+e.join("")+"</table>"},F=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return _();p.current.previewEl.innerHTML||(R(),await ce(0),P(),O(),b(!1))},H=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return _();R(),await ce(0),P(),O(),b(!1),a.doPrint(A()),await ce(0),a.doClose()},_=()=>{v("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},D=Ie("print-container"),$={[D]:!0,"no-visible":n};return o().createElement("div",{ref:u,className:Ne()($)},o().createElement(St,{wrapperClassName:"spin",spinning:g,tip:"Loading..."},o().createElement("div",{className:"preview"},o().createElement("div",{className:"origin-template",style:{width:`${E}px`,marginLeft:`-${Math.floor(E/2)}px`}},r?.()),o().createElement("div",{className:"workspace",style:T}))))}));Vd.displayName="Container";const zd=Vd;function Bd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ud extends a.Component{constructor(){super(...arguments),Bd(this,"context",void 0),Bd(this,"formRef",o().createRef()),Bd(this,"createFormList",(()=>[{type:"DIVIDER",fieldName:"_1",label:f("qm.print.setPanel.printParameter")},{type:"SELECT",label:f("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:f("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:f("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:f("qm.print.setPanel.vertical"),value:"vertical"},{text:f("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:f("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:f("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:f("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:f("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:Dd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:Dd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:Dd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:f("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:Dd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:f("qm.print.setPanel.noEmpty")}]}])),Bd(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})})),Bd(this,"getInitialExtra",(()=>({disleft:f("qm.print.setPanel.sizeUnit"),disright:f("qm.print.setPanel.sizeUnit"),distop:f("qm.print.setPanel.sizeUnit"),disbottom:f("qm.print.setPanel.sizeUnit")}))),Bd(this,"state",{formList:this.createFormList()}),Bd(this,"confirmHandle",(async()=>{const[e,t]=await this.formRef.current.GET_FORM_DATA();e||(this.props.onChange({distance:{left:t.disleft,right:t.disright,top:t.distop,bottom:t.disbottom},pageSize:t.pageSize,direction:t.direction,doubleSide:t.doubleSide,doubleSideType:t.doubleSideType,fixedLogo:t.fixedLogo}),this.cancelHandle())})),Bd(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return o().createElement(o().Fragment,null,o().createElement(Xo,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),o().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},o().createElement(xe,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},f("qm.dialog.close")),o().createElement(xe,{type:"primary",onClick:()=>this.confirmHandle()},f("qm.dialog.confirm"))))}}Bd(Ud,"contextType",c);const Wd=Ud;function Gd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Yd extends a.Component{constructor(){super(...arguments),Gd(this,"context",void 0),Gd(this,"provide",{$$preview:this}),Gd(this,"containRef",o().createRef()),Gd(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:Dd.defaultDistance,right:Dd.defaultDistance,top:Dd.defaultDistance,bottom:Dd.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),Gd(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),Gd(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),Gd(this,"printClickHandle",(async()=>{if(this.doPrint(this.containRef.current.createPrintHtml(this.state.printPage)),this.props.uniqueKey)try{const e={...this.state.form,printerName:this.printerItems.find((e=>e.value===this.state.form.printerName)).text};await zs().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),Gd(this,"doClose",(()=>{this.props.onClose?.()})),Gd(this,"getPrintConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),Gd(this,"savePrintConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),Gd(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 ')),Gd(this,"doPrint",(e=>{const t=jd();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:i,printerName:a,printerType:o,copies:l}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Dd,{left:d,right:u,top:p,bottom:h}=i.distance;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(a),t.SET_PRINT_COPIES(l),i.doubleSide&&("auto"===i.doubleSideType?(t.SET_PRINT_MODE("PRINT_DUPLEX",2),t.SET_PRINT_MODE("PRINT_DEFAULTSOURCE",1)):t.SET_PRINT_MODE("DOUBLE_SIDED_PRINT",1)),t.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW",1),"laser"===o&&("vertical"===i.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===i.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===o&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(p-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==o?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?n&&this.doClose():L.message.error(f("qm.print.printError"))},t.PRINT()})),Gd(this,"doExport",(e=>{const t=jd();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:i}}=this.state;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?n&&this.doClose():L.message.error(f("qm.print.exportError"))},t.ADD_PRINT_TABLE(0,0,"RightMargin: 0","BottomMargin: 0",this.createStyle()+e),t.SET_SAVE_MODE("Orientation","vertical"===i.direction?1:2),t.SAVE_TO_FILE(`${u()().format("YYYYMMDDHHmmss")}.xlsx`)}))}get printerTypeItems(){return[{text:f("qm.print.laserPrinter"),value:"laser"},{text:f("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=jd(),t=[{text:f("qm.print.defaultPrinter"),value:-1}];try{const r=e.GET_PRINTER_COUNT();for(let n=0;n<r;n++)t.push({text:e.GET_PRINTER_NAME(n),value:n})}catch(e){v("Print","[ClientPrint]: 请安装 LODOP 打印插件")}return t}get isWindowsPrinter(){const{form:{printerName:e}}=this.state;return!/OneNote|Microsoft|Fax/.test(this.printerItems.find((t=>t.value===e)).text)}get pageSize(){return this.state.form.setting.pageSize.split("*").map((e=>Number(e)))}get printerKey(){return this.props.uniqueKey?`print_${this.props.uniqueKey}`:""}async componentDidMount(){if(this.props.uniqueKey)try{let e=await zs().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,ne.isPlainObject)(e)&&await zs().setItem(this.printerKey,e)),(0,ne.isPlainObject)(e)&&Object.keys(e).length&&(0,ne.merge)(this.state.form,{...e,printerName:this.printerItems.find((t=>t.text===e.printerName))?.value??-1})}catch(e){}}render(){const{preview:e,templateRender:t}=this.props,{visible:r,form:n,currentPage:i,totalPage:a,printPage:l}=this.state,s=Ie("print-preview"),c={visible:r,title:f("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?o().createElement(o().Fragment,null,o().createElement("div",{className:Ne()(d)},o().createElement("div",{className:"outer"},o().createElement("div",{className:"header"},o().createElement("span",null,f("qm.print.printer"),":",o().createElement(L.Select,{value:n.printerName,onChange:e=>{this.setState((t=>(0,ne.merge)({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",null,f("qm.print.type"),":",o().createElement(L.Select,{value:n.printerType,onChange:e=>{this.setState((t=>(0,ne.merge)({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>o().createElement(L.Select.Option,{key:e.value,value:e.value},e.text))))),o().createElement("span",null,f("qm.print.copies"),":",o().createElement(L.InputNumber,{value:n.copies,min:1,precision:0,onChange:e=>{this.setState((t=>(0,ne.merge)({},t,{form:{copies:e??1}})))},style:{width:"50px"}})),o().createElement("span",null,f("qm.print.printPage.0"),o().createElement(L.InputNumber,{value:l,min:1,max:a,precision:0,onChange:e=>{this.setState({printPage:e??void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),f("qm.print.printPage.1")),o().createElement("span",null,o().createElement(L.Pagination,{size:"small",current:i,pageSize:1,total:a,onChange:this.pageChangeHandle})),o().createElement("span",null,o().createElement(xe,{type:"text",icon:o().createElement(Re.SettingOutlined,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},f("qm.print.setting"))),o().createElement("span",null,o().createElement(xe,{type:"text",icon:o().createElement(Re.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},f("qm.print.export"))),o().createElement("span",null,o().createElement(xe,{icon:o().createElement(Re.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},f("qm.print.print")))),o().createElement("div",{className:"main"},o().createElement($d.Provider,{value:this.provide},o().createElement(zd,{ref:this.containRef,templateRender:t,directPrint:!1}))),o().createElement("div",{className:"footer"},o().createElement("span",null,f("qm.print.scale"),":",o().createElement(L.Slider,{value:n.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>(0,ne.merge)({},t,{form:{scale:e}})))}}),o().createElement("em",{className:"scale-text"},`${Math.floor(100*n.scale)}%`)),o().createElement("span",null,f("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),o().createElement("span",null,f("qm.print.pageNumber"),":",f("qm.print.pagination",{currentPage:i,totalPage:a}))))),o().createElement(wr,c,o().createElement(Wd,{setting:n.setting,onChange:e=>{this.setState((t=>(0,ne.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):o().createElement($d.Provider,{value:this.provide},o().createElement(zd,{ref:this.containRef,templateRender:t,directPrint:!0}))}}Gd(Yd,"contextType",c);const Xd=Yd;function Qd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Zd extends a.Component{constructor(){super(...arguments),Qd(this,"context",void 0),Qd(this,"previewRef",o().createRef()),Qd(this,"state",{visible:!1,loading:!1}),Qd(this,"clickHandle",(async()=>{this.setState({loading:!0});try{const e=await(this.props.click?.());if(this.setState({loading:!1}),"boolean"==typeof e&&!e)return;await this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),Qd(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:t,uniqueKey:r,defaultConfig:n,preview:i,closeAfterPrint:a}=this.props,l={visible:e,title:f("qm.print.preview"),width:`${Dd.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:t,uniqueKey:r,defaultConfig:n,preview:i,closeAfterPrint:a,onClose:()=>{this.setState({visible:!1})}};return i?o().createElement(wr,l,o().createElement(Xd,s)):e?o().createElement(Xd,s):null})),Qd(this,"DO_PRINT",(async()=>{const{preview:e}=this.props;await ce(0),this.setState({visible:!0}),await ce(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:t,icon:r,type:n,disabled:i,shape:a}=this.props,l={size:t||this.context.size||"",type:n,shape:a,icon:r,loading:e,disabled:i,click:this.clickHandle};return o().createElement(o().Fragment,null,this.props.children&&o().createElement(xe,l,this.props.children),this.createRender())}}Qd(Zd,"propTypes",{size:(e,t,r)=>{if(!x(e[t]||""))return y("Print","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},templateRender:s().elementType}),Qd(Zd,"defaultProps",{preview:!0,type:"primary",icon:o().createElement(Re.PrinterOutlined,null)}),Qd(Zd,"contextType",c);const Jd=Zd;function eu(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function tu(e){const t=eu(e);return t?t.frameElement:null}function ru(e){const t=au(e);return nu([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function nu(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 iu(e,t){const r=tu(e);if(r&&r!==t){const n=[e.getBoundingClientRect()];let i=r,a=!1;for(;i;){const e=ru(i);if(n.push(e),i=tu(i),a)break;i&&eu(i)===t&&(a=!0)}return nu(n)}return e.getBoundingClientRect()}function au(e){const t=window.getComputedStyle(e);return{borderLeft:parseInt(t.borderLeftWidth,10),borderRight:parseInt(t.borderRightWidth,10),borderTop:parseInt(t.borderTopWidth,10),borderBottom:parseInt(t.borderBottomWidth,10),marginLeft:parseInt(t.marginLeft,10),marginRight:parseInt(t.marginRight,10),marginTop:parseInt(t.marginTop,10),marginBottom:parseInt(t.marginBottom,10),paddingLeft:parseInt(t.paddingLeft,10),paddingRight:parseInt(t.paddingRight,10),paddingTop:parseInt(t.paddingTop,10),paddingBottom:parseInt(t.paddingBottom,10)}}function ou(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const lu=Object.assign;class su{constructor(e,t){ou(this,"node",void 0),ou(this,"border",void 0),ou(this,"padding",void 0),ou(this,"content",void 0),this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=pu.border,this.padding.style.borderColor=pu.padding,this.content.style.backgroundColor=pu.background,lu(this.node.style,{borderColor:pu.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){uu(t,"margin",this.node),uu(t,"border",this.border),uu(t,"padding",this.padding),lu(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"}),lu(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class cu{constructor(e,t){ou(this,"tip",void 0),ou(this,"nameSpan",void 0),ou(this,"dimSpan",void 0),this.tip=e.createElement("div"),lu(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),lu(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),lu(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,r){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(r)+"px"}updatePosition(e,t){const r=this.tip.getBoundingClientRect(),n=function(e,t,r){const n=Math.max(r.height,20),i=Math.max(r.width,60);let a;a=e.top+e.height+n<=t.top+t.height?e.top+e.height<t.top+0?t.top+5:e.top+e.height+5:e.top-n<=t.top+t.height?e.top-n-5<t.top+5?t.top+5:e.top-n-5:t.top+t.height-n-5;let o=e.left+5;return e.left<t.left&&(o=t.left+5),e.left+i>t.left+t.width&&(o=t.left+t.width-i-5),a+="px",o+="px",{style:{top:a,left:o}}}(e,t,{width:r.width,height:r.height});lu(this.tip.style,n.style)}}class du{constructor(){ou(this,"window",void 0),ou(this,"tipBoundsWindow",void 0),ou(this,"container",void 0),ou(this,"tip",void 0),ou(this,"rects",void 0);const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const r=e.document;this.container=r.createElement("div"),this.container.style.zIndex="10000000",this.tip=new cu(r,this.container),this.rects=[],r.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 r=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>r.length;){const e=this.rects.pop();e?.remove()}if(0===r.length)return;for(;this.rects.length<r.length;)this.rects.push(new su(this.window.document,this.container));const n={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};r.forEach(((e,t)=>{const r=iu(e,this.window),i=au(e);n.top=Math.min(n.top,r.top-i.marginTop),n.right=Math.max(n.right,r.left+r.width+i.marginRight),n.bottom=Math.max(n.bottom,r.top+r.height+i.marginBottom),n.left=Math.min(n.left,r.left-i.marginLeft),this.rects[t].update(r,i)})),t||(t=r[0].nodeName.toLowerCase(),r[0]),this.tip.updateText(t,n.right-n.left,n.bottom-n.top);const i=iu(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:n.top,left:n.left,height:n.bottom-n.top,width:n.right-n.left},{top:i.top+this.tipBoundsWindow.scrollY,left:i.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function uu(e,t,r){lu(r.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const pu={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 hu=null,mu=null;function fu(){null!=window.document&&(hu=null,null!==mu&&(mu.remove(),mu=null))}function gu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class bu{constructor(e){gu(this,"_isRunning",void 0),gu(this,"_selectIgnore",void 0),gu(this,"_lastHoveredNode",null),gu(this,"excludeSelectors",void 0),gu(this,"onSelect",void 0),gu(this,"iframesListeningTo",new Set),gu(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),gu(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),gu(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),gu(this,"onPointerMove",(e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>et(t,window.document.querySelector(e)))))return this._selectIgnore=!0,fu();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 r;r=[t],null,!1,null!=window.document?(null!==hu&&clearTimeout(hu),null!=r&&(null===mu&&(mu=new du),mu.inspect(r,null))):null!=r&&null!=r[0]&&console.error("showNativeHighlight",r[0])}})),gu(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),gu(this,"selectFiberForNode",(0,ne.throttle)((e=>{this._selectIgnore||this.onSelect?.(e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;let r=e;const n=[];for(;r!==t&&null!==r;){let e=r.tagName.toLowerCase();const t=/(?:\b|\w+-)(actived?|select(ed)?|focus(ed)?|open(ed)?)$/;for(let e=0,n=Array.from(r.classList).reverse();e<n.length;e++)t.test(n[e])&&r.classList.remove(n[e]);if(r.id&&/^rc-\w+/.test(r.id)&&r.removeAttribute("id"),r.id)e+=`#${r.id}`;else{const t=Array.from(r.parentElement.children).filter((e=>e.tagName===r.tagName)),n=r.className.trim();if(t.filter((e=>e.className.includes(n))).length<=1){if(n){const t=n.split(/\s+/);let r="";for(let e=0;e<t.length;e++)/^ant-col-\d+$/.test(t[e])||(r+=`.${t[e]}`);e+=r}}else r.getAttribute("name")?e+=`[name=${r.getAttribute("name")}]`:e+=`:nth-of-type(${t.indexOf(r)+1})`}r.nodeType!==Node.TEXT_NODE&&n.unshift(e),r=r.parentElement}return n.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(){fu(),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 yu(e){return document.querySelector(e)}const vu=e=>{const{action:t,onConfirm:r,onCancel:n,onFinish:i}=e,{t:a}=yc();return o().createElement(o().Fragment,null,o().createElement("div",{style:{height:100}},a("qm.table.config.emptyText")),o().createElement(Ce,{style:{width:"100%",justifyContent:"flex-end"}},o().createElement(xe,{size:"small",onClick:()=>n?.()},a("qm.guideTracker.closeButton")),o().createElement(xe,{size:"small",onClick:()=>r?.()},a("add"===t?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),o().createElement(xe,{size:"small",onClick:()=>i?.()},a("qm.guideTracker.finishButton"))))},xu={left:"50%",top:"50%",width:1,height:1},Eu=o().forwardRef(((e,t)=>{const{open:r,current:n,defaultCurrent:i,steps:a=[],placement:l="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:p,zIndex:h,helper:m={},selectFilter:f=(e=>e),onSelect:g,onChange:b,onClose:y,onFinish:v}=e,{t:x}=yc(),E=o().useRef(),S=o().useRef(a.length),[w,C]=ud(0,{value:n,defaultValue:i}),[T,N]=ud(void 0,{value:r,postState:e=>e??!1}),[I,R]=ud(1051,{value:h,defaultValue:h}),[P,O]=o().useState({}),[k,A]=o().useState(!1),[F,H]=o().useState(T),[_,D]=o().useState(!1),[$,q]=cd(P.node,!!r),[M,j]=o().useState(22),K=o().useRef(!1),V=o().useMemo((()=>w>=a.length?"add":"edit"),[w,a]),z=o().useMemo((()=>`${w+1} / ${a.length}`),[w,a]);o().useLayoutEffect((()=>{E.current=new bu({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),O({id:cn(),node:e,path:t}),C(S.current),A(!0),U(),g?.(t,e)}})}),[]),o().useEffect((()=>(T?B():U(),T?setTimeout((()=>H(!0)),16):H(!1),()=>{U()})),[T]),o().useEffect((()=>{S.current=a.length}),[a]);const B=()=>{E.current.startHandle()},U=()=>{E.current.stopHandle()},W=e=>{e.stopPropagation(),e.preventDefault()};o().useImperativeHandle(t,(()=>({OPEN:()=>N(!0),CLOSE:()=>N(!1),GET_CURRENT_STEP:()=>({current:w,selector:P.path})})));const G=Ie("guide-tracker"),Y=[{[`${G}-primary`]:!0}],X=fd({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return o().createElement(o().Fragment,null,o().createElement(vd(),{zIndex:I,builtinPlacements:X,popupPlacement:l,popupVisible:T&&k,popupClassName:Ne()(Y,c),popupStyle:d,prefixCls:G,popup:()=>{const e=()=>{A(!1),B()};return o().createElement("div",{className:`${G}-content`},o().createElement("div",{className:`${G}-inner`},o().createElement(Re.CloseOutlined,{className:`${G}-close`,onClick:()=>{y?.(w),e()}}),o().createElement(L.Dropdown,{open:_,trigger:["click"],dropdownRender:()=>a.length?o().createElement("div",{className:"ant-dropdown-menu step-list"},o().createElement(fi.ReactSortable,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.id)),r=a.map((e=>e.id));if((0,ne.isEqual)(t,r))return;const n=t.findIndex((e=>e===P.id)),i=-1!==n?n:w;C(i),b?.(vn(e),i)}},a.map(((e,t)=>o().createElement("li",{key:t,className:Ne()("item",{actived:e.id===P.id})},o().createElement(Re.HolderOutlined,{className:"handle",title:x("qm.form.draggable")}),o().createElement("span",{className:"box"},o().createElement("span",{className:"title",title:e.title,onClick:()=>{t!==w&&(O({id:e.id,node:yu(e.selector),path:e.selector}),C(t),j(22===M?M+1:M-1),b?.(a,t))}},e.title),o().createElement(L.Popconfirm,{title:x("qm.button.confirmTitle"),zIndex:I+1,onConfirm:()=>{const r=a.filter((t=>t.id!==e.id)),n=t===w;let i=t<=w?w-1:w;if(i=i<0?0:i,i=i>r.length?r.length:i,n&&r[i]){const{id:e,selector:t}=r[i];O({id:e,node:yu(t),path:t})}C(i),b?.(r,i)}},o().createElement(Re.CloseOutlined,{className:"close-icon"})))))))):o().createElement(o().Fragment,null),overlayClassName:`${G}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:I},onOpenChange:e=>D(e)},o().createElement(Re.MenuOutlined,{className:Ne()(`${G}-close`,"menu-icon"),style:{width:M}})),m.content&&o().createElement(L.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:I},content:m.content,title:m.title},o().createElement(Re.QuestionCircleOutlined,{className:Ne()(`${G}-close`,"help-icon")})),o().createElement("div",{className:"panel-label"},o().createElement("span",{className:"title"},x("qm.guideTracker.label")),o().createElement("span",{className:"step"},x("qm.guideTracker.currentStep"),z)),p?p({id:P.id,selector:P.path,actionStatus:V,DO_CLOSE:e},w):o().createElement(vu,{action:V,onConfirm:()=>{b?.("add"===V?[...a,{id:P.id,selector:P.path,title:"Guide Title"}]:[...a],w),e()},onCancel:()=>{y?.(w),e()},onFinish:()=>{e(),y?.(w),v?.()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},o().createElement(bd(),{open:T&&k,autoLock:!0},o().createElement("div",{className:Ne()(`${G}-target-placeholder`),style:{...$||xu,position:"fixed",zIndex:I-1,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:W,onClick:W}))),s&&o().createElement(bd(),{open:F},o().createElement(Td,{zIndex:I,prefixCls:G,onPause:()=>{K.current=k,A(!1),U()},onPlay:()=>{K.current?A(!0):B()}})))}));Eu.displayName="QmGuideTracker";const Su=Eu,wu=e=>{const{content:t,image:r,width:n,height:i,font:l={},gap:s=[100,100],offset:c=[50,50],rotate:d=-22,zIndex:u=9,alpha:p=1,antiTamper:h=!0,grayscale:m,className:f,style:g}=e,b=o().useRef(null),y=o().useRef(new Map),v=l.fontSize??16,x=l.fontWeight??"normal",E=l.fontStyle??"normal",S=l.fontFamily??"sans-serif",w=l.color??"rgba(0, 0, 0, 0.15)",C=l.textAlign??"center",T=Array.isArray(t)?t:[t],N=s[0],I=s[1],R=N/2,P=I/2,O=c[0]??R,k=c[1]??P,A=o().useMemo((()=>{const e=O-R,t=k-P;return{position:"absolute",left:e>0?`${e}px`:0,top:t>0?`${t}px`:0,width:e>0?`calc(100% - ${e}px)`:"100%",height:t>0?`calc(100% - ${t}px)`:"100%",pointerEvents:"none",backgroundRepeat:"repeat",backgroundPosition:`${e>0?0:e}px ${t>0?0:t}px`,zIndex:u}}),[R,P,O,k,u]),L=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const a=(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),[o,l]=(e=>{let t=120,a=64;if(!r&&e.measureText){e.font=`${v}px ${S}`;const r=T.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...r)),a=v*T.length+3*(T.length-1)}return[n??t,i??a]})(t),s=o*a,c=l*a,u=(N+o)*a,h=(I+l)*a,f=N/2*a,g=I/2*a,R=u/2,P=h/2,O=2*(N+o);e.width=2*u,e.height=2*h,t.globalAlpha=p,t.save(),t.translate(R,P),t.rotate(Math.PI/180*d),t.translate(-R,-P);const k=()=>{t.restore(),t.drawImage(e,0,0,u,h,u,h,u,h),m&&(e=>{const t=e.getContext("2d");if(!t)return;const r=t.getImageData(0,0,e.width,e.height),{data:n}=r;for(let e=0;e<n.length;e+=4){const t=(n[e]+n[e+1]+n[e+2])/3;n[e]=t,n[e+1]=t,n[e+2]=t}t.putImageData(r,0,0)})(e),((e,t)=>{if(b.current){const r=y.current.get(b.current);r&&(b.current.contains(r)&&b.current.removeChild(r),y.current.delete(b.current));const n=document.createElement("div");n.setAttribute("style",(e=>Object.entries(e).map((e=>{let[t,r]=e;return`${n=t,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${r}`;var n})).join(";"))({...A,backgroundImage:`url('${e}')`,backgroundSize:`${t}px`})),b.current?.append(n),y.current.set(b.current,n)}})(e.toDataURL(),O)},L=()=>{const e=Number(v)*a;t.font=`${E} normal ${x} ${e}px/${l}px ${S}`,t.fillStyle=w,t.textAlign=C,t.textBaseline="top",t.translate(s/2,0),T.forEach(((r,n)=>{t.fillText(r??"",f,g+n*(e+3*a))})),k()};if(r){const e=new Image;e.onload=()=>{t.drawImage(e,f,g,s,c),k()},e.onerror=()=>{L()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=r}else L()},F=e=>Array.from(y.current.values()).includes(e);o().useEffect((()=>{L()}),[t,r,n,i,l,s,c,d,u,p,h,m]),function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=window&&"MutationObserver"in window,i=a.useRef(),o=()=>{i.current&&(i.current.disconnect(),i.current=void 0)};a.useLayoutEffect((()=>(o(),n&&e.current&&(i.current=new MutationObserver(t),i.current.observe(e.current,r)),()=>o())),[e])}(b,(e=>{if(h)for(const t of e){const e=Array.from(t.removedNodes).some((e=>F(e))),r="attributes"===t.type&&F(t.target);if(e||r){L();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const H=Ie("watermark");return o().createElement("div",{ref:b,className:Ne()(H,f),style:{position:"relative",...g}},e.children)},Cu=new Map,Tu=new WeakMap;let Nu=0;function Iu(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:undefined;if(void 0===window.IntersectionObserver&&void 0!==n){const i=e.getBoundingClientRect();return t(n,{isIntersecting:n,target:e,intersectionRatio:"number"==typeof r.threshold?r.threshold:0,time:0,boundingClientRect:i,intersectionRect:i,rootBounds:i}),()=>{}}const{id:i,observer:a,elements:o}=function(e){const t=function(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(r=e.root,r?(Tu.has(r)||(Nu+=1,Tu.set(r,Nu.toString())),Tu.get(r)):"0"):e[t]}`;var r})).toString()}(e);let r=Cu.get(t);if(!r){const n=new Map;let i=[];const a=new IntersectionObserver((t=>{t.forEach((t=>{const r=t.isIntersecting&&i.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=r),n.get(t.target)?.forEach((e=>{e(r,t)}))}))}),e);i=a.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),r={id:t,observer:a,elements:n},Cu.set(t,r)}return r}(r),l=o.get(e)||[];return o.has(e)||o.set(e,l),l.push(t),a.observe(e),function(){l.splice(l.indexOf(t),1),0===l.length&&(o.delete(e),a.unobserve(e)),0===o.size&&(a.disconnect(),Cu.delete(i))}}const Ru=e=>{const{forceRender:t,height:r,placeholder:n=null,unmountIfInvisible:i,className:a,style:l}=e,{ref:s,inView:c,entry:d}=function(){let{root:e,rootMargin:t,threshold:r,triggerOnce:n,fallbackInView:i,trackVisibility:a,skip:l,delay:s,onChange:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[d,u]=o().useState(null),[p,h]=o().useState({inView:!1,entry:void 0}),m=o().useRef(c);o().useEffect((()=>{if(l||!d)return;let o;return o=Iu(d,((e,t)=>{h({inView:e,entry:t}),m.current?.(e,t),t.isIntersecting&&n&&o&&(o(),o=void 0)}),{root:e,rootMargin:t,threshold:r,trackVisibility:a,delay:s},i),()=>{o&&o()}}),[Array.isArray(r)?r.toString():r,d,e,t,n,l,a,i,s]);const f=p.entry?.target,g=o().useRef();d||!f||n||l||g.current===f||(g.current=f,h({inView:!1,entry:void 0}));const b=[u,p.inView,p.entry];return b.ref=b[0],b.inView=b[1],b.entry=b[2],b}(Object.assign({},e,{triggerOnce:!i}));o().useEffect((()=>{r||v("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u=Ie("lazy-load"),p={[u]:!0};return o().createElement("div",{ref:s,className:Ne()(p,a),style:l},t||c?e.children:o().createElement("div",{className:"placeholder",style:{height:r}},n))},Pu=require("html2canvas");var Ou=n.n(Pu);function ku(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Au{constructor(e,t,r,n){if(ku(this,"x",void 0),ku(this,"y",void 0),ku(this,"pressure",void 0),ku(this,"time",void 0),isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=r||0,this.time=n||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 Lu{static fromPoints(e,t){const r=this.calculateControlPoints(e[0],e[1],e[2]).c2,n=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new Lu(e[1],r,n,e[2],t.start,t.end)}static calculateControlPoints(e,t,r){const n=e.x-t.x,i=e.y-t.y,a=t.x-r.x,o=t.y-r.y,l=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+r.x)/2,d=(t.y+r.y)/2,u=Math.sqrt(n*n+i*i),p=Math.sqrt(a*a+o*o),h=p/(u+p),m=c+(l-c)*h,f=d+(s-d)*h,g=t.x-m,b=t.y-f;return{c1:new Au(l+g,s+b),c2:new Au(c+g,d+b)}}constructor(e,t,r,n,i,a){this.startPoint=e,this.control2=t,this.control1=r,this.endPoint=n,this.startWidth=i,this.endWidth=a}length(){let e,t,r=0;for(let n=0;n<=10;n+=1){const i=n/10,a=this.point(i,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),o=this.point(i,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(n>0){const n=a-e,i=o-t;r+=Math.sqrt(n*n+i*i)}e=a,t=o}return r}point(e,t,r,n,i){return t*(1-e)*(1-e)*(1-e)+3*r*(1-e)*(1-e)*e+3*n*(1-e)*e*e+i*e*e*e}}function Fu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Hu{constructor(e,t){var r=this;Fu(this,"canvas",void 0),Fu(this,"ctx",void 0),Fu(this,"textInput",void 0),Fu(this,"width",320),Fu(this,"height",200),Fu(this,"ratio",Math.max(window.devicePixelRatio||1,1)),Fu(this,"penColor","rgba(0,0,0,1)"),Fu(this,"backgroundColor","rgba(0,0,0,0)"),Fu(this,"canAddHistory",!1),Fu(this,"mode",void 0),Fu(this,"openSmooth",!0),Fu(this,"dotSize",0),Fu(this,"throttle",16),Fu(this,"minDistance",5),Fu(this,"velocityFilterWeight",.7),Fu(this,"compositeOperation","source-over"),Fu(this,"minWidth",.5),Fu(this,"maxWidth",2.5),Fu(this,"fontSize",16),Fu(this,"eraserSize",20),Fu(this,"lineHeight",1.25),Fu(this,"degreeOfBlur",5),Fu(this,"textInputPos",{x:0,y:0}),Fu(this,"isMobile",/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile/i.test(navigator.userAgent)),Fu(this,"onStart",(()=>{})),Fu(this,"onEnd",(()=>{})),Fu(this,"_drawingStroke",!1),Fu(this,"_lastPoints",[]),Fu(this,"_data",[]),Fu(this,"_historyList",[]),Fu(this,"_lastVelocity",0),Fu(this,"_lastWidth",0),Fu(this,"_strokeMoveUpdate",void 0),Fu(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)})),Fu(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))})),Fu(this,"addListener",(()=>{this.removeListener(),this.canvas.style.touchAction="none",this.canvas.style.userSelect="none",this.isMobile&&("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)})),Fu(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)})),Fu(this,"_isLeftButtonPressed",((e,t)=>"touches"in e?!!e.touches.length:t?1===e.buttons:!(1&~e.buttons))),Fu(this,"_pointerEventToSignatureEvent",(e=>({event:e,type:e.type,x:"touches"in e?e.touches[0]?.clientX:e.clientX,y:"touches"in e?e.touches[0]?.clientY:e.clientY,pressure:"pressure"in e?e.pressure:0}))),Fu(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}))),Fu(this,"_strokeBegin",(e=>{this._drawingStroke=!0;const t=this._getPointGroupOptions(),r={...t,points:[]};this._data.push(r),this._reset(t),this._strokeUpdate(e,!1)})),Fu(this,"_strokeUpdate",(function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!r._drawingStroke)return;if(0===r._data.length)return void r._strokeBegin(e);const n=r._createPoint(e.x,e.y,e.pressure),i=r._data[r._data.length-1],a=i.points,o=a.length>0&&a[a.length-1],l=!!o&&n.distanceTo(o)<=r.minDistance,s=r._getPointGroupOptions(i);if(!o||!o||!l){const e=r._addPoint(n,s);t&&(o?e&&r._drawCurve(e,s):r._drawDot(n,s)),a.push({time:n.time,x:n.x,y:n.y,pressure:n.pressure})}})),Fu(this,"_strokeEnd",(function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r._drawingStroke&&(t&&r._strokeUpdate(e),r._drawingStroke=!1)})),Fu(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})),Fu(this,"_drawDot",((e,t)=>{const r=this.ctx,n=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;r.beginPath(),this._drawCurveSegment(e.x,e.y,n),r.closePath(),r.fillStyle=t.penColor,r.fill()})),Fu(this,"_drawCurve",((e,t)=>{const r=this.ctx,n=e.endWidth-e.startWidth,i=2*Math.ceil(e.length());r.beginPath(),r.fillStyle=t.penColor;for(let r=0;r<i;r+=1){const a=r/i,o=a*a,l=o*a,s=1-a,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*a*e.control1.x,u+=3*s*o*e.control2.x,u+=l*e.endPoint.x;let p=d*e.startPoint.y;p+=3*c*a*e.control1.y,p+=3*s*o*e.control2.y,p+=l*e.endPoint.y;const h=Math.min(e.startWidth+l*n,t.maxWidth);this._drawCurveSegment(u,p,h)}r.closePath(),r.fill()})),Fu(this,"_drawCurveSegment",((e,t,r)=>{const n=this.ctx;n.moveTo(e,t),n.arc(e,t,r,0,2*Math.PI,!1)})),Fu(this,"_createPoint",((e,t,r)=>{const n=this.canvas.getBoundingClientRect();return new Au(e-n.left,t-n.top,r,(new Date).getTime())})),Fu(this,"_createPointByEvent",(e=>this._createPoint(e.x,e.y,e.pressure))),Fu(this,"_addPoint",((e,t)=>{const{_lastPoints:r}=this;if(r.push(e),r.length>2){3===r.length&&r.unshift(r[0]);const e=this._calculateCurveWidths(r[1],r[2],t),n=Lu.fromPoints(r,e);return r.shift(),n}return null})),Fu(this,"_strokeWidth",((e,t)=>Math.max(t.maxWidth/(e+1),t.minWidth))),Fu(this,"_calculateCurveWidths",((e,t,r)=>{const n=r.velocityFilterWeight*t.velocityFrom(e)+(1-r.velocityFilterWeight)*this._lastVelocity,i=this._strokeWidth(n,r),a={end:i,start:this._lastWidth};return this._lastVelocity=n,this._lastWidth=i,a})),Fu(this,"onDrawStart",(e=>{e.preventDefault(),this._isLeftButtonPressed(e,!0)&&!this._drawingStroke&&(this._strokeBegin(this._pointerEventToSignatureEvent(e)),this.ctx.strokeStyle=this.penColor,this.ctx.lineWidth=this.maxWidth,"line"===this.mode&&this.createPencil(e),"eraser"===this.mode&&this.createEraser(e),"text"===this.mode&&this.createTextInput(e),this.onStart?.(e))})),Fu(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)))})),Fu(this,"onDrawEnd",(e=>{this._isLeftButtonPressed(e)||(this._strokeEnd(this._pointerEventToSignatureEvent(e)),"text"!==this.mode&&this.addHistory(),this.onEnd?.(e))})),Fu(this,"onInputBlur",(e=>{this.textInput.classList.remove("show"),this.drawHandler(e),this.textInput.innerText="",this.addHistory()})),Fu(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})),Fu(this,"drawSquare",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:i}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,r,n-t,i-r),this.ctx.stroke(),this.ctx.restore()})),Fu(this,"drawRound",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:i}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),a=Math.min(n,t),o=Math.min(i,r),l=.5*(Math.max(n,t)-a),s=.5*(Math.max(i,r)-o),c=a+l,d=o+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,l,s,0,0,2*Math.PI),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()})),Fu(this,"drawArrow",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:i}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),a=180*Math.atan2(r-i,t-n)/Math.PI,o=(a+25)*Math.PI/180,l=(a-25)*Math.PI/180,s=15*Math.cos(o),c=15*Math.sin(o),d=15*Math.cos(l),u=15*Math.sin(l);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,r),this.ctx.lineTo(n,i),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(n,i);const p=n+s,h=i+c;this.ctx.lineTo(p,h);const m=n+d,f=i+u;this.ctx.lineTo(m,f),this.ctx.lineTo(n,i),this.ctx.fill(),this.ctx.restore()})),Fu(this,"getAxisColor",((e,t,r)=>{const n=e.width,i=e.data,a=[];return a[0]=i[4*(r*n+t)],a[1]=i[4*(r*n+t)+1],a[2]=i[4*(r*n+t)+2],a[3]=i[4*(r*n+t)+3],a})),Fu(this,"setAxisColor",((e,t,r,n)=>{const i=e.width,a=e.data;a[4*(r*i+t)]=n[0],a[4*(r*i+t)+1]=n[1],a[4*(r*i+t)+2]=n[2],a[4*(r*i+t)+3]=n[3]})),Fu(this,"drawMosaic",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),n=this.ctx.getImageData(t*this.ratio,r*this.ratio,this.maxWidth*this.ratio,this.maxWidth*this.ratio),i=n.width,a=n.height,o=i/this.degreeOfBlur,l=a/this.degreeOfBlur;for(let e=0;e<l;e++)for(let t=0;t<o;t++){const r=this.getAxisColor(n,t*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur),e*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur));for(let i=0;i<this.degreeOfBlur;i++)for(let a=0;a<this.degreeOfBlur;a++)this.setAxisColor(n,t*this.degreeOfBlur+a,e*this.degreeOfBlur+i,r)}this.ctx.putImageData(n,t*this.ratio,r*this.ratio)})),Fu(this,"drawText",(e=>{const{x:t,y:r}=this.textInputPos;if(0===t&&0===r)return;this.ctx.lineWidth=1,this.ctx.fillStyle=this.penColor,this.ctx.textBaseline="middle",this.ctx.font=`bold ${this.fontSize}px none`;const n=this.fontSize*this.lineHeight,i=this.width-t,a=e.target.innerText,o=[];let l="";for(let e=0;e<a.length;e++){const t=l+a[e];this.ctx.measureText(t).width>i&&l.length>0?(o.push(l),l=a[e]):l=t}o.push(l),o.forEach(((e,i)=>{this.ctx.fillText(e,t+1,r+i*n+2)})),this.ctx.restore(),this.textInputPos={x:0,y:0}})),Fu(this,"createPencil",(e=>{if(this.openSmooth||!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,r)})),Fu(this,"drawPencil",(e=>{const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.lineTo(t,r),this.ctx.stroke(),this.ctx.restore()})),Fu(this,"createEraser",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,r)})),Fu(this,"drawEraser",(e=>{const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.globalCompositeOperation="destination-out",this.ctx.lineCap="round",this.ctx.lineWidth=this.eraserSize,this.ctx.lineTo(t,r),this.ctx.stroke(),this.ctx.globalCompositeOperation="source-over"})),Fu(this,"drawLine",(e=>{this.openSmooth?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this.drawPencil(e)})),Fu(this,"createTextInput",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];0!=this.textInputPos.x&&0!=this.textInputPos.y&&this.textInputPos.x!=t&&this.textInputPos.y!=r?this.textInput.blur():(this.textInput.classList.add("show"),this.setInputStyle(e),this.textInput.focus())})),Fu(this,"setInputStyle",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];this.textInput.style.left=t+"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=r-Math.floor((this.textInput.offsetHeight-2)/2)+"px",this.textInputPos={x:t,y:r}})),Fu(this,"drawBgColor",(()=>{this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height))})),Fu(this,"clearWorkSpace",(()=>{this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)})),Fu(this,"addHistory",(()=>{this.canAddHistory&&(this.canAddHistory=!1,this._historyList.push(this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height)))})),Fu(this,"getLastHistory",(()=>this._historyList[this._historyList.length-1])),Fu(this,"setLastHistory",(()=>{const e=this.getLastHistory();e?this.ctx.putImageData(e,0,0):this.clearWorkSpace()})),Fu(this,"clear",(()=>{this.clearWorkSpace(),this.drawBgColor(),this._historyList=[],this._data=[],this._reset(this._getPointGroupOptions())})),Fu(this,"undo",(()=>{const e=this._historyList[this._historyList.length-2];e?(this.ctx.putImageData(e,0,0),this._historyList.pop()):this.clear()})),Fu(this,"setDrawMode",(e=>{this.mode=e})),Fu(this,"setLineWidth",(e=>{this.maxWidth=e})),Fu(this,"setPenColor",(e=>{this.penColor=e})),Fu(this,"setFontSize",(e=>{this.fontSize=e})),Fu(this,"isEmpty",(()=>{const e=document.createElement("canvas"),t=e.getContext("2d");return e.width=this.canvas.width,e.height=this.canvas.height,this.backgroundColor?(t.fillStyle=this.backgroundColor,t.fillRect(0,0,e.width,e.height)):1!==this.ratio&&t.scale(this.ratio,this.ratio),e.toDataURL()===this.canvas.toDataURL()})),Fu(this,"toDataURL",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(r.canvas.width===r.width)return r.canvas.toDataURL(e,t);const n=document.createElement("canvas");return n.width=r.width,n.height=r.height,n.getContext("2d").drawImage(r.canvas,0,0,n.width,n.height),n.toDataURL(e,t)})),Fu(this,"getPNG",(()=>this.toDataURL())),Fu(this,"getJPG",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.8;return r.toDataURL("image/jpeg",e)})),Fu(this,"destroy",(()=>{this.removeListener();for(const e in this)this[e]=null})),this.initial(e,t)}initial(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e&&(this.canvas=e,this.ctx=e.getContext("2d"),this.textInput=document.createElement("div"),this.width=t.width||e.clientWidth||this.width,this.height=t.height||e.clientHeight||this.height,this.penColor=t.penColor||this.penColor,this.fontSize=t.fontSize||this.fontSize,this.backgroundColor=t.backgroundColor||this.backgroundColor,this.mode=t.mode||this.mode,this.openSmooth=void 0===t.openSmooth?this.openSmooth:!!t.openSmooth,this._strokeMoveUpdate=this.throttle?function(e){let t,r,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,a=0,o=null;const l=()=>{a=Date.now(),o=null,t=e.apply(r,n),o||(r=null,n=[])};return function(){const s=Date.now(),c=i-(s-a);r=this;for(var d=arguments.length,u=new Array(d),p=0;p<d;p++)u[p]=arguments[p];return n=u,c<=0||c>i?(o&&(clearTimeout(o),o=null),a=s,t=e.apply(r,n),o||(r=null,n=[])):o||(o=window.setTimeout(l,c)),t}}(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()}}Fu(Hu,"dataURLToBlob",(e=>{const t=e.split(";base64,"),r=t[0].split(":")[1],n=window.atob(t[1]),i=n.length,a=new Uint8Array(i);for(let e=0;e<i;++e)a[e]=n.charCodeAt(e);return new Blob([a],{type:r})})),Fu(Hu,"canvasToDataURL",(e=>e.toDataURL("image/png",1))),Fu(Hu,"canvasToBlob",(e=>new Promise(((t,r)=>{e.toBlob((e=>e?t(e):r(null)),"image/png",1)}))));const _u=Hu,Du=()=>o().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),$u=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),qu=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Mu=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),ju=()=>o().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},o().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"})),Ku=o().forwardRef(((e,t)=>{const{open:r,width:n,height:i,imageName:a,penColor:l,minWidth:s,maxWidth:c,backgroundColor:d,className:p,style:h,onOk:m,onCancel:f}=e,{t:g}=yc(),b=o().useRef(),y=o().useRef(null),x=o().useRef(null),E=o().useRef(null),S=[2,4,6],w=[14,16,18,20,24,28],C=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[T,N]=ud(void 0,{value:r,postState:e=>e??!1}),I=o().useMemo((()=>!!e.children),[e.children]),[R,P]=o().useState(I?"square":"line"),[O,k]=o().useState(S[0]),[A,F]=o().useState(I?C[0]:C[4]),[H,_]=o().useState(w[1]),[D,$]=o().useState("bottomLeft"),[q,M]=o().useState(!1),[j,K]=o().useState(!1);o().useEffect((()=>{const e={width:n??x.current?.offsetWidth,height:i??x.current?.offsetHeight,maxWidth:O,mode:R,penColor:A,fontSize:H,backgroundColor:d,openSmooth:!I};return e.openSmooth&&Object.assign(e,{penColor:l,minWidth:s,maxWidth:c}),b.current=new _u(y.current,e),()=>b.current.destroy()}),[]);const V=e=>{const[t,r]=[n??x.current?.offsetWidth,i??x.current?.offsetHeight],{width:a,height:o}=b.current;let l=!1;t&&t!==a&&(b.current.width=t,l=!0),r&&r!==o&&(b.current.height=r,l=!0),(l||e)&&b.current.update()};Ve((()=>{I&&T&&V()}),[T,I]),Ve((()=>{b.current.setDrawMode(R)}),[R]),Ve((()=>{b.current.setLineWidth(O)}),[O]),Ve((()=>{b.current.setPenColor(A)}),[A]),Ve((()=>{b.current.setFontSize(H)}),[H]);const z=async()=>{const e=I?x.current.parentNode:y.current;if(e)try{const t=await Ou()(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return _u.canvasToDataURL(t)}catch(e){v("Signature","生成合成图片失败!")}},B=()=>{b.current.clear(),f?.()};o().useImperativeHandle(t,(()=>({OPEN:()=>N(!0),CLOSE:()=>N(!1),CLEAR:()=>b.current.clear(),IS_EMPTY:()=>b.current.isEmpty(),UPDATE:V,GET_DATE_URL:z})));const U=e=>{e&&$((()=>{const e=E.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},W=e=>o().createElement("div",{className:Ne()("ant-dropdown-menu","content")},"text"!==e?o().createElement("div",{className:"lineWidth"},S.map((e=>o().createElement("span",{key:e,className:Ne()("dot",`s${e}`,{active:e===O}),onClick:()=>k(e)})))):o().createElement("div",{className:"fontSize"},o().createElement(L.Select,{size:"small",value:H,options:w.map((e=>({value:e,label:e.toString()}))),onChange:e=>_(e)})),o().createElement("span",{className:"divider"}),o().createElement("div",{className:"penColor"},C.map((e=>o().createElement("span",{key:e,className:Ne()("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>F(e)},o().createElement(Re.CheckOutlined,{className:"icon"})))))),G=Ie("signature"),Y={[G]:!0,"is-annotation":I},X=n?{...h,width:n}:h;return o().createElement("div",{className:Ne()(Y,p),style:X},I&&o().createElement(o().Fragment,null,o().createElement("div",{ref:x,className:"content"},e.children),j&&o().createElement(St,{spinning:!0,className:"spinning"})),o().createElement("div",{className:Ne()("signature",{show:T})},o().createElement("canvas",{ref:y,className:R}),I&&o().createElement("div",{ref:E,className:"signature__tool-bar"},o().createElement("div",{className:"wrapper"},o().createElement("div",{className:Ne()("actions",{hidden:q})},o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("square")},o().createElement(Re.BorderOutlined,null))),o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("round")},o().createElement(Du,null))),o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("arrow")},o().createElement(qu,null))),o().createElement(L.Dropdown,{dropdownRender:W,overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("line")},o().createElement(Re.EditOutlined,null))),o().createElement(L.Dropdown,{dropdownRender:()=>W("text"),overlayClassName:`${G}__popper`,placement:D,trigger:["click"],onOpenChange:U},o().createElement("button",{className:"btn",onClick:()=>P("text")},o().createElement($u,null))),o().createElement("button",{className:"btn",onClick:async()=>{await(async()=>{K(!0);const e=await z();if(e){const t=a?a.slice(0,a.lastIndexOf(".")>0?a.lastIndexOf("."):void 0):u()().format(Wl);qt(_u.dataURLToBlob(e),`${t}.png`)}K(!1)})(),B()}},o().createElement(Re.DownloadOutlined,null)),o().createElement("button",{className:"btn",onClick:()=>P("eraser")},o().createElement(Mu,null)),o().createElement("button",{className:"btn",onClick:()=>b.current.undo()},o().createElement(ju,null)),o().createElement("button",{className:"btn",onClick:()=>b.current.clear()},o().createElement(Re.ClearOutlined,null)),o().createElement("span",{className:"divider"}),o().createElement("button",{className:"btn",onClick:()=>f?.()},o().createElement(Re.CloseOutlined,null)),o().createElement("button",{className:"btn",onClick:async()=>{K(!0),await ce(10);const e=await z();K(!1),B(),m?.(e)}},o().createElement(Re.CheckOutlined,null))),o().createElement("button",{className:"btn btn-fold",title:g(q?"qm.divider.spread":"qm.divider.collect"),onClick:()=>M(!q)},q?o().createElement(Re.LeftOutlined,null):o().createElement(Re.RightOutlined,null))))))}));Ku.displayName="QmSignature";const Vu=Ku,zu="1.9.13";return i})()));
|