@visactor/vtable-plugins 1.22.11-alpha.8 → 1.22.11

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.
@@ -34,4 +34,4 @@ Object.defineProperty(r,"__esModule",{value:!0}),r.CHAR="-퟿-�𐀀-􏿿",
34
34
  * @license MIT
35
35
  * @copyright Louis-Dominique Dubeau
36
36
  */
37
- function n(e){return e>=65&&e<=90||95===e||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}Object.defineProperty(r,"__esModule",{value:!0}),r.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",r.NC_NAME_CHAR="-"+r.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.NC_NAME_START_CHAR_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]$","u"),r.NC_NAME_CHAR_RE=new RegExp("^["+r.NC_NAME_CHAR+"]$","u"),r.NC_NAME_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]["+r.NC_NAME_CHAR+"]*$","u"),r.isNCNameStartChar=n,r.isNCNameChar=function(e){return n(e)||45===e||46===e||e>=48&&e<=57||183===e||e>=768&&e<=879||e>=8255&&e<=8256}},{}]},{},[15])(15)}(ki);var Ai,Mi,Oi=l(ki.exports);async function Ii(e,t){const r=await e.text(),n=t?.delimiter||",",i=r.split(/\r?\n/).filter((e=>e.trim().length>0));if(0===i.length)throw new Error("CSV 文件为空");const s=[];for(const e of i){const t=Ni(e,n);s.push(t)}const o=s.length,a=Math.max(...s.map((e=>e.length)),0);return{sheets:[{sheetTitle:e.name.replace(/\.(csv|txt)$/i,"")||"Sheet1",sheetKey:`sheet_${Date.now()}_0`,data:s,columnCount:a,rowCount:o}]}}function Ni(e,t){const r=[];let n="",i=!1;for(let s=0;s<e.length;s++){const o=e[s],a=e[s+1];'"'===o?i&&'"'===a?(n+='"',s++):i=!i:o!==t||i?n+=o:(r.push(n.trim()),n="")}return r.push(n.trim()),r}async function Fi(e,t){const r=new Oi.Workbook;if(await r.xlsx.load(await e.arrayBuffer()),!r.worksheets||0===r.worksheets.length)throw new Error("Excel 文件无有效工作表");let n;n=t?.sheetIndices&&t.sheetIndices.length>0?t.sheetIndices.filter((e=>e>=0&&e<r.worksheets.length)):Array.from({length:r.worksheets.length},((e,t)=>t));const i=[];for(const e of n){const n=r.worksheets[e];if(n)try{const r=await Pi(n,e,t);i.push(r)}catch(e){}}if(0===i.length)throw new Error("没有成功解析任何工作表");return{sheets:i}}async function Pi(e,t,r){const n=e.name||`Sheet${t+1}`,i=`sheet_${Date.now()}_${t}`,s=e.actualRowCount||0,o=e.actualColumnCount||0;if(0===s||0===o){const t=ji(e,[]);return{sheetTitle:n,sheetKey:i,data:[],columnCount:0,rowCount:0,...t.length>0?{cellMerge:t}:{}}}const a=[];for(let t=1;t<=s;t++){const r=e.getRow(t),n=[];for(let e=1;e<=o;e++){let t=r.getCell(e).value;t&&"object"==typeof t&&("richText"in t?t=t.richText.map((e=>e.text)).join(""):"result"in t?t=t.result:"text"in t&&"hyperlink"in t?t=t.text:t instanceof Date&&(t=t.toISOString())),n.push(t??null)}a.push(n)}const l=ji(e,a);return{sheetTitle:n,sheetKey:i,data:a,columnCount:o,rowCount:s,...l.length>0?{cellMerge:l}:{}}}function ji(e,t){const r=[];try{const n=e,i=n.model?.merges||n._merges||{};for(const[e,n]of Object.entries(i))try{let e,i,s,o,a;if("string"==typeof n){const t=n.match(/^([A-Z]+\d+):([A-Z]+\d+)$/i);if(!t)continue;const r=Li(t[1]),a=Li(t[2]);if(!r||!a)continue;e=r.col,i=r.row,s=a.col,o=a.row}else{if("object"!=typeof n||null===n)continue;{const t=n;if(t.tl&&t.br){const r=Li(t.tl),n=Li(t.br);if(!r||!n)continue;e=r.col,i=r.row,s=n.col,o=n.row}else{if("number"!=typeof t.top||"number"!=typeof t.left||"number"!=typeof t.bottom||"number"!=typeof t.right)continue;i=t.top-1,e=t.left-1,o=t.bottom-1,s=t.right-1}}}if(i>=0&&i<t.length&&e>=0&&e<t[i].length){const r=t[i][e];null!=r&&(a=String(r))}r.push({text:a,range:{start:{col:e,row:i},end:{col:s,row:o},isCustom:!0}})}catch(e){}}catch(e){}return r}function Li(e){try{const t=e.match(/^([A-Z]+)(\d+)$/i);if(!t)return null;const r=t[1].toUpperCase(),n=parseInt(t[2],10);let i=0;for(let e=0;e<r.length;e++)i=26*i+(r.charCodeAt(e)-64);i-=1;return{col:i,row:n-1}}catch(e){return null}}function Di(e,t,r){const n=!1!==r?.clearExisting;if(0===t.sheets.length)return;if("function"!=typeof e.addSheet)throw new Error("VTableSheet 实例方法不完整");const i=(n?[...e.getAllSheets()]:[]).map((e=>e.sheetKey)),s=[];for(let r=0;r<t.sheets.length;r++){const n=t.sheets[r];let i=n.sheetKey,o=1;for(;e.getSheet(i)||s.includes(i);)i=`${n.sheetKey}_${o}`,o++;const a={sheetKey:i,sheetTitle:n.sheetTitle,data:n.data,rowCount:Math.max(n.rowCount,100),columnCount:Math.max(n.columnCount,26),cellMerge:n.cellMerge,active:!1};e.addSheet(a),s.push(i)}if(n&&i.length>0)for(const t of i)s.includes(t)||e.getSheet(t)&&e.getSheetCount()>1&&e.removeSheet(t);s.length>0&&e.activateSheet(s[0])}class Bi{id="excel-import-plugin";name="ExcelImportPlugin";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED];options;table=null;constructor(e){this.options={autoTable:!0,autoColumns:!0,delimiter:",",exportData:!1,batchSize:1e3,enableBatchProcessing:!0,asyncDelay:5,importAllSheets:!1,clearExisting:!0,...e},e?.id&&(this.id=e.id)}run(...e){if(e[1]===r.TABLE_EVENT_TYPE.INITIALIZED&&(this.table=e[2],this.table.importFile=()=>{this.import("file")},this.table.__vtableSheet)){const e=this.table.__vtableSheet;e._importFile||(e._importFile=async t=>{const r={...this.options,...t};return this._importFileFromDialogForVTableSheet(e,r)})}}async _importFile(e){if(!this.table)throw new Error("表格实例不存在或已销毁,无法导入数据!");const t={...this.options,...e};if(this._detectVTableSheet(this.table))return this._importMultipleSheetsFromFileDialog({...t,importAllSheets:!0});throw new Error("ListTable 单 sheet 导入功能需要进一步重构")}_selectFile(e=".xlsx,.xls,.csv,.txt,.json,.html,.htm"){return new Promise(((t,r)=>{const n=document.createElement("input");n.type="file",n.accept=e,n.style.display="none",document.body.appendChild(n),n.addEventListener("change",(()=>{try{const e=n.files?.[0];if(!e)return document.body.removeChild(n),void r(new Error("未选择文件"));n.value="",document.body.removeChild(n),t(e)}catch(e){document.body.removeChild(n),r(e)}})),n.click()}))}async _importFileFromDialogForVTableSheet(e,t){try{const r=await this._selectFile(".xlsx,.xls,.csv,.txt"),n=this._getFileExtension(r.name).toLowerCase();let i;if("csv"===n||"txt"===n)i=await Ii(r,t);else{if("xlsx"!==n&&"xls"!==n)throw new Error("不支持的文件类型,仅支持 Excel (.xlsx, .xls) 和 CSV (.csv, .txt)");i=await Fi(r,t)}return!1!==t.autoTable&&i.sheets.length>0&&Di(e,i,t),i}catch(e){throw e}}async _importMultipleSheetsFromFileDialog(e){try{const t=await this._selectFile(".xlsx,.xls,.csv,.txt"),r=this._getFileExtension(t.name).toLowerCase();let n;if("csv"===r||"txt"===r)n=await Ii(t,e);else{if("xlsx"!==r&&"xls"!==r)throw new Error("不支持的文件类型,仅支持 Excel (.xlsx, .xls) 和 CSV (.csv, .txt)");n=await Fi(t,e)}if(!1!==e.autoTable&&this.table&&this._detectVTableSheet(this.table)){const t=this.table.__vtableSheet;t&&Di(t,n,e)}return n}catch(e){throw e}}_detectVTableSheet(e){const t=e;return!!(t&&"function"==typeof t.updateOption&&t.options&&"object"==typeof t.options&&null!==t.options&&Array.isArray(t.options.sheets))}_getFileExtension(e){const t=e.split(".");return t.length>1?t[t.length-1]:""}release(){this.table&&(delete this.table.importFile,this.table=null)}async import(e,t,r){if(!this.table)throw new Error("表格实例不存在或已销毁,无法导入数据!");const n={...this.options,...r};if(this._detectVTableSheet(this.table)&&"file"===e)return this._importMultipleSheetsFromFileDialog({...n,importAllSheets:!0});if("file"===e)return this._importFromFileDialog(n);if("string"==typeof t)return this._importFromString(e,t,n);if(Array.isArray(t)||"object"==typeof t){if("json"!==e)throw new Error("只有JSON格式支持从对象导入");return this._importFromData("json",t,n)}throw new Error("Invalid import source")}async _importFromFileDialog(e){if(!this.table)throw new Error("表格实例不存在或已销毁,无法导入数据!");const t=await this._selectFile(),r=await this._parseFile(t,e);return e.autoTable&&this.table&&(e.autoColumns&&this.table.updateOption(Object.assign({},this.table.options,{columns:r.columns})),this.table.setRecords(r.records)),r}async _importFromString(e,t,r){let n;switch(e){case"csv":n=await this._parseCSVString(t,r);break;case"json":n=await this._parseJSONString(t,r);break;case"html":n=await this._parseHTMLString(t,r);break;default:throw new Error(`不支持的导入类型: ${e}`)}return r.autoTable&&this.table&&(r.autoColumns&&this.table.updateOption({columns:n.columns,plugins:[this]}),this.table.setRecords(n.records)),n}async _importFromData(e,t,r){let n;if("json"!==e)throw new Error(`不支持的数据类型: ${e}`);return n=await this._parseJSONData(t,r),r.autoTable&&this.table&&(r.autoColumns&&this.table.updateOption({columns:n.columns,plugins:[this]}),this.table.setRecords(n.records)),n}async _parseFile(e,t){const r={...this.options,...t},n=this._getFileExtension(e.name).toLowerCase();switch(n){case"xlsx":case"xls":return await this._parseExcelFile(e,r);case"csv":return await this._parseCsvFile(e,r);case"json":return await this._parseJsonFile(e,r);case"html":case"htm":return await this._parseHtmlFile(e,r);default:throw new Error(`不支持的文件类型: ${n}`)}}async _parseExcelFile(e,t){const r={...this.options,...t};return await Bi.importExcelToVTableData(e,r)}async _parseCsvFile(e,t){const r={...this.options,...t},n=await e.text();return this._parseCSVString(n,r)}async _parseJsonFile(e,t){const r={...this.options,...t},n=await e.text();return this._parseJSONString(n,r)}async _parseHtmlFile(e,t){const r={...this.options,...t},n=await e.text();return this._parseHTMLString(n,r)}_buildColumnsFromHeaders(e){return 1===e.length?e[0].map(((e,t)=>({field:`col${t}`,title:e||`列${t+1}`,cellType:"text",headerType:"text"}))):Bi.buildColumns(e)}static async importExcelToVTableData(e,t){const r=new Oi.Workbook;await r.xlsx.load(await e.arrayBuffer());const n=r.worksheets[0];if(!n)throw new Error("Excel 文件无有效工作表");const i=t?.headerRowCount??this.detectHeaderRowCount(n),s=[];for(let e=1;e<=i;e++){const t=n.getRow(e);s.push(Array.prototype.slice.call(t.values,1))}const o=Bi.buildColumns(s),a=[],l=[];n.eachRow(((e,t)=>{if(t<=i)return;const r=Array.prototype.slice.call(e.values,1);l.push(r)}));const c=t?.batchSize||1e3;if(!1!==t?.enableBatchProcessing&&l.length>c)for(let e=0;e<l.length;e+=c){const r=l.slice(e,e+c).map((e=>{const t={};return e.forEach(((e,r)=>{t[`col${r}`]=e})),t}));a.push(...r),e+c<l.length&&await new Promise((e=>setTimeout(e,t?.asyncDelay||5)))}else l.forEach((e=>{const t={};e.forEach(((e,r)=>{t[`col${r}`]=e})),a.push(t)}));if(t?.exportData){const e=Bi._generateJavaScriptExport(o,a),t=new Blob([e],{type:"text/javascript"}),r=URL.createObjectURL(t),n=document.createElement("a");n.href=r,n.download="vtable-data.js",document.body.appendChild(n),n.click(),setTimeout((()=>{document.body.removeChild(n),URL.revokeObjectURL(r)}),100)}return{columns:o,records:a}}static detectHeaderRowCount(e){let t=1,r=1;for(;;){const n=e.getRow(t),i=Array.prototype.slice.call(n.values,1);let s=!1;for(let e=1;e<i.length;e++)if(void 0!==i[e]&&""!==i[e]&&i[e]===i[e-1]){s=!0;break}if(!s)break;r++,t++}return r}static buildColumns(e,t=0,r,n=0){const i=e[n],s=[];r=r??i.length;let o=t;for(;o<r;){const t=String(i[o]||`列${o+1}`);let a=1;for(;o+a<r&&i[o+a]===t;)a++;if(n<e.length-1){const r=Bi.buildColumns(e,o,o+a,n+1);1===r.length?s.push(r[0]):s.push({title:t,columns:r,hideColumnsSubHeader:!1})}else s.push({field:`col${o}`,title:t,cellType:"text",headerType:"text"});o+=a}return s}async _parseCSVString(e,t){const r=t.delimiter||",",n=e.split(/\r?\n/).filter((e=>e.trim().length>0));if(0===n.length)throw new Error("CSV文件为空");const i=e=>{const t=[];let n="",i=!1;for(let s=0;s<e.length;s++){const o=e[s],a=e[s+1];'"'===o?i&&'"'===a?(n+='"',s++):i=!i:o!==r||i?n+=o:(t.push(n.trim()),n="")}return t.push(n.trim()),t},s=n.slice(0,1).map((e=>i(e).map((e=>String(e||""))))),o=n.slice(1),a=this._buildColumnsFromHeaders(s),l=[];return await this._processBatchRecords(o,t,(async e=>{const t=e.map((e=>{const t=i(e),r={};return t.forEach(((e,t)=>{r[`col${t}`]=e??""})),r}));l.push(...t)})),t.exportData&&this._exportToJS(a,l),{columns:a,records:l}}async _parseJSONString(e,t){let r;try{r=JSON.parse(e)}catch(e){throw new Error("JSON文件格式错误")}const n=await this._parseJSONData(r,t);return t.exportData&&this._exportToJS(n.columns,n.records),n}async _parseHTMLString(e,t){const r=(new DOMParser).parseFromString(e,"text/html").querySelector("table");if(!r)throw new Error("HTML文件中未找到表格");const n=Array.from(r.querySelectorAll("tr"));if(0===n.length)throw new Error("表格中没有数据行");const i=n.slice(0,1).map((e=>Array.from(e.querySelectorAll("th, td")).map((e=>e.textContent?.trim()||"")))),s=n.slice(1),o=this._buildColumnsFromHeaders(i),a=[];return await this._processBatchRecords(s,t,(async e=>{const t=e.map((e=>{const t=Array.from(e.querySelectorAll("td")).map((e=>e.textContent?.trim()||"")),r={};return t.forEach(((e,t)=>{r[`col${t}`]=e||""})),r}));a.push(...t)})),t.exportData&&this._exportToJS(o,a),{columns:o,records:a}}async _parseJSONData(e,t){let r;if("object"==typeof e&&!Array.isArray(e)&&e&&"columns"in e&&"records"in e){const n=e,i=[];await this._processBatchRecords(n.records,t,(async e=>{const t=e.map((e=>({...e})));i.push(...t)})),r={columns:n.columns,records:i}}else{if(!(Array.isArray(e)&&e.length>0))throw new Error("不支持的JSON格式");{const n=e[0],i=Object.keys(n).map((e=>({field:e,title:e,cellType:"text",headerType:"text"}))),s=[];await this._processBatchRecords(e,t,(async e=>{const t=e.map((e=>({...e})));s.push(...t)})),r={columns:i,records:s}}}return t.exportData&&this._exportToJS(r.columns,r.records),r}static _generateJavaScriptExport(e,t){const r=(e,t="")=>{if(null==e)return"null";if("string"==typeof e)return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`;if("number"==typeof e||"boolean"==typeof e)return String(e);if(Array.isArray(e)){if(0===e.length)return"[]";return`[${e.map((e=>r(e,t+" "))).join(", ")}]`}if("object"==typeof e){return`{\n${Object.entries(e).map((([e,n])=>`${t} ${e}: ${r(n,t+" ")}`)).join(",\n")}\n${t}}`}return String(e)},n=(e,t=" ")=>{const i=Object.entries(e).map((([e,i])=>{if("columns"===e&&Array.isArray(i)){const r=i.map((e=>n(e,t+" "))).join(",\n");return`${t} ${e}: [\n${r}\n${t} ]`}return`${t} ${e}: ${r(i)}`})).join(",\n");return`${t}{\n${i}\n${t}}`},i=e.map((e=>n(e))).join(",\n"),s=t.map((e=>` {\n${Object.entries(e).map((([e,t])=>` ${e}: ${r(t)}`)).join(",\n")}\n }`)).join(",\n");return`// VTable 数据导出 - JavaScript 对象字面量格式\n// 生成时间: ${(new Date).toLocaleString()}\n\nconst vtableData = {\n columns: [\n${i}\n ],\n records: [\n${s}\n ]\n};\n`}_exportToJS(e,t){const r=Bi._generateJavaScriptExport(e,t),n=new Blob([r],{type:"text/javascript"}),i=URL.createObjectURL(n),s=document.createElement("a");s.href=i,s.download="vtable-data.js",document.body.appendChild(s),s.click(),setTimeout((()=>{document.body.removeChild(s),URL.revokeObjectURL(i)}),100)}async _processBatchRecords(e,t,r){if(!t.enableBatchProcessing||e.length<=(t.batchSize||1e3))return void await r(e,0);const n=t.batchSize||1e3,i=Math.ceil(e.length/n);for(let s=0;s<i;s++){const o=s*n,a=Math.min(o+n,e.length),l=e.slice(o,a);await r(l,s),s<i-1&&await new Promise((e=>setTimeout(e,t.asyncDelay||5)))}}}class Hi{constructor(){}handleCopy(e){e.eventManager.handleCopy(new KeyboardEvent("copy"))}handleCut(e){e.eventManager.handleCut(new KeyboardEvent("cut"))}handlePaste(e){e.eventManager.handlePaste(new KeyboardEvent("paste"))}handleInsertRowAbove(e,t,r=1){if(void 0!==t&&"function"==typeof e.addRecord){const n=Array.from({length:r},((e,t)=>[]));e.addRecords(n,t-1)}}handleInsertRowBelow(e,t,r=1){if(void 0!==t&&"function"==typeof e.addRecord){const n=Array.from({length:r},((e,t)=>[]));e.addRecords(n,t)}}handleInsertColumnLeft(e,t,r=1){if(void 0!==t&&"function"==typeof e.addColumns){const n=[];for(let e=0;e<r;e++)n.push({field:t-e});e.addColumns(n,t,!0)}}handleInsertColumnRight(e,t,r=1){if(void 0!==t&&"function"==typeof e.addColumns){const n=[];for(let e=0;e<r;e++)n.push({field:t+1});e.addColumns(n,t+1,!0)}}handleDeleteRow(e){if("function"==typeof e.deleteRecords){const t=e.stateManager.select.ranges,r=[];for(let e=0;e<t.length;e++){const n=t[e];for(let e=n.start.row;e<=n.end.row;e++)r.includes(e)||r.push(e)}r.sort(((e,t)=>t-e));const n=[];for(let t=0;t<r.length;t++){const i=e.getRecordIndexByCell(0,r[t]);n.push(i)}e.deleteRecords(n)}}handleDeleteColumn(e,t){if(void 0!==t&&"function"==typeof e.deleteColumns){const t=e.stateManager.select.ranges,r=[];for(let e=0;e<t.length;e++){const n=t[e];for(let e=n.start.col;e<=n.end.col;e++)r.includes(e)||r.push(e)}e.deleteColumns(r,!0)}}handleHideColumn(e,t){void 0!==t&&"function"==typeof e.hideColumns&&e.hideColumns([t])}handleSort(e,t){if(void 0!==t&&"function"==typeof e.sort){const r=e.getSortState?e.getSortState():null;let n="asc";r&&r.field===t&&(n="asc"===r.order?"desc":"normal"),e.sort({field:t,order:n})}}handleMergeCells(e){if(1===(e.stateManager.select.ranges?.length??0)&&"function"==typeof e.mergeCells){const{row:t,col:r}=e.stateManager.select.ranges[0].start,{row:n,col:i}=e.stateManager.select.ranges[0].end;if(r===i&&t===n)return;e.mergeCells(Math.min(r,i),Math.min(t,n),Math.max(r,i),Math.max(t,n))}}handleUnmergeCells(e){if(1===(e.stateManager.select.ranges?.length??0)&&"function"==typeof e.unmergeCells){const{row:t,col:r}=e.stateManager.select.ranges[0].start,{row:n,col:i}=e.stateManager.select.ranges[0].end;if(r===i&&t===n)return;e.unmergeCells(Math.min(r,i),Math.min(t,n),Math.max(r,i),Math.max(t,n))}}handleSetProtection(e){}handleFreezeToRow(e,t){void 0!==t&&(e.frozenRowCount=t+1)}handleFreezeToColumn(e,t){void 0!==t&&(e.frozenColCount=t+1)}handleFreezeToRowAndColumn(e,t,r){void 0!==t&&void 0!==r&&(e.frozenRowCount=t+1,e.frozenColCount=r+1)}handleUnfreeze(e){e.frozenRowCount=0,e.frozenColCount=0}release(){}}class zi{filterFuncRule=[];filterValueRule=[];pluginOptions;constructor(e){this.pluginOptions=e}applyFilter(e,t){const{filters:r}=e;this.filterFuncRule=[],this.filterValueRule=[],r.forEach(((e,t)=>{if(e.enable)if("byValue"===e.type)this.filterValueRule.push({filterKey:String(e.field),filteredValues:e.values});else if("byCondition"===e.type){const t=this.createFilterFunction(e);this.filterFuncRule.push({filterFunc:t,fieldId:String(e.field)})}})),t.updateFilterRules([...this.filterFuncRule,...this.filterValueRule],{clearRowHeightCache:!1,onFilterRecordsEnd:this.pluginOptions?.onFilterRecordsEnd})}createFilterFunction(e){const{field:t,operator:r,condition:n}=e;return r&&void 0!==n?e=>{const i=e[t];if(null==i)return!1;switch(r){case"equals":return 0===this.compareValues(i,n);case"notEquals":return 0!==this.compareValues(i,n);case"greaterThan":return this.compareValues(i,n)>0;case"lessThan":return this.compareValues(i,n)<0;case"greaterThanOrEqual":return this.compareValues(i,n)>=0;case"lessThanOrEqual":return this.compareValues(i,n)<=0;case"between":return!Array.isArray(n)||2!==n.length||this.compareValues(i,n[0])>=0&&this.compareValues(i,n[1])<=0;case"notBetween":return!Array.isArray(n)||2!==n.length||(this.compareValues(i,n[0])<0||this.compareValues(i,n[1])>0);case"contains":return String(i).toLowerCase().includes(String(n).toLowerCase());case"notContains":return!String(i).toLowerCase().includes(String(n).toLowerCase());case"startsWith":return String(i).toLowerCase().startsWith(String(n).toLowerCase());case"notStartsWith":return!String(i).toLowerCase().startsWith(String(n).toLowerCase());case"endsWith":return String(i).toLowerCase().endsWith(String(n).toLowerCase());case"notEndsWith":return!String(i).toLowerCase().endsWith(String(n).toLowerCase());case"isChecked":return!0===Boolean(i);case"isUnchecked":return!1===Boolean(i);default:return!0}}:()=>!0}compareValues(e,t){if("number"==typeof e&&"number"==typeof t)return e===t?0:e>t?1:-1;if("boolean"==typeof e&&"boolean"==typeof t)return e===t?0:-1;const r=String(e).toLowerCase(),n=String(t).toLowerCase();return isNaN(Number(r))||isNaN(Number(n))?r===n?0:r>n?1:-1:Number(r)===Number(n)?0:Number(r)>Number(n)?1:-1}clearAllFilter(e){this.filterFuncRule=[],this.filterValueRule=[],e.updateFilterRules([])}clearFilter(e,t){this.filterValueRule=this.filterValueRule.filter((e=>e.filterKey!==t)),this.filterFuncRule=this.filterFuncRule.filter((e=>e.fieldId!==t)),e.updateFilterRules([...this.filterFuncRule,...this.filterValueRule])}}e.FilterActionType=void 0,(Ai=e.FilterActionType||(e.FilterActionType={}))[Ai.ADD_FILTER=0]="ADD_FILTER",Ai[Ai.REMOVE_FILTER=1]="REMOVE_FILTER",Ai[Ai.UPDATE_FILTER=2]="UPDATE_FILTER",Ai[Ai.ENABLE_FILTER=3]="ENABLE_FILTER",Ai[Ai.DISABLE_FILTER=4]="DISABLE_FILTER",Ai[Ai.CLEAR_ALL_FILTERS=5]="CLEAR_ALL_FILTERS",Ai[Ai.APPLY_FILTERS=6]="APPLY_FILTERS",e.FilterOperatorCategory=void 0,(Mi=e.FilterOperatorCategory||(e.FilterOperatorCategory={})).ALL="all",Mi.TEXT="text",Mi.NUMBER="number",Mi.COLOR="color",Mi.CHECKBOX="checkbox",Mi.RADIO="radio";class Ui{state;engine;listeners=[];table;constructor(e,t){this.state={filters:new Map},this.engine=t,this.table=e}getFilterState(e){return this.state.filters.get(e)}getActiveFilterFields(){const e=[];return this.state.filters.forEach(((t,r)=>{t.enable&&e.push(r)})),e}getAllFilterStates(){return this.state}reapplyCurrentFilters(){this.getActiveFilterFields().length>0&&this.applyFilters()}dispatch(e){this.state=this.reduce(this.state,e),this.shouldApplyFilter(e)&&this.applyFilters(),this.notifyListeners(e)}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter((t=>t!==e))}}notifyListeners(e){this.listeners.forEach((t=>t(this.state,e)))}reduce(t,r){const{type:n,payload:i}=r,s=new Map(t.filters);switch(n){case e.FilterActionType.ADD_FILTER:i.shouldKeepUnrelatedState?s.set(i.field,{...s.get(i.field),...i}):s.set(i.field,i);break;case e.FilterActionType.REMOVE_FILTER:i.shouldKeepUnrelatedState&&"byValue"===i.type?(delete s.get(i.field).values,s.set(i.field,{...s.get(i.field),enable:!1})):i.shouldKeepUnrelatedState&&"byCondition"===i.type?(delete s.get(i.field).condition,delete s.get(i.field).operator,s.set(i.field,{...s.get(i.field),enable:!1})):s.delete(i.field);break;case e.FilterActionType.UPDATE_FILTER:s.set(i.field,{...s.get(i.field),...i});break;case e.FilterActionType.ENABLE_FILTER:s.set(i.field,{...s.get(i.field),enable:!0});break;case e.FilterActionType.DISABLE_FILTER:s.set(i.field,{...s.get(i.field),enable:!1});break;case e.FilterActionType.CLEAR_ALL_FILTERS:s.clear();break;case e.FilterActionType.APPLY_FILTERS:s.set(i.field,{...s.get(i.field),...i,enable:!0})}return{...t,filters:s}}applyFilters(){this.engine.applyFilter(this.state,this.table)}shouldApplyFilter(t){return[e.FilterActionType.REMOVE_FILTER,e.FilterActionType.ENABLE_FILTER,e.FilterActionType.DISABLE_FILTER,e.FilterActionType.CLEAR_ALL_FILTERS,e.FilterActionType.APPLY_FILTERS].includes(t.type)}}const Vi={filterMenu:{display:"none",position:"absolute",backgroundColor:"white",border:"1px solid #ccc",boxShadow:"0 4px 8px rgba(0,0,0,0.15)",zIndex:"99999"},filterPanel:{padding:"10px",display:"block"},searchContainer:{padding:"5px"},searchInput:{width:"100%",padding:"8px 10px",border:"1px solid #ccc",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box"},optionsContainer:{maxHeight:"200px",overflowY:"auto",marginTop:"10px"},optionItem:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 5px"},optionLabel:{display:"flex",alignItems:"center",cursor:"pointer",flexGrow:"1",fontWeight:"normal"},checkbox:{marginRight:"10px"},countSpan:{color:"#888",fontSize:"12px"},tabsContainer:{display:"flex",justifyContent:"space-around",borderBottom:"1px solid #e0e0e0"},tabStyle:e=>({backgroundColor:"transparent",border:"none",flex:"1",padding:"10px 15px",cursor:"pointer",fontSize:"14px",fontWeight:e?"bold":"normal",color:e?"#007bff":"#666",borderBottom:e?"3px solid #007bff":"2px solid transparent"}),footerContainer:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"10px 15px",borderTop:"1px solid #e0e0e0",backgroundColor:"#f8f9fa"},footerButton:e=>({padding:"6px 12px",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",marginLeft:"5px",backgroundColor:e?"#007bff":"white",color:e?"white":"#333",borderColor:e?"#007bff":"#ccc"}),clearLink:{color:"#007bff",textDecoration:"none"},buttonStyle:(e=!1)=>({padding:"6px 12px",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",marginLeft:"5px",backgroundColor:e?"#007bff":"white",color:e?"white":"#333",borderColor:e?"#007bff":"#ccc"}),conditionContainer:{marginBottom:"15px",padding:"10px"},formLabel:{display:"block",marginBottom:"8px",fontWeight:"bold"},operatorSelect:{width:"100%",padding:"8px",marginBottom:"15px",border:"1px solid #ccc",borderRadius:"4px",boxSizing:"border-box"},rangeInputContainer:{display:"flex",alignItems:"center",gap:"8px"},addLabel:{display:"none",padding:"0 5px"}};function Wi(e,t){Object.entries(t).forEach((([t,r])=>{e.style[t]=r}))}function $i(e,t={},r=[]){const n=document.createElement(e);return Object.entries(t).forEach((([e,t])=>{n.setAttribute(e,t)})),r.forEach((e=>{"string"==typeof e?n.appendChild(document.createTextNode(e)):n.appendChild(e)})),n}class qi{table;filterStateManager;pluginOptions;styles;selectedField;selectedKeys=new Map;candidateKeys=new Map;formatFnCache=new Map;toUnformattedCache=new Map;valueFilterOptionList=new Map;filterByValuePanel;searchContainer;optionsContainer;selectAllItemDiv;selectAllLabel;filterByValueSearchInput;selectAllCheckbox;totalCountSpan;filterItemsContainer;_onInputKeyUpHandler;_onCheckboxChangeHandler;constructor(e,t,r){this.table=e,this.filterStateManager=t,this.pluginOptions=r,this.styles=r.styles||{}}setSelectedField(e){this.selectedField=e}getFormatFnCache(e){let t=this.formatFnCache.get(e);if(null!=t)return t;const r=this.table.internalProps.layoutMap.getHeaderCellAddressByField(String(e)),n=this.table.internalProps.layoutMap.getBody(r?.col,r?.row);return t=n&&"fieldFormat"in n&&"function"==typeof n.fieldFormat?n.fieldFormat:n&&"format"in n&&"function"==typeof n.format?n.format:t=>t[e],this.formatFnCache.set(e,t),t}getRecords(e,t){if(!0===t)return e.internalProps.records;const r=[],n=[...e.internalProps.dataSource.records];for(;n.length>0;){const e=n.pop();if(e.vtableMerge&&Array.isArray(e.children))for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t]);else r.push(e)}return r.reverse()}collectCandidateKeysForUnfilteredColumn(e){const t=this.pluginOptions?.syncFilterItemsState??!0,r=new Map;let n=[];n=t?this.getRecords(this.table,!1):this.table.internalProps.records;const i=this.getFormatFnCache(e),s=new Map;n.forEach((t=>{if(f(t)){const n=t[e],o=i(t)??"(空白)";if(null!=o){r.set(o,(r.get(o)||0)+1);const e=s.get(o);null!=e?e.add(n):s.set(o,new Set([n]))}}})),this.candidateKeys.set(e,r),this.toUnformattedCache.set(e,s)}collectCandidateKeysForFilteredColumn(e){const t=this.pluginOptions?.syncFilterItemsState??!0,r=this.filterStateManager.getActiveFilterFields().filter((t=>t!==e)),n=new Map,i=this.getFormatFnCache(e),s=new Map;let o=[];if(t){o=this.getRecords(this.table,!0).filter((e=>r.every((t=>{const r=this.filterStateManager.getFilterState(t)?.type;"byValue"!==r&&null!=r&&this.syncSingleStateFromTableData(t);return this.selectedKeys.get(t).has(e[t])}))))}else o=this.table.internalProps.records;o.forEach((t=>{if(f(t)){const r=t[e],o=i(t)??"(空白)";if(s.set(o,(s.get(o)||0)+1),null!=o){const e=n.get(o);null!=e?e.add(r):n.set(o,new Set([r]))}}})),this.candidateKeys.set(e,s),this.toUnformattedCache.set(e,n)}toggleSelectAll(e,t){this.valueFilterOptionList.get(e).forEach((e=>{"none"!==e.itemContainer.style.display&&(e.checkbox.checked=t)}))}syncSelectAllCheckbox(e){const t=this.valueFilterOptionList.get(e)||[],r=t.every((e=>e.checkbox.checked)),n=t.every((e=>!e.checkbox.checked));this.selectAllCheckbox.checked=r,this.selectAllCheckbox.indeterminate=!r&&!n}onSearch(e,t){const r=this.valueFilterOptionList.get(e),n=t.toUpperCase().split(" ").filter((e=>e));for(const e of r){const t=e.id.toUpperCase()||"",r=n.some((e=>t.includes(e))),i=0===n.length||r;e.itemContainer.style.display=i?"flex":"none"}}syncSingleStateFromTableData(t){const r=new Set,n=new Set;this.table.internalProps.records.forEach((e=>{f(e)&&n.add(e[t])}));const i=this.pluginOptions?.syncFilterItemsState??!0,s=!w(Array.from(n),Array.from(r));if(i){if(s){this.selectedKeys.set(t,r),this.filterStateManager.dispatch({type:e.FilterActionType.UPDATE_FILTER,payload:{field:t,values:Array.from(r),enable:!0}});!w(Array.from(n),Array.from(r))&&(this.selectedKeys.set(t,r),this.filterStateManager.dispatch({type:e.FilterActionType.ADD_FILTER,payload:{field:t,type:"byValue",values:Array.from(r),enable:!0}}))}}else{const r=this.filterStateManager.getFilterState(t)?.values;if(r){!w(Array.from(n),r)&&(this.selectedKeys.set(t,new Set(r)),this.filterStateManager.dispatch({type:e.FilterActionType.ADD_FILTER,payload:{field:t,type:"byValue",values:r,enable:!0,shouldKeepUnrelatedState:!0}}))}else this.selectedKeys.set(t,n)}}applyFilter(t=this.selectedField){const r=this.valueFilterOptionList.get(t);if(!r||0===r.length)return;const n=r.map((e=>e.checkbox.checked?e.originalValue:null)).filter((e=>null!==e)).flat();this.selectedKeys.set(t,new Set(n));const i=this.pluginOptions?.syncFilterItemsState??!0;n.length>=0&&n.length<this.valueFilterOptionList.get(t).length||!i?this.filterStateManager.dispatch({type:e.FilterActionType.APPLY_FILTERS,payload:{field:t,type:"byValue",values:n,enable:!0,shouldKeepUnrelatedState:!i}}):this.filterStateManager.dispatch({type:e.FilterActionType.REMOVE_FILTER,payload:{field:t,type:"byValue"}})}clearFilter(t){this.filterStateManager.dispatch({type:e.FilterActionType.REMOVE_FILTER,payload:{field:t}}),this.hide()}render(e){const t=this.styles;this.filterByValuePanel=document.createElement("div"),Wi(this.filterByValuePanel,t.filterPanel),this.searchContainer=document.createElement("div"),Wi(this.searchContainer,this.styles.searchContainer),this.filterByValueSearchInput=document.createElement("input"),this.filterByValueSearchInput.type="text",this.filterByValueSearchInput.placeholder=t.searchInput?.placeholder||"可使用空格分隔多个关键词",Wi(this.filterByValueSearchInput,t.searchInput),this.searchContainer.appendChild(this.filterByValueSearchInput),this.optionsContainer=document.createElement("div"),Wi(this.optionsContainer,this.styles.optionsContainer),this.selectAllItemDiv=document.createElement("div"),Wi(this.selectAllItemDiv,this.styles.optionItem),this.selectAllLabel=document.createElement("label"),Wi(this.selectAllLabel,this.styles.optionLabel),this.selectAllCheckbox=document.createElement("input"),this.selectAllCheckbox.type="checkbox",this.selectAllCheckbox.checked=!0,Wi(this.selectAllCheckbox,t.checkbox),this.totalCountSpan=document.createElement("span"),this.totalCountSpan.textContent="",Wi(this.totalCountSpan,t.countSpan),this.selectAllLabel.append(this.selectAllCheckbox," 全选"),this.selectAllItemDiv.appendChild(this.selectAllLabel),this.filterItemsContainer=document.createElement("div"),this.optionsContainer.append(this.selectAllItemDiv,this.filterItemsContainer),this.filterByValuePanel.append(this.searchContainer,this.optionsContainer),e.appendChild(this.filterByValuePanel),this.bindEventForFilterByValue()}updateStyles(e){Wi(this.filterByValuePanel,e.filterPanel),Wi(this.searchContainer,e.searchContainer),this.filterByValueSearchInput.placeholder=e.searchInput?.placeholder||"可使用空格分隔多个关键词",Wi(this.filterByValueSearchInput,e.searchInput),Wi(this.optionsContainer,e.optionsContainer),Wi(this.selectAllItemDiv,e.optionItem),Wi(this.selectAllLabel,e.optionLabel),Wi(this.selectAllCheckbox,e.checkbox)}renderFilterOptions(e){const t=this.styles;this.filterItemsContainer.innerHTML="",this.valueFilterOptionList.delete(e),this.valueFilterOptionList.set(e,[]);let r=0,n=!0,i=!0;const s=this.selectedKeys.get(e),o=[],a=this.filterStateManager.getFilterState(e)?.enable,l=this.toUnformattedCache.get(e),c=this.candidateKeys.get(e);if(!c||0===c.size)return;const h=[...c.entries()],u="number"==typeof h[0][0]?[...h]?.sort((([e],[t])=>Number(e)-Number(t))):[...h]?.sort((([e],[t])=>String(e).localeCompare(String(t))));u?.forEach((([e,c])=>{r+=c;const h=Array.from(l.get(e)||new Set),u=document.createElement("div");Wi(u,t.optionItem),u.style.display="flex";const f=document.createElement("label");Wi(f,t.optionLabel);const d=document.createElement("input");d.type="checkbox",d.value=String(e),d.checked=!a||h.some((e=>s?.has(e))),Wi(d,t.checkbox),d.checked?i=!1:n=!1;const p=document.createElement("span");p.textContent=String(c),Wi(p,t.countSpan),f.append(d,` ${this.pluginOptions.checkboxItemFormat?.(e,h)||e}`),u.append(f,p),this.filterItemsContainer.appendChild(u);const m={id:String(e),originalValue:h,itemContainer:u,checkbox:d,countSpan:p};o.push(m)})),this.valueFilterOptionList.set(e,o),this.selectAllCheckbox.checked=n,this.selectAllCheckbox.indeterminate=!n&&!i,this.totalCountSpan.textContent=String(r)}bindEventForFilterByValue(){this._onInputKeyUpHandler=e=>{const t=e.target;if(t instanceof HTMLInputElement&&"text"===t.type){const e=t.value;this.onSearch(this.selectedField,e)}},this._onCheckboxChangeHandler=e=>{const t=e.target;t instanceof HTMLInputElement&&"checkbox"===t.type&&(t===this.selectAllCheckbox?this.toggleSelectAll(this.selectedField,this.selectAllCheckbox.checked):this.syncSelectAllCheckbox(this.selectedField))},this.filterByValuePanel.addEventListener("keyup",this._onInputKeyUpHandler),this.filterByValuePanel.addEventListener("change",this._onCheckboxChangeHandler)}show(){const e=this.filterStateManager.getFilterState(this.selectedField)?.enable;e?this.collectCandidateKeysForFilteredColumn(this.selectedField):this.collectCandidateKeysForUnfilteredColumn(this.selectedField);const t=this.filterStateManager.getFilterState(this.selectedField)?.type;null!=t&&"byValue"!==t&&this.syncSingleStateFromTableData(this.selectedField),this.filterByValueSearchInput&&(this.filterByValueSearchInput.value=""),this.renderFilterOptions(this.selectedField),this.filterByValuePanel.style.display="block"}hide(){this.filterByValuePanel.style.display="none"}clearSearchInputValue(){this.filterByValueSearchInput.value=""}destroy(){if(this.filterByValuePanel&&(this._onInputKeyUpHandler&&this.filterByValuePanel.removeEventListener("keyup",this._onInputKeyUpHandler),this._onCheckboxChangeHandler&&this.filterByValuePanel.removeEventListener("change",this._onCheckboxChangeHandler)),this._onInputKeyUpHandler=void 0,this._onCheckboxChangeHandler=void 0,this.filterByValuePanel){const e=this.filterByValuePanel.parentElement;e?e.removeChild(this.filterByValuePanel):this.filterByValuePanel.remove()}this.filterItemsContainer&&(this.filterItemsContainer.innerHTML=""),this.filterByValueSearchInput&&(this.filterByValueSearchInput.value=""),this.selectedKeys&&this.selectedKeys.clear(),this.candidateKeys&&this.candidateKeys.clear(),this.formatFnCache&&this.formatFnCache.clear(),this.toUnformattedCache&&this.toUnformattedCache.clear(),this.valueFilterOptionList&&this.valueFilterOptionList.clear(),this.filterByValuePanel=void 0,this.filterByValueSearchInput=void 0,this.selectAllCheckbox=void 0,this.totalCountSpan=void 0,this.filterItemsContainer=void 0}}const Ki=[{value:e.FilterOperatorCategory.ALL,label:"全部"},{value:e.FilterOperatorCategory.TEXT,label:"文本"},{value:e.FilterOperatorCategory.NUMBER,label:"数值"},{value:e.FilterOperatorCategory.COLOR,label:"颜色"},{value:e.FilterOperatorCategory.CHECKBOX,label:"复选框"},{value:e.FilterOperatorCategory.RADIO,label:"单选框"}],Yi=[{value:"equals",label:"等于",category:e.FilterOperatorCategory.ALL},{value:"notEquals",label:"不等于",category:e.FilterOperatorCategory.ALL},{value:"equals",label:"等于",category:e.FilterOperatorCategory.NUMBER},{value:"notEquals",label:"不等于",category:e.FilterOperatorCategory.NUMBER},{value:"greaterThan",label:"大于",category:e.FilterOperatorCategory.NUMBER},{value:"lessThan",label:"小于",category:e.FilterOperatorCategory.NUMBER},{value:"greaterThanOrEqual",label:"大于等于",category:e.FilterOperatorCategory.NUMBER},{value:"lessThanOrEqual",label:"小于等于",category:e.FilterOperatorCategory.NUMBER},{value:"between",label:"介于",category:e.FilterOperatorCategory.NUMBER},{value:"notBetween",label:"不介于",category:e.FilterOperatorCategory.NUMBER},{value:"equals",label:"等于",category:e.FilterOperatorCategory.TEXT},{value:"notEquals",label:"不等于",category:e.FilterOperatorCategory.TEXT},{value:"contains",label:"包含",category:e.FilterOperatorCategory.TEXT},{value:"notContains",label:"不包含",category:e.FilterOperatorCategory.TEXT},{value:"startsWith",label:"开头是",category:e.FilterOperatorCategory.TEXT},{value:"notStartsWith",label:"开头不是",category:e.FilterOperatorCategory.TEXT},{value:"endsWith",label:"结尾是",category:e.FilterOperatorCategory.TEXT},{value:"notEndsWith",label:"结尾不是",category:e.FilterOperatorCategory.TEXT},{value:"equals",label:"等于",category:e.FilterOperatorCategory.COLOR},{value:"notEquals",label:"不等于",category:e.FilterOperatorCategory.COLOR},{value:"isChecked",label:"已选中",category:e.FilterOperatorCategory.CHECKBOX},{value:"isUnchecked",label:"未选中",category:e.FilterOperatorCategory.CHECKBOX},{value:"isChecked",label:"已选中",category:e.FilterOperatorCategory.RADIO},{value:"isUnchecked",label:"未选中",category:e.FilterOperatorCategory.RADIO}];class Xi{table;filterStateManager;pluginOptions;filterToolBarHide;styles;filterByConditionPanel;conditionContainer;categoryLabel;selectedField;operatorSelect;valueInput;andLabel;valueInputMax;categorySelect;operatorLabel;rangeInputContainer;valueLabel;currentCategory=e.FilterOperatorCategory.ALL;categories=[];operators=[];constructor(e,t,r,n){this.table=e,this.filterStateManager=t,this.pluginOptions=r,this.styles=r.styles||{},this.categories=r.conditionCategories,this.operators=Yi,this.filterToolBarHide=n}setSelectedField(e){this.selectedField=e,this.updateOperatorOptions(),this.loadCurrentFilterState()}updateOperatorOptions(){if(!this.operatorSelect)return;let t;if(this.operatorSelect.innerHTML="",this.currentCategory===e.FilterOperatorCategory.ALL){const e=new Map;this.operators.filter((e=>this.categories.map((e=>e.value)).includes(e.category))).forEach((t=>{e.has(t.value)||e.set(t.value,t)})),t=Array.from(e.values())}else t=this.operators.filter((e=>e.category===this.currentCategory));t.forEach((e=>{const t=document.createElement("option");t.value=e.value,t.textContent=e.label,this.operatorSelect.appendChild(t)}))}handleCategoryChange(){this.categorySelect&&(this.currentCategory=this.categorySelect.value,this.updateOperatorOptions(),this.syncUIState())}loadCurrentFilterState(){const e=this.filterStateManager.getFilterState(this.selectedField),t=this.pluginOptions?.syncFilterItemsState??!0;e&&"byCondition"===e.type||!t?(this.operatorSelect&&(this.operatorSelect.value=e?.operator??Yi[0].value),this.valueInput&&(Array.isArray(e?.condition)?(this.valueInput.value=String(e.condition[0]),this.valueInputMax&&(this.valueInputMax.value=String(e.condition[1]))):(this.valueInput.value=String(e?.condition??""),this.valueInputMax&&(this.valueInputMax.value=""))),this.syncUIState()):this.reset()}reset(){this.operatorSelect&&(this.operatorSelect.selectedIndex=0),this.valueInput&&(this.valueInput.value="",this.valueInput.placeholder="请输入筛选值"),this.valueInputMax&&(this.valueInputMax.value=""),this.currentCategory=e.FilterOperatorCategory.ALL,this.categorySelect&&(this.categorySelect.value=e.FilterOperatorCategory.ALL),this.updateOperatorOptions(),this.syncUIState()}syncUIState(){if(!this.operatorSelect||!this.valueInput)return;const e=this.operatorSelect.value,t=this.valueInput.nextElementSibling;this.isRangeOperator(e)?(this.valueInput.placeholder="最小值",this.valueInputMax&&(this.valueInputMax.style.display="inline-block"),t&&(t.style.display="inline-block")):(this.valueInput.placeholder="请输入筛选值",this.valueInputMax&&(this.valueInputMax.style.display="none"),t&&(t.style.display="none"))}isBooleanOperator(e){return["isChecked","isUnchecked"].includes(e)}isRangeOperator(e){return"between"===e||"notBetween"===e}applyFilter(t=this.selectedField){if(!this.operatorSelect||!this.valueInput)return;const r=this.operatorSelect?.value;let n=this.valueInput?.value;if(this.currentCategory===e.FilterOperatorCategory.NUMBER&&(n=parseFloat(n),isNaN(n)))return;if(this.isRangeOperator(r)){const t=n;let r=this.valueInputMax.value.trim();if(this.currentCategory===e.FilterOperatorCategory.NUMBER){const e=parseFloat(r);if(isNaN(e))return;r=e}n=[t,r]}if(!n&&!1!==n&&0!==n&&!this.isBooleanOperator(r))return void this.clearFilter(t);const i=this.pluginOptions?.syncFilterItemsState??!0;this.filterStateManager.dispatch({type:e.FilterActionType.APPLY_FILTERS,payload:{field:t,type:"byCondition",operator:r,condition:n,enable:!0,shouldKeepUnrelatedState:!i}})}clearFilter(t){this.filterStateManager.dispatch({type:e.FilterActionType.REMOVE_FILTER,payload:{field:t}}),this.hide()}render(e){const t=this.styles;this.filterByConditionPanel=document.createElement("div"),Wi(this.filterByConditionPanel,t.filterPanel),this.conditionContainer=document.createElement("div"),Wi(this.conditionContainer,this.styles.conditionContainer),this.categoryLabel=$i("label",{},["筛选类型:"]),Wi(this.categoryLabel,this.styles.formLabel),this.categorySelect=$i("select"),Wi(this.categorySelect,t.operatorSelect),this.categories.forEach((e=>{const t=document.createElement("option");t.value=e.value,t.textContent=e.label,this.categorySelect.appendChild(t)})),this.operatorLabel=$i("label",{},["筛选条件:"]),Wi(this.operatorLabel,this.styles.formLabel),this.operatorSelect=$i("select"),Wi(this.operatorSelect,t.operatorSelect),this.valueLabel=$i("label",{},["筛选值:"]),Wi(this.valueLabel,this.styles.formLabel),this.rangeInputContainer=$i("div"),Wi(this.rangeInputContainer,this.styles.rangeInputContainer),this.valueInput=$i("input",{type:"text",placeholder:"请输入筛选值"}),Wi(this.valueInput,t.searchInput),this.andLabel=$i("span",{},["和"]),Wi(this.andLabel,this.styles.addLabel),this.andLabel.style.display="none",this.valueInputMax=$i("input",{type:"text",placeholder:"最大值"}),Wi(this.valueInputMax,t.searchInput),this.valueInputMax.style.display="none",this.rangeInputContainer.appendChild(this.valueInput),this.rangeInputContainer.appendChild(this.andLabel),this.rangeInputContainer.appendChild(this.valueInputMax),this.conditionContainer.appendChild(this.categoryLabel),this.conditionContainer.appendChild(this.categorySelect),this.conditionContainer.appendChild(this.operatorLabel),this.conditionContainer.appendChild(this.operatorSelect),this.conditionContainer.appendChild(this.valueLabel),this.conditionContainer.appendChild(this.rangeInputContainer),this.filterByConditionPanel.appendChild(this.conditionContainer),e.appendChild(this.filterByConditionPanel),this.hide(),this.updateOperatorOptions(),this.bindEvents()}updateStyles(e){Wi(this.filterByConditionPanel,e.filterPanel),Wi(this.conditionContainer,e.conditionContainer),Wi(this.categoryLabel,e.formLabel),Wi(this.categorySelect,e.operatorSelect),Wi(this.operatorLabel,e.formLabel),Wi(this.operatorSelect,e.operatorSelect),Wi(this.valueLabel,e.formLabel),Wi(this.rangeInputContainer,e.rangeInputContainer),Wi(this.valueInput,e.searchInput),Wi(this.andLabel,e.addLabel),Wi(this.valueInputMax,e.searchInput)}bindEvents(){this.valueInput.addEventListener("keypress",(e=>{"Enter"===e.key&&(this.applyFilter(),this.filterToolBarHide())})),this.valueInputMax.addEventListener("keypress",(e=>{"Enter"===e.key&&(this.applyFilter(),this.filterToolBarHide())})),this.categorySelect.addEventListener("change",(()=>{this.handleCategoryChange()})),this.operatorSelect.addEventListener("change",(()=>{const e=this.operatorSelect.value,t=this.valueInput.nextElementSibling;this.isRangeOperator(e)?(this.valueInput.placeholder="最小值",this.valueInputMax.style.display="inline-block",t.style.display="inline-block"):(this.valueInput.placeholder="请输入筛选值",this.valueInputMax.style.display="none",t.style.display="none")}))}show(){this.filterByConditionPanel&&(this.filterByConditionPanel.style.display="block",this.loadCurrentFilterState())}hide(){this.filterByConditionPanel&&(this.filterByConditionPanel.style.display="none")}}class Gi{table;filterStateManager;pluginOptions;valueFilter=null;conditionFilter=null;activeTab="byValue";isVisible=!1;selectedField=null;filterModes=[];filterMenu;filterTabsContainer;filterMenuWidth;currentCol;currentRow;filterTabByValue;filterTabByCondition;footerContainer;clearFilterOptionLink;cancelFilterButton;applyFilterButton;constructor(e,t,r){this.table=e,this.filterStateManager=t,this.valueFilter=new qi(this.table,this.filterStateManager,r),this.conditionFilter=new Xi(this.table,this.filterStateManager,r,this.hide),this.pluginOptions=r,this.filterMenuWidth=300,this.filterStateManager.subscribe((e=>{this.isVisible&&null!==this.selectedField&&this.updateClearFilterButtonState(this.selectedField)}))}onTabSwitch(e){this.activeTab=e,"byValue"===e?(this.valueFilter.show(),this.conditionFilter.hide()):(this.conditionFilter.show(),this.valueFilter.hide());const t="byValue"===e;Wi(this.filterTabByValue,Vi.tabStyle(t)),Wi(this.filterTabByCondition,Vi.tabStyle(!t))}updateSelectedField(e){this.selectedField=e,this.valueFilter&&this.valueFilter.setSelectedField(e),this.conditionFilter&&this.conditionFilter.setSelectedField(e)}applyFilter(e){"byValue"===this.activeTab?this.valueFilter.applyFilter(e):"byCondition"===this.activeTab&&this.conditionFilter.applyFilter(e),this.hide()}clearFilter(e){this.valueFilter&&this.valueFilter.clearFilter(e),this.conditionFilter&&this.conditionFilter.clearFilter(e),this.hide()}updateClearFilterButtonState(e){const t=this.filterStateManager.getFilterState(e),r=t&&t.enable;this.clearFilterOptionLink.style.display="inline",this.clearFilterOptionLink.style.opacity=r?"1":"0.5",this.clearFilterOptionLink.style.pointerEvents=r?"auto":"none",this.clearFilterOptionLink.style.cursor=r?"pointer":"not-allowed"}render(e){const t=this.pluginOptions.styles||{};this.filterMenu=document.createElement("div"),this.filterMenu.classList.add("vtable-filter-menu"),Wi(this.filterMenu,t.filterMenu),this.filterMenu.style.width=`${this.filterMenuWidth}px`,this.filterTabsContainer=document.createElement("div"),Wi(this.filterTabsContainer,t.tabsContainer),this.filterTabByValue=document.createElement("button"),this.filterTabByValue.innerText="按值筛选",Wi(this.filterTabByValue,t.tabStyle(!0)),this.filterTabByCondition=document.createElement("button"),this.filterTabByCondition.innerText="按条件筛选",Wi(this.filterTabByCondition,t.tabStyle(!1)),this.filterTabsContainer.append(this.filterTabByValue,this.filterTabByCondition),this.footerContainer=document.createElement("div"),Wi(this.footerContainer,t.footerContainer),this.clearFilterOptionLink=document.createElement("a"),this.clearFilterOptionLink.href="#",this.clearFilterOptionLink.innerText="清除筛选",Wi(this.clearFilterOptionLink,t.clearLink);const r=document.createElement("div");this.cancelFilterButton=document.createElement("button"),this.cancelFilterButton.innerText="取消",Wi(this.cancelFilterButton,t.footerButton(!1)),this.applyFilterButton=document.createElement("button"),this.applyFilterButton.innerText="确认",Wi(this.applyFilterButton,t.footerButton(!0)),r.append(this.cancelFilterButton,this.applyFilterButton),this.footerContainer.append(this.clearFilterOptionLink,r),this.filterMenu.append(this.filterTabsContainer),this.valueFilter.render(this.filterMenu),this.conditionFilter.render(this.filterMenu),this.filterMenu.append(this.footerContainer),e.appendChild(this.filterMenu),this.attachEventListeners()}updateStyles(e){const t=(this.filterMenu.style.display??e.filterMenu.display)||"none";Wi(this.filterMenu,{...e.filterMenu,display:t}),Wi(this.filterTabsContainer,e.tabsContainer),Wi(this.filterTabByValue,e.tabStyle(!0)),Wi(this.footerContainer,e.footerContainer),Wi(this.clearFilterOptionLink,e.clearLink),Wi(this.cancelFilterButton,e.footerButton(!1)),Wi(this.applyFilterButton,e.footerButton(!0)),this.valueFilter.updateStyles(e),this.conditionFilter.updateStyles(e);const r=this.filterStateManager.getFilterState(this.selectedField);r&&"byCondition"===r.type?this.onTabSwitch("byCondition"):this.onTabSwitch("byValue")}attachEventListeners(){this.filterTabByValue.addEventListener("click",(()=>{this.onTabSwitch("byValue")})),this.filterTabByCondition.addEventListener("click",(()=>{this.onTabSwitch("byCondition")})),this.cancelFilterButton.addEventListener("click",(()=>this.hide())),this.clearFilterOptionLink.addEventListener("click",(e=>{e.preventDefault(),this.clearFilter(this.selectedField)})),this.applyFilterButton.addEventListener("click",(()=>{this.applyFilter(this.selectedField)})),document.addEventListener("click",(()=>{this.isVisible&&this.hide()})),this.filterMenu.addEventListener("click",(e=>{e.stopPropagation()}))}adjustMenuPosition(e,t,r,n){if("number"==typeof r&&"number"==typeof n)return this.filterMenu.style.display=this.isVisible?"block":"none",this.filterMenu.style.left=`${r}px`,void(this.filterMenu.style.top=`${n}px`);const i="number"==typeof e?e:this.currentCol,s="number"==typeof t?t:this.currentRow;if("number"!=typeof i||"number"!=typeof s)return;this.currentCol=i,this.currentRow=s;let o=0,a=0;const l=this.table.canvas.getBoundingClientRect(),c=this.table.getCellRelativeRect(i,s),h=this.filterMenuWidth;c.right<this.filterMenuWidth?(o=c.left+l.left,a=c.bottom+l.top):(o=c.right+l.left-this.filterMenuWidth,a=c.bottom+l.top),o=Math.max(0,Math.min(window.innerWidth-h,o)),a=Math.max(0,Math.min(window.innerHeight-380,a)),this.filterMenu.style.display=this.isVisible?"block":"none",this.filterMenu.style.left=`${o}px`,this.filterMenu.style.top=`${a}px`}show(e,t,n){this.valueFilter.clearSearchInputValue(),this.filterModes=n,this.filterModes.includes("byValue")?this.filterModes.includes("byCondition")||(this.filterTabByCondition.style.display="none",this.onTabSwitch("byValue")):(this.filterTabByValue.style.display="none",this.onTabSwitch("byCondition")),this.adjustMenuPosition(e,t),this.filterMenu.style.display="block";const i=this.table.internalProps.layoutMap.getHeaderField(e,t);this.updateSelectedField(i);const s=this.filterStateManager.getFilterState(i);s&&"byCondition"===s.type?this.onTabSwitch("byCondition"):this.onTabSwitch("byValue"),this.updateClearFilterButtonState(i),setTimeout((()=>{this.isVisible=!0,this.table.fireListeners(r.TABLE_EVENT_TYPE.FILTER_MENU_SHOW,{col:e,row:t})}),0)}hide=(e,t)=>{this.filterMenu.style.display="none",this.isVisible=!1,this.table.fireListeners(r.TABLE_EVENT_TYPE.FILTER_MENU_HIDE,{col:e??this.currentCol,row:t??this.currentRow})};destroy(){this.valueFilter.destroy(),this.filterMenu.remove()}}var Zi={exports:{}};!function(e,t){(function(){var r,n="Expected a function",i="__lodash_hash_undefined__",s="__lodash_placeholder__",o=16,l=32,c=64,h=128,u=256,f=1/0,d=9007199254740991,p=NaN,m=4294967295,b=[["ary",h],["bind",1],["bindKey",2],["curry",8],["curryRight",o],["flip",512],["partial",l],["partialRight",c],["rearg",u]],g="[object Arguments]",y="[object Array]",v="[object Boolean]",w="[object Date]",_="[object Error]",x="[object Function]",C="[object GeneratorFunction]",E="[object Map]",S="[object Number]",T="[object Object]",R="[object Promise]",k="[object RegExp]",A="[object Set]",M="[object String]",O="[object Symbol]",I="[object WeakMap]",N="[object ArrayBuffer]",F="[object DataView]",P="[object Float32Array]",j="[object Float64Array]",L="[object Int8Array]",D="[object Int16Array]",B="[object Int32Array]",H="[object Uint8Array]",z="[object Uint8ClampedArray]",U="[object Uint16Array]",V="[object Uint32Array]",W=/\b__p \+= '';/g,$=/\b(__p \+=) '' \+/g,q=/(__e\(.*?\)|\b__t\)) \+\n'';/g,K=/&(?:amp|lt|gt|quot|#39);/g,Y=/[&<>"']/g,X=RegExp(K.source),G=RegExp(Y.source),Z=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,ee=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,te=/^\w*$/,re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ne=/[\\^$.*+?()[\]{}|]/g,ie=RegExp(ne.source),se=/^\s+/,oe=/\s/,ae=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,le=/\{\n\/\* \[wrapped with (.+)\] \*/,ce=/,? & /,he=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,fe=/\\(\\)?/g,de=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,me=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,ge=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,ve=/^(?:0|[1-9]\d*)$/,we=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,xe=/['\n\r\u2028\u2029\\]/g,Ce="\\ud800-\\udfff",Ee="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Se="\\u2700-\\u27bf",Te="a-z\\xdf-\\xf6\\xf8-\\xff",Re="A-Z\\xc0-\\xd6\\xd8-\\xde",ke="\\ufe0e\\ufe0f",Ae="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Me="['’]",Oe="["+Ce+"]",Ie="["+Ae+"]",Ne="["+Ee+"]",Fe="\\d+",Pe="["+Se+"]",je="["+Te+"]",Le="[^"+Ce+Ae+Fe+Se+Te+Re+"]",De="\\ud83c[\\udffb-\\udfff]",Be="[^"+Ce+"]",He="(?:\\ud83c[\\udde6-\\uddff]){2}",ze="[\\ud800-\\udbff][\\udc00-\\udfff]",Ue="["+Re+"]",Ve="\\u200d",We="(?:"+je+"|"+Le+")",$e="(?:"+Ue+"|"+Le+")",qe="(?:['’](?:d|ll|m|re|s|t|ve))?",Ke="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ye="(?:"+Ne+"|"+De+")"+"?",Xe="["+ke+"]?",Ge=Xe+Ye+("(?:"+Ve+"(?:"+[Be,He,ze].join("|")+")"+Xe+Ye+")*"),Ze="(?:"+[Pe,He,ze].join("|")+")"+Ge,Je="(?:"+[Be+Ne+"?",Ne,He,ze,Oe].join("|")+")",Qe=RegExp(Me,"g"),et=RegExp(Ne,"g"),tt=RegExp(De+"(?="+De+")|"+Je+Ge,"g"),rt=RegExp([Ue+"?"+je+"+"+qe+"(?="+[Ie,Ue,"$"].join("|")+")",$e+"+"+Ke+"(?="+[Ie,Ue+We,"$"].join("|")+")",Ue+"?"+We+"+"+qe,Ue+"+"+Ke,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fe,Ze].join("|"),"g"),nt=RegExp("["+Ve+Ce+Ee+ke+"]"),it=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,st=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ot=-1,at={};at[P]=at[j]=at[L]=at[D]=at[B]=at[H]=at[z]=at[U]=at[V]=!0,at[g]=at[y]=at[N]=at[v]=at[F]=at[w]=at[_]=at[x]=at[E]=at[S]=at[T]=at[k]=at[A]=at[M]=at[I]=!1;var lt={};lt[g]=lt[y]=lt[N]=lt[F]=lt[v]=lt[w]=lt[P]=lt[j]=lt[L]=lt[D]=lt[B]=lt[E]=lt[S]=lt[T]=lt[k]=lt[A]=lt[M]=lt[O]=lt[H]=lt[z]=lt[U]=lt[V]=!0,lt[_]=lt[x]=lt[I]=!1;var ct={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ht=parseFloat,ut=parseInt,ft="object"==typeof a&&a&&a.Object===Object&&a,dt="object"==typeof self&&self&&self.Object===Object&&self,pt=ft||dt||Function("return this")(),mt=t&&!t.nodeType&&t,bt=mt&&e&&!e.nodeType&&e,gt=bt&&bt.exports===mt,yt=gt&&ft.process,vt=function(){try{var e=bt&&bt.require&&bt.require("util").types;return e||yt&&yt.binding&&yt.binding("util")}catch(e){}}(),wt=vt&&vt.isArrayBuffer,_t=vt&&vt.isDate,xt=vt&&vt.isMap,Ct=vt&&vt.isRegExp,Et=vt&&vt.isSet,St=vt&&vt.isTypedArray;function Tt(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function Rt(e,t,r,n){for(var i=-1,s=null==e?0:e.length;++i<s;){var o=e[i];t(n,o,r(o),e)}return n}function kt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function At(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function Mt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function Ot(e,t){for(var r=-1,n=null==e?0:e.length,i=0,s=[];++r<n;){var o=e[r];t(o,r,e)&&(s[i++]=o)}return s}function It(e,t){return!!(null==e?0:e.length)&&Ut(e,t,0)>-1}function Nt(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function Ft(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function Pt(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function jt(e,t,r,n){var i=-1,s=null==e?0:e.length;for(n&&s&&(r=e[++i]);++i<s;)r=t(r,e[i],i,e);return r}function Lt(e,t,r,n){var i=null==e?0:e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}function Dt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Bt=qt("length");function Ht(e,t,r){var n;return r(e,(function(e,r,i){if(t(e,r,i))return n=r,!1})),n}function zt(e,t,r,n){for(var i=e.length,s=r+(n?1:-1);n?s--:++s<i;)if(t(e[s],s,e))return s;return-1}function Ut(e,t,r){return t==t?function(e,t,r){var n=r-1,i=e.length;for(;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):zt(e,Wt,r)}function Vt(e,t,r,n){for(var i=r-1,s=e.length;++i<s;)if(n(e[i],t))return i;return-1}function Wt(e){return e!=e}function $t(e,t){var r=null==e?0:e.length;return r?Xt(e,t)/r:p}function qt(e){return function(t){return null==t?r:t[e]}}function Kt(e){return function(t){return null==e?r:e[t]}}function Yt(e,t,r,n,i){return i(e,(function(e,i,s){r=n?(n=!1,e):t(r,e,i,s)})),r}function Xt(e,t){for(var n,i=-1,s=e.length;++i<s;){var o=t(e[i]);o!==r&&(n=n===r?o:n+o)}return n}function Gt(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Zt(e){return e?e.slice(0,pr(e)+1).replace(se,""):e}function Jt(e){return function(t){return e(t)}}function Qt(e,t){return Ft(t,(function(t){return e[t]}))}function er(e,t){return e.has(t)}function tr(e,t){for(var r=-1,n=e.length;++r<n&&Ut(t,e[r],0)>-1;);return r}function rr(e,t){for(var r=e.length;r--&&Ut(t,e[r],0)>-1;);return r}var nr=Kt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ir=Kt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function sr(e){return"\\"+ct[e]}function or(e){return nt.test(e)}function ar(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function lr(e,t){return function(r){return e(t(r))}}function cr(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r];a!==t&&a!==s||(e[r]=s,o[i++]=r)}return o}function hr(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}function ur(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=[e,e]})),r}function fr(e){return or(e)?function(e){var t=tt.lastIndex=0;for(;tt.test(e);)++t;return t}(e):Bt(e)}function dr(e){return or(e)?function(e){return e.match(tt)||[]}(e):function(e){return e.split("")}(e)}function pr(e){for(var t=e.length;t--&&oe.test(e.charAt(t)););return t}var mr=Kt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var br=function e(t){var a=(t=null==t?pt:br.defaults(pt.Object(),t,br.pick(pt,st))).Array,oe=t.Date,Ce=t.Error,Ee=t.Function,Se=t.Math,Te=t.Object,Re=t.RegExp,ke=t.String,Ae=t.TypeError,Me=a.prototype,Oe=Ee.prototype,Ie=Te.prototype,Ne=t["__core-js_shared__"],Fe=Oe.toString,Pe=Ie.hasOwnProperty,je=0,Le=function(){var e=/[^.]+$/.exec(Ne&&Ne.keys&&Ne.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),De=Ie.toString,Be=Fe.call(Te),He=pt._,ze=Re("^"+Fe.call(Pe).replace(ne,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=gt?t.Buffer:r,Ve=t.Symbol,We=t.Uint8Array,$e=Ue?Ue.allocUnsafe:r,qe=lr(Te.getPrototypeOf,Te),Ke=Te.create,Ye=Ie.propertyIsEnumerable,Xe=Me.splice,Ge=Ve?Ve.isConcatSpreadable:r,Ze=Ve?Ve.iterator:r,Je=Ve?Ve.toStringTag:r,tt=function(){try{var e=us(Te,"defineProperty");return e({},"",{}),e}catch(e){}}(),nt=t.clearTimeout!==pt.clearTimeout&&t.clearTimeout,ct=oe&&oe.now!==pt.Date.now&&oe.now,ft=t.setTimeout!==pt.setTimeout&&t.setTimeout,dt=Se.ceil,mt=Se.floor,bt=Te.getOwnPropertySymbols,yt=Ue?Ue.isBuffer:r,vt=t.isFinite,Bt=Me.join,Kt=lr(Te.keys,Te),gr=Se.max,yr=Se.min,vr=oe.now,wr=t.parseInt,_r=Se.random,xr=Me.reverse,Cr=us(t,"DataView"),Er=us(t,"Map"),Sr=us(t,"Promise"),Tr=us(t,"Set"),Rr=us(t,"WeakMap"),kr=us(Te,"create"),Ar=Rr&&new Rr,Mr={},Or=Ls(Cr),Ir=Ls(Er),Nr=Ls(Sr),Fr=Ls(Tr),Pr=Ls(Rr),jr=Ve?Ve.prototype:r,Lr=jr?jr.valueOf:r,Dr=jr?jr.toString:r;function Br(e){if(ta(e)&&!Wo(e)&&!(e instanceof Vr)){if(e instanceof Ur)return e;if(Pe.call(e,"__wrapped__"))return Ds(e)}return new Ur(e)}var Hr=function(){function e(){}return function(t){if(!ea(t))return{};if(Ke)return Ke(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function zr(){}function Ur(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function Vr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Wr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function $r(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function qr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Kr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new qr;++t<r;)this.add(e[t])}function Yr(e){var t=this.__data__=new $r(e);this.size=t.size}function Xr(e,t){var r=Wo(e),n=!r&&Vo(e),i=!r&&!n&&Yo(e),s=!r&&!n&&!i&&ca(e),o=r||n||i||s,a=o?Gt(e.length,ke):[],l=a.length;for(var c in e)!t&&!Pe.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ys(c,l))||a.push(c);return a}function Gr(e){var t=e.length;return t?e[Yn(0,t-1)]:r}function Zr(e,t){return Fs(Ai(e),an(t,0,e.length))}function Jr(e){return Fs(Ai(e))}function Qr(e,t,n){(n!==r&&!Ho(e[t],n)||n===r&&!(t in e))&&sn(e,t,n)}function en(e,t,n){var i=e[t];Pe.call(e,t)&&Ho(i,n)&&(n!==r||t in e)||sn(e,t,n)}function tn(e,t){for(var r=e.length;r--;)if(Ho(e[r][0],t))return r;return-1}function rn(e,t,r,n){return fn(e,(function(e,i,s){t(n,e,r(e),s)})),n}function nn(e,t){return e&&Mi(t,Oa(t),e)}function sn(e,t,r){"__proto__"==t&&tt?tt(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function on(e,t){for(var n=-1,i=t.length,s=a(i),o=null==e;++n<i;)s[n]=o?r:Ta(e,t[n]);return s}function an(e,t,n){return e==e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function ln(e,t,n,i,s,o){var a,l=1&t,c=2&t,h=4&t;if(n&&(a=s?n(e,i,s,o):n(e)),a!==r)return a;if(!ea(e))return e;var u=Wo(e);if(u){if(a=function(e){var t=e.length,r=new e.constructor(t);t&&"string"==typeof e[0]&&Pe.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!l)return Ai(e,a)}else{var f=ps(e),d=f==x||f==C;if(Yo(e))return Ci(e,l);if(f==T||f==g||d&&!s){if(a=c||d?{}:bs(e),!l)return c?function(e,t){return Mi(e,ds(e),t)}(e,function(e,t){return e&&Mi(t,Ia(t),e)}(a,e)):function(e,t){return Mi(e,fs(e),t)}(e,nn(a,e))}else{if(!lt[f])return s?e:{};a=function(e,t,r){var n=e.constructor;switch(t){case N:return Ei(e);case v:case w:return new n(+e);case F:return function(e,t){var r=t?Ei(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case P:case j:case L:case D:case B:case H:case z:case U:case V:return Si(e,r);case E:return new n;case S:case M:return new n(e);case k:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case A:return new n;case O:return i=e,Lr?Te(Lr.call(i)):{}}var i}(e,f,l)}}o||(o=new Yr);var p=o.get(e);if(p)return p;o.set(e,a),oa(e)?e.forEach((function(r){a.add(ln(r,t,n,r,e,o))})):ra(e)&&e.forEach((function(r,i){a.set(i,ln(r,t,n,i,e,o))}));var m=u?r:(h?c?is:ns:c?Ia:Oa)(e);return kt(m||e,(function(r,i){m&&(r=e[i=r]),en(a,i,ln(r,t,n,i,e,o))})),a}function cn(e,t,n){var i=n.length;if(null==e)return!i;for(e=Te(e);i--;){var s=n[i],o=t[s],a=e[s];if(a===r&&!(s in e)||!o(a))return!1}return!0}function hn(e,t,i){if("function"!=typeof e)throw new Ae(n);return Ms((function(){e.apply(r,i)}),t)}function un(e,t,r,n){var i=-1,s=It,o=!0,a=e.length,l=[],c=t.length;if(!a)return l;r&&(t=Ft(t,Jt(r))),n?(s=Nt,o=!1):t.length>=200&&(s=er,o=!1,t=new Kr(t));e:for(;++i<a;){var h=e[i],u=null==r?h:r(h);if(h=n||0!==h?h:0,o&&u==u){for(var f=c;f--;)if(t[f]===u)continue e;l.push(h)}else s(t,u,n)||l.push(h)}return l}Br.templateSettings={escape:Z,evaluate:J,interpolate:Q,variable:"",imports:{_:Br}},Br.prototype=zr.prototype,Br.prototype.constructor=Br,Ur.prototype=Hr(zr.prototype),Ur.prototype.constructor=Ur,Vr.prototype=Hr(zr.prototype),Vr.prototype.constructor=Vr,Wr.prototype.clear=function(){this.__data__=kr?kr(null):{},this.size=0},Wr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Wr.prototype.get=function(e){var t=this.__data__;if(kr){var n=t[e];return n===i?r:n}return Pe.call(t,e)?t[e]:r},Wr.prototype.has=function(e){var t=this.__data__;return kr?t[e]!==r:Pe.call(t,e)},Wr.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=kr&&t===r?i:t,this},$r.prototype.clear=function(){this.__data__=[],this.size=0},$r.prototype.delete=function(e){var t=this.__data__,r=tn(t,e);return!(r<0)&&(r==t.length-1?t.pop():Xe.call(t,r,1),--this.size,!0)},$r.prototype.get=function(e){var t=this.__data__,n=tn(t,e);return n<0?r:t[n][1]},$r.prototype.has=function(e){return tn(this.__data__,e)>-1},$r.prototype.set=function(e,t){var r=this.__data__,n=tn(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},qr.prototype.clear=function(){this.size=0,this.__data__={hash:new Wr,map:new(Er||$r),string:new Wr}},qr.prototype.delete=function(e){var t=cs(this,e).delete(e);return this.size-=t?1:0,t},qr.prototype.get=function(e){return cs(this,e).get(e)},qr.prototype.has=function(e){return cs(this,e).has(e)},qr.prototype.set=function(e,t){var r=cs(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Kr.prototype.add=Kr.prototype.push=function(e){return this.__data__.set(e,i),this},Kr.prototype.has=function(e){return this.__data__.has(e)},Yr.prototype.clear=function(){this.__data__=new $r,this.size=0},Yr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Yr.prototype.get=function(e){return this.__data__.get(e)},Yr.prototype.has=function(e){return this.__data__.has(e)},Yr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof $r){var n=r.__data__;if(!Er||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new qr(n)}return r.set(e,t),this.size=r.size,this};var fn=Ni(wn),dn=Ni(_n,!0);function pn(e,t){var r=!0;return fn(e,(function(e,n,i){return r=!!t(e,n,i)})),r}function mn(e,t,n){for(var i=-1,s=e.length;++i<s;){var o=e[i],a=t(o);if(null!=a&&(l===r?a==a&&!la(a):n(a,l)))var l=a,c=o}return c}function bn(e,t){var r=[];return fn(e,(function(e,n,i){t(e,n,i)&&r.push(e)})),r}function gn(e,t,r,n,i){var s=-1,o=e.length;for(r||(r=gs),i||(i=[]);++s<o;){var a=e[s];t>0&&r(a)?t>1?gn(a,t-1,r,n,i):Pt(i,a):n||(i[i.length]=a)}return i}var yn=Fi(),vn=Fi(!0);function wn(e,t){return e&&yn(e,t,Oa)}function _n(e,t){return e&&vn(e,t,Oa)}function xn(e,t){return Ot(t,(function(t){return Zo(e[t])}))}function Cn(e,t){for(var n=0,i=(t=vi(t,e)).length;null!=e&&n<i;)e=e[js(t[n++])];return n&&n==i?e:r}function En(e,t,r){var n=t(e);return Wo(e)?n:Pt(n,r(e))}function Sn(e){return null==e?e===r?"[object Undefined]":"[object Null]":Je&&Je in Te(e)?function(e){var t=Pe.call(e,Je),n=e[Je];try{e[Je]=r;var i=!0}catch(e){}var s=De.call(e);i&&(t?e[Je]=n:delete e[Je]);return s}(e):function(e){return De.call(e)}(e)}function Tn(e,t){return e>t}function Rn(e,t){return null!=e&&Pe.call(e,t)}function kn(e,t){return null!=e&&t in Te(e)}function An(e,t,n){for(var i=n?Nt:It,s=e[0].length,o=e.length,l=o,c=a(o),h=1/0,u=[];l--;){var f=e[l];l&&t&&(f=Ft(f,Jt(t))),h=yr(f.length,h),c[l]=!n&&(t||s>=120&&f.length>=120)?new Kr(l&&f):r}f=e[0];var d=-1,p=c[0];e:for(;++d<s&&u.length<h;){var m=f[d],b=t?t(m):m;if(m=n||0!==m?m:0,!(p?er(p,b):i(u,b,n))){for(l=o;--l;){var g=c[l];if(!(g?er(g,b):i(e[l],b,n)))continue e}p&&p.push(b),u.push(m)}}return u}function Mn(e,t,n){var i=null==(e=Rs(e,t=vi(t,e)))?e:e[js(Xs(t))];return null==i?r:Tt(i,e,n)}function On(e){return ta(e)&&Sn(e)==g}function In(e,t,n,i,s){return e===t||(null==e||null==t||!ta(e)&&!ta(t)?e!=e&&t!=t:function(e,t,n,i,s,o){var a=Wo(e),l=Wo(t),c=a?y:ps(e),h=l?y:ps(t),u=(c=c==g?T:c)==T,f=(h=h==g?T:h)==T,d=c==h;if(d&&Yo(e)){if(!Yo(t))return!1;a=!0,u=!1}if(d&&!u)return o||(o=new Yr),a||ca(e)?ts(e,t,n,i,s,o):function(e,t,r,n,i,s,o){switch(r){case F:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case N:return!(e.byteLength!=t.byteLength||!s(new We(e),new We(t)));case v:case w:case S:return Ho(+e,+t);case _:return e.name==t.name&&e.message==t.message;case k:case M:return e==t+"";case E:var a=ar;case A:var l=1&n;if(a||(a=hr),e.size!=t.size&&!l)return!1;var c=o.get(e);if(c)return c==t;n|=2,o.set(e,t);var h=ts(a(e),a(t),n,i,s,o);return o.delete(e),h;case O:if(Lr)return Lr.call(e)==Lr.call(t)}return!1}(e,t,c,n,i,s,o);if(!(1&n)){var p=u&&Pe.call(e,"__wrapped__"),m=f&&Pe.call(t,"__wrapped__");if(p||m){var b=p?e.value():e,x=m?t.value():t;return o||(o=new Yr),s(b,x,n,i,o)}}if(!d)return!1;return o||(o=new Yr),function(e,t,n,i,s,o){var a=1&n,l=ns(e),c=l.length,h=ns(t),u=h.length;if(c!=u&&!a)return!1;var f=c;for(;f--;){var d=l[f];if(!(a?d in t:Pe.call(t,d)))return!1}var p=o.get(e),m=o.get(t);if(p&&m)return p==t&&m==e;var b=!0;o.set(e,t),o.set(t,e);var g=a;for(;++f<c;){var y=e[d=l[f]],v=t[d];if(i)var w=a?i(v,y,d,t,e,o):i(y,v,d,e,t,o);if(!(w===r?y===v||s(y,v,n,i,o):w)){b=!1;break}g||(g="constructor"==d)}if(b&&!g){var _=e.constructor,x=t.constructor;_==x||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof x&&x instanceof x||(b=!1)}return o.delete(e),o.delete(t),b}(e,t,n,i,s,o)}(e,t,n,i,In,s))}function Nn(e,t,n,i){var s=n.length,o=s,a=!i;if(null==e)return!o;for(e=Te(e);s--;){var l=n[s];if(a&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++s<o;){var c=(l=n[s])[0],h=e[c],u=l[1];if(a&&l[2]){if(h===r&&!(c in e))return!1}else{var f=new Yr;if(i)var d=i(h,u,c,e,t,f);if(!(d===r?In(u,h,3,i,f):d))return!1}}return!0}function Fn(e){return!(!ea(e)||(t=e,Le&&Le in t))&&(Zo(e)?ze:ge).test(Ls(e));var t}function Pn(e){return"function"==typeof e?e:null==e?nl:"object"==typeof e?Wo(e)?zn(e[0],e[1]):Hn(e):fl(e)}function jn(e){if(!Cs(e))return Kt(e);var t=[];for(var r in Te(e))Pe.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Ln(e){if(!ea(e))return function(e){var t=[];if(null!=e)for(var r in Te(e))t.push(r);return t}(e);var t=Cs(e),r=[];for(var n in e)("constructor"!=n||!t&&Pe.call(e,n))&&r.push(n);return r}function Dn(e,t){return e<t}function Bn(e,t){var r=-1,n=qo(e)?a(e.length):[];return fn(e,(function(e,i,s){n[++r]=t(e,i,s)})),n}function Hn(e){var t=hs(e);return 1==t.length&&t[0][2]?Ss(t[0][0],t[0][1]):function(r){return r===e||Nn(r,e,t)}}function zn(e,t){return ws(e)&&Es(t)?Ss(js(e),t):function(n){var i=Ta(n,e);return i===r&&i===t?Ra(n,e):In(t,i,3)}}function Un(e,t,n,i,s){e!==t&&yn(t,(function(o,a){if(s||(s=new Yr),ea(o))!function(e,t,n,i,s,o,a){var l=ks(e,n),c=ks(t,n),h=a.get(c);if(h)return void Qr(e,n,h);var u=o?o(l,c,n+"",e,t,a):r,f=u===r;if(f){var d=Wo(c),p=!d&&Yo(c),m=!d&&!p&&ca(c);u=c,d||p||m?Wo(l)?u=l:Ko(l)?u=Ai(l):p?(f=!1,u=Ci(c,!0)):m?(f=!1,u=Si(c,!0)):u=[]:ia(c)||Vo(c)?(u=l,Vo(l)?u=ga(l):ea(l)&&!Zo(l)||(u=bs(c))):f=!1}f&&(a.set(c,u),s(u,c,i,o,a),a.delete(c));Qr(e,n,u)}(e,t,a,n,Un,i,s);else{var l=i?i(ks(e,a),o,a+"",e,t,s):r;l===r&&(l=o),Qr(e,a,l)}}),Ia)}function Vn(e,t){var n=e.length;if(n)return ys(t+=t<0?n:0,n)?e[t]:r}function Wn(e,t,r){t=t.length?Ft(t,(function(e){return Wo(e)?function(t){return Cn(t,1===e.length?e[0]:e)}:e})):[nl];var n=-1;t=Ft(t,Jt(ls()));var i=Bn(e,(function(e,r,i){var s=Ft(t,(function(t){return t(e)}));return{criteria:s,index:++n,value:e}}));return function(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}(i,(function(e,t){return function(e,t,r){var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;for(;++n<o;){var l=Ti(i[n],s[n]);if(l)return n>=a?l:l*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}))}function $n(e,t,r){for(var n=-1,i=t.length,s={};++n<i;){var o=t[n],a=Cn(e,o);r(a,o)&&Qn(s,vi(o,e),a)}return s}function qn(e,t,r,n){var i=n?Vt:Ut,s=-1,o=t.length,a=e;for(e===t&&(t=Ai(t)),r&&(a=Ft(e,Jt(r)));++s<o;)for(var l=0,c=t[s],h=r?r(c):c;(l=i(a,h,l,n))>-1;)a!==e&&Xe.call(a,l,1),Xe.call(e,l,1);return e}function Kn(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==s){var s=i;ys(i)?Xe.call(e,i,1):ui(e,i)}}return e}function Yn(e,t){return e+mt(_r()*(t-e+1))}function Xn(e,t){var r="";if(!e||t<1||t>d)return r;do{t%2&&(r+=e),(t=mt(t/2))&&(e+=e)}while(t);return r}function Gn(e,t){return Os(Ts(e,t,nl),e+"")}function Zn(e){return Gr(Ha(e))}function Jn(e,t){var r=Ha(e);return Fs(r,an(t,0,r.length))}function Qn(e,t,n,i){if(!ea(e))return e;for(var s=-1,o=(t=vi(t,e)).length,a=o-1,l=e;null!=l&&++s<o;){var c=js(t[s]),h=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(s!=a){var u=l[c];(h=i?i(u,c,l):r)===r&&(h=ea(u)?u:ys(t[s+1])?[]:{})}en(l,c,h),l=l[c]}return e}var ei=Ar?function(e,t){return Ar.set(e,t),e}:nl,ti=tt?function(e,t){return tt(e,"toString",{configurable:!0,enumerable:!1,value:el(t),writable:!0})}:nl;function ri(e){return Fs(Ha(e))}function ni(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var s=a(i);++n<i;)s[n]=e[n+t];return s}function ii(e,t){var r;return fn(e,(function(e,n,i){return!(r=t(e,n,i))})),!!r}function si(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;n<i;){var s=n+i>>>1,o=e[s];null!==o&&!la(o)&&(r?o<=t:o<t)?n=s+1:i=s}return i}return oi(e,t,nl,r)}function oi(e,t,n,i){var s=0,o=null==e?0:e.length;if(0===o)return 0;for(var a=(t=n(t))!=t,l=null===t,c=la(t),h=t===r;s<o;){var u=mt((s+o)/2),f=n(e[u]),d=f!==r,p=null===f,m=f==f,b=la(f);if(a)var g=i||m;else g=h?m&&(i||d):l?m&&d&&(i||!p):c?m&&d&&!p&&(i||!b):!p&&!b&&(i?f<=t:f<t);g?s=u+1:o=u}return yr(o,4294967294)}function ai(e,t){for(var r=-1,n=e.length,i=0,s=[];++r<n;){var o=e[r],a=t?t(o):o;if(!r||!Ho(a,l)){var l=a;s[i++]=0===o?0:o}}return s}function li(e){return"number"==typeof e?e:la(e)?p:+e}function ci(e){if("string"==typeof e)return e;if(Wo(e))return Ft(e,ci)+"";if(la(e))return Dr?Dr.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function hi(e,t,r){var n=-1,i=It,s=e.length,o=!0,a=[],l=a;if(r)o=!1,i=Nt;else if(s>=200){var c=t?null:Xi(e);if(c)return hr(c);o=!1,i=er,l=new Kr}else l=t?[]:a;e:for(;++n<s;){var h=e[n],u=t?t(h):h;if(h=r||0!==h?h:0,o&&u==u){for(var f=l.length;f--;)if(l[f]===u)continue e;t&&l.push(u),a.push(h)}else i(l,u,r)||(l!==a&&l.push(u),a.push(h))}return a}function ui(e,t){return null==(e=Rs(e,t=vi(t,e)))||delete e[js(Xs(t))]}function fi(e,t,r,n){return Qn(e,t,r(Cn(e,t)),n)}function di(e,t,r,n){for(var i=e.length,s=n?i:-1;(n?s--:++s<i)&&t(e[s],s,e););return r?ni(e,n?0:s,n?s+1:i):ni(e,n?s+1:0,n?i:s)}function pi(e,t){var r=e;return r instanceof Vr&&(r=r.value()),jt(t,(function(e,t){return t.func.apply(t.thisArg,Pt([e],t.args))}),r)}function mi(e,t,r){var n=e.length;if(n<2)return n?hi(e[0]):[];for(var i=-1,s=a(n);++i<n;)for(var o=e[i],l=-1;++l<n;)l!=i&&(s[i]=un(s[i]||o,e[l],t,r));return hi(gn(s,1),t,r)}function bi(e,t,n){for(var i=-1,s=e.length,o=t.length,a={};++i<s;){var l=i<o?t[i]:r;n(a,e[i],l)}return a}function gi(e){return Ko(e)?e:[]}function yi(e){return"function"==typeof e?e:nl}function vi(e,t){return Wo(e)?e:ws(e,t)?[e]:Ps(ya(e))}var wi=Gn;function _i(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:ni(e,t,n)}var xi=nt||function(e){return pt.clearTimeout(e)};function Ci(e,t){if(t)return e.slice();var r=e.length,n=$e?$e(r):new e.constructor(r);return e.copy(n),n}function Ei(e){var t=new e.constructor(e.byteLength);return new We(t).set(new We(e)),t}function Si(e,t){var r=t?Ei(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Ti(e,t){if(e!==t){var n=e!==r,i=null===e,s=e==e,o=la(e),a=t!==r,l=null===t,c=t==t,h=la(t);if(!l&&!h&&!o&&e>t||o&&a&&c&&!l&&!h||i&&a&&c||!n&&c||!s)return 1;if(!i&&!o&&!h&&e<t||h&&n&&s&&!i&&!o||l&&n&&s||!a&&s||!c)return-1}return 0}function Ri(e,t,r,n){for(var i=-1,s=e.length,o=r.length,l=-1,c=t.length,h=gr(s-o,0),u=a(c+h),f=!n;++l<c;)u[l]=t[l];for(;++i<o;)(f||i<s)&&(u[r[i]]=e[i]);for(;h--;)u[l++]=e[i++];return u}function ki(e,t,r,n){for(var i=-1,s=e.length,o=-1,l=r.length,c=-1,h=t.length,u=gr(s-l,0),f=a(u+h),d=!n;++i<u;)f[i]=e[i];for(var p=i;++c<h;)f[p+c]=t[c];for(;++o<l;)(d||i<s)&&(f[p+r[o]]=e[i++]);return f}function Ai(e,t){var r=-1,n=e.length;for(t||(t=a(n));++r<n;)t[r]=e[r];return t}function Mi(e,t,n,i){var s=!n;n||(n={});for(var o=-1,a=t.length;++o<a;){var l=t[o],c=i?i(n[l],e[l],l,n,e):r;c===r&&(c=e[l]),s?sn(n,l,c):en(n,l,c)}return n}function Oi(e,t){return function(r,n){var i=Wo(r)?Rt:rn,s=t?t():{};return i(r,e,ls(n,2),s)}}function Ii(e){return Gn((function(t,n){var i=-1,s=n.length,o=s>1?n[s-1]:r,a=s>2?n[2]:r;for(o=e.length>3&&"function"==typeof o?(s--,o):r,a&&vs(n[0],n[1],a)&&(o=s<3?r:o,s=1),t=Te(t);++i<s;){var l=n[i];l&&e(t,l,i,o)}return t}))}function Ni(e,t){return function(r,n){if(null==r)return r;if(!qo(r))return e(r,n);for(var i=r.length,s=t?i:-1,o=Te(r);(t?s--:++s<i)&&!1!==n(o[s],s,o););return r}}function Fi(e){return function(t,r,n){for(var i=-1,s=Te(t),o=n(t),a=o.length;a--;){var l=o[e?a:++i];if(!1===r(s[l],l,s))break}return t}}function Pi(e){return function(t){var n=or(t=ya(t))?dr(t):r,i=n?n[0]:t.charAt(0),s=n?_i(n,1).join(""):t.slice(1);return i[e]()+s}}function ji(e){return function(t){return jt(Za(Va(t).replace(Qe,"")),e,"")}}function Li(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=Hr(e.prototype),n=e.apply(r,t);return ea(n)?n:r}}function Di(e){return function(t,n,i){var s=Te(t);if(!qo(t)){var o=ls(n,3);t=Oa(t),n=function(e){return o(s[e],e,s)}}var a=e(t,n,i);return a>-1?s[o?t[a]:a]:r}}function Bi(e){return rs((function(t){var i=t.length,s=i,o=Ur.prototype.thru;for(e&&t.reverse();s--;){var a=t[s];if("function"!=typeof a)throw new Ae(n);if(o&&!l&&"wrapper"==os(a))var l=new Ur([],!0)}for(s=l?s:i;++s<i;){var c=os(a=t[s]),h="wrapper"==c?ss(a):r;l=h&&_s(h[0])&&424==h[1]&&!h[4].length&&1==h[9]?l[os(h[0])].apply(l,h[3]):1==a.length&&_s(a)?l[c]():l.thru(a)}return function(){var e=arguments,r=e[0];if(l&&1==e.length&&Wo(r))return l.plant(r).value();for(var n=0,s=i?t[n].apply(this,e):r;++n<i;)s=t[n].call(this,s);return s}}))}function Hi(e,t,n,i,s,o,l,c,u,f){var d=t&h,p=1&t,m=2&t,b=24&t,g=512&t,y=m?r:Li(e);return function h(){for(var v=arguments.length,w=a(v),_=v;_--;)w[_]=arguments[_];if(b)var x=as(h),C=function(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(w,x);if(i&&(w=Ri(w,i,s,b)),o&&(w=ki(w,o,l,b)),v-=C,b&&v<f){var E=cr(w,x);return Ki(e,t,Hi,h.placeholder,n,w,E,c,u,f-v)}var S=p?n:this,T=m?S[e]:e;return v=w.length,c?w=function(e,t){var n=e.length,i=yr(t.length,n),s=Ai(e);for(;i--;){var o=t[i];e[i]=ys(o,n)?s[o]:r}return e}(w,c):g&&v>1&&w.reverse(),d&&u<v&&(w.length=u),this&&this!==pt&&this instanceof h&&(T=y||Li(T)),T.apply(S,w)}}function zi(e,t){return function(r,n){return function(e,t,r,n){return wn(e,(function(e,i,s){t(n,r(e),i,s)})),n}(r,e,t(n),{})}}function Ui(e,t){return function(n,i){var s;if(n===r&&i===r)return t;if(n!==r&&(s=n),i!==r){if(s===r)return i;"string"==typeof n||"string"==typeof i?(n=ci(n),i=ci(i)):(n=li(n),i=li(i)),s=e(n,i)}return s}}function Vi(e){return rs((function(t){return t=Ft(t,Jt(ls())),Gn((function(r){var n=this;return e(t,(function(e){return Tt(e,n,r)}))}))}))}function Wi(e,t){var n=(t=t===r?" ":ci(t)).length;if(n<2)return n?Xn(t,e):t;var i=Xn(t,dt(e/fr(t)));return or(t)?_i(dr(i),0,e).join(""):i.slice(0,e)}function $i(e){return function(t,n,i){return i&&"number"!=typeof i&&vs(t,n,i)&&(n=i=r),t=da(t),n===r?(n=t,t=0):n=da(n),function(e,t,r,n){for(var i=-1,s=gr(dt((t-e)/(r||1)),0),o=a(s);s--;)o[n?s:++i]=e,e+=r;return o}(t,n,i=i===r?t<n?1:-1:da(i),e)}}function qi(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=ba(t),r=ba(r)),e(t,r)}}function Ki(e,t,n,i,s,o,a,h,u,f){var d=8&t;t|=d?l:c,4&(t&=~(d?c:l))||(t&=-4);var p=[e,t,s,d?o:r,d?a:r,d?r:o,d?r:a,h,u,f],m=n.apply(r,p);return _s(e)&&As(m,p),m.placeholder=i,Is(m,e,t)}function Yi(e){var t=Se[e];return function(e,r){if(e=ba(e),(r=null==r?0:yr(pa(r),292))&&vt(e)){var n=(ya(e)+"e").split("e");return+((n=(ya(t(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return t(e)}}var Xi=Tr&&1/hr(new Tr([,-0]))[1]==f?function(e){return new Tr(e)}:ll;function Gi(e){return function(t){var r=ps(t);return r==E?ar(t):r==A?ur(t):function(e,t){return Ft(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Zi(e,t,i,f,d,p,m,b){var g=2&t;if(!g&&"function"!=typeof e)throw new Ae(n);var y=f?f.length:0;if(y||(t&=-97,f=d=r),m=m===r?m:gr(pa(m),0),b=b===r?b:pa(b),y-=d?d.length:0,t&c){var v=f,w=d;f=d=r}var _=g?r:ss(e),x=[e,t,i,f,d,v,w,p,m,b];if(_&&function(e,t){var r=e[1],n=t[1],i=r|n,o=i<131,a=n==h&&8==r||n==h&&r==u&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==r;if(!o&&!a)return e;1&n&&(e[2]=t[2],i|=1&r?0:4);var l=t[3];if(l){var c=e[3];e[3]=c?Ri(c,l,t[4]):l,e[4]=c?cr(e[3],s):t[4]}(l=t[5])&&(c=e[5],e[5]=c?ki(c,l,t[6]):l,e[6]=c?cr(e[5],s):t[6]);(l=t[7])&&(e[7]=l);n&h&&(e[8]=null==e[8]?t[8]:yr(e[8],t[8]));null==e[9]&&(e[9]=t[9]);e[0]=t[0],e[1]=i}(x,_),e=x[0],t=x[1],i=x[2],f=x[3],d=x[4],!(b=x[9]=x[9]===r?g?0:e.length:gr(x[9]-y,0))&&24&t&&(t&=-25),t&&1!=t)C=8==t||t==o?function(e,t,n){var i=Li(e);return function s(){for(var o=arguments.length,l=a(o),c=o,h=as(s);c--;)l[c]=arguments[c];var u=o<3&&l[0]!==h&&l[o-1]!==h?[]:cr(l,h);return(o-=u.length)<n?Ki(e,t,Hi,s.placeholder,r,l,u,r,r,n-o):Tt(this&&this!==pt&&this instanceof s?i:e,this,l)}}(e,t,b):t!=l&&33!=t||d.length?Hi.apply(r,x):function(e,t,r,n){var i=1&t,s=Li(e);return function t(){for(var o=-1,l=arguments.length,c=-1,h=n.length,u=a(h+l),f=this&&this!==pt&&this instanceof t?s:e;++c<h;)u[c]=n[c];for(;l--;)u[c++]=arguments[++o];return Tt(f,i?r:this,u)}}(e,t,i,f);else var C=function(e,t,r){var n=1&t,i=Li(e);return function t(){return(this&&this!==pt&&this instanceof t?i:e).apply(n?r:this,arguments)}}(e,t,i);return Is((_?ei:As)(C,x),e,t)}function Ji(e,t,n,i){return e===r||Ho(e,Ie[n])&&!Pe.call(i,n)?t:e}function Qi(e,t,n,i,s,o){return ea(e)&&ea(t)&&(o.set(t,e),Un(e,t,r,Qi,o),o.delete(t)),e}function es(e){return ia(e)?r:e}function ts(e,t,n,i,s,o){var a=1&n,l=e.length,c=t.length;if(l!=c&&!(a&&c>l))return!1;var h=o.get(e),u=o.get(t);if(h&&u)return h==t&&u==e;var f=-1,d=!0,p=2&n?new Kr:r;for(o.set(e,t),o.set(t,e);++f<l;){var m=e[f],b=t[f];if(i)var g=a?i(b,m,f,t,e,o):i(m,b,f,e,t,o);if(g!==r){if(g)continue;d=!1;break}if(p){if(!Dt(t,(function(e,t){if(!er(p,t)&&(m===e||s(m,e,n,i,o)))return p.push(t)}))){d=!1;break}}else if(m!==b&&!s(m,b,n,i,o)){d=!1;break}}return o.delete(e),o.delete(t),d}function rs(e){return Os(Ts(e,r,Ws),e+"")}function ns(e){return En(e,Oa,fs)}function is(e){return En(e,Ia,ds)}var ss=Ar?function(e){return Ar.get(e)}:ll;function os(e){for(var t=e.name+"",r=Mr[t],n=Pe.call(Mr,t)?r.length:0;n--;){var i=r[n],s=i.func;if(null==s||s==e)return i.name}return t}function as(e){return(Pe.call(Br,"placeholder")?Br:e).placeholder}function ls(){var e=Br.iteratee||il;return e=e===il?Pn:e,arguments.length?e(arguments[0],arguments[1]):e}function cs(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function hs(e){for(var t=Oa(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Es(i)]}return t}function us(e,t){var n=function(e,t){return null==e?r:e[t]}(e,t);return Fn(n)?n:r}var fs=bt?function(e){return null==e?[]:(e=Te(e),Ot(bt(e),(function(t){return Ye.call(e,t)})))}:ml,ds=bt?function(e){for(var t=[];e;)Pt(t,fs(e)),e=qe(e);return t}:ml,ps=Sn;function ms(e,t,r){for(var n=-1,i=(t=vi(t,e)).length,s=!1;++n<i;){var o=js(t[n]);if(!(s=null!=e&&r(e,o)))break;e=e[o]}return s||++n!=i?s:!!(i=null==e?0:e.length)&&Qo(i)&&ys(o,i)&&(Wo(e)||Vo(e))}function bs(e){return"function"!=typeof e.constructor||Cs(e)?{}:Hr(qe(e))}function gs(e){return Wo(e)||Vo(e)||!!(Ge&&e&&e[Ge])}function ys(e,t){var r=typeof e;return!!(t=null==t?d:t)&&("number"==r||"symbol"!=r&&ve.test(e))&&e>-1&&e%1==0&&e<t}function vs(e,t,r){if(!ea(r))return!1;var n=typeof t;return!!("number"==n?qo(r)&&ys(t,r.length):"string"==n&&t in r)&&Ho(r[t],e)}function ws(e,t){if(Wo(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!la(e))||(te.test(e)||!ee.test(e)||null!=t&&e in Te(t))}function _s(e){var t=os(e),r=Br[t];if("function"!=typeof r||!(t in Vr.prototype))return!1;if(e===r)return!0;var n=ss(r);return!!n&&e===n[0]}(Cr&&ps(new Cr(new ArrayBuffer(1)))!=F||Er&&ps(new Er)!=E||Sr&&ps(Sr.resolve())!=R||Tr&&ps(new Tr)!=A||Rr&&ps(new Rr)!=I)&&(ps=function(e){var t=Sn(e),n=t==T?e.constructor:r,i=n?Ls(n):"";if(i)switch(i){case Or:return F;case Ir:return E;case Nr:return R;case Fr:return A;case Pr:return I}return t});var xs=Ne?Zo:bl;function Cs(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ie)}function Es(e){return e==e&&!ea(e)}function Ss(e,t){return function(n){return null!=n&&(n[e]===t&&(t!==r||e in Te(n)))}}function Ts(e,t,n){return t=gr(t===r?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=gr(r.length-t,0),o=a(s);++i<s;)o[i]=r[t+i];i=-1;for(var l=a(t+1);++i<t;)l[i]=r[i];return l[t]=n(o),Tt(e,this,l)}}function Rs(e,t){return t.length<2?e:Cn(e,ni(t,0,-1))}function ks(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var As=Ns(ei),Ms=ft||function(e,t){return pt.setTimeout(e,t)},Os=Ns(ti);function Is(e,t,r){var n=t+"";return Os(e,function(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(ae,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return kt(b,(function(r){var n="_."+r[0];t&r[1]&&!It(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(le);return t?t[1].split(ce):[]}(n),r)))}function Ns(e){var t=0,n=0;return function(){var i=vr(),s=16-(i-n);if(n=i,s>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Fs(e,t){var n=-1,i=e.length,s=i-1;for(t=t===r?i:t;++n<t;){var o=Yn(n,s),a=e[o];e[o]=e[n],e[n]=a}return e.length=t,e}var Ps=function(e){var t=Fo(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(re,(function(e,r,n,i){t.push(n?i.replace(fe,"$1"):r||e)})),t}));function js(e){if("string"==typeof e||la(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ls(e){if(null!=e){try{return Fe.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ds(e){if(e instanceof Vr)return e.clone();var t=new Ur(e.__wrapped__,e.__chain__);return t.__actions__=Ai(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Bs=Gn((function(e,t){return Ko(e)?un(e,gn(t,1,Ko,!0)):[]})),Hs=Gn((function(e,t){var n=Xs(t);return Ko(n)&&(n=r),Ko(e)?un(e,gn(t,1,Ko,!0),ls(n,2)):[]})),zs=Gn((function(e,t){var n=Xs(t);return Ko(n)&&(n=r),Ko(e)?un(e,gn(t,1,Ko,!0),r,n):[]}));function Us(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:pa(r);return i<0&&(i=gr(n+i,0)),zt(e,ls(t,3),i)}function Vs(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var s=i-1;return n!==r&&(s=pa(n),s=n<0?gr(i+s,0):yr(s,i-1)),zt(e,ls(t,3),s,!0)}function Ws(e){return(null==e?0:e.length)?gn(e,1):[]}function $s(e){return e&&e.length?e[0]:r}var qs=Gn((function(e){var t=Ft(e,gi);return t.length&&t[0]===e[0]?An(t):[]})),Ks=Gn((function(e){var t=Xs(e),n=Ft(e,gi);return t===Xs(n)?t=r:n.pop(),n.length&&n[0]===e[0]?An(n,ls(t,2)):[]})),Ys=Gn((function(e){var t=Xs(e),n=Ft(e,gi);return(t="function"==typeof t?t:r)&&n.pop(),n.length&&n[0]===e[0]?An(n,r,t):[]}));function Xs(e){var t=null==e?0:e.length;return t?e[t-1]:r}var Gs=Gn(Zs);function Zs(e,t){return e&&e.length&&t&&t.length?qn(e,t):e}var Js=rs((function(e,t){var r=null==e?0:e.length,n=on(e,t);return Kn(e,Ft(t,(function(e){return ys(e,r)?+e:e})).sort(Ti)),n}));function Qs(e){return null==e?e:xr.call(e)}var eo=Gn((function(e){return hi(gn(e,1,Ko,!0))})),to=Gn((function(e){var t=Xs(e);return Ko(t)&&(t=r),hi(gn(e,1,Ko,!0),ls(t,2))})),ro=Gn((function(e){var t=Xs(e);return t="function"==typeof t?t:r,hi(gn(e,1,Ko,!0),r,t)}));function no(e){if(!e||!e.length)return[];var t=0;return e=Ot(e,(function(e){if(Ko(e))return t=gr(e.length,t),!0})),Gt(t,(function(t){return Ft(e,qt(t))}))}function io(e,t){if(!e||!e.length)return[];var n=no(e);return null==t?n:Ft(n,(function(e){return Tt(t,r,e)}))}var so=Gn((function(e,t){return Ko(e)?un(e,t):[]})),oo=Gn((function(e){return mi(Ot(e,Ko))})),ao=Gn((function(e){var t=Xs(e);return Ko(t)&&(t=r),mi(Ot(e,Ko),ls(t,2))})),lo=Gn((function(e){var t=Xs(e);return t="function"==typeof t?t:r,mi(Ot(e,Ko),r,t)})),co=Gn(no);var ho=Gn((function(e){var t=e.length,n=t>1?e[t-1]:r;return n="function"==typeof n?(e.pop(),n):r,io(e,n)}));function uo(e){var t=Br(e);return t.__chain__=!0,t}function fo(e,t){return t(e)}var po=rs((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,s=function(t){return on(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Vr&&ys(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:fo,args:[s],thisArg:r}),new Ur(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(r),e}))):this.thru(s)}));var mo=Oi((function(e,t,r){Pe.call(e,r)?++e[r]:sn(e,r,1)}));var bo=Di(Us),go=Di(Vs);function yo(e,t){return(Wo(e)?kt:fn)(e,ls(t,3))}function vo(e,t){return(Wo(e)?At:dn)(e,ls(t,3))}var wo=Oi((function(e,t,r){Pe.call(e,r)?e[r].push(t):sn(e,r,[t])}));var _o=Gn((function(e,t,r){var n=-1,i="function"==typeof t,s=qo(e)?a(e.length):[];return fn(e,(function(e){s[++n]=i?Tt(t,e,r):Mn(e,t,r)})),s})),xo=Oi((function(e,t,r){sn(e,r,t)}));function Co(e,t){return(Wo(e)?Ft:Bn)(e,ls(t,3))}var Eo=Oi((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]}));var So=Gn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&vs(e,t[0],t[1])?t=[]:r>2&&vs(t[0],t[1],t[2])&&(t=[t[0]]),Wn(e,gn(t,1),[])})),To=ct||function(){return pt.Date.now()};function Ro(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Zi(e,h,r,r,r,r,t)}function ko(e,t){var i;if("function"!=typeof t)throw new Ae(n);return e=pa(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=r),i}}var Ao=Gn((function(e,t,r){var n=1;if(r.length){var i=cr(r,as(Ao));n|=l}return Zi(e,n,t,r,i)})),Mo=Gn((function(e,t,r){var n=3;if(r.length){var i=cr(r,as(Mo));n|=l}return Zi(t,n,e,r,i)}));function Oo(e,t,i){var s,o,a,l,c,h,u=0,f=!1,d=!1,p=!0;if("function"!=typeof e)throw new Ae(n);function m(t){var n=s,i=o;return s=o=r,u=t,l=e.apply(i,n)}function b(e){var n=e-h;return h===r||n>=t||n<0||d&&e-u>=a}function g(){var e=To();if(b(e))return y(e);c=Ms(g,function(e){var r=t-(e-h);return d?yr(r,a-(e-u)):r}(e))}function y(e){return c=r,p&&s?m(e):(s=o=r,l)}function v(){var e=To(),n=b(e);if(s=arguments,o=this,h=e,n){if(c===r)return function(e){return u=e,c=Ms(g,t),f?m(e):l}(h);if(d)return xi(c),c=Ms(g,t),m(h)}return c===r&&(c=Ms(g,t)),l}return t=ba(t)||0,ea(i)&&(f=!!i.leading,a=(d="maxWait"in i)?gr(ba(i.maxWait)||0,t):a,p="trailing"in i?!!i.trailing:p),v.cancel=function(){c!==r&&xi(c),u=0,s=h=o=c=r},v.flush=function(){return c===r?l:y(To())},v}var Io=Gn((function(e,t){return hn(e,1,t)})),No=Gn((function(e,t,r){return hn(e,ba(t)||0,r)}));function Fo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ae(n);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(Fo.Cache||qr),r}function Po(e){if("function"!=typeof e)throw new Ae(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Fo.Cache=qr;var jo=wi((function(e,t){var r=(t=1==t.length&&Wo(t[0])?Ft(t[0],Jt(ls())):Ft(gn(t,1),Jt(ls()))).length;return Gn((function(n){for(var i=-1,s=yr(n.length,r);++i<s;)n[i]=t[i].call(this,n[i]);return Tt(e,this,n)}))})),Lo=Gn((function(e,t){var n=cr(t,as(Lo));return Zi(e,l,r,t,n)})),Do=Gn((function(e,t){var n=cr(t,as(Do));return Zi(e,c,r,t,n)})),Bo=rs((function(e,t){return Zi(e,u,r,r,r,t)}));function Ho(e,t){return e===t||e!=e&&t!=t}var zo=qi(Tn),Uo=qi((function(e,t){return e>=t})),Vo=On(function(){return arguments}())?On:function(e){return ta(e)&&Pe.call(e,"callee")&&!Ye.call(e,"callee")},Wo=a.isArray,$o=wt?Jt(wt):function(e){return ta(e)&&Sn(e)==N};function qo(e){return null!=e&&Qo(e.length)&&!Zo(e)}function Ko(e){return ta(e)&&qo(e)}var Yo=yt||bl,Xo=_t?Jt(_t):function(e){return ta(e)&&Sn(e)==w};function Go(e){if(!ta(e))return!1;var t=Sn(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ia(e)}function Zo(e){if(!ea(e))return!1;var t=Sn(e);return t==x||t==C||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Jo(e){return"number"==typeof e&&e==pa(e)}function Qo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=d}function ea(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ta(e){return null!=e&&"object"==typeof e}var ra=xt?Jt(xt):function(e){return ta(e)&&ps(e)==E};function na(e){return"number"==typeof e||ta(e)&&Sn(e)==S}function ia(e){if(!ta(e)||Sn(e)!=T)return!1;var t=qe(e);if(null===t)return!0;var r=Pe.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Fe.call(r)==Be}var sa=Ct?Jt(Ct):function(e){return ta(e)&&Sn(e)==k};var oa=Et?Jt(Et):function(e){return ta(e)&&ps(e)==A};function aa(e){return"string"==typeof e||!Wo(e)&&ta(e)&&Sn(e)==M}function la(e){return"symbol"==typeof e||ta(e)&&Sn(e)==O}var ca=St?Jt(St):function(e){return ta(e)&&Qo(e.length)&&!!at[Sn(e)]};var ha=qi(Dn),ua=qi((function(e,t){return e<=t}));function fa(e){if(!e)return[];if(qo(e))return aa(e)?dr(e):Ai(e);if(Ze&&e[Ze])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[Ze]());var t=ps(e);return(t==E?ar:t==A?hr:Ha)(e)}function da(e){return e?(e=ba(e))===f||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function pa(e){var t=da(e),r=t%1;return t==t?r?t-r:t:0}function ma(e){return e?an(pa(e),0,m):0}function ba(e){if("number"==typeof e)return e;if(la(e))return p;if(ea(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ea(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Zt(e);var r=be.test(e);return r||ye.test(e)?ut(e.slice(2),r?2:8):me.test(e)?p:+e}function ga(e){return Mi(e,Ia(e))}function ya(e){return null==e?"":ci(e)}var va=Ii((function(e,t){if(Cs(t)||qo(t))Mi(t,Oa(t),e);else for(var r in t)Pe.call(t,r)&&en(e,r,t[r])})),wa=Ii((function(e,t){Mi(t,Ia(t),e)})),_a=Ii((function(e,t,r,n){Mi(t,Ia(t),e,n)})),xa=Ii((function(e,t,r,n){Mi(t,Oa(t),e,n)})),Ca=rs(on);var Ea=Gn((function(e,t){e=Te(e);var n=-1,i=t.length,s=i>2?t[2]:r;for(s&&vs(t[0],t[1],s)&&(i=1);++n<i;)for(var o=t[n],a=Ia(o),l=-1,c=a.length;++l<c;){var h=a[l],u=e[h];(u===r||Ho(u,Ie[h])&&!Pe.call(e,h))&&(e[h]=o[h])}return e})),Sa=Gn((function(e){return e.push(r,Qi),Tt(Fa,r,e)}));function Ta(e,t,n){var i=null==e?r:Cn(e,t);return i===r?n:i}function Ra(e,t){return null!=e&&ms(e,t,kn)}var ka=zi((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),e[t]=r}),el(nl)),Aa=zi((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),Pe.call(e,t)?e[t].push(r):e[t]=[r]}),ls),Ma=Gn(Mn);function Oa(e){return qo(e)?Xr(e):jn(e)}function Ia(e){return qo(e)?Xr(e,!0):Ln(e)}var Na=Ii((function(e,t,r){Un(e,t,r)})),Fa=Ii((function(e,t,r,n){Un(e,t,r,n)})),Pa=rs((function(e,t){var r={};if(null==e)return r;var n=!1;t=Ft(t,(function(t){return t=vi(t,e),n||(n=t.length>1),t})),Mi(e,is(e),r),n&&(r=ln(r,7,es));for(var i=t.length;i--;)ui(r,t[i]);return r}));var ja=rs((function(e,t){return null==e?{}:function(e,t){return $n(e,t,(function(t,r){return Ra(e,r)}))}(e,t)}));function La(e,t){if(null==e)return{};var r=Ft(is(e),(function(e){return[e]}));return t=ls(t),$n(e,r,(function(e,r){return t(e,r[0])}))}var Da=Gi(Oa),Ba=Gi(Ia);function Ha(e){return null==e?[]:Qt(e,Oa(e))}var za=ji((function(e,t,r){return t=t.toLowerCase(),e+(r?Ua(t):t)}));function Ua(e){return Ga(ya(e).toLowerCase())}function Va(e){return(e=ya(e))&&e.replace(we,nr).replace(et,"")}var Wa=ji((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),$a=ji((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),qa=Pi("toLowerCase");var Ka=ji((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}));var Ya=ji((function(e,t,r){return e+(r?" ":"")+Ga(t)}));var Xa=ji((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Ga=Pi("toUpperCase");function Za(e,t,n){return e=ya(e),(t=n?r:t)===r?function(e){return it.test(e)}(e)?function(e){return e.match(rt)||[]}(e):function(e){return e.match(he)||[]}(e):e.match(t)||[]}var Ja=Gn((function(e,t){try{return Tt(e,r,t)}catch(e){return Go(e)?e:new Ce(e)}})),Qa=rs((function(e,t){return kt(t,(function(t){t=js(t),sn(e,t,Ao(e[t],e))})),e}));function el(e){return function(){return e}}var tl=Bi(),rl=Bi(!0);function nl(e){return e}function il(e){return Pn("function"==typeof e?e:ln(e,1))}var sl=Gn((function(e,t){return function(r){return Mn(r,e,t)}})),ol=Gn((function(e,t){return function(r){return Mn(e,r,t)}}));function al(e,t,r){var n=Oa(t),i=xn(t,n);null!=r||ea(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=xn(t,Oa(t)));var s=!(ea(r)&&"chain"in r&&!r.chain),o=Zo(e);return kt(i,(function(r){var n=t[r];e[r]=n,o&&(e.prototype[r]=function(){var t=this.__chain__;if(s||t){var r=e(this.__wrapped__);return(r.__actions__=Ai(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,Pt([this.value()],arguments))})})),e}function ll(){}var cl=Vi(Ft),hl=Vi(Mt),ul=Vi(Dt);function fl(e){return ws(e)?qt(js(e)):function(e){return function(t){return Cn(t,e)}}(e)}var dl=$i(),pl=$i(!0);function ml(){return[]}function bl(){return!1}var gl=Ui((function(e,t){return e+t}),0),yl=Yi("ceil"),vl=Ui((function(e,t){return e/t}),1),wl=Yi("floor");var _l,xl=Ui((function(e,t){return e*t}),1),Cl=Yi("round"),El=Ui((function(e,t){return e-t}),0);return Br.after=function(e,t){if("function"!=typeof t)throw new Ae(n);return e=pa(e),function(){if(--e<1)return t.apply(this,arguments)}},Br.ary=Ro,Br.assign=va,Br.assignIn=wa,Br.assignInWith=_a,Br.assignWith=xa,Br.at=Ca,Br.before=ko,Br.bind=Ao,Br.bindAll=Qa,Br.bindKey=Mo,Br.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wo(e)?e:[e]},Br.chain=uo,Br.chunk=function(e,t,n){t=(n?vs(e,t,n):t===r)?1:gr(pa(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var s=0,o=0,l=a(dt(i/t));s<i;)l[o++]=ni(e,s,s+=t);return l},Br.compact=function(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var s=e[t];s&&(i[n++]=s)}return i},Br.concat=function(){var e=arguments.length;if(!e)return[];for(var t=a(e-1),r=arguments[0],n=e;n--;)t[n-1]=arguments[n];return Pt(Wo(r)?Ai(r):[r],gn(t,1))},Br.cond=function(e){var t=null==e?0:e.length,r=ls();return e=t?Ft(e,(function(e){if("function"!=typeof e[1])throw new Ae(n);return[r(e[0]),e[1]]})):[],Gn((function(r){for(var n=-1;++n<t;){var i=e[n];if(Tt(i[0],this,r))return Tt(i[1],this,r)}}))},Br.conforms=function(e){return function(e){var t=Oa(e);return function(r){return cn(r,e,t)}}(ln(e,1))},Br.constant=el,Br.countBy=mo,Br.create=function(e,t){var r=Hr(e);return null==t?r:nn(r,t)},Br.curry=function e(t,n,i){var s=Zi(t,8,r,r,r,r,r,n=i?r:n);return s.placeholder=e.placeholder,s},Br.curryRight=function e(t,n,i){var s=Zi(t,o,r,r,r,r,r,n=i?r:n);return s.placeholder=e.placeholder,s},Br.debounce=Oo,Br.defaults=Ea,Br.defaultsDeep=Sa,Br.defer=Io,Br.delay=No,Br.difference=Bs,Br.differenceBy=Hs,Br.differenceWith=zs,Br.drop=function(e,t,n){var i=null==e?0:e.length;return i?ni(e,(t=n||t===r?1:pa(t))<0?0:t,i):[]},Br.dropRight=function(e,t,n){var i=null==e?0:e.length;return i?ni(e,0,(t=i-(t=n||t===r?1:pa(t)))<0?0:t):[]},Br.dropRightWhile=function(e,t){return e&&e.length?di(e,ls(t,3),!0,!0):[]},Br.dropWhile=function(e,t){return e&&e.length?di(e,ls(t,3),!0):[]},Br.fill=function(e,t,n,i){var s=null==e?0:e.length;return s?(n&&"number"!=typeof n&&vs(e,t,n)&&(n=0,i=s),function(e,t,n,i){var s=e.length;for((n=pa(n))<0&&(n=-n>s?0:s+n),(i=i===r||i>s?s:pa(i))<0&&(i+=s),i=n>i?0:ma(i);n<i;)e[n++]=t;return e}(e,t,n,i)):[]},Br.filter=function(e,t){return(Wo(e)?Ot:bn)(e,ls(t,3))},Br.flatMap=function(e,t){return gn(Co(e,t),1)},Br.flatMapDeep=function(e,t){return gn(Co(e,t),f)},Br.flatMapDepth=function(e,t,n){return n=n===r?1:pa(n),gn(Co(e,t),n)},Br.flatten=Ws,Br.flattenDeep=function(e){return(null==e?0:e.length)?gn(e,f):[]},Br.flattenDepth=function(e,t){return(null==e?0:e.length)?gn(e,t=t===r?1:pa(t)):[]},Br.flip=function(e){return Zi(e,512)},Br.flow=tl,Br.flowRight=rl,Br.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,n={};++t<r;){var i=e[t];n[i[0]]=i[1]}return n},Br.functions=function(e){return null==e?[]:xn(e,Oa(e))},Br.functionsIn=function(e){return null==e?[]:xn(e,Ia(e))},Br.groupBy=wo,Br.initial=function(e){return(null==e?0:e.length)?ni(e,0,-1):[]},Br.intersection=qs,Br.intersectionBy=Ks,Br.intersectionWith=Ys,Br.invert=ka,Br.invertBy=Aa,Br.invokeMap=_o,Br.iteratee=il,Br.keyBy=xo,Br.keys=Oa,Br.keysIn=Ia,Br.map=Co,Br.mapKeys=function(e,t){var r={};return t=ls(t,3),wn(e,(function(e,n,i){sn(r,t(e,n,i),e)})),r},Br.mapValues=function(e,t){var r={};return t=ls(t,3),wn(e,(function(e,n,i){sn(r,n,t(e,n,i))})),r},Br.matches=function(e){return Hn(ln(e,1))},Br.matchesProperty=function(e,t){return zn(e,ln(t,1))},Br.memoize=Fo,Br.merge=Na,Br.mergeWith=Fa,Br.method=sl,Br.methodOf=ol,Br.mixin=al,Br.negate=Po,Br.nthArg=function(e){return e=pa(e),Gn((function(t){return Vn(t,e)}))},Br.omit=Pa,Br.omitBy=function(e,t){return La(e,Po(ls(t)))},Br.once=function(e){return ko(2,e)},Br.orderBy=function(e,t,n,i){return null==e?[]:(Wo(t)||(t=null==t?[]:[t]),Wo(n=i?r:n)||(n=null==n?[]:[n]),Wn(e,t,n))},Br.over=cl,Br.overArgs=jo,Br.overEvery=hl,Br.overSome=ul,Br.partial=Lo,Br.partialRight=Do,Br.partition=Eo,Br.pick=ja,Br.pickBy=La,Br.property=fl,Br.propertyOf=function(e){return function(t){return null==e?r:Cn(e,t)}},Br.pull=Gs,Br.pullAll=Zs,Br.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?qn(e,t,ls(r,2)):e},Br.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?qn(e,t,r,n):e},Br.pullAt=Js,Br.range=dl,Br.rangeRight=pl,Br.rearg=Bo,Br.reject=function(e,t){return(Wo(e)?Ot:bn)(e,Po(ls(t,3)))},Br.remove=function(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],s=e.length;for(t=ls(t,3);++n<s;){var o=e[n];t(o,n,e)&&(r.push(o),i.push(n))}return Kn(e,i),r},Br.rest=function(e,t){if("function"!=typeof e)throw new Ae(n);return Gn(e,t=t===r?t:pa(t))},Br.reverse=Qs,Br.sampleSize=function(e,t,n){return t=(n?vs(e,t,n):t===r)?1:pa(t),(Wo(e)?Zr:Jn)(e,t)},Br.set=function(e,t,r){return null==e?e:Qn(e,t,r)},Br.setWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:Qn(e,t,n,i)},Br.shuffle=function(e){return(Wo(e)?Jr:ri)(e)},Br.slice=function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&vs(e,t,n)?(t=0,n=i):(t=null==t?0:pa(t),n=n===r?i:pa(n)),ni(e,t,n)):[]},Br.sortBy=So,Br.sortedUniq=function(e){return e&&e.length?ai(e):[]},Br.sortedUniqBy=function(e,t){return e&&e.length?ai(e,ls(t,2)):[]},Br.split=function(e,t,n){return n&&"number"!=typeof n&&vs(e,t,n)&&(t=n=r),(n=n===r?m:n>>>0)?(e=ya(e))&&("string"==typeof t||null!=t&&!sa(t))&&!(t=ci(t))&&or(e)?_i(dr(e),0,n):e.split(t,n):[]},Br.spread=function(e,t){if("function"!=typeof e)throw new Ae(n);return t=null==t?0:gr(pa(t),0),Gn((function(r){var n=r[t],i=_i(r,0,t);return n&&Pt(i,n),Tt(e,this,i)}))},Br.tail=function(e){var t=null==e?0:e.length;return t?ni(e,1,t):[]},Br.take=function(e,t,n){return e&&e.length?ni(e,0,(t=n||t===r?1:pa(t))<0?0:t):[]},Br.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?ni(e,(t=i-(t=n||t===r?1:pa(t)))<0?0:t,i):[]},Br.takeRightWhile=function(e,t){return e&&e.length?di(e,ls(t,3),!1,!0):[]},Br.takeWhile=function(e,t){return e&&e.length?di(e,ls(t,3)):[]},Br.tap=function(e,t){return t(e),e},Br.throttle=function(e,t,r){var i=!0,s=!0;if("function"!=typeof e)throw new Ae(n);return ea(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),Oo(e,t,{leading:i,maxWait:t,trailing:s})},Br.thru=fo,Br.toArray=fa,Br.toPairs=Da,Br.toPairsIn=Ba,Br.toPath=function(e){return Wo(e)?Ft(e,js):la(e)?[e]:Ai(Ps(ya(e)))},Br.toPlainObject=ga,Br.transform=function(e,t,r){var n=Wo(e),i=n||Yo(e)||ca(e);if(t=ls(t,4),null==r){var s=e&&e.constructor;r=i?n?new s:[]:ea(e)&&Zo(s)?Hr(qe(e)):{}}return(i?kt:wn)(e,(function(e,n,i){return t(r,e,n,i)})),r},Br.unary=function(e){return Ro(e,1)},Br.union=eo,Br.unionBy=to,Br.unionWith=ro,Br.uniq=function(e){return e&&e.length?hi(e):[]},Br.uniqBy=function(e,t){return e&&e.length?hi(e,ls(t,2)):[]},Br.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?hi(e,r,t):[]},Br.unset=function(e,t){return null==e||ui(e,t)},Br.unzip=no,Br.unzipWith=io,Br.update=function(e,t,r){return null==e?e:fi(e,t,yi(r))},Br.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:fi(e,t,yi(n),i)},Br.values=Ha,Br.valuesIn=function(e){return null==e?[]:Qt(e,Ia(e))},Br.without=so,Br.words=Za,Br.wrap=function(e,t){return Lo(yi(t),e)},Br.xor=oo,Br.xorBy=ao,Br.xorWith=lo,Br.zip=co,Br.zipObject=function(e,t){return bi(e||[],t||[],en)},Br.zipObjectDeep=function(e,t){return bi(e||[],t||[],Qn)},Br.zipWith=ho,Br.entries=Da,Br.entriesIn=Ba,Br.extend=wa,Br.extendWith=_a,al(Br,Br),Br.add=gl,Br.attempt=Ja,Br.camelCase=za,Br.capitalize=Ua,Br.ceil=yl,Br.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=ba(n))==n?n:0),t!==r&&(t=(t=ba(t))==t?t:0),an(ba(e),t,n)},Br.clone=function(e){return ln(e,4)},Br.cloneDeep=function(e){return ln(e,5)},Br.cloneDeepWith=function(e,t){return ln(e,5,t="function"==typeof t?t:r)},Br.cloneWith=function(e,t){return ln(e,4,t="function"==typeof t?t:r)},Br.conformsTo=function(e,t){return null==t||cn(e,t,Oa(t))},Br.deburr=Va,Br.defaultTo=function(e,t){return null==e||e!=e?t:e},Br.divide=vl,Br.endsWith=function(e,t,n){e=ya(e),t=ci(t);var i=e.length,s=n=n===r?i:an(pa(n),0,i);return(n-=t.length)>=0&&e.slice(n,s)==t},Br.eq=Ho,Br.escape=function(e){return(e=ya(e))&&G.test(e)?e.replace(Y,ir):e},Br.escapeRegExp=function(e){return(e=ya(e))&&ie.test(e)?e.replace(ne,"\\$&"):e},Br.every=function(e,t,n){var i=Wo(e)?Mt:pn;return n&&vs(e,t,n)&&(t=r),i(e,ls(t,3))},Br.find=bo,Br.findIndex=Us,Br.findKey=function(e,t){return Ht(e,ls(t,3),wn)},Br.findLast=go,Br.findLastIndex=Vs,Br.findLastKey=function(e,t){return Ht(e,ls(t,3),_n)},Br.floor=wl,Br.forEach=yo,Br.forEachRight=vo,Br.forIn=function(e,t){return null==e?e:yn(e,ls(t,3),Ia)},Br.forInRight=function(e,t){return null==e?e:vn(e,ls(t,3),Ia)},Br.forOwn=function(e,t){return e&&wn(e,ls(t,3))},Br.forOwnRight=function(e,t){return e&&_n(e,ls(t,3))},Br.get=Ta,Br.gt=zo,Br.gte=Uo,Br.has=function(e,t){return null!=e&&ms(e,t,Rn)},Br.hasIn=Ra,Br.head=$s,Br.identity=nl,Br.includes=function(e,t,r,n){e=qo(e)?e:Ha(e),r=r&&!n?pa(r):0;var i=e.length;return r<0&&(r=gr(i+r,0)),aa(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&Ut(e,t,r)>-1},Br.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:pa(r);return i<0&&(i=gr(n+i,0)),Ut(e,t,i)},Br.inRange=function(e,t,n){return t=da(t),n===r?(n=t,t=0):n=da(n),function(e,t,r){return e>=yr(t,r)&&e<gr(t,r)}(e=ba(e),t,n)},Br.invoke=Ma,Br.isArguments=Vo,Br.isArray=Wo,Br.isArrayBuffer=$o,Br.isArrayLike=qo,Br.isArrayLikeObject=Ko,Br.isBoolean=function(e){return!0===e||!1===e||ta(e)&&Sn(e)==v},Br.isBuffer=Yo,Br.isDate=Xo,Br.isElement=function(e){return ta(e)&&1===e.nodeType&&!ia(e)},Br.isEmpty=function(e){if(null==e)return!0;if(qo(e)&&(Wo(e)||"string"==typeof e||"function"==typeof e.splice||Yo(e)||ca(e)||Vo(e)))return!e.length;var t=ps(e);if(t==E||t==A)return!e.size;if(Cs(e))return!jn(e).length;for(var r in e)if(Pe.call(e,r))return!1;return!0},Br.isEqual=function(e,t){return In(e,t)},Br.isEqualWith=function(e,t,n){var i=(n="function"==typeof n?n:r)?n(e,t):r;return i===r?In(e,t,r,n):!!i},Br.isError=Go,Br.isFinite=function(e){return"number"==typeof e&&vt(e)},Br.isFunction=Zo,Br.isInteger=Jo,Br.isLength=Qo,Br.isMap=ra,Br.isMatch=function(e,t){return e===t||Nn(e,t,hs(t))},Br.isMatchWith=function(e,t,n){return n="function"==typeof n?n:r,Nn(e,t,hs(t),n)},Br.isNaN=function(e){return na(e)&&e!=+e},Br.isNative=function(e){if(xs(e))throw new Ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Fn(e)},Br.isNil=function(e){return null==e},Br.isNull=function(e){return null===e},Br.isNumber=na,Br.isObject=ea,Br.isObjectLike=ta,Br.isPlainObject=ia,Br.isRegExp=sa,Br.isSafeInteger=function(e){return Jo(e)&&e>=-9007199254740991&&e<=d},Br.isSet=oa,Br.isString=aa,Br.isSymbol=la,Br.isTypedArray=ca,Br.isUndefined=function(e){return e===r},Br.isWeakMap=function(e){return ta(e)&&ps(e)==I},Br.isWeakSet=function(e){return ta(e)&&"[object WeakSet]"==Sn(e)},Br.join=function(e,t){return null==e?"":Bt.call(e,t)},Br.kebabCase=Wa,Br.last=Xs,Br.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var s=i;return n!==r&&(s=(s=pa(n))<0?gr(i+s,0):yr(s,i-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,s):zt(e,Wt,s,!0)},Br.lowerCase=$a,Br.lowerFirst=qa,Br.lt=ha,Br.lte=ua,Br.max=function(e){return e&&e.length?mn(e,nl,Tn):r},Br.maxBy=function(e,t){return e&&e.length?mn(e,ls(t,2),Tn):r},Br.mean=function(e){return $t(e,nl)},Br.meanBy=function(e,t){return $t(e,ls(t,2))},Br.min=function(e){return e&&e.length?mn(e,nl,Dn):r},Br.minBy=function(e,t){return e&&e.length?mn(e,ls(t,2),Dn):r},Br.stubArray=ml,Br.stubFalse=bl,Br.stubObject=function(){return{}},Br.stubString=function(){return""},Br.stubTrue=function(){return!0},Br.multiply=xl,Br.nth=function(e,t){return e&&e.length?Vn(e,pa(t)):r},Br.noConflict=function(){return pt._===this&&(pt._=He),this},Br.noop=ll,Br.now=To,Br.pad=function(e,t,r){e=ya(e);var n=(t=pa(t))?fr(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Wi(mt(i),r)+e+Wi(dt(i),r)},Br.padEnd=function(e,t,r){e=ya(e);var n=(t=pa(t))?fr(e):0;return t&&n<t?e+Wi(t-n,r):e},Br.padStart=function(e,t,r){e=ya(e);var n=(t=pa(t))?fr(e):0;return t&&n<t?Wi(t-n,r)+e:e},Br.parseInt=function(e,t,r){return r||null==t?t=0:t&&(t=+t),wr(ya(e).replace(se,""),t||0)},Br.random=function(e,t,n){if(n&&"boolean"!=typeof n&&vs(e,t,n)&&(t=n=r),n===r&&("boolean"==typeof t?(n=t,t=r):"boolean"==typeof e&&(n=e,e=r)),e===r&&t===r?(e=0,t=1):(e=da(e),t===r?(t=e,e=0):t=da(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var s=_r();return yr(e+s*(t-e+ht("1e-"+((s+"").length-1))),t)}return Yn(e,t)},Br.reduce=function(e,t,r){var n=Wo(e)?jt:Yt,i=arguments.length<3;return n(e,ls(t,4),r,i,fn)},Br.reduceRight=function(e,t,r){var n=Wo(e)?Lt:Yt,i=arguments.length<3;return n(e,ls(t,4),r,i,dn)},Br.repeat=function(e,t,n){return t=(n?vs(e,t,n):t===r)?1:pa(t),Xn(ya(e),t)},Br.replace=function(){var e=arguments,t=ya(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Br.result=function(e,t,n){var i=-1,s=(t=vi(t,e)).length;for(s||(s=1,e=r);++i<s;){var o=null==e?r:e[js(t[i])];o===r&&(i=s,o=n),e=Zo(o)?o.call(e):o}return e},Br.round=Cl,Br.runInContext=e,Br.sample=function(e){return(Wo(e)?Gr:Zn)(e)},Br.size=function(e){if(null==e)return 0;if(qo(e))return aa(e)?fr(e):e.length;var t=ps(e);return t==E||t==A?e.size:jn(e).length},Br.snakeCase=Ka,Br.some=function(e,t,n){var i=Wo(e)?Dt:ii;return n&&vs(e,t,n)&&(t=r),i(e,ls(t,3))},Br.sortedIndex=function(e,t){return si(e,t)},Br.sortedIndexBy=function(e,t,r){return oi(e,t,ls(r,2))},Br.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var n=si(e,t);if(n<r&&Ho(e[n],t))return n}return-1},Br.sortedLastIndex=function(e,t){return si(e,t,!0)},Br.sortedLastIndexBy=function(e,t,r){return oi(e,t,ls(r,2),!0)},Br.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var r=si(e,t,!0)-1;if(Ho(e[r],t))return r}return-1},Br.startCase=Ya,Br.startsWith=function(e,t,r){return e=ya(e),r=null==r?0:an(pa(r),0,e.length),t=ci(t),e.slice(r,r+t.length)==t},Br.subtract=El,Br.sum=function(e){return e&&e.length?Xt(e,nl):0},Br.sumBy=function(e,t){return e&&e.length?Xt(e,ls(t,2)):0},Br.template=function(e,t,n){var i=Br.templateSettings;n&&vs(e,t,n)&&(t=r),e=ya(e),t=_a({},t,i,Ji);var s,o,a=_a({},t.imports,i.imports,Ji),l=Oa(a),c=Qt(a,l),h=0,u=t.interpolate||_e,f="__p += '",d=Re((t.escape||_e).source+"|"+u.source+"|"+(u===Q?de:_e).source+"|"+(t.evaluate||_e).source+"|$","g"),p="//# sourceURL="+(Pe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ot+"]")+"\n";e.replace(d,(function(t,r,n,i,a,l){return n||(n=i),f+=e.slice(h,l).replace(xe,sr),r&&(s=!0,f+="' +\n__e("+r+") +\n'"),a&&(o=!0,f+="';\n"+a+";\n__p += '"),n&&(f+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),h=l+t.length,t})),f+="';\n";var m=Pe.call(t,"variable")&&t.variable;if(m){if(ue.test(m))throw new Ce("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(o?f.replace(W,""):f).replace($,"$1").replace(q,"$1;"),f="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(s?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var b=Ja((function(){return Ee(l,p+"return "+f).apply(r,c)}));if(b.source=f,Go(b))throw b;return b},Br.times=function(e,t){if((e=pa(e))<1||e>d)return[];var r=m,n=yr(e,m);t=ls(t),e-=m;for(var i=Gt(n,t);++r<e;)t(r);return i},Br.toFinite=da,Br.toInteger=pa,Br.toLength=ma,Br.toLower=function(e){return ya(e).toLowerCase()},Br.toNumber=ba,Br.toSafeInteger=function(e){return e?an(pa(e),-9007199254740991,d):0===e?e:0},Br.toString=ya,Br.toUpper=function(e){return ya(e).toUpperCase()},Br.trim=function(e,t,n){if((e=ya(e))&&(n||t===r))return Zt(e);if(!e||!(t=ci(t)))return e;var i=dr(e),s=dr(t);return _i(i,tr(i,s),rr(i,s)+1).join("")},Br.trimEnd=function(e,t,n){if((e=ya(e))&&(n||t===r))return e.slice(0,pr(e)+1);if(!e||!(t=ci(t)))return e;var i=dr(e);return _i(i,0,rr(i,dr(t))+1).join("")},Br.trimStart=function(e,t,n){if((e=ya(e))&&(n||t===r))return e.replace(se,"");if(!e||!(t=ci(t)))return e;var i=dr(e);return _i(i,tr(i,dr(t))).join("")},Br.truncate=function(e,t){var n=30,i="...";if(ea(t)){var s="separator"in t?t.separator:s;n="length"in t?pa(t.length):n,i="omission"in t?ci(t.omission):i}var o=(e=ya(e)).length;if(or(e)){var a=dr(e);o=a.length}if(n>=o)return e;var l=n-fr(i);if(l<1)return i;var c=a?_i(a,0,l).join(""):e.slice(0,l);if(s===r)return c+i;if(a&&(l+=c.length-l),sa(s)){if(e.slice(l).search(s)){var h,u=c;for(s.global||(s=Re(s.source,ya(pe.exec(s))+"g")),s.lastIndex=0;h=s.exec(u);)var f=h.index;c=c.slice(0,f===r?l:f)}}else if(e.indexOf(ci(s),l)!=l){var d=c.lastIndexOf(s);d>-1&&(c=c.slice(0,d))}return c+i},Br.unescape=function(e){return(e=ya(e))&&X.test(e)?e.replace(K,mr):e},Br.uniqueId=function(e){var t=++je;return ya(e)+t},Br.upperCase=Xa,Br.upperFirst=Ga,Br.each=yo,Br.eachRight=vo,Br.first=$s,al(Br,(_l={},wn(Br,(function(e,t){Pe.call(Br.prototype,t)||(_l[t]=e)})),_l),{chain:!1}),Br.VERSION="4.17.21",kt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Br[e].placeholder=Br})),kt(["drop","take"],(function(e,t){Vr.prototype[e]=function(n){n=n===r?1:gr(pa(n),0);var i=this.__filtered__&&!t?new Vr(this):this.clone();return i.__filtered__?i.__takeCount__=yr(n,i.__takeCount__):i.__views__.push({size:yr(n,m),type:e+(i.__dir__<0?"Right":"")}),i},Vr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),kt(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;Vr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:ls(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),kt(["head","last"],(function(e,t){var r="take"+(t?"Right":"");Vr.prototype[e]=function(){return this[r](1).value()[0]}})),kt(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");Vr.prototype[e]=function(){return this.__filtered__?new Vr(this):this[r](1)}})),Vr.prototype.compact=function(){return this.filter(nl)},Vr.prototype.find=function(e){return this.filter(e).head()},Vr.prototype.findLast=function(e){return this.reverse().find(e)},Vr.prototype.invokeMap=Gn((function(e,t){return"function"==typeof e?new Vr(this):this.map((function(r){return Mn(r,e,t)}))})),Vr.prototype.reject=function(e){return this.filter(Po(ls(e)))},Vr.prototype.slice=function(e,t){e=pa(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Vr(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(n=(t=pa(t))<0?n.dropRight(-t):n.take(t-e)),n)},Vr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Vr.prototype.toArray=function(){return this.take(m)},wn(Vr.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),s=Br[i?"take"+("last"==t?"Right":""):t],o=i||/^find/.test(t);s&&(Br.prototype[t]=function(){var t=this.__wrapped__,a=i?[1]:arguments,l=t instanceof Vr,c=a[0],h=l||Wo(t),u=function(e){var t=s.apply(Br,Pt([e],a));return i&&f?t[0]:t};h&&n&&"function"==typeof c&&1!=c.length&&(l=h=!1);var f=this.__chain__,d=!!this.__actions__.length,p=o&&!f,m=l&&!d;if(!o&&h){t=m?t:new Vr(this);var b=e.apply(t,a);return b.__actions__.push({func:fo,args:[u],thisArg:r}),new Ur(b,f)}return p&&m?e.apply(this,a):(b=this.thru(u),p?i?b.value()[0]:b.value():b)})})),kt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Me[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Br.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(Wo(i)?i:[],e)}return this[r]((function(r){return t.apply(Wo(r)?r:[],e)}))}})),wn(Vr.prototype,(function(e,t){var r=Br[t];if(r){var n=r.name+"";Pe.call(Mr,n)||(Mr[n]=[]),Mr[n].push({name:t,func:r})}})),Mr[Hi(r,2).name]=[{name:"wrapper",func:r}],Vr.prototype.clone=function(){var e=new Vr(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Vr.prototype.reverse=function(){if(this.__filtered__){var e=new Vr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Vr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Wo(e),n=t<0,i=r?e.length:0,s=function(e,t,r){var n=-1,i=r.length;for(;++n<i;){var s=r[n],o=s.size;switch(s.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=yr(t,e+o);break;case"takeRight":e=gr(e,t-o)}}return{start:e,end:t}}(0,i,this.__views__),o=s.start,a=s.end,l=a-o,c=n?a:o-1,h=this.__iteratees__,u=h.length,f=0,d=yr(l,this.__takeCount__);if(!r||!n&&i==l&&d==l)return pi(e,this.__actions__);var p=[];e:for(;l--&&f<d;){for(var m=-1,b=e[c+=t];++m<u;){var g=h[m],y=g.iteratee,v=g.type,w=y(b);if(2==v)b=w;else if(!w){if(1==v)continue e;break e}}p[f++]=b}return p},Br.prototype.at=po,Br.prototype.chain=function(){return uo(this)},Br.prototype.commit=function(){return new Ur(this.value(),this.__chain__)},Br.prototype.next=function(){this.__values__===r&&(this.__values__=fa(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?r:this.__values__[this.__index__++]}},Br.prototype.plant=function(e){for(var t,n=this;n instanceof zr;){var i=Ds(n);i.__index__=0,i.__values__=r,t?s.__wrapped__=i:t=i;var s=i;n=n.__wrapped__}return s.__wrapped__=e,t},Br.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Vr){var t=e;return this.__actions__.length&&(t=new Vr(this)),(t=t.reverse()).__actions__.push({func:fo,args:[Qs],thisArg:r}),new Ur(t,this.__chain__)}return this.thru(Qs)},Br.prototype.toJSON=Br.prototype.valueOf=Br.prototype.value=function(){return pi(this.__wrapped__,this.__actions__)},Br.prototype.first=Br.prototype.head,Ze&&(Br.prototype[Ze]=function(){return this}),Br}();bt?((bt.exports=br)._=br,mt._=br):pt._=br}).call(a)}(Zi,Zi.exports);var Ji=Zi.exports;function Qi(e,t){let r="";for(let t=e+1;t>0;t=Math.floor((t-1)/26))r=String.fromCharCode((t-1)%26+65)+r;return r+(t+1)}function es(e){if(!e)return[0,0,0];if(e.startsWith("#")){let t=e.substring(1);3===t.length&&(t=t.replace(/(.)/g,"$1$1"));return[parseInt(t.substring(0,2),16),parseInt(t.substring(2,4),16),parseInt(t.substring(4,6),16)]}if(e.startsWith("rgb(")){return e.substring(4,e.length-1).split(",").map(Number)}if(e.startsWith("rgba(")){return e.substring(5,e.length-1).split(",").map(Number)}if(y(ns[e]))return[(t=ns[e])>>16,t>>8&255,255&t,1];if(y(rs[e]))return function(e){return[e>>>24,e>>>16&255,e>>>8&255,255&e]}(rs[e]);var t;throw new Error("Unsupported color format")}function ts(e){if(3===e.length&&e.push(1),4!==e.length)throw new Error("Invalid RGBA array");const[t,r,n,i]=e.map(Math.round);return`${Math.round(255*i).toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`}const rs={transparent:4294967040},ns={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function is(e,t){return{name:os(e.fontFamily)||"Arial",size:e.fontSize||10,bold:ss(e.fontWeight),italic:"italic"===e.fontStyle,color:us("link"===t?e._linkColor:e.color),underline:e.underline}}function ss(e){return"number"==typeof e?e>=600:Number(e)>=600||"bold"===e}function os(e){return e.split(",").map((e=>e.trim()))[0]}function as(e){return{type:"pattern",pattern:"solid",fgColor:us(e.bgColor)}}function ls(e){const{borderColor:t,borderLineWidth:r,borderLineDash:n,_strokeArrayWidth:i,_strokeArrayColor:s}=e;if(s||i){const e={};return s&&!s[0]||i&&!i[0]||(e.top={style:cs(i?.[0]??r,n),color:us(s?.[0]??t)}),s&&!s[1]||i&&!i[1]||(e.right={style:cs(i?.[1]??r,n),color:us(s?.[1]??t)}),s&&!s[2]||i&&!i[2]||(e.bottom={style:cs(i?.[2]??r,n),color:us(s?.[2]??t)}),s&&!s[3]||i&&!i[3]||(e.left={style:cs(i?.[3]??r,n),color:us(s?.[3]??t)}),e}if(0===r)return{};const o={style:cs(r,n),color:us(t)};return{top:o,left:o,bottom:o,right:o}}function cs(e,t){return t&&t.length?e<=2?"dashed":"mediumDashed":e<=.5?"hair":e<=1?"thin":e<=2?"medium":"thick"}function hs(e,t){return{horizontal:e.textAlign||"left",vertical:e.textBaseline||"middle",wrapText:e.autoWrapText||!1,indent:t||0}}function us(e){return{argb:ts(es(e))}}function fs(e,t,r){let n=0;const i=r.internalProps.layoutMap;if(i.isHeader(e,t)){const r=i.getHeader(e,t);f(r?.hierarchyLevel)&&(n=(r.hierarchyLevel??0)*(i.rowHierarchyIndent??0))}else{const s=r.getBodyColumnDefine(e,t);if(s?.tree){const s=r.dataSource.getIndexKey(r.getRecordShowIndexByCell(e,t));n=Array.isArray(s)&&"none"!==r.getHierarchyState(e,t)?(s.length-1)*(i.hierarchyIndent??0):0}}return n}function ds(e,t){const r=v(e.pagination),n=e.isPivotTable(),i=e.internalProps.layoutMap;let s=e.rowCount-1;return{reset:()=>{n&&t&&r&&(e.internalProps.layoutMap.setPagination(r),e.refreshRowColCount())},handleRowCount:()=>(t&&r&&(n?(e.internalProps.layoutMap.setPagination(void 0),e.refreshRowColCount(),s=e.rowCount-1):s=e.recordsCount*i.bodyRowSpanCount+i.headerLevelCount),s)}}function ps(e){return new Promise((t=>{requestIdleCallback((e=>{t(e)}),e)}))}async function ms(e,t,r=!1){const n=new Oi.Workbook,i=n.addWorksheet("sheet1");await bs(e,i,n,t,r);return await n.xlsx.writeBuffer()}async function bs(e,t,r,n,i=!1){const s=!!n?.exportAllData,{handleRowCount:o,reset:a}=ds(e,s);try{const s=0,a=o(),l=0,c=e.colCount-1;t.properties.defaultRowHeight=40;const h=[],u=[],f=new Set,d=100;let p=s;const m=async s=>{for(;p<=a&&(!i||s?.timeRemaining()>0);){const i=Math.min(p+d-1,a);for(let s=l;s<=c;s++){const o=e.getColWidth(s);void 0===h[s]&&(h[s]={width:o/6});for(let o=p;o<=i;o++){if(s===l){const r=e.getRowHeight(o);t.getRow(o+1).height=r}await ys(s,o,e,t,r,n);const i=e.getCellRange(s,o);if(i.start.col!==i.end.col||i.start.row!==i.end.row){const e=`${i.start.col},${i.start.row}:${i.end.col},${i.end.row}`;f.has(e)||(f.add(e),u.push(i))}}}p=i+1}if(p<=a){const e=i?await ps():void 0;await m(e)}};if(i){const e=await ps();await m(e)}else await m();t.columns=h,u.forEach((e=>{t.mergeCells(e.start.row+1,e.start.col+1,e.end.row+1,e.end.col+1)}));const b=[];e.frozenRowCount>0&&b.push({state:"frozen",ySplit:e.frozenRowCount,topLeftCell:Qi(0,e.frozenRowCount)}),e.frozenColCount>0&&b.push({state:"frozen",xSplit:e.frozenColCount,topLeftCell:Qi(e.frozenColCount,0)}),t.views=b,n?.excelJSWorksheetCallback&&n.excelJSWorksheetCallback(t)}finally{a()}}function gs(e,t){const r=function(e){const t=(e??"").toString().trim(),r=t.replace(/[:\\\/\?\*\[\]]/g," ").replace(/\s+/g," ").trim()||"sheet";return r.length>31?r.slice(0,31):r}(e)||"sheet";if(!t.has(r))return r;for(let e=2;e<1e4;e++){const n=`-${e}`,i=31-n.length,s=`${r.length>i?r.slice(0,i):r}${n}`;if(!t.has(s))return s}return`${r.slice(0,25)}-${Date.now().toString().slice(-5)}`}async function ys(e,t,n,i,s,o){const{layoutMap:a}=n.internalProps,l=n.getCellType(e,t),c=n.getCellRawRecord(e,t);let h=(c&&c.vtableMergeName)??n.getCellValue(e,t,!1);var f;!(f=h)||"object"!=typeof f&&"function"!=typeof f||"function"!=typeof f.then||(h=await h);const d=n.getCellStyle(e,t),m=n.getCellLocation(e,t),b="body"!==m?n.getHeaderDefine(e,t):n.getBodyColumnDefine(e,t);let g,y,v,w;if(("body"!==m||(b?.dragOrder||!!b?.icon||!!b?.tree))&&(g=n.getCellIcons(e,t)),"body"!==m?(y=b?.headerCustomRender,v=b?.headerCustomLayout):(y=b?.customRender||n.customRender,v=b?.customLayout),o?.formatExportOutput){const r={cellType:l,cellValue:h,table:n,col:e,row:t},s=o.formatExportOutput(r);if(void 0!==s){let r=i.getCell(Qi(e,t));r.value=s,r.font=is(d,l),r.fill=as(d),r.border=ls(d);const a=fs(e,t,n);if(r.alignment=hs(d,Math.ceil(a/r.font.size)),r&&o?.formatExcelJSCell){const i=o.formatExcelJSCell({cellType:l,cellValue:h,table:n,col:e,row:t},r);i&&(r=i)}return r}}if("image"===l||"video"===l||"progressbar"===l||"sparkline"===l||a.isAxisCell(e,t)||!o?.ignoreIcon&&p(g)&&g.length||y||v)if(ws(l,a.isAxisCell(e,t),!!y||!!v,!(o?.ignoreIcon||!p(g)||!g.length),o)){const r=vs(e,t,n),o=s.addImage({base64:r,extension:"png"});i.addImage(o,{tl:{col:e+1/80,row:t+1/120},br:{col:e+1,row:t+1},editAs:"oneCell"})}else w=i.getCell(Qi(e,t));else if("text"===l||"link"===l){let r;if(w=i.getCell(Qi(e,t)),"link"===l){const i=b.templateLink;if(i){const s=n.getCellOriginRecord(e,t);if(s&&s.vtableMerge);else{const o=n.getCellOriginValue(e,t),a=Object.assign({__value:h,__dataValue:o},s);if(u(i))r=i(a,e,t,n);else{const e=/\{\s*(\S+?)\s*\}/g;r=i.replace(e,((e,t)=>a[t]))}}}}w.value=function(e,t,r){if("link"===t)return{text:e,hyperlink:r||e,tooltip:e};return e}(h,l,r),w.font=is(d,l),w.fill=as(d),w.border=ls(d);const s=fs(e,t,n);w.alignment=hs(d,Math.ceil(s/w.font.size))}else if("chart"===l)if(ws("chart",!1,!1,!1,o)){const o=n.scenegraph.getCell(e,t);r.renderChart(o.firstChild);const a=vs(e,t,n),l=s.addImage({base64:a,extension:"png"});i.addImage(l,{tl:{col:e+1/80,row:t+1/120},br:{col:e+1,row:t+1},editAs:"oneCell"}),n.scenegraph.updateNextFrame()}else w=i.getCell(Qi(e,t));if(w&&o?.formatExcelJSCell){const r=o.formatExcelJSCell({cellType:l,cellValue:h,table:n,col:e,row:t},w);r&&(w=r)}return w}function vs(e,t,n){let i=n.scenegraph.getCell(e,t),s=!1;"empty"===i.role&&(i=r.updateCell(e,t,n,!0),i.setStage(n.scenegraph.stage),s=!0,i.stage.dirtyBounds.set(-1/0,-1/0,1/0,1/0));const o=i.attribute.stroke;i.attribute.stroke=!1;const a=r.graphicUtil.drawGraphicToCanvas(i,n.scenegraph.stage);return i.attribute.stroke=o,s&&i.parent?.removeChild(i),a.toDataURL()}function ws(e,t,r,n,i){return!i?.skipImageExportCellType||("image"===e||"video"===e||"progressbar"===e||"sparkline"===e||"chart"===e?!i.skipImageExportCellType.includes(e):t?!i.skipImageExportCellType.includes("chart"):r?!i.skipImageExportCellType.includes("custom"):!n||!i.skipImageExportCellType.includes("textWithIcon"))}function _s(e,t){const r=!!t?.exportAllData,{handleRowCount:n,reset:i}=ds(e,r),s=n(),o=e.colCount-1;let a="";for(let r=0;r<=s;r++){for(let n=0;n<=o;n++){const i=xs(n,r,e,t);if("undefined"!=typeof Promise&&i instanceof Promise);else{const e=`${void 0===i?"":i}`;/^\[object .*\]$/.exec(e)||(a+=e)}n!==o&&(a+=",")}a+="\r\n"}return i(),a}function xs(e,t,r,n){const i=r.getCellRawRecord(e,t),s=(i&&i.vtableMergeName)??r.getCellValue(e,t,!1);if(n?.formatExportOutput){const i={cellType:r.getCellType(e,t),cellValue:s,table:r,col:e,row:t},o=n.formatExportOutput(i);if(void 0!==o)return"string"==typeof o?'"'+o+'"':o}const o=r.getCellRange(e,t),a=o.start.col,l=o.start.row;if(a!==e||l!==t)return"";let c=s;return n?.escape?c=function(e){if("string"!=typeof e)return e;let t=e.replace(/"/g,'""');/[,"\r\n]/.test(t)&&(t=`"${t}"`);return t}(c):"string"==typeof c&&(c='"'+c+'"'),c}var Cs={exports:{}};!function(e,t){!function(){function t(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}function r(e,t,r){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){l(n.response,t,r)},n.onerror=function(){},n.send()}function n(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function i(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(r){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var s="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof a&&a.global===a?a:void 0,o=s.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=s.saveAs||("object"!=typeof window||window!==s?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(e,t,o){var a=s.URL||s.webkitURL,l=document.createElement("a");t=t||e.name||"download",l.download=t,l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?i(l):n(l.href)?r(e,t,o):i(l,l.target="_blank")):(l.href=a.createObjectURL(e),setTimeout((function(){a.revokeObjectURL(l.href)}),4e4),setTimeout((function(){i(l)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,s,o){if(s=s||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(t(e,o),s);else if(n(e))r(e,s,o);else{var a=document.createElement("a");a.href=e,a.target="_blank",setTimeout((function(){i(a)}))}}:function(e,t,n,i){if((i=i||open("","_blank"))&&(i.document.title=i.document.body.innerText="downloading..."),"string"==typeof e)return r(e,t,n);var a="application/octet-stream"===e.type,l=/constructor/i.test(s.HTMLElement)||s.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||a&&l||o)&&"undefined"!=typeof FileReader){var h=new FileReader;h.onloadend=function(){var e=h.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),i?i.location.href=e:location=e,i=null},h.readAsDataURL(e)}else{var u=s.URL||s.webkitURL,f=u.createObjectURL(e);i?i.location=f:location.href=f,i=null,setTimeout((function(){u.revokeObjectURL(f)}),4e4)}});s.saveAs=l.saveAs=l,e.exports=l}()}(Cs);var Es,Ss,Ts,Rs,ks=Cs.exports;async function As(e,t){const r=new Blob([e],{type:"application/octet-stream"});await ks.saveAs(r,`${t}.xlsx`)}function Ms(e){const t=Math.min(e.start.col,e.end.col),r=Math.min(e.start.row,e.end.row),n=Math.max(e.start.col,e.end.col),i=Math.max(e.start.row,e.end.row),s=[],o=[];for(let e=t;e<=n;e++)s.push(e);for(let e=r;e<=i;e++)o.push(e);return{cols:s,rows:o}}function Os(t,r,n){return t===e.Direction.DOWN||t===e.Direction.UP?{cols:n.cols,rows:n.rows.filter((e=>!r.rows.includes(e)))}:{cols:n.cols.filter((e=>!r.cols.includes(e))),rows:n.rows}}function Is(e,t,r){const n=e.scenegraph.highPerformanceGetCell(t,r).globalAABBBounds;e.showDropDownMenu(t,r,{content:[{type:"item",text:"复制填充",icon:{width:16,height:16,svg:'<svg t="1756136702877" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1474" width="200" height="200"><path d="M853.333333 981.333333h-384c-72.533333 0-128-55.466667-128-128v-384c0-72.533333 55.466667-128 128-128h384c72.533333 0 128 55.466667 128 128v384c0 72.533333-55.466667 128-128 128z m-384-554.666666c-25.6 0-42.666667 17.066667-42.666666 42.666666v384c0 25.6 17.066667 42.666667 42.666666 42.666667h384c25.6 0 42.666667-17.066667 42.666667-42.666667v-384c0-25.6-17.066667-42.666667-42.666667-42.666666h-384z" p-id="1475"></path><path d="M213.333333 682.666667H170.666667c-72.533333 0-128-55.466667-128-128V170.666667c0-72.533333 55.466667-128 128-128h384c72.533333 0 128 55.466667 128 128v42.666666c0 25.6-17.066667 42.666667-42.666667 42.666667s-42.666667-17.066667-42.666667-42.666667V170.666667c0-25.6-17.066667-42.666667-42.666666-42.666667H170.666667c-25.6 0-42.666667 17.066667-42.666667 42.666667v384c0 25.6 17.066667 42.666667 42.666667 42.666666h42.666666c25.6 0 42.666667 17.066667 42.666667 42.666667s-17.066667 42.666667-42.666667 42.666667z" p-id="1476"></path></svg>'}},{type:"item",text:"序列填充",icon:{width:16,height:16,svg:'<svg t="1756136788547" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2463" width="200" height="200"><path d="M312.832482 65.167035H959.204489c35.706211 0 64.64232 29.473622 64.64232 65.832527 0 36.346107-28.936109 65.832527-64.629522 65.832527H312.819684c-35.693413 0-64.629522-29.473622-64.629522-65.832527 0-36.346107 28.936109-65.832527 64.629522-65.832527z m0 394.982363H959.204489c35.706211 0 64.64232 29.460824 64.64232 65.819729 0 36.358905-28.936109 65.832527-64.629522 65.832527H312.819684c-35.693413 0-64.629522-29.473622-64.629522-65.832527 0-36.346107 28.936109-65.819729 64.629522-65.819729z m0 394.969566H959.204489c35.706211 0 64.64232 29.473622 64.64232 65.819729 0 36.358905-28.936109 65.832527-64.629522 65.832527H312.819684c-35.693413 0-64.629522-29.473622-64.629522-65.832527 0-36.346107 28.936109-65.819729 64.629522-65.819729zM12.286008 69.108796V38.176211c9.892796 0.767876 19.836784 0.767876 29.72958 0A41.823619 41.823619 0 0 0 63.989626 25.672638c4.261709-4.671243 7.358807-10.315128 9.048133-16.458132 0.37114-3.058704 0.37114-6.143004 0-9.214506H114.413451v229.748352H65.93491V69.108796H12.286008z m0 510.176487a130.730805 130.730805 0 0 1 45.240665-49.374395 334.537763 334.537763 0 0 0 40.070304-32.250771 48.47854 48.47854 0 0 0 14.218495-33.581756 37.31875 37.31875 0 0 0-7.755543-24.354451 28.193829 28.193829 0 0 0-23.266628-9.879998 27.643518 27.643518 0 0 0-31.02217 15.139945 78.27211 78.27211 0 0 0-5.170362 28.30901H2.585181a114.311067 114.311067 0 0 1 10.340723-48.056208c12.388392-24.124089 38.086625-37.984242 64.629522-34.887144a79.897447 79.897447 0 0 1 57.539472 20.41269 71.783562 71.783562 0 0 1 21.321343 53.981648 74.637499 74.637499 0 0 1-14.858391 46.072531 152.16733 152.16733 0 0 1-32.967455 29.627197L90.481331 553.625443l-23.266628 17.763521c-4.082538 3.583419-7.563574 7.806734-10.353522 12.51637h99.542262v40.147092H0a110.945213 110.945213 0 0 1 10.340724-45.419837l1.945284 0.665492zM44.600769 948.582211a53.495327 53.495327 0 0 0 4.517668 23.036265 30.279891 30.279891 0 0 0 29.742378 17.110826c7.422797 0.255959 14.717614-2.073264 20.681447-6.578133 6.7829-6.962071 10.315128-16.547717 9.688029-26.325332a30.356678 30.356678 0 0 0-18.096266-30.945383 91.735527 91.735527 0 0 0-32.314761-8.561812V883.440772a83.903197 83.903197 0 0 0 30.382274-4.607253 27.106005 27.106005 0 0 0 14.858391-28.30901 30.612637 30.612637 0 0 0-7.755542-21.730877 27.528337 27.528337 0 0 0-21.321344-8.549014 26.939632 26.939632 0 0 0-23.279425 10.532692 44.063256 44.063256 0 0 0-7.102849 27.643519H2.585181a117.101015 117.101015 0 0 1 5.823056-32.916264 74.381541 74.381541 0 0 1 17.443572-25.019944 60.534186 60.534186 0 0 1 20.681447-12.503572 89.55988 89.55988 0 0 1 29.742378-3.289067A78.540867 78.540867 0 0 1 129.259044 801.79001a57.744238 57.744238 0 0 1 20.041551 46.085328 51.921182 51.921182 0 0 1-12.286008 34.887144c-4.159326 5.170362-9.470465 9.227304-15.511086 11.850879 6.7829 1.510155 12.900309 5.208756 17.45637 10.532692a57.821026 57.821026 0 0 1 17.443572 44.10165 75.136618 75.136618 0 0 1-20.028753 52.010768 76.122059 76.122059 0 0 1-59.471958 22.383571 71.962733 71.962733 0 0 1-64.629522-32.250771A97.52019 97.52019 0 0 1 1.279793 946.611331l43.308178 1.97088z" fill="#515151" p-id="2464"></path></svg>'}}],referencePosition:{rect:{right:n.x2+110,bottom:n.y2}}})}function Ns(t){return{getValue:(r,n)=>{const i=t.getCellValue(n,r);return"number"!=typeof i&&isNaN(Number(i))?{v:i||"",t:e.CellValueType.STRING}:{v:i,t:e.CellValueType.NUMBER}},getMaxRows:()=>t.records.length,getMaxColumns:()=>t.columns.length}}e.Direction=void 0,(Es=e.Direction||(e.Direction={})).UP="top",Es.RIGHT="right",Es.DOWN="bottom",Es.LEFT="left",e.APPLY_TYPE=void 0,(Ss=e.APPLY_TYPE||(e.APPLY_TYPE={})).COPY="copy",Ss.SERIES="series",e.CellValueType=void 0,(Ts=e.CellValueType||(e.CellValueType={}))[Ts.STRING=1]="STRING",Ts[Ts.NUMBER=2]="NUMBER",Ts[Ts.BOOLEAN=3]="BOOLEAN",Ts[Ts.FORCE_STRING=4]="FORCE_STRING",e.DATA_TYPE=void 0,(Rs=e.DATA_TYPE||(e.DATA_TYPE={})).NUMBER="number",Rs.DATE="date",Rs.EXTEND_NUMBER="extendNumber",Rs.CHN_NUMBER="chnNumber",Rs.CHN_WEEK2="chnWeek2",Rs.CHN_WEEK3="chnWeek3",Rs.LOOP_SERIES="loopSeries",Rs.FORMULA="formula",Rs.OTHER="other";class Fs{table;constructor(e){this.table=e}isFormulaCell(e,t){const r=this.table.getCellValue(e,t);return"string"==typeof r&&r.startsWith("=")}getCellFormula(e,t){const r=this.table.getCellValue(e,t);if("string"==typeof r&&r.startsWith("="))return r}setCellFormula(e,t,r){this.table.changeCellValue(e,t,r)}getCalculatedValue(e,t){return this.table.getCellValue(e,t)}refreshFormulas(){}hasFormulaEngine(){return!1}}function Ps(e,t,r,n){return t||r||n?new js(e,t,r,n):new Fs(e)}class js{table;isFormulaCellFn;getCellFormulaFn;setCellFormulaFn;constructor(e,t,r,n){this.table=e,this.isFormulaCellFn=t,this.getCellFormulaFn=r,this.setCellFormulaFn=n}isFormulaCell(e,t){if(this.isFormulaCellFn){const r=this.table.getCellValue(e,t);return this.isFormulaCellFn(e,t,r,this.table)}const r=this.table.getCellValue(e,t);return"string"==typeof r&&r.startsWith("=")}getCellFormula(e,t){if(this.getCellFormulaFn){const r=this.table.getCellValue(e,t);return this.getCellFormulaFn(e,t,r,this.table)}const r=this.table.getCellValue(e,t);if("string"==typeof r&&r.startsWith("="))return r}setCellFormula(e,t,r){this.setCellFormulaFn?this.setCellFormulaFn(e,t,r,this.table):this.table.changeCellValue(e,t,r)}getCalculatedValue(e,t){return this.table.getCellValue(e,t)}refreshFormulas(){}hasFormulaEngine(){return!1}}var Ls=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e},Ds=et,Bs=function(){try{var e=Ds(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Hs=function(e,t,r){"__proto__"==t&&Bs?Bs(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},zs=Hs,Us=X,Vs=Object.prototype.hasOwnProperty;var Ws=function(e,t,r){var n=e[t];Vs.call(e,t)&&Us(n,r)&&(void 0!==r||t in e)||zs(e,t,r)},$s=Ws,qs=Hs;var Ks=function(e,t,r,n){var i=!r;r||(r={});for(var s=-1,o=t.length;++s<o;){var a=t[s],l=n?n(r[a],e[a],a,r,e):void 0;void 0===l&&(l=e[a]),i?qs(r,a,l):$s(r,a,l)}return r},Ys=Ks,Xs=bn;var Gs=function(e,t){return e&&Ys(t,Xs(t),e)};var Zs=Oe,Js=nn,Qs=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t},eo=Object.prototype.hasOwnProperty;var to=tn,ro=function(e){if(!Zs(e))return Qs(e);var t=Js(e),r=[];for(var n in e)("constructor"!=n||!t&&eo.call(e,n))&&r.push(n);return r},no=fn;var io=function(e){return no(e)?to(e,!0):ro(e)},so=Ks,oo=io;var ao=function(e,t){return e&&so(t,oo(t),e)},lo={exports:{}};!function(e,t){var r=ye,n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,s=i&&i.exports===n?r.Buffer:void 0,o=s?s.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var r=e.length,n=o?o(r):new e.constructor(r);return e.copy(n),n}}(lo,lo.exports);var co=lo.exports;var ho=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t},uo=Ks,fo=yr;var po=function(e,t){return uo(e,fo(e),t)},mo=sn(Object.getPrototypeOf,Object),bo=lr,go=mo,yo=yr,vo=dr,wo=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)bo(t,yo(e)),e=go(e);return t}:vo,_o=Ks,xo=wo;var Co=function(e,t){return _o(e,xo(e),t)},Eo=fr,So=wo,To=io;var Ro=function(e){return Eo(e,To,So)},ko=Object.prototype.hasOwnProperty;var Ao=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&ko.call(e,"index")&&(r.index=e.index,r.input=e.input),r},Mo=Qt;var Oo=function(e){var t=new e.constructor(e.byteLength);return new Mo(t).set(new Mo(e)),t},Io=Oo;var No=function(e,t){var r=t?Io(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)},Fo=/\w*$/;var Po=function(e){var t=new e.constructor(e.source,Fo.exec(e));return t.lastIndex=e.lastIndex,t},jo=ve?ve.prototype:void 0,Lo=jo?jo.valueOf:void 0;var Do=Oo;var Bo=Oo,Ho=No,zo=Po,Uo=function(e){return Lo?Object(Lo.call(e)):{}},Vo=function(e,t){var r=t?Do(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)};var Wo=function(e,t,r){var n=e.constructor;switch(t){case"[object ArrayBuffer]":return Bo(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return Ho(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Vo(e,r);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(e);case"[object RegExp]":return zo(e);case"[object Symbol]":return Uo(e)}},$o=Oe,qo=Object.create,Ko=function(){function e(){}return function(t){if(!$o(t))return{};if(qo)return qo(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),Yo=mo,Xo=nn;var Go=function(e){return"function"!=typeof e.constructor||Xo(e)?{}:Ko(Yo(e))},Zo=Un,Jo=wr;var Qo=function(e){return Jo(e)&&"[object Map]"==Zo(e)},ea=zr,ta=Vr&&Vr.isMap,ra=ta?ea(ta):Qo,na=Un,ia=wr;var sa=function(e){return ia(e)&&"[object Set]"==na(e)},oa=zr,aa=Vr&&Vr.isSet,la=aa?oa(aa):sa,ca=Wt,ha=Ls,ua=Ws,fa=Gs,da=ao,pa=co,ma=ho,ba=po,ga=Co,ya=wn,va=Ro,wa=Un,_a=Ao,xa=Wo,Ca=Go,Ea=cr,Sa=Ir,Ta=ra,Ra=Oe,ka=la,Aa=bn,Ma=io,Oa="[object Arguments]",Ia="[object Function]",Na="[object Object]",Fa={};Fa[Oa]=Fa["[object Array]"]=Fa["[object ArrayBuffer]"]=Fa["[object DataView]"]=Fa["[object Boolean]"]=Fa["[object Date]"]=Fa["[object Float32Array]"]=Fa["[object Float64Array]"]=Fa["[object Int8Array]"]=Fa["[object Int16Array]"]=Fa["[object Int32Array]"]=Fa["[object Map]"]=Fa["[object Number]"]=Fa[Na]=Fa["[object RegExp]"]=Fa["[object Set]"]=Fa["[object String]"]=Fa["[object Symbol]"]=Fa["[object Uint8Array]"]=Fa["[object Uint8ClampedArray]"]=Fa["[object Uint16Array]"]=Fa["[object Uint32Array]"]=!0,Fa["[object Error]"]=Fa[Ia]=Fa["[object WeakMap]"]=!1;var Pa=function e(t,r,n,i,s,o){var a,l=1&r,c=2&r,h=4&r;if(n&&(a=s?n(t,i,s,o):n(t)),void 0!==a)return a;if(!Ra(t))return t;var u=Ea(t);if(u){if(a=_a(t),!l)return ma(t,a)}else{var f=wa(t),d=f==Ia||"[object GeneratorFunction]"==f;if(Sa(t))return pa(t,l);if(f==Na||f==Oa||d&&!s){if(a=c||d?{}:Ca(t),!l)return c?ga(t,da(a,t)):ba(t,fa(a,t))}else{if(!Fa[f])return s?t:{};a=xa(t,f,l)}}o||(o=new ca);var p=o.get(t);if(p)return p;o.set(t,a),ka(t)?t.forEach((function(i){a.add(e(i,r,n,i,t,o))})):Ta(t)&&t.forEach((function(i,s){a.set(s,e(i,r,n,s,t,o))}));var m=u?void 0:(h?c?va:ya:c?Ma:Aa)(t);return ha(m||t,(function(i,s){m&&(i=t[s=i]),ua(a,s,e(i,r,n,s,t,o))})),a},ja=Pa;var La=l((function(e){return ja(e,5)}));const Da={"零":0,"一":1,"二":2,"三":3,"四":4,"五":5,"六":6,"七":7,"八":8,"九":9},Ba=["零","一","二","三","四","五","六","七","八","九"],Ha=["","万","亿","万亿","亿亿"],za=["","十","百","千"],Ua={"十":{value:10,secUnit:!1},"百":{value:100,secUnit:!1},"千":{value:1e3,secUnit:!1},"万":{value:1e4,secUnit:!0},"亿":{value:1e8,secUnit:!0}};function Va(e){if(!e)return 0;let t=0,r=0,n=0,i=!1;const s=e.split("");for(let e=0;e<s.length;e++){const o=Da[s[e]];if(void 0!==o)n=o,e===s.length-1&&(r+=n);else{const o=Ua[s[e]],a=o.value;i=o.secUnit,i?(r=(r+n)*a,t+=r,r=0):r+=n*a,n=0}}return t+r}function Wa(e){let t="",r="",n=0,i=!0;for(;e>0;){const s=e%10;0===s?i||(i=!0,r=Ba[s]+r):(i=!1,t=Ba[s],t+=za[n],r=t+r),n++,e=Math.floor(e/10)}return r}function $a(e){let t=0,r="",n="",i=!1;if(0===e)return Ba[0];for(;e>0;){const s=e%1e4;i&&(n=Ba[0]+n),r=Wa(s),r+=0!==s?Ha[t]:Ha[0],n=r+n,i=s<1e3&&s>0,e=Math.floor(e/1e4),t++}return n}function qa(e){if(!e)return{isExtendNumber:!1};const t=/0|([1-9]+[0-9]*)/g,r=t.test(e);if(r){const r=e.match(t);if(r&&r.length>0){const t=r[r.length-1],n=e.lastIndexOf(t),i=e.substr(0,n),s=e.substr(n+t.length);return{isExtendNumber:!0,matchTxt:Number(t),beforeTxt:i,afterTxt:s}}return{isExtendNumber:!1}}return{isExtendNumber:r}}function Ka(e){let t=!0;const r=e[1]-e[0];for(let n=1;n<e.length;n++)if(e[n]-e[n-1]!==r){t=!1;break}return t}function Ya(e,t){const r=[];for(let n=1;n<=t;n++){const t=(n-1)%e.length,i=La(e[t]);nl(i),r.push({v:null,t:null,...i})}return r}function Xa(t,r,n,i){i&&t.forEach((e=>{const{v:t,meta:r}=i.toNumber(e.v);e.v=t,e.f=r}));const s=[],o=[];for(let e=0;e<t.length;e++)o.push(Number(t[e]?.v));if(t.length>2&&function(e){let t=!0;const r=e[1]/e[0];for(let n=1;n<e.length;n++)if(e[n]/e[n-1]!==r){t=!1;break}return t}(o))for(let e=1;e<=r;e++){const r=(e-1)%t.length,n=La(t[r]);nl(n);const o=Number(t[t.length-1]?.v),a=Number(t[0]?.v),l=o*(Number(t[1]?.v)/a)**e;n&&(n.v=i?i.fromNumber(l,n.f):l,s.push(n))}else{const a=function(e){const t=[];for(let r=1;r<=e;r++)t.push(r);return t}(t.length);for(let l=1;l<=r;l++){const r=(l-1)%t.length,c=La(t[r]);nl(c);const h=n===e.Direction.DOWN||n===e.Direction.RIGHT,u=Ga(t.length+l,o,a,h);c&&(c.v=i?i.fromNumber(u,c.f):u,s.push(c))}}return s}function Ga(e,t,r,n=!0){function i(e){let t=0;for(let r=0;r<e.length;r++)t+=e[r];return t/e.length}const s=i(r),o=i(t);let a,l=0,c=0;for(let e=0;e<r.length;e++)l+=(r[e]-s)*(t[e]-o),c+=(r[e]-s)*(r[e]-s);a=0===c?n?1:-1:l/c;const h=o-a*s;return Math.round(1e5*(h+a*e))/1e5}function Za(e,t,r){const n=[],i=/0|([1-9]+[0-9]*)/g;for(let s=1;s<=t;s++){const t=(s-1)%e.length,o=La(e[t]);nl(o);const a=`${e[e.length-1]?.v??""}`;if(!a)continue;const l=a?.match(i),c=l?.[l.length-1];if(!c)continue;const h=Math.abs(Number(c)+r*s),u=a.lastIndexOf(c),f=a.substr(0,u)+h.toString()+a.substr(u+c.length);o&&(o.v=f,n.push(o))}return n}function Ja(e,t,r,n=0){const i=[["日","一","二","三","四","五","六"],["周日","周一","周二","周三","周四","周五","周六"],["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]];if(n>=i.length)return[];const s=i[n],o=[];for(let n=1;n<=t;n++){const t=(n-1)%e.length,i=La(e[t]);nl(i);let a=0;if(e[e.length-1]?.v===s[0])a=7+r*n;else{const t=`${e[e.length-1]?.v??""}`;if(t){a=Va(t.substr(t.length-1,1))+r*n}}a<0&&(a=7*Math.ceil(Math.abs(a)/7)+a);const l=a%7;i&&(i.v=s[l],o.push(i))}return o}function Qa(e,t,r){const n=[];for(let i=1;i<=t;i++){const t=(i-1)%e.length,s=La(e[t]);nl(s);const o=Va(`${e[e.length-1]?.v??""}`)+r*i;let a;a=o<=0?"零":$a(o),s&&(s.v=a,n.push(s))}return n}const el={enWeek1:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],enWeek2:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],enMonth1:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],enMonth2:["January","February","March","April","May","June","July","August","September","October","November","December"],chnMonth1:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],chnMonth2:["正月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","腊月"],chHour1:["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"],chHour2:["子时","丑时","寅时","卯时","辰时","巳时","午时","未时","申时","酉时","戌时","亥时"],chYear1:["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"],chSeason1:["春","夏","秋","冬"],chSeason2:["春季","夏季","秋季","冬季"]};function tl(e){let t="";const r=[];return Object.keys(el).forEach((n=>{el[n].includes(e)&&(t=n,r.push(...el[n]))})),{name:t,series:r}}function rl(e,t,r,n){const i=n.length,s=[];for(let o=1;o<=t;o++){const t=(o-1)%e.length,a=La(e[t]);nl(a);const l=`${e[e.length-1]?.v??""}`;let c=n.indexOf(l)+r*o;c<0&&(c+=Math.abs(r)*i);const h=c%i;a&&(a.v=n[h],s.push(a))}return s}function nl(e){e&&"custom"in e&&delete e.custom}function il(e,t,r=new Date){const n=e.trim();if("yyyy-MM-dd"===t){const[e,t,r]=n.split("-").map(Number);return new Date(e,t-1,r)}if("yyyy-M-d"===t){const[e,t,r]=n.split("-").map(Number);return new Date(e,t-1,r)}if("yyyy/MM/dd"===t){const[e,t,r]=n.split("/").map(Number);return new Date(e,t-1,r)}if("yyyy/M/d"===t){const[e,t,r]=n.split("/").map(Number);return new Date(e,t-1,r)}if("MM/dd/yyyy"===t){const[e,t,r]=n.split("/").map(Number);return new Date(r,e-1,t)}if("yyyy年M月d日"===t){const e=n.match(/^(\d{4})年(\d{1,2})月(\d{1,2})(日)?$/);if(e)return new Date(Number(e[1]),Number(e[2])-1,Number(e[3]))}const i=new Date(n);return isNaN(i.getTime())?new Date(r):i}function sl(e){return!isNaN(e.getTime())}function ol(e,t){const r=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())-Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.floor(r/864e5)}class al{key="date";baseDate=new Date(1900,0,1);dateFormats=[{pattern:/^\d{4}-\d{2}-\d{2}$/,format:"yyyy-MM-dd"},{pattern:/^\d{4}-\d{1,2}-\d{1,2}$/,format:"yyyy-M-d"},{pattern:/^\d{4}\/\d{2}\/\d{2}$/,format:"yyyy/MM/dd"},{pattern:/^\d{4}\/\d{1,2}\/\d{1,2}$/,format:"yyyy/M/d"},{pattern:/^\d{2}\/\d{2}\/\d{4}$/,format:"MM/dd/yyyy"},{pattern:/^\d{4}年\d{1,2}月\d{1,2}(日)?$/,format:"yyyy年M月d日",parser:e=>{const t=e.match(/(\d{4})年(\d{1,2})月(\d{1,2})/);if(!t)throw new Error("无效的中文日期格式");return new Date(+t[1],+t[2]-1,+t[3])}}];detect(e){if(e instanceof Date)return!isNaN(e.getTime());if("string"!=typeof e)return!1;const t=e.trim(),r=this.dateFormats.find((e=>e.pattern.test(t)));if(r)try{return sl(r.parser?r.parser(t):il(t,r.format,new Date))}catch{return!1}return!1}toNumber(e){let t,r;if(e instanceof Date){if(!sl(e))throw new Error("无效的日期对象");t=e,r="yyyy-MM-dd"}else{const n=e.trim(),i=this.dateFormats.find((e=>e.pattern.test(n)));if(!i)throw new Error(`不支持的日期格式: ${n}`);if(t=i.parser?i.parser(n):il(n,i.format,new Date),!sl(t))throw new Error(`无效的日期值: ${n}`);r=i.format}return{v:ol(t,this.baseDate),meta:r}}fromNumber(e,t){const r=function(e,t){const r=new Date(e);return r.setDate(r.getDate()+t),r}(this.baseDate,e);return r.setHours(0,0,0,0),function(e,t){const r=e.getFullYear(),n=e.getMonth()+1,i=e.getDate(),s=e=>e.toString().padStart(2,"0");switch(t){case"yyyy-MM-dd":default:return`${r}-${s(n)}-${s(i)}`;case"yyyy-M-d":return`${r}-${n}-${i}`;case"yyyy/MM/dd":return`${r}/${s(n)}/${s(i)}`;case"yyyy/M/d":return`${r}/${n}/${i}`;case"MM/dd/yyyy":return`${s(n)}/${s(i)}/${r}`;case"yyyy年M月d日":return`${r}年${n}月${i}日`}}(r,t||"yyyy-MM-dd")}}const ll=new class{converters=[];register(e){this.converters.push(e)}getConverter(e){return this.converters.find((t=>t.detect(e)))||null}getConverterByKey(e){return this.converters.find((t=>t.key===e))||null}};ll.register(new al);const cl={type:e.DATA_TYPE.DATE,priority:1100,match:(e,t)=>"string"==typeof e?.v&&ll.getConverter(e.v)instanceof al,isContinue:(t,r)=>t.type===e.DATA_TYPE.DATE,applyFunctions:{[e.APPLY_TYPE.SERIES]:(t,r,n)=>{const{data:i}=t,s=ll.getConverter(i[0]?.v);return n===e.Direction.LEFT||n===e.Direction.UP?(i.reverse(),Xa(i,r,n,s).reverse()):Xa(i,r,n,s)}}},hl={type:e.DATA_TYPE.NUMBER,priority:1e3,match:t=>"number"==typeof t?.v||t?.t===e.CellValueType.NUMBER,isContinue:(t,r)=>t.type===e.DATA_TYPE.NUMBER,applyFunctions:{[e.APPLY_TYPE.SERIES]:(t,r,n)=>{const{data:i}=t;return n===e.Direction.LEFT||n===e.Direction.UP?(i.reverse(),Xa(i,r,n).reverse()):Xa(i,r,n)}}},ul={type:e.DATA_TYPE.OTHER,priority:0,match:()=>!0,isContinue:(t,r)=>t.type===e.DATA_TYPE.OTHER},fl={type:e.DATA_TYPE.EXTEND_NUMBER,priority:900,match:e=>qa(`${e?.v??""}`||"").isExtendNumber,isContinue:(t,r)=>{if(t.type===e.DATA_TYPE.EXTEND_NUMBER){const{beforeTxt:e,afterTxt:n}=qa(`${t.cellData?.v??""}`||""),{beforeTxt:i,afterTxt:s}=qa(`${r?.v??""}`||"");if(e===i&&n===s)return!0}return!1},applyFunctions:{[e.APPLY_TYPE.SERIES]:(t,r,n)=>{const{data:i}=t,s=n===e.Direction.UP||n===e.Direction.LEFT;let o;if(1===i.length)return o=s?-1:1,gl(Za(i,r,o),s);const a=[];for(let e=0;e<i.length;e++){const t=`${i[e]?.v}`;t&&a.push(Number(qa(t).matchTxt))}return s&&(i.reverse(),a.reverse()),Ka(a)?(o=a[1]-a[0],gl(Za(i,r,o),s)):Ya(i,r)}}},dl={type:e.DATA_TYPE.CHN_NUMBER,priority:830,match:e=>!!function(e){if(!e)return!1;let t=!0;if(e)if(1===e.length)t="日"===e||e in Da;else{const r=e.split("");for(let e=0;e<r.length;e++)if(!(r[e]in Da)&&!(r[e]in Ua)){t=!1;break}}return t}(`${e?.v??""}`||""),isContinue:(t,r)=>t.type===e.DATA_TYPE.CHN_NUMBER,applyFunctions:{[e.APPLY_TYPE.SERIES]:(t,r,n)=>{const{data:i}=t,s=n===e.Direction.LEFT||n===e.Direction.UP;if(1===i.length){let e;return e=s?-1:1,gl(Qa(i,r,e),s)}let o=!1;for(let e=0;e<i.length;e++){const t=i[e]?.v;if("日"===t){o=!0;break}}const a=[];let l=0;for(let e=0;e<i.length;e++){const t=`${i[e]?.v}`;"日"===t?0===e?a.push(0):(l++,a.push(7*l)):o&&Va(t)>0&&Va(t)<7?a.push(Va(t)+7*l):a.push(Va(t))}if(s&&(i.reverse(),a.reverse()),Ka(a)){return gl(Qa(i,r,a[1]-a[0]),s)}return Ya(i,r)}}},pl={type:e.DATA_TYPE.CHN_WEEK2,priority:820,match:e=>!!function(e){let t;return t=2===e.length&&("周一"===e||"周二"===e||"周三"===e||"周四"===e||"周五"===e||"周六"===e||"周日"===e),t}(`${e?.v??""}`||""),isContinue:(t,r)=>t.type===e.DATA_TYPE.CHN_WEEK2,applyFunctions:{[e.APPLY_TYPE.SERIES]:(t,r,n)=>{const{data:i}=t,s=n===e.Direction.LEFT||n===e.Direction.UP;if(1===i.length){let e;return e=s?-1:1,gl(Ja(i,r,e,1),s)}const o=[];let a=0;for(let e=0;e<i.length;e++){const t=`${i[e]?.v}`,r=t?.substr(t.length-1,1);"周日"===t?0===e?o.push(0):(a++,o.push(7*a)):o.push(Va(r)+7*a)}if(s&&(i.reverse(),o.reverse()),Ka(o)){return gl(Ja(i,r,o[1]-o[0],1),s)}return Ya(i,r)}}},ml={type:e.DATA_TYPE.CHN_WEEK3,priority:810,match:e=>function(e){let t;return t=3===e.length&&("星期一"===e||"星期二"===e||"星期三"===e||"星期四"===e||"星期五"===e||"星期六"===e||"星期日"===e),t}(`${e?.v??""}`||""),isContinue:(t,r)=>t.type===e.DATA_TYPE.CHN_WEEK3,applyFunctions:{[e.APPLY_TYPE.SERIES]:(t,r,n)=>{const{data:i}=t,s=n===e.Direction.LEFT||n===e.Direction.UP;if(1===i.length){let e;return e=s?-1:1,gl(Ja(i,r,e,2),s)}const o=[];let a=0;for(let e=0;e<i.length;e++){const t=`${i[e]?.v}`;if(t){const r=t.substr(t.length-1,1);"星期日"===t?0===e?o.push(0):(a++,o.push(7*a)):o.push(Va(r)+7*a)}}if(s&&(i.reverse(),o.reverse()),Ka(o)){return gl(Ja(i,r,o[1]-o[0],2),s)}return Ya(i,r)}}},bl={type:e.DATA_TYPE.LOOP_SERIES,priority:800,match:e=>function(e){let t=!1;return Object.keys(el).forEach((r=>{el[r].includes(e)&&(t=!0)})),t}(`${e?.v??""}`||""),isContinue:(t,r)=>t.type===e.DATA_TYPE.LOOP_SERIES&&tl(`${t.cellData?.v??""}`||"").name===tl(`${r?.v??""}`||"").name,applyFunctions:{[e.APPLY_TYPE.SERIES]:(t,r,n)=>{const{data:i}=t,s=n===e.Direction.LEFT||n===e.Direction.UP,{series:o}=tl(`${i[0]?.v}`||"");if(1===i.length){let e;return e=s?-1:1,gl(rl(i,r,e,o),s)}const a=[];let l=0;for(let e=0;e<i.length;e++){const t=`${i[e]?.v}`;t&&(t===o[0]?0===e?a.push(0):(l++,a.push(l*o.length)):a.push(o.indexOf(t)+7*l))}if(s&&(i.reverse(),a.reverse()),Ka(a)){return gl(rl(i,r,a[1]-a[0],o),s)}return Ya(i,r)}}};function gl(e,t){return t?e.reverse():e}const yl={type:e.DATA_TYPE.FORMULA,priority:1200,match:(e,t)=>"string"==typeof e?.v&&e.v.startsWith("="),isContinue:(t,r)=>!(t.type!==e.DATA_TYPE.FORMULA||!r?.v?.startsWith("=")),applyFunctions:{[e.APPLY_TYPE.COPY]:(e,t,r,n,i)=>{const{data:s}=e;return Ya(s,t)},[e.APPLY_TYPE.SERIES]:(t,r,n,i,s)=>{const{data:o}=t;if(1===o.length)return function(t,r,n,i){const s=[],o=t[0]?.v||"";for(let i=0;i<r;i++){let r=o,a=0,l=0;switch(n){case e.Direction.DOWN:a=i+1;break;case e.Direction.UP:a=-(i+1);break;case e.Direction.RIGHT:l=i+1;break;case e.Direction.LEFT:l=-(i+1)}r=wl(o,a,l),s.push({v:r,t:t[0]?.t})}return s}(o,r,n);const a=function(e,t,r,n){if(e.length<2)return null;const i=e[0]?.v||"",s=e[1]?.v||"",o=function(e,t){const r=/\$?([A-Z]+)\$?(\d+)/g,n=[...e.matchAll(r)],i=[...t.matchAll(r)];if(n.length!==i.length||0===n.length)return null;let s=0,o=0,a=0;for(let e=0;e<n.length;e++){const t=n[e][1],r=parseInt(n[e][2],10),l=i[e][1],c=parseInt(i[e][2],10),h=_l(l)-_l(t),u=c-r;Math.abs(h)<100&&Math.abs(u)<1e4&&(o+=h,s+=u,a++)}if(0===a)return null;return{rowOffset:s/a,colOffset:o/a}}(i,s);if(!o)return null;const a=[];for(let r=0;r<t;r++){let t=i;t=vl(t,o,r+1),a.push({v:t,t:e[0]?.t})}return a}(o,r);return a||Ya(o,r)}}};function vl(e,t,r,n){return e.replace(/\$?([A-Z]+)\$?(\d+)/g,((e,n,i)=>{const s=e.startsWith("$")&&e.indexOf(n)>0,o=e.includes("$"+i);let a=n,l=i;if(!s&&0!==t.colOffset){a=xl(_l(n)+t.colOffset*r)}if(!o&&0!==t.rowOffset){l=(parseInt(i,10)+t.rowOffset*r).toString()}let c="";return s&&(c+="$"),c+=a,o&&(c+="$"),c+=l,c}))}function wl(e,t,r){return e.replace(/\$?([A-Z]+)\$?(\d+)/g,((e,n,i)=>{const s=e.startsWith("$")&&e.indexOf(n)>0,o=e.includes("$"+i);let a=n,l=i;if(!s&&0!==r){a=xl(_l(n)+r)}if(!o&&0!==t){l=(parseInt(i,10)+t).toString()}let c="";return s&&(c+="$"),c+=a,o&&(c+="$"),c+=l,c}))}function _l(e){let t=0;for(let r=0;r<e.length;r++)t=26*t+(e.charCodeAt(r)-"A".charCodeAt(0)+1);return t}function xl(e){let t="";for(;e>0;)e--,t=String.fromCharCode("A".charCodeAt(0)+e%26)+t,e=Math.floor(e/26);return t}class Cl{_rules=[];constructor(){this._init()}_init(){this._rules=[yl,cl,hl,fl,dl,pl,ml,bl,ul].sort(((e,t)=>t.priority-e.priority))}registerRule(e){if(this._rules.find((t=>t.type===e.type)))throw new Error(`Registry rule failed, type '${e.type}' already exist!`);const t=this._rules.findIndex((t=>t.priority<e.priority));this._rules.splice(-1===t?this._rules.length:t,0,e)}getRules(){return this._rules}}class El{sourceData=[];autoFillService;tableInstance;sourceRange;targetRange;direction;headers;options;formulaAdapter;constructor(e){this.options=e,this.autoFillService=new Cl,this.formulaAdapter=new Fs({})}setTable(t){this.headers={row:new Set,col:new Set},this.tableInstance=t,this.formulaAdapter=Ps(t,this.options?.isFormulaCell,this.options?.getCellFormula,this.options?.setCellFormula),t.on(r.TABLE_EVENT_TYPE.DROPDOWN_MENU_CLICK,(t=>{"复制填充"===t.text?this.fillData(e.APPLY_TYPE.COPY):"序列填充"===t.text&&this.fillData(e.APPLY_TYPE.SERIES)}));const n=this.tableInstance.getAllRowHeaderCells()[0];n&&n.forEach((e=>{this.headers.col.add(e.col)}));const i=this.tableInstance.getAllColumnHeaderCells()[0];i&&i.forEach((e=>{this.headers.row.add(e.row)}))}handleStartDrag(e){this.sourceRange=Ms(e),this.sourceRange.cols=this.sourceRange.cols.filter((e=>!this.headers.col.has(e))),this.sourceRange.rows=this.sourceRange.rows.filter((e=>!this.headers.row.has(e)))}handleEndDrag(e,t){this.direction=t;const r=Ms(e);this.targetRange=Os(this.direction,this.sourceRange,r),this.targetRange.cols=this.targetRange.cols.filter((e=>!this.headers.col.has(e))),this.targetRange.rows=this.targetRange.rows.filter((e=>!this.headers.row.has(e))),this.options?.fillMode?this.fillData(this.options.fillMode):Is(this.tableInstance,Math.max(...r.cols),Math.max(...r.rows))}handleDbClick(){if(!this.sourceRange)return;this.direction=e.Direction.DOWN;const t=Ms(this._detectFillRange());if(this.targetRange=Os(this.direction,this.sourceRange,t),this.targetRange.cols=this.targetRange.cols.filter((e=>!this.headers.col.has(e))),this.targetRange.rows=this.targetRange.rows.filter((e=>!this.headers.row.has(e))),0===this.targetRange.cols.length||0===this.targetRange.rows.length)return;const r=this.sourceRange.cols[0],n=this.sourceRange.rows[0],i=this.targetRange.cols[this.targetRange.cols.length-1],s=this.targetRange.rows[this.targetRange.rows.length-1],o=this.tableInstance.stateManager;o.updateSelectPos(r,n,!1,!1,!1,!0,!0),o.updateInteractionState(b.grabing),o.updateSelectPos(i,s,!1,!1,!1,!0,!0),o.endSelectCells(!1,!1),o.updateInteractionState(b.default),this.options?.fastFillMode?this.fillData(this.options.fastFillMode):Is(this.tableInstance,i,s)}fillData(e){this.sourceData=this.getSourceData(this.sourceRange,this.direction);const t={source:this.sourceRange,target:this.targetRange};this._fillData(t,this.direction,e)}getSourceData(t,r){const n=this.autoFillService.getRules(),i=[],s=r===e.Direction.DOWN||r===e.Direction.UP;let o,a;s?(o=t.cols,a=t.rows):(o=t.rows,a=t.cols);const l=Ns(this.tableInstance);return o.forEach((e=>{const t=this.getEmptySourceDataPiece(),r={type:void 0,cellData:void 0};a.forEach((i=>{let o;const c=s?e:i,h=s?i:e;if(o=s?l.getValue(i,e):l.getValue(e,i),o&&this.formulaAdapter.isFormulaCell(c,h)){const e=this.formulaAdapter.getCellFormula(c,h);e&&(o={...o,v:e})}const u=n.find((e=>e.match(o,null)))||ul,{type:f,isContinue:d}=u;if(d(r,o)){const e=t[f],r=e[e.length-1];r.data.push(o),r.index.push(i-a[0])}else{const e=t[f];e?e.push({data:[o],index:[i-a[0]]}):t[f]=[{data:[o],index:[i-a[0]]}]}r.type=f,r.cellData=o})),i.push(t)})),i}getEmptySourceDataPiece(){const e={};return this.autoFillService.getRules().forEach((t=>{e[t.type]=[]})),e}_detectFillRange(){const e={row:Math.min(...this.sourceRange.rows),col:Math.min(...this.sourceRange.cols)},t={row:Math.max(...this.sourceRange.rows),col:Math.max(...this.sourceRange.cols)},r=Ns(this.tableInstance),n=r.getMaxRows(),i=r.getMaxColumns();let s=t.row;if(e.col>0&&r.getValue(e.row,e.col-1)?.v){let t=e.row;for(;r.getValue(t,e.col-1)?.v&&t<=n;)t+=1;s=t-1}else if(t.col<i&&r.getValue(t.row,t.col+1)?.v){let i=e.row;for(;r.getValue(i,t.col+1)?.v&&i<=n;)i+=1;s=i-1}for(let n=t.row+1;n<=s;n++)for(let i=e.col;i<=t.col;i++)if(r.getValue(n,i)?.v){s=n-1;break}return{start:{row:e.row,col:e.col},end:{row:s,col:t.col}}}_fillData(t,r,n){const{source:i,target:s}=t;if(!i||!s||null==r)return;const{cols:o,rows:a}=s,{cols:l,rows:c}=i,h=this.sourceData;let u;u=r===e.Direction.DOWN||r===e.Direction.UP?c.length:l.length;const f=[];if(r===e.Direction.DOWN||r===e.Direction.UP){const e=a.length,i=[];o.forEach(((s,o)=>{const a=h[o],l=this.getApplyData(a,u,e,r,n,t);i.push(l)}));for(let e=0;e<i[0].length;e++){const t=[];for(let r=0;r<i.length;r++)t.push(i[r][e]);f.push(t)}}else{const e=o.length;a.forEach(((i,s)=>{const o=h[s],a=this.getApplyData(o,u,e,r,n,t),l=[];for(let e=0;e<a.length;e++)l.push(a[e]);f.push(l)}))}const d=[],p=[];a.forEach(((e,t)=>{const r=[];o.forEach(((n,i)=>{const s=function(e,t,r){const n=e.getCellRange(t,r);return n.start.col!==n.end.col||n.start.row!==n.end.row?n:null}(this.tableInstance,n,e);if(s&&this.tableInstance.unmergeCells(s.start.col,s.start.row,s.end.col,s.end.row),f[t][i]){const s=f[t][i],o=s?.v+"";s&&"string"==typeof s.v&&s.v.startsWith("=")?(p.push({col:n,row:e,formula:s.v}),r.push(o)):r.push(o)}})),d.push(r)}));const m=Math.min(...a),b=Math.min(...o);this.tableInstance.changeCellValues(b,m,d),p.length>0&&(p.forEach((({col:e,row:t,formula:r})=>{this.formulaAdapter.setCellFormula(e,t,r)})),this.formulaAdapter.hasFormulaEngine()&&this.formulaAdapter.refreshFormulas())}getApplyData(e,t,r,n,i,s){const o=[],a=Math.floor(r/t),l=r%t,c=this.autoFillService.getRules(),h={};c.forEach((e=>{h[e.type]=[]})),c.forEach((o=>{const{type:c,applyFunctions:u={}}=o,f=e[c];f&&f.forEach((o=>{const f=function(e,t){let r=0;for(let n=0;n<e.length&&e[n]<t;n++)r++;return r}(o.index,l),d=o.index.length*a+f,p=this.applyFunctions(o,d,n,i,u,e,s),m=function(e,t,r){const n=[],i=Math.floor(t/e),s=t%e;let o=0;if(i>0){for(let t=0;t<i;t++)for(let i=0;i<r.length;i++)n[r[i]+t*e]=o,o++;for(let t=0;t<r.length&&r[t]<s;t++)n[r[t]+e*i]=o,o++}else for(let e=0;e<r.length&&r[e]<s;e++)n[r[e]]=o,o++;return n}(t,r,o.index);h[c].push({data:p,index:m})}))}));for(let e=0;e<r;e++)c.forEach((t=>{const{type:r}=t,n=h[r];for(let t=0;t<n.length;t++)e in n[t].index&&o.push(n[t].data[n[t].index[e]])}));return o}applyFunctions(t,r,n,i,s,o,a){const{data:l}=t,c=n===e.Direction.UP||n===e.Direction.LEFT;if(i===e.APPLY_TYPE.COPY){const i=s?.[e.APPLY_TYPE.COPY];return i?i(t,r,n,o,a):(c&&l.reverse(),Ya(l,r))}if(i===e.APPLY_TYPE.SERIES){const i=s?.[e.APPLY_TYPE.SERIES];return i?i(t,r,n,o):(c&&l.reverse(),s?.[e.APPLY_TYPE.COPY]?s[e.APPLY_TYPE.COPY](t,r,n,o,a):Ya(l,r))}return[]}}e.AddRowColumnPlugin=class{id="add-row-column";name="Add Row Column";runTime=[r.TABLE_EVENT_TYPE.MOUSEENTER_CELL,r.TABLE_EVENT_TYPE.MOUSELEAVE_CELL,r.TABLE_EVENT_TYPE.MOUSELEAVE_TABLE];pluginOptions;table;hoverCell;hideAllTimeoutId_addColumn;hideAllTimeoutId_addRow;leftDotForAddColumn;rightDotForAddColumn;addIconForAddColumn;addLineForAddColumn;topDotForAddRow;bottomDotForAddRow;addIconForAddRow;addLineForAddRow;constructor(e={addColumnEnable:!0,addRowEnable:!0}){this.id=e.id??this.id,this.pluginOptions=e,this.pluginOptions.addColumnEnable=this.pluginOptions.addColumnEnable??!0,this.pluginOptions.addRowEnable=this.pluginOptions.addRowEnable??!0,this.pluginOptions.addColumnEnable&&(this.initAddColumnDomElement(),this.bindEventForAddColumn()),this.pluginOptions.addRowEnable&&(this.initAddRowDomElement(),this.bindEventForAddRow())}run(...e){const t=e[0],n=e[1],i=e[2];if(this.table=i,n===r.TABLE_EVENT_TYPE.MOUSEENTER_CELL){clearTimeout(this.hideAllTimeoutId_addColumn),clearTimeout(this.hideAllTimeoutId_addRow);const e=i.canvas.getBoundingClientRect(),r=i.getCellAtRelativePosition(t.event.clientX-e.left,t.event.clientY-e.top);this.hoverCell=r;const n=i.getCellRelativeRect(r.col,r.row);if(this.pluginOptions.addColumnEnable){const t=i.isSeriesNumber(r.col,0);this.showDotForAddColumn(e.top-6,n.left+e.left,n.right+e.left,!t)}if(this.pluginOptions.addRowEnable){const t=i.isHeader(r.col,r.row);this.showDotForAddRow(n.top+e.top,e.left-6,n.bottom+e.top,!t,!t)}}else n===r.TABLE_EVENT_TYPE.MOUSELEAVE_CELL||n===r.TABLE_EVENT_TYPE.MOUSELEAVE_TABLE&&(this.pluginOptions.addColumnEnable&&this.delayHideAllForAddColumn(),this.pluginOptions.addRowEnable&&this.delayHideAllForAddRow())}initAddColumnDomElement(){this.leftDotForAddColumn=document.createElement("div"),this.leftDotForAddColumn.style.width="6px",this.leftDotForAddColumn.style.height="6px",this.leftDotForAddColumn.style.backgroundColor="#4A90E2",this.leftDotForAddColumn.style.position="absolute",this.leftDotForAddColumn.style.cursor="pointer",this.leftDotForAddColumn.style.zIndex="1000",this.leftDotForAddColumn.style.borderRadius="50%",this.leftDotForAddColumn.style.border="1px solid white",this.leftDotForAddColumn.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.leftDotForAddColumn),this.rightDotForAddColumn=document.createElement("div"),this.rightDotForAddColumn.style.width="6px",this.rightDotForAddColumn.style.height="6px",this.rightDotForAddColumn.style.backgroundColor="#4A90E2",this.rightDotForAddColumn.style.position="absolute",this.rightDotForAddColumn.style.cursor="pointer",this.rightDotForAddColumn.style.zIndex="1000",this.rightDotForAddColumn.style.borderRadius="50%",this.rightDotForAddColumn.style.border="1px solid white",this.rightDotForAddColumn.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.rightDotForAddColumn),this.addIconForAddColumn=document.createElement("div"),this.addIconForAddColumn.style.width="18px",this.addIconForAddColumn.style.height="18px",this.addIconForAddColumn.style.backgroundColor="#4A90E2",this.addIconForAddColumn.style.position="absolute",this.addIconForAddColumn.style.zIndex="1001",this.addIconForAddColumn.style.display="none",this.addIconForAddColumn.style.borderRadius="50%",this.addIconForAddColumn.style.boxShadow="0 2px 5px rgba(0,0,0,0.2)",this.addIconForAddColumn.style.justifyContent="center",this.addIconForAddColumn.style.alignItems="center",this.addIconForAddColumn.style.border="1px solid white",document.body.appendChild(this.addIconForAddColumn);const e=document.createElement("div");e.textContent="+",e.style.color="white",e.style.fontSize="18px",e.style.fontWeight="bold",e.style.lineHeight="15px",e.style.userSelect="none",e.style.cursor="pointer",e.style.verticalAlign="top",e.style.textAlign="center",this.addIconForAddColumn.appendChild(e),this.addLineForAddColumn=document.createElement("div"),this.addLineForAddColumn.style.width="2px",this.addLineForAddColumn.style.height="10px",this.addLineForAddColumn.style.backgroundColor="#4A90E2",this.addLineForAddColumn.style.position="absolute",this.addLineForAddColumn.style.zIndex="1001",this.addLineForAddColumn.style.display="none",document.body.appendChild(this.addLineForAddColumn)}bindEventForAddColumn(){this.leftDotForAddColumn.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addColumn),this.addIconForAddColumn.style.display="block";const e=this.leftDotForAddColumn.offsetWidth,t=this.leftDotForAddColumn.offsetHeight;this.showAddIconForAddColumn(this.leftDotForAddColumn.offsetLeft+e/2,this.leftDotForAddColumn.offsetTop+t/2,!0),this.showSplitLineForAddColumn(this.leftDotForAddColumn.offsetLeft+e/2-1,this.leftDotForAddColumn.offsetTop+t/2+2,this.table.getDrawRange().height)})),this.rightDotForAddColumn.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addColumn),this.addIconForAddColumn.style.display="block";const e=this.rightDotForAddColumn.offsetWidth,t=this.rightDotForAddColumn.offsetHeight;this.showAddIconForAddColumn(this.rightDotForAddColumn.offsetLeft+e/2,this.rightDotForAddColumn.offsetTop+t/2,!1),this.showSplitLineForAddColumn(this.rightDotForAddColumn.offsetLeft+e/2-1,this.rightDotForAddColumn.offsetTop+t/2+2,this.table.getDrawRange().height)})),this.addIconForAddColumn.addEventListener("mouseleave",(()=>{this.addIconForAddColumn.style.display="none",this.addLineForAddColumn.style.display="none",this.delayHideAllForAddColumn()})),this.addIconForAddColumn.addEventListener("click",(e=>{const t="left"===this.addIconForAddColumn.dataset.addIconType;this.table.options.columns;const r=this.hoverCell.col,n=t?r:r+1;this.pluginOptions.addColumnCallback?this.pluginOptions.addColumnCallback(n,this.table):this.table.addColumns([{field:n,title:`New Column ${r}`,width:100}],n,!0),this.delayHideAllForAddColumn(0)}))}showDotForAddColumn(e,t,r,n=!0,i=!0){const s=this.leftDotForAddColumn.offsetWidth,o=this.leftDotForAddColumn.offsetHeight;this.leftDotForAddColumn.style.left=t-s/2+"px",this.leftDotForAddColumn.style.top=e-o/2+"px",this.rightDotForAddColumn.style.left=r-s/2+"px",this.rightDotForAddColumn.style.top=e-o/2+"px",this.leftDotForAddColumn.style.display=n?"block":"none",this.rightDotForAddColumn.style.display=i?"block":"none"}showAddIconForAddColumn(e,t,r){const n=this.addIconForAddColumn.offsetWidth,i=this.addIconForAddColumn.offsetHeight,s=this.leftDotForAddColumn.offsetHeight;this.addIconForAddColumn.style.left=e-n/2+"px",this.addIconForAddColumn.style.top=t-i/2-s/2+"px",this.addIconForAddColumn.dataset.addIconType=r?"left":"right"}showSplitLineForAddColumn(e,t,r){this.addLineForAddColumn.style.left=`${e}px`,this.addLineForAddColumn.style.top=`${t}px`,this.addLineForAddColumn.style.height=`${r}px`,this.addLineForAddColumn.style.display="block"}delayHideAllForAddColumn(e=1e3){this.hideAllTimeoutId_addColumn=setTimeout((()=>{this.addIconForAddColumn.style.display="none",this.addLineForAddColumn.style.display="none",this.leftDotForAddColumn.style.display="none",this.rightDotForAddColumn.style.display="none"}),e)}initAddRowDomElement(){this.topDotForAddRow=document.createElement("div"),this.topDotForAddRow.style.width="6px",this.topDotForAddRow.style.height="6px",this.topDotForAddRow.style.backgroundColor="#4A90E2",this.topDotForAddRow.style.position="absolute",this.topDotForAddRow.style.cursor="pointer",this.topDotForAddRow.style.zIndex="1000",this.topDotForAddRow.style.borderRadius="50%",this.topDotForAddRow.style.border="1px solid white",this.topDotForAddRow.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.topDotForAddRow),this.bottomDotForAddRow=document.createElement("div"),this.bottomDotForAddRow.style.width="6px",this.bottomDotForAddRow.style.height="6px",this.bottomDotForAddRow.style.backgroundColor="#4A90E2",this.bottomDotForAddRow.style.position="absolute",this.bottomDotForAddRow.style.cursor="pointer",this.bottomDotForAddRow.style.zIndex="1000",this.bottomDotForAddRow.style.borderRadius="50%",this.bottomDotForAddRow.style.border="1px solid white",this.bottomDotForAddRow.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.bottomDotForAddRow),this.addIconForAddRow=document.createElement("div"),this.addIconForAddRow.style.width="18px",this.addIconForAddRow.style.height="18px",this.addIconForAddRow.style.backgroundColor="#4A90E2",this.addIconForAddRow.style.position="absolute",this.addIconForAddRow.style.zIndex="1001",this.addIconForAddRow.style.display="none",this.addIconForAddRow.style.borderRadius="50%",this.addIconForAddRow.style.boxShadow="0 2px 5px rgba(0,0,0,0.2)",this.addIconForAddRow.style.justifyContent="center",this.addIconForAddRow.style.alignItems="center",this.addIconForAddRow.style.border="1px solid white",document.body.appendChild(this.addIconForAddRow);const e=document.createElement("div");e.textContent="+",e.style.color="white",e.style.fontSize="18px",e.style.fontWeight="bold",e.style.lineHeight="15px",e.style.userSelect="none",e.style.cursor="pointer",e.style.verticalAlign="top",e.style.textAlign="center",this.addIconForAddRow.appendChild(e),this.addLineForAddRow=document.createElement("div"),this.addLineForAddRow.style.width="10px",this.addLineForAddRow.style.height="2px",this.addLineForAddRow.style.backgroundColor="#4A90E2",this.addLineForAddRow.style.position="absolute",this.addLineForAddRow.style.zIndex="1001",this.addLineForAddRow.style.display="none",document.body.appendChild(this.addLineForAddRow)}bindEventForAddRow(){this.topDotForAddRow.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addRow),this.addIconForAddRow.style.display="block";const e=this.topDotForAddRow.offsetWidth,t=this.topDotForAddRow.offsetHeight;this.showAddIconForAddRow(this.topDotForAddRow.offsetLeft+e/2,this.topDotForAddRow.offsetTop+t/2,!0),this.showSplitLineForAddRow(this.topDotForAddRow.offsetLeft+e+2,this.topDotForAddRow.offsetTop+t/2-1,this.table.getDrawRange().width)})),this.bottomDotForAddRow.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addRow),this.addIconForAddRow.style.display="block";const e=this.bottomDotForAddRow.offsetWidth,t=this.bottomDotForAddRow.offsetHeight;this.showAddIconForAddRow(this.bottomDotForAddRow.offsetLeft+e/2,this.bottomDotForAddRow.offsetTop+t/2,!1),this.showSplitLineForAddRow(this.bottomDotForAddRow.offsetLeft+e+2,this.bottomDotForAddRow.offsetTop+t/2-1,this.table.getDrawRange().height)})),this.addIconForAddRow.addEventListener("mouseleave",(()=>{this.addIconForAddRow.style.display="none",this.addLineForAddRow.style.display="none",this.delayHideAllForAddRow()})),this.addIconForAddRow.addEventListener("click",(e=>{const t="top"===this.addIconForAddRow.dataset.addIconType,r=this.hoverCell.row,n=t?r:r+1;if(this.pluginOptions.addRowCallback)this.pluginOptions.addRowCallback(n,this.table);else{const e=this.table.getRecordIndexByCell(0,n);this.table.addRecord({},e)}this.delayHideAllForAddRow(0)}))}showDotForAddRow(e,t,r,n=!0,i=!0){const s=this.topDotForAddRow.offsetWidth,o=this.topDotForAddRow.offsetHeight;this.topDotForAddRow.style.left=t-s/2+"px",this.topDotForAddRow.style.top=e-o/2+"px",this.bottomDotForAddRow.style.left=t-s/2+"px",this.bottomDotForAddRow.style.top=r-o/2+"px",this.topDotForAddRow.style.display=n?"block":"none",this.bottomDotForAddRow.style.display=i?"block":"none"}showAddIconForAddRow(e,t,r){const n=this.addIconForAddRow.offsetWidth,i=this.addIconForAddRow.offsetHeight,s=this.topDotForAddRow.offsetWidth;this.addIconForAddRow.style.left=e-n/2-s/2+"px",this.addIconForAddRow.style.top=t-i/2+"px",this.addIconForAddRow.dataset.addIconType=r?"top":"bottom"}showSplitLineForAddRow(e,t,r){this.addLineForAddRow.style.left=`${e}px`,this.addLineForAddRow.style.top=`${t}px`,this.addLineForAddRow.style.width=`${r}px`,this.addLineForAddRow.style.display="block"}delayHideAllForAddRow(e=1e3){this.hideAllTimeoutId_addRow=setTimeout((()=>{this.addIconForAddRow.style.display="none",this.addLineForAddRow.style.display="none",this.topDotForAddRow.style.display="none",this.bottomDotForAddRow.style.display="none"}),e)}release(){this.leftDotForAddColumn.remove(),this.rightDotForAddColumn.remove(),this.addIconForAddColumn.remove(),this.addLineForAddColumn.remove(),this.topDotForAddRow.remove(),this.bottomDotForAddRow.remove(),this.addIconForAddRow.remove(),this.addLineForAddRow.remove()}},e.AutoFillPlugin=class{id="auto-fill";name="Auto Fill";runTime=[r.TABLE_EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,r.TABLE_EVENT_TYPE.DRAG_FILL_HANDLE_END,r.TABLE_EVENT_TYPE.DBLCLICK_FILL_HANDLE];table;autoFillManager;constructor(e){this.autoFillManager=new El(e)}run(...e){if(e[1]===r.TABLE_EVENT_TYPE.MOUSEDOWN_FILL_HANDLE){const[,,t]=e;this.table=t,this.autoFillManager.setTable(this.table),this.autoFillManager.handleStartDrag(this.table?.getSelectedCellRanges()[0])}else if(e[1]===r.TABLE_EVENT_TYPE.DRAG_FILL_HANDLE_END){const[{direction:t}]=e;this.autoFillManager.handleEndDrag(this.table?.getSelectedCellRanges()[0],t)}else e[1]===r.TABLE_EVENT_TYPE.DBLCLICK_FILL_HANDLE&&this.autoFillManager.handleDbClick()}},e.CarouselAnimationPlugin=class{table;rowCount;colCount;animationDuration;animationDelay;animationEasing;replaceScrollAction;playing;row;col;willUpdateRow=!1;willUpdateCol=!1;customDistRowFunction;customDistColFunction;constructor(e,t){this.table=e,this.rowCount=t?.rowCount??void 0,this.colCount=t?.colCount??void 0,this.animationDuration=t?.animationDuration??500,this.animationDelay=t?.animationDelay??1e3,this.animationEasing=t?.animationEasing??"linear",this.replaceScrollAction=t?.replaceScrollAction??!1,this.customDistColFunction=t.customDistColFunction,this.customDistRowFunction=t.customDistRowFunction,this.reset(),this.init()}init(){this.replaceScrollAction&&(this.table.disableScroll(),this.table.scenegraph.stage.addEventListener("wheel",this.onScrollEnd.bind(this)))}reset(){this.playing=!1,this.row=this.table.frozenRowCount,this.col=this.table.frozenColCount}onScrollEnd(e){this.rowCount?(e.deltaY>0?(this.row+=this.rowCount,this.row=Math.min(this.row,this.table.rowCount-this.table.frozenRowCount)):e.deltaY<0&&(this.row-=this.rowCount,this.row=Math.max(this.row,this.table.frozenRowCount)),this.table.scrollToRow(this.row,{duration:this.animationDuration,easing:this.animationEasing})):this.colCount&&(e.deltaX>0?(this.col+=this.colCount,this.col=Math.min(this.col,this.table.colCount-this.table.frozenColCount)):e.deltaX<0&&(this.col-=this.colCount,this.col=Math.max(this.col,this.table.frozenColCount)),this.table.scrollToCol(this.col,{duration:this.animationDuration,easing:this.animationEasing}))}play(){this.playing=!0,this.rowCount&&!this.willUpdateRow?this.updateRow():this.colCount&&!this.willUpdateCol&&this.updateCol()}pause(){this.playing=!1}updateRow(){if(!this.playing||this.table.isReleased)return;let e=!0;const t=this.customDistRowFunction&&this.customDistRowFunction(this.row,this.table);t?(this.row=t.distRow,e=t.animation??!0):s(this.row)&&this.table.scenegraph.proxy.screenTopRow!==this.row?(this.row=this.table.frozenRowCount,e=!1):s(this.row)||this.table.scenegraph.proxy.screenTopRow===Math.floor(this.row)?this.row+=this.rowCount:(this.row=this.table.frozenRowCount,e=!1),this.table.scrollToRow(this.row,e?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateRow=!0,setTimeout((()=>{this.willUpdateRow=!1,this.updateRow()}),this.animationDuration+this.animationDelay)}updateCol(){if(!this.playing||this.table.isReleased)return;let e=!0;const t=this.customDistColFunction&&this.customDistColFunction(this.col,this.table);t?(this.col=t.distCol,e=t.animation??!0):s(this.col)&&this.table.scenegraph.proxy.screenLeftCol!==this.col?(this.col=this.table.frozenColCount,e=!1):s(this.col)||this.table.scenegraph.proxy.screenLeftCol===Math.floor(this.col)?this.col+=this.colCount:(this.col=this.table.frozenColCount,e=!1),this.table.scrollToCol(this.col,e?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateCol=!0,setTimeout((()=>{this.willUpdateCol=!1,this.updateCol()}),this.animationDuration+this.animationDelay)}},e.ColumnSeriesPlugin=class{id="column-series";name="Column Series";runTime=[r.TABLE_EVENT_TYPE.BEFORE_INIT,r.TABLE_EVENT_TYPE.BEFORE_KEYDOWN];pluginOptions;table;columns=[];constructor(e){this.id=e.id??this.id,this.pluginOptions=Object.assign({columnCount:100},e)}run(...e){if(e[1]===r.TABLE_EVENT_TYPE.BEFORE_INIT){const t=e[0],r=e[2];this.table=r;const n=t.options;this.columns=this.generateColumns(this.pluginOptions.columnCount),n.columns=this.columns}else if(e[1]===r.TABLE_EVENT_TYPE.BEFORE_KEYDOWN){const t=e[0].event;this.pluginOptions.autoExtendColumnTriggerKeys?.includes(t.key)&&this.table.stateManager.select.cellPos.col===this.table.colCount-1&&this.table.addColumns([this.generateColumn(this.table.colCount-1)])}}generateColumns(e){const t=[];for(let r=0;r<e;r++)t.push(this.generateColumn(r));return t}generateColumn(e){return{title:this.pluginOptions.generateColumnTitle?this.pluginOptions.generateColumnTitle(e):this.generateColumnField(e)}}generateColumnField(e){if(e<26)return String.fromCharCode(65+e);const t=[];for(e++;e>0;)e--,t.unshift(String.fromCharCode(65+e%26)),e=Math.floor(e/26);return t.join("")}resetColumnCount(e){this.pluginOptions.columnCount=e,this.columns=this.generateColumns(e),this.table.updateColumns(this.columns)}},e.ConditionFilter=Xi,e.ContextMenuPlugin=class{id="context-menu";name="Context Menu";runTime=[r.TABLE_EVENT_TYPE.CONTEXTMENU_CELL,r.TABLE_EVENT_TYPE.PLUGIN_EVENT];pluginOptions;table;menuManager;menuHandler;constructor(e={}){this.id=e.id??this.id,this.pluginOptions=e,this.menuManager=new P,this.menuHandler=new Hi,this.initDefaultMenuItems()}initDefaultMenuItems(){this.pluginOptions.columnSeriesNumberMenuItems||(this.pluginOptions.columnSeriesNumberMenuItems=H),this.pluginOptions.rowSeriesNumberMenuItems||(this.pluginOptions.rowSeriesNumberMenuItems=z),this.pluginOptions.cornerSeriesNumberMenuItems||(this.pluginOptions.cornerSeriesNumberMenuItems=U),this.pluginOptions.headerCellMenuItems||(this.pluginOptions.headerCellMenuItems=B),this.pluginOptions.bodyCellMenuItems||(this.pluginOptions.bodyCellMenuItems=D)}handleContextMenuCell=(e,t)=>{const{col:r,row:n}=e,i=e.event.clientX,s=e.event.clientY,o=t.isSeriesNumber(r,n);let a=[];if(a=t.isHeader(r,n)?o?this.pluginOptions.columnSeriesNumberMenuItems||[]:this.pluginOptions.headerCellMenuItems||[]:o?this.pluginOptions.rowSeriesNumberMenuItems||[]:this.pluginOptions.bodyCellMenuItems||[],a.length>0){const e=t.getCellRange(r,n);a=e.start.col!==e.end.col||e.start.row!==e.end.row?a.filter((e=>"string"==typeof e||"merge_cells"!==e.menuKey)):a.filter((e=>"string"==typeof e||"unmerge_cells"!==e.menuKey)),this.pluginOptions.beforeShowAdjustMenuItems&&(a=this.pluginOptions.beforeShowAdjustMenuItems(a,t,r,n)),this.showContextMenu(a,i,s,r,n)}};handlePluginEvent=(e,t)=>{const{eventType:r,rowIndex:n,colIndex:i,isCorner:s}=e.pluginEventInfo,o=e.plugin,a=e.event.clientX,l=e.event.clientY;if("table-series-number"===o.id&&"rightclick"===r){let e=[];s?e=this.pluginOptions.cornerSeriesNumberMenuItems||[]:void 0!==n?e=this.pluginOptions.rowSeriesNumberMenuItems||[]:void 0!==i&&(e=this.pluginOptions.columnSeriesNumberMenuItems||[]),this.pluginOptions.beforeShowAdjustMenuItems&&(e=this.pluginOptions.beforeShowAdjustMenuItems(e,t,i,n)),this.showContextMenu(e,a,l,i,n)}};run(...e){const t=e[0],n=e[1],i=e[2];this.table=i,t.event.preventDefault(),n===r.TABLE_EVENT_TYPE.CONTEXTMENU_CELL?this.handleContextMenuCell(t,i):n===r.TABLE_EVENT_TYPE.PLUGIN_EVENT&&this.handlePluginEvent(t,i)}handleMenuClickCallback=(e,t)=>{"function"==typeof this.pluginOptions.menuClickCallback?this.pluginOptions.menuClickCallback(e,t):this.handleMenuClick(e,t)};showContextMenu(e,t,r,n,i){this.menuManager.showMenu(e,t,r,{rowIndex:i,colIndex:n},this.table),this.menuManager.setClickCallback(this.handleMenuClickCallback)}handleMenuClick(t,r){const{menuKey:n,rowIndex:i,colIndex:s,inputValue:o=1}=t;if("object"==typeof this.pluginOptions.menuClickCallback&&this.pluginOptions.menuClickCallback[n])this.pluginOptions.menuClickCallback[n](t,r);else switch(n){case e.MenuKey.COPY:this.menuHandler.handleCopy(r);break;case e.MenuKey.CUT:this.menuHandler.handleCut(r);break;case e.MenuKey.PASTE:this.menuHandler.handlePaste(r);break;case e.MenuKey.INSERT_ROW_ABOVE:this.menuHandler.handleInsertRowAbove(r,i,o);break;case e.MenuKey.INSERT_ROW_BELOW:this.menuHandler.handleInsertRowBelow(r,i,o);break;case e.MenuKey.INSERT_COLUMN_LEFT:this.menuHandler.handleInsertColumnLeft(r,s,o);break;case e.MenuKey.INSERT_COLUMN_RIGHT:this.menuHandler.handleInsertColumnRight(r,s,o);break;case e.MenuKey.DELETE_ROW:this.menuHandler.handleDeleteRow(r);break;case e.MenuKey.DELETE_COLUMN:this.menuHandler.handleDeleteColumn(r,s);break;case e.MenuKey.HIDE_COLUMN:this.menuHandler.handleHideColumn(r,s);break;case e.MenuKey.SORT:this.menuHandler.handleSort(r,s);break;case e.MenuKey.MERGE_CELLS:this.menuHandler.handleMergeCells(r);break;case e.MenuKey.UNMERGE_CELLS:this.menuHandler.handleUnmergeCells(r);break;case e.MenuKey.FREEZE_TO_THIS_ROW:this.menuHandler.handleFreezeToRow(r,i);break;case e.MenuKey.FREEZE_TO_THIS_COLUMN:this.menuHandler.handleFreezeToColumn(r,s);break;case e.MenuKey.FREEZE_TO_THIS_ROW_AND_COLUMN:this.menuHandler.handleFreezeToRowAndColumn(r,i,s);break;case e.MenuKey.UNFREEZE:this.menuHandler.handleUnfreeze(r)}}release(){this.menuManager&&(this.menuManager.release(),this.menuManager=null),this.menuHandler&&(this.menuHandler.release(),this.menuHandler=null)}},e.CustomFormulaAdapter=js,e.DEFAULT_BODY_MENU_ITEMS=D,e.DEFAULT_COLUMN_SERIES_MENU_ITEMS=H,e.DEFAULT_CORNER_SERIES_MENU_ITEMS=U,e.DEFAULT_HEADER_MENU_ITEMS=B,e.DEFAULT_ROW_SERIES_MENU_ITEMS=z,e.DefaultFormulaAdapter=Fs,e.ExcelEditCellKeyboardPlugin=class{id="excel-edit-cell-keyboard";name="Excel Edit Cell Keyboard";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED];table;pluginOptions;responseKeyboard;constructor(t){this.id=t?.id??this.id,this.pluginOptions=t,this.responseKeyboard=t?.responseKeyboard??[e.ExcelEditCellKeyboardResponse.ENTER,e.ExcelEditCellKeyboardResponse.TAB,e.ExcelEditCellKeyboardResponse.ARROW_LEFT,e.ExcelEditCellKeyboardResponse.ARROW_RIGHT,e.ExcelEditCellKeyboardResponse.ARROW_DOWN,e.ExcelEditCellKeyboardResponse.ARROW_UP,e.ExcelEditCellKeyboardResponse.DELETE,e.ExcelEditCellKeyboardResponse.BACKSPACE],this.bindEvent()}run(...e){const t=e[2];this.table=t}bindEvent(){document.addEventListener("keydown",this.handleKeyDown.bind(this),!0)}handleKeyDown(t){if(this.table?.editorManager&&this.isExcelShortcutKey(t)){const r=t.key.toLowerCase();if(this.table.editorManager.editingEditor&&"keydown"===this.table.editorManager.beginTriggerEditCellMode){const{col:n,row:i}=this.table.editorManager.editCell;if(r===e.ExcelEditCellKeyboardResponse.BACKSPACE||r===e.ExcelEditCellKeyboardResponse.DELETE)return;this.table.editorManager.completeEdit(),this.table.getElement().focus(),t.shiftKey||t.ctrlKey||t.metaKey||(r===e.ExcelEditCellKeyboardResponse.ENTER?this.table.selectCell(n,i+1):r===e.ExcelEditCellKeyboardResponse.TAB?this.table.selectCell(n+1,i):r===e.ExcelEditCellKeyboardResponse.ARROW_LEFT?this.table.selectCell(n-1,i):r===e.ExcelEditCellKeyboardResponse.ARROW_RIGHT?this.table.selectCell(n+1,i):r===e.ExcelEditCellKeyboardResponse.ARROW_DOWN?this.table.selectCell(n,i+1):r===e.ExcelEditCellKeyboardResponse.ARROW_UP&&this.table.selectCell(n,i-1),t.stopPropagation(),t.preventDefault())}else{const{col:n,row:i}=this.table.stateManager.select.cellPos;if(!this.table.editorManager.editingEditor||r!==e.ExcelEditCellKeyboardResponse.ENTER&&r!==e.ExcelEditCellKeyboardResponse.TAB){if(!this.table.editorManager.editingEditor&&(r===e.ExcelEditCellKeyboardResponse.DELETE||r===e.ExcelEditCellKeyboardResponse.BACKSPACE)){const e=this.table.getSelectedCellInfos();e?.length>0&&(document.activeElement===this.table.getElement()||Object.values(this.table.editorManager.cacheLastSelectedCellEditor||{}).some((e=>e.getInputElement?.()===document.activeElement)))&&(!function(e,t,r=!1){for(let n=0;n<e.length;n++)for(let i=0;i<e[n].length;i++)t.changeCellValue(e[n][i].col,e[n][i].row,"",r)}(e,this.table,this.pluginOptions?.deleteWorkOnEditableCell??!0),t.stopPropagation(),t.preventDefault())}}else this.table.editorManager.completeEdit(),this.table.getElement().focus(),r===e.ExcelEditCellKeyboardResponse.ENTER?this.table.selectCell(n,i+1):r===e.ExcelEditCellKeyboardResponse.TAB&&this.table.selectCell(n+1,i),t.stopPropagation(),t.preventDefault()}}}isExcelShortcutKey(e){return this.responseKeyboard.includes(e.key.toLowerCase())}setResponseKeyboard(e){this.responseKeyboard=e}deleteResponseKeyboard(e){this.responseKeyboard=this.responseKeyboard.filter((t=>!e.includes(t)))}addResponseKeyboard(e){this.responseKeyboard=[...this.responseKeyboard,...e]}release(){document.removeEventListener("keydown",this.handleKeyDown,!0)}},e.ExcelImportPlugin=Bi,e.ExportGanttPlugin=class{id="gantt-export-helper";name="Gantt Export Helper";_gantt=null;run(...e){const t=e[0];t&&(this._gantt=t)}async exportToImage(e={}){if(!this._gantt)return;const{fileName:r="gantt-export",type:n="png",quality:i=1,backgroundColor:s="#ffffff",scale:o=window.devicePixelRatio||1,download:a=!0}=e;try{const{tempContainer:e,clonedGantt:l}=await this.createFullSizeContainer(o);try{await new Promise((e=>t.vglobal.getRequestAnimationFrame()(e)));const e=(l.taskListTableInstance.getAllColsWidth()+l.getAllDateColsWidth())*o,c=l.getAllRowsHeight()*o,h=document.createElement("canvas");h.width=e,h.height=c;const u=h.getContext("2d");u.fillStyle=s,u.fillRect(0,0,e,c),l.taskListTableInstance?.canvas&&u.drawImage(l.taskListTableInstance.canvas,0,0,l.taskListTableInstance.getAllColsWidth()*o,c);const f=3*o,d=l.taskListTableInstance.getAllColsWidth()*o;u.fillStyle="rgb(225, 228, 232)",u.fillRect(d-f/2,0,f,c);const p=4*o,m=l.canvas.width-p;return l.canvas&&u.drawImage(l.canvas,p,0,m,l.canvas.height,(l.taskListTableInstance.getAllColsWidth()+1.5)*o,0,(l.getAllDateColsWidth()-1.5)*o,c),this.finalizeExport(h,r,n,i,a)}finally{e.remove(),l.release()}}catch(e){throw new Error(`甘特图导出失败: ${e instanceof Error?e.message:"未知错误"}`)}}async exportToBase64(e={}){return this.exportToImage({...e,download:!1})}async createFullSizeContainer(e){if(!this._gantt)throw new Error("ExportGanttPlugin: Gantt instance not available to create container.");const t=document.createElement("div");t.style.position="fixed",t.style.left="-9999px",t.style.overflow="hidden",t.style.width=`${window.innerWidth+100}px`,t.style.height=`${window.innerHeight+100}px`,document.body.appendChild(t);const r=document.createElement("div"),n=this._gantt.taskListTableInstance.getAllColsWidth()+this._gantt.getAllDateColsWidth(),i=this._gantt.getAllRowsHeight();r.style.width=`${n}px`,r.style.height=`${i}px`,t.appendChild(r);try{let n;try{if(n=(await import("@visactor/vtable-gantt")).Gantt,!n)throw new Error("Gantt class not found in @visactor/vtable-gantt")}catch(e){throw new Error("导出甘特图需要安装并正确加载 @visactor/vtable-gantt 依赖\n请执行: npm install @visactor/vtable-gantt")}const i=new n(r,{...this._gantt.options,records:this._gantt.records,taskListTable:{...this._gantt.options.taskListTable,tableWidth:void 0,minTableWidth:void 0,maxTableWidth:void 0},plugins:[]});return i.setPixelRatio(e),i.scenegraph?.ganttGroup&&i.scenegraph.ganttGroup.setAttribute("clip",!1),i.taskListTableInstance?.scenegraph?.tableGroup&&i.taskListTableInstance.scenegraph.tableGroup.setAttribute("clip",!1),i.scenegraph.stage.render(),{tempContainer:t,clonedGantt:i}}catch(e){throw t&&t.parentNode&&t.remove(),new Error("导出甘特图需要安装 @visactor/vtable-gantt 依赖")}}finalizeExport(e,t,r,n,i=!0){const s=e.toDataURL(`image/${r}`,n);if(i){const e=document.createElement("a");e.download=`${t}.${r}`,e.href=s,document.body.appendChild(e),e.click(),document.body.removeChild(e)}return s}release(){this._gantt=null}},e.FilterEngine=zi,e.FilterPlugin=class{id="filter";name="Filter";runTime=[r.TABLE_EVENT_TYPE.BEFORE_INIT,r.TABLE_EVENT_TYPE.BEFORE_UPDATE_OPTION,r.TABLE_EVENT_TYPE.ICON_CLICK,r.TABLE_EVENT_TYPE.SCROLL,r.TABLE_EVENT_TYPE.CHANGE_CELL_VALUE,r.TABLE_EVENT_TYPE.UPDATE_RECORD,r.TABLE_EVENT_TYPE.ADD_RECORD,r.TABLE_EVENT_TYPE.DELETE_RECORD];pluginOptions;table;columns;filterEngine;filterStateManager;filterToolbar;constructor(e){this.id=e?.id??this.id,this.pluginOptions=Ji.cloneDeep(e),this.pluginOptions.filterIcon=e.filterIcon??{name:"filter-icon",type:"svg",width:12,height:12,positionType:r.TYPES.IconPosition.right,cursor:"pointer",svg:'<svg t="1752821809070" class="icon" viewBox="0 0 1664 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12092" width="200" height="200"><path d="M89.6 179.2A89.6 89.6 0 0 1 89.6 0h1408a89.6 89.6 0 0 1 0 179.2H89.6z m256 384a89.6 89.6 0 0 1 0-179.2h896a89.6 89.6 0 0 1 0 179.2h-896z m256 384a89.6 89.6 0 0 1 0-179.2h384a89.6 89.6 0 0 1 0 179.2h-384z" fill="#93a2b9" p-id="12093"></path></svg>'},this.pluginOptions.filteringIcon=e.filteringIcon??{name:"filtering-icon",type:"svg",width:12,height:12,positionType:r.TYPES.IconPosition.right,cursor:"pointer",svg:'<svg t="1752821771292" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11926" width="200" height="200"><path d="M971.614323 53.05548L655.77935 412.054233C635.196622 435.434613 623.906096 465.509377 623.906096 496.583302v495.384307c0 28.975686-35.570152 43.063864-55.353551 21.781723l-159.865852-171.256294c-5.495389-5.895053-8.59279-13.688514-8.592789-21.781722V496.583302c0-31.073925-11.290526-61.148688-31.873254-84.429153L52.385677 53.05548C34.200936 32.472751 48.888611 0 76.365554 0h871.268892c27.476943 0 42.164618 32.472751 23.979877 53.05548z" fill="#416eff" p-id="11927"></path></svg>'},this.pluginOptions.filterModes&&this.pluginOptions.filterModes.length||(this.pluginOptions.filterModes=["byValue","byCondition"]),this.pluginOptions.styles=Ji.merge(Vi,this.pluginOptions.styles??{}),this.pluginOptions.conditionCategories=e.conditionCategories??Ki}initFilterPlugin(t){this.filterEngine=new zi(this.pluginOptions),this.filterStateManager=new Ui(this.table,this.filterEngine),this.filterToolbar=new Gi(this.table,this.filterStateManager,this.pluginOptions),this.columns=t.options.columns,this.filterToolbar.render(document.body),this.updateFilterIcons(this.columns),this.filterStateManager.subscribe(((t,r)=>{r?.type!==e.FilterActionType.ADD_FILTER&&(this.updateFilterIcons(this.columns),this.table.updateColumns(this.columns,{clearRowHeightCache:!1}))}))}run(...e){const t=e[0],n=e[1],i=e[2];if(this.table=i,n===r.TABLE_EVENT_TYPE.BEFORE_INIT)this.initFilterPlugin(t);else if(n===r.TABLE_EVENT_TYPE.BEFORE_UPDATE_OPTION)this.filterEngine&&this.filterStateManager&&this.filterToolbar||this.initFilterPlugin(t),this.pluginOptions={...this.pluginOptions,...t.options.plugins?.find((e=>e.id===this.id))?.pluginOptions},this.columns=t.options.columns,this.handleOptionUpdate(t.options);else if(n===r.TABLE_EVENT_TYPE.ICON_CLICK&&"filter-icon"===t.name||"filtering-icon"===t.name){if(3===t.event?.which||2===t.event?.button||2==(2&t.event?.buttons))return;const e=t.col,n=t.row;this.filterToolbar.isVisible?this.filterToolbar.hide(t.col,t.row):(this.filterToolbar.show(e,n,this.pluginOptions.filterModes),this.table.fireListeners(r.TABLE_EVENT_TYPE.FILTER_MENU_SHOW,{col:t.col,row:t.row}))}else if(n===r.TABLE_EVENT_TYPE.SCROLL)"horizontal"===t.scrollDirection&&this.filterToolbar.adjustMenuPosition();else if(n===r.TABLE_EVENT_TYPE.CHANGE_CELL_VALUE){const e=this.table.getHeaderField(t.col,t.row);this.syncFilterWithTableData(e)}else(n===r.TABLE_EVENT_TYPE.UPDATE_RECORD||n===r.TABLE_EVENT_TYPE.ADD_RECORD||n===r.TABLE_EVENT_TYPE.DELETE_RECORD)&&this.syncFilterWithTableData()}updatePluginOptions(e){this.pluginOptions=Ji.merge(this.pluginOptions,e),this.filterToolbar.updateStyles(this.pluginOptions.styles)}update(){this.filterStateManager&&this.reapplyActiveFilters()}syncFilterWithTableData(e){const t=this.filterStateManager.getFilterState(e)?.type;if("byValue"===t){if(null!=e)return void this.filterToolbar.valueFilter.syncSingleStateFromTableData(e);this.table.dataSource.columns.forEach((({field:e})=>{this.filterToolbar.valueFilter.syncSingleStateFromTableData(e)}))}}handleOptionUpdate(e){const t=this.filterStateManager?this.filterStateManager.getActiveFilterFields():[];this.filterStateManager&&t.length>0&&this.validateFilterStatesAfterUpdate(e,t),this.updateFilterIcons(e.columns)}reapplyActiveFilters(){this.filterStateManager.reapplyCurrentFilters()}validateFilterStatesAfterUpdate(t,r){const n=t.columns,i=[];r.forEach((e=>{const t=n.find((t=>t.field===e));t&&this.shouldEnableFilterForColumn(e,t)||i.push(e)})),i.forEach((t=>{this.filterStateManager.dispatch({type:e.FilterActionType.REMOVE_FILTER,payload:{field:t}})}))}updateFilterIcons(e=[]){const t=this.pluginOptions.filterIcon,r=this.pluginOptions.filteringIcon,n=(e,t)=>e===t||e&&t&&"object"==typeof e&&"object"==typeof t&&e.name===t.name,i=[...e],s=[];for(;i.length>0;){const e=i.pop();e.columns?e.columns.forEach((e=>i.push(e))):s.push(e)}s.forEach((e=>{const i=this.shouldEnableFilterForColumn(e.field,e),s=!!this.filterStateManager.getFilterState(e.field)?.enable;let o=(e=>e?Array.isArray(e)?e:[e]:[])(e.headerIcon);var a;i?s?o.some((e=>n(e,r)))||(o=o.filter((e=>!n(e,t))),o.push(r)):o.some((e=>n(e,t)))||(o=o.filter((e=>!n(e,r))),o.push(t)):o=o.filter((e=>!n(e,t))),e.headerIcon=0===(a=o).length?void 0:1===a.length?a[0]:a}))}shouldEnableFilterForColumn(e,t){if(!t.title)return!1;const r=t;return void 0!==r.filter?!!r.filter:this.pluginOptions.enableFilter?this.pluginOptions.enableFilter(e,t):void 0===this.pluginOptions.defaultEnabled||this.pluginOptions.defaultEnabled}getFilterState(){if(!this.filterStateManager)return null;const e=this.filterStateManager.getAllFilterStates(),t={};return e.filters.forEach(((e,r)=>{t[r]={enable:e.enable,field:e.field,type:e.type,values:e.values,operator:e.operator,condition:e.condition}})),{filters:t}}setFilterState(t){this.filterStateManager&&(this.filterStateManager.dispatch({type:e.FilterActionType.CLEAR_ALL_FILTERS,payload:{}}),t&&t.filters&&Object.entries(t.filters).forEach((([,t])=>{t.enable&&this.filterStateManager.dispatch({type:e.FilterActionType.ADD_FILTER,payload:{field:t.field,type:t.type,values:t.values,operator:t.operator,condition:t.condition,enable:!0}})})))}release(){this.columns.forEach((e=>{e.headerIcon=void 0})),this.table=null,this.filterEngine=null,this.filterStateManager=null,this.filterToolbar.destroy(),this.filterToolbar=null}},e.FilterStateManager=Ui,e.FilterToolbar=Gi,e.FocusHighlightPlugin=class{id="focus-highlight";name="Focus Highlight";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED,r.TABLE_EVENT_TYPE.SELECTED_CELL,r.TABLE_EVENT_TYPE.SELECTED_CLEAR];table;range;pluginOptions;constructor(e={fill:"#000",opacity:.5,highlightRange:void 0}){this.id=e.id??this.id,this.pluginOptions=Object.assign({fill:"#000",opacity:.5},e)}run(...e){if(this.table||(this.table=e[2]),e[1]===r.TABLE_EVENT_TYPE.INITIALIZED)this.pluginOptions.highlightRange&&this.setFocusHighlightRange(this.pluginOptions.highlightRange);else if(e[1]===r.TABLE_EVENT_TYPE.SELECTED_CELL){const e=this.table.stateManager.select.cellPos;if(this.table.isHeader(e.col,e.row))this.setFocusHighlightRange(void 0);else{const e=this.table.stateManager.select.ranges,t=0,r=this.table.colCount-1,n=Math.min(e[0].start.row,e[0].end.row),i=Math.max(e[0].start.row,e[0].end.row);this.setFocusHighlightRange({start:{col:t,row:n},end:{col:r,row:i}})}}else e[1]===r.TABLE_EVENT_TYPE.SELECTED_CLEAR&&this.setFocusHighlightRange(void 0)}setFocusHighlightRange(e,t=!1){let r;e&&"start"in e&&"end"in e?r=e:e&&(r={start:e,end:e}),o(this.range,r)&&!t||(this.range=r,e?this.updateCellGroupShadow():this.deleteAllCellGroupShadow(),this.table.scenegraph.updateNextFrame())}deleteAllCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup)}updateCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup,this.range)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.range,this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup,this.range)}updateCellGroupShadowInContainer(e,r){let n;r&&"start"in r&&"end"in r?n=r:r&&(n={start:r,end:r}),e.forEachChildrenSkipChild((e=>{const r=e;"column"===r.role&&r.forEachChildrenSkipChild((e=>{const r=e;if("cell"!==r.role)return;r.attachShadow(r.shadowRoot);const i=r.shadowRoot;if(n){if(x(n,r.col,r.row))i.removeAllChild();else if(!i.firstChild){const e=t.createRect({x:0,y:0,width:r.attribute.width,height:r.attribute.height,fill:this.pluginOptions.fill,opacity:this.pluginOptions.opacity});e.name="shadow-rect",i.appendChild(e)}}else i.removeAllChild()}))}))}update(){this.table&&this.setFocusHighlightRange(this.range,!0)}},e.HeaderHighlightPlugin=class{table;options;colHeaderRange;rowHeaderRange;constructor(e,t){this.table=e,this.options=t,this.registerStyle(),this.bindEvent()}registerStyle(){this.table.registerCustomCellStyle("col-highlight",{bgColor:this.options?.colHighlightBGColor??"#82b2f5",color:this.options?.colHighlightColor??"#FFF"}),this.table.registerCustomCellStyle("row-highlight",{bgColor:this.options?.rowHighlightBGColor??"#82b2f5",color:this.options?.rowHighlightColor??"#FFF"})}bindEvent(){this.table.on("selected_cell",(()=>{this.updateHighlight()})),this.table.on("selected_clear",(()=>{this.clearHighlight()})),this.table.on("mousemove_table",(()=>{this.table.stateManager.select.selecting&&this.updateHighlight()}))}clearHighlight(){this.colHeaderRange&&this.table.arrangeCustomCellStyle({range:this.colHeaderRange},void 0),this.rowHeaderRange&&this.table.arrangeCustomCellStyle({range:this.rowHeaderRange},void 0),this.colHeaderRange=void 0,this.rowHeaderRange=void 0}updateHighlight(){if(!1===this.options?.colHighlight&&!1===this.options?.rowHighlight)return;const e=this.table.getSelectedCellRanges();if(0===e.length)return void this.clearHighlight();const t=e[0],r=[t.start.row,t.end.row];r.sort(((e,t)=>e-t));const n=[t.start.col,t.end.col];let i,s;n.sort(((e,t)=>e-t)),this.table.isPivotTable()?(i={start:{col:n[0],row:0},end:{col:n[1],row:this.table.columnHeaderLevelCount-1}},s={start:{col:0,row:r[0]},end:{col:this.table.rowHeaderLevelCount-1,row:r[1]}}):this.table.internalProps.transpose?s={start:{col:0,row:r[0]},end:{col:this.table.rowHeaderLevelCount-1,row:r[1]}}:(i={start:{col:n[0],row:0},end:{col:n[1],row:this.table.columnHeaderLevelCount-1}},this.table.internalProps.rowSeriesNumber&&(s={start:{col:0,row:r[0]},end:{col:0,row:r[1]}})),!1===this.options?.colHighlight||C(this.colHeaderRange,i)||(this.colHeaderRange&&this.table.arrangeCustomCellStyle({range:this.colHeaderRange},void 0),i&&this.table.arrangeCustomCellStyle({range:i},"col-highlight"),this.colHeaderRange=i),!1===this.options?.rowHighlight||C(this.rowHeaderRange,s)||(this.rowHeaderRange&&this.table.arrangeCustomCellStyle({range:this.rowHeaderRange},void 0),s&&this.table.arrangeCustomCellStyle({range:s},"row-highlight"),this.rowHeaderRange=s)}},e.HighlightHeaderWhenSelectCellPlugin=class{id="highlight-header-when-select-cell";name="Highlight Header When Select Cell";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED,r.TABLE_EVENT_TYPE.SELECTED_CLEAR,r.TABLE_EVENT_TYPE.SELECTED_CELL,r.TABLE_EVENT_TYPE.MOUSEMOVE_TABLE];table;pluginOptions;colHeaderRanges=[];rowHeaderRanges=[];constructor(e){this.id=e?.id??this.id,this.pluginOptions=e}run(...e){const t=e[1],n=e[2];this.table=n,t===r.TABLE_EVENT_TYPE.SELECTED_CLEAR?this.clearHighlight():t===r.TABLE_EVENT_TYPE.SELECTED_CELL||t===r.TABLE_EVENT_TYPE.MOUSEMOVE_TABLE?this.updateHighlight():t===r.TABLE_EVENT_TYPE.INITIALIZED&&this.registerStyle()}registerStyle(){this.table.registerCustomCellStyle("col-highlight",{bgColor:this.pluginOptions?.colHighlightBGColor??"#82b2f5",color:this.pluginOptions?.colHighlightColor??"#FFF"}),this.table.registerCustomCellStyle("row-highlight",{bgColor:this.pluginOptions?.rowHighlightBGColor??"#82b2f5",color:this.pluginOptions?.rowHighlightColor??"yellow"})}clearHighlight(){this.colHeaderRanges&&this.colHeaderRanges.forEach((e=>{this.table.arrangeCustomCellStyle({range:e},void 0)})),this.rowHeaderRanges&&this.rowHeaderRanges.forEach((e=>{this.table.arrangeCustomCellStyle({range:e},void 0)})),this.colHeaderRanges=[],this.rowHeaderRanges=[]}updateHighlight(){if(!1===this.pluginOptions?.colHighlight&&!1===this.pluginOptions?.rowHighlight)return;const e=this.table.getSelectedCellRanges();e.length<2&&this.clearHighlight();for(let t=0;t<e.length;t++){const r=e[t],n=[r.start.row,r.end.row];n.sort(((e,t)=>e-t));const i=[r.start.col,r.end.col];let s,o;i.sort(((e,t)=>e-t)),this.table.isPivotTable()?(s={start:{col:i[0],row:0},end:{col:i[1],row:this.table.columnHeaderLevelCount-1}},o={start:{col:0,row:n[0]},end:{col:this.table.rowHeaderLevelCount-1,row:n[1]}}):this.table.internalProps.transpose?o={start:{col:0,row:n[0]},end:{col:this.table.rowHeaderLevelCount-1,row:n[1]}}:(s={start:{col:i[0],row:0},end:{col:i[1],row:this.table.columnHeaderLevelCount-1}},this.table.internalProps.rowSeriesNumber&&(o={start:{col:0,row:n[0]},end:{col:0,row:n[1]}})),!1===this.pluginOptions?.colHighlight||this.colHeaderRanges.find((e=>E(e,s)))||(s&&this.table.arrangeCustomCellStyle({range:s},"col-highlight"),this.colHeaderRanges.push(s)),!1===this.pluginOptions?.rowHighlight||this.rowHeaderRanges.find((e=>E(e,o)))||(o&&this.table.arrangeCustomCellStyle({range:o},"row-highlight"),this.rowHeaderRanges.push(o))}}update(){this.registerStyle(),this.updateHighlight()}release(){this.rowHeaderRanges=[],this.colHeaderRanges=[]}},e.InvertHighlightPlugin=class{table;range;_fill;_opacity;constructor(e,t){this.table=e,this._fill=t?.fill??"#000",this._opacity=t?.opacity??.5}setInvertHighlightRange(e){o(this.range,e)||(this.range=e,e?this.updateCellGroupShadow():this.deleteAllCellGroupShadow(),this.table.scenegraph.updateNextFrame())}deleteAllCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup)}updateCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup,this.range)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.range,this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup,this.range)}updateCellGroupShadowInContainer(e,r){e.forEachChildrenSkipChild((e=>{const n=e;"column"===n.role&&n.forEachChildrenSkipChild((e=>{const n=e;if("cell"!==n.role)return;n.attachShadow(n.shadowRoot);const i=n.shadowRoot;if(r){if(x(r,n.col,n.row))i.removeAllChild();else if(!i.firstChild){const e=t.createRect({x:0,y:0,width:n.attribute.width,height:n.attribute.height,fill:this._fill,opacity:this._opacity});e.name="shadow-rect",i.appendChild(e)}}else i.removeAllChild()}))}))}},e.MENU_CONTAINER_CLASS=T,e.MENU_ITEM_CLASS=R,e.MENU_ITEM_DISABLED_CLASS=k,e.MENU_ITEM_SEPARATOR_CLASS=A,e.MENU_ITEM_SUBMENU_CLASS=M,e.MENU_STYLES=O,e.MasterDetailPlugin=class{id="Master Detail Plugin";name="Master Detail Plugin";runTime=[i.TABLE_EVENT_TYPE.BEFORE_INIT,i.TABLE_EVENT_TYPE.INITIALIZED,i.TABLE_EVENT_TYPE.SORT_CLICK,i.TABLE_EVENT_TYPE.AFTER_SORT,i.TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH,i.TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT];pluginOptions;table;configManager;eventManager;subTableManager;tableAPIExtensions;resizeObserver;checkboxCascadeCleanup;constructor(e={}){this.pluginOptions=e}run(...e){const t=e[0],r=e[1],n=e[2];if(r===i.TABLE_EVENT_TYPE.BEFORE_INIT)this.table=n,this.initializeManagers(),this.configManager.injectMasterDetailOptions(t.options);else if(r===i.TABLE_EVENT_TYPE.INITIALIZED)this.setupMasterDetailFeatures();else{if(r===i.TABLE_EVENT_TYPE.SORT_CLICK)return this.eventManager.executeMasterDetailBeforeSort(),!0;r===i.TABLE_EVENT_TYPE.AFTER_SORT?this.eventManager.executeMasterDetailAfterSort():r===i.TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH?this.eventManager.handleAfterUpdateCellContentWidth(t):r===i.TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT&&this.eventManager.handleAfterUpdateSelectBorderHeight(t)}}initializeManagers(){this.configManager=new _i(this.pluginOptions,this.table),this.eventManager=new xi(this.table);const e=this.pluginOptions.enableCheckboxCascade??!0;this.subTableManager=new Ci(this.table,e),this.configManager.setRowExpandedChecker((e=>this.eventManager.isRowExpanded(e))),this.configManager.setExpandRowCallback((e=>this.expandRow(e))),this.eventManager.setCallbacks({onUpdateSubTablePositions:()=>this.subTableManager.recalculateAllSubTablePositions(),onUpdateSubTablePositionsForRow:()=>this.subTableManager.updateSubTablePositionsForRowResize(),onExpandRow:(e,t)=>this.expandRow(e,t),onCollapseRow:(e,t)=>this.collapseRow(e,t),onCollapseRowToNoRealRecordIndex:e=>this.collapseRowToNoRealRecordIndex(e),onToggleRowExpand:(e,t)=>this.toggleRowExpand(e,t),getOriginalRowHeight:e=>gi(this.table,e)}),this.subTableManager.setCallbacks({getDetailConfigForRecord:(e,t)=>this.configManager.getDetailConfigForRecord(e,t)}),this.subTableManager.setAutoHeightCallback(((e,t)=>{this.handleAutoHeightUpdate(e,t)}))}setupMasterDetailFeatures(){this.initInternalProps(),this.eventManager.bindEventHandlers(),this.setupUnifiedSelectionManagement(),this.extendTableAPI(),this.initCheckboxCascade()}mainTableClickHandler;setupUnifiedSelectionManagement(){this.mainTableClickHandler=()=>{this.clearAllSubTableVisibleSelections()},this.table.on("click_cell",this.mainTableClickHandler)}initCheckboxCascade(){(this.pluginOptions.enableCheckboxCascade??!0)&&(this.checkboxCascadeCleanup=Si(this.table,this.eventManager))}initInternalProps(){const e=mi(this.table);e.expandedRecordIndices=[],e.subTableInstances=new Map,e.originalRowHeights=new Map,e.subTableCheckboxStates=new Map}extendTableAPI(){this.tableAPIExtensions=new Ei(this.table,this.configManager,this.eventManager,{addUnderlineToCell:e=>this.addUnderlineToCell(e),updateOriginalHeightsAfterAdaptive:e=>this.updateOriginalHeightsAfterAdaptive(e),collapseRowToNoRealRecordIndex:e=>this.collapseRowToNoRealRecordIndex(e),expandRow:e=>this.expandRow(e),restoreExpandedStatesAfter:()=>this.restoreExpandedStatesAfter(),collapseRow:e=>this.collapseRow(e),updateSubTablePositions:()=>this.subTableManager.recalculateAllSubTablePositions(),updateRowHeightForExpand:(e,t)=>this.updateRowHeightForExpand(e,t)}),this.tableAPIExtensions.extendTableAPI()}updateOriginalHeightsAfterAdaptive(e){const t=mi(this.table);for(const[r,n]of e){const e=r-this.table.columnHeaderLevelCount;t.originalRowHeights&&t.originalRowHeights.set(e,n.baseHeight)}}restoreExpandedStatesAfter(){const e=mi(this.table);if(!e.expandedRecordIndices||0===e.expandedRecordIndices.length)return;this.table.dataSource._currentPagerIndexedData&&e.expandedRecordIndices.forEach((e=>{try{const t=this.table.getBodyRowIndexByRecordIndex(e);if(t>=0){const e=t+this.table.columnHeaderLevelCount;this.expandRow(e)}}catch(e){}}))}expandRow(e,t){const r=e-this.table.columnHeaderLevelCount,n=mi(this.table);if(this.eventManager.isRowExpanded(e))return;const i=this.table.getRecordIndexByCell(0,e);if(null==i)return;var s,o;n.expandedRecordIndices&&(s=n.expandedRecordIndices,o=i,s.some((e=>di(e,o)))||n.expandedRecordIndices.push(i)),this.eventManager.addExpandedRow(e);const a=this.table.getRowHeight(e);n.originalRowHeights&&(this.table.scenegraph.getCell(t,e),n.originalRowHeights.set(r,a));const l=bi(this.table,r),c=this.configManager.getDetailConfigForRecord(l,r),h=c?.style?.height||300,u=Array.isArray(l.children)?l.children:[],f="auto"===h?300:"number"==typeof h?h:300;this.updateRowHeightForExpand(e,f),this.table.scenegraph.updateContainerHeight(e,f),n._heightResizedRowMap.add(e),this.subTableManager.renderSubTable(r,u,((e,t)=>this.configManager.getDetailConfigForRecord(e,t))),e!==this.table.rowCount-1&&this.drawUnderlineForRow(e),this.refreshRowIcon(e,t),"adaptive"===this.table.heightMode&&this.table.scenegraph.dealHeightMode(),this.updateFrozenColumnShadowHeight()}handleAutoHeightUpdate(e,t){try{const r=e+this.table.columnHeaderLevelCount,n=this.table.getRowHeight(r),i=mi(this.table),s=i.originalRowHeights?.get(e)||0,o=t-(n-s);this.updateRowHeightForExpand(r,o),this.table.scenegraph.updateContainerHeight(r,o)}catch(e){}}collapseRow(e,t){const r=e-this.table.columnHeaderLevelCount,n=mi(this.table);if(!this.eventManager.isRowExpanded(e))return;const i=this.table.getRecordIndexByCell(0,e);if(null==i)return;if(this.subTableManager.removeSubTable(r),n.expandedRecordIndices){const e=(s=n.expandedRecordIndices,o=i,s.findIndex((e=>di(e,o))));e>-1&&n.expandedRecordIndices.splice(e,1)}var s,o;this.eventManager.removeExpandedRow(e);const a=this.table.getRowHeight(e)-gi(this.table,r);this.updateRowHeightForExpand(e,-a),n._heightResizedRowMap.delete(e),this.table.scenegraph.updateContainerHeight(e,-a),n.originalRowHeights&&n.originalRowHeights.delete(r),e!==this.table.rowCount-1&&this.removeUnderlineFromRow(e),this.refreshRowIcon(e,t),"adaptive"===this.table.heightMode&&this.table.scenegraph.dealHeightMode(),this.updateFrozenColumnShadowHeight()}collapseRowToNoRealRecordIndex(e){const t=e-this.table.columnHeaderLevelCount,r=mi(this.table);if(!this.eventManager.isRowExpanded(e))return;this.subTableManager.removeSubTable(t),this.eventManager.removeExpandedRow(e);const n=this.table.getRowHeight(e)-gi(this.table,t);this.updateRowHeightForExpand(e,-n),r._heightResizedRowMap.delete(e),this.table.scenegraph.updateContainerHeight(e,-n),r.originalRowHeights&&r.originalRowHeights.delete(t),e!==this.table.rowCount-1&&this.removeUnderlineFromRow(e),this.refreshRowIcon(e),"adaptive"===this.table.heightMode&&this.table.scenegraph.dealHeightMode(),this.updateFrozenColumnShadowHeight()}toggleRowExpand(e,t){this.eventManager.isRowExpanded(e)?this.collapseRow(e,t):this.expandRow(e,t)}updateRowHeightForExpand(e,t){this.table._setRowHeight(e,this.table.getRowHeight(e)+t,!0);const r=e+1;let n=0;n=e<this.table.frozenRowCount?this.table.frozenRowCount-1:e>=this.table.rowCount-this.table.bottomFrozenRowCount?this.table.rowCount-1:Math.min(this.table.scenegraph.proxy.rowEnd,this.table.rowCount-this.table.bottomFrozenRowCount-1);for(let e=0;e<this.table.colCount;e++)for(let i=r;i<=n;i++){const r=this.table.scenegraph.highPerformanceGetCell(e,i);"cell"===r.role&&r.setAttribute("y",r.attribute.y+t)}}drawUnderlineForRow(e){if(!this.table.scenegraph)return;const t=this.getRowCells(e);0!==t.length&&(t.forEach(((e,t)=>{e&&e.attribute&&this.addUnderlineToCell(e)})),this.table.scenegraph.updateNextFrame())}getRowCells(e){const t=[];for(let r=0;r<this.table.colCount;r++){const n=this.table.scenegraph.getCell(r,e);n&&"cell"===n.role&&t.push(n)}return t}addUnderlineToCell(e){const t=e.attribute,r=t.strokeArrayWidth||(t.lineWidth?[t.lineWidth,t.lineWidth,t.lineWidth,t.lineWidth]:[1,1,1,1]),n=t.strokeArrayColor||(t.stroke?[t.stroke,t.stroke,t.stroke,t.stroke]:["transparent","transparent","transparent","transparent"]);e._hasUnderline||(e._originalStrokeArrayWidth=[...r],e._originalStrokeArrayColor=[...n],e._hasUnderline=!0);const i=e._originalStrokeArrayWidth||r,s=e._originalStrokeArrayColor||n,o=[...i],a=[...s],l=2*(.75*(i[2]||1)+.75*(i[0]||1));if(o[2]=l,"transparent"!==s[2]&&s[2])a[2]=s[2];else{const e=this.table.theme;a[2]=e?.bodyStyle?.borderColor||"#e1e4e8"}e.setAttributes({strokeArrayWidth:o,strokeArrayColor:a,stroke:!0})}removeUnderlineFromRow(e){this.getRowCells(e).forEach(((e,t)=>{e&&e._hasUnderline&&this.removeUnderlineFromCell(e)})),this.table.scenegraph.updateNextFrame()}removeUnderlineFromCell(e){e._hasUnderline&&(e._originalStrokeArrayWidth&&e._originalStrokeArrayColor&&(e.setAttributes({strokeArrayWidth:e._originalStrokeArrayWidth,strokeArrayColor:e._originalStrokeArrayColor}),delete e._originalStrokeArrayWidth,delete e._originalStrokeArrayColor),e._hasUnderline=!1)}refreshRowIcon(e,t){let r;if("number"==typeof t)r=t;else{r=!!this.table.options.rowSeriesNumber?1:0}const n=this.table.getCellOriginRecord(r,e);if(n&&"object"==typeof n){const t=n,s=i.TYPES.HierarchyState,o=this.eventManager.isRowExpanded(e);t.hierarchyState=o?s.expand:s.collapse,this.table.scenegraph.updateHierarchyIcon(r,e)}}setRecordChildren(e,t,r){const n=this.table.getRecordIndexByCell(t,r);if(null==n)return;const i="number"==typeof n?n:n[0],s=this.table.dataSource.get(i);s&&(s.children=e,this.expandRow(r,t),this.table.scenegraph.updateCellContent(t,r))}release(){const e=mi(this.table);e&&(e._isReleasing=!0);try{if(this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0),this.checkboxCascadeCleanup){try{this.checkboxCascadeCleanup()}catch(e){}this.checkboxCascadeCleanup=void 0}if(this.eventManager)try{this.eventManager.cleanup()}catch(e){}if(this.subTableManager)try{this.subTableManager.cleanup()}catch(e){}if(this.configManager)try{this.configManager.release()}catch(e){}if(this.cleanupMasterDetailFeatures(),this.table&&e)try{e.expandedRecordIndices?.splice(0),e.subTableInstances?.clear(),e.originalRowHeights?.clear(),e.subTableCheckboxStates?.clear(),e._heightResizedRowMap?.clear()}catch(e){}}catch(e){}finally{try{this.configManager=null,this.eventManager=null,this.subTableManager=null,this.tableAPIExtensions=null,this.table=null,this.pluginOptions=null}catch(e){}}}clearAllSubTableVisibleSelections(){const e=mi(this.table);e.subTableInstances?.forEach((e=>{e&&"function"==typeof e.clearSelected&&e.clearSelected()}))}getAllSubTableInstances(){return this.subTableManager.getAllSubTableInstances()}getSubTableByRowIndex(e){const t=e-this.table.columnHeaderLevelCount;return this.subTableManager.getSubTableInstance(t)}getSubTableByBodyRowIndex(e){return this.subTableManager.getSubTableInstance(e)}filterSubTables(e){const t=[],r=this.subTableManager.getAllSubTableInstances();if(!r)return t;for(const[n,i]of r)try{e(n,i,bi(this.table,n))&&t.push({bodyRowIndex:n,subTable:i})}catch(e){}return t}updateFrozenColumnShadowHeight(){try{const e=this.table.frozenColCount;e>0&&this.table.scenegraph.component.setFrozenColumnShadow(e-1)}catch(e){}}cleanupMasterDetailFeatures(){this.mainTableClickHandler&&(this.table.off("click_cell",this.mainTableClickHandler),this.mainTableClickHandler=void 0),this.tableAPIExtensions&&(this.tableAPIExtensions.cleanup(),this.tableAPIExtensions=void 0)}},e.MenuManager=P,e.PasteAddRowColumnPlugin=class{id="paste-add-row-column";name="Paste Add row";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED,r.TABLE_EVENT_TYPE.PASTED_DATA];table;pluginOptions;pastedData;constructor(e){this.pluginOptions=e,this.id=e?.id??this.id}run(...e){const t=e[1],n=e[2];this.table=n,t===r.TABLE_EVENT_TYPE.PASTED_DATA&&(this.pastedData=e[0],this.handlePaste())}handlePaste(){const{pasteData:e,row:t,col:r}=this.pastedData,n=this.table.rowCount,i=this.table.colCount,s=t+e.length-n,o=r+(e[0]?.length||0)-i;if(s>0)for(let e=0;e<s;e++)this.pluginOptions?.addRowCallback?this.pluginOptions.addRowCallback(n+e,this.table):this.table.addRecord([]);if(o>0)for(let e=0;e<o;e++){const t=i+e;this.pluginOptions?.addColumnCallback?this.pluginOptions.addColumnCallback(t,this.table):this.table.addColumns([{field:`field_${t}`,title:`New Column ${t}`,width:100}])}this.table.changeCellValues(r,t,e,!0)}release(){this.table.internalProps.handler.clear()}},e.RotateTablePlugin=class{id="rotate-table";name="Rotate Table";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED];table;matrix;vglobal_mapToCanvasPoint;constructor(e){this.id=e?.id??this.id}run(...e){const t=e[2];this.table=t,this.table.rotate90WithTransform=W.bind(this.table),this.table.cancelTransform=$.bind(this.table)}release(){}},e.RowSeriesPlugin=class{id="row-series";name="Row Series";runTime=[r.TABLE_EVENT_TYPE.BEFORE_INIT,r.TABLE_EVENT_TYPE.BEFORE_KEYDOWN];pluginOptions;table;constructor(e){this.id=e.id??this.id,this.pluginOptions=Object.assign({rowCount:100},e)}run(...e){if(e[1]===r.TABLE_EVENT_TYPE.BEFORE_INIT){const t=e[0],r=e[2];this.table=r;const n=t.options,i=n.records??[];for(let e=i.length;e<this.pluginOptions.rowCount;e++)i.push(this.pluginOptions.fillRowRecord?this.pluginOptions.fillRowRecord(e):{});n.records=i,this.pluginOptions.rowSeriesNumber?(n.rowSeriesNumber=this.pluginOptions.rowSeriesNumber,this.pluginOptions.rowSeriesNumber.width||(n.rowSeriesNumber.width="auto")):n.rowSeriesNumber||(n.rowSeriesNumber={width:"auto"})}else if(e[1]===r.TABLE_EVENT_TYPE.BEFORE_KEYDOWN){const t=e[0].event;this.pluginOptions.autoExtendRowTriggerKeys?.includes(t.key)&&this.table.stateManager.select.cellPos.row===this.table.rowCount-1&&this.table.addRecord(this.pluginOptions.fillRowRecord?this.pluginOptions.fillRowRecord(this.table.rowCount-this.table.columnHeaderLevelCount):{})}}},e.TableCarouselAnimationPlugin=class{id="table-carousel-animation";name="Table Carousel Animation";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED];table;rowCount;colCount;animationDuration;animationDelay;animationEasing;playing;row;col;willUpdateRow=!1;willUpdateCol=!1;autoPlay;autoPlayDelay;customDistRowFunction;customDistColFunction;constructor(e={}){this.id=e.id??this.id,this.rowCount=e?.rowCount??void 0,this.colCount=e?.colCount??void 0,this.animationDuration=e?.animationDuration??500,this.animationDelay=e?.animationDelay??1e3,this.animationEasing=e?.animationEasing??"linear",this.autoPlay=e?.autoPlay??!1,this.autoPlayDelay=e?.autoPlayDelay??0,this.customDistColFunction=e.customDistColFunction,this.customDistRowFunction=e.customDistRowFunction}run(...e){this.table||(this.table=e[2]),this.reset(),this.autoPlay&&setTimeout((()=>{this.play()}),this.autoPlayDelay)}reset(){this.playing=!1,this.row=this.table.frozenRowCount,this.col=this.table.frozenColCount}play(){if(!this.table)throw new Error("table is not initialized");this.playing=!0,this.rowCount&&!this.willUpdateRow?this.updateRow():this.colCount&&!this.willUpdateCol&&this.updateCol()}pause(){this.playing=!1}updateRow(){if(!this.playing||this.table.isReleased)return;let e=!0;const t=Math.max(this.table.scenegraph.proxy.screenTopRow,this.table.frozenRowCount),r=this.customDistRowFunction&&this.customDistRowFunction(this.row,this.table);r?(this.row=r.distRow,e=r.animation??!0):V(this.row)&&t!==this.row?(this.row=this.table.frozenRowCount,e=!1):V(this.row)||t===Math.floor(this.row)?this.row+=this.rowCount:(this.row=this.table.frozenRowCount,e=!1),this.table.scrollToRow(this.row,e?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateRow=!0,setTimeout((()=>{this.willUpdateRow=!1,this.updateRow()}),this.animationDuration+this.animationDelay)}updateCol(){if(!this.playing||this.table.isReleased)return;let e=!0;const t=this.customDistColFunction&&this.customDistColFunction(this.col,this.table);t?(this.col=t.distCol,e=t.animation??!0):V(this.col)&&this.table.scenegraph.proxy.screenLeftCol!==this.col?(this.col=this.table.frozenColCount,e=!1):V(this.col)||this.table.scenegraph.proxy.screenLeftCol===Math.floor(this.col)?this.col+=this.colCount:(this.col=this.table.frozenColCount,e=!1),this.table.scrollToCol(this.col,e?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateCol=!0,setTimeout((()=>{this.willUpdateCol=!1,this.updateCol()}),this.animationDuration+this.animationDelay)}release(){}},e.TableExportPlugin=class{id="table-export-plugin";name="TableExport";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED];table;pluginOptions;constructor(e){this.pluginOptions=Object.assign({exportOnIdle:!1,exportExcelOptions:{downloadFile:!0,fileName:"export"},exportCsvOptions:{downloadFile:!0,fileName:"export"}},e)}run(...e){e[1]===r.TABLE_EVENT_TYPE.INITIALIZED&&(e[0],this.table=e[2],this.table.exportToCsv=()=>{const e=this.pluginOptions.exportCsvOptions;return e.downloadFile?async function(e,t){const r=new Blob([`\ufeff${e}`],{type:"text/csv;charset=utf-8"});await ks.saveAs(r,`${t}.csv`)}(_s(this.table,e),e.fileName||"export"):_s(this.table,e)},this.table.exportToExcel=async()=>{const e=this.pluginOptions.exportExcelOptions;return e.downloadFile?await As(await ms(this.table,e,this.pluginOptions.exportOnIdle),e.fileName||"export"):ms(this.table,e,this.pluginOptions.exportOnIdle)},this.table.__vtableSheet&&(this.table.__vtableSheet._exportMutipleTablesToExcel||(this.table.__vtableSheet._exportMutipleTablesToExcel=async e=>{const t=await async function(e,t,r=!1){const n=new Oi.Workbook,i=new Set;for(let s=0;s<e.length;s++){const{table:o,name:a}=e[s],l=gs(a||`sheet${s+1}`,i);i.add(l);const c=n.addWorksheet(l);await bs(o,c,n,t,r)}return await n.xlsx.writeBuffer()}(e,this.pluginOptions.exportExcelOptions);await As(t,this.pluginOptions.exportExcelOptions.fileName||"vtable-sheet-export")})))}release(){this.table&&(delete this.table.exportToCsv,delete this.table.exportToExcel,this.table=null)}},e.TableSeriesNumber=class{id="table-series-number";name="Table Series Number";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED,r.TABLE_EVENT_TYPE.BEFORE_INIT,r.TABLE_EVENT_TYPE.BEFORE_UPDATE_OPTION,r.TABLE_EVENT_TYPE.UPDATED];pluginOptions;table;seriesNumberComponent;componentLayoutLayer;lastCurrentRow=0;lastCurrentCol=0;startRowIndex=0;scrollTimer;constructor(e){this.pluginOptions=e,this.seriesNumberComponent=new t.TableSeriesNumber({rowCount:e.rowCount,colCount:e.colCount,rowSeriesNumberWidth:e.rowSeriesNumberWidth,colSeriesNumberHeight:e.colSeriesNumberHeight,rowSeriesNumberGenerate:e.rowSeriesNumberGenerate,colSeriesNumberGenerate:e.colSeriesNumberGenerate,rowSeriesNumberCellStyle:Object.assign({text:{fontSize:14,fill:"#7A7A7A",pickable:!1,textAlign:"left",textBaseline:"middle",padding:[2,4,2,4]},borderLine:{stroke:"#D9D9D9",lineWidth:1,pickable:!1},bgColor:"#F9F9F9",states:{hover:{fill:"#c8daf6",opacity:.7},select:{fill:"#c8daf6",opacity:1}}},e.rowSeriesNumberCellStyle),colSeriesNumberCellStyle:Object.assign({text:{fontSize:14,fill:"#7A7A7A",pickable:!1,textAlign:"left",textBaseline:"middle",padding:[2,4,2,4]},borderLine:{stroke:"#D9D9D9",lineWidth:1,pickable:!1},bgColor:"#F9F9F9",states:{hover:{fill:"#c8daf6",opacity:.7},select:{fill:"#c8daf6",opacity:1}}},e.colSeriesNumberCellStyle),cornerCellStyle:Object.assign({borderLine:{stroke:"#D9D9D9",lineWidth:1,pickable:!1},bgColor:"#F9F9F9",states:{hover:{fill:"#98C8A5",opacity:.7},select:{fill:"#98C8A5",opacity:1}}},e.cornerCellStyle),checkMoveColumnOrder:e=>!!this.pluginOptions.dragOrder?.enableDragColumnOrder&&this.table.isColumnSelected(e),checkMoveRowOrder:e=>!!this.pluginOptions.dragOrder?.enableDragRowOrder&&this.table.isRowSelected(e)}),this.listenComponentEvents()}run(...e){const t=e[1];if(t===r.TABLE_EVENT_TYPE.BEFORE_INIT||t===r.TABLE_EVENT_TYPE.BEFORE_UPDATE_OPTION){const t=e[0],r=e[2];this.table=r;const n=t.options,i=n.records??[];i.length<this.pluginOptions.rowCount&&(i.length=this.pluginOptions.rowCount),n.records=i,n.columns||(n.columns=[]);for(let e=n.columns.length;e<this.pluginOptions.colCount;e++){const t={field:e,key:e,title:""};n.columns.push(t)}const s=this.seriesNumberComponent.rowSeriesNumberWidth,o=this.seriesNumberComponent.colSeriesNumberHeight;n.contentOffsetX=s,n.contentOffsetY=o}else if(t===r.TABLE_EVENT_TYPE.INITIALIZED||t===r.TABLE_EVENT_TYPE.UPDATED){this.table=e[2],this.table.options.customConfig||(this.table.options.customConfig={}),this.table.options.customConfig.cancelSelectCellHook=e=>!e.target.isDescendantsOf(this.seriesNumberComponent),this.seriesNumberComponent.setAttributes({rowCount:this.table.rowCount,colCount:this.table.colCount,frozenRowCount:this.table.frozenRowCount,frozenColCount:this.table.frozenColCount,rightFrozenColCount:this.table.rightFrozenColCount,bottomFrozenRowCount:this.table.bottomFrozenRowCount});const t=this.table.scenegraph.stage.createLayer();t.appendChild(this.seriesNumberComponent),t.setAttributes({pickable:!1}),this.componentLayoutLayer=t,this.syncRowHeightToComponent(),this.syncColWidthToComponent(),this.listenTableEvents()}}handleScroll=()=>{this.scrollTimer&&(clearTimeout(this.scrollTimer),this.scrollTimer=null),this.scrollTimer=setTimeout((()=>{this.scrollTimer=null,this.syncScrollToComponent()}),10)};handleAfterSort=()=>{this.syncScrollToComponent()};handleSelectedChanged=e=>{this.seriesNumberComponent.removeAllSelectedIndexs();const t=this.table.stateManager.select.ranges,r=[],n=[];for(const e of t){const{row:t,col:i}=e.start,{row:s,col:o}=e.end;r.push({startIndex:Math.min(t,s),endIndex:Math.max(t,s)}),n.push({startIndex:Math.min(i,o),endIndex:Math.max(i,o)})}this.seriesNumberComponent.addRowSelectedRanges(r),this.seriesNumberComponent.addColSelectedRanges(n),this.table.stateManager.select.isSelectAll&&this.seriesNumberComponent.addCornderSelected(),this.seriesNumberComponent.renderSelectedIndexsState()};handleResizeColumnEnd=e=>{this.seriesNumberComponent.setAttribute("hover",!0)};handleResizeRowEnd=e=>{this.seriesNumberComponent.setAttribute("hover",!0)};handleChangeHeaderPosition=e=>{this.syncColWidthToComponent()};listenTableEvents(){this.table.on(r.TABLE_EVENT_TYPE.SCROLL,this.handleScroll),this.table.on(r.TABLE_EVENT_TYPE.AFTER_SORT,this.handleAfterSort),this.table.on(r.TABLE_EVENT_TYPE.SELECTED_CHANGED,this.handleSelectedChanged),this.table.on(r.TABLE_EVENT_TYPE.RESIZE_COLUMN_END,this.handleResizeColumnEnd),this.table.on(r.TABLE_EVENT_TYPE.RESIZE_ROW_END,this.handleResizeRowEnd),this.table.on(r.TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION,this.handleChangeHeaderPosition)}handleSeriesNumberCellRightClick=e=>{const{seriesNumberCell:t,event:n,isDragSelect:i}=e.detail,s=t.name.includes("row"),o=t.name.includes("col");if(s){const e=t.id;this.table.stateManager.select.ranges.some((t=>t.start.row<=e&&e<=t.end.row&&0===t.start.col&&t.end.col===this.table.colCount-1))||this.table.selectCells([{start:{row:e,col:0},end:{row:e,col:this.table.colCount-1}}]),this.table.fireListeners(r.TABLE_EVENT_TYPE.PLUGIN_EVENT,{plugin:this,event:n,pluginEventInfo:{eventType:"rightclick",rowIndex:e}})}else if(o){const e=t.id;this.table.stateManager.select.ranges.some((t=>t.start.col<=e&&e<=t.end.col&&0===t.start.row&&t.end.row===this.table.rowCount-1))||this.table.selectCells([{start:{row:0,col:e},end:{row:this.table.rowCount-1,col:e}}]),this.table.fireListeners(r.TABLE_EVENT_TYPE.PLUGIN_EVENT,{plugin:this,event:n,pluginEventInfo:{eventType:"rightclick",colIndex:e}})}else this.table.selectCells([{start:{row:0,col:0},end:{row:this.table.rowCount-1,col:this.table.colCount-1}}]),this.table.fireListeners(r.TABLE_EVENT_TYPE.PLUGIN_EVENT,{plugin:this,event:n,pluginEventInfo:{eventType:"rightclick",isCorner:!0}})};handleSeriesNumberCellHover=e=>{this.table.scenegraph.renderSceneGraph()};handleSeriesNumberCellUnHover=e=>{this.table.scenegraph.renderSceneGraph()};handleSeriesNumberCellClick=e=>{const{seriesNumberCell:t,event:r,isDragSelect:n}=e.detail,i=this.table.options.keyboardOptions?.ctrlMultiSelect??!0,s=this.table.options.keyboardOptions?.shiftMultiSelect??!0,o=(r.nativeEvent.ctrlKey||r.nativeEvent.metaKey)&&i,a=r.nativeEvent.shiftKey&&s,l=t.name.includes("row"),c=t.name.includes("col");if(l){this.table.stateManager.setSelectInline("row");const e=t.id;n?this.table.dragSelectRow(e,o):this.table.startDragSelectRow(e,o,a)}else if(c){this.table.stateManager.setSelectInline("col");const e=t.id;n?this.table.dragSelectCol(e,o):this.table.startDragSelectCol(e,o,a)}else this.table.eventManager.deelTableSelectAll()};handleSeriesNumberCellClickUp=e=>{this.table.stateManager.setSelectInline(!1),this.table.endDragSelect()};handleRowSeriesNumberWidthChange=e=>{const t=this.seriesNumberComponent.rowSeriesNumberWidth,r=this.seriesNumberComponent.colSeriesNumberHeight;this.table.setContentInsetXY(t,r)};handleResizeColWidthStart=e=>{this.seriesNumberComponent.setAttribute("hover",!1);const{colIndex:t,event:n}=e.detail;this.table.stateManager.updateInteractionState(r.TYPES.InteractionState.grabing),this.table.stateManager.startResizeCol(t,n.viewport.x,n.viewport.y)};handleResizeRowHeightStart=e=>{this.seriesNumberComponent.setAttribute("hover",!1);const{rowIndex:t,event:n}=e.detail;this.table.stateManager.updateInteractionState(r.TYPES.InteractionState.grabing),this.table.stateManager.startResizeRow(t,n.viewport.x,n.viewport.y)};handleDragColumOrderStart=e=>{const{colIndex:t,event:n}=e.detail;this.table.stateManager.updateInteractionState(r.TYPES.InteractionState.grabing),this.table.stateManager.startMoveCol(t,0,n.viewport.x,n.viewport.y,n.nativeEvent,"column")};handleDragRowOrderStart=e=>{const{rowIndex:t,event:n}=e.detail;this.table.stateManager.updateInteractionState(r.TYPES.InteractionState.grabing),this.table.stateManager.startMoveCol(0,t,n.viewport.x,n.viewport.y,n.nativeEvent,"row")};listenComponentEvents(){this.seriesNumberComponent.on(t.SeriesNumberEvent.seriesNumberCellRightClick,this.handleSeriesNumberCellRightClick),this.seriesNumberComponent.on(t.SeriesNumberEvent.seriesNumberCellHover,this.handleSeriesNumberCellHover),this.seriesNumberComponent.on(t.SeriesNumberEvent.seriesNumberCellUnHover,this.handleSeriesNumberCellUnHover),this.seriesNumberComponent.on(t.SeriesNumberEvent.seriesNumberCellClick,this.handleSeriesNumberCellClick),this.seriesNumberComponent.on(t.SeriesNumberEvent.seriesNumberCellClickUp,this.handleSeriesNumberCellClickUp),this.seriesNumberComponent.on(t.SeriesNumberEvent.rowSeriesNumberWidthChange,this.handleRowSeriesNumberWidthChange),this.seriesNumberComponent.on(t.SeriesNumberEvent.resizeColWidthStart,this.handleResizeColWidthStart),this.seriesNumberComponent.on(t.SeriesNumberEvent.resizeRowHeightStart,this.handleResizeRowHeightStart),this.pluginOptions.dragOrder?.enableDragColumnOrder&&this.seriesNumberComponent.on(t.SeriesNumberEvent.dragColumnOrderStart,this.handleDragColumOrderStart),this.pluginOptions.dragOrder?.enableDragRowOrder&&this.seriesNumberComponent.on(t.SeriesNumberEvent.dragRowOrderStart,this.handleDragRowOrderStart)}release(){this.componentLayoutLayer&&(this.table.scenegraph.stage.removeLayer(this.componentLayoutLayer._uid),this.componentLayoutLayer=null),this.scrollTimer&&(clearTimeout(this.scrollTimer),this.scrollTimer=null),this.table&&(this.table.off(r.TABLE_EVENT_TYPE.SCROLL,this.handleScroll),this.table.off(r.TABLE_EVENT_TYPE.AFTER_SORT,this.handleAfterSort),this.table.off(r.TABLE_EVENT_TYPE.SELECTED_CHANGED,this.handleSelectedChanged),this.table.off(r.TABLE_EVENT_TYPE.RESIZE_COLUMN_END,this.handleResizeColumnEnd),this.table.off(r.TABLE_EVENT_TYPE.RESIZE_ROW_END,this.handleResizeRowEnd)),this.seriesNumberComponent&&(this.seriesNumberComponent.off(t.SeriesNumberEvent.seriesNumberCellRightClick,this.handleSeriesNumberCellRightClick),this.seriesNumberComponent.off(t.SeriesNumberEvent.seriesNumberCellHover,this.handleSeriesNumberCellHover),this.seriesNumberComponent.off(t.SeriesNumberEvent.seriesNumberCellUnHover,this.handleSeriesNumberCellUnHover),this.seriesNumberComponent.off(t.SeriesNumberEvent.seriesNumberCellClick,this.handleSeriesNumberCellClick),this.seriesNumberComponent.off(t.SeriesNumberEvent.seriesNumberCellClickUp,this.handleSeriesNumberCellClickUp),this.seriesNumberComponent.off(t.SeriesNumberEvent.rowSeriesNumberWidthChange,this.handleRowSeriesNumberWidthChange),this.seriesNumberComponent.off(t.SeriesNumberEvent.resizeColWidthStart,this.handleResizeColWidthStart),this.seriesNumberComponent.off(t.SeriesNumberEvent.resizeRowHeightStart,this.handleResizeRowHeightStart),this.seriesNumberComponent.release?.(),this.seriesNumberComponent=null)}syncRowHeightToComponent(){if(!this.table.getBodyVisibleRowRange())return;const{rowStart:e,rowEnd:t}=this.table.getBodyVisibleRowRange(),r=Math.max(e-2,this.table.frozenRowCount),n=Math.min(t+2,this.table.rowCount-1);this.table.frozenRowCount!==this.seriesNumberComponent.getAttributes().frozenRowCount&&this.seriesNumberComponent.setAttributes({frozenRowCount:this.table.frozenRowCount}),this.seriesNumberComponent.recreateCellsToRowSeriesNumberGroup(r,n);for(let e=0;e<this.table.frozenRowCount;e++){const t=this.table.scenegraph.getCell(0,e).getAttributes();this.seriesNumberComponent.setRowSeriesNumberCellAttributes(e,{y:t.y,height:t.height})}for(let e=r;e<=n;e++){const t=this.table.scenegraph.getCell(0,e).getAttributes();this.seriesNumberComponent.setRowSeriesNumberCellAttributes(e,{y:t.y,height:t.height})}}syncColWidthToComponent(){if(!this.table.getBodyVisibleColRange())return;const{colStart:e,colEnd:t}=this.table.getBodyVisibleColRange(),r=e,n=Math.min(t,this.table.scenegraph.proxy.colEnd);this.table.frozenColCount!==this.seriesNumberComponent.getAttributes().frozenColCount&&this.seriesNumberComponent.setAttributes({frozenColCount:this.table.frozenColCount}),this.seriesNumberComponent.recreateCellsToColSeriesNumberGroup(r,n);for(let e=0;e<this.table.frozenColCount;e++){const t=this.table.scenegraph.getColGroup(e).getAttributes();this.seriesNumberComponent.setColSeriesNumberCellAttributes(e,{x:t.x,width:t.width})}for(let e=r;e<=n;e++){const t=this.table.scenegraph.getColGroup(e).getAttributes();this.seriesNumberComponent.setColSeriesNumberCellAttributes(e,{x:t.x,width:t.width})}}syncScrollToComponent(){this.syncRowHeightToComponent(),this.syncColWidthToComponent();const e=this.table.scenegraph.bodyGroup.getAttributes().y,t=this.table.scenegraph.bodyGroup.getAttributes().x;this.seriesNumberComponent.setRowSeriesNumberGroupAttributes({y:e+this.seriesNumberComponent.colSeriesNumberHeight}),this.seriesNumberComponent.setColSeriesNumberGroupAttributes({x:t+this.seriesNumberComponent.rowSeriesNumberWidth})}},e.ValueFilter=qi,e.WpsFillHandlePlugin=class{id="wps-fill-handle";name="WPS Fill Handle";runTime=[r.TABLE_EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,r.TABLE_EVENT_TYPE.DRAG_FILL_HANDLE_END];table;pluginOptions;beforeDragMinCol=0;beforeDragMinRow=0;beforeDragMaxCol=0;beforeDragMaxRow=0;constructor(e){this.id=e?.id??this.id,this.pluginOptions=e}run(...e){if(e[1]===r.TABLE_EVENT_TYPE.MOUSEDOWN_FILL_HANDLE){e[0];const t=e[2];this.table=t;const r=this.table?.getSelectedCellRanges()[0];if(!r)return;this.beforeDragMaxCol=Math.max(r.start.col,r.end.col),this.beforeDragMinCol=Math.min(r.start.col,r.end.col),this.beforeDragMaxRow=Math.max(r.start.row,r.end.row),this.beforeDragMinRow=Math.min(r.start.row,r.end.row)}else if(e[1]===r.TABLE_EVENT_TYPE.DRAG_FILL_HANDLE_END){const t=e[0].direction;let r,n;const i=this.table?.getSelectedCellRanges()[0];if(!i)return;"bottom"===t?(r=this.beforeDragMaxCol,n=i.end.row):"right"===t?(r=i.end.col,n=this.beforeDragMaxRow):"top"===t?(r=this.beforeDragMaxCol,n=i.end.row):"left"===t&&(r=i.end.col,n=this.beforeDragMaxRow);const s=this.table?.records,o=this.table?.getAllColumnHeaderCells()||[];let a=[];o?.length&&(a=o[o.length-1]);const l=fi(s,a,{startRow:this.beforeDragMinRow-o.length,startCol:this.beforeDragMinCol,endRow:this.beforeDragMaxRow-o.length,endCol:this.beforeDragMaxCol},{row:n-o.length,col:r});this.table?.setRecords(l)}}handleKeyDown(){if(this.table.editorManager){const e=this.table?.getSelectedCellRanges()[0];if(!e)return;this.beforeDragMaxCol=Math.max(e.start.col,e.end.col),this.beforeDragMinCol=Math.min(e.start.col,e.end.col),this.beforeDragMaxRow=Math.max(e.start.row,e.end.row),this.beforeDragMinRow=Math.min(e.start.row,e.end.row)}}release(){this.beforeDragMinCol=0,this.beforeDragMinRow=0,this.beforeDragMaxCol=0,this.beforeDragMaxRow=0}},e.applyStyles=N,e.cancelTransform=$,e.chnNumberRule=dl,e.chnWeek2Rule=pl,e.chnWeek3Rule=ml,e.createElement=I,e.createFormulaAdapter=Ps,e.createIcon=F,e.createNumberInputItem=function(e,t=1,r,n){const i=I("div");if(N(i,O.inputContainer),r){const e=F(r);i.appendChild(e)}const s=I("label");s.textContent=e,N(s,O.inputLabel),i.appendChild(s);const o=I("input");o.type="number",o.min="1",o.value=t.toString(),N(o,O.inputField),i.appendChild(o);const a=I("div");return a.appendChild(i),a},e.dateRule=cl,e.enhanceCellDataWithFormula=function(e,t,r,n){const i={...e};return n.isFormulaCell(t,r)&&(i.isFormula=!0,i.formula=n.getCellFormula(t,r),i.calculatedValue=n.getCalculatedValue(t,r)),i},e.extendNumberRule=fl,e.formulaRule=yl,e.loopSeriesRule=bl,e.numberRule=hl,e.otherRule=ul,e.reverseIfNeed=gl,e.rotate90WithTransform=W}));
37
+ function n(e){return e>=65&&e<=90||95===e||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}Object.defineProperty(r,"__esModule",{value:!0}),r.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",r.NC_NAME_CHAR="-"+r.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.NC_NAME_START_CHAR_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]$","u"),r.NC_NAME_CHAR_RE=new RegExp("^["+r.NC_NAME_CHAR+"]$","u"),r.NC_NAME_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]["+r.NC_NAME_CHAR+"]*$","u"),r.isNCNameStartChar=n,r.isNCNameChar=function(e){return n(e)||45===e||46===e||e>=48&&e<=57||183===e||e>=768&&e<=879||e>=8255&&e<=8256}},{}]},{},[15])(15)}(ki);var Ai,Mi,Oi=l(ki.exports);async function Ii(e,t){const r=await e.text(),n=t?.delimiter||",",i=r.split(/\r?\n/).filter((e=>e.trim().length>0));if(0===i.length)throw new Error("CSV 文件为空");const s=[];for(const e of i){const t=Ni(e,n);s.push(t)}const o=s.length,a=Math.max(...s.map((e=>e.length)),0);return{sheets:[{sheetTitle:e.name.replace(/\.(csv|txt)$/i,"")||"Sheet1",sheetKey:`sheet_${Date.now()}_0`,data:s,columnCount:a,rowCount:o}]}}function Ni(e,t){const r=[];let n="",i=!1;for(let s=0;s<e.length;s++){const o=e[s],a=e[s+1];'"'===o?i&&'"'===a?(n+='"',s++):i=!i:o!==t||i?n+=o:(r.push(n.trim()),n="")}return r.push(n.trim()),r}async function Fi(e,t){const r=new Oi.Workbook;if(await r.xlsx.load(await e.arrayBuffer()),!r.worksheets||0===r.worksheets.length)throw new Error("Excel 文件无有效工作表");let n;n=t?.sheetIndices&&t.sheetIndices.length>0?t.sheetIndices.filter((e=>e>=0&&e<r.worksheets.length)):Array.from({length:r.worksheets.length},((e,t)=>t));const i=[];for(const e of n){const n=r.worksheets[e];if(n)try{const r=await Pi(n,e,t);i.push(r)}catch(e){}}if(0===i.length)throw new Error("没有成功解析任何工作表");return{sheets:i}}async function Pi(e,t,r){const n=e.name||`Sheet${t+1}`,i=`sheet_${Date.now()}_${t}`,s=e.actualRowCount||0,o=e.actualColumnCount||0;if(0===s||0===o){const t=ji(e,[]);return{sheetTitle:n,sheetKey:i,data:[],columnCount:0,rowCount:0,...t.length>0?{cellMerge:t}:{}}}const a=[];for(let t=1;t<=s;t++){const r=e.getRow(t),n=[];for(let e=1;e<=o;e++){let t=r.getCell(e).value;t&&"object"==typeof t&&("richText"in t?t=t.richText.map((e=>e.text)).join(""):"result"in t?t=t.result:"text"in t&&"hyperlink"in t?t=t.text:t instanceof Date&&(t=t.toISOString())),n.push(t??null)}a.push(n)}const l=ji(e,a);return{sheetTitle:n,sheetKey:i,data:a,columnCount:o,rowCount:s,...l.length>0?{cellMerge:l}:{}}}function ji(e,t){const r=[];try{const n=e,i=n.model?.merges||n._merges||{};for(const[e,n]of Object.entries(i))try{let e,i,s,o,a;if("string"==typeof n){const t=n.match(/^([A-Z]+\d+):([A-Z]+\d+)$/i);if(!t)continue;const r=Li(t[1]),a=Li(t[2]);if(!r||!a)continue;e=r.col,i=r.row,s=a.col,o=a.row}else{if("object"!=typeof n||null===n)continue;{const t=n;if(t.tl&&t.br){const r=Li(t.tl),n=Li(t.br);if(!r||!n)continue;e=r.col,i=r.row,s=n.col,o=n.row}else{if("number"!=typeof t.top||"number"!=typeof t.left||"number"!=typeof t.bottom||"number"!=typeof t.right)continue;i=t.top-1,e=t.left-1,o=t.bottom-1,s=t.right-1}}}if(i>=0&&i<t.length&&e>=0&&e<t[i].length){const r=t[i][e];null!=r&&(a=String(r))}r.push({text:a,range:{start:{col:e,row:i},end:{col:s,row:o},isCustom:!0}})}catch(e){}}catch(e){}return r}function Li(e){try{const t=e.match(/^([A-Z]+)(\d+)$/i);if(!t)return null;const r=t[1].toUpperCase(),n=parseInt(t[2],10);let i=0;for(let e=0;e<r.length;e++)i=26*i+(r.charCodeAt(e)-64);i-=1;return{col:i,row:n-1}}catch(e){return null}}function Di(e,t,r){const n=!1!==r?.clearExisting;if(0===t.sheets.length)return;if("function"!=typeof e.addSheet)throw new Error("VTableSheet 实例方法不完整");const i=(n?[...e.getAllSheets()]:[]).map((e=>e.sheetKey)),s=[];for(let r=0;r<t.sheets.length;r++){const n=t.sheets[r];let i=n.sheetKey,o=1;for(;e.getSheet(i)||s.includes(i);)i=`${n.sheetKey}_${o}`,o++;const a={sheetKey:i,sheetTitle:n.sheetTitle,data:n.data,rowCount:Math.max(n.rowCount,100),columnCount:Math.max(n.columnCount,26),cellMerge:n.cellMerge,active:!1};e.addSheet(a),s.push(i)}if(n&&i.length>0)for(const t of i)s.includes(t)||e.getSheet(t)&&e.getSheetCount()>1&&e.removeSheet(t);s.length>0&&e.activateSheet(s[0])}class Bi{id="excel-import-plugin";name="ExcelImportPlugin";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED];options;table=null;constructor(e){this.options={autoTable:!0,autoColumns:!0,delimiter:",",exportData:!1,batchSize:1e3,enableBatchProcessing:!0,asyncDelay:5,importAllSheets:!1,clearExisting:!0,...e},e?.id&&(this.id=e.id)}run(...e){if(e[1]===r.TABLE_EVENT_TYPE.INITIALIZED&&(this.table=e[2],this.table.importFile=()=>{this.import("file")},this.table.__vtableSheet)){const e=this.table.__vtableSheet;e._importFile||(e._importFile=async t=>{const r={...this.options,...t};return this._importFileFromDialogForVTableSheet(e,r)})}}async _importFile(e){if(!this.table)throw new Error("表格实例不存在或已销毁,无法导入数据!");const t={...this.options,...e};if(this._detectVTableSheet(this.table))return this._importMultipleSheetsFromFileDialog({...t,importAllSheets:!0});throw new Error("ListTable 单 sheet 导入功能需要进一步重构")}_selectFile(e=".xlsx,.xls,.csv,.txt,.json,.html,.htm"){return new Promise(((t,r)=>{const n=document.createElement("input");n.type="file",n.accept=e,n.style.display="none",document.body.appendChild(n),n.addEventListener("change",(()=>{try{const e=n.files?.[0];if(!e)return document.body.removeChild(n),void r(new Error("未选择文件"));n.value="",document.body.removeChild(n),t(e)}catch(e){document.body.removeChild(n),r(e)}})),n.click()}))}async _importFileFromDialogForVTableSheet(e,t){try{const r=await this._selectFile(".xlsx,.xls,.csv,.txt"),n=this._getFileExtension(r.name).toLowerCase();let i;if("csv"===n||"txt"===n)i=await Ii(r,t);else{if("xlsx"!==n&&"xls"!==n)throw new Error("不支持的文件类型,仅支持 Excel (.xlsx, .xls) 和 CSV (.csv, .txt)");i=await Fi(r,t)}return!1!==t.autoTable&&i.sheets.length>0&&Di(e,i,t),i}catch(e){throw e}}async _importMultipleSheetsFromFileDialog(e){try{const t=await this._selectFile(".xlsx,.xls,.csv,.txt"),r=this._getFileExtension(t.name).toLowerCase();let n;if("csv"===r||"txt"===r)n=await Ii(t,e);else{if("xlsx"!==r&&"xls"!==r)throw new Error("不支持的文件类型,仅支持 Excel (.xlsx, .xls) 和 CSV (.csv, .txt)");n=await Fi(t,e)}if(!1!==e.autoTable&&this.table&&this._detectVTableSheet(this.table)){const t=this.table.__vtableSheet;t&&Di(t,n,e)}return n}catch(e){throw e}}_detectVTableSheet(e){const t=e;return!!(t&&"function"==typeof t.updateOption&&t.options&&"object"==typeof t.options&&null!==t.options&&Array.isArray(t.options.sheets))}_getFileExtension(e){const t=e.split(".");return t.length>1?t[t.length-1]:""}release(){this.table&&(delete this.table.importFile,this.table=null)}async import(e,t,r){if(!this.table)throw new Error("表格实例不存在或已销毁,无法导入数据!");const n={...this.options,...r};if(this._detectVTableSheet(this.table)&&"file"===e)return this._importMultipleSheetsFromFileDialog({...n,importAllSheets:!0});if("file"===e)return this._importFromFileDialog(n);if("string"==typeof t)return this._importFromString(e,t,n);if(Array.isArray(t)||"object"==typeof t){if("json"!==e)throw new Error("只有JSON格式支持从对象导入");return this._importFromData("json",t,n)}throw new Error("Invalid import source")}async _importFromFileDialog(e){if(!this.table)throw new Error("表格实例不存在或已销毁,无法导入数据!");const t=await this._selectFile(),r=await this._parseFile(t,e);return e.autoTable&&this.table&&(e.autoColumns&&this.table.updateOption(Object.assign({},this.table.options,{columns:r.columns})),this.table.setRecords(r.records)),r}async _importFromString(e,t,r){let n;switch(e){case"csv":n=await this._parseCSVString(t,r);break;case"json":n=await this._parseJSONString(t,r);break;case"html":n=await this._parseHTMLString(t,r);break;default:throw new Error(`不支持的导入类型: ${e}`)}return r.autoTable&&this.table&&(r.autoColumns&&this.table.updateOption({columns:n.columns,plugins:[this]}),this.table.setRecords(n.records)),n}async _importFromData(e,t,r){let n;if("json"!==e)throw new Error(`不支持的数据类型: ${e}`);return n=await this._parseJSONData(t,r),r.autoTable&&this.table&&(r.autoColumns&&this.table.updateOption({columns:n.columns,plugins:[this]}),this.table.setRecords(n.records)),n}async _parseFile(e,t){const r={...this.options,...t},n=this._getFileExtension(e.name).toLowerCase();switch(n){case"xlsx":case"xls":return await this._parseExcelFile(e,r);case"csv":return await this._parseCsvFile(e,r);case"json":return await this._parseJsonFile(e,r);case"html":case"htm":return await this._parseHtmlFile(e,r);default:throw new Error(`不支持的文件类型: ${n}`)}}async _parseExcelFile(e,t){const r={...this.options,...t};return await Bi.importExcelToVTableData(e,r)}async _parseCsvFile(e,t){const r={...this.options,...t},n=await e.text();return this._parseCSVString(n,r)}async _parseJsonFile(e,t){const r={...this.options,...t},n=await e.text();return this._parseJSONString(n,r)}async _parseHtmlFile(e,t){const r={...this.options,...t},n=await e.text();return this._parseHTMLString(n,r)}_buildColumnsFromHeaders(e){return 1===e.length?e[0].map(((e,t)=>({field:`col${t}`,title:e||`列${t+1}`,cellType:"text",headerType:"text"}))):Bi.buildColumns(e)}static async importExcelToVTableData(e,t){const r=new Oi.Workbook;await r.xlsx.load(await e.arrayBuffer());const n=r.worksheets[0];if(!n)throw new Error("Excel 文件无有效工作表");const i=t?.headerRowCount??this.detectHeaderRowCount(n),s=[];for(let e=1;e<=i;e++){const t=n.getRow(e);s.push(Array.prototype.slice.call(t.values,1))}const o=Bi.buildColumns(s),a=[],l=[];n.eachRow(((e,t)=>{if(t<=i)return;const r=Array.prototype.slice.call(e.values,1);l.push(r)}));const c=t?.batchSize||1e3;if(!1!==t?.enableBatchProcessing&&l.length>c)for(let e=0;e<l.length;e+=c){const r=l.slice(e,e+c).map((e=>{const t={};return e.forEach(((e,r)=>{t[`col${r}`]=e})),t}));a.push(...r),e+c<l.length&&await new Promise((e=>setTimeout(e,t?.asyncDelay||5)))}else l.forEach((e=>{const t={};e.forEach(((e,r)=>{t[`col${r}`]=e})),a.push(t)}));if(t?.exportData){const e=Bi._generateJavaScriptExport(o,a),t=new Blob([e],{type:"text/javascript"}),r=URL.createObjectURL(t),n=document.createElement("a");n.href=r,n.download="vtable-data.js",document.body.appendChild(n),n.click(),setTimeout((()=>{document.body.removeChild(n),URL.revokeObjectURL(r)}),100)}return{columns:o,records:a}}static detectHeaderRowCount(e){let t=1,r=1;for(;;){const n=e.getRow(t),i=Array.prototype.slice.call(n.values,1);let s=!1;for(let e=1;e<i.length;e++)if(void 0!==i[e]&&""!==i[e]&&i[e]===i[e-1]){s=!0;break}if(!s)break;r++,t++}return r}static buildColumns(e,t=0,r,n=0){const i=e[n],s=[];r=r??i.length;let o=t;for(;o<r;){const t=String(i[o]||`列${o+1}`);let a=1;for(;o+a<r&&i[o+a]===t;)a++;if(n<e.length-1){const r=Bi.buildColumns(e,o,o+a,n+1);1===r.length?s.push(r[0]):s.push({title:t,columns:r,hideColumnsSubHeader:!1})}else s.push({field:`col${o}`,title:t,cellType:"text",headerType:"text"});o+=a}return s}async _parseCSVString(e,t){const r=t.delimiter||",",n=e.split(/\r?\n/).filter((e=>e.trim().length>0));if(0===n.length)throw new Error("CSV文件为空");const i=e=>{const t=[];let n="",i=!1;for(let s=0;s<e.length;s++){const o=e[s],a=e[s+1];'"'===o?i&&'"'===a?(n+='"',s++):i=!i:o!==r||i?n+=o:(t.push(n.trim()),n="")}return t.push(n.trim()),t},s=n.slice(0,1).map((e=>i(e).map((e=>String(e||""))))),o=n.slice(1),a=this._buildColumnsFromHeaders(s),l=[];return await this._processBatchRecords(o,t,(async e=>{const t=e.map((e=>{const t=i(e),r={};return t.forEach(((e,t)=>{r[`col${t}`]=e??""})),r}));l.push(...t)})),t.exportData&&this._exportToJS(a,l),{columns:a,records:l}}async _parseJSONString(e,t){let r;try{r=JSON.parse(e)}catch(e){throw new Error("JSON文件格式错误")}const n=await this._parseJSONData(r,t);return t.exportData&&this._exportToJS(n.columns,n.records),n}async _parseHTMLString(e,t){const r=(new DOMParser).parseFromString(e,"text/html").querySelector("table");if(!r)throw new Error("HTML文件中未找到表格");const n=Array.from(r.querySelectorAll("tr"));if(0===n.length)throw new Error("表格中没有数据行");const i=n.slice(0,1).map((e=>Array.from(e.querySelectorAll("th, td")).map((e=>e.textContent?.trim()||"")))),s=n.slice(1),o=this._buildColumnsFromHeaders(i),a=[];return await this._processBatchRecords(s,t,(async e=>{const t=e.map((e=>{const t=Array.from(e.querySelectorAll("td")).map((e=>e.textContent?.trim()||"")),r={};return t.forEach(((e,t)=>{r[`col${t}`]=e||""})),r}));a.push(...t)})),t.exportData&&this._exportToJS(o,a),{columns:o,records:a}}async _parseJSONData(e,t){let r;if("object"==typeof e&&!Array.isArray(e)&&e&&"columns"in e&&"records"in e){const n=e,i=[];await this._processBatchRecords(n.records,t,(async e=>{const t=e.map((e=>({...e})));i.push(...t)})),r={columns:n.columns,records:i}}else{if(!(Array.isArray(e)&&e.length>0))throw new Error("不支持的JSON格式");{const n=e[0],i=Object.keys(n).map((e=>({field:e,title:e,cellType:"text",headerType:"text"}))),s=[];await this._processBatchRecords(e,t,(async e=>{const t=e.map((e=>({...e})));s.push(...t)})),r={columns:i,records:s}}}return t.exportData&&this._exportToJS(r.columns,r.records),r}static _generateJavaScriptExport(e,t){const r=(e,t="")=>{if(null==e)return"null";if("string"==typeof e)return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`;if("number"==typeof e||"boolean"==typeof e)return String(e);if(Array.isArray(e)){if(0===e.length)return"[]";return`[${e.map((e=>r(e,t+" "))).join(", ")}]`}if("object"==typeof e){return`{\n${Object.entries(e).map((([e,n])=>`${t} ${e}: ${r(n,t+" ")}`)).join(",\n")}\n${t}}`}return String(e)},n=(e,t=" ")=>{const i=Object.entries(e).map((([e,i])=>{if("columns"===e&&Array.isArray(i)){const r=i.map((e=>n(e,t+" "))).join(",\n");return`${t} ${e}: [\n${r}\n${t} ]`}return`${t} ${e}: ${r(i)}`})).join(",\n");return`${t}{\n${i}\n${t}}`},i=e.map((e=>n(e))).join(",\n"),s=t.map((e=>` {\n${Object.entries(e).map((([e,t])=>` ${e}: ${r(t)}`)).join(",\n")}\n }`)).join(",\n");return`// VTable 数据导出 - JavaScript 对象字面量格式\n// 生成时间: ${(new Date).toLocaleString()}\n\nconst vtableData = {\n columns: [\n${i}\n ],\n records: [\n${s}\n ]\n};\n`}_exportToJS(e,t){const r=Bi._generateJavaScriptExport(e,t),n=new Blob([r],{type:"text/javascript"}),i=URL.createObjectURL(n),s=document.createElement("a");s.href=i,s.download="vtable-data.js",document.body.appendChild(s),s.click(),setTimeout((()=>{document.body.removeChild(s),URL.revokeObjectURL(i)}),100)}async _processBatchRecords(e,t,r){if(!t.enableBatchProcessing||e.length<=(t.batchSize||1e3))return void await r(e,0);const n=t.batchSize||1e3,i=Math.ceil(e.length/n);for(let s=0;s<i;s++){const o=s*n,a=Math.min(o+n,e.length),l=e.slice(o,a);await r(l,s),s<i-1&&await new Promise((e=>setTimeout(e,t.asyncDelay||5)))}}}class Hi{constructor(){}handleCopy(e){e.eventManager.handleCopy(new KeyboardEvent("copy"))}handleCut(e){e.eventManager.handleCut(new KeyboardEvent("cut"))}handlePaste(e){e.eventManager.handlePaste(new KeyboardEvent("paste"))}handleInsertRowAbove(e,t,r=1){if(void 0!==t&&"function"==typeof e.addRecord){const n=Array.from({length:r},((e,t)=>[]));e.addRecords(n,t-1)}}handleInsertRowBelow(e,t,r=1){if(void 0!==t&&"function"==typeof e.addRecord){const n=Array.from({length:r},((e,t)=>[]));e.addRecords(n,t)}}handleInsertColumnLeft(e,t,r=1){if(void 0!==t&&"function"==typeof e.addColumns){const n=[];for(let e=0;e<r;e++)n.push({field:t-e});e.addColumns(n,t,!0)}}handleInsertColumnRight(e,t,r=1){if(void 0!==t&&"function"==typeof e.addColumns){const n=[];for(let e=0;e<r;e++)n.push({field:t+1});e.addColumns(n,t+1,!0)}}handleDeleteRow(e){if("function"==typeof e.deleteRecords){const t=e.stateManager.select.ranges,r=[];for(let e=0;e<t.length;e++){const n=t[e];for(let e=n.start.row;e<=n.end.row;e++)r.includes(e)||r.push(e)}r.sort(((e,t)=>t-e));const n=[];for(let t=0;t<r.length;t++){const i=e.getRecordIndexByCell(0,r[t]);n.push(i)}e.deleteRecords(n)}}handleDeleteColumn(e,t){if(void 0!==t&&"function"==typeof e.deleteColumns){const t=e.stateManager.select.ranges,r=[];for(let e=0;e<t.length;e++){const n=t[e];for(let e=n.start.col;e<=n.end.col;e++)r.includes(e)||r.push(e)}e.deleteColumns(r,!0)}}handleHideColumn(e,t){void 0!==t&&"function"==typeof e.hideColumns&&e.hideColumns([t])}handleSort(e,t){if(void 0!==t&&"function"==typeof e.sort){const r=e.getSortState?e.getSortState():null;let n="asc";r&&r.field===t&&(n="asc"===r.order?"desc":"normal"),e.sort({field:t,order:n})}}handleMergeCells(e){if(1===(e.stateManager.select.ranges?.length??0)&&"function"==typeof e.mergeCells){const{row:t,col:r}=e.stateManager.select.ranges[0].start,{row:n,col:i}=e.stateManager.select.ranges[0].end;if(r===i&&t===n)return;e.mergeCells(Math.min(r,i),Math.min(t,n),Math.max(r,i),Math.max(t,n))}}handleUnmergeCells(e){if(1===(e.stateManager.select.ranges?.length??0)&&"function"==typeof e.unmergeCells){const{row:t,col:r}=e.stateManager.select.ranges[0].start,{row:n,col:i}=e.stateManager.select.ranges[0].end;if(r===i&&t===n)return;e.unmergeCells(Math.min(r,i),Math.min(t,n),Math.max(r,i),Math.max(t,n))}}handleSetProtection(e){}handleFreezeToRow(e,t){void 0!==t&&(e.frozenRowCount=t+1)}handleFreezeToColumn(e,t){void 0!==t&&(e.frozenColCount=t+1)}handleFreezeToRowAndColumn(e,t,r){void 0!==t&&void 0!==r&&(e.frozenRowCount=t+1,e.frozenColCount=r+1)}handleUnfreeze(e){e.frozenRowCount=0,e.frozenColCount=0}release(){}}class zi{filterFuncRule=[];filterValueRule=[];pluginOptions;constructor(e){this.pluginOptions=e}applyFilter(e,t){const{filters:r}=e;this.filterFuncRule=[],this.filterValueRule=[],r.forEach(((e,t)=>{if(e.enable)if("byValue"===e.type)this.filterValueRule.push({filterKey:String(e.field),filteredValues:e.values});else if("byCondition"===e.type){const t=this.createFilterFunction(e);this.filterFuncRule.push({filterFunc:t,fieldId:String(e.field)})}})),t.updateFilterRules([...this.filterFuncRule,...this.filterValueRule],{clearRowHeightCache:!1,onFilterRecordsEnd:this.pluginOptions?.onFilterRecordsEnd})}createFilterFunction(e){const{field:t,operator:r,condition:n}=e;return r&&void 0!==n?e=>{const i=e[t];if(null==i)return!1;switch(r){case"equals":return 0===this.compareValues(i,n);case"notEquals":return 0!==this.compareValues(i,n);case"greaterThan":return this.compareValues(i,n)>0;case"lessThan":return this.compareValues(i,n)<0;case"greaterThanOrEqual":return this.compareValues(i,n)>=0;case"lessThanOrEqual":return this.compareValues(i,n)<=0;case"between":return!Array.isArray(n)||2!==n.length||this.compareValues(i,n[0])>=0&&this.compareValues(i,n[1])<=0;case"notBetween":return!Array.isArray(n)||2!==n.length||(this.compareValues(i,n[0])<0||this.compareValues(i,n[1])>0);case"contains":return String(i).toLowerCase().includes(String(n).toLowerCase());case"notContains":return!String(i).toLowerCase().includes(String(n).toLowerCase());case"startsWith":return String(i).toLowerCase().startsWith(String(n).toLowerCase());case"notStartsWith":return!String(i).toLowerCase().startsWith(String(n).toLowerCase());case"endsWith":return String(i).toLowerCase().endsWith(String(n).toLowerCase());case"notEndsWith":return!String(i).toLowerCase().endsWith(String(n).toLowerCase());case"isChecked":return!0===Boolean(i);case"isUnchecked":return!1===Boolean(i);default:return!0}}:()=>!0}compareValues(e,t){if("number"==typeof e&&"number"==typeof t)return e===t?0:e>t?1:-1;if("boolean"==typeof e&&"boolean"==typeof t)return e===t?0:-1;const r=String(e).toLowerCase(),n=String(t).toLowerCase();return isNaN(Number(r))||isNaN(Number(n))?r===n?0:r>n?1:-1:Number(r)===Number(n)?0:Number(r)>Number(n)?1:-1}clearAllFilter(e){this.filterFuncRule=[],this.filterValueRule=[],e.updateFilterRules([])}clearFilter(e,t){this.filterValueRule=this.filterValueRule.filter((e=>e.filterKey!==t)),this.filterFuncRule=this.filterFuncRule.filter((e=>e.fieldId!==t)),e.updateFilterRules([...this.filterFuncRule,...this.filterValueRule])}}e.FilterActionType=void 0,(Ai=e.FilterActionType||(e.FilterActionType={}))[Ai.ADD_FILTER=0]="ADD_FILTER",Ai[Ai.REMOVE_FILTER=1]="REMOVE_FILTER",Ai[Ai.UPDATE_FILTER=2]="UPDATE_FILTER",Ai[Ai.ENABLE_FILTER=3]="ENABLE_FILTER",Ai[Ai.DISABLE_FILTER=4]="DISABLE_FILTER",Ai[Ai.CLEAR_ALL_FILTERS=5]="CLEAR_ALL_FILTERS",Ai[Ai.APPLY_FILTERS=6]="APPLY_FILTERS",e.FilterOperatorCategory=void 0,(Mi=e.FilterOperatorCategory||(e.FilterOperatorCategory={})).ALL="all",Mi.TEXT="text",Mi.NUMBER="number",Mi.COLOR="color",Mi.CHECKBOX="checkbox",Mi.RADIO="radio";class Ui{state;engine;listeners=[];table;constructor(e,t){this.state={filters:new Map},this.engine=t,this.table=e}getFilterState(e){return this.state.filters.get(e)}getActiveFilterFields(){const e=[];return this.state.filters.forEach(((t,r)=>{t.enable&&e.push(r)})),e}getAllFilterStates(){return this.state}reapplyCurrentFilters(){this.getActiveFilterFields().length>0&&this.applyFilters()}dispatch(e){this.state=this.reduce(this.state,e),this.shouldApplyFilter(e)&&this.applyFilters(),this.notifyListeners(e)}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter((t=>t!==e))}}notifyListeners(e){this.listeners.forEach((t=>t(this.state,e)))}reduce(t,r){const{type:n,payload:i}=r,s=new Map(t.filters);switch(n){case e.FilterActionType.ADD_FILTER:i.shouldKeepUnrelatedState?s.set(i.field,{...s.get(i.field),...i}):s.set(i.field,i);break;case e.FilterActionType.REMOVE_FILTER:i.shouldKeepUnrelatedState&&"byValue"===i.type?(delete s.get(i.field).values,s.set(i.field,{...s.get(i.field),enable:!1})):i.shouldKeepUnrelatedState&&"byCondition"===i.type?(delete s.get(i.field).condition,delete s.get(i.field).operator,s.set(i.field,{...s.get(i.field),enable:!1})):s.delete(i.field);break;case e.FilterActionType.UPDATE_FILTER:s.set(i.field,{...s.get(i.field),...i});break;case e.FilterActionType.ENABLE_FILTER:s.set(i.field,{...s.get(i.field),enable:!0});break;case e.FilterActionType.DISABLE_FILTER:s.set(i.field,{...s.get(i.field),enable:!1});break;case e.FilterActionType.CLEAR_ALL_FILTERS:s.clear();break;case e.FilterActionType.APPLY_FILTERS:s.set(i.field,{...s.get(i.field),...i,enable:!0})}return{...t,filters:s}}applyFilters(){this.engine.applyFilter(this.state,this.table)}shouldApplyFilter(t){return[e.FilterActionType.REMOVE_FILTER,e.FilterActionType.ENABLE_FILTER,e.FilterActionType.DISABLE_FILTER,e.FilterActionType.CLEAR_ALL_FILTERS,e.FilterActionType.APPLY_FILTERS].includes(t.type)}}const Vi={filterMenu:{display:"none",position:"absolute",backgroundColor:"white",border:"1px solid #ccc",boxShadow:"0 4px 8px rgba(0,0,0,0.15)",zIndex:"99999"},filterPanel:{padding:"10px",display:"block"},searchContainer:{padding:"5px"},searchInput:{width:"100%",padding:"8px 10px",border:"1px solid #ccc",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box"},optionsContainer:{maxHeight:"200px",overflowY:"auto",marginTop:"10px"},optionItem:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 5px"},optionLabel:{display:"flex",alignItems:"center",cursor:"pointer",flexGrow:"1",fontWeight:"normal"},checkbox:{marginRight:"10px"},countSpan:{color:"#888",fontSize:"12px"},tabsContainer:{display:"flex",justifyContent:"space-around",borderBottom:"1px solid #e0e0e0"},tabStyle:e=>({backgroundColor:"transparent",border:"none",flex:"1",padding:"10px 15px",cursor:"pointer",fontSize:"14px",fontWeight:e?"bold":"normal",color:e?"#007bff":"#666",borderBottom:e?"3px solid #007bff":"2px solid transparent"}),footerContainer:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"10px 15px",borderTop:"1px solid #e0e0e0",backgroundColor:"#f8f9fa"},footerButton:e=>({padding:"6px 12px",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",marginLeft:"5px",backgroundColor:e?"#007bff":"white",color:e?"white":"#333",borderColor:e?"#007bff":"#ccc"}),clearLink:{color:"#007bff",textDecoration:"none"},buttonStyle:(e=!1)=>({padding:"6px 12px",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",marginLeft:"5px",backgroundColor:e?"#007bff":"white",color:e?"white":"#333",borderColor:e?"#007bff":"#ccc"}),conditionContainer:{marginBottom:"15px",padding:"10px"},formLabel:{display:"block",marginBottom:"8px",fontWeight:"bold"},operatorSelect:{width:"100%",padding:"8px",marginBottom:"15px",border:"1px solid #ccc",borderRadius:"4px",boxSizing:"border-box"},rangeInputContainer:{display:"flex",alignItems:"center",gap:"8px"},addLabel:{display:"none",padding:"0 5px"}};function Wi(e,t){Object.entries(t).forEach((([t,r])=>{e.style[t]=r}))}function $i(e,t={},r=[]){const n=document.createElement(e);return Object.entries(t).forEach((([e,t])=>{n.setAttribute(e,t)})),r.forEach((e=>{"string"==typeof e?n.appendChild(document.createTextNode(e)):n.appendChild(e)})),n}class qi{table;filterStateManager;pluginOptions;styles;selectedField;selectedKeys=new Map;candidateKeys=new Map;formatFnCache=new Map;toUnformattedCache=new Map;valueFilterOptionList=new Map;filterByValuePanel;searchContainer;optionsContainer;selectAllItemDiv;selectAllLabel;filterByValueSearchInput;selectAllCheckbox;totalCountSpan;filterItemsContainer;_onInputKeyUpHandler;_onCheckboxChangeHandler;constructor(e,t,r){this.table=e,this.filterStateManager=t,this.pluginOptions=r,this.styles=r.styles||{}}setSelectedField(e){this.selectedField=e}getFormatFnCache(e){let t=this.formatFnCache.get(e);if(null!=t)return t;const r=this.table.internalProps.layoutMap.getHeaderCellAddressByField(String(e)),n=this.table.internalProps.layoutMap.getBody(r?.col,r?.row);return t=n&&"fieldFormat"in n&&"function"==typeof n.fieldFormat?n.fieldFormat:n&&"format"in n&&"function"==typeof n.format?n.format:t=>t[e],this.formatFnCache.set(e,t),t}getRecords(e,t){if(!0===t)return e.internalProps.records;const r=[],n=[...e.internalProps.dataSource.records];for(;n.length>0;){const e=n.pop();if(e.vtableMerge&&Array.isArray(e.children))for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t]);else r.push(e)}return r.reverse()}collectCandidateKeysForUnfilteredColumn(e){const t=this.pluginOptions?.syncFilterItemsState??!0,r=new Map;let n=[];n=t?this.getRecords(this.table,!1):this.table.internalProps.records;const i=this.getFormatFnCache(e),s=new Map;n.forEach((t=>{if(f(t)){const n=t[e],o=i(t)??"(空白)";if(null!=o){r.set(o,(r.get(o)||0)+1);const e=s.get(o);null!=e?e.add(n):s.set(o,new Set([n]))}}})),this.candidateKeys.set(e,r),this.toUnformattedCache.set(e,s)}collectCandidateKeysForFilteredColumn(e){const t=this.pluginOptions?.syncFilterItemsState??!0,r=this.filterStateManager.getActiveFilterFields().filter((t=>t!==e)),n=new Map,i=this.getFormatFnCache(e),s=new Map;let o=[];if(t){o=this.getRecords(this.table,!0).filter((e=>r.every((t=>{const r=this.filterStateManager.getFilterState(t)?.type;"byValue"!==r&&null!=r&&this.syncSingleStateFromTableData(t);return this.selectedKeys.get(t).has(e[t])}))))}else o=this.table.internalProps.records;o.forEach((t=>{if(f(t)){const r=t[e],o=i(t)??"(空白)";if(s.set(o,(s.get(o)||0)+1),null!=o){const e=n.get(o);null!=e?e.add(r):n.set(o,new Set([r]))}}})),this.candidateKeys.set(e,s),this.toUnformattedCache.set(e,n)}toggleSelectAll(e,t){this.valueFilterOptionList.get(e).forEach((e=>{"none"!==e.itemContainer.style.display&&(e.checkbox.checked=t)}))}syncSelectAllCheckbox(e){const t=this.valueFilterOptionList.get(e)||[],r=t.every((e=>e.checkbox.checked)),n=t.every((e=>!e.checkbox.checked));this.selectAllCheckbox.checked=r,this.selectAllCheckbox.indeterminate=!r&&!n}onSearch(e,t){const r=this.valueFilterOptionList.get(e),n=t.toUpperCase().split(" ").filter((e=>e));for(const e of r){const t=e.id.toUpperCase()||"",r=n.some((e=>t.includes(e))),i=0===n.length||r;e.itemContainer.style.display=i?"flex":"none"}}syncSingleStateFromTableData(t){const r=new Set,n=new Set;this.table.internalProps.records.forEach((e=>{f(e)&&n.add(e[t])}));const i=this.pluginOptions?.syncFilterItemsState??!0,s=!w(Array.from(n),Array.from(r));if(i){if(s){this.selectedKeys.set(t,r),this.filterStateManager.dispatch({type:e.FilterActionType.UPDATE_FILTER,payload:{field:t,values:Array.from(r),enable:!0}});!w(Array.from(n),Array.from(r))&&(this.selectedKeys.set(t,r),this.filterStateManager.dispatch({type:e.FilterActionType.ADD_FILTER,payload:{field:t,type:"byValue",values:Array.from(r),enable:!0}}))}}else{const r=this.filterStateManager.getFilterState(t)?.values;if(r){!w(Array.from(n),r)&&(this.selectedKeys.set(t,new Set(r)),this.filterStateManager.dispatch({type:e.FilterActionType.ADD_FILTER,payload:{field:t,type:"byValue",values:r,enable:!0,shouldKeepUnrelatedState:!0}}))}else this.selectedKeys.set(t,n)}}applyFilter(t=this.selectedField){const r=this.valueFilterOptionList.get(t);if(!r||0===r.length)return;const n=r.map((e=>e.checkbox.checked?e.originalValue:null)).filter((e=>null!==e)).flat();this.selectedKeys.set(t,new Set(n));const i=this.pluginOptions?.syncFilterItemsState??!0;n.length>=0&&n.length<this.valueFilterOptionList.get(t).length||!i?this.filterStateManager.dispatch({type:e.FilterActionType.APPLY_FILTERS,payload:{field:t,type:"byValue",values:n,enable:!0,shouldKeepUnrelatedState:!i}}):this.filterStateManager.dispatch({type:e.FilterActionType.REMOVE_FILTER,payload:{field:t,type:"byValue"}})}clearFilter(t){this.filterStateManager.dispatch({type:e.FilterActionType.REMOVE_FILTER,payload:{field:t}}),this.hide()}render(e){const t=this.styles;this.filterByValuePanel=document.createElement("div"),Wi(this.filterByValuePanel,t.filterPanel),this.searchContainer=document.createElement("div"),Wi(this.searchContainer,this.styles.searchContainer),this.filterByValueSearchInput=document.createElement("input"),this.filterByValueSearchInput.type="text",this.filterByValueSearchInput.placeholder=t.searchInput?.placeholder||"可使用空格分隔多个关键词",Wi(this.filterByValueSearchInput,t.searchInput),this.searchContainer.appendChild(this.filterByValueSearchInput),this.optionsContainer=document.createElement("div"),Wi(this.optionsContainer,this.styles.optionsContainer),this.selectAllItemDiv=document.createElement("div"),Wi(this.selectAllItemDiv,this.styles.optionItem),this.selectAllLabel=document.createElement("label"),Wi(this.selectAllLabel,this.styles.optionLabel),this.selectAllCheckbox=document.createElement("input"),this.selectAllCheckbox.type="checkbox",this.selectAllCheckbox.checked=!0,Wi(this.selectAllCheckbox,t.checkbox),this.totalCountSpan=document.createElement("span"),this.totalCountSpan.textContent="",Wi(this.totalCountSpan,t.countSpan),this.selectAllLabel.append(this.selectAllCheckbox," 全选"),this.selectAllItemDiv.appendChild(this.selectAllLabel),this.filterItemsContainer=document.createElement("div"),this.optionsContainer.append(this.selectAllItemDiv,this.filterItemsContainer),this.filterByValuePanel.append(this.searchContainer,this.optionsContainer),e.appendChild(this.filterByValuePanel),this.bindEventForFilterByValue()}updateStyles(e){Wi(this.filterByValuePanel,e.filterPanel),Wi(this.searchContainer,e.searchContainer),this.filterByValueSearchInput.placeholder=e.searchInput?.placeholder||"可使用空格分隔多个关键词",Wi(this.filterByValueSearchInput,e.searchInput),Wi(this.optionsContainer,e.optionsContainer),Wi(this.selectAllItemDiv,e.optionItem),Wi(this.selectAllLabel,e.optionLabel),Wi(this.selectAllCheckbox,e.checkbox)}renderFilterOptions(e){const t=this.styles;this.filterItemsContainer.innerHTML="",this.valueFilterOptionList.delete(e),this.valueFilterOptionList.set(e,[]);let r=0,n=!0,i=!0;const s=this.selectedKeys.get(e),o=[],a=this.filterStateManager.getFilterState(e)?.enable,l=this.toUnformattedCache.get(e),c=this.candidateKeys.get(e);if(!c||0===c.size)return;const h=[...c.entries()],u="number"==typeof h[0][0]?[...h]?.sort((([e],[t])=>Number(e)-Number(t))):[...h]?.sort((([e],[t])=>String(e).localeCompare(String(t))));u?.forEach((([e,c])=>{r+=c;const h=Array.from(l.get(e)||new Set),u=document.createElement("div");Wi(u,t.optionItem),u.style.display="flex";const f=document.createElement("label");Wi(f,t.optionLabel);const d=document.createElement("input");d.type="checkbox",d.value=String(e),d.checked=!a||h.some((e=>s?.has(e))),Wi(d,t.checkbox),d.checked?i=!1:n=!1;const p=document.createElement("span");p.textContent=String(c),Wi(p,t.countSpan),f.append(d,` ${this.pluginOptions.checkboxItemFormat?.(e,h)||e}`),u.append(f,p),this.filterItemsContainer.appendChild(u);const m={id:String(e),originalValue:h,itemContainer:u,checkbox:d,countSpan:p};o.push(m)})),this.valueFilterOptionList.set(e,o),this.selectAllCheckbox.checked=n,this.selectAllCheckbox.indeterminate=!n&&!i,this.totalCountSpan.textContent=String(r)}bindEventForFilterByValue(){this._onInputKeyUpHandler=e=>{const t=e.target;if(t instanceof HTMLInputElement&&"text"===t.type){const e=t.value;this.onSearch(this.selectedField,e)}},this._onCheckboxChangeHandler=e=>{const t=e.target;t instanceof HTMLInputElement&&"checkbox"===t.type&&(t===this.selectAllCheckbox?this.toggleSelectAll(this.selectedField,this.selectAllCheckbox.checked):this.syncSelectAllCheckbox(this.selectedField))},this.filterByValuePanel.addEventListener("keyup",this._onInputKeyUpHandler),this.filterByValuePanel.addEventListener("change",this._onCheckboxChangeHandler)}show(){const e=this.filterStateManager.getFilterState(this.selectedField)?.enable;e?this.collectCandidateKeysForFilteredColumn(this.selectedField):this.collectCandidateKeysForUnfilteredColumn(this.selectedField);const t=this.filterStateManager.getFilterState(this.selectedField)?.type;null!=t&&"byValue"!==t&&this.syncSingleStateFromTableData(this.selectedField),this.filterByValueSearchInput&&(this.filterByValueSearchInput.value=""),this.renderFilterOptions(this.selectedField),this.filterByValuePanel.style.display="block"}hide(){this.filterByValuePanel.style.display="none"}clearSearchInputValue(){this.filterByValueSearchInput.value=""}destroy(){if(this.filterByValuePanel&&(this._onInputKeyUpHandler&&this.filterByValuePanel.removeEventListener("keyup",this._onInputKeyUpHandler),this._onCheckboxChangeHandler&&this.filterByValuePanel.removeEventListener("change",this._onCheckboxChangeHandler)),this._onInputKeyUpHandler=void 0,this._onCheckboxChangeHandler=void 0,this.filterByValuePanel){const e=this.filterByValuePanel.parentElement;e?e.removeChild(this.filterByValuePanel):this.filterByValuePanel.remove()}this.filterItemsContainer&&(this.filterItemsContainer.innerHTML=""),this.filterByValueSearchInput&&(this.filterByValueSearchInput.value=""),this.selectedKeys&&this.selectedKeys.clear(),this.candidateKeys&&this.candidateKeys.clear(),this.formatFnCache&&this.formatFnCache.clear(),this.toUnformattedCache&&this.toUnformattedCache.clear(),this.valueFilterOptionList&&this.valueFilterOptionList.clear(),this.filterByValuePanel=void 0,this.filterByValueSearchInput=void 0,this.selectAllCheckbox=void 0,this.totalCountSpan=void 0,this.filterItemsContainer=void 0}}const Ki=[{value:e.FilterOperatorCategory.ALL,label:"全部"},{value:e.FilterOperatorCategory.TEXT,label:"文本"},{value:e.FilterOperatorCategory.NUMBER,label:"数值"},{value:e.FilterOperatorCategory.COLOR,label:"颜色"},{value:e.FilterOperatorCategory.CHECKBOX,label:"复选框"},{value:e.FilterOperatorCategory.RADIO,label:"单选框"}],Yi=[{value:"equals",label:"等于",category:e.FilterOperatorCategory.ALL},{value:"notEquals",label:"不等于",category:e.FilterOperatorCategory.ALL},{value:"equals",label:"等于",category:e.FilterOperatorCategory.NUMBER},{value:"notEquals",label:"不等于",category:e.FilterOperatorCategory.NUMBER},{value:"greaterThan",label:"大于",category:e.FilterOperatorCategory.NUMBER},{value:"lessThan",label:"小于",category:e.FilterOperatorCategory.NUMBER},{value:"greaterThanOrEqual",label:"大于等于",category:e.FilterOperatorCategory.NUMBER},{value:"lessThanOrEqual",label:"小于等于",category:e.FilterOperatorCategory.NUMBER},{value:"between",label:"介于",category:e.FilterOperatorCategory.NUMBER},{value:"notBetween",label:"不介于",category:e.FilterOperatorCategory.NUMBER},{value:"equals",label:"等于",category:e.FilterOperatorCategory.TEXT},{value:"notEquals",label:"不等于",category:e.FilterOperatorCategory.TEXT},{value:"contains",label:"包含",category:e.FilterOperatorCategory.TEXT},{value:"notContains",label:"不包含",category:e.FilterOperatorCategory.TEXT},{value:"startsWith",label:"开头是",category:e.FilterOperatorCategory.TEXT},{value:"notStartsWith",label:"开头不是",category:e.FilterOperatorCategory.TEXT},{value:"endsWith",label:"结尾是",category:e.FilterOperatorCategory.TEXT},{value:"notEndsWith",label:"结尾不是",category:e.FilterOperatorCategory.TEXT},{value:"equals",label:"等于",category:e.FilterOperatorCategory.COLOR},{value:"notEquals",label:"不等于",category:e.FilterOperatorCategory.COLOR},{value:"isChecked",label:"已选中",category:e.FilterOperatorCategory.CHECKBOX},{value:"isUnchecked",label:"未选中",category:e.FilterOperatorCategory.CHECKBOX},{value:"isChecked",label:"已选中",category:e.FilterOperatorCategory.RADIO},{value:"isUnchecked",label:"未选中",category:e.FilterOperatorCategory.RADIO}];class Xi{table;filterStateManager;pluginOptions;filterToolBarHide;styles;filterByConditionPanel;conditionContainer;categoryLabel;selectedField;operatorSelect;valueInput;andLabel;valueInputMax;categorySelect;operatorLabel;rangeInputContainer;valueLabel;currentCategory=e.FilterOperatorCategory.ALL;categories=[];operators=[];constructor(e,t,r,n){this.table=e,this.filterStateManager=t,this.pluginOptions=r,this.styles=r.styles||{},this.categories=r.conditionCategories,this.operators=Yi,this.filterToolBarHide=n}setSelectedField(e){this.selectedField=e,this.updateOperatorOptions(),this.loadCurrentFilterState()}updateOperatorOptions(){if(!this.operatorSelect)return;let t;if(this.operatorSelect.innerHTML="",this.currentCategory===e.FilterOperatorCategory.ALL){const e=new Map;this.operators.filter((e=>this.categories.map((e=>e.value)).includes(e.category))).forEach((t=>{e.has(t.value)||e.set(t.value,t)})),t=Array.from(e.values())}else t=this.operators.filter((e=>e.category===this.currentCategory));t.forEach((e=>{const t=document.createElement("option");t.value=e.value,t.textContent=e.label,this.operatorSelect.appendChild(t)}))}handleCategoryChange(){this.categorySelect&&(this.currentCategory=this.categorySelect.value,this.updateOperatorOptions(),this.syncUIState())}loadCurrentFilterState(){const e=this.filterStateManager.getFilterState(this.selectedField),t=this.pluginOptions?.syncFilterItemsState??!0;e&&"byCondition"===e.type||!t?(this.operatorSelect&&(this.operatorSelect.value=e?.operator??Yi[0].value),this.valueInput&&(Array.isArray(e?.condition)?(this.valueInput.value=String(e.condition[0]),this.valueInputMax&&(this.valueInputMax.value=String(e.condition[1]))):(this.valueInput.value=String(e?.condition??""),this.valueInputMax&&(this.valueInputMax.value=""))),this.syncUIState()):this.reset()}reset(){this.operatorSelect&&(this.operatorSelect.selectedIndex=0),this.valueInput&&(this.valueInput.value="",this.valueInput.placeholder="请输入筛选值"),this.valueInputMax&&(this.valueInputMax.value=""),this.currentCategory=e.FilterOperatorCategory.ALL,this.categorySelect&&(this.categorySelect.value=e.FilterOperatorCategory.ALL),this.updateOperatorOptions(),this.syncUIState()}syncUIState(){if(!this.operatorSelect||!this.valueInput)return;const e=this.operatorSelect.value,t=this.valueInput.nextElementSibling;this.isRangeOperator(e)?(this.valueInput.placeholder="最小值",this.valueInputMax&&(this.valueInputMax.style.display="inline-block"),t&&(t.style.display="inline-block")):(this.valueInput.placeholder="请输入筛选值",this.valueInputMax&&(this.valueInputMax.style.display="none"),t&&(t.style.display="none"))}isBooleanOperator(e){return["isChecked","isUnchecked"].includes(e)}isRangeOperator(e){return"between"===e||"notBetween"===e}applyFilter(t=this.selectedField){if(!this.operatorSelect||!this.valueInput)return;const r=this.operatorSelect?.value;let n=this.valueInput?.value;if(this.currentCategory===e.FilterOperatorCategory.NUMBER&&(n=parseFloat(n),isNaN(n)))return;if(this.isRangeOperator(r)){const t=n;let r=this.valueInputMax.value.trim();if(this.currentCategory===e.FilterOperatorCategory.NUMBER){const e=parseFloat(r);if(isNaN(e))return;r=e}n=[t,r]}if(!n&&!1!==n&&0!==n&&!this.isBooleanOperator(r))return void this.clearFilter(t);const i=this.pluginOptions?.syncFilterItemsState??!0;this.filterStateManager.dispatch({type:e.FilterActionType.APPLY_FILTERS,payload:{field:t,type:"byCondition",operator:r,condition:n,enable:!0,shouldKeepUnrelatedState:!i}})}clearFilter(t){this.filterStateManager.dispatch({type:e.FilterActionType.REMOVE_FILTER,payload:{field:t}}),this.hide()}render(e){const t=this.styles;this.filterByConditionPanel=document.createElement("div"),Wi(this.filterByConditionPanel,t.filterPanel),this.conditionContainer=document.createElement("div"),Wi(this.conditionContainer,this.styles.conditionContainer),this.categoryLabel=$i("label",{},["筛选类型:"]),Wi(this.categoryLabel,this.styles.formLabel),this.categorySelect=$i("select"),Wi(this.categorySelect,t.operatorSelect),this.categories.forEach((e=>{const t=document.createElement("option");t.value=e.value,t.textContent=e.label,this.categorySelect.appendChild(t)})),this.operatorLabel=$i("label",{},["筛选条件:"]),Wi(this.operatorLabel,this.styles.formLabel),this.operatorSelect=$i("select"),Wi(this.operatorSelect,t.operatorSelect),this.valueLabel=$i("label",{},["筛选值:"]),Wi(this.valueLabel,this.styles.formLabel),this.rangeInputContainer=$i("div"),Wi(this.rangeInputContainer,this.styles.rangeInputContainer),this.valueInput=$i("input",{type:"text",placeholder:"请输入筛选值"}),Wi(this.valueInput,t.searchInput),this.andLabel=$i("span",{},["和"]),Wi(this.andLabel,this.styles.addLabel),this.andLabel.style.display="none",this.valueInputMax=$i("input",{type:"text",placeholder:"最大值"}),Wi(this.valueInputMax,t.searchInput),this.valueInputMax.style.display="none",this.rangeInputContainer.appendChild(this.valueInput),this.rangeInputContainer.appendChild(this.andLabel),this.rangeInputContainer.appendChild(this.valueInputMax),this.conditionContainer.appendChild(this.categoryLabel),this.conditionContainer.appendChild(this.categorySelect),this.conditionContainer.appendChild(this.operatorLabel),this.conditionContainer.appendChild(this.operatorSelect),this.conditionContainer.appendChild(this.valueLabel),this.conditionContainer.appendChild(this.rangeInputContainer),this.filterByConditionPanel.appendChild(this.conditionContainer),e.appendChild(this.filterByConditionPanel),this.hide(),this.updateOperatorOptions(),this.bindEvents()}updateStyles(e){Wi(this.filterByConditionPanel,e.filterPanel),Wi(this.conditionContainer,e.conditionContainer),Wi(this.categoryLabel,e.formLabel),Wi(this.categorySelect,e.operatorSelect),Wi(this.operatorLabel,e.formLabel),Wi(this.operatorSelect,e.operatorSelect),Wi(this.valueLabel,e.formLabel),Wi(this.rangeInputContainer,e.rangeInputContainer),Wi(this.valueInput,e.searchInput),Wi(this.andLabel,e.addLabel),Wi(this.valueInputMax,e.searchInput)}bindEvents(){this.valueInput.addEventListener("keypress",(e=>{"Enter"===e.key&&(this.applyFilter(),this.filterToolBarHide())})),this.valueInputMax.addEventListener("keypress",(e=>{"Enter"===e.key&&(this.applyFilter(),this.filterToolBarHide())})),this.categorySelect.addEventListener("change",(()=>{this.handleCategoryChange()})),this.operatorSelect.addEventListener("change",(()=>{const e=this.operatorSelect.value,t=this.valueInput.nextElementSibling;this.isRangeOperator(e)?(this.valueInput.placeholder="最小值",this.valueInputMax.style.display="inline-block",t.style.display="inline-block"):(this.valueInput.placeholder="请输入筛选值",this.valueInputMax.style.display="none",t.style.display="none")}))}show(){this.filterByConditionPanel&&(this.filterByConditionPanel.style.display="block",this.loadCurrentFilterState())}hide(){this.filterByConditionPanel&&(this.filterByConditionPanel.style.display="none")}}class Gi{table;filterStateManager;pluginOptions;valueFilter=null;conditionFilter=null;activeTab="byValue";isVisible=!1;selectedField=null;filterModes=[];filterMenu;filterTabsContainer;filterMenuWidth;currentCol;currentRow;filterTabByValue;filterTabByCondition;footerContainer;clearFilterOptionLink;cancelFilterButton;applyFilterButton;constructor(e,t,r){this.table=e,this.filterStateManager=t,this.valueFilter=new qi(this.table,this.filterStateManager,r),this.conditionFilter=new Xi(this.table,this.filterStateManager,r,this.hide),this.pluginOptions=r,this.filterMenuWidth=300,this.filterStateManager.subscribe((e=>{this.isVisible&&null!==this.selectedField&&this.updateClearFilterButtonState(this.selectedField)}))}onTabSwitch(e){this.activeTab=e,"byValue"===e?(this.valueFilter.show(),this.conditionFilter.hide()):(this.conditionFilter.show(),this.valueFilter.hide());const t="byValue"===e;Wi(this.filterTabByValue,Vi.tabStyle(t)),Wi(this.filterTabByCondition,Vi.tabStyle(!t))}updateSelectedField(e){this.selectedField=e,this.valueFilter&&this.valueFilter.setSelectedField(e),this.conditionFilter&&this.conditionFilter.setSelectedField(e)}applyFilter(e){"byValue"===this.activeTab?this.valueFilter.applyFilter(e):"byCondition"===this.activeTab&&this.conditionFilter.applyFilter(e),this.hide()}clearFilter(e){this.valueFilter&&this.valueFilter.clearFilter(e),this.conditionFilter&&this.conditionFilter.clearFilter(e),this.hide()}updateClearFilterButtonState(e){const t=this.filterStateManager.getFilterState(e),r=t&&t.enable;this.clearFilterOptionLink.style.display="inline",this.clearFilterOptionLink.style.opacity=r?"1":"0.5",this.clearFilterOptionLink.style.pointerEvents=r?"auto":"none",this.clearFilterOptionLink.style.cursor=r?"pointer":"not-allowed"}render(e){const t=this.pluginOptions.styles||{};this.filterMenu=document.createElement("div"),this.filterMenu.classList.add("vtable-filter-menu"),Wi(this.filterMenu,t.filterMenu),this.filterMenu.style.width=`${this.filterMenuWidth}px`,this.filterTabsContainer=document.createElement("div"),Wi(this.filterTabsContainer,t.tabsContainer),this.filterTabByValue=document.createElement("button"),this.filterTabByValue.innerText="按值筛选",Wi(this.filterTabByValue,t.tabStyle(!0)),this.filterTabByCondition=document.createElement("button"),this.filterTabByCondition.innerText="按条件筛选",Wi(this.filterTabByCondition,t.tabStyle(!1)),this.filterTabsContainer.append(this.filterTabByValue,this.filterTabByCondition),this.footerContainer=document.createElement("div"),Wi(this.footerContainer,t.footerContainer),this.clearFilterOptionLink=document.createElement("a"),this.clearFilterOptionLink.href="#",this.clearFilterOptionLink.innerText="清除筛选",Wi(this.clearFilterOptionLink,t.clearLink);const r=document.createElement("div");this.cancelFilterButton=document.createElement("button"),this.cancelFilterButton.innerText="取消",Wi(this.cancelFilterButton,t.footerButton(!1)),this.applyFilterButton=document.createElement("button"),this.applyFilterButton.innerText="确认",Wi(this.applyFilterButton,t.footerButton(!0)),r.append(this.cancelFilterButton,this.applyFilterButton),this.footerContainer.append(this.clearFilterOptionLink,r),this.filterMenu.append(this.filterTabsContainer),this.valueFilter.render(this.filterMenu),this.conditionFilter.render(this.filterMenu),this.filterMenu.append(this.footerContainer),e.appendChild(this.filterMenu),this.attachEventListeners()}updateStyles(e){const t=(this.filterMenu.style.display??e.filterMenu.display)||"none";Wi(this.filterMenu,{...e.filterMenu,display:t}),Wi(this.filterTabsContainer,e.tabsContainer),Wi(this.filterTabByValue,e.tabStyle(!0)),Wi(this.footerContainer,e.footerContainer),Wi(this.clearFilterOptionLink,e.clearLink),Wi(this.cancelFilterButton,e.footerButton(!1)),Wi(this.applyFilterButton,e.footerButton(!0)),this.valueFilter.updateStyles(e),this.conditionFilter.updateStyles(e);const r=this.filterStateManager.getFilterState(this.selectedField);r&&"byCondition"===r.type?this.onTabSwitch("byCondition"):this.onTabSwitch("byValue")}attachEventListeners(){this.filterTabByValue.addEventListener("click",(()=>{this.onTabSwitch("byValue")})),this.filterTabByCondition.addEventListener("click",(()=>{this.onTabSwitch("byCondition")})),this.cancelFilterButton.addEventListener("click",(()=>this.hide())),this.clearFilterOptionLink.addEventListener("click",(e=>{e.preventDefault(),this.clearFilter(this.selectedField)})),this.applyFilterButton.addEventListener("click",(()=>{this.applyFilter(this.selectedField)})),document.addEventListener("click",(()=>{this.isVisible&&this.hide()})),this.filterMenu.addEventListener("click",(e=>{e.stopPropagation()}))}adjustMenuPosition(e,t,r,n){if("number"==typeof r&&"number"==typeof n)return this.filterMenu.style.display=this.isVisible?"block":"none",this.filterMenu.style.left=`${r}px`,void(this.filterMenu.style.top=`${n}px`);const i="number"==typeof e?e:this.currentCol,s="number"==typeof t?t:this.currentRow;if("number"!=typeof i||"number"!=typeof s)return;this.currentCol=i,this.currentRow=s;let o=0,a=0;const l=this.table.canvas.getBoundingClientRect(),c=this.table.getCellRelativeRect(i,s),h=this.filterMenuWidth;c.right<this.filterMenuWidth?(o=c.left+l.left,a=c.bottom+l.top):(o=c.right+l.left-this.filterMenuWidth,a=c.bottom+l.top),o=Math.max(0,Math.min(window.innerWidth-h,o)),a=Math.max(0,Math.min(window.innerHeight-380,a)),this.filterMenu.style.display=this.isVisible?"block":"none",this.filterMenu.style.left=`${o}px`,this.filterMenu.style.top=`${a}px`}show(e,t,n){this.valueFilter.clearSearchInputValue(),this.filterModes=n,this.filterModes.includes("byValue")?this.filterModes.includes("byCondition")||(this.filterTabByCondition.style.display="none",this.onTabSwitch("byValue")):(this.filterTabByValue.style.display="none",this.onTabSwitch("byCondition")),this.adjustMenuPosition(e,t),this.filterMenu.style.display="block";const i=this.table.internalProps.layoutMap.getHeaderField(e,t);this.updateSelectedField(i);const s=this.filterStateManager.getFilterState(i);s&&"byCondition"===s.type?this.onTabSwitch("byCondition"):this.onTabSwitch("byValue"),this.updateClearFilterButtonState(i),setTimeout((()=>{this.isVisible=!0,this.table.fireListeners(r.TABLE_EVENT_TYPE.FILTER_MENU_SHOW,{col:e,row:t})}),0)}hide=(e,t)=>{this.filterMenu.style.display="none",this.isVisible=!1,this.table.fireListeners(r.TABLE_EVENT_TYPE.FILTER_MENU_HIDE,{col:e??this.currentCol,row:t??this.currentRow})};destroy(){this.valueFilter.destroy(),this.filterMenu.remove()}}var Zi={exports:{}};!function(e,t){(function(){var r,n="Expected a function",i="__lodash_hash_undefined__",s="__lodash_placeholder__",o=16,l=32,c=64,h=128,u=256,f=1/0,d=9007199254740991,p=NaN,m=4294967295,b=[["ary",h],["bind",1],["bindKey",2],["curry",8],["curryRight",o],["flip",512],["partial",l],["partialRight",c],["rearg",u]],g="[object Arguments]",y="[object Array]",v="[object Boolean]",w="[object Date]",_="[object Error]",x="[object Function]",C="[object GeneratorFunction]",E="[object Map]",S="[object Number]",T="[object Object]",R="[object Promise]",k="[object RegExp]",A="[object Set]",M="[object String]",O="[object Symbol]",I="[object WeakMap]",N="[object ArrayBuffer]",F="[object DataView]",P="[object Float32Array]",j="[object Float64Array]",L="[object Int8Array]",D="[object Int16Array]",B="[object Int32Array]",H="[object Uint8Array]",z="[object Uint8ClampedArray]",U="[object Uint16Array]",V="[object Uint32Array]",W=/\b__p \+= '';/g,$=/\b(__p \+=) '' \+/g,q=/(__e\(.*?\)|\b__t\)) \+\n'';/g,K=/&(?:amp|lt|gt|quot|#39);/g,Y=/[&<>"']/g,X=RegExp(K.source),G=RegExp(Y.source),Z=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,ee=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,te=/^\w*$/,re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ne=/[\\^$.*+?()[\]{}|]/g,ie=RegExp(ne.source),se=/^\s+/,oe=/\s/,ae=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,le=/\{\n\/\* \[wrapped with (.+)\] \*/,ce=/,? & /,he=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,fe=/\\(\\)?/g,de=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,me=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,ge=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,ve=/^(?:0|[1-9]\d*)$/,we=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,xe=/['\n\r\u2028\u2029\\]/g,Ce="\\ud800-\\udfff",Ee="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Se="\\u2700-\\u27bf",Te="a-z\\xdf-\\xf6\\xf8-\\xff",Re="A-Z\\xc0-\\xd6\\xd8-\\xde",ke="\\ufe0e\\ufe0f",Ae="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Me="['’]",Oe="["+Ce+"]",Ie="["+Ae+"]",Ne="["+Ee+"]",Fe="\\d+",Pe="["+Se+"]",je="["+Te+"]",Le="[^"+Ce+Ae+Fe+Se+Te+Re+"]",De="\\ud83c[\\udffb-\\udfff]",Be="[^"+Ce+"]",He="(?:\\ud83c[\\udde6-\\uddff]){2}",ze="[\\ud800-\\udbff][\\udc00-\\udfff]",Ue="["+Re+"]",Ve="\\u200d",We="(?:"+je+"|"+Le+")",$e="(?:"+Ue+"|"+Le+")",qe="(?:['’](?:d|ll|m|re|s|t|ve))?",Ke="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ye="(?:"+Ne+"|"+De+")"+"?",Xe="["+ke+"]?",Ge=Xe+Ye+("(?:"+Ve+"(?:"+[Be,He,ze].join("|")+")"+Xe+Ye+")*"),Ze="(?:"+[Pe,He,ze].join("|")+")"+Ge,Je="(?:"+[Be+Ne+"?",Ne,He,ze,Oe].join("|")+")",Qe=RegExp(Me,"g"),et=RegExp(Ne,"g"),tt=RegExp(De+"(?="+De+")|"+Je+Ge,"g"),rt=RegExp([Ue+"?"+je+"+"+qe+"(?="+[Ie,Ue,"$"].join("|")+")",$e+"+"+Ke+"(?="+[Ie,Ue+We,"$"].join("|")+")",Ue+"?"+We+"+"+qe,Ue+"+"+Ke,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fe,Ze].join("|"),"g"),nt=RegExp("["+Ve+Ce+Ee+ke+"]"),it=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,st=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ot=-1,at={};at[P]=at[j]=at[L]=at[D]=at[B]=at[H]=at[z]=at[U]=at[V]=!0,at[g]=at[y]=at[N]=at[v]=at[F]=at[w]=at[_]=at[x]=at[E]=at[S]=at[T]=at[k]=at[A]=at[M]=at[I]=!1;var lt={};lt[g]=lt[y]=lt[N]=lt[F]=lt[v]=lt[w]=lt[P]=lt[j]=lt[L]=lt[D]=lt[B]=lt[E]=lt[S]=lt[T]=lt[k]=lt[A]=lt[M]=lt[O]=lt[H]=lt[z]=lt[U]=lt[V]=!0,lt[_]=lt[x]=lt[I]=!1;var ct={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ht=parseFloat,ut=parseInt,ft="object"==typeof a&&a&&a.Object===Object&&a,dt="object"==typeof self&&self&&self.Object===Object&&self,pt=ft||dt||Function("return this")(),mt=t&&!t.nodeType&&t,bt=mt&&e&&!e.nodeType&&e,gt=bt&&bt.exports===mt,yt=gt&&ft.process,vt=function(){try{var e=bt&&bt.require&&bt.require("util").types;return e||yt&&yt.binding&&yt.binding("util")}catch(e){}}(),wt=vt&&vt.isArrayBuffer,_t=vt&&vt.isDate,xt=vt&&vt.isMap,Ct=vt&&vt.isRegExp,Et=vt&&vt.isSet,St=vt&&vt.isTypedArray;function Tt(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function Rt(e,t,r,n){for(var i=-1,s=null==e?0:e.length;++i<s;){var o=e[i];t(n,o,r(o),e)}return n}function kt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function At(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function Mt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function Ot(e,t){for(var r=-1,n=null==e?0:e.length,i=0,s=[];++r<n;){var o=e[r];t(o,r,e)&&(s[i++]=o)}return s}function It(e,t){return!!(null==e?0:e.length)&&Ut(e,t,0)>-1}function Nt(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function Ft(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function Pt(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function jt(e,t,r,n){var i=-1,s=null==e?0:e.length;for(n&&s&&(r=e[++i]);++i<s;)r=t(r,e[i],i,e);return r}function Lt(e,t,r,n){var i=null==e?0:e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}function Dt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Bt=qt("length");function Ht(e,t,r){var n;return r(e,(function(e,r,i){if(t(e,r,i))return n=r,!1})),n}function zt(e,t,r,n){for(var i=e.length,s=r+(n?1:-1);n?s--:++s<i;)if(t(e[s],s,e))return s;return-1}function Ut(e,t,r){return t==t?function(e,t,r){var n=r-1,i=e.length;for(;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):zt(e,Wt,r)}function Vt(e,t,r,n){for(var i=r-1,s=e.length;++i<s;)if(n(e[i],t))return i;return-1}function Wt(e){return e!=e}function $t(e,t){var r=null==e?0:e.length;return r?Xt(e,t)/r:p}function qt(e){return function(t){return null==t?r:t[e]}}function Kt(e){return function(t){return null==e?r:e[t]}}function Yt(e,t,r,n,i){return i(e,(function(e,i,s){r=n?(n=!1,e):t(r,e,i,s)})),r}function Xt(e,t){for(var n,i=-1,s=e.length;++i<s;){var o=t(e[i]);o!==r&&(n=n===r?o:n+o)}return n}function Gt(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Zt(e){return e?e.slice(0,pr(e)+1).replace(se,""):e}function Jt(e){return function(t){return e(t)}}function Qt(e,t){return Ft(t,(function(t){return e[t]}))}function er(e,t){return e.has(t)}function tr(e,t){for(var r=-1,n=e.length;++r<n&&Ut(t,e[r],0)>-1;);return r}function rr(e,t){for(var r=e.length;r--&&Ut(t,e[r],0)>-1;);return r}var nr=Kt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ir=Kt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function sr(e){return"\\"+ct[e]}function or(e){return nt.test(e)}function ar(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function lr(e,t){return function(r){return e(t(r))}}function cr(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r];a!==t&&a!==s||(e[r]=s,o[i++]=r)}return o}function hr(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}function ur(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=[e,e]})),r}function fr(e){return or(e)?function(e){var t=tt.lastIndex=0;for(;tt.test(e);)++t;return t}(e):Bt(e)}function dr(e){return or(e)?function(e){return e.match(tt)||[]}(e):function(e){return e.split("")}(e)}function pr(e){for(var t=e.length;t--&&oe.test(e.charAt(t)););return t}var mr=Kt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var br=function e(t){var a=(t=null==t?pt:br.defaults(pt.Object(),t,br.pick(pt,st))).Array,oe=t.Date,Ce=t.Error,Ee=t.Function,Se=t.Math,Te=t.Object,Re=t.RegExp,ke=t.String,Ae=t.TypeError,Me=a.prototype,Oe=Ee.prototype,Ie=Te.prototype,Ne=t["__core-js_shared__"],Fe=Oe.toString,Pe=Ie.hasOwnProperty,je=0,Le=function(){var e=/[^.]+$/.exec(Ne&&Ne.keys&&Ne.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),De=Ie.toString,Be=Fe.call(Te),He=pt._,ze=Re("^"+Fe.call(Pe).replace(ne,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=gt?t.Buffer:r,Ve=t.Symbol,We=t.Uint8Array,$e=Ue?Ue.allocUnsafe:r,qe=lr(Te.getPrototypeOf,Te),Ke=Te.create,Ye=Ie.propertyIsEnumerable,Xe=Me.splice,Ge=Ve?Ve.isConcatSpreadable:r,Ze=Ve?Ve.iterator:r,Je=Ve?Ve.toStringTag:r,tt=function(){try{var e=us(Te,"defineProperty");return e({},"",{}),e}catch(e){}}(),nt=t.clearTimeout!==pt.clearTimeout&&t.clearTimeout,ct=oe&&oe.now!==pt.Date.now&&oe.now,ft=t.setTimeout!==pt.setTimeout&&t.setTimeout,dt=Se.ceil,mt=Se.floor,bt=Te.getOwnPropertySymbols,yt=Ue?Ue.isBuffer:r,vt=t.isFinite,Bt=Me.join,Kt=lr(Te.keys,Te),gr=Se.max,yr=Se.min,vr=oe.now,wr=t.parseInt,_r=Se.random,xr=Me.reverse,Cr=us(t,"DataView"),Er=us(t,"Map"),Sr=us(t,"Promise"),Tr=us(t,"Set"),Rr=us(t,"WeakMap"),kr=us(Te,"create"),Ar=Rr&&new Rr,Mr={},Or=Ls(Cr),Ir=Ls(Er),Nr=Ls(Sr),Fr=Ls(Tr),Pr=Ls(Rr),jr=Ve?Ve.prototype:r,Lr=jr?jr.valueOf:r,Dr=jr?jr.toString:r;function Br(e){if(ta(e)&&!Wo(e)&&!(e instanceof Vr)){if(e instanceof Ur)return e;if(Pe.call(e,"__wrapped__"))return Ds(e)}return new Ur(e)}var Hr=function(){function e(){}return function(t){if(!ea(t))return{};if(Ke)return Ke(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function zr(){}function Ur(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function Vr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Wr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function $r(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function qr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Kr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new qr;++t<r;)this.add(e[t])}function Yr(e){var t=this.__data__=new $r(e);this.size=t.size}function Xr(e,t){var r=Wo(e),n=!r&&Vo(e),i=!r&&!n&&Yo(e),s=!r&&!n&&!i&&ca(e),o=r||n||i||s,a=o?Gt(e.length,ke):[],l=a.length;for(var c in e)!t&&!Pe.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ys(c,l))||a.push(c);return a}function Gr(e){var t=e.length;return t?e[Yn(0,t-1)]:r}function Zr(e,t){return Fs(Ai(e),an(t,0,e.length))}function Jr(e){return Fs(Ai(e))}function Qr(e,t,n){(n!==r&&!Ho(e[t],n)||n===r&&!(t in e))&&sn(e,t,n)}function en(e,t,n){var i=e[t];Pe.call(e,t)&&Ho(i,n)&&(n!==r||t in e)||sn(e,t,n)}function tn(e,t){for(var r=e.length;r--;)if(Ho(e[r][0],t))return r;return-1}function rn(e,t,r,n){return fn(e,(function(e,i,s){t(n,e,r(e),s)})),n}function nn(e,t){return e&&Mi(t,Oa(t),e)}function sn(e,t,r){"__proto__"==t&&tt?tt(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function on(e,t){for(var n=-1,i=t.length,s=a(i),o=null==e;++n<i;)s[n]=o?r:Ta(e,t[n]);return s}function an(e,t,n){return e==e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function ln(e,t,n,i,s,o){var a,l=1&t,c=2&t,h=4&t;if(n&&(a=s?n(e,i,s,o):n(e)),a!==r)return a;if(!ea(e))return e;var u=Wo(e);if(u){if(a=function(e){var t=e.length,r=new e.constructor(t);t&&"string"==typeof e[0]&&Pe.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!l)return Ai(e,a)}else{var f=ps(e),d=f==x||f==C;if(Yo(e))return Ci(e,l);if(f==T||f==g||d&&!s){if(a=c||d?{}:bs(e),!l)return c?function(e,t){return Mi(e,ds(e),t)}(e,function(e,t){return e&&Mi(t,Ia(t),e)}(a,e)):function(e,t){return Mi(e,fs(e),t)}(e,nn(a,e))}else{if(!lt[f])return s?e:{};a=function(e,t,r){var n=e.constructor;switch(t){case N:return Ei(e);case v:case w:return new n(+e);case F:return function(e,t){var r=t?Ei(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case P:case j:case L:case D:case B:case H:case z:case U:case V:return Si(e,r);case E:return new n;case S:case M:return new n(e);case k:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case A:return new n;case O:return i=e,Lr?Te(Lr.call(i)):{}}var i}(e,f,l)}}o||(o=new Yr);var p=o.get(e);if(p)return p;o.set(e,a),oa(e)?e.forEach((function(r){a.add(ln(r,t,n,r,e,o))})):ra(e)&&e.forEach((function(r,i){a.set(i,ln(r,t,n,i,e,o))}));var m=u?r:(h?c?is:ns:c?Ia:Oa)(e);return kt(m||e,(function(r,i){m&&(r=e[i=r]),en(a,i,ln(r,t,n,i,e,o))})),a}function cn(e,t,n){var i=n.length;if(null==e)return!i;for(e=Te(e);i--;){var s=n[i],o=t[s],a=e[s];if(a===r&&!(s in e)||!o(a))return!1}return!0}function hn(e,t,i){if("function"!=typeof e)throw new Ae(n);return Ms((function(){e.apply(r,i)}),t)}function un(e,t,r,n){var i=-1,s=It,o=!0,a=e.length,l=[],c=t.length;if(!a)return l;r&&(t=Ft(t,Jt(r))),n?(s=Nt,o=!1):t.length>=200&&(s=er,o=!1,t=new Kr(t));e:for(;++i<a;){var h=e[i],u=null==r?h:r(h);if(h=n||0!==h?h:0,o&&u==u){for(var f=c;f--;)if(t[f]===u)continue e;l.push(h)}else s(t,u,n)||l.push(h)}return l}Br.templateSettings={escape:Z,evaluate:J,interpolate:Q,variable:"",imports:{_:Br}},Br.prototype=zr.prototype,Br.prototype.constructor=Br,Ur.prototype=Hr(zr.prototype),Ur.prototype.constructor=Ur,Vr.prototype=Hr(zr.prototype),Vr.prototype.constructor=Vr,Wr.prototype.clear=function(){this.__data__=kr?kr(null):{},this.size=0},Wr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Wr.prototype.get=function(e){var t=this.__data__;if(kr){var n=t[e];return n===i?r:n}return Pe.call(t,e)?t[e]:r},Wr.prototype.has=function(e){var t=this.__data__;return kr?t[e]!==r:Pe.call(t,e)},Wr.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=kr&&t===r?i:t,this},$r.prototype.clear=function(){this.__data__=[],this.size=0},$r.prototype.delete=function(e){var t=this.__data__,r=tn(t,e);return!(r<0)&&(r==t.length-1?t.pop():Xe.call(t,r,1),--this.size,!0)},$r.prototype.get=function(e){var t=this.__data__,n=tn(t,e);return n<0?r:t[n][1]},$r.prototype.has=function(e){return tn(this.__data__,e)>-1},$r.prototype.set=function(e,t){var r=this.__data__,n=tn(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},qr.prototype.clear=function(){this.size=0,this.__data__={hash:new Wr,map:new(Er||$r),string:new Wr}},qr.prototype.delete=function(e){var t=cs(this,e).delete(e);return this.size-=t?1:0,t},qr.prototype.get=function(e){return cs(this,e).get(e)},qr.prototype.has=function(e){return cs(this,e).has(e)},qr.prototype.set=function(e,t){var r=cs(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Kr.prototype.add=Kr.prototype.push=function(e){return this.__data__.set(e,i),this},Kr.prototype.has=function(e){return this.__data__.has(e)},Yr.prototype.clear=function(){this.__data__=new $r,this.size=0},Yr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Yr.prototype.get=function(e){return this.__data__.get(e)},Yr.prototype.has=function(e){return this.__data__.has(e)},Yr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof $r){var n=r.__data__;if(!Er||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new qr(n)}return r.set(e,t),this.size=r.size,this};var fn=Ni(wn),dn=Ni(_n,!0);function pn(e,t){var r=!0;return fn(e,(function(e,n,i){return r=!!t(e,n,i)})),r}function mn(e,t,n){for(var i=-1,s=e.length;++i<s;){var o=e[i],a=t(o);if(null!=a&&(l===r?a==a&&!la(a):n(a,l)))var l=a,c=o}return c}function bn(e,t){var r=[];return fn(e,(function(e,n,i){t(e,n,i)&&r.push(e)})),r}function gn(e,t,r,n,i){var s=-1,o=e.length;for(r||(r=gs),i||(i=[]);++s<o;){var a=e[s];t>0&&r(a)?t>1?gn(a,t-1,r,n,i):Pt(i,a):n||(i[i.length]=a)}return i}var yn=Fi(),vn=Fi(!0);function wn(e,t){return e&&yn(e,t,Oa)}function _n(e,t){return e&&vn(e,t,Oa)}function xn(e,t){return Ot(t,(function(t){return Zo(e[t])}))}function Cn(e,t){for(var n=0,i=(t=vi(t,e)).length;null!=e&&n<i;)e=e[js(t[n++])];return n&&n==i?e:r}function En(e,t,r){var n=t(e);return Wo(e)?n:Pt(n,r(e))}function Sn(e){return null==e?e===r?"[object Undefined]":"[object Null]":Je&&Je in Te(e)?function(e){var t=Pe.call(e,Je),n=e[Je];try{e[Je]=r;var i=!0}catch(e){}var s=De.call(e);i&&(t?e[Je]=n:delete e[Je]);return s}(e):function(e){return De.call(e)}(e)}function Tn(e,t){return e>t}function Rn(e,t){return null!=e&&Pe.call(e,t)}function kn(e,t){return null!=e&&t in Te(e)}function An(e,t,n){for(var i=n?Nt:It,s=e[0].length,o=e.length,l=o,c=a(o),h=1/0,u=[];l--;){var f=e[l];l&&t&&(f=Ft(f,Jt(t))),h=yr(f.length,h),c[l]=!n&&(t||s>=120&&f.length>=120)?new Kr(l&&f):r}f=e[0];var d=-1,p=c[0];e:for(;++d<s&&u.length<h;){var m=f[d],b=t?t(m):m;if(m=n||0!==m?m:0,!(p?er(p,b):i(u,b,n))){for(l=o;--l;){var g=c[l];if(!(g?er(g,b):i(e[l],b,n)))continue e}p&&p.push(b),u.push(m)}}return u}function Mn(e,t,n){var i=null==(e=Rs(e,t=vi(t,e)))?e:e[js(Xs(t))];return null==i?r:Tt(i,e,n)}function On(e){return ta(e)&&Sn(e)==g}function In(e,t,n,i,s){return e===t||(null==e||null==t||!ta(e)&&!ta(t)?e!=e&&t!=t:function(e,t,n,i,s,o){var a=Wo(e),l=Wo(t),c=a?y:ps(e),h=l?y:ps(t),u=(c=c==g?T:c)==T,f=(h=h==g?T:h)==T,d=c==h;if(d&&Yo(e)){if(!Yo(t))return!1;a=!0,u=!1}if(d&&!u)return o||(o=new Yr),a||ca(e)?ts(e,t,n,i,s,o):function(e,t,r,n,i,s,o){switch(r){case F:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case N:return!(e.byteLength!=t.byteLength||!s(new We(e),new We(t)));case v:case w:case S:return Ho(+e,+t);case _:return e.name==t.name&&e.message==t.message;case k:case M:return e==t+"";case E:var a=ar;case A:var l=1&n;if(a||(a=hr),e.size!=t.size&&!l)return!1;var c=o.get(e);if(c)return c==t;n|=2,o.set(e,t);var h=ts(a(e),a(t),n,i,s,o);return o.delete(e),h;case O:if(Lr)return Lr.call(e)==Lr.call(t)}return!1}(e,t,c,n,i,s,o);if(!(1&n)){var p=u&&Pe.call(e,"__wrapped__"),m=f&&Pe.call(t,"__wrapped__");if(p||m){var b=p?e.value():e,x=m?t.value():t;return o||(o=new Yr),s(b,x,n,i,o)}}if(!d)return!1;return o||(o=new Yr),function(e,t,n,i,s,o){var a=1&n,l=ns(e),c=l.length,h=ns(t),u=h.length;if(c!=u&&!a)return!1;var f=c;for(;f--;){var d=l[f];if(!(a?d in t:Pe.call(t,d)))return!1}var p=o.get(e),m=o.get(t);if(p&&m)return p==t&&m==e;var b=!0;o.set(e,t),o.set(t,e);var g=a;for(;++f<c;){var y=e[d=l[f]],v=t[d];if(i)var w=a?i(v,y,d,t,e,o):i(y,v,d,e,t,o);if(!(w===r?y===v||s(y,v,n,i,o):w)){b=!1;break}g||(g="constructor"==d)}if(b&&!g){var _=e.constructor,x=t.constructor;_==x||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof x&&x instanceof x||(b=!1)}return o.delete(e),o.delete(t),b}(e,t,n,i,s,o)}(e,t,n,i,In,s))}function Nn(e,t,n,i){var s=n.length,o=s,a=!i;if(null==e)return!o;for(e=Te(e);s--;){var l=n[s];if(a&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++s<o;){var c=(l=n[s])[0],h=e[c],u=l[1];if(a&&l[2]){if(h===r&&!(c in e))return!1}else{var f=new Yr;if(i)var d=i(h,u,c,e,t,f);if(!(d===r?In(u,h,3,i,f):d))return!1}}return!0}function Fn(e){return!(!ea(e)||(t=e,Le&&Le in t))&&(Zo(e)?ze:ge).test(Ls(e));var t}function Pn(e){return"function"==typeof e?e:null==e?nl:"object"==typeof e?Wo(e)?zn(e[0],e[1]):Hn(e):fl(e)}function jn(e){if(!Cs(e))return Kt(e);var t=[];for(var r in Te(e))Pe.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Ln(e){if(!ea(e))return function(e){var t=[];if(null!=e)for(var r in Te(e))t.push(r);return t}(e);var t=Cs(e),r=[];for(var n in e)("constructor"!=n||!t&&Pe.call(e,n))&&r.push(n);return r}function Dn(e,t){return e<t}function Bn(e,t){var r=-1,n=qo(e)?a(e.length):[];return fn(e,(function(e,i,s){n[++r]=t(e,i,s)})),n}function Hn(e){var t=hs(e);return 1==t.length&&t[0][2]?Ss(t[0][0],t[0][1]):function(r){return r===e||Nn(r,e,t)}}function zn(e,t){return ws(e)&&Es(t)?Ss(js(e),t):function(n){var i=Ta(n,e);return i===r&&i===t?Ra(n,e):In(t,i,3)}}function Un(e,t,n,i,s){e!==t&&yn(t,(function(o,a){if(s||(s=new Yr),ea(o))!function(e,t,n,i,s,o,a){var l=ks(e,n),c=ks(t,n),h=a.get(c);if(h)return void Qr(e,n,h);var u=o?o(l,c,n+"",e,t,a):r,f=u===r;if(f){var d=Wo(c),p=!d&&Yo(c),m=!d&&!p&&ca(c);u=c,d||p||m?Wo(l)?u=l:Ko(l)?u=Ai(l):p?(f=!1,u=Ci(c,!0)):m?(f=!1,u=Si(c,!0)):u=[]:ia(c)||Vo(c)?(u=l,Vo(l)?u=ga(l):ea(l)&&!Zo(l)||(u=bs(c))):f=!1}f&&(a.set(c,u),s(u,c,i,o,a),a.delete(c));Qr(e,n,u)}(e,t,a,n,Un,i,s);else{var l=i?i(ks(e,a),o,a+"",e,t,s):r;l===r&&(l=o),Qr(e,a,l)}}),Ia)}function Vn(e,t){var n=e.length;if(n)return ys(t+=t<0?n:0,n)?e[t]:r}function Wn(e,t,r){t=t.length?Ft(t,(function(e){return Wo(e)?function(t){return Cn(t,1===e.length?e[0]:e)}:e})):[nl];var n=-1;t=Ft(t,Jt(ls()));var i=Bn(e,(function(e,r,i){var s=Ft(t,(function(t){return t(e)}));return{criteria:s,index:++n,value:e}}));return function(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}(i,(function(e,t){return function(e,t,r){var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;for(;++n<o;){var l=Ti(i[n],s[n]);if(l)return n>=a?l:l*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}))}function $n(e,t,r){for(var n=-1,i=t.length,s={};++n<i;){var o=t[n],a=Cn(e,o);r(a,o)&&Qn(s,vi(o,e),a)}return s}function qn(e,t,r,n){var i=n?Vt:Ut,s=-1,o=t.length,a=e;for(e===t&&(t=Ai(t)),r&&(a=Ft(e,Jt(r)));++s<o;)for(var l=0,c=t[s],h=r?r(c):c;(l=i(a,h,l,n))>-1;)a!==e&&Xe.call(a,l,1),Xe.call(e,l,1);return e}function Kn(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==s){var s=i;ys(i)?Xe.call(e,i,1):ui(e,i)}}return e}function Yn(e,t){return e+mt(_r()*(t-e+1))}function Xn(e,t){var r="";if(!e||t<1||t>d)return r;do{t%2&&(r+=e),(t=mt(t/2))&&(e+=e)}while(t);return r}function Gn(e,t){return Os(Ts(e,t,nl),e+"")}function Zn(e){return Gr(Ha(e))}function Jn(e,t){var r=Ha(e);return Fs(r,an(t,0,r.length))}function Qn(e,t,n,i){if(!ea(e))return e;for(var s=-1,o=(t=vi(t,e)).length,a=o-1,l=e;null!=l&&++s<o;){var c=js(t[s]),h=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(s!=a){var u=l[c];(h=i?i(u,c,l):r)===r&&(h=ea(u)?u:ys(t[s+1])?[]:{})}en(l,c,h),l=l[c]}return e}var ei=Ar?function(e,t){return Ar.set(e,t),e}:nl,ti=tt?function(e,t){return tt(e,"toString",{configurable:!0,enumerable:!1,value:el(t),writable:!0})}:nl;function ri(e){return Fs(Ha(e))}function ni(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var s=a(i);++n<i;)s[n]=e[n+t];return s}function ii(e,t){var r;return fn(e,(function(e,n,i){return!(r=t(e,n,i))})),!!r}function si(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;n<i;){var s=n+i>>>1,o=e[s];null!==o&&!la(o)&&(r?o<=t:o<t)?n=s+1:i=s}return i}return oi(e,t,nl,r)}function oi(e,t,n,i){var s=0,o=null==e?0:e.length;if(0===o)return 0;for(var a=(t=n(t))!=t,l=null===t,c=la(t),h=t===r;s<o;){var u=mt((s+o)/2),f=n(e[u]),d=f!==r,p=null===f,m=f==f,b=la(f);if(a)var g=i||m;else g=h?m&&(i||d):l?m&&d&&(i||!p):c?m&&d&&!p&&(i||!b):!p&&!b&&(i?f<=t:f<t);g?s=u+1:o=u}return yr(o,4294967294)}function ai(e,t){for(var r=-1,n=e.length,i=0,s=[];++r<n;){var o=e[r],a=t?t(o):o;if(!r||!Ho(a,l)){var l=a;s[i++]=0===o?0:o}}return s}function li(e){return"number"==typeof e?e:la(e)?p:+e}function ci(e){if("string"==typeof e)return e;if(Wo(e))return Ft(e,ci)+"";if(la(e))return Dr?Dr.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function hi(e,t,r){var n=-1,i=It,s=e.length,o=!0,a=[],l=a;if(r)o=!1,i=Nt;else if(s>=200){var c=t?null:Xi(e);if(c)return hr(c);o=!1,i=er,l=new Kr}else l=t?[]:a;e:for(;++n<s;){var h=e[n],u=t?t(h):h;if(h=r||0!==h?h:0,o&&u==u){for(var f=l.length;f--;)if(l[f]===u)continue e;t&&l.push(u),a.push(h)}else i(l,u,r)||(l!==a&&l.push(u),a.push(h))}return a}function ui(e,t){return null==(e=Rs(e,t=vi(t,e)))||delete e[js(Xs(t))]}function fi(e,t,r,n){return Qn(e,t,r(Cn(e,t)),n)}function di(e,t,r,n){for(var i=e.length,s=n?i:-1;(n?s--:++s<i)&&t(e[s],s,e););return r?ni(e,n?0:s,n?s+1:i):ni(e,n?s+1:0,n?i:s)}function pi(e,t){var r=e;return r instanceof Vr&&(r=r.value()),jt(t,(function(e,t){return t.func.apply(t.thisArg,Pt([e],t.args))}),r)}function mi(e,t,r){var n=e.length;if(n<2)return n?hi(e[0]):[];for(var i=-1,s=a(n);++i<n;)for(var o=e[i],l=-1;++l<n;)l!=i&&(s[i]=un(s[i]||o,e[l],t,r));return hi(gn(s,1),t,r)}function bi(e,t,n){for(var i=-1,s=e.length,o=t.length,a={};++i<s;){var l=i<o?t[i]:r;n(a,e[i],l)}return a}function gi(e){return Ko(e)?e:[]}function yi(e){return"function"==typeof e?e:nl}function vi(e,t){return Wo(e)?e:ws(e,t)?[e]:Ps(ya(e))}var wi=Gn;function _i(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:ni(e,t,n)}var xi=nt||function(e){return pt.clearTimeout(e)};function Ci(e,t){if(t)return e.slice();var r=e.length,n=$e?$e(r):new e.constructor(r);return e.copy(n),n}function Ei(e){var t=new e.constructor(e.byteLength);return new We(t).set(new We(e)),t}function Si(e,t){var r=t?Ei(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Ti(e,t){if(e!==t){var n=e!==r,i=null===e,s=e==e,o=la(e),a=t!==r,l=null===t,c=t==t,h=la(t);if(!l&&!h&&!o&&e>t||o&&a&&c&&!l&&!h||i&&a&&c||!n&&c||!s)return 1;if(!i&&!o&&!h&&e<t||h&&n&&s&&!i&&!o||l&&n&&s||!a&&s||!c)return-1}return 0}function Ri(e,t,r,n){for(var i=-1,s=e.length,o=r.length,l=-1,c=t.length,h=gr(s-o,0),u=a(c+h),f=!n;++l<c;)u[l]=t[l];for(;++i<o;)(f||i<s)&&(u[r[i]]=e[i]);for(;h--;)u[l++]=e[i++];return u}function ki(e,t,r,n){for(var i=-1,s=e.length,o=-1,l=r.length,c=-1,h=t.length,u=gr(s-l,0),f=a(u+h),d=!n;++i<u;)f[i]=e[i];for(var p=i;++c<h;)f[p+c]=t[c];for(;++o<l;)(d||i<s)&&(f[p+r[o]]=e[i++]);return f}function Ai(e,t){var r=-1,n=e.length;for(t||(t=a(n));++r<n;)t[r]=e[r];return t}function Mi(e,t,n,i){var s=!n;n||(n={});for(var o=-1,a=t.length;++o<a;){var l=t[o],c=i?i(n[l],e[l],l,n,e):r;c===r&&(c=e[l]),s?sn(n,l,c):en(n,l,c)}return n}function Oi(e,t){return function(r,n){var i=Wo(r)?Rt:rn,s=t?t():{};return i(r,e,ls(n,2),s)}}function Ii(e){return Gn((function(t,n){var i=-1,s=n.length,o=s>1?n[s-1]:r,a=s>2?n[2]:r;for(o=e.length>3&&"function"==typeof o?(s--,o):r,a&&vs(n[0],n[1],a)&&(o=s<3?r:o,s=1),t=Te(t);++i<s;){var l=n[i];l&&e(t,l,i,o)}return t}))}function Ni(e,t){return function(r,n){if(null==r)return r;if(!qo(r))return e(r,n);for(var i=r.length,s=t?i:-1,o=Te(r);(t?s--:++s<i)&&!1!==n(o[s],s,o););return r}}function Fi(e){return function(t,r,n){for(var i=-1,s=Te(t),o=n(t),a=o.length;a--;){var l=o[e?a:++i];if(!1===r(s[l],l,s))break}return t}}function Pi(e){return function(t){var n=or(t=ya(t))?dr(t):r,i=n?n[0]:t.charAt(0),s=n?_i(n,1).join(""):t.slice(1);return i[e]()+s}}function ji(e){return function(t){return jt(Za(Va(t).replace(Qe,"")),e,"")}}function Li(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=Hr(e.prototype),n=e.apply(r,t);return ea(n)?n:r}}function Di(e){return function(t,n,i){var s=Te(t);if(!qo(t)){var o=ls(n,3);t=Oa(t),n=function(e){return o(s[e],e,s)}}var a=e(t,n,i);return a>-1?s[o?t[a]:a]:r}}function Bi(e){return rs((function(t){var i=t.length,s=i,o=Ur.prototype.thru;for(e&&t.reverse();s--;){var a=t[s];if("function"!=typeof a)throw new Ae(n);if(o&&!l&&"wrapper"==os(a))var l=new Ur([],!0)}for(s=l?s:i;++s<i;){var c=os(a=t[s]),h="wrapper"==c?ss(a):r;l=h&&_s(h[0])&&424==h[1]&&!h[4].length&&1==h[9]?l[os(h[0])].apply(l,h[3]):1==a.length&&_s(a)?l[c]():l.thru(a)}return function(){var e=arguments,r=e[0];if(l&&1==e.length&&Wo(r))return l.plant(r).value();for(var n=0,s=i?t[n].apply(this,e):r;++n<i;)s=t[n].call(this,s);return s}}))}function Hi(e,t,n,i,s,o,l,c,u,f){var d=t&h,p=1&t,m=2&t,b=24&t,g=512&t,y=m?r:Li(e);return function h(){for(var v=arguments.length,w=a(v),_=v;_--;)w[_]=arguments[_];if(b)var x=as(h),C=function(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(w,x);if(i&&(w=Ri(w,i,s,b)),o&&(w=ki(w,o,l,b)),v-=C,b&&v<f){var E=cr(w,x);return Ki(e,t,Hi,h.placeholder,n,w,E,c,u,f-v)}var S=p?n:this,T=m?S[e]:e;return v=w.length,c?w=function(e,t){var n=e.length,i=yr(t.length,n),s=Ai(e);for(;i--;){var o=t[i];e[i]=ys(o,n)?s[o]:r}return e}(w,c):g&&v>1&&w.reverse(),d&&u<v&&(w.length=u),this&&this!==pt&&this instanceof h&&(T=y||Li(T)),T.apply(S,w)}}function zi(e,t){return function(r,n){return function(e,t,r,n){return wn(e,(function(e,i,s){t(n,r(e),i,s)})),n}(r,e,t(n),{})}}function Ui(e,t){return function(n,i){var s;if(n===r&&i===r)return t;if(n!==r&&(s=n),i!==r){if(s===r)return i;"string"==typeof n||"string"==typeof i?(n=ci(n),i=ci(i)):(n=li(n),i=li(i)),s=e(n,i)}return s}}function Vi(e){return rs((function(t){return t=Ft(t,Jt(ls())),Gn((function(r){var n=this;return e(t,(function(e){return Tt(e,n,r)}))}))}))}function Wi(e,t){var n=(t=t===r?" ":ci(t)).length;if(n<2)return n?Xn(t,e):t;var i=Xn(t,dt(e/fr(t)));return or(t)?_i(dr(i),0,e).join(""):i.slice(0,e)}function $i(e){return function(t,n,i){return i&&"number"!=typeof i&&vs(t,n,i)&&(n=i=r),t=da(t),n===r?(n=t,t=0):n=da(n),function(e,t,r,n){for(var i=-1,s=gr(dt((t-e)/(r||1)),0),o=a(s);s--;)o[n?s:++i]=e,e+=r;return o}(t,n,i=i===r?t<n?1:-1:da(i),e)}}function qi(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=ba(t),r=ba(r)),e(t,r)}}function Ki(e,t,n,i,s,o,a,h,u,f){var d=8&t;t|=d?l:c,4&(t&=~(d?c:l))||(t&=-4);var p=[e,t,s,d?o:r,d?a:r,d?r:o,d?r:a,h,u,f],m=n.apply(r,p);return _s(e)&&As(m,p),m.placeholder=i,Is(m,e,t)}function Yi(e){var t=Se[e];return function(e,r){if(e=ba(e),(r=null==r?0:yr(pa(r),292))&&vt(e)){var n=(ya(e)+"e").split("e");return+((n=(ya(t(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return t(e)}}var Xi=Tr&&1/hr(new Tr([,-0]))[1]==f?function(e){return new Tr(e)}:ll;function Gi(e){return function(t){var r=ps(t);return r==E?ar(t):r==A?ur(t):function(e,t){return Ft(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Zi(e,t,i,f,d,p,m,b){var g=2&t;if(!g&&"function"!=typeof e)throw new Ae(n);var y=f?f.length:0;if(y||(t&=-97,f=d=r),m=m===r?m:gr(pa(m),0),b=b===r?b:pa(b),y-=d?d.length:0,t&c){var v=f,w=d;f=d=r}var _=g?r:ss(e),x=[e,t,i,f,d,v,w,p,m,b];if(_&&function(e,t){var r=e[1],n=t[1],i=r|n,o=i<131,a=n==h&&8==r||n==h&&r==u&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==r;if(!o&&!a)return e;1&n&&(e[2]=t[2],i|=1&r?0:4);var l=t[3];if(l){var c=e[3];e[3]=c?Ri(c,l,t[4]):l,e[4]=c?cr(e[3],s):t[4]}(l=t[5])&&(c=e[5],e[5]=c?ki(c,l,t[6]):l,e[6]=c?cr(e[5],s):t[6]);(l=t[7])&&(e[7]=l);n&h&&(e[8]=null==e[8]?t[8]:yr(e[8],t[8]));null==e[9]&&(e[9]=t[9]);e[0]=t[0],e[1]=i}(x,_),e=x[0],t=x[1],i=x[2],f=x[3],d=x[4],!(b=x[9]=x[9]===r?g?0:e.length:gr(x[9]-y,0))&&24&t&&(t&=-25),t&&1!=t)C=8==t||t==o?function(e,t,n){var i=Li(e);return function s(){for(var o=arguments.length,l=a(o),c=o,h=as(s);c--;)l[c]=arguments[c];var u=o<3&&l[0]!==h&&l[o-1]!==h?[]:cr(l,h);return(o-=u.length)<n?Ki(e,t,Hi,s.placeholder,r,l,u,r,r,n-o):Tt(this&&this!==pt&&this instanceof s?i:e,this,l)}}(e,t,b):t!=l&&33!=t||d.length?Hi.apply(r,x):function(e,t,r,n){var i=1&t,s=Li(e);return function t(){for(var o=-1,l=arguments.length,c=-1,h=n.length,u=a(h+l),f=this&&this!==pt&&this instanceof t?s:e;++c<h;)u[c]=n[c];for(;l--;)u[c++]=arguments[++o];return Tt(f,i?r:this,u)}}(e,t,i,f);else var C=function(e,t,r){var n=1&t,i=Li(e);return function t(){return(this&&this!==pt&&this instanceof t?i:e).apply(n?r:this,arguments)}}(e,t,i);return Is((_?ei:As)(C,x),e,t)}function Ji(e,t,n,i){return e===r||Ho(e,Ie[n])&&!Pe.call(i,n)?t:e}function Qi(e,t,n,i,s,o){return ea(e)&&ea(t)&&(o.set(t,e),Un(e,t,r,Qi,o),o.delete(t)),e}function es(e){return ia(e)?r:e}function ts(e,t,n,i,s,o){var a=1&n,l=e.length,c=t.length;if(l!=c&&!(a&&c>l))return!1;var h=o.get(e),u=o.get(t);if(h&&u)return h==t&&u==e;var f=-1,d=!0,p=2&n?new Kr:r;for(o.set(e,t),o.set(t,e);++f<l;){var m=e[f],b=t[f];if(i)var g=a?i(b,m,f,t,e,o):i(m,b,f,e,t,o);if(g!==r){if(g)continue;d=!1;break}if(p){if(!Dt(t,(function(e,t){if(!er(p,t)&&(m===e||s(m,e,n,i,o)))return p.push(t)}))){d=!1;break}}else if(m!==b&&!s(m,b,n,i,o)){d=!1;break}}return o.delete(e),o.delete(t),d}function rs(e){return Os(Ts(e,r,Ws),e+"")}function ns(e){return En(e,Oa,fs)}function is(e){return En(e,Ia,ds)}var ss=Ar?function(e){return Ar.get(e)}:ll;function os(e){for(var t=e.name+"",r=Mr[t],n=Pe.call(Mr,t)?r.length:0;n--;){var i=r[n],s=i.func;if(null==s||s==e)return i.name}return t}function as(e){return(Pe.call(Br,"placeholder")?Br:e).placeholder}function ls(){var e=Br.iteratee||il;return e=e===il?Pn:e,arguments.length?e(arguments[0],arguments[1]):e}function cs(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function hs(e){for(var t=Oa(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Es(i)]}return t}function us(e,t){var n=function(e,t){return null==e?r:e[t]}(e,t);return Fn(n)?n:r}var fs=bt?function(e){return null==e?[]:(e=Te(e),Ot(bt(e),(function(t){return Ye.call(e,t)})))}:ml,ds=bt?function(e){for(var t=[];e;)Pt(t,fs(e)),e=qe(e);return t}:ml,ps=Sn;function ms(e,t,r){for(var n=-1,i=(t=vi(t,e)).length,s=!1;++n<i;){var o=js(t[n]);if(!(s=null!=e&&r(e,o)))break;e=e[o]}return s||++n!=i?s:!!(i=null==e?0:e.length)&&Qo(i)&&ys(o,i)&&(Wo(e)||Vo(e))}function bs(e){return"function"!=typeof e.constructor||Cs(e)?{}:Hr(qe(e))}function gs(e){return Wo(e)||Vo(e)||!!(Ge&&e&&e[Ge])}function ys(e,t){var r=typeof e;return!!(t=null==t?d:t)&&("number"==r||"symbol"!=r&&ve.test(e))&&e>-1&&e%1==0&&e<t}function vs(e,t,r){if(!ea(r))return!1;var n=typeof t;return!!("number"==n?qo(r)&&ys(t,r.length):"string"==n&&t in r)&&Ho(r[t],e)}function ws(e,t){if(Wo(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!la(e))||(te.test(e)||!ee.test(e)||null!=t&&e in Te(t))}function _s(e){var t=os(e),r=Br[t];if("function"!=typeof r||!(t in Vr.prototype))return!1;if(e===r)return!0;var n=ss(r);return!!n&&e===n[0]}(Cr&&ps(new Cr(new ArrayBuffer(1)))!=F||Er&&ps(new Er)!=E||Sr&&ps(Sr.resolve())!=R||Tr&&ps(new Tr)!=A||Rr&&ps(new Rr)!=I)&&(ps=function(e){var t=Sn(e),n=t==T?e.constructor:r,i=n?Ls(n):"";if(i)switch(i){case Or:return F;case Ir:return E;case Nr:return R;case Fr:return A;case Pr:return I}return t});var xs=Ne?Zo:bl;function Cs(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ie)}function Es(e){return e==e&&!ea(e)}function Ss(e,t){return function(n){return null!=n&&(n[e]===t&&(t!==r||e in Te(n)))}}function Ts(e,t,n){return t=gr(t===r?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=gr(r.length-t,0),o=a(s);++i<s;)o[i]=r[t+i];i=-1;for(var l=a(t+1);++i<t;)l[i]=r[i];return l[t]=n(o),Tt(e,this,l)}}function Rs(e,t){return t.length<2?e:Cn(e,ni(t,0,-1))}function ks(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var As=Ns(ei),Ms=ft||function(e,t){return pt.setTimeout(e,t)},Os=Ns(ti);function Is(e,t,r){var n=t+"";return Os(e,function(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(ae,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return kt(b,(function(r){var n="_."+r[0];t&r[1]&&!It(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(le);return t?t[1].split(ce):[]}(n),r)))}function Ns(e){var t=0,n=0;return function(){var i=vr(),s=16-(i-n);if(n=i,s>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Fs(e,t){var n=-1,i=e.length,s=i-1;for(t=t===r?i:t;++n<t;){var o=Yn(n,s),a=e[o];e[o]=e[n],e[n]=a}return e.length=t,e}var Ps=function(e){var t=Fo(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(re,(function(e,r,n,i){t.push(n?i.replace(fe,"$1"):r||e)})),t}));function js(e){if("string"==typeof e||la(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ls(e){if(null!=e){try{return Fe.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ds(e){if(e instanceof Vr)return e.clone();var t=new Ur(e.__wrapped__,e.__chain__);return t.__actions__=Ai(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Bs=Gn((function(e,t){return Ko(e)?un(e,gn(t,1,Ko,!0)):[]})),Hs=Gn((function(e,t){var n=Xs(t);return Ko(n)&&(n=r),Ko(e)?un(e,gn(t,1,Ko,!0),ls(n,2)):[]})),zs=Gn((function(e,t){var n=Xs(t);return Ko(n)&&(n=r),Ko(e)?un(e,gn(t,1,Ko,!0),r,n):[]}));function Us(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:pa(r);return i<0&&(i=gr(n+i,0)),zt(e,ls(t,3),i)}function Vs(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var s=i-1;return n!==r&&(s=pa(n),s=n<0?gr(i+s,0):yr(s,i-1)),zt(e,ls(t,3),s,!0)}function Ws(e){return(null==e?0:e.length)?gn(e,1):[]}function $s(e){return e&&e.length?e[0]:r}var qs=Gn((function(e){var t=Ft(e,gi);return t.length&&t[0]===e[0]?An(t):[]})),Ks=Gn((function(e){var t=Xs(e),n=Ft(e,gi);return t===Xs(n)?t=r:n.pop(),n.length&&n[0]===e[0]?An(n,ls(t,2)):[]})),Ys=Gn((function(e){var t=Xs(e),n=Ft(e,gi);return(t="function"==typeof t?t:r)&&n.pop(),n.length&&n[0]===e[0]?An(n,r,t):[]}));function Xs(e){var t=null==e?0:e.length;return t?e[t-1]:r}var Gs=Gn(Zs);function Zs(e,t){return e&&e.length&&t&&t.length?qn(e,t):e}var Js=rs((function(e,t){var r=null==e?0:e.length,n=on(e,t);return Kn(e,Ft(t,(function(e){return ys(e,r)?+e:e})).sort(Ti)),n}));function Qs(e){return null==e?e:xr.call(e)}var eo=Gn((function(e){return hi(gn(e,1,Ko,!0))})),to=Gn((function(e){var t=Xs(e);return Ko(t)&&(t=r),hi(gn(e,1,Ko,!0),ls(t,2))})),ro=Gn((function(e){var t=Xs(e);return t="function"==typeof t?t:r,hi(gn(e,1,Ko,!0),r,t)}));function no(e){if(!e||!e.length)return[];var t=0;return e=Ot(e,(function(e){if(Ko(e))return t=gr(e.length,t),!0})),Gt(t,(function(t){return Ft(e,qt(t))}))}function io(e,t){if(!e||!e.length)return[];var n=no(e);return null==t?n:Ft(n,(function(e){return Tt(t,r,e)}))}var so=Gn((function(e,t){return Ko(e)?un(e,t):[]})),oo=Gn((function(e){return mi(Ot(e,Ko))})),ao=Gn((function(e){var t=Xs(e);return Ko(t)&&(t=r),mi(Ot(e,Ko),ls(t,2))})),lo=Gn((function(e){var t=Xs(e);return t="function"==typeof t?t:r,mi(Ot(e,Ko),r,t)})),co=Gn(no);var ho=Gn((function(e){var t=e.length,n=t>1?e[t-1]:r;return n="function"==typeof n?(e.pop(),n):r,io(e,n)}));function uo(e){var t=Br(e);return t.__chain__=!0,t}function fo(e,t){return t(e)}var po=rs((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,s=function(t){return on(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Vr&&ys(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:fo,args:[s],thisArg:r}),new Ur(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(r),e}))):this.thru(s)}));var mo=Oi((function(e,t,r){Pe.call(e,r)?++e[r]:sn(e,r,1)}));var bo=Di(Us),go=Di(Vs);function yo(e,t){return(Wo(e)?kt:fn)(e,ls(t,3))}function vo(e,t){return(Wo(e)?At:dn)(e,ls(t,3))}var wo=Oi((function(e,t,r){Pe.call(e,r)?e[r].push(t):sn(e,r,[t])}));var _o=Gn((function(e,t,r){var n=-1,i="function"==typeof t,s=qo(e)?a(e.length):[];return fn(e,(function(e){s[++n]=i?Tt(t,e,r):Mn(e,t,r)})),s})),xo=Oi((function(e,t,r){sn(e,r,t)}));function Co(e,t){return(Wo(e)?Ft:Bn)(e,ls(t,3))}var Eo=Oi((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]}));var So=Gn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&vs(e,t[0],t[1])?t=[]:r>2&&vs(t[0],t[1],t[2])&&(t=[t[0]]),Wn(e,gn(t,1),[])})),To=ct||function(){return pt.Date.now()};function Ro(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Zi(e,h,r,r,r,r,t)}function ko(e,t){var i;if("function"!=typeof t)throw new Ae(n);return e=pa(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=r),i}}var Ao=Gn((function(e,t,r){var n=1;if(r.length){var i=cr(r,as(Ao));n|=l}return Zi(e,n,t,r,i)})),Mo=Gn((function(e,t,r){var n=3;if(r.length){var i=cr(r,as(Mo));n|=l}return Zi(t,n,e,r,i)}));function Oo(e,t,i){var s,o,a,l,c,h,u=0,f=!1,d=!1,p=!0;if("function"!=typeof e)throw new Ae(n);function m(t){var n=s,i=o;return s=o=r,u=t,l=e.apply(i,n)}function b(e){var n=e-h;return h===r||n>=t||n<0||d&&e-u>=a}function g(){var e=To();if(b(e))return y(e);c=Ms(g,function(e){var r=t-(e-h);return d?yr(r,a-(e-u)):r}(e))}function y(e){return c=r,p&&s?m(e):(s=o=r,l)}function v(){var e=To(),n=b(e);if(s=arguments,o=this,h=e,n){if(c===r)return function(e){return u=e,c=Ms(g,t),f?m(e):l}(h);if(d)return xi(c),c=Ms(g,t),m(h)}return c===r&&(c=Ms(g,t)),l}return t=ba(t)||0,ea(i)&&(f=!!i.leading,a=(d="maxWait"in i)?gr(ba(i.maxWait)||0,t):a,p="trailing"in i?!!i.trailing:p),v.cancel=function(){c!==r&&xi(c),u=0,s=h=o=c=r},v.flush=function(){return c===r?l:y(To())},v}var Io=Gn((function(e,t){return hn(e,1,t)})),No=Gn((function(e,t,r){return hn(e,ba(t)||0,r)}));function Fo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ae(n);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(Fo.Cache||qr),r}function Po(e){if("function"!=typeof e)throw new Ae(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Fo.Cache=qr;var jo=wi((function(e,t){var r=(t=1==t.length&&Wo(t[0])?Ft(t[0],Jt(ls())):Ft(gn(t,1),Jt(ls()))).length;return Gn((function(n){for(var i=-1,s=yr(n.length,r);++i<s;)n[i]=t[i].call(this,n[i]);return Tt(e,this,n)}))})),Lo=Gn((function(e,t){var n=cr(t,as(Lo));return Zi(e,l,r,t,n)})),Do=Gn((function(e,t){var n=cr(t,as(Do));return Zi(e,c,r,t,n)})),Bo=rs((function(e,t){return Zi(e,u,r,r,r,t)}));function Ho(e,t){return e===t||e!=e&&t!=t}var zo=qi(Tn),Uo=qi((function(e,t){return e>=t})),Vo=On(function(){return arguments}())?On:function(e){return ta(e)&&Pe.call(e,"callee")&&!Ye.call(e,"callee")},Wo=a.isArray,$o=wt?Jt(wt):function(e){return ta(e)&&Sn(e)==N};function qo(e){return null!=e&&Qo(e.length)&&!Zo(e)}function Ko(e){return ta(e)&&qo(e)}var Yo=yt||bl,Xo=_t?Jt(_t):function(e){return ta(e)&&Sn(e)==w};function Go(e){if(!ta(e))return!1;var t=Sn(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ia(e)}function Zo(e){if(!ea(e))return!1;var t=Sn(e);return t==x||t==C||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Jo(e){return"number"==typeof e&&e==pa(e)}function Qo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=d}function ea(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ta(e){return null!=e&&"object"==typeof e}var ra=xt?Jt(xt):function(e){return ta(e)&&ps(e)==E};function na(e){return"number"==typeof e||ta(e)&&Sn(e)==S}function ia(e){if(!ta(e)||Sn(e)!=T)return!1;var t=qe(e);if(null===t)return!0;var r=Pe.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Fe.call(r)==Be}var sa=Ct?Jt(Ct):function(e){return ta(e)&&Sn(e)==k};var oa=Et?Jt(Et):function(e){return ta(e)&&ps(e)==A};function aa(e){return"string"==typeof e||!Wo(e)&&ta(e)&&Sn(e)==M}function la(e){return"symbol"==typeof e||ta(e)&&Sn(e)==O}var ca=St?Jt(St):function(e){return ta(e)&&Qo(e.length)&&!!at[Sn(e)]};var ha=qi(Dn),ua=qi((function(e,t){return e<=t}));function fa(e){if(!e)return[];if(qo(e))return aa(e)?dr(e):Ai(e);if(Ze&&e[Ze])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[Ze]());var t=ps(e);return(t==E?ar:t==A?hr:Ha)(e)}function da(e){return e?(e=ba(e))===f||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function pa(e){var t=da(e),r=t%1;return t==t?r?t-r:t:0}function ma(e){return e?an(pa(e),0,m):0}function ba(e){if("number"==typeof e)return e;if(la(e))return p;if(ea(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ea(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Zt(e);var r=be.test(e);return r||ye.test(e)?ut(e.slice(2),r?2:8):me.test(e)?p:+e}function ga(e){return Mi(e,Ia(e))}function ya(e){return null==e?"":ci(e)}var va=Ii((function(e,t){if(Cs(t)||qo(t))Mi(t,Oa(t),e);else for(var r in t)Pe.call(t,r)&&en(e,r,t[r])})),wa=Ii((function(e,t){Mi(t,Ia(t),e)})),_a=Ii((function(e,t,r,n){Mi(t,Ia(t),e,n)})),xa=Ii((function(e,t,r,n){Mi(t,Oa(t),e,n)})),Ca=rs(on);var Ea=Gn((function(e,t){e=Te(e);var n=-1,i=t.length,s=i>2?t[2]:r;for(s&&vs(t[0],t[1],s)&&(i=1);++n<i;)for(var o=t[n],a=Ia(o),l=-1,c=a.length;++l<c;){var h=a[l],u=e[h];(u===r||Ho(u,Ie[h])&&!Pe.call(e,h))&&(e[h]=o[h])}return e})),Sa=Gn((function(e){return e.push(r,Qi),Tt(Fa,r,e)}));function Ta(e,t,n){var i=null==e?r:Cn(e,t);return i===r?n:i}function Ra(e,t){return null!=e&&ms(e,t,kn)}var ka=zi((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),e[t]=r}),el(nl)),Aa=zi((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),Pe.call(e,t)?e[t].push(r):e[t]=[r]}),ls),Ma=Gn(Mn);function Oa(e){return qo(e)?Xr(e):jn(e)}function Ia(e){return qo(e)?Xr(e,!0):Ln(e)}var Na=Ii((function(e,t,r){Un(e,t,r)})),Fa=Ii((function(e,t,r,n){Un(e,t,r,n)})),Pa=rs((function(e,t){var r={};if(null==e)return r;var n=!1;t=Ft(t,(function(t){return t=vi(t,e),n||(n=t.length>1),t})),Mi(e,is(e),r),n&&(r=ln(r,7,es));for(var i=t.length;i--;)ui(r,t[i]);return r}));var ja=rs((function(e,t){return null==e?{}:function(e,t){return $n(e,t,(function(t,r){return Ra(e,r)}))}(e,t)}));function La(e,t){if(null==e)return{};var r=Ft(is(e),(function(e){return[e]}));return t=ls(t),$n(e,r,(function(e,r){return t(e,r[0])}))}var Da=Gi(Oa),Ba=Gi(Ia);function Ha(e){return null==e?[]:Qt(e,Oa(e))}var za=ji((function(e,t,r){return t=t.toLowerCase(),e+(r?Ua(t):t)}));function Ua(e){return Ga(ya(e).toLowerCase())}function Va(e){return(e=ya(e))&&e.replace(we,nr).replace(et,"")}var Wa=ji((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),$a=ji((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),qa=Pi("toLowerCase");var Ka=ji((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}));var Ya=ji((function(e,t,r){return e+(r?" ":"")+Ga(t)}));var Xa=ji((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Ga=Pi("toUpperCase");function Za(e,t,n){return e=ya(e),(t=n?r:t)===r?function(e){return it.test(e)}(e)?function(e){return e.match(rt)||[]}(e):function(e){return e.match(he)||[]}(e):e.match(t)||[]}var Ja=Gn((function(e,t){try{return Tt(e,r,t)}catch(e){return Go(e)?e:new Ce(e)}})),Qa=rs((function(e,t){return kt(t,(function(t){t=js(t),sn(e,t,Ao(e[t],e))})),e}));function el(e){return function(){return e}}var tl=Bi(),rl=Bi(!0);function nl(e){return e}function il(e){return Pn("function"==typeof e?e:ln(e,1))}var sl=Gn((function(e,t){return function(r){return Mn(r,e,t)}})),ol=Gn((function(e,t){return function(r){return Mn(e,r,t)}}));function al(e,t,r){var n=Oa(t),i=xn(t,n);null!=r||ea(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=xn(t,Oa(t)));var s=!(ea(r)&&"chain"in r&&!r.chain),o=Zo(e);return kt(i,(function(r){var n=t[r];e[r]=n,o&&(e.prototype[r]=function(){var t=this.__chain__;if(s||t){var r=e(this.__wrapped__);return(r.__actions__=Ai(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,Pt([this.value()],arguments))})})),e}function ll(){}var cl=Vi(Ft),hl=Vi(Mt),ul=Vi(Dt);function fl(e){return ws(e)?qt(js(e)):function(e){return function(t){return Cn(t,e)}}(e)}var dl=$i(),pl=$i(!0);function ml(){return[]}function bl(){return!1}var gl=Ui((function(e,t){return e+t}),0),yl=Yi("ceil"),vl=Ui((function(e,t){return e/t}),1),wl=Yi("floor");var _l,xl=Ui((function(e,t){return e*t}),1),Cl=Yi("round"),El=Ui((function(e,t){return e-t}),0);return Br.after=function(e,t){if("function"!=typeof t)throw new Ae(n);return e=pa(e),function(){if(--e<1)return t.apply(this,arguments)}},Br.ary=Ro,Br.assign=va,Br.assignIn=wa,Br.assignInWith=_a,Br.assignWith=xa,Br.at=Ca,Br.before=ko,Br.bind=Ao,Br.bindAll=Qa,Br.bindKey=Mo,Br.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wo(e)?e:[e]},Br.chain=uo,Br.chunk=function(e,t,n){t=(n?vs(e,t,n):t===r)?1:gr(pa(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var s=0,o=0,l=a(dt(i/t));s<i;)l[o++]=ni(e,s,s+=t);return l},Br.compact=function(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var s=e[t];s&&(i[n++]=s)}return i},Br.concat=function(){var e=arguments.length;if(!e)return[];for(var t=a(e-1),r=arguments[0],n=e;n--;)t[n-1]=arguments[n];return Pt(Wo(r)?Ai(r):[r],gn(t,1))},Br.cond=function(e){var t=null==e?0:e.length,r=ls();return e=t?Ft(e,(function(e){if("function"!=typeof e[1])throw new Ae(n);return[r(e[0]),e[1]]})):[],Gn((function(r){for(var n=-1;++n<t;){var i=e[n];if(Tt(i[0],this,r))return Tt(i[1],this,r)}}))},Br.conforms=function(e){return function(e){var t=Oa(e);return function(r){return cn(r,e,t)}}(ln(e,1))},Br.constant=el,Br.countBy=mo,Br.create=function(e,t){var r=Hr(e);return null==t?r:nn(r,t)},Br.curry=function e(t,n,i){var s=Zi(t,8,r,r,r,r,r,n=i?r:n);return s.placeholder=e.placeholder,s},Br.curryRight=function e(t,n,i){var s=Zi(t,o,r,r,r,r,r,n=i?r:n);return s.placeholder=e.placeholder,s},Br.debounce=Oo,Br.defaults=Ea,Br.defaultsDeep=Sa,Br.defer=Io,Br.delay=No,Br.difference=Bs,Br.differenceBy=Hs,Br.differenceWith=zs,Br.drop=function(e,t,n){var i=null==e?0:e.length;return i?ni(e,(t=n||t===r?1:pa(t))<0?0:t,i):[]},Br.dropRight=function(e,t,n){var i=null==e?0:e.length;return i?ni(e,0,(t=i-(t=n||t===r?1:pa(t)))<0?0:t):[]},Br.dropRightWhile=function(e,t){return e&&e.length?di(e,ls(t,3),!0,!0):[]},Br.dropWhile=function(e,t){return e&&e.length?di(e,ls(t,3),!0):[]},Br.fill=function(e,t,n,i){var s=null==e?0:e.length;return s?(n&&"number"!=typeof n&&vs(e,t,n)&&(n=0,i=s),function(e,t,n,i){var s=e.length;for((n=pa(n))<0&&(n=-n>s?0:s+n),(i=i===r||i>s?s:pa(i))<0&&(i+=s),i=n>i?0:ma(i);n<i;)e[n++]=t;return e}(e,t,n,i)):[]},Br.filter=function(e,t){return(Wo(e)?Ot:bn)(e,ls(t,3))},Br.flatMap=function(e,t){return gn(Co(e,t),1)},Br.flatMapDeep=function(e,t){return gn(Co(e,t),f)},Br.flatMapDepth=function(e,t,n){return n=n===r?1:pa(n),gn(Co(e,t),n)},Br.flatten=Ws,Br.flattenDeep=function(e){return(null==e?0:e.length)?gn(e,f):[]},Br.flattenDepth=function(e,t){return(null==e?0:e.length)?gn(e,t=t===r?1:pa(t)):[]},Br.flip=function(e){return Zi(e,512)},Br.flow=tl,Br.flowRight=rl,Br.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,n={};++t<r;){var i=e[t];n[i[0]]=i[1]}return n},Br.functions=function(e){return null==e?[]:xn(e,Oa(e))},Br.functionsIn=function(e){return null==e?[]:xn(e,Ia(e))},Br.groupBy=wo,Br.initial=function(e){return(null==e?0:e.length)?ni(e,0,-1):[]},Br.intersection=qs,Br.intersectionBy=Ks,Br.intersectionWith=Ys,Br.invert=ka,Br.invertBy=Aa,Br.invokeMap=_o,Br.iteratee=il,Br.keyBy=xo,Br.keys=Oa,Br.keysIn=Ia,Br.map=Co,Br.mapKeys=function(e,t){var r={};return t=ls(t,3),wn(e,(function(e,n,i){sn(r,t(e,n,i),e)})),r},Br.mapValues=function(e,t){var r={};return t=ls(t,3),wn(e,(function(e,n,i){sn(r,n,t(e,n,i))})),r},Br.matches=function(e){return Hn(ln(e,1))},Br.matchesProperty=function(e,t){return zn(e,ln(t,1))},Br.memoize=Fo,Br.merge=Na,Br.mergeWith=Fa,Br.method=sl,Br.methodOf=ol,Br.mixin=al,Br.negate=Po,Br.nthArg=function(e){return e=pa(e),Gn((function(t){return Vn(t,e)}))},Br.omit=Pa,Br.omitBy=function(e,t){return La(e,Po(ls(t)))},Br.once=function(e){return ko(2,e)},Br.orderBy=function(e,t,n,i){return null==e?[]:(Wo(t)||(t=null==t?[]:[t]),Wo(n=i?r:n)||(n=null==n?[]:[n]),Wn(e,t,n))},Br.over=cl,Br.overArgs=jo,Br.overEvery=hl,Br.overSome=ul,Br.partial=Lo,Br.partialRight=Do,Br.partition=Eo,Br.pick=ja,Br.pickBy=La,Br.property=fl,Br.propertyOf=function(e){return function(t){return null==e?r:Cn(e,t)}},Br.pull=Gs,Br.pullAll=Zs,Br.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?qn(e,t,ls(r,2)):e},Br.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?qn(e,t,r,n):e},Br.pullAt=Js,Br.range=dl,Br.rangeRight=pl,Br.rearg=Bo,Br.reject=function(e,t){return(Wo(e)?Ot:bn)(e,Po(ls(t,3)))},Br.remove=function(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],s=e.length;for(t=ls(t,3);++n<s;){var o=e[n];t(o,n,e)&&(r.push(o),i.push(n))}return Kn(e,i),r},Br.rest=function(e,t){if("function"!=typeof e)throw new Ae(n);return Gn(e,t=t===r?t:pa(t))},Br.reverse=Qs,Br.sampleSize=function(e,t,n){return t=(n?vs(e,t,n):t===r)?1:pa(t),(Wo(e)?Zr:Jn)(e,t)},Br.set=function(e,t,r){return null==e?e:Qn(e,t,r)},Br.setWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:Qn(e,t,n,i)},Br.shuffle=function(e){return(Wo(e)?Jr:ri)(e)},Br.slice=function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&vs(e,t,n)?(t=0,n=i):(t=null==t?0:pa(t),n=n===r?i:pa(n)),ni(e,t,n)):[]},Br.sortBy=So,Br.sortedUniq=function(e){return e&&e.length?ai(e):[]},Br.sortedUniqBy=function(e,t){return e&&e.length?ai(e,ls(t,2)):[]},Br.split=function(e,t,n){return n&&"number"!=typeof n&&vs(e,t,n)&&(t=n=r),(n=n===r?m:n>>>0)?(e=ya(e))&&("string"==typeof t||null!=t&&!sa(t))&&!(t=ci(t))&&or(e)?_i(dr(e),0,n):e.split(t,n):[]},Br.spread=function(e,t){if("function"!=typeof e)throw new Ae(n);return t=null==t?0:gr(pa(t),0),Gn((function(r){var n=r[t],i=_i(r,0,t);return n&&Pt(i,n),Tt(e,this,i)}))},Br.tail=function(e){var t=null==e?0:e.length;return t?ni(e,1,t):[]},Br.take=function(e,t,n){return e&&e.length?ni(e,0,(t=n||t===r?1:pa(t))<0?0:t):[]},Br.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?ni(e,(t=i-(t=n||t===r?1:pa(t)))<0?0:t,i):[]},Br.takeRightWhile=function(e,t){return e&&e.length?di(e,ls(t,3),!1,!0):[]},Br.takeWhile=function(e,t){return e&&e.length?di(e,ls(t,3)):[]},Br.tap=function(e,t){return t(e),e},Br.throttle=function(e,t,r){var i=!0,s=!0;if("function"!=typeof e)throw new Ae(n);return ea(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),Oo(e,t,{leading:i,maxWait:t,trailing:s})},Br.thru=fo,Br.toArray=fa,Br.toPairs=Da,Br.toPairsIn=Ba,Br.toPath=function(e){return Wo(e)?Ft(e,js):la(e)?[e]:Ai(Ps(ya(e)))},Br.toPlainObject=ga,Br.transform=function(e,t,r){var n=Wo(e),i=n||Yo(e)||ca(e);if(t=ls(t,4),null==r){var s=e&&e.constructor;r=i?n?new s:[]:ea(e)&&Zo(s)?Hr(qe(e)):{}}return(i?kt:wn)(e,(function(e,n,i){return t(r,e,n,i)})),r},Br.unary=function(e){return Ro(e,1)},Br.union=eo,Br.unionBy=to,Br.unionWith=ro,Br.uniq=function(e){return e&&e.length?hi(e):[]},Br.uniqBy=function(e,t){return e&&e.length?hi(e,ls(t,2)):[]},Br.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?hi(e,r,t):[]},Br.unset=function(e,t){return null==e||ui(e,t)},Br.unzip=no,Br.unzipWith=io,Br.update=function(e,t,r){return null==e?e:fi(e,t,yi(r))},Br.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:fi(e,t,yi(n),i)},Br.values=Ha,Br.valuesIn=function(e){return null==e?[]:Qt(e,Ia(e))},Br.without=so,Br.words=Za,Br.wrap=function(e,t){return Lo(yi(t),e)},Br.xor=oo,Br.xorBy=ao,Br.xorWith=lo,Br.zip=co,Br.zipObject=function(e,t){return bi(e||[],t||[],en)},Br.zipObjectDeep=function(e,t){return bi(e||[],t||[],Qn)},Br.zipWith=ho,Br.entries=Da,Br.entriesIn=Ba,Br.extend=wa,Br.extendWith=_a,al(Br,Br),Br.add=gl,Br.attempt=Ja,Br.camelCase=za,Br.capitalize=Ua,Br.ceil=yl,Br.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=ba(n))==n?n:0),t!==r&&(t=(t=ba(t))==t?t:0),an(ba(e),t,n)},Br.clone=function(e){return ln(e,4)},Br.cloneDeep=function(e){return ln(e,5)},Br.cloneDeepWith=function(e,t){return ln(e,5,t="function"==typeof t?t:r)},Br.cloneWith=function(e,t){return ln(e,4,t="function"==typeof t?t:r)},Br.conformsTo=function(e,t){return null==t||cn(e,t,Oa(t))},Br.deburr=Va,Br.defaultTo=function(e,t){return null==e||e!=e?t:e},Br.divide=vl,Br.endsWith=function(e,t,n){e=ya(e),t=ci(t);var i=e.length,s=n=n===r?i:an(pa(n),0,i);return(n-=t.length)>=0&&e.slice(n,s)==t},Br.eq=Ho,Br.escape=function(e){return(e=ya(e))&&G.test(e)?e.replace(Y,ir):e},Br.escapeRegExp=function(e){return(e=ya(e))&&ie.test(e)?e.replace(ne,"\\$&"):e},Br.every=function(e,t,n){var i=Wo(e)?Mt:pn;return n&&vs(e,t,n)&&(t=r),i(e,ls(t,3))},Br.find=bo,Br.findIndex=Us,Br.findKey=function(e,t){return Ht(e,ls(t,3),wn)},Br.findLast=go,Br.findLastIndex=Vs,Br.findLastKey=function(e,t){return Ht(e,ls(t,3),_n)},Br.floor=wl,Br.forEach=yo,Br.forEachRight=vo,Br.forIn=function(e,t){return null==e?e:yn(e,ls(t,3),Ia)},Br.forInRight=function(e,t){return null==e?e:vn(e,ls(t,3),Ia)},Br.forOwn=function(e,t){return e&&wn(e,ls(t,3))},Br.forOwnRight=function(e,t){return e&&_n(e,ls(t,3))},Br.get=Ta,Br.gt=zo,Br.gte=Uo,Br.has=function(e,t){return null!=e&&ms(e,t,Rn)},Br.hasIn=Ra,Br.head=$s,Br.identity=nl,Br.includes=function(e,t,r,n){e=qo(e)?e:Ha(e),r=r&&!n?pa(r):0;var i=e.length;return r<0&&(r=gr(i+r,0)),aa(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&Ut(e,t,r)>-1},Br.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:pa(r);return i<0&&(i=gr(n+i,0)),Ut(e,t,i)},Br.inRange=function(e,t,n){return t=da(t),n===r?(n=t,t=0):n=da(n),function(e,t,r){return e>=yr(t,r)&&e<gr(t,r)}(e=ba(e),t,n)},Br.invoke=Ma,Br.isArguments=Vo,Br.isArray=Wo,Br.isArrayBuffer=$o,Br.isArrayLike=qo,Br.isArrayLikeObject=Ko,Br.isBoolean=function(e){return!0===e||!1===e||ta(e)&&Sn(e)==v},Br.isBuffer=Yo,Br.isDate=Xo,Br.isElement=function(e){return ta(e)&&1===e.nodeType&&!ia(e)},Br.isEmpty=function(e){if(null==e)return!0;if(qo(e)&&(Wo(e)||"string"==typeof e||"function"==typeof e.splice||Yo(e)||ca(e)||Vo(e)))return!e.length;var t=ps(e);if(t==E||t==A)return!e.size;if(Cs(e))return!jn(e).length;for(var r in e)if(Pe.call(e,r))return!1;return!0},Br.isEqual=function(e,t){return In(e,t)},Br.isEqualWith=function(e,t,n){var i=(n="function"==typeof n?n:r)?n(e,t):r;return i===r?In(e,t,r,n):!!i},Br.isError=Go,Br.isFinite=function(e){return"number"==typeof e&&vt(e)},Br.isFunction=Zo,Br.isInteger=Jo,Br.isLength=Qo,Br.isMap=ra,Br.isMatch=function(e,t){return e===t||Nn(e,t,hs(t))},Br.isMatchWith=function(e,t,n){return n="function"==typeof n?n:r,Nn(e,t,hs(t),n)},Br.isNaN=function(e){return na(e)&&e!=+e},Br.isNative=function(e){if(xs(e))throw new Ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Fn(e)},Br.isNil=function(e){return null==e},Br.isNull=function(e){return null===e},Br.isNumber=na,Br.isObject=ea,Br.isObjectLike=ta,Br.isPlainObject=ia,Br.isRegExp=sa,Br.isSafeInteger=function(e){return Jo(e)&&e>=-9007199254740991&&e<=d},Br.isSet=oa,Br.isString=aa,Br.isSymbol=la,Br.isTypedArray=ca,Br.isUndefined=function(e){return e===r},Br.isWeakMap=function(e){return ta(e)&&ps(e)==I},Br.isWeakSet=function(e){return ta(e)&&"[object WeakSet]"==Sn(e)},Br.join=function(e,t){return null==e?"":Bt.call(e,t)},Br.kebabCase=Wa,Br.last=Xs,Br.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var s=i;return n!==r&&(s=(s=pa(n))<0?gr(i+s,0):yr(s,i-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,s):zt(e,Wt,s,!0)},Br.lowerCase=$a,Br.lowerFirst=qa,Br.lt=ha,Br.lte=ua,Br.max=function(e){return e&&e.length?mn(e,nl,Tn):r},Br.maxBy=function(e,t){return e&&e.length?mn(e,ls(t,2),Tn):r},Br.mean=function(e){return $t(e,nl)},Br.meanBy=function(e,t){return $t(e,ls(t,2))},Br.min=function(e){return e&&e.length?mn(e,nl,Dn):r},Br.minBy=function(e,t){return e&&e.length?mn(e,ls(t,2),Dn):r},Br.stubArray=ml,Br.stubFalse=bl,Br.stubObject=function(){return{}},Br.stubString=function(){return""},Br.stubTrue=function(){return!0},Br.multiply=xl,Br.nth=function(e,t){return e&&e.length?Vn(e,pa(t)):r},Br.noConflict=function(){return pt._===this&&(pt._=He),this},Br.noop=ll,Br.now=To,Br.pad=function(e,t,r){e=ya(e);var n=(t=pa(t))?fr(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Wi(mt(i),r)+e+Wi(dt(i),r)},Br.padEnd=function(e,t,r){e=ya(e);var n=(t=pa(t))?fr(e):0;return t&&n<t?e+Wi(t-n,r):e},Br.padStart=function(e,t,r){e=ya(e);var n=(t=pa(t))?fr(e):0;return t&&n<t?Wi(t-n,r)+e:e},Br.parseInt=function(e,t,r){return r||null==t?t=0:t&&(t=+t),wr(ya(e).replace(se,""),t||0)},Br.random=function(e,t,n){if(n&&"boolean"!=typeof n&&vs(e,t,n)&&(t=n=r),n===r&&("boolean"==typeof t?(n=t,t=r):"boolean"==typeof e&&(n=e,e=r)),e===r&&t===r?(e=0,t=1):(e=da(e),t===r?(t=e,e=0):t=da(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var s=_r();return yr(e+s*(t-e+ht("1e-"+((s+"").length-1))),t)}return Yn(e,t)},Br.reduce=function(e,t,r){var n=Wo(e)?jt:Yt,i=arguments.length<3;return n(e,ls(t,4),r,i,fn)},Br.reduceRight=function(e,t,r){var n=Wo(e)?Lt:Yt,i=arguments.length<3;return n(e,ls(t,4),r,i,dn)},Br.repeat=function(e,t,n){return t=(n?vs(e,t,n):t===r)?1:pa(t),Xn(ya(e),t)},Br.replace=function(){var e=arguments,t=ya(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Br.result=function(e,t,n){var i=-1,s=(t=vi(t,e)).length;for(s||(s=1,e=r);++i<s;){var o=null==e?r:e[js(t[i])];o===r&&(i=s,o=n),e=Zo(o)?o.call(e):o}return e},Br.round=Cl,Br.runInContext=e,Br.sample=function(e){return(Wo(e)?Gr:Zn)(e)},Br.size=function(e){if(null==e)return 0;if(qo(e))return aa(e)?fr(e):e.length;var t=ps(e);return t==E||t==A?e.size:jn(e).length},Br.snakeCase=Ka,Br.some=function(e,t,n){var i=Wo(e)?Dt:ii;return n&&vs(e,t,n)&&(t=r),i(e,ls(t,3))},Br.sortedIndex=function(e,t){return si(e,t)},Br.sortedIndexBy=function(e,t,r){return oi(e,t,ls(r,2))},Br.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var n=si(e,t);if(n<r&&Ho(e[n],t))return n}return-1},Br.sortedLastIndex=function(e,t){return si(e,t,!0)},Br.sortedLastIndexBy=function(e,t,r){return oi(e,t,ls(r,2),!0)},Br.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var r=si(e,t,!0)-1;if(Ho(e[r],t))return r}return-1},Br.startCase=Ya,Br.startsWith=function(e,t,r){return e=ya(e),r=null==r?0:an(pa(r),0,e.length),t=ci(t),e.slice(r,r+t.length)==t},Br.subtract=El,Br.sum=function(e){return e&&e.length?Xt(e,nl):0},Br.sumBy=function(e,t){return e&&e.length?Xt(e,ls(t,2)):0},Br.template=function(e,t,n){var i=Br.templateSettings;n&&vs(e,t,n)&&(t=r),e=ya(e),t=_a({},t,i,Ji);var s,o,a=_a({},t.imports,i.imports,Ji),l=Oa(a),c=Qt(a,l),h=0,u=t.interpolate||_e,f="__p += '",d=Re((t.escape||_e).source+"|"+u.source+"|"+(u===Q?de:_e).source+"|"+(t.evaluate||_e).source+"|$","g"),p="//# sourceURL="+(Pe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ot+"]")+"\n";e.replace(d,(function(t,r,n,i,a,l){return n||(n=i),f+=e.slice(h,l).replace(xe,sr),r&&(s=!0,f+="' +\n__e("+r+") +\n'"),a&&(o=!0,f+="';\n"+a+";\n__p += '"),n&&(f+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),h=l+t.length,t})),f+="';\n";var m=Pe.call(t,"variable")&&t.variable;if(m){if(ue.test(m))throw new Ce("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(o?f.replace(W,""):f).replace($,"$1").replace(q,"$1;"),f="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(s?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var b=Ja((function(){return Ee(l,p+"return "+f).apply(r,c)}));if(b.source=f,Go(b))throw b;return b},Br.times=function(e,t){if((e=pa(e))<1||e>d)return[];var r=m,n=yr(e,m);t=ls(t),e-=m;for(var i=Gt(n,t);++r<e;)t(r);return i},Br.toFinite=da,Br.toInteger=pa,Br.toLength=ma,Br.toLower=function(e){return ya(e).toLowerCase()},Br.toNumber=ba,Br.toSafeInteger=function(e){return e?an(pa(e),-9007199254740991,d):0===e?e:0},Br.toString=ya,Br.toUpper=function(e){return ya(e).toUpperCase()},Br.trim=function(e,t,n){if((e=ya(e))&&(n||t===r))return Zt(e);if(!e||!(t=ci(t)))return e;var i=dr(e),s=dr(t);return _i(i,tr(i,s),rr(i,s)+1).join("")},Br.trimEnd=function(e,t,n){if((e=ya(e))&&(n||t===r))return e.slice(0,pr(e)+1);if(!e||!(t=ci(t)))return e;var i=dr(e);return _i(i,0,rr(i,dr(t))+1).join("")},Br.trimStart=function(e,t,n){if((e=ya(e))&&(n||t===r))return e.replace(se,"");if(!e||!(t=ci(t)))return e;var i=dr(e);return _i(i,tr(i,dr(t))).join("")},Br.truncate=function(e,t){var n=30,i="...";if(ea(t)){var s="separator"in t?t.separator:s;n="length"in t?pa(t.length):n,i="omission"in t?ci(t.omission):i}var o=(e=ya(e)).length;if(or(e)){var a=dr(e);o=a.length}if(n>=o)return e;var l=n-fr(i);if(l<1)return i;var c=a?_i(a,0,l).join(""):e.slice(0,l);if(s===r)return c+i;if(a&&(l+=c.length-l),sa(s)){if(e.slice(l).search(s)){var h,u=c;for(s.global||(s=Re(s.source,ya(pe.exec(s))+"g")),s.lastIndex=0;h=s.exec(u);)var f=h.index;c=c.slice(0,f===r?l:f)}}else if(e.indexOf(ci(s),l)!=l){var d=c.lastIndexOf(s);d>-1&&(c=c.slice(0,d))}return c+i},Br.unescape=function(e){return(e=ya(e))&&X.test(e)?e.replace(K,mr):e},Br.uniqueId=function(e){var t=++je;return ya(e)+t},Br.upperCase=Xa,Br.upperFirst=Ga,Br.each=yo,Br.eachRight=vo,Br.first=$s,al(Br,(_l={},wn(Br,(function(e,t){Pe.call(Br.prototype,t)||(_l[t]=e)})),_l),{chain:!1}),Br.VERSION="4.17.21",kt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Br[e].placeholder=Br})),kt(["drop","take"],(function(e,t){Vr.prototype[e]=function(n){n=n===r?1:gr(pa(n),0);var i=this.__filtered__&&!t?new Vr(this):this.clone();return i.__filtered__?i.__takeCount__=yr(n,i.__takeCount__):i.__views__.push({size:yr(n,m),type:e+(i.__dir__<0?"Right":"")}),i},Vr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),kt(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;Vr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:ls(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),kt(["head","last"],(function(e,t){var r="take"+(t?"Right":"");Vr.prototype[e]=function(){return this[r](1).value()[0]}})),kt(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");Vr.prototype[e]=function(){return this.__filtered__?new Vr(this):this[r](1)}})),Vr.prototype.compact=function(){return this.filter(nl)},Vr.prototype.find=function(e){return this.filter(e).head()},Vr.prototype.findLast=function(e){return this.reverse().find(e)},Vr.prototype.invokeMap=Gn((function(e,t){return"function"==typeof e?new Vr(this):this.map((function(r){return Mn(r,e,t)}))})),Vr.prototype.reject=function(e){return this.filter(Po(ls(e)))},Vr.prototype.slice=function(e,t){e=pa(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Vr(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(n=(t=pa(t))<0?n.dropRight(-t):n.take(t-e)),n)},Vr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Vr.prototype.toArray=function(){return this.take(m)},wn(Vr.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),s=Br[i?"take"+("last"==t?"Right":""):t],o=i||/^find/.test(t);s&&(Br.prototype[t]=function(){var t=this.__wrapped__,a=i?[1]:arguments,l=t instanceof Vr,c=a[0],h=l||Wo(t),u=function(e){var t=s.apply(Br,Pt([e],a));return i&&f?t[0]:t};h&&n&&"function"==typeof c&&1!=c.length&&(l=h=!1);var f=this.__chain__,d=!!this.__actions__.length,p=o&&!f,m=l&&!d;if(!o&&h){t=m?t:new Vr(this);var b=e.apply(t,a);return b.__actions__.push({func:fo,args:[u],thisArg:r}),new Ur(b,f)}return p&&m?e.apply(this,a):(b=this.thru(u),p?i?b.value()[0]:b.value():b)})})),kt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Me[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Br.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(Wo(i)?i:[],e)}return this[r]((function(r){return t.apply(Wo(r)?r:[],e)}))}})),wn(Vr.prototype,(function(e,t){var r=Br[t];if(r){var n=r.name+"";Pe.call(Mr,n)||(Mr[n]=[]),Mr[n].push({name:t,func:r})}})),Mr[Hi(r,2).name]=[{name:"wrapper",func:r}],Vr.prototype.clone=function(){var e=new Vr(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Vr.prototype.reverse=function(){if(this.__filtered__){var e=new Vr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Vr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Wo(e),n=t<0,i=r?e.length:0,s=function(e,t,r){var n=-1,i=r.length;for(;++n<i;){var s=r[n],o=s.size;switch(s.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=yr(t,e+o);break;case"takeRight":e=gr(e,t-o)}}return{start:e,end:t}}(0,i,this.__views__),o=s.start,a=s.end,l=a-o,c=n?a:o-1,h=this.__iteratees__,u=h.length,f=0,d=yr(l,this.__takeCount__);if(!r||!n&&i==l&&d==l)return pi(e,this.__actions__);var p=[];e:for(;l--&&f<d;){for(var m=-1,b=e[c+=t];++m<u;){var g=h[m],y=g.iteratee,v=g.type,w=y(b);if(2==v)b=w;else if(!w){if(1==v)continue e;break e}}p[f++]=b}return p},Br.prototype.at=po,Br.prototype.chain=function(){return uo(this)},Br.prototype.commit=function(){return new Ur(this.value(),this.__chain__)},Br.prototype.next=function(){this.__values__===r&&(this.__values__=fa(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?r:this.__values__[this.__index__++]}},Br.prototype.plant=function(e){for(var t,n=this;n instanceof zr;){var i=Ds(n);i.__index__=0,i.__values__=r,t?s.__wrapped__=i:t=i;var s=i;n=n.__wrapped__}return s.__wrapped__=e,t},Br.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Vr){var t=e;return this.__actions__.length&&(t=new Vr(this)),(t=t.reverse()).__actions__.push({func:fo,args:[Qs],thisArg:r}),new Ur(t,this.__chain__)}return this.thru(Qs)},Br.prototype.toJSON=Br.prototype.valueOf=Br.prototype.value=function(){return pi(this.__wrapped__,this.__actions__)},Br.prototype.first=Br.prototype.head,Ze&&(Br.prototype[Ze]=function(){return this}),Br}();bt?((bt.exports=br)._=br,mt._=br):pt._=br}).call(a)}(Zi,Zi.exports);var Ji=Zi.exports;function Qi(e,t){let r="";for(let t=e+1;t>0;t=Math.floor((t-1)/26))r=String.fromCharCode((t-1)%26+65)+r;return r+(t+1)}function es(e){if(!e)return[0,0,0];if(e.startsWith("#")){let t=e.substring(1);3===t.length&&(t=t.replace(/(.)/g,"$1$1"));return[parseInt(t.substring(0,2),16),parseInt(t.substring(2,4),16),parseInt(t.substring(4,6),16)]}if(e.startsWith("rgb(")){return e.substring(4,e.length-1).split(",").map(Number)}if(e.startsWith("rgba(")){return e.substring(5,e.length-1).split(",").map(Number)}if(y(ns[e]))return[(t=ns[e])>>16,t>>8&255,255&t,1];if(y(rs[e]))return function(e){return[e>>>24,e>>>16&255,e>>>8&255,255&e]}(rs[e]);var t;throw new Error("Unsupported color format")}function ts(e){if(3===e.length&&e.push(1),4!==e.length)throw new Error("Invalid RGBA array");const[t,r,n,i]=e.map(Math.round);return`${Math.round(255*i).toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`}const rs={transparent:4294967040},ns={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function is(e,t){return{name:os(e.fontFamily)||"Arial",size:e.fontSize||10,bold:ss(e.fontWeight),italic:"italic"===e.fontStyle,color:us("link"===t?e._linkColor:e.color),underline:e.underline}}function ss(e){return"number"==typeof e?e>=600:Number(e)>=600||"bold"===e}function os(e){return e.split(",").map((e=>e.trim()))[0]}function as(e){return{type:"pattern",pattern:"solid",fgColor:us(e.bgColor)}}function ls(e){const{borderColor:t,borderLineWidth:r,borderLineDash:n,_strokeArrayWidth:i,_strokeArrayColor:s}=e;if(s||i){const e={};return s&&!s[0]||i&&!i[0]||(e.top={style:cs(i?.[0]??r,n),color:us(s?.[0]??t)}),s&&!s[1]||i&&!i[1]||(e.right={style:cs(i?.[1]??r,n),color:us(s?.[1]??t)}),s&&!s[2]||i&&!i[2]||(e.bottom={style:cs(i?.[2]??r,n),color:us(s?.[2]??t)}),s&&!s[3]||i&&!i[3]||(e.left={style:cs(i?.[3]??r,n),color:us(s?.[3]??t)}),e}if(0===r)return{};const o={style:cs(r,n),color:us(t)};return{top:o,left:o,bottom:o,right:o}}function cs(e,t){return t&&t.length?e<=2?"dashed":"mediumDashed":e<=.5?"hair":e<=1?"thin":e<=2?"medium":"thick"}function hs(e,t){return{horizontal:e.textAlign||"left",vertical:e.textBaseline||"middle",wrapText:e.autoWrapText||!1,indent:t||0}}function us(e){return{argb:ts(es(e))}}function fs(e,t,r){let n=0;const i=r.internalProps.layoutMap;if(i.isHeader(e,t)){const r=i.getHeader(e,t);f(r?.hierarchyLevel)&&(n=(r.hierarchyLevel??0)*(i.rowHierarchyIndent??0))}else{const s=r.getBodyColumnDefine(e,t);if(s?.tree){const s=r.dataSource.getIndexKey(r.getRecordShowIndexByCell(e,t));n=Array.isArray(s)&&"none"!==r.getHierarchyState(e,t)?(s.length-1)*(i.hierarchyIndent??0):0}}return n}function ds(e,t){const r=v(e.pagination),n=e.isPivotTable(),i=e.internalProps.layoutMap;let s=e.rowCount-1;return{reset:()=>{n&&t&&r&&(e.internalProps.layoutMap.setPagination(r),e.refreshRowColCount())},handleRowCount:()=>(t&&r&&(n?(e.internalProps.layoutMap.setPagination(void 0),e.refreshRowColCount(),s=e.rowCount-1):s=e.recordsCount*i.bodyRowSpanCount+i.headerLevelCount),s)}}function ps(e){return new Promise((t=>{requestIdleCallback((e=>{t(e)}),e)}))}async function ms(e,t,r=!1){const n=new Oi.Workbook,i=n.addWorksheet("sheet1");await bs(e,i,n,t,r);return await n.xlsx.writeBuffer()}async function bs(e,t,r,n,i=!1){const s=!!n?.exportAllData,{handleRowCount:o,reset:a}=ds(e,s);try{const s=0,a=o(),l=0,c=e.colCount-1;t.properties.defaultRowHeight=40;const h=[],u=[],f=new Set,d=100;let p=s;const m=async s=>{for(;p<=a&&(!i||s?.timeRemaining()>0);){const i=Math.min(p+d-1,a);for(let s=l;s<=c;s++){const o=e.getColWidth(s);void 0===h[s]&&(h[s]={width:o/6});for(let o=p;o<=i;o++){if(s===l){const r=e.getRowHeight(o);t.getRow(o+1).height=r}await ys(s,o,e,t,r,n);const i=e.getCellRange(s,o);if(i.start.col!==i.end.col||i.start.row!==i.end.row){const e=`${i.start.col},${i.start.row}:${i.end.col},${i.end.row}`;f.has(e)||(f.add(e),u.push(i))}}}p=i+1}if(p<=a){const e=i?await ps():void 0;await m(e)}};if(i){const e=await ps();await m(e)}else await m();t.columns=h,u.forEach((e=>{t.mergeCells(e.start.row+1,e.start.col+1,e.end.row+1,e.end.col+1)}));const b=[];e.frozenRowCount>0&&b.push({state:"frozen",ySplit:e.frozenRowCount,topLeftCell:Qi(0,e.frozenRowCount)}),e.frozenColCount>0&&b.push({state:"frozen",xSplit:e.frozenColCount,topLeftCell:Qi(e.frozenColCount,0)}),t.views=b,n?.excelJSWorksheetCallback&&n.excelJSWorksheetCallback(t)}finally{a()}}function gs(e,t){const r=function(e){const t=(e??"").toString().trim(),r=t.replace(/[:\\\/\?\*\[\]]/g," ").replace(/\s+/g," ").trim()||"sheet";return r.length>31?r.slice(0,31):r}(e)||"sheet";if(!t.has(r))return r;for(let e=2;e<1e4;e++){const n=`-${e}`,i=31-n.length,s=`${r.length>i?r.slice(0,i):r}${n}`;if(!t.has(s))return s}return`${r.slice(0,25)}-${Date.now().toString().slice(-5)}`}async function ys(e,t,n,i,s,o){const{layoutMap:a}=n.internalProps,l=n.getCellType(e,t),c=n.getCellRawRecord(e,t);let h=(c&&c.vtableMergeName)??n.getCellValue(e,t,!1);var f;!(f=h)||"object"!=typeof f&&"function"!=typeof f||"function"!=typeof f.then||(h=await h);const d=n.getCellStyle(e,t),m=n.getCellLocation(e,t),b="body"!==m?n.getHeaderDefine(e,t):n.getBodyColumnDefine(e,t);let g,y,v,w;if(("body"!==m||(b?.dragOrder||!!b?.icon||!!b?.tree))&&(g=n.getCellIcons(e,t)),"body"!==m?(y=b?.headerCustomRender,v=b?.headerCustomLayout):(y=b?.customRender||n.customRender,v=b?.customLayout),o?.formatExportOutput){const r={cellType:l,cellValue:h,table:n,col:e,row:t},s=o.formatExportOutput(r);if(void 0!==s){let r=i.getCell(Qi(e,t));r.value=s,r.font=is(d,l),r.fill=as(d),r.border=ls(d);const a=fs(e,t,n);if(r.alignment=hs(d,Math.ceil(a/r.font.size)),r&&o?.formatExcelJSCell){const i=o.formatExcelJSCell({cellType:l,cellValue:h,table:n,col:e,row:t},r);i&&(r=i)}return r}}if("image"===l||"video"===l||"progressbar"===l||"sparkline"===l||a.isAxisCell(e,t)||!o?.ignoreIcon&&p(g)&&g.length||y||v)if(ws(l,a.isAxisCell(e,t),!!y||!!v,!(o?.ignoreIcon||!p(g)||!g.length),o)){const r=vs(e,t,n),o=s.addImage({base64:r,extension:"png"});i.addImage(o,{tl:{col:e+1/80,row:t+1/120},br:{col:e+1,row:t+1},editAs:"oneCell"})}else w=i.getCell(Qi(e,t));else if("text"===l||"link"===l){let r;if(w=i.getCell(Qi(e,t)),"link"===l){const i=b.templateLink;if(i){const s=n.getCellOriginRecord(e,t);if(s&&s.vtableMerge);else{const o=n.getCellOriginValue(e,t),a=Object.assign({__value:h,__dataValue:o},s);if(u(i))r=i(a,e,t,n);else{const e=/\{\s*(\S+?)\s*\}/g;r=i.replace(e,((e,t)=>a[t]))}}}}w.value=function(e,t,r){if("link"===t)return{text:e,hyperlink:r||e,tooltip:e};return e}(h,l,r),w.font=is(d,l),w.fill=as(d),w.border=ls(d);const s=fs(e,t,n);w.alignment=hs(d,Math.ceil(s/w.font.size))}else if("chart"===l)if(ws("chart",!1,!1,!1,o)){const o=n.scenegraph.getCell(e,t);r.renderChart(o.firstChild);const a=vs(e,t,n),l=s.addImage({base64:a,extension:"png"});i.addImage(l,{tl:{col:e+1/80,row:t+1/120},br:{col:e+1,row:t+1},editAs:"oneCell"}),n.scenegraph.updateNextFrame()}else w=i.getCell(Qi(e,t));if(w&&o?.formatExcelJSCell){const r=o.formatExcelJSCell({cellType:l,cellValue:h,table:n,col:e,row:t},w);r&&(w=r)}return w}function vs(e,t,n){let i=n.scenegraph.getCell(e,t),s=!1;"empty"===i.role&&(i=r.updateCell(e,t,n,!0),i.setStage(n.scenegraph.stage),s=!0,i.stage.dirtyBounds.set(-1/0,-1/0,1/0,1/0));const o=i.attribute.stroke;i.attribute.stroke=!1;const a=r.graphicUtil.drawGraphicToCanvas(i,n.scenegraph.stage);return i.attribute.stroke=o,s&&i.parent?.removeChild(i),a.toDataURL()}function ws(e,t,r,n,i){return!i?.skipImageExportCellType||("image"===e||"video"===e||"progressbar"===e||"sparkline"===e||"chart"===e?!i.skipImageExportCellType.includes(e):t?!i.skipImageExportCellType.includes("chart"):r?!i.skipImageExportCellType.includes("custom"):!n||!i.skipImageExportCellType.includes("textWithIcon"))}function _s(e,t){const r=!!t?.exportAllData,{handleRowCount:n,reset:i}=ds(e,r),s=n(),o=e.colCount-1;let a="";for(let r=0;r<=s;r++){for(let n=0;n<=o;n++){const i=xs(n,r,e,t);if("undefined"!=typeof Promise&&i instanceof Promise);else{const e=`${void 0===i?"":i}`;/^\[object .*\]$/.exec(e)||(a+=e)}n!==o&&(a+=",")}a+="\r\n"}return i(),a}function xs(e,t,r,n){const i=r.getCellRawRecord(e,t),s=(i&&i.vtableMergeName)??r.getCellValue(e,t,!1);if(n?.formatExportOutput){const i={cellType:r.getCellType(e,t),cellValue:s,table:r,col:e,row:t},o=n.formatExportOutput(i);if(void 0!==o)return"string"==typeof o?'"'+o+'"':o}const o=r.getCellRange(e,t),a=o.start.col,l=o.start.row;if(a!==e||l!==t)return"";let c=s;return n?.escape?c=function(e){if("string"!=typeof e)return e;let t=e.replace(/"/g,'""');/[,"\r\n]/.test(t)&&(t=`"${t}"`);return t}(c):"string"==typeof c&&(c='"'+c+'"'),c}var Cs={exports:{}};!function(e,t){!function(){function t(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}function r(e,t,r){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){l(n.response,t,r)},n.onerror=function(){},n.send()}function n(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function i(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(r){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var s="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof a&&a.global===a?a:void 0,o=s.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=s.saveAs||("object"!=typeof window||window!==s?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(e,t,o){var a=s.URL||s.webkitURL,l=document.createElement("a");t=t||e.name||"download",l.download=t,l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?i(l):n(l.href)?r(e,t,o):i(l,l.target="_blank")):(l.href=a.createObjectURL(e),setTimeout((function(){a.revokeObjectURL(l.href)}),4e4),setTimeout((function(){i(l)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,s,o){if(s=s||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(t(e,o),s);else if(n(e))r(e,s,o);else{var a=document.createElement("a");a.href=e,a.target="_blank",setTimeout((function(){i(a)}))}}:function(e,t,n,i){if((i=i||open("","_blank"))&&(i.document.title=i.document.body.innerText="downloading..."),"string"==typeof e)return r(e,t,n);var a="application/octet-stream"===e.type,l=/constructor/i.test(s.HTMLElement)||s.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||a&&l||o)&&"undefined"!=typeof FileReader){var h=new FileReader;h.onloadend=function(){var e=h.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),i?i.location.href=e:location=e,i=null},h.readAsDataURL(e)}else{var u=s.URL||s.webkitURL,f=u.createObjectURL(e);i?i.location=f:location.href=f,i=null,setTimeout((function(){u.revokeObjectURL(f)}),4e4)}});s.saveAs=l.saveAs=l,e.exports=l}()}(Cs);var Es,Ss,Ts,Rs,ks=Cs.exports;async function As(e,t){const r=new Blob([e],{type:"application/octet-stream"});await ks.saveAs(r,`${t}.xlsx`)}function Ms(e){const t=Math.min(e.start.col,e.end.col),r=Math.min(e.start.row,e.end.row),n=Math.max(e.start.col,e.end.col),i=Math.max(e.start.row,e.end.row),s=[],o=[];for(let e=t;e<=n;e++)s.push(e);for(let e=r;e<=i;e++)o.push(e);return{cols:s,rows:o}}function Os(t,r,n){return t===e.Direction.DOWN||t===e.Direction.UP?{cols:n.cols,rows:n.rows.filter((e=>!r.rows.includes(e)))}:{cols:n.cols.filter((e=>!r.cols.includes(e))),rows:n.rows}}function Is(e,t,r){const n=e.scenegraph.highPerformanceGetCell(t,r).globalAABBBounds;e.showDropDownMenu(t,r,{content:[{type:"item",text:"复制填充",icon:{width:16,height:16,svg:'<svg t="1756136702877" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1474" width="200" height="200"><path d="M853.333333 981.333333h-384c-72.533333 0-128-55.466667-128-128v-384c0-72.533333 55.466667-128 128-128h384c72.533333 0 128 55.466667 128 128v384c0 72.533333-55.466667 128-128 128z m-384-554.666666c-25.6 0-42.666667 17.066667-42.666666 42.666666v384c0 25.6 17.066667 42.666667 42.666666 42.666667h384c25.6 0 42.666667-17.066667 42.666667-42.666667v-384c0-25.6-17.066667-42.666667-42.666667-42.666666h-384z" p-id="1475"></path><path d="M213.333333 682.666667H170.666667c-72.533333 0-128-55.466667-128-128V170.666667c0-72.533333 55.466667-128 128-128h384c72.533333 0 128 55.466667 128 128v42.666666c0 25.6-17.066667 42.666667-42.666667 42.666667s-42.666667-17.066667-42.666667-42.666667V170.666667c0-25.6-17.066667-42.666667-42.666666-42.666667H170.666667c-25.6 0-42.666667 17.066667-42.666667 42.666667v384c0 25.6 17.066667 42.666667 42.666667 42.666666h42.666666c25.6 0 42.666667 17.066667 42.666667 42.666667s-17.066667 42.666667-42.666667 42.666667z" p-id="1476"></path></svg>'}},{type:"item",text:"序列填充",icon:{width:16,height:16,svg:'<svg t="1756136788547" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2463" width="200" height="200"><path d="M312.832482 65.167035H959.204489c35.706211 0 64.64232 29.473622 64.64232 65.832527 0 36.346107-28.936109 65.832527-64.629522 65.832527H312.819684c-35.693413 0-64.629522-29.473622-64.629522-65.832527 0-36.346107 28.936109-65.832527 64.629522-65.832527z m0 394.982363H959.204489c35.706211 0 64.64232 29.460824 64.64232 65.819729 0 36.358905-28.936109 65.832527-64.629522 65.832527H312.819684c-35.693413 0-64.629522-29.473622-64.629522-65.832527 0-36.346107 28.936109-65.819729 64.629522-65.819729z m0 394.969566H959.204489c35.706211 0 64.64232 29.473622 64.64232 65.819729 0 36.358905-28.936109 65.832527-64.629522 65.832527H312.819684c-35.693413 0-64.629522-29.473622-64.629522-65.832527 0-36.346107 28.936109-65.819729 64.629522-65.819729zM12.286008 69.108796V38.176211c9.892796 0.767876 19.836784 0.767876 29.72958 0A41.823619 41.823619 0 0 0 63.989626 25.672638c4.261709-4.671243 7.358807-10.315128 9.048133-16.458132 0.37114-3.058704 0.37114-6.143004 0-9.214506H114.413451v229.748352H65.93491V69.108796H12.286008z m0 510.176487a130.730805 130.730805 0 0 1 45.240665-49.374395 334.537763 334.537763 0 0 0 40.070304-32.250771 48.47854 48.47854 0 0 0 14.218495-33.581756 37.31875 37.31875 0 0 0-7.755543-24.354451 28.193829 28.193829 0 0 0-23.266628-9.879998 27.643518 27.643518 0 0 0-31.02217 15.139945 78.27211 78.27211 0 0 0-5.170362 28.30901H2.585181a114.311067 114.311067 0 0 1 10.340723-48.056208c12.388392-24.124089 38.086625-37.984242 64.629522-34.887144a79.897447 79.897447 0 0 1 57.539472 20.41269 71.783562 71.783562 0 0 1 21.321343 53.981648 74.637499 74.637499 0 0 1-14.858391 46.072531 152.16733 152.16733 0 0 1-32.967455 29.627197L90.481331 553.625443l-23.266628 17.763521c-4.082538 3.583419-7.563574 7.806734-10.353522 12.51637h99.542262v40.147092H0a110.945213 110.945213 0 0 1 10.340724-45.419837l1.945284 0.665492zM44.600769 948.582211a53.495327 53.495327 0 0 0 4.517668 23.036265 30.279891 30.279891 0 0 0 29.742378 17.110826c7.422797 0.255959 14.717614-2.073264 20.681447-6.578133 6.7829-6.962071 10.315128-16.547717 9.688029-26.325332a30.356678 30.356678 0 0 0-18.096266-30.945383 91.735527 91.735527 0 0 0-32.314761-8.561812V883.440772a83.903197 83.903197 0 0 0 30.382274-4.607253 27.106005 27.106005 0 0 0 14.858391-28.30901 30.612637 30.612637 0 0 0-7.755542-21.730877 27.528337 27.528337 0 0 0-21.321344-8.549014 26.939632 26.939632 0 0 0-23.279425 10.532692 44.063256 44.063256 0 0 0-7.102849 27.643519H2.585181a117.101015 117.101015 0 0 1 5.823056-32.916264 74.381541 74.381541 0 0 1 17.443572-25.019944 60.534186 60.534186 0 0 1 20.681447-12.503572 89.55988 89.55988 0 0 1 29.742378-3.289067A78.540867 78.540867 0 0 1 129.259044 801.79001a57.744238 57.744238 0 0 1 20.041551 46.085328 51.921182 51.921182 0 0 1-12.286008 34.887144c-4.159326 5.170362-9.470465 9.227304-15.511086 11.850879 6.7829 1.510155 12.900309 5.208756 17.45637 10.532692a57.821026 57.821026 0 0 1 17.443572 44.10165 75.136618 75.136618 0 0 1-20.028753 52.010768 76.122059 76.122059 0 0 1-59.471958 22.383571 71.962733 71.962733 0 0 1-64.629522-32.250771A97.52019 97.52019 0 0 1 1.279793 946.611331l43.308178 1.97088z" fill="#515151" p-id="2464"></path></svg>'}}],referencePosition:{rect:{right:n.x2+110,bottom:n.y2}}})}function Ns(t){return{getValue:(r,n)=>{const i=t.getCellValue(n,r);return"number"!=typeof i&&isNaN(Number(i))?{v:i||"",t:e.CellValueType.STRING}:{v:i,t:e.CellValueType.NUMBER}},getMaxRows:()=>t.records.length,getMaxColumns:()=>t.columns.length}}e.Direction=void 0,(Es=e.Direction||(e.Direction={})).UP="top",Es.RIGHT="right",Es.DOWN="bottom",Es.LEFT="left",e.APPLY_TYPE=void 0,(Ss=e.APPLY_TYPE||(e.APPLY_TYPE={})).COPY="copy",Ss.SERIES="series",e.CellValueType=void 0,(Ts=e.CellValueType||(e.CellValueType={}))[Ts.STRING=1]="STRING",Ts[Ts.NUMBER=2]="NUMBER",Ts[Ts.BOOLEAN=3]="BOOLEAN",Ts[Ts.FORCE_STRING=4]="FORCE_STRING",e.DATA_TYPE=void 0,(Rs=e.DATA_TYPE||(e.DATA_TYPE={})).NUMBER="number",Rs.DATE="date",Rs.EXTEND_NUMBER="extendNumber",Rs.CHN_NUMBER="chnNumber",Rs.CHN_WEEK2="chnWeek2",Rs.CHN_WEEK3="chnWeek3",Rs.LOOP_SERIES="loopSeries",Rs.FORMULA="formula",Rs.OTHER="other";class Fs{table;constructor(e){this.table=e}isFormulaCell(e,t){const r=this.table.getCellValue(e,t);return"string"==typeof r&&r.startsWith("=")}getCellFormula(e,t){const r=this.table.getCellValue(e,t);if("string"==typeof r&&r.startsWith("="))return r}setCellFormula(e,t,r){this.table.changeCellValue(e,t,r)}getCalculatedValue(e,t){return this.table.getCellValue(e,t)}refreshFormulas(){}hasFormulaEngine(){return!1}}function Ps(e,t,r,n){return t||r||n?new js(e,t,r,n):new Fs(e)}class js{table;isFormulaCellFn;getCellFormulaFn;setCellFormulaFn;constructor(e,t,r,n){this.table=e,this.isFormulaCellFn=t,this.getCellFormulaFn=r,this.setCellFormulaFn=n}isFormulaCell(e,t){if(this.isFormulaCellFn){const r=this.table.getCellValue(e,t);return this.isFormulaCellFn(e,t,r,this.table)}const r=this.table.getCellValue(e,t);return"string"==typeof r&&r.startsWith("=")}getCellFormula(e,t){if(this.getCellFormulaFn){const r=this.table.getCellValue(e,t);return this.getCellFormulaFn(e,t,r,this.table)}const r=this.table.getCellValue(e,t);if("string"==typeof r&&r.startsWith("="))return r}setCellFormula(e,t,r){this.setCellFormulaFn?this.setCellFormulaFn(e,t,r,this.table):this.table.changeCellValue(e,t,r)}getCalculatedValue(e,t){return this.table.getCellValue(e,t)}refreshFormulas(){}hasFormulaEngine(){return!1}}var Ls=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e},Ds=et,Bs=function(){try{var e=Ds(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Hs=function(e,t,r){"__proto__"==t&&Bs?Bs(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},zs=Hs,Us=X,Vs=Object.prototype.hasOwnProperty;var Ws=function(e,t,r){var n=e[t];Vs.call(e,t)&&Us(n,r)&&(void 0!==r||t in e)||zs(e,t,r)},$s=Ws,qs=Hs;var Ks=function(e,t,r,n){var i=!r;r||(r={});for(var s=-1,o=t.length;++s<o;){var a=t[s],l=n?n(r[a],e[a],a,r,e):void 0;void 0===l&&(l=e[a]),i?qs(r,a,l):$s(r,a,l)}return r},Ys=Ks,Xs=bn;var Gs=function(e,t){return e&&Ys(t,Xs(t),e)};var Zs=Oe,Js=nn,Qs=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t},eo=Object.prototype.hasOwnProperty;var to=tn,ro=function(e){if(!Zs(e))return Qs(e);var t=Js(e),r=[];for(var n in e)("constructor"!=n||!t&&eo.call(e,n))&&r.push(n);return r},no=fn;var io=function(e){return no(e)?to(e,!0):ro(e)},so=Ks,oo=io;var ao=function(e,t){return e&&so(t,oo(t),e)},lo={exports:{}};!function(e,t){var r=ye,n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,s=i&&i.exports===n?r.Buffer:void 0,o=s?s.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var r=e.length,n=o?o(r):new e.constructor(r);return e.copy(n),n}}(lo,lo.exports);var co=lo.exports;var ho=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t},uo=Ks,fo=yr;var po=function(e,t){return uo(e,fo(e),t)},mo=sn(Object.getPrototypeOf,Object),bo=lr,go=mo,yo=yr,vo=dr,wo=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)bo(t,yo(e)),e=go(e);return t}:vo,_o=Ks,xo=wo;var Co=function(e,t){return _o(e,xo(e),t)},Eo=fr,So=wo,To=io;var Ro=function(e){return Eo(e,To,So)},ko=Object.prototype.hasOwnProperty;var Ao=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&ko.call(e,"index")&&(r.index=e.index,r.input=e.input),r},Mo=Qt;var Oo=function(e){var t=new e.constructor(e.byteLength);return new Mo(t).set(new Mo(e)),t},Io=Oo;var No=function(e,t){var r=t?Io(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)},Fo=/\w*$/;var Po=function(e){var t=new e.constructor(e.source,Fo.exec(e));return t.lastIndex=e.lastIndex,t},jo=ve?ve.prototype:void 0,Lo=jo?jo.valueOf:void 0;var Do=Oo;var Bo=Oo,Ho=No,zo=Po,Uo=function(e){return Lo?Object(Lo.call(e)):{}},Vo=function(e,t){var r=t?Do(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)};var Wo=function(e,t,r){var n=e.constructor;switch(t){case"[object ArrayBuffer]":return Bo(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return Ho(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Vo(e,r);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(e);case"[object RegExp]":return zo(e);case"[object Symbol]":return Uo(e)}},$o=Oe,qo=Object.create,Ko=function(){function e(){}return function(t){if(!$o(t))return{};if(qo)return qo(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),Yo=mo,Xo=nn;var Go=function(e){return"function"!=typeof e.constructor||Xo(e)?{}:Ko(Yo(e))},Zo=Un,Jo=wr;var Qo=function(e){return Jo(e)&&"[object Map]"==Zo(e)},ea=zr,ta=Vr&&Vr.isMap,ra=ta?ea(ta):Qo,na=Un,ia=wr;var sa=function(e){return ia(e)&&"[object Set]"==na(e)},oa=zr,aa=Vr&&Vr.isSet,la=aa?oa(aa):sa,ca=Wt,ha=Ls,ua=Ws,fa=Gs,da=ao,pa=co,ma=ho,ba=po,ga=Co,ya=wn,va=Ro,wa=Un,_a=Ao,xa=Wo,Ca=Go,Ea=cr,Sa=Ir,Ta=ra,Ra=Oe,ka=la,Aa=bn,Ma=io,Oa="[object Arguments]",Ia="[object Function]",Na="[object Object]",Fa={};Fa[Oa]=Fa["[object Array]"]=Fa["[object ArrayBuffer]"]=Fa["[object DataView]"]=Fa["[object Boolean]"]=Fa["[object Date]"]=Fa["[object Float32Array]"]=Fa["[object Float64Array]"]=Fa["[object Int8Array]"]=Fa["[object Int16Array]"]=Fa["[object Int32Array]"]=Fa["[object Map]"]=Fa["[object Number]"]=Fa[Na]=Fa["[object RegExp]"]=Fa["[object Set]"]=Fa["[object String]"]=Fa["[object Symbol]"]=Fa["[object Uint8Array]"]=Fa["[object Uint8ClampedArray]"]=Fa["[object Uint16Array]"]=Fa["[object Uint32Array]"]=!0,Fa["[object Error]"]=Fa[Ia]=Fa["[object WeakMap]"]=!1;var Pa=function e(t,r,n,i,s,o){var a,l=1&r,c=2&r,h=4&r;if(n&&(a=s?n(t,i,s,o):n(t)),void 0!==a)return a;if(!Ra(t))return t;var u=Ea(t);if(u){if(a=_a(t),!l)return ma(t,a)}else{var f=wa(t),d=f==Ia||"[object GeneratorFunction]"==f;if(Sa(t))return pa(t,l);if(f==Na||f==Oa||d&&!s){if(a=c||d?{}:Ca(t),!l)return c?ga(t,da(a,t)):ba(t,fa(a,t))}else{if(!Fa[f])return s?t:{};a=xa(t,f,l)}}o||(o=new ca);var p=o.get(t);if(p)return p;o.set(t,a),ka(t)?t.forEach((function(i){a.add(e(i,r,n,i,t,o))})):Ta(t)&&t.forEach((function(i,s){a.set(s,e(i,r,n,s,t,o))}));var m=u?void 0:(h?c?va:ya:c?Ma:Aa)(t);return ha(m||t,(function(i,s){m&&(i=t[s=i]),ua(a,s,e(i,r,n,s,t,o))})),a},ja=Pa;var La=l((function(e){return ja(e,5)}));const Da={"零":0,"一":1,"二":2,"三":3,"四":4,"五":5,"六":6,"七":7,"八":8,"九":9},Ba=["零","一","二","三","四","五","六","七","八","九"],Ha=["","万","亿","万亿","亿亿"],za=["","十","百","千"],Ua={"十":{value:10,secUnit:!1},"百":{value:100,secUnit:!1},"千":{value:1e3,secUnit:!1},"万":{value:1e4,secUnit:!0},"亿":{value:1e8,secUnit:!0}};function Va(e){if(!e)return 0;let t=0,r=0,n=0,i=!1;const s=e.split("");for(let e=0;e<s.length;e++){const o=Da[s[e]];if(void 0!==o)n=o,e===s.length-1&&(r+=n);else{const o=Ua[s[e]],a=o.value;i=o.secUnit,i?(r=(r+n)*a,t+=r,r=0):r+=n*a,n=0}}return t+r}function Wa(e){let t="",r="",n=0,i=!0;for(;e>0;){const s=e%10;0===s?i||(i=!0,r=Ba[s]+r):(i=!1,t=Ba[s],t+=za[n],r=t+r),n++,e=Math.floor(e/10)}return r}function $a(e){let t=0,r="",n="",i=!1;if(0===e)return Ba[0];for(;e>0;){const s=e%1e4;i&&(n=Ba[0]+n),r=Wa(s),r+=0!==s?Ha[t]:Ha[0],n=r+n,i=s<1e3&&s>0,e=Math.floor(e/1e4),t++}return n}function qa(e){if(!e)return{isExtendNumber:!1};const t=/0|([1-9]+[0-9]*)/g,r=t.test(e);if(r){const r=e.match(t);if(r&&r.length>0){const t=r[r.length-1],n=e.lastIndexOf(t),i=e.substr(0,n),s=e.substr(n+t.length);return{isExtendNumber:!0,matchTxt:Number(t),beforeTxt:i,afterTxt:s}}return{isExtendNumber:!1}}return{isExtendNumber:r}}function Ka(e){let t=!0;const r=e[1]-e[0];for(let n=1;n<e.length;n++)if(e[n]-e[n-1]!==r){t=!1;break}return t}function Ya(e,t){const r=[];for(let n=1;n<=t;n++){const t=(n-1)%e.length,i=La(e[t]);nl(i),r.push({v:null,t:null,...i})}return r}function Xa(t,r,n,i){i&&t.forEach((e=>{const{v:t,meta:r}=i.toNumber(e.v);e.v=t,e.f=r}));const s=[],o=[];for(let e=0;e<t.length;e++)o.push(Number(t[e]?.v));if(t.length>2&&function(e){let t=!0;const r=e[1]/e[0];for(let n=1;n<e.length;n++)if(e[n]/e[n-1]!==r){t=!1;break}return t}(o))for(let e=1;e<=r;e++){const r=(e-1)%t.length,n=La(t[r]);nl(n);const o=Number(t[t.length-1]?.v),a=Number(t[0]?.v),l=o*(Number(t[1]?.v)/a)**e;n&&(n.v=i?i.fromNumber(l,n.f):l,s.push(n))}else{const a=function(e){const t=[];for(let r=1;r<=e;r++)t.push(r);return t}(t.length);for(let l=1;l<=r;l++){const r=(l-1)%t.length,c=La(t[r]);nl(c);const h=n===e.Direction.DOWN||n===e.Direction.RIGHT,u=Ga(t.length+l,o,a,h);c&&(c.v=i?i.fromNumber(u,c.f):u,s.push(c))}}return s}function Ga(e,t,r,n=!0){function i(e){let t=0;for(let r=0;r<e.length;r++)t+=e[r];return t/e.length}const s=i(r),o=i(t);let a,l=0,c=0;for(let e=0;e<r.length;e++)l+=(r[e]-s)*(t[e]-o),c+=(r[e]-s)*(r[e]-s);a=0===c?n?1:-1:l/c;const h=o-a*s;return Math.round(1e5*(h+a*e))/1e5}function Za(e,t,r){const n=[],i=/0|([1-9]+[0-9]*)/g;for(let s=1;s<=t;s++){const t=(s-1)%e.length,o=La(e[t]);nl(o);const a=`${e[e.length-1]?.v??""}`;if(!a)continue;const l=a?.match(i),c=l?.[l.length-1];if(!c)continue;const h=Math.abs(Number(c)+r*s),u=a.lastIndexOf(c),f=a.substr(0,u)+h.toString()+a.substr(u+c.length);o&&(o.v=f,n.push(o))}return n}function Ja(e,t,r,n=0){const i=[["日","一","二","三","四","五","六"],["周日","周一","周二","周三","周四","周五","周六"],["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]];if(n>=i.length)return[];const s=i[n],o=[];for(let n=1;n<=t;n++){const t=(n-1)%e.length,i=La(e[t]);nl(i);let a=0;if(e[e.length-1]?.v===s[0])a=7+r*n;else{const t=`${e[e.length-1]?.v??""}`;if(t){a=Va(t.substr(t.length-1,1))+r*n}}a<0&&(a=7*Math.ceil(Math.abs(a)/7)+a);const l=a%7;i&&(i.v=s[l],o.push(i))}return o}function Qa(e,t,r){const n=[];for(let i=1;i<=t;i++){const t=(i-1)%e.length,s=La(e[t]);nl(s);const o=Va(`${e[e.length-1]?.v??""}`)+r*i;let a;a=o<=0?"零":$a(o),s&&(s.v=a,n.push(s))}return n}const el={enWeek1:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],enWeek2:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],enMonth1:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],enMonth2:["January","February","March","April","May","June","July","August","September","October","November","December"],chnMonth1:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],chnMonth2:["正月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","腊月"],chHour1:["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"],chHour2:["子时","丑时","寅时","卯时","辰时","巳时","午时","未时","申时","酉时","戌时","亥时"],chYear1:["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"],chSeason1:["春","夏","秋","冬"],chSeason2:["春季","夏季","秋季","冬季"]};function tl(e){let t="";const r=[];return Object.keys(el).forEach((n=>{el[n].includes(e)&&(t=n,r.push(...el[n]))})),{name:t,series:r}}function rl(e,t,r,n){const i=n.length,s=[];for(let o=1;o<=t;o++){const t=(o-1)%e.length,a=La(e[t]);nl(a);const l=`${e[e.length-1]?.v??""}`;let c=n.indexOf(l)+r*o;c<0&&(c+=Math.abs(r)*i);const h=c%i;a&&(a.v=n[h],s.push(a))}return s}function nl(e){e&&"custom"in e&&delete e.custom}function il(e,t,r=new Date){const n=e.trim();if("yyyy-MM-dd"===t){const[e,t,r]=n.split("-").map(Number);return new Date(e,t-1,r)}if("yyyy-M-d"===t){const[e,t,r]=n.split("-").map(Number);return new Date(e,t-1,r)}if("yyyy/MM/dd"===t){const[e,t,r]=n.split("/").map(Number);return new Date(e,t-1,r)}if("yyyy/M/d"===t){const[e,t,r]=n.split("/").map(Number);return new Date(e,t-1,r)}if("MM/dd/yyyy"===t){const[e,t,r]=n.split("/").map(Number);return new Date(r,e-1,t)}if("yyyy年M月d日"===t){const e=n.match(/^(\d{4})年(\d{1,2})月(\d{1,2})(日)?$/);if(e)return new Date(Number(e[1]),Number(e[2])-1,Number(e[3]))}const i=new Date(n);return isNaN(i.getTime())?new Date(r):i}function sl(e){return!isNaN(e.getTime())}function ol(e,t){const r=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())-Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.floor(r/864e5)}class al{key="date";baseDate=new Date(1900,0,1);dateFormats=[{pattern:/^\d{4}-\d{2}-\d{2}$/,format:"yyyy-MM-dd"},{pattern:/^\d{4}-\d{1,2}-\d{1,2}$/,format:"yyyy-M-d"},{pattern:/^\d{4}\/\d{2}\/\d{2}$/,format:"yyyy/MM/dd"},{pattern:/^\d{4}\/\d{1,2}\/\d{1,2}$/,format:"yyyy/M/d"},{pattern:/^\d{2}\/\d{2}\/\d{4}$/,format:"MM/dd/yyyy"},{pattern:/^\d{4}年\d{1,2}月\d{1,2}(日)?$/,format:"yyyy年M月d日",parser:e=>{const t=e.match(/(\d{4})年(\d{1,2})月(\d{1,2})/);if(!t)throw new Error("无效的中文日期格式");return new Date(+t[1],+t[2]-1,+t[3])}}];detect(e){if(e instanceof Date)return!isNaN(e.getTime());if("string"!=typeof e)return!1;const t=e.trim(),r=this.dateFormats.find((e=>e.pattern.test(t)));if(r)try{return sl(r.parser?r.parser(t):il(t,r.format,new Date))}catch{return!1}return!1}toNumber(e){let t,r;if(e instanceof Date){if(!sl(e))throw new Error("无效的日期对象");t=e,r="yyyy-MM-dd"}else{const n=e.trim(),i=this.dateFormats.find((e=>e.pattern.test(n)));if(!i)throw new Error(`不支持的日期格式: ${n}`);if(t=i.parser?i.parser(n):il(n,i.format,new Date),!sl(t))throw new Error(`无效的日期值: ${n}`);r=i.format}return{v:ol(t,this.baseDate),meta:r}}fromNumber(e,t){const r=function(e,t){const r=new Date(e);return r.setDate(r.getDate()+t),r}(this.baseDate,e);return r.setHours(0,0,0,0),function(e,t){const r=e.getFullYear(),n=e.getMonth()+1,i=e.getDate(),s=e=>e.toString().padStart(2,"0");switch(t){case"yyyy-MM-dd":default:return`${r}-${s(n)}-${s(i)}`;case"yyyy-M-d":return`${r}-${n}-${i}`;case"yyyy/MM/dd":return`${r}/${s(n)}/${s(i)}`;case"yyyy/M/d":return`${r}/${n}/${i}`;case"MM/dd/yyyy":return`${s(n)}/${s(i)}/${r}`;case"yyyy年M月d日":return`${r}年${n}月${i}日`}}(r,t||"yyyy-MM-dd")}}const ll=new class{converters=[];register(e){this.converters.push(e)}getConverter(e){return this.converters.find((t=>t.detect(e)))||null}getConverterByKey(e){return this.converters.find((t=>t.key===e))||null}};ll.register(new al);const cl={type:e.DATA_TYPE.DATE,priority:1100,match:(e,t)=>"string"==typeof e?.v&&ll.getConverter(e.v)instanceof al,isContinue:(t,r)=>t.type===e.DATA_TYPE.DATE,applyFunctions:{[e.APPLY_TYPE.SERIES]:(t,r,n)=>{const{data:i}=t,s=ll.getConverter(i[0]?.v);return n===e.Direction.LEFT||n===e.Direction.UP?(i.reverse(),Xa(i,r,n,s).reverse()):Xa(i,r,n,s)}}},hl={type:e.DATA_TYPE.NUMBER,priority:1e3,match:t=>"number"==typeof t?.v||t?.t===e.CellValueType.NUMBER,isContinue:(t,r)=>t.type===e.DATA_TYPE.NUMBER,applyFunctions:{[e.APPLY_TYPE.SERIES]:(t,r,n)=>{const{data:i}=t;return n===e.Direction.LEFT||n===e.Direction.UP?(i.reverse(),Xa(i,r,n).reverse()):Xa(i,r,n)}}},ul={type:e.DATA_TYPE.OTHER,priority:0,match:()=>!0,isContinue:(t,r)=>t.type===e.DATA_TYPE.OTHER},fl={type:e.DATA_TYPE.EXTEND_NUMBER,priority:900,match:e=>qa(`${e?.v??""}`||"").isExtendNumber,isContinue:(t,r)=>{if(t.type===e.DATA_TYPE.EXTEND_NUMBER){const{beforeTxt:e,afterTxt:n}=qa(`${t.cellData?.v??""}`||""),{beforeTxt:i,afterTxt:s}=qa(`${r?.v??""}`||"");if(e===i&&n===s)return!0}return!1},applyFunctions:{[e.APPLY_TYPE.SERIES]:(t,r,n)=>{const{data:i}=t,s=n===e.Direction.UP||n===e.Direction.LEFT;let o;if(1===i.length)return o=s?-1:1,gl(Za(i,r,o),s);const a=[];for(let e=0;e<i.length;e++){const t=`${i[e]?.v}`;t&&a.push(Number(qa(t).matchTxt))}return s&&(i.reverse(),a.reverse()),Ka(a)?(o=a[1]-a[0],gl(Za(i,r,o),s)):Ya(i,r)}}},dl={type:e.DATA_TYPE.CHN_NUMBER,priority:830,match:e=>!!function(e){if(!e)return!1;let t=!0;if(e)if(1===e.length)t="日"===e||e in Da;else{const r=e.split("");for(let e=0;e<r.length;e++)if(!(r[e]in Da)&&!(r[e]in Ua)){t=!1;break}}return t}(`${e?.v??""}`||""),isContinue:(t,r)=>t.type===e.DATA_TYPE.CHN_NUMBER,applyFunctions:{[e.APPLY_TYPE.SERIES]:(t,r,n)=>{const{data:i}=t,s=n===e.Direction.LEFT||n===e.Direction.UP;if(1===i.length){let e;return e=s?-1:1,gl(Qa(i,r,e),s)}let o=!1;for(let e=0;e<i.length;e++){const t=i[e]?.v;if("日"===t){o=!0;break}}const a=[];let l=0;for(let e=0;e<i.length;e++){const t=`${i[e]?.v}`;"日"===t?0===e?a.push(0):(l++,a.push(7*l)):o&&Va(t)>0&&Va(t)<7?a.push(Va(t)+7*l):a.push(Va(t))}if(s&&(i.reverse(),a.reverse()),Ka(a)){return gl(Qa(i,r,a[1]-a[0]),s)}return Ya(i,r)}}},pl={type:e.DATA_TYPE.CHN_WEEK2,priority:820,match:e=>!!function(e){let t;return t=2===e.length&&("周一"===e||"周二"===e||"周三"===e||"周四"===e||"周五"===e||"周六"===e||"周日"===e),t}(`${e?.v??""}`||""),isContinue:(t,r)=>t.type===e.DATA_TYPE.CHN_WEEK2,applyFunctions:{[e.APPLY_TYPE.SERIES]:(t,r,n)=>{const{data:i}=t,s=n===e.Direction.LEFT||n===e.Direction.UP;if(1===i.length){let e;return e=s?-1:1,gl(Ja(i,r,e,1),s)}const o=[];let a=0;for(let e=0;e<i.length;e++){const t=`${i[e]?.v}`,r=t?.substr(t.length-1,1);"周日"===t?0===e?o.push(0):(a++,o.push(7*a)):o.push(Va(r)+7*a)}if(s&&(i.reverse(),o.reverse()),Ka(o)){return gl(Ja(i,r,o[1]-o[0],1),s)}return Ya(i,r)}}},ml={type:e.DATA_TYPE.CHN_WEEK3,priority:810,match:e=>function(e){let t;return t=3===e.length&&("星期一"===e||"星期二"===e||"星期三"===e||"星期四"===e||"星期五"===e||"星期六"===e||"星期日"===e),t}(`${e?.v??""}`||""),isContinue:(t,r)=>t.type===e.DATA_TYPE.CHN_WEEK3,applyFunctions:{[e.APPLY_TYPE.SERIES]:(t,r,n)=>{const{data:i}=t,s=n===e.Direction.LEFT||n===e.Direction.UP;if(1===i.length){let e;return e=s?-1:1,gl(Ja(i,r,e,2),s)}const o=[];let a=0;for(let e=0;e<i.length;e++){const t=`${i[e]?.v}`;if(t){const r=t.substr(t.length-1,1);"星期日"===t?0===e?o.push(0):(a++,o.push(7*a)):o.push(Va(r)+7*a)}}if(s&&(i.reverse(),o.reverse()),Ka(o)){return gl(Ja(i,r,o[1]-o[0],2),s)}return Ya(i,r)}}},bl={type:e.DATA_TYPE.LOOP_SERIES,priority:800,match:e=>function(e){let t=!1;return Object.keys(el).forEach((r=>{el[r].includes(e)&&(t=!0)})),t}(`${e?.v??""}`||""),isContinue:(t,r)=>t.type===e.DATA_TYPE.LOOP_SERIES&&tl(`${t.cellData?.v??""}`||"").name===tl(`${r?.v??""}`||"").name,applyFunctions:{[e.APPLY_TYPE.SERIES]:(t,r,n)=>{const{data:i}=t,s=n===e.Direction.LEFT||n===e.Direction.UP,{series:o}=tl(`${i[0]?.v}`||"");if(1===i.length){let e;return e=s?-1:1,gl(rl(i,r,e,o),s)}const a=[];let l=0;for(let e=0;e<i.length;e++){const t=`${i[e]?.v}`;t&&(t===o[0]?0===e?a.push(0):(l++,a.push(l*o.length)):a.push(o.indexOf(t)+7*l))}if(s&&(i.reverse(),a.reverse()),Ka(a)){return gl(rl(i,r,a[1]-a[0],o),s)}return Ya(i,r)}}};function gl(e,t){return t?e.reverse():e}const yl={type:e.DATA_TYPE.FORMULA,priority:1200,match:(e,t)=>"string"==typeof e?.v&&e.v.startsWith("="),isContinue:(t,r)=>!(t.type!==e.DATA_TYPE.FORMULA||!r?.v?.startsWith("=")),applyFunctions:{[e.APPLY_TYPE.COPY]:(e,t,r,n,i)=>{const{data:s}=e;return Ya(s,t)},[e.APPLY_TYPE.SERIES]:(t,r,n,i,s)=>{const{data:o}=t;if(1===o.length)return function(t,r,n,i){const s=[],o=t[0]?.v||"";for(let i=0;i<r;i++){let r=o,a=0,l=0;switch(n){case e.Direction.DOWN:a=i+1;break;case e.Direction.UP:a=-(i+1);break;case e.Direction.RIGHT:l=i+1;break;case e.Direction.LEFT:l=-(i+1)}r=wl(o,a,l),s.push({v:r,t:t[0]?.t})}return s}(o,r,n);const a=function(e,t,r,n){if(e.length<2)return null;const i=e[0]?.v||"",s=e[1]?.v||"",o=function(e,t){const r=/\$?([A-Z]+)\$?(\d+)/g,n=[...e.matchAll(r)],i=[...t.matchAll(r)];if(n.length!==i.length||0===n.length)return null;let s=0,o=0,a=0;for(let e=0;e<n.length;e++){const t=n[e][1],r=parseInt(n[e][2],10),l=i[e][1],c=parseInt(i[e][2],10),h=_l(l)-_l(t),u=c-r;Math.abs(h)<100&&Math.abs(u)<1e4&&(o+=h,s+=u,a++)}if(0===a)return null;return{rowOffset:s/a,colOffset:o/a}}(i,s);if(!o)return null;const a=[];for(let r=0;r<t;r++){let t=i;t=vl(t,o,r+1),a.push({v:t,t:e[0]?.t})}return a}(o,r);return a||Ya(o,r)}}};function vl(e,t,r,n){return e.replace(/\$?([A-Z]+)\$?(\d+)/g,((e,n,i)=>{const s=e.startsWith("$")&&e.indexOf(n)>0,o=e.includes("$"+i);let a=n,l=i;if(!s&&0!==t.colOffset){a=xl(_l(n)+t.colOffset*r)}if(!o&&0!==t.rowOffset){l=(parseInt(i,10)+t.rowOffset*r).toString()}let c="";return s&&(c+="$"),c+=a,o&&(c+="$"),c+=l,c}))}function wl(e,t,r){return e.replace(/\$?([A-Z]+)\$?(\d+)/g,((e,n,i)=>{const s=e.startsWith("$")&&e.indexOf(n)>0,o=e.includes("$"+i);let a=n,l=i;if(!s&&0!==r){a=xl(_l(n)+r)}if(!o&&0!==t){l=(parseInt(i,10)+t).toString()}let c="";return s&&(c+="$"),c+=a,o&&(c+="$"),c+=l,c}))}function _l(e){let t=0;for(let r=0;r<e.length;r++)t=26*t+(e.charCodeAt(r)-"A".charCodeAt(0)+1);return t}function xl(e){let t="";for(;e>0;)e--,t=String.fromCharCode("A".charCodeAt(0)+e%26)+t,e=Math.floor(e/26);return t}class Cl{_rules=[];constructor(){this._init()}_init(){this._rules=[yl,cl,hl,fl,dl,pl,ml,bl,ul].sort(((e,t)=>t.priority-e.priority))}registerRule(e){if(this._rules.find((t=>t.type===e.type)))throw new Error(`Registry rule failed, type '${e.type}' already exist!`);const t=this._rules.findIndex((t=>t.priority<e.priority));this._rules.splice(-1===t?this._rules.length:t,0,e)}getRules(){return this._rules}}class El{sourceData=[];autoFillService;tableInstance;sourceRange;targetRange;direction;headers;options;formulaAdapter;constructor(e){this.options=e,this.autoFillService=new Cl,this.formulaAdapter=new Fs({})}setTable(t){this.headers={row:new Set,col:new Set},this.tableInstance=t,this.formulaAdapter=Ps(t,this.options?.isFormulaCell,this.options?.getCellFormula,this.options?.setCellFormula),t.on(r.TABLE_EVENT_TYPE.DROPDOWN_MENU_CLICK,(t=>{"复制填充"===t.text?this.fillData(e.APPLY_TYPE.COPY):"序列填充"===t.text&&this.fillData(e.APPLY_TYPE.SERIES)}));const n=this.tableInstance.getAllRowHeaderCells()[0];n&&n.forEach((e=>{this.headers.col.add(e.col)}));const i=this.tableInstance.getAllColumnHeaderCells()[0];i&&i.forEach((e=>{this.headers.row.add(e.row)}))}handleStartDrag(e){this.sourceRange=Ms(e),this.sourceRange.cols=this.sourceRange.cols.filter((e=>!this.headers.col.has(e))),this.sourceRange.rows=this.sourceRange.rows.filter((e=>!this.headers.row.has(e)))}handleEndDrag(e,t){this.direction=t;const r=Ms(e);this.targetRange=Os(this.direction,this.sourceRange,r),this.targetRange.cols=this.targetRange.cols.filter((e=>!this.headers.col.has(e))),this.targetRange.rows=this.targetRange.rows.filter((e=>!this.headers.row.has(e))),this.options?.fillMode?this.fillData(this.options.fillMode):Is(this.tableInstance,Math.max(...r.cols),Math.max(...r.rows))}handleDbClick(){if(!this.sourceRange)return;this.direction=e.Direction.DOWN;const t=Ms(this._detectFillRange());if(this.targetRange=Os(this.direction,this.sourceRange,t),this.targetRange.cols=this.targetRange.cols.filter((e=>!this.headers.col.has(e))),this.targetRange.rows=this.targetRange.rows.filter((e=>!this.headers.row.has(e))),0===this.targetRange.cols.length||0===this.targetRange.rows.length)return;const r=this.sourceRange.cols[0],n=this.sourceRange.rows[0],i=this.targetRange.cols[this.targetRange.cols.length-1],s=this.targetRange.rows[this.targetRange.rows.length-1],o=this.tableInstance.stateManager;o.updateSelectPos(r,n,!1,!1,!1,!0,!0),o.updateInteractionState(b.grabing),o.updateSelectPos(i,s,!1,!1,!1,!0,!0),o.endSelectCells(!1,!1),o.updateInteractionState(b.default),this.options?.fastFillMode?this.fillData(this.options.fastFillMode):Is(this.tableInstance,i,s)}fillData(e){this.sourceData=this.getSourceData(this.sourceRange,this.direction);const t={source:this.sourceRange,target:this.targetRange};this._fillData(t,this.direction,e)}getSourceData(t,r){const n=this.autoFillService.getRules(),i=[],s=r===e.Direction.DOWN||r===e.Direction.UP;let o,a;s?(o=t.cols,a=t.rows):(o=t.rows,a=t.cols);const l=Ns(this.tableInstance);return o.forEach((e=>{const t=this.getEmptySourceDataPiece(),r={type:void 0,cellData:void 0};a.forEach((i=>{let o;const c=s?e:i,h=s?i:e;if(o=s?l.getValue(i,e):l.getValue(e,i),o&&this.formulaAdapter.isFormulaCell(c,h)){const e=this.formulaAdapter.getCellFormula(c,h);e&&(o={...o,v:e})}const u=n.find((e=>e.match(o,null)))||ul,{type:f,isContinue:d}=u;if(d(r,o)){const e=t[f],r=e[e.length-1];r.data.push(o),r.index.push(i-a[0])}else{const e=t[f];e?e.push({data:[o],index:[i-a[0]]}):t[f]=[{data:[o],index:[i-a[0]]}]}r.type=f,r.cellData=o})),i.push(t)})),i}getEmptySourceDataPiece(){const e={};return this.autoFillService.getRules().forEach((t=>{e[t.type]=[]})),e}_detectFillRange(){const e={row:Math.min(...this.sourceRange.rows),col:Math.min(...this.sourceRange.cols)},t={row:Math.max(...this.sourceRange.rows),col:Math.max(...this.sourceRange.cols)},r=Ns(this.tableInstance),n=r.getMaxRows(),i=r.getMaxColumns();let s=t.row;if(e.col>0&&r.getValue(e.row,e.col-1)?.v){let t=e.row;for(;r.getValue(t,e.col-1)?.v&&t<=n;)t+=1;s=t-1}else if(t.col<i&&r.getValue(t.row,t.col+1)?.v){let i=e.row;for(;r.getValue(i,t.col+1)?.v&&i<=n;)i+=1;s=i-1}for(let n=t.row+1;n<=s;n++)for(let i=e.col;i<=t.col;i++)if(r.getValue(n,i)?.v){s=n-1;break}return{start:{row:e.row,col:e.col},end:{row:s,col:t.col}}}_fillData(t,r,n){const{source:i,target:s}=t;if(!i||!s||null==r)return;const{cols:o,rows:a}=s,{cols:l,rows:c}=i,h=this.sourceData;let u;u=r===e.Direction.DOWN||r===e.Direction.UP?c.length:l.length;const f=[];if(r===e.Direction.DOWN||r===e.Direction.UP){const e=a.length,i=[];o.forEach(((s,o)=>{const a=h[o],l=this.getApplyData(a,u,e,r,n,t);i.push(l)}));for(let e=0;e<i[0].length;e++){const t=[];for(let r=0;r<i.length;r++)t.push(i[r][e]);f.push(t)}}else{const e=o.length;a.forEach(((i,s)=>{const o=h[s],a=this.getApplyData(o,u,e,r,n,t),l=[];for(let e=0;e<a.length;e++)l.push(a[e]);f.push(l)}))}const d=[],p=[];a.forEach(((e,t)=>{const r=[];o.forEach(((n,i)=>{const s=function(e,t,r){const n=e.getCellRange(t,r);return n.start.col!==n.end.col||n.start.row!==n.end.row?n:null}(this.tableInstance,n,e);if(s&&this.tableInstance.unmergeCells(s.start.col,s.start.row,s.end.col,s.end.row),f[t][i]){const s=f[t][i],o=s?.v+"";s&&"string"==typeof s.v&&s.v.startsWith("=")?(p.push({col:n,row:e,formula:s.v}),r.push(o)):r.push(o)}})),d.push(r)}));const m=Math.min(...a),b=Math.min(...o);this.tableInstance.changeCellValues(b,m,d),p.length>0&&(p.forEach((({col:e,row:t,formula:r})=>{this.formulaAdapter.setCellFormula(e,t,r)})),this.formulaAdapter.hasFormulaEngine()&&this.formulaAdapter.refreshFormulas())}getApplyData(e,t,r,n,i,s){const o=[],a=Math.floor(r/t),l=r%t,c=this.autoFillService.getRules(),h={};c.forEach((e=>{h[e.type]=[]})),c.forEach((o=>{const{type:c,applyFunctions:u={}}=o,f=e[c];f&&f.forEach((o=>{const f=function(e,t){let r=0;for(let n=0;n<e.length&&e[n]<t;n++)r++;return r}(o.index,l),d=o.index.length*a+f,p=this.applyFunctions(o,d,n,i,u,e,s),m=function(e,t,r){const n=[],i=Math.floor(t/e),s=t%e;let o=0;if(i>0){for(let t=0;t<i;t++)for(let i=0;i<r.length;i++)n[r[i]+t*e]=o,o++;for(let t=0;t<r.length&&r[t]<s;t++)n[r[t]+e*i]=o,o++}else for(let e=0;e<r.length&&r[e]<s;e++)n[r[e]]=o,o++;return n}(t,r,o.index);h[c].push({data:p,index:m})}))}));for(let e=0;e<r;e++)c.forEach((t=>{const{type:r}=t,n=h[r];for(let t=0;t<n.length;t++)e in n[t].index&&o.push(n[t].data[n[t].index[e]])}));return o}applyFunctions(t,r,n,i,s,o,a){const{data:l}=t,c=n===e.Direction.UP||n===e.Direction.LEFT;if(i===e.APPLY_TYPE.COPY){const i=s?.[e.APPLY_TYPE.COPY];return i?i(t,r,n,o,a):(c&&l.reverse(),Ya(l,r))}if(i===e.APPLY_TYPE.SERIES){const i=s?.[e.APPLY_TYPE.SERIES];return i?i(t,r,n,o):(c&&l.reverse(),s?.[e.APPLY_TYPE.COPY]?s[e.APPLY_TYPE.COPY](t,r,n,o,a):Ya(l,r))}return[]}}e.AddRowColumnPlugin=class{id="add-row-column";name="Add Row Column";runTime=[r.TABLE_EVENT_TYPE.MOUSEENTER_CELL,r.TABLE_EVENT_TYPE.MOUSELEAVE_CELL,r.TABLE_EVENT_TYPE.MOUSELEAVE_TABLE];pluginOptions;table;hoverCell;hideAllTimeoutId_addColumn;hideAllTimeoutId_addRow;leftDotForAddColumn;rightDotForAddColumn;addIconForAddColumn;addLineForAddColumn;topDotForAddRow;bottomDotForAddRow;addIconForAddRow;addLineForAddRow;constructor(e={addColumnEnable:!0,addRowEnable:!0}){this.id=e.id??this.id,this.pluginOptions=e,this.pluginOptions.addColumnEnable=this.pluginOptions.addColumnEnable??!0,this.pluginOptions.addRowEnable=this.pluginOptions.addRowEnable??!0,this.pluginOptions.addColumnEnable&&(this.initAddColumnDomElement(),this.bindEventForAddColumn()),this.pluginOptions.addRowEnable&&(this.initAddRowDomElement(),this.bindEventForAddRow())}run(...e){const t=e[0],n=e[1],i=e[2];if(this.table=i,n===r.TABLE_EVENT_TYPE.MOUSEENTER_CELL){clearTimeout(this.hideAllTimeoutId_addColumn),clearTimeout(this.hideAllTimeoutId_addRow);const e=i.canvas.getBoundingClientRect(),r=i.getCellAtRelativePosition(t.event.clientX-e.left,t.event.clientY-e.top);this.hoverCell=r;const n=i.getCellRelativeRect(r.col,r.row);if(this.pluginOptions.addColumnEnable){const t=i.isSeriesNumber(r.col,0);this.showDotForAddColumn(e.top-6,n.left+e.left,n.right+e.left,!t)}if(this.pluginOptions.addRowEnable){const t=i.isHeader(r.col,r.row);this.showDotForAddRow(n.top+e.top,e.left-6,n.bottom+e.top,!t,!t)}}else n===r.TABLE_EVENT_TYPE.MOUSELEAVE_CELL||n===r.TABLE_EVENT_TYPE.MOUSELEAVE_TABLE&&(this.pluginOptions.addColumnEnable&&this.delayHideAllForAddColumn(),this.pluginOptions.addRowEnable&&this.delayHideAllForAddRow())}initAddColumnDomElement(){this.leftDotForAddColumn=document.createElement("div"),this.leftDotForAddColumn.style.width="6px",this.leftDotForAddColumn.style.height="6px",this.leftDotForAddColumn.style.backgroundColor="#4A90E2",this.leftDotForAddColumn.style.position="absolute",this.leftDotForAddColumn.style.cursor="pointer",this.leftDotForAddColumn.style.zIndex="1000",this.leftDotForAddColumn.style.borderRadius="50%",this.leftDotForAddColumn.style.border="1px solid white",this.leftDotForAddColumn.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.leftDotForAddColumn),this.rightDotForAddColumn=document.createElement("div"),this.rightDotForAddColumn.style.width="6px",this.rightDotForAddColumn.style.height="6px",this.rightDotForAddColumn.style.backgroundColor="#4A90E2",this.rightDotForAddColumn.style.position="absolute",this.rightDotForAddColumn.style.cursor="pointer",this.rightDotForAddColumn.style.zIndex="1000",this.rightDotForAddColumn.style.borderRadius="50%",this.rightDotForAddColumn.style.border="1px solid white",this.rightDotForAddColumn.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.rightDotForAddColumn),this.addIconForAddColumn=document.createElement("div"),this.addIconForAddColumn.style.width="18px",this.addIconForAddColumn.style.height="18px",this.addIconForAddColumn.style.backgroundColor="#4A90E2",this.addIconForAddColumn.style.position="absolute",this.addIconForAddColumn.style.zIndex="1001",this.addIconForAddColumn.style.display="none",this.addIconForAddColumn.style.borderRadius="50%",this.addIconForAddColumn.style.boxShadow="0 2px 5px rgba(0,0,0,0.2)",this.addIconForAddColumn.style.justifyContent="center",this.addIconForAddColumn.style.alignItems="center",this.addIconForAddColumn.style.border="1px solid white",document.body.appendChild(this.addIconForAddColumn);const e=document.createElement("div");e.textContent="+",e.style.color="white",e.style.fontSize="18px",e.style.fontWeight="bold",e.style.lineHeight="15px",e.style.userSelect="none",e.style.cursor="pointer",e.style.verticalAlign="top",e.style.textAlign="center",this.addIconForAddColumn.appendChild(e),this.addLineForAddColumn=document.createElement("div"),this.addLineForAddColumn.style.width="2px",this.addLineForAddColumn.style.height="10px",this.addLineForAddColumn.style.backgroundColor="#4A90E2",this.addLineForAddColumn.style.position="absolute",this.addLineForAddColumn.style.zIndex="1001",this.addLineForAddColumn.style.display="none",document.body.appendChild(this.addLineForAddColumn)}bindEventForAddColumn(){this.leftDotForAddColumn.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addColumn),this.addIconForAddColumn.style.display="block";const e=this.leftDotForAddColumn.offsetWidth,t=this.leftDotForAddColumn.offsetHeight;this.showAddIconForAddColumn(this.leftDotForAddColumn.offsetLeft+e/2,this.leftDotForAddColumn.offsetTop+t/2,!0),this.showSplitLineForAddColumn(this.leftDotForAddColumn.offsetLeft+e/2-1,this.leftDotForAddColumn.offsetTop+t/2+2,this.table.getDrawRange().height)})),this.rightDotForAddColumn.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addColumn),this.addIconForAddColumn.style.display="block";const e=this.rightDotForAddColumn.offsetWidth,t=this.rightDotForAddColumn.offsetHeight;this.showAddIconForAddColumn(this.rightDotForAddColumn.offsetLeft+e/2,this.rightDotForAddColumn.offsetTop+t/2,!1),this.showSplitLineForAddColumn(this.rightDotForAddColumn.offsetLeft+e/2-1,this.rightDotForAddColumn.offsetTop+t/2+2,this.table.getDrawRange().height)})),this.addIconForAddColumn.addEventListener("mouseleave",(()=>{this.addIconForAddColumn.style.display="none",this.addLineForAddColumn.style.display="none",this.delayHideAllForAddColumn()})),this.addIconForAddColumn.addEventListener("click",(e=>{const t="left"===this.addIconForAddColumn.dataset.addIconType;this.table.options.columns;const r=this.hoverCell.col,n=t?r:r+1;this.pluginOptions.addColumnCallback?this.pluginOptions.addColumnCallback(n,this.table):this.table.addColumns([{field:n,title:`New Column ${r}`,width:100}],n,!0),this.delayHideAllForAddColumn(0)}))}showDotForAddColumn(e,t,r,n=!0,i=!0){const s=this.leftDotForAddColumn.offsetWidth,o=this.leftDotForAddColumn.offsetHeight;this.leftDotForAddColumn.style.left=t-s/2+"px",this.leftDotForAddColumn.style.top=e-o/2+"px",this.rightDotForAddColumn.style.left=r-s/2+"px",this.rightDotForAddColumn.style.top=e-o/2+"px",this.leftDotForAddColumn.style.display=n?"block":"none",this.rightDotForAddColumn.style.display=i?"block":"none"}showAddIconForAddColumn(e,t,r){const n=this.addIconForAddColumn.offsetWidth,i=this.addIconForAddColumn.offsetHeight,s=this.leftDotForAddColumn.offsetHeight;this.addIconForAddColumn.style.left=e-n/2+"px",this.addIconForAddColumn.style.top=t-i/2-s/2+"px",this.addIconForAddColumn.dataset.addIconType=r?"left":"right"}showSplitLineForAddColumn(e,t,r){this.addLineForAddColumn.style.left=`${e}px`,this.addLineForAddColumn.style.top=`${t}px`,this.addLineForAddColumn.style.height=`${r}px`,this.addLineForAddColumn.style.display="block"}delayHideAllForAddColumn(e=1e3){this.hideAllTimeoutId_addColumn=setTimeout((()=>{this.addIconForAddColumn.style.display="none",this.addLineForAddColumn.style.display="none",this.leftDotForAddColumn.style.display="none",this.rightDotForAddColumn.style.display="none"}),e)}initAddRowDomElement(){this.topDotForAddRow=document.createElement("div"),this.topDotForAddRow.style.width="6px",this.topDotForAddRow.style.height="6px",this.topDotForAddRow.style.backgroundColor="#4A90E2",this.topDotForAddRow.style.position="absolute",this.topDotForAddRow.style.cursor="pointer",this.topDotForAddRow.style.zIndex="1000",this.topDotForAddRow.style.borderRadius="50%",this.topDotForAddRow.style.border="1px solid white",this.topDotForAddRow.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.topDotForAddRow),this.bottomDotForAddRow=document.createElement("div"),this.bottomDotForAddRow.style.width="6px",this.bottomDotForAddRow.style.height="6px",this.bottomDotForAddRow.style.backgroundColor="#4A90E2",this.bottomDotForAddRow.style.position="absolute",this.bottomDotForAddRow.style.cursor="pointer",this.bottomDotForAddRow.style.zIndex="1000",this.bottomDotForAddRow.style.borderRadius="50%",this.bottomDotForAddRow.style.border="1px solid white",this.bottomDotForAddRow.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.bottomDotForAddRow),this.addIconForAddRow=document.createElement("div"),this.addIconForAddRow.style.width="18px",this.addIconForAddRow.style.height="18px",this.addIconForAddRow.style.backgroundColor="#4A90E2",this.addIconForAddRow.style.position="absolute",this.addIconForAddRow.style.zIndex="1001",this.addIconForAddRow.style.display="none",this.addIconForAddRow.style.borderRadius="50%",this.addIconForAddRow.style.boxShadow="0 2px 5px rgba(0,0,0,0.2)",this.addIconForAddRow.style.justifyContent="center",this.addIconForAddRow.style.alignItems="center",this.addIconForAddRow.style.border="1px solid white",document.body.appendChild(this.addIconForAddRow);const e=document.createElement("div");e.textContent="+",e.style.color="white",e.style.fontSize="18px",e.style.fontWeight="bold",e.style.lineHeight="15px",e.style.userSelect="none",e.style.cursor="pointer",e.style.verticalAlign="top",e.style.textAlign="center",this.addIconForAddRow.appendChild(e),this.addLineForAddRow=document.createElement("div"),this.addLineForAddRow.style.width="10px",this.addLineForAddRow.style.height="2px",this.addLineForAddRow.style.backgroundColor="#4A90E2",this.addLineForAddRow.style.position="absolute",this.addLineForAddRow.style.zIndex="1001",this.addLineForAddRow.style.display="none",document.body.appendChild(this.addLineForAddRow)}bindEventForAddRow(){this.topDotForAddRow.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addRow),this.addIconForAddRow.style.display="block";const e=this.topDotForAddRow.offsetWidth,t=this.topDotForAddRow.offsetHeight;this.showAddIconForAddRow(this.topDotForAddRow.offsetLeft+e/2,this.topDotForAddRow.offsetTop+t/2,!0),this.showSplitLineForAddRow(this.topDotForAddRow.offsetLeft+e+2,this.topDotForAddRow.offsetTop+t/2-1,this.table.getDrawRange().width)})),this.bottomDotForAddRow.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addRow),this.addIconForAddRow.style.display="block";const e=this.bottomDotForAddRow.offsetWidth,t=this.bottomDotForAddRow.offsetHeight;this.showAddIconForAddRow(this.bottomDotForAddRow.offsetLeft+e/2,this.bottomDotForAddRow.offsetTop+t/2,!1),this.showSplitLineForAddRow(this.bottomDotForAddRow.offsetLeft+e+2,this.bottomDotForAddRow.offsetTop+t/2-1,this.table.getDrawRange().height)})),this.addIconForAddRow.addEventListener("mouseleave",(()=>{this.addIconForAddRow.style.display="none",this.addLineForAddRow.style.display="none",this.delayHideAllForAddRow()})),this.addIconForAddRow.addEventListener("click",(e=>{const t="top"===this.addIconForAddRow.dataset.addIconType,r=this.hoverCell.row,n=t?r:r+1;if(this.pluginOptions.addRowCallback)this.pluginOptions.addRowCallback(n,this.table);else{const e=this.table.getRecordIndexByCell(0,n);this.table.addRecord({},e)}this.delayHideAllForAddRow(0)}))}showDotForAddRow(e,t,r,n=!0,i=!0){const s=this.topDotForAddRow.offsetWidth,o=this.topDotForAddRow.offsetHeight;this.topDotForAddRow.style.left=t-s/2+"px",this.topDotForAddRow.style.top=e-o/2+"px",this.bottomDotForAddRow.style.left=t-s/2+"px",this.bottomDotForAddRow.style.top=r-o/2+"px",this.topDotForAddRow.style.display=n?"block":"none",this.bottomDotForAddRow.style.display=i?"block":"none"}showAddIconForAddRow(e,t,r){const n=this.addIconForAddRow.offsetWidth,i=this.addIconForAddRow.offsetHeight,s=this.topDotForAddRow.offsetWidth;this.addIconForAddRow.style.left=e-n/2-s/2+"px",this.addIconForAddRow.style.top=t-i/2+"px",this.addIconForAddRow.dataset.addIconType=r?"top":"bottom"}showSplitLineForAddRow(e,t,r){this.addLineForAddRow.style.left=`${e}px`,this.addLineForAddRow.style.top=`${t}px`,this.addLineForAddRow.style.width=`${r}px`,this.addLineForAddRow.style.display="block"}delayHideAllForAddRow(e=1e3){this.hideAllTimeoutId_addRow=setTimeout((()=>{this.addIconForAddRow.style.display="none",this.addLineForAddRow.style.display="none",this.topDotForAddRow.style.display="none",this.bottomDotForAddRow.style.display="none"}),e)}release(){this.leftDotForAddColumn.remove(),this.rightDotForAddColumn.remove(),this.addIconForAddColumn.remove(),this.addLineForAddColumn.remove(),this.topDotForAddRow.remove(),this.bottomDotForAddRow.remove(),this.addIconForAddRow.remove(),this.addLineForAddRow.remove()}},e.AutoFillPlugin=class{id="auto-fill";name="Auto Fill";runTime=[r.TABLE_EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,r.TABLE_EVENT_TYPE.DRAG_FILL_HANDLE_END,r.TABLE_EVENT_TYPE.DBLCLICK_FILL_HANDLE];table;autoFillManager;constructor(e){this.autoFillManager=new El(e)}run(...e){if(e[1]===r.TABLE_EVENT_TYPE.MOUSEDOWN_FILL_HANDLE){const[,,t]=e;this.table=t,this.autoFillManager.setTable(this.table),this.autoFillManager.handleStartDrag(this.table?.getSelectedCellRanges()[0])}else if(e[1]===r.TABLE_EVENT_TYPE.DRAG_FILL_HANDLE_END){const[{direction:t}]=e;this.autoFillManager.handleEndDrag(this.table?.getSelectedCellRanges()[0],t)}else e[1]===r.TABLE_EVENT_TYPE.DBLCLICK_FILL_HANDLE&&this.autoFillManager.handleDbClick()}},e.CarouselAnimationPlugin=class{table;rowCount;colCount;animationDuration;animationDelay;animationEasing;replaceScrollAction;playing;row;col;willUpdateRow=!1;willUpdateCol=!1;customDistRowFunction;customDistColFunction;constructor(e,t){this.table=e,this.rowCount=t?.rowCount??void 0,this.colCount=t?.colCount??void 0,this.animationDuration=t?.animationDuration??500,this.animationDelay=t?.animationDelay??1e3,this.animationEasing=t?.animationEasing??"linear",this.replaceScrollAction=t?.replaceScrollAction??!1,this.customDistColFunction=t.customDistColFunction,this.customDistRowFunction=t.customDistRowFunction,this.reset(),this.init()}init(){this.replaceScrollAction&&(this.table.disableScroll(),this.table.scenegraph.stage.addEventListener("wheel",this.onScrollEnd.bind(this)))}reset(){this.playing=!1,this.row=this.table.frozenRowCount,this.col=this.table.frozenColCount}onScrollEnd(e){this.rowCount?(e.deltaY>0?(this.row+=this.rowCount,this.row=Math.min(this.row,this.table.rowCount-this.table.frozenRowCount)):e.deltaY<0&&(this.row-=this.rowCount,this.row=Math.max(this.row,this.table.frozenRowCount)),this.table.scrollToRow(this.row,{duration:this.animationDuration,easing:this.animationEasing})):this.colCount&&(e.deltaX>0?(this.col+=this.colCount,this.col=Math.min(this.col,this.table.colCount-this.table.frozenColCount)):e.deltaX<0&&(this.col-=this.colCount,this.col=Math.max(this.col,this.table.frozenColCount)),this.table.scrollToCol(this.col,{duration:this.animationDuration,easing:this.animationEasing}))}play(){this.playing=!0,this.rowCount&&!this.willUpdateRow?this.updateRow():this.colCount&&!this.willUpdateCol&&this.updateCol()}pause(){this.playing=!1}updateRow(){if(!this.playing||this.table.isReleased)return;let e=!0;const t=this.customDistRowFunction&&this.customDistRowFunction(this.row,this.table);t?(this.row=t.distRow,e=t.animation??!0):s(this.row)&&this.table.scenegraph.proxy.screenTopRow!==this.row?(this.row=this.table.frozenRowCount,e=!1):s(this.row)||this.table.scenegraph.proxy.screenTopRow===Math.floor(this.row)?this.row+=this.rowCount:(this.row=this.table.frozenRowCount,e=!1),this.table.scrollToRow(this.row,e?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateRow=!0,setTimeout((()=>{this.willUpdateRow=!1,this.updateRow()}),this.animationDuration+this.animationDelay)}updateCol(){if(!this.playing||this.table.isReleased)return;let e=!0;const t=this.customDistColFunction&&this.customDistColFunction(this.col,this.table);t?(this.col=t.distCol,e=t.animation??!0):s(this.col)&&this.table.scenegraph.proxy.screenLeftCol!==this.col?(this.col=this.table.frozenColCount,e=!1):s(this.col)||this.table.scenegraph.proxy.screenLeftCol===Math.floor(this.col)?this.col+=this.colCount:(this.col=this.table.frozenColCount,e=!1),this.table.scrollToCol(this.col,e?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateCol=!0,setTimeout((()=>{this.willUpdateCol=!1,this.updateCol()}),this.animationDuration+this.animationDelay)}},e.ColumnSeriesPlugin=class{id="column-series";name="Column Series";runTime=[r.TABLE_EVENT_TYPE.BEFORE_INIT,r.TABLE_EVENT_TYPE.BEFORE_KEYDOWN];pluginOptions;table;columns=[];constructor(e){this.id=e.id??this.id,this.pluginOptions=Object.assign({columnCount:100},e)}run(...e){if(e[1]===r.TABLE_EVENT_TYPE.BEFORE_INIT){const t=e[0],r=e[2];this.table=r;const n=t.options;this.columns=this.generateColumns(this.pluginOptions.columnCount),n.columns=this.columns}else if(e[1]===r.TABLE_EVENT_TYPE.BEFORE_KEYDOWN){const t=e[0].event;this.pluginOptions.autoExtendColumnTriggerKeys?.includes(t.key)&&this.table.stateManager.select.cellPos.col===this.table.colCount-1&&this.table.addColumns([this.generateColumn(this.table.colCount-1)])}}generateColumns(e){const t=[];for(let r=0;r<e;r++)t.push(this.generateColumn(r));return t}generateColumn(e){return{title:this.pluginOptions.generateColumnTitle?this.pluginOptions.generateColumnTitle(e):this.generateColumnField(e)}}generateColumnField(e){if(e<26)return String.fromCharCode(65+e);const t=[];for(e++;e>0;)e--,t.unshift(String.fromCharCode(65+e%26)),e=Math.floor(e/26);return t.join("")}resetColumnCount(e){this.pluginOptions.columnCount=e,this.columns=this.generateColumns(e),this.table.updateColumns(this.columns)}},e.ConditionFilter=Xi,e.ContextMenuPlugin=class{id="context-menu";name="Context Menu";runTime=[r.TABLE_EVENT_TYPE.CONTEXTMENU_CELL,r.TABLE_EVENT_TYPE.PLUGIN_EVENT];pluginOptions;table;menuManager;menuHandler;constructor(e={}){this.id=e.id??this.id,this.pluginOptions=e,this.menuManager=new P,this.menuHandler=new Hi,this.initDefaultMenuItems()}initDefaultMenuItems(){this.pluginOptions.columnSeriesNumberMenuItems||(this.pluginOptions.columnSeriesNumberMenuItems=H),this.pluginOptions.rowSeriesNumberMenuItems||(this.pluginOptions.rowSeriesNumberMenuItems=z),this.pluginOptions.cornerSeriesNumberMenuItems||(this.pluginOptions.cornerSeriesNumberMenuItems=U),this.pluginOptions.headerCellMenuItems||(this.pluginOptions.headerCellMenuItems=B),this.pluginOptions.bodyCellMenuItems||(this.pluginOptions.bodyCellMenuItems=D)}handleContextMenuCell=(e,t)=>{const{col:r,row:n}=e,i=e.event.clientX,s=e.event.clientY,o=t.isSeriesNumber(r,n);let a=[];if(a=t.isHeader(r,n)?o?this.pluginOptions.columnSeriesNumberMenuItems||[]:this.pluginOptions.headerCellMenuItems||[]:o?this.pluginOptions.rowSeriesNumberMenuItems||[]:this.pluginOptions.bodyCellMenuItems||[],a.length>0){const e=t.getCellRange(r,n);a=e.start.col!==e.end.col||e.start.row!==e.end.row?a.filter((e=>"string"==typeof e||"merge_cells"!==e.menuKey)):a.filter((e=>"string"==typeof e||"unmerge_cells"!==e.menuKey)),this.pluginOptions.beforeShowAdjustMenuItems&&(a=this.pluginOptions.beforeShowAdjustMenuItems(a,t,r,n)),this.showContextMenu(a,i,s,r,n)}};handlePluginEvent=(e,t)=>{const{eventType:r,rowIndex:n,colIndex:i,isCorner:s}=e.pluginEventInfo,o=e.plugin,a=e.event.clientX,l=e.event.clientY;if("table-series-number"===o.id&&"rightclick"===r){let e=[];s?e=this.pluginOptions.cornerSeriesNumberMenuItems||[]:void 0!==n?e=this.pluginOptions.rowSeriesNumberMenuItems||[]:void 0!==i&&(e=this.pluginOptions.columnSeriesNumberMenuItems||[]),this.pluginOptions.beforeShowAdjustMenuItems&&(e=this.pluginOptions.beforeShowAdjustMenuItems(e,t,i,n)),this.showContextMenu(e,a,l,i,n)}};run(...e){const t=e[0],n=e[1],i=e[2];this.table=i,t.event.preventDefault(),n===r.TABLE_EVENT_TYPE.CONTEXTMENU_CELL?this.handleContextMenuCell(t,i):n===r.TABLE_EVENT_TYPE.PLUGIN_EVENT&&this.handlePluginEvent(t,i)}handleMenuClickCallback=(e,t)=>{"function"==typeof this.pluginOptions.menuClickCallback?this.pluginOptions.menuClickCallback(e,t):this.handleMenuClick(e,t)};showContextMenu(e,t,r,n,i){this.menuManager.showMenu(e,t,r,{rowIndex:i,colIndex:n},this.table),this.menuManager.setClickCallback(this.handleMenuClickCallback)}handleMenuClick(t,r){const{menuKey:n,rowIndex:i,colIndex:s,inputValue:o=1}=t;if("object"==typeof this.pluginOptions.menuClickCallback&&this.pluginOptions.menuClickCallback[n])this.pluginOptions.menuClickCallback[n](t,r);else switch(n){case e.MenuKey.COPY:this.menuHandler.handleCopy(r);break;case e.MenuKey.CUT:this.menuHandler.handleCut(r);break;case e.MenuKey.PASTE:this.menuHandler.handlePaste(r);break;case e.MenuKey.INSERT_ROW_ABOVE:this.menuHandler.handleInsertRowAbove(r,i,o);break;case e.MenuKey.INSERT_ROW_BELOW:this.menuHandler.handleInsertRowBelow(r,i,o);break;case e.MenuKey.INSERT_COLUMN_LEFT:this.menuHandler.handleInsertColumnLeft(r,s,o);break;case e.MenuKey.INSERT_COLUMN_RIGHT:this.menuHandler.handleInsertColumnRight(r,s,o);break;case e.MenuKey.DELETE_ROW:this.menuHandler.handleDeleteRow(r);break;case e.MenuKey.DELETE_COLUMN:this.menuHandler.handleDeleteColumn(r,s);break;case e.MenuKey.HIDE_COLUMN:this.menuHandler.handleHideColumn(r,s);break;case e.MenuKey.SORT:this.menuHandler.handleSort(r,s);break;case e.MenuKey.MERGE_CELLS:this.menuHandler.handleMergeCells(r);break;case e.MenuKey.UNMERGE_CELLS:this.menuHandler.handleUnmergeCells(r);break;case e.MenuKey.FREEZE_TO_THIS_ROW:this.menuHandler.handleFreezeToRow(r,i);break;case e.MenuKey.FREEZE_TO_THIS_COLUMN:this.menuHandler.handleFreezeToColumn(r,s);break;case e.MenuKey.FREEZE_TO_THIS_ROW_AND_COLUMN:this.menuHandler.handleFreezeToRowAndColumn(r,i,s);break;case e.MenuKey.UNFREEZE:this.menuHandler.handleUnfreeze(r)}}release(){this.menuManager&&(this.menuManager.release(),this.menuManager=null),this.menuHandler&&(this.menuHandler.release(),this.menuHandler=null)}},e.CustomFormulaAdapter=js,e.DEFAULT_BODY_MENU_ITEMS=D,e.DEFAULT_COLUMN_SERIES_MENU_ITEMS=H,e.DEFAULT_CORNER_SERIES_MENU_ITEMS=U,e.DEFAULT_HEADER_MENU_ITEMS=B,e.DEFAULT_ROW_SERIES_MENU_ITEMS=z,e.DefaultFormulaAdapter=Fs,e.ExcelEditCellKeyboardPlugin=class{id="excel-edit-cell-keyboard";name="Excel Edit Cell Keyboard";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED];table;pluginOptions;responseKeyboard;constructor(t){this.id=t?.id??this.id,this.pluginOptions=t,this.responseKeyboard=t?.responseKeyboard??[e.ExcelEditCellKeyboardResponse.ENTER,e.ExcelEditCellKeyboardResponse.TAB,e.ExcelEditCellKeyboardResponse.ARROW_LEFT,e.ExcelEditCellKeyboardResponse.ARROW_RIGHT,e.ExcelEditCellKeyboardResponse.ARROW_DOWN,e.ExcelEditCellKeyboardResponse.ARROW_UP,e.ExcelEditCellKeyboardResponse.DELETE,e.ExcelEditCellKeyboardResponse.BACKSPACE],this.bindEvent()}run(...e){const t=e[2];this.table=t}bindEvent(){document.addEventListener("keydown",this.handleKeyDown.bind(this),!0)}handleKeyDown(t){if(this.table?.editorManager&&this.isExcelShortcutKey(t)){const r=t.key.toLowerCase();if(this.table.editorManager.editingEditor&&"keydown"===this.table.editorManager.beginTriggerEditCellMode){const{col:n,row:i}=this.table.editorManager.editCell;if(r===e.ExcelEditCellKeyboardResponse.BACKSPACE||r===e.ExcelEditCellKeyboardResponse.DELETE)return;this.table.editorManager.completeEdit(),this.table.getElement().focus(),t.shiftKey||t.ctrlKey||t.metaKey||(r===e.ExcelEditCellKeyboardResponse.ENTER?this.table.selectCell(n,i+1):r===e.ExcelEditCellKeyboardResponse.TAB?this.table.selectCell(n+1,i):r===e.ExcelEditCellKeyboardResponse.ARROW_LEFT?this.table.selectCell(n-1,i):r===e.ExcelEditCellKeyboardResponse.ARROW_RIGHT?this.table.selectCell(n+1,i):r===e.ExcelEditCellKeyboardResponse.ARROW_DOWN?this.table.selectCell(n,i+1):r===e.ExcelEditCellKeyboardResponse.ARROW_UP&&this.table.selectCell(n,i-1),t.stopPropagation(),t.preventDefault())}else{const{col:n,row:i}=this.table.stateManager.select.cellPos;if(!this.table.editorManager.editingEditor||r!==e.ExcelEditCellKeyboardResponse.ENTER&&r!==e.ExcelEditCellKeyboardResponse.TAB){if(!this.table.editorManager.editingEditor&&(r===e.ExcelEditCellKeyboardResponse.DELETE||r===e.ExcelEditCellKeyboardResponse.BACKSPACE)){const e=this.table.getSelectedCellInfos();e?.length>0&&(document.activeElement===this.table.getElement()||Object.values(this.table.editorManager.cacheLastSelectedCellEditor||{}).some((e=>e.getInputElement?.()===document.activeElement)))&&(!function(e,t,r=!1){for(let n=0;n<e.length;n++)for(let i=0;i<e[n].length;i++)t.changeCellValue(e[n][i].col,e[n][i].row,"",r)}(e,this.table,this.pluginOptions?.deleteWorkOnEditableCell??!0),t.stopPropagation(),t.preventDefault())}}else this.table.editorManager.completeEdit(),this.table.getElement().focus(),r===e.ExcelEditCellKeyboardResponse.ENTER?this.table.selectCell(n,i+1):r===e.ExcelEditCellKeyboardResponse.TAB&&this.table.selectCell(n+1,i),t.stopPropagation(),t.preventDefault()}}}isExcelShortcutKey(e){return this.responseKeyboard.includes(e.key.toLowerCase())}setResponseKeyboard(e){this.responseKeyboard=e}deleteResponseKeyboard(e){this.responseKeyboard=this.responseKeyboard.filter((t=>!e.includes(t)))}addResponseKeyboard(e){this.responseKeyboard=[...this.responseKeyboard,...e]}release(){document.removeEventListener("keydown",this.handleKeyDown,!0)}},e.ExcelImportPlugin=Bi,e.ExportGanttPlugin=class{id="gantt-export-helper";name="Gantt Export Helper";_gantt=null;run(...e){const t=e[0];t&&(this._gantt=t)}async exportToImage(e={}){if(!this._gantt)return;const{fileName:r="gantt-export",type:n="png",quality:i=1,backgroundColor:s="#ffffff",scale:o=window.devicePixelRatio||1,download:a=!0}=e;try{const{tempContainer:e,clonedGantt:l}=await this.createFullSizeContainer(o);try{await new Promise((e=>t.vglobal.getRequestAnimationFrame()(e)));const e=(l.taskListTableInstance.getAllColsWidth()+l.getAllDateColsWidth())*o,c=l.getAllRowsHeight()*o,h=document.createElement("canvas");h.width=e,h.height=c;const u=h.getContext("2d");u.fillStyle=s,u.fillRect(0,0,e,c),l.taskListTableInstance?.canvas&&u.drawImage(l.taskListTableInstance.canvas,0,0,l.taskListTableInstance.getAllColsWidth()*o,c);const f=3*o,d=l.taskListTableInstance.getAllColsWidth()*o;u.fillStyle="rgb(225, 228, 232)",u.fillRect(d-f/2,0,f,c);const p=4*o,m=l.canvas.width-p;return l.canvas&&u.drawImage(l.canvas,p,0,m,l.canvas.height,(l.taskListTableInstance.getAllColsWidth()+1.5)*o,0,(l.getAllDateColsWidth()-1.5)*o,c),this.finalizeExport(h,r,n,i,a)}finally{e.remove(),l.release()}}catch(e){throw new Error(`甘特图导出失败: ${e instanceof Error?e.message:"未知错误"}`)}}async exportToBase64(e={}){return this.exportToImage({...e,download:!1})}async createFullSizeContainer(e){if(!this._gantt)throw new Error("ExportGanttPlugin: Gantt instance not available to create container.");const t=document.createElement("div");t.style.position="fixed",t.style.left="-9999px",t.style.overflow="hidden",t.style.width=`${window.innerWidth+100}px`,t.style.height=`${window.innerHeight+100}px`,document.body.appendChild(t);const r=document.createElement("div"),n=this._gantt.taskListTableInstance.getAllColsWidth()+this._gantt.getAllDateColsWidth(),i=this._gantt.getAllRowsHeight();r.style.width=`${n}px`,r.style.height=`${i}px`,t.appendChild(r);try{let n;try{if(n=(await import("@visactor/vtable-gantt")).Gantt,!n)throw new Error("Gantt class not found in @visactor/vtable-gantt")}catch(e){throw new Error("导出甘特图需要安装并正确加载 @visactor/vtable-gantt 依赖\n请执行: npm install @visactor/vtable-gantt")}const i=new n(r,{...this._gantt.options,records:this._gantt.records,taskListTable:{...this._gantt.options.taskListTable,tableWidth:void 0,minTableWidth:void 0,maxTableWidth:void 0},plugins:[]});return i.setPixelRatio(e),i.scenegraph?.ganttGroup&&i.scenegraph.ganttGroup.setAttribute("clip",!1),i.taskListTableInstance?.scenegraph?.tableGroup&&i.taskListTableInstance.scenegraph.tableGroup.setAttribute("clip",!1),i.scenegraph.stage.render(),{tempContainer:t,clonedGantt:i}}catch(e){throw t&&t.parentNode&&t.remove(),new Error("导出甘特图需要安装 @visactor/vtable-gantt 依赖")}}finalizeExport(e,t,r,n,i=!0){const s=e.toDataURL(`image/${r}`,n);if(i){const e=document.createElement("a");e.download=`${t}.${r}`,e.href=s,document.body.appendChild(e),e.click(),document.body.removeChild(e)}return s}release(){this._gantt=null}},e.FilterEngine=zi,e.FilterPlugin=class{id="filter";name="Filter";runTime=[r.TABLE_EVENT_TYPE.BEFORE_INIT,r.TABLE_EVENT_TYPE.BEFORE_UPDATE_OPTION,r.TABLE_EVENT_TYPE.ICON_CLICK,r.TABLE_EVENT_TYPE.SCROLL,r.TABLE_EVENT_TYPE.CHANGE_CELL_VALUE,r.TABLE_EVENT_TYPE.UPDATE_RECORD,r.TABLE_EVENT_TYPE.ADD_RECORD,r.TABLE_EVENT_TYPE.DELETE_RECORD];pluginOptions;table;columns;filterEngine;filterStateManager;filterToolbar;constructor(e){this.id=e?.id??this.id,this.pluginOptions=Ji.cloneDeep(e),this.pluginOptions.filterIcon=e.filterIcon??{name:"filter-icon",type:"svg",width:12,height:12,positionType:r.TYPES.IconPosition.right,cursor:"pointer",svg:'<svg t="1752821809070" class="icon" viewBox="0 0 1664 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12092" width="200" height="200"><path d="M89.6 179.2A89.6 89.6 0 0 1 89.6 0h1408a89.6 89.6 0 0 1 0 179.2H89.6z m256 384a89.6 89.6 0 0 1 0-179.2h896a89.6 89.6 0 0 1 0 179.2h-896z m256 384a89.6 89.6 0 0 1 0-179.2h384a89.6 89.6 0 0 1 0 179.2h-384z" fill="#93a2b9" p-id="12093"></path></svg>'},this.pluginOptions.filteringIcon=e.filteringIcon??{name:"filtering-icon",type:"svg",width:12,height:12,positionType:r.TYPES.IconPosition.right,cursor:"pointer",svg:'<svg t="1752821771292" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11926" width="200" height="200"><path d="M971.614323 53.05548L655.77935 412.054233C635.196622 435.434613 623.906096 465.509377 623.906096 496.583302v495.384307c0 28.975686-35.570152 43.063864-55.353551 21.781723l-159.865852-171.256294c-5.495389-5.895053-8.59279-13.688514-8.592789-21.781722V496.583302c0-31.073925-11.290526-61.148688-31.873254-84.429153L52.385677 53.05548C34.200936 32.472751 48.888611 0 76.365554 0h871.268892c27.476943 0 42.164618 32.472751 23.979877 53.05548z" fill="#416eff" p-id="11927"></path></svg>'},this.pluginOptions.filterModes&&this.pluginOptions.filterModes.length||(this.pluginOptions.filterModes=["byValue","byCondition"]),this.pluginOptions.styles=Ji.merge(Vi,this.pluginOptions.styles??{}),this.pluginOptions.conditionCategories=e.conditionCategories??Ki}initFilterPlugin(t){this.filterEngine=new zi(this.pluginOptions),this.filterStateManager=new Ui(this.table,this.filterEngine),this.filterToolbar=new Gi(this.table,this.filterStateManager,this.pluginOptions),this.columns=t.options.columns,this.filterToolbar.render(document.body),this.updateFilterIcons(this.columns),this.filterStateManager.subscribe(((t,r)=>{r?.type!==e.FilterActionType.ADD_FILTER&&(this.updateFilterIcons(this.columns),this.table.updateColumns(this.columns,{clearRowHeightCache:!1}))}))}run(...e){const t=e[0],n=e[1],i=e[2];if(this.table=i,n===r.TABLE_EVENT_TYPE.BEFORE_INIT)this.initFilterPlugin(t);else if(n===r.TABLE_EVENT_TYPE.BEFORE_UPDATE_OPTION)this.filterEngine&&this.filterStateManager&&this.filterToolbar||this.initFilterPlugin(t),this.pluginOptions={...this.pluginOptions,...t.options.plugins?.find((e=>e.id===this.id))?.pluginOptions},this.columns=t.options.columns,this.handleOptionUpdate(t.options);else if(n===r.TABLE_EVENT_TYPE.ICON_CLICK&&"filter-icon"===t.name||"filtering-icon"===t.name){if(3===t.event?.which||2===t.event?.button||2==(2&t.event?.buttons))return;const e=t.col,n=t.row;this.filterToolbar.isVisible?this.filterToolbar.hide(t.col,t.row):(this.filterToolbar.show(e,n,this.pluginOptions.filterModes),this.table.fireListeners(r.TABLE_EVENT_TYPE.FILTER_MENU_SHOW,{col:t.col,row:t.row}))}else if(n===r.TABLE_EVENT_TYPE.SCROLL)"horizontal"===t.scrollDirection&&this.filterToolbar.adjustMenuPosition();else if(n===r.TABLE_EVENT_TYPE.CHANGE_CELL_VALUE){const e=this.table.getHeaderField(t.col,t.row);this.syncFilterWithTableData(e)}else(n===r.TABLE_EVENT_TYPE.UPDATE_RECORD||n===r.TABLE_EVENT_TYPE.ADD_RECORD||n===r.TABLE_EVENT_TYPE.DELETE_RECORD)&&this.syncFilterWithTableData()}updatePluginOptions(e){this.pluginOptions=Ji.merge(this.pluginOptions,e),this.filterToolbar.updateStyles(this.pluginOptions.styles),this.table.updateColumns(this.columns,{clearRowHeightCache:!1})}update(){this.filterStateManager&&this.reapplyActiveFilters()}syncFilterWithTableData(e){const t=this.filterStateManager.getFilterState(e)?.type;if("byValue"===t){if(null!=e)return void this.filterToolbar.valueFilter.syncSingleStateFromTableData(e);this.table.dataSource.columns.forEach((({field:e})=>{this.filterToolbar.valueFilter.syncSingleStateFromTableData(e)}))}}handleOptionUpdate(e){const t=this.filterStateManager?this.filterStateManager.getActiveFilterFields():[];this.filterStateManager&&t.length>0&&this.validateFilterStatesAfterUpdate(e,t),this.updateFilterIcons(e.columns)}reapplyActiveFilters(){this.filterStateManager.reapplyCurrentFilters()}validateFilterStatesAfterUpdate(t,r){const n=t.columns,i=[];r.forEach((e=>{const t=n.find((t=>t.field===e));t&&this.shouldEnableFilterForColumn(e,t)||i.push(e)})),i.forEach((t=>{this.filterStateManager.dispatch({type:e.FilterActionType.REMOVE_FILTER,payload:{field:t}})}))}updateFilterIcons(e=[]){const t=this.pluginOptions.filterIcon,r=this.pluginOptions.filteringIcon,n=(e,t)=>e===t||e&&t&&"object"==typeof e&&"object"==typeof t&&e.name===t.name,i=[...e],s=[];for(;i.length>0;){const e=i.pop();e.columns?e.columns.forEach((e=>i.push(e))):s.push(e)}s.forEach((e=>{const i=this.shouldEnableFilterForColumn(e.field,e),s=!!this.filterStateManager.getFilterState(e.field)?.enable;let o=(e=>e?Array.isArray(e)?e:[e]:[])(e.headerIcon);var a;i?s?o.some((e=>n(e,r)))||(o=o.filter((e=>!n(e,t))),o.push(r)):o.some((e=>n(e,t)))||(o=o.filter((e=>!n(e,r))),o.push(t)):o=o.filter((e=>!n(e,t))),e.headerIcon=0===(a=o).length?void 0:1===a.length?a[0]:a}))}shouldEnableFilterForColumn(e,t){if(!t.title)return!1;const r=t;return void 0!==r.filter?!!r.filter:this.pluginOptions.enableFilter?this.pluginOptions.enableFilter(e,t):void 0===this.pluginOptions.defaultEnabled||this.pluginOptions.defaultEnabled}getFilterState(){if(!this.filterStateManager)return null;const e=this.filterStateManager.getAllFilterStates(),t={};return e.filters.forEach(((e,r)=>{t[r]={enable:e.enable,field:e.field,type:e.type,values:e.values,operator:e.operator,condition:e.condition}})),{filters:t}}setFilterState(t){this.filterStateManager&&(this.filterStateManager.dispatch({type:e.FilterActionType.CLEAR_ALL_FILTERS,payload:{}}),t&&t.filters&&Object.entries(t.filters).forEach((([,t])=>{t.enable&&this.filterStateManager.dispatch({type:e.FilterActionType.ADD_FILTER,payload:{field:t.field,type:t.type,values:t.values,operator:t.operator,condition:t.condition,enable:!0}})})))}release(){this.columns.forEach((e=>{e.headerIcon=void 0})),this.table=null,this.filterEngine=null,this.filterStateManager=null,this.filterToolbar.destroy(),this.filterToolbar=null}},e.FilterStateManager=Ui,e.FilterToolbar=Gi,e.FocusHighlightPlugin=class{id="focus-highlight";name="Focus Highlight";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED,r.TABLE_EVENT_TYPE.SELECTED_CELL,r.TABLE_EVENT_TYPE.SELECTED_CLEAR];table;range;pluginOptions;constructor(e={fill:"#000",opacity:.5,highlightRange:void 0}){this.id=e.id??this.id,this.pluginOptions=Object.assign({fill:"#000",opacity:.5},e)}run(...e){if(this.table||(this.table=e[2]),e[1]===r.TABLE_EVENT_TYPE.INITIALIZED)this.pluginOptions.highlightRange&&this.setFocusHighlightRange(this.pluginOptions.highlightRange);else if(e[1]===r.TABLE_EVENT_TYPE.SELECTED_CELL){const e=this.table.stateManager.select.cellPos;if(this.table.isHeader(e.col,e.row))this.setFocusHighlightRange(void 0);else{const e=this.table.stateManager.select.ranges,t=0,r=this.table.colCount-1,n=Math.min(e[0].start.row,e[0].end.row),i=Math.max(e[0].start.row,e[0].end.row);this.setFocusHighlightRange({start:{col:t,row:n},end:{col:r,row:i}})}}else e[1]===r.TABLE_EVENT_TYPE.SELECTED_CLEAR&&this.setFocusHighlightRange(void 0)}setFocusHighlightRange(e,t=!1){let r;e&&"start"in e&&"end"in e?r=e:e&&(r={start:e,end:e}),o(this.range,r)&&!t||(this.range=r,e?this.updateCellGroupShadow():this.deleteAllCellGroupShadow(),this.table.scenegraph.updateNextFrame())}deleteAllCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup)}updateCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup,this.range)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.range,this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup,this.range)}updateCellGroupShadowInContainer(e,r){let n;r&&"start"in r&&"end"in r?n=r:r&&(n={start:r,end:r}),e.forEachChildrenSkipChild((e=>{const r=e;"column"===r.role&&r.forEachChildrenSkipChild((e=>{const r=e;if("cell"!==r.role)return;r.attachShadow(r.shadowRoot);const i=r.shadowRoot;if(n){if(x(n,r.col,r.row))i.removeAllChild();else if(!i.firstChild){const e=t.createRect({x:0,y:0,width:r.attribute.width,height:r.attribute.height,fill:this.pluginOptions.fill,opacity:this.pluginOptions.opacity});e.name="shadow-rect",i.appendChild(e)}}else i.removeAllChild()}))}))}update(){this.table&&this.setFocusHighlightRange(this.range,!0)}},e.HeaderHighlightPlugin=class{table;options;colHeaderRange;rowHeaderRange;constructor(e,t){this.table=e,this.options=t,this.registerStyle(),this.bindEvent()}registerStyle(){this.table.registerCustomCellStyle("col-highlight",{bgColor:this.options?.colHighlightBGColor??"#82b2f5",color:this.options?.colHighlightColor??"#FFF"}),this.table.registerCustomCellStyle("row-highlight",{bgColor:this.options?.rowHighlightBGColor??"#82b2f5",color:this.options?.rowHighlightColor??"#FFF"})}bindEvent(){this.table.on("selected_cell",(()=>{this.updateHighlight()})),this.table.on("selected_clear",(()=>{this.clearHighlight()})),this.table.on("mousemove_table",(()=>{this.table.stateManager.select.selecting&&this.updateHighlight()}))}clearHighlight(){this.colHeaderRange&&this.table.arrangeCustomCellStyle({range:this.colHeaderRange},void 0),this.rowHeaderRange&&this.table.arrangeCustomCellStyle({range:this.rowHeaderRange},void 0),this.colHeaderRange=void 0,this.rowHeaderRange=void 0}updateHighlight(){if(!1===this.options?.colHighlight&&!1===this.options?.rowHighlight)return;const e=this.table.getSelectedCellRanges();if(0===e.length)return void this.clearHighlight();const t=e[0],r=[t.start.row,t.end.row];r.sort(((e,t)=>e-t));const n=[t.start.col,t.end.col];let i,s;n.sort(((e,t)=>e-t)),this.table.isPivotTable()?(i={start:{col:n[0],row:0},end:{col:n[1],row:this.table.columnHeaderLevelCount-1}},s={start:{col:0,row:r[0]},end:{col:this.table.rowHeaderLevelCount-1,row:r[1]}}):this.table.internalProps.transpose?s={start:{col:0,row:r[0]},end:{col:this.table.rowHeaderLevelCount-1,row:r[1]}}:(i={start:{col:n[0],row:0},end:{col:n[1],row:this.table.columnHeaderLevelCount-1}},this.table.internalProps.rowSeriesNumber&&(s={start:{col:0,row:r[0]},end:{col:0,row:r[1]}})),!1===this.options?.colHighlight||C(this.colHeaderRange,i)||(this.colHeaderRange&&this.table.arrangeCustomCellStyle({range:this.colHeaderRange},void 0),i&&this.table.arrangeCustomCellStyle({range:i},"col-highlight"),this.colHeaderRange=i),!1===this.options?.rowHighlight||C(this.rowHeaderRange,s)||(this.rowHeaderRange&&this.table.arrangeCustomCellStyle({range:this.rowHeaderRange},void 0),s&&this.table.arrangeCustomCellStyle({range:s},"row-highlight"),this.rowHeaderRange=s)}},e.HighlightHeaderWhenSelectCellPlugin=class{id="highlight-header-when-select-cell";name="Highlight Header When Select Cell";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED,r.TABLE_EVENT_TYPE.SELECTED_CLEAR,r.TABLE_EVENT_TYPE.SELECTED_CELL,r.TABLE_EVENT_TYPE.MOUSEMOVE_TABLE];table;pluginOptions;colHeaderRanges=[];rowHeaderRanges=[];constructor(e){this.id=e?.id??this.id,this.pluginOptions=e}run(...e){const t=e[1],n=e[2];this.table=n,t===r.TABLE_EVENT_TYPE.SELECTED_CLEAR?this.clearHighlight():t===r.TABLE_EVENT_TYPE.SELECTED_CELL||t===r.TABLE_EVENT_TYPE.MOUSEMOVE_TABLE?this.updateHighlight():t===r.TABLE_EVENT_TYPE.INITIALIZED&&this.registerStyle()}registerStyle(){this.table.registerCustomCellStyle("col-highlight",{bgColor:this.pluginOptions?.colHighlightBGColor??"#82b2f5",color:this.pluginOptions?.colHighlightColor??"#FFF"}),this.table.registerCustomCellStyle("row-highlight",{bgColor:this.pluginOptions?.rowHighlightBGColor??"#82b2f5",color:this.pluginOptions?.rowHighlightColor??"yellow"})}clearHighlight(){this.colHeaderRanges&&this.colHeaderRanges.forEach((e=>{this.table.arrangeCustomCellStyle({range:e},void 0)})),this.rowHeaderRanges&&this.rowHeaderRanges.forEach((e=>{this.table.arrangeCustomCellStyle({range:e},void 0)})),this.colHeaderRanges=[],this.rowHeaderRanges=[]}updateHighlight(){if(!1===this.pluginOptions?.colHighlight&&!1===this.pluginOptions?.rowHighlight)return;const e=this.table.getSelectedCellRanges();e.length<2&&this.clearHighlight();for(let t=0;t<e.length;t++){const r=e[t],n=[r.start.row,r.end.row];n.sort(((e,t)=>e-t));const i=[r.start.col,r.end.col];let s,o;i.sort(((e,t)=>e-t)),this.table.isPivotTable()?(s={start:{col:i[0],row:0},end:{col:i[1],row:this.table.columnHeaderLevelCount-1}},o={start:{col:0,row:n[0]},end:{col:this.table.rowHeaderLevelCount-1,row:n[1]}}):this.table.internalProps.transpose?o={start:{col:0,row:n[0]},end:{col:this.table.rowHeaderLevelCount-1,row:n[1]}}:(s={start:{col:i[0],row:0},end:{col:i[1],row:this.table.columnHeaderLevelCount-1}},this.table.internalProps.rowSeriesNumber&&(o={start:{col:0,row:n[0]},end:{col:0,row:n[1]}})),!1===this.pluginOptions?.colHighlight||this.colHeaderRanges.find((e=>E(e,s)))||(s&&this.table.arrangeCustomCellStyle({range:s},"col-highlight"),this.colHeaderRanges.push(s)),!1===this.pluginOptions?.rowHighlight||this.rowHeaderRanges.find((e=>E(e,o)))||(o&&this.table.arrangeCustomCellStyle({range:o},"row-highlight"),this.rowHeaderRanges.push(o))}}update(){this.registerStyle(),this.updateHighlight()}release(){this.rowHeaderRanges=[],this.colHeaderRanges=[]}},e.InvertHighlightPlugin=class{table;range;_fill;_opacity;constructor(e,t){this.table=e,this._fill=t?.fill??"#000",this._opacity=t?.opacity??.5}setInvertHighlightRange(e){o(this.range,e)||(this.range=e,e?this.updateCellGroupShadow():this.deleteAllCellGroupShadow(),this.table.scenegraph.updateNextFrame())}deleteAllCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup)}updateCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup,this.range)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.range,this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup,this.range)}updateCellGroupShadowInContainer(e,r){e.forEachChildrenSkipChild((e=>{const n=e;"column"===n.role&&n.forEachChildrenSkipChild((e=>{const n=e;if("cell"!==n.role)return;n.attachShadow(n.shadowRoot);const i=n.shadowRoot;if(r){if(x(r,n.col,n.row))i.removeAllChild();else if(!i.firstChild){const e=t.createRect({x:0,y:0,width:n.attribute.width,height:n.attribute.height,fill:this._fill,opacity:this._opacity});e.name="shadow-rect",i.appendChild(e)}}else i.removeAllChild()}))}))}},e.MENU_CONTAINER_CLASS=T,e.MENU_ITEM_CLASS=R,e.MENU_ITEM_DISABLED_CLASS=k,e.MENU_ITEM_SEPARATOR_CLASS=A,e.MENU_ITEM_SUBMENU_CLASS=M,e.MENU_STYLES=O,e.MasterDetailPlugin=class{id="Master Detail Plugin";name="Master Detail Plugin";runTime=[i.TABLE_EVENT_TYPE.BEFORE_INIT,i.TABLE_EVENT_TYPE.INITIALIZED,i.TABLE_EVENT_TYPE.SORT_CLICK,i.TABLE_EVENT_TYPE.AFTER_SORT,i.TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH,i.TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT];pluginOptions;table;configManager;eventManager;subTableManager;tableAPIExtensions;resizeObserver;checkboxCascadeCleanup;constructor(e={}){this.pluginOptions=e}run(...e){const t=e[0],r=e[1],n=e[2];if(r===i.TABLE_EVENT_TYPE.BEFORE_INIT)this.table=n,this.initializeManagers(),this.configManager.injectMasterDetailOptions(t.options);else if(r===i.TABLE_EVENT_TYPE.INITIALIZED)this.setupMasterDetailFeatures();else{if(r===i.TABLE_EVENT_TYPE.SORT_CLICK)return this.eventManager.executeMasterDetailBeforeSort(),!0;r===i.TABLE_EVENT_TYPE.AFTER_SORT?this.eventManager.executeMasterDetailAfterSort():r===i.TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH?this.eventManager.handleAfterUpdateCellContentWidth(t):r===i.TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT&&this.eventManager.handleAfterUpdateSelectBorderHeight(t)}}initializeManagers(){this.configManager=new _i(this.pluginOptions,this.table),this.eventManager=new xi(this.table);const e=this.pluginOptions.enableCheckboxCascade??!0;this.subTableManager=new Ci(this.table,e),this.configManager.setRowExpandedChecker((e=>this.eventManager.isRowExpanded(e))),this.configManager.setExpandRowCallback((e=>this.expandRow(e))),this.eventManager.setCallbacks({onUpdateSubTablePositions:()=>this.subTableManager.recalculateAllSubTablePositions(),onUpdateSubTablePositionsForRow:()=>this.subTableManager.updateSubTablePositionsForRowResize(),onExpandRow:(e,t)=>this.expandRow(e,t),onCollapseRow:(e,t)=>this.collapseRow(e,t),onCollapseRowToNoRealRecordIndex:e=>this.collapseRowToNoRealRecordIndex(e),onToggleRowExpand:(e,t)=>this.toggleRowExpand(e,t),getOriginalRowHeight:e=>gi(this.table,e)}),this.subTableManager.setCallbacks({getDetailConfigForRecord:(e,t)=>this.configManager.getDetailConfigForRecord(e,t)}),this.subTableManager.setAutoHeightCallback(((e,t)=>{this.handleAutoHeightUpdate(e,t)}))}setupMasterDetailFeatures(){this.initInternalProps(),this.eventManager.bindEventHandlers(),this.setupUnifiedSelectionManagement(),this.extendTableAPI(),this.initCheckboxCascade()}mainTableClickHandler;setupUnifiedSelectionManagement(){this.mainTableClickHandler=()=>{this.clearAllSubTableVisibleSelections()},this.table.on("click_cell",this.mainTableClickHandler)}initCheckboxCascade(){(this.pluginOptions.enableCheckboxCascade??!0)&&(this.checkboxCascadeCleanup=Si(this.table,this.eventManager))}initInternalProps(){const e=mi(this.table);e.expandedRecordIndices=[],e.subTableInstances=new Map,e.originalRowHeights=new Map,e.subTableCheckboxStates=new Map}extendTableAPI(){this.tableAPIExtensions=new Ei(this.table,this.configManager,this.eventManager,{addUnderlineToCell:e=>this.addUnderlineToCell(e),updateOriginalHeightsAfterAdaptive:e=>this.updateOriginalHeightsAfterAdaptive(e),collapseRowToNoRealRecordIndex:e=>this.collapseRowToNoRealRecordIndex(e),expandRow:e=>this.expandRow(e),restoreExpandedStatesAfter:()=>this.restoreExpandedStatesAfter(),collapseRow:e=>this.collapseRow(e),updateSubTablePositions:()=>this.subTableManager.recalculateAllSubTablePositions(),updateRowHeightForExpand:(e,t)=>this.updateRowHeightForExpand(e,t)}),this.tableAPIExtensions.extendTableAPI()}updateOriginalHeightsAfterAdaptive(e){const t=mi(this.table);for(const[r,n]of e){const e=r-this.table.columnHeaderLevelCount;t.originalRowHeights&&t.originalRowHeights.set(e,n.baseHeight)}}restoreExpandedStatesAfter(){const e=mi(this.table);if(!e.expandedRecordIndices||0===e.expandedRecordIndices.length)return;this.table.dataSource._currentPagerIndexedData&&e.expandedRecordIndices.forEach((e=>{try{const t=this.table.getBodyRowIndexByRecordIndex(e);if(t>=0){const e=t+this.table.columnHeaderLevelCount;this.expandRow(e)}}catch(e){}}))}expandRow(e,t){const r=e-this.table.columnHeaderLevelCount,n=mi(this.table);if(this.eventManager.isRowExpanded(e))return;const i=this.table.getRecordIndexByCell(0,e);if(null==i)return;var s,o;n.expandedRecordIndices&&(s=n.expandedRecordIndices,o=i,s.some((e=>di(e,o)))||n.expandedRecordIndices.push(i)),this.eventManager.addExpandedRow(e);const a=this.table.getRowHeight(e);n.originalRowHeights&&(this.table.scenegraph.getCell(t,e),n.originalRowHeights.set(r,a));const l=bi(this.table,r),c=this.configManager.getDetailConfigForRecord(l,r),h=c?.style?.height||300,u=Array.isArray(l.children)?l.children:[],f="auto"===h?300:"number"==typeof h?h:300;this.updateRowHeightForExpand(e,f),this.table.scenegraph.updateContainerHeight(e,f),n._heightResizedRowMap.add(e),this.subTableManager.renderSubTable(r,u,((e,t)=>this.configManager.getDetailConfigForRecord(e,t))),e!==this.table.rowCount-1&&this.drawUnderlineForRow(e),this.refreshRowIcon(e,t),"adaptive"===this.table.heightMode&&this.table.scenegraph.dealHeightMode(),this.updateFrozenColumnShadowHeight()}handleAutoHeightUpdate(e,t){try{const r=e+this.table.columnHeaderLevelCount,n=this.table.getRowHeight(r),i=mi(this.table),s=i.originalRowHeights?.get(e)||0,o=t-(n-s);this.updateRowHeightForExpand(r,o),this.table.scenegraph.updateContainerHeight(r,o)}catch(e){}}collapseRow(e,t){const r=e-this.table.columnHeaderLevelCount,n=mi(this.table);if(!this.eventManager.isRowExpanded(e))return;const i=this.table.getRecordIndexByCell(0,e);if(null==i)return;if(this.subTableManager.removeSubTable(r),n.expandedRecordIndices){const e=(s=n.expandedRecordIndices,o=i,s.findIndex((e=>di(e,o))));e>-1&&n.expandedRecordIndices.splice(e,1)}var s,o;this.eventManager.removeExpandedRow(e);const a=this.table.getRowHeight(e)-gi(this.table,r);this.updateRowHeightForExpand(e,-a),n._heightResizedRowMap.delete(e),this.table.scenegraph.updateContainerHeight(e,-a),n.originalRowHeights&&n.originalRowHeights.delete(r),e!==this.table.rowCount-1&&this.removeUnderlineFromRow(e),this.refreshRowIcon(e,t),"adaptive"===this.table.heightMode&&this.table.scenegraph.dealHeightMode(),this.updateFrozenColumnShadowHeight()}collapseRowToNoRealRecordIndex(e){const t=e-this.table.columnHeaderLevelCount,r=mi(this.table);if(!this.eventManager.isRowExpanded(e))return;this.subTableManager.removeSubTable(t),this.eventManager.removeExpandedRow(e);const n=this.table.getRowHeight(e)-gi(this.table,t);this.updateRowHeightForExpand(e,-n),r._heightResizedRowMap.delete(e),this.table.scenegraph.updateContainerHeight(e,-n),r.originalRowHeights&&r.originalRowHeights.delete(t),e!==this.table.rowCount-1&&this.removeUnderlineFromRow(e),this.refreshRowIcon(e),"adaptive"===this.table.heightMode&&this.table.scenegraph.dealHeightMode(),this.updateFrozenColumnShadowHeight()}toggleRowExpand(e,t){this.eventManager.isRowExpanded(e)?this.collapseRow(e,t):this.expandRow(e,t)}updateRowHeightForExpand(e,t){this.table._setRowHeight(e,this.table.getRowHeight(e)+t,!0);const r=e+1;let n=0;n=e<this.table.frozenRowCount?this.table.frozenRowCount-1:e>=this.table.rowCount-this.table.bottomFrozenRowCount?this.table.rowCount-1:Math.min(this.table.scenegraph.proxy.rowEnd,this.table.rowCount-this.table.bottomFrozenRowCount-1);for(let e=0;e<this.table.colCount;e++)for(let i=r;i<=n;i++){const r=this.table.scenegraph.highPerformanceGetCell(e,i);"cell"===r.role&&r.setAttribute("y",r.attribute.y+t)}}drawUnderlineForRow(e){if(!this.table.scenegraph)return;const t=this.getRowCells(e);0!==t.length&&(t.forEach(((e,t)=>{e&&e.attribute&&this.addUnderlineToCell(e)})),this.table.scenegraph.updateNextFrame())}getRowCells(e){const t=[];for(let r=0;r<this.table.colCount;r++){const n=this.table.scenegraph.getCell(r,e);n&&"cell"===n.role&&t.push(n)}return t}addUnderlineToCell(e){const t=e.attribute,r=t.strokeArrayWidth||(t.lineWidth?[t.lineWidth,t.lineWidth,t.lineWidth,t.lineWidth]:[1,1,1,1]),n=t.strokeArrayColor||(t.stroke?[t.stroke,t.stroke,t.stroke,t.stroke]:["transparent","transparent","transparent","transparent"]);e._hasUnderline||(e._originalStrokeArrayWidth=[...r],e._originalStrokeArrayColor=[...n],e._hasUnderline=!0);const i=e._originalStrokeArrayWidth||r,s=e._originalStrokeArrayColor||n,o=[...i],a=[...s],l=2*(.75*(i[2]||1)+.75*(i[0]||1));if(o[2]=l,"transparent"!==s[2]&&s[2])a[2]=s[2];else{const e=this.table.theme;a[2]=e?.bodyStyle?.borderColor||"#e1e4e8"}e.setAttributes({strokeArrayWidth:o,strokeArrayColor:a,stroke:!0})}removeUnderlineFromRow(e){this.getRowCells(e).forEach(((e,t)=>{e&&e._hasUnderline&&this.removeUnderlineFromCell(e)})),this.table.scenegraph.updateNextFrame()}removeUnderlineFromCell(e){e._hasUnderline&&(e._originalStrokeArrayWidth&&e._originalStrokeArrayColor&&(e.setAttributes({strokeArrayWidth:e._originalStrokeArrayWidth,strokeArrayColor:e._originalStrokeArrayColor}),delete e._originalStrokeArrayWidth,delete e._originalStrokeArrayColor),e._hasUnderline=!1)}refreshRowIcon(e,t){let r;if("number"==typeof t)r=t;else{r=!!this.table.options.rowSeriesNumber?1:0}const n=this.table.getCellOriginRecord(r,e);if(n&&"object"==typeof n){const t=n,s=i.TYPES.HierarchyState,o=this.eventManager.isRowExpanded(e);t.hierarchyState=o?s.expand:s.collapse,this.table.scenegraph.updateHierarchyIcon(r,e)}}setRecordChildren(e,t,r){const n=this.table.getRecordIndexByCell(t,r);if(null==n)return;const i="number"==typeof n?n:n[0],s=this.table.dataSource.get(i);s&&(s.children=e,this.expandRow(r,t),this.table.scenegraph.updateCellContent(t,r))}release(){const e=mi(this.table);e&&(e._isReleasing=!0);try{if(this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0),this.checkboxCascadeCleanup){try{this.checkboxCascadeCleanup()}catch(e){}this.checkboxCascadeCleanup=void 0}if(this.eventManager)try{this.eventManager.cleanup()}catch(e){}if(this.subTableManager)try{this.subTableManager.cleanup()}catch(e){}if(this.configManager)try{this.configManager.release()}catch(e){}if(this.cleanupMasterDetailFeatures(),this.table&&e)try{e.expandedRecordIndices?.splice(0),e.subTableInstances?.clear(),e.originalRowHeights?.clear(),e.subTableCheckboxStates?.clear(),e._heightResizedRowMap?.clear()}catch(e){}}catch(e){}finally{try{this.configManager=null,this.eventManager=null,this.subTableManager=null,this.tableAPIExtensions=null,this.table=null,this.pluginOptions=null}catch(e){}}}clearAllSubTableVisibleSelections(){const e=mi(this.table);e.subTableInstances?.forEach((e=>{e&&"function"==typeof e.clearSelected&&e.clearSelected()}))}getAllSubTableInstances(){return this.subTableManager.getAllSubTableInstances()}getSubTableByRowIndex(e){const t=e-this.table.columnHeaderLevelCount;return this.subTableManager.getSubTableInstance(t)}getSubTableByBodyRowIndex(e){return this.subTableManager.getSubTableInstance(e)}filterSubTables(e){const t=[],r=this.subTableManager.getAllSubTableInstances();if(!r)return t;for(const[n,i]of r)try{e(n,i,bi(this.table,n))&&t.push({bodyRowIndex:n,subTable:i})}catch(e){}return t}updateFrozenColumnShadowHeight(){try{const e=this.table.frozenColCount;e>0&&this.table.scenegraph.component.setFrozenColumnShadow(e-1)}catch(e){}}cleanupMasterDetailFeatures(){this.mainTableClickHandler&&(this.table.off("click_cell",this.mainTableClickHandler),this.mainTableClickHandler=void 0),this.tableAPIExtensions&&(this.tableAPIExtensions.cleanup(),this.tableAPIExtensions=void 0)}},e.MenuManager=P,e.PasteAddRowColumnPlugin=class{id="paste-add-row-column";name="Paste Add row";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED,r.TABLE_EVENT_TYPE.PASTED_DATA];table;pluginOptions;pastedData;constructor(e){this.pluginOptions=e,this.id=e?.id??this.id}run(...e){const t=e[1],n=e[2];this.table=n,t===r.TABLE_EVENT_TYPE.PASTED_DATA&&(this.pastedData=e[0],this.handlePaste())}handlePaste(){const{pasteData:e,row:t,col:r}=this.pastedData,n=this.table.rowCount,i=this.table.colCount,s=t+e.length-n,o=r+(e[0]?.length||0)-i;if(s>0)for(let e=0;e<s;e++)this.pluginOptions?.addRowCallback?this.pluginOptions.addRowCallback(n+e,this.table):this.table.addRecord([]);if(o>0)for(let e=0;e<o;e++){const t=i+e;this.pluginOptions?.addColumnCallback?this.pluginOptions.addColumnCallback(t,this.table):this.table.addColumns([{field:`field_${t}`,title:`New Column ${t}`,width:100}])}this.table.changeCellValues(r,t,e,!0)}release(){this.table.internalProps.handler.clear()}},e.RotateTablePlugin=class{id="rotate-table";name="Rotate Table";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED];table;matrix;vglobal_mapToCanvasPoint;constructor(e){this.id=e?.id??this.id}run(...e){const t=e[2];this.table=t,this.table.rotate90WithTransform=W.bind(this.table),this.table.cancelTransform=$.bind(this.table)}release(){}},e.RowSeriesPlugin=class{id="row-series";name="Row Series";runTime=[r.TABLE_EVENT_TYPE.BEFORE_INIT,r.TABLE_EVENT_TYPE.BEFORE_KEYDOWN];pluginOptions;table;constructor(e){this.id=e.id??this.id,this.pluginOptions=Object.assign({rowCount:100},e)}run(...e){if(e[1]===r.TABLE_EVENT_TYPE.BEFORE_INIT){const t=e[0],r=e[2];this.table=r;const n=t.options,i=n.records??[];for(let e=i.length;e<this.pluginOptions.rowCount;e++)i.push(this.pluginOptions.fillRowRecord?this.pluginOptions.fillRowRecord(e):{});n.records=i,this.pluginOptions.rowSeriesNumber?(n.rowSeriesNumber=this.pluginOptions.rowSeriesNumber,this.pluginOptions.rowSeriesNumber.width||(n.rowSeriesNumber.width="auto")):n.rowSeriesNumber||(n.rowSeriesNumber={width:"auto"})}else if(e[1]===r.TABLE_EVENT_TYPE.BEFORE_KEYDOWN){const t=e[0].event;this.pluginOptions.autoExtendRowTriggerKeys?.includes(t.key)&&this.table.stateManager.select.cellPos.row===this.table.rowCount-1&&this.table.addRecord(this.pluginOptions.fillRowRecord?this.pluginOptions.fillRowRecord(this.table.rowCount-this.table.columnHeaderLevelCount):{})}}},e.TableCarouselAnimationPlugin=class{id="table-carousel-animation";name="Table Carousel Animation";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED];table;rowCount;colCount;animationDuration;animationDelay;animationEasing;playing;row;col;willUpdateRow=!1;willUpdateCol=!1;autoPlay;autoPlayDelay;customDistRowFunction;customDistColFunction;constructor(e={}){this.id=e.id??this.id,this.rowCount=e?.rowCount??void 0,this.colCount=e?.colCount??void 0,this.animationDuration=e?.animationDuration??500,this.animationDelay=e?.animationDelay??1e3,this.animationEasing=e?.animationEasing??"linear",this.autoPlay=e?.autoPlay??!1,this.autoPlayDelay=e?.autoPlayDelay??0,this.customDistColFunction=e.customDistColFunction,this.customDistRowFunction=e.customDistRowFunction}run(...e){this.table||(this.table=e[2]),this.reset(),this.autoPlay&&setTimeout((()=>{this.play()}),this.autoPlayDelay)}reset(){this.playing=!1,this.row=this.table.frozenRowCount,this.col=this.table.frozenColCount}play(){if(!this.table)throw new Error("table is not initialized");this.playing=!0,this.rowCount&&!this.willUpdateRow?this.updateRow():this.colCount&&!this.willUpdateCol&&this.updateCol()}pause(){this.playing=!1}updateRow(){if(!this.playing||this.table.isReleased)return;let e=!0;const t=Math.max(this.table.scenegraph.proxy.screenTopRow,this.table.frozenRowCount),r=this.customDistRowFunction&&this.customDistRowFunction(this.row,this.table);r?(this.row=r.distRow,e=r.animation??!0):V(this.row)&&t!==this.row?(this.row=this.table.frozenRowCount,e=!1):V(this.row)||t===Math.floor(this.row)?this.row+=this.rowCount:(this.row=this.table.frozenRowCount,e=!1),this.table.scrollToRow(this.row,e?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateRow=!0,setTimeout((()=>{this.willUpdateRow=!1,this.updateRow()}),this.animationDuration+this.animationDelay)}updateCol(){if(!this.playing||this.table.isReleased)return;let e=!0;const t=this.customDistColFunction&&this.customDistColFunction(this.col,this.table);t?(this.col=t.distCol,e=t.animation??!0):V(this.col)&&this.table.scenegraph.proxy.screenLeftCol!==this.col?(this.col=this.table.frozenColCount,e=!1):V(this.col)||this.table.scenegraph.proxy.screenLeftCol===Math.floor(this.col)?this.col+=this.colCount:(this.col=this.table.frozenColCount,e=!1),this.table.scrollToCol(this.col,e?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateCol=!0,setTimeout((()=>{this.willUpdateCol=!1,this.updateCol()}),this.animationDuration+this.animationDelay)}release(){}},e.TableExportPlugin=class{id="table-export-plugin";name="TableExport";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED];table;pluginOptions;constructor(e){this.pluginOptions=Object.assign({exportOnIdle:!1,exportExcelOptions:{downloadFile:!0,fileName:"export"},exportCsvOptions:{downloadFile:!0,fileName:"export"}},e)}run(...e){e[1]===r.TABLE_EVENT_TYPE.INITIALIZED&&(e[0],this.table=e[2],this.table.exportToCsv=()=>{const e=this.pluginOptions.exportCsvOptions;return e.downloadFile?async function(e,t){const r=new Blob([`\ufeff${e}`],{type:"text/csv;charset=utf-8"});await ks.saveAs(r,`${t}.csv`)}(_s(this.table,e),e.fileName||"export"):_s(this.table,e)},this.table.exportToExcel=async()=>{const e=this.pluginOptions.exportExcelOptions;return e.downloadFile?await As(await ms(this.table,e,this.pluginOptions.exportOnIdle),e.fileName||"export"):ms(this.table,e,this.pluginOptions.exportOnIdle)},this.table.__vtableSheet&&(this.table.__vtableSheet._exportMutipleTablesToExcel||(this.table.__vtableSheet._exportMutipleTablesToExcel=async e=>{const t=await async function(e,t,r=!1){const n=new Oi.Workbook,i=new Set;for(let s=0;s<e.length;s++){const{table:o,name:a}=e[s],l=gs(a||`sheet${s+1}`,i);i.add(l);const c=n.addWorksheet(l);await bs(o,c,n,t,r)}return await n.xlsx.writeBuffer()}(e,this.pluginOptions.exportExcelOptions);await As(t,this.pluginOptions.exportExcelOptions.fileName||"vtable-sheet-export")})))}release(){this.table&&(delete this.table.exportToCsv,delete this.table.exportToExcel,this.table=null)}},e.TableSeriesNumber=class{id="table-series-number";name="Table Series Number";runTime=[r.TABLE_EVENT_TYPE.INITIALIZED,r.TABLE_EVENT_TYPE.BEFORE_INIT,r.TABLE_EVENT_TYPE.BEFORE_UPDATE_OPTION,r.TABLE_EVENT_TYPE.UPDATED];pluginOptions;table;seriesNumberComponent;componentLayoutLayer;lastCurrentRow=0;lastCurrentCol=0;startRowIndex=0;scrollTimer;constructor(e){this.pluginOptions=e,this.seriesNumberComponent=new t.TableSeriesNumber({rowCount:e.rowCount,colCount:e.colCount,rowSeriesNumberWidth:e.rowSeriesNumberWidth,colSeriesNumberHeight:e.colSeriesNumberHeight,rowSeriesNumberGenerate:e.rowSeriesNumberGenerate,colSeriesNumberGenerate:e.colSeriesNumberGenerate,rowSeriesNumberCellStyle:Object.assign({text:{fontSize:14,fill:"#7A7A7A",pickable:!1,textAlign:"left",textBaseline:"middle",padding:[2,4,2,4]},borderLine:{stroke:"#D9D9D9",lineWidth:1,pickable:!1},bgColor:"#F9F9F9",states:{hover:{fill:"#c8daf6",opacity:.7},select:{fill:"#c8daf6",opacity:1}}},e.rowSeriesNumberCellStyle),colSeriesNumberCellStyle:Object.assign({text:{fontSize:14,fill:"#7A7A7A",pickable:!1,textAlign:"left",textBaseline:"middle",padding:[2,4,2,4]},borderLine:{stroke:"#D9D9D9",lineWidth:1,pickable:!1},bgColor:"#F9F9F9",states:{hover:{fill:"#c8daf6",opacity:.7},select:{fill:"#c8daf6",opacity:1}}},e.colSeriesNumberCellStyle),cornerCellStyle:Object.assign({borderLine:{stroke:"#D9D9D9",lineWidth:1,pickable:!1},bgColor:"#F9F9F9",states:{hover:{fill:"#98C8A5",opacity:.7},select:{fill:"#98C8A5",opacity:1}}},e.cornerCellStyle),checkMoveColumnOrder:e=>!!this.pluginOptions.dragOrder?.enableDragColumnOrder&&this.table.isColumnSelected(e),checkMoveRowOrder:e=>!!this.pluginOptions.dragOrder?.enableDragRowOrder&&this.table.isRowSelected(e)}),this.listenComponentEvents()}run(...e){const t=e[1];if(t===r.TABLE_EVENT_TYPE.BEFORE_INIT||t===r.TABLE_EVENT_TYPE.BEFORE_UPDATE_OPTION){const t=e[0],r=e[2];this.table=r;const n=t.options,i=n.records??[];i.length<this.pluginOptions.rowCount&&(i.length=this.pluginOptions.rowCount),n.records=i,n.columns||(n.columns=[]);for(let e=n.columns.length;e<this.pluginOptions.colCount;e++){const t={field:e,key:e,title:""};n.columns.push(t)}const s=this.seriesNumberComponent.rowSeriesNumberWidth,o=this.seriesNumberComponent.colSeriesNumberHeight;n.contentOffsetX=s,n.contentOffsetY=o}else if(t===r.TABLE_EVENT_TYPE.INITIALIZED||t===r.TABLE_EVENT_TYPE.UPDATED){this.table=e[2],this.table.options.customConfig||(this.table.options.customConfig={}),this.table.options.customConfig.cancelSelectCellHook=e=>!e.target.isDescendantsOf(this.seriesNumberComponent),this.seriesNumberComponent.setAttributes({rowCount:this.table.rowCount,colCount:this.table.colCount,frozenRowCount:this.table.frozenRowCount,frozenColCount:this.table.frozenColCount,rightFrozenColCount:this.table.rightFrozenColCount,bottomFrozenRowCount:this.table.bottomFrozenRowCount});const t=this.table.scenegraph.stage.createLayer();t.appendChild(this.seriesNumberComponent),t.setAttributes({pickable:!1}),this.componentLayoutLayer=t,this.syncRowHeightToComponent(),this.syncColWidthToComponent(),this.listenTableEvents()}}handleScroll=()=>{this.scrollTimer&&(clearTimeout(this.scrollTimer),this.scrollTimer=null),this.scrollTimer=setTimeout((()=>{this.scrollTimer=null,this.syncScrollToComponent()}),10)};handleAfterSort=()=>{this.syncScrollToComponent()};handleSelectedChanged=e=>{this.seriesNumberComponent.removeAllSelectedIndexs();const t=this.table.stateManager.select.ranges,r=[],n=[];for(const e of t){const{row:t,col:i}=e.start,{row:s,col:o}=e.end;r.push({startIndex:Math.min(t,s),endIndex:Math.max(t,s)}),n.push({startIndex:Math.min(i,o),endIndex:Math.max(i,o)})}this.seriesNumberComponent.addRowSelectedRanges(r),this.seriesNumberComponent.addColSelectedRanges(n),this.table.stateManager.select.isSelectAll&&this.seriesNumberComponent.addCornderSelected(),this.seriesNumberComponent.renderSelectedIndexsState()};handleResizeColumnEnd=e=>{this.seriesNumberComponent.setAttribute("hover",!0)};handleResizeRowEnd=e=>{this.seriesNumberComponent.setAttribute("hover",!0)};handleChangeHeaderPosition=e=>{this.syncColWidthToComponent()};listenTableEvents(){this.table.on(r.TABLE_EVENT_TYPE.SCROLL,this.handleScroll),this.table.on(r.TABLE_EVENT_TYPE.AFTER_SORT,this.handleAfterSort),this.table.on(r.TABLE_EVENT_TYPE.SELECTED_CHANGED,this.handleSelectedChanged),this.table.on(r.TABLE_EVENT_TYPE.RESIZE_COLUMN_END,this.handleResizeColumnEnd),this.table.on(r.TABLE_EVENT_TYPE.RESIZE_ROW_END,this.handleResizeRowEnd),this.table.on(r.TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION,this.handleChangeHeaderPosition)}handleSeriesNumberCellRightClick=e=>{const{seriesNumberCell:t,event:n,isDragSelect:i}=e.detail,s=t.name.includes("row"),o=t.name.includes("col");if(s){const e=t.id;this.table.stateManager.select.ranges.some((t=>t.start.row<=e&&e<=t.end.row&&0===t.start.col&&t.end.col===this.table.colCount-1))||this.table.selectCells([{start:{row:e,col:0},end:{row:e,col:this.table.colCount-1}}]),this.table.fireListeners(r.TABLE_EVENT_TYPE.PLUGIN_EVENT,{plugin:this,event:n,pluginEventInfo:{eventType:"rightclick",rowIndex:e}})}else if(o){const e=t.id;this.table.stateManager.select.ranges.some((t=>t.start.col<=e&&e<=t.end.col&&0===t.start.row&&t.end.row===this.table.rowCount-1))||this.table.selectCells([{start:{row:0,col:e},end:{row:this.table.rowCount-1,col:e}}]),this.table.fireListeners(r.TABLE_EVENT_TYPE.PLUGIN_EVENT,{plugin:this,event:n,pluginEventInfo:{eventType:"rightclick",colIndex:e}})}else this.table.selectCells([{start:{row:0,col:0},end:{row:this.table.rowCount-1,col:this.table.colCount-1}}]),this.table.fireListeners(r.TABLE_EVENT_TYPE.PLUGIN_EVENT,{plugin:this,event:n,pluginEventInfo:{eventType:"rightclick",isCorner:!0}})};handleSeriesNumberCellHover=e=>{this.table.scenegraph.renderSceneGraph()};handleSeriesNumberCellUnHover=e=>{this.table.scenegraph.renderSceneGraph()};handleSeriesNumberCellClick=e=>{const{seriesNumberCell:t,event:r,isDragSelect:n}=e.detail,i=this.table.options.keyboardOptions?.ctrlMultiSelect??!0,s=this.table.options.keyboardOptions?.shiftMultiSelect??!0,o=(r.nativeEvent.ctrlKey||r.nativeEvent.metaKey)&&i,a=r.nativeEvent.shiftKey&&s,l=t.name.includes("row"),c=t.name.includes("col");if(l){this.table.stateManager.setSelectInline("row");const e=t.id;n?this.table.dragSelectRow(e,o):this.table.startDragSelectRow(e,o,a)}else if(c){this.table.stateManager.setSelectInline("col");const e=t.id;n?this.table.dragSelectCol(e,o):this.table.startDragSelectCol(e,o,a)}else this.table.eventManager.deelTableSelectAll()};handleSeriesNumberCellClickUp=e=>{this.table.stateManager.setSelectInline(!1),this.table.endDragSelect()};handleRowSeriesNumberWidthChange=e=>{const t=this.seriesNumberComponent.rowSeriesNumberWidth,r=this.seriesNumberComponent.colSeriesNumberHeight;this.table.setContentInsetXY(t,r)};handleResizeColWidthStart=e=>{this.seriesNumberComponent.setAttribute("hover",!1);const{colIndex:t,event:n}=e.detail;this.table.stateManager.updateInteractionState(r.TYPES.InteractionState.grabing),this.table.stateManager.startResizeCol(t,n.viewport.x,n.viewport.y)};handleResizeRowHeightStart=e=>{this.seriesNumberComponent.setAttribute("hover",!1);const{rowIndex:t,event:n}=e.detail;this.table.stateManager.updateInteractionState(r.TYPES.InteractionState.grabing),this.table.stateManager.startResizeRow(t,n.viewport.x,n.viewport.y)};handleDragColumOrderStart=e=>{const{colIndex:t,event:n}=e.detail;this.table.stateManager.updateInteractionState(r.TYPES.InteractionState.grabing),this.table.stateManager.startMoveCol(t,0,n.viewport.x,n.viewport.y,n.nativeEvent,"column")};handleDragRowOrderStart=e=>{const{rowIndex:t,event:n}=e.detail;this.table.stateManager.updateInteractionState(r.TYPES.InteractionState.grabing),this.table.stateManager.startMoveCol(0,t,n.viewport.x,n.viewport.y,n.nativeEvent,"row")};listenComponentEvents(){this.seriesNumberComponent.on(t.SeriesNumberEvent.seriesNumberCellRightClick,this.handleSeriesNumberCellRightClick),this.seriesNumberComponent.on(t.SeriesNumberEvent.seriesNumberCellHover,this.handleSeriesNumberCellHover),this.seriesNumberComponent.on(t.SeriesNumberEvent.seriesNumberCellUnHover,this.handleSeriesNumberCellUnHover),this.seriesNumberComponent.on(t.SeriesNumberEvent.seriesNumberCellClick,this.handleSeriesNumberCellClick),this.seriesNumberComponent.on(t.SeriesNumberEvent.seriesNumberCellClickUp,this.handleSeriesNumberCellClickUp),this.seriesNumberComponent.on(t.SeriesNumberEvent.rowSeriesNumberWidthChange,this.handleRowSeriesNumberWidthChange),this.seriesNumberComponent.on(t.SeriesNumberEvent.resizeColWidthStart,this.handleResizeColWidthStart),this.seriesNumberComponent.on(t.SeriesNumberEvent.resizeRowHeightStart,this.handleResizeRowHeightStart),this.pluginOptions.dragOrder?.enableDragColumnOrder&&this.seriesNumberComponent.on(t.SeriesNumberEvent.dragColumnOrderStart,this.handleDragColumOrderStart),this.pluginOptions.dragOrder?.enableDragRowOrder&&this.seriesNumberComponent.on(t.SeriesNumberEvent.dragRowOrderStart,this.handleDragRowOrderStart)}release(){this.componentLayoutLayer&&(this.table.scenegraph.stage.removeLayer(this.componentLayoutLayer._uid),this.componentLayoutLayer=null),this.scrollTimer&&(clearTimeout(this.scrollTimer),this.scrollTimer=null),this.table&&(this.table.off(r.TABLE_EVENT_TYPE.SCROLL,this.handleScroll),this.table.off(r.TABLE_EVENT_TYPE.AFTER_SORT,this.handleAfterSort),this.table.off(r.TABLE_EVENT_TYPE.SELECTED_CHANGED,this.handleSelectedChanged),this.table.off(r.TABLE_EVENT_TYPE.RESIZE_COLUMN_END,this.handleResizeColumnEnd),this.table.off(r.TABLE_EVENT_TYPE.RESIZE_ROW_END,this.handleResizeRowEnd)),this.seriesNumberComponent&&(this.seriesNumberComponent.off(t.SeriesNumberEvent.seriesNumberCellRightClick,this.handleSeriesNumberCellRightClick),this.seriesNumberComponent.off(t.SeriesNumberEvent.seriesNumberCellHover,this.handleSeriesNumberCellHover),this.seriesNumberComponent.off(t.SeriesNumberEvent.seriesNumberCellUnHover,this.handleSeriesNumberCellUnHover),this.seriesNumberComponent.off(t.SeriesNumberEvent.seriesNumberCellClick,this.handleSeriesNumberCellClick),this.seriesNumberComponent.off(t.SeriesNumberEvent.seriesNumberCellClickUp,this.handleSeriesNumberCellClickUp),this.seriesNumberComponent.off(t.SeriesNumberEvent.rowSeriesNumberWidthChange,this.handleRowSeriesNumberWidthChange),this.seriesNumberComponent.off(t.SeriesNumberEvent.resizeColWidthStart,this.handleResizeColWidthStart),this.seriesNumberComponent.off(t.SeriesNumberEvent.resizeRowHeightStart,this.handleResizeRowHeightStart),this.seriesNumberComponent.release?.(),this.seriesNumberComponent=null)}syncRowHeightToComponent(){if(!this.table.getBodyVisibleRowRange())return;const{rowStart:e,rowEnd:t}=this.table.getBodyVisibleRowRange(),r=Math.max(e-2,this.table.frozenRowCount),n=Math.min(t+2,this.table.rowCount-1);this.table.frozenRowCount!==this.seriesNumberComponent.getAttributes().frozenRowCount&&this.seriesNumberComponent.setAttributes({frozenRowCount:this.table.frozenRowCount}),this.seriesNumberComponent.recreateCellsToRowSeriesNumberGroup(r,n);for(let e=0;e<this.table.frozenRowCount;e++){const t=this.table.scenegraph.getCell(0,e).getAttributes();this.seriesNumberComponent.setRowSeriesNumberCellAttributes(e,{y:t.y,height:t.height})}for(let e=r;e<=n;e++){const t=this.table.scenegraph.getCell(0,e).getAttributes();this.seriesNumberComponent.setRowSeriesNumberCellAttributes(e,{y:t.y,height:t.height})}}syncColWidthToComponent(){if(!this.table.getBodyVisibleColRange())return;const{colStart:e,colEnd:t}=this.table.getBodyVisibleColRange(),r=e,n=Math.min(t,this.table.scenegraph.proxy.colEnd);this.table.frozenColCount!==this.seriesNumberComponent.getAttributes().frozenColCount&&this.seriesNumberComponent.setAttributes({frozenColCount:this.table.frozenColCount}),this.seriesNumberComponent.recreateCellsToColSeriesNumberGroup(r,n);for(let e=0;e<this.table.frozenColCount;e++){const t=this.table.scenegraph.getColGroup(e).getAttributes();this.seriesNumberComponent.setColSeriesNumberCellAttributes(e,{x:t.x,width:t.width})}for(let e=r;e<=n;e++){const t=this.table.scenegraph.getColGroup(e).getAttributes();this.seriesNumberComponent.setColSeriesNumberCellAttributes(e,{x:t.x,width:t.width})}}syncScrollToComponent(){this.syncRowHeightToComponent(),this.syncColWidthToComponent();const e=this.table.scenegraph.bodyGroup.getAttributes().y,t=this.table.scenegraph.bodyGroup.getAttributes().x;this.seriesNumberComponent.setRowSeriesNumberGroupAttributes({y:e+this.seriesNumberComponent.colSeriesNumberHeight}),this.seriesNumberComponent.setColSeriesNumberGroupAttributes({x:t+this.seriesNumberComponent.rowSeriesNumberWidth})}},e.ValueFilter=qi,e.WpsFillHandlePlugin=class{id="wps-fill-handle";name="WPS Fill Handle";runTime=[r.TABLE_EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,r.TABLE_EVENT_TYPE.DRAG_FILL_HANDLE_END];table;pluginOptions;beforeDragMinCol=0;beforeDragMinRow=0;beforeDragMaxCol=0;beforeDragMaxRow=0;constructor(e){this.id=e?.id??this.id,this.pluginOptions=e}run(...e){if(e[1]===r.TABLE_EVENT_TYPE.MOUSEDOWN_FILL_HANDLE){e[0];const t=e[2];this.table=t;const r=this.table?.getSelectedCellRanges()[0];if(!r)return;this.beforeDragMaxCol=Math.max(r.start.col,r.end.col),this.beforeDragMinCol=Math.min(r.start.col,r.end.col),this.beforeDragMaxRow=Math.max(r.start.row,r.end.row),this.beforeDragMinRow=Math.min(r.start.row,r.end.row)}else if(e[1]===r.TABLE_EVENT_TYPE.DRAG_FILL_HANDLE_END){const t=e[0].direction;let r,n;const i=this.table?.getSelectedCellRanges()[0];if(!i)return;"bottom"===t?(r=this.beforeDragMaxCol,n=i.end.row):"right"===t?(r=i.end.col,n=this.beforeDragMaxRow):"top"===t?(r=this.beforeDragMaxCol,n=i.end.row):"left"===t&&(r=i.end.col,n=this.beforeDragMaxRow);const s=this.table?.records,o=this.table?.getAllColumnHeaderCells()||[];let a=[];o?.length&&(a=o[o.length-1]);const l=fi(s,a,{startRow:this.beforeDragMinRow-o.length,startCol:this.beforeDragMinCol,endRow:this.beforeDragMaxRow-o.length,endCol:this.beforeDragMaxCol},{row:n-o.length,col:r});this.table?.setRecords(l)}}handleKeyDown(){if(this.table.editorManager){const e=this.table?.getSelectedCellRanges()[0];if(!e)return;this.beforeDragMaxCol=Math.max(e.start.col,e.end.col),this.beforeDragMinCol=Math.min(e.start.col,e.end.col),this.beforeDragMaxRow=Math.max(e.start.row,e.end.row),this.beforeDragMinRow=Math.min(e.start.row,e.end.row)}}release(){this.beforeDragMinCol=0,this.beforeDragMinRow=0,this.beforeDragMaxCol=0,this.beforeDragMaxRow=0}},e.applyStyles=N,e.cancelTransform=$,e.chnNumberRule=dl,e.chnWeek2Rule=pl,e.chnWeek3Rule=ml,e.createElement=I,e.createFormulaAdapter=Ps,e.createIcon=F,e.createNumberInputItem=function(e,t=1,r,n){const i=I("div");if(N(i,O.inputContainer),r){const e=F(r);i.appendChild(e)}const s=I("label");s.textContent=e,N(s,O.inputLabel),i.appendChild(s);const o=I("input");o.type="number",o.min="1",o.value=t.toString(),N(o,O.inputField),i.appendChild(o);const a=I("div");return a.appendChild(i),a},e.dateRule=cl,e.enhanceCellDataWithFormula=function(e,t,r,n){const i={...e};return n.isFormulaCell(t,r)&&(i.isFormula=!0,i.formula=n.getCellFormula(t,r),i.calculatedValue=n.getCalculatedValue(t,r)),i},e.extendNumberRule=fl,e.formulaRule=yl,e.loopSeriesRule=bl,e.numberRule=hl,e.otherRule=ul,e.reverseIfNeed=gl,e.rotate90WithTransform=W}));