xiaodao-spreader 0.1.35 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ZH.md +87 -2
- package/README.md +87 -2
- package/dist/style.css +1 -1
- package/dist/types/components/spreader/components/data-validation-input-message.vue.d.ts +8 -8
- package/dist/types/components/spreader/components/dropdown.vue.d.ts +4 -1
- package/dist/types/components/spreader/components/pickers/border-picker.vue.d.ts +3 -0
- package/dist/types/components/spreader/components/pickers/calc-picker.vue.d.ts +2 -0
- package/dist/types/components/spreader/components/pickers/color-picker.vue.d.ts +3 -0
- package/dist/types/components/spreader/components/pickers/conditional-format-menu.vue.d.ts +9 -1
- package/dist/types/components/spreader/components/pickers/data-validation-alert.vue.d.ts +2 -2
- package/dist/types/components/spreader/components/pickers/data-validation-dialog.vue.d.ts +4 -4
- package/dist/types/components/spreader/components/pickers/data-validation-dropdown.vue.d.ts +12 -10
- package/dist/types/components/spreader/components/pickers/filter-popup.vue.d.ts +2 -0
- package/dist/types/components/spreader/components/pickers/merge-picker.vue.d.ts +3 -0
- package/dist/types/components/spreader/components/pickers/outline-picker.vue.d.ts +32 -0
- package/dist/types/components/spreader/components/pickers/sort-picker.vue.d.ts +3 -0
- package/dist/types/components/spreader/components/spreader.vue.d.ts +43 -0
- package/dist/types/components/spreader/components/tabbar.vue.d.ts +2 -0
- package/dist/types/components/spreader/components/toolbar.vue.d.ts +29 -0
- package/dist/types/components/spreader/composables/core-state.d.ts +41 -1
- package/dist/types/components/spreader/composables/interactions.d.ts +10 -0
- package/dist/types/components/spreader/composables/useFloatMenuPosition.d.ts +39 -0
- package/dist/types/components/spreader/core/autofill.d.ts +11 -2
- package/dist/types/components/spreader/core/constants.d.ts +2 -0
- package/dist/types/components/spreader/core/outline-core.d.ts +64 -0
- package/dist/types/components/spreader/core/types.d.ts +24 -0
- package/dist/types/components/spreader/core/utils.d.ts +20 -0
- package/dist/xiaodao-spreader.es.js +8597 -7810
- package/dist/xiaodao-spreader.umd.js +9 -9
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(Ql,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(Ql=typeof globalThis<"u"?globalThis:Ql||self,t(Ql.XiaoDaoSpreader={},Ql.Vue))})(this,function(Ql,t){"use strict";const oa={"zh-CN":{insert:"插入",delete:"删除",rename:"重命名",moveLeft:"左移",moveRight:"右移",cut:"剪切",copy:"复制",paste:"粘贴",addSheet:"新建工作表",sheetList:"工作表列表",moveSheetLeft:"左移",moveSheetRight:"右移",scrollUp:"向上滚动",scrollDown:"向下滚动",scrollLeft:"向左滚动",scrollRight:"向右滚动",calculate:"计算",sum:"求和",avg:"平均值",count:"计数",undo:"撤销",redo:"重做",paintFormat:"格式刷",clearFormat:"清除格式",fontFamily:"字体",fontSize:"字号",fontSizeIncrease:"增大字号",fontSizeDecrease:"减小字号",bold:"加粗",italic:"斜体",underline:"下划线",strikethrough:"删除线",fontColor:"文字颜色",fillColor:"填充颜色",borders:"边框",hAlign:"水平对齐",vAlign:"垂直对齐",alignLeft:"左端对齐",alignCenter:"居中对齐",alignRight:"右端对齐",alignTop:"顶端对齐",alignMiddle:"垂直居中",alignBottom:"底端对齐",wrap:"自动换行",mergeCells:"合并单元格",mergeCenter:"合并后居中",mergeAcross:"跨越合并",unmergeCells:"取消合并单元格",borderBottom:"下框线",borderTop:"上框线",borderLeft:"左框线",borderRight:"右框线",borderNone:"无框线",borderAll:"所有框线",borderOuter:"外框线",borderThickOuter:"粗外框线",fontDefault:"默认",rowHeight:"行高",colWidth:"列宽",autoRowHeight:"自动行高",defaultColWidth:"默认列宽",sort:"排序",sortAsc:"升序排序",sortDesc:"降序排序",sortReminderTitle:"排序提醒",sortReminderMessage:"选定区域的左侧或右侧还有相邻数据,这些数据未被选中,将不参与排序。是否将其一并纳入排序?",sortExpandSelection:"扩展选定区域",sortCurrentSelection:"仅对选定区域排序",insertFunctionTitle:"插入函数",insertFunctionSelectLabel:"函数",insertFunctionPlaceholder:"请选择函数",insertFunctionSearchPlaceholder:"搜索函数",insertFunctionFormulaLabel:"公式",insertFunctionBtn:"插入",fnDescSum:"计算单元格区域中所有数值的和",fnDescAverage:"计算单元格区域中数值的算术平均值",fnDescCount:"统计单元格区域中包含数值的单元格个数",fnDescIf:"根据指定条件判断真假,返回对应的两个值之一",fnDescVlookup:"在区域首列查找指定值,返回同一行中指定列的值",fnDescConcatenate:"将多个文本连接合并为一个文本",fnDescMax:"返回单元格区域中所有数值的最大值",fnDescMin:"返回单元格区域中所有数值的最小值",fnDescSin:"返回给定角度(弧度)的正弦值",fnDescSumif:"对区域中满足指定条件的单元格对应的数值求和",fnDescPmt:"计算基于固定利率及等额分期付款的贷款每期还款额",fnDescStdev:"估算基于样本的标准偏差(忽略文本与逻辑值)",ok:"确定",cancel:"取消",dimNumberError:"请输入数字",dimRangeError:"请输入 {min}~{max} 之间的数值",colorAutomatic:"自动",colorNoFill:"无填充",colorWhite:"白色",colorBlack:"黑色",colorLightGray:"浅灰",colorLightBlue:"浅蓝",colorLightOrange:"浅橙",colorLightYellow:"浅黄",colorLightGreen:"浅绿",colorPaleBlue:"淡蓝",colorPaleOrange:"淡橙",colorPaleYellow:"淡黄",colorPaleGreen:"淡绿",colorSilver:"银色",colorSkyBlue:"天蓝",colorCoral:"珊瑚",colorGold:"金色",colorMint:"薄荷",colorGray:"灰色",colorMediumBlue:"中蓝",colorOrange:"橙色",colorAmber:"琥珀",colorMediumGreen:"中绿",colorDarkGray:"深灰",colorRoyalBlue:"宝蓝",colorRed:"红色",colorDarkGold:"深金",colorDarkGreen:"深绿",colorCharcoal:"炭灰",colorDeepBlue:"深蓝",colorDarkRed:"深红",colorOlive:"橄榄",colorForest:"森林",colorSlate:"石板灰",colorNavy:"藏青",colorCrimson:"绯红",colorDarkOlive:"深橄榄",colorDeepForest:"深林",colorDarkSlate:"深石板灰",colorMidnight:"午夜蓝",colorMaroon:"栗色",colorCoffee:"咖啡色",colorEvergreen:"常青",colorDarkNavy:"深藏青",colorDarkMaroon:"深栗",colorDarkCoffee:"深咖",colorInkGreen:"墨绿",numberFormat:"数字格式",nfGeneral:"常规",nfText:"文本",nfNumber:"数字",nfPercent:"百分比",nfScientific:"科学计数法",nfAccounting:"会计专用",nfFinancial:"财务数值",nfCurrency:"货币",nfCurrencyRounded:"货币取整",nfDate:"日期",nfTime:"时间",nfDateTime:"日期和时间",nfDuration:"持续时间",nfCustom:"其他数字格式…",nfMixed:"混合",nfIncreaseDecimals:"增加小数位数",nfDecreaseDecimals:"减少小数位数",nfDialogTitle:"设置单元格格式",nfCategory:"分类",nfCatCustom:"自定义",nfDecimals:"小数位数",nfThousands:"使用千位分隔符",nfSymbol:"货币符号",nfDateFormat:"日期格式",nfTimeFormat:"时间格式",nfCustomCode:"自定义格式代码",nfPreview:"预览",nfPreviewSample:"示例",find:"查找",findReplace:"查找和替换",findPlaceholder:"查找内容",replacePlaceholder:"替换为",findPrev:"上一个",findNext:"下一个",replace:"替换",replaceAll:"全部替换",findScope:"范围",findOptions:"查找选项",scopeSheet:"当前工作表",scopeWorkbook:"整个工作簿",scopeSelection:"当前选区",matchCase:"区分大小写",matchEntireCell:"完整匹配",findNoResult:"未找到",findNeedSelection:"请先选择范围",findReplacedAll:"已替换 {n} 处",findClose:"关闭",freezePane:"冻结窗格",freezePanes:"冻结窗格",freezeFirstRow:"冻结首行",freezeFirstCol:"冻结首列",unfreezePanes:"取消冻结",freezeToRow:"冻结至此行",freezeToCol:"冻结至此列",filter:"筛选",clearFilter:"清除筛选",cancelFilter:"取消",filterSearchPlaceholder:"搜索",filterSelectAll:"全选",filterClearAll:"清除全部",filterOk:"确定",filterBlank:"空白",filterNonBlank:"非空白",filterText:"文本筛选",filterNumber:"数字筛选",filterDate:"日期筛选",filterEquals:"等于",filterNotEquals:"不等于",filterContains:"包含",filterNotContains:"不包含",filterStartsWith:"开头是",filterEndsWith:"结尾是",filterGreaterThan:"大于",filterGreaterThanOrEqual:"大于等于",filterLessThan:"小于",filterLessThanOrEqual:"小于等于",filterBetween:"介于",filterAnd:"与",filterCustom:"自定义筛选",filterNoData:"无数据",filterFilteredCount:"共 {n} 项",filterActive:"筛选中",filterByValue:"按此值筛选",filterByThisColumn:"筛选此列",conditionalFormat:"条件格式",cfHighlightRules:"突出显示单元格规则",cfGreaterThan:"大于",cfGreaterThanOrEqual:"大于等于",cfLessThan:"小于",cfLessThanOrEqual:"小于等于",cfBetween:"介于",cfNotBetween:"不介于",cfEqual:"等于",cfCellIs:"单元格值",cfNotEqual:"不等于",cfTextContains:"文本包含",cfTextNotContains:"文本不包含",cfBlank:"空白",cfNotBlank:"非空白",cfDuplicate:"重复值",cfUnique:"唯一值",cfFormulaShort:"公式",cfFormula:"使用公式确定要设置格式的单元格",cfFormulaExample:"例如 =$A1>100",cfNewRule:"新建规则",cfManageRules:"管理规则",cfClearRules:"清除规则",cfClearSelected:"清除所选单元格的规则",cfClearSheet:"清除整个工作表的规则",cfAppliedTo:"应用于",cfRule:"规则",cfFormat:"格式",cfPriority:"优先级",cfStopIfTrue:"停止如果为真",cfEnabled:"启用",cfDelete:"删除",cfEdit:"编辑",cfMoveUp:"上移",cfMoveDown:"下移",cfType:"类型",cfOperator:"条件",cfValue:"值",cfValue2:"到",cfManagerTitle:"条件格式规则管理器",cfPreview:"预览",cfNoRules:"当前工作表没有条件格式规则",cfRuleTypeGeneric:"自定义规则",cfBold:"加粗",cfItalic:"斜体",cfUnderline:"下划线",cfFontColor:"字体颜色",cfFillColor:"填充颜色",dv:"数据验证",dvDialogTitle:"数据验证",dvSettings:"设置",dvInputMessageTab:"输入信息",dvErrorAlertTab:"出错警告",dvAllow:"允许",dvData:"数据",dvSource:"来源",dvMin:"最小值",dvMax:"最大值",dvValue:"值",dvFormula:"公式",dvOperator:"条件",dvApplyTo:"应用于",dvShowDropdown:"提供下拉箭头",dvIgnoreBlank:"忽略空值",dvShowInputMessage:"选定单元格时显示输入信息",dvInputTitle:"标题",dvInputMessage:"输入信息",dvShowErrorAlert:"输入无效数据时显示出错警告",dvErrorStyle:"样式",dvErrorTitle:"标题",dvErrorMessage:"错误信息",dvClearAll:"全部清除",dvTypeAny:"任何值",dvTypeList:"列表",dvTypeWholeNumber:"整数",dvTypeDecimal:"小数",dvTypeDate:"日期",dvTypeTime:"时间",dvTypeTextLength:"文本长度",dvTypeCustom:"自定义",dvBetween:"介于",dvNotBetween:"不介于",dvEqual:"等于",dvNotEqual:"不等于",dvGreaterThan:"大于",dvGreaterThanOrEqual:"大于等于",dvLessThan:"小于",dvLessThanOrEqual:"小于等于",dvStyleStop:"停止",dvStyleWarning:"警告",dvStyleInformation:"信息",dvErrorTitleDefault:"输入无效",dvMsgList:"请从下拉列表中选择:{values}",dvMsgListEmpty:"请从下拉列表中选择一个有效值",dvMsgBetween:"{type}必须介于 {min} 与 {max} 之间",dvMsgNotBetween:"{type}不能介于 {min} 与 {max} 之间",dvMsgCompare:"{type}必须{op} {value}",dvMsgCustom:"输入不满足条件:{formula}",dvMsgInvalid:"输入的值不符合该单元格的数据验证规则",dvStopDialogTitle:"输入无效",dvWarningDialogTitle:"输入可能无效",dvInformationDialogTitle:"输入提示",dvBtnRetry:"重试",dvBtnContinue:"是",dvBtnNo:"否",dvBtnOk:"确定",dvRangeInvalid:"范围格式无效,例如 A1:B10 或 A2:A100,C2:C100",dvSourceInvalid:"来源不能为空",dvFormulaRequired:"请输入公式",dvValueRequired:"请输入比较值",dvMinRequired:"请输入最小值",dvMaxRequired:"请输入最大值",dvMustBeInteger:"必须为整数",dvMustBeNumber:"必须为数字",dvDateInvalid:"日期格式无效",dvTimeInvalid:"时间格式无效",dvSearchPlaceholder:"搜索",dvNoMatch:"无匹配项",dvClearValidation:"清除数据验证",dvSourceHint:"直接输入逗号分隔的值,或引用区域(如 A1:A10、Sheet2!A1:A10)"},"en-US":{insert:"Insert",delete:"Delete",rename:"Rename",moveLeft:"Move Left",moveRight:"Move Right",cut:"Cut",copy:"Copy",paste:"Paste",addSheet:"Add new sheet",sheetList:"Sheet list",moveSheetLeft:"Move Left",moveSheetRight:"Move Right",scrollUp:"Scroll up",scrollDown:"Scroll down",scrollLeft:"Scroll left",scrollRight:"Scroll right",calculate:"Calculate",sum:"Sum",avg:"Average",count:"Count",undo:"Undo",redo:"Redo",paintFormat:"Paint Format",clearFormat:"Clear Format",fontFamily:"Font Family",fontSize:"Font Size",fontSizeIncrease:"Increase Font Size",fontSizeDecrease:"Decrease Font Size",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",fontColor:"Font Color",fillColor:"Fill Color",borders:"Borders",hAlign:"Horizontal Align",vAlign:"Vertical Align",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignTop:"Align Top",alignMiddle:"Align Middle",alignBottom:"Align Bottom",wrap:"Wrap Text",mergeCells:"Merge Cells",mergeCenter:"Merge & Center",mergeAcross:"Merge Across",unmergeCells:"Unmerge Cells",borderBottom:"Bottom Border",borderTop:"Top Border",borderLeft:"Left Border",borderRight:"Right Border",borderNone:"No Border",borderAll:"All Borders",borderOuter:"Outside Borders",borderThickOuter:"Thick Box Border",fontDefault:"Default",rowHeight:"Row Height",colWidth:"Column Width",autoRowHeight:"Auto Row Height",defaultColWidth:"Default Column Width",sort:"Sort",sortAsc:"Sort Ascending",sortDesc:"Sort Descending",sortReminderTitle:"Sort Warning",sortReminderMessage:"There is adjacent data to the left or right of your selection. It is not selected and will not be sorted. Include it in the sort?",sortExpandSelection:"Expand the selection",sortCurrentSelection:"Sort the current selection only",insertFunctionTitle:"Insert Function",insertFunctionSelectLabel:"Function",insertFunctionPlaceholder:"Select a function",insertFunctionSearchPlaceholder:"Search a function",insertFunctionFormulaLabel:"Formula",insertFunctionBtn:"Insert",fnDescSum:"Adds all the numbers in a range of cells",fnDescAverage:"Returns the arithmetic mean of the numbers in a range",fnDescCount:"Counts the cells that contain numbers in a range",fnDescIf:"Checks a condition and returns one of two values",fnDescVlookup:"Looks up a value in the first column of a range and returns a value in the same row",fnDescConcatenate:"Joins several text strings into one text string",fnDescMax:"Returns the largest numeric value in a range of cells",fnDescMin:"Returns the smallest numeric value in a range of cells",fnDescSin:"Returns the sine of a given angle (in radians)",fnDescSumif:"Sums the values in a range that meet a specified condition",fnDescPmt:"Calculates the periodic payment for a loan with constant payments and interest",fnDescStdev:"Estimates the sample standard deviation of a supplied set of values",ok:"OK",cancel:"Cancel",dimNumberError:"Please enter a number",dimRangeError:"Please enter a value between {min} and {max}",colorAutomatic:"Automatic",colorNoFill:"No Fill",colorWhite:"White",colorBlack:"Black",colorLightGray:"Light Gray",colorLightBlue:"Light Blue",colorLightOrange:"Light Orange",colorLightYellow:"Light Yellow",colorLightGreen:"Light Green",colorPaleBlue:"Pale Blue",colorPaleOrange:"Pale Orange",colorPaleYellow:"Pale Yellow",colorPaleGreen:"Pale Green",colorSilver:"Silver",colorSkyBlue:"Sky Blue",colorCoral:"Coral",colorGold:"Gold",colorMint:"Mint",colorGray:"Gray",colorMediumBlue:"Medium Blue",colorOrange:"Orange",colorAmber:"Amber",colorMediumGreen:"Medium Green",colorDarkGray:"Dark Gray",colorRoyalBlue:"Royal Blue",colorRed:"Red",colorDarkGold:"Dark Gold",colorDarkGreen:"Dark Green",colorCharcoal:"Charcoal",colorDeepBlue:"Deep Blue",colorDarkRed:"Dark Red",colorOlive:"Olive",colorForest:"Forest",colorSlate:"Slate",colorNavy:"Navy",colorCrimson:"Crimson",colorDarkOlive:"Dark Olive",colorDeepForest:"Deep Forest",colorDarkSlate:"Dark Slate",colorMidnight:"Midnight",colorMaroon:"Maroon",colorCoffee:"Coffee",colorEvergreen:"Evergreen",colorDarkNavy:"Dark Navy",colorDarkMaroon:"Dark Maroon",colorDarkCoffee:"Dark Coffee",colorInkGreen:"Ink Green",numberFormat:"Number Format",nfGeneral:"General",nfText:"Text",nfNumber:"Number",nfPercent:"Percentage",nfScientific:"Scientific",nfAccounting:"Accounting",nfFinancial:"Financial",nfCurrency:"Currency",nfCurrencyRounded:"Currency Rounded",nfDate:"Date",nfTime:"Time",nfDateTime:"Date & Time",nfDuration:"Duration",nfCustom:"Other Number Formats…",nfMixed:"Mixed",nfIncreaseDecimals:"Increase Decimal",nfDecreaseDecimals:"Decrease Decimal",nfDialogTitle:"Format Cells",nfCategory:"Category",nfCatCustom:"Custom",nfDecimals:"Decimal places",nfThousands:"Use 1000 separator",nfSymbol:"Currency symbol",nfDateFormat:"Date format",nfTimeFormat:"Time format",nfCustomCode:"Custom format code",nfPreview:"Preview",nfPreviewSample:"Sample",find:"Find",findReplace:"Find & Replace",findPlaceholder:"Find what",replacePlaceholder:"Replace with",findPrev:"Previous",findNext:"Next",replace:"Replace",replaceAll:"Replace All",findScope:"Scope",findOptions:"Find options",scopeSheet:"Current sheet",scopeWorkbook:"Entire workbook",scopeSelection:"Current selection",matchCase:"Match case",matchEntireCell:"Match entire cell",findNoResult:"No results",findNeedSelection:"Select a range first",findReplacedAll:"Replaced {n} occurrence(s)",findClose:"Close",freezePane:"Freeze Panes",freezePanes:"Freeze Panes",freezeFirstRow:"Freeze First Row",freezeFirstCol:"Freeze First Column",unfreezePanes:"Unfreeze Panes",freezeToRow:"Freeze to Row",freezeToCol:"Freeze to Column",filter:"Filter",clearFilter:"Clear Filter",cancelFilter:"Cancel",filterSearchPlaceholder:"Search",filterSelectAll:"Select All",filterClearAll:"Clear All",filterOk:"OK",filterBlank:"Blanks",filterNonBlank:"Non-blanks",filterText:"Text Filters",filterNumber:"Number Filters",filterDate:"Date Filters",filterEquals:"Equals",filterNotEquals:"Does Not Equal",filterContains:"Contains",filterNotContains:"Does Not Contain",filterStartsWith:"Begins With",filterEndsWith:"Ends With",filterGreaterThan:"Greater Than",filterGreaterThanOrEqual:"Greater Than Or Equal To",filterLessThan:"Less Than",filterLessThanOrEqual:"Less Than Or Equal To",filterBetween:"Between",filterAnd:"And",filterCustom:"Custom Filter",filterNoData:"No data",filterFilteredCount:"{n} items",filterActive:"Filtering",filterByValue:"Filter by This Value",filterByThisColumn:"Filter This Column",conditionalFormat:"Conditional Formatting",cfHighlightRules:"Highlight Cell Rules",cfGreaterThan:"Greater Than",cfGreaterThanOrEqual:"Greater Than Or Equal To",cfLessThan:"Less Than",cfLessThanOrEqual:"Less Than Or Equal To",cfBetween:"Between",cfNotBetween:"Not Between",cfEqual:"Equal To",cfCellIs:"Cell Value",cfNotEqual:"Not Equal To",cfTextContains:"Text Contains",cfTextNotContains:"Text Does Not Contain",cfBlank:"Blanks",cfNotBlank:"Non-blanks",cfDuplicate:"Duplicate Values",cfUnique:"Unique Values",cfFormulaShort:"Formula",cfFormula:"Use a formula to determine which cells to format",cfFormulaExample:"e.g. =$A1>100",cfNewRule:"New Rule",cfManageRules:"Manage Rules",cfClearRules:"Clear Rules",cfClearSelected:"Clear Rules from Selected Cells",cfClearSheet:"Clear Rules from Entire Sheet",cfAppliedTo:"Applies to",cfRule:"Rule",cfFormat:"Format",cfPriority:"Priority",cfStopIfTrue:"Stop If True",cfEnabled:"Enabled",cfDelete:"Delete",cfEdit:"Edit",cfMoveUp:"Move Up",cfMoveDown:"Move Down",cfType:"Type",cfOperator:"When",cfValue:"Value",cfValue2:"To",cfManagerTitle:"Conditional Formatting Rules Manager",cfPreview:"Preview",cfNoRules:"No conditional formatting rules on this sheet",cfRuleTypeGeneric:"Custom Rule",cfBold:"Bold",cfItalic:"Italic",cfUnderline:"Underline",cfFontColor:"Font Color",cfFillColor:"Fill Color",dv:"Data Validation",dvDialogTitle:"Data Validation",dvSettings:"Settings",dvInputMessageTab:"Input Message",dvErrorAlertTab:"Error Alert",dvAllow:"Allow",dvData:"Data",dvSource:"Source",dvMin:"Minimum",dvMax:"Maximum",dvValue:"Value",dvFormula:"Formula",dvOperator:"Operator",dvApplyTo:"Apply to",dvShowDropdown:"In-cell dropdown",dvIgnoreBlank:"Ignore blank",dvShowInputMessage:"Show input message when cell is selected",dvInputTitle:"Title",dvInputMessage:"Input message",dvShowErrorAlert:"Show error alert after invalid data is entered",dvErrorStyle:"Style",dvErrorTitle:"Title",dvErrorMessage:"Error message",dvClearAll:"Clear All",dvTypeAny:"Any value",dvTypeList:"List",dvTypeWholeNumber:"Whole Number",dvTypeDecimal:"Decimal",dvTypeDate:"Date",dvTypeTime:"Time",dvTypeTextLength:"Text Length",dvTypeCustom:"Custom",dvBetween:"between",dvNotBetween:"not between",dvEqual:"equal to",dvNotEqual:"not equal to",dvGreaterThan:"greater than",dvGreaterThanOrEqual:"greater than or equal to",dvLessThan:"less than",dvLessThanOrEqual:"less than or equal to",dvStyleStop:"Stop",dvStyleWarning:"Warning",dvStyleInformation:"Information",dvErrorTitleDefault:"Invalid Input",dvMsgList:"Please select a value from the dropdown list: {values}",dvMsgListEmpty:"Please select a valid value from the dropdown list",dvMsgBetween:"{type} must be between {min} and {max}",dvMsgNotBetween:"{type} must not be between {min} and {max}",dvMsgCompare:"{type} must be {op} {value}",dvMsgCustom:"The input does not satisfy: {formula}",dvMsgInvalid:"The value does not match the data validation rules for this cell",dvStopDialogTitle:"Invalid Input",dvWarningDialogTitle:"Possible Invalid Input",dvInformationDialogTitle:"Input Notice",dvBtnRetry:"Retry",dvBtnContinue:"Yes",dvBtnNo:"No",dvBtnOk:"OK",dvRangeInvalid:"Invalid range, e.g. A1:B10 or A2:A100,C2:C100",dvSourceInvalid:"Source cannot be empty",dvFormulaRequired:"Please enter a formula",dvValueRequired:"Please enter a comparison value",dvMinRequired:"Please enter the minimum value",dvMaxRequired:"Please enter the maximum value",dvMustBeInteger:"Must be an integer",dvMustBeNumber:"Must be a number",dvDateInvalid:"Invalid date format",dvTimeInvalid:"Invalid time format",dvSearchPlaceholder:"Search",dvNoMatch:"No matches",dvClearValidation:"Clear Validation",dvSourceHint:"Enter comma separated values, or reference a range (e.g. A1:A10, Sheet2!A1:A10)"}};function b(e,n){var l;return((l=oa[e])==null?void 0:l[n])??n}const pn='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',zl=10,ra=[{label:"",value:""},{label:"微软雅黑",value:'"Microsoft YaHei", "微软雅黑", sans-serif'},{label:"宋体",value:'"SimSun", "宋体", serif'},{label:"黑体",value:'"SimHei", "黑体", sans-serif'},{label:"楷体",value:'"KaiTi", "楷体", serif'},{label:"Arial",value:"Arial, sans-serif"},{label:"Arial Black",value:'"Arial Black", sans-serif'},{label:"Times New Roman",value:'"Times New Roman", serif'},{label:"Courier New",value:'"Courier New", monospace'},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Impact",value:"Impact, sans-serif"},{label:"Tahoma",value:"Tahoma, sans-serif"},{label:"Trebuchet MS",value:'"Trebuchet MS", sans-serif'},{label:"Comic Sans MS",value:'"Comic Sans MS", cursive'}],aa=[{label:"9",value:9},{label:"10",value:10},{label:"11",value:11},{label:"12",value:12},{label:"13",value:13},{label:"14",value:14},{label:"16",value:16},{label:"18",value:18},{label:"20",value:20},{label:"24",value:24},{label:"28",value:28},{label:"32",value:32},{label:"36",value:36},{label:"48",value:48},{label:"72",value:72}],ia='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="19" y2="6"/><line x1="3" y1="12" x2="15" y2="12"/><line x1="3" y1="18" x2="17" y2="18"/></svg>',sa='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="6" y1="12" x2="18" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>',ca='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="5" y1="6" x2="21" y2="6"/><line x1="9" y1="12" x2="21" y2="12"/><line x1="7" y1="18" x2="21" y2="18"/></svg>',da='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="7" x2="6" y2="20"/><line x1="12" y1="7" x2="12" y2="16"/><line x1="18" y1="7" x2="18" y2="20"/><line x1="4" y1="3" x2="20" y2="3"/></svg>',ua='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="4" x2="6" y2="20"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="18" y1="4" x2="18" y2="20"/></svg>',fa='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="4" x2="6" y2="17"/><line x1="12" y1="8" x2="12" y2="17"/><line x1="18" y1="4" x2="18" y2="17"/><line x1="4" y1="21" x2="20" y2="21"/></svg>',ma=[{value:"left",labelKey:"alignLeft",icon:ia},{value:"center",labelKey:"alignCenter",icon:sa},{value:"right",labelKey:"alignRight",icon:ca}],pa=[{value:"top",labelKey:"alignTop",icon:da},{value:"middle",labelKey:"alignMiddle",icon:ua},{value:"bottom",labelKey:"alignBottom",icon:fa}],ha=[{key:"mergeCenter",labelKey:"mergeCenter",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M709.952 465.92l88-76.032C801.92 385.984 806.656 384 812.032 384s10.048 1.984 14.08 5.952C830.08 393.92 832 398.656 832 403.968L832 448l32 0C881.664 448 896 462.336 896 480S881.664 512 864 512L832 512l0 44.032c0 5.376-1.92 10.112-5.952 14.08C822.08 574.08 817.344 576 812.032 576s-10.048-1.92-14.08-5.952L709.952 494.08C705.984 490.112 704 485.376 704 480S705.984 469.952 709.952 465.92zM378.048 465.92 290.048 389.952C286.08 385.984 281.344 384 275.968 384s-10.048 1.984-14.08 5.952C257.92 393.92 256 398.656 256 403.968L256 448 224 448C206.336 448 192 462.336 192 480S206.336 512 224 512L256 512l0 44.032c0 5.376 1.92 10.112 5.952 14.08C265.92 574.08 270.656 576 275.968 576s10.048-1.92 14.08-5.952L378.048 494.08C382.016 490.112 384 485.376 384 480S382.016 469.952 378.048 465.92zM448 128 128 128l0 704 320 0 0-128 64 0 0 128c0 35.392-28.608 64-64 64L128 896c-35.392 0-64-28.608-64-64L64 128c0-35.392 28.608-64 64-64l320 0 0 0c35.392 0 64 28.608 64 64l0 128L448 256 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128M722.304 642.304c0 8.512-3.52 16.32-10.496 23.36s-15.424 10.624-25.344 10.624c-5.76 0-10.688-1.088-14.72-3.136-4.096-2.048-7.616-4.928-10.432-8.512s-5.824-9.088-9.024-16.512-5.952-13.952-8.32-19.648l-17.28-46.016L479.36 582.464 462.08 629.568c-6.72 18.304-12.48 30.656-17.344 37.12s-12.544 9.6-23.424 9.6c-9.28 0-17.408-3.456-24.512-10.24s-10.624-14.592-10.624-23.232c0-4.992 0.896-10.176 2.496-15.488S393.024 614.592 396.8 605.056l92.672-238.016C492.096 360.256 495.296 352 499.008 342.464s7.68-17.536 11.904-23.872 9.664-11.456 16.576-15.36c6.784-3.968 15.232-5.888 25.344-5.888 10.176 0 18.752 1.92 25.472 5.888 6.848 3.968 12.352 8.96 16.64 15.104 4.096 6.208 7.744 12.8 10.624 19.904s6.528 16.576 11.008 28.352l94.656 236.48C718.592 621.056 722.304 634.112 722.304 642.304zM606.912 526.784 552.32 375.552 498.624 526.784 606.912 526.784z"/></svg>'},{key:"mergeAcross",labelKey:"mergeAcross",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M832 64c70.4 0 128 57.6 128 128v640c0 70.4-57.6 128-128 128H192c-70.4 0-128-57.6-128-128V192c0-70.4 57.6-128 128-128h640zM448 768H128v64c0 38.4 25.6 64 64 64h256v-128z m448 0H512v128h320c38.4 0 64-25.6 64-64v-64z m0-448H128v384h768V320zM633.6 390.4l96 96c6.4 6.4 6.4 12.8 6.4 19.2 0 6.4-6.4 12.8-6.4 19.2L633.6 633.6c-12.8 12.8-32 12.8-44.8 0-12.8-12.8-12.8-32-6.4-44.8l44.8-44.8H288c-19.2 0-32-12.8-32-32s12.8-32 32-32h339.2l-44.8-44.8c-6.4-12.8-6.4-32 0-44.8 12.8-12.8 38.4-12.8 51.2 0zM448 128H192c-38.4 0-64 25.6-64 64v64h320V128z m384 0H512v128h384V192c0-38.4-25.6-64-64-64z"/></svg>'},{key:"mergeCells",labelKey:"mergeCells",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M512 480c0 5.376-1.984 10.112-5.952 14.08L354.048 634.048C350.08 638.08 345.344 640 339.968 640s-10.048-1.92-14.08-5.952C321.92 630.144 320 625.344 320 620.032L320 512 224 512C206.336 512 192 497.664 192 480S206.336 448 224 448L320 448 320 339.968c0-5.376 1.92-10.048 5.952-14.08C329.92 321.984 334.656 320 339.968 320s10.048 1.984 14.08 5.952L506.048 465.92C510.016 469.952 512 474.624 512 480zM576 480c0 5.376 1.984 10.112 5.952 14.08l152 140.032C737.92 638.08 742.656 640 748.032 640s10.048-1.92 14.08-5.952C766.08 630.144 768 625.344 768 620.032L768 512l96 0C881.664 512 896 497.664 896 480S881.664 448 864 448L768 448 768 339.968c0-5.376-1.92-10.048-5.952-14.08C758.08 321.984 753.344 320 748.032 320s-10.048 1.984-14.08 5.952L581.952 465.92C577.984 469.952 576 474.624 576 480zM448 128l0 128 64 0L512 128c0-35.392-28.672-64-64-64l0 0L128 64C92.672 64 64 92.608 64 128l0 704c0 35.392 28.672 64 64 64l320 0c35.328 0 64-28.608 64-64l0-128L448 704l0 128L128 832 128 128 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128"/></svg>'},{key:"unmergeCells",labelKey:"unmergeCells",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M197.952 465.92l152-140.032C353.92 321.984 358.656 320 364.032 320s10.048 1.984 14.08 5.952C382.08 329.92 384 334.656 384 339.968L384 448l96 0C497.664 448 512 462.336 512 480S497.664 512 480 512L384 512l0 108.032c0 5.376-1.92 10.112-5.952 14.08C374.08 638.08 369.344 640 364.032 640S353.92 638.08 349.952 634.048L197.952 494.08C193.984 490.112 192 485.376 192 480S193.984 469.952 197.952 465.92zM890.048 465.92l-152-140.032C734.08 321.984 729.344 320 723.968 320s-10.048 1.984-14.08 5.952C705.92 329.92 704 334.656 704 339.968L704 448 608 448C590.336 448 576 462.336 576 480S590.336 512 608 512L704 512l0 108.032c0 5.376 1.92 10.112 5.952 14.08C713.92 638.08 718.656 640 723.968 640s10.048-1.92 14.08-5.952l152-140.032C894.016 490.112 896 485.376 896 480S894.016 469.952 890.048 465.92zM448 128l0 128 64 0L512 128c0-35.392-28.608-64-64-64l0 0L128 64C92.608 64 64 92.608 64 128l0 704c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64l0-128L448 704l0 128L128 832 128 128 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128"/></svg>'}],ga={bg:"#f4f4f4",gridBg:"#ffffff",headerBg:"#e8e8e8",headerBorder:"#c8c8c8",headerText:"#444",headerSep:"#b0b0b0",cornerBg:"#e0e0e0",gridLine:"#e0e0e0",selectionBg:"rgba(0, 120, 215, 0.12)",activeCellBorder:"#0078d7",cellText:"#1a1a1a",scrollTrack:"rgba(0,0,0,0.08)",scrollThumb:"rgba(0,0,0,0.25)",formulaBarBg:"#f0f0f0",formulaBarBorder:"#c8c8c8",formulaBarLabelText:"#333",formulaBarLabelBg:"#fff",formulaBarLabelBorder:"#c0c0c0",formulaBarInputBg:"#fff",formulaBarInputBorder:"#c0c0c0",formulaBarInputText:"#1a1a1a",formulaBarInputFocusBorder:"#0078d7",formulaBarInputFocusShadow:"rgba(0, 120, 215, 0.3)",wrapperBg:"#e8e8e8",cellEditorBorder:"#0078d7",cellEditorText:"#1a1a1a",cellEditorBg:"#fff",cellEditorShadow:"#0078d7",tabBarBg:"#e8e8e8",tabBarBorder:"#c0c0c0",tabActiveBg:"#ffffff",tabActiveText:"#1a1a1a",tabActiveBorder:"#0078d7",tabInactiveBg:"#dfdfdf",tabInactiveText:"#666",tabInactiveBorder:"transparent",tabHoverBg:"#e0e0e0",tabAddBtnColor:"#555",tabAddBtnHoverBg:"#d0d0d0",tabScrollBtnColor:"#888",tabScrollBtnHoverBg:"#d0d0d0",scrollbarThumb:"rgba(0,0,0,0.25)",scrollbarThumbHover:"rgba(0,0,0,0.4)",scrollBtnBg:"#e8e8e8",scrollBtnColor:"#666",scrollBtnHoverBg:"#d0d0d0",scrollBtnActiveBg:"#c0c0c0",scrollTrackBg:"rgba(0,0,0,0.06)",toolbarBg:"#f7f7f7",toolbarBorder:"#d8d8d8",toolbarBtnColor:"#444",toolbarBtnHoverBg:"#e6e6e6",toolbarBtnDisabledColor:"#b0b0b0",toolbarBtnActiveColor:"#0078d7",findMatchBg:"rgba(255, 213, 79, 0.45)",findActiveBg:"rgba(255, 179, 0, 0.75)"},ba={bg:"#1e1e1e",gridBg:"#252526",headerBg:"#252525",headerBorder:"#3e3e3e",headerText:"#999",headerSep:"#3e3e3e",cornerBg:"#2a2a2a",gridLine:"#3e3e3e",selectionBg:"rgba(0, 120, 215, 0.25)",activeCellBorder:"#0078d7",cellText:"#d4d4d4",scrollTrack:"rgba(255,255,255,0.06)",scrollThumb:"rgba(255,255,255,0.2)",formulaBarBg:"#2d2d2d",formulaBarBorder:"#3e3e3e",formulaBarLabelText:"#ccc",formulaBarLabelBg:"#3c3c3c",formulaBarLabelBorder:"#555",formulaBarInputBg:"#3c3c3c",formulaBarInputBorder:"#555",formulaBarInputText:"#d4d4d4",formulaBarInputFocusBorder:"#0078d7",formulaBarInputFocusShadow:"rgba(0, 120, 215, 0.4)",wrapperBg:"#1e1e1e",cellEditorBorder:"#0078d7",cellEditorText:"#d4d4d4",cellEditorBg:"#3c3c3c",cellEditorShadow:"#0078d7",tabBarBg:"#2a2a2a",tabBarBorder:"#3e3e3e",tabActiveBg:"#1e1e1e",tabActiveText:"#e0e0e0",tabActiveBorder:"#0078d7",tabInactiveBg:"#333333",tabInactiveText:"#888",tabInactiveBorder:"transparent",tabHoverBg:"#3a3a3a",tabAddBtnColor:"#999",tabAddBtnHoverBg:"#3a3a3a",tabScrollBtnColor:"#777",tabScrollBtnHoverBg:"#3a3a3a",scrollbarThumb:"rgba(255,255,255,0.2)",scrollbarThumbHover:"rgba(255,255,255,0.35)",scrollBtnBg:"#2d2d2d",scrollBtnColor:"#999",scrollBtnHoverBg:"#3d3d3d",scrollBtnActiveBg:"#4d4d4d",scrollTrackBg:"rgba(255,255,255,0.05)",toolbarBg:"#2a2a2a",toolbarBorder:"#3e3e3e",toolbarBtnColor:"#ccc",toolbarBtnHoverBg:"#3a3a3a",toolbarBtnDisabledColor:"#666",toolbarBtnActiveColor:"#4ea1ff",findMatchBg:"rgba(255, 213, 79, 0.35)",findActiveBg:"rgba(255, 179, 0, 0.6)"},Wl="__nf_custom__",Tl="",Pl="",il="@",Gn="__NF_INVALID__",Co=2958465,wo=0;function sl(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function vo(e){return e==="zh-CN"?"¥":"$"}function ya(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function er(e){return e.replace(/"([^"]*)"/g,"$1")}function Ca(e){let n=e,l;const o=n.match(/^\[([^\]]+)\]/);o&&(l=o[1].toLowerCase(),n=n.slice(o[0].length)),n=ya(n);const a=/E[+-]/i.test(n),i=n.includes("%"),r=n.search(/[0#?]/);if(r===-1)return{hasDigits:!1,decimals:0,minDecimals:0,minIntDigits:0,thousands:!1,scale:i?100:1,scientific:!1,prefix:n,suffix:"",color:l};let d=-1;for(let X=n.length-1;X>=0;X--){const te=n[X];if(te==="0"||te==="#"||te==="?"||te==="E"){d=X;break}}d<0&&(d=r);const f=r>0?n.slice(0,r):"",y=d<n.length-1?n.slice(d+1):"",h=n.slice(r,d+1),u=/[0#?]/.test(h),E=h.includes(",");let k=h.replace(/,/g,"");if(a){const X=k.search(/E/i);X>=0&&(k=k.slice(0,X))}const H=k.indexOf("."),Y=H>=0?k.slice(0,H):k,ne=H>=0?k.slice(H+1):"",ee=(ne.match(/[0#?]/g)||[]).length,M=(ne.match(/0/g)||[]).length,se=(Y.match(/0/g)||[]).length;return{hasDigits:u,decimals:ee,minDecimals:M,minIntDigits:se,thousands:E,scale:i?100:1,scientific:a,prefix:f,suffix:y,color:l}}function wa(e){const n=[];let l=!1;const o=/\[h\]|\[mm\]|\[ss\]|yyyy|yy|y|mmmm|mmm|mm|m|dddd|ddd|dd|d|hh|h|ss|s|AM\/PM|am\/pm|"[^"]*"|\/|-|:|\s+|[^\s]/g;let a;for(;(a=o.exec(e))!==null;){const i=a[0];switch(i){case"[h]":l=!0,n.push({type:"hour",len:0});break;case"[mm]":l=!0,n.push({type:"minute",len:2});break;case"[ss]":l=!0,n.push({type:"second",len:2});break;case"yyyy":n.push({type:"year",len:4});break;case"yy":case"y":n.push({type:"year",len:2});break;case"mmmm":n.push(l?{type:"minute",len:4}:{type:"monthName",len:4});break;case"mmm":n.push(l?{type:"minute",len:3}:{type:"monthName",len:3});break;case"mm":n.push(l?{type:"minute",len:2}:{type:"month",len:2});break;case"m":n.push(l?{type:"minute",len:1}:{type:"month",len:1});break;case"dddd":n.push({type:"weekday",len:4});break;case"ddd":n.push({type:"weekday",len:3});break;case"dd":n.push({type:"day",len:2});break;case"d":n.push({type:"day",len:1});break;case"hh":n.push({type:"hour",len:2});break;case"h":n.push({type:"hour",len:1});break;case"ss":n.push({type:"second",len:2});break;case"s":n.push({type:"second",len:1});break;case"AM/PM":case"am/pm":n.push({type:"ampm",len:2});break;default:i.startsWith('"')?n.push({type:"literal",text:er(i),len:0}):n.push({type:"literal",text:i,len:0})}}return{tokens:n,isDuration:l}}const tr=new Map;function va(e){const n=e.replace(/\[[^\]]*\]/gi,i=>/^\[(h|mm|ss)\]$/i.test(i)?i:"");if(/[ydhs]/.test(n)||/AM\/PM/i.test(n)||/\[h\]/i.test(n)){const i=e.split(";")[0]??e,{tokens:r,isDuration:d}=wa(i);return{kind:d?"duration":"date",sections:[],tokens:r,isDuration:d,raw:e}}return{kind:"number",sections:e.split(";").map(i=>Ca(i)),tokens:[],isDuration:!1,raw:e}}function Ul(e){const n=tr.get(e);if(n)return n;const l=va(e);return tr.set(e,l),l}function lr(e,n,l,o,a){const i=Math.pow(10,n),r=Math.round((e+Number.EPSILON)*i)/i,d=r<0,f=Math.abs(r);let h=new Intl.NumberFormat("en-US",{useGrouping:o,minimumIntegerDigits:a,minimumFractionDigits:n,maximumFractionDigits:n}).format(f);if(l<n&&n>0){const E=h.indexOf(".");if(E>=0){const x=h.substring(0,E);let k=h.substring(E+1);k=k.replace(/0+$/,""),k.length<l&&(k=k+"0".repeat(l-k.length)),h=k?`${x}.${k}`:x}}return`${d?"-":""}${h}`}function nr(e,n){if(e===0)return(n>0?"0."+"0".repeat(n):"0")+"E+00";const l=Math.floor(Math.log10(Math.abs(e))),o=e/Math.pow(10,l),a=lr(o,n,n,!1,1),i=(l>=0?"+":"-")+String(Math.abs(l)).padStart(2,"0");return`${a}E${i}`}function ka(e,n,l){if(!l.hasDigits)return er(l.prefix+l.suffix);const o=l.scale===100?e*100:e,a=l.scientific?nr(o,l.decimals):lr(o,l.decimals,l.minDecimals,l.thousands,l.minIntDigits);return n+l.prefix+a+l.suffix}function Ea(e,n){const l=n.sections;if(l.length===0)return String(e);let o,a,i="";return e>0?(o=l[0],a=e):e<0?l[1]?(o=l[1],a=-e):(o=l[0],a=-e,i="-"):(o=l[2]??l[0],a=0),ka(a,i,o)}function Ra(e){return new Date((e-25569)*864e5)}const Sa=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Ma=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],or=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],Ba=["January","February","March","April","May","June","July","August","September","October","November","December"],Ta=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],rr=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function En(e,n){return String(e).padStart(n,"0")}function Na(e,n,l,o){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),d=e.getUTCDay(),f=l==="zh-CN";let y="",h=!1;for(const u of n)switch(u.type){case"literal":y+=u.text??"";break;case"year":y+=u.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":y+=En(h?e.getUTCMinutes():i,u.len);break;case"monthName":y+=u.len>=4?f?Sa[i-1]:Ba[i-1]:f?Ma[i-1]:Ta[i-1];break;case"day":y+=En(r,u.len);break;case"weekday":y+=u.len>=4?f?or[d]:rr[d]:f?or[d].slice(2):rr[d].slice(0,3);break;case"hour":{let E=e.getUTCHours();if(u.len===0){const x=Math.floor(o*86400);E=Math.floor(x/3600)}y+=String(E),h=!0;break}case"minute":y+=En(e.getUTCMinutes(),u.len);break;case"second":y+=En(e.getUTCSeconds(),u.len);break;case"ampm":{const E=e.getUTCHours();y+=E<12?f?"上午":"AM":f?"下午":"PM";break}}return y}function xa(e,n){const l=Math.floor(e*86400),o=Math.floor(l/3600),a=Math.floor(l%3600/60),i=l%60;let r="";for(const d of n)switch(d.type){case"literal":r+=d.text??"";break;case"hour":r+=String(o);break;case"minute":r+=En(a,d.len||2);break;case"second":r+=En(i,d.len||2);break;default:r+=""}return r}function Da(e){if(e==="")return e;const n=Number(e);if(!isNaN(n)&&e.trim()!==""){const l=Math.abs(n);return l!==0&&(l>=1e15||l<1e-9)?nr(n,9):e}return e}function yl(e,n,l){if(sl(n))return Da(e);if(n==null||n===il)return e;const o=Ul(n);if(o.kind==="date"||o.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(o.kind==="date"){if(i<wo||i>Co)return Gn}else if(i<0)return Gn;return o.kind==="duration"?xa(i,o.tokens):Na(Ra(i),o.tokens,l,i)}const a=Number(e);return isNaN(a)?e:Ea(a,o)}const Va=["general","text","number","percent","scientific","accounting","financial","currency","currencyRounded","date","time","dateTime","duration","custom"];function ko(e,n){if(n===il||n==="@")return!1;if(sl(n)){if(e==null||e===""||e.trim()==="")return!1;const o=Number(e);return!Number.isNaN(o)&&Number.isFinite(o)}const l=Ul(n);return!!(l.kind==="number"&&ar(l))}function ar(e){return e.sections.some(n=>n.hasDigits)}function ir(e){if(e==null||sl(e)||e===il||e==="@")return!1;const n=Ul(e);return!!(n.kind==="date"||n.kind==="duration"||n.kind==="number"&&ar(n))}function sr(e,n){if(n==null||sl(n)||n===il||n==="@")return!1;const l=Ul(n),o=Number(e);return Number.isFinite(o)?l.kind==="date"?o<wo||o>Co:l.kind==="duration"?o<0:!1:!1}const Eo=30,Ro=0;function Cl(e){if(e==null||e===""||e.trim()==="")return!1;const n=Number(e);return!Number.isNaN(n)&&Number.isFinite(n)}function cr(e,n){if(e==null||e===Tl||sl(e))return Cl(n);if(e===il)return!1;const l=Ul(e);return l.kind==="date"||l.kind==="duration"?!1:l.sections.some(o=>o.hasDigits)}function Fa(e){if(!Cl(e))return 0;const n=String(Number(e));return n.indexOf(".")<0||/e/i.test(n)?0:n.slice(n.indexOf(".")+1).length}function Ia(e,n){if(!cr(e,n))return-1;if(e==null||e===Tl||sl(e))return Fa(n);const o=Ul(e).sections.find(a=>a.hasDigits);return o?o.decimals:-1}function Aa(e,n){let l=0;const o=/\[[^\]]*\]/g;let a;for(;(a=o.exec(e))!==null&&!/^\[(h|mm|ss)\]$/i.test(a[0]);)l=a.index+a[0].length;const i=e.slice(0,l),r=e.slice(l),d=r.search(/[0#?]/);if(d===-1)return e;let f=-1;for(let Y=r.length-1;Y>=0;Y--){const ne=r[Y];if(ne==="0"||ne==="#"||ne==="?"||ne==="E"){f=Y;break}}if(f<d)return e;const y=r.slice(d,f+1),h=y.search(/E[+-]/i),u=h>=0?y.slice(0,h):y,E=u.indexOf("."),x=E>=0?(u.slice(E+1).match(/[0#?]/g)||[]).length:0;if(x===n)return e;let k;if(E<0)k=n>0?u+"."+"0".repeat(n):u;else if(n>x)k=u+"0".repeat(n-x);else{let Y=x-n;const ne=u.split("");for(let ee=ne.length-1;ee>=0&&Y>0;ee--){const M=ne[ee];(M==="0"||M==="#"||M==="?")&&(ne.splice(ee,1),Y--)}k=ne.join(""),n===0&&k.endsWith(".")&&(k=k.slice(0,-1))}const H=k+(h>=0?y.slice(h):"");return i+r.slice(0,d)+H+r.slice(f+1)}function _a(e,n){if(!Number.isInteger(n)||n<Ro||n>Eo||e===Tl)return null;if(e==null||sl(e))return n>0?"0."+"0".repeat(n):"0";if(e===il)return null;const l=Ul(e);return l.kind==="date"||l.kind==="duration"||!l.sections.some(o=>o.hasDigits)?null:e.split(";").map(o=>Aa(o,n)).join(";")}const So=["¥","$","€","£"];function dr(e,n){if(e==null||e===Tl)return e??Pl;if(sl(e))return Pl;if(e===il||e==="@")return il;const l=vo(n),o=n==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",a=n==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",i=`${l}#,##0.00;(${l}#,##0.00);${l}"-"`,r="#,##0.00;[Red](#,##0.00)";if(ur(n).some(x=>x.value===e))return e;const f=e.replace(/\[[^\]]*\]/gi,x=>/^\[(h|mm|ss)\]$/i.test(x)?x:"");if(/\[(h|mm|ss)\]/i.test(f)&&!/[yd]/i.test(f))return"[h]:mm:ss";const y=/[yd]/i.test(f),h=/h|s|AM\/PM/i.test(f);if(y&&h)return a;if(y||/AM\/PM/i.test(f))return o;if(h)return"h:mm:ss";if(e.includes("%"))return"0.00%";if(/E[+-]/i.test(e))return"0.00E+00";if(e.includes("[Red]("))return r;const u=So.find(x=>e.startsWith(x));if(u)return e.includes("(")?i:/\.\d/.test(e.slice(u.length))?l+"#,##0.00":l+"#,##0";const E=Ul(e);return E.kind==="number"&&E.sections.some(x=>x.hasDigits)?"#,##0.00":Wl}function La(e,n){return new Date(Date.UTC(e,n,0)).getUTCDate()}function Oa(e,n,l){const o=Date.UTC(e,n-1,l)/864e5+25569;return o<=60?o-1:o}function Nl(e,n,l=new Date){const o=e.trim();if(!o||o.startsWith("=")||Cl(o))return null;const a=n==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",i=n==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",r="h:mm:ss";function d(E){const x=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(E);if(!x)return null;const k=Number(x[1]),H=Number(x[2]),Y=x[3]!==void 0?Number(x[3]):0;return k>23||H>59||Y>59?null:(k*3600+H*60+Y)/86400}function f(E){let x=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(E),k,H,Y;if(x)k=Number(x[1]),H=Number(x[2]),Y=Number(x[3]);else if(x=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(E))k=Number(x[1]),H=Number(x[2]),Y=Number(x[3]);else if(x=/^(\d{1,2})[-/](\d{1,2})[-/](\d{4})$/.exec(E))H=Number(x[1]),Y=Number(x[2]),k=Number(x[3]);else if(x=/^(\d{1,2})[-/](\d{1,2})$/.exec(E))k=l.getUTCFullYear(),H=Number(x[1]),Y=Number(x[2]);else return null;if(k<1900||k>9999||H<1||H>12||Y<1||Y>La(k,H))return null;const ne=Oa(k,H,Y);return ne>=wo&&ne<=Co?ne:null}const y=d(o);if(y!==null)return{serial:y,format:r};const h=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(o);if(h){const E=f(h[1].trim()),x=d(h[2]);if(E!==null&&x!==null)return{serial:E+x,format:i}}const u=f(o);return u!==null?{serial:u,format:a}:null}function qn(e,n){const l=e.trim();if(!l||l.startsWith("=")||!(l.includes(",")||l.includes("%")||So.some(ee=>l.startsWith(ee)))||Nl(l,n))return null;const a=So.find(ee=>l.startsWith(ee)),i=a?l.slice(a.length).trim():l;if(!i)return null;const r=/^([+-]?)(\d{1,3}(?:,\d{3})+)(?:\.(\d+))?(%?)$/.exec(i)||/^([+-]?)(\d+)(?:\.(\d+))?(%?)$/.exec(i);if(!r)return null;const d=r[1]==="-"?-1:1,f=r[2].replace(/,/g,""),y=r[3],h=(r[4]??"")==="%",u=y?y.length:0,E=+(f+(y?"."+y:""));if(!Number.isFinite(E))return null;const k=i.includes(",")?"#,##0":"0",H=u>0?"."+"0".repeat(u):"",Y=(a??"")+k+H+(h?"%":"");let ne=E*d;return h&&(ne=ne/100),ne=Math.round(ne*1e12)/1e12,{num:ne,format:Y}}function $a(e,n,l,o){const a=vo(e),i=o?"#,##0":"0",r=l>0?"."+"0".repeat(l):"",d=i+r;switch(n){case"general":return"";case"text":return il;case"custom":return"";case"number":return d;case"percent":return d+"%";case"scientific":return"0."+"0".repeat(l)+"E+00";case"currency":return a+d;case"currencyRounded":return a+(o?"#,##0":"0");case"accounting":return`${a}${d};(${a}${d});${a}"-"`;case"financial":return`${d};[Red](${d})`;case"date":return e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy";case"time":return"h:mm:ss";case"dateTime":return e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss";case"duration":return"[h]:mm:ss";default:return""}}function ur(e){const n=vo(e);return[{label:b(e,"nfGeneral"),value:Pl},{label:b(e,"nfText"),value:il},{label:b(e,"nfNumber"),value:"#,##0.00"},{label:b(e,"nfPercent"),value:"0.00%"},{label:b(e,"nfScientific"),value:"0.00E+00"},{label:b(e,"nfAccounting"),value:`${n}#,##0.00;(${n}#,##0.00);${n}"-"`},{label:b(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:b(e,"nfCurrency"),value:n+"#,##0.00"},{label:b(e,"nfCurrencyRounded"),value:n+"#,##0"},{label:b(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:b(e,"nfTime"),value:"h:mm:ss"},{label:b(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:b(e,"nfDuration"),value:"[h]:mm:ss"},{label:b(e,"nfCustom"),value:Wl}]}const Ha=["title"],za=["innerHTML"],Wa={class:"sp-dropdown__value"},Pa=["disabled"],Ua=["placeholder"],Ka=["disabled","onClick"],Ga=["innerHTML"],qa={class:"sp-dropdown__item-label"},Ya={key:2,class:"sp-dropdown__empty"},Xa=["disabled"],ja=t.defineComponent({__name:"dropdown",props:{modelValue:{},options:{},width:{default:"auto"},menuWidth:{default:void 0},visibleCount:{default:8},title:{default:""},modelOpen:{type:Boolean,default:void 0},hideTrigger:{type:Boolean,default:!1},align:{default:"left"},triggerEl:{default:null},fallbackLabel:{default:""},searchable:{type:Boolean,default:!1},searchPlaceholder:{default:""},triggerIcon:{default:""},triggerLabel:{default:""}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:n}){const l=e,o=n,a=t.ref(!1),i=t.ref(0),r=t.ref(null),d=t.ref(null),f=t.ref(null),y=t.ref({top:0,up:!1}),h=t.ref(void 0),u=t.ref(0),E=t.ref(!1),x=t.ref(""),k=t.ref(null),H=t.computed(()=>l.options.find(Q=>String(Q.value)===String(l.modelValue))),Y=t.computed(()=>l.menuWidth!==void 0?l.menuWidth:h.value),ne=t.computed(()=>{if(!l.searchable||!x.value.trim())return l.options;const Q=x.value.trim().toLowerCase();return l.options.filter(ke=>String(ke.label??"").toLowerCase().includes(Q))}),ee=t.computed(()=>ne.value.length>0),M=t.computed(()=>Math.min(l.visibleCount,ne.value.length)),se=t.computed(()=>ne.value.slice(i.value,i.value+M.value)),X=t.computed(()=>i.value>0),te=t.computed(()=>i.value+M.value<ne.value.length),Ne=t.computed(()=>ne.value.length>M.value);function ze(Q){i.value=Math.max(0,Math.min(ne.value.length-M.value,i.value+Q))}function Ve(){const Q=l.triggerEl??r.value;if(!Q)return;const ke=Q.getBoundingClientRect();h.value=ke.width,a.value=!0,l.searchable&&(x.value=""),l.modelOpen!==void 0&&o("update:modelOpen",!0);const B=ke.bottom+4;l.align==="right"?y.value={right:window.innerWidth-ke.right,top:B,up:!1}:y.value={left:ke.left,top:B,up:!1};const oe=ne.value.findIndex(Z=>String(Z.value)===String(l.modelValue));i.value=oe>=0?Math.max(0,Math.min(oe-Math.floor(M.value/2),ne.value.length-M.value)):0,l.searchable&&t.nextTick(()=>{var Z;return(Z=k.value)==null?void 0:Z.focus()}),t.nextTick(()=>{const Z=l.triggerEl??r.value;if(!Z)return;const re=Z.getBoundingClientRect(),K=f.value;if(!K)return;const L=K.offsetHeight,J=window.innerHeight-re.bottom-8,$=re.top-8,U=J<L&&$>0;let de=U?re.top-L-4:re.bottom+4;de=Math.max(8,Math.min(window.innerHeight-L-8,de)),l.align==="right"?y.value={right:window.innerWidth-re.right,top:de,up:U}:y.value={left:re.left,top:de,up:U}})}function Fe(){a.value=!1,x.value="",l.modelOpen!==void 0&&o("update:modelOpen",!1)}function je(){a.value?Fe():Ve()}function _e(Q){Q.disabled||(o("update:modelValue",Q.value),o("change",Q.value),Fe())}function F(Q){var B,oe;if(!a.value)return;const ke=Q.target;(B=r.value)!=null&&B.contains(ke)||(oe=f.value)!=null&&oe.contains(ke)||Fe()}function I(Q){a.value&&(Q.preventDefault(),ze(Q.deltaY>0?1:-1))}t.watch(a,Q=>{t.nextTick(()=>{var ke,B;Q?((ke=d.value)==null||ke.addEventListener("wheel",I,{passive:!1}),document.addEventListener("keydown",G)):((B=d.value)==null||B.removeEventListener("wheel",I),document.removeEventListener("keydown",G))})});function G(Q){a.value&&Q.key==="Escape"&&Fe()}t.watch(()=>l.modelOpen,Q=>{Q!==void 0&&Q!==a.value&&(Q?Ve():Fe())});function Ce(Q){a.value&&(u.value=Q.touches[0].clientY,E.value=!0)}function $e(Q){if(!a.value||!E.value)return;const ke=Q.touches[0].clientY-u.value;Math.abs(ke)>5&&(ze(ke<0?1:-1),u.value=Q.touches[0].clientY)}function j(){E.value=!1}function Be(Q){Q.key==="Escape"&&(Q.stopPropagation(),Fe())}return t.onMounted(()=>{document.addEventListener("pointerdown",F),window.addEventListener("resize",Fe),window.addEventListener("scroll",Fe,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",F),document.removeEventListener("keydown",G),window.removeEventListener("resize",Fe),window.removeEventListener("scroll",Fe,!0)}),(Q,ke)=>{var B,oe,Z,re,K;return t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"sp-dropdown",style:t.normalizeStyle(typeof e.width=="number"?{width:e.width+"px"}:{width:e.width})},[e.hideTrigger?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__trigger",{"sp-dropdown__trigger--open":a.value}]),title:e.title,onClick:je},[(B=H.value)!=null&&B.icon||e.triggerIcon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:((oe=H.value)==null?void 0:oe.icon)||e.triggerIcon},null,8,za)):t.createCommentVNode("",!0),t.createElementVNode("span",Wa,t.toDisplayString((Z=H.value)!=null&&Z.icon||e.triggerIcon?((re=H.value)==null?void 0:re.label)??e.triggerLabel:((K=H.value)==null?void 0:K.label)??e.fallbackLabel),1),ke[5]||(ke[5]=t.createElementVNode("svg",{class:"sp-dropdown__caret",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1))],10,Ha)),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:f,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":y.value.up}]),style:t.normalizeStyle({left:y.value.left!==void 0?y.value.left+"px":void 0,right:y.value.right!==void 0?y.value.right+"px":void 0,top:y.value.top+"px",minWidth:Y.value!==void 0?typeof Y.value=="number"?Y.value+"px":Y.value:void 0}),onKeydown:Be,onMousedown:ke[4]||(ke[4]=t.withModifiers(()=>{},["prevent"]))},[Ne.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!X.value}]),disabled:!X.value,onClick:ke[0]||(ke[0]=L=>ze(-1))},[...ke[6]||(ke[6]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 662.613333a32 32 0 0 0 45.226667 0L512 375.893333l286.72 286.72a32 32 0 1 0 45.226667-45.226666l-309.333334-309.333334a32 32 0 0 0-45.226666 0l-309.333334 309.333334a32 32 0 0 0 0 45.226666z"})],-1)])],10,Pa)):t.createCommentVNode("",!0),e.searchable?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"searchInputRef",ref:k,"onUpdate:modelValue":ke[1]||(ke[1]=L=>x.value=L),class:"sp-dropdown__search",type:"text",placeholder:e.searchPlaceholder,onMousedown:ke[2]||(ke[2]=t.withModifiers(()=>{},["stop"]))},null,40,Ua)),[[t.vModelText,x.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:d,class:"sp-dropdown__list",onTouchstart:Ce,onTouchmove:$e,onTouchend:j},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(se.value,L=>(t.openBlock(),t.createElementBlock("button",{key:String(L.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":!L.disabled&&String(L.value)===String(e.modelValue),"sp-dropdown__item--disabled":L.disabled}]),disabled:L.disabled,onClick:J=>_e(L)},[L.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:L.icon},null,8,Ga)):t.createCommentVNode("",!0),t.createElementVNode("span",qa,t.toDisplayString(L.label),1)],10,Ka))),128))],544),e.searchable&&!ee.value?(t.openBlock(),t.createElementBlock("div",Ya," 无匹配 ")):t.createCommentVNode("",!0),Ne.value?(t.openBlock(),t.createElementBlock("button",{key:3,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!te.value}]),disabled:!te.value,onClick:ke[3]||(ke[3]=L=>ze(1))},[...ke[7]||(ke[7]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],10,Xa)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),St=(e,n)=>{const l=e.__vccOpts||e;for(const[o,a]of n)l[o]=a;return l},Dt=St(ja,[["__scopeId","data-v-391d39ca"]]),Za=["title","onClick"],Yn=St(t.defineComponent({__name:"color-picker",props:{modelOpen:{type:Boolean,default:void 0},colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{expose:n,emit:l}){const o=e,a=l,i=[[{key:"colorAutomatic",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorSlate",value:"#595959"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorBlack",value:"#000000"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],r=[[{key:"colorNoFill",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorWhite",value:"#FFFFFF"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorSlate",value:"#595959"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],d=t.computed(()=>o.colorKey==="fill"?r:i);function f(ee){return b(o.locale,ee)}function y(ee){const M=o.currentColor;return!M&&!ee?!0:M?M.toLowerCase()===ee.toLowerCase():!1}const h=t.ref(!1),u=t.ref(null),E=t.ref(null),x=t.ref({top:0});t.watch(()=>o.modelOpen,ee=>{ee!==void 0&&ee!==h.value&&(ee?H():Y())});function k(ee){const M=u.value,se=E.value,X=ee.target;M&&M.contains(X)||se&&se.contains(X)||Y()}function H(){const ee=o.triggerEl??u.value;if(!ee)return;h.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0);const M=ee.getBoundingClientRect();let se=window.innerWidth-M.right;const X=120;let te;M.left-X<4&&(se=void 0,te=Math.max(4,M.left)),x.value=se!==void 0?{right:se,top:M.bottom+4}:{left:te,top:M.bottom+4},t.nextTick(()=>{const Ne=o.triggerEl??u.value;if(!Ne)return;const ze=Ne.getBoundingClientRect(),Ve=E.value;if(!Ve)return;const Fe=Ve.offsetHeight,je=window.innerHeight-ze.bottom-8,_e=ze.top-8;let I=je<Fe&&_e>0?ze.top-Fe-4:ze.bottom+4;I=Math.max(4,Math.min(window.innerHeight-Fe-4,I)),x.value=se!==void 0?{right:window.innerWidth-ze.right,top:I}:{left:te,top:I},document.addEventListener("pointerdown",k)})}function Y(){h.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",k)}function ne(ee){a("update:modelValue",ee),a("change",ee),Y()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",k)}),n({open:h,openMenu:H,close:Y}),(ee,M)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:u,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[h.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:E,class:"color-picker__menu",style:t.normalizeStyle({left:x.value.left!==void 0?x.value.left+"px":void 0,right:x.value.right!==void 0?x.value.right+"px":void 0,top:x.value.top+"px"}),onMousedown:M[0]||(M[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,(se,X)=>(t.openBlock(),t.createElementBlock("div",{key:X,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(se,te=>(t.openBlock(),t.createElementBlock("button",{key:te.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":y(te.value)}]),title:f(te.key),style:t.normalizeStyle({background:te.value||"transparent",border:te.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:Ne=>ne(te.value)},null,14,Za))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-34b2d484"]]),Ja=["title","onClick"],Qa={viewBox:"0 0 30 30",class:"border-picker__icon"},ei=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],ti={class:"border-picker__label"},li=St(t.defineComponent({__name:"border-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:l}){const o=e,a=l,i=[{key:"bottom",i18nKey:"borderBottom"},{key:"top",i18nKey:"borderTop"},{key:"left",i18nKey:"borderLeft"},{key:"right",i18nKey:"borderRight"},{key:"none",i18nKey:"borderNone"},{key:"all",i18nKey:"borderAll"},{key:"outer",i18nKey:"borderOuter"},{key:"thickOuter",i18nKey:"borderThickOuter"}],r=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],d={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},f={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function y(ee,M){return f[ee].includes(M)?"thick":d[ee].includes(M)?"solid":"dashed"}const h=t.ref(!1),u=t.ref(null),E=t.ref(null),x=t.ref({top:0});t.watch(()=>o.modelOpen,ee=>{ee!==void 0&&ee!==h.value&&(ee?H():Y())});function k(ee){const M=u.value,se=E.value,X=ee.target;M&&M.contains(X)||se&&se.contains(X)||Y()}function H(){const ee=o.triggerEl??u.value;if(!ee)return;h.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0);const M=ee.getBoundingClientRect();let se=window.innerWidth-M.right;const X=160;let te;M.left-X<4&&(se=void 0,te=Math.max(4,M.left)),x.value=se!==void 0?{right:se,top:M.bottom+4}:{left:te,top:M.bottom+4},t.nextTick(()=>{const Ne=o.triggerEl??u.value;if(!Ne)return;const ze=Ne.getBoundingClientRect(),Ve=E.value;if(!Ve)return;const Fe=Ve.offsetHeight,je=window.innerHeight-ze.bottom-8,_e=ze.top-8;let I=je<Fe&&_e>0?ze.top-Fe-4:ze.bottom+4;I=Math.max(4,Math.min(window.innerHeight-Fe-4,I)),x.value=se!==void 0?{right:window.innerWidth-ze.right,top:I}:{left:te,top:I},document.addEventListener("pointerdown",k)})}function Y(){h.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",k)}function ne(ee){a("change",ee),Y()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",k)}),n({open:h,openMenu:H,close:Y}),(ee,M)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:u,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[h.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:E,class:"border-picker__menu",style:t.normalizeStyle({left:x.value.left!==void 0?x.value.left+"px":void 0,right:x.value.right!==void 0?x.value.right+"px":void 0,top:x.value.top+"px"}),onMousedown:M[0]||(M[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,se=>t.createElementVNode("button",{key:se.key,class:"border-picker__item",title:t.unref(b)(e.locale,se.i18nKey),onClick:X=>ne(se.key)},[(t.openBlock(),t.createElementBlock("svg",Qa,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,X=>t.createElementVNode("line",{key:X.name,x1:X.x1,y1:X.y1,x2:X.x2,y2:X.y2,stroke:"currentColor","stroke-width":y(se.key,X.name)==="thick"?3:1.5,"stroke-dasharray":y(se.key,X.name)==="dashed"?"0 4":"none","stroke-linecap":y(se.key,X.name)==="dashed"?"round":"square"},null,8,ei)),64))])),t.createElementVNode("span",ti,t.toDisplayString(t.unref(b)(e.locale,se.i18nKey)),1)],8,Ja)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-a6e24710"]]),ni=["title","onClick"],oi={viewBox:"0 0 1024 1024",class:"sort-picker__icon",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},ri=["x1","y1","x2","y2"],ai=["d"],ii={class:"sort-picker__label"},si=St(t.defineComponent({__name:"sort-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentSort:{default:"asc"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:l}){const o=e,a=l,i=[{key:"asc",i18nKey:"sortAsc"},{key:"desc",i18nKey:"sortDesc"}],r=[{name:"bar1",x1:96,y1:224,x2:352,y2:224},{name:"bar2",x1:96,y1:512,x2:512,y2:512},{name:"bar3",x1:96,y1:800,x2:672,y2:800}],d={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},f=t.ref(!1),y=t.ref(null),h=t.ref(null),u=t.ref({top:0});t.watch(()=>o.modelOpen,Y=>{Y!==void 0&&Y!==f.value&&(Y?x():k())});function E(Y){const ne=y.value,ee=h.value,M=Y.target;ne&&ne.contains(M)||ee&&ee.contains(M)||k()}function x(){const Y=o.triggerEl??y.value;if(!Y)return;f.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0);const ne=Y.getBoundingClientRect();let ee=window.innerWidth-ne.right;const M=160;let se;ne.left-M<4&&(ee=void 0,se=Math.max(4,ne.left)),u.value=ee!==void 0?{right:ee,top:ne.bottom+4}:{left:se,top:ne.bottom+4},t.nextTick(()=>{const X=o.triggerEl??y.value;if(!X)return;const te=X.getBoundingClientRect(),Ne=h.value;if(!Ne)return;const ze=Ne.offsetHeight,Ve=window.innerHeight-te.bottom-8,Fe=te.top-8;let _e=Ve<ze&&Fe>0?te.top-ze-4:te.bottom+4;_e=Math.max(4,Math.min(window.innerHeight-ze-4,_e)),u.value=ee!==void 0?{right:window.innerWidth-te.right,top:_e}:{left:se,top:_e},document.addEventListener("pointerdown",E)})}function k(){f.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",E)}function H(Y){a("change",Y),k()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",E)}),n({open:f,openMenu:x,close:k}),(Y,ne)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:y,class:"sort-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[f.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:h,class:"sort-picker__menu",style:t.normalizeStyle({left:u.value.left!==void 0?u.value.left+"px":void 0,right:u.value.right!==void 0?u.value.right+"px":void 0,top:u.value.top+"px"}),onMousedown:ne[0]||(ne[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,ee=>t.createElementVNode("button",{key:ee.key,class:"sort-picker__item",title:t.unref(b)(e.locale,ee.i18nKey),onClick:M=>H(ee.key)},[(t.openBlock(),t.createElementBlock("svg",oi,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,M=>t.createElementVNode("line",{key:M.name,x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2},null,8,ri)),64)),t.createElementVNode("path",{d:d[ee.key]},null,8,ai)])),t.createElementVNode("span",ii,t.toDisplayString(t.unref(b)(e.locale,ee.i18nKey)),1)],8,ni)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-a6111c69"]]),ci=["title","onClick"],di=["innerHTML"],ui={class:"merge-picker__label"},fi=St(t.defineComponent({__name:"merge-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:l}){const o=e,a=l,i=t.ref(!1),r=t.ref(null),d=t.ref(null),f=t.ref({top:0});t.watch(()=>o.modelOpen,x=>{x!==void 0&&x!==i.value&&(x?h():u())});function y(x){const k=r.value,H=d.value,Y=x.target;k&&k.contains(Y)||H&&H.contains(Y)||u()}function h(){const x=o.triggerEl??r.value;if(!x)return;i.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0);const k=x.getBoundingClientRect();let H=window.innerWidth-k.right;const Y=160;let ne;k.left-Y<4&&(H=void 0,ne=Math.max(4,k.left)),f.value=H!==void 0?{right:H,top:k.bottom+4}:{left:ne,top:k.bottom+4},t.nextTick(()=>{const ee=o.triggerEl??r.value;if(!ee)return;const M=ee.getBoundingClientRect(),se=d.value;if(!se)return;const X=se.offsetHeight,te=window.innerHeight-M.bottom-8,Ne=M.top-8;let Ve=te<X&&Ne>0?M.top-X-4:M.bottom+4;Ve=Math.max(4,Math.min(window.innerHeight-X-4,Ve)),f.value=H!==void 0?{right:window.innerWidth-M.right,top:Ve}:{left:ne,top:Ve},document.addEventListener("pointerdown",y)})}function u(){i.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",y)}function E(x){a("change",x),u()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",y)}),n({open:i,openMenu:h,close:u}),(x,k)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"merge-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:d,class:"merge-picker__menu",style:t.normalizeStyle({left:f.value.left!==void 0?f.value.left+"px":void 0,right:f.value.right!==void 0?f.value.right+"px":void 0,top:f.value.top+"px"}),onMousedown:k[0]||(k[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(ha),H=>(t.openBlock(),t.createElementBlock("button",{key:H.key,class:"merge-picker__item",title:t.unref(b)(e.locale,H.labelKey),onClick:Y=>E(H.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:H.icon},null,8,di),t.createElementVNode("span",ui,t.toDisplayString(t.unref(b)(e.locale,H.labelKey)),1)],8,ci))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-78cf6d86"]]),mi=["title","disabled"],pi={class:"cf-menu-trigger__label"},hi=["disabled"],gi=["disabled"],bi=["disabled"],yi=["disabled"],Ci=["disabled"],wi=["disabled"],vi=["disabled"],ki=["onClick"],Ei=["disabled"],Ri=["disabled"],Si=["disabled"],Mi=["disabled"],Bi=St(t.defineComponent({__name:"conditional-format-menu",props:{locale:{},hasSelection:{type:Boolean},themeVars:{default:()=>({})}},emits:["preset","new-rule","manage","clear"],setup(e,{emit:n}){const l=n,o=t.ref(null),a=t.ref(null),i=t.ref(null),r=t.ref(null),d=t.ref(null),f=t.ref(!1),y=t.ref(null),h=t.ref("right"),u=t.ref("right"),E=t.ref({right:0,top:0,up:!1}),x=t.ref(!1),k=t.ref(!1),H=t.ref(!1),Y=t.ref(!1),ne=t.ref(!1),ee=t.ref(!1),M=t.ref({top:0}),se=t.ref({top:0});let X;const te=[{type:"equal",key:"cfEqual"},{type:"notEqual",key:"cfNotEqual"},{type:"greaterThan",key:"cfGreaterThan"},{type:"greaterThanOrEqual",key:"cfGreaterThanOrEqual"},{type:"lessThan",key:"cfLessThan"},{type:"lessThanOrEqual",key:"cfLessThanOrEqual"},{type:"between",key:"cfBetween"},{type:"notBetween",key:"cfNotBetween"},{type:"textContains",key:"cfTextContains"},{type:"textNotContains",key:"cfTextNotContains"}];function Ne(){f.value?Ve():ze()}function ze(){const K=a.value;if(!K)return;const L=K.getBoundingClientRect();f.value=!0,y.value=null,E.value={right:window.innerWidth-L.right,top:L.bottom+4,up:!1},t.nextTick(()=>{var Ie;const J=(Ie=i.value)==null?void 0:Ie.closest(".cf-menu");if(!J)return;const $=J.offsetHeight,U=window.innerHeight-L.bottom-8,de=L.top-8,Le=U<$&&de>0;let ve=Le?L.top-$-4:L.bottom+4;ve=Math.max(8,Math.min(window.innerHeight-$-8,ve)),E.value={right:window.innerWidth-L.right,top:ve,up:Le},Fe()})}function Ve(){f.value=!1,clearTimeout(X),y.value=null}function Fe(){const K=i.value;K&&(x.value=K.scrollTop>1,k.value=K.scrollTop+K.clientHeight<K.scrollHeight-1)}function je(K){const L=i.value;L&&(L.scrollTop=Math.max(0,Math.min(L.scrollHeight-L.clientHeight,L.scrollTop+K*30)))}function _e(K){const L=K==="highlight"?r.value:d.value;if(!L)return;const J=L.scrollTop>1,$=L.scrollTop+L.clientHeight<L.scrollHeight-1;K==="highlight"?(H.value=J,Y.value=$):(ne.value=J,ee.value=$)}function F(K,L){const J=K==="highlight"?r.value:d.value;J&&(J.scrollTop=Math.max(0,Math.min(J.scrollHeight-J.clientHeight,J.scrollTop+L*30)))}function I(K,L){K&&(K.scrollHeight<=K.clientHeight||(L.preventDefault(),K.scrollTop=Math.max(0,Math.min(K.scrollHeight-K.clientHeight,K.scrollTop+L.deltaY))))}function G(K){I(i.value,K),Fe()}function Ce(K){I(r.value,K),_e("highlight")}function $e(K){I(d.value,K),_e("clear")}function j(K){var J,$,U,de,Le,ve;if(!f.value)return;const L=K.target;(J=o.value)!=null&&J.contains(L)||($=i.value)!=null&&$.contains(L)||(de=(U=r.value)==null?void 0:U.closest(".cf-submenu-wrap"))!=null&&de.contains(L)||(ve=(Le=d.value)==null?void 0:Le.closest(".cf-submenu-wrap"))!=null&&ve.contains(L)||Ve()}function Be(K,L){clearTimeout(X),y.value=K,t.nextTick(()=>{var ge,et;const J=(L==null?void 0:L.currentTarget)instanceof HTMLElement?L.currentTarget:null;if(!J)return;const $=J.getBoundingClientRect(),U=K==="highlight"?(ge=r.value)==null?void 0:ge.closest(".cf-submenu-wrap"):(et=d.value)==null?void 0:et.closest(".cf-submenu-wrap");if(!U)return;const de=U.offsetWidth,Le=$.right+de+8>window.innerWidth,ve=$.left-de-8<0;let Ie="right";(Le&&!ve||Le&&ve)&&(Ie="left"),K==="highlight"?h.value=Ie:u.value=Ie;const Ee=Math.max(8,Math.min(window.innerHeight-30,$.top-4)),He=Ie==="right"?{left:$.right+4,top:Ee}:{right:window.innerWidth-$.left+4,top:Ee};K==="highlight"?M.value=He:se.value=He,_e(K)})}function Q(){clearTimeout(X),X=setTimeout(()=>{y.value=null},150)}function ke(){clearTimeout(X)}function B(K){l("preset",K),Ve()}function oe(){l("new-rule"),Ve()}function Z(){l("manage"),Ve()}function re(K){l("clear",K),Ve()}return t.onMounted(()=>{document.addEventListener("pointerdown",j),window.addEventListener("resize",Ve),window.addEventListener("scroll",Ve,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",j),window.removeEventListener("resize",Ve),window.removeEventListener("scroll",Ve,!0)}),(K,L)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:o,class:"cf-menu-root"},[t.createElementVNode("button",{ref_key:"btnRef",ref:a,type:"button",class:"toolbar-btn cf-menu-trigger",title:t.unref(b)(e.locale,"conditionalFormat"),disabled:!e.hasSelection,onClick:Ne},[L[22]||(L[22]=t.createStaticVNode('<svg class="cf-menu-trigger__icon" viewBox="0 0 1097 1024" version="1.1" fill="currentColor" data-v-7b3d8228><path d="M877.714286 52.809143V487.862857h-73.142857V125.952H73.142857v585.142857h247.661714v73.142857H0v-731.428571z" data-v-7b3d8228></path><path d="M841.142857 267.702857v73.142857H36.571429v-73.142857zM287.451429 457.142857v73.142857H36.571429v-73.142857z" data-v-7b3d8228></path><path d="M324.022857 109.714286v674.596571h-73.142857V109.714286zM584.850286 109.714286v341.942857h-73.142857V109.714286zM1060.278857 512h-658.285714v475.428571h658.285714V512z m-73.216 73.142857v329.142857h-512V585.142857h512z" data-v-7b3d8228></path><path d="M877.421714 637.952v73.142857H568.539429v-73.142857zM877.421714 784.237714v73.142857H568.539429v-73.142857z" data-v-7b3d8228></path></svg>',1)),t.createElementVNode("span",pi,t.toDisplayString(t.unref(b)(e.locale,"conditionalFormat")),1),L[23]||(L[23]=t.createElementVNode("svg",{class:"cf-menu-trigger__caret",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1))],8,mi),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-pop"},{default:t.withCtx(()=>[f.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-menu",style:t.normalizeStyle({...e.themeVars,right:E.value.right+"px",top:E.value.top+"px"}),onClick:L[8]||(L[8]=t.withModifiers(()=>{},["stop"])),onMousedown:L[9]||(L[9]=t.withModifiers(()=>{},["prevent"]))},[x.value||k.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!x.value}]),disabled:!x.value,onClick:L[0]||(L[0]=J=>je(-1))},[...L[24]||(L[24]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,hi)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"menuRef",ref:i,class:"cf-menu__body",onScroll:Fe,onWheelPassive:G},[t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:L[1]||(L[1]=J=>Be("highlight",J)),onMouseleave:Q},[t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"cfHighlightRules")),1),L[25]||(L[25]=t.createElementVNode("svg",{class:"cf-menu__arrow",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M361.387 180.053a32 32 0 0 0 0 45.227L648.107 512l-286.72 286.72a32 32 0 1 0 45.227 45.227l309.333-309.334a32 32 0 0 0 0-45.226L406.613 180.053a32 32 0 0 0-45.226 0z"})],-1))],32),L[27]||(L[27]=t.createElementVNode("div",{class:"cf-menu__sep"},null,-1)),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:L[2]||(L[2]=J=>e.hasSelection&&B("blank"))},t.toDisplayString(t.unref(b)(e.locale,"cfBlank")),11,gi),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:L[3]||(L[3]=J=>e.hasSelection&&B("notBlank"))},t.toDisplayString(t.unref(b)(e.locale,"cfNotBlank")),11,bi),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:L[4]||(L[4]=J=>e.hasSelection&&B("duplicate"))},t.toDisplayString(t.unref(b)(e.locale,"cfDuplicate")),11,yi),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:L[5]||(L[5]=J=>e.hasSelection&&B("unique"))},t.toDisplayString(t.unref(b)(e.locale,"cfUnique")),11,Ci),L[28]||(L[28]=t.createElementVNode("div",{class:"cf-menu__sep"},null,-1)),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:oe},t.toDisplayString(t.unref(b)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:Z},t.toDisplayString(t.unref(b)(e.locale,"cfManageRules")),1),t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:L[6]||(L[6]=J=>Be("clear",J)),onMouseleave:Q},[t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"cfClearRules")),1),L[26]||(L[26]=t.createElementVNode("svg",{class:"cf-menu__arrow",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M361.387 180.053a32 32 0 0 0 0 45.227L648.107 512l-286.72 286.72a32 32 0 1 0 45.227 45.227l309.333-309.334a32 32 0 0 0 0-45.226L406.613 180.053a32 32 0 0 0-45.226 0z"})],-1))],32)],544),x.value||k.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!k.value}]),disabled:!k.value,onClick:L[7]||(L[7]=J=>je(1))},[...L[29]||(L[29]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,wi)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-sub-pop"},{default:t.withCtx(()=>[f.value&&y.value==="highlight"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":h.value==="left"}]),style:t.normalizeStyle({...e.themeVars,left:M.value.left!==void 0?M.value.left+"px":void 0,right:M.value.right!==void 0?M.value.right+"px":void 0,top:M.value.top+"px"}),onClick:L[13]||(L[13]=t.withModifiers(()=>{},["stop"])),onMousedown:L[14]||(L[14]=t.withModifiers(()=>{},["prevent"])),onMouseenter:ke,onMouseleave:Q},[H.value||Y.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!H.value}]),disabled:!H.value,onClick:L[10]||(L[10]=J=>F("highlight",-1))},[...L[30]||(L[30]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,vi)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"highlightSubRef",ref:r,class:"cf-submenu",onScroll:L[11]||(L[11]=J=>_e("highlight")),onWheelPassive:Ce},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(te,J=>t.createElementVNode("button",{key:J.type,type:"button",class:"cf-menu__subitem",onClick:$=>B(J.type)},t.toDisplayString(t.unref(b)(e.locale,J.key)),9,ki)),64))],544),H.value||Y.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!Y.value}]),disabled:!Y.value,onClick:L[12]||(L[12]=J=>F("highlight",1))},[...L[31]||(L[31]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,Ei)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-sub-pop"},{default:t.withCtx(()=>[f.value&&y.value==="clear"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":u.value==="left"}]),style:t.normalizeStyle({...e.themeVars,left:se.value.left!==void 0?se.value.left+"px":void 0,right:se.value.right!==void 0?se.value.right+"px":void 0,top:se.value.top+"px"}),onClick:L[20]||(L[20]=t.withModifiers(()=>{},["stop"])),onMousedown:L[21]||(L[21]=t.withModifiers(()=>{},["prevent"])),onMouseenter:ke,onMouseleave:Q},[ne.value||ee.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!ne.value}]),disabled:!ne.value,onClick:L[15]||(L[15]=J=>F("clear",-1))},[...L[32]||(L[32]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,Ri)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"clearSubRef",ref:d,class:"cf-submenu",onScroll:L[18]||(L[18]=J=>_e("clear")),onWheelPassive:$e},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__subitem",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:L[16]||(L[16]=J=>e.hasSelection&&re("selection"))},t.toDisplayString(t.unref(b)(e.locale,"cfClearSelected")),11,Si),t.createElementVNode("button",{type:"button",class:"cf-menu__subitem",onClick:L[17]||(L[17]=J=>re("sheet"))},t.toDisplayString(t.unref(b)(e.locale,"cfClearSheet")),1)],544),ne.value||ee.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!ee.value}]),disabled:!ee.value,onClick:L[19]||(L[19]=J=>F("clear",1))},[...L[33]||(L[33]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,Mi)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-7b3d8228"]]),Ti=["disabled","title","onClick"],Ni={class:"calc-picker__label"},xi=St(t.defineComponent({__name:"calc-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},disabled:{type:Boolean,default:!1}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:l}){const o=e,a=l,i=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),d=t.ref(null),f=t.ref(null),y=t.ref({top:0});t.watch(()=>o.modelOpen,k=>{k!==void 0&&k!==r.value&&(k?u():E())});function h(k){const H=d.value,Y=f.value,ne=k.target;H&&H.contains(ne)||Y&&Y.contains(ne)||E()}function u(){const k=o.triggerEl??d.value;if(!k)return;r.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0);const H=k.getBoundingClientRect();let Y=window.innerWidth-H.right;const ne=160;let ee;H.left-ne<4&&(Y=void 0,ee=Math.max(4,H.left)),y.value=Y!==void 0?{right:Y,top:H.bottom+4}:{left:ee,top:H.bottom+4},t.nextTick(()=>{const M=o.triggerEl??d.value;if(!M)return;const se=M.getBoundingClientRect(),X=f.value;if(!X)return;const te=X.offsetHeight,Ne=window.innerHeight-se.bottom-8,ze=se.top-8;let Fe=Ne<te&&ze>0?se.top-te-4:se.bottom+4;Fe=Math.max(4,Math.min(window.innerHeight-te-4,Fe)),y.value=Y!==void 0?{right:window.innerWidth-se.right,top:Fe}:{left:ee,top:Fe},document.addEventListener("pointerdown",h)})}function E(){r.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",h)}function x(k){o.disabled||(a("change",k),E())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",h)}),n({open:r,openMenu:u,close:E}),(k,H)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:d,class:"calc-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:f,class:"calc-picker__menu",style:t.normalizeStyle({left:y.value.left!==void 0?y.value.left+"px":void 0,right:y.value.right!==void 0?y.value.right+"px":void 0,top:y.value.top+"px"}),onMousedown:H[0]||(H[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,Y=>t.createElementVNode("button",{key:Y.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(b)(e.locale,Y.labelKey),onClick:ne=>x(Y.key)},[t.createElementVNode("span",Ni,t.toDisplayString(t.unref(b)(e.locale,Y.labelKey)),1)],10,Ti)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-d9e95ea2"]]),Di={class:"tb-item","data-key":"undo"},Vi=["title","disabled"],Fi={class:"toolbar-btn__label"},Ii={class:"tb-item","data-key":"redo"},Ai=["title","disabled"],_i={class:"toolbar-btn__label"},Li={class:"tb-item","data-key":"paint"},Oi=["title","disabled"],$i={class:"toolbar-btn__label"},Hi={class:"tb-item","data-key":"clear"},zi=["title","disabled"],Wi={class:"toolbar-btn__label"},Pi={class:"tb-item","data-key":"font"},Ui={class:"tb-item","data-key":"fontSize"},Ki={class:"toolbar-font-size"},Gi=["value","title"],qi=["title"],Yi=["title","disabled"],Xi=["title","disabled"],ji={class:"tb-item","data-key":"bold"},Zi=["title","disabled"],Ji={class:"toolbar-btn__label"},Qi={class:"tb-item","data-key":"italic"},es=["title","disabled"],ts={class:"toolbar-btn__label"},ls={class:"tb-item","data-key":"underline"},ns=["title","disabled"],os={class:"toolbar-btn__label"},rs={class:"tb-item","data-key":"strike"},as=["title","disabled"],is={class:"toolbar-btn__label"},ss={class:"tb-item","data-key":"textColor"},cs={class:"toolbar-split"},ds=["title","disabled"],us={viewBox:"0 0 1024 1024",fill:"currentColor"},fs=["fill"],ms={class:"toolbar-btn__label"},ps=["title","disabled"],hs={class:"tb-item","data-key":"fillColor"},gs={class:"toolbar-split"},bs=["title","disabled"],ys={viewBox:"0 0 1024 1024",fill:"currentColor"},Cs=["fill"],ws={class:"toolbar-btn__label"},vs=["title","disabled"],ks={class:"tb-item","data-key":"border"},Es={class:"toolbar-split"},Rs=["title","disabled"],Ss={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},Ms=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Bs={class:"toolbar-btn__label"},Ts=["title","disabled"],Ns={class:"tb-item","data-key":"hAlign"},xs={class:"tb-item","data-key":"vAlign"},Ds={class:"tb-item","data-key":"wrap"},Vs=["title"],Fs={class:"toolbar-btn__label"},Is={class:"tb-item","data-key":"merge"},As={class:"toolbar-split"},_s=["title","disabled"],Ls={class:"toolbar-btn__label"},Os=["title","disabled"],$s={class:"tb-item","data-key":"numFmt"},Hs={class:"toolbar-number-format-group"},zs=["title","disabled"],Ws=["title","disabled"],Ps={class:"tb-item","data-key":"calc"},Us={class:"toolbar-split"},Ks=["title","disabled"],Gs={class:"toolbar-btn__label"},qs=["title","disabled"],Ys={class:"tb-item","data-key":"sort"},Xs={class:"toolbar-split"},js=["title","disabled"],Zs={viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},Js=["x1","y1","x2","y2"],Qs=["d"],ec={class:"toolbar-btn__label"},tc=["title","disabled"],lc={class:"tb-item","data-key":"filter"},nc=["disabled","title"],oc={class:"toolbar-btn__label"},rc={class:"tb-item","data-key":"freeze"},ac={class:"tb-item","data-key":"cf"},ic={class:"tb-item","data-key":"dv"},sc=["title"],cc={class:"toolbar-btn__label"},dc={class:"tb-item","data-key":"find"},uc=["title"],fc={class:"toolbar-btn__label"},mc=["disabled"],pc=["disabled"],fr='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M160 448 H864" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M448 160 V864" /><path d="M192 192 H416 V416 H192 Z" /></svg>',hc='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M160 448 H864" /><path d="M192 192 H832 V416 H192 Z" /></svg>',gc='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M448 160 V864" /><path d="M192 192 H416 V832 H192 Z" /></svg>',bc='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M160 448 H864" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M448 160 V864" /><path fill="none" stroke="currentColor" stroke-width="48" stroke-linecap="round" d="M224 224 L416 416" /><path fill="none" stroke="currentColor" stroke-width="48" stroke-linecap="round" d="M416 224 L224 416" /></svg>',Mo=2,yc=6,Cc=34,wc=St(t.defineComponent({__name:"toolbar",props:{locale:{},canUndo:{type:Boolean},canRedo:{type:Boolean},paintFmtActive:{type:Boolean},hasSelection:{type:Boolean},fontFamilyOptions:{},fontSizeOptions:{},selFontFamily:{},selFontSize:{},fontSizeInput:{},fontSizeMenuOpen:{type:Boolean},selFontWeight:{type:Boolean},selFontStyle:{type:Boolean},selUnderline:{type:Boolean},selStrikethrough:{type:Boolean},selTextColor:{},textColorMenuOpen:{type:Boolean},selFillColor:{},fillColorMenuOpen:{type:Boolean},cachedTextColor:{},cachedFillColor:{},borderMenuOpen:{type:Boolean},cachedBorder:{},sortMenuOpen:{type:Boolean},cachedSortOrder:{},canSort:{type:Boolean},canFilter:{type:Boolean},filterActive:{type:Boolean},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},calcMenuOpen:{type:Boolean},isSingleCell:{type:Boolean},hasFreeze:{type:Boolean},freezePanesDisabled:{type:Boolean},themeVars:{},selNumberFormat:{},nfOptions:{},canIncreaseDecimals:{type:Boolean},canDecreaseDecimals:{type:Boolean}},emits:["undo","redo","paint-format","clear-format","font-size-blur","font-size-toggle","font-size-step-up","font-size-step-down","bold-toggle","italic-toggle","underline-toggle","strikethrough-toggle","apply-text-color","apply-fill-color","apply-border","apply-sort","wrap-toggle","apply-merge","calc-sum","calc-avg","calc-count","find","increase-decimals","decrease-decimals","toggle-filter","cf-new-rule","cf-manage","open-data-validation","font-family-change","font-size-change","h-align-change","v-align-change","font-size-input","text-color-change","fill-color-change","number-format-change","freeze-change","cf-preset","font-size-keydown","update:font-size-menu-open","update:text-color-menu-open","update:fill-color-menu-open","update:border-menu-open","update:sort-menu-open","update:merge-menu-open","update:calc-menu-open","border-change","sort-change","merge-change","cf-clear"],setup(e,{expose:n,emit:l}){const o=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],a={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},i={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function r(Pe,N){return i[Pe].includes(N)?"thick":a[Pe].includes(N)?"solid":"dashed"}const d={none:"borderNone",bottom:"borderBottom",top:"borderTop",left:"borderLeft",right:"borderRight",all:"borderAll",outer:"borderOuter",thickOuter:"borderThickOuter"},f=[{name:"bar1",x1:96,y1:224,x2:352,y2:224},{name:"bar2",x1:96,y1:512,x2:512,y2:512},{name:"bar3",x1:96,y1:800,x2:672,y2:800}],y={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},h=["undo","redo","paint","clear","sep1","font","fontSize","sep2","bold","italic","underline","strike","sep3","textColor","fillColor","border","sep4","hAlign","vAlign","wrap","merge","sep6","numFmt","sep7","calc","sort","filter","freeze","cf","dv","find"],u=t.ref(null),E=t.ref(null),x=t.ref(null),k=t.ref(null),H=t.ref(null),Y=t.ref(null),ne=t.ref(null),ee=t.ref(null),M=t.ref(null),se=t.ref(null),X=t.ref(new Set),te=t.ref(!1),Ne=t.ref(!1),ze=t.ref(0),Ve=t.ref(!1),Fe=t.ref(!1),je=t.ref(!1),_e=new Map,F=t.computed(()=>X.value.size>0);function I(Pe){return X.value.has(Pe)}const G=t.computed(()=>{const Pe=E.value;return Pe instanceof HTMLElement?Pe:void 0});function Ce(Pe){return G.value?!I(Pe):!0}function $e(){for(const Pe of h){const N=_e.get(Pe);if(N===void 0||N===0)return!0}return!1}function j(){if(!u.value)return;u.value.querySelectorAll(".tb-item").forEach(N=>{const ie=N.dataset.key;if(!ie)return;const Rt=N.offsetWidth;Rt>0?_e.set(ie,Rt):_e.has(ie)||_e.set(ie,0)})}function Be(Pe,N){if(Pe.size!==N.size)return!1;for(const ie of Pe)if(!N.has(ie))return!1;return!0}let Q=0,ke=0;function B(){Q&&cancelAnimationFrame(Q),!(ke>60)&&(ke++,Q=requestAnimationFrame(()=>requestAnimationFrame(oe)))}function oe(){if(!u.value)return;const Pe=u.value.clientWidth-yc*2;if(Pe<=0){B();return}ke=0,(_e.size===0||$e())&&j();let N=0;for(const Rt of h)N+=(_e.get(Rt)??0)+Mo;const ie=new Set;if(N>Pe){const Rt=Pe-Cc-Mo;let ft=0;for(let Mt=0;Mt<h.length;Mt++){const Ft=h[Mt],It=(_e.get(Ft)??0)+Mo;if(ft+It>Rt){for(let Ot=Mt;Ot<h.length;Ot++)ie.add(h[Ot]);break}ft+=It}}Be(ie,X.value)||(X.value=ie,ze.value++,ie.size===0&&(te.value=!1)),je.value=!0}let Z=null;const re=t.ref(0),K=t.computed(()=>{const Pe=x.value,N={position:"fixed",top:"0px",right:"0px"};if(!Pe)return{...He.themeVars,...N};re.value;const ie=Pe.getBoundingClientRect();return{...He.themeVars,position:"fixed",top:`${ie.bottom+4}px`,right:`${window.innerWidth-ie.right}px`}});function L(){te.value&&(re.value++,t.nextTick(()=>oe()))}function J(Pe){var ie,Rt,ft;if(!te.value)return;const N=Pe.target;(ie=N.closest)!=null&&ie.call(N,".overflow-menu-wrap")||(Rt=x.value)!=null&&Rt.contains(N)||(ft=N.closest)!=null&&ft.call(N,".cf-menu, .sp-dropdown__menu, .color-picker__menu")||(Ne.value=!0,te.value=!1,t.nextTick(()=>{Ne.value=!1}))}function $(){te.value=!te.value,te.value&&t.nextTick(Ie)}function U(){te.value=!1,ge("open-data-validation")}function de(){te.value=!1,ge("find")}function Le(){te.value=!1,ge("toggle-filter")}function ve(){te.value=!1}function Ie(){const Pe=E.value;Pe&&(Ve.value=Pe.scrollTop>1,Fe.value=Pe.scrollTop+Pe.clientHeight<Pe.scrollHeight-1)}function Ee(Pe){const N=E.value;N&&(N.scrollTop=Math.max(0,Math.min(N.scrollHeight-N.clientHeight,N.scrollTop+Pe*40)))}n({closeOverflow:ve}),t.onMounted(()=>{B(),u.value&&(Z=new ResizeObserver(()=>{te.value||B()}),Z.observe(u.value)),document.addEventListener("pointerdown",J,!0),window.addEventListener("resize",L),window.addEventListener("load",B),window.addEventListener("orientationchange",B)}),t.onBeforeUnmount(()=>{Q&&cancelAnimationFrame(Q),Z==null||Z.disconnect(),document.removeEventListener("pointerdown",J,!0),window.removeEventListener("resize",L),window.removeEventListener("load",B),window.removeEventListener("orientationchange",B)});const He=e,ge=l,et=t.computed(()=>He.selNumberFormat===Tl?b(He.locale,"nfMixed"):""),ut=t.computed(()=>{const Pe=[{label:b(He.locale,"freezeFirstRow"),value:"firstRow",icon:hc},{label:b(He.locale,"freezeFirstCol"),value:"firstCol",icon:gc}];return He.hasFreeze?Pe.unshift({label:b(He.locale,"unfreezePanes"),value:"unfreeze",icon:bc}):Pe.unshift({label:b(He.locale,"freezePanes"),value:"panes",icon:fr,disabled:He.freezePanesDisabled}),Pe});return(Pe,N)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:u,class:t.normalizeClass(["toolbar",{"toolbar--ready":je.value}]),onMousedown:N[56]||(N[56]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("undo"),to:G.value},[t.createElementVNode("div",Di,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(b)(e.locale,"undo"),disabled:!e.canUndo,onClick:N[0]||(N[0]=ie=>ge("undo"))},[N[60]||(N[60]=t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272"})],-1)),t.createElementVNode("span",Fi,t.toDisplayString(t.unref(b)(e.locale,"undo")),1)],10,Vi)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("redo"),to:G.value},[t.createElementVNode("div",Ii,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(b)(e.locale,"redo"),disabled:!e.canRedo,onClick:N[1]||(N[1]=ie=>ge("redo"))},[N[61]||(N[61]=t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{transform:"translate(1024, 0) scale(-1, 1)",d:"M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272"})],-1)),t.createElementVNode("span",_i,t.toDisplayString(t.unref(b)(e.locale,"redo")),1)],10,Ai)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("paint"),to:G.value},[t.createElementVNode("div",Li,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(b)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:N[2]||(N[2]=ie=>ge("paint-format"))},[N[62]||(N[62]=t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M722.285714 438.857143a36.571429 36.571429 0 0 1-36.571428 36.571428h-512a36.571429 36.571429 0 0 1-36.571429-36.571428V164.571429a36.571429 36.571429 0 0 1 36.571429-36.571429h512a36.571429 36.571429 0 0 1 36.571428 36.571429V256h128a36.571429 36.571429 0 0 1 36.571429 36.571429v294.4a36.571429 36.571429 0 0 1-31.890286 36.278857L448 675.766857V859.428571a36.571429 36.571429 0 0 1-32.292571 36.315429l-4.278858 0.256a36.571429 36.571429 0 0 1-36.571428-36.571429v-215.771428a36.571429 36.571429 0 0 1 31.890286-36.278857l406.966857-52.553143V329.142857h-91.428572v109.714286z m-73.142857-237.714286h-438.857143V402.285714h438.857143V201.142857z"})],-1)),t.createElementVNode("span",$i,t.toDisplayString(t.unref(b)(e.locale,"paintFormat")),1)],10,Oi)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("clear"),to:G.value},[t.createElementVNode("div",Hi,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(b)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:N[3]||(N[3]=ie=>ge("clear-format"))},[N[63]||(N[63]=t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M672.748 105.674c-3.666-3.799-8.778-5.949-14.125-5.949-5.341 0-10.459 2.15-14.119 5.949L10.418 754.633c-7.789 8.163-7.789 20.798 0 28.967l123.353 126.213c7.782 7.979 23.113 14.461 34.111 14.461h395.042c12.774-0.742 24.882-5.854 34.162-14.461l416.525-426.362c7.751-8.163 7.751-20.76 0-28.916l-340.92-348.861h0.057zM557.85 832.801c-9.273 8.582-21.343 13.707-34.111 14.461H217.888c-12.781-0.742-24.882-5.867-34.162-14.461l-58.074-59.482c-7.782-8.163-7.782-20.804 0-28.967l232.333-237.87c3.666-3.799 8.778-5.949 14.125-5.949s10.453 2.15 14.119 5.949l231.102 236.551c7.744 8.157 7.744 20.753 0 28.916l-59.539 60.909 0.058-0.057z m0 0"})],-1)),t.createElementVNode("span",Wi,t.toDisplayString(t.unref(b)(e.locale,"clearFormat")),1)],10,zi)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep1"),to:G.value},[N[64]||(N[64]=t.createElementVNode("div",{class:"tb-item","data-key":"sep1"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("font"),to:G.value},[t.createElementVNode("div",Pi,[t.createVNode(Dt,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:I("font")?"100%":110,"menu-width":I("font")?120:void 0,"visible-count":8,title:t.unref(b)(e.locale,"fontFamily"),align:"right",onChange:N[4]||(N[4]=ie=>ge("font-family-change",ie))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("fontSize"),to:G.value},[t.createElementVNode("div",Ui,[t.createElementVNode("div",Ki,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(b)(e.locale,"fontSize"),onMousedown:N[5]||(N[5]=t.withModifiers(()=>{},["stop"])),onInput:N[6]||(N[6]=ie=>ge("font-size-input",ie.target.value)),onBlur:N[7]||(N[7]=ie=>ge("font-size-blur")),onKeydown:N[8]||(N[8]=ie=>ge("font-size-keydown",ie))},null,40,Gi),t.createVNode(Dt,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:I("fontSize")?"100%":56,"menu-width":I("fontSize")?120:56,"visible-count":9,title:t.unref(b)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":se.value,"onUpdate:modelOpen":N[9]||(N[9]=ie=>ge("update:font-size-menu-open",ie)),onChange:N[10]||(N[10]=ie=>ge("font-size-change",ie))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:se,class:"toolbar-font-size__btn",type:"button",title:t.unref(b)(e.locale,"fontSize"),onMousedown:N[11]||(N[11]=t.withModifiers(()=>{},["prevent"])),onClick:N[12]||(N[12]=ie=>ge("font-size-toggle"))},[...N[65]||(N[65]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],40,qi),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(b)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:N[13]||(N[13]=t.withModifiers(()=>{},["prevent"])),onClick:N[14]||(N[14]=ie=>ge("font-size-step-down"))},[...N[66]||(N[66]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M675.2 184.533333h260.266667a12.8 12.8 0 0 1 12.8 12.8v21.333334a12.8 12.8 0 0 1-12.8 12.8H675.2a12.8 12.8 0 0 1-12.8-12.8v-21.333334a12.8 12.8 0 0 1 12.8-12.8zM687.744 739.413333l87.722667 197.717334a12.8 12.8 0 0 0 11.733333 7.594666h54.016a12.8 12.8 0 0 0 11.605333-18.133333l-7.466666-16.213333-131.2-287.829334-35.413334-77.653333-166.570666-365.525333a36.266667 36.266667 0 0 0-66.432 0.938666l-154.154667 365.482667-34.688 82.261333-34.688 82.218667-84.778667 201.045333-6.570666 15.658667a12.8 12.8 0 0 0 11.776 17.749333h57.557333a12.8 12.8 0 0 0 11.904-8.106666l102.4-258.474667 343.466667-4.010667 29.781333 65.28zM480.426667 284.672l132.352 290.261333 12.288 27.050667-279.808 3.242667 13.184-31.232 122.026666-289.28z"})],-1)])],40,Yi),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(b)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:N[15]||(N[15]=t.withModifiers(()=>{},["prevent"])),onClick:N[16]||(N[16]=ie=>ge("font-size-step-up"))},[...N[67]||(N[67]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M769.066667 77.952v93.781333h-93.866667a12.8 12.8 0 0 0-12.8 12.8v46.933334a12.8 12.8 0 0 0 12.8 12.8h93.866667v93.952a12.8 12.8 0 0 0 12.8 12.8h46.933333a12.8 12.8 0 0 0 12.8-12.8V244.266667h93.866667a12.8 12.8 0 0 0 12.8-12.8v-46.933334a12.8 12.8 0 0 0-12.8-12.8h-93.866667V77.952a12.8 12.8 0 0 0-12.8-12.8h-46.933333a12.8 12.8 0 0 0-12.8 12.8zM687.744 739.413333l87.722667 197.717334a12.8 12.8 0 0 0 11.733333 7.594666h54.016a12.8 12.8 0 0 0 11.605333-18.133333l-7.466666-16.213333-131.2-287.829334-35.413334-77.653333-166.570666-365.525333a36.266667 36.266667 0 0 0-66.432 0.938666l-154.154667 365.482667-34.688 82.261333-34.688 82.218667-84.778667 201.045333-6.570666 15.658667a12.8 12.8 0 0 0 11.776 17.749333h57.557333a12.8 12.8 0 0 0 11.904-8.106666l102.4-258.474667 343.466667-4.010667 29.781333 65.28zM480.426667 284.672l132.352 290.261333 12.288 27.050667-279.808 3.242667 13.184-31.232 122.026666-289.28z"})],-1)])],40,Xi)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep2"),to:G.value},[N[68]||(N[68]=t.createElementVNode("div",{class:"tb-item","data-key":"sep2"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("bold"),to:G.value},[t.createElementVNode("div",ji,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(b)(e.locale,"bold"),disabled:!e.hasSelection,onClick:N[17]||(N[17]=ie=>ge("bold-toggle"))},[N[69]||(N[69]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M214.857 889.143v-68.571h68.571V203.429H214.857v-68.571h411.429v1.257c96.114 10.629 171.429 87.383 171.429 181.6 0 58.971-29.486 111.086-75.109 144.457 72.069 39.291 120.823 113.234 120.823 198.4 0 119.291-95.634 216.594-217.12 227.543l-0.286.029H214.857z m388.572-388.571H352v320h251.429c95.086 0 171.429-72.091 171.429-160s-76.343-160-171.429-160z m0-297.143H352v228.571h251.429l5.211-0.091c67.52-2.515 120.503-53.235 120.503-114.195 0-62.537-55.749-114.285-125.714-114.285z"})],-1)),t.createElementVNode("span",Ji,t.toDisplayString(t.unref(b)(e.locale,"bold")),1)],10,Zi)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("italic"),to:G.value},[t.createElementVNode("div",Qi,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(b)(e.locale,"italic"),disabled:!e.hasSelection,onClick:N[18]||(N[18]=ie=>ge("italic-toggle"))},[N[70]||(N[70]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M730.143 127.714v64.286h-112.329l-166.521 621.429h128.871v64.286H276.286v-64.286h108.45l166.5-621.429H426.286V127.714h303.857z"})],-1)),t.createElementVNode("span",ts,t.toDisplayString(t.unref(b)(e.locale,"italic")),1)],10,es)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("underline"),to:G.value},[t.createElementVNode("div",ls,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(b)(e.locale,"underline"),disabled:!e.hasSelection,onClick:N[19]||(N[19]=ie=>ge("underline-toggle"))},[N[71]||(N[71]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 123.639a36.409 36.409 0 0 1 33.642 22.525l230.59 558.27a36.409 36.409 0 1 1-67.284 27.768L638.072 560.545H385.928l-70.876 171.656a36.409 36.409 0 1 1-67.332-27.768l230.59-558.27A36.409 36.409 0 0 1 512 123.639z m-95.974 364.089h191.948L512 255.439l-95.974 232.289zM769.289 827.544c19.418 0 38.836 14.564 38.836 38.836 0 19.418-14.564 33.982-29.127 33.982H259.565c-19.418 0-38.836-14.564-38.836-38.836 0-19.418 14.564-33.982 29.127-33.982h519.433z"})],-1)),t.createElementVNode("span",os,t.toDisplayString(t.unref(b)(e.locale,"underline")),1)],10,ns)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("strike"),to:G.value},[t.createElementVNode("div",rs,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(b)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:N[20]||(N[20]=ie=>ge("strikethrough-toggle"))},[N[72]||(N[72]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M182.044 490.667h659.911a34.133 34.133 0 0 1 4.642 67.948l-4.597 0.319h-135.395c40.05 37 60.803 81.601 60.803 133.575 0 128.569-147.092 211.171-307.382 192.512-101.717-11.833-173.352-52.565-210.944-122.971a34.133 34.133 0 0 1 60.211-32.176c25.942 48.606 77.46 77.915 158.606 87.381 124.837 14.473 231.242-45.283 231.242-124.746 0-53.339-36.636-96.802-116.736-131.345l-5.279-2.23H182.044a34.133 34.133 0 0 1-33.815-29.492L147.911 524.8a34.133 34.133 0 0 1 29.491-33.815l4.642-0.318z m68.767-176.447c6.918-128.796 128.432-203.343 287.812-184.82 99.579 11.56 175.81 47.923 226.737 109.636a34.133 34.133 0 1 1-52.657 43.463c-38.775-47.013-98.759-75.639-181.999-85.288-123.654-14.381-211.627 36.591-211.627 117.009 0 35.135 10.65 61.349 37.774 90.203l5.826 6.007c4.278 4.369 8.966 8.875 11.377 10.923l1.411 0.91H288.085l-1.092-1.729c-6.508-9.376-38.958-54.386-36.182-106.314z"})],-1)),t.createElementVNode("span",is,t.toDisplayString(t.unref(b)(e.locale,"strikethrough")),1)],10,as)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep3"),to:G.value},[N[73]||(N[73]=t.createElementVNode("div",{class:"tb-item","data-key":"sep3"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("textColor"),to:G.value},[t.createElementVNode("div",ss,[t.createElementVNode("div",cs,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:N[21]||(N[21]=ie=>ge("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",us,[N[74]||(N[74]=t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M663.120842 529.946947H364.759579l-84.07579 212.884211a53.894737 53.894737 0 0 1-50.122105 34.169263h-14.551579a34.869895 34.869895 0 0 1-32.498526-47.696842L443.715368 70.063158a53.894737 53.894737 0 0 1 50.122106-34.115369h41.768421a53.894737 53.894737 0 0 1 50.176 34.277053l257.670737 659.078737a34.977684 34.977684 0 0 1-32.552421 47.696842h-14.389895a53.894737 53.894737 0 0 1-50.229895-34.277053l-83.159579-212.776421z m-35.139368-89.788631l-113.340632-289.953684-114.472421 289.953684h227.813053z"})],-1)),t.createElementVNode("path",{d:"M62.895 844.369m53.895 0l790.474 0q53.895 0 53.895 53.895l0 26.947q0 53.895-53.895 53.895l-790.474 0q-53.895 0-53.895-53.895l0-26.947q0-53.895 53.895-53.895z",fill:e.cachedTextColor||"#000000"},null,8,fs)])),t.createElementVNode("span",ms,t.toDisplayString(t.unref(b)(e.locale,"fontColor")),1)],8,ds),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:k,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:N[22]||(N[22]=ie=>ge("update:text-color-menu-open",!e.textColorMenuOpen))},[...N[75]||(N[75]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,ps),t.createVNode(Yn,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":k.value,"onUpdate:modelOpen":N[23]||(N[23]=ie=>ge("update:text-color-menu-open",ie)),onChange:N[24]||(N[24]=ie=>ge("text-color-change",ie))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("fillColor"),to:G.value},[t.createElementVNode("div",hs,[t.createElementVNode("div",gs,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:N[25]||(N[25]=ie=>ge("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",ys,[N[76]||(N[76]=t.createElementVNode("path",{d:"M447.018667 37.952l352.298666 352.298667c6.613333 6.613333 6.613333 17.344 0 23.957333L446.101333 767.424a16.938667 16.938667 0 0 1-23.957333 0L121.429333 466.688a16.938667 16.938667 0 0 1 0-23.957333L428.608 135.552 388.992 96a8.469333 8.469333 0 0 1 0-11.989333l46.058667-46.037334a8.469333 8.469333 0 0 1 11.968 0z m346.325333 517.461333l57.514667 60.074667c31.744 33.194667 31.744 86.997333 0 120.192a78.869333 78.869333 0 0 1-115.008 0c-31.765333-33.194667-31.765333-86.997333 0-120.192l57.493333-60.074667zM486.101333 193.066667l-261.12 261.12 20.458667 20.458666 380.16-1.728 70.186667-70.186666-209.706667-209.664z"},null,-1)),t.createElementVNode("path",{d:"M85.333333 853.333333m8.896 0l835.541334 0q8.896 0 8.896 8.896l0 110.208q0 8.896-8.896 8.896l-835.541334 0q-8.896 0-8.896-8.896l0-110.208q0-8.896 8.896-8.896Z",fill:e.cachedFillColor||"currentColor"},null,8,Cs)])),t.createElementVNode("span",ws,t.toDisplayString(t.unref(b)(e.locale,"fillColor")),1)],8,bs),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:H,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:N[26]||(N[26]=ie=>ge("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...N[77]||(N[77]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,vs),t.createVNode(Yn,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":H.value,"onUpdate:modelOpen":N[27]||(N[27]=ie=>ge("update:fill-color-menu-open",ie)),onChange:N[28]||(N[28]=ie=>ge("fill-color-change",ie))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("border"),to:G.value},[t.createElementVNode("div",ks,[t.createElementVNode("div",Es,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"borders"),disabled:!e.hasSelection,onClick:N[29]||(N[29]=ie=>ge("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",Ss,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(o,ie=>t.createElementVNode("line",{key:ie.name,x1:ie.x1,y1:ie.y1,x2:ie.x2,y2:ie.y2,"stroke-width":r(e.cachedBorder,ie.name)==="thick"?3:1.5,"stroke-dasharray":r(e.cachedBorder,ie.name)==="dashed"?"0 4":"none","stroke-linecap":r(e.cachedBorder,ie.name)==="dashed"?"round":"square"},null,8,Ms)),64))])),t.createElementVNode("span",Bs,t.toDisplayString(t.unref(b)(e.locale,d[e.cachedBorder]??"borders")),1)],8,Rs),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:Y,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"borders"),disabled:!e.hasSelection,onClick:N[30]||(N[30]=ie=>ge("update:border-menu-open",!e.borderMenuOpen))},[...N[78]||(N[78]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Ts),t.createVNode(li,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":Y.value,"onUpdate:modelOpen":N[31]||(N[31]=ie=>ge("update:border-menu-open",ie)),onChange:N[32]||(N[32]=ie=>ge("border-change",ie))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep4"),to:G.value},[N[79]||(N[79]=t.createElementVNode("div",{class:"tb-item","data-key":"sep4"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("hAlign"),to:G.value},[t.createElementVNode("div",Ns,[t.createVNode(Dt,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:I("hAlign")?"100%":44,"menu-width":I("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(b)(e.locale,"hAlign"),onChange:N[33]||(N[33]=ie=>ge("h-align-change",ie))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("vAlign"),to:G.value},[t.createElementVNode("div",xs,[t.createVNode(Dt,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:I("vAlign")?"100%":44,"menu-width":I("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(b)(e.locale,"vAlign"),onChange:N[34]||(N[34]=ie=>ge("v-align-change",ie))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",Ds,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(b)(e.locale,"wrap"),onClick:N[35]||(N[35]=ie=>ge("wrap-toggle"))},[N[80]||(N[80]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M896 179.2a38.4 38.4 0 0 0-76.8 0v665.6a38.4 38.4 0 0 0 76.8 0v-665.6zM204.8 281.6A38.4 38.4 0 0 0 204.8 358.4h179.2a38.4 38.4 0 0 0 0-76.8H204.8zM550.4 281.6a38.4 38.4 0 0 0 0 76.8h51.2c35.328 0 64 28.672 64 64v179.2c0 35.328-28.672 64-64 64H246.272l36.864-36.864a38.4 38.4 0 1 0-54.272-54.272l-102.4 102.4a38.4 38.4 0 0 0 0 54.272l102.4 102.4a38.4 38.4 0 0 0 54.272-54.272l-36.864-36.864h355.328a140.8 140.8 0 0 0 140.8-140.8v-179.2a140.8 140.8 0 0 0-140.8-140.8h-51.2z"})],-1)),t.createElementVNode("span",Fs,t.toDisplayString(t.unref(b)(e.locale,"wrap")),1)],10,Vs)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("merge"),to:G.value},[t.createElementVNode("div",Is,[t.createElementVNode("div",As,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:N[36]||(N[36]=ie=>ge("apply-merge"))},[N[81]||(N[81]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M709.952 465.92l88-76.032C801.92 385.984 806.656 384 812.032 384s10.048 1.984 14.08 5.952C830.08 393.92 832 398.656 832 403.968L832 448l32 0C881.664 448 896 462.336 896 480S881.664 512 864 512L832 512l0 44.032c0 5.376-1.92 10.112-5.952 14.08C822.08 574.08 817.344 576 812.032 576s-10.048-1.92-14.08-5.952L709.952 494.08C705.984 490.112 704 485.376 704 480S705.984 469.952 709.952 465.92zM378.048 465.92 290.048 389.952C286.08 385.984 281.344 384 275.968 384s-10.048 1.984-14.08 5.952C257.92 393.92 256 398.656 256 403.968L256 448 224 448C206.336 448 192 462.336 192 480S206.336 512 224 512L256 512l0 44.032c0 5.376 1.92 10.112 5.952 14.08C265.92 574.08 270.656 576 275.968 576s10.048-1.92 14.08-5.952L378.048 494.08C382.016 490.112 384 485.376 384 480S382.016 469.952 378.048 465.92zM448 128 128 128l0 704 320 0 0-128 64 0 0 128c0 35.392-28.608 64-64 64L128 896c-35.392 0-64-28.608-64-64L64 128c0-35.392 28.608-64 64-64l320 0 0 0c35.392 0 64 28.608 64 64l0 128L448 256 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128M722.304 642.304c0 8.512-3.52 16.32-10.496 23.36s-15.424 10.624-25.344 10.624c-5.76 0-10.688-1.088-14.72-3.136-4.096-2.048-7.616-4.928-10.432-8.512s-5.824-9.088-9.024-16.512-5.952-13.952-8.32-19.648l-17.28-46.016L479.36 582.464 462.08 629.568c-6.72 18.304-12.48 30.656-17.344 37.12s-12.544 9.6-23.424 9.6c-9.28 0-17.408-3.456-24.512-10.24s-10.624-14.592-10.624-23.232c0-4.992 0.896-10.176 2.496-15.488S393.024 614.592 396.8 605.056l92.672-238.016C492.096 360.256 495.296 352 499.008 342.464s7.68-17.536 11.904-23.872 9.664-11.456 16.576-15.36c6.784-3.968 15.232-5.888 25.344-5.888 10.176 0 18.752 1.92 25.472 5.888 6.848 3.968 12.352 8.96 16.64 15.104 4.096 6.208 7.744 12.8 10.624 19.904s6.528 16.576 11.008 28.352l94.656 236.48C718.592 621.056 722.304 634.112 722.304 642.304zM606.912 526.784 552.32 375.552 498.624 526.784 606.912 526.784z"})],-1)),t.createElementVNode("span",Ls,t.toDisplayString(t.unref(b)(e.locale,"mergeCenter")),1)],8,_s),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:ee,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:N[37]||(N[37]=ie=>ge("update:merge-menu-open",!e.mergeMenuOpen))},[...N[82]||(N[82]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Os),t.createVNode(fi,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":ee.value,"onUpdate:modelOpen":N[38]||(N[38]=ie=>ge("update:merge-menu-open",ie)),onChange:N[39]||(N[39]=ie=>ge("merge-change",ie))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep6"),to:G.value},[N[83]||(N[83]=t.createElementVNode("div",{class:"tb-item","data-key":"sep6"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("numFmt"),to:G.value},[t.createElementVNode("div",$s,[t.createElementVNode("div",Hs,[t.createVNode(Dt,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:I("numFmt")?"auto":92,"menu-width":(I("numFmt"),150),"visible-count":8,title:t.unref(b)(e.locale,"numberFormat"),"fallback-label":et.value,align:"right",onChange:N[40]||(N[40]=ie=>ge("number-format-change",String(ie)))},null,8,["model-value","options","width","menu-width","title","fallback-label"]),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canIncreaseDecimals}]),title:t.unref(b)(e.locale,"nfIncreaseDecimals"),disabled:!e.canIncreaseDecimals,onClick:N[41]||(N[41]=ie=>ge("increase-decimals"))},[...N[84]||(N[84]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("text",{x:"0.5",y:"16","font-size":"9","font-weight":"700","font-family":"Arial, sans-serif"},".00"),t.createElementVNode("path",{d:"M19 5.5l4.2 5.2h-2.7v7.8h-3v-7.8h-2.7z"})],-1)])],10,zs),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canDecreaseDecimals}]),title:t.unref(b)(e.locale,"nfDecreaseDecimals"),disabled:!e.canDecreaseDecimals,onClick:N[42]||(N[42]=ie=>ge("decrease-decimals"))},[...N[85]||(N[85]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("text",{x:"0.5",y:"16","font-size":"9","font-weight":"700","font-family":"Arial, sans-serif"},".00"),t.createElementVNode("path",{d:"M19 18.5l-4.2-5.2h2.7V5.5h3v7.8h2.7z"})],-1)])],10,Ws)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep7"),to:G.value},[N[86]||(N[86]=t.createElementVNode("div",{class:"tb-item","data-key":"sep7"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("calc"),to:G.value},[t.createElementVNode("div",Ps,[t.createElementVNode("div",Us,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:N[43]||(N[43]=ie=>ge("calc-sum"))},[N[87]||(N[87]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("path",{d:"M19 3H5l7 9-7 9h14v-2H8l5.5-7L8 5h11z"})],-1)),t.createElementVNode("span",Gs,t.toDisplayString(t.unref(b)(e.locale,"sum")),1)],8,Ks),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:M,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:N[44]||(N[44]=ie=>ge("update:calc-menu-open",!e.calcMenuOpen))},[...N[88]||(N[88]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,qs),t.createVNode(xi,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":M.value,disabled:e.isSingleCell,"onUpdate:modelOpen":N[45]||(N[45]=ie=>ge("update:calc-menu-open",ie)),onChange:N[46]||(N[46]=ie=>ge(`calc-${ie}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sort"),to:G.value},[t.createElementVNode("div",Ys,[t.createElementVNode("div",Xs,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.cachedSortOrder==="asc"?t.unref(b)(e.locale,"sortAsc"):t.unref(b)(e.locale,"sortDesc"),disabled:!e.canSort,onClick:N[47]||(N[47]=ie=>ge("apply-sort"))},[(t.openBlock(),t.createElementBlock("svg",Zs,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(f,ie=>t.createElementVNode("line",{key:ie.name,x1:ie.x1,y1:ie.y1,x2:ie.x2,y2:ie.y2},null,8,Js)),64)),t.createElementVNode("path",{d:y[e.cachedSortOrder]},null,8,Qs)])),t.createElementVNode("span",ec,t.toDisplayString(t.unref(b)(e.locale,"sort")),1)],8,js),t.createElementVNode("button",{ref_key:"sortArrowRef",ref:ne,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"sort"),disabled:!e.canSort,onClick:N[48]||(N[48]=ie=>ge("update:sort-menu-open",!e.sortMenuOpen))},[...N[89]||(N[89]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,tc),t.createVNode(si,{"model-open":e.sortMenuOpen,locale:e.locale,"current-sort":e.cachedSortOrder,"trigger-el":ne.value,"onUpdate:modelOpen":N[49]||(N[49]=ie=>ge("update:sort-menu-open",ie)),onChange:N[50]||(N[50]=ie=>ge("sort-change",ie))},null,8,["model-open","locale","current-sort","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("filter"),to:G.value},[t.createElementVNode("div",lc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.filterActive}]),disabled:!e.canFilter,title:e.filterActive?t.unref(b)(e.locale,"clearFilter"):t.unref(b)(e.locale,"filter"),onClick:Le},[N[90]||(N[90]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M96 192c0-17.6 14.4-32 32-32h768c17.6 0 32 14.4 32 32 0 9.6-4.8 19.2-12.8 25.6L608 480v320c0 19.2-12.8 35.2-32 40-4.8 1.6-9.6 1.6-14.4 1.6-12.8 0-24-4.8-33.6-12.8l-128-108.8c-8-6.4-12.8-16-12.8-25.6V480L108.8 217.6C100.8 211.2 96 201.6 96 192z"})],-1)),t.createElementVNode("span",oc,t.toDisplayString(t.unref(b)(e.locale,"filter")),1)],10,nc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("freeze"),to:G.value},[t.createElementVNode("div",rc,[t.createVNode(Dt,{class:"toolbar-freeze","model-value":"",options:ut.value,width:I("freeze")?"100%":44,"menu-width":I("freeze")?120:void 0,"visible-count":4,align:"right",title:t.unref(b)(e.locale,"freezePane"),"trigger-icon":fr,"trigger-label":t.unref(b)(e.locale,"freezePane"),onChange:N[51]||(N[51]=ie=>ge("freeze-change",String(ie)))},null,8,["options","width","menu-width","title","trigger-label"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("cf"),to:G.value},[t.createElementVNode("div",ac,[t.createVNode(Bi,{locale:e.locale,"has-selection":e.hasSelection,"theme-vars":e.themeVars,onPreset:N[52]||(N[52]=ie=>ge("cf-preset",ie)),onNewRule:N[53]||(N[53]=ie=>ge("cf-new-rule")),onManage:N[54]||(N[54]=ie=>ge("cf-manage")),onClear:N[55]||(N[55]=ie=>ge("cf-clear",ie))},null,8,["locale","has-selection","theme-vars"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("dv"),to:G.value},[t.createElementVNode("div",ic,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(b)(e.locale,"dv"),onClick:U},[N[91]||(N[91]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M933.76 705.728l-74.112 74.048 74.88 74.944-58.88 58.88-74.88-75.008-74.88 74.88-58.88-58.752 74.88-74.88-74.048-74.112 58.88-58.88 74.112 74.048 74.048-74.048 58.88 58.88z"}),t.createElementVNode("path",{d:"M832.576 607.104H167.808v162.944h370.688v83.2H126.208a41.664 41.664 0 0 1-41.6-41.6V565.376a41.6 41.6 0 0 1 41.6-41.6h706.368v83.2zM908.608 241.856l30.848 27.904-158.08 174.08a41.664 41.664 0 0 1-60.224 1.408L605.824 329.856l58.816-58.88 84.48 84.48 128.768-141.568 30.72 27.968z"}),t.createElementVNode("path",{d:"M832.576 193.664H167.808v162.944h370.688v83.2H126.208a41.6 41.6 0 0 1-41.6-41.6V151.936a41.6 41.6 0 0 1 41.6-41.6h706.368v83.2z"})],-1)),t.createElementVNode("span",cc,t.toDisplayString(t.unref(b)(e.locale,"dv")),1)],8,sc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("find"),to:G.value},[t.createElementVNode("div",dc,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(b)(e.locale,"find"),onClick:de},[N[92]||(N[92]=t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M448 128a320 320 0 0 1 251.2 516.8l171.2 171.2a32 32 0 0 1-45.2 45.2L654 689.9A320 320 0 1 1 448 128zm0 64a256 256 0 1 0 0 512 256 256 0 0 0 0-512z"})],-1)),t.createElementVNode("span",fc,t.toDisplayString(t.unref(b)(e.locale,"findReplace")),1)],8,uc)])],8,["disabled","to"])),F.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:x,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":te.value}]),type:"button",onClick:$},[...N[93]||(N[93]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("circle",{cx:"512",cy:"160",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"512",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"864",r:"96"})],-1)])],2)):t.createCommentVNode("",!0)],34),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["overflow-menu-wrap",{"no-anim":Ne.value}]),style:t.normalizeStyle(K.value),onPointerdown:N[59]||(N[59]=t.withModifiers(()=>{},["stop","prevent"]))},[Ve.value||Fe.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!Ve.value}]),disabled:!Ve.value,onClick:N[57]||(N[57]=ie=>Ee(-1))},[...N[94]||(N[94]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,mc)):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock("div",{ref_key:"overflowMenuEl",ref:E,key:ze.value,class:"overflow-menu",onScroll:Ie},null,32)),Ve.value||Fe.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!Fe.value}]),disabled:!Fe.value,onClick:N[58]||(N[58]=ie=>Ee(1))},[...N[95]||(N[95]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,pc)):t.createCommentVNode("",!0)],38),[[t.vShow,te.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-886dd586"]]),vc=["title"],kc={class:"tab-list"},Ec=["onClick","onDblclick","onContextmenu","onTouchstart"],Rc=["value"],Sc={key:1,class:"tab-item__name"},Mc=["title"],Bc=["disabled"],Tc=["title","onClick"],Nc={class:"tab-list-menu__name"},xc=["title","disabled","onClick"],Dc=["disabled"],Vc=8,mr=450,Xn=8,Fc=St(t.defineComponent({__name:"tabbar",props:{locale:{},sheets:{},activeSheetIndex:{},renTab:{},renTabVal:{}},emits:["tab-click","tab-dblclick","delete-sheet","tab-contextmenu","tab-rename-input","tab-rename-keydown","tab-rename-commit","add-sheet","tabbar-contextmenu"],setup(e,{emit:n}){const l=e,o=n,a=t.ref(null),i=t.ref(!1),r=t.ref(0),d=t.ref({left:0,bottom:0}),f=t.ref(null),y=t.computed(()=>Math.min(Vc,l.sheets.length)),h=t.computed(()=>l.sheets.slice(r.value,r.value+y.value)),u=t.computed(()=>r.value>0),E=t.computed(()=>r.value+y.value<l.sheets.length),x=t.computed(()=>l.sheets.length>y.value),k=t.computed(()=>l.sheets.length>1);t.watch(()=>l.sheets.length,()=>{if(!i.value)return;const $=Math.max(0,l.sheets.length-y.value);r.value>$&&(r.value=$)});function H($){r.value=Math.max(0,Math.min(l.sheets.length-y.value,r.value+$))}function Y(){if(i.value){i.value=!1;return}const $=a.value;if(!$)return;const U=$.getBoundingClientRect();d.value={left:U.left,bottom:window.innerHeight-U.top+4};const de=l.activeSheetIndex;r.value=de>=0?Math.max(0,Math.min(de-Math.floor(y.value/2),l.sheets.length-y.value)):0,i.value=!0}function ne($){o("tab-click",$),i.value=!1}function ee($){k.value&&o("delete-sheet",$)}function M($){var Le;if(!i.value)return;const U=$.target;if((Le=a.value)!=null&&Le.contains(U))return;const de=document.querySelector(".tab-list-menu");de!=null&&de.contains(U)||(i.value=!1)}function se($){i.value&&$.key==="Escape"&&(i.value=!1)}function X($){i.value&&($.preventDefault(),H($.deltaY>0?1:-1))}function te(){i.value=!1}function Ne($){!i.value||$.target===f.value||te()}const ze=t.ref(0),Ve=t.ref(!1);function Fe($){i.value&&(ze.value=$.touches[0].clientY,Ve.value=!0)}function je($){if(!i.value||!Ve.value)return;const U=$.touches[0].clientY-ze.value;Math.abs(U)>5&&(H(U<0?1:-1),ze.value=$.touches[0].clientY)}function _e(){Ve.value=!1}let F=null,I=-1,G=0,Ce=0,$e=!1,j=null,Be=0,Q=0;function ke($,U,de){return{clientX:$,clientY:U,target:de,preventDefault(){},stopPropagation(){}}}function B($,U){const de=$.touches[0];if(!de)return;G=de.clientX,Ce=de.clientY,I=U,F!==null&&clearTimeout(F);const Le=$.target;F=window.setTimeout(()=>{$e=!0;const ve=ke(G,Ce,Le);o("tab-contextmenu",{ev:ve,i:I})},mr)}function oe($){const U=$.touches[0];!U||F===null||(Math.abs(U.clientX-G)>Xn||Math.abs(U.clientY-Ce)>Xn)&&(clearTimeout(F),F=null)}function Z(){F!==null&&(clearTimeout(F),F=null)}function re($){if($e){$e=!1;return}o("tab-click",$)}function K($){const U=$.touches[0];if(!U)return;const de=$.target;if(de.closest(".tab-item")||de.closest(".tab-bar__add-btn")||de.closest(".tab-bar__list-btn"))return;Be=U.clientX,Q=U.clientY,j!==null&&clearTimeout(j);const Le=de;j=window.setTimeout(()=>{const ve=ke(Be,Q,Le);o("tabbar-contextmenu",ve)},mr)}function L($){const U=$.touches[0];!U||j===null||(Math.abs(U.clientX-Be)>Xn||Math.abs(U.clientY-Q)>Xn)&&(clearTimeout(j),j=null)}function J(){j!==null&&(clearTimeout(j),j=null)}return t.watch(i,$=>{t.nextTick(()=>{var U,de;$?(U=f.value)==null||U.addEventListener("wheel",X,{passive:!1}):(de=f.value)==null||de.removeEventListener("wheel",X)})}),t.onMounted(()=>{document.addEventListener("pointerdown",M),document.addEventListener("keydown",se),window.addEventListener("resize",te),window.addEventListener("scroll",Ne,!0)}),t.onBeforeUnmount(()=>{F!==null&&clearTimeout(F),j!==null&&clearTimeout(j),document.removeEventListener("pointerdown",M),document.removeEventListener("keydown",se),window.removeEventListener("resize",te),window.removeEventListener("scroll",Ne,!0)}),($,U)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:U[8]||(U[8]=de=>o("tabbar-contextmenu",de)),onTouchstart:K,onTouchmove:L,onTouchend:J,onTouchcancel:J},[t.createElementVNode("button",{ref_key:"listBtnRef",ref:a,class:t.normalizeClass(["tab-bar__list-btn",{"tab-bar__list-btn--active":i.value}]),type:"button",title:t.unref(b)(e.locale,"sheetList"),onClick:Y},[...U[9]||(U[9]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M128 256h768a32 32 0 0 0 0-64H128a32 32 0 0 0 0 64z m0 256h768a32 32 0 0 0 0-64H128a32 32 0 0 0 0 64z m0 256h768a32 32 0 0 0 0-64H128a32 32 0 0 0 0 64z"})],-1)])],10,vc),t.createElementVNode("div",kc,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(de,Le)=>(t.openBlock(),t.createElementBlock("div",{key:de.id,class:t.normalizeClass(["tab-item",{"tab-item--active":Le===e.activeSheetIndex}]),onClick:ve=>re(Le),onDblclick:t.withModifiers(ve=>o("tab-dblclick",Le),["prevent"]),onContextmenu:ve=>o("tab-contextmenu",{ev:ve,i:Le}),onTouchstart:ve=>B(ve,Le),onTouchmove:oe,onTouchend:Z,onTouchcancel:Z},[e.renTab===Le?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:U[0]||(U[0]=ve=>o("tab-rename-input",ve.target.value)),onKeydown:U[1]||(U[1]=ve=>o("tab-rename-keydown",ve)),onBlur:U[2]||(U[2]=ve=>o("tab-rename-commit")),onClick:U[3]||(U[3]=t.withModifiers(()=>{},["stop"]))},null,40,Rc)):(t.openBlock(),t.createElementBlock("span",Sc,t.toDisplayString(de.name),1))],42,Ec))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(b)(e.locale,"addSheet"),onClick:U[4]||(U[4]=de=>o("add-sheet"))}," + ",8,Mc),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"tab-list-menu",style:t.normalizeStyle({left:d.value.left+"px",bottom:d.value.bottom+"px"}),onMousedown:U[7]||(U[7]=t.withModifiers(()=>{},["prevent"]))},[x.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!u.value}]),disabled:!u.value,onClick:U[5]||(U[5]=de=>H(-1))},[...U[10]||(U[10]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 662.613333a32 32 0 0 0 45.226667 0L512 375.893333l286.72 286.72a32 32 0 1 0 45.226667-45.226666l-309.333334-309.333334a32 32 0 0 0-45.226666 0l-309.333334 309.333334a32 32 0 0 0 0 45.226666z"})],-1)])],10,Bc)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:f,class:"tab-list-menu__list",onTouchstart:Fe,onTouchmove:je,onTouchend:_e},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,de=>(t.openBlock(),t.createElementBlock("div",{key:de.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(de)===e.activeSheetIndex}]),title:de.name,onClick:Le=>ne(e.sheets.indexOf(de))},[t.createElementVNode("span",Nc,t.toDisplayString(de.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(b)(e.locale,"delete"),disabled:!k.value,onClick:t.withModifiers(Le=>ee(e.sheets.indexOf(de)),["stop"])},[...U[11]||(U[11]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])],8,xc)],10,Tc))),128))],544),x.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!E.value}]),disabled:!E.value,onClick:U[6]||(U[6]=de=>H(1))},[...U[12]||(U[12]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],10,Dc)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-e00401ad"]]),Ic={class:"find-bar__row find-bar__row--inputs"},Ac=["placeholder","value"],_c=["placeholder","value"],Lc=["title","disabled"],Oc=["title","disabled"],$c=["title"],Hc={class:"find-bar__row find-bar__row--controls"},zc=["title"],Wc={class:"find-bar__count"},Pc=["disabled"],Uc=["disabled"],Kc={class:"find-bar__chk find-bar__chk--panel"},Gc=["checked"],qc={class:"find-bar__chk find-bar__chk--panel"},Yc=["checked"],Xc=St(t.defineComponent({__name:"find-replace-bar",props:{open:{type:Boolean},findText:{},replaceText:{},scope:{},matchCase:{type:Boolean},matchEntireCell:{type:Boolean},currentIndex:{},total:{},message:{},focusToken:{},locale:{},themeVars:{}},emits:["update:findText","update:replaceText","update:scope","update:matchCase","update:matchEntireCell","prev","next","replace","replace-all","close"],setup(e,{emit:n}){const l=e,o=n,a=t.ref(null),i=t.ref(null),r=t.ref(!1),d=t.ref({top:0,left:0}),f=t.computed(()=>l.total>0?`${l.currentIndex+1}/${l.total}`:l.message||""),y=t.computed(()=>[{label:b(l.locale,"scopeSheet"),value:"sheet"},{label:b(l.locale,"scopeWorkbook"),value:"workbook"},{label:b(l.locale,"scopeSelection"),value:"selection"}]);t.watch(()=>l.focusToken,()=>{t.nextTick(()=>{var x;return(x=a.value)==null?void 0:x.focus()})});function h(x){x.key==="Enter"?(x.preventDefault(),x.shiftKey?o("prev"):o("next")):x.key==="Escape"&&(x.preventDefault(),o("close"))}function u(){if(i.value){if(!r.value){const x=i.value.getBoundingClientRect();d.value={top:x.bottom+2,left:x.left}}r.value=!r.value}}function E(x){if(!r.value)return;const k=x.target;k.closest(".find-bar__settings-btn")||k.closest(".find-bar__settings-panel")||(r.value=!1)}return t.watch(r,x=>{x?document.addEventListener("pointerdown",E,!0):document.removeEventListener("pointerdown",E,!0)}),t.watch(()=>l.open,x=>{x||(r.value=!1)}),t.onBeforeUnmount(()=>document.removeEventListener("pointerdown",E,!0)),(x,k)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[e.open?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Ic,[t.createElementVNode("input",{ref_key:"findInputRef",ref:a,class:"find-bar__input",placeholder:t.unref(b)(e.locale,"findPlaceholder"),value:e.findText,onInput:k[0]||(k[0]=H=>o("update:findText",H.target.value)),onKeydown:h},null,40,Ac),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(b)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:k[1]||(k[1]=H=>o("update:replaceText",H.target.value)),onKeydown:h},null,40,_c),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(b)(e.locale,"findPrev"),disabled:e.total===0,onClick:k[2]||(k[2]=H=>o("prev"))},[...k[12]||(k[12]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 320a32 32 0 0 1 45.254 0l288 288a32 32 0 0 1-45.254 45.254L512 410.51 214.254 653.254A32 32 0 0 1 169 608l288-288z"})],-1)])],8,Lc),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(b)(e.locale,"findNext"),disabled:e.total===0,onClick:k[3]||(k[3]=H=>o("next"))},[...k[13]||(k[13]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 704a32 32 0 0 1-45.254 0l-288-288A32 32 0 0 1 214.254 370.746L512 613.49 809.746 370.746A32 32 0 0 1 855 416l-288 288z"})],-1)])],8,Oc),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(b)(e.locale,"findClose"),onClick:k[4]||(k[4]=H=>o("close"))},[...k[14]||(k[14]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])],8,$c)]),t.createElementVNode("div",Hc,[t.createVNode(Dt,{class:"find-bar__dropdown","model-value":e.scope,options:y.value,title:t.unref(b)(e.locale,"findScope"),"onUpdate:modelValue":k[5]||(k[5]=H=>x.$emit("update:scope",H))},null,8,["model-value","options","title"]),t.createElementVNode("button",{ref_key:"settingsBtnRef",ref:i,class:t.normalizeClass(["find-bar__btn find-bar__btn--icon find-bar__settings-btn",{"find-bar__btn--active":r.value}]),title:t.unref(b)(e.locale,"findOptions"),onClick:t.withModifiers(u,["stop"])},[...k[15]||(k[15]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M224 671.616a64 64 0 1 1 128 0 64 64 0 0 1-128 0z m-59.968 32a128 128 0 0 0 247.936 0H928a32 32 0 1 0 0-64H411.968a128 128 0 0 0-247.936 0H96a32 32 0 1 0 0 64h68.032z"}),t.createElementVNode("path",{d:"M800 319.808a64 64 0 1 1-128 0 64 64 0 0 1 128 0z m59.968-32a128 128 0 0 0-247.936 0H96a32 32 0 0 0 0 64h516.032a128 128 0 0 0 247.936 0H928a32 32 0 0 0 0-64h-68.032z"})],-1)])],10,zc),t.createElementVNode("span",Wc,t.toDisplayString(f.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:k[6]||(k[6]=H=>o("replace"))},t.toDisplayString(t.unref(b)(e.locale,"replace")),9,Pc),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:k[7]||(k[7]=H=>o("replace-all"))},t.toDisplayString(t.unref(b)(e.locale,"replaceAll")),9,Uc)])],4)):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"find-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar__settings-panel",style:t.normalizeStyle({top:d.value.top+"px",left:d.value.left+"px"}),onClick:k[10]||(k[10]=t.withModifiers(()=>{},["stop"])),onMousedown:k[11]||(k[11]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("label",Kc,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchCase,onChange:k[8]||(k[8]=H=>o("update:matchCase",H.target.checked))},null,40,Gc),k[16]||(k[16]=t.createElementVNode("span",{class:"find-bar__chk-box"},[t.createElementVNode("svg",{class:"find-bar__chk-tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"matchCase")),1)]),t.createElementVNode("label",qc,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchEntireCell,onChange:k[9]||(k[9]=H=>o("update:matchEntireCell",H.target.checked))},null,40,Yc),k[17]||(k[17]=t.createElementVNode("span",{class:"find-bar__chk-box"},[t.createElementVNode("svg",{class:"find-bar__chk-tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"matchEntireCell")),1)])],36)):t.createCommentVNode("",!0)]),_:1})]))],64))}}),[["__scopeId","data-v-07f6713b"]]),jc={class:"nf-dialog__header"},Zc={class:"nf-dialog__title"},Jc={class:"nf-dialog__body"},Qc={class:"nf-field"},ed={class:"nf-field__label"},td={key:0,class:"nf-field"},ld={class:"nf-field__label"},nd={key:1,class:"nf-field nf-field--inline"},od={class:"nf-checkbox"},rd={key:2,class:"nf-field"},ad={class:"nf-field__label"},id={key:3,class:"nf-field"},sd={class:"nf-field__label"},cd={key:4,class:"nf-field"},dd={class:"nf-field__label"},ud={key:5,class:"nf-field"},fd={class:"nf-field__label"},md={key:6,class:"nf-field"},pd={class:"nf-field__label"},hd={class:"nf-field"},gd={class:"nf-field__label"},bd={class:"nf-dialog__footer"},yd={class:"nf-preview"},Cd={class:"nf-preview__label"},wd={class:"nf-preview__value"},vd={class:"nf-dialog__actions"},kd=St(t.defineComponent({__name:"number-format-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"},currentFormat:{default:""},isCustom:{type:Boolean,default:!1},sampleValue:{default:"1234.5"}},emits:["update:modelOpen","apply"],setup(e,{emit:n}){const l=e,o=n,a=t.ref(!1),i=t.ref("general"),r=t.ref(2),d=t.ref(!1),f=t.ref("$"),y=t.ref("m/d/yyyy"),h=t.ref("h:mm:ss"),u=t.ref("m/d/yyyy h:mm:ss"),E=t.ref("[h]:mm:ss"),x=t.ref(""),k=t.ref(null),H=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],Y=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],ne=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],ee=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],M=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],se=t.computed(()=>l.locale==="zh-CN"?[...Y,...ne]:[...ne,...Y]),X=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],te=t.computed(()=>l.locale==="zh-CN"?[...ee,...M]:[...M,...ee]),Ne=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],ze={general:"nfGeneral",text:"nfText",number:"nfNumber",percent:"nfPercent",scientific:"nfScientific",accounting:"nfAccounting",financial:"nfFinancial",currency:"nfCurrency",currencyRounded:"nfCurrencyRounded",date:"nfDate",time:"nfTime",dateTime:"nfDateTime",duration:"nfDuration",custom:"nfCatCustom"},Ve=t.computed(()=>Va.map(Ee=>({label:b(l.locale,ze[Ee]),value:Ee}))),Fe=H.map(Ee=>({label:Ee.label,value:Ee.value})),je=t.computed(()=>se.value.map(Ee=>({label:Ee,value:Ee}))),_e=X.map(Ee=>({label:Ee,value:Ee})),F=t.computed(()=>te.value.map(Ee=>({label:Ee,value:Ee}))),I=Ne.map(Ee=>({label:Ee,value:Ee})),G=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),Ce=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),$e=t.computed(()=>i.value==="date"),j=t.computed(()=>i.value==="time"),Be=t.computed(()=>i.value==="dateTime"),Q=t.computed(()=>i.value==="duration"),ke=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function B(){if(i.value==="general")return Pl;if(i.value==="text")return il;if(i.value==="custom")return x.value;if(i.value==="date")return y.value;if(i.value==="time")return h.value;if(i.value==="dateTime")return u.value;if(i.value==="duration")return E.value;const Ee=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?oe(i.value,Ee,d.value,f.value):$a(l.locale,i.value,Ee,d.value)}function oe(Ee,He,ge,et){const ut=ge?"#,##0":"0";if(Ee==="currencyRounded")return et+ut;const Pe=He>0?"."+"0".repeat(He):"",N=ut+Pe;return Ee==="currency"?et+N:`${et}${N};(${et}${N});${et}"-"`}function Z(Ee){if(x.value=Ee,sl(Ee)){i.value="general";return}if(Ee==="@"){i.value="text";return}const He=Ee.replace(/\[[^\]]*\]/gi,Pe=>/\[h\]/i.test(Pe)?Pe:"");if(/\[h\]/i.test(He)&&!/[yd]/i.test(He)){i.value="duration",Ne.includes(Ee)&&(E.value=Ee);return}const ge=/[yd]/i.test(He),et=/h|s|AM\/PM/i.test(He);if(ge&&et){i.value="dateTime",te.value.includes(Ee)&&(u.value=Ee);return}if(ge||/AM\/PM/i.test(He)){et&&!ge?(i.value="time",X.includes(Ee)&&(h.value=Ee)):(i.value="date",se.value.includes(Ee)&&(y.value=Ee));return}if(Ee.includes("%")){i.value="percent",r.value=re(Ee);return}if(/E[+-]/i.test(Ee)){i.value="scientific",r.value=re(Ee);return}const ut=H.find(Pe=>Ee.startsWith(Pe.value));if(Ee.includes("[Red](")){i.value="financial",d.value=Ee.includes(","),r.value=re(Ee);return}if(ut){Ee.includes("(")?(i.value="accounting",f.value=ut.value,d.value=Ee.includes(","),r.value=re(Ee)):/\.\d/.test(Ee.slice(ut.value.length))?(i.value="currency",f.value=ut.value,d.value=Ee.includes(","),r.value=re(Ee)):(i.value="currencyRounded",f.value=ut.value,d.value=Ee.includes(","));return}i.value="number",d.value=Ee.includes(","),r.value=re(Ee)}function re(Ee){const He=Ee.match(/\.([0#?]+)/);return He?He[1].length:0}function K(){i.value!=="custom"&&(x.value=B())}function L(){}function J(){y.value=se.value[0],h.value=X[0],u.value=te.value[0],E.value=Ne[0]}function $(){a.value=!0,l.modelOpen!==void 0&&o("update:modelOpen",!0),J(),Z(l.currentFormat??""),l.isCustom&&(i.value="custom"),t.nextTick(()=>{var Ee;return(Ee=k.value)==null?void 0:Ee.focus()})}function U(){a.value=!1,l.modelOpen!==void 0&&o("update:modelOpen",!1)}function de(){o("apply",x.value),U()}function Le(){U()}function ve(Ee){Ee.key==="Escape"&&U()}t.watch(()=>l.modelOpen,Ee=>{Ee&&!a.value?$():!Ee&&a.value&&U()});const Ie=t.computed(()=>yl(l.sampleValue,x.value,l.locale));return(Ee,He)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"nf-dialog"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"nf-dialog__mask",onMousedown:Le,onKeydown:ve},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:He[9]||(He[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",jc,[t.createElementVNode("span",Zc,t.toDisplayString(t.unref(b)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:U},[...He[10]||(He[10]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])])]),t.createElementVNode("div",Jc,[t.createElementVNode("div",Qc,[t.createElementVNode("label",ed,t.toDisplayString(t.unref(b)(e.locale,"nfCategory")),1),t.createVNode(Dt,{class:"nf-field__dropdown","model-value":i.value,options:Ve.value,"onUpdate:modelValue":He[0]||(He[0]=ge=>i.value=ge),onChange:K},null,8,["model-value","options"])]),ke.value?(t.openBlock(),t.createElementBlock("div",td,[t.createElementVNode("label",ld,t.toDisplayString(t.unref(b)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":He[1]||(He[1]=ge=>r.value=ge),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:K},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),G.value?(t.openBlock(),t.createElementBlock("div",nd,[t.createElementVNode("label",od,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":He[2]||(He[2]=ge=>d.value=ge),type:"checkbox",onChange:K},null,544),[[t.vModelCheckbox,d.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),Ce.value?(t.openBlock(),t.createElementBlock("div",rd,[t.createElementVNode("label",ad,t.toDisplayString(t.unref(b)(e.locale,"nfSymbol")),1),t.createVNode(Dt,{class:"nf-field__dropdown","model-value":f.value,options:t.unref(Fe),"onUpdate:modelValue":He[3]||(He[3]=ge=>f.value=ge),onChange:K},null,8,["model-value","options"])])):t.createCommentVNode("",!0),$e.value?(t.openBlock(),t.createElementBlock("div",id,[t.createElementVNode("label",sd,t.toDisplayString(t.unref(b)(e.locale,"nfDateFormat")),1),t.createVNode(Dt,{class:"nf-field__dropdown","model-value":y.value,options:je.value,"onUpdate:modelValue":He[4]||(He[4]=ge=>y.value=ge),onChange:K},null,8,["model-value","options"])])):t.createCommentVNode("",!0),j.value?(t.openBlock(),t.createElementBlock("div",cd,[t.createElementVNode("label",dd,t.toDisplayString(t.unref(b)(e.locale,"nfTimeFormat")),1),t.createVNode(Dt,{class:"nf-field__dropdown","model-value":h.value,options:t.unref(_e),"onUpdate:modelValue":He[5]||(He[5]=ge=>h.value=ge),onChange:K},null,8,["model-value","options"])])):t.createCommentVNode("",!0),Be.value?(t.openBlock(),t.createElementBlock("div",ud,[t.createElementVNode("label",fd,t.toDisplayString(t.unref(b)(e.locale,"nfDateTime")),1),t.createVNode(Dt,{class:"nf-field__dropdown","model-value":u.value,options:F.value,"onUpdate:modelValue":He[6]||(He[6]=ge=>u.value=ge),onChange:K},null,8,["model-value","options"])])):t.createCommentVNode("",!0),Q.value?(t.openBlock(),t.createElementBlock("div",md,[t.createElementVNode("label",pd,t.toDisplayString(t.unref(b)(e.locale,"nfDuration")),1),t.createVNode(Dt,{class:"nf-field__dropdown","model-value":E.value,options:t.unref(I),"onUpdate:modelValue":He[7]||(He[7]=ge=>E.value=ge),onChange:K},null,8,["model-value","options"])])):t.createCommentVNode("",!0),t.createElementVNode("div",hd,[t.createElementVNode("label",gd,t.toDisplayString(t.unref(b)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:k,"onUpdate:modelValue":He[8]||(He[8]=ge=>x.value=ge),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:L},null,544),[[t.vModelText,x.value]])])]),t.createElementVNode("div",bd,[t.createElementVNode("div",yd,[t.createElementVNode("span",Cd,t.toDisplayString(t.unref(b)(e.locale,"nfPreview")),1),t.createElementVNode("span",wd,t.toDisplayString(Ie.value||"—"),1)]),t.createElementVNode("div",vd,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:de},t.toDisplayString(t.unref(b)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:U},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-84bb335b"]]),Ed={class:"sort-confirm__header"},Rd={class:"sort-confirm__title"},Sd={class:"sort-confirm__body"},Md={class:"sort-confirm__message"},Bd={class:"sort-confirm__options"},Td={class:"sort-confirm__option"},Nd={class:"sort-confirm__option"},xd={class:"sort-confirm__footer"},Dd=St(t.defineComponent({__name:"sort-confirm-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","confirm","cancel"],setup(e,{emit:n}){const l=e,o=n,a=t.ref(!1),i=t.ref(!0),r=t.ref(null);t.watch(()=>l.modelOpen,x=>{x&&!a.value?d():!x&&a.value&&f()});function d(){i.value=!0,a.value=!0,l.modelOpen!==void 0&&o("update:modelOpen",!0),t.nextTick(()=>{var k;const x=(k=r.value)==null?void 0:k.querySelector(".sort-confirm__btn--primary");x==null||x.focus()})}function f(){a.value=!1,l.modelOpen!==void 0&&o("update:modelOpen",!1)}function y(){E()}function h(x){x.key==="Escape"&&E()}function u(){o("confirm",i.value),f()}function E(){o("cancel"),f()}return(x,k)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"sort-confirm"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"sort-confirm__mask",onMousedown:y,onKeydown:h},[t.createElementVNode("div",{ref_key:"dialogRef",ref:r,class:"sort-confirm",onMousedown:k[2]||(k[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Ed,[t.createElementVNode("span",Rd,t.toDisplayString(t.unref(b)(e.locale,"sortReminderTitle")),1),t.createElementVNode("button",{class:"sort-confirm__close",type:"button",onClick:E},[...k[3]||(k[3]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])])]),t.createElementVNode("div",Sd,[t.createElementVNode("p",Md,t.toDisplayString(t.unref(b)(e.locale,"sortReminderMessage")),1),t.createElementVNode("div",Bd,[t.createElementVNode("label",Td,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":k[0]||(k[0]=H=>i.value=H),type:"radio",value:!0},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"sortExpandSelection")),1)]),t.createElementVNode("label",Nd,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":k[1]||(k[1]=H=>i.value=H),type:"radio",value:!1},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"sortCurrentSelection")),1)])])]),t.createElementVNode("div",xd,[t.createElementVNode("button",{class:"sort-confirm__btn sort-confirm__btn--primary",type:"button",onClick:u},t.toDisplayString(t.unref(b)(e.locale,"sort")),1),t.createElementVNode("button",{class:"sort-confirm__btn",type:"button",onClick:E},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-af42d78b"]]);function lt(e){let n="",l=e;do n=String.fromCharCode(65+l%26)+n,l=Math.floor(l/26)-1;while(l>=0);return n}function Bo(e){let n=0;for(let l=0;l<e.length;l++)n=n*26+(e.toUpperCase().charCodeAt(l)-64);return n-1}function hn(e){if(e==null)return null;if(typeof e=="number")return e;if(typeof e=="string"){const n=parseFloat(e);return e.endsWith("%")||isNaN(n)?null:n}return null}function To(e){navigator.clipboard.writeText(e).catch(()=>{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)})}function Rn(e,n){return`${e},${n}`}function ll(e,n,l){const o=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!o)return null;const a=Bo(o[1]),i=parseInt(o[2],10)-1;return a<0||a>=n||i<0||i>=l?null:{col:a,row:i}}function en(e,n){if(!n)return{x:0,y:0};const l=n.getBoundingClientRect();return{x:e.clientX-l.left,y:e.clientY-l.top}}const pr=[{name:"SUM",snippet:"SUM(A1:A10)"},{name:"AVERAGE",snippet:"AVERAGE(A1:A10)"},{name:"COUNT",snippet:"COUNT(A1:A10)"},{name:"IF",snippet:"IF(A1>0, B1, C1)"},{name:"VLOOKUP",snippet:"VLOOKUP(A1, B1:C10, 2, FALSE)"},{name:"CONCATENATE",snippet:"CONCATENATE(A1, B1)"},{name:"MAX",snippet:"MAX(A1:A10)"},{name:"MIN",snippet:"MIN(A1:A10)"},{name:"SIN",snippet:"SIN(A1)"},{name:"SUMIF",snippet:'SUMIF(A1:A10, ">0", B1:B10)'},{name:"PMT",snippet:"PMT(0.05/12, 360, 100000)"},{name:"STDEV",snippet:"STDEV(A1:A10)"}],Vd={SUM:{min:1,max:1},AVERAGE:{min:1,max:1},COUNT:{min:1,max:1},IF:{min:3,max:3},VLOOKUP:{min:3,max:4},CONCATENATE:{min:1,max:1/0},MAX:{min:1,max:1},MIN:{min:1,max:1},SIN:{min:1,max:1},SUMIF:{min:2,max:3},PMT:{min:3,max:5},STDEV:{min:1,max:1}};function Fd(e){let n=0,l=null;for(let o=0;o<e.length;o++){const a=e[o];if(l){a===l&&(e[o+1]===l?o++:l=null);continue}if(a==='"'||a==="'"){l=a;continue}if(a==="(")n++;else if(a===")"&&(n--,n<0))return!1}return n===0}function Id(e){const n=e.trim();if(!n.startsWith("="))return{ok:!1,name:null};const l=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(n.slice(1).trim());if(!l)return{ok:!1,name:null};const o=l[1].toUpperCase(),a=Vd[o];if(!a)return{ok:!1,name:o};const i=l[2];if(!Fd(i))return{ok:!1,name:o};const r=Kl(i),d=r.length===1&&r[0].trim()===""?0:r.length;return d<a.min||d>a.max?{ok:!1,name:o}:r.some(f=>f.trim()==="")?{ok:!1,name:o}:{ok:!0,name:o}}function Sn(e,n,l){const o=e.split(":");if(o.length!==2)return null;const a=ll(o[0],n,l),i=ll(o[1],n,l);return!a||!i?null:{sc:Math.min(a.col,i.col),sr:Math.min(a.row,i.row),ec:Math.max(a.col,i.col),er:Math.max(a.row,i.row)}}function hr(e){const n=e.trim();if(n==="")return"";const l=Number(n);return!isNaN(l)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(n)?l:e}function xl(e,n,l,o,a){const i=l[Rn(e,n)];if(!i)return"";const r=i.value;return r.startsWith("=")?br(Rn(e,n),l,o,a):hr(r)}function gr(e,n,l,o,a){const i=xl(e,n,l,o,a);if(i===null)return 0;if(typeof i=="number")return i;const r=parseFloat(String(i));return isNaN(r)?0:r}const Fn=new Map,jn=new Set;function tn(){Fn.clear(),jn.clear()}function br(e,n,l,o){return Ad(e,n,l,o,0)}function Ad(e,n,l,o,a){if(jn.has(e))return null;if(Fn.has(e))return Fn.get(e);jn.add(e);const i=n[e];let r;if(!i)r=null;else{const d=i.value;if(!d.startsWith("="))r=hr(d);else{const f=d.slice(1).trim(),y=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(f);r=y?vr(y[1].toUpperCase(),y[2],n,l,o,a+1):Vt(f,n,l,o,a+1)}}return jn.delete(e),Fn.set(e,r),r}function Mn(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function yr(e,n){return typeof e=="number"&&typeof n=="number"?e===n:String(e??"")===String(n??"")}function No(e,n,l){let o;if(typeof e=="number"&&typeof n=="number")o=e<n?-1:e>n?1:0;else{const a=String(e??""),i=String(n??"");o=a<i?-1:a>i?1:0}switch(l){case"=":return o===0;case"<>":return o!==0;case"<":return o<0;case">":return o>0;case"<=":return o<=0;case">=":return o>=0}return!1}function Cr(e,n,l,o){const a=e.trim();if(a.length>=2&&(a[0]==='"'&&a[a.length-1]==='"'||a[0]==="'"&&a[a.length-1]==="'"))return a.slice(1,-1);const i=Number(a);return!isNaN(i)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(a)?i:a}function _d(e,n,l,o,a,i){let d=n.trim();d.length>=2&&(d[0]==='"'&&d[d.length-1]==='"'||d[0]==="'"&&d[d.length-1]==="'")&&(d=d.slice(1,-1));const f=/^([<>=]+)([\s\S]*)$/.exec(d);if(f){const h=f[1],u=Cr(f[2]);return No(e,u,h)}const y=Cr(d);return yr(e,y)}function wr(e,n,l,o,a){const i=e.trim(),r=["<=",">=","<>"];let d=null,f=-1,y=null,h=0;for(let E=0;E<i.length;E++){const x=i[E];if(y){x===y&&(i[E+1]===y?E++:y=null);continue}if(x==='"'||x==="'"){y=x;continue}if(x==="("&&h++,x===")"&&h--,h===0&&(x==="<"||x===">"||x==="=")){const k=i.slice(E,E+2);d=r.includes(k)?k:x,f=E;break}}if(d&&f>=0){const E=i.slice(0,f).trim(),x=i.slice(f+d.length).trim(),k=Vt(E,n,l,o,a),H=Vt(x,n,l,o,a);return No(k,H,d)}const u=Vt(i,n,l,o,a);return Mn(u)}function Kl(e){const n=[];let l=0,o=null,a="";for(let i=0;i<e.length;i++){const r=e[i];if(o){a+=r,r===o&&(e[i+1]===o?(i++,a+=o):o=null);continue}if(r==='"'||r==="'"){o=r,a+=r;continue}if(r==="("&&l++,r===")"&&l--,r===","&&l===0){n.push(a),a="";continue}a+=r}return n.push(a),n}function Vt(e,n,l,o,a){if(a>20)return null;const i=e.trim();if(i==="")return null;const r=i.toUpperCase();if(r==="TRUE")return 1;if(r==="FALSE")return 0;const d=Ld(i);if(d.length===0)return null;let f=0;const y=()=>{const k=h(),H=d[f];if(!(H&&H.type==="cmp"))return k;f++;const Y=h();return k===null||Y===null?null:No(k,Y,H.val)?1:0},h=()=>{let k=u();for(;f<d.length;){const H=d[f];if(H.type==="op"&&(H.val==="+"||H.val==="-"))f++,k=xo(k,u(),H.val);else break}return k},u=()=>{let k=E();for(;f<d.length;){const H=d[f];if(H.type==="op"&&(H.val==="*"||H.val==="/"))f++,k=xo(k,E(),H.val);else break}return k},E=()=>{const k=d[f];return k&&k.type==="op"&&k.val==="-"?(f++,xo(0,E(),"-")):k&&k.type==="op"&&k.val==="+"?(f++,E()):x()},x=()=>{const k=d[f];if(!k)return null;if(k.type==="num")return f++,Number(k.val);if(k.type==="str")return f++,k.val;if(k.type==="lp"){f++;const H=y();return d[f]&&d[f].type==="rp"&&f++,H}if(k.type==="ref"){f++;const H=ll(k.val,l,o);return H?xl(H.col,H.row,n,l,o):null}if(k.type==="func"){const H=k.val.toUpperCase();if(f++,d[f]&&d[f].type==="lp"){const Y=d[f];let ne=0,ee=null,M=f;for(;M<d.length;M++)if(d[M].type==="lp")ne++;else if(d[M].type==="rp"&&(ne--,ne===0)){ee=d[M];break}if(ee){const se=i.slice(Y.start+1,ee.start);return f=M+1,vr(H,se,n,l,o,a+1)}}return null}return f++,null};return y()}function Ld(e){const n=[];let l=0;for(;l<e.length;){const o=e[l];if(/\s/.test(o)){l++;continue}if(o==='"'||o==="'"){const a=o,i=l;l++;let r="";for(;l<e.length;){if(e[l]===a){if(e[l+1]===a){r+=a,l+=2;continue}l++;break}r+=e[l],l++}n.push({type:"str",val:r,start:i});continue}if(/[0-9]/.test(o)||o==="."){const a=l;let i="";for(o==="."&&(i+=".",l++);l<e.length&&/[0-9]/.test(e[l]);)i+=e[l],l++;if(e[l]===".")for(i+=".",l++;l<e.length&&/[0-9]/.test(e[l]);)i+=e[l],l++;if(e[l]==="e"||e[l]==="E")for(i+=e[l],l++,(e[l]==="+"||e[l]==="-")&&(i+=e[l],l++);l<e.length&&/[0-9]/.test(e[l]);)i+=e[l],l++;n.push({type:"num",val:i,start:a});continue}if(/[A-Za-z_$]/.test(o)){const a=l;let i="";for(;l<e.length&&/[A-Za-z0-9_$]/.test(e[l]);)i+=e[l],l++;e[l]==="("&&!i.includes("$")?n.push({type:"func",val:i,start:a}):n.push({type:"ref",val:i,start:a});continue}if(o==="("){n.push({type:"lp",val:o,start:l}),l++;continue}if(o===")"){n.push({type:"rp",val:o,start:l}),l++;continue}if(o===","){n.push({type:"comma",val:o,start:l}),l++;continue}if(o==="+"||o==="-"||o==="*"||o==="/"){n.push({type:"op",val:o,start:l}),l++;continue}if(o==="<"||o===">"||o==="="){const a=e.slice(l,l+2);a==="<="||a===">="||a==="<>"?(n.push({type:"cmp",val:a,start:l}),l+=2):(n.push({type:"cmp",val:o,start:l}),l++);continue}l++}return n}function xo(e,n,l){if(typeof e!="number"||typeof n!="number")return null;switch(l){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return n===0?null:e/n}return null}function vr(e,n,l,o,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=Sn(n.trim(),o,a);if(!r)return null;if(e==="COUNT"){let f=0;for(let y=r.sc;y<=r.ec;y++)for(let h=r.sr;h<=r.er;h++)typeof xl(y,h,l,o,a)=="number"&&f++;return f}let d=0;for(let f=r.sc;f<=r.ec;f++)for(let y=r.sr;y<=r.er;y++)d+=gr(f,y,l,o,a);if(isNaN(d))return null;if(e==="AVERAGE"){const f=(r.ec-r.sc+1)*(r.er-r.sr+1);return f===0?null:d/f}return d}case"AND":case"OR":{const r=Kl(n);if(r.length===0)return null;let d=e==="AND";for(const f of r){const y=Vt(f,l,o,a,i);if(y===null)return null;if(e==="AND"){if(!Mn(y))return 0}else if(Mn(y))return 1}return d?1:0}case"NOT":{const r=Kl(n);if(r.length!==1)return null;const d=Vt(r[0],l,o,a,i);return d===null?null:Mn(d)?0:1}case"IF":{const r=Kl(n);if(r.length<3)return null;const d=wr(r[0],l,o,a,i);return Vt(d?r[1]:r[2],l,o,a,i)}case"VLOOKUP":{const r=Kl(n);if(r.length<3)return null;const d=Vt(r[0],l,o,a,i),f=Sn(r[1].trim(),o,a);if(!f)return null;const y=Vt(r[2],l,o,a,i),h=typeof y=="number"?y:parseFloat(String(y));if(isNaN(h))return null;const u=f.sc+(h-1);if(u<f.sc||u>f.ec)return null;if(r.length>=4?Mn(Vt(r[3],l,o,a,i)):!1){let x=-1,k=-1/0;for(let H=f.sr;H<=f.er;H++){const Y=xl(f.sc,H,l,o,a);typeof Y=="number"&&typeof d=="number"&&Y<=d&&Y>k&&(k=Y,x=H)}return x>=0?xl(u,x,l,o,a):null}for(let x=f.sr;x<=f.er;x++){const k=xl(f.sc,x,l,o,a);if(yr(k,d))return xl(u,x,l,o,a)}return null}case"CONCATENATE":{const r=Kl(n);let d="";for(const f of r){const y=Vt(f,l,o,a,i);d+=y===null?"":typeof y=="number"?String(y):y}return d}case"MAX":case"MIN":{const r=Sn(n.trim(),o,a);if(!r)return null;const d=[];for(let f=r.sc;f<=r.ec;f++)for(let y=r.sr;y<=r.er;y++){const h=xl(f,y,l,o,a);typeof h=="number"&&d.push(h)}return d.length===0?null:e==="MAX"?Math.max(...d):Math.min(...d)}case"STDEV":{const r=Sn(n.trim(),o,a);if(!r)return null;const d=[];for(let u=r.sc;u<=r.ec;u++)for(let E=r.sr;E<=r.er;E++){const x=xl(u,E,l,o,a);typeof x=="number"&&d.push(x)}const f=d.length;if(f<2)return null;const y=d.reduce((u,E)=>u+E,0)/f,h=d.reduce((u,E)=>u+Math.pow(E-y,2),0)/(f-1);return Math.sqrt(h)}case"SIN":{const r=Kl(n);if(r.length!==1)return null;const d=Vt(r[0],l,o,a,i);return typeof d!="number"?null:Math.sin(d)}case"SUMIF":{const r=Kl(n);if(r.length<2||r.length>3)return null;const d=Sn(r[0].trim(),o,a);if(!d)return null;const f=r.length===3?Sn(r[2].trim(),o,a):d;if(!f)return null;let y=0;for(let h=d.sr;h<=d.er;h++)for(let u=d.sc;u<=d.ec;u++){const E=xl(u,h,l,o,a);_d(E,r[1])&&(y+=gr(f.sc+(u-d.sc),f.sr+(h-d.sr),l,o,a))}return y}case"PMT":{const r=Kl(n);if(r.length<3||r.length>5)return null;const d=Vt(r[0],l,o,a,i),f=Vt(r[1],l,o,a,i),y=Vt(r[2],l,o,a,i);if(typeof d!="number"||typeof f!="number"||typeof y!="number")return null;const h=r.length>=4?Vt(r[3],l,o,a,i):0,u=typeof h=="number"?h:0,E=r.length>=5?Vt(r[4],l,o,a,i):0,x=Mn(E)?1:0;if(d===0)return f===0?null:-(y+u)/f;const k=Math.pow(1+d,f);return-(u+y*k)*d/((1+d*x)*(k-1))}default:return null}}function Zn(e,n,l){const o=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=ll(i[1],n,l);if(r)if(i[2]){const d=ll(i[2],n,l);if(!d)continue;for(let f=Math.min(r.col,d.col);f<=Math.max(r.col,d.col);f++)for(let y=Math.min(r.row,d.row);y<=Math.max(r.row,d.row);y++)o.push(Rn(f,y))}else o.push(Rn(r.col,r.row))}return o}function kr(e,n,l,o,a){const i=l[Rn(e,n)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const d=br(Rn(e,n),l,o,a);return d===null?"#ERROR":String(d)}function Er(e,n,l,o){return Vt(e,n,l,o,0)}function Rr(e,n,l,o){const a=e.trim().replace(/^=/,"");return a?wr(a,n,l,o,0):!1}function Jn(e,n,l,o,a,i){return n===0&&l===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,d,f,y,h)=>{const u=d?Bo(f):Bo(f)+n,E=y?parseInt(h,10)-1:parseInt(h,10)-1+l;let x;u<0?x="A":u>=o?x=i(o-1):x=i(u);let k;return E<0?k="1":E>=a?k=String(a):k=String(E+1),(d||"")+x+(y||"")+k})}class Od{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(n){var o;const l=this.deps.get(n);if(l){for(const a of l)(o=this.rev.get(a))==null||o.delete(n);this.deps.delete(n)}}set(n,l){if(this.clear(n),l.length!==0){this.deps.set(n,l);for(const o of l)this.rev.has(o)||this.rev.set(o,new Set),this.rev.get(o).add(n)}}markDirty(n){const l=[n];for(;l.length>0;){const o=l.pop(),a=this.rev.get(o);if(a)for(const i of a)this.dirty.has(i)||(this.dirty.add(i),l.push(i))}}getDirtyAndClear(){const n=this.dirty;return this.dirty=new Set,n}rebuild(n,l,o){this.deps.clear(),this.rev.clear(),this.dirty.clear(),Fn.clear();for(const[a,i]of Object.entries(n))if(i.value.startsWith("=")){const r=Zn(i.value.slice(1),l,o);this.set(a,r)}}}const $d={class:"ifn-dialog__header"},Hd={class:"ifn-dialog__title"},zd={class:"ifn-dialog__body"},Wd={class:"ifn-dialog__field"},Pd={class:"ifn-dialog__label"},Ud={key:0,class:"ifn-dialog__desc"},Kd={class:"ifn-dialog__field"},Gd={class:"ifn-dialog__label"},qd={class:"ifn-dialog__footer"},Yd=["disabled"],Xd=St(t.defineComponent({__name:"insert-function-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","insert","cancel"],setup(e,{emit:n}){const l=e,o=n,a=t.ref(!1),i=t.ref(""),r=t.ref(""),d=t.ref(null),f=t.ref(null),y={SUM:"fnDescSum",AVERAGE:"fnDescAverage",COUNT:"fnDescCount",IF:"fnDescIf",VLOOKUP:"fnDescVlookup",CONCATENATE:"fnDescConcatenate",MAX:"fnDescMax",MIN:"fnDescMin",SIN:"fnDescSin",SUMIF:"fnDescSumif",PMT:"fnDescPmt",STDEV:"fnDescStdev"},h=t.computed(()=>pr.map(X=>({label:X.name,value:X.name}))),u=t.computed(()=>{const X=String(i.value??"");return X?b(l.locale,y[X]??""):""}),E=t.computed(()=>Id(r.value)),x=t.computed(()=>i.value===""||i.value===null||!r.value.trim()||!E.value.ok?!1:E.value.name===String(i.value).toUpperCase());t.watch(()=>l.modelOpen,X=>{X&&!a.value?k():!X&&a.value&&H()});function k(){r.value="",i.value="",a.value=!0,l.modelOpen!==void 0&&o("update:modelOpen",!0),t.nextTick(()=>{const X=d.value;if(X)try{X.focus({preventScroll:!0}),X.setSelectionRange(X.value.length,X.value.length)}catch{}})}function H(){a.value=!1,l.modelOpen!==void 0&&o("update:modelOpen",!1)}function Y(X){i.value=X;const te=pr.find(Ne=>Ne.name===String(X));te&&(r.value="",ne(te.snippet))}function ne(X){const te=r.value,Ne=d.value,ze=Ne?Ne.selectionStart??te.length:te.length,Ve=Ne?Ne.selectionEnd??te.length:te.length,Fe=te.trim()?X:"="+X;r.value=te.slice(0,ze)+Fe+te.slice(Ve),t.nextTick(()=>{const je=d.value;if(!je)return;const _e=ze+Fe.length;try{je.focus({preventScroll:!0}),je.setSelectionRange(_e,_e)}catch{}})}function ee(){o("insert",r.value),H()}function M(){o("cancel"),H()}function se(X){X.key==="Escape"&&(X.stopPropagation(),M())}return(X,te)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"ifn-dialog"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"ifn-dialog__mask",onMousedown:t.withModifiers(M,["self"]),onKeydown:se},[t.createElementVNode("div",{ref_key:"dialogRef",ref:f,class:"ifn-dialog",onMousedown:te[1]||(te[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",$d,[t.createElementVNode("span",Hd,t.toDisplayString(t.unref(b)(e.locale,"insertFunctionTitle")),1),t.createElementVNode("button",{class:"ifn-dialog__close",type:"button",onClick:M},[...te[2]||(te[2]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])])]),t.createElementVNode("div",zd,[t.createElementVNode("div",Wd,[t.createElementVNode("label",Pd,t.toDisplayString(t.unref(b)(e.locale,"insertFunctionSelectLabel")),1),t.createVNode(Dt,{class:"ifn-dialog__dropdown","model-value":i.value,options:h.value,searchable:!0,"search-placeholder":t.unref(b)(e.locale,"insertFunctionSearchPlaceholder"),"fallback-label":t.unref(b)(e.locale,"insertFunctionPlaceholder"),title:t.unref(b)(e.locale,"insertFunctionSelectLabel"),"onUpdate:modelValue":Y},null,8,["model-value","options","search-placeholder","fallback-label","title"]),u.value?(t.openBlock(),t.createElementBlock("div",Ud,t.toDisplayString(u.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",Kd,[t.createElementVNode("label",Gd,t.toDisplayString(t.unref(b)(e.locale,"insertFunctionFormulaLabel")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:d,"onUpdate:modelValue":te[0]||(te[0]=Ne=>r.value=Ne),class:"ifn-dialog__textarea",spellcheck:"false"},null,512),[[t.vModelText,r.value]])])]),t.createElementVNode("div",qd,[t.createElementVNode("button",{class:"ifn-dialog__btn ifn-dialog__btn--primary",type:"button",disabled:!x.value,onClick:ee},t.toDisplayString(t.unref(b)(e.locale,"insertFunctionBtn")),9,Yd),t.createElementVNode("button",{class:"ifn-dialog__btn",type:"button",onClick:M},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-9b21a714"]]),In="__filter_blank__";function Do(e,n,l,o){if(Cl(e))return Number(e);if(o==="date"){const a=Nl(e,l);if(a)return a.serial}return null}function Qn(e,n,l){if(e==null)return null;if(Cl(e))return Number(e);if(n==="date"){const o=Nl(e,l);if(o)return o.serial}return null}function jd(e,n,l,o,a){const i=yl(n,l,o);switch(e.operator){case"blank":return n.trim()==="";case"notBlank":return n.trim()!=="";case"equals":case"notEquals":{const r=e.operator==="equals";if(a==="number"||a==="date"){const f=Do(n,l,o,a),y=Qn(e.value,a,o);return f==null||y==null?!1:r?f===y:f!==y}const d=i.toLowerCase()===(e.value??"").toLowerCase();return r?d:!d}case"contains":return i.toLowerCase().includes((e.value??"").toLowerCase());case"notContains":return!i.toLowerCase().includes((e.value??"").toLowerCase());case"startsWith":return i.toLowerCase().startsWith((e.value??"").toLowerCase());case"endsWith":return i.toLowerCase().endsWith((e.value??"").toLowerCase());case"gt":case"gte":case"lt":case"lte":{const r=Do(n,l,o,a),d=Qn(e.value,a,o);return r==null||d==null?!1:e.operator==="gt"?r>d:e.operator==="gte"?r>=d:e.operator==="lt"?r<d:r<=d}case"between":{const r=Do(n,l,o,a),d=Qn(e.value,a,o),f=Qn(e.value2,a,o);if(r==null||d==null||f==null)return!1;const y=Math.min(d,f),h=Math.max(d,f);return r>=y&&r<=h}}return!0}function Sr(e,n,l,o){if(e.type==="values"){const a=e.values??[];if(a.length===0)return!0;if(n.trim()==="")return a.includes(In);const i=yl(n,l,o);return a.includes(n)||a.includes(i)}return e.condition?jd(e.condition,n,l,o,e.type):!0}function Zd(e,n,l,o){if(!e)return!0;const{columns:a,range:i}=e;for(const r in a){const d=Number(r);if(d<i.startCol||d>i.endCol)continue;const f=a[r],y=l.getValue(d,n),h=l.getFormat(d,n);if(!Sr(f,y,h,o))return!1}return!0}function Jd(e,n,l,o){const a=new Set,i=[];let r=!1;const{range:d,columns:f}=e;for(let h=d.startRow+1;h<=d.endRow;h++){let u=!0;for(const k in f){const H=Number(k);if(H===n)continue;const Y=f[k];if(!Sr(Y,l.getValue(H,h),l.getFormat(H,h),o)){u=!1;break}}if(!u)continue;const E=l.getValue(n,h),x=yl(E,l.getFormat(n,h),o);if(E.trim()===""){r=!0;continue}a.has(x)||(a.add(x),i.push(x))}return i.length>0&&i.every(h=>Cl(h))?i.sort((h,u)=>Number(h)-Number(u)):i.sort((h,u)=>h.localeCompare(u,o,{numeric:!0})),{values:i,hasBlank:r}}function Mr(e){var n;return e?e.type==="values"?(((n=e.values)==null?void 0:n.length)??0)>0:!!e.condition:!1}const Qd={class:"filter-popup__head"},eu={class:"filter-popup__head-label"},tu={key:0,class:"filter-popup__head-badge"},lu={class:"filter-popup__search"},nu=["placeholder"],ou={class:"filter-popup__tools"},ru={class:"filter-popup__count"},au=["checked","onChange"],iu={class:"filter-popup__item-label"},su={key:0,class:"filter-popup__item-note"},cu={key:0,class:"filter-popup__empty"},du={class:"filter-popup__modes"},uu={key:1,class:"filter-popup__cond"},fu={class:"filter-popup__cond-row"},mu=["value"],pu={key:0,class:"filter-popup__cond-row"},hu={class:"filter-popup__cond-and"},gu={key:1,class:"filter-popup__cond-row"},bu=["placeholder"],yu={class:"filter-popup__footer"},Vo=248,eo=28,Cu=252,wu=St(t.defineComponent({__name:"filter-popup",props:{col:{},anchor:{},locale:{default:"zh-CN"},headerLabel:{},getFilter:{},setFilter:{},setFilterColumn:{},clearFilterColumn:{},getColumnCandidates:{},close:{}},setup(e){const n=e,l=t.ref(null),o=t.ref(null),a=t.ref(null),i=t.ref({left:0,top:0}),r=t.ref("values"),d=t.ref(""),f=t.ref(new Set),y=t.ref(!1),h=t.ref(0),u=t.ref(null),E=t.ref("equals"),x=t.ref(""),k=t.ref(""),H=t.computed(()=>n.getColumnCandidates(n.col)),Y=t.computed(()=>d.value.trim()!==""),ne=t.computed(()=>{const $=d.value.trim().toLowerCase();return $?H.value.values.filter(U=>U.toLowerCase().includes($)):H.value.values}),ee=t.computed(()=>{const $=ne.value.map(U=>({key:U,label:U,isBlank:!1}));return H.value.hasBlank&&!Y.value&&$.push({key:In,label:b(n.locale,"filterBlank"),isBlank:!0}),$}),M=Math.ceil(Cu/eo),se=t.computed(()=>Math.max(0,Math.floor(h.value/eo)-2)),X=t.computed(()=>Math.min(ee.value.length,se.value+M+4)),te=t.computed(()=>ee.value.slice(se.value,X.value)),Ne=t.computed(()=>se.value*eo),ze=t.computed(()=>Math.max(0,(ee.value.length-X.value)*eo));function Ve($){h.value=$.target.scrollTop}const Fe=["equals","notEquals","contains","notContains","startsWith","endsWith"],je=["equals","notEquals","gt","gte","lt","lte","between"],_e={equals:"filterEquals",notEquals:"filterNotEquals",contains:"filterContains",notContains:"filterNotContains",startsWith:"filterStartsWith",endsWith:"filterEndsWith",gt:"filterGreaterThan",gte:"filterGreaterThanOrEqual",lt:"filterLessThan",lte:"filterLessThanOrEqual",between:"filterBetween",blank:"filterBlank",notBlank:"filterNonBlank"},F=t.computed(()=>r.value==="text"?Fe:je),I=t.computed(()=>{var de;const $=n.getFilter(),U=$==null?void 0:$.columns[n.col];return U?U.type==="values"?(((de=U.values)==null?void 0:de.length)??0)>0:!!U.condition:!1});function G(){const $=n.getFilter(),U=$==null?void 0:$.columns[n.col];U&&U.type==="values"?(f.value=new Set((U.values??[]).filter(de=>de!==In)),y.value=(U.values??[]).includes(In)):U&&U.condition?(r.value=U.type,E.value=U.condition.operator,x.value=U.condition.value??"",k.value=U.condition.value2??""):(f.value=new Set(H.value.values),y.value=H.value.hasBlank)}function Ce(){if(!n.getFilter())return;const U=H.value.values,de=H.value.hasBlank;if(f.value.size===U.length&&U.every(ve=>f.value.has(ve))&&y.value===de)n.setFilterColumn(n.col,null);else{const ve=[...f.value];y.value&&ve.push(In),n.setFilterColumn(n.col,{type:"values",values:ve})}}function $e($){const U=new Set(f.value);U.has($)?U.delete($):U.add($),f.value=U}function j(){y.value=!y.value}function Be(){const $=Y.value?ne.value:H.value.values,U=new Set(f.value);$.forEach(de=>U.add(de)),f.value=U,y.value=!0}function Q(){f.value=new Set,y.value=!1}function ke($){r.value=$,E.value=$==="text"?"contains":"equals",x.value="",k.value=""}function B(){r.value="values",G()}function oe(){const $={operator:E.value,value:x.value};r.value!=="text"&&E.value==="between"&&($.value2=k.value),x.value.trim()!==""&&(n.setFilterColumn(n.col,{type:r.value,condition:$}),n.close())}function Z(){f.value=new Set(H.value.values),y.value=H.value.hasBlank}function re(){Ce(),n.close()}function K(){u.value&&n.setFilter(u.value),n.close()}function L($){const U=l.value;U&&$.target instanceof Node&&U.contains($.target)||n.close()}function J($){$.key==="Escape"&&K()}return t.onMounted(async()=>{var Le,ve;u.value=n.getFilter()?JSON.parse(JSON.stringify(n.getFilter())):null,G(),await t.nextTick();const $=((Le=l.value)==null?void 0:Le.offsetHeight)??400;let U=n.anchor.x+15-Vo,de=n.anchor.y+24;U<4&&(U=Math.max(4,n.anchor.x)),U+Vo>window.innerWidth-4&&(U=Math.max(4,window.innerWidth-Vo-4)),de+$>window.innerHeight-4&&(de=Math.max(4,n.anchor.y-$-4)),i.value={left:U,top:de},(ve=a.value)==null||ve.focus(),document.addEventListener("pointerdown",L,!0),document.addEventListener("keydown",J,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",L,!0),document.removeEventListener("keydown",J,!0)}),($,U)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{ref_key:"rootRef",ref:l,class:"filter-popup",style:t.normalizeStyle({left:i.value.left+"px",top:i.value.top+"px"}),onPointerdown:U[9]||(U[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Qd,[t.createElementVNode("span",eu,t.toDisplayString(e.headerLabel||t.unref(lt)(e.col)),1),I.value?(t.openBlock(),t.createElementBlock("span",tu,t.toDisplayString(t.unref(b)(e.locale,"filterActive")),1)):t.createCommentVNode("",!0)]),r.value==="values"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",lu,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchInputRef",ref:a,"onUpdate:modelValue":U[0]||(U[0]=de=>d.value=de),class:"filter-popup__search-input",type:"text",placeholder:t.unref(b)(e.locale,"filterSearchPlaceholder")},null,8,nu),[[t.vModelText,d.value]])]),t.createElementVNode("div",ou,[t.createElementVNode("button",{class:"filter-popup__tool",onClick:Be},t.toDisplayString(t.unref(b)(e.locale,"filterSelectAll")),1),t.createElementVNode("button",{class:"filter-popup__tool",onClick:Q},t.toDisplayString(t.unref(b)(e.locale,"filterClearAll")),1),t.createElementVNode("span",ru,t.toDisplayString(t.unref(b)(e.locale,"filterFilteredCount").replace("{n}",String(H.value.values.length))),1)]),t.createElementVNode("div",{ref_key:"listRef",ref:o,class:"filter-popup__list",onScroll:Ve},[t.createElementVNode("div",{style:t.normalizeStyle({height:Ne.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te.value,de=>(t.openBlock(),t.createElementBlock("label",{key:de.key,class:"filter-popup__item"},[t.createElementVNode("input",{type:"checkbox",checked:de.isBlank?y.value:f.value.has(de.key),onChange:Le=>de.isBlank?j():$e(de.key)},null,40,au),t.createElementVNode("span",iu,t.toDisplayString(de.label),1),de.isBlank?(t.openBlock(),t.createElementBlock("span",su,"("+t.toDisplayString(t.unref(b)(e.locale,"filterBlank"))+")",1)):t.createCommentVNode("",!0)]))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:ze.value+"px"})},null,4),ee.value.length===0?(t.openBlock(),t.createElementBlock("div",cu,t.toDisplayString(t.unref(b)(e.locale,"filterNoData")),1)):t.createCommentVNode("",!0)],544),t.createElementVNode("div",du,[t.createElementVNode("button",{class:"filter-popup__mode",onClick:U[1]||(U[1]=de=>ke("text"))},t.toDisplayString(t.unref(b)(e.locale,"filterText")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:U[2]||(U[2]=de=>ke("number"))},t.toDisplayString(t.unref(b)(e.locale,"filterNumber")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:U[3]||(U[3]=de=>ke("date"))},t.toDisplayString(t.unref(b)(e.locale,"filterDate")),1)])],64)):(t.openBlock(),t.createElementBlock("div",uu,[t.createElementVNode("button",{class:"filter-popup__cond-back",onClick:B}," ← "+t.toDisplayString(t.unref(b)(e.locale,"filterCustom")),1),t.createElementVNode("div",fu,[t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":U[4]||(U[4]=de=>E.value=de),class:"filter-popup__cond-select"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(F.value,de=>(t.openBlock(),t.createElementBlock("option",{key:de,value:de},t.toDisplayString(t.unref(b)(e.locale,_e[de])),9,mu))),128))],512),[[t.vModelSelect,E.value]])]),E.value==="between"?(t.openBlock(),t.createElementBlock("div",pu,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":U[5]||(U[5]=de=>x.value=de),class:"filter-popup__cond-input",type:"text"},null,512),[[t.vModelText,x.value]]),t.createElementVNode("span",hu,t.toDisplayString(t.unref(b)(e.locale,"filterAnd")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":U[6]||(U[6]=de=>k.value=de),class:"filter-popup__cond-input",type:"text"},null,512),[[t.vModelText,k.value]])])):(t.openBlock(),t.createElementBlock("div",gu,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":U[7]||(U[7]=de=>x.value=de),class:"filter-popup__cond-input",type:"text",placeholder:r.value==="date"?"2024-01-01":"",onKeydown:t.withKeys(oe,["enter"])},null,40,bu),[[t.vModelText,x.value]])]))])),t.createElementVNode("div",yu,[t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--clear",onClick:Z},t.toDisplayString(t.unref(b)(e.locale,"clearFilter")),1),U[10]||(U[10]=t.createElementVNode("span",{class:"filter-popup__footer-spacer"},null,-1)),t.createElementVNode("button",{class:"filter-popup__btn",onClick:K},t.toDisplayString(t.unref(b)(e.locale,"cancelFilter")),1),t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--primary",onClick:U[8]||(U[8]=de=>r.value==="values"?re():oe())},t.toDisplayString(t.unref(b)(e.locale,"filterOk")),1)])],36)]))}}),[["__scopeId","data-v-f6b7d944"]]),vu={class:"cf-manager__header"},ku={class:"cf-manager__title"},Eu={key:0,class:"cf-manager__empty"},Ru={key:1,class:"cf-manager__list"},Su={class:"cf-rule__main"},Mu={class:"cf-rule__info"},Bu={class:"cf-rule__summary"},Tu={class:"cf-rule__range"},Nu={class:"cf-rule__actions"},xu={class:"cf-chk"},Du=["checked","onChange"],Vu=["title","onClick"],Fu=["title","onClick"],Iu=["title","onClick"],Au=["title","onClick"],_u=St(t.defineComponent({__name:"conditional-format-manager",props:{locale:{},rules:{default:()=>[]},themeVars:{default:()=>({})}},emits:["edit","delete","move","toggle","new","close"],setup(e,{emit:n}){const l=e,o=n,a=t.computed(()=>[...l.rules].sort((f,y)=>f.priority-y.priority));function i(f){return f.ranges.map(y=>{const h=lt(y.startCol)+(y.startRow+1);return y.startCol===y.endCol&&y.startRow===y.endRow?h:h+":"+lt(y.endCol)+(y.endRow+1)}).join(", ")}function r(f){switch(f.type){case"cellIs":{const y=b(l.locale,"cf"+(f.operator==="greaterThan"?"GreaterThan":f.operator==="lessThan"?"LessThan":f.operator==="greaterThanOrEqual"?"GreaterThanOrEqual":f.operator==="lessThanOrEqual"?"LessThanOrEqual":f.operator==="notEqual"?"NotEqual":f.operator==="between"?"Between":f.operator==="notBetween"?"NotBetween":"Equal"));return f.operator==="between"||f.operator==="notBetween"?`${y} ${f.value} ${b(l.locale,"cfValue2")} ${f.value2??""}`:`${y} ${f.value}`}case"textContains":return`${b(l.locale,"cfTextContains")} "${f.value}"`;case"textNotContains":return`${b(l.locale,"cfTextNotContains")} "${f.value}"`;case"blank":return b(l.locale,"cfBlank");case"notBlank":return b(l.locale,"cfNotBlank");case"duplicate":return b(l.locale,"cfDuplicate");case"unique":return b(l.locale,"cfUnique");case"formula":return"= "+f.formula;default:return b(l.locale,"cfRuleTypeGeneric")}}function d(f){const y={};return f.format.backgroundColor&&(y.background=f.format.backgroundColor),f.format.color&&(y.color=f.format.color),f.format.fontWeight==="bold"&&(y.fontWeight="700"),f.format.fontStyle==="italic"&&(y.fontStyle="italic"),f.format.underline==="underline"&&(y.textDecoration="underline"),f.format.strikethrough==="line-through"&&(y.textDecoration="line-through"),y}return(f,y)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-manager",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",vu,[t.createElementVNode("span",ku,t.toDisplayString(t.unref(b)(e.locale,"cfManagerTitle")),1),t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary cf-manager__new",onClick:y[0]||(y[0]=h=>o("new"))},t.toDisplayString(t.unref(b)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-manager__close",onClick:y[1]||(y[1]=h=>o("close"))}," × ")]),a.value.length===0?(t.openBlock(),t.createElementBlock("div",Eu,t.toDisplayString(t.unref(b)(e.locale,"cfNoRules")),1)):(t.openBlock(),t.createElementBlock("div",Ru,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,h=>(t.openBlock(),t.createElementBlock("div",{key:h.id,class:t.normalizeClass(["cf-rule",{"cf-rule--disabled":!h.enabled}])},[t.createElementVNode("div",Su,[t.createElementVNode("span",{class:"cf-rule__preview",style:t.normalizeStyle(d(h))},"Aa",4),t.createElementVNode("div",Mu,[t.createElementVNode("div",Bu,t.toDisplayString(r(h.condition)),1),t.createElementVNode("div",Tu,t.toDisplayString(t.unref(b)(e.locale,"cfAppliedTo"))+": "+t.toDisplayString(i(h)),1)])]),t.createElementVNode("div",Nu,[t.createElementVNode("label",xu,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:h.enabled,onChange:u=>o("toggle",h.id,u.target.checked)},null,40,Du),y[2]||(y[2]=t.createElementVNode("span",{class:"cf-chk__box"},[t.createElementVNode("svg",{class:"cf-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"cfEnabled")),1)]),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(b)(e.locale,"cfMoveUp"),onClick:u=>o("move",h.id,"up")},[...y[3]||(y[3]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M8 3 L8 13 M4 7 L8 3 L12 7"})],-1)])],8,Vu),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(b)(e.locale,"cfMoveDown"),onClick:u=>o("move",h.id,"down")},[...y[4]||(y[4]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M8 3 L8 13 M4 9 L8 13 L12 9"})],-1)])],8,Fu),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(b)(e.locale,"cfEdit"),onClick:u=>o("edit",h)},[...y[5]||(y[5]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M10.5 3.5 L13 6 L5 14 L2 14 L2 11 Z"}),t.createElementVNode("path",{d:"M9 5.5 L11.5 8"})],-1)])],8,Iu),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(b)(e.locale,"cfDelete"),onClick:u=>o("delete",h.id)},[...y[6]||(y[6]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"},[t.createElementVNode("path",{d:"M4.5 4.5 L11.5 11.5 M11.5 4.5 L4.5 11.5"})],-1)])],8,Au)])],2))),128))]))],4))}}),[["__scopeId","data-v-230c5fcf"]]),Lu={class:"cf-editor__header"},Ou={class:"cf-editor__title"},$u={class:"cf-editor__body"},Hu={class:"cf-row"},zu={class:"cf-label"},Wu={class:"cf-row"},Pu={class:"cf-label"},Uu={class:"cf-row"},Ku={class:"cf-label"},Gu={key:0,class:"cf-row"},qu={class:"cf-label"},Yu={class:"cf-row"},Xu={class:"cf-label"},ju=["placeholder"],Zu={class:"cf-hint"},Ju={key:2,class:"cf-row"},Qu={class:"cf-label"},ef={class:"cf-row"},tf={class:"cf-label"},lf={class:"cf-format-row"},nf=["title"],of={viewBox:"0 0 1024 1024",fill:"currentColor"},rf=["fill"],af=["title"],sf={viewBox:"0 0 1024 1024",fill:"currentColor"},cf=["fill"],df=["title"],uf=["title"],ff=["title"],mf=["title"],pf={class:"cf-row"},hf={class:"cf-label"},gf={key:3,class:"cf-error"},bf={class:"cf-row cf-row--inline"},yf={class:"cf-chk"},Cf=["checked"],wf={class:"cf-chk"},vf=["checked"],kf={class:"cf-editor__footer"},Ef=St(t.defineComponent({__name:"conditional-format-rule-editor",props:{locale:{},mode:{},rule:{default:null},defaultRangeText:{default:""},themeVars:{default:()=>({})}},emits:["save","cancel"],setup(e,{emit:n}){const l=e,o=n,a=[{label:"cfCellIs",value:"cellIs"},{label:"cfTextContains",value:"textContains"},{label:"cfTextNotContains",value:"textNotContains"},{label:"cfBlank",value:"blank"},{label:"cfNotBlank",value:"notBlank"},{label:"cfDuplicate",value:"duplicate"},{label:"cfUnique",value:"unique"},{label:"cfFormulaShort",value:"formula"}],i=[{label:"cfEqual",value:"equal"},{label:"cfNotEqual",value:"notEqual"},{label:"cfGreaterThan",value:"greaterThan"},{label:"cfGreaterThanOrEqual",value:"greaterThanOrEqual"},{label:"cfLessThan",value:"lessThan"},{label:"cfLessThanOrEqual",value:"lessThanOrEqual"},{label:"cfBetween",value:"between"},{label:"cfNotBetween",value:"notBetween"}];function r(){if(l.rule){const F=l.rule.condition;return{type:F.type==="cellIs"||F.type==="textContains"||F.type==="textNotContains"||F.type==="blank"||F.type==="notBlank"||F.type==="duplicate"||F.type==="unique"||F.type==="formula"?F.type:"cellIs",operator:F.type==="cellIs"?F.operator:"greaterThan",value:F.type==="cellIs"||F.type==="textContains"||F.type==="textNotContains"?F.value:"",value2:F.type==="cellIs"?F.value2??"":"",formula:F.type==="formula"?F.formula:"",backgroundColor:l.rule.format.backgroundColor??"",color:l.rule.format.color??"",fontWeight:l.rule.format.fontWeight==="bold",fontStyle:l.rule.format.fontStyle==="italic",underline:l.rule.format.underline==="underline",strikethrough:l.rule.format.strikethrough==="line-through",rangeText:l.rule.ranges.length?l.rule.ranges.map(G=>x(G)).join(", "):l.defaultRangeText,stopIfTrue:l.rule.stopIfTrue,enabled:l.rule.enabled}}return{type:"cellIs",operator:"greaterThan",value:"",value2:"",formula:"",backgroundColor:"#DEEBF7",color:"#17375E",fontWeight:!1,fontStyle:!1,underline:!1,strikethrough:!1,rangeText:l.defaultRangeText,stopIfTrue:!1,enabled:!0}}const d=t.reactive(r()),f=t.ref(!1),y=t.ref(!1),h=t.ref(null),u=t.ref(null),E=t.ref("");function x(F){const I=lt(F.startCol)+(F.startRow+1);return F.startCol===F.endCol&&F.startRow===F.endRow?I:I+":"+lt(F.endCol)+(F.endRow+1)}function k(F){const I=F.split(",").map(Ce=>Ce.trim()).filter(Boolean),G=[];for(const Ce of I){if(!Ce.match(/^[A-Za-z]+\d+(?::[A-Za-z]+\d+)?$/i))return null;const j=ll(Ce.split(":")[0],99999,99999),Be=Ce.split(":")[1],Q=Be?ll(Be,99999,99999):j;if(!j||!Q)return null;G.push({startCol:Math.min(j.col,Q.col),endCol:Math.max(j.col,Q.col),startRow:Math.min(j.row,Q.row),endRow:Math.max(j.row,Q.row)})}return G.length?G:null}const H=t.computed(()=>d.type==="cellIs"&&(d.operator==="between"||d.operator==="notBetween")),Y=t.computed(()=>d.type==="formula"),ne=t.computed(()=>["blank","notBlank","duplicate","unique"].includes(d.type)),ee=t.computed(()=>a.map(F=>({value:F.value,label:b(l.locale,F.label)}))),M=t.computed(()=>i.map(F=>({value:F.value,label:b(l.locale,F.label)})));function se(F){d.type=F}function X(F){d.operator=String(F)}function te(){f.value=!f.value}function Ne(){y.value=!y.value}function ze(){return E.value="",k(d.rangeText)?Y.value&&!d.formula.trim()?(E.value="请输入公式",!1):!0:(E.value="范围格式无效,例如 A1:B10",!1)}function Ve(){switch(d.type){case"cellIs":return{type:"cellIs",operator:d.operator,value:d.value,value2:d.value2||void 0};case"textContains":return{type:"textContains",value:d.value};case"textNotContains":return{type:"textNotContains",value:d.value};case"blank":return{type:"blank"};case"notBlank":return{type:"notBlank"};case"duplicate":return{type:"duplicate"};case"unique":return{type:"unique"};case"formula":return{type:"formula",formula:d.formula}}}function Fe(){return{backgroundColor:d.backgroundColor||void 0,color:d.color||void 0,fontWeight:d.fontWeight?"bold":"",fontStyle:d.fontStyle?"italic":"",underline:d.underline?"underline":"",strikethrough:d.strikethrough?"line-through":""}}function je(){var G,Ce;if(!ze())return;const F=k(d.rangeText),I={id:((G=l.rule)==null?void 0:G.id)??"",condition:Ve(),format:Fe(),ranges:F,priority:((Ce=l.rule)==null?void 0:Ce.priority)??0,stopIfTrue:d.stopIfTrue,enabled:d.enabled};o("save",I)}function _e(){o("cancel")}return(F,I)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Lu,[t.createElementVNode("span",Ou,t.toDisplayString(e.mode==="edit"?t.unref(b)(e.locale,"cfEdit"):t.unref(b)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-editor__close",onClick:_e}," × ")]),t.createElementVNode("div",$u,[t.createElementVNode("div",Hu,[t.createElementVNode("label",zu,t.toDisplayString(t.unref(b)(e.locale,"cfType")),1),t.createVNode(Dt,{class:"cf-dropdown","model-value":d.type,options:ee.value,width:"100%","visible-count":8,title:t.unref(b)(e.locale,"cfType"),align:"right",onChange:se},null,8,["model-value","options","title"])]),d.type==="cellIs"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",Wu,[t.createElementVNode("label",Pu,t.toDisplayString(t.unref(b)(e.locale,"cfOperator")),1),t.createVNode(Dt,{class:"cf-dropdown","model-value":d.operator,options:M.value,width:"100%","visible-count":9,title:t.unref(b)(e.locale,"cfOperator"),align:"right",onChange:X},null,8,["model-value","options","title"])]),t.createElementVNode("div",Uu,[t.createElementVNode("label",Ku,t.toDisplayString(t.unref(b)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[0]||(I[0]=G=>d.value=G),class:"cf-input",type:"text"},null,512),[[t.vModelText,d.value]])]),H.value?(t.openBlock(),t.createElementBlock("div",Gu,[t.createElementVNode("label",qu,t.toDisplayString(t.unref(b)(e.locale,"cfValue2")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[1]||(I[1]=G=>d.value2=G),class:"cf-input",type:"text"},null,512),[[t.vModelText,d.value2]])])):t.createCommentVNode("",!0)],64)):Y.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",Yu,[t.createElementVNode("label",Xu,t.toDisplayString(t.unref(b)(e.locale,"cfFormulaShort")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[2]||(I[2]=G=>d.formula=G),class:"cf-input",type:"text",placeholder:t.unref(b)(e.locale,"cfFormulaExample")},null,8,ju),[[t.vModelText,d.formula]])]),t.createElementVNode("p",Zu,t.toDisplayString(t.unref(b)(e.locale,"cfFormula")),1)],64)):ne.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Ju,[t.createElementVNode("label",Qu,t.toDisplayString(t.unref(b)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[3]||(I[3]=G=>d.value=G),class:"cf-input",type:"text"},null,512),[[t.vModelText,d.value]])])),t.createElementVNode("div",ef,[t.createElementVNode("label",tf,t.toDisplayString(t.unref(b)(e.locale,"cfFormat")),1),t.createElementVNode("div",lf,[t.createElementVNode("button",{ref_key:"fillTrigger",ref:h,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":f.value}]),title:t.unref(b)(e.locale,"fillColor"),onClick:te},[(t.openBlock(),t.createElementBlock("svg",of,[I[15]||(I[15]=t.createElementVNode("path",{d:"M447.018667 37.952l352.298666 352.298667c6.613333 6.613333 6.613333 17.344 0 23.957333L446.101333 767.424a16.938667 16.938667 0 0 1-23.957333 0L121.429333 466.688a16.938667 16.938667 0 0 1 0-23.957333L428.608 135.552 388.992 96a8.469333 8.469333 0 0 1 0-11.989333l46.058667-46.037334a8.469333 8.469333 0 0 1 11.968 0z m346.325333 517.461333l57.514667 60.074667c31.744 33.194667 31.744 86.997333 0 120.192a78.869333 78.869333 0 0 1-115.008 0c-31.765333-33.194667-31.765333-86.997333 0-120.192l57.493333-60.074667zM486.101333 193.066667l-261.12 261.12 20.458667 20.458666 380.16-1.728 70.186667-70.186666-209.706667-209.664z"},null,-1)),t.createElementVNode("path",{d:"M85.333333 853.333333m8.896 0l835.541334 0q8.896 0 8.896 8.896l0 110.208q0 8.896-8.896 8.896l-835.541334 0q-8.896 0-8.896-8.896l0-110.208q0-8.896 8.896-8.896Z",fill:d.backgroundColor||"currentColor"},null,8,rf)]))],10,nf),t.createVNode(Yn,{"model-open":f.value,"color-key":"fill","current-color":d.backgroundColor,"trigger-el":h.value,locale:e.locale,"onUpdate:modelOpen":I[4]||(I[4]=G=>f.value=G),onChange:I[5]||(I[5]=G=>d.backgroundColor=G)},null,8,["model-open","current-color","trigger-el","locale"]),t.createElementVNode("button",{ref_key:"fontTrigger",ref:u,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":y.value}]),title:t.unref(b)(e.locale,"fontColor"),onClick:Ne},[(t.openBlock(),t.createElementBlock("svg",sf,[I[16]||(I[16]=t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M663.120842 529.946947H364.759579l-84.07579 212.884211a53.894737 53.894737 0 0 1-50.122105 34.169263h-14.551579a34.869895 34.869895 0 0 1-32.498526-47.696842L443.715368 70.063158a53.894737 53.894737 0 0 1 50.122106-34.115369h41.768421a53.894737 53.894737 0 0 1 50.176 34.277053l257.670737 659.078737a34.977684 34.977684 0 0 1-32.552421 47.696842h-14.389895a53.894737 53.894737 0 0 1-50.229895-34.277053l-83.159579-212.776421z m-35.139368-89.788631l-113.340632-289.953684-114.472421 289.953684h227.813053z"})],-1)),t.createElementVNode("path",{d:"M62.895 844.369m53.895 0l790.474 0q53.895 0 53.895 53.895l0 26.947q0 53.895-53.895 53.895l-790.474 0q-53.895 0-53.895-53.895l0-26.947q0-53.895 53.895-53.895z",fill:d.color||"#000000"},null,8,cf)]))],10,af),t.createVNode(Yn,{"model-open":y.value,"color-key":"text","current-color":d.color,"trigger-el":u.value,locale:e.locale,"onUpdate:modelOpen":I[6]||(I[6]=G=>y.value=G),onChange:I[7]||(I[7]=G=>d.color=G)},null,8,["model-open","current-color","trigger-el","locale"]),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":d.fontWeight}]),title:t.unref(b)(e.locale,"bold"),onClick:I[8]||(I[8]=G=>d.fontWeight=!d.fontWeight)},[...I[17]||(I[17]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M214.857 889.143v-68.571h68.571V203.429H214.857v-68.571h411.429v1.257c96.114 10.629 171.429 87.383 171.429 181.6 0 58.971-29.486 111.086-75.109 144.457 72.069 39.291 120.823 113.234 120.823 198.4 0 119.291-95.634 216.594-217.12 227.543l-0.286.029H214.857z m388.572-388.571H352v320h251.429c95.086 0 171.429-72.091 171.429-160s-76.343-160-171.429-160z m0-297.143H352v228.571h251.429l5.211-0.091c67.52-2.515 120.503-53.235 120.503-114.195 0-62.537-55.749-114.285-125.714-114.285z"})],-1)])],10,df),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":d.fontStyle}]),title:t.unref(b)(e.locale,"italic"),onClick:I[9]||(I[9]=G=>d.fontStyle=!d.fontStyle)},[...I[18]||(I[18]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M730.143 127.714v64.286h-112.329l-166.521 621.429h128.871v64.286H276.286v-64.286h108.45l166.5-621.429H426.286V127.714h303.857z"})],-1)])],10,uf),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":d.underline}]),title:t.unref(b)(e.locale,"underline"),onClick:I[10]||(I[10]=G=>d.underline=!d.underline)},[...I[19]||(I[19]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 123.639a36.409 36.409 0 0 1 33.642 22.525l230.59 558.27a36.409 36.409 0 1 1-67.284 27.768L638.072 560.545H385.928l-70.876 171.656a36.409 36.409 0 1 1-67.332-27.768l230.59-558.27A36.409 36.409 0 0 1 512 123.639z m-95.974 364.089h191.948L512 255.439l-95.974 232.289zM769.289 827.544c19.418 0 38.836 14.564 38.836 38.836 0 19.418-14.564 33.982-29.127 33.982H259.565c-19.418 0-38.836-14.564-38.836-38.836 0-19.418 14.564-33.982 29.127-33.982h519.433z"})],-1)])],10,ff),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":d.strikethrough}]),title:t.unref(b)(e.locale,"strikethrough"),onClick:I[11]||(I[11]=G=>d.strikethrough=!d.strikethrough)},[...I[20]||(I[20]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M182.044 490.667h659.911a34.133 34.133 0 0 1 4.642 67.948l-4.597 0.319h-135.395c40.05 37 60.803 81.601 60.803 133.575 0 128.569-147.092 211.171-307.382 192.512-101.717-11.833-173.352-52.565-210.944-122.971a34.133 34.133 0 0 1 60.211-32.176c25.942 48.606 77.46 77.915 158.606 87.381 124.837 14.473 231.242-45.283 231.242-124.746 0-53.339-36.636-96.802-116.736-131.345l-5.279-2.23H182.044a34.133 34.133 0 0 1-33.815-29.492L147.911 524.8a34.133 34.133 0 0 1 29.491-33.815l4.642-0.318z m68.767-176.447c6.918-128.796 128.432-203.343 287.812-184.82 99.579 11.56 175.81 47.923 226.737 109.636a34.133 34.133 0 1 1-52.657 43.463c-38.775-47.013-98.759-75.639-181.999-85.288-123.654-14.381-211.627 36.591-211.627 117.009 0 35.135 10.65 61.349 37.774 90.203l5.826 6.007c4.278 4.369 8.966 8.875 11.377 10.923l1.411 0.91H288.085l-1.092-1.729c-6.508-9.376-38.958-54.386-36.182-106.314z"})],-1)])],10,mf)])]),t.createElementVNode("div",pf,[t.createElementVNode("label",hf,t.toDisplayString(t.unref(b)(e.locale,"cfAppliedTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[12]||(I[12]=G=>d.rangeText=G),class:"cf-input",type:"text"},null,512),[[t.vModelText,d.rangeText]])]),E.value?(t.openBlock(),t.createElementBlock("div",gf,t.toDisplayString(E.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",bf,[t.createElementVNode("label",yf,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:d.stopIfTrue,onChange:I[13]||(I[13]=G=>d.stopIfTrue=G.target.checked)},null,40,Cf),I[21]||(I[21]=t.createElementVNode("span",{class:"cf-chk__box"},[t.createElementVNode("svg",{class:"cf-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"cfStopIfTrue")),1)]),t.createElementVNode("label",wf,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:d.enabled,onChange:I[14]||(I[14]=G=>d.enabled=G.target.checked)},null,40,vf),I[22]||(I[22]=t.createElementVNode("span",{class:"cf-chk__box"},[t.createElementVNode("svg",{class:"cf-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"cfEnabled")),1)])])]),t.createElementVNode("div",kf,[t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary",onClick:je},t.toDisplayString(t.unref(b)(e.locale,"ok")),1),t.createElementVNode("button",{type:"button",class:"cf-btn",onClick:_e},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-f625bb44"]]),Rf={class:"dv-editor__header"},Sf={class:"dv-editor__title"},Mf={class:"dv-editor__body"},Bf={class:"dv-sec"},Tf={class:"dv-sec__title"},Nf={class:"dv-row"},xf={class:"dv-label"},Df={class:"dv-row"},Vf={class:"dv-label"},Ff={class:"dv-hint"},If={class:"dv-row dv-row--inline"},Af={class:"dv-chk"},_f=["checked"],Lf={class:"dv-row"},Of={class:"dv-label"},$f={class:"dv-hint"},Hf={class:"dv-row"},zf={class:"dv-label"},Wf={key:0,class:"dv-row"},Pf={class:"dv-label"},Uf={class:"dv-row"},Kf={class:"dv-label"},Gf={class:"dv-row"},qf={class:"dv-label"},Yf={class:"dv-row dv-row--inline"},Xf=["checked","disabled"],jf=["checked","disabled"],Zf={class:"dv-sec"},Jf={class:"dv-sec__title"},Qf={class:"dv-row dv-row--inline"},em={class:"dv-chk"},tm=["checked"],lm={class:"dv-row"},nm={class:"dv-label"},om=["disabled"],rm={class:"dv-row dv-row--top"},am={class:"dv-label"},im=["disabled"],sm={class:"dv-sec"},cm={class:"dv-sec__title"},dm={class:"dv-row dv-row--inline"},um={class:"dv-chk"},fm=["checked"],mm={class:"dv-row"},pm={class:"dv-label"},hm={class:"dv-row"},gm={class:"dv-label"},bm=["disabled"],ym={class:"dv-row dv-row--top"},Cm={class:"dv-label"},wm=["disabled"],vm={class:"dv-sec"},km={class:"dv-row"},Em={class:"dv-label"},Rm={key:0,class:"dv-error"},Sm={class:"dv-editor__footer"},to="\\$?[A-Za-z]+\\$?\\d+",Mm=St(t.defineComponent({__name:"data-validation-dialog",props:{locale:{},mode:{},rule:{default:null},defaultRangeText:{default:""},themeVars:{default:()=>({})}},emits:["save","cancel","clear"],setup(e,{emit:n}){const l=e,o=n,a=[{label:"dvTypeAny",value:"any"},{label:"dvTypeList",value:"list"},{label:"dvTypeWholeNumber",value:"wholeNumber"},{label:"dvTypeDecimal",value:"decimal"},{label:"dvTypeDate",value:"date"},{label:"dvTypeTime",value:"time"},{label:"dvTypeTextLength",value:"textLength"},{label:"dvTypeCustom",value:"custom"}],i=[{label:"dvBetween",value:"between"},{label:"dvNotBetween",value:"notBetween"},{label:"dvEqual",value:"equal"},{label:"dvNotEqual",value:"notEqual"},{label:"dvGreaterThan",value:"greaterThan"},{label:"dvGreaterThanOrEqual",value:"greaterThanOrEqual"},{label:"dvLessThan",value:"lessThan"},{label:"dvLessThanOrEqual",value:"lessThanOrEqual"}],r=[{label:"dvStyleStop",value:"stop"},{label:"dvStyleWarning",value:"warning"},{label:"dvStyleInformation",value:"information"}];function d(F){const I=lt(F.startCol)+(F.startRow+1);return F.startCol===F.endCol&&F.startRow===F.endRow?I:I+":"+lt(F.endCol)+(F.endRow+1)}function f(F){const I=F==null?void 0:F.listSource;if((I==null?void 0:I.type)==="range"){const Ce=d(I.range);return I.sheetId?`${I.sheetId}!${Ce}`:Ce}return((I==null?void 0:I.type)==="values"?I.values:(F==null?void 0:F.values)??[]).join(",")}function y(){const F=l.rule;return{type:(F==null?void 0:F.type)??"any",operator:(F==null?void 0:F.operator)??"between",formula1:(F==null?void 0:F.formula1)??"",formula2:(F==null?void 0:F.formula2)??"",source:f(F),allowBlank:(F==null?void 0:F.allowBlank)!==!1,showDropdown:(F==null?void 0:F.showDropdown)!==!1,showInputMessage:(F==null?void 0:F.showInputMessage)===!0,inputTitle:(F==null?void 0:F.inputTitle)??"",inputMessage:(F==null?void 0:F.inputMessage)??"",showErrorMessage:(F==null?void 0:F.showErrorMessage)!==!1,errorStyle:(F==null?void 0:F.errorStyle)??"stop",errorTitle:(F==null?void 0:F.errorTitle)??"",errorMessage:(F==null?void 0:F.errorMessage)??"",rangeText:F&&F.ranges.length?F.ranges.map(d).join(", "):l.defaultRangeText,enabled:(F==null?void 0:F.enabled)!==!1}}const h=t.reactive(y()),u=t.ref(""),E=t.computed(()=>h.type==="list"),x=t.computed(()=>h.type==="custom"),k=t.computed(()=>["wholeNumber","decimal","date","time","textLength"].includes(h.type)),H=t.computed(()=>k.value&&(h.operator==="between"||h.operator==="notBetween")),Y=t.computed(()=>h.type==="any"),ne=t.computed(()=>a.map(F=>({value:F.value,label:b(l.locale,F.label)}))),ee=t.computed(()=>i.map(F=>({value:F.value,label:b(l.locale,F.label)}))),M=t.computed(()=>r.map(F=>({value:F.value,label:b(l.locale,F.label)})));function se(F){const I=F.split(",").map(Ce=>Ce.trim()).filter(Boolean),G=[];for(const Ce of I){if(!Ce.match(/^\$?[A-Za-z]+\$?\d+(?::\$?[A-Za-z]+\$?\d+)?$/))return null;const j=ll(Ce.split(":")[0],99999,99999),Be=Ce.split(":")[1],Q=Be?ll(Be,99999,99999):j;if(!j||!Q)return null;G.push({startCol:Math.min(j.col,Q.col),endCol:Math.max(j.col,Q.col),startRow:Math.min(j.row,Q.row),endRow:Math.max(j.row,Q.row)})}return G.length?G:null}function X(F){const I=F.trim();if(!I)return null;const G=new RegExp(`^(?:'([^']+)'|([^!'"]+))!(${to})(?::(${to}))?$`).exec(I);if(G){const j=(G[1]??G[2]??"").trim(),Be=ll(G[3],99999,99999),Q=G[4]?ll(G[4],99999,99999):Be;return!j||!Be||!Q?null:{type:"range",sheetId:j,range:{startCol:Math.min(Be.col,Q.col),endCol:Math.max(Be.col,Q.col),startRow:Math.min(Be.row,Q.row),endRow:Math.max(Be.row,Q.row)}}}const Ce=new RegExp(`^(${to})(?::(${to}))?$`).exec(I);if(Ce){const j=ll(Ce[1],99999,99999),Be=Ce[2]?ll(Ce[2],99999,99999):j;return!j||!Be?null:{type:"range",range:{startCol:Math.min(j.col,Be.col),endCol:Math.max(j.col,Be.col),startRow:Math.min(j.row,Be.row),endRow:Math.max(j.row,Be.row)}}}const $e=I.split(",").map(j=>j.trim());return $e.some(j=>j!=="")?{type:"values",values:$e}:null}const te=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function Ne(F,I){const G=I.trim();if(G==="")return b(l.locale,"dvValueRequired");if(G.startsWith("="))return null;const Ce=l.locale;switch(F){case"wholeNumber":case"textLength":{const $e=qn(G,Ce);return $e&&Number.isFinite($e.num)&&Number.isInteger($e.num)||te.test(G)&&Number.isInteger(Number(G))?null:b(Ce,"dvMustBeInteger")}case"decimal":{const $e=qn(G,Ce);return $e&&Number.isFinite($e.num)||te.test(G)&&Number.isFinite(Number(G))?null:b(Ce,"dvMustBeNumber")}case"date":{const $e=Nl(G,Ce);return $e&&$e.format!=="h:mm:ss"?null:b(Ce,"dvDateInvalid")}case"time":return Nl(G,Ce)?null:b(Ce,"dvTimeInvalid");default:return null}}function ze(){if(u.value="",!se(h.rangeText))return u.value=b(l.locale,"dvRangeInvalid"),!1;if(h.type==="any")return!0;if(E.value)return X(h.source)?!0:(u.value=b(l.locale,"dvSourceInvalid"),!1);if(x.value)return h.formula1.trim()?!0:(u.value=b(l.locale,"dvFormulaRequired"),!1);if(H.value){if(!h.formula1.trim())return u.value=b(l.locale,"dvMinRequired"),!1;if(!h.formula2.trim())return u.value=b(l.locale,"dvMaxRequired"),!1;const I=Ne(h.type,h.formula1);if(I)return u.value=`${b(l.locale,"dvMin")}:${I}`,!1;const G=Ne(h.type,h.formula2);return G?(u.value=`${b(l.locale,"dvMax")}:${G}`,!1):!0}if(!h.formula1.trim())return u.value=b(l.locale,"dvValueRequired"),!1;const F=Ne(h.type,h.formula1);return F?(u.value=`${b(l.locale,"dvValue")}:${F}`,!1):!0}function Ve(){var G,Ce;if(!ze())return;const F=se(h.rangeText);if(h.type==="any"){o("save",{id:((G=l.rule)==null?void 0:G.id)??"",type:"any",ranges:F,allowBlank:h.allowBlank,enabled:!0});return}const I={id:((Ce=l.rule)==null?void 0:Ce.id)??"",type:h.type,ranges:F,allowBlank:h.allowBlank,enabled:h.enabled,showInputMessage:h.showInputMessage,inputTitle:h.inputTitle||void 0,inputMessage:h.inputMessage||void 0,showErrorMessage:h.showErrorMessage,errorStyle:h.errorStyle,errorTitle:h.errorTitle||void 0,errorMessage:h.errorMessage||void 0};if(E.value){const $e=X(h.source);I.listSource=$e,I.values=$e.type==="values"?$e.values:void 0,I.showDropdown=h.showDropdown}else x.value?I.formula1=h.formula1.trim():(I.operator=h.operator,I.formula1=h.formula1.trim(),I.formula2=H.value?h.formula2.trim():void 0);o("save",I)}function Fe(F){h.type=F}function je(F){h.operator=String(F)}function _e(F){h.errorStyle=String(F)}return(F,I)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Rf,[t.createElementVNode("span",Sf,t.toDisplayString(t.unref(b)(e.locale,"dvDialogTitle")),1),t.createElementVNode("button",{type:"button",class:"dv-editor__close",onClick:I[0]||(I[0]=G=>o("cancel"))}," × ")]),t.createElementVNode("div",Mf,[t.createElementVNode("div",Bf,[t.createElementVNode("div",Tf,t.toDisplayString(t.unref(b)(e.locale,"dvSettings")),1),t.createElementVNode("div",Nf,[t.createElementVNode("label",xf,t.toDisplayString(t.unref(b)(e.locale,"dvAllow")),1),t.createVNode(Dt,{class:"dv-dropdown","model-value":h.type,options:ne.value,width:"100%","visible-count":8,title:t.unref(b)(e.locale,"dvAllow"),align:"right",onChange:Fe},null,8,["model-value","options","title"])]),E.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",Df,[t.createElementVNode("label",Vf,t.toDisplayString(t.unref(b)(e.locale,"dvSource")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[1]||(I[1]=G=>h.source=G),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.source]])]),t.createElementVNode("p",Ff,t.toDisplayString(t.unref(b)(e.locale,"dvSourceHint")),1),t.createElementVNode("div",If,[t.createElementVNode("label",Af,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.showDropdown,onChange:I[2]||(I[2]=G=>h.showDropdown=G.target.checked)},null,40,_f),I[18]||(I[18]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"dvShowDropdown")),1)])])],64)):x.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",Lf,[t.createElementVNode("label",Of,t.toDisplayString(t.unref(b)(e.locale,"dvFormula")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[3]||(I[3]=G=>h.formula1=G),class:"dv-input",type:"text",spellcheck:"false",placeholder:"=AND(A1>=0,A1<=100)"},null,512),[[t.vModelText,h.formula1]])]),t.createElementVNode("p",$f,t.toDisplayString(t.unref(b)(e.locale,"cfFormulaExample")),1)],64)):k.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",Hf,[t.createElementVNode("label",zf,t.toDisplayString(t.unref(b)(e.locale,"dvData")),1),t.createVNode(Dt,{class:"dv-dropdown","model-value":h.operator,options:ee.value,width:"100%","visible-count":9,title:t.unref(b)(e.locale,"dvOperator"),align:"right",onChange:je},null,8,["model-value","options","title"])]),H.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",Uf,[t.createElementVNode("label",Kf,t.toDisplayString(t.unref(b)(e.locale,"dvMin")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[5]||(I[5]=G=>h.formula1=G),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.formula1]])]),t.createElementVNode("div",Gf,[t.createElementVNode("label",qf,t.toDisplayString(t.unref(b)(e.locale,"dvMax")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[6]||(I[6]=G=>h.formula2=G),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.formula2]])])],64)):(t.openBlock(),t.createElementBlock("div",Wf,[t.createElementVNode("label",Pf,t.toDisplayString(t.unref(b)(e.locale,"dvValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[4]||(I[4]=G=>h.formula1=G),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.formula1]])]))],64)):t.createCommentVNode("",!0),t.createElementVNode("div",Yf,[t.createElementVNode("label",{class:t.normalizeClass(["dv-chk",{"dv-chk--disabled":Y.value}])},[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.allowBlank,disabled:Y.value,onChange:I[7]||(I[7]=G=>h.allowBlank=G.target.checked)},null,40,Xf),I[19]||(I[19]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"dvIgnoreBlank")),1)],2),t.createElementVNode("label",{class:t.normalizeClass(["dv-chk",{"dv-chk--disabled":Y.value}])},[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.enabled,disabled:Y.value,onChange:I[8]||(I[8]=G=>h.enabled=G.target.checked)},null,40,jf),I[20]||(I[20]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"cfEnabled")),1)],2)])]),t.createElementVNode("div",Zf,[t.createElementVNode("div",Jf,t.toDisplayString(t.unref(b)(e.locale,"dvInputMessageTab")),1),t.createElementVNode("div",Qf,[t.createElementVNode("label",em,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.showInputMessage,onChange:I[9]||(I[9]=G=>h.showInputMessage=G.target.checked)},null,40,tm),I[21]||(I[21]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"dvShowInputMessage")),1)])]),t.createElementVNode("div",lm,[t.createElementVNode("label",nm,t.toDisplayString(t.unref(b)(e.locale,"dvInputTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[10]||(I[10]=G=>h.inputTitle=G),class:"dv-input",type:"text",disabled:!h.showInputMessage},null,8,om),[[t.vModelText,h.inputTitle]])]),t.createElementVNode("div",rm,[t.createElementVNode("label",am,t.toDisplayString(t.unref(b)(e.locale,"dvInputMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":I[11]||(I[11]=G=>h.inputMessage=G),class:"dv-input dv-input--area",rows:"2",disabled:!h.showInputMessage},null,8,im),[[t.vModelText,h.inputMessage]])])]),t.createElementVNode("div",sm,[t.createElementVNode("div",cm,t.toDisplayString(t.unref(b)(e.locale,"dvErrorAlertTab")),1),t.createElementVNode("div",dm,[t.createElementVNode("label",um,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.showErrorMessage,onChange:I[12]||(I[12]=G=>h.showErrorMessage=G.target.checked)},null,40,fm),I[22]||(I[22]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"dvShowErrorAlert")),1)])]),t.createElementVNode("div",mm,[t.createElementVNode("label",pm,t.toDisplayString(t.unref(b)(e.locale,"dvErrorStyle")),1),t.createVNode(Dt,{class:"dv-dropdown","model-value":h.errorStyle,options:M.value,width:"100%","visible-count":4,title:t.unref(b)(e.locale,"dvErrorStyle"),align:"right",onChange:_e},null,8,["model-value","options","title"])]),t.createElementVNode("div",hm,[t.createElementVNode("label",gm,t.toDisplayString(t.unref(b)(e.locale,"dvErrorTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[13]||(I[13]=G=>h.errorTitle=G),class:"dv-input",type:"text",disabled:!h.showErrorMessage},null,8,bm),[[t.vModelText,h.errorTitle]])]),t.createElementVNode("div",ym,[t.createElementVNode("label",Cm,t.toDisplayString(t.unref(b)(e.locale,"dvErrorMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":I[14]||(I[14]=G=>h.errorMessage=G),class:"dv-input dv-input--area",rows:"2",disabled:!h.showErrorMessage},null,8,wm),[[t.vModelText,h.errorMessage]])])]),t.createElementVNode("div",vm,[t.createElementVNode("div",km,[t.createElementVNode("label",Em,t.toDisplayString(t.unref(b)(e.locale,"dvApplyTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[15]||(I[15]=G=>h.rangeText=G),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.rangeText]])])]),u.value?(t.openBlock(),t.createElementBlock("div",Rm,t.toDisplayString(u.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",Sm,[t.createElementVNode("button",{type:"button",class:"dv-btn dv-btn--danger",onClick:I[16]||(I[16]=G=>o("clear"))},t.toDisplayString(t.unref(b)(e.locale,"dvClearAll")),1),I[23]||(I[23]=t.createElementVNode("span",{class:"dv-editor__spacer"},null,-1)),t.createElementVNode("button",{type:"button",class:"dv-btn dv-btn--primary",onClick:Ve},t.toDisplayString(t.unref(b)(e.locale,"ok")),1),t.createElementVNode("button",{type:"button",class:"dv-btn",onClick:I[17]||(I[17]=G=>o("cancel"))},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-3f7d54bb"]]),Bm={key:0,class:"dvd__search"},Tm=["placeholder"],Nm=["onMouseenter","onClick"],xm={class:"dvd__check"},Dm={class:"dvd__label"},Vm={key:1,class:"dvd__empty"},cl=24,Fm=244,Im=140,Am=St(t.defineComponent({__name:"data-validation-dropdown",props:{items:{default:()=>[]},current:{default:""},locale:{default:"zh-CN"},x:{default:0},y:{default:0},width:{default:100},height:{default:24}},emits:["select","close"],setup(e,{emit:n}){const l=e,o=n,a=t.ref(""),i=t.ref(0),r=t.ref(0),d=t.ref(null),f=t.ref(null),y=t.ref(null),h=t.ref({left:l.x,top:l.y+l.height+2,up:!1}),u=t.computed(()=>{const F=a.value.trim().toLowerCase();return F?l.items.filter(I=>String(I??"").toLowerCase().includes(F)):l.items}),E=t.computed(()=>Math.min(Fm,Math.max(cl,u.value.length*cl))),x=t.computed(()=>Math.max(Im,Math.min(360,l.width))),k=t.computed(()=>Math.max(0,Math.floor(r.value/cl)-1)),H=t.computed(()=>Math.min(u.value.length,Math.ceil((r.value+E.value)/cl)+1)),Y=t.computed(()=>u.value.slice(k.value,H.value)),ne=t.computed(()=>k.value*cl),ee=t.computed(()=>Math.max(0,(u.value.length-H.value)*cl));function M(F){return String(F??"").trim().toLowerCase()===String(l.current??"").trim().toLowerCase()}function se(){const F=E.value+X(),I=window.innerHeight-(l.y+l.height)-8,G=l.y-8,Ce=I<F&&G>I;let $e=Ce?l.y-F-2:l.y+l.height+2;$e=Math.max(8,Math.min(window.innerHeight-F-8,$e));const j=Math.max(8,Math.min(window.innerWidth-x.value-8,l.x));h.value={left:j,top:$e,up:Ce}}function X(){return u.value.length>8||a.value?34:0}t.watch(()=>[l.x,l.y,l.width,l.height],()=>se()),t.onMounted(()=>{t.nextTick(()=>{var F;se(),d.value?d.value.focus():(F=y.value)==null||F.focus()}),document.addEventListener("pointerdown",te,!0),window.addEventListener("resize",Ne),window.addEventListener("scroll",Ne,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",te,!0),window.removeEventListener("resize",Ne),window.removeEventListener("scroll",Ne,!0)});function te(F){var I;(I=y.value)!=null&&I.contains(F.target)||Ne()}function Ne(){o("close")}function ze(F){const I=f.value;if(!I)return;const G=F*cl,Ce=G+cl;G<I.scrollTop?I.scrollTop=G:Ce>I.scrollTop+E.value&&(I.scrollTop=Ce-E.value)}function Ve(F){const I=u.value.length;I!==0&&(i.value=(i.value+F+I)%I,ze(i.value))}function Fe(F){const I=u.value[F];I!==void 0&&o("select",I)}function je(F){r.value=F.target.scrollTop}function _e(F){switch(F.key){case"ArrowDown":F.preventDefault(),F.stopPropagation(),Ve(1);return;case"ArrowUp":F.preventDefault(),F.stopPropagation(),Ve(-1);return;case"Home":F.preventDefault(),F.stopPropagation(),i.value=0,r.value=0,f.value&&(f.value.scrollTop=0);return;case"End":{F.preventDefault(),F.stopPropagation();const I=u.value.length;i.value=Math.max(0,I-1),ze(i.value);return}case"PageDown":F.preventDefault(),F.stopPropagation(),Ve(Math.max(1,Math.floor(E.value/cl)));return;case"PageUp":F.preventDefault(),F.stopPropagation(),Ve(-Math.max(1,Math.floor(E.value/cl)));return;case"Enter":F.preventDefault(),F.stopPropagation(),Fe(i.value);return;case"Escape":F.preventDefault(),F.stopPropagation(),Ne();return;case"Tab":F.preventDefault(),F.stopPropagation(),Fe(i.value);return}}return t.watch(a,()=>{i.value=0,r.value=0,f.value&&(f.value.scrollTop=0),t.nextTick(se)}),t.watch(u,F=>{const I=F.findIndex(G=>M(G));I>=0&&(i.value=I,t.nextTick(()=>ze(I)))},{immediate:!0}),(F,I)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:y,class:"dvd",tabindex:"-1",style:t.normalizeStyle({left:h.value.left+"px",top:h.value.top+"px",width:x.value+"px"}),onKeydown:_e,onWheel:I[2]||(I[2]=t.withModifiers(()=>{},["stop"]))},[X()>0?(t.openBlock(),t.createElementBlock("div",Bm,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchRef",ref:d,"onUpdate:modelValue":I[0]||(I[0]=G=>a.value=G),class:"dvd__search-input",type:"text",spellcheck:"false",placeholder:t.unref(b)(e.locale,"dvSearchPlaceholder"),onKeydown:_e},null,40,Tm),[[t.vModelText,a.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:f,class:"dvd__list",style:t.normalizeStyle({height:E.value+"px"}),onScroll:je},[t.createElementVNode("div",{style:t.normalizeStyle({height:ne.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Y.value,(G,Ce)=>(t.openBlock(),t.createElementBlock("div",{key:k.value+Ce,class:t.normalizeClass(["dvd__item",{"dvd__item--active":k.value+Ce===i.value,"dvd__item--checked":M(G)}]),style:t.normalizeStyle({height:cl+"px",lineHeight:cl+"px"}),onMousedown:I[1]||(I[1]=t.withModifiers(()=>{},["prevent"])),onMouseenter:$e=>i.value=k.value+Ce,onClick:$e=>Fe(k.value+Ce)},[t.createElementVNode("span",xm,t.toDisplayString(M(G)?"✓":""),1),t.createElementVNode("span",Dm,t.toDisplayString(G===""?"(空)":G),1)],46,Nm))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:ee.value+"px"})},null,4)],36),u.value.length===0?(t.openBlock(),t.createElementBlock("div",Vm,t.toDisplayString(t.unref(b)(e.locale,"dvNoMatch")),1)):t.createCommentVNode("",!0)],36))}}),[["__scopeId","data-v-9b17a184"]]),_m={class:"dv-alert__header"},Lm={class:"dv-alert__title"},Om={class:"dv-alert__body"},$m=["d"],Hm={class:"dv-alert__text"},zm={key:0,class:"dv-alert__subtitle"},Wm={class:"dv-alert__message"},Pm={class:"dv-alert__footer"},Um=St(t.defineComponent({__name:"data-validation-alert",props:{locale:{},severity:{},title:{default:""},message:{default:""},themeVars:{default:()=>({})}},emits:["resolve"],setup(e,{emit:n}){const l=e,o=n,a={stop:{color:"#d93025",path:"M512 64a448 448 0 1 0 0 896 448 448 0 0 0 0-896zm0 96a352 352 0 1 1 0 704 352 352 0 0 1 0-704zm-160 224h320a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64z"},warning:{color:"#f4b400",path:"M512 96l416 736H96L512 96zm0 128L192 768h640L512 224zm-32 128a32 32 0 0 1 32 32v160a32 32 0 0 1-64 0V384a32 32 0 0 1 32-32zm0 256a36 36 0 1 1 0 72 36 36 0 0 1 0-72z"},information:{color:"#1a73e8",path:"M512 64a448 448 0 1 0 0 896 448 448 0 0 0 0-896zm0 96a352 352 0 1 1 0 704 352 352 0 0 1 0-704zm-32 128a32 32 0 0 1 64 0v32a32 32 0 0 1-64 0V288zm32 128a36 36 0 1 1 0 72 36 36 0 0 1 0-72zm0 96a32 32 0 0 1 32 32v128a32 32 0 0 1-64 0V544a32 32 0 0 1 32-32z"}},i=t.computed(()=>a[l.severity]??a.stop),r=t.computed(()=>l.title?l.title:l.severity==="warning"?b(l.locale,"dvWarningDialogTitle"):l.severity==="information"?b(l.locale,"dvInformationDialogTitle"):b(l.locale,"dvStopDialogTitle")),d=t.computed(()=>l.severity==="stop"?b(l.locale,"dvBtnRetry"):l.severity==="warning"?b(l.locale,"dvBtnContinue"):b(l.locale,"dvBtnOk")),f=t.computed(()=>l.severity==="stop"?b(l.locale,"cancel"):l.severity==="warning"?b(l.locale,"dvBtnNo"):b(l.locale,"cancel"));function y(){o("resolve",l.severity==="stop"?"retry":"continue")}function h(){o("resolve","cancel")}return(u,E)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-alert",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",_m,[t.createElementVNode("span",Lm,t.toDisplayString(r.value),1)]),t.createElementVNode("div",Om,[(t.openBlock(),t.createElementBlock("svg",{class:"dv-alert__icon",viewBox:"0 0 1024 1024",style:t.normalizeStyle({color:i.value.color})},[t.createElementVNode("path",{d:i.value.path,fill:"currentColor"},null,8,$m)],4)),t.createElementVNode("div",Hm,[e.title?(t.openBlock(),t.createElementBlock("div",zm,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Wm,t.toDisplayString(e.message),1)])]),t.createElementVNode("div",Pm,[E[2]||(E[2]=t.createElementVNode("span",{class:"dv-alert__spacer"},null,-1)),t.createElementVNode("button",{type:"button",class:"dv-alert__btn dv-alert__btn--primary",onMousedown:E[0]||(E[0]=t.withModifiers(()=>{},["prevent"])),onClick:y},t.toDisplayString(d.value),33),t.createElementVNode("button",{type:"button",class:"dv-alert__btn",onMousedown:E[1]||(E[1]=t.withModifiers(()=>{},["prevent"])),onClick:h},t.toDisplayString(f.value),33)])],4))}}),[["__scopeId","data-v-07223d87"]]),Km={key:0,class:"dvim__title"},Gm={class:"dvim__message"},qm=St(t.defineComponent({__name:"data-validation-input-message",props:{title:{default:""},message:{default:""},x:{default:0},y:{default:0},width:{default:100},height:{default:24}},setup(e){return(n,l)=>(t.openBlock(),t.createElementBlock("div",{class:"dvim",style:t.normalizeStyle({left:e.x+"px",top:e.y+e.height+4+"px",minWidth:Math.min(220,Math.max(e.width,140))+"px"})},[e.title?(t.openBlock(),t.createElementBlock("div",Km,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Gm,t.toDisplayString(e.message),1)],4))}}),[["__scopeId","data-v-ec9868e3"]]);function ln(e,n){return`${e},${n}`}function Br(e,n){if(e.startsWith("="))return{kind:"formula",formula:e};const l=Nl(e,n);if(l)return{kind:"date",serial:l.serial};const o=/^(.*?)(\d+)$/.exec(e);if(o){const a=o[1],i=o[2];if(a!==""&&/^\d+$/.test(i))return{kind:"text-number",prefix:a,num:parseInt(i,10),digits:i.length}}return Cl(e)?{kind:"number",num:parseFloat(e)}:{kind:"text",text:e}}function Fo(e,n){for(let l=2;l<e.length;l++)if(e[l]-e[l-1]!==n)return!1;return!0}function Tr(e){const n=e.length;if(n===0)return{kind:"copy",sourceValues:[]};if(e.some(l=>l.kind==="formula"))return{kind:"formula"};if(e.every(l=>l.kind==="date")){const l=e[0],o=n>=2?e[1].serial-l.serial:1;return{kind:"date-linear",baseSerial:l.serial,step:o,sourceLen:n}}if(e.every(l=>l.kind==="number")){if(n===1)return{kind:"copy",sourceValues:[...e]};const l=e.map(a=>a.num),o=l[1]-l[0];return Fo(l,o)?{kind:"linear",step:o,base:l[0],sourceLen:n}:{kind:"copy",sourceValues:[...e]}}if(e.every(l=>l.kind==="text-number")){const l=e[0];if(e.every(a=>a.kind==="text-number"&&a.prefix===l.prefix)){if(n===1)return{kind:"copy",sourceValues:[...e]};const a=e.map(r=>r.num),i=a[1]-a[0];if(Fo(a,i))return{kind:"text-number",prefix:l.prefix,step:i,base:l.num,digits:l.digits,sourceLen:n}}return{kind:"copy",sourceValues:[...e]}}if(e.every(l=>l.kind==="text")){const l=e.every(o=>o.text.length===1&&/[a-zA-Z]/.test(o.text));if(n>=2&&l){const o=e.map(i=>i.text.charCodeAt(0)),a=o[1]-o[0];if(a!==0&&Fo(o,a))return{kind:"text-series",step:a,baseCharCode:o[0],sourceLen:n}}return{kind:"copy",sourceValues:[...e]}}return{kind:"copy",sourceValues:[...e]}}function Nr(e,n,l){switch(e.kind){case"copy":{const o=e.sourceValues.length;return o===0?{kind:"text",text:""}:e.sourceValues[n%o]}case"linear":return{kind:"number",num:e.base+e.step*(l+n)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base+e.step*(l+n),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial+e.step*(l+n)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode+e.step*(l+n))};case"formula":return{kind:"formula",formula:""}}}function xr(e,n){switch(e.kind){case"copy":{const l=e.sourceValues.length;return l===0?{kind:"text",text:""}:e.sourceValues[l-1-n%l]}case"linear":return{kind:"number",num:e.base-e.step*(n+1)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base-e.step*(n+1),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial-e.step*(n+1)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode-e.step*(n+1))};case"formula":return{kind:"formula",formula:""}}}function lo(e,n){switch(e.kind){case"formula":return{value:e.formula,styleId:n};case"number":return{value:String(e.num),styleId:n};case"text":return{value:e.text,styleId:n};case"text-number":return{value:e.prefix+String(e.num).padStart(e.digits,"0"),styleId:n};case"date":return{value:String(e.serial),styleId:n}}}function Dr(e,n){const l=n.row<e.startRow?e.startRow-n.row:n.row>e.endRow?n.row-e.endRow:0,o=n.col<e.startCol?e.startCol-n.col:n.col>e.endCol?n.col-e.endCol:0;if(l===0&&o===0)return null;const a=l>=o?n.row<e.startRow?"up":"down":n.col<e.startCol?"left":"right";let i;switch(a){case"down":i={startCol:e.startCol,startRow:e.endRow+1,endCol:e.endCol,endRow:n.row};break;case"up":i={startCol:e.startCol,startRow:n.row,endCol:e.endCol,endRow:e.startRow-1};break;case"right":i={startCol:e.endCol+1,startRow:e.startRow,endCol:n.col,endRow:e.endRow};break;case"left":i={startCol:n.col,startRow:e.startRow,endCol:e.startCol-1,endRow:e.endRow};break}return{targetRange:i,direction:a}}function Vr(e,n,l,o,a,i){return Jn(e,l.col-n.col,l.row-n.row,o,a,i)}function Fr(e,n){return!(e.endCol<n.startCol||e.startCol>n.endCol||e.endRow<n.startRow||e.startRow>n.endRow)}function Ym(e,n){return n.startCol>=e.startCol&&n.endCol<=e.endCol&&n.startRow>=e.startRow&&n.endRow<=e.endRow}function Io(e,n,l){const o=Object.keys(l);for(const a of o){const i=l[a];if(Fr(e,i)&&!Ym(e,i))return!1}for(const a of o){const i=l[a];if(Fr(n,i))return!1}return!0}function Ir(e,n,l,o){const a=n.length;if(a!==0){if(e.kind==="copy"){const i=o?a-1-l%a:l%a;return n[i]}return o?n[0]:n[a-1]}}function Ar(e,n,l,o,a,i,r,d){const f={cells:{},merges:{}},y=o==="up"||o==="down",h=o==="up"||o==="left";if(y){const u=e.endRow-e.startRow+1;for(let E=e.startCol;E<=e.endCol;E++){const x=[],k=[];for(let ne=e.startRow;ne<=e.endRow;ne++){const ee=l.cells[ln(E,ne)];x.push(ee?Br(ee.value,a):{kind:"text",text:""}),k.push(ee==null?void 0:ee.styleId)}const H=Tr(x),Y=x.length;for(let ne=n.startRow;ne<=n.endRow;ne++){const ee=h?n.endRow-ne:ne-n.startRow;if(H.kind==="formula"){const M=h?e.endRow-((n.endRow-ne)%u+u)%u:e.startRow+((ne-e.startRow)%u+u)%u,se=l.cells[ln(E,M)],X=se?se.value:"",te=Vr(X,{col:E,row:M},{col:E,row:ne},i,r,d);f.cells[ln(E,ne)]=lo({kind:"formula",formula:te},se==null?void 0:se.styleId)}else{const M=h?xr(H,ee):Nr(H,ee,Y),se=Ir(H,k,ee,h);f.cells[ln(E,ne)]=lo(M,se)}}}}else{const u=e.endCol-e.startCol+1;for(let E=e.startRow;E<=e.endRow;E++){const x=[],k=[];for(let ne=e.startCol;ne<=e.endCol;ne++){const ee=l.cells[ln(ne,E)];x.push(ee?Br(ee.value,a):{kind:"text",text:""}),k.push(ee==null?void 0:ee.styleId)}const H=Tr(x),Y=x.length;for(let ne=n.startCol;ne<=n.endCol;ne++){const ee=h?n.endCol-ne:ne-n.startCol;if(H.kind==="formula"){const M=h?e.endCol-((n.endCol-ne)%u+u)%u:e.startCol+((ne-e.startCol)%u+u)%u,se=l.cells[ln(M,E)],X=se?se.value:"",te=Vr(X,{col:M,row:E},{col:ne,row:E},i,r,d);f.cells[ln(ne,E)]=lo({kind:"formula",formula:te},se==null?void 0:se.styleId)}else{const M=h?xr(H,ee):Nr(H,ee,Y),se=Ir(H,k,ee,h);f.cells[ln(ne,E)]=lo(M,se)}}}}return f}function Xm(e){let n=1/0,l=1/0;for(const o of e.ranges)o.startCol<n&&(n=o.startCol),o.startRow<l&&(l=o.startRow);return isFinite(n)||(n=0),isFinite(l)||(l=0),{col:n,row:l}}function jm(e,n,l){for(const o of e)if(n>=o.startCol&&n<=o.endCol&&l>=o.startRow&&l<=o.endRow)return!0;return!1}function wl(e){if(e==null)return null;const n=String(e).trim();if(n==="")return null;const l=n.replace(/[, ]/g,"");if(l==="")return null;const o=Number(l);return Number.isFinite(o)?o:null}function Zm(e,n){const l=new Map;for(const o of e.ranges)for(let a=o.startRow;a<=o.endRow;a++)for(let i=o.startCol;i<=o.endCol;i++){const r=n.getCellValue(i,a);r!==""&&l.set(r,(l.get(r)??0)+1)}return l}class Jm{constructor(){this.map=new Map}get(n){return this.map.get(n)}set(n,l){this.map.set(n,l)}invalidate(n){n?this.map.delete(n):this.map.clear()}}function Qm(e,n,l,o,a,i){switch(e.type){case"cellIs":{const r=o.getCellValue(n,l),d=wl(r);switch(e.operator){case"equal":{const f=wl(e.value);return d!==null&&f!==null?d===f:r===e.value}case"notEqual":{const f=wl(e.value);return d!==null&&f!==null?d!==f:r!==e.value}case"greaterThan":{const f=wl(e.value);return d===null||f===null?!1:d>f}case"greaterThanOrEqual":{const f=wl(e.value);return d===null||f===null?!1:d>=f}case"lessThan":{const f=wl(e.value);return d===null||f===null?!1:d<f}case"lessThanOrEqual":{const f=wl(e.value);return d===null||f===null?!1:d<=f}case"between":{const f=wl(e.value),y=wl(e.value2??"");return d===null||f===null||y===null?!1:d>=Math.min(f,y)&&d<=Math.max(f,y)}case"notBetween":{const f=wl(e.value),y=wl(e.value2??"");return d===null||f===null||y===null?!1:d<Math.min(f,y)||d>Math.max(f,y)}}return!1}case"textContains":return o.getCellValue(n,l).toLowerCase().includes(e.value.toLowerCase());case"textNotContains":return!o.getCellValue(n,l).toLowerCase().includes(e.value.toLowerCase());case"blank":return o.getCellValue(n,l)==="";case"notBlank":return o.getCellValue(n,l)!=="";case"duplicate":{if(!i)return!1;const r=o.getCellValue(n,l);return r===""?!1:(i.get(r)??0)>1}case"unique":{if(!i)return!1;const r=o.getCellValue(n,l);return r===""?!1:(i.get(r)??0)===1}case"formula":try{const r=n-a.col,d=l-a.row,f=e.formula.trim().replace(/^=/,""),y=e0(f,r,d,o.colCount,o.rowCount);return Rr(y,o.cells,o.colCount,o.rowCount)}catch{return!1}case"colorScale":case"dataBar":case"iconSet":case"topBottom":case"aboveBelowAverage":return!1}return!1}function e0(e,n,l,o,a){return Jn(e,n,l,o,a,lt)}function t0(e,n,l,o,a){if(!l||l.length===0)return null;const i=l.filter(f=>f.enabled&&jm(f.ranges,e,n)).sort((f,y)=>f.priority-y.priority);if(i.length===0)return null;const r={};let d=!1;for(const f of i){const y=Xm(f);let h;(f.condition.type==="duplicate"||f.condition.type==="unique")&&(h=a==null?void 0:a.get(f.id),h||(h=Zm(f,o),a==null||a.set(f.id,h)));let u=!1;try{u=Qm(f.condition,e,n,o,y,h)}catch{}if(!u)continue;d=!0;const E=f.format;if(E.backgroundColor!==void 0&&r.backgroundColor===void 0&&(r.backgroundColor=E.backgroundColor),E.color!==void 0&&r.color===void 0&&(r.color=E.color),E.fontWeight!==void 0&&r.fontWeight===void 0&&(r.fontWeight=E.fontWeight),E.fontStyle!==void 0&&r.fontStyle===void 0&&(r.fontStyle=E.fontStyle),E.underline!==void 0&&r.underline===void 0&&(r.underline=E.underline),E.strikethrough!==void 0&&r.strikethrough===void 0&&(r.strikethrough=E.strikethrough),f.stopIfTrue)break}return d?r:null}function l0(){return"cf_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function _r(){return"dv_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function n0(e,n,l){for(const o of e)if(n>=o.startCol&&n<=o.endCol&&l>=o.startRow&&l<=o.endRow)return!0;return!1}function o0(e){let n=1/0,l=1/0;for(const o of e.ranges)o.startCol<n&&(n=o.startCol),o.startRow<l&&(l=o.startRow);return isFinite(n)||(n=0),isFinite(l)||(l=0),{col:n,row:l}}function r0(e){return e==null?!0:typeof e=="number"?!1:(typeof e=="string"?e:String(e)).trim()===""}function a0(e){return e?Array.from(e).length:0}const Lr=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function An(e,n){if(e==null)return null;const l=String(e).trim();if(l==="")return null;if(l.startsWith("=")){const a=Ao(l.slice(1),n);return typeof a=="number"&&Number.isFinite(a)?a:a===null?null:Number(a)}const o=qn(l,n.locale);if(o&&Number.isFinite(o.num))return o.num;if(Lr.test(l)){const a=Number(l);return Number.isFinite(a)?a:null}return null}function Ao(e,n){try{return tn(),Er(e,n.cells,n.colCount,n.rowCount)}catch{return null}}function _o(e,n){if(e==null)return null;const l=String(e).trim();if(l==="")return null;if(l.startsWith("=")){const a=Ao(l.slice(1),n);return typeof a=="number"&&Number.isFinite(a)?a:typeof a=="string"?_o(a,n):null}if(Cl(l)||Lr.test(l)){const a=Number(l);return Number.isFinite(a)?a:null}const o=Nl(l,n.locale);return o&&o.format!=="h:mm:ss"?o.serial:null}function Lo(e,n){if(e==null)return null;const l=String(e).trim();if(l==="")return null;if(l.startsWith("=")){const a=Ao(l.slice(1),n);return typeof a=="number"&&Number.isFinite(a)?Oo(a):typeof a=="string"?Lo(a,n):null}const o=Nl(l,n.locale);return o?o.format==="h:mm:ss"?o.serial:Oo(o.serial):Cl(l)?Oo(Number(l)):null}function Oo(e){return Number.isFinite(e)?Math.abs(e)%1:0}function i0(e,n,l,o){switch(e){case"between":return l===null||o===null?!1:n>=Math.min(l,o)&&n<=Math.max(l,o);case"notBetween":return l===null||o===null?!1:n<Math.min(l,o)||n>Math.max(l,o);case"equal":return l!==null&&n===l;case"notEqual":return l!==null&&n!==l;case"greaterThan":return l!==null&&n>l;case"greaterThanOrEqual":return l!==null&&n>=l;case"lessThan":return l!==null&&n<l;case"lessThanOrEqual":return l!==null&&n<=l;default:return!1}}function $o(e){return String(e??"").trim().toLowerCase()}function Or(e,n){var h;const l=e.listSource??(e.values?{type:"values",values:e.values}:void 0);if(!l)return[];const o=[],a=new Set,i=u=>{const E=$o(u);if(!E){if(e.allowBlank===!1||a.has("\0blank"))return;a.add("\0blank"),o.push("");return}a.has(E)||(a.add(E),o.push(u))};if(l.type==="values"){for(const u of l.values??[])i(u);return o}const{range:r,sheetId:d}=l,f=d?((h=n.getSheetCells)==null?void 0:h.call(n,d))??null:null,y=f??n.cells;for(let u=r.startRow;u<=r.endRow;u++)for(let E=r.startCol;E<=r.endCol;E++){const x=`${E},${u}`,k=y[x];if(k)if(f){const H=k.value;i(H.startsWith("=")?s0(H,f,n):H)}else i(n.getCellValue(E,u))}return o}function s0(e,n,l){try{tn();const o=Er(e.slice(1),n,l.colCount,l.rowCount);return o===null?"":String(o)}catch{return""}}function c0(e){return!!e&&e.type==="list"&&e.showDropdown!==!1&&e.enabled!==!1}function d0(e,n,l){const o={value:l};return new Proxy(e,{get(a,i){return i===n?o:a[i]},has(a,i){return i===n?!0:i in a}})}function u0(e,n,l,o,a){if(e.enabled===!1)return!0;const i=n==null?"":String(n);if(r0(i))return e.allowBlank!==!1;try{switch(e.type){case"any":return!0;case"list":{const r=Or(e,a),d=$o(i);return r.some(f=>$o(f)===d)}case"wholeNumber":{const r=An(i,a);return r===null||!Number.isFinite(r)||!Number.isInteger(r)?!1:_n(e,r,a,An)}case"decimal":{const r=An(i,a);return r===null||!Number.isFinite(r)?!1:_n(e,r,a,An)}case"date":{const r=_o(i,a);return r===null?!1:_n(e,r,a,_o)}case"time":{const r=Lo(i,a);return r===null?!1:_n(e,r,a,Lo)}case"textLength":{const r=a0(i);return _n(e,r,a,An)}case"custom":{const r=(e.formula1??"").trim().replace(/^=/,"");return r?f0(r,n,l,o,e,a):!0}default:return!0}}catch{return!1}}function _n(e,n,l,o){const a=e.operator;if(!a)return!0;const i=e.formula1!==void 0&&e.formula1!==""?o(e.formula1,l):null,r=e.formula2!==void 0&&e.formula2!==""?o(e.formula2,l):null;return i0(a,n,i,r)}function f0(e,n,l,o,a,i){try{const r=o0(a),d=Jn(e,l-r.col,o-r.row,i.colCount,i.rowCount,lt),f=d0(i.cells,`${l},${o}`,n==null?"":String(n));return tn(),Rr(d,f,i.colCount,i.rowCount)}catch{return!1}}const m0={stop:3,warning:2,information:1};function Ho(e){return e.errorStyle==="warning"||e.errorStyle==="information"?e.errorStyle:"stop"}function $r(e,n,l,o,a){if(!o||o.length===0)return{valid:!0};let i=null,r=0;for(const h of o){if(h.enabled===!1||!n0(h.ranges,n,l))continue;let u=!1;try{u=u0(h,e,n,l,a)}catch{u=!1}if(u)continue;const E=m0[Ho(h)];E>r&&(r=E,i=h)}if(!i)return{valid:!0};const d=Ho(i),f=i.showErrorMessage!==!1,y=p0(i,a.locale);return{valid:!1,rule:i,severity:d,title:f&&i.errorTitle?i.errorTitle:y.title,message:f&&i.errorMessage?i.errorMessage:y.message}}function p0(e,n){var a;const l=b(n,"dvErrorTitleDefault"),o=e.operator?b(n,`dv${h0(e.operator)}`):"";switch(e.type){case"list":{const r=(((a=e.listSource)==null?void 0:a.type)==="values"?e.listSource.values??e.values??[]:e.values??[]).filter(Boolean).slice(0,6).join(", ");return{title:l,message:b(n,r?"dvMsgList":"dvMsgListEmpty").replace("{values}",r)}}case"wholeNumber":return{title:l,message:Ln(n,b(n,"dvTypeWholeNumber"),o,e)};case"decimal":return{title:l,message:Ln(n,b(n,"dvTypeDecimal"),o,e)};case"date":return{title:l,message:Ln(n,b(n,"dvTypeDate"),o,e)};case"time":return{title:l,message:Ln(n,b(n,"dvTypeTime"),o,e)};case"textLength":return{title:l,message:Ln(n,b(n,"dvTypeTextLength"),o,e)};case"custom":return{title:l,message:b(n,"dvMsgCustom").replace("{formula}",e.formula1??"")};default:return{title:l,message:b(n,"dvMsgInvalid")}}}function h0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ln(e,n,l,o){return l?o.operator==="between"||o.operator==="notBetween"?b(e,o.operator==="between"?"dvMsgBetween":"dvMsgNotBetween").replace("{type}",n).replace("{min}",o.formula1??"").replace("{max}",o.formula2??""):b(e,"dvMsgCompare").replace("{type}",n).replace("{op}",l).replace("{value}",o.formula1??""):b(e,"dvMsgInvalid")}const no=64;class g0{constructor(n=[]){this.bands=new Map,this.dirty=!0,this.source=[],this.source=n}invalidate(){this.dirty=!0}ensure(n){if(n&&n!==this.source&&(this.source=n,this.dirty=!0),!!this.dirty){this.bands.clear();for(const l of this.source)if(!(!l||l.enabled===!1))for(const o of l.ranges??[]){const a=Math.floor(o.startRow/no),i=Math.floor(o.endRow/no);for(let r=a;r<=i;r++){let d=this.bands.get(r);d||(d=[],this.bands.set(r,d)),d.push({rule:l,range:o})}}this.dirty=!1}}getRules(n,l,o){this.ensure(o);const a=this.bands.get(Math.floor(l/no));if(!a||a.length===0)return[];const i=[];for(const r of a)n<r.range.startCol||n>r.range.endCol||l<r.range.startRow||l>r.range.endRow||i.includes(r.rule)||i.push(r.rule);return i}has(n,l,o){const a=this.bandsOf(n,l,o);for(const i of a)if(!(n<i.range.startCol||n>i.range.endCol)&&!(l<i.range.startRow||l>i.range.endRow))return!0;return!1}findRule(n,l,o,a){for(const i of this.bandsOf(n,l,a))if(!(n<i.range.startCol||n>i.range.endCol)&&!(l<i.range.startRow||l>i.range.endRow)&&o(i.rule))return i.rule;return null}bandsOf(n,l,o){return this.ensure(o),this.bands.get(Math.floor(l/no))??b0}}const b0=[];function y0(e,n,l,o){if(n==="row"){const f=e.startRow,y=e.endRow;let h,u;if(y<l)h=f,u=y;else if(f>l+o-1)h=f-o,u=y-o;else if(h=f<l?f:l,u=y>l+o-1?y-o:l-1,u<h)return null;return{...e,startRow:h,endRow:u}}const a=e.startCol,i=e.endCol;let r,d;if(i<l)r=a,d=i;else if(a>l+o-1)r=a-o,d=i-o;else if(r=a<l?a:l,d=i>l+o-1?i-o:l-1,d<r)return null;return{...e,startCol:r,endCol:d}}function C0(e,n,l,o){if(n==="row"){const r=e.startRow,d=e.endRow;return r>=l?{...e,startRow:r+o,endRow:d+o}:d<l?e:{...e,endRow:d+o}}const a=e.startCol,i=e.endCol;return a>=l?{...e,startCol:a+o,endCol:i+o}:i<l?e:{...e,endCol:i+o}}function Hr(e,n){return!(e.endCol<n.startCol||e.startCol>n.endCol||e.endRow<n.startRow||e.startRow>n.endRow)}function zr(e,n){if(!Hr(e,n))return[{...e}];const l=[];e.startRow<n.startRow&&l.push({startCol:e.startCol,endCol:e.endCol,startRow:e.startRow,endRow:n.startRow-1}),e.endRow>n.endRow&&l.push({startCol:e.startCol,endCol:e.endCol,startRow:n.endRow+1,endRow:e.endRow});const o=Math.max(e.startRow,n.startRow),a=Math.min(e.endRow,n.endRow);return o<=a&&(e.startCol<n.startCol&&l.push({startCol:e.startCol,endCol:n.startCol-1,startRow:o,endRow:a}),e.endCol>n.endCol&&l.push({startCol:n.endCol+1,endCol:e.endCol,startRow:o,endRow:a})),l}function w0(e,n,l){return{startCol:e.startCol+n,endCol:e.endCol+n,startRow:e.startRow+l,endRow:e.endRow+l}}function Wr(e,n){return Hr(e,n)?{startCol:Math.max(e.startCol,n.startCol),endCol:Math.min(e.endCol,n.endCol),startRow:Math.max(e.startRow,n.startRow),endRow:Math.min(e.endRow,n.endRow)}:null}class v0{constructor(n){if(n&&n.length>0){this.styles=n,this.index=new Map;for(let l=0;l<this.styles.length;l++){const o=this.stableKey(this.styles[l]);this.index.set(o,l)}}else this.styles=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(n){const l=Object.keys(n).sort(),o={};for(const a of l)o[a]=n[a];return JSON.stringify(o)}get(n){const l=this.styles[n];return l?n===0?l:Object.freeze(l):{}}getId(n){if(!n||Object.keys(n).length===0)return 0;const l=this.stableKey(n),o=this.index.get(l);if(o!==void 0)return o;const a=this.styles.length,i=Object.freeze({...n});return this.styles.push(i),this.index.set(l,a),a}getStyles(){return[...this.styles]}setStyles(n){this.styles=n,this.index=new Map;for(let l=0;l<this.styles.length;l++){const o=this.stableKey(this.styles[l]);this.index.set(o,l)}}compactStyles(n){const l=new Set;l.add(0);for(const r in n){const d=n[r].styleId??0;l.add(d)}const o=new Map,a=[{}];o.set(0,0);const i=Array.from(l).sort((r,d)=>r-d);for(const r of i)if(r!==0&&r<this.styles.length){const d=a.length;o.set(r,d),a.push(this.styles[r])}for(const r in n){const d=n[r],f=d.styleId??0,y=o.get(f);y!==void 0&&y!==f&&(d.styleId=y)}this.styles=a,this.index=new Map;for(let r=0;r<this.styles.length;r++){const d=this.stableKey(this.styles[r]);this.index.set(d,r)}return a}}function k0(e,n){if(!e)return null;const l=e.styleId;return l===void 0||l===0?null:n[l]??null}function Pr(e){const n=new v0,l={};for(const[o,a]of Object.entries(e)){const i={value:a.value};a.styleId!==void 0&&a.styleId>0&&(i.styleId=a.styleId),a.style&&Object.keys(a.style).length>0&&(i.styleId=n.getId(a.style)),i.styleId===0&&delete i.styleId,l[o]=i}return{cells:l,styles:n.getStyles()}}function E0(e){const n={};for(const[l,o]of Object.entries(e)){const a={value:o.value};o.styleId!==void 0&&o.styleId>0&&(a.styleId=o.styleId),n[l]=a}return n}class R0{constructor(n){if(n&&n.length>0){this.borders=n,this.index=new Map;for(let l=0;l<this.borders.length;l++){const o=this.stableKey(this.borders[l]);this.index.set(o,l)}}else this.borders=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(n){const l=["top","right","bottom","left"],o={};for(const a of l){const i=n[a];if(i&&(i.width!==void 0||i.color!==void 0||i.style!==void 0)){const r={};i.width!==void 0&&(r.width=i.width),i.color!==void 0&&(r.color=i.color),i.style!==void 0&&(r.style=i.style),o[a]=r}}return JSON.stringify(o)}get(n){const l=this.borders[n];return l?n===0?l:Object.freeze(l):{}}getId(n){if(!n||this.isEmptyBorder(n))return 0;const l=this.stableKey(n),o=this.index.get(l);if(o!==void 0)return o;const a=this.borders.length,i=Object.freeze(this.deepCloneBorder(n));return this.borders.push(i),this.index.set(l,a),a}isEmptyBorder(n){return!n.top&&!n.right&&!n.bottom&&!n.left}deepCloneBorder(n){const l={};return n.top&&(l.top={...n.top}),n.right&&(l.right={...n.right}),n.bottom&&(l.bottom={...n.bottom}),n.left&&(l.left={...n.left}),l}getBorders(){return[...this.borders]}setBorders(n){this.borders=n,this.index=new Map;for(let l=0;l<this.borders.length;l++){const o=this.stableKey(this.borders[l]);this.index.set(o,l)}}compactBorders(n){const l=new Set;l.add(0);for(const r of n){const d=r.borderId??0;l.add(d)}const o=new Map,a=[{}];o.set(0,0);const i=Array.from(l).sort((r,d)=>r-d);for(const r of i)if(r!==0&&r<this.borders.length){const d=a.length;o.set(r,d),a.push(this.borders[r])}for(const r of n){const d=r.borderId??0,f=o.get(d);f!==void 0&&f!==d&&(r.borderId=f)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const d=this.stableKey(this.borders[r]);this.index.set(d,r)}return a}}function S0(e,n,l,o){if(!e)return;const a=e.styleId??0,i=l[a];if(!i)return;const r=i.borderId??0;if(r===0)return;const d=o.get(r);if(d)return d[n]}function M0(e,n,l,o,a,i){const r=o[e.styleId??0]??{},d=r.borderId??0,f=d>0?a.get(d):{},y={top:f.top?{...f.top}:void 0,right:f.right?{...f.right}:void 0,bottom:f.bottom?{...f.bottom}:void 0,left:f.left?{...f.left}:void 0};l?y[n]={...l}:y[n]=void 0;const h=a.getId(y),u={...r};h===0?delete u.borderId:u.borderId=h,delete u.borderTopWidth,delete u.borderBottomWidth,delete u.borderLeftWidth,delete u.borderRightWidth,delete u.borderColor,Object.keys(u).length===0?e.styleId=0:e.styleId=i(u)}function Ur(e){const n=new R0,l=[];for(const o of e){if(!(o.borderTopWidth!==void 0||o.borderBottomWidth!==void 0||o.borderLeftWidth!==void 0||o.borderRightWidth!==void 0)){l.push(o);continue}const i=typeof o.borderColor=="string"?o.borderColor:void 0,r={};o.borderTopWidth!==void 0&&o.borderTopWidth>0&&(r.top={width:o.borderTopWidth,color:i}),o.borderBottomWidth!==void 0&&o.borderBottomWidth>0&&(r.bottom={width:o.borderBottomWidth,color:i}),o.borderLeftWidth!==void 0&&o.borderLeftWidth>0&&(r.left={width:o.borderLeftWidth,color:i}),o.borderRightWidth!==void 0&&o.borderRightWidth>0&&(r.right={width:o.borderRightWidth,color:i});const d=n.getId(r),f={...o};delete f.borderTopWidth,delete f.borderBottomWidth,delete f.borderLeftWidth,delete f.borderRightWidth,delete f.borderColor,d>0?f.borderId=d:delete f.borderId,l.push(f)}return{styles:l,borders:n.getBorders()}}function B0(e,n){const l=t.reactive({rowCount:e.rowCount??n.rowCount,colCount:e.colCount??n.colCount,width:e.width,height:e.height,theme:e.theme??n.theme,locale:e.locale??n.locale});t.watchEffect(()=>{l.rowCount=e.rowCount??n.rowCount,l.colCount=e.colCount??n.colCount,l.width=e.width,l.height=e.height,l.theme=e.theme??n.theme,l.locale=e.locale??n.locale});const o=t.computed(()=>l.locale==="zh-CN"?"zh-CN":"en-US"),a=l.colCount,i=l.rowCount,r=t.reactive({colCount:a,rowCount:i}),d=8,f=32,y=t.reactive({}),h=t.reactive([{}]),u=t.reactive([{}]);let E=new Map;E.set("{}",0);let x=new Map;x.set("{}",0);const k=t.reactive([]),H=new Jm,Y=t.reactive([]),ne=new g0(Y),ee=new Map;let M=0;function se(p){const v=Object.keys(p).sort(),S={};for(const O of v)S[O]=p[O];return JSON.stringify(S)}function X(p){const v=["top","right","bottom","left"],S={};for(const O of v){const s=p[O];if(s&&(s.width!==void 0||s.color!==void 0||s.style!==void 0)){const m={};s.width!==void 0&&(m.width=s.width),s.color!==void 0&&(m.color=s.color),s.style!==void 0&&(m.style=s.style),S[O]=m}}return JSON.stringify(S)}function te(p){if(!p||Object.keys(p).length===0)return 0;const v=se(p),S=E.get(v);if(S!==void 0)return S;const O=h.length;return h.push(Object.freeze({...p})),E.set(v,O),O}function Ne(p){return k0(p,h)}function ze(){E=new Map;for(let p=0;p<h.length;p++)E.set(se(h[p]),p)}function Ve(p){h.splice(0,h.length,...p),ze()}function Fe(p){if(!p||!p.top&&!p.right&&!p.bottom&&!p.left)return 0;const v=X(p),S=x.get(v);if(S!==void 0)return S;const O=u.length;return u.push(Object.freeze({top:p.top?Object.freeze({...p.top}):void 0,right:p.right?Object.freeze({...p.right}):void 0,bottom:p.bottom?Object.freeze({...p.bottom}):void 0,left:p.left?Object.freeze({...p.left}):void 0})),x.set(v,O),O}function je(p){return u[p]??{}}function _e(){x=new Map;for(let p=0;p<u.length;p++)x.set(X(u[p]),p)}function F(p){u.splice(0,u.length,...p),_e()}function I(p,v){return S0(p,v,h,{get:S=>u[S]??{}})}function G(p,v){const S=et(p,v);return S?S.anchor:null}function Ce(p,v,S,O){const s=et(p,v),m=et(S,O);return!s||!m?!1:s.anchor===m.anchor}const $e=t.reactive({}),j=new Od,Be=t.ref(null),Q=t.ref("cell"),ke=t.ref({col:0,row:0}),B=t.ref(null),oe=t.ref(""),Z=t.ref(new Array(r.colCount).fill(100)),re=t.ref(new Array(r.rowCount).fill(void 0)),K=t.ref(0),L=t.ref(0),J=t.reactive({rows:0,cols:0}),$=t.ref(null),U=t.shallowRef({active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}),de=new Map;let Le=null;function ve(p,v,S,O){const s=`${O} ${S} ${v}px ${p}`,m=de.get(s);if(m)return m;if(!Le){if(typeof document>"u")return{ascent:v*.88,descent:v*.28};Le=document.createElement("canvas")}const C=Le.getContext("2d");if(!C)return{ascent:v*.88,descent:v*.28};C.font=s;const T=C.measureText(" "),R=T.fontBoundingBoxAscent,A=T.fontBoundingBoxDescent;if(typeof R=="number"&&typeof A=="number"&&R>0&&A>0){const nt={ascent:R,descent:A};return de.set(s,nt),nt}const _=["M","中","y","Ä","0"];let D=0,z=0;for(const nt of _){const dt=C.measureText(nt),vt=dt.actualBoundingBoxAscent||0,Nt=dt.actualBoundingBoxDescent||0;vt>D&&(D=vt),Nt>z&&(z=Nt)}const ae=Math.max(D,v*.88),Me=Math.max(z,v*.28),Qe={ascent:ae,descent:Me};return de.set(s,Qe),Qe}const Ie=ve(pn,zl,"normal","normal"),Ee=Ie.ascent+Ie.descent,He=Math.max(0,(24-Ee)/2);let ge=(p,v)=>`${p},${v}`,et=()=>null,ut=()=>zl,Pe=t.computed(()=>[0]),N=()=>24,ie=(p,v,S,O)=>({startCol:Math.min(p,S),startRow:Math.min(v,O),endCol:Math.max(p,S),endRow:Math.max(v,O)});function Rt(p,v){const S=Ne(y[ge(p,v)]),O=ut(p,v),s=typeof(S==null?void 0:S.fontFamily)=="string"&&S.fontFamily?S.fontFamily:pn,m=(S==null?void 0:S.fontWeight)==="bold"?"bold":"normal",C=(S==null?void 0:S.fontStyle)==="italic"?"italic":"normal";return ve(s,O,m,C)}function ft(p,v,S,O){if(!v)return[""];const s=v.split(`
|
|
2
|
-
`),
|
|
3
|
-
`).length,At>s&&(s=At)}}const T=S+O,R=He*2+s*T;return Math.min(500,Math.max(24,Math.round(R)))}N=nl;function dl(p){return re.value[p]===void 0}const ol={getValue:(p,v)=>Wt(p,v),getFormat:(p,v)=>{var S;return(S=Ne(y[ge(p,v)]))==null?void 0:S.numberFormat}},Ht=t.computed(()=>{const p=new Set,v=$.value;if(!v)return p;const{range:S}=v;for(let O=S.startRow+1;O<=S.endRow;O++)vl(O)||p.add(O);return p});function vl(p){return Zd($.value,p,ol,o.value)}function zt(){return Ht.value}function W(p){return $.value?Ht.value.has(p):!1}function g(){return $.value?r.rowCount-Ht.value.size:r.rowCount}function c(p){let v=-1;for(let S=0;S<r.rowCount;S++)if(!W(S)&&(v++,v===p))return S;return-1}function w(p){if(W(p))return-1;let v=0;for(let S=0;S<p;S++)W(S)||v++;return v}function be(){return $.value}function he(p,v=!1){var S,O;$.value=p,!v&&(Ot(K.value,L.value),(S=q.scheduleRender)==null||S.call(q),(O=q.emitModelData)==null||O.call(q))}function xe(p){var S,O;const v={range:{startCol:Math.min(p.startCol,p.endCol),endCol:Math.max(p.startCol,p.endCol),startRow:Math.min(p.startRow,p.endRow),endRow:Math.max(p.startRow,p.endRow)},columns:{}};$.value=v,Ot(K.value,L.value),(S=q.scheduleRender)==null||S.call(q),(O=q.emitModelData)==null||O.call(q)}function we(){var p,v;$.value&&($.value=null,Ot(K.value,L.value),(p=q.scheduleRender)==null||p.call(q),(v=q.emitModelData)==null||v.call(q))}function ce(p){var O,s;if(!$.value)return;const{[p]:v,...S}=$.value.columns;$.value={...$.value,columns:S},(O=q.scheduleRender)==null||O.call(q),(s=q.emitModelData)==null||s.call(q)}function Ue(p,v){var S,O;if($.value){if(v)$.value={...$.value,columns:{...$.value.columns,[p]:v}};else{const{[p]:s,...m}=$.value.columns;$.value={...$.value,columns:m}}(S=q.scheduleRender)==null||S.call(q),(O=q.emitModelData)==null||O.call(q)}}function Ze(p){const v=$.value;return v?Jd(v,p,ol,o.value):{values:[],hasBlank:!1}}function fe(p,v){const S=r.colCount,O=r.rowCount,s=(D,z)=>{const ae=y[ct(D,z)];return!!ae&&(ae.value!==""||ae.styleId!==void 0)};if(!s(p,v))return null;const m=D=>{for(let z=0;z<S;z++)if(s(z,D))return!0;return!1},C=(D,z,ae)=>{for(let Me=z;Me<=ae;Me++)if(s(D,Me))return!0;return!1};let T=v;for(;T>0&&m(T-1);)T--;let R=v;for(;R<O-1&&m(R+1);)R++;let A=p;for(;A>0&&C(A-1,T,R);)A--;let _=p;for(;_<S-1&&C(_+1,T,R);)_++;return{startCol:A,startRow:T,endCol:_,endRow:R}}function We(){const p=Be.value;if(!!p&&p.startRow!==p.endRow)return{startCol:Math.min(p.startCol,p.endCol),endCol:Math.max(p.startCol,p.endCol),startRow:Math.min(p.startRow,p.endRow),endRow:Math.max(p.startRow,p.endRow)};const S=ke.value,O=p?p.startCol:S.col,s=p?p.startRow:S.row,m=(A,_)=>{const D=y[ct(A,_)];return!!D&&(D.value!==""||D.styleId!==void 0)};let C,T;p?(C=Math.min(p.startCol,p.endCol),T=Math.max(p.startCol,p.endCol)):(C=S.col,T=S.col);let R=s;for(;R<r.rowCount-1;){const A=R+1;let _=!1,D=!1;for(let z=C;z<=T;z++){m(z,A)&&(_=!0);const ae=On(z,A);ae&&(ae.range.startCol!==ae.range.endCol||ae.range.startRow!==ae.range.endRow)&&(D=!0)}if(D||!_)break;R++}return!m(O,s)&&R===s?Te():{startCol:C,endCol:T,startRow:s,endRow:R}}function V(){if($.value){we();return}const p=We();p&&xe(p)}function le(p){const v=$.value;return v?p>=v.range.startCol&&p<=v.range.endCol:!1}function me(){return $.value?{...$.value.range}:null}function pe(){return!!$.value}function Re(p){const v=$.value;return v?Mr(v.columns[p]):!1}function Te(){let p=1/0,v=1/0,S=-1,O=-1;for(const s in y){const m=s.indexOf(",");if(m<0)continue;const C=parseInt(s.substring(0,m),10),T=parseInt(s.substring(m+1),10),R=y[s];R&&(R.value!==""||R.styleId!==void 0)&&(C<p&&(p=C),T<v&&(v=T),C>S&&(S=C),T>O&&(O=T))}return S<0?null:{startCol:p,startRow:v,endCol:S,endRow:O}}const Se=t.computed(()=>{const p=[0];for(let v=0;v<r.rowCount;v++)p.push(p[v]+N(v));return p}),qe=t.computed(()=>Ft.value[r.colCount]),mt=t.computed(()=>Se.value[r.rowCount]);function ct(p,v){return`${p},${v}`}ge=ct;function kt(p){Reflect.deleteProperty(y,p)}function jt(p,v){Q.value="cell";const S=et(p,v);S?(ke.value={col:S.range.startCol,row:S.range.startRow},Be.value={...S.range}):(ke.value={col:p,row:v},Be.value={startCol:p,startRow:v,endCol:p,endRow:v})}function kl(p,v,S,O,s="cell"){const m=et(p,v);if(ke.value=m?{col:m.range.startCol,row:m.range.startRow}:{col:p,row:v},Q.value=s,s==="row"||s==="col"){const C=Math.min(p,S),T=Math.max(p,S),R=Math.min(v,O),A=Math.max(v,O);Be.value={startCol:C,startRow:R,endCol:T,endRow:A}}else Be.value=ie(p,v,S,O)}function gn(){kl(0,0,r.colCount-1,r.rowCount-1,"all")}function El(p,v){const S=Be.value;return S?(Q.value==="cell"||Q.value==="all",p>=S.startCol&&p<=S.endCol&&v>=S.startRow&&v<=S.endRow):!1}function nn(p,v){return El(p,v)}function On(p,v){for(const S in $e){const O=$e[S];if(O&&p>=O.startCol&&p<=O.endCol&&v>=O.startRow&&v<=O.endRow)return{range:O,anchor:S}}return null}et=On;function Po(p,v){return $e[ct(p,v)]!==void 0}function on(p,v){const S=et(p,v);if(S&&p===S.range.startCol&&v===S.range.startRow){const O=Ft.value[S.range.endCol+1]-Ft.value[p],s=Se.value[S.range.endRow+1]-Se.value[v];return{w:O,h:s}}return{w:Z.value[p],h:N(v)}}function Zt(p,v,S,O){let s=Math.min(p,S),m=Math.max(p,S),C=Math.min(v,O),T=Math.max(v,O),R=!0;for(;R;){R=!1;for(const A in $e){const _=$e[A];if(!_)continue;_.startCol<=m&&_.endCol>=s&&_.startRow<=T&&_.endRow>=C&&(_.startCol<s&&(s=_.startCol,R=!0),_.endCol>m&&(m=_.endCol,R=!0),_.startRow<C&&(C=_.startRow,R=!0),_.endRow>T&&(T=_.endRow,R=!0))}}return{startCol:s,startRow:C,endCol:m,endRow:T}}ie=Zt;function Jt(p,v){var S;return((S=y[ct(p,v)])==null?void 0:S.value)??""}function Wt(p,v){return tn(),kr(p,v,y,r.colCount,r.rowCount)}function rl(p,v,S){var T,R;p>=0&&v>=0&&Gl(p,v);const O=ct(p,v);if(tn(),H.invalidate(),Y.length>0&&$t(),S===""||S==null){j.clear(O);const A=(T=y[O])==null?void 0:T.styleId;A!==void 0&&A>0?y[O]={value:"",styleId:A}:kt(O),j.markDirty(O);return}const s=String(S);if(!s.startsWith("=")){const A=Ne(y[O]),_=typeof(A==null?void 0:A.numberFormat)=="string"?A.numberFormat:"";if(sl(_)){const D=Nl(s,o.value);if(D){const ae={...A??{},numberFormat:D.format};y[O]={value:String(D.serial),styleId:te(ae)},j.clear(O),j.markDirty(O);return}const z=qn(s,o.value);if(z){const ae={...A??{},numberFormat:z.format};y[O]={value:String(z.num),styleId:te(ae)},j.clear(O),j.markDirty(O);return}}}const m=(R=y[O])==null?void 0:R.styleId,C={value:s};m!==void 0&&m>0&&(C.styleId=m),y[O]=C,s.startsWith("=")?j.set(O,Zn(s.slice(1),r.colCount,r.rowCount)):j.clear(O),j.markDirty(O)}function rn(p,v,S,O){for(let s=p;s<=v;s++)for(let m=S;m<=O;m++){const C=ct(s,m);j.clear(C),kt(C),j.markDirty(C)}H.invalidate(),Y.length>0&&$t()}function an(){return{cells:y,colCount:r.colCount,rowCount:r.rowCount,locale:o.value,getCellValue:(p,v)=>Wt(p,v)}}function Vl(p,v){return k.length===0?null:t0(p,v,k,an(),H)}function Fl(p){var S,O,s;(S=q.saveUndo)==null||S.call(q);const v={id:p.id||l0(),condition:p.condition,format:p.format,ranges:p.ranges,priority:p.priority,stopIfTrue:p.stopIfTrue,enabled:p.enabled!==!1};k.push(v),H.invalidate(),(O=q.scheduleRender)==null||O.call(q),(s=q.emitModelData)==null||s.call(q)}function bn(p,v){var O,s,m;(O=q.saveUndo)==null||O.call(q);const S=k.findIndex(C=>C.id===p);S<0||(k[S]={...k[S],...v,id:p},H.invalidate(),(s=q.scheduleRender)==null||s.call(q),(m=q.emitModelData)==null||m.call(q))}function yn(p){var S,O,s;(S=q.saveUndo)==null||S.call(q);const v=k.findIndex(m=>m.id===p);v<0||(k.splice(v,1),H.invalidate(),(O=q.scheduleRender)==null||O.call(q),(s=q.emitModelData)==null||s.call(q))}function Bn(p,v){var R,A,_;(R=q.saveUndo)==null||R.call(q);const S=[...k].sort((D,z)=>D.priority-z.priority),O=S.findIndex(D=>D.id===p);if(O<0)return;const s=v==="up"?O-1:O+1;if(s<0||s>=S.length)return;const m=S[O],C=S[s],T=m.priority;m.priority=C.priority,C.priority=T,H.invalidate(),(A=q.scheduleRender)==null||A.call(q),(_=q.emitModelData)==null||_.call(q)}function Tn(){H.invalidate()}function Gt(p){var v,S,O;if((v=q.saveUndo)==null||v.call(q),p==="sheet")k.splice(0,k.length);else{const s=q.selection.value;if(!s)return;for(let m=k.length-1;m>=0;m--){const C=k[m];C.ranges=C.ranges.filter(T=>!(T.startCol<=s.endCol&&T.endCol>=s.startCol&&T.startRow<=s.endRow&&T.endRow>=s.startRow)),C.ranges.length===0&&k.splice(m,1)}}H.invalidate(),(S=q.scheduleRender)==null||S.call(q),(O=q.emitModelData)==null||O.call(q)}function $t(){ne.invalidate(),ee.clear()}function gt(){return{cells:y,colCount:r.colCount,rowCount:r.rowCount,locale:o.value,getCellValue:(p,v)=>Wt(p,v),getSheetCells:p=>q.getSheetCellsById?q.getSheetCellsById(p):null}}function pt(p,v){const S=et(v,p),O=S?{col:S.range.startCol,row:S.range.startRow}:{col:v,row:p};return ne.getRules(O.col,O.row,Y)}function Pt(p,v){const S=pt(p,v);return S.length?S[0]:null}function $n(p,v){return pt(p,v).length>0}function Hn(p,v){const S=et(v,p),O=S?{col:S.range.startCol,row:S.range.startRow}:{col:v,row:p};return ne.findRule(O.col,O.row,c0,Y)}function oo(p){const v=p.listSource,S=v&&v.type==="range"?`range:${v.sheetId??""}:${v.range.startCol},${v.range.startRow},${v.range.endCol},${v.range.endRow}`:`values:${(v&&v.type==="values"?v.values:p.values??[]).join("")}`,O=ee.get(S);if(O)return O;const s=Or(p,gt());return ee.set(S,s),s}function Qt(p,v){const S=Hn(p,v);return S?{rule:S,items:oo(S)}:null}function Il(p,v){for(const S of pt(p,v)){if(S.enabled===!1||!S.showInputMessage)continue;const O=S.inputTitle??"",s=S.inputMessage??"";if(!(!O&&!s))return{title:O,message:s}}return null}function ul(p,v,S){const O=pt(p,v);return O.length===0?{valid:!0}:$r(S,v,p,O,gt())}function fl(p){const v=gt(),S={stop:3,warning:2,information:1};let O=null,s=0;for(const m of p){const C=pt(m.row,m.col);if(C.length===0)continue;const T=$r(m.value,m.col,m.row,C,v);if(T.valid)continue;const R=S[Ho(T.rule)]??0;R>s&&(s=R,O=T)}return O??{valid:!0}}function Al(p,v){var O,s,m;v!=null&&v.silent||(O=q.saveUndo)==null||O.call(q);const S={...p,id:p.id||_r(),ranges:(p.ranges??[]).map(C=>({...C})),enabled:p.enabled!==!1};return Y.push(S),$t(),v!=null&&v.silent||((s=q.scheduleRender)==null||s.call(q),(m=q.emitModelData)==null||m.call(q)),S}function ml(p,v,S){var s,m,C;const O=Y.findIndex(T=>T.id===p);if(O<0){Al({id:p,...v},S);return}S!=null&&S.silent||(s=q.saveUndo)==null||s.call(q),Y[O]={...Y[O],...v,id:p},$t(),S!=null&&S.silent||((m=q.scheduleRender)==null||m.call(q),(C=q.emitModelData)==null||C.call(q))}function sn(p,v){var O,s,m;const S=Y.findIndex(C=>C.id===p);S<0||(v!=null&&v.silent||(O=q.saveUndo)==null||O.call(q),Y.splice(S,1),$t(),v!=null&&v.silent||((s=q.scheduleRender)==null||s.call(q),(m=q.emitModelData)==null||m.call(q)))}function ro(p,v){var s,m,C,T,R,A;if(!p){if(Y.length===0)return;v!=null&&v.silent||(s=q.saveUndo)==null||s.call(q),Y.splice(0,Y.length),$t(),v!=null&&v.silent||((m=q.scheduleRender)==null||m.call(q),(C=q.emitModelData)==null||C.call(q));return}const S={startCol:Math.min(p.startCol,p.endCol),endCol:Math.max(p.startCol,p.endCol),startRow:Math.min(p.startRow,p.endRow),endRow:Math.max(p.startRow,p.endRow)};if(Y.filter(_=>(_.ranges??[]).some(D=>!(D.endCol<S.startCol||D.startCol>S.endCol||D.endRow<S.startRow||D.startRow>S.endRow))).length!==0){v!=null&&v.silent||(T=q.saveUndo)==null||T.call(q);for(let _=Y.length-1;_>=0;_--){const D=Y[_],z=[];for(const ae of D.ranges??[])z.push(...zr(ae,S));z.length===0?Y.splice(_,1):D.ranges=z}$t(),v!=null&&v.silent||((R=q.scheduleRender)==null||R.call(q),(A=q.emitModelData)==null||A.call(q))}}function ao(p){const v=[];for(const S of Y)for(const O of S.ranges??[]){const s=Wr(O,p);s&&v.push({rule:S,range:s})}return v}function zn(p,v,S){var O,s,m;if(p.length){S!=null&&S.silent||(O=q.saveUndo)==null||O.call(q);for(let C=Y.length-1;C>=0;C--){const T=Y[C],R=[];for(const A of T.ranges??[])R.push(...zr(A,v));R.length===0?Y.splice(C,1):T.ranges=R}for(const C of p){const T=[];for(const R of C.ranges??[]){const A=Wr(R,v);A&&T.push(A)}T.length&&Y.push({...C,id:_r(),ranges:T})}$t(),S!=null&&S.silent||((s=q.scheduleRender)==null||s.call(q),(m=q.emitModelData)==null||m.call(q))}}async function Wn(p,v,S){const O=p.severity??"stop";if(!(!p.rule||p.rule.showErrorMessage!==!1))return O==="stop"?"cancel":"continue";const m=q.showValidationAlert;if(!m)return O==="stop"?"cancel":"continue";M++;try{return await m({severity:O,title:p.title??"",message:p.message??"",col:v,row:S})}catch{return"cancel"}finally{M=Math.max(0,M-1)}}function io(){return M>0}let Nn=()=>{};function so(p){B.value||(B.value={...ke.value},p!==void 0?oe.value=p:oe.value||(oe.value=Jt(ke.value.col,ke.value.row)))}async function co(){const p=B.value;if(!p)return!1;const v=p.col,S=p.row,O=oe.value,s=ul(S,v,O);return!s.valid&&await Wn(s,v,S)!=="continue"?!1:(Nn(),rl(v,S,O),B.value=null,oe.value="",!0)}function Uo(){B.value=null,oe.value=""}function Ko(p,v){const S=ke.value;let O=Math.max(0,S.col+p),s=Math.max(0,S.row+v);(O>=r.colCount||s>=r.rowCount)&&Gl(O,s);const m=et(S.col,S.row),C=et(O,s);m&&C&&m.anchor===C.anchor&&(p>0?O=m.range.endCol+1:p<0&&(O=m.range.startCol-1),v>0?s=m.range.endRow+1:v<0&&(s=m.range.startRow-1),(O>=r.colCount||s>=r.rowCount)&&Gl(O,s)),O=Math.max(0,Math.min(r.colCount-1,O)),s=Math.max(0,Math.min(r.rowCount-1,s)),jt(O,s)}function Go(p,v){Dn(v,p)}function uo(p){const v=Ft.value;if(p<0||p>=v[r.colCount])return-1;let S=0,O=r.colCount-1;for(;S<O;){const s=S+O+1>>1;v[s]<=p?S=s:O=s-1}return S}function fo(p){const v=Se.value;if(p<0||p>=v[r.rowCount])return-1;let S=0,O=r.rowCount-1;for(;S<O;){const s=S+O+1>>1;v[s]<=p?S=s:O=s-1}return S}function qo(p,v){var s,m;const S=Math.max(0,Math.min(Math.floor(p),r.rowCount)),O=Math.max(0,Math.min(Math.floor(v),r.colCount));J.rows=S,J.cols=O,(s=q.scheduleRender)==null||s.call(q),(m=q.emitModelData)==null||m.call(q)}function Yo(){var p,v;J.rows=0,J.cols=0,(p=q.scheduleRender)==null||p.call(q),(v=q.emitModelData)==null||v.call(q)}function Xo(){return{rows:J.rows,cols:J.cols}}function xn(){let p=0,v=0;if(J.cols>0){const S=Z.value,O=Math.min(J.cols,S.length);for(let s=0;s<O;s++)p+=S[s]}if(J.rows>0)for(let S=0;S<J.rows;S++)v+=N(S);return{frozenRowsHeight:v,frozenColumnsWidth:p}}function jo(){const{frozenColumnsWidth:p,frozenRowsHeight:v}=xn(),S=52+p,O=24+v,s=Math.max(0,It.w-52-11-p),m=Math.max(0,It.h-24-11-v),C=[];return v>0&&p>0&&C.push({kind:"corner",x:52,y:24,width:p,height:v,scrollLeft:0,scrollTop:0}),v>0&&C.push({kind:"rows",x:S,y:24,width:s,height:v,scrollLeft:K.value,scrollTop:0}),p>0&&C.push({kind:"columns",x:52,y:O,width:p,height:m,scrollLeft:0,scrollTop:L.value}),C.push({kind:"body",x:S,y:O,width:s,height:m,scrollLeft:K.value,scrollTop:L.value}),C}function Pn(p,v){const S=Ft.value,O=Se.value,s=Z.value,m=S[v]??0,C=O[p]??0,T=et(v,p),R=T?(S[T.range.endCol+1]??m)-m:s[v]??0,A=T?(O[T.range.endRow+1]??C)-C:N(p),_=v<J.cols,D=p<J.rows,z=_?52+m:52+m-K.value,ae=D?24+C:24+C-L.value;return{x:z,y:ae,width:R,height:A}}function mo(p,v){const{frozenColumnsWidth:S,frozenRowsHeight:O}=xn();if(p<52||v<24)return null;const s=S>0&&p<52+S,m=O>0&&v<24+O,C=s?p-52:p-52+K.value,T=m?v-24:v-24+L.value,R=uo(C),A=fo(T);return R<0||A<0?null:{col:R,row:A}}function Un(p,v){return p<J.rows||v<J.cols}function Dn(p,v){if(Un(p,v))return;const{frozenColumnsWidth:S,frozenRowsHeight:O}=xn(),s=Math.max(0,It.w-52-11-S),m=Math.max(0,It.h-24-11-O),C=Ft.value,T=Se.value,R=(C[v]??0)-S,A=(T[p]??0)-O,_=et(v,p),D=_?(C[_.range.endCol+1]??0)-(C[v]??0):Z.value[v]??0,z=_?(T[_.range.endRow+1]??0)-(T[p]??0):N(p);let ae=K.value,Me=L.value;R<ae?ae=R:R+D>ae+s&&(ae=R+D-s),A<Me?Me=A:A+z>Me+m&&(Me=A+z-m),ae=Math.max(0,ae),Me=Math.max(0,Me),Ot(ae,Me)}function Gl(p,v){var m;const S=p+1,O=v+1;let s=!1;if(S>=r.colCount){const C=Math.max(r.colCount+d,S),T=C-r.colCount,R=Z.value;for(let A=0;A<T;A++)R.push(100);r.colCount=C,s=!0}if(O>=r.rowCount){const C=Math.max(r.rowCount+f,O),T=C-r.rowCount,R=re.value;for(let A=0;A<T;A++)R.push(void 0);r.rowCount=C,s=!0}s&&((m=q.scheduleRender)==null||m.call(q))}function Zo(){return r.colCount!==a||r.rowCount!==i}function Jo(p,v,S){if(!Io(p,v,$e))return;const O=Ar(p,v,{cells:y},S,o.value,r.colCount,r.rowCount,lt),s=Object.entries(O.cells).map(([C,T])=>{const R=C.indexOf(",");return{col:parseInt(C.substring(0,R),10),row:parseInt(C.substring(R+1),10),value:T?T.value:""}}),m=fl(s);if(!m.valid){(async()=>await Wn(m,v.startCol,v.startRow)==="continue"&&po(p,v,S))();return}po(p,v,S)}function po(p,v,S){var m,C,T;(m=q.saveUndo)==null||m.call(q),Gl(v.endCol,v.endRow);const O=Ar(p,v,{cells:y},S,o.value,r.colCount,r.rowCount,lt);tn();for(const[R,A]of Object.entries(O.cells)){const _=A.value;_===""&&(A.styleId===void 0||A.styleId===0)?(j.clear(R),kt(R)):(y[R]={value:_,...A.styleId!==void 0&&A.styleId>0?{styleId:A.styleId}:{}},_.startsWith("=")?j.set(R,Zn(_.slice(1),r.colCount,r.rowCount)):j.clear(R)),j.markDirty(R)}const s={startCol:Math.min(p.startCol,v.startCol),startRow:Math.min(p.startRow,v.startRow),endCol:Math.max(p.endCol,v.endCol),endRow:Math.max(p.endRow,v.endRow)};kl(s.startCol,s.startRow,s.endCol,s.endRow),(C=q.scheduleRender)==null||C.call(q),(T=q.emitModelData)==null||T.call(q)}function Qo(p,v){var m;let S=!1;const O=Math.max(1,Math.floor(p)),s=Math.max(1,Math.floor(v));if(O!==r.colCount){if(O>r.colCount){const C=Z.value;for(let T=r.colCount;T<O;T++)C.push(100)}else Z.value=Z.value.slice(0,O);r.colCount=O,S=!0}if(s!==r.rowCount){if(s>r.rowCount){const C=re.value;for(let T=r.rowCount;T<s;T++)C.push(void 0)}else re.value=re.value.slice(0,s);r.rowCount=s,S=!0}S&&((m=q.scheduleRender)==null||m.call(q))}const q={props:l,locale:o,get colCount(){return r.colCount},get rowCount(){return r.rowCount},ensureCapacity:Gl,hasDynamicDims:Zo,setDims:Qo,cells:y,styles:h,borders:u,merges:$e,formulaDeps:j,selection:Be,activeCell:ke,editingCell:B,editValue:oe,colWidths:Z,rowHeights:re,scrollX:K,scrollY:L,freeze:J,setFreeze:qo,clearFreeze:Yo,getFreeze:Xo,getFrozenMetrics:xn,filter:$,getFilter:be,setFilter:he,enableFilter:xe,clearFilter:we,clearFilterColumn:ce,setFilterColumn:Ue,getColumnCandidates:Ze,getDataRange:Te,getCurrentRegion:fe,detectFilterRange:We,toggleAutoFilter:V,isColumnInFilterRange:le,getFilterRange:me,isFilterEnabled:pe,isFilterColumnActive:Re,isRowHidden:W,getFilteredOutRows:zt,getVisibleRowCount:g,getVisibleRowAt:c,getVisibleRowIndex:w,getViewportRegions:jo,cellToScreenRect:Pn,screenToCell:mo,isCellFrozen:Un,scrollCellIntoView:Dn,BASE_CELL_VPAD:He,fontMetricsCache:de,fontMetricsCanvas:Le,measureFontMetrics:ve,_getFontMetricsForCell:Rt,getWrappedLines:ft,cellFontSize:Mt,colPositions:Ft,getRowHeight:nl,_isAutoRow:dl,rowPositions:Se,totalWidth:qe,totalHeight:mt,selectCell:jt,selectRange:kl,selectAll:gn,isSelected:El,isCellSelected:nn,selectionMode:Q,cellKey:ct,delCell:kt,findMerge:On,_isMergeAnchor:Po,_mergedSpan:on,expandSelectionForMerges:Zt,getCellRaw:Jt,getCellValue:Wt,setCellValue:rl,clearCellsInRange:rn,startEdit:so,commitEdit:co,cancelEdit:Uo,moveActive:Ko,ensureVisible:Go,hitCol:uo,hitRow:fo,registerStyle:te,resolveStyle:Ne,rebuildStyleIndex:ze,syncStyles:Ve,registerBorder:Fe,resolveBorder:je,rebuildBorderIndex:_e,syncBorders:F,getCellBorderSide:I,getMergeOwner:G,isSameMergeInternal:Ce,viewSize:It,findHighlight:(p,v)=>null,autoFillState:U,applyAutoFill:Jo,conditionalFormats:k,resolveConditionalFormat:Vl,addConditionalFormatRule:Fl,updateConditionalFormatRule:bn,removeConditionalFormatRule:yn,moveConditionalFormatRule:Bn,clearConditionalFormats:Gt,invalidateConditionalFormatCache:Tn,dataValidations:Y,getDataValidationRules:pt,getDataValidationRule:Pt,hasDataValidation:$n,getListValidation:Hn,getValidationDropdown:Qt,getValidationInputMessage:Il,validateCell:ul,validateCells:fl,createDataValidation:Al,updateDataValidation:ml,removeDataValidation:sn,clearDataValidation:ro,getDataValidationsInRange:ao,applyDataValidationsToRange:zn,invalidateDataValidationCache:$t,isValidationAlertOpen:io,confirmInvalidValue:Wn};return Nn=()=>{var p;return(p=q.saveUndo)==null?void 0:p.call(q)},Ot=(p,v)=>{var S;return(S=q.clampScroll)==null?void 0:S.call(q,p,v)},q}function T0(e,n){const l=t.ref([]),o=t.ref([]);function a(V){return E0(V)}function i(){return n.saveSheet(),{sheets:n.sheets.value.map(V=>({id:V.id,name:V.name,cells:a(V.cells),styles:[...V.styles],borders:V.borders?[...V.borders]:[{}],merges:V.merges?{...V.merges}:{},selection:V.selection?{...V.selection}:null,activeCell:V.activeCell?{...V.activeCell}:{col:0,row:0},scrollX:V.scrollX,scrollY:V.scrollY,colWidths:[...V.colWidths],rowHeights:[...V.rowHeights],colCount:V.colCount,rowCount:V.rowCount,freeze:{...V.freeze},filter:V.filter?JSON.parse(JSON.stringify(V.filter)):null,conditionalFormats:V.conditionalFormats?V.conditionalFormats.map(le=>({...le,ranges:le.ranges.map(me=>({...me}))})):[],dataValidations:V.dataValidations?V.dataValidations.map(le=>({...le,ranges:(le.ranges??[]).map(me=>({...me}))})):[]})),styles:[...e.styles],activeSheetIndex:n.activeSheetIndex.value}}function r(V){const le=n.sheets.value;n.sheets.value=V.sheets.map((me,pe)=>{var Te;const Re=((Te=le[pe])==null?void 0:Te.freeze)??{rows:0,cols:0};return{...me,cells:a(me.cells),styles:[...me.styles],borders:me.borders?[...me.borders]:[{}],freeze:{rows:Re.rows,cols:Re.cols}}}),n.loadSheet(Math.max(0,Math.min(V.activeSheetIndex,n.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function d(){const V=i(),le=l.value[l.value.length-1];le&&JSON.stringify(le)===JSON.stringify(V)||(l.value.push(V),o.value=[],l.value.length>50&&l.value.shift())}e.saveUndo=d;function f(){var V,le,me;l.value.length&&(o.value.push(i()),r(l.value.pop()),(V=e.invalidateConditionalFormatCache)==null||V.call(e),(le=e.invalidateDataValidationCache)==null||le.call(e),(me=e.scheduleRender)==null||me.call(e),t.nextTick(()=>{var pe;return(pe=e.emitModelData)==null?void 0:pe.call(e)}))}function y(){var V,le,me;o.value.length&&(l.value.push(i()),r(o.value.pop()),(V=e.invalidateConditionalFormatCache)==null||V.call(e),(le=e.invalidateDataValidationCache)==null||le.call(e),(me=e.scheduleRender)==null||me.call(e),t.nextTick(()=>{var pe;return(pe=e.emitModelData)==null?void 0:pe.call(e)}))}const h=t.computed(()=>l.value.length>0),u=t.computed(()=>o.value.length>0),E=t.computed(()=>!!e.selection.value),x=t.ref(null);function k(){var me;const V=e.selection.value;if(!V)return;const le={};for(let pe=V.startCol;pe<=V.endCol;pe++)for(let Re=V.startRow;Re<=V.endRow;Re++)le[`${pe-V.startCol},${Re-V.startRow}`]=((me=e.cells[e.cellKey(pe,Re)])==null?void 0:me.styleId)??0;x.value={styles:le}}function H(){var me,pe,Re;const V=x.value,le=e.selection.value;if(!(!V||!le)){d();for(let Te=le.startCol;Te<=le.endCol;Te++)for(let Se=le.startRow;Se<=le.endRow;Se++){const qe=e.findMerge(Te,Se);if(qe&&(Te!==qe.range.startCol||Se!==qe.range.startRow))continue;const mt=V.styles[`${Te-le.startCol},${Se-le.startRow}`]??0,ct=e.cellKey(Te,Se),kt=((me=e.cells[ct])==null?void 0:me.value)??"";if(kt===""&&mt===0)e.delCell(ct);else{const jt={value:kt};mt>0&&(jt.styleId=mt),e.cells[ct]=jt}}x.value=null,(pe=e.scheduleRender)==null||pe.call(e),(Re=e.emitModelData)==null||Re.call(e)}}function Y(){var le,me,pe;const V=e.selection.value;if(V){d();for(let Re=V.startCol;Re<=V.endCol;Re++)for(let Te=V.startRow;Te<=V.endRow;Te++){const Se=e.findMerge(Re,Te);if(Se&&(Re!==Se.range.startCol||Te!==Se.range.startRow))continue;const qe=e.cellKey(Re,Te),mt=((le=e.cells[qe])==null?void 0:le.value)??"";mt===""?e.delCell(qe):e.cells[qe]={value:mt}}(me=e.scheduleRender)==null||me.call(e),(pe=e.emitModelData)==null||pe.call(e)}}const ne=t.computed(()=>ra.map(V=>({...V,label:V.value===""?b(e.locale.value,"fontDefault"):V.label}))),ee=t.computed(()=>aa.map(V=>({...V,label:String(V.value)}))),M="\0",se=t.computed(()=>{const V=e.selection.value;if(!V)return"";let le,me=!1;for(let pe=V.startCol;pe<=V.endCol&&!me;pe++)for(let Re=V.startRow;Re<=V.endRow&&!me;Re++){const Te=e.findMerge(pe,Re);if(Te&&(pe!==Te.range.startCol||Re!==Te.range.startRow))continue;const Se=e.resolveStyle(e.cells[e.cellKey(pe,Re)]),qe=typeof(Se==null?void 0:Se.fontFamily)=="string"?Se.fontFamily:"";le===void 0?le=qe:qe!==le&&(me=!0)}return me?M:le??""}),X=t.computed(()=>{const V=e.selection.value;if(!V)return zl;let le,me=!1;for(let pe=V.startCol;pe<=V.endCol&&!me;pe++)for(let Re=V.startRow;Re<=V.endRow&&!me;Re++){const Te=e.findMerge(pe,Re);if(Te&&(pe!==Te.range.startCol||Re!==Te.range.startRow))continue;const Se=e.cellFontSize(pe,Re);le===void 0?le=Se:Se!==le&&(me=!0)}return me?0:le??zl});function te(V,le){var pe,Re,Te;const me=e.selection.value;if(me){d();for(let Se=me.startCol;Se<=me.endCol;Se++)for(let qe=me.startRow;qe<=me.endRow;qe++){const mt=e.findMerge(Se,qe);if(mt&&(Se!==mt.range.startCol||qe!==mt.range.startRow))continue;const ct=e.cellKey(Se,qe),kt=((pe=e.cells[ct])==null?void 0:pe.value)??"";let kl={...e.resolveStyle(e.cells[ct])??{}};if(le===""||le===null||le===void 0||le===0){const{[V]:El,...nn}=kl;kl=nn}else kl[V]=le;const gn=Object.keys(kl).length?e.registerStyle(kl):0;if(kt===""&&gn===0)e.delCell(ct);else{const El={value:kt};gn>0&&(El.styleId=gn),e.cells[ct]=El}}(Re=e.scheduleRender)==null||Re.call(e),(Te=e.emitModelData)==null||Te.call(e)}}function Ne(V){te("fontFamily",V===""?"":V)}const ze=t.ref(!1),Ve=t.ref(!1),Fe=t.ref(!1),je=t.ref(!1),_e=t.ref(!1);function F(V){te("fontSize",V),ze.value=!1}const I=t.computed(()=>ma.map(V=>({label:b(e.locale.value,V.labelKey),value:V.value,icon:V.icon}))),G=t.computed(()=>pa.map(V=>({label:b(e.locale.value,V.labelKey),value:V.value,icon:V.icon}))),Ce=t.computed(()=>{const V=e.selection.value;if(!V)return"left";const le=e.resolveStyle(e.cells[e.cellKey(V.startCol,V.startRow)]),me=typeof(le==null?void 0:le.textAlign)=="string"?le.textAlign:"";return me==="center"||me==="right"?me:"left"}),$e=t.computed(()=>{const V=e.selection.value;if(!V)return"top";const le=e.resolveStyle(e.cells[e.cellKey(V.startCol,V.startRow)]),me=typeof(le==null?void 0:le.verticalAlign)=="string"?le.verticalAlign:"";return me==="middle"||me==="bottom"?me:"top"}),j=t.computed(()=>{const V=e.selection.value;if(!V)return!1;const le=e.resolveStyle(e.cells[e.cellKey(V.startCol,V.startRow)]);return(le==null?void 0:le.wrap)==="wrap"});function Be(V){te("textAlign",V)}function Q(V){te("verticalAlign",V)}function ke(){if(!e.selection.value)return;const le=j.value;te("wrap",le?void 0:"wrap")}const B=t.ref(""),oe=ze;t.watch(X,V=>{B.value=V===0?"":String(V)},{immediate:!0});function Z(V){const le=V.replace(/[^\d]/g,"");B.value=le;const me=parseInt(le,10);!isNaN(me)&&me>=5&&me<=72&&me!==X.value&&te("fontSize",me)}function re(){const V=B.value.trim();if(!V){B.value=X.value===0?"":String(X.value);return}let le=parseInt(V,10);isNaN(le)?le=X.value===0?zl:X.value:le=Math.max(5,Math.min(72,le)),B.value=String(le),le!==X.value&&te("fontSize",le)}function K(V){V.key==="Enter"&&V.target.blur()}function L(V){V&&V.preventDefault(),oe.value=!oe.value,oe.value&&(Fe&&(Fe.value=!1),Ve&&(Ve.value=!1),je.value=!1,_e.value=!1)}function J(){const V=X.value===0?zl:X.value,le=Math.min(72,V+1);te("fontSize",le),B.value=String(le),oe.value=!1}function $(){const V=X.value===0?zl:X.value,le=Math.max(5,V-1);te("fontSize",le),B.value=String(le),oe.value=!1}function U(V){const le=e.selection.value;if(!le)return!1;let me,pe=!1;for(let Re=le.startCol;Re<=le.endCol&&!pe;Re++)for(let Te=le.startRow;Te<=le.endRow&&!pe;Te++){const Se=e.findMerge(Re,Te);if(Se&&(Re!==Se.range.startCol||Te!==Se.range.startRow))continue;const qe=e.resolveStyle(e.cells[e.cellKey(Re,Te)]),mt=!!(qe!=null&&qe[V]);me===void 0?me=mt:mt!==me&&(pe=!0)}return!pe&&me===!0}const de=t.computed(()=>U("fontWeight")),Le=t.computed(()=>U("fontStyle")),ve=t.computed(()=>U("underline")),Ie=t.computed(()=>U("strikethrough"));function Ee(){te("fontWeight",de.value?"":"bold")}function He(){te("fontStyle",Le.value?"":"italic")}function ge(){te("underline",ve.value?"":"underline")}function et(){te("strikethrough",Ie.value?"":"line-through")}const ut=t.ref(""),Pe=t.ref(""),N=je,ie=_e;function Rt(){N.value=!N.value,ie.value=!1,Ve&&(Ve.value=!1),Fe&&(Fe.value=!1)}function ft(){ie.value=!ie.value,N.value=!1,Ve&&(Ve.value=!1),Fe&&(Fe.value=!1)}function Mt(V){Ve&&(Ve.value=V),V&&(N.value=!1,ie.value=!1,Fe&&(Fe.value=!1))}function Ft(V){ut.value=V,te("color",V===""?"":V)}function It(V){Pe.value=V,te("backgroundColor",V===""?"":V)}function Ot(){te("color",ut.value===""?"":ut.value)}function Dl(){te("backgroundColor",Pe.value===""?"":Pe.value)}const nl=t.computed(()=>{const V=e.selection.value;if(!V)return"";let le,me=!1;for(let pe=V.startCol;pe<=V.endCol&&!me;pe++)for(let Re=V.startRow;Re<=V.endRow&&!me;Re++){const Te=e.findMerge(pe,Re);if(Te&&(pe!==Te.range.startCol||Re!==Te.range.startRow))continue;const Se=e.resolveStyle(e.cells[e.cellKey(pe,Re)]),qe=typeof(Se==null?void 0:Se.color)=="string"?Se.color:"";le===void 0?le=qe:qe!==le&&(me=!0)}return me?"":le??""}),dl=t.computed(()=>{const V=e.selection.value;if(!V)return"";let le,me=!1;for(let pe=V.startCol;pe<=V.endCol&&!me;pe++)for(let Re=V.startRow;Re<=V.endRow&&!me;Re++){const Te=e.findMerge(pe,Re);if(Te&&(pe!==Te.range.startCol||Re!==Te.range.startRow))continue;const Se=e.resolveStyle(e.cells[e.cellKey(pe,Re)]),qe=typeof(Se==null?void 0:Se.backgroundColor)=="string"?Se.backgroundColor:"";le===void 0?le=qe:qe!==le&&(me=!0)}return me?"":le??""}),ol=t.computed(()=>ur(e.locale.value)),Ht=t.ref(!1),vl=t.computed(()=>{const V=e.selection.value;if(!V)return Pl;let le,me=!1;for(let pe=V.startCol;pe<=V.endCol&&!me;pe++)for(let Re=V.startRow;Re<=V.endRow&&!me;Re++){const Te=e.findMerge(pe,Re);if(Te&&(pe!==Te.range.startCol||Re!==Te.range.startRow))continue;const Se=e.resolveStyle(e.cells[e.cellKey(pe,Re)]),qe=(Se==null?void 0:Se.numberFormatCategory)==="custom"?Wl:typeof(Se==null?void 0:Se.numberFormat)=="string"?Se.numberFormat:"";le===void 0?le=qe:qe!==le&&(me=!0)}return me?Tl:le??Pl});function zt(V){if((V==null?void 0:V.numberFormatCategory)==="custom")return Wl;const le=typeof(V==null?void 0:V.numberFormat)=="string"?V.numberFormat:"";return dr(le,e.locale.value)}const W=t.computed(()=>{const V=vl.value;if(V!==Tl)return V===Wl?Wl:dr(V,e.locale.value);const le=e.selection.value;if(!le)return Pl;let me,pe=!1;for(let Re=le.startCol;Re<=le.endCol&&!pe;Re++)for(let Te=le.startRow;Te<=le.endRow&&!pe;Te++){const Se=e.findMerge(Re,Te);if(Se&&(Re!==Se.range.startCol||Te!==Se.range.startRow))continue;const qe=zt(e.resolveStyle(e.cells[e.cellKey(Re,Te)]));me===void 0?me=qe:qe!==me&&(pe=!0)}return pe?Tl:me??Pl});function g(V){te("numberFormat",V),c()}function c(){const V=e.selection.value;if(V)for(let le=V.startCol;le<=V.endCol;le++)for(let me=V.startRow;me<=V.endRow;me++){const pe=e.findMerge(le,me);if(pe&&(le!==pe.range.startCol||me!==pe.range.startRow))continue;const Re=e.cellKey(le,me),Te=e.cells[Re],Se=e.resolveStyle(Te);if((Se==null?void 0:Se.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:qe,...mt}=Se,ct=Object.keys(mt).length?e.registerStyle(mt):0,kt=(Te==null?void 0:Te.value)??"";if(kt===""&&ct===0)e.delCell(Re);else{const jt={value:kt};ct>0&&(jt.styleId=ct),e.cells[Re]=jt}}}function w(V){if(V===Wl){Ht.value=!0;return}g(V)}function be(){Ht.value=!0}function he(){const V=e.selection.value;if(!V)return[];const le=[];for(let me=V.startCol;me<=V.endCol;me++)for(let pe=V.startRow;pe<=V.endRow;pe++){const Re=e.findMerge(me,pe);if(Re&&(me!==Re.range.startCol||pe!==Re.range.startRow))continue;const Te=e.cellKey(me,pe),Se=e.cells[Te],qe=e.resolveStyle(Se),mt=typeof(qe==null?void 0:qe.numberFormat)=="string"?qe.numberFormat:Pl,ct=(Se==null?void 0:Se.value)??"",kt=ct.startsWith("=")?kr(me,pe,e.cells,e.colCount,e.rowCount):ct;cr(mt,kt)&&le.push({key:Te,nf:mt,decimals:Ia(mt,kt)})}return le}const xe=t.computed(()=>he().some(V=>V.decimals<Eo)),we=t.computed(()=>he().some(V=>V.decimals>Ro));function ce(V,le,me){var qe;const pe=((qe=e.cells[V])==null?void 0:qe.value)??"",Te={...e.resolveStyle(e.cells[V])??{}};le===""?(delete Te.numberFormat,delete Te.numberFormatCategory):(Te.numberFormat=le,me==="custom"&&(Te.numberFormatCategory="custom"));const Se=Object.keys(Te).length?e.registerStyle(Te):0;if(pe===""&&Se===0)e.delCell(V);else{const mt={value:pe};Se>0&&(mt.styleId=Se),e.cells[V]=mt}}function Ue(V){var pe,Re;const le=he(),me=[];for(const Te of le){const Se=Te.decimals+V;if(Se<Ro||Se>Eo)continue;const qe=_a(Te.nf,Se);qe==null||qe===Te.nf||me.push({key:Te.key,code:qe,category:sl(Te.nf)?"custom":void 0})}if(me.length){d();for(const Te of me)ce(Te.key,Te.code,Te.category);(pe=e.scheduleRender)==null||pe.call(e),(Re=e.emitModelData)==null||Re.call(e)}}function Ze(){Ue(1)}function fe(){Ue(-1)}return{undoStack:l,redoStack:o,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:d,undo:f,redo:y,canUndo:h,canRedo:u,hasSelection:E,paintFmt:x,onPaintFormat:k,applyPaintFormat:H,clearFormat:Y,fontFamilyOptions:ne,fontSizeOptions:ee,FONT_FAMILY_MIXED:M,selFontFamily:se,selFontSize:X,applyStyleToSelection:te,onFontFamilyChange:Ne,onFontSizeChange:F,hAlignOptions:I,vAlignOptions:G,selHAlign:Ce,selVAlign:$e,selWrap:j,onHAlignChange:Be,onVAlignChange:Q,onWrapToggle:ke,fontSizeInput:B,fontSizeMenuOpen:oe,onFontSizeInput:Z,onFontSizeBlur:re,onFontSizeKeydown:K,toggleFontSizeMenu:L,onFontSizeStepUp:J,onFontSizeStepDown:$,selFontWeight:de,selFontStyle:Le,selUnderline:ve,selStrikethrough:Ie,toggleFontWeight:Ee,toggleFontStyle:He,toggleUnderline:ge,toggleStrikethrough:et,cachedTextColor:ut,cachedFillColor:Pe,textColorMenuOpen:N,fillColorMenuOpen:ie,_toggleTextColorMenu:Rt,_toggleFillColorMenu:ft,onBorderMenuToggle:Mt,onTextColorChange:Ft,onFillColorChange:It,applyCachedTextColor:Ot,applyCachedFillColor:Dl,selTextColor:nl,selFillColor:dl,nfOptions:ol,selNumberFormat:vl,selNumberFormatDisplay:W,NF_NUMBER_FORMAT_MIXED:Tl,nfDialogOpen:Ht,onNumberFormatChange:w,openNumberFormatDialog:be,applyNumberFormatCode:g,canIncreaseDecimals:xe,canDecreaseDecimals:we,onIncreaseDecimals:Ze,onDecreaseDecimals:fe}}function N0(e,n){n.borderMenuOpen&&(e.borderMenuOpen=n.borderMenuOpen),n.mergeMenuOpen&&(e.mergeMenuOpen=n.mergeMenuOpen),(()=>{const o=e.borderMenuOpen,a=e.mergeMenuOpen;e.onBorderMenuToggle=i=>{o&&(o.value=i),i&&(e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1,a&&(a.value=!1))},e.toggleFontSizeMenu=i=>{i&&i.preventDefault(),e.fontSizeMenuOpen.value=!e.fontSizeMenuOpen.value,e.fontSizeMenuOpen.value&&(a&&(a.value=!1),o&&(o.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,o&&(o.value=!1),a&&(a.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,o&&(o.value=!1),a&&(a.value=!1)}})()}function x0(e,n){const l=t.ref("none"),o=t.ref(!1),a="#444";function i(B,oe,Z,re){if(B<0||oe<0||B>=e.colCount||oe>=e.rowCount)return;const K=e.findMerge(B,oe),L=K?K.anchor:e.cellKey(B,oe);if(!e.cells[L]){if(!re)return;e.cells[L]={value:""}}M0(e.cells[L],Z,re,e.styles,{get:$=>e.resolveBorder($),getId:$=>e.registerBorder($)},e.registerStyle)}function r(B,oe,Z){var U;const re=e.findMerge(B,oe),K=re?re.anchor:e.cellKey(B,oe),L=((U=e.cells[K])==null?void 0:U.value)??"",J=e.resolveStyle(e.cells[K])?{...e.resolveStyle(e.cells[K])}:{},$=e.registerBorder(Z);if($>0?J.borderId=$:delete J.borderId,delete J.borderTopWidth,delete J.borderBottomWidth,delete J.borderLeftWidth,delete J.borderRightWidth,delete J.borderColor,L===""&&!Object.keys(J).length)e.delCell(K);else{const de=e.registerStyle(J);e.cells[K]={value:L,styleId:de||void 0}}}function d(B){var U,de;l.value=B;const oe=e.selection.value;if(!oe)return;n.saveUndo();const{startCol:Z,startRow:re,endCol:K,endRow:L}=oe,J={width:1,color:a},$={width:2,color:a};if(B==="none")for(let Le=Z;Le<=K;Le++)for(let ve=re;ve<=L;ve++){const Ie=e.findMerge(Le,ve);Ie&&(Le!==Ie.range.startCol||ve!==Ie.range.startRow)||r(Le,ve,{})}else if(B==="all")for(let Le=Z;Le<=K;Le++)for(let ve=re;ve<=L;ve++){const Ie=e.findMerge(Le,ve);Ie&&(Le!==Ie.range.startCol||ve!==Ie.range.startRow)||r(Le,ve,{top:J,right:J,bottom:J,left:J})}else if(B==="outer"||B==="thickOuter"){const Le=B==="thickOuter"?$:J;for(let ve=Z;ve<=K;ve++)i(ve,re,"top",Le);for(let ve=Z;ve<=K;ve++)i(ve,L,"bottom",Le);for(let ve=re;ve<=L;ve++)i(Z,ve,"left",Le);for(let ve=re;ve<=L;ve++)i(K,ve,"right",Le)}else{const ve={top:{side:"top",edgeCheck:(Ie,Ee)=>Ee===re},bottom:{side:"bottom",edgeCheck:(Ie,Ee)=>Ee===L},left:{side:"left",edgeCheck:(Ie,Ee)=>Ie===Z},right:{side:"right",edgeCheck:(Ie,Ee)=>Ie===K}}[B];if(ve)for(let Ie=Z;Ie<=K;Ie++)for(let Ee=re;Ee<=L;Ee++)ve.edgeCheck(Ie,Ee)&&i(Ie,Ee,ve.side,J)}(U=e.scheduleRender)==null||U.call(e),(de=e.emitModelData)==null||de.call(e)}function f(){d(l.value)}function y(B,oe,Z){const re=Z.toLowerCase(),K=e.findMerge(B,oe);if(K){if(re==="top"&&oe!==K.range.startRow||re==="bottom"&&oe!==K.range.endRow||re==="left"&&B!==K.range.startCol||re==="right"&&B!==K.range.endCol)return 0;const J=e.getCellBorderSide(e.cells[K.anchor],re);return(J==null?void 0:J.width)??0}const L=e.getCellBorderSide(e.cells[e.cellKey(B,oe)],re);return(L==null?void 0:L.width)??0}const h=t.ref(!1);function u(B){h.value=B,B&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,o.value=!1,n.fontSizeMenuOpen.value=!1)}function E(B,oe,Z,re){const K=[];for(const L in e.merges){const J=e.merges[L];J&&J.startCol<=Z&&J.endCol>=B&&J.startRow<=re&&J.endRow>=oe&&K.push(L)}for(const L of K)Reflect.deleteProperty(e.merges,L)}function x(){var L,J,$;const B=e.selection.value;if(!B||B.startCol===B.endCol&&B.startRow===B.endRow)return;n.saveUndo(),E(B.startCol,B.startRow,B.endCol,B.endRow);const oe=e.cellKey(B.startCol,B.startRow),Z=((L=e.cells[oe])==null?void 0:L.value)??"";for(let U=B.startCol;U<=B.endCol;U++)for(let de=B.startRow;de<=B.endRow;de++)U===B.startCol&&de===B.startRow||e.clearCellsInRange(U,U,de,de);const re=e.resolveStyle(e.cells[oe])?{...e.resolveStyle(e.cells[oe])}:{};re.textAlign="center";const K=e.registerStyle(re);e.cells[oe]={value:Z,styleId:K||void 0},e.merges[oe]={startCol:B.startCol,startRow:B.startRow,endCol:B.endCol,endRow:B.endRow},e.selectCell(B.startCol,B.startRow),(J=e.scheduleRender)==null||J.call(e),($=e.emitModelData)==null||$.call(e)}function k(){var oe,Z,re;const B=e.selection.value;if(!(!B||B.startCol===B.endCol)){n.saveUndo();for(let K=B.startRow;K<=B.endRow;K++){E(B.startCol,K,B.endCol,K);const L=e.cellKey(B.startCol,K);(oe=e.cells[L])==null||oe.value;for(let J=B.startCol+1;J<=B.endCol;J++)e.clearCellsInRange(J,J,K,K);e.merges[L]={startCol:B.startCol,startRow:K,endCol:B.endCol,endRow:K}}e.selectRange(B.startCol,B.startRow,B.endCol,B.endRow),(Z=e.scheduleRender)==null||Z.call(e),(re=e.emitModelData)==null||re.call(e)}}function H(){var Z,re,K;const B=e.selection.value;if(!B||B.startCol===B.endCol&&B.startRow===B.endRow)return;n.saveUndo(),E(B.startCol,B.startRow,B.endCol,B.endRow);const oe=e.cellKey(B.startCol,B.startRow);(Z=e.cells[oe])==null||Z.value;for(let L=B.startCol;L<=B.endCol;L++)for(let J=B.startRow;J<=B.endRow;J++)L===B.startCol&&J===B.startRow||e.clearCellsInRange(L,L,J,J);e.merges[oe]={startCol:B.startCol,startRow:B.startRow,endCol:B.endCol,endRow:B.endRow},e.selectCell(B.startCol,B.startRow),(re=e.scheduleRender)==null||re.call(e),(K=e.emitModelData)==null||K.call(e)}function Y(){var oe,Z;const B=e.selection.value;B&&(n.saveUndo(),E(B.startCol,B.startRow,B.endCol,B.endRow),(oe=e.scheduleRender)==null||oe.call(e),(Z=e.emitModelData)==null||Z.call(e))}function ne(){const B=e.selection.value;if(!B)return;const oe=e.findMerge(B.startCol,B.startRow);oe&&B.startCol===oe.range.startCol&&B.startRow===oe.range.startRow&&B.endCol===oe.range.endCol&&B.endRow===oe.range.endRow?Y():x()}function ee(B){switch(B){case"mergeCenter":x();break;case"mergeAcross":k();break;case"mergeCells":H();break;case"unmergeCells":Y();break}}let M=null,se=[],X=[];function te(B,oe,Z,re){X=[];const K={startCol:B,endCol:oe,startRow:Z,endRow:re};for(const{rule:L,range:J}of e.getDataValidationsInRange(K))X.push({...L,ranges:[{...J}]})}function Ne(B,oe,Z,re){se=[];for(let K=Z;K<=re;K++){const L=[];for(let J=B;J<=oe;J++){const $=e.cells[e.cellKey(J,K)];L.push(($==null?void 0:$.styleId)??0)}se.push(L)}}function ze(B,oe,Z,re){const K=e.cellKey(B,oe);if(tn(),Z===""||Z==null){e.formulaDeps.clear(K),re&&re>0?e.cells[K]={value:"",styleId:re}:e.delCell(K),e.formulaDeps.markDirty(K);return}e.cells[K]={value:Z,styleId:re&&re>0?re:void 0},Z.startsWith("=")?e.formulaDeps.set(K,Zn(Z.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(K),e.formulaDeps.markDirty(K)}function Ve(){const B=e.selection.value;if(!B)return;M={...B},Ne(B.startCol,B.endCol,B.startRow,B.endRow),te(B.startCol,B.endCol,B.startRow,B.endRow);const oe=[];for(let Z=B.startRow;Z<=B.endRow;Z++){const re=[];for(let K=B.startCol;K<=B.endCol;K++)re.push(e.getCellRaw(K,Z));oe.push(re.join(" "))}To(oe.join(`
|
|
4
|
-
`))}function
|
|
5
|
-
`))}else if(
|
|
6
|
-
`))}}}async function je(){var ve;let B;try{B=await navigator.clipboard.readText()}catch{return}if(!B&&B!=="")return;const oe=B.split(/\r?\n/),Z=e.activeCell.value,re=M,K=re&&se.length>0,L=oe.map(Ie=>Ie.split(" ").length),J=L.length?Math.max(...L):0,$=Z.col+J-1,U=Z.row+oe.length-1;$>=0&&U>=0&&e.ensureCapacity($,U);const de=[];for(let Ie=0;Ie<oe.length;Ie++){const Ee=oe[Ie].split(" ");for(let He=0;He<Ee.length;He++){const ge=Z.col+He,et=Z.row+Ie;let ut=Ee[He];ut.startsWith("=")&&re&&(ut=Jn(ut,ge-(re.startCol+He),et-(re.startRow+Ie),e.colCount,e.rowCount,lt));const Pe=K&&Ie<se.length&&He<(((ve=se[Ie])==null?void 0:ve.length)??0)?se[Ie][He]??null:null;de.push({c:ge,r:et,val:ut,styleId:Pe})}}const Le=e.validateCells(de.map(Ie=>({col:Ie.c,row:Ie.r,value:Ie.val})));if(!(!Le.valid&&await e.confirmInvalidValue(Le,Z.col,Z.row)!=="continue")){for(const Ie of de)Ie.styleId!==null?ze(Ie.c,Ie.r,Ie.val,Ie.styleId):e.setCellValue(Ie.c,Ie.r,Ie.val);if(re&&X.length>0){const Ie=Z.col-re.startCol,Ee=Z.row-re.startRow,He={startCol:Z.col,endCol:Z.col+J-1,startRow:Z.row,endRow:Z.row+oe.length-1},ge=X.map(et=>({...et,ranges:et.ranges.map(ut=>w0(ut,Ie,Ee))}));e.applyDataValidationsToRange(ge,He,{silent:!0}),e.invalidateDataValidationCache()}}}function _e(){var B;if(n.saveUndo(),Ve(),e.selection.value){const oe=e.selection.value;e.clearCellsInRange(oe.startCol,oe.endCol,oe.startRow,oe.endRow),(B=e.scheduleRender)==null||B.call(e)}}function F(){var B;if(e.selection.value){const oe=e.selection.value;e.clearCellsInRange(oe.startCol,oe.endCol,oe.startRow,oe.endRow),(B=e.scheduleRender)==null||B.call(e)}}function I(){var L,J;const B=e.selection.value;if(!B)return;n.saveUndo();const oe=B.startCol,Z=B.startRow,re=B.endCol,K=B.endRow;if(Z===K)if(re+1<e.colCount){const $=`${lt(oe)}${Z+1}:${lt(re)}${Z+1}`;e.setCellValue(re+1,Z,`=SUM(${$})`)}else{const $=`${lt(oe)}${Z+1}:${lt(re-1)}${Z+1}`;e.setCellValue(re,Z,`=SUM(${$})`)}else for(let $=oe;$<=re;$++)if(K+1<e.rowCount){const U=`${lt($)}${Z+1}:${lt($)}${K+1}`;e.setCellValue($,K+1,`=SUM(${U})`)}else{const U=`${lt($)}${Z+1}:${lt($)}${K}`;e.setCellValue($,K,`=SUM(${U})`)}(L=e.scheduleRender)==null||L.call(e),(J=e.emitModelData)==null||J.call(e)}function G(){var L,J;const B=e.selection.value;if(!B)return;n.saveUndo();const oe=B.startCol,Z=B.startRow,re=B.endCol,K=B.endRow;if(Z===K)if(re+1<e.colCount){const $=`${lt(oe)}${Z+1}:${lt(re)}${Z+1}`;e.setCellValue(re+1,Z,`=AVERAGE(${$})`)}else{const $=`${lt(oe)}${Z+1}:${lt(re-1)}${Z+1}`;e.setCellValue(re,Z,`=AVERAGE(${$})`)}else for(let $=oe;$<=re;$++)if(K+1<e.rowCount){const U=`${lt($)}${Z+1}:${lt($)}${K+1}`;e.setCellValue($,K+1,`=AVERAGE(${U})`)}else{const U=`${lt($)}${Z+1}:${lt($)}${K}`;e.setCellValue($,K,`=AVERAGE(${U})`)}(L=e.scheduleRender)==null||L.call(e),(J=e.emitModelData)==null||J.call(e)}function Ce(){var L,J;const B=e.selection.value;if(!B)return;n.saveUndo();const oe=B.startCol,Z=B.startRow,re=B.endCol,K=B.endRow;if(Z===K)if(re+1<e.colCount){const $=`${lt(oe)}${Z+1}:${lt(re)}${Z+1}`;e.setCellValue(re+1,Z,`=COUNT(${$})`)}else{const $=`${lt(oe)}${Z+1}:${lt(re-1)}${Z+1}`;e.setCellValue(re,Z,`=COUNT(${$})`)}else for(let $=oe;$<=re;$++)if(K+1<e.rowCount){const U=`${lt($)}${Z+1}:${lt($)}${K+1}`;e.setCellValue($,K+1,`=COUNT(${U})`)}else{const U=`${lt($)}${Z+1}:${lt($)}${K}`;e.setCellValue($,K,`=COUNT(${U})`)}(L=e.scheduleRender)==null||L.call(e),(J=e.emitModelData)==null||J.call(e)}const $e=t.ref(!1);function j(B){$e.value=B,B&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,o.value=!1,n.fontSizeMenuOpen.value=!1,h.value=!1)}function Be(){I(),$e.value=!1}function Q(){G(),$e.value=!1}function ke(){Ce(),$e.value=!1}return{cachedBorder:l,borderMenuOpen:o,BORDER_COLOR:a,onBorderChange:d,setCellBorderSide:i,applyBorderToCell:r,applyCachedBorder:f,cellBorderWidth:y,mergeMenuOpen:h,onMergeMenuToggle:u,removeOverlappingMerges:E,mergeAndCenter:x,mergeAcross:k,mergeCells:H,unmergeCells:Y,onApplyMerge:ne,onMergeChange:ee,copySourceRange:null,copySourceStyles:[],captureStyles:Ne,captureDataValidations:te,setCellWithStyle:ze,copyToClipboard:Ve,copyRowCol:Fe,pasteFromClipboard:je,cutSelected:_e,clearSelected:F,sumSelected:I,avgSelected:G,countSelected:Ce,calcMenuOpen:$e,onCalcMenuToggle:j,onCalcSum:Be,onCalcAvg:Q,onCalcCount:ke}}function D0(e,n,l,o){const a={},i=o(n),r=o(l);return i!=null&&(a.width=`${i}px`),r!=null&&(a.height=`${r}px`),a["--sp-formula-bar-bg"]=e.formulaBarBg,a["--sp-formula-bar-border"]=e.formulaBarBorder,a["--sp-formula-bar-label-color"]=e.formulaBarLabelText,a["--sp-formula-bar-label-bg"]=e.formulaBarLabelBg,a["--sp-formula-bar-label-border"]=e.formulaBarLabelBorder,a["--sp-formula-bar-input-bg"]=e.formulaBarInputBg,a["--sp-formula-bar-input-border"]=e.formulaBarInputBorder,a["--sp-formula-bar-input-color"]=e.formulaBarInputText,a["--sp-formula-bar-input-focus-border"]=e.formulaBarInputFocusBorder,a["--sp-formula-bar-input-focus-shadow"]=e.formulaBarInputFocusShadow,a["--sp-wrapper-bg"]=e.wrapperBg,a["--sp-cell-editor-border"]=e.cellEditorBorder,a["--sp-cell-editor-color"]=e.cellEditorText,a["--sp-cell-editor-bg"]=e.cellEditorBg,a["--sp-cell-editor-shadow"]=e.cellEditorShadow,a["--sp-tab-bar-bg"]=e.tabBarBg,a["--sp-tab-bar-border"]=e.tabBarBorder,a["--sp-tab-active-bg"]=e.tabActiveBg,a["--sp-tab-active-color"]=e.tabActiveText,a["--sp-tab-active-border"]=e.tabActiveBorder,a["--sp-tab-inactive-bg"]=e.tabInactiveBg,a["--sp-tab-inactive-color"]=e.tabInactiveText,a["--sp-tab-inactive-border"]=e.tabInactiveBorder,a["--sp-tab-hover-bg"]=e.tabHoverBg,a["--sp-tab-add-btn-color"]=e.tabAddBtnColor,a["--sp-tab-add-btn-hover-bg"]=e.tabAddBtnHoverBg,a["--sp-tab-scroll-btn-color"]=e.tabScrollBtnColor,a["--sp-tab-scroll-btn-hover-bg"]=e.tabScrollBtnHoverBg,a["--sp-scroll-thumb"]=e.scrollbarThumb,a["--sp-scroll-thumb-hover"]=e.scrollbarThumbHover,a["--sp-scroll-btn-bg"]=e.scrollBtnBg,a["--sp-scroll-btn-color"]=e.scrollBtnColor,a["--sp-scroll-btn-hover-bg"]=e.scrollBtnHoverBg,a["--sp-scroll-btn-active-bg"]=e.scrollBtnActiveBg,a["--sp-scroll-track-bg"]=e.scrollTrackBg,a["--sp-toolbar-bg"]=e.toolbarBg,a["--sp-toolbar-border"]=e.toolbarBorder,a["--sp-toolbar-btn-color"]=e.toolbarBtnColor,a["--sp-toolbar-btn-hover-bg"]=e.toolbarBtnHoverBg,a["--sp-toolbar-btn-disabled-color"]=e.toolbarBtnDisabledColor,a["--sp-toolbar-btn-active-color"]=e.toolbarBtnActiveColor,a}function Kr(e){return e==="number"?0:1}function Gr(e,n,l){var i;if(e==null||e.trim()==="")return{kind:"blank"};const o=n??"";if(o===il||o==="@")return{kind:"text",text:e};if(sl(o)){if(Cl(e))return{kind:"number",num:Number(e)};const r=Nl(e,l);return r?{kind:"number",num:r.serial}:{kind:"text",text:yl(e,o,l)}}const a=Ul(o);if(a.kind==="date"||a.kind==="duration"){const r=Number(e);return Number.isFinite(r)?{kind:"number",num:r}:{kind:"text",text:yl(e,o,l)}}if(a.kind==="number"){const r=Number(e);if(Number.isFinite(r)){const d=((i=a.sections.find(f=>f.hasDigits))==null?void 0:i.scale)??1;return{kind:"number",num:r*d}}return{kind:"text",text:yl(e,o,l)}}return{kind:"text",text:yl(e,o,l)}}function V0(e,n,l,o){if(e.kind==="blank"||n.kind==="blank")return e.kind==="blank"&&n.kind==="blank"?0:e.kind==="blank"?1:-1;const a=Kr(e.kind),i=Kr(n.kind);if(a!==i)return l==="asc"?a-i:i-a;let r;return e.kind==="number"?r=(e.num??0)-(n.num??0):r=(e.text??"").localeCompare(n.text??"",o,{numeric:!0}),l==="asc"?r:-r}function F0(e,n,l){const o=e.map((a,i)=>i);return o.sort((a,i)=>{const r=V0(e[a],e[i],n,l);return r!==0?r:a-i}),o}function I0(e){if(e.length<2||e[0].kind!=="text")return!1;for(let n=1;n<e.length;n++)if(e[n].kind==="number")return!0;return!1}function zo(e){return e?JSON.parse(JSON.stringify(e)):null}function qr(e,n,l,o){if(!e)return null;const a=l-n+1,i={...e.range};return o?n<=i.endRow&&(n<=i.startRow&&(i.startRow+=a),i.endRow+=a):l<i.startRow?(i.startRow-=a,i.endRow-=a):n<=i.endRow&&(i.endRow-=Math.min(a,i.endRow-n+1),i.endRow<i.startRow&&(i.endRow=i.startRow)),{range:i,columns:e.columns}}function Yr(e,n,l,o){if(!e)return null;const a=l-n+1,i={...e.range},r={};if(o){n<=i.endCol&&(n<=i.startCol&&(i.startCol+=a),i.endCol+=a);for(const d in e.columns){const f=Number(d);r[f>=n?f+a:f]=e.columns[d]}}else{l<i.startCol?(i.startCol-=a,i.endCol-=a):n<=i.endCol&&(i.endCol-=Math.min(a,i.endCol-n+1),i.endCol<i.startCol&&(i.endCol=i.startCol));for(const d in e.columns){const f=Number(d);f>=n&&f<=l||(r[f>l?f-a:f]=e.columns[d])}}return{range:i,columns:r}}function Xr(e,n,l,o){if(n==="row"){const a=e.startRow,i=e.endRow;let r,d;if(i<l)r=a,d=i;else if(a>l+o-1)r=a-o,d=i-o;else if(r=a<l?a:l,d=i>l+o-1?i-o:l-1,d<r)return null;return{...e,startRow:r,endRow:d}}else{const a=e.startCol,i=e.endCol;let r,d;if(i<l)r=a,d=i;else if(a>l+o-1)r=a-o,d=i-o;else if(r=a<l?a:l,d=i>l+o-1?i-o:l-1,d<r)return null;return{...e,startCol:r,endCol:d}}}function jr(e,n,l,o){if(n==="row"){const a=e.startRow,i=e.endRow;return a>=l?{...e,startRow:a+o,endRow:i+o}:i<l?e:{...e,endRow:i+o}}else{const a=e.startCol,i=e.endCol;return a>=l?{...e,startCol:a+o,endCol:i+o}:i<l?e:{...e,endCol:i+o}}}function A0(e,n,l){var a;const o=l-n+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],d=r.ranges.map(f=>Xr(f,"row",n,o)).filter(f=>f!==null);d.length===0?e.conditionalFormats.splice(i,1):r.ranges=d}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function _0(e,n,l){var a;const o=l-n+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>jr(r,"row",n,o));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function L0(e,n,l){var a;const o=l-n+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],d=r.ranges.map(f=>Xr(f,"col",n,o)).filter(f=>f!==null);d.length===0?e.conditionalFormats.splice(i,1):r.ranges=d}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function O0(e,n,l){var a;const o=l-n+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>jr(r,"col",n,o));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function Zr(e,n,l,o){var a;for(let i=e.dataValidations.length-1;i>=0;i--){const r=e.dataValidations[i],d=(r.ranges??[]).map(f=>y0(f,n,l,o)).filter(f=>f!==null);d.length===0?e.dataValidations.splice(i,1):r.ranges=d}(a=e.invalidateDataValidationCache)==null||a.call(e)}function Jr(e,n,l,o){var a;for(const i of e.dataValidations)i.ranges=(i.ranges??[]).map(r=>C0(r,n,l,o));(a=e.invalidateDataValidationCache)==null||a.call(e)}function $0(e,n,l,o,a){function i(W,g){const c=g-W+1,w=_e(W,g),be=[],he=[];for(const ce in e.cells){const Ue=ce.indexOf(",");if(Ue<0)continue;const Ze=parseInt(ce.substring(0,Ue),10),fe=parseInt(ce.substring(Ue+1),10);fe>=W&&fe<=g?he.push(ce):fe>g&&be.push({oldKey:ce,newKey:e.cellKey(Ze,fe-c),cell:e.cells[ce]})}for(const ce of he)Reflect.deleteProperty(e.cells,ce);for(const ce of be)Reflect.deleteProperty(e.cells,ce.oldKey),e.cells[ce.newKey]=ce.cell;const xe=e.rowHeights.value,we=new Array(xe.length);for(let ce=0;ce<W;ce++)we[ce]=xe[ce];for(let ce=W;ce<xe.length-c;ce++)we[ce]=xe[ce+c];for(let ce=xe.length-c;ce<xe.length;ce++)we[ce]=void 0;e.rowHeights.value=we,je(w),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(qr(e.getFilter(),W,g,!1)),A0(e,W,g),Zr(e,"row",W,c)}function r(W,g){const c=g-W+1,w=e.rowCount,be=e.colCount,{lastRow:he}=y();he>=W&&he+c>=w&&e.ensureCapacity(be-1,w-1+c);const xe=e.rowCount,we=I(W,g),ce=[];for(const fe in e.cells){const We=fe.indexOf(",");if(We<0)continue;const V=parseInt(fe.substring(0,We),10),le=parseInt(fe.substring(We+1),10);le>=W&&ce.push({oldKey:fe,newKey:e.cellKey(V,le+c),cell:e.cells[fe],oldRow:le})}ce.sort((fe,We)=>We.oldRow-fe.oldRow);for(const fe of ce)Reflect.deleteProperty(e.cells,fe.oldKey),e.cells[fe.newKey]=fe.cell;for(const fe in e.cells){const We=fe.indexOf(",");if(We<0)continue;const V=parseInt(fe.substring(We+1),10);V>=W&&V<=g&&Reflect.deleteProperty(e.cells,fe)}const Ue=e.rowHeights.value,Ze=new Array(xe);for(let fe=0;fe<W;fe++)Ze[fe]=Ue[fe];for(let fe=W;fe<=g;fe++)Ze[fe]=void 0;for(let fe=W;fe<xe;fe++)Ze[fe+c]=Ue[fe];e.rowHeights.value=Ze,je(we),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(qr(e.getFilter(),W,g,!0)),_0(e,W,g),Jr(e,"row",W,c)}function d(W,g){const c=g-W+1,w=e.colCount,be=e.rowCount,{lastCol:he}=y();he>=W&&he+c>=w&&e.ensureCapacity(w-1+c,be-1);const xe=e.colCount,we=G(W,g),ce=[];for(const fe in e.cells){const We=fe.indexOf(",");if(We<0)continue;const V=parseInt(fe.substring(0,We),10),le=parseInt(fe.substring(We+1),10);V>=W&&ce.push({oldKey:fe,newKey:e.cellKey(V+c,le),cell:e.cells[fe],oldCol:V})}ce.sort((fe,We)=>We.oldCol-fe.oldCol);for(const fe of ce)Reflect.deleteProperty(e.cells,fe.oldKey),e.cells[fe.newKey]=fe.cell;for(const fe in e.cells){const We=fe.indexOf(",");if(We<0)continue;const V=parseInt(fe.substring(0,We),10);V>=W&&V<=g&&Reflect.deleteProperty(e.cells,fe)}const Ue=e.colWidths.value,Ze=new Array(xe);for(let fe=0;fe<W;fe++)Ze[fe]=Ue[fe];for(let fe=W;fe<=g;fe++)Ze[fe]=100;for(let fe=W;fe<xe;fe++)Ze[fe+c]=Ue[fe];e.colWidths.value=Ze,je(we),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(Yr(e.getFilter(),W,g,!0)),O0(e,W,g),Jr(e,"col",W,c)}function f(W,g){const c=g-W+1,w=F(W,g),be=[],he=[];for(const ce in e.cells){const Ue=ce.indexOf(",");if(Ue<0)continue;const Ze=parseInt(ce.substring(0,Ue),10),fe=parseInt(ce.substring(Ue+1),10);Ze>=W&&Ze<=g?he.push(ce):Ze>g&&be.push({oldKey:ce,newKey:e.cellKey(Ze-c,fe),cell:e.cells[ce]})}for(const ce of he)Reflect.deleteProperty(e.cells,ce);for(const ce of be)Reflect.deleteProperty(e.cells,ce.oldKey),e.cells[ce.newKey]=ce.cell;const xe=e.colWidths.value,we=new Array(xe.length);for(let ce=0;ce<W;ce++)we[ce]=xe[ce];for(let ce=W;ce<xe.length-c;ce++)we[ce]=xe[ce+c];for(let ce=xe.length-c;ce<xe.length;ce++)we[ce]=100;e.colWidths.value=we,je(w),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(Yr(e.getFilter(),W,g,!1)),L0(e,W,g),Zr(e,"col",W,c)}function y(){let W=-1,g=-1;for(const c in e.cells){const w=c.split(",");if(w.length===2){const be=parseInt(w[0],10),he=parseInt(w[1],10),xe=e.cells[c];xe&&(xe.value!==""||xe.styleId!==void 0)&&(be>W&&(W=be),he>g&&(g=he))}}for(let c=e.colCount-1;c>=0;c--){const w=e.colWidths.value[c];if(w!==void 0&&w!==100){c>W&&(W=c);break}}for(let c=e.rowCount-1;c>=0;c--)if(e.rowHeights.value[c]!==void 0){c>g&&(g=c);break}return{lastCol:W,lastRow:g}}function h(W,g){const c=e.resolveStyle(e.cells[e.cellKey(W,g)]);return typeof(c==null?void 0:c.numberFormat)=="string"?c.numberFormat:""}function u(W,g,c){for(let w=g;w<=c;w++)if(e.getCellRaw(W,w).trim()!=="")return!0;return!1}function E(W){const{startRow:g,endRow:c,startCol:w,endCol:be}=W;let he=w,xe=be;for(;he>0&&u(he-1,g,c);)he--;for(;xe<e.colCount-1&&u(xe+1,g,c);)xe++;return{startRow:g,endRow:c,startCol:he,endCol:xe}}function x(W){const g=E(W);return g.startCol!==W.startCol||g.endCol!==W.endCol}function k(W,g,c,w=W){let be,he;if(c)be=c.startRow,he=c.endRow;else{const fe=e.selection.value,We=!!fe&&fe.startRow===fe.endRow&&fe.startCol===fe.endCol;be=We||!fe?0:fe.startRow,he=We||!fe?e.rowCount-1:fe.endRow}let xe=-1,we=-1;for(let fe=be;fe<=he;fe++){let We=!1;for(let V=W;V<=g;V++)if(e.getCellRaw(V,fe).trim()!==""){We=!0;break}We&&(xe<0&&(xe=fe),we=fe)}if(xe<0)return null;const ce=[];for(let fe=xe;fe<=we;fe++){const We=e.getCellRaw(w,fe);ce.push(Gr(We,h(w,fe),e.locale.value))}const Ue=I0(ce)?xe+1:xe;let Ze=!1;for(let fe=xe;fe<=we&&!Ze;fe++)for(let We=W;We<=g;We++){const V=e.cells[e.cellKey(We,fe)];if(V&&V.value.startsWith("=")){Ze=!0;break}}if(!Ze)for(const fe in e.merges){const We=e.merges[fe];if(We&&We.startCol<=g&&We.endCol>=W&&We.startRow<=he&&We.endRow>=be){Ze=!0;break}}return{firstRow:xe,lastRow:we,sortStart:Ue,blocked:Ze}}function H(W,g){const c=k(W,g);return!!c&&!c.blocked&&c.sortStart<c.lastRow}function Y(W,g,c){var le,me;const w=g??e.selection.value;if(!w)return;const be=w.startCol,he=w.endCol,xe=c??be,we=k(be,he,{startRow:w.startRow,endRow:w.endRow},xe);if(!we||we.blocked||we.sortStart>=we.lastRow)return;const ce=he-be+1,Ue=we.lastRow-we.sortStart+1,Ze=[],fe=[];for(let pe=we.sortStart;pe<=we.lastRow;pe++){const Re=new Array(ce);for(let Se=be;Se<=he;Se++)Re[Se-be]=e.cells[e.cellKey(Se,pe)]??null;Ze.push(Re);const Te=e.getCellRaw(xe,pe);fe.push(Gr(Te,h(xe,pe),e.locale.value))}const We=F0(fe,W,e.locale.value);let V=!1;for(let pe=0;pe<Ue;pe++)if(We[pe]!==pe){V=!0;break}if(V){n.saveUndo();for(let pe=0;pe<Ue;pe++){const Re=Ze[We[pe]],Te=we.sortStart+pe;for(let Se=be;Se<=he;Se++){const qe=e.cellKey(Se,Te),mt=Re[Se-be],ct=mt?mt.value:"",kt=(le=e.cells[qe])==null?void 0:le.styleId;ct!==""||kt!==void 0?e.cells[qe]={value:ct,styleId:kt}:e.delCell(qe)}}tn();for(let pe=we.sortStart;pe<=we.lastRow;pe++)for(let Re=be;Re<=he;Re++)e.formulaDeps.markDirty(e.cellKey(Re,pe));(me=e.scheduleRender)==null||me.call(e),ve()}}const ne=t.ref(!1),ee=t.ref(null);function M(W){const g=e.selection.value;if(!g||!x(g))return!1;const c=E(g);return ee.value={order:W,originalRange:g,expandedRange:c},ne.value=!0,!0}function se(W){const g=ee.value;if(!g)return;const{order:c,originalRange:w,expandedRange:be}=g;ne.value=!1,ee.value=null,Y(c,W?be:w,w.startCol),Ne.value=c}function X(){ne.value=!1,ee.value=null}const te=t.ref(!1),Ne=t.ref("asc");function ze(W){te.value=W,W&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,n.fontSizeMenuOpen.value=!1)}function Ve(W){M(W)||(Ne.value=W,Y(W))}function Fe(){M(Ne.value)||Y(Ne.value)}function je(W){Object.keys(e.merges).forEach(g=>Reflect.deleteProperty(e.merges,g));for(const g of W)if(!(g.newRange.startCol>g.newRange.endCol||g.newRange.startRow>g.newRange.endRow)&&(e.merges[g.newAnchorKey]={...g.newRange},g.anchorCell)){const c=g.anchorCell.value,w=g.anchorCell.styleId;c===""&&!w||(e.cells[g.newAnchorKey]={value:c,styleId:w||void 0})}}function _e(W,g){const c=g-W+1,w=[];for(const be in e.merges){const he=e.merges[be];if(!he)continue;const xe=e.cells[be]?{value:e.cells[be].value,styleId:e.cells[be].styleId??0}:{value:"",styleId:0},{startCol:we,endCol:ce}=he;let{startRow:Ue,endRow:Ze}=he;if(Ue>g){Ue-=c,Ze-=c,w.push({newAnchorKey:e.cellKey(we,Ue),newRange:{startCol:we,startRow:Ue,endCol:ce,endRow:Ze}});continue}if(Ze<W){w.push({newAnchorKey:be,newRange:{startCol:we,startRow:Ue,endCol:ce,endRow:Ze}});continue}if(Ue>=W&&Ze<=g||(Ue>=W&&Ue<=g&&(Ue=W),Ze>=W&&Ze<=g?Ze=W-1:Ze>g&&(Ze-=c),Ue>Ze))continue;const fe=we,We=Ue,V=e.cellKey(fe,We),me=be.split(",").map(Number)[1],pe=me>=W&&me<=g||fe!==he.startCol||We!==me;w.push({newAnchorKey:V,newRange:{startCol:we,startRow:Ue,endCol:ce,endRow:Ze},anchorCell:pe?xe:void 0})}return w}function F(W,g){const c=g-W+1,w=[];for(const be in e.merges){const he=e.merges[be];if(!he)continue;const xe=e.cells[be]?{value:e.cells[be].value,styleId:e.cells[be].styleId??0}:{value:"",styleId:0};let{startCol:we,endCol:ce}=he;const{startRow:Ue,endRow:Ze}=he;if(we>g){we-=c,ce-=c,w.push({newAnchorKey:e.cellKey(we,Ue),newRange:{startCol:we,startRow:Ue,endCol:ce,endRow:Ze}});continue}if(ce<W){w.push({newAnchorKey:be,newRange:{startCol:we,startRow:Ue,endCol:ce,endRow:Ze}});continue}if(we>=W&&ce<=g||(we>=W&&we<=g&&(we=W),ce>=W&&ce<=g?ce=W-1:ce>g&&(ce-=c),we>ce))continue;const fe=we,We=Ue,V=e.cellKey(fe,We),me=be.split(",").map(Number)[0],pe=me>=W&&me<=g||fe!==me||We!==he.startRow;w.push({newAnchorKey:V,newRange:{startCol:we,startRow:Ue,endCol:ce,endRow:Ze},anchorCell:pe?xe:void 0})}return w}function I(W,g){const c=g-W+1,w=[];for(const be in e.merges){const he=e.merges[be];if(!he)continue;const{startCol:xe,endCol:we}=he;let{startRow:ce,endRow:Ue}=he;Ue<W?w.push({newAnchorKey:be,newRange:{startCol:xe,startRow:ce,endCol:we,endRow:Ue}}):ce>g?(ce+=c,Ue+=c,w.push({newAnchorKey:e.cellKey(xe,ce),newRange:{startCol:xe,startRow:ce,endCol:we,endRow:Ue}})):(Ue+=c,w.push({newAnchorKey:be,newRange:{startCol:xe,startRow:ce,endCol:we,endRow:Ue}}))}return w}function G(W,g){const c=g-W+1,w=[];for(const be in e.merges){const he=e.merges[be];if(!he)continue;let{startCol:xe,endCol:we}=he;const{startRow:ce,endRow:Ue}=he;we<W?w.push({newAnchorKey:be,newRange:{startCol:xe,startRow:ce,endCol:we,endRow:Ue}}):xe>g?(xe+=c,we+=c,w.push({newAnchorKey:e.cellKey(xe,ce),newRange:{startCol:xe,startRow:ce,endCol:we,endRow:Ue}})):(we+=c,w.push({newAnchorKey:be,newRange:{startCol:xe,startRow:ce,endCol:we,endRow:Ue}}))}return w}let Ce=0;function $e(){return Ce++,`s_${Ce}`}function j(W){if(!Array.isArray(W))return[];const g=[];for(const c of W){if(!c||typeof c!="object")continue;const w=c;if(!w.type||!Array.isArray(w.ranges)||w.ranges.length===0)continue;const be=w.ranges.filter(he=>!!he&&typeof he.startCol=="number"&&typeof he.startRow=="number"&&typeof he.endCol=="number"&&typeof he.endRow=="number").map(he=>({startCol:Math.min(he.startCol,he.endCol),endCol:Math.max(he.startCol,he.endCol),startRow:Math.min(he.startRow,he.endRow),endRow:Math.max(he.startRow,he.endRow)}));be.length&&g.push({...w,id:w.id||`dv_${g.length}`,ranges:be})}return g}function Be(W,g){const c=Math.max(1,(g==null?void 0:g.colCount)??e.colCount),w=Math.max(1,(g==null?void 0:g.rowCount)??e.rowCount),be=new Array(c).fill(100),he=new Array(w).fill(void 0);return{id:$e(),name:W,cells:{},merges:{},styles:[{}],borders:[{}],selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:be,rowHeights:he,colCount:c,rowCount:w,freeze:{rows:0,cols:0},filter:null,conditionalFormats:[],dataValidations:[]}}const Q=t.ref([Be("Sheet1")]),ke=t.ref(0);function B(){const W=Q.value[ke.value];W&&(W.cells={...e.cells},W.merges={...e.merges},W.selection=e.selection.value?{...e.selection.value}:null,W.activeCell={...e.activeCell.value},W.scrollX=e.scrollX.value,W.scrollY=e.scrollY.value,W.colWidths=[...e.colWidths.value],W.rowHeights=[...e.rowHeights.value],W.styles=[...e.styles],W.borders=[...e.borders],W.colCount=e.colCount,W.rowCount=e.rowCount,W.freeze={rows:e.freeze.rows,cols:e.freeze.cols},W.filter=zo(e.getFilter()),W.conditionalFormats=[...e.conditionalFormats],W.dataValidations=[...e.dataValidations])}function oe(W){var Ue,Ze,fe;const g=Q.value[W];if(!g)return;Object.keys(e.cells).forEach(We=>e.delCell(We)),Object.assign(e.cells,g.cells),Object.keys(e.merges).forEach(We=>Reflect.deleteProperty(e.merges,We)),g.merges&&Object.assign(e.merges,g.merges),e.selection.value=g.selection?{...g.selection}:null,e.activeCell.value={...g.activeCell};const c=e.activeCell.value,w=e.selection.value,be=e.findMerge(c.col,c.row);be&&be.anchor===e.cellKey(c.col,c.row)&&(!w||w.startCol===c.col&&w.startRow===c.row&&w.endCol===c.col&&w.endRow===c.row)&&e.selectCell(c.col,c.row),e.scrollX.value=g.scrollX,e.scrollY.value=g.scrollY,e.colWidths.value=[...g.colWidths],e.rowHeights.value=[...g.rowHeights];const he=Math.max(1,g.colCount??e.colCount),xe=Math.max(1,g.rowCount??e.rowCount);if((Ue=e.setDims)==null||Ue.call(e,he,xe),e.freeze.rows=Math.max(0,Math.min(g.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(g.freeze.cols,e.colCount)),g.filter){const We=g.filter.range;e.setFilter({range:{startCol:Math.max(0,Math.min(We.startCol,e.colCount-1)),endCol:Math.max(0,Math.min(We.endCol,e.colCount-1)),startRow:Math.max(0,Math.min(We.startRow,e.rowCount-1)),endRow:Math.max(0,Math.min(We.endRow,e.rowCount-1))},columns:{...g.filter.columns}},!0)}else e.setFilter(null,!0);e.syncStyles(g.styles),e.syncBorders(g.borders??[{}]);const we=g.conditionalFormats?g.conditionalFormats.map(We=>({...We,ranges:We.ranges.map(V=>({...V}))})):[];e.conditionalFormats.splice(0,e.conditionalFormats.length,...we),(Ze=e.invalidateConditionalFormatCache)==null||Ze.call(e);const ce=j(g.dataValidations);e.dataValidations.splice(0,e.dataValidations.length,...ce),(fe=e.invalidateDataValidationCache)==null||fe.call(e),ke.value=W}function Z(W){W===ke.value||W<0||W>=Q.value.length||(e.cancelEdit(),B(),oe(W))}function re(W){return n.saveUndo(),e.cancelEdit(),B(),Q.value.push(Be(W??`Sheet${Q.value.length+1}`)),oe(Q.value.length-1),Q.value.length-1}function K(W){return Q.value.length<=1||(n.saveUndo(),e.cancelEdit(),Q.value.splice(W,1),oe(Math.min(W,Q.value.length-1))),ke.value}function L(W,g){Q.value[W]&&g.trim()&&(n.saveUndo(),Q.value[W].name=g.trim())}function J(W){n.saveUndo(),e.cancelEdit(),B();const g=Q.value[W];if(!g)return W;let c=g.name;const w=c.match(/^(.*?)\s*\((\d+)\)$/);let be=w?parseInt(w[2],10)+1:2;w&&(c=w[1]);let he=`${c} (${be})`;const xe=new Set(Q.value.map(ce=>ce.name));for(;xe.has(he);)be++,he=`${c} (${be})`;const we={id:$e(),name:he,cells:{...g.cells},merges:g.merges?{...g.merges}:{},styles:[...g.styles],borders:g.borders?[...g.borders]:[{}],selection:g.selection?{...g.selection}:null,activeCell:g.activeCell?{...g.activeCell}:{col:0,row:0},scrollX:g.scrollX,scrollY:g.scrollY,colWidths:[...g.colWidths],rowHeights:[...g.rowHeights],colCount:g.colCount,rowCount:g.rowCount,freeze:{...g.freeze},filter:zo(g.filter),conditionalFormats:g.conditionalFormats?g.conditionalFormats.map(ce=>({...ce})):[],dataValidations:j(g.dataValidations)};return Q.value.splice(W+1,0,we),oe(W+1),W+1}function $(W,g){var he;const c=W+g;if(c<0||c>=Q.value.length)return;n.saveUndo();const w=ke.value,be=Q.value.splice(W,1)[0];Q.value.splice(c,0,be),w===W?ke.value=c:W<w&&c>=w?ke.value=w-1:W>w&&c<=w&&(ke.value=w+1),(he=e.scheduleRender)==null||he.call(e)}const U=t.computed(()=>Q.value.length);let de="";const Le=l;function ve(){B();const W=Q.value.map(c=>{const w={};for(const[we,ce]of Object.entries(c.cells))w[we]={value:ce.value},ce.styleId&&ce.styleId>0&&(w[we].styleId=ce.styleId);const be={name:c.name,cells:w};c.styles&&c.styles.length>1&&(be.styles=[...c.styles]),c.borders&&c.borders.length>1&&(be.borders=[...c.borders]),c.merges&&Object.keys(c.merges).length&&(be.merges={...c.merges});const he={};for(let we=0;we<c.colWidths.length;we++)c.colWidths[we]!==100&&(he[we]=c.colWidths[we]);Object.keys(he).length&&(be.colWidths=he);const xe={};for(let we=0;we<c.rowHeights.length;we++){const ce=c.rowHeights[we];ce!=null&&(xe[we]=ce)}return Object.keys(xe).length&&(be.rowHeights=xe),c.colCount!==26&&(be.colCount=c.colCount),c.rowCount!==200&&(be.rowCount=c.rowCount),(c.freeze.rows!==0||c.freeze.cols!==0)&&(be.freeze={rows:c.freeze.rows,cols:c.freeze.cols}),c.filter&&(be.filter=zo(c.filter)),c.conditionalFormats&&c.conditionalFormats.length&&(be.conditionalFormats=c.conditionalFormats.map(we=>({...we}))),c.dataValidations&&c.dataValidations.length&&(be.dataValidations=c.dataValidations.map(we=>({...we,ranges:we.ranges.map(ce=>({...ce}))}))),be}),g=JSON.stringify(W);g!==de&&(de=g,Le.value=W,a&&(a.value=g))}e.emitModelData=ve;let Ie=!1;function Ee(){Ie||(Ie=!0,Promise.resolve().then(()=>{Ie=!1,ve()}))}const He=t.computed(()=>e.props.theme==="dark"?ba:ga),ge=t.computed(()=>D0(He.value,e.props.width,e.props.height,hn)),et=t.computed(()=>{const W={};for(const[g,c]of Object.entries(ge.value))g.startsWith("--")&&(W[g]=c);return W}),ut=t.ref(null),Pe=t.ref(null),N=t.ref(null),ie=t.ref(null),Rt=t.ref(null),ft=t.reactive({w:800,h:600});e.viewSize&&t.watch(ft,W=>{e.viewSize&&(e.viewSize.w=W.w,e.viewSize.h=W.h)},{deep:!0});const Mt=48,Ft=28,It=11,Ot=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,ft.w-Mt-It))),Dl=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,ft.h-Ft-It)));function nl(W,g){const c=Math.max(0,ft.w-Mt-It),w=Math.max(0,ft.h-Ft-It),be=W??e.scrollX.value,he=g??e.scrollY.value,xe=40,we=Math.max(0,e.totalWidth.value-c),ce=Math.max(0,e.totalHeight.value-w);if(be>=we-xe&&be>e.scrollX.value||he>=ce-xe&&he>e.scrollY.value){const Ue=Math.max(0,Math.ceil((be+c)/100)+2),Ze=Math.max(0,Math.ceil((he+w)/24)+2);e.ensureCapacity(Ue,Ze)}e.scrollX.value=Math.max(0,Math.min(be,Math.max(0,e.totalWidth.value-c))),e.scrollY.value=Math.max(0,Math.min(he,Math.max(0,e.totalHeight.value-w)))}e.clampScroll=nl;function dl(){var W;return typeof window>"u"?!1:!((W=window.matchMedia)!=null&&W.call(window,"(hover: none) and (pointer: coarse)").matches)}function ol(W=!1){t.nextTick(()=>{const g=ie.value;if(g){if(!e.editingCell.value&&!dl()){document.activeElement===g&&g.blur();return}g.focus({preventScroll:!0}),W&&g.select()}})}function Ht(){ol()}function vl(){var g;const W=e.selection.value;if(W){n.saveUndo();for(let c=W.startRow;c<=W.endRow;c++)e.rowHeights.value[c]=void 0;(g=e.scheduleRender)==null||g.call(e),ve()}}function zt(){var g;const W=e.selection.value;if(W){n.saveUndo();for(let c=W.startCol;c<=W.endCol;c++)e.colWidths.value[c]=100;(g=e.scheduleRender)==null||g.call(e),ve()}}return{deleteRows:i,insertRows:r,insertCols:d,deleteCols:f,sortSelectedColumns:Y,canSortColumns:H,sortMenuOpen:te,cachedSortOrder:Ne,onSortMenuToggle:ze,onSortChange:Ve,applyCachedSort:Fe,sortConfirmOpen:ne,prepareSortConfirmation:M,confirmSort:se,cancelSortConfirmation:X,sheets:Q,activeSheetIndex:ke,saveSheet:B,loadSheet:oe,switchSheet:Z,addSheet:re,removeSheet:K,renameSheet:L,dupSheet:J,moveSheet:$,sheetCount:U,mkSheet:Be,emitModelData:ve,scheduleOptEmit:Ee,themeColors:He,outerStyle:ge,toolbarThemeVars:et,wrapperRef:ut,canvasRef:Pe,freezeCanvasRef:N,editInputRef:ie,formulaBarRef:Rt,viewSize:ft,maxScrollX:Ot,maxScrollY:Dl,clampScroll:nl,canFocusHiddenEditor:dl,focusEditInput:ol,onCanvasFocus:Ht,resetRowHeight:vl,resetColWidth:zt,modelData:Le}}function Qr(e){return!!e&&e.width!==void 0&&e.width>0}function Tt(e,n,l,o){const a=Qr(e),i=Qr(n);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return n;const r=e.width??0,d=n.width??0;return r>d?e:d>r?n:e}function ea(e,n){if(!e||typeof e!="object")return null;const l=e,o=l.columns??{},a=Object.keys(o).map(r=>Number(r)).filter(r=>!Number.isNaN(r));if(!l.range||typeof l.range.startRow!="number"){const r=a.length?Math.min(...a):0,d=a.length?Math.max(...a):0;let f=0;for(const y in n){const h=y.indexOf(",");if(h<0)continue;const u=parseInt(y.substring(h+1),10);u>f&&(f=u)}return{range:{startCol:r,startRow:0,endCol:d,endRow:Math.max(0,f)},columns:o}}const i={...l.range};for(const r of a)r<i.startCol&&(i.startCol=r),r>i.endCol&&(i.endCol=r);return{range:i,columns:o}}function H0(e,n,l,o,a){let i=!1,r=null,d=1,f=()=>{},y=()=>{},h=()=>{};function u(){i||(i=!0,requestAnimationFrame(()=>{i=!1,Y(),ne()}))}e.scheduleRender=u;function E(s){const{frozenColumnsWidth:m}=e.getFrozenMetrics(),C=m>0&&s<52+m?s-52:s-52+e.scrollX.value;return e.hitCol(C)}function x(s){const{frozenRowsHeight:m}=e.getFrozenMetrics(),C=m>0&&s<24+m?s-24:s-24+e.scrollY.value;return e.hitRow(C)}const k="#444",H=14;function Y(){const s=o.wrapperRef.value,m=o.canvasRef.value;if(!s||!m||(r=m.getContext("2d"),!r))return;d=window.devicePixelRatio||1;const C=s.getBoundingClientRect(),T=C.width,R=C.height;o.viewSize.w=T,o.viewSize.h=R,m.width=T*d,m.height=R*d,m.style.width=T+"px",m.style.height=R+"px",r.setTransform(d,0,0,d,0,0);const A=e.scrollX.value,_=e.scrollY.value,D=52,z=24,ae=o.themeColors.value,Me=e.getFilter(),Qe=e.colPositions.value,nt=e.rowPositions.value,dt=e.colWidths.value,{frozenRowsHeight:vt,frozenColumnsWidth:Nt}=e.getFrozenMetrics(),Ut=D+Nt,At=z+vt,el=Math.max(0,T-D-11-Nt),pl=Math.max(0,R-z-11-vt),ql=Math.max(0,e.freeze.cols-1),cn=Math.max(0,e.freeze.rows-1),Yl=Math.max(e.freeze.cols,e.hitCol(Nt+A));let dn=Yl;for(let P=Yl;P<e.colCount&&!(D+Qe[P]-A>=T);P++)dn=P;const hl=Math.max(e.freeze.rows,e.hitRow(vt+_));let _l=hl;for(let P=hl;P<e.rowCount&&!(z+nt[P]-_>=R);P++)_l=P;let qt=Yl,Yt=dn,tl=hl,Ll=_l;Nt>0&&(qt=0,Yt=Math.max(Yt,ql)),vt>0&&(tl=0,Ll=Math.max(Ll,cn));let Ol=qt,Xl=tl;for(const P in e.merges){const Ae=e.merges[P];Ae&&(Ae.startRow>Ll||Ae.endRow<tl||Ae.startCol>Yt||Ae.endCol<qt||(Ae.startCol<Ol&&(Ol=Ae.startCol),Ae.startRow<Xl&&(Xl=Ae.startRow)))}const $l=new Array(Xl);for(let P=Xl;P<=Ll;P++)$l[P]=nt[P+1]-nt[P];r.fillStyle=ae.bg,r.fillRect(0,0,T,R),r.fillStyle=ae.gridBg,r.fillRect(D,z,T-D,R-z);const yt=e.selection.value,Cn=e.editingCell.value;f=(P,Ae,Ke,bt,_t,Bt)=>{const ht=e.dataValidations.length>0;for(let De=bt;De<=_t;De++)for(let Ye=Ae;Ye<=Ke;Ye++){if(e.findMerge(Ye,De))continue;const tt=e.cellToScreenRect(De,Ye),Xe=tt.x,rt=tt.y,Ge=tt.width,at=tt.height;if(Xe+Ge<D||rt+at<z||Xe>T||rt>R)continue;const Ct=e.findHighlight?e.findHighlight(Ye,De):null,Et=e.resolveStyle(e.cells[e.cellKey(Ye,De)]),ot=typeof(Et==null?void 0:Et.backgroundColor)=="string"?Et.backgroundColor:"";ot&&(P.fillStyle=ot,P.fillRect(Xe,rt,Ge,at));const ue=e.resolveConditionalFormat(Ye,De);if(ue!=null&&ue.backgroundColor&&(P.fillStyle=ue.backgroundColor,P.fillRect(Xe,rt,Ge,at)),Ct&&(P.fillStyle=Ct==="active"?ae.findActiveBg:ae.findMatchBg,P.fillRect(Xe,rt,Ge,at)),e.isSelected(Ye,De)&&(P.fillStyle=ae.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?P.fillRect(Xe,rt,dt[Ye],Bt[De]):P.fillRect(Xe,rt,Ge,at)),e.activeCell.value.col===Ye&&e.activeCell.value.row===De&&(P.strokeStyle=ae.activeCellBorder,P.lineWidth=2,P.strokeRect(Xe+1,rt+1,Ge-2,at-2)),Ct==="active"&&(P.strokeStyle=ae.findActiveBg,P.lineWidth=2,P.strokeRect(Xe+1,rt+1,Ge-2,at-2)),P.strokeStyle=ae.gridLine,P.lineWidth=.5,P.strokeRect(Xe+.25,rt+.25,Ge-.5,at-.5),!(Cn&&Cn.col===Ye&&Cn.row===De)){const ye=e.resolveStyle(e.cells[e.cellKey(Ye,De)]),Oe=e.getCellValue(Ye,De),it=typeof(ye==null?void 0:ye.numberFormat)=="string"?ye.numberFormat:"",wt=Oe?yl(Oe,it,e.locale.value):"";if(wt){const Lt=e.cellFontSize(Ye,De),Kt=typeof(ye==null?void 0:ye.fontFamily)=="string"&&ye.fontFamily?ye.fontFamily:pn,jl=(ye==null?void 0:ye.fontWeight)==="bold"||(ue==null?void 0:ue.fontWeight)==="bold"?"bold":"normal",Sl=(ye==null?void 0:ye.fontStyle)==="italic"||(ue==null?void 0:ue.fontStyle)==="italic"?"italic":"normal",un=(ye==null?void 0:ye.underline)==="underline"||(ue==null?void 0:ue.underline)==="underline",wn=(ye==null?void 0:ye.strikethrough)==="line-through"||(ue==null?void 0:ue.strikethrough)==="line-through",Ml=(ue==null?void 0:ue.color)||(typeof(ye==null?void 0:ye.color)=="string"?ye.color:""),fn=typeof(ye==null?void 0:ye.textAlign)=="string"?ye.textAlign:ko(Oe,it)?"right":"left",Zl=typeof(ye==null?void 0:ye.verticalAlign)=="string"?ye.verticalAlign:"top";P.fillStyle=Ml||ae.cellText,P.font=`${Sl} ${jl} ${Lt}px ${Kt}`,P.textBaseline="alphabetic",P.save(),P.beginPath(),P.rect(Xe+5,rt+1,Ge-10,at-2),P.clip();const bl=(ye==null?void 0:ye.wrap)==="wrap";let al=Ge-10;Me&&De===Me.range.startRow&&Ye>=Me.range.startCol&&Ye<=Me.range.endCol&&(al=Ge-10-L);let Xt=wt;const Hl=!bl&&ir(it),Bl=wt===Gn||sr(Oe,it);if(Bl||Hl){if(Bl){const kn=Math.max(1,P.measureText("#").width),Kn=Math.max(1,Math.floor(al/kn));Xt="#".repeat(Kn)}else if(e.getWrappedLines(P,wt,1e9,!1).some(Jl=>Jl&&P.measureText(Jl).width>al)){const Jl=Math.max(1,P.measureText("#").width),Vn=Math.max(1,Math.floor(al/Jl));Xt="#".repeat(Vn)}}const vn=e.getWrappedLines(P,Xt,al,bl),{ascent:ho,descent:go}=e.measureFontMetrics(Kt,Lt,jl,Sl),bo=ho+go,d1=vn.length*bo;let yo;Zl==="middle"?yo=rt+(at-d1)/2+ho:Zl==="bottom"?yo=rt+at-e.BASE_CELL_VPAD-go-(vn.length-1)*bo:yo=rt+e.BASE_CELL_VPAD+ho;for(let kn=0;kn<vn.length;kn++){const Kn=vn[kn],Jl=yo+kn*bo,Vn=P.measureText(Kn);let mn;if(fn==="center"?mn=Xe+Ge/2-Vn.width/2:fn==="right"?mn=Xe+Ge-5-Vn.width:mn=Xe+5,P.fillText(Kn,mn,Jl),un&&(P.strokeStyle=Ml||ae.cellText,P.lineWidth=1,P.beginPath(),P.moveTo(mn,Jl+go+1),P.lineTo(mn+Vn.width,Jl+go+1),P.stroke()),wn){P.strokeStyle=Ml||ae.cellText,P.lineWidth=1;const na=Jl-ho+bo*.42;P.beginPath(),P.moveTo(mn,na),P.lineTo(mn+Vn.width,na),P.stroke()}}P.restore()}}if(Me&&De===Me.range.startRow&&Ye>=Me.range.startCol&&Ye<=Me.range.endCol&&ge(P,Xe,rt,Ge,at,Mr(Me.columns[Ye]),ae),ht&&e.getListValidation(De,Ye)){const ye=e.activeCell.value.col===Ye&&e.activeCell.value.row===De;Le(P,Xe,rt,Ge,at,ye||e.isSelected(Ye,De),ae)}}};const Je=(P,Ae,Ke)=>{const bt=e.findMerge(P,Ae);return bt?e.getCellBorderSide(e.cells[bt.anchor],Ke):e.getCellBorderSide(e.cells[e.cellKey(P,Ae)],Ke)};y=(P,Ae,Ke,bt,_t,Bt)=>{P.fillStyle=k;for(let ht=bt;ht<=_t;ht++)for(let De=Ae;De<=Ke;De++){if(e.findMerge(De,ht))continue;const st=e.cellToScreenRect(ht,De),tt=st.x,Xe=st.y,rt=st.width,Ge=st.height;if(tt+rt<D||Xe+Ge<z||tt>T||Xe>R)continue;const at=e.cells[e.cellKey(De,ht)],Ct={top:e.getCellBorderSide(at,"top"),right:e.getCellBorderSide(at,"right"),bottom:e.getCellBorderSide(at,"bottom"),left:e.getCellBorderSide(at,"left")},Et={top:Je(De,ht-1,"bottom"),left:Je(De-1,ht,"right"),bottom:Je(De,ht+1,"top"),right:Je(De+1,ht,"left")},ot=Tt(Et.top,Ct.top),ue=Tt(Et.left,Ct.left),ye=Tt(Ct.bottom,Et.bottom),Oe=Tt(Ct.right,Et.right),it=(ot==null?void 0:ot.width)??0,wt=(ue==null?void 0:ue.width)??0,Lt=(ye==null?void 0:ye.width)??0,Kt=(Oe==null?void 0:Oe.width)??0;it>0&&(P.fillStyle=(ot==null?void 0:ot.color)||k,P.fillRect(tt,Xe,rt,it)),Lt>0&&(P.fillStyle=(ye==null?void 0:ye.color)||k,P.fillRect(tt,Xe+Ge-Lt,rt,Lt)),wt>0&&(P.fillStyle=(ue==null?void 0:ue.color)||k,P.fillRect(tt,Xe,wt,Ge)),Kt>0&&(P.fillStyle=(Oe==null?void 0:Oe.color)||k,P.fillRect(tt+rt-Kt,Xe,Kt,Ge)),it>0&&wt>0&&(P.fillStyle=(ot==null?void 0:ot.color)||(ue==null?void 0:ue.color)||k,P.fillRect(tt-wt,Xe-it,wt,it)),it>0&&Kt>0&&(P.fillStyle=(ot==null?void 0:ot.color)||(Oe==null?void 0:Oe.color)||k,P.fillRect(tt+rt,Xe-it,Kt,it)),Lt>0&&wt>0&&(P.fillStyle=(ye==null?void 0:ye.color)||(ue==null?void 0:ue.color)||k,P.fillRect(tt-wt,Xe+Ge,wt,Lt)),Lt>0&&Kt>0&&(P.fillStyle=(ye==null?void 0:ye.color)||(Oe==null?void 0:Oe.color)||k,P.fillRect(tt+rt,Xe+Ge,Kt,Lt))}};const xt=(P,Ae,Ke,bt,_t,Bt,ht)=>{const De=e.resolveStyle(e.cells[e.cellKey(Ae,Ke)]),Ye=e.getCellValue(Ae,Ke),st=typeof(De==null?void 0:De.numberFormat)=="string"?De.numberFormat:"",tt=Ye?yl(Ye,st,e.locale.value):"";if(!tt)return;const Xe=e.cellFontSize(Ae,Ke),rt=typeof(De==null?void 0:De.fontFamily)=="string"&&De.fontFamily?De.fontFamily:pn,Ge=e.resolveConditionalFormat(Ae,Ke),at=(De==null?void 0:De.fontWeight)==="bold"||(Ge==null?void 0:Ge.fontWeight)==="bold"?"bold":"normal",Ct=(De==null?void 0:De.fontStyle)==="italic"||(Ge==null?void 0:Ge.fontStyle)==="italic"?"italic":"normal",Et=(De==null?void 0:De.underline)==="underline"||(Ge==null?void 0:Ge.underline)==="underline",ot=(De==null?void 0:De.strikethrough)==="line-through"||(Ge==null?void 0:Ge.strikethrough)==="line-through",ue=(Ge==null?void 0:Ge.color)||(typeof(De==null?void 0:De.color)=="string"?De.color:""),ye=typeof(De==null?void 0:De.textAlign)=="string"?De.textAlign:ko(Ye,st)?"right":"left",Oe=typeof(De==null?void 0:De.verticalAlign)=="string"?De.verticalAlign:"top";P.fillStyle=ue||ae.cellText,P.font=`${Ct} ${at} ${Xe}px ${rt}`,P.textBaseline="alphabetic",P.save(),P.beginPath(),P.rect(Bt+5,ht+1,bt-10,_t-2),P.clip();const it=(De==null?void 0:De.wrap)==="wrap",wt=bt-10;let Lt=tt;const Kt=!it&&ir(st),jl=tt===Gn||sr(Ye,st);if(jl||Kt){if(jl){const bl=Math.max(1,P.measureText("#").width),al=Math.max(1,Math.floor(wt/bl));Lt="#".repeat(al)}else if(e.getWrappedLines(P,tt,1e9,!1).some(Xt=>Xt&&P.measureText(Xt).width>wt)){const Xt=Math.max(1,P.measureText("#").width),Hl=Math.max(1,Math.floor(wt/Xt));Lt="#".repeat(Hl)}}const Sl=e.getWrappedLines(P,Lt,wt,it),{ascent:un,descent:wn}=e.measureFontMetrics(rt,Xe,at,Ct),Ml=un+wn,fn=Sl.length*Ml;let Zl;Oe==="middle"?Zl=ht+(_t-fn)/2+un:Oe==="bottom"?Zl=ht+_t-e.BASE_CELL_VPAD-wn-(Sl.length-1)*Ml:Zl=ht+e.BASE_CELL_VPAD+un;for(let bl=0;bl<Sl.length;bl++){const al=Sl[bl],Xt=Zl+bl*Ml,Hl=P.measureText(al);let Bl;if(ye==="center"?Bl=Bt+bt/2-Hl.width/2:ye==="right"?Bl=Bt+bt-5-Hl.width:Bl=Bt+5,P.fillText(al,Bl,Xt),Et&&(P.strokeStyle=ue||ae.cellText,P.lineWidth=1,P.beginPath(),P.moveTo(Bl,Xt+wn+1),P.lineTo(Bl+Hl.width,Xt+wn+1),P.stroke()),ot){P.strokeStyle=ue||ae.cellText,P.lineWidth=1;const vn=Xt-un+Ml*.42;P.beginPath(),P.moveTo(Bl,vn),P.lineTo(Bl+Hl.width,vn),P.stroke()}}P.restore()},Rl=(P,Ae,Ke,bt,_t,Bt,ht,De)=>{const Ye=Ae.startCol,st=Ae.endCol,tt=Ae.startRow,Xe=Ae.endRow,rt=bt,Ge=Bt,at=ht&&st>=e.freeze.cols,Ct=De&&Xe>=e.freeze.rows,Et=e.cells[e.cellKey(Ye,tt)],ot={top:e.getCellBorderSide(Et,"top"),right:e.getCellBorderSide(Et,"right"),bottom:e.getCellBorderSide(Et,"bottom"),left:e.getCellBorderSide(Et,"left")};P.fillStyle=k;for(let ue=Ye;ue<=st;ue++){if(ht&&ue>=e.freeze.cols||e.isSameMergeInternal(ue,tt-1,ue,tt))continue;const ye=Je(ue,tt-1,"bottom"),Oe=Tt(ye,ot.top);if(Oe&&Oe.width&&Oe.width>0){const it=ue<e.freeze.cols?D+Qe[ue]:D+Qe[ue]-A;P.fillStyle=Oe.color||k,P.fillRect(it,rt,dt[ue],Oe.width)}}if(!Ct)for(let ue=Ye;ue<=st;ue++){if(ht&&ue>=e.freeze.cols||e.isSameMergeInternal(ue,Xe,ue,Xe+1))continue;const ye=Je(ue,Xe+1,"top"),Oe=Tt(ot.bottom,ye);if(Oe&&Oe.width&&Oe.width>0){const it=ue<e.freeze.cols?D+Qe[ue]:D+Qe[ue]-A;P.fillStyle=Oe.color||k,P.fillRect(it,rt+Ge-Oe.width,dt[ue],Oe.width)}}for(let ue=tt;ue<=Xe;ue++){if(De&&ue>=e.freeze.rows||e.isSameMergeInternal(Ye-1,ue,Ye,ue))continue;const ye=Je(Ye-1,ue,"right"),Oe=Tt(ye,ot.left);if(Oe&&Oe.width&&Oe.width>0){const it=ue<e.freeze.rows?z+nt[ue]:z+nt[ue]-_,wt=nt[ue+1]-nt[ue];P.fillStyle=Oe.color||k,P.fillRect(Ke,it,Oe.width,wt)}}if(!at)for(let ue=tt;ue<=Xe;ue++){if(De&&ue>=e.freeze.rows||e.isSameMergeInternal(st,ue,st+1,ue))continue;const ye=Je(st+1,ue,"left"),Oe=Tt(ot.right,ye);if(Oe&&Oe.width&&Oe.width>0){const it=ue<e.freeze.rows?z+nt[ue]:z+nt[ue]-_,wt=nt[ue+1]-nt[ue];P.fillStyle=Oe.color||k,P.fillRect(Ke+_t-Oe.width,it,Oe.width,wt)}}{const ue=e.isSameMergeInternal(Ye,tt-1,Ye,tt)?ot.top:Tt(Je(Ye,tt-1,"bottom"),ot.top),ye=e.isSameMergeInternal(Ye-1,tt,Ye,tt)?ot.left:Tt(Je(Ye-1,tt,"right"),ot.left),Oe=(ue==null?void 0:ue.width)??0,it=(ye==null?void 0:ye.width)??0;Oe>0&&it>0&&(P.fillStyle=(ue==null?void 0:ue.color)||(ye==null?void 0:ye.color)||k,P.fillRect(Ke-it,bt-Oe,it,Oe))}if(!at){const ue=e.isSameMergeInternal(st,tt-1,st,tt)?ot.top:Tt(Je(st,tt-1,"bottom"),ot.top),ye=e.isSameMergeInternal(st,tt,st+1,tt)?ot.right:Tt(ot.right,Je(st+1,tt,"left")),Oe=(ue==null?void 0:ue.width)??0,it=(ye==null?void 0:ye.width)??0;Oe>0&&it>0&&(P.fillStyle=(ue==null?void 0:ue.color)||(ye==null?void 0:ye.color)||k,P.fillRect(Ke+_t,bt-Oe,it,Oe))}if(!Ct){const ue=e.isSameMergeInternal(Ye,Xe,Ye,Xe+1)?ot.bottom:Tt(ot.bottom,Je(Ye,Xe+1,"top")),ye=e.isSameMergeInternal(Ye-1,Xe,Ye,Xe)?ot.left:Tt(Je(Ye-1,Xe,"right"),ot.left),Oe=(ue==null?void 0:ue.width)??0,it=(ye==null?void 0:ye.width)??0;Oe>0&&it>0&&(P.fillStyle=(ue==null?void 0:ue.color)||(ye==null?void 0:ye.color)||k,P.fillRect(Ke-it,bt+Bt,it,Oe))}if(!at&&!Ct){const ue=e.isSameMergeInternal(st,Xe,st,Xe+1)?ot.bottom:Tt(ot.bottom,Je(st,Xe+1,"top")),ye=e.isSameMergeInternal(st,Xe,st+1,Xe)?ot.right:Tt(ot.right,Je(st+1,Xe,"left")),Oe=(ue==null?void 0:ue.width)??0,it=(ye==null?void 0:ye.width)??0;Oe>0&&it>0&&(P.fillStyle=(ue==null?void 0:ue.color)||(ye==null?void 0:ye.color)||k,P.fillRect(Ke+_t,bt+Bt,it,Oe))}};h=(P,Ae,Ke,bt,_t)=>{var st,tt;const Bt=Ae+bt,ht=Ke+_t,De=Ae<Ut,Ye=Ke<At;for(const Xe in e.merges){const rt=e.merges[Xe];if(!rt)continue;const Ge=rt.startCol,at=rt.startRow,Ct=rt.endCol,Et=rt.endRow,ot=e.cellToScreenRect(at,Ge),ue=e.cellToScreenRect(Et,Ct),ye=ot.x,Oe=ot.y,it=ue.x+ue.width-ye,wt=ue.y+ue.height-Oe,Lt=De&&Ct>=e.freeze.cols?Math.min(Bt,Ut):Math.min(ye+it,Bt),Kt=Ye&&Et>=e.freeze.rows?Math.min(ht,At):Math.min(Oe+wt,ht),jl=Math.max(ye,Ae),Sl=Math.max(Oe,Ke);if(Lt<=jl||Kt<=Sl)continue;const un=(st=e.resolveStyle(e.cells[e.cellKey(Ge,at)]))==null?void 0:st.backgroundColor,Ml=((tt=e.resolveConditionalFormat(Ge,at))==null?void 0:tt.backgroundColor)||un;if(Ml&&(P.fillStyle=Ml,P.fillRect(jl,Sl,Lt-jl,Kt-Sl)),P.strokeStyle=ae.gridLine,P.lineWidth=.5,P.strokeRect(ye+.25,Oe+.25,Lt-ye-.5,Kt-Oe-.5),Rl(P,rt,ye,Oe,it,wt,De,Ye),e.getListValidation(at,Ge)){const fn=e.activeCell.value.col===Ge&&e.activeCell.value.row===at;Le(P,ye,Oe,it,wt,fn,ae)}if(!(e.editingCell.value&&e.editingCell.value.col===Ge&&e.editingCell.value.row===at)){const fn=Qe[Ct+1]-Qe[Ge],Zl=nt[Et+1]-nt[at],bl=Ge<e.freeze.cols,al=at<e.freeze.rows,Xt=De?ye:bl?ye-A:ye,Hl=Ye?Oe:al?Oe-_:Oe;xt(P,Ge,at,fn,Zl,Xt,Hl)}}},r.save(),r.beginPath(),r.rect(Ut,At,el,pl),r.clip(),f(r,Ol,Yt,Xl,Ll,$l),y(r,Ol,Yt,Xl,Ll,$l),h(r,Ut,At,el,pl),r.restore(),Nt>0&&(r.strokeStyle=ae.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Ut+.5,z),r.lineTo(Ut+.5,R),r.stroke()),vt>0&&(r.strokeStyle=ae.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(D,At+.5),r.lineTo(T,At+.5),r.stroke()),r.fillStyle=ae.headerBg,r.fillRect(D,0,T-D,z);for(let P=Yl;P<=dn;P++){const Ae=D+Qe[P]-A,Ke=dt[P];Ae+Ke<D||Ae>T||(yt&&P>=yt.startCol&&P<=yt.endCol&&(r.fillStyle=ae.selectionBg,r.fillRect(Ae,0,Ke,z)),r.strokeStyle=ae.headerBorder,r.lineWidth=.5,r.strokeRect(Ae+.25,.25,Ke-.5,z-.5),yt&&P>=yt.startCol&&P<=yt.endCol&&(r.strokeStyle=ae.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ae,z-1),r.lineTo(Ae+Ke,z-1),r.stroke()),r.fillStyle=ae.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(lt(P),Ae+Ke/2,z/2))}if(Nt>0){r.fillStyle=ae.headerBg,r.fillRect(D,0,Nt,z);for(let P=0;P<=ql;P++){const Ae=D+Qe[P],Ke=dt[P];Ae+Ke<D||Ae>T||(yt&&P>=yt.startCol&&P<=yt.endCol&&(r.fillStyle=ae.selectionBg,r.fillRect(Ae,0,Ke,z)),r.strokeStyle=ae.headerBorder,r.lineWidth=.5,r.strokeRect(Ae+.25,.25,Ke-.5,z-.5),yt&&P>=yt.startCol&&P<=yt.endCol&&(r.strokeStyle=ae.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ae,z-1),r.lineTo(Ae+Ke,z-1),r.stroke()),r.fillStyle=ae.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(lt(P),Ae+Ke/2,z/2))}}r.strokeStyle=ae.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(D,z+.5),r.lineTo(T,z+.5),r.stroke(),r.fillStyle=ae.headerBg,r.fillRect(0,z,D,R-z);for(let P=hl;P<=_l;P++){if(e.isRowHidden(P))continue;const Ae=z+nt[P]-_,Ke=$l[P];Ae+Ke<z||Ae>R||(yt&&P>=yt.startRow&&P<=yt.endRow&&(r.fillStyle=ae.selectionBg,r.fillRect(0,Ae,D,Ke)),r.strokeStyle=ae.headerBorder,r.lineWidth=.5,r.strokeRect(.25,Ae+.25,D-.5,Ke-.5),yt&&P>=yt.startRow&&P<=yt.endRow&&(r.strokeStyle=ae.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(D-1,Ae),r.lineTo(D-1,Ae+Ke),r.stroke()),r.fillStyle=ae.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(P+1),D/2,Ae+Ke/2+.5))}if(vt>0){r.fillStyle=ae.headerBg,r.fillRect(0,z,D,vt);for(let P=0;P<=cn;P++){if(e.isRowHidden(P))continue;const Ae=z+nt[P],Ke=$l[P];Ae+Ke<z||Ae>R||(yt&&P>=yt.startRow&&P<=yt.endRow&&(r.fillStyle=ae.selectionBg,r.fillRect(0,Ae,D,Ke)),r.strokeStyle=ae.headerBorder,r.lineWidth=.5,r.strokeRect(.25,Ae+.25,D-.5,Ke-.5),yt&&P>=yt.startRow&&P<=yt.endRow&&(r.strokeStyle=ae.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(D-1,Ae),r.lineTo(D-1,Ae+Ke),r.stroke()),r.fillStyle=ae.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(P+1),D/2,Ae+Ke/2+.5))}}r.strokeStyle=ae.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(D+.5,z),r.lineTo(D+.5,R),r.stroke(),r.fillStyle=ae.headerBg,r.fillRect(0,0,D,z),r.strokeStyle=ae.headerSep,r.lineWidth=1,r.strokeRect(.5,.5,D-1,z-1);const gl=Math.min(D,z)*.32;r.fillStyle=ae.activeCellBorder,r.beginPath(),r.moveTo(D-1,z-1-gl),r.lineTo(D-1-gl,z-1),r.lineTo(D-1,z-1),r.closePath(),r.fill(),ee(r,ae),M(r,ae)}function ne(){const s=o.freezeCanvasRef.value,m=o.wrapperRef.value;if(!s||!m)return;const C=s.getContext("2d");if(!C)return;const T=m.getBoundingClientRect(),R=T.width,A=T.height,_=52,D=24,z=o.themeColors.value,ae=e.colPositions.value,Me=e.rowPositions.value,Qe=e.scrollX.value,nt=e.scrollY.value;s.width=R*d,s.height=A*d,s.style.width=R+"px",s.style.height=A+"px",C.setTransform(d,0,0,d,0,0),C.clearRect(0,0,R,A);const{frozenRowsHeight:dt,frozenColumnsWidth:vt}=e.getFrozenMetrics();if(dt<=0&&vt<=0)return;const Nt=_+vt,Ut=D+dt,At=Math.max(0,R-_-11-vt),el=Math.max(0,A-D-11-dt),pl=Math.max(0,e.freeze.cols-1),ql=Math.max(0,e.freeze.rows-1),cn=Math.max(e.freeze.cols,e.hitCol(vt+Qe));let Yl=cn;for(let Je=cn;Je<e.colCount&&!(_+ae[Je]-Qe>=R);Je++)Yl=Je;const dn=Math.max(e.freeze.rows,e.hitRow(dt+nt));let hl=dn;for(let Je=dn;Je<e.rowCount&&!(D+Me[Je]-nt>=A);Je++)hl=Je;let _l=cn,qt=Yl,Yt=dn,tl=hl;vt>0&&(_l=0,qt=Math.max(qt,pl)),dt>0&&(Yt=0,tl=Math.max(tl,ql));let Ll=_l,Ol=Yt;for(const Je in e.merges){const xt=e.merges[Je];xt&&(xt.startRow>tl||xt.endRow<Yt||xt.startCol>qt||xt.endCol<_l||(xt.startCol<Ll&&(Ll=xt.startCol),xt.startRow<Ol&&(Ol=xt.startRow)))}const Xl=new Array(Ol);for(let Je=Ol;Je<=tl;Je++)Xl[Je]=Me[Je+1]-Me[Je];const $l=(Je,xt,Rl)=>{const gl=e.findMerge(Je,xt);return gl?e.getCellBorderSide(e.cells[gl.anchor],Rl):e.getCellBorderSide(e.cells[e.cellKey(Je,xt)],Rl)},yt=(Je,xt,Rl,gl,P)=>{Je.fillStyle="#444";for(let Ae=gl;Ae<=P;Ae++)for(let Ke=xt;Ke<=Rl;Ke++){const bt=e.findMerge(Ke,Ae);if(bt&&!(Ke===bt.range.startCol&&Ae===bt.range.startRow))continue;const _t=e.cellToScreenRect(Ae,Ke),Bt=_t.x,ht=_t.y,De=_t.width,Ye=_t.height;if(Bt+De<_||ht+Ye<D||Bt>R||ht>A)continue;const st=e.cells[e.cellKey(Ke,Ae)],tt={top:e.getCellBorderSide(st,"top"),right:e.getCellBorderSide(st,"right"),bottom:e.getCellBorderSide(st,"bottom"),left:e.getCellBorderSide(st,"left")};if(bt)continue;const Xe={top:$l(Ke,Ae-1,"bottom"),left:$l(Ke-1,Ae,"right"),bottom:$l(Ke,Ae+1,"top"),right:$l(Ke+1,Ae,"left")},rt=Tt(Xe.top,tt.top),Ge=Tt(Xe.left,tt.left),at=Tt(tt.bottom,Xe.bottom),Ct=Tt(tt.right,Xe.right),Et=(rt==null?void 0:rt.width)??0,ot=(Ge==null?void 0:Ge.width)??0,ue=(at==null?void 0:at.width)??0,ye=(Ct==null?void 0:Ct.width)??0;Et>0&&(Je.fillStyle=(rt==null?void 0:rt.color)||"#444",Je.fillRect(Bt,ht,De,Et)),ue>0&&(Je.fillStyle=(at==null?void 0:at.color)||"#444",Je.fillRect(Bt,ht+Ye-ue,De,ue)),ot>0&&(Je.fillStyle=(Ge==null?void 0:Ge.color)||"#444",Je.fillRect(Bt,ht,ot,Ye)),ye>0&&(Je.fillStyle=(Ct==null?void 0:Ct.color)||"#444",Je.fillRect(Bt+De-ye,ht,ye,Ye))}},Cn=(Je,xt,Rl,gl,P,Ae,Ke,bt)=>{Rl<=0||gl<=0||(C.save(),C.beginPath(),C.rect(Je,xt,Rl,gl),C.clip(),C.fillStyle=z.gridBg,C.fillRect(Je,xt,Rl,gl),f(C,P,Ae,Ke,bt,Xl),yt(C,P,Ae,Ke,bt),h(C,Je,xt,Rl,gl),C.restore())};vt>0&&dt>0&&Cn(_,D,vt,dt,0,pl,0,ql),dt>0&&Cn(Nt,D,At,dt,Ll,qt,0,ql),vt>0&&Cn(_,Ut,vt,el,0,pl,Ol,tl),C.strokeStyle=z.headerSep,C.lineWidth=1,vt>0&&(C.beginPath(),C.moveTo(Nt+.5,D),C.lineTo(Nt+.5,A),C.stroke()),dt>0&&(C.beginPath(),C.moveTo(_,Ut+.5),C.lineTo(R,Ut+.5),C.stroke()),C.fillStyle=z.headerBg,C.fillRect(0,0,_,D),C.strokeStyle=z.headerSep,C.lineWidth=1,C.strokeRect(.5,.5,_-.5,D-.5),ee(C,z),M(C,z)}function ee(s,m){const C=e.selection.value;if(!C||e.editingCell.value)return;const T=e.cellToScreenRect(C.endRow,C.endCol),R=Io(C,C,e.merges),A=T.x+T.width-6/2,_=T.y+T.height-6/2;s.fillStyle=R?m.activeCellBorder:m.scrollTrack,s.fillRect(A,_,6,6),s.strokeStyle="#fff",s.lineWidth=1,s.strokeRect(A+.5,_+.5,6-1,6-1)}function M(s,m){const C=e.autoFillState.value;if(!C.active||!C.preview||!C.targetRange)return;const T=C.targetRange,R=e.cellToScreenRect(T.startRow,T.startCol),A=e.cellToScreenRect(T.endRow,T.endCol),_=R.x,D=R.y,z=A.x+A.width-_,ae=A.y+A.height-D;s.fillStyle=m.selectionBg,s.fillRect(_,D,z,ae),s.strokeStyle=m.activeCellBorder,s.lineWidth=1.5,s.setLineDash([4,3]),s.strokeRect(_+.5,D+.5,z-1,ae-1),s.setLineDash([])}const se=t.computed(()=>lt(e.activeCell.value.col)+String(e.activeCell.value.row+1)),X=t.ref(""),te=t.ref(!1),Ne=t.computed(()=>e.editingCell.value?X.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(s,m)=>{if(s&&!m){const C=e.editValue.value||e.getCellRaw(s.col,s.row)||"";X.value=C,_e=!1}else!s&&m&&(X.value="",te.value=!1,_e=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(X.value="",_e=!1)});function ze(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),u())}function Ve(s){const m=s.target.value;e.editingCell.value?e.editValue.value=m:e.startEdit(m),X.value=m,_e=!0}function Fe(s){var C,T;const m={...e.activeCell.value};e.editingCell.value?(e.editValue.value=s,e.commitEdit()):((C=e.saveUndo)==null||C.call(e),e.setCellValue(m.col,m.row,s)),X.value="",_e=!1,u(),(T=o.emitModelData)==null||T.call(o)}let je=!1,_e=!1;function F(){var A,_,D;if(je)return;const s=o.formulaBarRef.value,m=!!(s&&typeof document<"u"&&document.activeElement===s);if(!e.editingCell.value&&!m&&!_e)return;const C={...e.activeCell.value},T=e.editingCell.value?e.editingCell.value.col:C.col,R=e.editingCell.value?e.editingCell.value.row:C.row;if(!e.editingCell.value){const z=e.getCellRaw(T,R),ae=X.value!==z;if(!_e)return;je=!0,ae&&((A=e.saveUndo)==null||A.call(e),e.setCellValue(T,R,X.value),u(),(_=o.emitModelData)==null||_.call(o)),(D=o.formulaBarRef.value)==null||D.blur(),X.value="",te.value=!1,_e=!1,t.nextTick(()=>{je=!1});return}je=!0,_e?(e.editValue.value=X.value,e.commitEdit().then(z=>{var ae,Me;z&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(ae=o.formulaBarRef.value)==null||ae.blur(),X.value="",te.value=!1,_e=!1,u(),o.focusEditInput(),(Me=o.emitModelData)==null||Me.call(o),t.nextTick(()=>{je=!1})})):m?(X.value=e.editValue.value,e.commitEdit().then(z=>{var ae,Me;z&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(ae=o.formulaBarRef.value)==null||ae.blur(),X.value="",te.value=!1,_e=!1,u(),o.focusEditInput(),(Me=o.emitModelData)==null||Me.call(o),t.nextTick(()=>{je=!1})})):e.commitEdit().then(()=>{var z,ae;(z=o.formulaBarRef.value)==null||z.blur(),X.value="",te.value=!1,_e=!1,u(),o.focusEditInput(),(ae=o.emitModelData)==null||ae.call(o),t.nextTick(()=>{je=!1})})}function I(){var s;je||(je=!0,e.editingCell.value&&e.cancelEdit(),(s=o.formulaBarRef.value)==null||s.blur(),X.value="",te.value=!1,_e=!1,u(),o.focusEditInput(),t.nextTick(()=>{je=!1}))}function G(s){if(!s.isComposing){if(s.key==="Enter"&&(s.altKey||s.metaKey)&&!s.ctrlKey){s.preventDefault(),s.stopPropagation();const m=s.target;if(!m)return;e.editingCell.value||e.startEdit();const C=m.selectionStart??m.value.length,T=m.selectionEnd??m.value.length,R=m.value,A=R.substring(0,C)+`
|
|
7
|
-
`+R.substring(T),_=C+1;X.value=A,te.value||(te.value=!0),t.nextTick(()=>{try{m.setSelectionRange(_,_)}catch{}if(te.value)try{m.scrollTop=m.scrollHeight}catch{}try{m.focus({preventScroll:!0})}catch{}});return}s.key==="Enter"?(s.preventDefault(),F()):s.key==="Escape"&&(s.preventDefault(),I())}}function Ce(){F()}const $e=t.ref(null),j=t.ref("");function Be(s){$e.value===null&&(o.switchSheet(s),u())}function Q(s){s!==o.activeSheetIndex.value&&(o.saveSheet(),o.loadSheet(s),u()),$e.value=s,j.value=o.sheets.value[s].name,t.nextTick(()=>{const m=document.querySelector(".tab-rename-input");m==null||m.focus(),m==null||m.select()})}function ke(){$e.value!==null&&(o.renameSheet($e.value,j.value),t.nextTick(()=>o.emitModelData())),$e.value=null,j.value=""}function B(){$e.value=null,j.value=""}function oe(s){s.key==="Enter"?(s.preventDefault(),ke()):s.key==="Escape"&&(s.preventDefault(),B())}const Z=t.ref(null);t.watch(Z,s=>{s===null&&Rt()});const re=t.ref(null),K=t.ref(null),L=18,J=2,$=2,U=new Path2D("M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z");function de(s,m,C,T,R,A){const _=Math.min(A,T/2,R/2);s.beginPath(),s.moveTo(m+_,C),s.arcTo(m+T,C,m+T,C+R,_),s.arcTo(m+T,C+R,m,C+R,_),s.arcTo(m,C+R,m,C,_),s.arcTo(m,C,m+T,C,_),s.closePath()}function Le(s,m,C,T,R,A,_){if(T<H+4||R<10)return;const D=m+T-H,z=C+1,ae=R-2;s.save(),A&&(s.fillStyle=_.selectionBg,s.fillRect(D,z,H,ae)),s.fillStyle=_.activeCellBorder;const Me=6,Qe=4,nt=D+H/2,dt=z+ae/2;s.beginPath(),s.moveTo(nt-Me/2,dt-Qe/2+.5),s.lineTo(nt+Me/2,dt-Qe/2+.5),s.lineTo(nt,dt+Qe/2+.5),s.closePath(),s.fill(),s.restore()}function ve(s,m){if(e.dataValidations.length===0)return null;const C=e.screenToCell(s,m);if(!C)return null;const T=e.findMerge(C.col,C.row),R=T?T.range.startCol:C.col,A=T?T.range.startRow:C.row;if(!e.getListValidation(A,R))return null;const _=e.cellToScreenRect(A,R);if(_.width<H+4)return null;const D=_.x+_.width-H;return s<D||s>_.x+_.width||m<_.y||m>_.y+_.height?null:{col:R,row:A}}function Ie(s,m){const C=e.getValidationDropdown(m,s);if(!C)return!1;const T=o.canvasRef.value;if(!T)return!1;e.activeCell.value.col===s&&e.activeCell.value.row===m||e.selectCell(s,m),e.ensureVisible(s,m),u();const R=e.cellToScreenRect(m,s),A=T.getBoundingClientRect();return K.value={col:s,row:m,rule:C.rule,items:C.items,current:e.getCellRaw(s,m),x:A.left+R.x,y:A.top+R.y,width:R.width,height:R.height},!0}function Ee(){K.value&&(K.value=null,u())}async function He(s){var A;const m=K.value;if(!m)return;const{col:C,row:T}=m;K.value=null;const R=e.validateCell(T,C,s);if(!R.valid&&await e.confirmInvalidValue(R,C,T)!=="continue"){u(),o.focusEditInput();return}n.saveUndo(),e.setCellValue(C,T,s),(A=e.emitModelData)==null||A.call(e),u(),o.focusEditInput()}function ge(s,m,C,T,R,A,_){const D=Math.min(T,L)-J,z=m+T-D-J,ae=C+J,Me=R-2*J;s.save(),s.fillStyle=A?_.activeCellBorder:"#ececec",de(s,z,ae,D,Me,$),s.fill();const Qe=Math.min(D,Me)*.72;s.translate(z+D/2,ae+Me/2),s.scale(Qe/1024,Qe/1024),s.translate(-512,-512),s.fillStyle=A?"#ffffff":"#5a5a5a",s.fill(U),s.restore()}function et(s,m){const C=e.getFilter();if(!C)return-1;const T=e.screenToCell(s,m);if(!T)return-1;const{col:R,row:A}=T;if(A!==C.range.startRow||R<C.range.startCol||R>C.range.endCol)return-1;const _=e.cellToScreenRect(A,R),D=Math.min(_.width,L)-J,z=_.x+_.width-D-J,ae=_.x+_.width-J;return s>=z&&s<=ae&&m>=_.y+J&&m<=_.y+_.height-J?R:-1}function ut(s){const m=e.getFilter();if(!m)return;const C=o.canvasRef.value;if(!C)return;const T=C.getBoundingClientRect(),R=e.cellToScreenRect(m.range.startRow,s);re.value={col:s,x:T.left+R.x+R.width-L,y:T.top+R.y+2}}function Pe(){re.value=null}let N=null,ie=null;function Rt(){N&&(document.removeEventListener("click",N),N=null),ie&&(document.removeEventListener("touchstart",ie,{capture:!0}),ie=null)}function ft(s,m,C){Rt();const T=140,R=C.length*28+8,A=window.innerWidth,_=window.innerHeight;s+T>A&&(s-=T),m+R>_&&(m-=R),Mt.value=!1,Z.value={x:s,y:m,items:C},t.nextTick(()=>It()),N=()=>{Z.value=null,Rt()},ie=D=>{const z=D.target;z&&z.closest(".context-menu")||(Z.value=null,Rt())},setTimeout(()=>{document.addEventListener("click",N,{once:!0}),document.addEventListener("touchstart",ie,{capture:!0})},0)}const Mt=t.ref(!1);function Ft(s,m){}function It(){const m=document.querySelector(".context-menu"),C=Z.value,T=o.wrapperRef.value;if(!m||!C||!T){Mt.value=!1;return}const R=C.x+140,A=T.getBoundingClientRect(),_=m.style.transform;m.style.transform="none";let D=0;if(m.querySelectorAll(".context-menu__item").forEach(ae=>{const Me=ae.querySelector(":scope > .context-submenu");if(!Me)return;const Qe=Me.style.display;Me.style.display="block";const nt=Me.getBoundingClientRect().width;Me.style.display=Qe,nt>D&&(D=nt)}),m.style.transform=_,D===0){Mt.value=!0;return}const z=A.right-R;Mt.value=z<D+8}function Ot(s,m){s.preventDefault(),s.stopPropagation(),ft(s.clientX,s.clientY,[{label:b(e.locale.value,"insert"),action:()=>{o.addSheet(),u()}},{label:b(e.locale.value,"copy"),action:()=>{o.dupSheet(m)}},{label:b(e.locale.value,"rename"),action:()=>{Q(m)}},{label:b(e.locale.value,"delete"),action:()=>{o.removeSheet(m),u()},disabled:o.sheetCount.value<=1},{label:b(e.locale.value,"moveSheetLeft"),action:()=>{o.moveSheet(m,-1)},disabled:m===0},{label:b(e.locale.value,"moveSheetRight"),action:()=>{o.moveSheet(m,1)},disabled:m===o.sheets.value.length-1}])}function Dl(s){s.preventDefault(),!(s.target.closest(".tab-item")||s.target.closest(".tab-bar__add-btn"))&&ft(s.clientX,s.clientY,[{label:b(e.locale.value,"insert"),action:()=>{o.addSheet(),u()}}])}function nl(s){s.preventDefault(),e.selectAll(),u(),ft(s.clientX,s.clientY,[{label:b(e.locale.value,"cut"),action:()=>{l.cutSelected(),o.emitModelData()}},{label:b(e.locale.value,"copy"),action:()=>l.copyToClipboard()},{label:b(e.locale.value,"paste"),action:()=>{n.saveUndo(),l.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>o.emitModelData())})}},{label:b(e.locale.value,"delete"),action:()=>{n.saveUndo(),l.clearSelected();for(let m=0;m<e.colCount;m++)e.colWidths.value[m]=100;for(let m=0;m<e.rowCount;m++)e.rowHeights.value[m]=void 0;u(),o.emitModelData()}}])}function dl(s,m){s.preventDefault();const C=s.clientX,T=s.clientY,R=e.selection.value;R&&R.startCol===0&&R.endCol===e.colCount-1&&m>=R.startRow&&m<=R.endRow||(e.selectRange(0,m,e.colCount-1,m,"row"),u());const A=e.selection.value;ft(s.clientX,s.clientY,[{label:b(e.locale.value,"insert"),action:()=>{n.saveUndo(),o.insertRows(A.startRow,A.endRow),u(),o.emitModelData()}},{label:b(e.locale.value,"cut"),action:()=>{n.saveUndo(),l.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,A.startRow,A.endRow),u(),o.emitModelData()}},{label:b(e.locale.value,"copy"),action:()=>l.copyRowCol()},{label:b(e.locale.value,"paste"),action:()=>{n.saveUndo(),l.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>o.emitModelData())})}},{label:b(e.locale.value,"delete"),action:()=>{n.saveUndo(),o.deleteRows(A.startRow,A.endRow),u(),o.emitModelData()}},{label:`${b(e.locale.value,"rowHeight")}...`,action:()=>w("row",C,T)},{label:b(e.locale.value,"autoRowHeight"),action:()=>o.resetRowHeight()},{label:b(e.locale.value,"freezeToRow"),action:()=>{e.setFreeze(m+1,e.freeze.cols),u()}}])}function ol(s,m){s.preventDefault();const C=s.clientX,T=s.clientY,R=e.selection.value;R&&R.startRow===0&&R.endRow===e.rowCount-1&&m>=R.startCol&&m<=R.endCol||(e.selectRange(m,0,m,e.rowCount-1,"col"),u());const A=e.selection.value,_=!o.canSortColumns(A.startCol,A.endCol);ft(s.clientX,s.clientY,[{label:b(e.locale.value,"insert"),action:()=>{n.saveUndo(),o.insertCols(A.startCol,A.endCol),u(),o.emitModelData()}},{label:b(e.locale.value,"cut"),action:()=>{n.saveUndo(),l.copyRowCol(),e.clearCellsInRange(A.startCol,A.endCol,0,e.rowCount-1),u(),o.emitModelData()}},{label:b(e.locale.value,"copy"),action:()=>l.copyRowCol()},{label:b(e.locale.value,"paste"),action:()=>{n.saveUndo(),l.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>o.emitModelData())})}},{label:b(e.locale.value,"delete"),action:()=>{n.saveUndo(),o.deleteCols(A.startCol,A.endCol),u(),o.emitModelData()}},{label:b(e.locale.value,"sort"),disabled:_,children:[{label:b(e.locale.value,"sortAsc"),action:()=>{o.prepareSortConfirmation("asc")||o.sortSelectedColumns("asc")},disabled:_},{label:b(e.locale.value,"sortDesc"),action:()=>{o.prepareSortConfirmation("desc")||o.sortSelectedColumns("desc")},disabled:_}]},{label:`${b(e.locale.value,"colWidth")}...`,action:()=>w("col",C,T)},{label:b(e.locale.value,"defaultColWidth"),action:()=>o.resetColWidth()},{label:b(e.locale.value,"freezeToCol"),action:()=>{e.setFreeze(e.freeze.rows,m+1),u()}}])}function Ht(s,m,C){s.preventDefault(),e.isSelected(m,C)||(e.selectCell(m,C),u());const T=e.selection.value,R=!!(T&&T.startCol===T.endCol&&T.startRow===T.endRow);ft(s.clientX,s.clientY,[{label:b(e.locale.value,"cut"),action:()=>{l.cutSelected(),o.emitModelData()}},{label:b(e.locale.value,"copy"),action:()=>l.copyToClipboard()},{label:b(e.locale.value,"paste"),action:()=>{n.saveUndo(),l.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>o.emitModelData())})}},{label:b(e.locale.value,"delete"),action:()=>{n.saveUndo(),l.clearSelected(),u(),o.emitModelData()}},{label:b(e.locale.value,"calculate"),children:[{label:b(e.locale.value,"sum"),action:l.sumSelected,disabled:R},{label:b(e.locale.value,"avg"),action:l.avgSelected,disabled:R},{label:b(e.locale.value,"count"),action:l.countSelected,disabled:R}]},{label:`${b(e.locale.value,"dv")}...`,action:()=>{var A;return(A=e.requestDataValidationDialog)==null?void 0:A.call(e)}},{label:b(e.locale.value,"dvClearValidation"),action:()=>{n.saveUndo(),e.clearDataValidation(e.selection.value),u(),o.emitModelData()}}])}const vl=t.ref(null),zt=t.ref(null);let W=null,g=null;function c(){W&&(document.removeEventListener("mousedown",W),W=null),g&&(document.removeEventListener("touchstart",g),g=null)}function w(s,m,C){c();const T=e.selection.value;let R="";if(T){const ae=s==="row"?e.getRowHeight(T.startRow):e.colWidths.value[T.startCol];R=ae!=null&&ae>0?String(Math.round(ae)):""}const A=220,_=118;let D=m,z=C;D+A>window.innerWidth&&(D=window.innerWidth-A-8),z+_>window.innerHeight&&(z=window.innerHeight-_-8),D<8&&(D=8),z<8&&(z=8),zt.value={type:s,x:D,y:z,value:R,error:""},W=()=>{zt.value=null},g=()=>{zt.value=null},setTimeout(()=>{document.addEventListener("mousedown",W,{once:!0}),document.addEventListener("touchstart",g,{once:!0})},0),t.nextTick(()=>{const ae=vl.value;ae&&(ae.focus(),ae.select())})}function be(s){const m=zt.value;if(!m)return;const C=s.target,T=C.value,R=T.replace(/[^\d]/g,"");m.value=R,T!==R&&(C.value=R),m.error=""}function he(s){s.key==="Enter"?(s.preventDefault(),we()):s.key==="Escape"&&(s.preventDefault(),ce())}function xe(){const s=zt.value;if(!s)return;const m=s.value.trim(),C=Number(m),T=s.type==="row",R=T?24:30,A=T?500:1e3;if(m===""||!Number.isFinite(C)){ce();return}const _=Math.max(R,Math.min(A,Math.round(C)));s.value=String(_),s.error=""}function we(){const s=zt.value,m=e.selection.value;if(!s||!m)return;const C=s.value.trim(),T=Number(C),R=s.type==="row",A=R?24:30,_=R?500:1e3;if(C===""||!Number.isFinite(T)){s.error=b(e.locale.value,"dimNumberError");return}if(T<A||T>_){s.error=b(e.locale.value,"dimRangeError").replace("{min}",String(A)).replace("{max}",String(_));return}const D=T;if(n.saveUndo(),R)for(let z=m.startRow;z<=m.endRow;z++)e.rowHeights.value[z]=D;else for(let z=m.startCol;z<=m.endCol;z++)e.colWidths.value[z]=D;u(),o.emitModelData(),ce()}function ce(){c(),zt.value=null}const Ue=t.computed(()=>{const s=!e.editingCell.value,m=e.editingCell.value??e.activeCell.value,C=m.col,T=m.row,R=e.resolveStyle(e.cells[e.cellKey(C,T)]),A=e.cellFontSize(C,T),_=typeof(R==null?void 0:R.fontFamily)=="string"&&R.fontFamily?R.fontFamily:pn,D=(R==null?void 0:R.fontWeight)==="bold"?"bold":"normal",z=(R==null?void 0:R.fontStyle)==="italic"?"italic":"normal",ae=(R==null?void 0:R.underline)==="underline"?"underline":(R==null?void 0:R.strikethrough)==="line-through"?"line-through":"none",Me=(R==null?void 0:R.underline)==="underline"&&(R==null?void 0:R.strikethrough)==="line-through"?"underline line-through":ae,Qe=typeof(R==null?void 0:R.color)=="string"?R.color:void 0,nt=typeof(R==null?void 0:R.backgroundColor)=="string"?R.backgroundColor:void 0,dt=typeof(R==null?void 0:R.numberFormat)=="string"?R.numberFormat:"",vt=e.editValue.value??e.getCellValue(C,T),Nt=typeof(R==null?void 0:R.textAlign)=="string"?R.textAlign:ko(vt,dt)?"right":"left",Ut=typeof(R==null?void 0:R.verticalAlign)=="string"?R.verticalAlign:"top",At=e.findMerge(C,T),el=At?e.rowPositions.value[At.range.endRow+1]-e.rowPositions.value[T]:e.getRowHeight(T),pl=2,{ascent:ql,descent:cn}=e.measureFontMetrics(_,A,D,z),Yl=ql+cn,hl=(e.editValue.value?e.editValue.value.split(`
|
|
8
|
-
`).length:1)*Yl,_l=e.BASE_CELL_VPAD-pl;let qt=0,Yt=0;Ut==="middle"?(qt=Math.floor((el-hl)/2),Yt=Math.max(0,el-hl-qt)):Ut==="top"?(qt=_l,Yt=Math.max(0,el-hl-qt)):Ut==="bottom"&&(Yt=_l,qt=Math.max(0,el-hl-Yt));const tl=e.cellToScreenRect(T,C);return{left:`${tl.x}px`,top:`${tl.y}px`,width:`${tl.width}px`,height:`${tl.height}px`,fontFamily:_,fontSize:`${A}px`,lineHeight:1,fontWeight:D,fontStyle:z,textDecoration:Me,textAlign:Nt,paddingTop:`${qt}px`,paddingRight:"3px",paddingBottom:`${Yt}px`,paddingLeft:"3px",opacity:s?0:1,pointerEvents:s?"none":"auto",color:s?"transparent":Qe,caretColor:s?"transparent":void 0,borderColor:s?"transparent":void 0,background:s?"transparent":nt,boxShadow:s?"none":void 0}});function Ze(){return Math.max(0,o.viewSize.w-52-11)}function fe(){return Math.max(0,o.viewSize.h-24-11)}const We=t.computed(()=>Math.max(0,Ze()-e.getFrozenMetrics().frozenColumnsWidth)),V=t.computed(()=>Math.max(0,fe()-e.getFrozenMetrics().frozenRowsHeight)),le=t.computed(()=>52+e.getFrozenMetrics().frozenColumnsWidth),me=t.computed(()=>24+e.getFrozenMetrics().frozenRowsHeight),pe=t.computed(()=>Math.max(0,We.value-11*2)),Re=t.computed(()=>Math.max(0,V.value-11*2)),Te=t.computed(()=>o.maxScrollX.value<=0?pe.value:Math.max(24,We.value/e.totalWidth.value*pe.value)),Se=t.computed(()=>o.maxScrollX.value<=0?0:e.scrollX.value/o.maxScrollX.value*(pe.value-Te.value)),qe=t.computed(()=>o.maxScrollY.value<=0?Re.value:Math.max(24,V.value/e.totalHeight.value*Re.value)),mt=t.computed(()=>o.maxScrollY.value<=0?0:e.scrollY.value/o.maxScrollY.value*(Re.value-qe.value));let ct=null,kt=0,jt=0;function kl(s){s.preventDefault(),ct="v",kt=s.clientY,jt=e.scrollY.value,document.addEventListener("mousemove",El),document.addEventListener("mouseup",nn)}function gn(s){s.preventDefault(),ct="h",kt=s.clientX,jt=e.scrollX.value,document.addEventListener("mousemove",El),document.addEventListener("mouseup",nn)}function El(s){if(ct==="v"){const C=(s.clientY-kt)/(Re.value-qe.value);o.clampScroll(null,jt+C*o.maxScrollY.value),u()}else if(ct==="h"){const C=(s.clientX-kt)/(pe.value-Te.value);o.clampScroll(jt+C*o.maxScrollX.value,null),u()}}function nn(){ct=null,document.removeEventListener("mousemove",El),document.removeEventListener("mouseup",nn)}function On(s){if(ct)return;const m=s.currentTarget.getBoundingClientRect(),C=s.clientY-m.top;C<mt.value?o.clampScroll(null,e.scrollY.value-fe()):C>mt.value+qe.value&&o.clampScroll(null,e.scrollY.value+fe()),u()}function Po(s){if(ct)return;const m=s.currentTarget.getBoundingClientRect(),C=s.clientX-m.left;C<Se.value?o.clampScroll(e.scrollX.value-Ze(),null):C>Se.value+Te.value&&o.clampScroll(e.scrollX.value+Ze(),null),u()}let on=!1,Zt=0,Jt=0,Wt=!1,rl=!1,rn=0,an=0,Vl=0,Fl=0,bn=0,yn=0,Bn=0,Tn=0,Gt=!1,$t=!1,gt=0,pt=0,Pt="cell",$n=0,Hn=-1,oo=-1,Qt=null,Il=!1,ul=0,fl=0,Al=!1,ml=null,sn=null,ro=0,ao=0;function zn(s,m){const C=e.selection.value;if(!C||e.editingCell.value||!Io(C,C,e.merges))return!1;const T=e.cellToScreenRect(C.endRow,C.endCol),R=T.x+T.width-6,A=T.y+T.height-6,_=4;return s>=R-_&&s<=R+6+_&&m>=A-_&&m<=A+6+_}function Wn(){ml=requestAnimationFrame(io)}function io(){if(!e.autoFillState.value.active||!sn){ml=null;return}const s=8;o.clampScroll(e.scrollX.value+sn.x*s*.1,e.scrollY.value+sn.y*s*.1);const m=e.screenToCell(ro,ao),C=e.autoFillState.value.sourceRange;if(m&&C){const T=Dr(C,{col:m.col,row:m.row});T?e.autoFillState.value={...e.autoFillState.value,targetRange:T.targetRange,direction:T.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}u(),ml=requestAnimationFrame(io)}function Nn(){ml!==null&&(cancelAnimationFrame(ml),ml=null),sn=null}function so(s,m){ro=s,ao=m;const C=e.screenToCell(s,m),T=e.autoFillState.value.sourceRange;if(C&&T){const ae=Dr(T,{col:C.col,row:C.row});ae?e.autoFillState.value={...e.autoFillState.value,targetRange:ae.targetRange,direction:ae.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}const R=30,A=o.viewSize.w,_=o.viewSize.h;let D=0,z=0;s<52+R?D=-(52+R-s):s>A-11-R&&(D=s-(A-11-R)),m<24+R?z=-(24+R-m):m>_-11-R&&(z=m-(_-11-R)),D!==0||z!==0?(sn={x:D,y:z},ml===null&&Wn()):(sn=null,ml!==null&&(cancelAnimationFrame(ml),ml=null)),u()}function co(){Nn();const s=e.autoFillState.value;s.targetRange&&s.direction&&s.sourceRange&&e.applyAutoFill(s.sourceRange,s.targetRange,s.direction),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}}function Uo(s){if(s.button!==0)return;s.preventDefault(),Z.value=null;const m=en(s,o.canvasRef.value),C=ve(m.x,m.y);if(C){if(e.editingCell.value){e.commitEdit().then(D=>{D&&Ie(C.col,C.row)});return}Ie(C.col,C.row);return}const T=et(m.x,m.y);if(T>=0){ut(T);return}if(m.y<24&&m.x>=52){const D=m.x-52+e.scrollX.value,z=E(m.x),ae=z>=0?e.cellToScreenRect(0,z).x+e.colWidths.value[z]:-1;if(z>=0&&Math.abs(m.x-ae)<=4){n.saveUndo(),Wt=!0,rn=z,Vl=e.colWidths.value[z],Fl=D,u();return}}if(m.x<52&&m.y>=24){const D=m.y-24+e.scrollY.value,z=x(m.y),ae=z>=0?e.cellToScreenRect(z,0).y+e.getRowHeight(z):-1;if(z>=0&&Math.abs(m.y-ae)<=4){n.saveUndo(),rl=!0,an=z,Vl=e.getRowHeight(z),Fl=D,u();return}}if(zn(m.x,m.y)){const D=e.selection.value;D&&(e.autoFillState.value={active:!0,sourceRange:{...D},targetRange:null,direction:null,preview:!0},u());return}if(m.x<52||m.y<24){{const D=o.formulaBarRef.value,z=!!(D&&typeof document<"u"&&document.activeElement===D);(e.editingCell.value||z||_e)&&F()}if(m.y<24&&m.x>=52){const D=E(m.x);D>=0&&(e.selectRange(D,0,D,e.rowCount-1,"col"),on=!0,Zt=D,Jt=0)}else if(m.x<52&&m.y>=24){const D=x(m.y);D>=0&&(e.selectRange(0,D,e.colCount-1,D,"row"),on=!0,Zt=0,Jt=D)}else m.x<52&&m.y<24&&e.selectAll();u();return}const R=e.screenToCell(m.x,m.y);if(!R)return;const A=R.col,_=R.row;{const D=o.formulaBarRef.value,z=!!(D&&typeof document<"u"&&document.activeElement===D);(e.editingCell.value||z||_e)&&F()}if(s.shiftKey&&e.selection.value){const D=e.selection.value;e.selectRange(D.startCol,D.startRow,A,_)}else e.selectCell(A,_);on=!0,Zt=A,Jt=_,o.focusEditInput(),u()}function Ko(s){if(Wt){const _=en(s,o.canvasRef.value).x-52+e.scrollX.value-Fl,D=Vl+_;D>=30&&D<=1e3?e.colWidths.value[rn]=D:D<30?e.colWidths.value[rn]=30:e.colWidths.value[rn]=1e3,u();return}if(rl){const _=en(s,o.canvasRef.value).y-24+e.scrollY.value-Fl,D=Vl+_;D>=24&&D<=500?e.rowHeights.value[an]=D:D<24?e.rowHeights.value[an]=24:e.rowHeights.value[an]=500,u();return}if(e.autoFillState.value.active){const A=en(s,o.canvasRef.value);so(A.x,A.y);return}if(!on){const A=o.canvasRef.value;if(!A)return;if(n.paintFmt.value){A.style.cursor="copy";return}const _=en(s,A);if(et(_.x,_.y)>=0){A.style.cursor="pointer";return}if(ve(_.x,_.y)){A.style.cursor="pointer";return}if(_.y<24&&_.x>=52){const D=E(_.x),z=D>=0?e.cellToScreenRect(0,D).x+e.colWidths.value[D]:-1;if(D>=0&&Math.abs(_.x-z)<=4){A.style.cursor="col-resize";return}}if(_.x<52&&_.y>=24){const D=x(_.y),z=D>=0?e.cellToScreenRect(D,0).y+e.getRowHeight(D):-1;if(D>=0&&Math.abs(_.y-z)<=4){A.style.cursor="row-resize";return}}if(zn(_.x,_.y)){A.style.cursor="crosshair";return}A.style.cursor="cell";return}const m=en(s,o.canvasRef.value);if(Zt<0||Jt<0)return;if(m.x<52||m.y<24){if(m.y<24&&m.x>=52){const A=E(m.x);A>=0&&e.selectRange(Math.min(Zt,A),0,Math.max(Zt,A),e.rowCount-1,"col")}else if(m.x<52&&m.y>=24){const A=x(m.y);A>=0&&e.selectRange(0,Math.min(Jt,A),e.colCount-1,Math.max(Jt,A),"row")}u();return}const C=e.screenToCell(m.x,m.y);if(!C)return;const T=C.col,R=C.row;Jt===0&&Zt>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(Zt,T),0,Math.max(Zt,T),e.rowCount-1,"col"):Zt===0&&Jt>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(Jt,R),e.colCount-1,Math.max(Jt,R),"row"):e.selectRange(Zt,Jt,T,R),u()}function Go(s){const m=Wt||rl;if(on=!1,Wt=!1,rl=!1,m&&o.scheduleOptEmit(),e.autoFillState.value.active){co();return}n.paintFmt.value&&n.applyPaintFormat()}function uo(){Nn();const s=Wt||rl;on=!1,Wt=!1,rl=!1,s&&o.scheduleOptEmit()}function fo(s){s.preventDefault();const m=en(s,o.canvasRef.value);if(m.x<52&&m.y<24){nl(s);return}if(m.y<24&&m.x>=52){const C=E(m.x);C>=0&&ol(s,C);return}if(m.x<52&&m.y>=24){const C=x(m.y);C>=0&&dl(s,C);return}if(m.x>=52&&m.y>=24){const C=e.screenToCell(m.x,m.y);C&&Ht(s,C.col,C.row)}}function qo(s){const m=en(s,o.canvasRef.value);if(m.x<52||m.y<24)return;const C=e.screenToCell(m.x,m.y);if(!C)return;const T=C.col,R=C.row;{const A=o.formulaBarRef.value,_=!!(A&&typeof document<"u"&&document.activeElement===A);(e.editingCell.value||_||_e)&&F()}e.selectCell(T,R),e.ensureVisible(T,R),e.startEdit(),u(),o.focusEditInput()}function Yo(s){const m=e.scrollX.value+s.deltaX,C=e.scrollY.value+s.deltaY,T=40,R=o.maxScrollX.value,A=o.maxScrollY.value;if(m>=R-T&&s.deltaX>0||C>=A-T&&s.deltaY>0){const _=Math.max(0,o.viewSize.w-28-11),D=Math.max(0,o.viewSize.h-28-11),z=Math.max(0,Math.ceil((m+_)/100)+2),ae=Math.max(0,Math.ceil((C+D)/24)+2);e.ensureCapacity(z,ae)}o.clampScroll(m,C),u()}function Xo(s){if(s.touches.length!==1){Gt=!1;return}const m=s.touches[0],C=o.canvasRef.value;if(!C)return;const T=C.getBoundingClientRect(),R=m.clientX-T.left,A=m.clientY-T.top,_=m.clientX,D=m.clientY,z=(Me,Qe)=>({clientX:Me,clientY:Qe,preventDefault(){}});{const Me=o.formulaBarRef.value,Qe=!!(Me&&typeof document<"u"&&document.activeElement===Me);(e.editingCell.value||Qe||_e)&&F()}if(zn(R,A)){s.preventDefault();const Me=e.selection.value;Me&&(e.autoFillState.value={active:!0,sourceRange:{...Me},targetRange:null,direction:null,preview:!0},Gt=!0,$t=!1,Pt="cell",bn=R,yn=A,Bn=e.scrollX.value,Tn=e.scrollY.value);return}const ae=et(R,A);if(ae>=0){s.preventDefault(),ut(ae);return}if(A<24&&R>=52){const Me=E(R);if(Me>=0){const Qe=e.cellToScreenRect(0,Me).x+e.colWidths.value[Me];if(Math.abs(R-Qe)<=8){s.preventDefault(),n.saveUndo(),Wt=!0,rn=Me,Vl=e.colWidths.value[Me],Fl=R-52+e.scrollX.value,Gt=!0,$t=!1;return}}}if(R<52&&A>=24){const Me=x(A);if(Me>=0){const Qe=e.cellToScreenRect(Me,0).y+e.getRowHeight(Me);if(Math.abs(A-Qe)<=8){s.preventDefault(),n.saveUndo(),rl=!0,an=Me,Vl=e.getRowHeight(Me),Fl=A-24+e.scrollY.value,Gt=!0,$t=!1;return}}}R>=52&&A>=24?(s.preventDefault(),Gt=!0,$t=!1,Il=!1,Al=!1,Pt="cell",bn=R,yn=A,Bn=e.scrollX.value,Tn=e.scrollY.value,gt=E(R),pt=x(A),Qt!==null&&clearTimeout(Qt),Qt=window.setTimeout(()=>{const Me=e.selection.value;if(!!Me&>>=Me.startCol&><=Me.endCol&&pt>=Me.startRow&&pt<=Me.endRow){Al=!0,Ht(z(_,D),gt,pt);return}Il=!0,ul=gt,fl=pt,gt>=0&&pt>=0&&(e.selectCell(gt,pt),u())},450)):R>=0&&A>=0&&(R<52||A<24)&&(s.preventDefault(),Gt=!0,$t=!1,Il=!1,bn=R,yn=A,Bn=e.scrollX.value,Tn=e.scrollY.value,A<24&&R>=52?(Pt="col",gt=E(R),pt=-1):R<52&&A>=24?(Pt="row",pt=x(A),gt=-1):(Pt="all",gt=-1,pt=-1),(Pt==="col"||Pt==="row"||Pt==="all")&&(Qt!==null&&clearTimeout(Qt),Qt=window.setTimeout(()=>{const Me=e.selection.value;if(Pt==="all"){Al=!0,nl(z(_,D));return}if(Pt==="col"){if(!!Me&&Me.startRow===0&&Me.endRow===e.rowCount-1&>>=Me.startCol&><=Me.endCol){Al=!0,ol(z(_,D),gt);return}Il=!0,ul=gt,fl=-1,gt>=0&&(e.selectRange(gt,0,gt,e.rowCount-1,"col"),u())}else{if(!!Me&&Me.startCol===0&&Me.endCol===e.colCount-1&&pt>=Me.startRow&&pt<=Me.endRow){Al=!0,dl(z(_,D),pt);return}Il=!0,ul=-1,fl=pt,pt>=0&&(e.selectRange(0,pt,e.colCount-1,pt,"row"),u())}},450)))}function xn(s){if(!Gt||s.touches.length!==1)return;const m=s.touches[0],C=o.canvasRef.value;if(!C)return;const T=C.getBoundingClientRect(),R=m.clientX-T.left,A=m.clientY-T.top;if(e.autoFillState.value.active){s.preventDefault(),so(R,A);return}if(Wt){const _=R-52+e.scrollX.value-Fl;let D=Vl+_;D=D<30?30:D>1e3?1e3:D,e.colWidths.value[rn]=D,s.preventDefault(),u();return}if(rl){const _=A-24+e.scrollY.value-Fl;let D=Vl+_;D=D<24?24:D>500?500:D,e.rowHeights.value[an]=D,s.preventDefault(),u();return}if(Il){if(s.preventDefault(),ul>=0&&fl>=0){const _=E(R),D=x(A);_>=0&&D>=0&&(e.selectRange(ul,fl,_,D),u())}else if(fl===-1&&ul>=0){const _=E(R);_>=0&&(e.selectRange(Math.min(ul,_),0,Math.max(ul,_),e.rowCount-1,"col"),u())}else if(ul===-1&&fl>=0){const _=x(A);_>=0&&(e.selectRange(0,Math.min(fl,_),e.colCount-1,Math.max(fl,_),"row"),u())}return}Qt!==null&&(clearTimeout(Qt),Qt=null),(Math.abs(R-bn)>8||Math.abs(A-yn)>8)&&($t=!0,s.preventDefault(),o.clampScroll(Bn+(bn-R),Tn+(yn-A)),u())}function jo(){if(Gt){if(Qt!==null&&(clearTimeout(Qt),Qt=null),Al){Al=!1,Gt=!1;return}if(e.autoFillState.value.active){co(),Gt=!1;return}if(Wt||rl){Wt=!1,rl=!1,o.scheduleOptEmit(),n.paintFmt.value&&n.applyPaintFormat(),Gt=!1;return}if(Il){Il=!1,n.paintFmt.value&&n.applyPaintFormat(),Gt=!1;return}if(Gt=!1,!$t){if(Pt==="cell"&>>=0&&pt>=0){const s=Date.now();gt===Hn&&pt===oo&&s-$n<300?(e.selectCell(gt,pt),e.startEdit(),u(),o.focusEditInput(),$n=0):(e.commitEdit(),e.selectCell(gt,pt),u(),$n=s),Hn=gt,oo=pt,o.focusEditInput()}else Pt==="col"&>>=0?(e.commitEdit(),e.selectRange(gt,0,gt,e.rowCount-1,"col"),u()):Pt==="row"&&pt>=0?(e.commitEdit(),e.selectRange(0,pt,e.colCount-1,pt,"row"),u()):Pt==="all"&&(e.commitEdit(),e.selectAll(),u());n.paintFmt.value&&!e.editingCell.value&&n.applyPaintFormat()}}}function Pn(s){return s.isComposing||s.key==="Process"||s.keyCode===229}function mo(s){return s.key.length===1&&!s.ctrlKey&&!s.metaKey&&!s.altKey}function Un(s){if(e.autoFillState.value.active){s.key==="Escape"&&(s.preventDefault(),Nn(),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1},u());return}if(e.editingCell.value)return;const m=s.ctrlKey||s.metaKey,C=s.shiftKey;switch(!0){case(s.altKey&&s.key==="ArrowDown"):s.preventDefault(),Ie(e.activeCell.value.col,e.activeCell.value.row);return;case(m&&(s.key==="c"||s.key==="C")):s.preventDefault(),l.copyToClipboard();return;case(m&&(s.key==="x"||s.key==="X")):s.preventDefault(),l.cutSelected();return;case(m&&(s.key==="z"||s.key==="Z")):s.preventDefault(),n.undo();return;case(m&&(s.key==="y"||s.key==="Y")):s.preventDefault(),n.redo();return;case(m&&(s.key==="v"||s.key==="V")):s.preventDefault(),n.saveUndo(),l.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>o.emitModelData())});return;case(m&&(s.key==="a"||s.key==="A")):s.preventDefault(),e.selectAll(),u();return;case(m&&C&&(s.key==="l"||s.key==="L")):s.preventDefault(),e.toggleAutoFilter(),u();return;case(m&&s.key==="Home"):s.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),u();return;case(m&&s.key==="End"):s.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),u();return;case s.key==="Home":s.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),u();return;case s.key==="End":s.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),u();return;case s.key==="ArrowUp":s.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="ArrowDown":s.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="ArrowLeft":s.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="ArrowRight":s.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="Tab":s.preventDefault(),e.moveActive(C?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="Enter":s.preventDefault(),e.moveActive(0,C?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="F2":s.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),u(),o.focusEditInput();return;case s.key==="Delete":case s.key==="Backspace":s.preventDefault(),n.saveUndo(),l.clearSelected(),u();return;case s.key==="Escape":s.preventDefault(),e.cancelEdit(),n.paintFmt.value=null,u();return;case mo(s):if(Pn(s)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),u(),o.focusEditInput();return}s.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(s.key),u(),t.nextTick(()=>{const T=o.editInputRef.value;T&&(T.focus(),T.setSelectionRange(1,1))});return}}let Dn=!1,Gl=!1;function Zo(s){const m=s.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(m),X.value=m,u();return}e.editValue.value=m,X.value=m}function Jo(){Dn=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),X.value="",u())}function po(s){Dn=!1,Gl=!0,setTimeout(()=>{Gl=!1},0);const m=s.target.value;e.editValue.value=m,X.value=m}function Qo(s){if(!e.editingCell.value){if(mo(s)||Pn(s))return;Un(s);return}if(!(Dn||Pn(s))&&!(Gl&&(s.key==="Enter"||s.key==="Escape")))if(s.key==="Enter"&&(s.altKey||s.metaKey)){s.preventDefault();const m=o.editInputRef.value;if(!m)return;const C=m.selectionStart??m.value.length,T=m.selectionEnd??m.value.length,R=m.value,A=R.slice(0,C)+`
|
|
9
|
-
`+R.slice(T);e.editValue.value=A,m.value=A,m.selectionStart=m.selectionEnd=C+1,u()}else s.key==="Enter"?(s.preventDefault(),e.commitEdit().then(m=>{if(!m){u(),o.focusEditInput();return}e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u(),o.focusEditInput()})):s.key==="Tab"?(s.preventDefault(),e.commitEdit().then(m=>{if(!m){u(),o.focusEditInput();return}e.moveActive(s.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u(),o.focusEditInput()})):s.key==="Escape"&&(s.preventDefault(),e.cancelEdit(),u(),o.focusEditInput())}function q(s){e.editingCell.value}function p(){setTimeout(()=>{e.isValidationAlertOpen()||e.editingCell.value&&e.commitEdit().then(()=>u())},0)}let v=null;function S(){var m;const s=(m=o.wrapperRef.value)==null?void 0:m.getBoundingClientRect();if(s){const C=hn(e.props.width),T=hn(e.props.height);C!=null?o.viewSize.w=C:o.viewSize.w=s.width,T!=null?o.viewSize.h=T:o.viewSize.h=s.height}o.clampScroll(null,null),u()}function O(){t.onMounted(()=>{const s=hn(e.props.width),m=hn(e.props.height);(s==null||m==null)&&(v=new ResizeObserver(()=>S()),o.wrapperRef.value&&v.observe(o.wrapperRef.value)),t.nextTick(()=>{S(),o.focusEditInput()}),e.selectCell(0,0),o.modelData.value&&o.modelData.value.length>0&&(a.value=JSON.stringify(o.modelData.value),o.sheets.value=o.modelData.value.map(C=>{const T=o.mkSheet(C.name,{colCount:C.colCount,rowCount:C.rowCount}),{cells:R,styles:A}=Pr(C.cells);if(Object.assign(T.cells,R),T.styles=C.styles??A,C.borders)T.borders=C.borders;else{const _=Ur(T.styles);T.styles=_.styles,T.borders=_.borders}if(C.colWidths)for(const[_,D]of Object.entries(C.colWidths)){const z=Number(_);z>=0&&z<(T.colCount??e.colCount)&&D>=30&&(T.colWidths[z]=D)}if(C.rowHeights)for(const[_,D]of Object.entries(C.rowHeights)){const z=Number(_);z>=0&&z<(T.rowCount??e.rowCount)&&D>=24&&(T.rowHeights[z]=D)}if(C.merges)for(const[_,D]of Object.entries(C.merges))T.merges[_]={...D};return T.freeze=C.freeze?{rows:C.freeze.rows,cols:C.freeze.cols}:{rows:0,cols:0},T.filter=ea(C.filter,T.cells),T.dataValidations=Array.isArray(C.dataValidations)?[...C.dataValidations]:[],T}),o.sheets.value.length>0&&o.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const s=hn(e.props.width),m=hn(e.props.height);s!=null&&m!=null?(v==null||v.disconnect(),v=null):!v&&o.wrapperRef.value&&(v=new ResizeObserver(()=>S()),v.observe(o.wrapperRef.value)),t.nextTick(()=>S())}),t.watch(()=>e.props.theme,()=>u()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>o.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>o.emitModelData()),u()},{deep:!1}),t.watch(o.activeSheetIndex,()=>t.nextTick(()=>o.emitModelData())),t.watch(()=>o.modelData.value,s=>{if(!s||s.length===0)return;const m=JSON.stringify(s);if(m===a.value)return;a.value=m;const C=e.selection.value?{...e.selection.value}:null,T={...e.activeCell.value};o.sheets.value=s.map(D=>{const z=o.mkSheet(D.name),{cells:ae,styles:Me}=Pr(D.cells);if(Object.assign(z.cells,ae),z.styles=D.styles??Me,D.borders)z.borders=D.borders;else{const Qe=Ur(z.styles);z.styles=Qe.styles,z.borders=Qe.borders}if(D.colWidths)for(const[Qe,nt]of Object.entries(D.colWidths)){const dt=Number(Qe);dt>=0&&dt<e.colCount&&nt>=30&&(z.colWidths[dt]=nt)}if(D.rowHeights)for(const[Qe,nt]of Object.entries(D.rowHeights)){const dt=Number(Qe);dt>=0&&dt<e.rowCount&&nt>=24&&(z.rowHeights[dt]=nt)}if(D.merges)for(const[Qe,nt]of Object.entries(D.merges))z.merges[Qe]={...nt};return z.freeze=D.freeze?{rows:D.freeze.rows,cols:D.freeze.cols}:{rows:0,cols:0},z.filter=ea(D.filter,z.cells),z.dataValidations=Array.isArray(D.dataValidations)?[...D.dataValidations]:[],z}),o.sheets.value.length>0&&o.loadSheet(0),C&&(e.selection.value=C),e.activeCell.value=T;const R=e.activeCell.value,A=e.selection.value,_=e.findMerge(R.col,R.row);_&&_.anchor===e.cellKey(R.col,R.row)&&(!A||A.startCol===R.col&&A.startRow===R.row&&A.endCol===R.col&&A.endRow===R.row)&&e.selectCell(R.col,R.row),u()},{deep:!0}),t.onBeforeUnmount(()=>{v==null||v.disconnect()})}return{scheduleRender:u,render:Y,renderFrozenOverlay:ne,activeCellLabel:se,formulaBarDisplay:Ne,formulaBarDraft:X,formulaBarExpanded:te,onFormulaBarFocus:ze,onFormulaBarInput:Ve,onFormulaBarKeydown:G,onFormulaBarBlur:Ce,acceptFormulaBarEdit:F,cancelFormulaBarEdit:I,insertFunctionIntoCell:Fe,renTab:$e,renTabVal:j,onTabClick:Be,onTabDblClick:Q,commitTabRename:ke,cclTabRename:B,onTabRenameKd:oe,ctxMenu:Z,ctxSubmenuLeft:Mt,filterPopup:re,isFilterButtonHit:et,openFilterPopup:ut,closeFilterPopup:Pe,validationDropdown:K,isValidationDropdownHit:ve,openValidationDropdown:Ie,closeValidationDropdown:Ee,onValidationDropdownSelect:He,onCtxItemEnter:Ft,onTabCtxMenu:Ot,onTabBarCtx:Dl,onCornerCtx:nl,onRowHdrCtx:dl,onColHdrCtx:ol,onCellCtx:Ht,dimInputRef:vl,dimPanel:zt,openDimPanel:w,onDimInput:be,onDimKeydown:he,onDimBlur:xe,applyDimPanel:we,closeDimPanel:ce,editInputStyle:Ue,hScrollbarW:We,vScrollbarH:V,hScrollbarLeft:le,vScrollbarTop:me,hTrackW:pe,vTrackH:Re,hThumbW:Te,hThumbL:Se,vThumbH:qe,vThumbT:mt,onVStart:kl,onHStart:gn,onSbMove:El,onSbUp:nn,onVTrk:On,onHTrk:Po,onMouseDown:Uo,onMouseMove:Ko,onMouseUp:Go,onMouseLeave:uo,onCanvasCtx:fo,onDblClick:qo,onWheel:Yo,onTouchStart:Xo,onTouchMove:xn,onTouchEnd:jo,onKeydown:Un,onEditInput:Zo,onEditCompositionStart:Jo,onEditCompositionEnd:po,onEditKd:Qo,onEditPaste:q,onEditBlur:p,applySize:S,setupLifecycle:O}}function z0(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ta(e,n,l,o){return n?o?l?e===n:e.toLowerCase()===n.toLowerCase():l?e.includes(n):e.toLowerCase().includes(n.toLowerCase()):!1}function W0(e,n,l,o){if(!n)return e;if(o){const i=e.indexOf(n);return i<0?e:e.slice(0,i)+l+e.slice(i+n.length)}const a=e.toLowerCase().indexOf(n.toLowerCase());return a<0?e:e.slice(0,a)+l+e.slice(a+n.length)}function P0(e,n,l,o){return n?o?e.indexOf(n)<0?e:e.split(n).join(l):e.toLowerCase().indexOf(n.toLowerCase())<0?e:e.replace(new RegExp(z0(n),"gi"),()=>l):e}function Wo(e,n,l,o,a,i,r){const d=[];if(r){for(let f=r.startRow;f<=r.endRow;f++)for(let y=r.startCol;y<=r.endCol;y++){const h=e[l(y,f)];h&&ta(h.value,o,a,i)&&d.push({sheetIndex:n,col:y,row:f})}return d}for(const f in e){const y=e[f];if(y&&ta(y.value,o,a,i)){const h=f.split(","),u=Number(h[0]),E=Number(h[1]);!Number.isNaN(u)&&!Number.isNaN(E)&&d.push({sheetIndex:n,col:u,row:E})}}return d}function U0(e,n,l,o){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),d=t.ref("sheet"),f=t.ref(!1),y=t.ref(!1),h=t.ref(-1),u=t.ref([]),E=t.ref(""),x=t.ref(0),k=t.ref(""),H=t.computed(()=>{const j=new Set,Be=l.activeSheetIndex.value;for(const Q of u.value)Q.sheetIndex===Be&&j.add(`${Q.col},${Q.row}`);return j}),Y=t.computed(()=>{if(h.value<0||h.value>=u.value.length)return null;const j=u.value[h.value];return j.sheetIndex!==l.activeSheetIndex.value?null:`${j.col},${j.row}`});e.findHighlight=(j,Be)=>{const Q=`${j},${Be}`;return Y.value===Q?"active":H.value.has(Q)?"match":null};function ne(j){var ke,B;const Be=e.cellKey(j.col,j.row);if(j.sheetIndex===l.activeSheetIndex.value)return((ke=e.cells[Be])==null?void 0:ke.value)??"";const Q=l.sheets.value[j.sheetIndex];return((B=Q==null?void 0:Q.cells[Be])==null?void 0:B.value)??""}function ee(j,Be){const Q=e.cellKey(j.col,j.row);if(j.sheetIndex===l.activeSheetIndex.value)e.setCellValue(j.col,j.row,Be);else{const ke=l.sheets.value[j.sheetIndex];if(!ke)return;const B=ke.cells[Q];ke.cells[Q]={value:String(Be),styleId:B==null?void 0:B.styleId}}}function M(){if(k.value){E.value=k.value;return}if(!i.value){E.value="";return}if(d.value==="selection"&&!e.selection.value){E.value=b(e.locale.value,"findNeedSelection");return}if(u.value.length===0){E.value=b(e.locale.value,"findNoResult");return}E.value=""}function se(){const j=i.value,Be=[];if(j)if(d.value==="workbook")l.sheets.value.forEach((Q,ke)=>{Be.push(...Wo(Q.cells,ke,e.cellKey,j,f.value,y.value))});else if(d.value==="selection"){const Q=e.selection.value;Q&&Be.push(...Wo(e.cells,l.activeSheetIndex.value,e.cellKey,j,f.value,y.value,Q))}else Be.push(...Wo(e.cells,l.activeSheetIndex.value,e.cellKey,j,f.value,y.value));u.value=Be,Be.length===0?h.value=-1:h.value>=Be.length?h.value=Be.length-1:h.value<0&&(h.value=0),M()}function X(){if(h.value<0||h.value>=u.value.length)return;const j=u.value[h.value];j.sheetIndex!==l.activeSheetIndex.value&&l.switchSheet(j.sheetIndex),d.value==="selection"?e.activeCell.value={col:j.col,row:j.row}:e.selectCell(j.col,j.row),e.ensureVisible(j.col,j.row)}const te=typeof requestAnimationFrame=="function"?requestAnimationFrame:j=>setTimeout(j,16);let Ne=!1,ze=!1;function Ve(j){if(Ne){ze=ze||j;return}Ne=!0,ze=j,te(()=>{var Be;Ne=!1,se(),ze&&u.value.length>0&&h.value>=0&&X(),ze=!1,(Be=e.scheduleRender)==null||Be.call(e)})}function Fe(){var j;a.value=!0,x.value++,se(),u.value.length>0&&(h.value=0,X()),(j=e.scheduleRender)==null||j.call(e)}function je(){Fe()}function _e(){var j;a.value=!1,u.value=[],h.value=-1,k.value="",E.value="",(j=e.scheduleRender)==null||j.call(e)}function F(){var j;u.value.length!==0&&(h.value=(h.value+1)%u.value.length,X(),(j=e.scheduleRender)==null||j.call(e))}function I(){var j;u.value.length!==0&&(h.value=(h.value-1+u.value.length)%u.value.length,X(),(j=e.scheduleRender)==null||j.call(e))}function G(){var B,oe;if(h.value<0||h.value>=u.value.length)return;const j=u.value[h.value],Be=ne(j),Q=W0(Be,i.value,r.value,f.value);if(Q===Be)return;n.saveUndo(),ee(j,Q);const ke=h.value;se(),u.value.length>0?(h.value=Math.min(ke,u.value.length-1),F()):h.value=-1,(B=e.emitModelData)==null||B.call(e),(oe=e.scheduleRender)==null||oe.call(e)}function Ce(){var ke,B;const j=i.value;if(!j||u.value.length===0)return;n.saveUndo();let Be=0;const Q=u.value.slice();for(const oe of Q){const Z=ne(oe),re=P0(Z,j,r.value,f.value);re!==Z&&(ee(oe,re),Be++)}u.value=[],h.value=-1,k.value=b(e.locale.value,"findReplacedAll").replace("{n}",String(Be)),M(),(ke=e.emitModelData)==null||ke.call(e),(B=e.scheduleRender)==null||B.call(e)}function $e(){const j=Be=>{if(!(Be.ctrlKey||Be.metaKey))return;const ke=Be.key.toLowerCase();(ke==="f"||ke==="h")&&(Be.preventDefault(),Fe())};window.addEventListener("keydown",j),t.onBeforeUnmount(()=>window.removeEventListener("keydown",j))}return t.watch(i,()=>{a.value&&(k.value="",h.value=0,Ve(!0))}),t.watch([d,f,y],()=>{a.value&&(k.value="",h.value=0,Ve(!0))}),t.watch(e.cells,()=>{a.value&&Ve(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&d.value==="selection"&&(h.value=0,Ve(!0))}),t.watch([()=>n.undoStack.value.length,()=>n.redoStack.value.length],()=>{a.value&&Ve(!1)}),{open:a,findText:i,replaceText:r,scope:d,matchCase:f,matchEntireCell:y,currentIndex:h,results:u,message:E,focusToken:x,activeSheetMatches:H,activeMatchKey:Y,openFind:Fe,openReplace:je,close:_e,recompute:se,findNext:F,findPrev:I,replace:G,replaceAll:Ce,setupLifecycle:$e}}const K0={class:"formula-bar__cell-label"},G0={class:"formula-bar__buttons"},q0=["title","aria-label"],Y0=["rows","value"],X0=["title"],j0={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Z0={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},J0=["value"],Q0={key:2,class:"sb-corner"},e1=["onClick","onMouseenter"],t1={class:"context-menu__label"},l1={key:0,class:"context-menu__arrow",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"22869"},n1=["onClick"],o1={key:0,class:"cf-modal-mask"},r1={class:"dim-panel__title"},a1={class:"dim-panel__body"},i1=["value"],s1={key:0,class:"dim-panel__error"},c1={class:"dim-panel__footer"},la=St(t.defineComponent({__name:"spreader",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const n=e,l=t.useModel(e,"data"),o={value:""},a=B0(n,{rowCount:n.rowCount,colCount:n.colCount,theme:n.theme,locale:n.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:g=>{},mkSheet:g=>({id:"",name:g,cells:{},merges:{},styles:[{}],borders:[{}],selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[],colCount:0,rowCount:0,freeze:{rows:0,cols:0},filter:null,conditionalFormats:[],dataValidations:[]})},r=T0(a,i),d=x0(a,r);N0(r,{borderMenuOpen:d.borderMenuOpen,mergeMenuOpen:d.mergeMenuOpen});const f=$0(a,r,l,void 0,o);i.sheets=f.sheets,i.activeSheetIndex=f.activeSheetIndex,i.saveSheet=f.saveSheet,i.loadSheet=f.loadSheet,i.mkSheet=f.mkSheet;const y=H0(a,r,d,f,o);y.setupLifecycle();const h=U0(a,r,f);h.setupLifecycle();const u=t.reactive(a),E=t.reactive(r),x=t.reactive(d),k=t.reactive(f),H=f.sheets,Y=f.activeSheetIndex,ne=f.sortMenuOpen,ee=f.cachedSortOrder,M=t.reactive(y),se=t.reactive(h),X=t.computed(()=>{const g=u.selection;return!!g&&g.startCol===g.endCol&&g.startRow===g.endRow}),te=t.computed(()=>{const g=u.selection;return g?f.canSortColumns(g.startCol,g.endCol):!1}),Ne=t.computed(()=>{if(u.getFilter()!==null)return!0;const g=u.selection;if(!g)return!0;const c=Math.min(g.startCol,g.endCol),w=Math.max(g.startCol,g.endCol),be=Math.min(g.startRow,g.endRow),he=Math.max(g.startRow,g.endRow);for(const xe in u.merges){const we=u.merges[xe];if(!(we.startCol===we.endCol&&we.startRow===we.endRow)&&c<=we.endCol&&w>=we.startCol&&be<=we.endRow&&he>=we.startRow)return!1}return!0}),ze=t.computed(()=>{const g=E.selNumberFormat;if(g!==Tl&&g!==Wl)return g;const c=u.activeCell,w=a.resolveStyle(u.cells[u.cellKey(c.col,c.row)]);return typeof(w==null?void 0:w.numberFormat)=="string"?w.numberFormat:""});function Ve(g){r.nfDialogOpen.value=g}const Fe=t.ref(!1);function je(){Fe.value=!0}function _e(g){Fe.value=g}function F(g){y.insertFunctionIntoCell(g)}function I(){u.toggleAutoFilter(),M.scheduleRender()}function G(g){const c=u.getFilter();return c?u.getCellValue(g,c.range.startRow):""}const Ce=t.computed(()=>{const g=u.selection,c=g?g.startRow:u.activeCell.row,w=g?g.startCol:u.activeCell.col;return c===0&&w===0});function $e(g){const c=u.freeze;if(g==="panes"){const w=u.selection,be=w?w.startRow:u.activeCell.row,he=w?w.startCol:u.activeCell.col;u.setFreeze(be,he)}else g==="firstRow"?u.setFreeze(1,c.cols):g==="firstCol"?u.setFreeze(c.rows,1):g==="unfreeze"&&u.clearFreeze();M.scheduleRender()}const j=t.ref(null),Be=t.ref(!1),Q=t.ref(!1),ke=t.ref(null),B=t.ref("create"),oe=t.computed(()=>{const g=u.selection;if(g){const w=lt(g.startCol)+(g.startRow+1),be=lt(g.endCol)+(g.endRow+1);return g.startCol===g.endCol&&g.startRow===g.endRow?w:`${w}:${be}`}const c=u.activeCell;return lt(c.col)+(c.row+1)});function Z(g){var be;let c;["equal","notEqual","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","notBetween"].includes(g)?c={type:"cellIs",operator:g,value:""}:g==="textContains"?c={type:"textContains",value:""}:g==="textNotContains"?c={type:"textNotContains",value:""}:g==="blank"?c={type:"blank"}:g==="notBlank"?c={type:"notBlank"}:g==="duplicate"?c={type:"duplicate"}:g==="unique"?c={type:"unique"}:c={type:"cellIs",operator:"greaterThan",value:""},ke.value={id:"",condition:c,format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},B.value="create",(be=j.value)==null||be.closeOverflow(),Q.value=!0}function re(){var g;ke.value={id:"",condition:{type:"cellIs",operator:"greaterThan",value:""},format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},B.value="create",(g=j.value)==null||g.closeOverflow(),Q.value=!0}function K(){var g;(g=j.value)==null||g.closeOverflow(),Be.value=!0}function L(g){u.clearConditionalFormats(g),M.scheduleRender()}function J(g){g.id?u.updateConditionalFormatRule(g.id,g):u.addConditionalFormatRule(g),Q.value=!1}function $(g){var c;ke.value=g,B.value="edit",(c=j.value)==null||c.closeOverflow(),Q.value=!0}function U(g){u.removeConditionalFormatRule(g)}function de(g,c){u.moveConditionalFormatRule(g,c)}function Le(g,c){u.updateConditionalFormatRule(g,{enabled:c})}const ve=t.ref(!1),Ie=t.ref(null),Ee=t.ref("create"),He=t.computed(()=>{const g=u.selection;if(g){const w=lt(g.startCol)+(g.startRow+1),be=lt(g.endCol)+(g.endRow+1);return g.startCol===g.endCol&&g.startRow===g.endRow?w:`${w}:${be}`}const c=u.activeCell;return lt(c.col)+(c.row+1)}),ge=t.ref(null);let et=null;function ut(g){return new Promise(c=>{et=c,ge.value={...g}})}a.showValidationAlert=ut,a.getSheetCellsById=g=>{const c=f.sheets.value.findIndex(w=>w.id===g||w.name===g);return c<0?null:c===f.activeSheetIndex.value?a.cells:f.sheets.value[c].cells},a.requestDataValidationDialog=()=>Pe();function Pe(){var w;const g=u.activeCell,c=a.getDataValidationRule(g.row,g.col);Ie.value=c?JSON.parse(JSON.stringify(c)):null,Ee.value=c?"edit":"create",(w=j.value)==null||w.closeOverflow(),ve.value=!0}function N(g){if(g.type==="any"){g.ranges.forEach(c=>a.clearDataValidation(c)),ve.value=!1,y.scheduleRender();return}g.id?a.updateDataValidation(g.id,g):a.createDataValidation(g),ve.value=!1,y.scheduleRender()}function ie(){const g=u.selection;g&&a.clearDataValidation(g),ve.value=!1,y.scheduleRender()}function Rt(g){ge.value=null;const c=et;et=null,t.nextTick(()=>{const w=u.editingCell;w&&(a.selectCell(w.col,w.row),a.ensureVisible(w.col,w.row),y.scheduleRender(),f.focusEditInput())}),c==null||c(g)}const ft=t.computed(()=>{const g=u.activeCell,c=a.getValidationInputMessage(g.row,g.col);if(!c)return null;const w=a.cellToScreenRect(g.row,g.col),be=f.wrapperRef.value,he=be?be.getBoundingClientRect():{left:0,top:0};return{title:c.title,message:c.message,x:he.left+w.x,y:he.top+w.y,width:w.width,height:w.height}});function Mt(g){r.fontSizeMenuOpen.value=g}function Ft(g){r.textColorMenuOpen.value=g}function It(g){r.fillColorMenuOpen.value=g}function Ot(g){y.renTabVal.value=g}function Dl(){y.ctxMenu.value=null}const nl=g=>{f.formulaBarRef.value=g};function dl(){y.formulaBarExpanded.value=!y.formulaBarExpanded.value}const ol=g=>{f.wrapperRef.value=g},Ht=g=>{f.canvasRef.value=g},vl=g=>{f.freezeCanvasRef.value=g},zt=g=>{f.editInputRef.value=g},W=g=>{y.dimInputRef.value=g};return(g,c)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(k.outerStyle)},[t.createVNode(wc,{ref_key:"toolbarRef",ref:j,locale:u.locale,"can-undo":E.canUndo,"can-redo":E.canRedo,"paint-fmt-active":E.paintFmt!==null,"has-selection":E.hasSelection,"font-family-options":E.fontFamilyOptions,"font-size-options":E.fontSizeOptions,"sel-font-family":E.selFontFamily,"sel-font-size":E.selFontSize,"font-size-input":E.fontSizeInput,"font-size-menu-open":E.fontSizeMenuOpen,"sel-font-weight":E.selFontWeight,"sel-font-style":E.selFontStyle,"sel-underline":E.selUnderline,"sel-strikethrough":E.selStrikethrough,"sel-text-color":E.selTextColor,"text-color-menu-open":E.textColorMenuOpen,"sel-fill-color":E.selFillColor,"fill-color-menu-open":E.fillColorMenuOpen,"cached-text-color":E.cachedTextColor,"cached-fill-color":E.cachedFillColor,"border-menu-open":x.borderMenuOpen,"cached-border":x.cachedBorder,"sort-menu-open":t.unref(ne),"cached-sort-order":t.unref(ee),"can-sort":te.value,"can-filter":Ne.value,"filter-active":u.getFilter()!==null,"h-align-options":E.hAlignOptions,"v-align-options":E.vAlignOptions,"sel-h-align":E.selHAlign,"sel-v-align":E.selVAlign,"sel-wrap":E.selWrap,"merge-menu-open":x.mergeMenuOpen,"calc-menu-open":x.calcMenuOpen,"is-single-cell":X.value,"has-freeze":u.freeze.rows>0||u.freeze.cols>0,"freeze-panes-disabled":Ce.value,"sel-number-format":E.selNumberFormatDisplay,"nf-options":E.nfOptions,"can-increase-decimals":E.canIncreaseDecimals,"can-decrease-decimals":E.canDecreaseDecimals,"theme-vars":k.toolbarThemeVars,onUndo:c[0]||(c[0]=w=>E.undo()),onRedo:c[1]||(c[1]=w=>E.redo()),onPaintFormat:E.onPaintFormat,onClearFormat:c[2]||(c[2]=w=>E.clearFormat()),onNumberFormatChange:c[3]||(c[3]=w=>E.onNumberFormatChange(w)),onIncreaseDecimals:E.onIncreaseDecimals,onDecreaseDecimals:E.onDecreaseDecimals,onFontFamilyChange:c[4]||(c[4]=w=>E.onFontFamilyChange(w)),onFontSizeInput:c[5]||(c[5]=w=>E.onFontSizeInput(w)),onFontSizeBlur:E.onFontSizeBlur,onFontSizeKeydown:c[6]||(c[6]=w=>E.onFontSizeKeydown(w)),onFontSizeChange:c[7]||(c[7]=w=>E.onFontSizeChange(w)),"onUpdate:fontSizeMenuOpen":c[8]||(c[8]=w=>Mt(w)),onFontSizeToggle:c[9]||(c[9]=w=>E.toggleFontSizeMenu()),onFontSizeStepUp:E.onFontSizeStepUp,onFontSizeStepDown:E.onFontSizeStepDown,onBoldToggle:E.toggleFontWeight,onItalicToggle:E.toggleFontStyle,onUnderlineToggle:E.toggleUnderline,onStrikethroughToggle:E.toggleStrikethrough,onTextColorChange:c[10]||(c[10]=w=>E.onTextColorChange(w)),"onUpdate:textColorMenuOpen":c[11]||(c[11]=w=>Ft(w)),onFillColorChange:c[12]||(c[12]=w=>E.onFillColorChange(w)),"onUpdate:fillColorMenuOpen":c[13]||(c[13]=w=>It(w)),onApplyTextColor:E.applyCachedTextColor,onApplyFillColor:E.applyCachedFillColor,"onUpdate:borderMenuOpen":c[14]||(c[14]=w=>E.onBorderMenuToggle(w)),onBorderChange:c[15]||(c[15]=w=>x.onBorderChange(w)),onApplyBorder:x.applyCachedBorder,"onUpdate:sortMenuOpen":c[16]||(c[16]=w=>k.onSortMenuToggle(w)),onSortChange:c[17]||(c[17]=w=>k.onSortChange(w)),onApplySort:k.applyCachedSort,onToggleFilter:I,onFreezeChange:c[18]||(c[18]=w=>$e(w)),onHAlignChange:c[19]||(c[19]=w=>E.onHAlignChange(w)),onVAlignChange:c[20]||(c[20]=w=>E.onVAlignChange(w)),onWrapToggle:E.onWrapToggle,"onUpdate:mergeMenuOpen":c[21]||(c[21]=w=>x.onMergeMenuToggle(w)),onMergeChange:c[22]||(c[22]=w=>x.onMergeChange(w)),onApplyMerge:x.onApplyMerge,"onUpdate:calcMenuOpen":c[23]||(c[23]=w=>x.onCalcMenuToggle(w)),onCalcSum:x.onCalcSum,onCalcAvg:x.onCalcAvg,onCalcCount:x.onCalcCount,onFind:c[24]||(c[24]=w=>t.unref(h).openFind()),onCfPreset:c[25]||(c[25]=w=>Z(w)),onCfNewRule:re,onCfManage:K,onCfClear:c[26]||(c[26]=w=>L(w)),onOpenDataValidation:Pe},null,8,["locale","can-undo","can-redo","paint-fmt-active","has-selection","font-family-options","font-size-options","sel-font-family","sel-font-size","font-size-input","font-size-menu-open","sel-font-weight","sel-font-style","sel-underline","sel-strikethrough","sel-text-color","text-color-menu-open","sel-fill-color","fill-color-menu-open","cached-text-color","cached-fill-color","border-menu-open","cached-border","sort-menu-open","cached-sort-order","can-sort","can-filter","filter-active","h-align-options","v-align-options","sel-h-align","sel-v-align","sel-wrap","merge-menu-open","calc-menu-open","is-single-cell","has-freeze","freeze-panes-disabled","sel-number-format","nf-options","can-increase-decimals","can-decrease-decimals","theme-vars","onPaintFormat","onIncreaseDecimals","onDecreaseDecimals","onFontSizeBlur","onFontSizeStepUp","onFontSizeStepDown","onBoldToggle","onItalicToggle","onUnderlineToggle","onStrikethroughToggle","onApplyTextColor","onApplyFillColor","onApplyBorder","onApplySort","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg","onCalcCount"]),t.createVNode(Xc,{open:se.open,"find-text":se.findText,"replace-text":se.replaceText,scope:se.scope,"match-case":se.matchCase,"match-entire-cell":se.matchEntireCell,"current-index":se.currentIndex,total:se.results.length,message:se.message,"focus-token":se.focusToken,locale:u.locale,"theme-vars":k.toolbarThemeVars,"onUpdate:findText":c[27]||(c[27]=w=>t.unref(h).findText.value=w),"onUpdate:replaceText":c[28]||(c[28]=w=>t.unref(h).replaceText.value=w),"onUpdate:scope":c[29]||(c[29]=w=>t.unref(h).scope.value=w),"onUpdate:matchCase":c[30]||(c[30]=w=>t.unref(h).matchCase.value=w),"onUpdate:matchEntireCell":c[31]||(c[31]=w=>t.unref(h).matchEntireCell.value=w),onPrev:c[32]||(c[32]=w=>t.unref(h).findPrev()),onNext:c[33]||(c[33]=w=>t.unref(h).findNext()),onReplace:c[34]||(c[34]=w=>t.unref(h).replace()),onReplaceAll:c[35]||(c[35]=w=>t.unref(h).replaceAll()),onClose:c[36]||(c[36]=w=>t.unref(h).close())},null,8,["open","find-text","replace-text","scope","match-case","match-entire-cell","current-index","total","message","focus-token","locale","theme-vars"]),t.createVNode(kd,{"model-open":E.nfDialogOpen,locale:u.locale,"current-format":ze.value,"is-custom":E.selNumberFormat===t.unref(Wl),"onUpdate:modelOpen":c[37]||(c[37]=w=>Ve(w)),onApply:c[38]||(c[38]=w=>E.applyNumberFormatCode(w))},null,8,["model-open","locale","current-format","is-custom"]),t.createVNode(Dd,{"model-open":k.sortConfirmOpen,locale:u.locale,"onUpdate:modelOpen":c[39]||(c[39]=w=>k.sortConfirmOpen=w),onConfirm:c[40]||(c[40]=w=>k.confirmSort(w)),onCancel:c[41]||(c[41]=w=>k.cancelSortConfirmation())},null,8,["model-open","locale"]),t.createVNode(Xd,{"model-open":Fe.value,locale:u.locale,"onUpdate:modelOpen":c[42]||(c[42]=w=>_e(w)),onInsert:c[43]||(c[43]=w=>F(w))},null,8,["model-open","locale"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":M.formulaBarExpanded}])},[t.createElementVNode("div",K0,t.toDisplayString(M.activeCellLabel),1),t.createElementVNode("div",G0,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:c[44]||(c[44]=t.withModifiers(()=>{},["prevent"])),onClick:c[45]||(c[45]=t.withModifiers((...w)=>M.cancelFormulaBarEdit&&M.cancelFormulaBarEdit(...w),["stop"]))},[...c[105]||(c[105]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 3l8 8M11 3l-8 8",fill:"none",stroke:"#e53935","stroke-width":"1.8","stroke-linecap":"round"})],-1)])],32),t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--accept",title:"接受(Enter)","aria-label":"接受",onMousedown:c[46]||(c[46]=t.withModifiers(()=>{},["prevent"])),onClick:c[47]||(c[47]=t.withModifiers((...w)=>M.acceptFormulaBarEdit&&M.acceptFormulaBarEdit(...w),["stop"]))},[...c[106]||(c[106]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M2.5 7.5l3.5 3.5L12 3.5",fill:"none",stroke:"#2e7d32","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],32),t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--fx",title:t.unref(b)(u.locale,"insertFunctionTitle"),"aria-label":t.unref(b)(u.locale,"insertFunctionTitle"),onMousedown:c[48]||(c[48]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(je,["stop"])},[...c[107]||(c[107]=[t.createElementVNode("span",{class:"formula-bar__fx-label"},"fx",-1)])],40,q0)]),t.createElementVNode("textarea",{ref:nl,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":M.formulaBarExpanded}]),rows:M.formulaBarExpanded?3:1,value:M.formulaBarDisplay,spellcheck:"false",onFocus:c[49]||(c[49]=(...w)=>M.onFormulaBarFocus&&M.onFormulaBarFocus(...w)),onInput:c[50]||(c[50]=(...w)=>M.onFormulaBarInput&&M.onFormulaBarInput(...w)),onKeydown:c[51]||(c[51]=(...w)=>M.onFormulaBarKeydown&&M.onFormulaBarKeydown(...w)),onBlur:c[52]||(c[52]=(...w)=>M.onFormulaBarBlur&&M.onFormulaBarBlur(...w))},null,42,Y0),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:M.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:c[53]||(c[53]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(dl,["stop"])},[M.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",Z0,[...c[109]||(c[109]=[t.createElementVNode("path",{d:"M2 8l4-4 4 4",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",j0,[...c[108]||(c[108]=[t.createElementVNode("path",{d:"M2 4l4 4 4-4",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))],40,X0)],2),t.createElementVNode("div",{ref:ol,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:Ht,class:"grid-canvas",tabindex:"0",onMousedown:c[54]||(c[54]=(...w)=>M.onMouseDown&&M.onMouseDown(...w)),onMousemove:c[55]||(c[55]=(...w)=>M.onMouseMove&&M.onMouseMove(...w)),onMouseup:c[56]||(c[56]=(...w)=>M.onMouseUp&&M.onMouseUp(...w)),onMouseleave:c[57]||(c[57]=(...w)=>M.onMouseLeave&&M.onMouseLeave(...w)),onDblclick:c[58]||(c[58]=(...w)=>M.onDblClick&&M.onDblClick(...w)),onWheel:c[59]||(c[59]=t.withModifiers((...w)=>M.onWheel&&M.onWheel(...w),["prevent"])),onFocus:c[60]||(c[60]=(...w)=>k.onCanvasFocus&&k.onCanvasFocus(...w)),onKeydown:c[61]||(c[61]=(...w)=>M.onKeydown&&M.onKeydown(...w)),onContextmenu:c[62]||(c[62]=(...w)=>M.onCanvasCtx&&M.onCanvasCtx(...w)),onTouchstart:c[63]||(c[63]=t.withModifiers((...w)=>M.onTouchStart&&M.onTouchStart(...w),["prevent"])),onTouchmove:c[64]||(c[64]=t.withModifiers((...w)=>M.onTouchMove&&M.onTouchMove(...w),["prevent"])),onTouchend:c[65]||(c[65]=(...w)=>M.onTouchEnd&&M.onTouchEnd(...w))},null,32),t.createElementVNode("canvas",{ref:vl,class:"grid-canvas grid-canvas--freeze","aria-hidden":"true"}),t.createElementVNode("textarea",{ref:zt,class:"cell-editor",value:u.editValue,style:t.normalizeStyle(M.editInputStyle),onInput:c[66]||(c[66]=(...w)=>M.onEditInput&&M.onEditInput(...w)),onKeydown:c[67]||(c[67]=(...w)=>M.onEditKd&&M.onEditKd(...w)),onCompositionstart:c[68]||(c[68]=(...w)=>M.onEditCompositionStart&&M.onEditCompositionStart(...w)),onCompositionend:c[69]||(c[69]=(...w)=>M.onEditCompositionEnd&&M.onEditCompositionEnd(...w)),onBlur:c[70]||(c[70]=(...w)=>M.onEditBlur&&M.onEditBlur(...w)),onPaste:c[71]||(c[71]=(...w)=>M.onEditPaste&&M.onEditPaste(...w))},null,44,J0),k.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:M.vScrollbarTop+"px",height:`calc(100% - ${M.vScrollbarTop+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:c[72]||(c[72]=t.withModifiers(w=>{k.clampScroll(null,u.scrollY-50),M.scheduleRender()},["prevent"]))},[...c[110]||(c[110]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:c[74]||(c[74]=(...w)=>M.onVTrk&&M.onVTrk(...w))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:M.vThumbT+"px",height:M.vThumbH+"px"}),onMousedown:c[73]||(c[73]=(...w)=>M.onVStart&&M.onVStart(...w))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:c[75]||(c[75]=t.withModifiers(w=>{k.clampScroll(null,u.scrollY+50),M.scheduleRender()},["prevent"]))},[...c[111]||(c[111]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),k.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:M.hScrollbarLeft+"px",width:`calc(100% - ${M.hScrollbarLeft+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:c[76]||(c[76]=t.withModifiers(w=>{k.clampScroll(u.scrollX-50,null),M.scheduleRender()},["prevent"]))},[...c[112]||(c[112]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:c[78]||(c[78]=(...w)=>M.onHTrk&&M.onHTrk(...w))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:M.hThumbL+"px",width:M.hThumbW+"px"}),onMousedown:c[77]||(c[77]=(...w)=>M.onHStart&&M.onHStart(...w))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:c[79]||(c[79]=t.withModifiers(w=>{k.clampScroll(u.scrollX+50,null),M.scheduleRender()},["prevent"]))},[...c[113]||(c[113]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),k.maxScrollX>0&&k.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",Q0)):t.createCommentVNode("",!0)]),t.createVNode(Fc,{locale:u.locale,sheets:t.unref(H),"active-sheet-index":t.unref(Y),"ren-tab":M.renTab,"ren-tab-val":M.renTabVal,onTabClick:c[80]||(c[80]=w=>M.onTabClick(w)),onTabDblclick:c[81]||(c[81]=w=>M.onTabDblClick(w)),onTabContextmenu:c[82]||(c[82]=w=>M.onTabCtxMenu(w.ev,w.i)),onTabRenameInput:c[83]||(c[83]=w=>Ot(w)),onTabRenameKeydown:c[84]||(c[84]=w=>M.onTabRenameKd(w)),onTabRenameCommit:M.commitTabRename,onTabbarContextmenu:c[85]||(c[85]=w=>M.onTabBarCtx(w)),onDeleteSheet:c[86]||(c[86]=w=>{k.removeSheet(w),M.scheduleRender()}),onAddSheet:c[87]||(c[87]=w=>{k.addSheet(),M.scheduleRender()})},null,8,["locale","sheets","active-sheet-index","ren-tab","ren-tab-val","onTabRenameCommit"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[M.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:M.ctxMenu.x+"px",top:M.ctxMenu.y+"px"}),onClick:c[88]||(c[88]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(M.ctxMenu.items,(w,be)=>(t.openBlock(),t.createElementBlock("div",{key:be,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":w.disabled}]),onClick:he=>!w.disabled&&w.action&&(w.action(),Dl()),onMouseenter:he=>M.onCtxItemEnter(he,w)},[t.createElementVNode("span",t1,t.toDisplayString(w.label),1),w.children?(t.openBlock(),t.createElementBlock("svg",l1,[...c[114]||(c[114]=[t.createElementVNode("path",{d:"M361.386667 180.053333a32 32 0 0 0 0 45.226667L648.106667 512l-286.72 286.72a32 32 0 1 0 45.226666 45.226667l309.333334-309.333334a32 32 0 0 0 0-45.226666L406.613333 180.053333a32 32 0 0 0-45.226666 0z","p-id":"22870"},null,-1)])])):t.createCommentVNode("",!0),w.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":M.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.children,(he,xe)=>(t.openBlock(),t.createElementBlock("div",{key:xe,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":he.disabled}]),onClick:t.withModifiers(we=>!he.disabled&&he.action&&(he.action(),Dl()),["stop"])},t.toDisplayString(he.label),11,n1))),128))],2)):t.createCommentVNode("",!0)],42,e1))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),M.filterPopup?(t.openBlock(),t.createBlock(wu,{key:M.filterPopup.col,col:M.filterPopup.col,"header-label":G(M.filterPopup.col),anchor:{x:M.filterPopup.x,y:M.filterPopup.y},locale:u.locale,"get-filter":u.getFilter,"set-filter":u.setFilter,"set-filter-column":u.setFilterColumn,"clear-filter-column":u.clearFilterColumn,"get-column-candidates":u.getColumnCandidates,close:M.closeFilterPopup},null,8,["col","header-label","anchor","locale","get-filter","set-filter","set-filter-column","clear-filter-column","get-column-candidates","close"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[Be.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:c[90]||(c[90]=t.withModifiers(w=>Be.value=!1,["self"]))},[t.createVNode(_u,{locale:u.locale,rules:u.conditionalFormats,"theme-vars":k.toolbarThemeVars,onNew:re,onEdit:$,onDelete:U,onMove:de,onToggle:Le,onClose:c[89]||(c[89]=w=>Be.value=!1)},null,8,["locale","rules","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[Q.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:c[92]||(c[92]=t.withModifiers(w=>Q.value=!1,["self"]))},[t.createVNode(Ef,{locale:u.locale,mode:B.value,rule:ke.value,"default-range-text":oe.value,"theme-vars":k.toolbarThemeVars,onSave:J,onCancel:c[91]||(c[91]=w=>Q.value=!1)},null,8,["locale","mode","rule","default-range-text","theme-vars"])])):t.createCommentVNode("",!0)])),M.validationDropdown?(t.openBlock(),t.createBlock(Am,{key:`${M.validationDropdown.col},${M.validationDropdown.row}`,items:M.validationDropdown.items,current:M.validationDropdown.current,locale:u.locale,x:M.validationDropdown.x,y:M.validationDropdown.y,width:M.validationDropdown.width,height:M.validationDropdown.height,onSelect:c[93]||(c[93]=w=>t.unref(y).onValidationDropdownSelect(w)),onClose:c[94]||(c[94]=w=>t.unref(y).closeValidationDropdown())},null,8,["items","current","locale","x","y","width","height"])):t.createCommentVNode("",!0),ft.value?(t.openBlock(),t.createBlock(qm,{key:2,title:ft.value.title,message:ft.value.message,x:ft.value.x,y:ft.value.y,width:ft.value.width,height:ft.value.height},null,8,["title","message","x","y","width","height"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[ve.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:c[96]||(c[96]=t.withModifiers(w=>ve.value=!1,["self"]))},[t.createVNode(Mm,{locale:u.locale,mode:Ee.value,rule:Ie.value,"default-range-text":He.value,"theme-vars":k.toolbarThemeVars,onSave:N,onClear:ie,onCancel:c[95]||(c[95]=w=>ve.value=!1)},null,8,["locale","mode","rule","default-range-text","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[ge.value?(t.openBlock(),t.createElementBlock("div",o1,[t.createVNode(Um,{locale:u.locale,severity:ge.value.severity,title:ge.value.title,message:ge.value.message,"theme-vars":k.toolbarThemeVars,onResolve:Rt},null,8,["locale","severity","title","message","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[M.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:M.dimPanel.x+"px",top:M.dimPanel.y+"px"}),onMousedown:c[102]||(c[102]=t.withModifiers(()=>{},["stop"])),onTouchstart:c[103]||(c[103]=t.withModifiers(()=>{},["stop"])),onClick:c[104]||(c[104]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",r1,t.toDisplayString(M.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",a1,[t.createElementVNode("input",{ref:W,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":M.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:M.dimPanel.value,onInput:c[97]||(c[97]=(...w)=>M.onDimInput&&M.onDimInput(...w)),onKeydown:c[98]||(c[98]=(...w)=>M.onDimKeydown&&M.onDimKeydown(...w)),onBlur:c[99]||(c[99]=(...w)=>M.onDimBlur&&M.onDimBlur(...w))},null,42,i1)]),M.dimPanel.error?(t.openBlock(),t.createElementBlock("div",s1,t.toDisplayString(M.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",c1,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:c[100]||(c[100]=(...w)=>M.applyDimPanel&&M.applyDimPanel(...w))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:c[101]||(c[101]=(...w)=>M.closeDimPanel&&M.closeDimPanel(...w))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-5417998d"]]);Ql.Spreader=la,Ql.default=la,Object.defineProperties(Ql,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(hn,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(hn=typeof globalThis<"u"?globalThis:hn||self,t(hn.XiaoDaoSpreader={},hn.Vue))})(this,function(hn,t){"use strict";const Ka={"zh-CN":{insert:"插入",delete:"删除",rename:"重命名",moveLeft:"左移",moveRight:"右移",cut:"剪切",copy:"复制",paste:"粘贴",addSheet:"新建工作表",sheetList:"工作表列表",moveSheetLeft:"左移",moveSheetRight:"右移",scrollUp:"向上滚动",scrollDown:"向下滚动",scrollLeft:"向左滚动",scrollRight:"向右滚动",calculate:"计算",sum:"求和",avg:"平均值",count:"计数",undo:"撤销",redo:"重做",paintFormat:"格式刷",clearFormat:"清除格式",fontFamily:"字体",fontSize:"字号",fontSizeIncrease:"增大字号",fontSizeDecrease:"减小字号",bold:"加粗",italic:"斜体",underline:"下划线",strikethrough:"删除线",fontColor:"文字颜色",fillColor:"填充颜色",borders:"边框",hAlign:"水平对齐",vAlign:"垂直对齐",alignLeft:"左端对齐",alignCenter:"居中对齐",alignRight:"右端对齐",alignTop:"顶端对齐",alignMiddle:"垂直居中",alignBottom:"底端对齐",wrap:"自动换行",mergeCells:"合并单元格",mergeCenter:"合并后居中",mergeAcross:"跨越合并",unmergeCells:"取消合并单元格",borderBottom:"下框线",borderTop:"上框线",borderLeft:"左框线",borderRight:"右框线",borderNone:"无框线",borderAll:"所有框线",borderOuter:"外框线",borderThickOuter:"粗外框线",fontDefault:"默认",rowHeight:"行高",colWidth:"列宽",autoRowHeight:"自动行高",defaultColWidth:"默认列宽",sort:"排序",sortAsc:"升序排序",sortDesc:"降序排序",sortReminderTitle:"排序提醒",sortReminderMessage:"选定区域的左侧或右侧还有相邻数据,这些数据未被选中,将不参与排序。是否将其一并纳入排序?",sortExpandSelection:"扩展选定区域",sortCurrentSelection:"仅对选定区域排序",insertFunctionTitle:"插入函数",insertFunctionSelectLabel:"函数",insertFunctionPlaceholder:"请选择函数",insertFunctionSearchPlaceholder:"搜索函数",insertFunctionFormulaLabel:"公式",insertFunctionBtn:"插入",fnDescSum:"计算单元格区域中所有数值的和",fnDescAverage:"计算单元格区域中数值的算术平均值",fnDescCount:"统计单元格区域中包含数值的单元格个数",fnDescIf:"根据指定条件判断真假,返回对应的两个值之一",fnDescVlookup:"在区域首列查找指定值,返回同一行中指定列的值",fnDescConcatenate:"将多个文本连接合并为一个文本",fnDescMax:"返回单元格区域中所有数值的最大值",fnDescMin:"返回单元格区域中所有数值的最小值",fnDescSin:"返回给定角度(弧度)的正弦值",fnDescSumif:"对区域中满足指定条件的单元格对应的数值求和",fnDescPmt:"计算基于固定利率及等额分期付款的贷款每期还款额",fnDescStdev:"估算基于样本的标准偏差(忽略文本与逻辑值)",ok:"确定",cancel:"取消",dimNumberError:"请输入数字",dimRangeError:"请输入 {min}~{max} 之间的数值",colorAutomatic:"自动",colorNoFill:"无填充",colorWhite:"白色",colorBlack:"黑色",colorLightGray:"浅灰",colorLightBlue:"浅蓝",colorLightOrange:"浅橙",colorLightYellow:"浅黄",colorLightGreen:"浅绿",colorPaleBlue:"淡蓝",colorPaleOrange:"淡橙",colorPaleYellow:"淡黄",colorPaleGreen:"淡绿",colorSilver:"银色",colorSkyBlue:"天蓝",colorCoral:"珊瑚",colorGold:"金色",colorMint:"薄荷",colorGray:"灰色",colorMediumBlue:"中蓝",colorOrange:"橙色",colorAmber:"琥珀",colorMediumGreen:"中绿",colorDarkGray:"深灰",colorRoyalBlue:"宝蓝",colorRed:"红色",colorDarkGold:"深金",colorDarkGreen:"深绿",colorCharcoal:"炭灰",colorDeepBlue:"深蓝",colorDarkRed:"深红",colorOlive:"橄榄",colorForest:"森林",colorSlate:"石板灰",colorNavy:"藏青",colorCrimson:"绯红",colorDarkOlive:"深橄榄",colorDeepForest:"深林",colorDarkSlate:"深石板灰",colorMidnight:"午夜蓝",colorMaroon:"栗色",colorCoffee:"咖啡色",colorEvergreen:"常青",colorDarkNavy:"深藏青",colorDarkMaroon:"深栗",colorDarkCoffee:"深咖",colorInkGreen:"墨绿",numberFormat:"数字格式",nfGeneral:"常规",nfText:"文本",nfNumber:"数字",nfPercent:"百分比",nfScientific:"科学计数法",nfAccounting:"会计专用",nfFinancial:"财务数值",nfCurrency:"货币",nfCurrencyRounded:"货币取整",nfDate:"日期",nfTime:"时间",nfDateTime:"日期和时间",nfDuration:"持续时间",nfCustom:"其他数字格式…",nfMixed:"混合",nfIncreaseDecimals:"增加小数位数",nfDecreaseDecimals:"减少小数位数",nfDialogTitle:"设置单元格格式",nfCategory:"分类",nfCatCustom:"自定义",nfDecimals:"小数位数",nfThousands:"使用千位分隔符",nfSymbol:"货币符号",nfDateFormat:"日期格式",nfTimeFormat:"时间格式",nfCustomCode:"自定义格式代码",nfPreview:"预览",nfPreviewSample:"示例",find:"查找",findReplace:"查找和替换",findPlaceholder:"查找内容",replacePlaceholder:"替换为",findPrev:"上一个",findNext:"下一个",replace:"替换",replaceAll:"全部替换",findScope:"范围",findOptions:"查找选项",scopeSheet:"当前工作表",scopeWorkbook:"整个工作簿",scopeSelection:"当前选区",matchCase:"区分大小写",matchEntireCell:"完整匹配",findNoResult:"未找到",findNeedSelection:"请先选择范围",findReplacedAll:"已替换 {n} 处",findClose:"关闭",freezePane:"冻结窗格",freezePanes:"冻结窗格",freezeFirstRow:"冻结首行",freezeFirstCol:"冻结首列",unfreezePanes:"取消冻结",freezeToRow:"冻结至此行",freezeToCol:"冻结至此列",filter:"筛选",clearFilter:"清除筛选",cancelFilter:"取消",filterSearchPlaceholder:"搜索",filterSelectAll:"全选",filterClearAll:"清除全部",filterOk:"确定",filterBlank:"空白",filterNonBlank:"非空白",filterText:"文本筛选",filterNumber:"数字筛选",filterDate:"日期筛选",filterEquals:"等于",filterNotEquals:"不等于",filterContains:"包含",filterNotContains:"不包含",filterStartsWith:"开头是",filterEndsWith:"结尾是",filterGreaterThan:"大于",filterGreaterThanOrEqual:"大于等于",filterLessThan:"小于",filterLessThanOrEqual:"小于等于",filterBetween:"介于",filterAnd:"与",filterCustom:"自定义筛选",filterNoData:"无数据",filterFilteredCount:"共 {n} 项",filterActive:"筛选中",filterByValue:"按此值筛选",filterByThisColumn:"筛选此列",outlineGroup:"分组",outlineAddGroup:"添加分组",outlineRows:"行分组",outlineColumns:"列分组",outlineAddRowGroup:"添加行分组",outlineAddColumnGroup:"添加列分组",outlineUngroup:"取消分组",outlineUngroupRows:"取消行分组",outlineUngroupColumns:"取消列分组",outlineClear:"清除分组",outlineClearAll:"清除全部分组",outlineExpand:"展开",outlineCollapse:"折叠",outlineExpandAll:"全部展开",outlineCollapseAll:"全部折叠",outlineRowsLabel:"行",outlineColumnsLabel:"列",outlineLevel:"级别",outlineLevelLabel:"等级",outlineNeedRowsOrColumns:"请选择整行或整列后分组",outlineInvalidRange:"无效的分组范围:分组至少需要连续 2 个行或列",outlineCrossing:"分组范围与现有分组交叉,请调整",outlineTooDeep:"分组不能嵌套,仅支持一层",outlineUngroupPartial:"选区未完整覆盖某个分组,无法取消分组",autofillMergeSizeError:"要执行此操作,所有合并单元格必须大小相同。",outlineSelectAxisTitle:"创建分组",outlineSelectAxisPrompt:"请选择按行分组还是按列分组",outlineAlertTitle:"分组提示",conditionalFormat:"条件格式",cfHighlightRules:"突出显示单元格规则",cfGreaterThan:"大于",cfGreaterThanOrEqual:"大于等于",cfLessThan:"小于",cfLessThanOrEqual:"小于等于",cfBetween:"介于",cfNotBetween:"不介于",cfEqual:"等于",cfCellIs:"单元格值",cfNotEqual:"不等于",cfTextContains:"文本包含",cfTextNotContains:"文本不包含",cfBlank:"空白",cfNotBlank:"非空白",cfDuplicate:"重复值",cfUnique:"唯一值",cfFormulaShort:"公式",cfFormula:"使用公式确定要设置格式的单元格",cfFormulaExample:"例如 =$A1>100",cfNewRule:"新建规则",cfManageRules:"管理规则",cfClearRules:"清除规则",cfClearSelected:"清除所选单元格的规则",cfClearSheet:"清除整个工作表的规则",cfAppliedTo:"应用于",cfRule:"规则",cfFormat:"格式",cfPriority:"优先级",cfStopIfTrue:"停止如果为真",cfEnabled:"启用",cfDelete:"删除",cfEdit:"编辑",cfMoveUp:"上移",cfMoveDown:"下移",cfType:"类型",cfOperator:"条件",cfValue:"值",cfValue2:"到",cfManagerTitle:"条件格式规则管理器",cfPreview:"预览",cfNoRules:"当前工作表没有条件格式规则",cfRuleTypeGeneric:"自定义规则",cfBold:"加粗",cfItalic:"斜体",cfUnderline:"下划线",cfFontColor:"字体颜色",cfFillColor:"填充颜色",dv:"数据验证",dvDialogTitle:"数据验证",dvSettings:"设置",dvInputMessageTab:"输入信息",dvErrorAlertTab:"出错警告",dvAllow:"允许",dvData:"数据",dvSource:"来源",dvMin:"最小值",dvMax:"最大值",dvValue:"值",dvFormula:"公式",dvOperator:"条件",dvApplyTo:"应用于",dvShowDropdown:"提供下拉箭头",dvIgnoreBlank:"忽略空值",dvShowInputMessage:"选定单元格时显示输入信息",dvInputTitle:"标题",dvInputMessage:"输入信息",dvShowErrorAlert:"输入无效数据时显示出错警告",dvErrorStyle:"样式",dvErrorTitle:"标题",dvErrorMessage:"错误信息",dvClearAll:"全部清除",dvTypeAny:"任何值",dvTypeList:"列表",dvTypeWholeNumber:"整数",dvTypeDecimal:"小数",dvTypeDate:"日期",dvTypeTime:"时间",dvTypeTextLength:"文本长度",dvTypeCustom:"自定义",dvBetween:"介于",dvNotBetween:"不介于",dvEqual:"等于",dvNotEqual:"不等于",dvGreaterThan:"大于",dvGreaterThanOrEqual:"大于等于",dvLessThan:"小于",dvLessThanOrEqual:"小于等于",dvStyleStop:"停止",dvStyleWarning:"警告",dvStyleInformation:"信息",dvErrorTitleDefault:"输入无效",dvMsgList:"请从下拉列表中选择:{values}",dvMsgListEmpty:"请从下拉列表中选择一个有效值",dvMsgBetween:"{type}必须介于 {min} 与 {max} 之间",dvMsgNotBetween:"{type}不能介于 {min} 与 {max} 之间",dvMsgCompare:"{type}必须{op} {value}",dvMsgCustom:"输入不满足条件:{formula}",dvMsgInvalid:"输入的值不符合该单元格的数据验证规则",dvStopDialogTitle:"输入无效",dvWarningDialogTitle:"输入可能无效",dvInformationDialogTitle:"输入提示",dvBtnRetry:"重试",dvBtnContinue:"是",dvBtnNo:"否",dvBtnOk:"确定",dvRangeInvalid:"范围格式无效,例如 A1:B10 或 A2:A100,C2:C100",dvSourceInvalid:"来源不能为空",dvFormulaRequired:"请输入公式",dvValueRequired:"请输入比较值",dvMinRequired:"请输入最小值",dvMaxRequired:"请输入最大值",dvMustBeInteger:"必须为整数",dvMustBeNumber:"必须为数字",dvDateInvalid:"日期格式无效",dvTimeInvalid:"时间格式无效",dvSearchPlaceholder:"搜索",dvNoMatch:"无匹配项",dvClearValidation:"清除数据验证",dvSourceHint:"直接输入逗号分隔的值,或引用区域(如 A1:A10、Sheet2!A1:A10)"},"en-US":{insert:"Insert",delete:"Delete",rename:"Rename",moveLeft:"Move Left",moveRight:"Move Right",cut:"Cut",copy:"Copy",paste:"Paste",addSheet:"Add new sheet",sheetList:"Sheet list",moveSheetLeft:"Move Left",moveSheetRight:"Move Right",scrollUp:"Scroll up",scrollDown:"Scroll down",scrollLeft:"Scroll left",scrollRight:"Scroll right",calculate:"Calculate",sum:"Sum",avg:"Average",count:"Count",undo:"Undo",redo:"Redo",paintFormat:"Paint Format",clearFormat:"Clear Format",fontFamily:"Font Family",fontSize:"Font Size",fontSizeIncrease:"Increase Font Size",fontSizeDecrease:"Decrease Font Size",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",fontColor:"Font Color",fillColor:"Fill Color",borders:"Borders",hAlign:"Horizontal Align",vAlign:"Vertical Align",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignTop:"Align Top",alignMiddle:"Align Middle",alignBottom:"Align Bottom",wrap:"Wrap Text",mergeCells:"Merge Cells",mergeCenter:"Merge & Center",mergeAcross:"Merge Across",unmergeCells:"Unmerge Cells",borderBottom:"Bottom Border",borderTop:"Top Border",borderLeft:"Left Border",borderRight:"Right Border",borderNone:"No Border",borderAll:"All Borders",borderOuter:"Outside Borders",borderThickOuter:"Thick Box Border",fontDefault:"Default",rowHeight:"Row Height",colWidth:"Column Width",autoRowHeight:"Auto Row Height",defaultColWidth:"Default Column Width",sort:"Sort",sortAsc:"Sort Ascending",sortDesc:"Sort Descending",sortReminderTitle:"Sort Warning",sortReminderMessage:"There is adjacent data to the left or right of your selection. It is not selected and will not be sorted. Include it in the sort?",sortExpandSelection:"Expand the selection",sortCurrentSelection:"Sort the current selection only",insertFunctionTitle:"Insert Function",insertFunctionSelectLabel:"Function",insertFunctionPlaceholder:"Select a function",insertFunctionSearchPlaceholder:"Search a function",insertFunctionFormulaLabel:"Formula",insertFunctionBtn:"Insert",fnDescSum:"Adds all the numbers in a range of cells",fnDescAverage:"Returns the arithmetic mean of the numbers in a range",fnDescCount:"Counts the cells that contain numbers in a range",fnDescIf:"Checks a condition and returns one of two values",fnDescVlookup:"Looks up a value in the first column of a range and returns a value in the same row",fnDescConcatenate:"Joins several text strings into one text string",fnDescMax:"Returns the largest numeric value in a range of cells",fnDescMin:"Returns the smallest numeric value in a range of cells",fnDescSin:"Returns the sine of a given angle (in radians)",fnDescSumif:"Sums the values in a range that meet a specified condition",fnDescPmt:"Calculates the periodic payment for a loan with constant payments and interest",fnDescStdev:"Estimates the sample standard deviation of a supplied set of values",ok:"OK",cancel:"Cancel",dimNumberError:"Please enter a number",dimRangeError:"Please enter a value between {min} and {max}",colorAutomatic:"Automatic",colorNoFill:"No Fill",colorWhite:"White",colorBlack:"Black",colorLightGray:"Light Gray",colorLightBlue:"Light Blue",colorLightOrange:"Light Orange",colorLightYellow:"Light Yellow",colorLightGreen:"Light Green",colorPaleBlue:"Pale Blue",colorPaleOrange:"Pale Orange",colorPaleYellow:"Pale Yellow",colorPaleGreen:"Pale Green",colorSilver:"Silver",colorSkyBlue:"Sky Blue",colorCoral:"Coral",colorGold:"Gold",colorMint:"Mint",colorGray:"Gray",colorMediumBlue:"Medium Blue",colorOrange:"Orange",colorAmber:"Amber",colorMediumGreen:"Medium Green",colorDarkGray:"Dark Gray",colorRoyalBlue:"Royal Blue",colorRed:"Red",colorDarkGold:"Dark Gold",colorDarkGreen:"Dark Green",colorCharcoal:"Charcoal",colorDeepBlue:"Deep Blue",colorDarkRed:"Dark Red",colorOlive:"Olive",colorForest:"Forest",colorSlate:"Slate",colorNavy:"Navy",colorCrimson:"Crimson",colorDarkOlive:"Dark Olive",colorDeepForest:"Deep Forest",colorDarkSlate:"Dark Slate",colorMidnight:"Midnight",colorMaroon:"Maroon",colorCoffee:"Coffee",colorEvergreen:"Evergreen",colorDarkNavy:"Dark Navy",colorDarkMaroon:"Dark Maroon",colorDarkCoffee:"Dark Coffee",colorInkGreen:"Ink Green",numberFormat:"Number Format",nfGeneral:"General",nfText:"Text",nfNumber:"Number",nfPercent:"Percentage",nfScientific:"Scientific",nfAccounting:"Accounting",nfFinancial:"Financial",nfCurrency:"Currency",nfCurrencyRounded:"Currency Rounded",nfDate:"Date",nfTime:"Time",nfDateTime:"Date & Time",nfDuration:"Duration",nfCustom:"Other Number Formats…",nfMixed:"Mixed",nfIncreaseDecimals:"Increase Decimal",nfDecreaseDecimals:"Decrease Decimal",nfDialogTitle:"Format Cells",nfCategory:"Category",nfCatCustom:"Custom",nfDecimals:"Decimal places",nfThousands:"Use 1000 separator",nfSymbol:"Currency symbol",nfDateFormat:"Date format",nfTimeFormat:"Time format",nfCustomCode:"Custom format code",nfPreview:"Preview",nfPreviewSample:"Sample",find:"Find",findReplace:"Find & Replace",findPlaceholder:"Find what",replacePlaceholder:"Replace with",findPrev:"Previous",findNext:"Next",replace:"Replace",replaceAll:"Replace All",findScope:"Scope",findOptions:"Find options",scopeSheet:"Current sheet",scopeWorkbook:"Entire workbook",scopeSelection:"Current selection",matchCase:"Match case",matchEntireCell:"Match entire cell",findNoResult:"No results",findNeedSelection:"Select a range first",findReplacedAll:"Replaced {n} occurrence(s)",findClose:"Close",freezePane:"Freeze Panes",freezePanes:"Freeze Panes",freezeFirstRow:"Freeze First Row",freezeFirstCol:"Freeze First Column",unfreezePanes:"Unfreeze Panes",freezeToRow:"Freeze to Row",freezeToCol:"Freeze to Column",filter:"Filter",clearFilter:"Clear Filter",cancelFilter:"Cancel",filterSearchPlaceholder:"Search",filterSelectAll:"Select All",filterClearAll:"Clear All",filterOk:"OK",filterBlank:"Blanks",filterNonBlank:"Non-blanks",filterText:"Text Filters",filterNumber:"Number Filters",filterDate:"Date Filters",filterEquals:"Equals",filterNotEquals:"Does Not Equal",filterContains:"Contains",filterNotContains:"Does Not Contain",filterStartsWith:"Begins With",filterEndsWith:"Ends With",filterGreaterThan:"Greater Than",filterGreaterThanOrEqual:"Greater Than Or Equal To",filterLessThan:"Less Than",filterLessThanOrEqual:"Less Than Or Equal To",filterBetween:"Between",filterAnd:"And",filterCustom:"Custom Filter",filterNoData:"No data",filterFilteredCount:"{n} items",filterActive:"Filtering",filterByValue:"Filter by This Value",filterByThisColumn:"Filter This Column",outlineGroup:"Group",outlineAddGroup:"Add Group",outlineRows:"Group Rows",outlineColumns:"Group Columns",outlineAddRowGroup:"Add Row Group",outlineAddColumnGroup:"Add Column Group",outlineUngroup:"Ungroup",outlineUngroupRows:"Ungroup Rows",outlineUngroupColumns:"Ungroup Columns",outlineClear:"Clear Outline",outlineClearAll:"Clear All Outlines",outlineExpand:"Expand",outlineCollapse:"Collapse",outlineExpandAll:"Expand All",outlineCollapseAll:"Collapse All",outlineRowsLabel:"Rows",outlineColumnsLabel:"Columns",outlineLevel:"Level",outlineLevelLabel:"Level",outlineNeedRowsOrColumns:"Select entire rows or columns to group",outlineInvalidRange:"Invalid group range: a group needs at least 2 consecutive rows or columns",outlineCrossing:"Group range crosses an existing group, please adjust",outlineTooDeep:"Groups cannot be nested; single level only",outlineUngroupPartial:"The selection does not fully cover a group, cannot ungroup",autofillMergeSizeError:"To do this, all the merged cells need to be the same size.",outlineSelectAxisTitle:"Create Group",outlineSelectAxisPrompt:"Choose to group by rows or by columns",outlineAlertTitle:"Grouping Notice",conditionalFormat:"Conditional Formatting",cfHighlightRules:"Highlight Cell Rules",cfGreaterThan:"Greater Than",cfGreaterThanOrEqual:"Greater Than Or Equal To",cfLessThan:"Less Than",cfLessThanOrEqual:"Less Than Or Equal To",cfBetween:"Between",cfNotBetween:"Not Between",cfEqual:"Equal To",cfCellIs:"Cell Value",cfNotEqual:"Not Equal To",cfTextContains:"Text Contains",cfTextNotContains:"Text Does Not Contain",cfBlank:"Blanks",cfNotBlank:"Non-blanks",cfDuplicate:"Duplicate Values",cfUnique:"Unique Values",cfFormulaShort:"Formula",cfFormula:"Use a formula to determine which cells to format",cfFormulaExample:"e.g. =$A1>100",cfNewRule:"New Rule",cfManageRules:"Manage Rules",cfClearRules:"Clear Rules",cfClearSelected:"Clear Rules from Selected Cells",cfClearSheet:"Clear Rules from Entire Sheet",cfAppliedTo:"Applies to",cfRule:"Rule",cfFormat:"Format",cfPriority:"Priority",cfStopIfTrue:"Stop If True",cfEnabled:"Enabled",cfDelete:"Delete",cfEdit:"Edit",cfMoveUp:"Move Up",cfMoveDown:"Move Down",cfType:"Type",cfOperator:"When",cfValue:"Value",cfValue2:"To",cfManagerTitle:"Conditional Formatting Rules Manager",cfPreview:"Preview",cfNoRules:"No conditional formatting rules on this sheet",cfRuleTypeGeneric:"Custom Rule",cfBold:"Bold",cfItalic:"Italic",cfUnderline:"Underline",cfFontColor:"Font Color",cfFillColor:"Fill Color",dv:"Data Validation",dvDialogTitle:"Data Validation",dvSettings:"Settings",dvInputMessageTab:"Input Message",dvErrorAlertTab:"Error Alert",dvAllow:"Allow",dvData:"Data",dvSource:"Source",dvMin:"Minimum",dvMax:"Maximum",dvValue:"Value",dvFormula:"Formula",dvOperator:"Operator",dvApplyTo:"Apply to",dvShowDropdown:"In-cell dropdown",dvIgnoreBlank:"Ignore blank",dvShowInputMessage:"Show input message when cell is selected",dvInputTitle:"Title",dvInputMessage:"Input message",dvShowErrorAlert:"Show error alert after invalid data is entered",dvErrorStyle:"Style",dvErrorTitle:"Title",dvErrorMessage:"Error message",dvClearAll:"Clear All",dvTypeAny:"Any value",dvTypeList:"List",dvTypeWholeNumber:"Whole Number",dvTypeDecimal:"Decimal",dvTypeDate:"Date",dvTypeTime:"Time",dvTypeTextLength:"Text Length",dvTypeCustom:"Custom",dvBetween:"between",dvNotBetween:"not between",dvEqual:"equal to",dvNotEqual:"not equal to",dvGreaterThan:"greater than",dvGreaterThanOrEqual:"greater than or equal to",dvLessThan:"less than",dvLessThanOrEqual:"less than or equal to",dvStyleStop:"Stop",dvStyleWarning:"Warning",dvStyleInformation:"Information",dvErrorTitleDefault:"Invalid Input",dvMsgList:"Please select a value from the dropdown list: {values}",dvMsgListEmpty:"Please select a valid value from the dropdown list",dvMsgBetween:"{type} must be between {min} and {max}",dvMsgNotBetween:"{type} must not be between {min} and {max}",dvMsgCompare:"{type} must be {op} {value}",dvMsgCustom:"The input does not satisfy: {formula}",dvMsgInvalid:"The value does not match the data validation rules for this cell",dvStopDialogTitle:"Invalid Input",dvWarningDialogTitle:"Possible Invalid Input",dvInformationDialogTitle:"Input Notice",dvBtnRetry:"Retry",dvBtnContinue:"Yes",dvBtnNo:"No",dvBtnOk:"OK",dvRangeInvalid:"Invalid range, e.g. A1:B10 or A2:A100,C2:C100",dvSourceInvalid:"Source cannot be empty",dvFormulaRequired:"Please enter a formula",dvValueRequired:"Please enter a comparison value",dvMinRequired:"Please enter the minimum value",dvMaxRequired:"Please enter the maximum value",dvMustBeInteger:"Must be an integer",dvMustBeNumber:"Must be a number",dvDateInvalid:"Invalid date format",dvTimeInvalid:"Invalid time format",dvSearchPlaceholder:"Search",dvNoMatch:"No matches",dvClearValidation:"Clear Validation",dvSourceHint:"Enter comma separated values, or reference a range (e.g. A1:A10, Sheet2!A1:A10)"}};function g(e,o){var l;return((l=Ka[e])==null?void 0:l[o])??o}const Mn='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',nn=10,qa=[{label:"",value:""},{label:"微软雅黑",value:'"Microsoft YaHei", "微软雅黑", sans-serif'},{label:"宋体",value:'"SimSun", "宋体", serif'},{label:"黑体",value:'"SimHei", "黑体", sans-serif'},{label:"楷体",value:'"KaiTi", "楷体", serif'},{label:"Arial",value:"Arial, sans-serif"},{label:"Arial Black",value:'"Arial Black", sans-serif'},{label:"Times New Roman",value:'"Times New Roman", serif'},{label:"Courier New",value:'"Courier New", monospace'},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Impact",value:"Impact, sans-serif"},{label:"Tahoma",value:"Tahoma, sans-serif"},{label:"Trebuchet MS",value:'"Trebuchet MS", sans-serif'},{label:"Comic Sans MS",value:'"Comic Sans MS", cursive'}],Ya=[{label:"9",value:9},{label:"10",value:10},{label:"11",value:11},{label:"12",value:12},{label:"13",value:13},{label:"14",value:14},{label:"16",value:16},{label:"18",value:18},{label:"20",value:20},{label:"24",value:24},{label:"28",value:28},{label:"32",value:32},{label:"36",value:36},{label:"48",value:48},{label:"72",value:72}],Xa='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="19" y2="6"/><line x1="3" y1="12" x2="15" y2="12"/><line x1="3" y1="18" x2="17" y2="18"/></svg>',ja='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="6" y1="12" x2="18" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>',Za='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="5" y1="6" x2="21" y2="6"/><line x1="9" y1="12" x2="21" y2="12"/><line x1="7" y1="18" x2="21" y2="18"/></svg>',Ja='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="7" x2="6" y2="20"/><line x1="12" y1="7" x2="12" y2="16"/><line x1="18" y1="7" x2="18" y2="20"/><line x1="4" y1="3" x2="20" y2="3"/></svg>',Qa='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="4" x2="6" y2="20"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="18" y1="4" x2="18" y2="20"/></svg>',ei='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="4" x2="6" y2="17"/><line x1="12" y1="8" x2="12" y2="17"/><line x1="18" y1="4" x2="18" y2="17"/><line x1="4" y1="21" x2="20" y2="21"/></svg>',ti=[{value:"left",labelKey:"alignLeft",icon:Xa},{value:"center",labelKey:"alignCenter",icon:ja},{value:"right",labelKey:"alignRight",icon:Za}],li=[{value:"top",labelKey:"alignTop",icon:Ja},{value:"middle",labelKey:"alignMiddle",icon:Qa},{value:"bottom",labelKey:"alignBottom",icon:ei}],ni=[{key:"mergeCenter",labelKey:"mergeCenter",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M709.952 465.92l88-76.032C801.92 385.984 806.656 384 812.032 384s10.048 1.984 14.08 5.952C830.08 393.92 832 398.656 832 403.968L832 448l32 0C881.664 448 896 462.336 896 480S881.664 512 864 512L832 512l0 44.032c0 5.376-1.92 10.112-5.952 14.08C822.08 574.08 817.344 576 812.032 576s-10.048-1.92-14.08-5.952L709.952 494.08C705.984 490.112 704 485.376 704 480S705.984 469.952 709.952 465.92zM378.048 465.92 290.048 389.952C286.08 385.984 281.344 384 275.968 384s-10.048 1.984-14.08 5.952C257.92 393.92 256 398.656 256 403.968L256 448 224 448C206.336 448 192 462.336 192 480S206.336 512 224 512L256 512l0 44.032c0 5.376 1.92 10.112 5.952 14.08C265.92 574.08 270.656 576 275.968 576s10.048-1.92 14.08-5.952L378.048 494.08C382.016 490.112 384 485.376 384 480S382.016 469.952 378.048 465.92zM448 128 128 128l0 704 320 0 0-128 64 0 0 128c0 35.392-28.608 64-64 64L128 896c-35.392 0-64-28.608-64-64L64 128c0-35.392 28.608-64 64-64l320 0 0 0c35.392 0 64 28.608 64 64l0 128L448 256 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128M722.304 642.304c0 8.512-3.52 16.32-10.496 23.36s-15.424 10.624-25.344 10.624c-5.76 0-10.688-1.088-14.72-3.136-4.096-2.048-7.616-4.928-10.432-8.512s-5.824-9.088-9.024-16.512-5.952-13.952-8.32-19.648l-17.28-46.016L479.36 582.464 462.08 629.568c-6.72 18.304-12.48 30.656-17.344 37.12s-12.544 9.6-23.424 9.6c-9.28 0-17.408-3.456-24.512-10.24s-10.624-14.592-10.624-23.232c0-4.992 0.896-10.176 2.496-15.488S393.024 614.592 396.8 605.056l92.672-238.016C492.096 360.256 495.296 352 499.008 342.464s7.68-17.536 11.904-23.872 9.664-11.456 16.576-15.36c6.784-3.968 15.232-5.888 25.344-5.888 10.176 0 18.752 1.92 25.472 5.888 6.848 3.968 12.352 8.96 16.64 15.104 4.096 6.208 7.744 12.8 10.624 19.904s6.528 16.576 11.008 28.352l94.656 236.48C718.592 621.056 722.304 634.112 722.304 642.304zM606.912 526.784 552.32 375.552 498.624 526.784 606.912 526.784z"/></svg>'},{key:"mergeAcross",labelKey:"mergeAcross",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M832 64c70.4 0 128 57.6 128 128v640c0 70.4-57.6 128-128 128H192c-70.4 0-128-57.6-128-128V192c0-70.4 57.6-128 128-128h640zM448 768H128v64c0 38.4 25.6 64 64 64h256v-128z m448 0H512v128h320c38.4 0 64-25.6 64-64v-64z m0-448H128v384h768V320zM633.6 390.4l96 96c6.4 6.4 6.4 12.8 6.4 19.2 0 6.4-6.4 12.8-6.4 19.2L633.6 633.6c-12.8 12.8-32 12.8-44.8 0-12.8-12.8-12.8-32-6.4-44.8l44.8-44.8H288c-19.2 0-32-12.8-32-32s12.8-32 32-32h339.2l-44.8-44.8c-6.4-12.8-6.4-32 0-44.8 12.8-12.8 38.4-12.8 51.2 0zM448 128H192c-38.4 0-64 25.6-64 64v64h320V128z m384 0H512v128h384V192c0-38.4-25.6-64-64-64z"/></svg>'},{key:"mergeCells",labelKey:"mergeCells",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M512 480c0 5.376-1.984 10.112-5.952 14.08L354.048 634.048C350.08 638.08 345.344 640 339.968 640s-10.048-1.92-14.08-5.952C321.92 630.144 320 625.344 320 620.032L320 512 224 512C206.336 512 192 497.664 192 480S206.336 448 224 448L320 448 320 339.968c0-5.376 1.92-10.048 5.952-14.08C329.92 321.984 334.656 320 339.968 320s10.048 1.984 14.08 5.952L506.048 465.92C510.016 469.952 512 474.624 512 480zM576 480c0 5.376 1.984 10.112 5.952 14.08l152 140.032C737.92 638.08 742.656 640 748.032 640s10.048-1.92 14.08-5.952C766.08 630.144 768 625.344 768 620.032L768 512l96 0C881.664 512 896 497.664 896 480S881.664 448 864 448L768 448 768 339.968c0-5.376-1.92-10.048-5.952-14.08C758.08 321.984 753.344 320 748.032 320s-10.048 1.984-14.08 5.952L581.952 465.92C577.984 469.952 576 474.624 576 480zM448 128l0 128 64 0L512 128c0-35.392-28.672-64-64-64l0 0L128 64C92.672 64 64 92.608 64 128l0 704c0 35.392 28.672 64 64 64l320 0c35.328 0 64-28.608 64-64l0-128L448 704l0 128L128 832 128 128 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128"/></svg>'},{key:"unmergeCells",labelKey:"unmergeCells",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M197.952 465.92l152-140.032C353.92 321.984 358.656 320 364.032 320s10.048 1.984 14.08 5.952C382.08 329.92 384 334.656 384 339.968L384 448l96 0C497.664 448 512 462.336 512 480S497.664 512 480 512L384 512l0 108.032c0 5.376-1.92 10.112-5.952 14.08C374.08 638.08 369.344 640 364.032 640S353.92 638.08 349.952 634.048L197.952 494.08C193.984 490.112 192 485.376 192 480S193.984 469.952 197.952 465.92zM890.048 465.92l-152-140.032C734.08 321.984 729.344 320 723.968 320s-10.048 1.984-14.08 5.952C705.92 329.92 704 334.656 704 339.968L704 448 608 448C590.336 448 576 462.336 576 480S590.336 512 608 512L704 512l0 108.032c0 5.376 1.92 10.112 5.952 14.08C713.92 638.08 718.656 640 723.968 640s10.048-1.92 14.08-5.952l152-140.032C894.016 490.112 896 485.376 896 480S894.016 469.952 890.048 465.92zM448 128l0 128 64 0L512 128c0-35.392-28.608-64-64-64l0 0L128 64C92.608 64 64 92.608 64 128l0 704c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64l0-128L448 704l0 128L128 832 128 128 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128"/></svg>'}],oi={bg:"#f4f4f4",gridBg:"#ffffff",headerBg:"#e8e8e8",headerBorder:"#c8c8c8",headerText:"#444",headerSep:"#b0b0b0",cornerBg:"#e0e0e0",gridLine:"#e0e0e0",selectionBg:"rgba(0, 120, 215, 0.12)",activeCellBorder:"#0078d7",outlineGroupBg1:"#d5e2f8",outlineGroupBg2:"#f0e2f6",cellText:"#1a1a1a",scrollTrack:"rgba(0,0,0,0.08)",scrollThumb:"rgba(0,0,0,0.25)",formulaBarBg:"#f0f0f0",formulaBarBorder:"#c8c8c8",formulaBarLabelText:"#333",formulaBarLabelBg:"#fff",formulaBarLabelBorder:"#c0c0c0",formulaBarInputBg:"#fff",formulaBarInputBorder:"#c0c0c0",formulaBarInputText:"#1a1a1a",formulaBarInputFocusBorder:"#0078d7",formulaBarInputFocusShadow:"rgba(0, 120, 215, 0.3)",wrapperBg:"#e8e8e8",cellEditorBorder:"#0078d7",cellEditorText:"#1a1a1a",cellEditorBg:"#fff",cellEditorShadow:"#0078d7",tabBarBg:"#e8e8e8",tabBarBorder:"#c0c0c0",tabActiveBg:"#ffffff",tabActiveText:"#1a1a1a",tabActiveBorder:"#0078d7",tabInactiveBg:"#dfdfdf",tabInactiveText:"#666",tabInactiveBorder:"transparent",tabHoverBg:"#e0e0e0",tabAddBtnColor:"#555",tabAddBtnHoverBg:"#d0d0d0",tabScrollBtnColor:"#888",tabScrollBtnHoverBg:"#d0d0d0",scrollbarThumb:"rgba(0,0,0,0.25)",scrollbarThumbHover:"rgba(0,0,0,0.4)",scrollBtnBg:"#e8e8e8",scrollBtnColor:"#666",scrollBtnHoverBg:"#d0d0d0",scrollBtnActiveBg:"#c0c0c0",scrollTrackBg:"rgba(0,0,0,0.06)",toolbarBg:"#f7f7f7",toolbarBorder:"#d8d8d8",toolbarBtnColor:"#444",toolbarBtnHoverBg:"#e6e6e6",toolbarBtnDisabledColor:"#b0b0b0",toolbarBtnActiveColor:"#0078d7",findMatchBg:"rgba(255, 213, 79, 0.45)",findActiveBg:"rgba(255, 179, 0, 0.75)"},ri={bg:"#1e1e1e",gridBg:"#252526",headerBg:"#252525",headerBorder:"#3e3e3e",headerText:"#999",headerSep:"#3e3e3e",cornerBg:"#2a2a2a",gridLine:"#3e3e3e",selectionBg:"rgba(0, 120, 215, 0.25)",activeCellBorder:"#0078d7",outlineGroupBg1:"#33405f",outlineGroupBg2:"#47335f",cellText:"#d4d4d4",scrollTrack:"rgba(255,255,255,0.06)",scrollThumb:"rgba(255,255,255,0.2)",formulaBarBg:"#2d2d2d",formulaBarBorder:"#3e3e3e",formulaBarLabelText:"#ccc",formulaBarLabelBg:"#3c3c3c",formulaBarLabelBorder:"#555",formulaBarInputBg:"#3c3c3c",formulaBarInputBorder:"#555",formulaBarInputText:"#d4d4d4",formulaBarInputFocusBorder:"#0078d7",formulaBarInputFocusShadow:"rgba(0, 120, 215, 0.4)",wrapperBg:"#1e1e1e",cellEditorBorder:"#0078d7",cellEditorText:"#d4d4d4",cellEditorBg:"#3c3c3c",cellEditorShadow:"#0078d7",tabBarBg:"#2a2a2a",tabBarBorder:"#3e3e3e",tabActiveBg:"#1e1e1e",tabActiveText:"#e0e0e0",tabActiveBorder:"#0078d7",tabInactiveBg:"#333333",tabInactiveText:"#888",tabInactiveBorder:"transparent",tabHoverBg:"#3a3a3a",tabAddBtnColor:"#999",tabAddBtnHoverBg:"#3a3a3a",tabScrollBtnColor:"#777",tabScrollBtnHoverBg:"#3a3a3a",scrollbarThumb:"rgba(255,255,255,0.2)",scrollbarThumbHover:"rgba(255,255,255,0.35)",scrollBtnBg:"#2d2d2d",scrollBtnColor:"#999",scrollBtnHoverBg:"#3d3d3d",scrollBtnActiveBg:"#4d4d4d",scrollTrackBg:"rgba(255,255,255,0.05)",toolbarBg:"#2a2a2a",toolbarBorder:"#3e3e3e",toolbarBtnColor:"#ccc",toolbarBtnHoverBg:"#3a3a3a",toolbarBtnDisabledColor:"#666",toolbarBtnActiveColor:"#4ea1ff",findMatchBg:"rgba(255, 213, 79, 0.35)",findActiveBg:"rgba(255, 179, 0, 0.6)"};function pt(e){let o="",l=e;do o=String.fromCharCode(65+l%26)+o,l=Math.floor(l/26)-1;while(l>=0);return o}function Po(e){let o=0;for(let l=0;l<e.length;l++)o=o*26+(e.toUpperCase().charCodeAt(l)-64);return o-1}function Bn(e){if(e==null)return null;if(typeof e=="number")return e;if(typeof e=="string"){const o=parseFloat(e);return e.endsWith("%")||isNaN(o)?null:o}return null}function Go(e){navigator.clipboard.writeText(e).catch(()=>{const o=document.createElement("textarea");o.value=e,o.style.position="fixed",o.style.opacity="0",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)})}function _n(e,o){return`${e},${o}`}function hl(e,o,l){const n=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!n)return null;const a=Po(n[1]),i=parseInt(n[2],10)-1;return a<0||a>=o||i<0||i>=l?null:{col:a,row:i}}function gn(e,o){if(!o)return{x:0,y:0};const l=o.getBoundingClientRect();return{x:e.clientX-l.left,y:e.clientY-l.top}}function Gl(e){const o=window.innerWidth,l=window.innerHeight,n=(e==null?void 0:e.getBoundingClientRect())??null;return n?{left:Math.max(0,Math.min(o,n.left)),right:Math.max(0,Math.min(o,n.right)),top:Math.max(0,Math.min(l,n.top)),bottom:Math.max(0,Math.min(l,n.bottom))}:{left:0,right:o,top:0,bottom:l}}function lo(e){return window.innerWidth-e}const on="__nf_custom__",Kl="",rn="",Nl="@",wo="__NF_INVALID__",Ko=2958465,qo=0;function xl(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function Yo(e){return e==="zh-CN"?"¥":"$"}function ai(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Fr(e){return e.replace(/"([^"]*)"/g,"$1")}function ii(e){let o=e,l;const n=o.match(/^\[([^\]]+)\]/);n&&(l=n[1].toLowerCase(),o=o.slice(n[0].length)),o=ai(o);const a=/E[+-]/i.test(o),i=o.includes("%"),r=o.search(/[0#?]/);if(r===-1)return{hasDigits:!1,decimals:0,minDecimals:0,minIntDigits:0,thousands:!1,scale:i?100:1,scientific:!1,prefix:o,suffix:"",color:l};let c=-1;for(let me=o.length-1;me>=0;me--){const pe=o[me];if(pe==="0"||pe==="#"||pe==="?"||pe==="E"){c=me;break}}c<0&&(c=r);const u=r>0?o.slice(0,r):"",b=c<o.length-1?o.slice(c+1):"",h=o.slice(r,c+1),C=/[0#?]/.test(h),p=h.includes(",");let R=h.replace(/,/g,"");if(a){const me=R.search(/E/i);me>=0&&(R=R.slice(0,me))}const O=R.indexOf("."),X=O>=0?R.slice(0,O):R,j=O>=0?R.slice(O+1):"",Ee=(j.match(/[0#?]/g)||[]).length,ae=(j.match(/0/g)||[]).length,ge=(X.match(/0/g)||[]).length;return{hasDigits:C,decimals:Ee,minDecimals:ae,minIntDigits:ge,thousands:p,scale:i?100:1,scientific:a,prefix:u,suffix:b,color:l}}function si(e){const o=[];let l=!1;const n=/\[h\]|\[mm\]|\[ss\]|yyyy|yy|y|mmmm|mmm|mm|m|dddd|ddd|dd|d|hh|h|ss|s|AM\/PM|am\/pm|"[^"]*"|\/|-|:|\s+|[^\s]/g;let a;for(;(a=n.exec(e))!==null;){const i=a[0];switch(i){case"[h]":l=!0,o.push({type:"hour",len:0});break;case"[mm]":l=!0,o.push({type:"minute",len:2});break;case"[ss]":l=!0,o.push({type:"second",len:2});break;case"yyyy":o.push({type:"year",len:4});break;case"yy":case"y":o.push({type:"year",len:2});break;case"mmmm":o.push(l?{type:"minute",len:4}:{type:"monthName",len:4});break;case"mmm":o.push(l?{type:"minute",len:3}:{type:"monthName",len:3});break;case"mm":o.push(l?{type:"minute",len:2}:{type:"month",len:2});break;case"m":o.push(l?{type:"minute",len:1}:{type:"month",len:1});break;case"dddd":o.push({type:"weekday",len:4});break;case"ddd":o.push({type:"weekday",len:3});break;case"dd":o.push({type:"day",len:2});break;case"d":o.push({type:"day",len:1});break;case"hh":o.push({type:"hour",len:2});break;case"h":o.push({type:"hour",len:1});break;case"ss":o.push({type:"second",len:2});break;case"s":o.push({type:"second",len:1});break;case"AM/PM":case"am/pm":o.push({type:"ampm",len:2});break;default:i.startsWith('"')?o.push({type:"literal",text:Fr(i),len:0}):o.push({type:"literal",text:i,len:0})}}return{tokens:o,isDuration:l}}const Or=new Map;function ci(e){const o=e.replace(/\[[^\]]*\]/gi,i=>/^\[(h|mm|ss)\]$/i.test(i)?i:"");if(/[ydhs]/.test(o)||/AM\/PM/i.test(o)||/\[h\]/i.test(o)){const i=e.split(";")[0]??e,{tokens:r,isDuration:c}=si(i);return{kind:c?"duration":"date",sections:[],tokens:r,isDuration:c,raw:e}}return{kind:"number",sections:e.split(";").map(i=>ii(i)),tokens:[],isDuration:!1,raw:e}}function an(e){const o=Or.get(e);if(o)return o;const l=ci(e);return Or.set(e,l),l}function Ir(e,o,l,n,a){const i=Math.pow(10,o),r=Math.round((e+Number.EPSILON)*i)/i,c=r<0,u=Math.abs(r);let h=new Intl.NumberFormat("en-US",{useGrouping:n,minimumIntegerDigits:a,minimumFractionDigits:o,maximumFractionDigits:o}).format(u);if(l<o&&o>0){const p=h.indexOf(".");if(p>=0){const x=h.substring(0,p);let R=h.substring(p+1);R=R.replace(/0+$/,""),R.length<l&&(R=R+"0".repeat(l-R.length)),h=R?`${x}.${R}`:x}}return`${c?"-":""}${h}`}function Ar(e,o){if(e===0)return(o>0?"0."+"0".repeat(o):"0")+"E+00";const l=Math.floor(Math.log10(Math.abs(e))),n=e/Math.pow(10,l),a=Ir(n,o,o,!1,1),i=(l>=0?"+":"-")+String(Math.abs(l)).padStart(2,"0");return`${a}E${i}`}function di(e,o,l){if(!l.hasDigits)return Fr(l.prefix+l.suffix);const n=l.scale===100?e*100:e,a=l.scientific?Ar(n,l.decimals):Ir(n,l.decimals,l.minDecimals,l.thousands,l.minIntDigits);return o+l.prefix+a+l.suffix}function ui(e,o){const l=o.sections;if(l.length===0)return String(e);let n,a,i="";return e>0?(n=l[0],a=e):e<0?l[1]?(n=l[1],a=-e):(n=l[0],a=-e,i="-"):(n=l[2]??l[0],a=0),di(a,i,n)}function fi(e){return new Date((e-25569)*864e5)}const mi=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],pi=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Lr=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],hi=["January","February","March","April","May","June","July","August","September","October","November","December"],gi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],zr=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Hn(e,o){return String(e).padStart(o,"0")}function bi(e,o,l,n){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),c=e.getUTCDay(),u=l==="zh-CN";let b="",h=!1;for(const C of o)switch(C.type){case"literal":b+=C.text??"";break;case"year":b+=C.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":b+=Hn(h?e.getUTCMinutes():i,C.len);break;case"monthName":b+=C.len>=4?u?mi[i-1]:hi[i-1]:u?pi[i-1]:gi[i-1];break;case"day":b+=Hn(r,C.len);break;case"weekday":b+=C.len>=4?u?Lr[c]:zr[c]:u?Lr[c].slice(2):zr[c].slice(0,3);break;case"hour":{let p=e.getUTCHours();if(C.len===0){const x=Math.floor(n*86400);p=Math.floor(x/3600)}b+=String(p),h=!0;break}case"minute":b+=Hn(e.getUTCMinutes(),C.len);break;case"second":b+=Hn(e.getUTCSeconds(),C.len);break;case"ampm":{const p=e.getUTCHours();b+=p<12?u?"上午":"AM":u?"下午":"PM";break}}return b}function yi(e,o){const l=Math.floor(e*86400),n=Math.floor(l/3600),a=Math.floor(l%3600/60),i=l%60;let r="";for(const c of o)switch(c.type){case"literal":r+=c.text??"";break;case"hour":r+=String(n);break;case"minute":r+=Hn(a,c.len||2);break;case"second":r+=Hn(i,c.len||2);break;default:r+=""}return r}function Ci(e){if(e==="")return e;const o=Number(e);if(!isNaN(o)&&e.trim()!==""){const l=Math.abs(o);return l!==0&&(l>=1e15||l<1e-9)?Ar(o,9):e}return e}function Il(e,o,l){if(xl(o))return Ci(e);if(o==null||o===Nl)return e;const n=an(o);if(n.kind==="date"||n.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(n.kind==="date"){if(i<qo||i>Ko)return wo}else if(i<0)return wo;return n.kind==="duration"?yi(i,n.tokens):bi(fi(i),n.tokens,l,i)}const a=Number(e);return isNaN(a)?e:ui(a,n)}const wi=["general","text","number","percent","scientific","accounting","financial","currency","currencyRounded","date","time","dateTime","duration","custom"];function Xo(e,o){if(o===Nl||o==="@")return!1;if(xl(o)){if(e==null||e===""||e.trim()==="")return!1;const n=Number(e);return!Number.isNaN(n)&&Number.isFinite(n)}const l=an(o);return!!(l.kind==="number"&&$r(l))}function $r(e){return e.sections.some(o=>o.hasDigits)}function _r(e){if(e==null||xl(e)||e===Nl||e==="@")return!1;const o=an(e);return!!(o.kind==="date"||o.kind==="duration"||o.kind==="number"&&$r(o))}function Hr(e,o){if(o==null||xl(o)||o===Nl||o==="@")return!1;const l=an(o),n=Number(e);return Number.isFinite(n)?l.kind==="date"?n<qo||n>Ko:l.kind==="duration"?n<0:!1:!1}const jo=30,Zo=0;function Al(e){if(e==null||e===""||e.trim()==="")return!1;const o=Number(e);return!Number.isNaN(o)&&Number.isFinite(o)}function Wr(e,o){if(e==null||e===Kl||xl(e))return Al(o);if(e===Nl)return!1;const l=an(e);return l.kind==="date"||l.kind==="duration"?!1:l.sections.some(n=>n.hasDigits)}function vi(e){if(!Al(e))return 0;const o=String(Number(e));return o.indexOf(".")<0||/e/i.test(o)?0:o.slice(o.indexOf(".")+1).length}function ki(e,o){if(!Wr(e,o))return-1;if(e==null||e===Kl||xl(e))return vi(o);const n=an(e).sections.find(a=>a.hasDigits);return n?n.decimals:-1}function Ei(e,o){let l=0;const n=/\[[^\]]*\]/g;let a;for(;(a=n.exec(e))!==null&&!/^\[(h|mm|ss)\]$/i.test(a[0]);)l=a.index+a[0].length;const i=e.slice(0,l),r=e.slice(l),c=r.search(/[0#?]/);if(c===-1)return e;let u=-1;for(let X=r.length-1;X>=0;X--){const j=r[X];if(j==="0"||j==="#"||j==="?"||j==="E"){u=X;break}}if(u<c)return e;const b=r.slice(c,u+1),h=b.search(/E[+-]/i),C=h>=0?b.slice(0,h):b,p=C.indexOf("."),x=p>=0?(C.slice(p+1).match(/[0#?]/g)||[]).length:0;if(x===o)return e;let R;if(p<0)R=o>0?C+"."+"0".repeat(o):C;else if(o>x)R=C+"0".repeat(o-x);else{let X=x-o;const j=C.split("");for(let Ee=j.length-1;Ee>=0&&X>0;Ee--){const ae=j[Ee];(ae==="0"||ae==="#"||ae==="?")&&(j.splice(Ee,1),X--)}R=j.join(""),o===0&&R.endsWith(".")&&(R=R.slice(0,-1))}const O=R+(h>=0?b.slice(h):"");return i+r.slice(0,c)+O+r.slice(u+1)}function Ri(e,o){if(!Number.isInteger(o)||o<Zo||o>jo||e===Kl)return null;if(e==null||xl(e))return o>0?"0."+"0".repeat(o):"0";if(e===Nl)return null;const l=an(e);return l.kind==="date"||l.kind==="duration"||!l.sections.some(n=>n.hasDigits)?null:e.split(";").map(n=>Ei(n,o)).join(";")}const Jo=["¥","$","€","£"];function Ur(e,o){if(e==null||e===Kl)return e??rn;if(xl(e))return rn;if(e===Nl||e==="@")return Nl;const l=Yo(o),n=o==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",a=o==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",i=`${l}#,##0.00;(${l}#,##0.00);${l}"-"`,r="#,##0.00;[Red](#,##0.00)";if(Pr(o).some(x=>x.value===e))return e;const u=e.replace(/\[[^\]]*\]/gi,x=>/^\[(h|mm|ss)\]$/i.test(x)?x:"");if(/\[(h|mm|ss)\]/i.test(u)&&!/[yd]/i.test(u))return"[h]:mm:ss";const b=/[yd]/i.test(u),h=/h|s|AM\/PM/i.test(u);if(b&&h)return a;if(b||/AM\/PM/i.test(u))return n;if(h)return"h:mm:ss";if(e.includes("%"))return"0.00%";if(/E[+-]/i.test(e))return"0.00E+00";if(e.includes("[Red]("))return r;const C=Jo.find(x=>e.startsWith(x));if(C)return e.includes("(")?i:/\.\d/.test(e.slice(C.length))?l+"#,##0.00":l+"#,##0";const p=an(e);return p.kind==="number"&&p.sections.some(x=>x.hasDigits)?"#,##0.00":on}function Si(e,o){return new Date(Date.UTC(e,o,0)).getUTCDate()}function Mi(e,o,l){const n=Date.UTC(e,o-1,l)/864e5+25569;return n<=60?n-1:n}function ql(e,o,l=new Date){const n=e.trim();if(!n||n.startsWith("=")||Al(n))return null;const a=o==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",i=o==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",r="h:mm:ss";function c(p){const x=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(p);if(!x)return null;const R=Number(x[1]),O=Number(x[2]),X=x[3]!==void 0?Number(x[3]):0;return R>23||O>59||X>59?null:(R*3600+O*60+X)/86400}function u(p){let x=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(p),R,O,X;if(x)R=Number(x[1]),O=Number(x[2]),X=Number(x[3]);else if(x=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(p))R=Number(x[1]),O=Number(x[2]),X=Number(x[3]);else if(x=/^(\d{1,2})[-/](\d{1,2})[-/](\d{4})$/.exec(p))O=Number(x[1]),X=Number(x[2]),R=Number(x[3]);else if(x=/^(\d{1,2})[-/](\d{1,2})$/.exec(p))R=l.getUTCFullYear(),O=Number(x[1]),X=Number(x[2]);else return null;if(R<1900||R>9999||O<1||O>12||X<1||X>Si(R,O))return null;const j=Mi(R,O,X);return j>=qo&&j<=Ko?j:null}const b=c(n);if(b!==null)return{serial:b,format:r};const h=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(n);if(h){const p=u(h[1].trim()),x=c(h[2]);if(p!==null&&x!==null)return{serial:p+x,format:i}}const C=u(n);return C!==null?{serial:C,format:a}:null}function vo(e,o){const l=e.trim();if(!l||l.startsWith("=")||!(l.includes(",")||l.includes("%")||Jo.some(Ee=>l.startsWith(Ee)))||ql(l,o))return null;const a=Jo.find(Ee=>l.startsWith(Ee)),i=a?l.slice(a.length).trim():l;if(!i)return null;const r=/^([+-]?)(\d{1,3}(?:,\d{3})+)(?:\.(\d+))?(%?)$/.exec(i)||/^([+-]?)(\d+)(?:\.(\d+))?(%?)$/.exec(i);if(!r)return null;const c=r[1]==="-"?-1:1,u=r[2].replace(/,/g,""),b=r[3],h=(r[4]??"")==="%",C=b?b.length:0,p=+(u+(b?"."+b:""));if(!Number.isFinite(p))return null;const R=i.includes(",")?"#,##0":"0",O=C>0?"."+"0".repeat(C):"",X=(a??"")+R+O+(h?"%":"");let j=p*c;return h&&(j=j/100),j=Math.round(j*1e12)/1e12,{num:j,format:X}}function Bi(e,o,l,n){const a=Yo(e),i=n?"#,##0":"0",r=l>0?"."+"0".repeat(l):"",c=i+r;switch(o){case"general":return"";case"text":return Nl;case"custom":return"";case"number":return c;case"percent":return c+"%";case"scientific":return"0."+"0".repeat(l)+"E+00";case"currency":return a+c;case"currencyRounded":return a+(n?"#,##0":"0");case"accounting":return`${a}${c};(${a}${c});${a}"-"`;case"financial":return`${c};[Red](${c})`;case"date":return e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy";case"time":return"h:mm:ss";case"dateTime":return e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss";case"duration":return"[h]:mm:ss";default:return""}}function Pr(e){const o=Yo(e);return[{label:g(e,"nfGeneral"),value:rn},{label:g(e,"nfText"),value:Nl},{label:g(e,"nfNumber"),value:"#,##0.00"},{label:g(e,"nfPercent"),value:"0.00%"},{label:g(e,"nfScientific"),value:"0.00E+00"},{label:g(e,"nfAccounting"),value:`${o}#,##0.00;(${o}#,##0.00);${o}"-"`},{label:g(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:g(e,"nfCurrency"),value:o+"#,##0.00"},{label:g(e,"nfCurrencyRounded"),value:o+"#,##0"},{label:g(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:g(e,"nfTime"),value:"h:mm:ss"},{label:g(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:g(e,"nfDuration"),value:"[h]:mm:ss"},{label:g(e,"nfCustom"),value:on}]}const Ni=["title"],xi=["innerHTML"],Ti={class:"sp-dropdown__value"},Vi=["disabled"],Di=["placeholder"],Fi=["disabled","onClick"],Oi=["innerHTML"],Ii={class:"sp-dropdown__item-label"},Ai={key:2,class:"sp-dropdown__empty"},Li=["disabled"],zi=t.defineComponent({__name:"dropdown",props:{modelValue:{},options:{},width:{default:"auto"},menuWidth:{default:void 0},visibleCount:{default:8},title:{default:""},modelOpen:{type:Boolean,default:void 0},hideTrigger:{type:Boolean,default:!1},align:{default:"left"},triggerEl:{default:null},fallbackLabel:{default:""},searchable:{type:Boolean,default:!1},searchPlaceholder:{default:""},triggerIcon:{default:""},triggerLabel:{default:""},boundaryEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:o}){const l=e,n=o,a=t.ref(!1),i=t.ref(0),r=t.ref(null),c=t.ref(null),u=t.ref(null),b=t.ref({top:0,up:!1}),h=t.ref(void 0),C=t.ref(0),p=t.ref(!1),x=t.ref(""),R=t.ref(null),O=t.computed(()=>l.options.find(ie=>String(ie.value)===String(l.modelValue))),X=t.computed(()=>l.menuWidth!==void 0?l.menuWidth:h.value),j=t.computed(()=>{if(!l.searchable||!x.value.trim())return l.options;const ie=x.value.trim().toLowerCase();return l.options.filter(De=>String(De.label??"").toLowerCase().includes(ie))}),Ee=t.computed(()=>j.value.length>0),ae=t.computed(()=>Math.min(l.visibleCount,j.value.length)),ge=t.computed(()=>j.value.slice(i.value,i.value+ae.value)),me=t.computed(()=>i.value>0),pe=t.computed(()=>i.value+ae.value<j.value.length),se=t.computed(()=>j.value.length>ae.value);function Ve(ie){i.value=Math.max(0,Math.min(j.value.length-ae.value,i.value+ie))}function tt(){const ie=l.triggerEl??r.value;if(!ie)return;const De=ie.getBoundingClientRect();h.value=De.width,a.value=!0,l.searchable&&(x.value=""),l.modelOpen!==void 0&&n("update:modelOpen",!0);const N=De.bottom+4,J=Gl(l.boundaryEl);l.align==="right"?b.value={right:lo(Math.min(De.right,J.right)),top:N,up:!1}:b.value={left:Math.max(J.left,De.left),top:N,up:!1};const le=j.value.findIndex(re=>String(re.value)===String(l.modelValue));i.value=le>=0?Math.max(0,Math.min(le-Math.floor(ae.value/2),j.value.length-ae.value)):0,l.searchable&&t.nextTick(()=>{var re;return(re=R.value)==null?void 0:re.focus()}),t.nextTick(()=>{const re=l.triggerEl??r.value;if(!re)return;const ne=re.getBoundingClientRect(),ve=u.value;if(!ve)return;const Ce=ve.offsetHeight,_=J.bottom-ne.bottom-8,L=ne.top-J.top-8,U=_<Ce&&L>0,q=U?ne.top-Ce-4:ne.bottom+4,de=Math.min(J.top+8,ne.bottom+4),ze=Math.max(de,Math.min(J.bottom-Ce-8,q));l.align==="right"?b.value={right:lo(Math.min(ne.right,J.right)),top:ze,up:U}:b.value={left:Math.max(J.left,ne.left),top:ze,up:U}})}function Qe(){a.value=!1,x.value="",l.modelOpen!==void 0&&n("update:modelOpen",!1)}function K(){a.value?Qe():tt()}function it(ie){ie.disabled||(n("update:modelValue",ie.value),n("change",ie.value),Qe())}function I(ie){var N,J;if(!a.value)return;const De=ie.target;(N=r.value)!=null&&N.contains(De)||(J=u.value)!=null&&J.contains(De)||Qe()}function D(ie){a.value&&(ie.preventDefault(),Ve(ie.deltaY>0?1:-1))}t.watch(a,ie=>{t.nextTick(()=>{var De,N;ie?((De=c.value)==null||De.addEventListener("wheel",D,{passive:!1}),document.addEventListener("keydown",W)):((N=c.value)==null||N.removeEventListener("wheel",D),document.removeEventListener("keydown",W))})});function W(ie){a.value&&ie.key==="Escape"&&Qe()}t.watch(()=>l.modelOpen,ie=>{ie!==void 0&&ie!==a.value&&(ie?tt():Qe())});function we(ie){a.value&&(C.value=ie.touches[0].clientY,p.value=!0)}function $e(ie){if(!a.value||!p.value)return;const De=ie.touches[0].clientY-C.value;Math.abs(De)>5&&(Ve(De<0?1:-1),C.value=ie.touches[0].clientY)}function Z(){p.value=!1}function Le(ie){ie.key==="Escape"&&(ie.stopPropagation(),Qe())}return t.onMounted(()=>{document.addEventListener("pointerdown",I),window.addEventListener("resize",Qe),window.addEventListener("scroll",Qe,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",I),document.removeEventListener("keydown",W),window.removeEventListener("resize",Qe),window.removeEventListener("scroll",Qe,!0)}),(ie,De)=>{var N,J,le,re,ne;return t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"sp-dropdown",style:t.normalizeStyle(typeof e.width=="number"?{width:e.width+"px"}:{width:e.width})},[e.hideTrigger?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__trigger",{"sp-dropdown__trigger--open":a.value}]),title:e.title,onClick:K},[(N=O.value)!=null&&N.icon||e.triggerIcon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:((J=O.value)==null?void 0:J.icon)||e.triggerIcon},null,8,xi)):t.createCommentVNode("",!0),t.createElementVNode("span",Ti,t.toDisplayString((le=O.value)!=null&&le.icon||e.triggerIcon?((re=O.value)==null?void 0:re.label)??e.triggerLabel:((ne=O.value)==null?void 0:ne.label)??e.fallbackLabel),1),De[5]||(De[5]=t.createElementVNode("svg",{class:"sp-dropdown__caret",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1))],10,Ni)),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:u,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":b.value.up}]),style:t.normalizeStyle({left:b.value.left!==void 0?b.value.left+"px":void 0,right:b.value.right!==void 0?b.value.right+"px":void 0,top:b.value.top+"px",minWidth:X.value!==void 0?typeof X.value=="number"?X.value+"px":X.value:void 0}),onKeydown:Le,onMousedown:De[4]||(De[4]=t.withModifiers(()=>{},["prevent"]))},[se.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!me.value}]),disabled:!me.value,onClick:De[0]||(De[0]=ve=>Ve(-1))},[...De[6]||(De[6]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 662.613333a32 32 0 0 0 45.226667 0L512 375.893333l286.72 286.72a32 32 0 1 0 45.226667-45.226666l-309.333334-309.333334a32 32 0 0 0-45.226666 0l-309.333334 309.333334a32 32 0 0 0 0 45.226666z"})],-1)])],10,Vi)):t.createCommentVNode("",!0),e.searchable?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"searchInputRef",ref:R,"onUpdate:modelValue":De[1]||(De[1]=ve=>x.value=ve),class:"sp-dropdown__search",type:"text",placeholder:e.searchPlaceholder,onMousedown:De[2]||(De[2]=t.withModifiers(()=>{},["stop"]))},null,40,Di)),[[t.vModelText,x.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:c,class:"sp-dropdown__list",onTouchstart:we,onTouchmove:$e,onTouchend:Z},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ge.value,ve=>(t.openBlock(),t.createElementBlock("button",{key:String(ve.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":!ve.disabled&&String(ve.value)===String(e.modelValue),"sp-dropdown__item--disabled":ve.disabled}]),disabled:ve.disabled,onClick:Ce=>it(ve)},[ve.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:ve.icon},null,8,Oi)):t.createCommentVNode("",!0),t.createElementVNode("span",Ii,t.toDisplayString(ve.label),1)],10,Fi))),128))],544),e.searchable&&!Ee.value?(t.openBlock(),t.createElementBlock("div",Ai," 无匹配 ")):t.createCommentVNode("",!0),se.value?(t.openBlock(),t.createElementBlock("button",{key:3,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!pe.value}]),disabled:!pe.value,onClick:De[3]||(De[3]=ve=>Ve(1))},[...De[7]||(De[7]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],10,Li)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),It=(e,o)=>{const l=e.__vccOpts||e;for(const[n,a]of o)l[n]=a;return l},Yt=It(zi,[["__scopeId","data-v-85ba0ec8"]]);function Nn(){const e=t.ref({top:0,up:!1});function o(l,n,a){const i=Gl(n),r=l.getBoundingClientRect(),c=lo(Math.min(r.right,i.right));if(!a){e.value={right:c,top:r.bottom+4,up:!1};return}const u=a.offsetHeight,b=i.bottom-r.bottom-8,h=r.top-i.top-8,C=b<u&&h>0,p=C?r.top-u-4:r.bottom+4,x=Math.min(i.top+8,r.bottom+4),R=Math.max(x,Math.min(i.bottom-u-8,p));e.value={right:c,top:R,up:C}}return{pos:e,place:o}}const $i=["title","onClick"],ko=It(t.defineComponent({__name:"color-picker",props:{modelOpen:{type:Boolean,default:void 0},colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"},triggerEl:{default:null},boundaryEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{expose:o,emit:l}){const n=e,a=l,i=[[{key:"colorAutomatic",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorSlate",value:"#595959"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorBlack",value:"#000000"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],r=[[{key:"colorNoFill",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorWhite",value:"#FFFFFF"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorSlate",value:"#595959"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],c=t.computed(()=>n.colorKey==="fill"?r:i);function u(ae){return g(n.locale,ae)}function b(ae){const ge=n.currentColor;return!ge&&!ae?!0:ge?ge.toLowerCase()===ae.toLowerCase():!1}const h=t.ref(!1),C=t.ref(null),p=t.ref(null),{pos:x,place:R}=Nn();t.watch(()=>n.modelOpen,ae=>{ae!==void 0&&ae!==h.value&&(ae?X():j())});function O(ae){const ge=C.value,me=p.value,pe=ae.target;ge&&ge.contains(pe)||me&&me.contains(pe)||j()}function X(){const ae=n.triggerEl??C.value;ae&&(h.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0),R(ae,n.boundaryEl),t.nextTick(()=>{const ge=n.triggerEl??C.value;if(!ge)return;const me=p.value;me&&(R(ge,n.boundaryEl,me),document.addEventListener("pointerdown",O))}))}function j(){h.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",O)}function Ee(ae){a("update:modelValue",ae),a("change",ae),j()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",O)}),o({open:h,openMenu:X,close:j}),(ae,ge)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:C,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[h.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:p,class:"color-picker__menu",style:t.normalizeStyle({left:t.unref(x).left!==void 0?t.unref(x).left+"px":void 0,right:t.unref(x).right!==void 0?t.unref(x).right+"px":void 0,top:t.unref(x).top+"px"}),onMousedown:ge[0]||(ge[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,(me,pe)=>(t.openBlock(),t.createElementBlock("div",{key:pe,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(me,se=>(t.openBlock(),t.createElementBlock("button",{key:se.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":b(se.value)}]),title:u(se.key),style:t.normalizeStyle({background:se.value||"transparent",border:se.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:Ve=>Ee(se.value)},null,14,$i))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f6c2d2cf"]]),_i=["title","onClick"],Hi={viewBox:"0 0 30 30",class:"border-picker__icon"},Wi=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Ui={class:"border-picker__label"},Pi=It(t.defineComponent({__name:"border-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},triggerEl:{default:null},boundaryEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:o,emit:l}){const n=e,a=l,i=[{key:"bottom",i18nKey:"borderBottom"},{key:"top",i18nKey:"borderTop"},{key:"left",i18nKey:"borderLeft"},{key:"right",i18nKey:"borderRight"},{key:"none",i18nKey:"borderNone"},{key:"all",i18nKey:"borderAll"},{key:"outer",i18nKey:"borderOuter"},{key:"thickOuter",i18nKey:"borderThickOuter"}],r=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],c={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},u={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function b(ae,ge){return u[ae].includes(ge)?"thick":c[ae].includes(ge)?"solid":"dashed"}const h=t.ref(!1),C=t.ref(null),p=t.ref(null),{pos:x,place:R}=Nn();t.watch(()=>n.modelOpen,ae=>{ae!==void 0&&ae!==h.value&&(ae?X():j())});function O(ae){const ge=C.value,me=p.value,pe=ae.target;ge&&ge.contains(pe)||me&&me.contains(pe)||j()}function X(){const ae=n.triggerEl??C.value;ae&&(h.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0),R(ae,n.boundaryEl),t.nextTick(()=>{const ge=n.triggerEl??C.value;if(!ge)return;const me=p.value;me&&(R(ge,n.boundaryEl,me),document.addEventListener("pointerdown",O))}))}function j(){h.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",O)}function Ee(ae){a("change",ae),j()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",O)}),o({open:h,openMenu:X,close:j}),(ae,ge)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:C,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[h.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:p,class:"border-picker__menu",style:t.normalizeStyle({left:t.unref(x).left!==void 0?t.unref(x).left+"px":void 0,right:t.unref(x).right!==void 0?t.unref(x).right+"px":void 0,top:t.unref(x).top+"px"}),onMousedown:ge[0]||(ge[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,me=>t.createElementVNode("button",{key:me.key,class:"border-picker__item",title:t.unref(g)(e.locale,me.i18nKey),onClick:pe=>Ee(me.key)},[(t.openBlock(),t.createElementBlock("svg",Hi,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,pe=>t.createElementVNode("line",{key:pe.name,x1:pe.x1,y1:pe.y1,x2:pe.x2,y2:pe.y2,stroke:"currentColor","stroke-width":b(me.key,pe.name)==="thick"?3:1.5,"stroke-dasharray":b(me.key,pe.name)==="dashed"?"0 4":"none","stroke-linecap":b(me.key,pe.name)==="dashed"?"round":"square"},null,8,Wi)),64))])),t.createElementVNode("span",Ui,t.toDisplayString(t.unref(g)(e.locale,me.i18nKey)),1)],8,_i)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-5c3ebafb"]]),Gi=["title","onClick"],Ki={viewBox:"0 0 1024 1024",class:"sort-picker__icon",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},qi=["x1","y1","x2","y2"],Yi=["d"],Xi={class:"sort-picker__label"},ji=It(t.defineComponent({__name:"sort-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentSort:{default:"asc"},triggerEl:{default:null},boundaryEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:o,emit:l}){const n=e,a=l,i=[{key:"asc",i18nKey:"sortAsc"},{key:"desc",i18nKey:"sortDesc"}],r=[{name:"bar1",x1:96,y1:224,x2:352,y2:224},{name:"bar2",x1:96,y1:512,x2:512,y2:512},{name:"bar3",x1:96,y1:800,x2:672,y2:800}],c={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},u=t.ref(!1),b=t.ref(null),h=t.ref(null),{pos:C,place:p}=Nn();t.watch(()=>n.modelOpen,j=>{j!==void 0&&j!==u.value&&(j?R():O())});function x(j){const Ee=b.value,ae=h.value,ge=j.target;Ee&&Ee.contains(ge)||ae&&ae.contains(ge)||O()}function R(){const j=n.triggerEl??b.value;j&&(u.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0),p(j,n.boundaryEl),t.nextTick(()=>{const Ee=n.triggerEl??b.value;if(!Ee)return;const ae=h.value;ae&&(p(Ee,n.boundaryEl,ae),document.addEventListener("pointerdown",x))}))}function O(){u.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",x)}function X(j){a("change",j),O()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",x)}),o({open:u,openMenu:R,close:O}),(j,Ee)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:b,class:"sort-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[u.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:h,class:"sort-picker__menu",style:t.normalizeStyle({left:t.unref(C).left!==void 0?t.unref(C).left+"px":void 0,right:t.unref(C).right!==void 0?t.unref(C).right+"px":void 0,top:t.unref(C).top+"px"}),onMousedown:Ee[0]||(Ee[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,ae=>t.createElementVNode("button",{key:ae.key,class:"sort-picker__item",title:t.unref(g)(e.locale,ae.i18nKey),onClick:ge=>X(ae.key)},[(t.openBlock(),t.createElementBlock("svg",Ki,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,ge=>t.createElementVNode("line",{key:ge.name,x1:ge.x1,y1:ge.y1,x2:ge.x2,y2:ge.y2},null,8,qi)),64)),t.createElementVNode("path",{d:c[ae.key]},null,8,Yi)])),t.createElementVNode("span",Xi,t.toDisplayString(t.unref(g)(e.locale,ae.i18nKey)),1)],8,Gi)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-ef7c7f4c"]]),Zi={key:0,class:"outline-picker__sep"},Ji=["onClick"],Qi={class:"outline-picker__label"},es=It(t.defineComponent({__name:"outline-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},boundaryEl:{default:null},axis:{default:null}},emits:["update:modelOpen","action"],setup(e,{expose:o,emit:l}){const n=e,a=l,i=[{key:"group",i18nKey:"outlineAddGroup"},{key:"ungroup",i18nKey:"outlineUngroup"},{key:"clear",i18nKey:"outlineClear"},{key:"expand",i18nKey:"outlineExpandAll"},{key:"collapse",i18nKey:"outlineCollapseAll"}],r=t.ref(!1),c=t.ref(null),u=t.ref(null),{pos:b,place:h}=Nn();t.watch(()=>n.modelOpen,O=>{O!==void 0&&O!==r.value&&(O?p():x())});function C(O){const X=c.value,j=u.value,Ee=O.target;X&&X.contains(Ee)||j&&j.contains(Ee)||x()}function p(){const O=n.triggerEl??c.value;O&&(r.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0),h(O,n.boundaryEl),t.nextTick(()=>{const X=n.triggerEl??c.value;if(!X)return;const j=u.value;j&&(h(X,n.boundaryEl,j),document.addEventListener("pointerdown",C))}))}function x(){r.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",C)}function R(O){n.axis&&(a("action",`${O}-${n.axis}`),x())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",C)}),o({open:r,openMenu:p,close:x}),(O,X)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:c,class:"outline-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:u,class:"outline-picker__menu",style:t.normalizeStyle({left:t.unref(b).left!==void 0?t.unref(b).left+"px":void 0,right:t.unref(b).right!==void 0?t.unref(b).right+"px":void 0,top:t.unref(b).top+"px"}),onMousedown:X[0]||(X[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,j=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:j.key},[j.sep?(t.openBlock(),t.createElementBlock("div",Zi)):(t.openBlock(),t.createElementBlock("div",{key:1,class:"outline-picker__item",onClick:Ee=>R(j.key)},[t.createElementVNode("span",Qi,t.toDisplayString(t.unref(g)(e.locale,j.i18nKey)),1)],8,Ji))],64))),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-9ba8ba10"]]),ts=["title","onClick"],ls=["innerHTML"],ns={class:"merge-picker__label"},os=It(t.defineComponent({__name:"merge-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},boundaryEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:o,emit:l}){const n=e,a=l,i=t.ref(!1),r=t.ref(null),c=t.ref(null),{pos:u,place:b}=Nn();t.watch(()=>n.modelOpen,R=>{R!==void 0&&R!==i.value&&(R?C():p())});function h(R){const O=r.value,X=c.value,j=R.target;O&&O.contains(j)||X&&X.contains(j)||p()}function C(){const R=n.triggerEl??r.value;R&&(i.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0),b(R,n.boundaryEl),t.nextTick(()=>{const O=n.triggerEl??r.value;if(!O)return;const X=c.value;X&&(b(O,n.boundaryEl,X),document.addEventListener("pointerdown",h))}))}function p(){i.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",h)}function x(R){a("change",R),p()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",h)}),o({open:i,openMenu:C,close:p}),(R,O)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"merge-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:c,class:"merge-picker__menu",style:t.normalizeStyle({left:t.unref(u).left!==void 0?t.unref(u).left+"px":void 0,right:t.unref(u).right!==void 0?t.unref(u).right+"px":void 0,top:t.unref(u).top+"px"}),onMousedown:O[0]||(O[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(ni),X=>(t.openBlock(),t.createElementBlock("button",{key:X.key,class:"merge-picker__item",title:t.unref(g)(e.locale,X.labelKey),onClick:j=>x(X.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:X.icon},null,8,ls),t.createElementVNode("span",ns,t.toDisplayString(t.unref(g)(e.locale,X.labelKey)),1)],8,ts))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-b44e2e92"]]),rs=["title","disabled"],as={class:"cf-menu-trigger__label"},is=["disabled"],ss=["disabled"],cs=["disabled"],ds=["disabled"],us=["disabled"],fs=["disabled"],ms=["disabled"],ps=["onClick"],hs=["disabled"],gs=["disabled"],bs=["disabled"],ys=["disabled"],Cs=It(t.defineComponent({__name:"conditional-format-menu",props:{locale:{},hasSelection:{type:Boolean},themeVars:{default:()=>({})},boundaryEl:{default:null},modelOpen:{type:Boolean,default:!1}},emits:["preset","new-rule","manage","clear","update:modelOpen"],setup(e,{emit:o}){const l=e,n=o,a=t.ref(null),i=t.ref(null),r=t.ref(null),c=t.ref(null),u=t.ref(null),b=t.ref(!1),h=t.ref(null),C=t.ref("right"),p=t.ref("right"),x=t.ref(!1),R=t.ref(!1),O=t.ref(!1),X=t.ref(!1),j=t.ref(!1),Ee=t.ref(!1),ae=t.ref(!1),ge=t.ref(!1),{pos:me,place:pe}=Nn(),se=t.ref({top:0}),Ve=t.ref({top:0});let tt;const Qe=[{type:"equal",key:"cfEqual"},{type:"notEqual",key:"cfNotEqual"},{type:"greaterThan",key:"cfGreaterThan"},{type:"greaterThanOrEqual",key:"cfGreaterThanOrEqual"},{type:"lessThan",key:"cfLessThan"},{type:"lessThanOrEqual",key:"cfLessThanOrEqual"},{type:"between",key:"cfBetween"},{type:"notBetween",key:"cfNotBetween"},{type:"textContains",key:"cfTextContains"},{type:"textNotContains",key:"cfTextNotContains"}];function K(){n("update:modelOpen",!b.value)}t.watch(()=>l.modelOpen,U=>{U&&!b.value?it():!U&&b.value&&I()});function it(){const U=i.value;U&&(b.value=!0,h.value=null,pe(U,l.boundaryEl),t.nextTick(()=>{var de;const q=(de=r.value)==null?void 0:de.closest(".cf-menu");q&&(pe(U,l.boundaryEl,q),W())}))}function I(){b.value=!1,clearTimeout(tt),h.value=null}function D(){n("update:modelOpen",!1)}function W(){const U=r.value;U&&(O.value=U.scrollTop>1,X.value=U.scrollTop+U.clientHeight<U.scrollHeight-1)}function we(U){const q=r.value;q&&(q.scrollTop=Math.max(0,Math.min(q.scrollHeight-q.clientHeight,q.scrollTop+U*30)))}function $e(U){const q=U==="highlight"?c.value:u.value;if(!q)return;const de=q.scrollTop>1,ze=q.scrollTop+q.clientHeight<q.scrollHeight-1;U==="highlight"?(j.value=de,Ee.value=ze):(ae.value=de,ge.value=ze)}function Z(U,q){const de=U==="highlight"?c.value:u.value;de&&(de.scrollTop=Math.max(0,Math.min(de.scrollHeight-de.clientHeight,de.scrollTop+q*30)))}function Le(U,q){U&&(U.scrollHeight<=U.clientHeight||(q.preventDefault(),U.scrollTop=Math.max(0,Math.min(U.scrollHeight-U.clientHeight,U.scrollTop+q.deltaY))))}function ie(U){Le(r.value,U),W()}function De(U){Le(c.value,U),$e("highlight")}function N(U){Le(u.value,U),$e("clear")}function J(U){var de,ze,Re,Pe,lt,_e;if(!b.value)return;const q=U.target;(de=a.value)!=null&&de.contains(q)||(ze=r.value)!=null&&ze.contains(q)||(Pe=(Re=c.value)==null?void 0:Re.closest(".cf-submenu-wrap"))!=null&&Pe.contains(q)||(_e=(lt=u.value)==null?void 0:lt.closest(".cf-submenu-wrap"))!=null&&_e.contains(q)||D()}function le(U,q){clearTimeout(tt),h.value=U,t.nextTick(()=>{var Xe,S;const de=(q==null?void 0:q.currentTarget)instanceof HTMLElement?q.currentTarget:null;if(!de)return;const ze=de.getBoundingClientRect(),Re=U==="highlight"?(Xe=c.value)==null?void 0:Xe.closest(".cf-submenu-wrap"):(S=u.value)==null?void 0:S.closest(".cf-submenu-wrap");if(!Re)return;const Pe=Gl(l.boundaryEl),lt=Re.offsetWidth,_e=Re.offsetHeight,Ct=ze.right+lt+8>Pe.right;let st="right";Ct&&(st="left");const ct=ze.top+_e>Pe.bottom-8,Vt=ct?ze.bottom+5-_e:ze.top-5,$t=Math.min(Pe.top+8,Vt),_t=Math.max($t,Math.min(Pe.bottom-_e-8,Vt)),Ht=st==="right"?{left:ze.right+4,top:_t}:{right:lo(ze.left-4),top:_t};U==="highlight"?(C.value=st,x.value=ct,se.value=Ht):(p.value=st,R.value=ct,Ve.value=Ht),$e(U)})}function re(){clearTimeout(tt),tt=setTimeout(()=>{h.value=null},150)}function ne(){clearTimeout(tt)}function ve(U){n("preset",U),D()}function Ce(){n("new-rule"),D()}function _(){n("manage"),D()}function L(U){n("clear",U),D()}return t.onMounted(()=>{document.addEventListener("pointerdown",J),window.addEventListener("resize",D),window.addEventListener("scroll",D,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",J),window.removeEventListener("resize",D),window.removeEventListener("scroll",D,!0)}),(U,q)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:a,class:"cf-menu-root"},[t.createElementVNode("button",{ref_key:"btnRef",ref:i,type:"button",class:"toolbar-btn cf-menu-trigger",title:t.unref(g)(e.locale,"conditionalFormat"),disabled:!e.hasSelection,onClick:K},[q[22]||(q[22]=t.createStaticVNode('<svg class="cf-menu-trigger__icon" viewBox="0 0 1097 1024" version="1.1" fill="currentColor" data-v-f75544d4><path d="M877.714286 52.809143V487.862857h-73.142857V125.952H73.142857v585.142857h247.661714v73.142857H0v-731.428571z" data-v-f75544d4></path><path d="M841.142857 267.702857v73.142857H36.571429v-73.142857zM287.451429 457.142857v73.142857H36.571429v-73.142857z" data-v-f75544d4></path><path d="M324.022857 109.714286v674.596571h-73.142857V109.714286zM584.850286 109.714286v341.942857h-73.142857V109.714286zM1060.278857 512h-658.285714v475.428571h658.285714V512z m-73.216 73.142857v329.142857h-512V585.142857h512z" data-v-f75544d4></path><path d="M877.421714 637.952v73.142857H568.539429v-73.142857zM877.421714 784.237714v73.142857H568.539429v-73.142857z" data-v-f75544d4></path></svg>',1)),t.createElementVNode("span",as,t.toDisplayString(t.unref(g)(e.locale,"conditionalFormat")),1),q[23]||(q[23]=t.createElementVNode("svg",{class:"cf-menu-trigger__caret",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1))],8,rs),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-pop"},{default:t.withCtx(()=>[b.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-menu",style:t.normalizeStyle({...e.themeVars,right:t.unref(me).right+"px",top:t.unref(me).top+"px"}),onClick:q[8]||(q[8]=t.withModifiers(()=>{},["stop"])),onMousedown:q[9]||(q[9]=t.withModifiers(()=>{},["prevent"]))},[O.value||X.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!O.value}]),disabled:!O.value,onClick:q[0]||(q[0]=de=>we(-1))},[...q[24]||(q[24]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,is)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"menuRef",ref:r,class:"cf-menu__body",onScroll:W,onWheelPassive:ie},[t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:q[1]||(q[1]=de=>le("highlight",de)),onMouseleave:re},[t.createElementVNode("span",null,t.toDisplayString(t.unref(g)(e.locale,"cfHighlightRules")),1),q[25]||(q[25]=t.createElementVNode("svg",{class:"cf-menu__arrow",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M361.387 180.053a32 32 0 0 0 0 45.227L648.107 512l-286.72 286.72a32 32 0 1 0 45.227 45.227l309.333-309.334a32 32 0 0 0 0-45.226L406.613 180.053a32 32 0 0 0-45.226 0z"})],-1))],32),q[27]||(q[27]=t.createElementVNode("div",{class:"cf-menu__sep"},null,-1)),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:q[2]||(q[2]=de=>e.hasSelection&&ve("blank"))},t.toDisplayString(t.unref(g)(e.locale,"cfBlank")),11,ss),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:q[3]||(q[3]=de=>e.hasSelection&&ve("notBlank"))},t.toDisplayString(t.unref(g)(e.locale,"cfNotBlank")),11,cs),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:q[4]||(q[4]=de=>e.hasSelection&&ve("duplicate"))},t.toDisplayString(t.unref(g)(e.locale,"cfDuplicate")),11,ds),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:q[5]||(q[5]=de=>e.hasSelection&&ve("unique"))},t.toDisplayString(t.unref(g)(e.locale,"cfUnique")),11,us),q[28]||(q[28]=t.createElementVNode("div",{class:"cf-menu__sep"},null,-1)),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:Ce},t.toDisplayString(t.unref(g)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:_},t.toDisplayString(t.unref(g)(e.locale,"cfManageRules")),1),t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:q[6]||(q[6]=de=>le("clear",de)),onMouseleave:re},[t.createElementVNode("span",null,t.toDisplayString(t.unref(g)(e.locale,"cfClearRules")),1),q[26]||(q[26]=t.createElementVNode("svg",{class:"cf-menu__arrow",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M361.387 180.053a32 32 0 0 0 0 45.227L648.107 512l-286.72 286.72a32 32 0 1 0 45.227 45.227l309.333-309.334a32 32 0 0 0 0-45.226L406.613 180.053a32 32 0 0 0-45.226 0z"})],-1))],32)],544),O.value||X.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!X.value}]),disabled:!X.value,onClick:q[7]||(q[7]=de=>we(1))},[...q[29]||(q[29]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,fs)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-sub-pop"},{default:t.withCtx(()=>[b.value&&h.value==="highlight"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":C.value==="left","cf-submenu-wrap--up":x.value}]),style:t.normalizeStyle({...e.themeVars,left:se.value.left!==void 0?se.value.left+"px":void 0,right:se.value.right!==void 0?se.value.right+"px":void 0,top:se.value.top+"px"}),onClick:q[13]||(q[13]=t.withModifiers(()=>{},["stop"])),onMousedown:q[14]||(q[14]=t.withModifiers(()=>{},["prevent"])),onMouseenter:ne,onMouseleave:re},[j.value||Ee.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!j.value}]),disabled:!j.value,onClick:q[10]||(q[10]=de=>Z("highlight",-1))},[...q[30]||(q[30]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,ms)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"highlightSubRef",ref:c,class:"cf-submenu",onScroll:q[11]||(q[11]=de=>$e("highlight")),onWheelPassive:De},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(Qe,de=>t.createElementVNode("button",{key:de.type,type:"button",class:"cf-menu__subitem",onClick:ze=>ve(de.type)},t.toDisplayString(t.unref(g)(e.locale,de.key)),9,ps)),64))],544),j.value||Ee.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!Ee.value}]),disabled:!Ee.value,onClick:q[12]||(q[12]=de=>Z("highlight",1))},[...q[31]||(q[31]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,hs)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-sub-pop"},{default:t.withCtx(()=>[b.value&&h.value==="clear"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":p.value==="left","cf-submenu-wrap--up":R.value}]),style:t.normalizeStyle({...e.themeVars,left:Ve.value.left!==void 0?Ve.value.left+"px":void 0,right:Ve.value.right!==void 0?Ve.value.right+"px":void 0,top:Ve.value.top+"px"}),onClick:q[20]||(q[20]=t.withModifiers(()=>{},["stop"])),onMousedown:q[21]||(q[21]=t.withModifiers(()=>{},["prevent"])),onMouseenter:ne,onMouseleave:re},[ae.value||ge.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!ae.value}]),disabled:!ae.value,onClick:q[15]||(q[15]=de=>Z("clear",-1))},[...q[32]||(q[32]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,gs)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"clearSubRef",ref:u,class:"cf-submenu",onScroll:q[18]||(q[18]=de=>$e("clear")),onWheelPassive:N},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__subitem",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:q[16]||(q[16]=de=>e.hasSelection&&L("selection"))},t.toDisplayString(t.unref(g)(e.locale,"cfClearSelected")),11,bs),t.createElementVNode("button",{type:"button",class:"cf-menu__subitem",onClick:q[17]||(q[17]=de=>L("sheet"))},t.toDisplayString(t.unref(g)(e.locale,"cfClearSheet")),1)],544),ae.value||ge.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!ge.value}]),disabled:!ge.value,onClick:q[19]||(q[19]=de=>Z("clear",1))},[...q[33]||(q[33]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,ys)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f75544d4"]]),ws=["disabled","title","onClick"],vs={class:"calc-picker__label"},ks=It(t.defineComponent({__name:"calc-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},disabled:{type:Boolean,default:!1},boundaryEl:{}},emits:["update:modelOpen","change"],setup(e,{expose:o,emit:l}){const n=e,a=l,i=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),c=t.ref(null),u=t.ref(null),{pos:b,place:h}=Nn();t.watch(()=>n.modelOpen,O=>{O!==void 0&&O!==r.value&&(O?p():x())});function C(O){const X=c.value,j=u.value,Ee=O.target;X&&X.contains(Ee)||j&&j.contains(Ee)||x()}function p(){const O=n.triggerEl??c.value;O&&(r.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0),h(O,n.boundaryEl),t.nextTick(()=>{const X=n.triggerEl??c.value;if(!X)return;const j=u.value;j&&(h(X,n.boundaryEl,j),document.addEventListener("pointerdown",C))}))}function x(){r.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",C)}function R(O){n.disabled||(a("change",O),x())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",C)}),o({open:r,openMenu:p,close:x}),(O,X)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:c,class:"calc-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:u,class:"calc-picker__menu",style:t.normalizeStyle({left:t.unref(b).left!==void 0?t.unref(b).left+"px":void 0,right:t.unref(b).right!==void 0?t.unref(b).right+"px":void 0,top:t.unref(b).top+"px"}),onMousedown:X[0]||(X[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,j=>t.createElementVNode("button",{key:j.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(g)(e.locale,j.labelKey),onClick:Ee=>R(j.key)},[t.createElementVNode("span",vs,t.toDisplayString(t.unref(g)(e.locale,j.labelKey)),1)],10,ws)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-01c4024a"]]),Es={class:"tb-item","data-key":"undo"},Rs=["title","disabled"],Ss={class:"toolbar-btn__label"},Ms={class:"tb-item","data-key":"redo"},Bs=["title","disabled"],Ns={class:"toolbar-btn__label"},xs={class:"tb-item","data-key":"paint"},Ts=["title","disabled"],Vs={class:"toolbar-btn__label"},Ds={class:"tb-item","data-key":"clear"},Fs=["title","disabled"],Os={class:"toolbar-btn__label"},Is={class:"tb-item","data-key":"font"},As={class:"tb-item","data-key":"fontSize"},Ls={class:"toolbar-font-size"},zs=["value","title"],$s=["title"],_s=["title","disabled"],Hs=["title","disabled"],Ws={class:"tb-item","data-key":"bold"},Us=["title","disabled"],Ps={class:"toolbar-btn__label"},Gs={class:"tb-item","data-key":"italic"},Ks=["title","disabled"],qs={class:"toolbar-btn__label"},Ys={class:"tb-item","data-key":"underline"},Xs=["title","disabled"],js={class:"toolbar-btn__label"},Zs={class:"tb-item","data-key":"strike"},Js=["title","disabled"],Qs={class:"toolbar-btn__label"},ec={class:"tb-item","data-key":"textColor"},tc={class:"toolbar-split"},lc=["title","disabled"],nc={viewBox:"0 0 1024 1024",fill:"currentColor"},oc=["fill"],rc={class:"toolbar-btn__label"},ac=["title","disabled"],ic={class:"tb-item","data-key":"fillColor"},sc={class:"toolbar-split"},cc=["title","disabled"],dc={viewBox:"0 0 1024 1024",fill:"currentColor"},uc=["fill"],fc={class:"toolbar-btn__label"},mc=["title","disabled"],pc={class:"tb-item","data-key":"border"},hc={class:"toolbar-split"},gc=["title","disabled"],bc={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},yc=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Cc={class:"toolbar-btn__label"},wc=["title","disabled"],vc={class:"tb-item","data-key":"hAlign"},kc={class:"tb-item","data-key":"vAlign"},Ec={class:"tb-item","data-key":"wrap"},Rc=["title"],Sc={class:"toolbar-btn__label"},Mc={class:"tb-item","data-key":"merge"},Bc={class:"toolbar-split"},Nc=["title","disabled"],xc={class:"toolbar-btn__label"},Tc=["title","disabled"],Vc={class:"tb-item","data-key":"numFmt"},Dc={class:"toolbar-number-format-group"},Fc=["title","disabled"],Oc=["title","disabled"],Ic={class:"tb-item","data-key":"calc"},Ac={class:"toolbar-split"},Lc=["title","disabled"],zc={class:"toolbar-btn__label"},$c=["title","disabled"],_c={class:"tb-item","data-key":"sort"},Hc={class:"toolbar-split"},Wc=["title","disabled"],Uc={viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},Pc=["x1","y1","x2","y2"],Gc=["d"],Kc={class:"toolbar-btn__label"},qc=["title","disabled"],Yc={class:"tb-item","data-key":"outline"},Xc=["disabled","title"],jc={class:"toolbar-btn__label"},Zc={class:"tb-item","data-key":"filter"},Jc=["disabled","title"],Qc={class:"toolbar-btn__label"},ed={class:"tb-item","data-key":"freeze"},td={class:"tb-item","data-key":"cf"},ld={class:"tb-item","data-key":"dv"},nd=["title"],od={class:"toolbar-btn__label"},rd={class:"tb-item","data-key":"find"},ad=["title"],id={class:"toolbar-btn__label"},sd=["disabled"],cd=["disabled"],Gr='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M160 448 H864" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M448 160 V864" /><path d="M192 192 H416 V416 H192 Z" /></svg>',dd='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M160 448 H864" /><path d="M192 192 H832 V416 H192 Z" /></svg>',ud='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M448 160 V864" /><path d="M192 192 H416 V832 H192 Z" /></svg>',fd='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M160 448 H864" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M448 160 V864" /><path fill="none" stroke="currentColor" stroke-width="48" stroke-linecap="round" d="M224 224 L416 416" /><path fill="none" stroke="currentColor" stroke-width="48" stroke-linecap="round" d="M416 224 L224 416" /></svg>',Qo=2,md=6,pd=34,hd=It(t.defineComponent({__name:"toolbar",props:{locale:{},canUndo:{type:Boolean},canRedo:{type:Boolean},paintFmtActive:{type:Boolean},hasSelection:{type:Boolean},fontFamilyOptions:{},fontSizeOptions:{},selFontFamily:{},selFontSize:{},fontSizeInput:{},fontSizeMenuOpen:{type:Boolean},selFontWeight:{type:Boolean},selFontStyle:{type:Boolean},selUnderline:{type:Boolean},selStrikethrough:{type:Boolean},selTextColor:{},textColorMenuOpen:{type:Boolean},selFillColor:{},fillColorMenuOpen:{type:Boolean},cachedTextColor:{},cachedFillColor:{},borderMenuOpen:{type:Boolean},cachedBorder:{},sortMenuOpen:{type:Boolean},cachedSortOrder:{},canSort:{type:Boolean},outlineMenuOpen:{type:Boolean},outlineAxis:{},canFilter:{type:Boolean},filterActive:{type:Boolean},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},calcMenuOpen:{type:Boolean},cfMenuOpen:{type:Boolean},freezeMenuOpen:{type:Boolean},fontMenuOpen:{type:Boolean},hAlignMenuOpen:{type:Boolean},vAlignMenuOpen:{type:Boolean},numFmtMenuOpen:{type:Boolean},isSingleCell:{type:Boolean},hasFreeze:{type:Boolean},freezePanesDisabled:{type:Boolean},themeVars:{},selNumberFormat:{},nfOptions:{},canIncreaseDecimals:{type:Boolean},canDecreaseDecimals:{type:Boolean},boundaryEl:{}},emits:["undo","redo","paint-format","clear-format","font-size-blur","font-size-toggle","font-size-step-up","font-size-step-down","bold-toggle","italic-toggle","underline-toggle","strikethrough-toggle","apply-text-color","apply-fill-color","apply-border","apply-sort","wrap-toggle","apply-merge","calc-sum","calc-avg","calc-count","find","increase-decimals","decrease-decimals","toggle-filter","cf-new-rule","cf-manage","open-data-validation","font-family-change","font-size-change","h-align-change","v-align-change","font-size-input","text-color-change","fill-color-change","number-format-change","freeze-change","cf-preset","outline-action","font-size-keydown","update:font-size-menu-open","update:text-color-menu-open","update:fill-color-menu-open","update:border-menu-open","update:sort-menu-open","update:outline-menu-open","update:merge-menu-open","update:calc-menu-open","update:cf-menu-open","update:freeze-menu-open","update:font-menu-open","update:h-align-menu-open","update:v-align-menu-open","update:num-fmt-menu-open","border-change","sort-change","merge-change","cf-clear"],setup(e,{expose:o,emit:l}){const n=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],a={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},i={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function r(Xe,S){return i[Xe].includes(S)?"thick":a[Xe].includes(S)?"solid":"dashed"}const c={none:"borderNone",bottom:"borderBottom",top:"borderTop",left:"borderLeft",right:"borderRight",all:"borderAll",outer:"borderOuter",thickOuter:"borderThickOuter"},u=[{name:"bar1",x1:96,y1:224,x2:352,y2:224},{name:"bar2",x1:96,y1:512,x2:512,y2:512},{name:"bar3",x1:96,y1:800,x2:672,y2:800}],b={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},h=["undo","redo","paint","clear","sep1","font","fontSize","sep2","bold","italic","underline","strike","sep3","textColor","fillColor","border","sep4","hAlign","vAlign","wrap","merge","sep6","numFmt","sep7","calc","sort","filter","outline","freeze","cf","dv","find"],C=t.ref(null),p=t.ref(null),x=t.ref(null),R=t.ref(null),O=t.ref(null),X=t.ref(null),j=t.ref(null),Ee=t.ref(null),ae=t.ref(null),ge=t.ref(null),me=t.ref(null),pe=t.ref(new Set),se=t.ref(!1),Ve=t.ref(!1),tt=t.ref(0),Qe=t.ref(!1),K=t.ref(!1),it=new Map,I=t.computed(()=>pe.value.size>0);function D(Xe){return pe.value.has(Xe)}const W=t.computed(()=>{const Xe=p.value;return Xe instanceof HTMLElement?Xe:void 0});function we(Xe){return W.value?!D(Xe):!0}function $e(){for(const Xe of h){const S=it.get(Xe);if(S===void 0||S===0)return!0}return!1}function Z(){if(!C.value)return;C.value.querySelectorAll(".tb-item").forEach(S=>{const ee=S.dataset.key;if(!ee)return;const xt=S.offsetWidth;xt>0?it.set(ee,xt):it.has(ee)||it.set(ee,0)})}function Le(Xe,S){if(Xe.size!==S.size)return!1;for(const ee of Xe)if(!S.has(ee))return!1;return!0}let ie=0,De=0,N=null;function J(){if(ie&&cancelAnimationFrame(ie),De>60){N&&clearTimeout(N),N=setTimeout(()=>{De=0,J()},500);return}De++,ie=requestAnimationFrame(()=>requestAnimationFrame(le))}function le(){if(!C.value)return;const Xe=C.value.clientWidth-md*2;if(Xe<=0){J();return}De=0,(it.size===0||$e())&&Z();let S=0;for(const xt of h)S+=(it.get(xt)??0)+Qo;const ee=new Set;if(S>Xe){const xt=Xe-pd-Qo;let Dt=0;for(let tl=0;tl<h.length;tl++){const gl=h[tl],jt=(it.get(gl)??0)+Qo;if(Dt+jt>xt){for(let Kt=tl;Kt<h.length;Kt++)ee.add(h[Kt]);break}Dt+=jt}}Le(ee,pe.value)||(pe.value=ee,tt.value++,ee.size===0&&(se.value=!1))}let re=null;const ne=t.ref(0),ve=t.computed(()=>{const Xe=x.value,S={position:"fixed",top:"0px",right:"0px"};if(!Xe)return{...lt.themeVars,...S};ne.value;const ee=Xe.getBoundingClientRect(),xt=Gl(lt.boundaryEl);return{...lt.themeVars,position:"fixed",top:`${ee.bottom+4}px`,right:`${lo(Math.min(ee.right,xt.right))}px`}});function Ce(){se.value&&(ne.value++,t.nextTick(()=>le()))}function _(Xe){var ee,xt,Dt;if(!se.value)return;const S=Xe.target;(ee=S.closest)!=null&&ee.call(S,".overflow-menu-wrap")||(xt=x.value)!=null&&xt.contains(S)||(Dt=S.closest)!=null&&Dt.call(S,".cf-menu, .sp-dropdown__menu, .color-picker__menu, .outline-picker__menu, .border-picker__menu, .calc-picker__menu, .merge-picker__menu, .sort-picker__menu")||(Ve.value=!0,se.value=!1,t.nextTick(()=>{Ve.value=!1}))}function L(){se.value=!se.value,se.value&&t.nextTick(Re)}function U(){se.value=!1,_e("open-data-validation")}function q(){se.value=!1,_e("find")}function de(){se.value=!1,_e("toggle-filter")}function ze(){se.value=!1}function Re(){const Xe=p.value;Xe&&(Qe.value=Xe.scrollTop>1,K.value=Xe.scrollTop+Xe.clientHeight<Xe.scrollHeight-1,Vt())}function Pe(Xe){const S=p.value;S&&(S.scrollTop=Math.max(0,Math.min(S.scrollHeight-S.clientHeight,S.scrollTop+Xe*40)))}o({closeOverflow:ze}),t.onMounted(()=>{J(),C.value&&(re=new ResizeObserver(()=>{se.value||J()}),re.observe(C.value)),document.addEventListener("pointerdown",_,!0),window.addEventListener("resize",Ce),window.addEventListener("load",J),window.addEventListener("orientationchange",J)}),t.onBeforeUnmount(()=>{ie&&cancelAnimationFrame(ie),N&&clearTimeout(N),re==null||re.disconnect(),document.removeEventListener("pointerdown",_,!0),window.removeEventListener("resize",Ce),window.removeEventListener("load",J),window.removeEventListener("orientationchange",J)});const lt=e,_e=l,Ct=["fontSize","textColor","fillColor","border","merge","calc","sort","outline","cf","freeze","font","hAlign","vAlign","numFmt"],st={fontSize:"update:font-size-menu-open",textColor:"update:text-color-menu-open",fillColor:"update:fill-color-menu-open",border:"update:border-menu-open",merge:"update:merge-menu-open",calc:"update:calc-menu-open",sort:"update:sort-menu-open",outline:"update:outline-menu-open",cf:"update:cf-menu-open",freeze:"update:freeze-menu-open",font:"update:font-menu-open",hAlign:"update:h-align-menu-open",vAlign:"update:v-align-menu-open",numFmt:"update:num-fmt-menu-open"};function ct(Xe,S){if(S)for(const ee of Ct)ee!==Xe&&_e(st[ee],!1);_e(st[Xe],S)}function Vt(){for(const Xe of Ct)_e(st[Xe],!1)}function $t(Xe){var ee;const S=Xe.target;(ee=S.closest)!=null&&ee.call(S,".toolbar-split__arrow, .outline-trigger, .toolbar-font-size__btn, .cf-menu-trigger, .sp-dropdown__trigger")||Vt()}const _t=t.computed(()=>lt.selNumberFormat===Kl?g(lt.locale,"nfMixed"):""),Ht=t.computed(()=>{const Xe=[{label:g(lt.locale,"freezeFirstRow"),value:"firstRow",icon:dd},{label:g(lt.locale,"freezeFirstCol"),value:"firstCol",icon:ud}];return lt.hasFreeze?Xe.unshift({label:g(lt.locale,"unfreezePanes"),value:"unfreeze",icon:fd}):Xe.unshift({label:g(lt.locale,"freezePanes"),value:"panes",icon:Gr,disabled:lt.freezePanesDisabled}),Xe});return(Xe,S)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:C,class:"toolbar",onMousedown:S[65]||(S[65]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("undo"),to:W.value},[t.createElementVNode("div",Es,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(g)(e.locale,"undo"),disabled:!e.canUndo,onClick:S[0]||(S[0]=ee=>_e("undo"))},[S[69]||(S[69]=t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272"})],-1)),t.createElementVNode("span",Ss,t.toDisplayString(t.unref(g)(e.locale,"undo")),1)],10,Rs)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("redo"),to:W.value},[t.createElementVNode("div",Ms,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(g)(e.locale,"redo"),disabled:!e.canRedo,onClick:S[1]||(S[1]=ee=>_e("redo"))},[S[70]||(S[70]=t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{transform:"translate(1024, 0) scale(-1, 1)",d:"M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272"})],-1)),t.createElementVNode("span",Ns,t.toDisplayString(t.unref(g)(e.locale,"redo")),1)],10,Bs)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("paint"),to:W.value},[t.createElementVNode("div",xs,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(g)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:S[2]||(S[2]=ee=>_e("paint-format"))},[S[71]||(S[71]=t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M722.285714 438.857143a36.571429 36.571429 0 0 1-36.571428 36.571428h-512a36.571429 36.571429 0 0 1-36.571429-36.571428V164.571429a36.571429 36.571429 0 0 1 36.571429-36.571429h512a36.571429 36.571429 0 0 1 36.571428 36.571429V256h128a36.571429 36.571429 0 0 1 36.571429 36.571429v294.4a36.571429 36.571429 0 0 1-31.890286 36.278857L448 675.766857V859.428571a36.571429 36.571429 0 0 1-32.292571 36.315429l-4.278858 0.256a36.571429 36.571429 0 0 1-36.571428-36.571429v-215.771428a36.571429 36.571429 0 0 1 31.890286-36.278857l406.966857-52.553143V329.142857h-91.428572v109.714286z m-73.142857-237.714286h-438.857143V402.285714h438.857143V201.142857z"})],-1)),t.createElementVNode("span",Vs,t.toDisplayString(t.unref(g)(e.locale,"paintFormat")),1)],10,Ts)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("clear"),to:W.value},[t.createElementVNode("div",Ds,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(g)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:S[3]||(S[3]=ee=>_e("clear-format"))},[S[72]||(S[72]=t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M672.748 105.674c-3.666-3.799-8.778-5.949-14.125-5.949-5.341 0-10.459 2.15-14.119 5.949L10.418 754.633c-7.789 8.163-7.789 20.798 0 28.967l123.353 126.213c7.782 7.979 23.113 14.461 34.111 14.461h395.042c12.774-0.742 24.882-5.854 34.162-14.461l416.525-426.362c7.751-8.163 7.751-20.76 0-28.916l-340.92-348.861h0.057zM557.85 832.801c-9.273 8.582-21.343 13.707-34.111 14.461H217.888c-12.781-0.742-24.882-5.867-34.162-14.461l-58.074-59.482c-7.782-8.163-7.782-20.804 0-28.967l232.333-237.87c3.666-3.799 8.778-5.949 14.125-5.949s10.453 2.15 14.119 5.949l231.102 236.551c7.744 8.157 7.744 20.753 0 28.916l-59.539 60.909 0.058-0.057z m0 0"})],-1)),t.createElementVNode("span",Os,t.toDisplayString(t.unref(g)(e.locale,"clearFormat")),1)],10,Fs)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("sep1"),to:W.value},[S[73]||(S[73]=t.createElementVNode("div",{class:"tb-item","data-key":"sep1"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("font"),to:W.value},[t.createElementVNode("div",Is,[t.createVNode(Yt,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:D("font")?"100%":110,"menu-width":D("font")?120:void 0,"visible-count":8,title:t.unref(g)(e.locale,"fontFamily"),align:"right","model-open":e.fontMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":S[4]||(S[4]=ee=>ct("font",ee)),onChange:S[5]||(S[5]=ee=>_e("font-family-change",ee))},null,8,["model-value","options","width","menu-width","title","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("fontSize"),to:W.value},[t.createElementVNode("div",As,[t.createElementVNode("div",Ls,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(g)(e.locale,"fontSize"),onMousedown:S[6]||(S[6]=t.withModifiers(()=>{},["stop"])),onInput:S[7]||(S[7]=ee=>_e("font-size-input",ee.target.value)),onBlur:S[8]||(S[8]=ee=>_e("font-size-blur")),onKeydown:S[9]||(S[9]=ee=>_e("font-size-keydown",ee))},null,40,zs),t.createVNode(Yt,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:D("fontSize")?"100%":56,"menu-width":D("fontSize")?120:56,"visible-count":9,title:t.unref(g)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":me.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":S[10]||(S[10]=ee=>ct("fontSize",ee)),onChange:S[11]||(S[11]=ee=>_e("font-size-change",ee))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el","boundary-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:me,class:"toolbar-font-size__btn",type:"button",title:t.unref(g)(e.locale,"fontSize"),onMousedown:S[12]||(S[12]=t.withModifiers(()=>{},["prevent"])),onClick:S[13]||(S[13]=ee=>_e("font-size-toggle"))},[...S[74]||(S[74]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],40,$s),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(g)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:S[14]||(S[14]=t.withModifiers(()=>{},["prevent"])),onClick:S[15]||(S[15]=ee=>_e("font-size-step-down"))},[...S[75]||(S[75]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M675.2 184.533333h260.266667a12.8 12.8 0 0 1 12.8 12.8v21.333334a12.8 12.8 0 0 1-12.8 12.8H675.2a12.8 12.8 0 0 1-12.8-12.8v-21.333334a12.8 12.8 0 0 1 12.8-12.8zM687.744 739.413333l87.722667 197.717334a12.8 12.8 0 0 0 11.733333 7.594666h54.016a12.8 12.8 0 0 0 11.605333-18.133333l-7.466666-16.213333-131.2-287.829334-35.413334-77.653333-166.570666-365.525333a36.266667 36.266667 0 0 0-66.432 0.938666l-154.154667 365.482667-34.688 82.261333-34.688 82.218667-84.778667 201.045333-6.570666 15.658667a12.8 12.8 0 0 0 11.776 17.749333h57.557333a12.8 12.8 0 0 0 11.904-8.106666l102.4-258.474667 343.466667-4.010667 29.781333 65.28zM480.426667 284.672l132.352 290.261333 12.288 27.050667-279.808 3.242667 13.184-31.232 122.026666-289.28z"})],-1)])],40,_s),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(g)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:S[16]||(S[16]=t.withModifiers(()=>{},["prevent"])),onClick:S[17]||(S[17]=ee=>_e("font-size-step-up"))},[...S[76]||(S[76]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M769.066667 77.952v93.781333h-93.866667a12.8 12.8 0 0 0-12.8 12.8v46.933334a12.8 12.8 0 0 0 12.8 12.8h93.866667v93.952a12.8 12.8 0 0 0 12.8 12.8h46.933333a12.8 12.8 0 0 0 12.8-12.8V244.266667h93.866667a12.8 12.8 0 0 0 12.8-12.8v-46.933334a12.8 12.8 0 0 0-12.8-12.8h-93.866667V77.952a12.8 12.8 0 0 0-12.8-12.8h-46.933333a12.8 12.8 0 0 0-12.8 12.8zM687.744 739.413333l87.722667 197.717334a12.8 12.8 0 0 0 11.733333 7.594666h54.016a12.8 12.8 0 0 0 11.605333-18.133333l-7.466666-16.213333-131.2-287.829334-35.413334-77.653333-166.570666-365.525333a36.266667 36.266667 0 0 0-66.432 0.938666l-154.154667 365.482667-34.688 82.261333-34.688 82.218667-84.778667 201.045333-6.570666 15.658667a12.8 12.8 0 0 0 11.776 17.749333h57.557333a12.8 12.8 0 0 0 11.904-8.106666l102.4-258.474667 343.466667-4.010667 29.781333 65.28zM480.426667 284.672l132.352 290.261333 12.288 27.050667-279.808 3.242667 13.184-31.232 122.026666-289.28z"})],-1)])],40,Hs)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("sep2"),to:W.value},[S[77]||(S[77]=t.createElementVNode("div",{class:"tb-item","data-key":"sep2"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("bold"),to:W.value},[t.createElementVNode("div",Ws,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(g)(e.locale,"bold"),disabled:!e.hasSelection,onClick:S[18]||(S[18]=ee=>_e("bold-toggle"))},[S[78]||(S[78]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M214.857 889.143v-68.571h68.571V203.429H214.857v-68.571h411.429v1.257c96.114 10.629 171.429 87.383 171.429 181.6 0 58.971-29.486 111.086-75.109 144.457 72.069 39.291 120.823 113.234 120.823 198.4 0 119.291-95.634 216.594-217.12 227.543l-0.286.029H214.857z m388.572-388.571H352v320h251.429c95.086 0 171.429-72.091 171.429-160s-76.343-160-171.429-160z m0-297.143H352v228.571h251.429l5.211-0.091c67.52-2.515 120.503-53.235 120.503-114.195 0-62.537-55.749-114.285-125.714-114.285z"})],-1)),t.createElementVNode("span",Ps,t.toDisplayString(t.unref(g)(e.locale,"bold")),1)],10,Us)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("italic"),to:W.value},[t.createElementVNode("div",Gs,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(g)(e.locale,"italic"),disabled:!e.hasSelection,onClick:S[19]||(S[19]=ee=>_e("italic-toggle"))},[S[79]||(S[79]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M730.143 127.714v64.286h-112.329l-166.521 621.429h128.871v64.286H276.286v-64.286h108.45l166.5-621.429H426.286V127.714h303.857z"})],-1)),t.createElementVNode("span",qs,t.toDisplayString(t.unref(g)(e.locale,"italic")),1)],10,Ks)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("underline"),to:W.value},[t.createElementVNode("div",Ys,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(g)(e.locale,"underline"),disabled:!e.hasSelection,onClick:S[20]||(S[20]=ee=>_e("underline-toggle"))},[S[80]||(S[80]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 123.639a36.409 36.409 0 0 1 33.642 22.525l230.59 558.27a36.409 36.409 0 1 1-67.284 27.768L638.072 560.545H385.928l-70.876 171.656a36.409 36.409 0 1 1-67.332-27.768l230.59-558.27A36.409 36.409 0 0 1 512 123.639z m-95.974 364.089h191.948L512 255.439l-95.974 232.289zM769.289 827.544c19.418 0 38.836 14.564 38.836 38.836 0 19.418-14.564 33.982-29.127 33.982H259.565c-19.418 0-38.836-14.564-38.836-38.836 0-19.418 14.564-33.982 29.127-33.982h519.433z"})],-1)),t.createElementVNode("span",js,t.toDisplayString(t.unref(g)(e.locale,"underline")),1)],10,Xs)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("strike"),to:W.value},[t.createElementVNode("div",Zs,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(g)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:S[21]||(S[21]=ee=>_e("strikethrough-toggle"))},[S[81]||(S[81]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M182.044 490.667h659.911a34.133 34.133 0 0 1 4.642 67.948l-4.597 0.319h-135.395c40.05 37 60.803 81.601 60.803 133.575 0 128.569-147.092 211.171-307.382 192.512-101.717-11.833-173.352-52.565-210.944-122.971a34.133 34.133 0 0 1 60.211-32.176c25.942 48.606 77.46 77.915 158.606 87.381 124.837 14.473 231.242-45.283 231.242-124.746 0-53.339-36.636-96.802-116.736-131.345l-5.279-2.23H182.044a34.133 34.133 0 0 1-33.815-29.492L147.911 524.8a34.133 34.133 0 0 1 29.491-33.815l4.642-0.318z m68.767-176.447c6.918-128.796 128.432-203.343 287.812-184.82 99.579 11.56 175.81 47.923 226.737 109.636a34.133 34.133 0 1 1-52.657 43.463c-38.775-47.013-98.759-75.639-181.999-85.288-123.654-14.381-211.627 36.591-211.627 117.009 0 35.135 10.65 61.349 37.774 90.203l5.826 6.007c4.278 4.369 8.966 8.875 11.377 10.923l1.411 0.91H288.085l-1.092-1.729c-6.508-9.376-38.958-54.386-36.182-106.314z"})],-1)),t.createElementVNode("span",Qs,t.toDisplayString(t.unref(g)(e.locale,"strikethrough")),1)],10,Js)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("sep3"),to:W.value},[S[82]||(S[82]=t.createElementVNode("div",{class:"tb-item","data-key":"sep3"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("textColor"),to:W.value},[t.createElementVNode("div",ec,[t.createElementVNode("div",tc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(g)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:S[22]||(S[22]=ee=>_e("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",nc,[S[83]||(S[83]=t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M663.120842 529.946947H364.759579l-84.07579 212.884211a53.894737 53.894737 0 0 1-50.122105 34.169263h-14.551579a34.869895 34.869895 0 0 1-32.498526-47.696842L443.715368 70.063158a53.894737 53.894737 0 0 1 50.122106-34.115369h41.768421a53.894737 53.894737 0 0 1 50.176 34.277053l257.670737 659.078737a34.977684 34.977684 0 0 1-32.552421 47.696842h-14.389895a53.894737 53.894737 0 0 1-50.229895-34.277053l-83.159579-212.776421z m-35.139368-89.788631l-113.340632-289.953684-114.472421 289.953684h227.813053z"})],-1)),t.createElementVNode("path",{d:"M62.895 844.369m53.895 0l790.474 0q53.895 0 53.895 53.895l0 26.947q0 53.895-53.895 53.895l-790.474 0q-53.895 0-53.895-53.895l0-26.947q0-53.895 53.895-53.895z",fill:e.cachedTextColor||"#000000"},null,8,oc)])),t.createElementVNode("span",rc,t.toDisplayString(t.unref(g)(e.locale,"fontColor")),1)],8,lc),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:R,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:S[23]||(S[23]=ee=>ct("textColor",!e.textColorMenuOpen))},[...S[84]||(S[84]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,ac),t.createVNode(ko,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":R.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":S[24]||(S[24]=ee=>ct("textColor",ee)),onChange:S[25]||(S[25]=ee=>_e("text-color-change",ee))},null,8,["model-open","current-color","locale","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("fillColor"),to:W.value},[t.createElementVNode("div",ic,[t.createElementVNode("div",sc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(g)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:S[26]||(S[26]=ee=>_e("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",dc,[S[85]||(S[85]=t.createElementVNode("path",{d:"M447.018667 37.952l352.298666 352.298667c6.613333 6.613333 6.613333 17.344 0 23.957333L446.101333 767.424a16.938667 16.938667 0 0 1-23.957333 0L121.429333 466.688a16.938667 16.938667 0 0 1 0-23.957333L428.608 135.552 388.992 96a8.469333 8.469333 0 0 1 0-11.989333l46.058667-46.037334a8.469333 8.469333 0 0 1 11.968 0z m346.325333 517.461333l57.514667 60.074667c31.744 33.194667 31.744 86.997333 0 120.192a78.869333 78.869333 0 0 1-115.008 0c-31.765333-33.194667-31.765333-86.997333 0-120.192l57.493333-60.074667zM486.101333 193.066667l-261.12 261.12 20.458667 20.458666 380.16-1.728 70.186667-70.186666-209.706667-209.664z"},null,-1)),t.createElementVNode("path",{d:"M85.333333 853.333333m8.896 0l835.541334 0q8.896 0 8.896 8.896l0 110.208q0 8.896-8.896 8.896l-835.541334 0q-8.896 0-8.896-8.896l0-110.208q0-8.896 8.896-8.896Z",fill:e.cachedFillColor||"currentColor"},null,8,uc)])),t.createElementVNode("span",fc,t.toDisplayString(t.unref(g)(e.locale,"fillColor")),1)],8,cc),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:O,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:S[27]||(S[27]=ee=>ct("fillColor",!e.fillColorMenuOpen))},[...S[86]||(S[86]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,mc),t.createVNode(ko,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":O.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":S[28]||(S[28]=ee=>ct("fillColor",ee)),onChange:S[29]||(S[29]=ee=>_e("fill-color-change",ee))},null,8,["model-open","current-color","locale","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("border"),to:W.value},[t.createElementVNode("div",pc,[t.createElementVNode("div",hc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(g)(e.locale,"borders"),disabled:!e.hasSelection,onClick:S[30]||(S[30]=ee=>_e("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",bc,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(n,ee=>t.createElementVNode("line",{key:ee.name,x1:ee.x1,y1:ee.y1,x2:ee.x2,y2:ee.y2,"stroke-width":r(e.cachedBorder,ee.name)==="thick"?3:1.5,"stroke-dasharray":r(e.cachedBorder,ee.name)==="dashed"?"0 4":"none","stroke-linecap":r(e.cachedBorder,ee.name)==="dashed"?"round":"square"},null,8,yc)),64))])),t.createElementVNode("span",Cc,t.toDisplayString(t.unref(g)(e.locale,c[e.cachedBorder]??"borders")),1)],8,gc),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:X,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"borders"),disabled:!e.hasSelection,onClick:S[31]||(S[31]=ee=>ct("border",!e.borderMenuOpen))},[...S[87]||(S[87]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,wc),t.createVNode(Pi,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":X.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":S[32]||(S[32]=ee=>ct("border",ee)),onChange:S[33]||(S[33]=ee=>_e("border-change",ee))},null,8,["model-open","locale","current-border","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("sep4"),to:W.value},[S[88]||(S[88]=t.createElementVNode("div",{class:"tb-item","data-key":"sep4"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("hAlign"),to:W.value},[t.createElementVNode("div",vc,[t.createVNode(Yt,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:D("hAlign")?"100%":44,"menu-width":D("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(g)(e.locale,"hAlign"),"model-open":e.hAlignMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":S[34]||(S[34]=ee=>ct("hAlign",ee)),onChange:S[35]||(S[35]=ee=>_e("h-align-change",ee))},null,8,["model-value","options","width","menu-width","title","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("vAlign"),to:W.value},[t.createElementVNode("div",kc,[t.createVNode(Yt,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:D("vAlign")?"100%":44,"menu-width":D("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(g)(e.locale,"vAlign"),"model-open":e.vAlignMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":S[36]||(S[36]=ee=>ct("vAlign",ee)),onChange:S[37]||(S[37]=ee=>_e("v-align-change",ee))},null,8,["model-value","options","width","menu-width","title","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("wrap"),to:W.value},[t.createElementVNode("div",Ec,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(g)(e.locale,"wrap"),onClick:S[38]||(S[38]=ee=>_e("wrap-toggle"))},[S[89]||(S[89]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M896 179.2a38.4 38.4 0 0 0-76.8 0v665.6a38.4 38.4 0 0 0 76.8 0v-665.6zM204.8 281.6A38.4 38.4 0 0 0 204.8 358.4h179.2a38.4 38.4 0 0 0 0-76.8H204.8zM550.4 281.6a38.4 38.4 0 0 0 0 76.8h51.2c35.328 0 64 28.672 64 64v179.2c0 35.328-28.672 64-64 64H246.272l36.864-36.864a38.4 38.4 0 1 0-54.272-54.272l-102.4 102.4a38.4 38.4 0 0 0 0 54.272l102.4 102.4a38.4 38.4 0 0 0 54.272-54.272l-36.864-36.864h355.328a140.8 140.8 0 0 0 140.8-140.8v-179.2a140.8 140.8 0 0 0-140.8-140.8h-51.2z"})],-1)),t.createElementVNode("span",Sc,t.toDisplayString(t.unref(g)(e.locale,"wrap")),1)],10,Rc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("merge"),to:W.value},[t.createElementVNode("div",Mc,[t.createElementVNode("div",Bc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(g)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:S[39]||(S[39]=ee=>_e("apply-merge"))},[S[90]||(S[90]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M709.952 465.92l88-76.032C801.92 385.984 806.656 384 812.032 384s10.048 1.984 14.08 5.952C830.08 393.92 832 398.656 832 403.968L832 448l32 0C881.664 448 896 462.336 896 480S881.664 512 864 512L832 512l0 44.032c0 5.376-1.92 10.112-5.952 14.08C822.08 574.08 817.344 576 812.032 576s-10.048-1.92-14.08-5.952L709.952 494.08C705.984 490.112 704 485.376 704 480S705.984 469.952 709.952 465.92zM378.048 465.92 290.048 389.952C286.08 385.984 281.344 384 275.968 384s-10.048 1.984-14.08 5.952C257.92 393.92 256 398.656 256 403.968L256 448 224 448C206.336 448 192 462.336 192 480S206.336 512 224 512L256 512l0 44.032c0 5.376 1.92 10.112 5.952 14.08C265.92 574.08 270.656 576 275.968 576s10.048-1.92 14.08-5.952L378.048 494.08C382.016 490.112 384 485.376 384 480S382.016 469.952 378.048 465.92zM448 128 128 128l0 704 320 0 0-128 64 0 0 128c0 35.392-28.608 64-64 64L128 896c-35.392 0-64-28.608-64-64L64 128c0-35.392 28.608-64 64-64l320 0 0 0c35.392 0 64 28.608 64 64l0 128L448 256 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128M722.304 642.304c0 8.512-3.52 16.32-10.496 23.36s-15.424 10.624-25.344 10.624c-5.76 0-10.688-1.088-14.72-3.136-4.096-2.048-7.616-4.928-10.432-8.512s-5.824-9.088-9.024-16.512-5.952-13.952-8.32-19.648l-17.28-46.016L479.36 582.464 462.08 629.568c-6.72 18.304-12.48 30.656-17.344 37.12s-12.544 9.6-23.424 9.6c-9.28 0-17.408-3.456-24.512-10.24s-10.624-14.592-10.624-23.232c0-4.992 0.896-10.176 2.496-15.488S393.024 614.592 396.8 605.056l92.672-238.016C492.096 360.256 495.296 352 499.008 342.464s7.68-17.536 11.904-23.872 9.664-11.456 16.576-15.36c6.784-3.968 15.232-5.888 25.344-5.888 10.176 0 18.752 1.92 25.472 5.888 6.848 3.968 12.352 8.96 16.64 15.104 4.096 6.208 7.744 12.8 10.624 19.904s6.528 16.576 11.008 28.352l94.656 236.48C718.592 621.056 722.304 634.112 722.304 642.304zM606.912 526.784 552.32 375.552 498.624 526.784 606.912 526.784z"})],-1)),t.createElementVNode("span",xc,t.toDisplayString(t.unref(g)(e.locale,"mergeCenter")),1)],8,Nc),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:Ee,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:S[40]||(S[40]=ee=>ct("merge",!e.mergeMenuOpen))},[...S[91]||(S[91]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Tc),t.createVNode(os,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":Ee.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":S[41]||(S[41]=ee=>ct("merge",ee)),onChange:S[42]||(S[42]=ee=>_e("merge-change",ee))},null,8,["model-open","locale","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("sep6"),to:W.value},[S[92]||(S[92]=t.createElementVNode("div",{class:"tb-item","data-key":"sep6"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("numFmt"),to:W.value},[t.createElementVNode("div",Vc,[t.createElementVNode("div",Dc,[t.createVNode(Yt,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:D("numFmt")?"auto":92,"menu-width":(D("numFmt"),150),"visible-count":8,title:t.unref(g)(e.locale,"numberFormat"),"fallback-label":_t.value,align:"right","model-open":e.numFmtMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":S[43]||(S[43]=ee=>ct("numFmt",ee)),onChange:S[44]||(S[44]=ee=>_e("number-format-change",String(ee)))},null,8,["model-value","options","width","menu-width","title","fallback-label","model-open","boundary-el"]),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canIncreaseDecimals}]),title:t.unref(g)(e.locale,"nfIncreaseDecimals"),disabled:!e.canIncreaseDecimals,onClick:S[45]||(S[45]=ee=>_e("increase-decimals"))},[...S[93]||(S[93]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("text",{x:"0.5",y:"16","font-size":"9","font-weight":"700","font-family":"Arial, sans-serif"},".00"),t.createElementVNode("path",{d:"M19 5.5l4.2 5.2h-2.7v7.8h-3v-7.8h-2.7z"})],-1)])],10,Fc),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canDecreaseDecimals}]),title:t.unref(g)(e.locale,"nfDecreaseDecimals"),disabled:!e.canDecreaseDecimals,onClick:S[46]||(S[46]=ee=>_e("decrease-decimals"))},[...S[94]||(S[94]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("text",{x:"0.5",y:"16","font-size":"9","font-weight":"700","font-family":"Arial, sans-serif"},".00"),t.createElementVNode("path",{d:"M19 18.5l-4.2-5.2h2.7V5.5h3v7.8h2.7z"})],-1)])],10,Oc)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("sep7"),to:W.value},[S[95]||(S[95]=t.createElementVNode("div",{class:"tb-item","data-key":"sep7"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("calc"),to:W.value},[t.createElementVNode("div",Ic,[t.createElementVNode("div",Ac,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(g)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:S[47]||(S[47]=ee=>_e("calc-sum"))},[S[96]||(S[96]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("path",{d:"M19 3H5l7 9-7 9h14v-2H8l5.5-7L8 5h11z"})],-1)),t.createElementVNode("span",zc,t.toDisplayString(t.unref(g)(e.locale,"sum")),1)],8,Lc),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:ae,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:S[48]||(S[48]=ee=>ct("calc",!e.calcMenuOpen))},[...S[97]||(S[97]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,$c),t.createVNode(ks,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":ae.value,disabled:e.isSingleCell,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":S[49]||(S[49]=ee=>ct("calc",ee)),onChange:S[50]||(S[50]=ee=>_e(`calc-${ee}`))},null,8,["model-open","locale","trigger-el","disabled","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("sort"),to:W.value},[t.createElementVNode("div",_c,[t.createElementVNode("div",Hc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.cachedSortOrder==="asc"?t.unref(g)(e.locale,"sortAsc"):t.unref(g)(e.locale,"sortDesc"),disabled:!e.canSort,onClick:S[51]||(S[51]=ee=>_e("apply-sort"))},[(t.openBlock(),t.createElementBlock("svg",Uc,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(u,ee=>t.createElementVNode("line",{key:ee.name,x1:ee.x1,y1:ee.y1,x2:ee.x2,y2:ee.y2},null,8,Pc)),64)),t.createElementVNode("path",{d:b[e.cachedSortOrder]},null,8,Gc)])),t.createElementVNode("span",Kc,t.toDisplayString(t.unref(g)(e.locale,"sort")),1)],8,Wc),t.createElementVNode("button",{ref_key:"sortArrowRef",ref:j,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"sort"),disabled:!e.canSort,onClick:S[52]||(S[52]=ee=>ct("sort",!e.sortMenuOpen))},[...S[98]||(S[98]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,qc),t.createVNode(ji,{"model-open":e.sortMenuOpen,locale:e.locale,"current-sort":e.cachedSortOrder,"trigger-el":j.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":S[53]||(S[53]=ee=>ct("sort",ee)),onChange:S[54]||(S[54]=ee=>_e("sort-change",ee))},null,8,["model-open","locale","current-sort","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("outline"),to:W.value},[t.createElementVNode("div",Yc,[t.createElementVNode("button",{ref_key:"outlineArrowRef",ref:ge,class:t.normalizeClass(["toolbar-btn outline-trigger",{"is-open":e.outlineMenuOpen}]),disabled:!e.outlineAxis,title:t.unref(g)(e.locale,"outlineGroup"),onClick:S[55]||(S[55]=ee=>ct("outline",!e.outlineMenuOpen))},[S[99]||(S[99]=t.createElementVNode("svg",{class:"outline-trigger__icon",viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"56","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M160 224 H560 V800 H160 Z"}),t.createElementVNode("path",{"stroke-width":"44",d:"M664 640 H864 V384 H664"})],-1)),t.createElementVNode("span",jc,t.toDisplayString(t.unref(g)(e.locale,"outlineGroup")),1),S[100]||(S[100]=t.createElementVNode("svg",{class:"outline-trigger__caret",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1))],10,Xc),t.createVNode(es,{"model-open":e.outlineMenuOpen,locale:e.locale,"trigger-el":ge.value,"boundary-el":e.boundaryEl,axis:e.outlineAxis,"onUpdate:modelOpen":S[56]||(S[56]=ee=>ct("outline",ee)),onAction:S[57]||(S[57]=ee=>_e("outline-action",ee))},null,8,["model-open","locale","trigger-el","boundary-el","axis"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("filter"),to:W.value},[t.createElementVNode("div",Zc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.filterActive}]),disabled:!e.canFilter,title:e.filterActive?t.unref(g)(e.locale,"clearFilter"):t.unref(g)(e.locale,"filter"),onClick:de},[S[101]||(S[101]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M96 192c0-17.6 14.4-32 32-32h768c17.6 0 32 14.4 32 32 0 9.6-4.8 19.2-12.8 25.6L608 480v320c0 19.2-12.8 35.2-32 40-4.8 1.6-9.6 1.6-14.4 1.6-12.8 0-24-4.8-33.6-12.8l-128-108.8c-8-6.4-12.8-16-12.8-25.6V480L108.8 217.6C100.8 211.2 96 201.6 96 192z"})],-1)),t.createElementVNode("span",Qc,t.toDisplayString(t.unref(g)(e.locale,"filter")),1)],10,Jc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("freeze"),to:W.value},[t.createElementVNode("div",ed,[t.createVNode(Yt,{class:"toolbar-freeze","model-value":"",options:Ht.value,width:D("freeze")?"100%":44,"menu-width":D("freeze")?120:void 0,"visible-count":4,align:"right",title:t.unref(g)(e.locale,"freezePane"),"trigger-icon":Gr,"trigger-label":t.unref(g)(e.locale,"freezePane"),"model-open":e.freezeMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":S[58]||(S[58]=ee=>ct("freeze",ee)),onChange:S[59]||(S[59]=ee=>_e("freeze-change",String(ee)))},null,8,["options","width","menu-width","title","trigger-label","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("cf"),to:W.value},[t.createElementVNode("div",td,[t.createVNode(Cs,{locale:e.locale,"has-selection":e.hasSelection,"theme-vars":e.themeVars,"model-open":e.cfMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":S[60]||(S[60]=ee=>ct("cf",ee)),onPreset:S[61]||(S[61]=ee=>_e("cf-preset",ee)),onNewRule:S[62]||(S[62]=ee=>_e("cf-new-rule")),onManage:S[63]||(S[63]=ee=>_e("cf-manage")),onClear:S[64]||(S[64]=ee=>_e("cf-clear",ee))},null,8,["locale","has-selection","theme-vars","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("dv"),to:W.value},[t.createElementVNode("div",ld,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(g)(e.locale,"dv"),onClick:U},[S[102]||(S[102]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M933.76 705.728l-74.112 74.048 74.88 74.944-58.88 58.88-74.88-75.008-74.88 74.88-58.88-58.752 74.88-74.88-74.048-74.112 58.88-58.88 74.112 74.048 74.048-74.048 58.88 58.88z"}),t.createElementVNode("path",{d:"M832.576 607.104H167.808v162.944h370.688v83.2H126.208a41.664 41.664 0 0 1-41.6-41.6V565.376a41.6 41.6 0 0 1 41.6-41.6h706.368v83.2zM908.608 241.856l30.848 27.904-158.08 174.08a41.664 41.664 0 0 1-60.224 1.408L605.824 329.856l58.816-58.88 84.48 84.48 128.768-141.568 30.72 27.968z"}),t.createElementVNode("path",{d:"M832.576 193.664H167.808v162.944h370.688v83.2H126.208a41.6 41.6 0 0 1-41.6-41.6V151.936a41.6 41.6 0 0 1 41.6-41.6h706.368v83.2z"})],-1)),t.createElementVNode("span",od,t.toDisplayString(t.unref(g)(e.locale,"dv")),1)],8,nd)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("find"),to:W.value},[t.createElementVNode("div",rd,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(g)(e.locale,"find"),onClick:q},[S[103]||(S[103]=t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M448 128a320 320 0 0 1 251.2 516.8l171.2 171.2a32 32 0 0 1-45.2 45.2L654 689.9A320 320 0 1 1 448 128zm0 64a256 256 0 1 0 0 512 256 256 0 0 0 0-512z"})],-1)),t.createElementVNode("span",id,t.toDisplayString(t.unref(g)(e.locale,"findReplace")),1)],8,ad)])],8,["disabled","to"])),I.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:x,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":se.value}]),type:"button",onClick:L},[...S[104]||(S[104]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("circle",{cx:"512",cy:"160",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"512",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"864",r:"96"})],-1)])],2)):t.createCommentVNode("",!0)],544),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["overflow-menu-wrap",{"no-anim":Ve.value}]),style:t.normalizeStyle(ve.value),onPointerdown:S[68]||(S[68]=t.withModifiers(()=>{},["stop","prevent"]))},[Qe.value||K.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!Qe.value}]),disabled:!Qe.value,onClick:S[66]||(S[66]=ee=>Pe(-1))},[...S[105]||(S[105]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,sd)):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock("div",{ref_key:"overflowMenuEl",ref:p,key:tt.value,class:"overflow-menu",onScroll:Re,onClick:$t},null,32)),Qe.value||K.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!K.value}]),disabled:!K.value,onClick:S[67]||(S[67]=ee=>Pe(1))},[...S[106]||(S[106]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,cd)):t.createCommentVNode("",!0)],38),[[t.vShow,se.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-1a2f529d"]]),gd=["title"],bd={class:"tab-list"},yd=["onClick","onDblclick","onContextmenu","onTouchstart"],Cd=["value"],wd={key:1,class:"tab-item__name"},vd=["title"],kd=["disabled"],Ed=["title","onClick"],Rd={class:"tab-list-menu__name"},Sd=["title","disabled","onClick"],Md=["disabled"],Bd=8,Kr=450,Eo=8,Nd=It(t.defineComponent({__name:"tabbar",props:{locale:{},sheets:{},activeSheetIndex:{},renTab:{},renTabVal:{},boundaryEl:{}},emits:["tab-click","tab-dblclick","delete-sheet","tab-contextmenu","tab-rename-input","tab-rename-keydown","tab-rename-commit","add-sheet","tabbar-contextmenu"],setup(e,{emit:o}){const l=e,n=o,a=t.ref(null),i=t.ref(!1),r=t.ref(0),c=t.ref({left:0,bottom:0}),u=t.ref(null),b=t.computed(()=>Math.min(Bd,l.sheets.length)),h=t.computed(()=>l.sheets.slice(r.value,r.value+b.value)),C=t.computed(()=>r.value>0),p=t.computed(()=>r.value+b.value<l.sheets.length),x=t.computed(()=>l.sheets.length>b.value),R=t.computed(()=>l.sheets.length>1);t.watch(()=>l.sheets.length,()=>{if(!i.value)return;const _=Math.max(0,l.sheets.length-b.value);r.value>_&&(r.value=_)});function O(_){r.value=Math.max(0,Math.min(l.sheets.length-b.value,r.value+_))}function X(){if(i.value){i.value=!1;return}const _=a.value;if(!_)return;const L=_.getBoundingClientRect(),U=Gl(l.boundaryEl);c.value={left:L.left,bottom:U.bottom-L.top+4};const q=l.activeSheetIndex;r.value=q>=0?Math.max(0,Math.min(q-Math.floor(b.value/2),l.sheets.length-b.value)):0,i.value=!0}function j(_){n("tab-click",_),i.value=!1}function Ee(_){R.value&&n("delete-sheet",_)}function ae(_){var q;if(!i.value)return;const L=_.target;if((q=a.value)!=null&&q.contains(L))return;const U=document.querySelector(".tab-list-menu");U!=null&&U.contains(L)||(i.value=!1)}function ge(_){i.value&&_.key==="Escape"&&(i.value=!1)}function me(_){i.value&&(_.preventDefault(),O(_.deltaY>0?1:-1))}function pe(){i.value=!1}function se(_){!i.value||_.target===u.value||pe()}const Ve=t.ref(0),tt=t.ref(!1);function Qe(_){i.value&&(Ve.value=_.touches[0].clientY,tt.value=!0)}function K(_){if(!i.value||!tt.value)return;const L=_.touches[0].clientY-Ve.value;Math.abs(L)>5&&(O(L<0?1:-1),Ve.value=_.touches[0].clientY)}function it(){tt.value=!1}let I=null,D=-1,W=0,we=0,$e=!1,Z=null,Le=0,ie=0;function De(_,L,U){return{clientX:_,clientY:L,target:U,preventDefault(){},stopPropagation(){}}}function N(_,L){const U=_.touches[0];if(!U)return;W=U.clientX,we=U.clientY,D=L,I!==null&&clearTimeout(I);const q=_.target;I=window.setTimeout(()=>{$e=!0;const de=De(W,we,q);n("tab-contextmenu",{ev:de,i:D})},Kr)}function J(_){const L=_.touches[0];!L||I===null||(Math.abs(L.clientX-W)>Eo||Math.abs(L.clientY-we)>Eo)&&(clearTimeout(I),I=null)}function le(){I!==null&&(clearTimeout(I),I=null)}function re(_){if($e){$e=!1;return}n("tab-click",_)}function ne(_){const L=_.touches[0];if(!L)return;const U=_.target;if(U.closest(".tab-item")||U.closest(".tab-bar__add-btn")||U.closest(".tab-bar__list-btn"))return;Le=L.clientX,ie=L.clientY,Z!==null&&clearTimeout(Z);const q=U;Z=window.setTimeout(()=>{const de=De(Le,ie,q);n("tabbar-contextmenu",de)},Kr)}function ve(_){const L=_.touches[0];!L||Z===null||(Math.abs(L.clientX-Le)>Eo||Math.abs(L.clientY-ie)>Eo)&&(clearTimeout(Z),Z=null)}function Ce(){Z!==null&&(clearTimeout(Z),Z=null)}return t.watch(i,_=>{t.nextTick(()=>{var L,U;_?(L=u.value)==null||L.addEventListener("wheel",me,{passive:!1}):(U=u.value)==null||U.removeEventListener("wheel",me)})}),t.onMounted(()=>{document.addEventListener("pointerdown",ae),document.addEventListener("keydown",ge),window.addEventListener("resize",pe),window.addEventListener("scroll",se,!0)}),t.onBeforeUnmount(()=>{I!==null&&clearTimeout(I),Z!==null&&clearTimeout(Z),document.removeEventListener("pointerdown",ae),document.removeEventListener("keydown",ge),window.removeEventListener("resize",pe),window.removeEventListener("scroll",se,!0)}),(_,L)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:L[8]||(L[8]=U=>n("tabbar-contextmenu",U)),onTouchstart:ne,onTouchmove:ve,onTouchend:Ce,onTouchcancel:Ce},[t.createElementVNode("button",{ref_key:"listBtnRef",ref:a,class:t.normalizeClass(["tab-bar__list-btn",{"tab-bar__list-btn--active":i.value}]),type:"button",title:t.unref(g)(e.locale,"sheetList"),onClick:X},[...L[9]||(L[9]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M128 256h768a32 32 0 0 0 0-64H128a32 32 0 0 0 0 64z m0 256h768a32 32 0 0 0 0-64H128a32 32 0 0 0 0 64z m0 256h768a32 32 0 0 0 0-64H128a32 32 0 0 0 0 64z"})],-1)])],10,gd),t.createElementVNode("div",bd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(U,q)=>(t.openBlock(),t.createElementBlock("div",{key:U.id,class:t.normalizeClass(["tab-item",{"tab-item--active":q===e.activeSheetIndex}]),onClick:de=>re(q),onDblclick:t.withModifiers(de=>n("tab-dblclick",q),["prevent"]),onContextmenu:de=>n("tab-contextmenu",{ev:de,i:q}),onTouchstart:de=>N(de,q),onTouchmove:J,onTouchend:le,onTouchcancel:le},[e.renTab===q?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:L[0]||(L[0]=de=>n("tab-rename-input",de.target.value)),onKeydown:L[1]||(L[1]=de=>n("tab-rename-keydown",de)),onBlur:L[2]||(L[2]=de=>n("tab-rename-commit")),onClick:L[3]||(L[3]=t.withModifiers(()=>{},["stop"]))},null,40,Cd)):(t.openBlock(),t.createElementBlock("span",wd,t.toDisplayString(U.name),1))],42,yd))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(g)(e.locale,"addSheet"),onClick:L[4]||(L[4]=U=>n("add-sheet"))}," + ",8,vd),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"tab-list-menu",style:t.normalizeStyle({left:c.value.left+"px",bottom:c.value.bottom+"px"}),onMousedown:L[7]||(L[7]=t.withModifiers(()=>{},["prevent"]))},[x.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!C.value}]),disabled:!C.value,onClick:L[5]||(L[5]=U=>O(-1))},[...L[10]||(L[10]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 662.613333a32 32 0 0 0 45.226667 0L512 375.893333l286.72 286.72a32 32 0 1 0 45.226667-45.226666l-309.333334-309.333334a32 32 0 0 0-45.226666 0l-309.333334 309.333334a32 32 0 0 0 0 45.226666z"})],-1)])],10,kd)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:u,class:"tab-list-menu__list",onTouchstart:Qe,onTouchmove:K,onTouchend:it},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,U=>(t.openBlock(),t.createElementBlock("div",{key:U.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(U)===e.activeSheetIndex}]),title:U.name,onClick:q=>j(e.sheets.indexOf(U))},[t.createElementVNode("span",Rd,t.toDisplayString(U.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(g)(e.locale,"delete"),disabled:!R.value,onClick:t.withModifiers(q=>Ee(e.sheets.indexOf(U)),["stop"])},[...L[11]||(L[11]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])],8,Sd)],10,Ed))),128))],544),x.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!p.value}]),disabled:!p.value,onClick:L[6]||(L[6]=U=>O(1))},[...L[12]||(L[12]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],10,Md)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-96289e1d"]]),xd={class:"find-bar__row find-bar__row--inputs"},Td=["placeholder","value"],Vd=["placeholder","value"],Dd=["title","disabled"],Fd=["title","disabled"],Od=["title"],Id={class:"find-bar__row find-bar__row--controls"},Ad=["title"],Ld={class:"find-bar__count"},zd=["disabled"],$d=["disabled"],_d={class:"find-bar__chk find-bar__chk--panel"},Hd=["checked"],Wd={class:"find-bar__chk find-bar__chk--panel"},Ud=["checked"],Pd=It(t.defineComponent({__name:"find-replace-bar",props:{open:{type:Boolean},findText:{},replaceText:{},scope:{},matchCase:{type:Boolean},matchEntireCell:{type:Boolean},currentIndex:{},total:{},message:{},focusToken:{},locale:{},themeVars:{}},emits:["update:findText","update:replaceText","update:scope","update:matchCase","update:matchEntireCell","prev","next","replace","replace-all","close"],setup(e,{emit:o}){const l=e,n=o,a=t.ref(null),i=t.ref(null),r=t.ref(!1),c=t.ref({top:0,left:0}),u=t.computed(()=>l.total>0?`${l.currentIndex+1}/${l.total}`:l.message||""),b=t.computed(()=>[{label:g(l.locale,"scopeSheet"),value:"sheet"},{label:g(l.locale,"scopeWorkbook"),value:"workbook"},{label:g(l.locale,"scopeSelection"),value:"selection"}]);t.watch(()=>l.focusToken,()=>{t.nextTick(()=>{var x;return(x=a.value)==null?void 0:x.focus()})});function h(x){x.key==="Enter"?(x.preventDefault(),x.shiftKey?n("prev"):n("next")):x.key==="Escape"&&(x.preventDefault(),n("close"))}function C(){if(i.value){if(!r.value){const x=i.value.getBoundingClientRect();c.value={top:x.bottom+2,left:x.left}}r.value=!r.value}}function p(x){if(!r.value)return;const R=x.target;R.closest(".find-bar__settings-btn")||R.closest(".find-bar__settings-panel")||(r.value=!1)}return t.watch(r,x=>{x?document.addEventListener("pointerdown",p,!0):document.removeEventListener("pointerdown",p,!0)}),t.watch(()=>l.open,x=>{x||(r.value=!1)}),t.onBeforeUnmount(()=>document.removeEventListener("pointerdown",p,!0)),(x,R)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[e.open?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",xd,[t.createElementVNode("input",{ref_key:"findInputRef",ref:a,class:"find-bar__input",placeholder:t.unref(g)(e.locale,"findPlaceholder"),value:e.findText,onInput:R[0]||(R[0]=O=>n("update:findText",O.target.value)),onKeydown:h},null,40,Td),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(g)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:R[1]||(R[1]=O=>n("update:replaceText",O.target.value)),onKeydown:h},null,40,Vd),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(g)(e.locale,"findPrev"),disabled:e.total===0,onClick:R[2]||(R[2]=O=>n("prev"))},[...R[12]||(R[12]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 320a32 32 0 0 1 45.254 0l288 288a32 32 0 0 1-45.254 45.254L512 410.51 214.254 653.254A32 32 0 0 1 169 608l288-288z"})],-1)])],8,Dd),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(g)(e.locale,"findNext"),disabled:e.total===0,onClick:R[3]||(R[3]=O=>n("next"))},[...R[13]||(R[13]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 704a32 32 0 0 1-45.254 0l-288-288A32 32 0 0 1 214.254 370.746L512 613.49 809.746 370.746A32 32 0 0 1 855 416l-288 288z"})],-1)])],8,Fd),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(g)(e.locale,"findClose"),onClick:R[4]||(R[4]=O=>n("close"))},[...R[14]||(R[14]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])],8,Od)]),t.createElementVNode("div",Id,[t.createVNode(Yt,{class:"find-bar__dropdown","model-value":e.scope,options:b.value,title:t.unref(g)(e.locale,"findScope"),"onUpdate:modelValue":R[5]||(R[5]=O=>x.$emit("update:scope",O))},null,8,["model-value","options","title"]),t.createElementVNode("button",{ref_key:"settingsBtnRef",ref:i,class:t.normalizeClass(["find-bar__btn find-bar__btn--icon find-bar__settings-btn",{"find-bar__btn--active":r.value}]),title:t.unref(g)(e.locale,"findOptions"),onClick:t.withModifiers(C,["stop"])},[...R[15]||(R[15]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M224 671.616a64 64 0 1 1 128 0 64 64 0 0 1-128 0z m-59.968 32a128 128 0 0 0 247.936 0H928a32 32 0 1 0 0-64H411.968a128 128 0 0 0-247.936 0H96a32 32 0 1 0 0 64h68.032z"}),t.createElementVNode("path",{d:"M800 319.808a64 64 0 1 1-128 0 64 64 0 0 1 128 0z m59.968-32a128 128 0 0 0-247.936 0H96a32 32 0 0 0 0 64h516.032a128 128 0 0 0 247.936 0H928a32 32 0 0 0 0-64h-68.032z"})],-1)])],10,Ad),t.createElementVNode("span",Ld,t.toDisplayString(u.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:R[6]||(R[6]=O=>n("replace"))},t.toDisplayString(t.unref(g)(e.locale,"replace")),9,zd),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:R[7]||(R[7]=O=>n("replace-all"))},t.toDisplayString(t.unref(g)(e.locale,"replaceAll")),9,$d)])],4)):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"find-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar__settings-panel",style:t.normalizeStyle({top:c.value.top+"px",left:c.value.left+"px"}),onClick:R[10]||(R[10]=t.withModifiers(()=>{},["stop"])),onMousedown:R[11]||(R[11]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("label",_d,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchCase,onChange:R[8]||(R[8]=O=>n("update:matchCase",O.target.checked))},null,40,Hd),R[16]||(R[16]=t.createElementVNode("span",{class:"find-bar__chk-box"},[t.createElementVNode("svg",{class:"find-bar__chk-tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(g)(e.locale,"matchCase")),1)]),t.createElementVNode("label",Wd,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchEntireCell,onChange:R[9]||(R[9]=O=>n("update:matchEntireCell",O.target.checked))},null,40,Ud),R[17]||(R[17]=t.createElementVNode("span",{class:"find-bar__chk-box"},[t.createElementVNode("svg",{class:"find-bar__chk-tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(g)(e.locale,"matchEntireCell")),1)])],36)):t.createCommentVNode("",!0)]),_:1})]))],64))}}),[["__scopeId","data-v-07f6713b"]]),Gd={class:"nf-dialog__header"},Kd={class:"nf-dialog__title"},qd={class:"nf-dialog__body"},Yd={class:"nf-field"},Xd={class:"nf-field__label"},jd={key:0,class:"nf-field"},Zd={class:"nf-field__label"},Jd={key:1,class:"nf-field nf-field--inline"},Qd={class:"nf-checkbox"},eu={key:2,class:"nf-field"},tu={class:"nf-field__label"},lu={key:3,class:"nf-field"},nu={class:"nf-field__label"},ou={key:4,class:"nf-field"},ru={class:"nf-field__label"},au={key:5,class:"nf-field"},iu={class:"nf-field__label"},su={key:6,class:"nf-field"},cu={class:"nf-field__label"},du={class:"nf-field"},uu={class:"nf-field__label"},fu={class:"nf-dialog__footer"},mu={class:"nf-preview"},pu={class:"nf-preview__label"},hu={class:"nf-preview__value"},gu={class:"nf-dialog__actions"},bu=It(t.defineComponent({__name:"number-format-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"},currentFormat:{default:""},isCustom:{type:Boolean,default:!1},sampleValue:{default:"1234.5"}},emits:["update:modelOpen","apply"],setup(e,{emit:o}){const l=e,n=o,a=t.ref(!1),i=t.ref("general"),r=t.ref(2),c=t.ref(!1),u=t.ref("$"),b=t.ref("m/d/yyyy"),h=t.ref("h:mm:ss"),C=t.ref("m/d/yyyy h:mm:ss"),p=t.ref("[h]:mm:ss"),x=t.ref(""),R=t.ref(null),O=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],X=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],j=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],Ee=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],ae=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],ge=t.computed(()=>l.locale==="zh-CN"?[...X,...j]:[...j,...X]),me=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],pe=t.computed(()=>l.locale==="zh-CN"?[...Ee,...ae]:[...ae,...Ee]),se=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],Ve={general:"nfGeneral",text:"nfText",number:"nfNumber",percent:"nfPercent",scientific:"nfScientific",accounting:"nfAccounting",financial:"nfFinancial",currency:"nfCurrency",currencyRounded:"nfCurrencyRounded",date:"nfDate",time:"nfTime",dateTime:"nfDateTime",duration:"nfDuration",custom:"nfCatCustom"},tt=t.computed(()=>wi.map(Re=>({label:g(l.locale,Ve[Re]),value:Re}))),Qe=O.map(Re=>({label:Re.label,value:Re.value})),K=t.computed(()=>ge.value.map(Re=>({label:Re,value:Re}))),it=me.map(Re=>({label:Re,value:Re})),I=t.computed(()=>pe.value.map(Re=>({label:Re,value:Re}))),D=se.map(Re=>({label:Re,value:Re})),W=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),we=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),$e=t.computed(()=>i.value==="date"),Z=t.computed(()=>i.value==="time"),Le=t.computed(()=>i.value==="dateTime"),ie=t.computed(()=>i.value==="duration"),De=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function N(){if(i.value==="general")return rn;if(i.value==="text")return Nl;if(i.value==="custom")return x.value;if(i.value==="date")return b.value;if(i.value==="time")return h.value;if(i.value==="dateTime")return C.value;if(i.value==="duration")return p.value;const Re=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?J(i.value,Re,c.value,u.value):Bi(l.locale,i.value,Re,c.value)}function J(Re,Pe,lt,_e){const Ct=lt?"#,##0":"0";if(Re==="currencyRounded")return _e+Ct;const st=Pe>0?"."+"0".repeat(Pe):"",ct=Ct+st;return Re==="currency"?_e+ct:`${_e}${ct};(${_e}${ct});${_e}"-"`}function le(Re){if(x.value=Re,xl(Re)){i.value="general";return}if(Re==="@"){i.value="text";return}const Pe=Re.replace(/\[[^\]]*\]/gi,st=>/\[h\]/i.test(st)?st:"");if(/\[h\]/i.test(Pe)&&!/[yd]/i.test(Pe)){i.value="duration",se.includes(Re)&&(p.value=Re);return}const lt=/[yd]/i.test(Pe),_e=/h|s|AM\/PM/i.test(Pe);if(lt&&_e){i.value="dateTime",pe.value.includes(Re)&&(C.value=Re);return}if(lt||/AM\/PM/i.test(Pe)){_e&&!lt?(i.value="time",me.includes(Re)&&(h.value=Re)):(i.value="date",ge.value.includes(Re)&&(b.value=Re));return}if(Re.includes("%")){i.value="percent",r.value=re(Re);return}if(/E[+-]/i.test(Re)){i.value="scientific",r.value=re(Re);return}const Ct=O.find(st=>Re.startsWith(st.value));if(Re.includes("[Red](")){i.value="financial",c.value=Re.includes(","),r.value=re(Re);return}if(Ct){Re.includes("(")?(i.value="accounting",u.value=Ct.value,c.value=Re.includes(","),r.value=re(Re)):/\.\d/.test(Re.slice(Ct.value.length))?(i.value="currency",u.value=Ct.value,c.value=Re.includes(","),r.value=re(Re)):(i.value="currencyRounded",u.value=Ct.value,c.value=Re.includes(","));return}i.value="number",c.value=Re.includes(","),r.value=re(Re)}function re(Re){const Pe=Re.match(/\.([0#?]+)/);return Pe?Pe[1].length:0}function ne(){i.value!=="custom"&&(x.value=N())}function ve(){}function Ce(){b.value=ge.value[0],h.value=me[0],C.value=pe.value[0],p.value=se[0]}function _(){a.value=!0,l.modelOpen!==void 0&&n("update:modelOpen",!0),Ce(),le(l.currentFormat??""),l.isCustom&&(i.value="custom"),t.nextTick(()=>{var Re;return(Re=R.value)==null?void 0:Re.focus()})}function L(){a.value=!1,l.modelOpen!==void 0&&n("update:modelOpen",!1)}function U(){n("apply",x.value),L()}function q(){L()}function de(Re){Re.key==="Escape"&&L()}t.watch(()=>l.modelOpen,Re=>{Re&&!a.value?_():!Re&&a.value&&L()});const ze=t.computed(()=>Il(l.sampleValue,x.value,l.locale));return(Re,Pe)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"nf-dialog"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"nf-dialog__mask",onMousedown:q,onKeydown:de},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:Pe[9]||(Pe[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Gd,[t.createElementVNode("span",Kd,t.toDisplayString(t.unref(g)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:L},[...Pe[10]||(Pe[10]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])])]),t.createElementVNode("div",qd,[t.createElementVNode("div",Yd,[t.createElementVNode("label",Xd,t.toDisplayString(t.unref(g)(e.locale,"nfCategory")),1),t.createVNode(Yt,{class:"nf-field__dropdown","model-value":i.value,options:tt.value,"onUpdate:modelValue":Pe[0]||(Pe[0]=lt=>i.value=lt),onChange:ne},null,8,["model-value","options"])]),De.value?(t.openBlock(),t.createElementBlock("div",jd,[t.createElementVNode("label",Zd,t.toDisplayString(t.unref(g)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":Pe[1]||(Pe[1]=lt=>r.value=lt),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:ne},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),W.value?(t.openBlock(),t.createElementBlock("div",Jd,[t.createElementVNode("label",Qd,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":Pe[2]||(Pe[2]=lt=>c.value=lt),type:"checkbox",onChange:ne},null,544),[[t.vModelCheckbox,c.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(g)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),we.value?(t.openBlock(),t.createElementBlock("div",eu,[t.createElementVNode("label",tu,t.toDisplayString(t.unref(g)(e.locale,"nfSymbol")),1),t.createVNode(Yt,{class:"nf-field__dropdown","model-value":u.value,options:t.unref(Qe),"onUpdate:modelValue":Pe[3]||(Pe[3]=lt=>u.value=lt),onChange:ne},null,8,["model-value","options"])])):t.createCommentVNode("",!0),$e.value?(t.openBlock(),t.createElementBlock("div",lu,[t.createElementVNode("label",nu,t.toDisplayString(t.unref(g)(e.locale,"nfDateFormat")),1),t.createVNode(Yt,{class:"nf-field__dropdown","model-value":b.value,options:K.value,"onUpdate:modelValue":Pe[4]||(Pe[4]=lt=>b.value=lt),onChange:ne},null,8,["model-value","options"])])):t.createCommentVNode("",!0),Z.value?(t.openBlock(),t.createElementBlock("div",ou,[t.createElementVNode("label",ru,t.toDisplayString(t.unref(g)(e.locale,"nfTimeFormat")),1),t.createVNode(Yt,{class:"nf-field__dropdown","model-value":h.value,options:t.unref(it),"onUpdate:modelValue":Pe[5]||(Pe[5]=lt=>h.value=lt),onChange:ne},null,8,["model-value","options"])])):t.createCommentVNode("",!0),Le.value?(t.openBlock(),t.createElementBlock("div",au,[t.createElementVNode("label",iu,t.toDisplayString(t.unref(g)(e.locale,"nfDateTime")),1),t.createVNode(Yt,{class:"nf-field__dropdown","model-value":C.value,options:I.value,"onUpdate:modelValue":Pe[6]||(Pe[6]=lt=>C.value=lt),onChange:ne},null,8,["model-value","options"])])):t.createCommentVNode("",!0),ie.value?(t.openBlock(),t.createElementBlock("div",su,[t.createElementVNode("label",cu,t.toDisplayString(t.unref(g)(e.locale,"nfDuration")),1),t.createVNode(Yt,{class:"nf-field__dropdown","model-value":p.value,options:t.unref(D),"onUpdate:modelValue":Pe[7]||(Pe[7]=lt=>p.value=lt),onChange:ne},null,8,["model-value","options"])])):t.createCommentVNode("",!0),t.createElementVNode("div",du,[t.createElementVNode("label",uu,t.toDisplayString(t.unref(g)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:R,"onUpdate:modelValue":Pe[8]||(Pe[8]=lt=>x.value=lt),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:ve},null,544),[[t.vModelText,x.value]])])]),t.createElementVNode("div",fu,[t.createElementVNode("div",mu,[t.createElementVNode("span",pu,t.toDisplayString(t.unref(g)(e.locale,"nfPreview")),1),t.createElementVNode("span",hu,t.toDisplayString(ze.value||"—"),1)]),t.createElementVNode("div",gu,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:U},t.toDisplayString(t.unref(g)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:L},t.toDisplayString(t.unref(g)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-84bb335b"]]),yu={class:"sort-confirm__header"},Cu={class:"sort-confirm__title"},wu={class:"sort-confirm__body"},vu={class:"sort-confirm__message"},ku={class:"sort-confirm__options"},Eu={class:"sort-confirm__option"},Ru={class:"sort-confirm__option"},Su={class:"sort-confirm__footer"},Mu=It(t.defineComponent({__name:"sort-confirm-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","confirm","cancel"],setup(e,{emit:o}){const l=e,n=o,a=t.ref(!1),i=t.ref(!0),r=t.ref(null);t.watch(()=>l.modelOpen,x=>{x&&!a.value?c():!x&&a.value&&u()});function c(){i.value=!0,a.value=!0,l.modelOpen!==void 0&&n("update:modelOpen",!0),t.nextTick(()=>{var R;const x=(R=r.value)==null?void 0:R.querySelector(".sort-confirm__btn--primary");x==null||x.focus()})}function u(){a.value=!1,l.modelOpen!==void 0&&n("update:modelOpen",!1)}function b(){p()}function h(x){x.key==="Escape"&&p()}function C(){n("confirm",i.value),u()}function p(){n("cancel"),u()}return(x,R)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"sort-confirm"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"sort-confirm__mask",onMousedown:b,onKeydown:h},[t.createElementVNode("div",{ref_key:"dialogRef",ref:r,class:"sort-confirm",onMousedown:R[2]||(R[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",yu,[t.createElementVNode("span",Cu,t.toDisplayString(t.unref(g)(e.locale,"sortReminderTitle")),1),t.createElementVNode("button",{class:"sort-confirm__close",type:"button",onClick:p},[...R[3]||(R[3]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])])]),t.createElementVNode("div",wu,[t.createElementVNode("p",vu,t.toDisplayString(t.unref(g)(e.locale,"sortReminderMessage")),1),t.createElementVNode("div",ku,[t.createElementVNode("label",Eu,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":R[0]||(R[0]=O=>i.value=O),type:"radio",value:!0},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(g)(e.locale,"sortExpandSelection")),1)]),t.createElementVNode("label",Ru,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":R[1]||(R[1]=O=>i.value=O),type:"radio",value:!1},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(g)(e.locale,"sortCurrentSelection")),1)])])]),t.createElementVNode("div",Su,[t.createElementVNode("button",{class:"sort-confirm__btn sort-confirm__btn--primary",type:"button",onClick:C},t.toDisplayString(t.unref(g)(e.locale,"sort")),1),t.createElementVNode("button",{class:"sort-confirm__btn",type:"button",onClick:p},t.toDisplayString(t.unref(g)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-af42d78b"]]),qr=[{name:"SUM",snippet:"SUM(A1:A10)"},{name:"AVERAGE",snippet:"AVERAGE(A1:A10)"},{name:"COUNT",snippet:"COUNT(A1:A10)"},{name:"IF",snippet:"IF(A1>0, B1, C1)"},{name:"VLOOKUP",snippet:"VLOOKUP(A1, B1:C10, 2, FALSE)"},{name:"CONCATENATE",snippet:"CONCATENATE(A1, B1)"},{name:"MAX",snippet:"MAX(A1:A10)"},{name:"MIN",snippet:"MIN(A1:A10)"},{name:"SIN",snippet:"SIN(A1)"},{name:"SUMIF",snippet:'SUMIF(A1:A10, ">0", B1:B10)'},{name:"PMT",snippet:"PMT(0.05/12, 360, 100000)"},{name:"STDEV",snippet:"STDEV(A1:A10)"}],Bu={SUM:{min:1,max:1},AVERAGE:{min:1,max:1},COUNT:{min:1,max:1},IF:{min:3,max:3},VLOOKUP:{min:3,max:4},CONCATENATE:{min:1,max:1/0},MAX:{min:1,max:1},MIN:{min:1,max:1},SIN:{min:1,max:1},SUMIF:{min:2,max:3},PMT:{min:3,max:5},STDEV:{min:1,max:1}};function Nu(e){let o=0,l=null;for(let n=0;n<e.length;n++){const a=e[n];if(l){a===l&&(e[n+1]===l?n++:l=null);continue}if(a==='"'||a==="'"){l=a;continue}if(a==="(")o++;else if(a===")"&&(o--,o<0))return!1}return o===0}function xu(e){const o=e.trim();if(!o.startsWith("="))return{ok:!1,name:null};const l=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(o.slice(1).trim());if(!l)return{ok:!1,name:null};const n=l[1].toUpperCase(),a=Bu[n];if(!a)return{ok:!1,name:n};const i=l[2];if(!Nu(i))return{ok:!1,name:n};const r=sn(i),c=r.length===1&&r[0].trim()===""?0:r.length;return c<a.min||c>a.max?{ok:!1,name:n}:r.some(u=>u.trim()==="")?{ok:!1,name:n}:{ok:!0,name:n}}function Wn(e,o,l){const n=e.split(":");if(n.length!==2)return null;const a=hl(n[0],o,l),i=hl(n[1],o,l);return!a||!i?null:{sc:Math.min(a.col,i.col),sr:Math.min(a.row,i.row),ec:Math.max(a.col,i.col),er:Math.max(a.row,i.row)}}function Yr(e){const o=e.trim();if(o==="")return"";const l=Number(o);return!isNaN(l)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(o)?l:e}function Yl(e,o,l,n,a){const i=l[_n(e,o)];if(!i)return"";const r=i.value;return r.startsWith("=")?jr(_n(e,o),l,n,a):Yr(r)}function Xr(e,o,l,n,a){const i=Yl(e,o,l,n,a);if(i===null)return 0;if(typeof i=="number")return i;const r=parseFloat(String(i));return isNaN(r)?0:r}const no=new Map,Ro=new Set;function bn(){no.clear(),Ro.clear()}function jr(e,o,l,n){return Tu(e,o,l,n,0)}function Tu(e,o,l,n,a){if(Ro.has(e))return null;if(no.has(e))return no.get(e);Ro.add(e);const i=o[e];let r;if(!i)r=null;else{const c=i.value;if(!c.startsWith("="))r=Yr(c);else{const u=c.slice(1).trim(),b=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(u);r=b?ea(b[1].toUpperCase(),b[2],o,l,n,a+1):Xt(u,o,l,n,a+1)}}return Ro.delete(e),no.set(e,r),r}function Un(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function Zr(e,o){return typeof e=="number"&&typeof o=="number"?e===o:String(e??"")===String(o??"")}function er(e,o,l){let n;if(typeof e=="number"&&typeof o=="number")n=e<o?-1:e>o?1:0;else{const a=String(e??""),i=String(o??"");n=a<i?-1:a>i?1:0}switch(l){case"=":return n===0;case"<>":return n!==0;case"<":return n<0;case">":return n>0;case"<=":return n<=0;case">=":return n>=0}return!1}function Jr(e,o,l,n){const a=e.trim();if(a.length>=2&&(a[0]==='"'&&a[a.length-1]==='"'||a[0]==="'"&&a[a.length-1]==="'"))return a.slice(1,-1);const i=Number(a);return!isNaN(i)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(a)?i:a}function Vu(e,o,l,n,a,i){let c=o.trim();c.length>=2&&(c[0]==='"'&&c[c.length-1]==='"'||c[0]==="'"&&c[c.length-1]==="'")&&(c=c.slice(1,-1));const u=/^([<>=]+)([\s\S]*)$/.exec(c);if(u){const h=u[1],C=Jr(u[2]);return er(e,C,h)}const b=Jr(c);return Zr(e,b)}function Qr(e,o,l,n,a){const i=e.trim(),r=["<=",">=","<>"];let c=null,u=-1,b=null,h=0;for(let p=0;p<i.length;p++){const x=i[p];if(b){x===b&&(i[p+1]===b?p++:b=null);continue}if(x==='"'||x==="'"){b=x;continue}if(x==="("&&h++,x===")"&&h--,h===0&&(x==="<"||x===">"||x==="=")){const R=i.slice(p,p+2);c=r.includes(R)?R:x,u=p;break}}if(c&&u>=0){const p=i.slice(0,u).trim(),x=i.slice(u+c.length).trim(),R=Xt(p,o,l,n,a),O=Xt(x,o,l,n,a);return er(R,O,c)}const C=Xt(i,o,l,n,a);return Un(C)}function sn(e){const o=[];let l=0,n=null,a="";for(let i=0;i<e.length;i++){const r=e[i];if(n){a+=r,r===n&&(e[i+1]===n?(i++,a+=n):n=null);continue}if(r==='"'||r==="'"){n=r,a+=r;continue}if(r==="("&&l++,r===")"&&l--,r===","&&l===0){o.push(a),a="";continue}a+=r}return o.push(a),o}function Xt(e,o,l,n,a){if(a>20)return null;const i=e.trim();if(i==="")return null;const r=i.toUpperCase();if(r==="TRUE")return 1;if(r==="FALSE")return 0;const c=Du(i);if(c.length===0)return null;let u=0;const b=()=>{const R=h(),O=c[u];if(!(O&&O.type==="cmp"))return R;u++;const X=h();return R===null||X===null?null:er(R,X,O.val)?1:0},h=()=>{let R=C();for(;u<c.length;){const O=c[u];if(O.type==="op"&&(O.val==="+"||O.val==="-"))u++,R=tr(R,C(),O.val);else break}return R},C=()=>{let R=p();for(;u<c.length;){const O=c[u];if(O.type==="op"&&(O.val==="*"||O.val==="/"))u++,R=tr(R,p(),O.val);else break}return R},p=()=>{const R=c[u];return R&&R.type==="op"&&R.val==="-"?(u++,tr(0,p(),"-")):R&&R.type==="op"&&R.val==="+"?(u++,p()):x()},x=()=>{const R=c[u];if(!R)return null;if(R.type==="num")return u++,Number(R.val);if(R.type==="str")return u++,R.val;if(R.type==="lp"){u++;const O=b();return c[u]&&c[u].type==="rp"&&u++,O}if(R.type==="ref"){u++;const O=hl(R.val,l,n);return O?Yl(O.col,O.row,o,l,n):null}if(R.type==="func"){const O=R.val.toUpperCase();if(u++,c[u]&&c[u].type==="lp"){const X=c[u];let j=0,Ee=null,ae=u;for(;ae<c.length;ae++)if(c[ae].type==="lp")j++;else if(c[ae].type==="rp"&&(j--,j===0)){Ee=c[ae];break}if(Ee){const ge=i.slice(X.start+1,Ee.start);return u=ae+1,ea(O,ge,o,l,n,a+1)}}return null}return u++,null};return b()}function Du(e){const o=[];let l=0;for(;l<e.length;){const n=e[l];if(/\s/.test(n)){l++;continue}if(n==='"'||n==="'"){const a=n,i=l;l++;let r="";for(;l<e.length;){if(e[l]===a){if(e[l+1]===a){r+=a,l+=2;continue}l++;break}r+=e[l],l++}o.push({type:"str",val:r,start:i});continue}if(/[0-9]/.test(n)||n==="."){const a=l;let i="";for(n==="."&&(i+=".",l++);l<e.length&&/[0-9]/.test(e[l]);)i+=e[l],l++;if(e[l]===".")for(i+=".",l++;l<e.length&&/[0-9]/.test(e[l]);)i+=e[l],l++;if(e[l]==="e"||e[l]==="E")for(i+=e[l],l++,(e[l]==="+"||e[l]==="-")&&(i+=e[l],l++);l<e.length&&/[0-9]/.test(e[l]);)i+=e[l],l++;o.push({type:"num",val:i,start:a});continue}if(/[A-Za-z_$]/.test(n)){const a=l;let i="";for(;l<e.length&&/[A-Za-z0-9_$]/.test(e[l]);)i+=e[l],l++;e[l]==="("&&!i.includes("$")?o.push({type:"func",val:i,start:a}):o.push({type:"ref",val:i,start:a});continue}if(n==="("){o.push({type:"lp",val:n,start:l}),l++;continue}if(n===")"){o.push({type:"rp",val:n,start:l}),l++;continue}if(n===","){o.push({type:"comma",val:n,start:l}),l++;continue}if(n==="+"||n==="-"||n==="*"||n==="/"){o.push({type:"op",val:n,start:l}),l++;continue}if(n==="<"||n===">"||n==="="){const a=e.slice(l,l+2);a==="<="||a===">="||a==="<>"?(o.push({type:"cmp",val:a,start:l}),l+=2):(o.push({type:"cmp",val:n,start:l}),l++);continue}l++}return o}function tr(e,o,l){if(typeof e!="number"||typeof o!="number")return null;switch(l){case"+":return e+o;case"-":return e-o;case"*":return e*o;case"/":return o===0?null:e/o}return null}function ea(e,o,l,n,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=Wn(o.trim(),n,a);if(!r)return null;if(e==="COUNT"){let u=0;for(let b=r.sc;b<=r.ec;b++)for(let h=r.sr;h<=r.er;h++)typeof Yl(b,h,l,n,a)=="number"&&u++;return u}let c=0;for(let u=r.sc;u<=r.ec;u++)for(let b=r.sr;b<=r.er;b++)c+=Xr(u,b,l,n,a);if(isNaN(c))return null;if(e==="AVERAGE"){const u=(r.ec-r.sc+1)*(r.er-r.sr+1);return u===0?null:c/u}return c}case"AND":case"OR":{const r=sn(o);if(r.length===0)return null;const c=e==="AND";for(const u of r){const b=Xt(u,l,n,a,i);if(b===null)return null;if(e==="AND"){if(!Un(b))return 0}else if(Un(b))return 1}return c?1:0}case"NOT":{const r=sn(o);if(r.length!==1)return null;const c=Xt(r[0],l,n,a,i);return c===null?null:Un(c)?0:1}case"IF":{const r=sn(o);if(r.length<3)return null;const c=Qr(r[0],l,n,a,i);return Xt(c?r[1]:r[2],l,n,a,i)}case"VLOOKUP":{const r=sn(o);if(r.length<3)return null;const c=Xt(r[0],l,n,a,i),u=Wn(r[1].trim(),n,a);if(!u)return null;const b=Xt(r[2],l,n,a,i),h=typeof b=="number"?b:parseFloat(String(b));if(isNaN(h))return null;const C=u.sc+(h-1);if(C<u.sc||C>u.ec)return null;if(r.length>=4?Un(Xt(r[3],l,n,a,i)):!1){let x=-1,R=-1/0;for(let O=u.sr;O<=u.er;O++){const X=Yl(u.sc,O,l,n,a);typeof X=="number"&&typeof c=="number"&&X<=c&&X>R&&(R=X,x=O)}return x>=0?Yl(C,x,l,n,a):null}for(let x=u.sr;x<=u.er;x++){const R=Yl(u.sc,x,l,n,a);if(Zr(R,c))return Yl(C,x,l,n,a)}return null}case"CONCATENATE":{const r=sn(o);let c="";for(const u of r){const b=Xt(u,l,n,a,i);c+=b===null?"":typeof b=="number"?String(b):b}return c}case"MAX":case"MIN":{const r=Wn(o.trim(),n,a);if(!r)return null;const c=[];for(let u=r.sc;u<=r.ec;u++)for(let b=r.sr;b<=r.er;b++){const h=Yl(u,b,l,n,a);typeof h=="number"&&c.push(h)}return c.length===0?null:e==="MAX"?Math.max(...c):Math.min(...c)}case"STDEV":{const r=Wn(o.trim(),n,a);if(!r)return null;const c=[];for(let C=r.sc;C<=r.ec;C++)for(let p=r.sr;p<=r.er;p++){const x=Yl(C,p,l,n,a);typeof x=="number"&&c.push(x)}const u=c.length;if(u<2)return null;const b=c.reduce((C,p)=>C+p,0)/u,h=c.reduce((C,p)=>C+Math.pow(p-b,2),0)/(u-1);return Math.sqrt(h)}case"SIN":{const r=sn(o);if(r.length!==1)return null;const c=Xt(r[0],l,n,a,i);return typeof c!="number"?null:Math.sin(c)}case"SUMIF":{const r=sn(o);if(r.length<2||r.length>3)return null;const c=Wn(r[0].trim(),n,a);if(!c)return null;const u=r.length===3?Wn(r[2].trim(),n,a):c;if(!u)return null;let b=0;for(let h=c.sr;h<=c.er;h++)for(let C=c.sc;C<=c.ec;C++){const p=Yl(C,h,l,n,a);Vu(p,r[1])&&(b+=Xr(u.sc+(C-c.sc),u.sr+(h-c.sr),l,n,a))}return b}case"PMT":{const r=sn(o);if(r.length<3||r.length>5)return null;const c=Xt(r[0],l,n,a,i),u=Xt(r[1],l,n,a,i),b=Xt(r[2],l,n,a,i);if(typeof c!="number"||typeof u!="number"||typeof b!="number")return null;const h=r.length>=4?Xt(r[3],l,n,a,i):0,C=typeof h=="number"?h:0,p=r.length>=5?Xt(r[4],l,n,a,i):0,x=Un(p)?1:0;if(c===0)return u===0?null:-(b+C)/u;const R=Math.pow(1+c,u);return-(C+b*R)*c/((1+c*x)*(R-1))}default:return null}}function So(e,o,l){const n=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=hl(i[1],o,l);if(r)if(i[2]){const c=hl(i[2],o,l);if(!c)continue;for(let u=Math.min(r.col,c.col);u<=Math.max(r.col,c.col);u++)for(let b=Math.min(r.row,c.row);b<=Math.max(r.row,c.row);b++)n.push(_n(u,b))}else n.push(_n(r.col,r.row))}return n}function ta(e,o,l,n,a){const i=l[_n(e,o)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const c=jr(_n(e,o),l,n,a);return c===null?"#ERROR":String(c)}function la(e,o,l,n){return Xt(e,o,l,n,0)}function na(e,o,l,n){const a=e.trim().replace(/^=/,"");return a?Qr(a,o,l,n,0):!1}function Mo(e,o,l,n,a,i){return o===0&&l===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,c,u,b,h)=>{const C=c?Po(u):Po(u)+o,p=b?parseInt(h,10)-1:parseInt(h,10)-1+l;let x;C<0?x="A":C>=n?x=i(n-1):x=i(C);let R;return p<0?R="1":p>=a?R=String(a):R=String(p+1),(c||"")+x+(b||"")+R})}class Fu{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(o){var n;const l=this.deps.get(o);if(l){for(const a of l)(n=this.rev.get(a))==null||n.delete(o);this.deps.delete(o)}}set(o,l){if(this.clear(o),l.length!==0){this.deps.set(o,l);for(const n of l)this.rev.has(n)||this.rev.set(n,new Set),this.rev.get(n).add(o)}}markDirty(o){const l=[o];for(;l.length>0;){const n=l.pop(),a=this.rev.get(n);if(a)for(const i of a)this.dirty.has(i)||(this.dirty.add(i),l.push(i))}}getDirtyAndClear(){const o=this.dirty;return this.dirty=new Set,o}rebuild(o,l,n){this.deps.clear(),this.rev.clear(),this.dirty.clear(),no.clear();for(const[a,i]of Object.entries(o))if(i.value.startsWith("=")){const r=So(i.value.slice(1),l,n);this.set(a,r)}}}const Ou={class:"ifn-dialog__header"},Iu={class:"ifn-dialog__title"},Au={class:"ifn-dialog__body"},Lu={class:"ifn-dialog__field"},zu={class:"ifn-dialog__label"},$u={key:0,class:"ifn-dialog__desc"},_u={class:"ifn-dialog__field"},Hu={class:"ifn-dialog__label"},Wu={class:"ifn-dialog__footer"},Uu=["disabled"],Pu=It(t.defineComponent({__name:"insert-function-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","insert","cancel"],setup(e,{emit:o}){const l=e,n=o,a=t.ref(!1),i=t.ref(""),r=t.ref(""),c=t.ref(null),u=t.ref(null),b={SUM:"fnDescSum",AVERAGE:"fnDescAverage",COUNT:"fnDescCount",IF:"fnDescIf",VLOOKUP:"fnDescVlookup",CONCATENATE:"fnDescConcatenate",MAX:"fnDescMax",MIN:"fnDescMin",SIN:"fnDescSin",SUMIF:"fnDescSumif",PMT:"fnDescPmt",STDEV:"fnDescStdev"},h=t.computed(()=>qr.map(me=>({label:me.name,value:me.name}))),C=t.computed(()=>{const me=String(i.value??"");return me?g(l.locale,b[me]??""):""}),p=t.computed(()=>xu(r.value)),x=t.computed(()=>i.value===""||i.value===null||!r.value.trim()||!p.value.ok?!1:p.value.name===String(i.value).toUpperCase());t.watch(()=>l.modelOpen,me=>{me&&!a.value?R():!me&&a.value&&O()});function R(){r.value="",i.value="",a.value=!0,l.modelOpen!==void 0&&n("update:modelOpen",!0),t.nextTick(()=>{const me=c.value;if(me)try{me.focus({preventScroll:!0}),me.setSelectionRange(me.value.length,me.value.length)}catch{}})}function O(){a.value=!1,l.modelOpen!==void 0&&n("update:modelOpen",!1)}function X(me){i.value=me;const pe=qr.find(se=>se.name===String(me));pe&&(r.value="",j(pe.snippet))}function j(me){const pe=r.value,se=c.value,Ve=se?se.selectionStart??pe.length:pe.length,tt=se?se.selectionEnd??pe.length:pe.length,Qe=pe.trim()?me:"="+me;r.value=pe.slice(0,Ve)+Qe+pe.slice(tt),t.nextTick(()=>{const K=c.value;if(!K)return;const it=Ve+Qe.length;try{K.focus({preventScroll:!0}),K.setSelectionRange(it,it)}catch{}})}function Ee(){n("insert",r.value),O()}function ae(){n("cancel"),O()}function ge(me){me.key==="Escape"&&(me.stopPropagation(),ae())}return(me,pe)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"ifn-dialog"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"ifn-dialog__mask",onMousedown:t.withModifiers(ae,["self"]),onKeydown:ge},[t.createElementVNode("div",{ref_key:"dialogRef",ref:u,class:"ifn-dialog",onMousedown:pe[1]||(pe[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Ou,[t.createElementVNode("span",Iu,t.toDisplayString(t.unref(g)(e.locale,"insertFunctionTitle")),1),t.createElementVNode("button",{class:"ifn-dialog__close",type:"button",onClick:ae},[...pe[2]||(pe[2]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])])]),t.createElementVNode("div",Au,[t.createElementVNode("div",Lu,[t.createElementVNode("label",zu,t.toDisplayString(t.unref(g)(e.locale,"insertFunctionSelectLabel")),1),t.createVNode(Yt,{class:"ifn-dialog__dropdown","model-value":i.value,options:h.value,searchable:!0,"search-placeholder":t.unref(g)(e.locale,"insertFunctionSearchPlaceholder"),"fallback-label":t.unref(g)(e.locale,"insertFunctionPlaceholder"),title:t.unref(g)(e.locale,"insertFunctionSelectLabel"),"onUpdate:modelValue":X},null,8,["model-value","options","search-placeholder","fallback-label","title"]),C.value?(t.openBlock(),t.createElementBlock("div",$u,t.toDisplayString(C.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",_u,[t.createElementVNode("label",Hu,t.toDisplayString(t.unref(g)(e.locale,"insertFunctionFormulaLabel")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:c,"onUpdate:modelValue":pe[0]||(pe[0]=se=>r.value=se),class:"ifn-dialog__textarea",spellcheck:"false"},null,512),[[t.vModelText,r.value]])])]),t.createElementVNode("div",Wu,[t.createElementVNode("button",{class:"ifn-dialog__btn ifn-dialog__btn--primary",type:"button",disabled:!x.value,onClick:Ee},t.toDisplayString(t.unref(g)(e.locale,"insertFunctionBtn")),9,Uu),t.createElementVNode("button",{class:"ifn-dialog__btn",type:"button",onClick:ae},t.toDisplayString(t.unref(g)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-9b21a714"]]),oo="__filter_blank__";function lr(e,o,l,n){if(Al(e))return Number(e);if(n==="date"){const a=ql(e,l);if(a)return a.serial}return null}function Bo(e,o,l){if(e==null)return null;if(Al(e))return Number(e);if(o==="date"){const n=ql(e,l);if(n)return n.serial}return null}function Gu(e,o,l,n,a){const i=Il(o,l,n);switch(e.operator){case"blank":return o.trim()==="";case"notBlank":return o.trim()!=="";case"equals":case"notEquals":{const r=e.operator==="equals";if(a==="number"||a==="date"){const u=lr(o,l,n,a),b=Bo(e.value,a,n);return u==null||b==null?!1:r?u===b:u!==b}const c=i.toLowerCase()===(e.value??"").toLowerCase();return r?c:!c}case"contains":return i.toLowerCase().includes((e.value??"").toLowerCase());case"notContains":return!i.toLowerCase().includes((e.value??"").toLowerCase());case"startsWith":return i.toLowerCase().startsWith((e.value??"").toLowerCase());case"endsWith":return i.toLowerCase().endsWith((e.value??"").toLowerCase());case"gt":case"gte":case"lt":case"lte":{const r=lr(o,l,n,a),c=Bo(e.value,a,n);return r==null||c==null?!1:e.operator==="gt"?r>c:e.operator==="gte"?r>=c:e.operator==="lt"?r<c:r<=c}case"between":{const r=lr(o,l,n,a),c=Bo(e.value,a,n),u=Bo(e.value2,a,n);if(r==null||c==null||u==null)return!1;const b=Math.min(c,u),h=Math.max(c,u);return r>=b&&r<=h}}return!0}function oa(e,o,l,n){if(e.type==="values"){const a=e.values??[];if(a.length===0)return!0;if(o.trim()==="")return a.includes(oo);const i=Il(o,l,n);return a.includes(o)||a.includes(i)}return e.condition?Gu(e.condition,o,l,n,e.type):!0}function Ku(e,o,l,n){if(!e)return!0;const{columns:a,range:i}=e;for(const r in a){const c=Number(r);if(c<i.startCol||c>i.endCol)continue;const u=a[r],b=l.getValue(c,o),h=l.getFormat(c,o);if(!oa(u,b,h,n))return!1}return!0}function qu(e,o,l,n){const a=new Set,i=[];let r=!1;const{range:c,columns:u}=e;for(let h=c.startRow+1;h<=c.endRow;h++){let C=!0;for(const R in u){const O=Number(R);if(O===o)continue;const X=u[R];if(!oa(X,l.getValue(O,h),l.getFormat(O,h),n)){C=!1;break}}if(!C)continue;const p=l.getValue(o,h),x=Il(p,l.getFormat(o,h),n);if(p.trim()===""){r=!0;continue}a.has(x)||(a.add(x),i.push(x))}return i.length>0&&i.every(h=>Al(h))?i.sort((h,C)=>Number(h)-Number(C)):i.sort((h,C)=>h.localeCompare(C,n,{numeric:!0})),{values:i,hasBlank:r}}function ra(e){var o;return e?e.type==="values"?(((o=e.values)==null?void 0:o.length)??0)>0:!!e.condition:!1}const Yu={class:"filter-popup__head"},Xu={class:"filter-popup__head-label"},ju={key:0,class:"filter-popup__head-badge"},Zu={class:"filter-popup__search"},Ju=["placeholder"],Qu={class:"filter-popup__tools"},ef={class:"filter-popup__count"},tf=["checked","onChange"],lf={class:"filter-popup__item-label"},nf={key:0,class:"filter-popup__item-note"},of={key:0,class:"filter-popup__empty"},rf={class:"filter-popup__modes"},af={key:1,class:"filter-popup__cond"},sf={class:"filter-popup__cond-row"},cf=["value"],df={key:0,class:"filter-popup__cond-row"},uf={class:"filter-popup__cond-and"},ff={key:1,class:"filter-popup__cond-row"},mf=["placeholder"],pf={class:"filter-popup__footer"},nr=248,No=28,hf=252,gf=It(t.defineComponent({__name:"filter-popup",props:{col:{},anchor:{},locale:{default:"zh-CN"},headerLabel:{},getFilter:{},setFilter:{},setFilterColumn:{},clearFilterColumn:{},getColumnCandidates:{},close:{},boundaryEl:{}},setup(e){const o=e,l=t.ref(null),n=t.ref(null),a=t.ref(null),i=t.ref({left:0,top:0}),r=t.ref("values"),c=t.ref(""),u=t.ref(new Set),b=t.ref(!1),h=t.ref(0),C=t.ref(null),p=t.ref("equals"),x=t.ref(""),R=t.ref(""),O=t.computed(()=>o.getColumnCandidates(o.col)),X=t.computed(()=>c.value.trim()!==""),j=t.computed(()=>{const _=c.value.trim().toLowerCase();return _?O.value.values.filter(L=>L.toLowerCase().includes(_)):O.value.values}),Ee=t.computed(()=>{const _=j.value.map(L=>({key:L,label:L,isBlank:!1}));return O.value.hasBlank&&!X.value&&_.push({key:oo,label:g(o.locale,"filterBlank"),isBlank:!0}),_}),ae=Math.ceil(hf/No),ge=t.computed(()=>Math.max(0,Math.floor(h.value/No)-2)),me=t.computed(()=>Math.min(Ee.value.length,ge.value+ae+4)),pe=t.computed(()=>Ee.value.slice(ge.value,me.value)),se=t.computed(()=>ge.value*No),Ve=t.computed(()=>Math.max(0,(Ee.value.length-me.value)*No));function tt(_){h.value=_.target.scrollTop}const Qe=["equals","notEquals","contains","notContains","startsWith","endsWith"],K=["equals","notEquals","gt","gte","lt","lte","between"],it={equals:"filterEquals",notEquals:"filterNotEquals",contains:"filterContains",notContains:"filterNotContains",startsWith:"filterStartsWith",endsWith:"filterEndsWith",gt:"filterGreaterThan",gte:"filterGreaterThanOrEqual",lt:"filterLessThan",lte:"filterLessThanOrEqual",between:"filterBetween",blank:"filterBlank",notBlank:"filterNonBlank"},I=t.computed(()=>r.value==="text"?Qe:K),D=t.computed(()=>{var U;const _=o.getFilter(),L=_==null?void 0:_.columns[o.col];return L?L.type==="values"?(((U=L.values)==null?void 0:U.length)??0)>0:!!L.condition:!1});function W(){const _=o.getFilter(),L=_==null?void 0:_.columns[o.col];L&&L.type==="values"?(u.value=new Set((L.values??[]).filter(U=>U!==oo)),b.value=(L.values??[]).includes(oo)):L&&L.condition?(r.value=L.type,p.value=L.condition.operator,x.value=L.condition.value??"",R.value=L.condition.value2??""):(u.value=new Set(O.value.values),b.value=O.value.hasBlank)}function we(){if(!o.getFilter())return;const L=O.value.values,U=O.value.hasBlank;if(u.value.size===L.length&&L.every(de=>u.value.has(de))&&b.value===U)o.setFilterColumn(o.col,null);else{const de=[...u.value];b.value&&de.push(oo),o.setFilterColumn(o.col,{type:"values",values:de})}}function $e(_){const L=new Set(u.value);L.has(_)?L.delete(_):L.add(_),u.value=L}function Z(){b.value=!b.value}function Le(){const _=X.value?j.value:O.value.values,L=new Set(u.value);_.forEach(U=>L.add(U)),u.value=L,b.value=!0}function ie(){u.value=new Set,b.value=!1}function De(_){r.value=_,p.value=_==="text"?"contains":"equals",x.value="",R.value=""}function N(){r.value="values",W()}function J(){const _={operator:p.value,value:x.value};r.value!=="text"&&p.value==="between"&&(_.value2=R.value),x.value.trim()!==""&&(o.setFilterColumn(o.col,{type:r.value,condition:_}),o.close())}function le(){u.value=new Set(O.value.values),b.value=O.value.hasBlank}function re(){we(),o.close()}function ne(){C.value&&o.setFilter(C.value),o.close()}function ve(_){const L=l.value;L&&_.target instanceof Node&&L.contains(_.target)||o.close()}function Ce(_){_.key==="Escape"&&ne()}return t.onMounted(async()=>{var de,ze;C.value=o.getFilter()?JSON.parse(JSON.stringify(o.getFilter())):null,W(),await t.nextTick();const _=((de=l.value)==null?void 0:de.offsetHeight)??400;let L=o.anchor.x+15-nr,U=o.anchor.y+24;const q=Gl(o.boundaryEl);L<q.left+4&&(L=Math.max(q.left+4,o.anchor.x)),L+nr>q.right-4&&(L=Math.max(q.left+4,q.right-nr-4)),U+_>q.bottom-4&&(U=Math.max(q.top+4,o.anchor.y-_-4)),i.value={left:L,top:U},(ze=a.value)==null||ze.focus(),document.addEventListener("pointerdown",ve,!0),document.addEventListener("keydown",Ce,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",ve,!0),document.removeEventListener("keydown",Ce,!0)}),(_,L)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{ref_key:"rootRef",ref:l,class:"filter-popup",style:t.normalizeStyle({left:i.value.left+"px",top:i.value.top+"px"}),onPointerdown:L[9]||(L[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Yu,[t.createElementVNode("span",Xu,t.toDisplayString(e.headerLabel||t.unref(pt)(e.col)),1),D.value?(t.openBlock(),t.createElementBlock("span",ju,t.toDisplayString(t.unref(g)(e.locale,"filterActive")),1)):t.createCommentVNode("",!0)]),r.value==="values"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",Zu,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchInputRef",ref:a,"onUpdate:modelValue":L[0]||(L[0]=U=>c.value=U),class:"filter-popup__search-input",type:"text",placeholder:t.unref(g)(e.locale,"filterSearchPlaceholder")},null,8,Ju),[[t.vModelText,c.value]])]),t.createElementVNode("div",Qu,[t.createElementVNode("button",{class:"filter-popup__tool",onClick:Le},t.toDisplayString(t.unref(g)(e.locale,"filterSelectAll")),1),t.createElementVNode("button",{class:"filter-popup__tool",onClick:ie},t.toDisplayString(t.unref(g)(e.locale,"filterClearAll")),1),t.createElementVNode("span",ef,t.toDisplayString(t.unref(g)(e.locale,"filterFilteredCount").replace("{n}",String(O.value.values.length))),1)]),t.createElementVNode("div",{ref_key:"listRef",ref:n,class:"filter-popup__list",onScroll:tt},[t.createElementVNode("div",{style:t.normalizeStyle({height:se.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(pe.value,U=>(t.openBlock(),t.createElementBlock("label",{key:U.key,class:"filter-popup__item"},[t.createElementVNode("input",{type:"checkbox",checked:U.isBlank?b.value:u.value.has(U.key),onChange:q=>U.isBlank?Z():$e(U.key)},null,40,tf),t.createElementVNode("span",lf,t.toDisplayString(U.label),1),U.isBlank?(t.openBlock(),t.createElementBlock("span",nf,"("+t.toDisplayString(t.unref(g)(e.locale,"filterBlank"))+")",1)):t.createCommentVNode("",!0)]))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:Ve.value+"px"})},null,4),Ee.value.length===0?(t.openBlock(),t.createElementBlock("div",of,t.toDisplayString(t.unref(g)(e.locale,"filterNoData")),1)):t.createCommentVNode("",!0)],544),t.createElementVNode("div",rf,[t.createElementVNode("button",{class:"filter-popup__mode",onClick:L[1]||(L[1]=U=>De("text"))},t.toDisplayString(t.unref(g)(e.locale,"filterText")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:L[2]||(L[2]=U=>De("number"))},t.toDisplayString(t.unref(g)(e.locale,"filterNumber")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:L[3]||(L[3]=U=>De("date"))},t.toDisplayString(t.unref(g)(e.locale,"filterDate")),1)])],64)):(t.openBlock(),t.createElementBlock("div",af,[t.createElementVNode("button",{class:"filter-popup__cond-back",onClick:N}," ← "+t.toDisplayString(t.unref(g)(e.locale,"filterCustom")),1),t.createElementVNode("div",sf,[t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":L[4]||(L[4]=U=>p.value=U),class:"filter-popup__cond-select"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(I.value,U=>(t.openBlock(),t.createElementBlock("option",{key:U,value:U},t.toDisplayString(t.unref(g)(e.locale,it[U])),9,cf))),128))],512),[[t.vModelSelect,p.value]])]),p.value==="between"?(t.openBlock(),t.createElementBlock("div",df,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[5]||(L[5]=U=>x.value=U),class:"filter-popup__cond-input",type:"text"},null,512),[[t.vModelText,x.value]]),t.createElementVNode("span",uf,t.toDisplayString(t.unref(g)(e.locale,"filterAnd")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[6]||(L[6]=U=>R.value=U),class:"filter-popup__cond-input",type:"text"},null,512),[[t.vModelText,R.value]])])):(t.openBlock(),t.createElementBlock("div",ff,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[7]||(L[7]=U=>x.value=U),class:"filter-popup__cond-input",type:"text",placeholder:r.value==="date"?"2024-01-01":"",onKeydown:t.withKeys(J,["enter"])},null,40,mf),[[t.vModelText,x.value]])]))])),t.createElementVNode("div",pf,[t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--clear",onClick:le},t.toDisplayString(t.unref(g)(e.locale,"clearFilter")),1),L[10]||(L[10]=t.createElementVNode("span",{class:"filter-popup__footer-spacer"},null,-1)),t.createElementVNode("button",{class:"filter-popup__btn",onClick:ne},t.toDisplayString(t.unref(g)(e.locale,"cancelFilter")),1),t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--primary",onClick:L[8]||(L[8]=U=>r.value==="values"?re():J())},t.toDisplayString(t.unref(g)(e.locale,"filterOk")),1)])],36)]))}}),[["__scopeId","data-v-8ed96243"]]),bf={class:"cf-manager__header"},yf={class:"cf-manager__title"},Cf={key:0,class:"cf-manager__empty"},wf={key:1,class:"cf-manager__list"},vf={class:"cf-rule__main"},kf={class:"cf-rule__info"},Ef={class:"cf-rule__summary"},Rf={class:"cf-rule__range"},Sf={class:"cf-rule__actions"},Mf={class:"cf-chk"},Bf=["checked","onChange"],Nf=["title","onClick"],xf=["title","onClick"],Tf=["title","onClick"],Vf=["title","onClick"],Df=It(t.defineComponent({__name:"conditional-format-manager",props:{locale:{},rules:{default:()=>[]},themeVars:{default:()=>({})}},emits:["edit","delete","move","toggle","new","close"],setup(e,{emit:o}){const l=e,n=o,a=t.computed(()=>[...l.rules].sort((u,b)=>u.priority-b.priority));function i(u){return u.ranges.map(b=>{const h=pt(b.startCol)+(b.startRow+1);return b.startCol===b.endCol&&b.startRow===b.endRow?h:h+":"+pt(b.endCol)+(b.endRow+1)}).join(", ")}function r(u){switch(u.type){case"cellIs":{const b=g(l.locale,"cf"+(u.operator==="greaterThan"?"GreaterThan":u.operator==="lessThan"?"LessThan":u.operator==="greaterThanOrEqual"?"GreaterThanOrEqual":u.operator==="lessThanOrEqual"?"LessThanOrEqual":u.operator==="notEqual"?"NotEqual":u.operator==="between"?"Between":u.operator==="notBetween"?"NotBetween":"Equal"));return u.operator==="between"||u.operator==="notBetween"?`${b} ${u.value} ${g(l.locale,"cfValue2")} ${u.value2??""}`:`${b} ${u.value}`}case"textContains":return`${g(l.locale,"cfTextContains")} "${u.value}"`;case"textNotContains":return`${g(l.locale,"cfTextNotContains")} "${u.value}"`;case"blank":return g(l.locale,"cfBlank");case"notBlank":return g(l.locale,"cfNotBlank");case"duplicate":return g(l.locale,"cfDuplicate");case"unique":return g(l.locale,"cfUnique");case"formula":return"= "+u.formula;default:return g(l.locale,"cfRuleTypeGeneric")}}function c(u){const b={};return u.format.backgroundColor&&(b.background=u.format.backgroundColor),u.format.color&&(b.color=u.format.color),u.format.fontWeight==="bold"&&(b.fontWeight="700"),u.format.fontStyle==="italic"&&(b.fontStyle="italic"),u.format.underline==="underline"&&(b.textDecoration="underline"),u.format.strikethrough==="line-through"&&(b.textDecoration="line-through"),b}return(u,b)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-manager",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",bf,[t.createElementVNode("span",yf,t.toDisplayString(t.unref(g)(e.locale,"cfManagerTitle")),1),t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary cf-manager__new",onClick:b[0]||(b[0]=h=>n("new"))},t.toDisplayString(t.unref(g)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-manager__close",onClick:b[1]||(b[1]=h=>n("close"))}," × ")]),a.value.length===0?(t.openBlock(),t.createElementBlock("div",Cf,t.toDisplayString(t.unref(g)(e.locale,"cfNoRules")),1)):(t.openBlock(),t.createElementBlock("div",wf,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,h=>(t.openBlock(),t.createElementBlock("div",{key:h.id,class:t.normalizeClass(["cf-rule",{"cf-rule--disabled":!h.enabled}])},[t.createElementVNode("div",vf,[t.createElementVNode("span",{class:"cf-rule__preview",style:t.normalizeStyle(c(h))},"Aa",4),t.createElementVNode("div",kf,[t.createElementVNode("div",Ef,t.toDisplayString(r(h.condition)),1),t.createElementVNode("div",Rf,t.toDisplayString(t.unref(g)(e.locale,"cfAppliedTo"))+": "+t.toDisplayString(i(h)),1)])]),t.createElementVNode("div",Sf,[t.createElementVNode("label",Mf,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:h.enabled,onChange:C=>n("toggle",h.id,C.target.checked)},null,40,Bf),b[2]||(b[2]=t.createElementVNode("span",{class:"cf-chk__box"},[t.createElementVNode("svg",{class:"cf-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(g)(e.locale,"cfEnabled")),1)]),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(g)(e.locale,"cfMoveUp"),onClick:C=>n("move",h.id,"up")},[...b[3]||(b[3]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M8 3 L8 13 M4 7 L8 3 L12 7"})],-1)])],8,Nf),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(g)(e.locale,"cfMoveDown"),onClick:C=>n("move",h.id,"down")},[...b[4]||(b[4]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M8 3 L8 13 M4 9 L8 13 L12 9"})],-1)])],8,xf),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(g)(e.locale,"cfEdit"),onClick:C=>n("edit",h)},[...b[5]||(b[5]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M10.5 3.5 L13 6 L5 14 L2 14 L2 11 Z"}),t.createElementVNode("path",{d:"M9 5.5 L11.5 8"})],-1)])],8,Tf),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(g)(e.locale,"cfDelete"),onClick:C=>n("delete",h.id)},[...b[6]||(b[6]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"},[t.createElementVNode("path",{d:"M4.5 4.5 L11.5 11.5 M11.5 4.5 L4.5 11.5"})],-1)])],8,Vf)])],2))),128))]))],4))}}),[["__scopeId","data-v-230c5fcf"]]),Ff={class:"cf-editor__header"},Of={class:"cf-editor__title"},If={class:"cf-editor__body"},Af={class:"cf-row"},Lf={class:"cf-label"},zf={class:"cf-row"},$f={class:"cf-label"},_f={class:"cf-row"},Hf={class:"cf-label"},Wf={key:0,class:"cf-row"},Uf={class:"cf-label"},Pf={class:"cf-row"},Gf={class:"cf-label"},Kf=["placeholder"],qf={class:"cf-hint"},Yf={key:2,class:"cf-row"},Xf={class:"cf-label"},jf={class:"cf-row"},Zf={class:"cf-label"},Jf={class:"cf-format-row"},Qf=["title"],em={viewBox:"0 0 1024 1024",fill:"currentColor"},tm=["fill"],lm=["title"],nm={viewBox:"0 0 1024 1024",fill:"currentColor"},om=["fill"],rm=["title"],am=["title"],im=["title"],sm=["title"],cm={class:"cf-row"},dm={class:"cf-label"},um={key:3,class:"cf-error"},fm={class:"cf-row cf-row--inline"},mm={class:"cf-chk"},pm=["checked"],hm={class:"cf-chk"},gm=["checked"],bm={class:"cf-editor__footer"},ym=It(t.defineComponent({__name:"conditional-format-rule-editor",props:{locale:{},mode:{},rule:{default:null},defaultRangeText:{default:""},themeVars:{default:()=>({})}},emits:["save","cancel"],setup(e,{emit:o}){const l=e,n=o,a=[{label:"cfCellIs",value:"cellIs"},{label:"cfTextContains",value:"textContains"},{label:"cfTextNotContains",value:"textNotContains"},{label:"cfBlank",value:"blank"},{label:"cfNotBlank",value:"notBlank"},{label:"cfDuplicate",value:"duplicate"},{label:"cfUnique",value:"unique"},{label:"cfFormulaShort",value:"formula"}],i=[{label:"cfEqual",value:"equal"},{label:"cfNotEqual",value:"notEqual"},{label:"cfGreaterThan",value:"greaterThan"},{label:"cfGreaterThanOrEqual",value:"greaterThanOrEqual"},{label:"cfLessThan",value:"lessThan"},{label:"cfLessThanOrEqual",value:"lessThanOrEqual"},{label:"cfBetween",value:"between"},{label:"cfNotBetween",value:"notBetween"}];function r(){if(l.rule){const I=l.rule.condition;return{type:I.type==="cellIs"||I.type==="textContains"||I.type==="textNotContains"||I.type==="blank"||I.type==="notBlank"||I.type==="duplicate"||I.type==="unique"||I.type==="formula"?I.type:"cellIs",operator:I.type==="cellIs"?I.operator:"greaterThan",value:I.type==="cellIs"||I.type==="textContains"||I.type==="textNotContains"?I.value:"",value2:I.type==="cellIs"?I.value2??"":"",formula:I.type==="formula"?I.formula:"",backgroundColor:l.rule.format.backgroundColor??"",color:l.rule.format.color??"",fontWeight:l.rule.format.fontWeight==="bold",fontStyle:l.rule.format.fontStyle==="italic",underline:l.rule.format.underline==="underline",strikethrough:l.rule.format.strikethrough==="line-through",rangeText:l.rule.ranges.length?l.rule.ranges.map(W=>x(W)).join(", "):l.defaultRangeText,stopIfTrue:l.rule.stopIfTrue,enabled:l.rule.enabled}}return{type:"cellIs",operator:"greaterThan",value:"",value2:"",formula:"",backgroundColor:"#DEEBF7",color:"#17375E",fontWeight:!1,fontStyle:!1,underline:!1,strikethrough:!1,rangeText:l.defaultRangeText,stopIfTrue:!1,enabled:!0}}const c=t.reactive(r()),u=t.ref(!1),b=t.ref(!1),h=t.ref(null),C=t.ref(null),p=t.ref("");function x(I){const D=pt(I.startCol)+(I.startRow+1);return I.startCol===I.endCol&&I.startRow===I.endRow?D:D+":"+pt(I.endCol)+(I.endRow+1)}function R(I){const D=I.split(",").map(we=>we.trim()).filter(Boolean),W=[];for(const we of D){if(!we.match(/^[A-Za-z]+\d+(?::[A-Za-z]+\d+)?$/i))return null;const Z=hl(we.split(":")[0],99999,99999),Le=we.split(":")[1],ie=Le?hl(Le,99999,99999):Z;if(!Z||!ie)return null;W.push({startCol:Math.min(Z.col,ie.col),endCol:Math.max(Z.col,ie.col),startRow:Math.min(Z.row,ie.row),endRow:Math.max(Z.row,ie.row)})}return W.length?W:null}const O=t.computed(()=>c.type==="cellIs"&&(c.operator==="between"||c.operator==="notBetween")),X=t.computed(()=>c.type==="formula"),j=t.computed(()=>["blank","notBlank","duplicate","unique"].includes(c.type)),Ee=t.computed(()=>a.map(I=>({value:I.value,label:g(l.locale,I.label)}))),ae=t.computed(()=>i.map(I=>({value:I.value,label:g(l.locale,I.label)})));function ge(I){c.type=I}function me(I){c.operator=String(I)}function pe(){u.value=!u.value}function se(){b.value=!b.value}function Ve(){return p.value="",R(c.rangeText)?X.value&&!c.formula.trim()?(p.value="请输入公式",!1):!0:(p.value="范围格式无效,例如 A1:B10",!1)}function tt(){switch(c.type){case"cellIs":return{type:"cellIs",operator:c.operator,value:c.value,value2:c.value2||void 0};case"textContains":return{type:"textContains",value:c.value};case"textNotContains":return{type:"textNotContains",value:c.value};case"blank":return{type:"blank"};case"notBlank":return{type:"notBlank"};case"duplicate":return{type:"duplicate"};case"unique":return{type:"unique"};case"formula":return{type:"formula",formula:c.formula}}}function Qe(){return{backgroundColor:c.backgroundColor||void 0,color:c.color||void 0,fontWeight:c.fontWeight?"bold":"",fontStyle:c.fontStyle?"italic":"",underline:c.underline?"underline":"",strikethrough:c.strikethrough?"line-through":""}}function K(){var W,we;if(!Ve())return;const I=R(c.rangeText),D={id:((W=l.rule)==null?void 0:W.id)??"",condition:tt(),format:Qe(),ranges:I,priority:((we=l.rule)==null?void 0:we.priority)??0,stopIfTrue:c.stopIfTrue,enabled:c.enabled};n("save",D)}function it(){n("cancel")}return(I,D)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Ff,[t.createElementVNode("span",Of,t.toDisplayString(e.mode==="edit"?t.unref(g)(e.locale,"cfEdit"):t.unref(g)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-editor__close",onClick:it}," × ")]),t.createElementVNode("div",If,[t.createElementVNode("div",Af,[t.createElementVNode("label",Lf,t.toDisplayString(t.unref(g)(e.locale,"cfType")),1),t.createVNode(Yt,{class:"cf-dropdown","model-value":c.type,options:Ee.value,width:"100%","visible-count":8,title:t.unref(g)(e.locale,"cfType"),align:"right",onChange:ge},null,8,["model-value","options","title"])]),c.type==="cellIs"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",zf,[t.createElementVNode("label",$f,t.toDisplayString(t.unref(g)(e.locale,"cfOperator")),1),t.createVNode(Yt,{class:"cf-dropdown","model-value":c.operator,options:ae.value,width:"100%","visible-count":9,title:t.unref(g)(e.locale,"cfOperator"),align:"right",onChange:me},null,8,["model-value","options","title"])]),t.createElementVNode("div",_f,[t.createElementVNode("label",Hf,t.toDisplayString(t.unref(g)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":D[0]||(D[0]=W=>c.value=W),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.value]])]),O.value?(t.openBlock(),t.createElementBlock("div",Wf,[t.createElementVNode("label",Uf,t.toDisplayString(t.unref(g)(e.locale,"cfValue2")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":D[1]||(D[1]=W=>c.value2=W),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.value2]])])):t.createCommentVNode("",!0)],64)):X.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",Pf,[t.createElementVNode("label",Gf,t.toDisplayString(t.unref(g)(e.locale,"cfFormulaShort")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":D[2]||(D[2]=W=>c.formula=W),class:"cf-input",type:"text",placeholder:t.unref(g)(e.locale,"cfFormulaExample")},null,8,Kf),[[t.vModelText,c.formula]])]),t.createElementVNode("p",qf,t.toDisplayString(t.unref(g)(e.locale,"cfFormula")),1)],64)):j.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Yf,[t.createElementVNode("label",Xf,t.toDisplayString(t.unref(g)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":D[3]||(D[3]=W=>c.value=W),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.value]])])),t.createElementVNode("div",jf,[t.createElementVNode("label",Zf,t.toDisplayString(t.unref(g)(e.locale,"cfFormat")),1),t.createElementVNode("div",Jf,[t.createElementVNode("button",{ref_key:"fillTrigger",ref:h,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":u.value}]),title:t.unref(g)(e.locale,"fillColor"),onClick:pe},[(t.openBlock(),t.createElementBlock("svg",em,[D[15]||(D[15]=t.createElementVNode("path",{d:"M447.018667 37.952l352.298666 352.298667c6.613333 6.613333 6.613333 17.344 0 23.957333L446.101333 767.424a16.938667 16.938667 0 0 1-23.957333 0L121.429333 466.688a16.938667 16.938667 0 0 1 0-23.957333L428.608 135.552 388.992 96a8.469333 8.469333 0 0 1 0-11.989333l46.058667-46.037334a8.469333 8.469333 0 0 1 11.968 0z m346.325333 517.461333l57.514667 60.074667c31.744 33.194667 31.744 86.997333 0 120.192a78.869333 78.869333 0 0 1-115.008 0c-31.765333-33.194667-31.765333-86.997333 0-120.192l57.493333-60.074667zM486.101333 193.066667l-261.12 261.12 20.458667 20.458666 380.16-1.728 70.186667-70.186666-209.706667-209.664z"},null,-1)),t.createElementVNode("path",{d:"M85.333333 853.333333m8.896 0l835.541334 0q8.896 0 8.896 8.896l0 110.208q0 8.896-8.896 8.896l-835.541334 0q-8.896 0-8.896-8.896l0-110.208q0-8.896 8.896-8.896Z",fill:c.backgroundColor||"currentColor"},null,8,tm)]))],10,Qf),t.createVNode(ko,{"model-open":u.value,"color-key":"fill","current-color":c.backgroundColor,"trigger-el":h.value,locale:e.locale,"onUpdate:modelOpen":D[4]||(D[4]=W=>u.value=W),onChange:D[5]||(D[5]=W=>c.backgroundColor=W)},null,8,["model-open","current-color","trigger-el","locale"]),t.createElementVNode("button",{ref_key:"fontTrigger",ref:C,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":b.value}]),title:t.unref(g)(e.locale,"fontColor"),onClick:se},[(t.openBlock(),t.createElementBlock("svg",nm,[D[16]||(D[16]=t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M663.120842 529.946947H364.759579l-84.07579 212.884211a53.894737 53.894737 0 0 1-50.122105 34.169263h-14.551579a34.869895 34.869895 0 0 1-32.498526-47.696842L443.715368 70.063158a53.894737 53.894737 0 0 1 50.122106-34.115369h41.768421a53.894737 53.894737 0 0 1 50.176 34.277053l257.670737 659.078737a34.977684 34.977684 0 0 1-32.552421 47.696842h-14.389895a53.894737 53.894737 0 0 1-50.229895-34.277053l-83.159579-212.776421z m-35.139368-89.788631l-113.340632-289.953684-114.472421 289.953684h227.813053z"})],-1)),t.createElementVNode("path",{d:"M62.895 844.369m53.895 0l790.474 0q53.895 0 53.895 53.895l0 26.947q0 53.895-53.895 53.895l-790.474 0q-53.895 0-53.895-53.895l0-26.947q0-53.895 53.895-53.895z",fill:c.color||"#000000"},null,8,om)]))],10,lm),t.createVNode(ko,{"model-open":b.value,"color-key":"text","current-color":c.color,"trigger-el":C.value,locale:e.locale,"onUpdate:modelOpen":D[6]||(D[6]=W=>b.value=W),onChange:D[7]||(D[7]=W=>c.color=W)},null,8,["model-open","current-color","trigger-el","locale"]),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.fontWeight}]),title:t.unref(g)(e.locale,"bold"),onClick:D[8]||(D[8]=W=>c.fontWeight=!c.fontWeight)},[...D[17]||(D[17]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M214.857 889.143v-68.571h68.571V203.429H214.857v-68.571h411.429v1.257c96.114 10.629 171.429 87.383 171.429 181.6 0 58.971-29.486 111.086-75.109 144.457 72.069 39.291 120.823 113.234 120.823 198.4 0 119.291-95.634 216.594-217.12 227.543l-0.286.029H214.857z m388.572-388.571H352v320h251.429c95.086 0 171.429-72.091 171.429-160s-76.343-160-171.429-160z m0-297.143H352v228.571h251.429l5.211-0.091c67.52-2.515 120.503-53.235 120.503-114.195 0-62.537-55.749-114.285-125.714-114.285z"})],-1)])],10,rm),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.fontStyle}]),title:t.unref(g)(e.locale,"italic"),onClick:D[9]||(D[9]=W=>c.fontStyle=!c.fontStyle)},[...D[18]||(D[18]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M730.143 127.714v64.286h-112.329l-166.521 621.429h128.871v64.286H276.286v-64.286h108.45l166.5-621.429H426.286V127.714h303.857z"})],-1)])],10,am),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.underline}]),title:t.unref(g)(e.locale,"underline"),onClick:D[10]||(D[10]=W=>c.underline=!c.underline)},[...D[19]||(D[19]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 123.639a36.409 36.409 0 0 1 33.642 22.525l230.59 558.27a36.409 36.409 0 1 1-67.284 27.768L638.072 560.545H385.928l-70.876 171.656a36.409 36.409 0 1 1-67.332-27.768l230.59-558.27A36.409 36.409 0 0 1 512 123.639z m-95.974 364.089h191.948L512 255.439l-95.974 232.289zM769.289 827.544c19.418 0 38.836 14.564 38.836 38.836 0 19.418-14.564 33.982-29.127 33.982H259.565c-19.418 0-38.836-14.564-38.836-38.836 0-19.418 14.564-33.982 29.127-33.982h519.433z"})],-1)])],10,im),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.strikethrough}]),title:t.unref(g)(e.locale,"strikethrough"),onClick:D[11]||(D[11]=W=>c.strikethrough=!c.strikethrough)},[...D[20]||(D[20]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M182.044 490.667h659.911a34.133 34.133 0 0 1 4.642 67.948l-4.597 0.319h-135.395c40.05 37 60.803 81.601 60.803 133.575 0 128.569-147.092 211.171-307.382 192.512-101.717-11.833-173.352-52.565-210.944-122.971a34.133 34.133 0 0 1 60.211-32.176c25.942 48.606 77.46 77.915 158.606 87.381 124.837 14.473 231.242-45.283 231.242-124.746 0-53.339-36.636-96.802-116.736-131.345l-5.279-2.23H182.044a34.133 34.133 0 0 1-33.815-29.492L147.911 524.8a34.133 34.133 0 0 1 29.491-33.815l4.642-0.318z m68.767-176.447c6.918-128.796 128.432-203.343 287.812-184.82 99.579 11.56 175.81 47.923 226.737 109.636a34.133 34.133 0 1 1-52.657 43.463c-38.775-47.013-98.759-75.639-181.999-85.288-123.654-14.381-211.627 36.591-211.627 117.009 0 35.135 10.65 61.349 37.774 90.203l5.826 6.007c4.278 4.369 8.966 8.875 11.377 10.923l1.411 0.91H288.085l-1.092-1.729c-6.508-9.376-38.958-54.386-36.182-106.314z"})],-1)])],10,sm)])]),t.createElementVNode("div",cm,[t.createElementVNode("label",dm,t.toDisplayString(t.unref(g)(e.locale,"cfAppliedTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":D[12]||(D[12]=W=>c.rangeText=W),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.rangeText]])]),p.value?(t.openBlock(),t.createElementBlock("div",um,t.toDisplayString(p.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",fm,[t.createElementVNode("label",mm,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:c.stopIfTrue,onChange:D[13]||(D[13]=W=>c.stopIfTrue=W.target.checked)},null,40,pm),D[21]||(D[21]=t.createElementVNode("span",{class:"cf-chk__box"},[t.createElementVNode("svg",{class:"cf-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(g)(e.locale,"cfStopIfTrue")),1)]),t.createElementVNode("label",hm,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:c.enabled,onChange:D[14]||(D[14]=W=>c.enabled=W.target.checked)},null,40,gm),D[22]||(D[22]=t.createElementVNode("span",{class:"cf-chk__box"},[t.createElementVNode("svg",{class:"cf-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(g)(e.locale,"cfEnabled")),1)])])]),t.createElementVNode("div",bm,[t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary",onClick:K},t.toDisplayString(t.unref(g)(e.locale,"ok")),1),t.createElementVNode("button",{type:"button",class:"cf-btn",onClick:it},t.toDisplayString(t.unref(g)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-f625bb44"]]),Cm={class:"dv-editor__header"},wm={class:"dv-editor__title"},vm={class:"dv-editor__body"},km={class:"dv-sec"},Em={class:"dv-sec__title"},Rm={class:"dv-row"},Sm={class:"dv-label"},Mm={class:"dv-row"},Bm={class:"dv-label"},Nm={class:"dv-hint"},xm={class:"dv-row dv-row--inline"},Tm={class:"dv-chk"},Vm=["checked"],Dm={class:"dv-row"},Fm={class:"dv-label"},Om={class:"dv-hint"},Im={class:"dv-row"},Am={class:"dv-label"},Lm={key:0,class:"dv-row"},zm={class:"dv-label"},$m={class:"dv-row"},_m={class:"dv-label"},Hm={class:"dv-row"},Wm={class:"dv-label"},Um={class:"dv-row dv-row--inline"},Pm=["checked","disabled"],Gm=["checked","disabled"],Km={class:"dv-sec"},qm={class:"dv-sec__title"},Ym={class:"dv-row dv-row--inline"},Xm={class:"dv-chk"},jm=["checked"],Zm={class:"dv-row"},Jm={class:"dv-label"},Qm=["disabled"],e0={class:"dv-row dv-row--top"},t0={class:"dv-label"},l0=["disabled"],n0={class:"dv-sec"},o0={class:"dv-sec__title"},r0={class:"dv-row dv-row--inline"},a0={class:"dv-chk"},i0=["checked"],s0={class:"dv-row"},c0={class:"dv-label"},d0={class:"dv-row"},u0={class:"dv-label"},f0=["disabled"],m0={class:"dv-row dv-row--top"},p0={class:"dv-label"},h0=["disabled"],g0={class:"dv-sec"},b0={class:"dv-row"},y0={class:"dv-label"},C0={key:0,class:"dv-error"},w0={class:"dv-editor__footer"},xo="\\$?[A-Za-z]+\\$?\\d+",v0=It(t.defineComponent({__name:"data-validation-dialog",props:{locale:{},mode:{},rule:{default:null},defaultRangeText:{default:""},themeVars:{default:()=>({})}},emits:["save","cancel","clear"],setup(e,{emit:o}){const l=e,n=o,a=[{label:"dvTypeAny",value:"any"},{label:"dvTypeList",value:"list"},{label:"dvTypeWholeNumber",value:"wholeNumber"},{label:"dvTypeDecimal",value:"decimal"},{label:"dvTypeDate",value:"date"},{label:"dvTypeTime",value:"time"},{label:"dvTypeTextLength",value:"textLength"},{label:"dvTypeCustom",value:"custom"}],i=[{label:"dvBetween",value:"between"},{label:"dvNotBetween",value:"notBetween"},{label:"dvEqual",value:"equal"},{label:"dvNotEqual",value:"notEqual"},{label:"dvGreaterThan",value:"greaterThan"},{label:"dvGreaterThanOrEqual",value:"greaterThanOrEqual"},{label:"dvLessThan",value:"lessThan"},{label:"dvLessThanOrEqual",value:"lessThanOrEqual"}],r=[{label:"dvStyleStop",value:"stop"},{label:"dvStyleWarning",value:"warning"},{label:"dvStyleInformation",value:"information"}];function c(I){const D=pt(I.startCol)+(I.startRow+1);return I.startCol===I.endCol&&I.startRow===I.endRow?D:D+":"+pt(I.endCol)+(I.endRow+1)}function u(I){const D=I==null?void 0:I.listSource;if((D==null?void 0:D.type)==="range"){const we=c(D.range);return D.sheetId?`${D.sheetId}!${we}`:we}return((D==null?void 0:D.type)==="values"?D.values:(I==null?void 0:I.values)??[]).join(",")}function b(){const I=l.rule;return{type:(I==null?void 0:I.type)??"any",operator:(I==null?void 0:I.operator)??"between",formula1:(I==null?void 0:I.formula1)??"",formula2:(I==null?void 0:I.formula2)??"",source:u(I),allowBlank:(I==null?void 0:I.allowBlank)!==!1,showDropdown:(I==null?void 0:I.showDropdown)!==!1,showInputMessage:(I==null?void 0:I.showInputMessage)===!0,inputTitle:(I==null?void 0:I.inputTitle)??"",inputMessage:(I==null?void 0:I.inputMessage)??"",showErrorMessage:(I==null?void 0:I.showErrorMessage)!==!1,errorStyle:(I==null?void 0:I.errorStyle)??"stop",errorTitle:(I==null?void 0:I.errorTitle)??"",errorMessage:(I==null?void 0:I.errorMessage)??"",rangeText:I&&I.ranges.length?I.ranges.map(c).join(", "):l.defaultRangeText,enabled:(I==null?void 0:I.enabled)!==!1}}const h=t.reactive(b()),C=t.ref(""),p=t.computed(()=>h.type==="list"),x=t.computed(()=>h.type==="custom"),R=t.computed(()=>["wholeNumber","decimal","date","time","textLength"].includes(h.type)),O=t.computed(()=>R.value&&(h.operator==="between"||h.operator==="notBetween")),X=t.computed(()=>h.type==="any"),j=t.computed(()=>a.map(I=>({value:I.value,label:g(l.locale,I.label)}))),Ee=t.computed(()=>i.map(I=>({value:I.value,label:g(l.locale,I.label)}))),ae=t.computed(()=>r.map(I=>({value:I.value,label:g(l.locale,I.label)})));function ge(I){const D=I.split(",").map(we=>we.trim()).filter(Boolean),W=[];for(const we of D){if(!we.match(/^\$?[A-Za-z]+\$?\d+(?::\$?[A-Za-z]+\$?\d+)?$/))return null;const Z=hl(we.split(":")[0],99999,99999),Le=we.split(":")[1],ie=Le?hl(Le,99999,99999):Z;if(!Z||!ie)return null;W.push({startCol:Math.min(Z.col,ie.col),endCol:Math.max(Z.col,ie.col),startRow:Math.min(Z.row,ie.row),endRow:Math.max(Z.row,ie.row)})}return W.length?W:null}function me(I){const D=I.trim();if(!D)return null;const W=new RegExp(`^(?:'([^']+)'|([^!'"]+))!(${xo})(?::(${xo}))?$`).exec(D);if(W){const Z=(W[1]??W[2]??"").trim(),Le=hl(W[3],99999,99999),ie=W[4]?hl(W[4],99999,99999):Le;return!Z||!Le||!ie?null:{type:"range",sheetId:Z,range:{startCol:Math.min(Le.col,ie.col),endCol:Math.max(Le.col,ie.col),startRow:Math.min(Le.row,ie.row),endRow:Math.max(Le.row,ie.row)}}}const we=new RegExp(`^(${xo})(?::(${xo}))?$`).exec(D);if(we){const Z=hl(we[1],99999,99999),Le=we[2]?hl(we[2],99999,99999):Z;return!Z||!Le?null:{type:"range",range:{startCol:Math.min(Z.col,Le.col),endCol:Math.max(Z.col,Le.col),startRow:Math.min(Z.row,Le.row),endRow:Math.max(Z.row,Le.row)}}}const $e=D.split(",").map(Z=>Z.trim());return $e.some(Z=>Z!=="")?{type:"values",values:$e}:null}const pe=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function se(I,D){const W=D.trim();if(W==="")return g(l.locale,"dvValueRequired");if(W.startsWith("="))return null;const we=l.locale;switch(I){case"wholeNumber":case"textLength":{const $e=vo(W,we);return $e&&Number.isFinite($e.num)&&Number.isInteger($e.num)||pe.test(W)&&Number.isInteger(Number(W))?null:g(we,"dvMustBeInteger")}case"decimal":{const $e=vo(W,we);return $e&&Number.isFinite($e.num)||pe.test(W)&&Number.isFinite(Number(W))?null:g(we,"dvMustBeNumber")}case"date":{const $e=ql(W,we);return $e&&$e.format!=="h:mm:ss"?null:g(we,"dvDateInvalid")}case"time":return ql(W,we)?null:g(we,"dvTimeInvalid");default:return null}}function Ve(){if(C.value="",!ge(h.rangeText))return C.value=g(l.locale,"dvRangeInvalid"),!1;if(h.type==="any")return!0;if(p.value)return me(h.source)?!0:(C.value=g(l.locale,"dvSourceInvalid"),!1);if(x.value)return h.formula1.trim()?!0:(C.value=g(l.locale,"dvFormulaRequired"),!1);if(O.value){if(!h.formula1.trim())return C.value=g(l.locale,"dvMinRequired"),!1;if(!h.formula2.trim())return C.value=g(l.locale,"dvMaxRequired"),!1;const D=se(h.type,h.formula1);if(D)return C.value=`${g(l.locale,"dvMin")}:${D}`,!1;const W=se(h.type,h.formula2);return W?(C.value=`${g(l.locale,"dvMax")}:${W}`,!1):!0}if(!h.formula1.trim())return C.value=g(l.locale,"dvValueRequired"),!1;const I=se(h.type,h.formula1);return I?(C.value=`${g(l.locale,"dvValue")}:${I}`,!1):!0}function tt(){var W,we;if(!Ve())return;const I=ge(h.rangeText);if(h.type==="any"){n("save",{id:((W=l.rule)==null?void 0:W.id)??"",type:"any",ranges:I,allowBlank:h.allowBlank,enabled:!0});return}const D={id:((we=l.rule)==null?void 0:we.id)??"",type:h.type,ranges:I,allowBlank:h.allowBlank,enabled:h.enabled,showInputMessage:h.showInputMessage,inputTitle:h.inputTitle||void 0,inputMessage:h.inputMessage||void 0,showErrorMessage:h.showErrorMessage,errorStyle:h.errorStyle,errorTitle:h.errorTitle||void 0,errorMessage:h.errorMessage||void 0};if(p.value){const $e=me(h.source);D.listSource=$e,D.values=$e.type==="values"?$e.values:void 0,D.showDropdown=h.showDropdown}else x.value?D.formula1=h.formula1.trim():(D.operator=h.operator,D.formula1=h.formula1.trim(),D.formula2=O.value?h.formula2.trim():void 0);n("save",D)}function Qe(I){h.type=I}function K(I){h.operator=String(I)}function it(I){h.errorStyle=String(I)}return(I,D)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Cm,[t.createElementVNode("span",wm,t.toDisplayString(t.unref(g)(e.locale,"dvDialogTitle")),1),t.createElementVNode("button",{type:"button",class:"dv-editor__close",onClick:D[0]||(D[0]=W=>n("cancel"))}," × ")]),t.createElementVNode("div",vm,[t.createElementVNode("div",km,[t.createElementVNode("div",Em,t.toDisplayString(t.unref(g)(e.locale,"dvSettings")),1),t.createElementVNode("div",Rm,[t.createElementVNode("label",Sm,t.toDisplayString(t.unref(g)(e.locale,"dvAllow")),1),t.createVNode(Yt,{class:"dv-dropdown","model-value":h.type,options:j.value,width:"100%","visible-count":8,title:t.unref(g)(e.locale,"dvAllow"),align:"right",onChange:Qe},null,8,["model-value","options","title"])]),p.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",Mm,[t.createElementVNode("label",Bm,t.toDisplayString(t.unref(g)(e.locale,"dvSource")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":D[1]||(D[1]=W=>h.source=W),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.source]])]),t.createElementVNode("p",Nm,t.toDisplayString(t.unref(g)(e.locale,"dvSourceHint")),1),t.createElementVNode("div",xm,[t.createElementVNode("label",Tm,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.showDropdown,onChange:D[2]||(D[2]=W=>h.showDropdown=W.target.checked)},null,40,Vm),D[18]||(D[18]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(g)(e.locale,"dvShowDropdown")),1)])])],64)):x.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",Dm,[t.createElementVNode("label",Fm,t.toDisplayString(t.unref(g)(e.locale,"dvFormula")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":D[3]||(D[3]=W=>h.formula1=W),class:"dv-input",type:"text",spellcheck:"false",placeholder:"=AND(A1>=0,A1<=100)"},null,512),[[t.vModelText,h.formula1]])]),t.createElementVNode("p",Om,t.toDisplayString(t.unref(g)(e.locale,"cfFormulaExample")),1)],64)):R.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",Im,[t.createElementVNode("label",Am,t.toDisplayString(t.unref(g)(e.locale,"dvData")),1),t.createVNode(Yt,{class:"dv-dropdown","model-value":h.operator,options:Ee.value,width:"100%","visible-count":9,title:t.unref(g)(e.locale,"dvOperator"),align:"right",onChange:K},null,8,["model-value","options","title"])]),O.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",$m,[t.createElementVNode("label",_m,t.toDisplayString(t.unref(g)(e.locale,"dvMin")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":D[5]||(D[5]=W=>h.formula1=W),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.formula1]])]),t.createElementVNode("div",Hm,[t.createElementVNode("label",Wm,t.toDisplayString(t.unref(g)(e.locale,"dvMax")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":D[6]||(D[6]=W=>h.formula2=W),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.formula2]])])],64)):(t.openBlock(),t.createElementBlock("div",Lm,[t.createElementVNode("label",zm,t.toDisplayString(t.unref(g)(e.locale,"dvValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":D[4]||(D[4]=W=>h.formula1=W),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.formula1]])]))],64)):t.createCommentVNode("",!0),t.createElementVNode("div",Um,[t.createElementVNode("label",{class:t.normalizeClass(["dv-chk",{"dv-chk--disabled":X.value}])},[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.allowBlank,disabled:X.value,onChange:D[7]||(D[7]=W=>h.allowBlank=W.target.checked)},null,40,Pm),D[19]||(D[19]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(g)(e.locale,"dvIgnoreBlank")),1)],2),t.createElementVNode("label",{class:t.normalizeClass(["dv-chk",{"dv-chk--disabled":X.value}])},[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.enabled,disabled:X.value,onChange:D[8]||(D[8]=W=>h.enabled=W.target.checked)},null,40,Gm),D[20]||(D[20]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(g)(e.locale,"cfEnabled")),1)],2)])]),t.createElementVNode("div",Km,[t.createElementVNode("div",qm,t.toDisplayString(t.unref(g)(e.locale,"dvInputMessageTab")),1),t.createElementVNode("div",Ym,[t.createElementVNode("label",Xm,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.showInputMessage,onChange:D[9]||(D[9]=W=>h.showInputMessage=W.target.checked)},null,40,jm),D[21]||(D[21]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(g)(e.locale,"dvShowInputMessage")),1)])]),t.createElementVNode("div",Zm,[t.createElementVNode("label",Jm,t.toDisplayString(t.unref(g)(e.locale,"dvInputTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":D[10]||(D[10]=W=>h.inputTitle=W),class:"dv-input",type:"text",disabled:!h.showInputMessage},null,8,Qm),[[t.vModelText,h.inputTitle]])]),t.createElementVNode("div",e0,[t.createElementVNode("label",t0,t.toDisplayString(t.unref(g)(e.locale,"dvInputMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":D[11]||(D[11]=W=>h.inputMessage=W),class:"dv-input dv-input--area",rows:"2",disabled:!h.showInputMessage},null,8,l0),[[t.vModelText,h.inputMessage]])])]),t.createElementVNode("div",n0,[t.createElementVNode("div",o0,t.toDisplayString(t.unref(g)(e.locale,"dvErrorAlertTab")),1),t.createElementVNode("div",r0,[t.createElementVNode("label",a0,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.showErrorMessage,onChange:D[12]||(D[12]=W=>h.showErrorMessage=W.target.checked)},null,40,i0),D[22]||(D[22]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(g)(e.locale,"dvShowErrorAlert")),1)])]),t.createElementVNode("div",s0,[t.createElementVNode("label",c0,t.toDisplayString(t.unref(g)(e.locale,"dvErrorStyle")),1),t.createVNode(Yt,{class:"dv-dropdown","model-value":h.errorStyle,options:ae.value,width:"100%","visible-count":4,title:t.unref(g)(e.locale,"dvErrorStyle"),align:"right",onChange:it},null,8,["model-value","options","title"])]),t.createElementVNode("div",d0,[t.createElementVNode("label",u0,t.toDisplayString(t.unref(g)(e.locale,"dvErrorTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":D[13]||(D[13]=W=>h.errorTitle=W),class:"dv-input",type:"text",disabled:!h.showErrorMessage},null,8,f0),[[t.vModelText,h.errorTitle]])]),t.createElementVNode("div",m0,[t.createElementVNode("label",p0,t.toDisplayString(t.unref(g)(e.locale,"dvErrorMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":D[14]||(D[14]=W=>h.errorMessage=W),class:"dv-input dv-input--area",rows:"2",disabled:!h.showErrorMessage},null,8,h0),[[t.vModelText,h.errorMessage]])])]),t.createElementVNode("div",g0,[t.createElementVNode("div",b0,[t.createElementVNode("label",y0,t.toDisplayString(t.unref(g)(e.locale,"dvApplyTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":D[15]||(D[15]=W=>h.rangeText=W),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.rangeText]])])]),C.value?(t.openBlock(),t.createElementBlock("div",C0,t.toDisplayString(C.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",w0,[t.createElementVNode("button",{type:"button",class:"dv-btn dv-btn--danger",onClick:D[16]||(D[16]=W=>n("clear"))},t.toDisplayString(t.unref(g)(e.locale,"dvClearAll")),1),D[23]||(D[23]=t.createElementVNode("span",{class:"dv-editor__spacer"},null,-1)),t.createElementVNode("button",{type:"button",class:"dv-btn dv-btn--primary",onClick:tt},t.toDisplayString(t.unref(g)(e.locale,"ok")),1),t.createElementVNode("button",{type:"button",class:"dv-btn",onClick:D[17]||(D[17]=W=>n("cancel"))},t.toDisplayString(t.unref(g)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-dc3b8000"]]),k0={key:0,class:"dvd__search"},E0=["placeholder"],R0=["onMouseenter","onClick"],S0={class:"dvd__check"},M0={class:"dvd__label"},B0={key:1,class:"dvd__empty"},Tl=24,N0=244,x0=140,T0=It(t.defineComponent({__name:"data-validation-dropdown",props:{items:{default:()=>[]},current:{default:""},locale:{default:"zh-CN"},x:{default:0},y:{default:0},width:{default:100},height:{default:24},boundaryEl:{}},emits:["select","close"],setup(e,{emit:o}){const l=e,n=o,a=t.ref(""),i=t.ref(0),r=t.ref(0),c=t.ref(null),u=t.ref(null),b=t.ref(null),h=t.ref({left:l.x,top:l.y+l.height+2,up:!1}),C=t.computed(()=>{const I=a.value.trim().toLowerCase();return I?l.items.filter(D=>String(D??"").toLowerCase().includes(I)):l.items}),p=t.computed(()=>Math.min(N0,Math.max(Tl,C.value.length*Tl))),x=t.computed(()=>Math.max(x0,Math.min(360,l.width))),R=t.computed(()=>Math.max(0,Math.floor(r.value/Tl)-1)),O=t.computed(()=>Math.min(C.value.length,Math.ceil((r.value+p.value)/Tl)+1)),X=t.computed(()=>C.value.slice(R.value,O.value)),j=t.computed(()=>R.value*Tl),Ee=t.computed(()=>Math.max(0,(C.value.length-O.value)*Tl));function ae(I){return String(I??"").trim().toLowerCase()===String(l.current??"").trim().toLowerCase()}function ge(){const I=p.value+me(),D=Gl(l.boundaryEl),W=D.bottom-(l.y+l.height)-8,we=l.y-D.top-8,$e=W<I&&we>W;let Z=$e?l.y-I-2:l.y+l.height+2;Z=Math.max(D.top+8,Math.min(D.bottom-I-8,Z));const Le=Math.max(D.left+8,Math.min(D.right-x.value-8,l.x));h.value={left:Le,top:Z,up:$e}}function me(){return C.value.length>8||a.value?34:0}t.watch(()=>[l.x,l.y,l.width,l.height],()=>ge()),t.onMounted(()=>{t.nextTick(()=>{var I;ge(),c.value?c.value.focus():(I=b.value)==null||I.focus()}),document.addEventListener("pointerdown",pe,!0),window.addEventListener("resize",se),window.addEventListener("scroll",se,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",pe,!0),window.removeEventListener("resize",se),window.removeEventListener("scroll",se,!0)});function pe(I){var D;(D=b.value)!=null&&D.contains(I.target)||se()}function se(){n("close")}function Ve(I){const D=u.value;if(!D)return;const W=I*Tl,we=W+Tl;W<D.scrollTop?D.scrollTop=W:we>D.scrollTop+p.value&&(D.scrollTop=we-p.value)}function tt(I){const D=C.value.length;D!==0&&(i.value=(i.value+I+D)%D,Ve(i.value))}function Qe(I){const D=C.value[I];D!==void 0&&n("select",D)}function K(I){r.value=I.target.scrollTop}function it(I){switch(I.key){case"ArrowDown":I.preventDefault(),I.stopPropagation(),tt(1);return;case"ArrowUp":I.preventDefault(),I.stopPropagation(),tt(-1);return;case"Home":I.preventDefault(),I.stopPropagation(),i.value=0,r.value=0,u.value&&(u.value.scrollTop=0);return;case"End":{I.preventDefault(),I.stopPropagation();const D=C.value.length;i.value=Math.max(0,D-1),Ve(i.value);return}case"PageDown":I.preventDefault(),I.stopPropagation(),tt(Math.max(1,Math.floor(p.value/Tl)));return;case"PageUp":I.preventDefault(),I.stopPropagation(),tt(-Math.max(1,Math.floor(p.value/Tl)));return;case"Enter":I.preventDefault(),I.stopPropagation(),Qe(i.value);return;case"Escape":I.preventDefault(),I.stopPropagation(),se();return;case"Tab":I.preventDefault(),I.stopPropagation(),Qe(i.value);return}}return t.watch(a,()=>{i.value=0,r.value=0,u.value&&(u.value.scrollTop=0),t.nextTick(ge)}),t.watch(C,I=>{const D=I.findIndex(W=>ae(W));D>=0&&(i.value=D,t.nextTick(()=>Ve(D)))},{immediate:!0}),(I,D)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:b,class:"dvd",tabindex:"-1",style:t.normalizeStyle({left:h.value.left+"px",top:h.value.top+"px",width:x.value+"px"}),onKeydown:it,onWheel:D[2]||(D[2]=t.withModifiers(()=>{},["stop"]))},[me()>0?(t.openBlock(),t.createElementBlock("div",k0,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchRef",ref:c,"onUpdate:modelValue":D[0]||(D[0]=W=>a.value=W),class:"dvd__search-input",type:"text",spellcheck:"false",placeholder:t.unref(g)(e.locale,"dvSearchPlaceholder"),onKeydown:it},null,40,E0),[[t.vModelText,a.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:u,class:"dvd__list",style:t.normalizeStyle({height:p.value+"px"}),onScroll:K},[t.createElementVNode("div",{style:t.normalizeStyle({height:j.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(X.value,(W,we)=>(t.openBlock(),t.createElementBlock("div",{key:R.value+we,class:t.normalizeClass(["dvd__item",{"dvd__item--active":R.value+we===i.value,"dvd__item--checked":ae(W)}]),style:t.normalizeStyle({height:Tl+"px",lineHeight:Tl+"px"}),onMousedown:D[1]||(D[1]=t.withModifiers(()=>{},["prevent"])),onMouseenter:$e=>i.value=R.value+we,onClick:$e=>Qe(R.value+we)},[t.createElementVNode("span",S0,t.toDisplayString(ae(W)?"✓":""),1),t.createElementVNode("span",M0,t.toDisplayString(W===""?"(空)":W),1)],46,R0))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:Ee.value+"px"})},null,4)],36),C.value.length===0?(t.openBlock(),t.createElementBlock("div",B0,t.toDisplayString(t.unref(g)(e.locale,"dvNoMatch")),1)):t.createCommentVNode("",!0)],36))}}),[["__scopeId","data-v-fc845e0b"]]),V0={class:"dv-alert__header"},D0={class:"dv-alert__title"},F0={class:"dv-alert__body"},O0=["d"],I0={class:"dv-alert__text"},A0={key:0,class:"dv-alert__subtitle"},L0={class:"dv-alert__message"},z0={class:"dv-alert__footer"},aa=It(t.defineComponent({__name:"data-validation-alert",props:{locale:{},severity:{},title:{default:""},message:{default:""},themeVars:{default:()=>({})}},emits:["resolve"],setup(e,{emit:o}){const l=e,n=o,a={stop:{color:"#d93025",path:"M512 64a448 448 0 1 0 0 896 448 448 0 0 0 0-896zm0 96a352 352 0 1 1 0 704 352 352 0 0 1 0-704zm-160 224h320a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64z"},warning:{color:"#f4b400",path:"M512 96l416 736H96L512 96zm0 128L192 768h640L512 224zm-32 128a32 32 0 0 1 32 32v160a32 32 0 0 1-64 0V384a32 32 0 0 1 32-32zm0 256a36 36 0 1 1 0 72 36 36 0 0 1 0-72z"},information:{color:"#1a73e8",path:"M512 64a448 448 0 1 0 0 896 448 448 0 0 0 0-896zm0 96a352 352 0 1 1 0 704 352 352 0 0 1 0-704zm-32 128a32 32 0 0 1 64 0v32a32 32 0 0 1-64 0V288zm32 128a36 36 0 1 1 0 72 36 36 0 0 1 0-72zm0 96a32 32 0 0 1 32 32v128a32 32 0 0 1-64 0V544a32 32 0 0 1 32-32z"}},i=t.computed(()=>a[l.severity]??a.stop),r=t.computed(()=>l.title?l.title:l.severity==="warning"?g(l.locale,"dvWarningDialogTitle"):l.severity==="information"?g(l.locale,"dvInformationDialogTitle"):g(l.locale,"dvStopDialogTitle")),c=t.computed(()=>l.severity==="stop"?g(l.locale,"dvBtnRetry"):l.severity==="warning"?g(l.locale,"dvBtnContinue"):g(l.locale,"dvBtnOk")),u=t.computed(()=>l.severity==="stop"?g(l.locale,"cancel"):l.severity==="warning"?g(l.locale,"dvBtnNo"):g(l.locale,"cancel"));function b(){n("resolve",l.severity==="stop"?"retry":"continue")}function h(){n("resolve","cancel")}return(C,p)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-alert",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",V0,[t.createElementVNode("span",D0,t.toDisplayString(r.value),1)]),t.createElementVNode("div",F0,[(t.openBlock(),t.createElementBlock("svg",{class:"dv-alert__icon",viewBox:"0 0 1024 1024",style:t.normalizeStyle({color:i.value.color})},[t.createElementVNode("path",{d:i.value.path,fill:"currentColor"},null,8,O0)],4)),t.createElementVNode("div",I0,[e.title?(t.openBlock(),t.createElementBlock("div",A0,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",L0,t.toDisplayString(e.message),1)])]),t.createElementVNode("div",z0,[p[2]||(p[2]=t.createElementVNode("span",{class:"dv-alert__spacer"},null,-1)),t.createElementVNode("button",{type:"button",class:"dv-alert__btn dv-alert__btn--primary",onMousedown:p[0]||(p[0]=t.withModifiers(()=>{},["prevent"])),onClick:b},t.toDisplayString(c.value),33),t.createElementVNode("button",{type:"button",class:"dv-alert__btn",onMousedown:p[1]||(p[1]=t.withModifiers(()=>{},["prevent"])),onClick:h},t.toDisplayString(u.value),33)])],4))}}),[["__scopeId","data-v-4edabad0"]]),$0={key:0,class:"dvim__title"},_0={class:"dvim__message"},H0=It(t.defineComponent({__name:"data-validation-input-message",props:{title:{default:""},message:{default:""},x:{default:0},y:{default:0},width:{default:100},height:{default:24}},setup(e){return(o,l)=>(t.openBlock(),t.createElementBlock("div",{class:"dvim",style:t.normalizeStyle({left:e.x+"px",top:e.y+e.height+4+"px",minWidth:Math.min(220,Math.max(e.width,140))+"px"})},[e.title?(t.openBlock(),t.createElementBlock("div",$0,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",_0,t.toDisplayString(e.message),1)],4))}}),[["__scopeId","data-v-15c54146"]]);function yn(e,o){return`${e},${o}`}function ia(e,o){if(e.startsWith("="))return{kind:"formula",formula:e};const l=ql(e,o);if(l)return{kind:"date",serial:l.serial};const n=/^(.*?)(\d+)$/.exec(e);if(n){const a=n[1],i=n[2];if(a!==""&&/^\d+$/.test(i))return{kind:"text-number",prefix:a,num:parseInt(i,10),digits:i.length}}return Al(e)?{kind:"number",num:parseFloat(e)}:{kind:"text",text:e}}function or(e,o){for(let l=2;l<e.length;l++)if(e[l]-e[l-1]!==o)return!1;return!0}function sa(e){const o=e.length;if(o===0)return{kind:"copy",sourceValues:[]};if(e.some(l=>l.kind==="formula"))return{kind:"formula"};if(e.every(l=>l.kind==="date")){const l=e[0],n=o>=2?e[1].serial-l.serial:1;return{kind:"date-linear",baseSerial:l.serial,step:n,sourceLen:o}}if(e.every(l=>l.kind==="number")){if(o===1)return{kind:"copy",sourceValues:[...e]};const l=e.map(a=>a.num),n=l[1]-l[0];return or(l,n)?{kind:"linear",step:n,base:l[0],sourceLen:o}:{kind:"copy",sourceValues:[...e]}}if(e.every(l=>l.kind==="text-number")){const l=e[0];if(e.every(a=>a.kind==="text-number"&&a.prefix===l.prefix)){if(o===1)return{kind:"copy",sourceValues:[...e]};const a=e.map(r=>r.num),i=a[1]-a[0];if(or(a,i))return{kind:"text-number",prefix:l.prefix,step:i,base:l.num,digits:l.digits,sourceLen:o}}return{kind:"copy",sourceValues:[...e]}}if(e.every(l=>l.kind==="text")){const l=e.every(n=>n.text.length===1&&/[a-zA-Z]/.test(n.text));if(o>=2&&l){const n=e.map(i=>i.text.charCodeAt(0)),a=n[1]-n[0];if(a!==0&&or(n,a))return{kind:"text-series",step:a,baseCharCode:n[0],sourceLen:o}}return{kind:"copy",sourceValues:[...e]}}return{kind:"copy",sourceValues:[...e]}}function ca(e,o,l){switch(e.kind){case"copy":{const n=e.sourceValues.length;return n===0?{kind:"text",text:""}:e.sourceValues[o%n]}case"linear":return{kind:"number",num:e.base+e.step*(l+o)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base+e.step*(l+o),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial+e.step*(l+o)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode+e.step*(l+o))};case"formula":return{kind:"formula",formula:""}}}function da(e,o){switch(e.kind){case"copy":{const l=e.sourceValues.length;return l===0?{kind:"text",text:""}:e.sourceValues[l-1-o%l]}case"linear":return{kind:"number",num:e.base-e.step*(o+1)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base-e.step*(o+1),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial-e.step*(o+1)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode-e.step*(o+1))};case"formula":return{kind:"formula",formula:""}}}function To(e,o){switch(e.kind){case"formula":return{value:e.formula,styleId:o};case"number":return{value:String(e.num),styleId:o};case"text":return{value:e.text,styleId:o};case"text-number":return{value:e.prefix+String(e.num).padStart(e.digits,"0"),styleId:o};case"date":return{value:String(e.serial),styleId:o}}}function ua(e,o){const l=o.row<e.startRow?e.startRow-o.row:o.row>e.endRow?o.row-e.endRow:0,n=o.col<e.startCol?e.startCol-o.col:o.col>e.endCol?o.col-e.endCol:0;if(l===0&&n===0)return null;const a=l>=n?o.row<e.startRow?"up":"down":o.col<e.startCol?"left":"right";let i;switch(a){case"down":i={startCol:e.startCol,startRow:e.endRow+1,endCol:e.endCol,endRow:o.row};break;case"up":i={startCol:e.startCol,startRow:o.row,endCol:e.endCol,endRow:e.startRow-1};break;case"right":i={startCol:e.endCol+1,startRow:e.startRow,endCol:o.col,endRow:e.endRow};break;case"left":i={startCol:o.col,startRow:e.startRow,endCol:e.startCol-1,endRow:e.endRow};break}return{targetRange:i,direction:a}}function fa(e,o,l,n,a,i){return Mo(e,l.col-o.col,l.row-o.row,n,a,i)}function ma(e,o){return!(e.endCol<o.startCol||e.startCol>o.endCol||e.endRow<o.startRow||e.startRow>o.endRow)}function pa(e,o){return o.startCol>=e.startCol&&o.endCol<=e.endCol&&o.startRow>=e.startRow&&o.endRow<=e.endRow}function rr(e,o,l){const n=Object.keys(l);for(const c of n){const u=l[c];if(ma(e,u)&&!pa(e,u))return{ok:!1,reason:"source-overlap"}}const a=[];for(const c of n){const u=l[c];pa(e,u)||ma(o,u)&&a.push(u)}if(a.length===0)return{ok:!0,reason:"ok"};const i=a[0].endRow-a[0].startRow,r=a[0].endCol-a[0].startCol;for(const c of a)if(c.endRow-c.startRow!==i||c.endCol-c.startCol!==r)return{ok:!1,reason:"target-merge-size"};return{ok:!0,reason:"ok"}}function ha(e,o,l,n){const a=o.length;if(a!==0){if(e.kind==="copy"){const i=n?a-1-l%a:l%a;return o[i]}return n?o[0]:o[a-1]}}function ga(e,o,l,n,a,i,r,c){const u={cells:{},merges:{}},b=n==="up"||n==="down",h=n==="up"||n==="left";if(b){const C=e.endRow-e.startRow+1;for(let p=e.startCol;p<=e.endCol;p++){const x=[],R=[];for(let j=e.startRow;j<=e.endRow;j++){const Ee=l.cells[yn(p,j)];x.push(Ee?ia(Ee.value,a):{kind:"text",text:""}),R.push(Ee==null?void 0:Ee.styleId)}const O=sa(x),X=x.length;for(let j=o.startRow;j<=o.endRow;j++){const Ee=h?o.endRow-j:j-o.startRow;if(O.kind==="formula"){const ae=h?e.endRow-((o.endRow-j)%C+C)%C:e.startRow+((j-e.startRow)%C+C)%C,ge=l.cells[yn(p,ae)],me=ge?ge.value:"",pe=fa(me,{col:p,row:ae},{col:p,row:j},i,r,c);u.cells[yn(p,j)]=To({kind:"formula",formula:pe},ge==null?void 0:ge.styleId)}else{const ae=h?da(O,Ee):ca(O,Ee,X),ge=ha(O,R,Ee,h);u.cells[yn(p,j)]=To(ae,ge)}}}}else{const C=e.endCol-e.startCol+1;for(let p=e.startRow;p<=e.endRow;p++){const x=[],R=[];for(let j=e.startCol;j<=e.endCol;j++){const Ee=l.cells[yn(j,p)];x.push(Ee?ia(Ee.value,a):{kind:"text",text:""}),R.push(Ee==null?void 0:Ee.styleId)}const O=sa(x),X=x.length;for(let j=o.startCol;j<=o.endCol;j++){const Ee=h?o.endCol-j:j-o.startCol;if(O.kind==="formula"){const ae=h?e.endCol-((o.endCol-j)%C+C)%C:e.startCol+((j-e.startCol)%C+C)%C,ge=l.cells[yn(ae,p)],me=ge?ge.value:"",pe=fa(me,{col:ae,row:p},{col:j,row:p},i,r,c);u.cells[yn(j,p)]=To({kind:"formula",formula:pe},ge==null?void 0:ge.styleId)}else{const ae=h?da(O,Ee):ca(O,Ee,X),ge=ha(O,R,Ee,h);u.cells[yn(j,p)]=To(ae,ge)}}}}return u}function W0(e){let o=1/0,l=1/0;for(const n of e.ranges)n.startCol<o&&(o=n.startCol),n.startRow<l&&(l=n.startRow);return isFinite(o)||(o=0),isFinite(l)||(l=0),{col:o,row:l}}function U0(e,o,l){for(const n of e)if(o>=n.startCol&&o<=n.endCol&&l>=n.startRow&&l<=n.endRow)return!0;return!1}function Ll(e){if(e==null)return null;const o=String(e).trim();if(o==="")return null;const l=o.replace(/[, ]/g,"");if(l==="")return null;const n=Number(l);return Number.isFinite(n)?n:null}function P0(e,o){const l=new Map;for(const n of e.ranges)for(let a=n.startRow;a<=n.endRow;a++)for(let i=n.startCol;i<=n.endCol;i++){const r=o.getCellValue(i,a);r!==""&&l.set(r,(l.get(r)??0)+1)}return l}class G0{constructor(){this.map=new Map}get(o){return this.map.get(o)}set(o,l){this.map.set(o,l)}invalidate(o){o?this.map.delete(o):this.map.clear()}}function K0(e,o,l,n,a,i){switch(e.type){case"cellIs":{const r=n.getCellValue(o,l),c=Ll(r);switch(e.operator){case"equal":{const u=Ll(e.value);return c!==null&&u!==null?c===u:r===e.value}case"notEqual":{const u=Ll(e.value);return c!==null&&u!==null?c!==u:r!==e.value}case"greaterThan":{const u=Ll(e.value);return c===null||u===null?!1:c>u}case"greaterThanOrEqual":{const u=Ll(e.value);return c===null||u===null?!1:c>=u}case"lessThan":{const u=Ll(e.value);return c===null||u===null?!1:c<u}case"lessThanOrEqual":{const u=Ll(e.value);return c===null||u===null?!1:c<=u}case"between":{const u=Ll(e.value),b=Ll(e.value2??"");return c===null||u===null||b===null?!1:c>=Math.min(u,b)&&c<=Math.max(u,b)}case"notBetween":{const u=Ll(e.value),b=Ll(e.value2??"");return c===null||u===null||b===null?!1:c<Math.min(u,b)||c>Math.max(u,b)}}return!1}case"textContains":return n.getCellValue(o,l).toLowerCase().includes(e.value.toLowerCase());case"textNotContains":return!n.getCellValue(o,l).toLowerCase().includes(e.value.toLowerCase());case"blank":return n.getCellValue(o,l)==="";case"notBlank":return n.getCellValue(o,l)!=="";case"duplicate":{if(!i)return!1;const r=n.getCellValue(o,l);return r===""?!1:(i.get(r)??0)>1}case"unique":{if(!i)return!1;const r=n.getCellValue(o,l);return r===""?!1:(i.get(r)??0)===1}case"formula":try{const r=o-a.col,c=l-a.row,u=e.formula.trim().replace(/^=/,""),b=q0(u,r,c,n.colCount,n.rowCount);return na(b,n.cells,n.colCount,n.rowCount)}catch{return!1}case"colorScale":case"dataBar":case"iconSet":case"topBottom":case"aboveBelowAverage":return!1}return!1}function q0(e,o,l,n,a){return Mo(e,o,l,n,a,pt)}function Y0(e,o,l,n,a){if(!l||l.length===0)return null;const i=l.filter(u=>u.enabled&&U0(u.ranges,e,o)).sort((u,b)=>u.priority-b.priority);if(i.length===0)return null;const r={};let c=!1;for(const u of i){const b=W0(u);let h;(u.condition.type==="duplicate"||u.condition.type==="unique")&&(h=a==null?void 0:a.get(u.id),h||(h=P0(u,n),a==null||a.set(u.id,h)));let C=!1;try{C=K0(u.condition,e,o,n,b,h)}catch{}if(!C)continue;c=!0;const p=u.format;if(p.backgroundColor!==void 0&&r.backgroundColor===void 0&&(r.backgroundColor=p.backgroundColor),p.color!==void 0&&r.color===void 0&&(r.color=p.color),p.fontWeight!==void 0&&r.fontWeight===void 0&&(r.fontWeight=p.fontWeight),p.fontStyle!==void 0&&r.fontStyle===void 0&&(r.fontStyle=p.fontStyle),p.underline!==void 0&&r.underline===void 0&&(r.underline=p.underline),p.strikethrough!==void 0&&r.strikethrough===void 0&&(r.strikethrough=p.strikethrough),u.stopIfTrue)break}return c?r:null}function X0(){return"cf_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function ba(){return"dv_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function j0(e,o,l){for(const n of e)if(o>=n.startCol&&o<=n.endCol&&l>=n.startRow&&l<=n.endRow)return!0;return!1}function Z0(e){let o=1/0,l=1/0;for(const n of e.ranges)n.startCol<o&&(o=n.startCol),n.startRow<l&&(l=n.startRow);return isFinite(o)||(o=0),isFinite(l)||(l=0),{col:o,row:l}}function J0(e){return e==null?!0:typeof e=="number"?!1:(typeof e=="string"?e:String(e)).trim()===""}function Q0(e){return e?Array.from(e).length:0}const ya=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function ro(e,o){if(e==null)return null;const l=String(e).trim();if(l==="")return null;if(l.startsWith("=")){const a=ar(l.slice(1),o);return typeof a=="number"&&Number.isFinite(a)?a:a===null?null:Number(a)}const n=vo(l,o.locale);if(n&&Number.isFinite(n.num))return n.num;if(ya.test(l)){const a=Number(l);return Number.isFinite(a)?a:null}return null}function ar(e,o){try{return bn(),la(e,o.cells,o.colCount,o.rowCount)}catch{return null}}function ir(e,o){if(e==null)return null;const l=String(e).trim();if(l==="")return null;if(l.startsWith("=")){const a=ar(l.slice(1),o);return typeof a=="number"&&Number.isFinite(a)?a:typeof a=="string"?ir(a,o):null}if(Al(l)||ya.test(l)){const a=Number(l);return Number.isFinite(a)?a:null}const n=ql(l,o.locale);return n&&n.format!=="h:mm:ss"?n.serial:null}function sr(e,o){if(e==null)return null;const l=String(e).trim();if(l==="")return null;if(l.startsWith("=")){const a=ar(l.slice(1),o);return typeof a=="number"&&Number.isFinite(a)?cr(a):typeof a=="string"?sr(a,o):null}const n=ql(l,o.locale);return n?n.format==="h:mm:ss"?n.serial:cr(n.serial):Al(l)?cr(Number(l)):null}function cr(e){return Number.isFinite(e)?Math.abs(e)%1:0}function e1(e,o,l,n){switch(e){case"between":return l===null||n===null?!1:o>=Math.min(l,n)&&o<=Math.max(l,n);case"notBetween":return l===null||n===null?!1:o<Math.min(l,n)||o>Math.max(l,n);case"equal":return l!==null&&o===l;case"notEqual":return l!==null&&o!==l;case"greaterThan":return l!==null&&o>l;case"greaterThanOrEqual":return l!==null&&o>=l;case"lessThan":return l!==null&&o<l;case"lessThanOrEqual":return l!==null&&o<=l;default:return!1}}function dr(e){return String(e??"").trim().toLowerCase()}function Ca(e,o){var h;const l=e.listSource??(e.values?{type:"values",values:e.values}:void 0);if(!l)return[];const n=[],a=new Set,i=C=>{const p=dr(C);if(!p){if(e.allowBlank===!1||a.has("\0blank"))return;a.add("\0blank"),n.push("");return}a.has(p)||(a.add(p),n.push(C))};if(l.type==="values"){for(const C of l.values??[])i(C);return n}const{range:r,sheetId:c}=l,u=c?((h=o.getSheetCells)==null?void 0:h.call(o,c))??null:null,b=u??o.cells;for(let C=r.startRow;C<=r.endRow;C++)for(let p=r.startCol;p<=r.endCol;p++){const x=`${p},${C}`,R=b[x];if(R)if(u){const O=R.value;i(O.startsWith("=")?t1(O,u,o):O)}else i(o.getCellValue(p,C))}return n}function t1(e,o,l){try{bn();const n=la(e.slice(1),o,l.colCount,l.rowCount);return n===null?"":String(n)}catch{return""}}function l1(e){return!!e&&e.type==="list"&&e.showDropdown!==!1&&e.enabled!==!1}function n1(e,o,l){const n={value:l};return new Proxy(e,{get(a,i){return i===o?n:a[i]},has(a,i){return i===o?!0:i in a}})}function o1(e,o,l,n,a){if(e.enabled===!1)return!0;const i=o==null?"":String(o);if(J0(i))return e.allowBlank!==!1;try{switch(e.type){case"any":return!0;case"list":{const r=Ca(e,a),c=dr(i);return r.some(u=>dr(u)===c)}case"wholeNumber":{const r=ro(i,a);return r===null||!Number.isFinite(r)||!Number.isInteger(r)?!1:ao(e,r,a,ro)}case"decimal":{const r=ro(i,a);return r===null||!Number.isFinite(r)?!1:ao(e,r,a,ro)}case"date":{const r=ir(i,a);return r===null?!1:ao(e,r,a,ir)}case"time":{const r=sr(i,a);return r===null?!1:ao(e,r,a,sr)}case"textLength":{const r=Q0(i);return ao(e,r,a,ro)}case"custom":{const r=(e.formula1??"").trim().replace(/^=/,"");return r?r1(r,o,l,n,e,a):!0}default:return!0}}catch{return!1}}function ao(e,o,l,n){const a=e.operator;if(!a)return!0;const i=e.formula1!==void 0&&e.formula1!==""?n(e.formula1,l):null,r=e.formula2!==void 0&&e.formula2!==""?n(e.formula2,l):null;return e1(a,o,i,r)}function r1(e,o,l,n,a,i){try{const r=Z0(a),c=Mo(e,l-r.col,n-r.row,i.colCount,i.rowCount,pt),u=n1(i.cells,`${l},${n}`,o==null?"":String(o));return bn(),na(c,u,i.colCount,i.rowCount)}catch{return!1}}const a1={stop:3,warning:2,information:1};function ur(e){return e.errorStyle==="warning"||e.errorStyle==="information"?e.errorStyle:"stop"}function wa(e,o,l,n,a){if(!n||n.length===0)return{valid:!0};let i=null,r=0;for(const h of n){if(h.enabled===!1||!j0(h.ranges,o,l))continue;let C;try{C=o1(h,e,o,l,a)}catch{C=!1}if(C)continue;const p=a1[ur(h)];p>r&&(r=p,i=h)}if(!i)return{valid:!0};const c=ur(i),u=i.showErrorMessage!==!1,b=i1(i,a.locale);return{valid:!1,rule:i,severity:c,title:u&&i.errorTitle?i.errorTitle:b.title,message:u&&i.errorMessage?i.errorMessage:b.message}}function i1(e,o){var a;const l=g(o,"dvErrorTitleDefault"),n=e.operator?g(o,`dv${s1(e.operator)}`):"";switch(e.type){case"list":{const r=(((a=e.listSource)==null?void 0:a.type)==="values"?e.listSource.values??e.values??[]:e.values??[]).filter(Boolean).slice(0,6).join(", ");return{title:l,message:g(o,r?"dvMsgList":"dvMsgListEmpty").replace("{values}",r)}}case"wholeNumber":return{title:l,message:io(o,g(o,"dvTypeWholeNumber"),n,e)};case"decimal":return{title:l,message:io(o,g(o,"dvTypeDecimal"),n,e)};case"date":return{title:l,message:io(o,g(o,"dvTypeDate"),n,e)};case"time":return{title:l,message:io(o,g(o,"dvTypeTime"),n,e)};case"textLength":return{title:l,message:io(o,g(o,"dvTypeTextLength"),n,e)};case"custom":return{title:l,message:g(o,"dvMsgCustom").replace("{formula}",e.formula1??"")};default:return{title:l,message:g(o,"dvMsgInvalid")}}}function s1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function io(e,o,l,n){return l?n.operator==="between"||n.operator==="notBetween"?g(e,n.operator==="between"?"dvMsgBetween":"dvMsgNotBetween").replace("{type}",o).replace("{min}",n.formula1??"").replace("{max}",n.formula2??""):g(e,"dvMsgCompare").replace("{type}",o).replace("{op}",l).replace("{value}",n.formula1??""):g(e,"dvMsgInvalid")}const Vo=64;class c1{constructor(o=[]){this.bands=new Map,this.dirty=!0,this.source=[],this.source=o}invalidate(){this.dirty=!0}ensure(o){if(o&&o!==this.source&&(this.source=o,this.dirty=!0),!!this.dirty){this.bands.clear();for(const l of this.source)if(!(!l||l.enabled===!1))for(const n of l.ranges??[]){const a=Math.floor(n.startRow/Vo),i=Math.floor(n.endRow/Vo);for(let r=a;r<=i;r++){let c=this.bands.get(r);c||(c=[],this.bands.set(r,c)),c.push({rule:l,range:n})}}this.dirty=!1}}getRules(o,l,n){this.ensure(n);const a=this.bands.get(Math.floor(l/Vo));if(!a||a.length===0)return[];const i=[];for(const r of a)o<r.range.startCol||o>r.range.endCol||l<r.range.startRow||l>r.range.endRow||i.includes(r.rule)||i.push(r.rule);return i}has(o,l,n){const a=this.bandsOf(o,l,n);for(const i of a)if(!(o<i.range.startCol||o>i.range.endCol)&&!(l<i.range.startRow||l>i.range.endRow))return!0;return!1}findRule(o,l,n,a){for(const i of this.bandsOf(o,l,a))if(!(o<i.range.startCol||o>i.range.endCol)&&!(l<i.range.startRow||l>i.range.endRow)&&n(i.rule))return i.rule;return null}bandsOf(o,l,n){return this.ensure(n),this.bands.get(Math.floor(l/Vo))??d1}}const d1=[];function u1(e,o,l,n){if(o==="row"){const u=e.startRow,b=e.endRow;let h,C;if(b<l)h=u,C=b;else if(u>l+n-1)h=u-n,C=b-n;else if(h=u<l?u:l,C=b>l+n-1?b-n:l-1,C<h)return null;return{...e,startRow:h,endRow:C}}const a=e.startCol,i=e.endCol;let r,c;if(i<l)r=a,c=i;else if(a>l+n-1)r=a-n,c=i-n;else if(r=a<l?a:l,c=i>l+n-1?i-n:l-1,c<r)return null;return{...e,startCol:r,endCol:c}}function f1(e,o,l,n){if(o==="row"){const r=e.startRow,c=e.endRow;return r>=l?{...e,startRow:r+n,endRow:c+n}:c<l?e:{...e,endRow:c+n}}const a=e.startCol,i=e.endCol;return a>=l?{...e,startCol:a+n,endCol:i+n}:i<l?e:{...e,endCol:i+n}}function va(e,o){return!(e.endCol<o.startCol||e.startCol>o.endCol||e.endRow<o.startRow||e.startRow>o.endRow)}function ka(e,o){if(!va(e,o))return[{...e}];const l=[];e.startRow<o.startRow&&l.push({startCol:e.startCol,endCol:e.endCol,startRow:e.startRow,endRow:o.startRow-1}),e.endRow>o.endRow&&l.push({startCol:e.startCol,endCol:e.endCol,startRow:o.endRow+1,endRow:e.endRow});const n=Math.max(e.startRow,o.startRow),a=Math.min(e.endRow,o.endRow);return n<=a&&(e.startCol<o.startCol&&l.push({startCol:e.startCol,endCol:o.startCol-1,startRow:n,endRow:a}),e.endCol>o.endCol&&l.push({startCol:o.endCol+1,endCol:e.endCol,startRow:n,endRow:a})),l}function m1(e,o,l){return{startCol:e.startCol+o,endCol:e.endCol+o,startRow:e.startRow+l,endRow:e.endRow+l}}function Ea(e,o){return va(e,o)?{startCol:Math.max(e.startCol,o.startCol),endCol:Math.min(e.endCol,o.endCol),startRow:Math.max(e.startRow,o.startRow),endRow:Math.min(e.endRow,o.endRow)}:null}const p1=1;function h1(e,o,l){let n=0;for(let a=0;a<e.length;a++){const i=e[a];i.start<=o&&l<=i.end&&n++}return n}function g1(e,o,l,n){return e<=l&&n<=o||l<=e&&o<=n||o<l||n<e}function fr(e,o,l){if(!Number.isInteger(o)||!Number.isInteger(l)||o<0||l<o)return{ok:!1,code:"outlineInvalid"};if(l-o+1<2)return{ok:!1,code:"outlineMinSize"};for(let a=0;a<e.length;a++){const i=e[a];if(!g1(o,l,i.start,i.end))return{ok:!1,code:"outlineCrossing"}}const n=h1(e,o,l)+1;return n>p1?{ok:!1,code:"outlineTooDeep"}:{ok:!0,level:n}}function Ra(e,o,l,n,a,i){const r=fr(e,l,n);return!r.ok||r.level===void 0?{outlines:e,validation:r}:{outlines:e.concat({id:a,axis:o,start:l,end:n,level:r.level,collapsed:!1}),validation:r}}function Sa(e,o,l){let n=!1;const a=e.map(i=>i.id===o&&i.collapsed!==l?(n=!0,{...i,collapsed:l}):i);return n?a:e}function Ma(e,o){return e.filter(l=>l.id!==o)}function Do(){return[]}function Ba(e,o,l){return e.map(n=>n.start>=o?{...n,start:n.start+l,end:n.end+l}:n.end<o?n:{...n,end:n.end+l})}function Na(e,o,l){const n=[];for(const a of e){const i=a.start,r=a.end;let c,u;if(r<o)c=i,u=r;else if(i>o+l-1)c=i-l,u=r-l;else if(c=i<o?i:o,u=r>o+l-1?r-l:o-1,u<c)continue;n.push({...a,start:c,end:u})}return n}function Xl(e){return e.map(o=>{let l=0;for(let n=0;n<e.length;n++){const a=e[n];a!==o&&a.start<=o.start&&o.end<=a.end&&l++}return{...o,level:l+1}})}function xa(e,o){let l=0;for(let n=0;n<e.length;n++){const a=e[n];a.start<=o&&o<=a.end&&l++}return l}function Ta(e,o){const l=o==="row"?"row-outline":"col-outline",n=new Set(e.map(i=>i.id));let a=1;for(;n.has(`${l}-${a}`);)a++;return`${l}-${a}`}class b1{constructor(o){if(o&&o.length>0){this.styles=o,this.index=new Map;for(let l=0;l<this.styles.length;l++){const n=this.stableKey(this.styles[l]);this.index.set(n,l)}}else this.styles=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(o){const l=Object.keys(o).sort(),n={};for(const a of l)n[a]=o[a];return JSON.stringify(n)}get(o){const l=this.styles[o];return l?o===0?l:Object.freeze(l):{}}getId(o){if(!o||Object.keys(o).length===0)return 0;const l=this.stableKey(o),n=this.index.get(l);if(n!==void 0)return n;const a=this.styles.length,i=Object.freeze({...o});return this.styles.push(i),this.index.set(l,a),a}getStyles(){return[...this.styles]}setStyles(o){this.styles=o,this.index=new Map;for(let l=0;l<this.styles.length;l++){const n=this.stableKey(this.styles[l]);this.index.set(n,l)}}compactStyles(o){const l=new Set;l.add(0);for(const r in o){const c=o[r].styleId??0;l.add(c)}const n=new Map,a=[{}];n.set(0,0);const i=Array.from(l).sort((r,c)=>r-c);for(const r of i)if(r!==0&&r<this.styles.length){const c=a.length;n.set(r,c),a.push(this.styles[r])}for(const r in o){const c=o[r],u=c.styleId??0,b=n.get(u);b!==void 0&&b!==u&&(c.styleId=b)}this.styles=a,this.index=new Map;for(let r=0;r<this.styles.length;r++){const c=this.stableKey(this.styles[r]);this.index.set(c,r)}return a}}function y1(e,o){if(!e)return null;const l=e.styleId;return l===void 0||l===0?null:o[l]??null}function Va(e){const o=new b1,l={};for(const[n,a]of Object.entries(e)){const i={value:a.value};a.styleId!==void 0&&a.styleId>0&&(i.styleId=a.styleId),a.style&&Object.keys(a.style).length>0&&(i.styleId=o.getId(a.style)),i.styleId===0&&delete i.styleId,l[n]=i}return{cells:l,styles:o.getStyles()}}function C1(e){const o={};for(const[l,n]of Object.entries(e)){const a={value:n.value};n.styleId!==void 0&&n.styleId>0&&(a.styleId=n.styleId),o[l]=a}return o}class w1{constructor(o){if(o&&o.length>0){this.borders=o,this.index=new Map;for(let l=0;l<this.borders.length;l++){const n=this.stableKey(this.borders[l]);this.index.set(n,l)}}else this.borders=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(o){const l=["top","right","bottom","left"],n={};for(const a of l){const i=o[a];if(i&&(i.width!==void 0||i.color!==void 0||i.style!==void 0)){const r={};i.width!==void 0&&(r.width=i.width),i.color!==void 0&&(r.color=i.color),i.style!==void 0&&(r.style=i.style),n[a]=r}}return JSON.stringify(n)}get(o){const l=this.borders[o];return l?o===0?l:Object.freeze(l):{}}getId(o){if(!o||this.isEmptyBorder(o))return 0;const l=this.stableKey(o),n=this.index.get(l);if(n!==void 0)return n;const a=this.borders.length,i=Object.freeze(this.deepCloneBorder(o));return this.borders.push(i),this.index.set(l,a),a}isEmptyBorder(o){return!o.top&&!o.right&&!o.bottom&&!o.left}deepCloneBorder(o){const l={};return o.top&&(l.top={...o.top}),o.right&&(l.right={...o.right}),o.bottom&&(l.bottom={...o.bottom}),o.left&&(l.left={...o.left}),l}getBorders(){return[...this.borders]}setBorders(o){this.borders=o,this.index=new Map;for(let l=0;l<this.borders.length;l++){const n=this.stableKey(this.borders[l]);this.index.set(n,l)}}compactBorders(o){const l=new Set;l.add(0);for(const r of o){const c=r.borderId??0;l.add(c)}const n=new Map,a=[{}];n.set(0,0);const i=Array.from(l).sort((r,c)=>r-c);for(const r of i)if(r!==0&&r<this.borders.length){const c=a.length;n.set(r,c),a.push(this.borders[r])}for(const r of o){const c=r.borderId??0,u=n.get(c);u!==void 0&&u!==c&&(r.borderId=u)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const c=this.stableKey(this.borders[r]);this.index.set(c,r)}return a}}function v1(e,o,l,n){if(!e)return;const a=e.styleId??0,i=l[a];if(!i)return;const r=i.borderId??0;if(r===0)return;const c=n.get(r);if(c)return c[o]}function k1(e,o,l,n,a,i){const r=n[e.styleId??0]??{},c=r.borderId??0,u=c>0?a.get(c):{},b={top:u.top?{...u.top}:void 0,right:u.right?{...u.right}:void 0,bottom:u.bottom?{...u.bottom}:void 0,left:u.left?{...u.left}:void 0};l?b[o]={...l}:b[o]=void 0;const h=a.getId(b),C={...r};h===0?delete C.borderId:C.borderId=h,delete C.borderTopWidth,delete C.borderBottomWidth,delete C.borderLeftWidth,delete C.borderRightWidth,delete C.borderColor,Object.keys(C).length===0?e.styleId=0:e.styleId=i(C)}function Da(e){const o=new w1,l=[];for(const n of e){if(!(n.borderTopWidth!==void 0||n.borderBottomWidth!==void 0||n.borderLeftWidth!==void 0||n.borderRightWidth!==void 0)){l.push(n);continue}const i=typeof n.borderColor=="string"?n.borderColor:void 0,r={};n.borderTopWidth!==void 0&&n.borderTopWidth>0&&(r.top={width:n.borderTopWidth,color:i}),n.borderBottomWidth!==void 0&&n.borderBottomWidth>0&&(r.bottom={width:n.borderBottomWidth,color:i}),n.borderLeftWidth!==void 0&&n.borderLeftWidth>0&&(r.left={width:n.borderLeftWidth,color:i}),n.borderRightWidth!==void 0&&n.borderRightWidth>0&&(r.right={width:n.borderRightWidth,color:i});const c=o.getId(r),u={...n};delete u.borderTopWidth,delete u.borderBottomWidth,delete u.borderLeftWidth,delete u.borderRightWidth,delete u.borderColor,c>0?u.borderId=c:delete u.borderId,l.push(u)}return{styles:l,borders:o.getBorders()}}function E1(e,o){const l=t.reactive({rowCount:e.rowCount??o.rowCount,colCount:e.colCount??o.colCount,width:e.width,height:e.height,theme:e.theme??o.theme,locale:e.locale??o.locale});t.watchEffect(()=>{l.rowCount=e.rowCount??o.rowCount,l.colCount=e.colCount??o.colCount,l.width=e.width,l.height=e.height,l.theme=e.theme??o.theme,l.locale=e.locale??o.locale});const n=t.computed(()=>l.locale==="zh-CN"?"zh-CN":"en-US"),a=l.colCount,i=l.rowCount,r=t.reactive({colCount:a,rowCount:i}),c=8,u=32,b=t.reactive({}),h=t.reactive([{}]),C=t.reactive([{}]);let p=new Map;p.set("{}",0);let x=new Map;x.set("{}",0);const R=t.reactive([]),O=new G0,X=t.reactive([]),j=new c1(X),Ee=new Map;let ae=0;function ge(s){const f=Object.keys(s).sort(),k={};for(const B of f)k[B]=s[B];return JSON.stringify(k)}function me(s){const f=["top","right","bottom","left"],k={};for(const B of f){const V=s[B];if(V&&(V.width!==void 0||V.color!==void 0||V.style!==void 0)){const oe={};V.width!==void 0&&(oe.width=V.width),V.color!==void 0&&(oe.color=V.color),V.style!==void 0&&(oe.style=V.style),k[B]=oe}}return JSON.stringify(k)}function pe(s){if(!s||Object.keys(s).length===0)return 0;const f=ge(s),k=p.get(f);if(k!==void 0)return k;const B=h.length;return h.push(Object.freeze({...s})),p.set(f,B),B}function se(s){return y1(s,h)}function Ve(){p=new Map;for(let s=0;s<h.length;s++)p.set(ge(h[s]),s)}function tt(s){h.splice(0,h.length,...s),Ve()}function Qe(s){if(!s||!s.top&&!s.right&&!s.bottom&&!s.left)return 0;const f=me(s),k=x.get(f);if(k!==void 0)return k;const B=C.length;return C.push(Object.freeze({top:s.top?Object.freeze({...s.top}):void 0,right:s.right?Object.freeze({...s.right}):void 0,bottom:s.bottom?Object.freeze({...s.bottom}):void 0,left:s.left?Object.freeze({...s.left}):void 0})),x.set(f,B),B}function K(s){return C[s]??{}}function it(){x=new Map;for(let s=0;s<C.length;s++)x.set(me(C[s]),s)}function I(s){C.splice(0,C.length,...s),it()}function D(s,f){return v1(s,f,h,{get:k=>C[k]??{}})}function W(s,f){const k=st(s,f);return k?k.anchor:null}function we(s,f,k,B){const V=st(s,f),oe=st(k,B);return!V||!oe?!1:V.anchor===oe.anchor}const $e=t.reactive({}),Z=new Fu,Le=t.ref(null),ie=t.ref("cell"),De=t.ref({col:0,row:0}),N=t.ref(null),J=t.ref(""),le=t.ref(new Array(r.colCount).fill(100)),re=t.ref(new Array(r.rowCount).fill(void 0)),ne=t.ref(0),ve=t.ref(0),Ce=t.reactive({rows:0,cols:0}),_=t.ref(null),L=t.ref([]),U=t.ref([]),q=t.shallowRef({active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}),de=new Map;let ze=null;function Re(s,f,k,B){const V=`${B} ${k} ${f}px ${s}`,oe=de.get(V);if(oe)return oe;if(!ze){if(typeof document>"u")return{ascent:f*.88,descent:f*.28};ze=document.createElement("canvas")}const fe=ze.getContext("2d");if(!fe)return{ascent:f*.88,descent:f*.28};fe.font=V;const ke=fe.measureText(" "),Be=ke.fontBoundingBoxAscent,We=ke.fontBoundingBoxDescent;if(typeof Be=="number"&&typeof We=="number"&&Be>0&&We>0){const Wt={ascent:Be,descent:We};return de.set(V,Wt),Wt}const Ue=["M","中","y","Ä","0"];let rt=0,Ye=0;for(const Wt of Ue){const El=fe.measureText(Wt),Rl=El.actualBoundingBoxAscent||0,dl=El.actualBoundingBoxDescent||0;Rl>rt&&(rt=Rl),dl>Ye&&(Ye=dl)}const gt=Math.max(rt,f*.88),Et=Math.max(Ye,f*.28),qt={ascent:gt,descent:Et};return de.set(V,qt),qt}const Pe=Re(Mn,nn,"normal","normal"),lt=Pe.ascent+Pe.descent,_e=Math.max(0,(24-lt)/2);let Ct=(s,f)=>`${s},${f}`,st=()=>null,ct=()=>nn,Vt=t.computed(()=>[0]),$t=()=>24,_t=(s,f,k,B)=>({startCol:Math.min(s,k),startRow:Math.min(f,B),endCol:Math.max(s,k),endRow:Math.max(f,B)});function Ht(s,f){const k=se(b[Ct(s,f)]),B=ct(s,f),V=typeof(k==null?void 0:k.fontFamily)=="string"&&k.fontFamily?k.fontFamily:Mn,oe=(k==null?void 0:k.fontWeight)==="bold"?"bold":"normal",fe=(k==null?void 0:k.fontStyle)==="italic"?"italic":"normal";return Re(V,B,oe,fe)}function Xe(s,f,k,B){if(!f)return[""];const V=f.split(`
|
|
2
|
+
`),oe=[];for(const fe of V)if(!B||k<=0)oe.push(fe);else{let ke="";for(let Be=0;Be<fe.length;Be++){const We=fe[Be],Ue=ke+We;s.measureText(Ue).width>k&&ke?(oe.push(ke),ke=We):ke=Ue}oe.push(ke)}return oe}function S(s,f){const k=se(b[Ct(s,f)]);return typeof(k==null?void 0:k.fontSize)=="number"&&k.fontSize>0?k.fontSize:nn}ct=S;const ee=t.computed(()=>{const s=[0];for(let f=0;f<r.colCount;f++)s.push(s[f]+d(f));return s});Vt=ee;const xt={w:800,h:600};let Dt=()=>{};const tl=t.computed(()=>{const s=new Set;for(const f in b){const k=f.indexOf(",");if(k<0)continue;const B=parseInt(f.substring(k+1),10),V=b[f];V&&(V.value!==""||V.styleId!==void 0)&&s.add(B)}for(let f=0;f<re.value.length;f++)re.value[f]!==void 0&&s.add(f);for(const f in $e){const k=f.indexOf(",");if(k<0)continue;const B=parseInt(f.substring(k+1),10);s.add(B)}return s});function gl(s){if(z(s))return 0;const f=re.value[s];if(f!=null&&f>0)return f;if(!tl.value.has(s))return 24;let k,B,V=1;const oe=ze?ze.getContext("2d"):null,fe=Re(Mn,nn,"normal","normal");k=fe.ascent,B=fe.descent;for(let Ue=0;Ue<r.colCount;Ue++){const rt=S(Ue,s),Ye=se(b[Ct(Ue,s)]),gt=typeof(Ye==null?void 0:Ye.fontFamily)=="string"&&Ye.fontFamily?Ye.fontFamily:Mn,Et=(Ye==null?void 0:Ye.fontWeight)==="bold"?"bold":"normal",qt=(Ye==null?void 0:Ye.fontStyle)==="italic"?"italic":"normal",Wt=Re(gt,rt,Et,qt);Wt.ascent>k&&(k=Wt.ascent),Wt.descent>B&&(B=Wt.descent);const El=typeof(Ye==null?void 0:Ye.numberFormat)=="string"?Ye.numberFormat:"",Rl=En(Ue,s),dl=Il(Rl,El,n.value);if(dl){const Sl=(Ye==null?void 0:Ye.wrap)==="wrap";let ul;if(Sl&&oe){oe.font=`${qt} ${Et} ${rt}px ${gt}`;const ol=st(Ue,s);let _l;ol&&Ue===ol.range.startCol&&s===ol.range.startRow?_l=Vt.value[ol.range.endCol+1]-Vt.value[Ue]:_l=le.value[Ue],ul=Xe(oe,dl,Math.max(0,_l-10),!0).length,ul>V&&(V=ul)}else ul=dl.split(`
|
|
3
|
+
`).length,ul>V&&(V=ul)}}const ke=k+B,Be=_e*2+V*ke;return Math.min(500,Math.max(24,Math.round(Be)))}$t=gl;function jt(s){return re.value[s]===void 0}const Kt={getValue:(s,f)=>En(s,f),getFormat:(s,f)=>{var k;return(k=se(b[Ct(s,f)]))==null?void 0:k.numberFormat}},Zt=t.computed(()=>{const s=new Set,f=_.value;if(!f)return s;const{range:k}=f;for(let B=k.startRow+1;B<=k.endRow;B++)jl(B)||s.add(B);return s});function jl(s){return Ku(_.value,s,Kt,n.value)}function Zl(){return Zt.value}function z(s){return He(s)?!0:_.value?Zt.value.has(s):!1}function $(){let s=0;for(let f=0;f<r.rowCount;f++)z(f)||s++;return s}function H(s){let f=-1;for(let k=0;k<r.rowCount;k++)if(!z(k)&&(f++,f===s))return k;return-1}function he(s){if(z(s))return-1;let f=0;for(let k=0;k<s;k++)z(k)||f++;return f}const Ne=t.computed(()=>{const s=new Set,f=L.value;for(let k=0;k<f.length;k++){const B=f[k];if(B.collapsed)for(let V=Math.max(0,B.start);V<=B.end&&V<r.rowCount;V++)s.add(V)}return s}),xe=t.computed(()=>{const s=new Set,f=U.value;for(let k=0;k<f.length;k++){const B=f[k];if(B.collapsed)for(let V=Math.max(0,B.start);V<=B.end&&V<r.colCount;V++)s.add(V)}return s});function He(s){return Ne.value.has(s)}function Se(s){return xe.value.has(s)}function ce(s){return He(s)}function Ze(s){return Se(s)}function ot(s){return!z(s)}function E(s){return!Se(s)}function y(s){return Se(s)}function d(s){return y(s)?0:le.value[s]??100}function w(s){return xa(L.value,s)}function be(s){return xa(U.value,s)}function ue(s){const f=s==="row"?L.value:U.value;let k=0;for(let B=0;B<f.length;B++){const V=f[B].level;V>k&&(k=V)}return k}function Oe(s){return 0}const qe=()=>Oe(),bt=()=>Oe();function Ft(){return L.value.map(s=>({...s}))}function Qt(){return U.value.map(s=>({...s}))}function Tt(s=!1){var f,k;s||(Dt(ne.value,ve.value),(f=M.scheduleRender)==null||f.call(M),(k=M.emitModelData)==null||k.call(M))}function bl(s,f){var B;const k=fr(L.value,s,f);return!k.ok||k.level===void 0?k:((B=M.saveUndo)==null||B.call(M),L.value=Xl(Ra(L.value,"row",s,f,Ta(L.value,"row")).outlines),Tt(),{ok:!0,level:k.level})}function Jl(s,f){var B;const k=fr(U.value,s,f);return!k.ok||k.level===void 0?k:((B=M.saveUndo)==null||B.call(M),U.value=Xl(Ra(U.value,"column",s,f,Ta(U.value,"column")).outlines),Tt(),{ok:!0,level:k.level})}function xn(s){var B;const f=L.value.some(V=>V.id===s),k=!f&&U.value.some(V=>V.id===s);return!f&&!k?!1:((B=M.saveUndo)==null||B.call(M),f?L.value=Xl(Ma(L.value,s)):U.value=Xl(Ma(U.value,s)),Tt(),!0)}function Tn(){var s;L.value.length&&((s=M.saveUndo)==null||s.call(M),L.value=Do(),Tt())}function so(){var s;U.value.length&&((s=M.saveUndo)==null||s.call(M),U.value=Do(),Tt())}function co(){var s;!L.value.length&&!U.value.length||((s=M.saveUndo)==null||s.call(M),L.value=Do(),U.value=Do(),Tt())}function Pn(s,f,k=!1){var oe;const B=Sa(L.value,s,f),V=Sa(U.value,s,f);B===L.value&&V===U.value||(k||(oe=M.saveUndo)==null||oe.call(M),L.value=B,U.value=V,Tt(k))}function hr(s){const f=L.value.find(k=>k.id===s)??U.value.find(k=>k.id===s);f&&Pn(s,!f.collapsed)}function gr(s,f){L.value.length&&(L.value=Xl(Ba(L.value,s,f)),Tt())}function Vn(s,f){L.value.length&&(L.value=Xl(Na(L.value,s,f)),Tt())}function Dn(s,f){U.value.length&&(U.value=Xl(Ba(U.value,s,f)),Tt())}function Gn(s,f){U.value.length&&(U.value=Xl(Na(U.value,s,f)),Tt())}function uo(s,f){s&&(L.value=Xl([...s])),f&&(U.value=Xl([...f])),Tt(!0)}function Kn(){return _.value}function fo(s,f=!1){var k,B;_.value=s,!f&&(Dt(ne.value,ve.value),(k=M.scheduleRender)==null||k.call(M),(B=M.emitModelData)==null||B.call(M))}function Ql(s){var k,B;const f={range:{startCol:Math.min(s.startCol,s.endCol),endCol:Math.max(s.startCol,s.endCol),startRow:Math.min(s.startRow,s.endRow),endRow:Math.max(s.startRow,s.endRow)},columns:{}};_.value=f,Dt(ne.value,ve.value),(k=M.scheduleRender)==null||k.call(M),(B=M.emitModelData)==null||B.call(M)}function Fn(){var s,f;_.value&&(_.value=null,Dt(ne.value,ve.value),(s=M.scheduleRender)==null||s.call(M),(f=M.emitModelData)==null||f.call(M))}function qn(s){var B,V;if(!_.value)return;const{[s]:f,...k}=_.value.columns;_.value={..._.value,columns:k},(B=M.scheduleRender)==null||B.call(M),(V=M.emitModelData)==null||V.call(M)}function br(s,f){var k,B;if(_.value){if(f)_.value={..._.value,columns:{..._.value.columns,[s]:f}};else{const{[s]:V,...oe}=_.value.columns;_.value={..._.value,columns:oe}}(k=M.scheduleRender)==null||k.call(M),(B=M.emitModelData)==null||B.call(M)}}function yr(s){const f=_.value;return f?qu(f,s,Kt,n.value):{values:[],hasBlank:!1}}function Yn(s,f){const k=r.colCount,B=r.rowCount,V=(rt,Ye)=>{const gt=b[ll(rt,Ye)];return!!gt&&(gt.value!==""||gt.styleId!==void 0)};if(!V(s,f))return null;const oe=rt=>{for(let Ye=0;Ye<k;Ye++)if(V(Ye,rt))return!0;return!1},fe=(rt,Ye,gt)=>{for(let Et=Ye;Et<=gt;Et++)if(V(rt,Et))return!0;return!1};let ke=f;for(;ke>0&&oe(ke-1);)ke--;let Be=f;for(;Be<B-1&&oe(Be+1);)Be++;let We=s;for(;We>0&&fe(We-1,ke,Be);)We--;let Ue=s;for(;Ue<k-1&&fe(Ue+1,ke,Be);)Ue++;return{startCol:We,startRow:ke,endCol:Ue,endRow:Be}}function On(){const s=Le.value;if(!!s&&s.startRow!==s.endRow)return{startCol:Math.min(s.startCol,s.endCol),endCol:Math.max(s.startCol,s.endCol),startRow:Math.min(s.startRow,s.endRow),endRow:Math.max(s.startRow,s.endRow)};const k=De.value,B=s?s.startCol:k.col,V=s?s.startRow:k.row,oe=(We,Ue)=>{const rt=b[ll(We,Ue)];return!!rt&&(rt.value!==""||rt.styleId!==void 0)};let fe,ke;s?(fe=Math.min(s.startCol,s.endCol),ke=Math.max(s.startCol,s.endCol)):(fe=k.col,ke=k.col);let Be=V;for(;Be<r.rowCount-1;){const We=Be+1;let Ue=!1,rt=!1;for(let Ye=fe;Ye<=ke;Ye++){oe(Ye,We)&&(Ue=!0);const gt=Vl(Ye,We);gt&&(gt.range.startCol!==gt.range.endCol||gt.range.startRow!==gt.range.endRow)&&(rt=!0)}if(rt||!Ue)break;Be++}return!oe(B,V)&&Be===V?wl():{startCol:fe,endCol:ke,startRow:V,endRow:Be}}function Cr(){if(_.value){Fn();return}const s=On();s&&Ql(s)}function wr(s){const f=_.value;return f?s>=f.range.startCol&&s<=f.range.endCol:!1}function Cn(){return _.value?{..._.value.range}:null}function yl(){return!!_.value}function Cl(s){const f=_.value;return f?ra(f.columns[s]):!1}function wl(){let s=1/0,f=1/0,k=-1,B=-1;for(const V in b){const oe=V.indexOf(",");if(oe<0)continue;const fe=parseInt(V.substring(0,oe),10),ke=parseInt(V.substring(oe+1),10),Be=b[V];Be&&(Be.value!==""||Be.styleId!==void 0)&&(fe<s&&(s=fe),ke<f&&(f=ke),fe>k&&(k=fe),ke>B&&(B=ke))}return k<0?null:{startCol:s,startRow:f,endCol:k,endRow:B}}const el=t.computed(()=>{const s=[0];for(let f=0;f<r.rowCount;f++)s.push(s[f]+$t(f));return s}),wn=t.computed(()=>ee.value[r.colCount]),vn=t.computed(()=>el.value[r.rowCount]);function ll(s,f){return`${s},${f}`}Ct=ll;function vl(s){Reflect.deleteProperty(b,s)}function kn(s,f){ie.value="cell";const k=st(s,f);k?(De.value={col:k.range.startCol,row:k.range.startRow},Le.value={...k.range}):(De.value={col:s,row:f},Le.value={startCol:s,startRow:f,endCol:s,endRow:f})}function cn(s,f,k,B,V="cell"){const oe=st(s,f);if(De.value=oe?{col:oe.range.startCol,row:oe.range.startRow}:{col:s,row:f},ie.value=V,V==="row"||V==="col"){const fe=Math.min(s,k),ke=Math.max(s,k),Be=Math.min(f,B),We=Math.max(f,B);Le.value={startCol:fe,startRow:Be,endCol:ke,endRow:We}}else Le.value=_t(s,f,k,B)}function Xn(){cn(0,0,r.colCount-1,r.rowCount-1,"all")}function In(s,f){const k=Le.value;return k?(ie.value==="cell"||ie.value==="all",s>=k.startCol&&s<=k.endCol&&f>=k.startRow&&f<=k.endRow):!1}function al(s,f){return In(s,f)}function Vl(s,f){for(const k in $e){const B=$e[k];if(B&&s>=B.startCol&&s<=B.endCol&&f>=B.startRow&&f<=B.endRow)return{range:B,anchor:k}}return null}st=Vl;function Mt(s,f){return $e[ll(s,f)]!==void 0}function Bt(s,f){const k=st(s,f);if(k&&s===k.range.startCol&&f===k.range.startRow){const B=ee.value[k.range.endCol+1]-ee.value[s],V=el.value[k.range.endRow+1]-el.value[f];return{w:B,h:V}}return{w:d(s),h:$t(f)}}function nl(s,f,k,B){let V=Math.min(s,k),oe=Math.max(s,k),fe=Math.min(f,B),ke=Math.max(f,B),Be=!0;for(;Be;){Be=!1;for(const We in $e){const Ue=$e[We];if(!Ue)continue;Ue.startCol<=oe&&Ue.endCol>=V&&Ue.startRow<=ke&&Ue.endRow>=fe&&(Ue.startCol<V&&(V=Ue.startCol,Be=!0),Ue.endCol>oe&&(oe=Ue.endCol,Be=!0),Ue.startRow<fe&&(fe=Ue.startRow,Be=!0),Ue.endRow>ke&&(ke=Ue.endRow,Be=!0))}}return{startCol:V,startRow:fe,endCol:oe,endRow:ke}}_t=nl;function jn(s,f){var k;return((k=b[ll(s,f)])==null?void 0:k.value)??""}function En(s,f){return bn(),ta(s,f,b,r.colCount,r.rowCount)}function mo(s,f,k){var ke,Be;s>=0&&f>=0&&Y(s,f);const B=ll(s,f);if(bn(),O.invalidate(),X.length>0&&kl(),k===""||k==null){Z.clear(B);const We=(ke=b[B])==null?void 0:ke.styleId;We!==void 0&&We>0?b[B]={value:"",styleId:We}:vl(B),Z.markDirty(B);return}const V=String(k);if(!V.startsWith("=")){const We=se(b[B]),Ue=typeof(We==null?void 0:We.numberFormat)=="string"?We.numberFormat:"";if(xl(Ue)){const rt=ql(V,n.value);if(rt){const gt={...We??{},numberFormat:rt.format};b[B]={value:String(rt.serial),styleId:pe(gt)},Z.clear(B),Z.markDirty(B);return}const Ye=vo(V,n.value);if(Ye){const gt={...We??{},numberFormat:Ye.format};b[B]={value:String(Ye.num),styleId:pe(gt)},Z.clear(B),Z.markDirty(B);return}}}const oe=(Be=b[B])==null?void 0:Be.styleId,fe={value:V};oe!==void 0&&oe>0&&(fe.styleId=oe),b[B]=fe,V.startsWith("=")?Z.set(B,So(V.slice(1),r.colCount,r.rowCount)):Z.clear(B),Z.markDirty(B)}function sl(s,f,k,B){for(let V=s;V<=f;V++)for(let oe=k;oe<=B;oe++){const fe=ll(V,oe);Z.clear(fe),vl(fe),Z.markDirty(fe)}O.invalidate(),X.length>0&&kl()}function en(){return{cells:b,colCount:r.colCount,rowCount:r.rowCount,locale:n.value,getCellValue:(s,f)=>En(s,f)}}function zl(s,f){return R.length===0?null:Y0(s,f,R,en(),O)}function $l(s){var k,B,V;(k=M.saveUndo)==null||k.call(M);const f={id:s.id||X0(),condition:s.condition,format:s.format,ranges:s.ranges,priority:s.priority,stopIfTrue:s.stopIfTrue,enabled:s.enabled!==!1};R.push(f),O.invalidate(),(B=M.scheduleRender)==null||B.call(M),(V=M.emitModelData)==null||V.call(M)}function dn(s,f){var B,V,oe;(B=M.saveUndo)==null||B.call(M);const k=R.findIndex(fe=>fe.id===s);k<0||(R[k]={...R[k],...f,id:s},O.invalidate(),(V=M.scheduleRender)==null||V.call(M),(oe=M.emitModelData)==null||oe.call(M))}function Dl(s){var k,B,V;(k=M.saveUndo)==null||k.call(M);const f=R.findIndex(oe=>oe.id===s);f<0||(R.splice(f,1),O.invalidate(),(B=M.scheduleRender)==null||B.call(M),(V=M.emitModelData)==null||V.call(M))}function Rn(s,f){var Be,We,Ue;(Be=M.saveUndo)==null||Be.call(M);const k=[...R].sort((rt,Ye)=>rt.priority-Ye.priority),B=k.findIndex(rt=>rt.id===s);if(B<0)return;const V=f==="up"?B-1:B+1;if(V<0||V>=k.length)return;const oe=k[B],fe=k[V],ke=oe.priority;oe.priority=fe.priority,fe.priority=ke,O.invalidate(),(We=M.scheduleRender)==null||We.call(M),(Ue=M.emitModelData)==null||Ue.call(M)}function Fo(){O.invalidate()}function Oo(s){var f,k,B;if((f=M.saveUndo)==null||f.call(M),s==="sheet")R.splice(0,R.length);else{const V=M.selection.value;if(!V)return;for(let oe=R.length-1;oe>=0;oe--){const fe=R[oe];fe.ranges=fe.ranges.filter(ke=>!(ke.startCol<=V.endCol&&ke.endCol>=V.startCol&&ke.startRow<=V.endRow&&ke.endRow>=V.startRow)),fe.ranges.length===0&&R.splice(oe,1)}}O.invalidate(),(k=M.scheduleRender)==null||k.call(M),(B=M.emitModelData)==null||B.call(M)}function kl(){j.invalidate(),Ee.clear()}function po(){return{cells:b,colCount:r.colCount,rowCount:r.rowCount,locale:n.value,getCellValue:(s,f)=>En(s,f),getSheetCells:s=>M.getSheetCellsById?M.getSheetCellsById(s):null}}function un(s,f){const k=st(f,s),B=k?{col:k.range.startCol,row:k.range.startRow}:{col:f,row:s};return j.getRules(B.col,B.row,X)}function ho(s,f){const k=un(s,f);return k.length?k[0]:null}function Io(s,f){return un(s,f).length>0}function go(s,f){const k=st(f,s),B=k?{col:k.range.startCol,row:k.range.startRow}:{col:f,row:s};return j.findRule(B.col,B.row,l1,X)}function vr(s){const f=s.listSource,k=f&&f.type==="range"?`range:${f.sheetId??""}:${f.range.startCol},${f.range.startRow},${f.range.endCol},${f.range.endRow}`:`values:${(f&&f.type==="values"?f.values:s.values??[]).join("")}`,B=Ee.get(k);if(B)return B;const V=Ca(s,po());return Ee.set(k,V),V}function kr(s,f){const k=go(s,f);return k?{rule:k,items:vr(k)}:null}function Er(s,f){for(const k of un(s,f)){if(k.enabled===!1||!k.showInputMessage)continue;const B=k.inputTitle??"",V=k.inputMessage??"";if(!(!B&&!V))return{title:B,message:V}}return null}function Ao(s,f,k){const B=un(s,f);return B.length===0?{valid:!0}:wa(k,f,s,B,po())}function Lo(s){const f=po(),k={stop:3,warning:2,information:1};let B=null,V=0;for(const oe of s){const fe=un(oe.row,oe.col);if(fe.length===0)continue;const ke=wa(oe.value,oe.col,oe.row,fe,f);if(ke.valid)continue;const Be=k[ur(ke.rule)]??0;Be>V&&(V=Be,B=ke)}return B??{valid:!0}}function zo(s,f){var B,V,oe;f!=null&&f.silent||(B=M.saveUndo)==null||B.call(M);const k={...s,id:s.id||ba(),ranges:(s.ranges??[]).map(fe=>({...fe})),enabled:s.enabled!==!1};return X.push(k),kl(),f!=null&&f.silent||((V=M.scheduleRender)==null||V.call(M),(oe=M.emitModelData)==null||oe.call(M)),k}function Rr(s,f,k){var V,oe,fe;const B=X.findIndex(ke=>ke.id===s);if(B<0){zo({id:s,...f},k);return}k!=null&&k.silent||(V=M.saveUndo)==null||V.call(M),X[B]={...X[B],...f,id:s},kl(),k!=null&&k.silent||((oe=M.scheduleRender)==null||oe.call(M),(fe=M.emitModelData)==null||fe.call(M))}function Sr(s,f){var B,V,oe;const k=X.findIndex(fe=>fe.id===s);k<0||(f!=null&&f.silent||(B=M.saveUndo)==null||B.call(M),X.splice(k,1),kl(),f!=null&&f.silent||((V=M.scheduleRender)==null||V.call(M),(oe=M.emitModelData)==null||oe.call(M)))}function Mr(s,f){var V,oe,fe,ke,Be,We;if(!s){if(X.length===0)return;f!=null&&f.silent||(V=M.saveUndo)==null||V.call(M),X.splice(0,X.length),kl(),f!=null&&f.silent||((oe=M.scheduleRender)==null||oe.call(M),(fe=M.emitModelData)==null||fe.call(M));return}const k={startCol:Math.min(s.startCol,s.endCol),endCol:Math.max(s.startCol,s.endCol),startRow:Math.min(s.startRow,s.endRow),endRow:Math.max(s.startRow,s.endRow)};if(X.filter(Ue=>(Ue.ranges??[]).some(rt=>!(rt.endCol<k.startCol||rt.startCol>k.endCol||rt.endRow<k.startRow||rt.startRow>k.endRow))).length!==0){f!=null&&f.silent||(ke=M.saveUndo)==null||ke.call(M);for(let Ue=X.length-1;Ue>=0;Ue--){const rt=X[Ue],Ye=[];for(const gt of rt.ranges??[])Ye.push(...ka(gt,k));Ye.length===0?X.splice(Ue,1):rt.ranges=Ye}kl(),f!=null&&f.silent||((Be=M.scheduleRender)==null||Be.call(M),(We=M.emitModelData)==null||We.call(M))}}function Br(s){const f=[];for(const k of X)for(const B of k.ranges??[]){const V=Ea(B,s);V&&f.push({rule:k,range:V})}return f}function bo(s,f,k){var B,V,oe;if(s.length){k!=null&&k.silent||(B=M.saveUndo)==null||B.call(M);for(let fe=X.length-1;fe>=0;fe--){const ke=X[fe],Be=[];for(const We of ke.ranges??[])Be.push(...ka(We,f));Be.length===0?X.splice(fe,1):ke.ranges=Be}for(const fe of s){const ke=[];for(const Be of fe.ranges??[]){const We=Ea(Be,f);We&&ke.push(We)}ke.length&&X.push({...fe,id:ba(),ranges:ke})}kl(),k!=null&&k.silent||((V=M.scheduleRender)==null||V.call(M),(oe=M.emitModelData)==null||oe.call(M))}}async function Zn(s,f,k){const B=s.severity??"stop";if(!(!s.rule||s.rule.showErrorMessage!==!1))return B==="stop"?"cancel":"continue";const oe=M.showValidationAlert;if(!oe)return B==="stop"?"cancel":"continue";ae++;try{return await oe({severity:B,title:s.title??"",message:s.message??"",col:f,row:k})}catch{return"cancel"}finally{ae=Math.max(0,ae-1)}}function $o(){return ae>0}let Jn=()=>{};function yo(s){N.value||(N.value={...De.value},s!==void 0?J.value=s:J.value||(J.value=jn(De.value.col,De.value.row)))}async function Nr(){const s=N.value;if(!s)return!1;const f=s.col,k=s.row,B=J.value,V=Ao(k,f,B);return!V.valid&&await Zn(V,f,k)!=="continue"?!1:(Jn(),mo(f,k,B),N.value=null,J.value="",!0)}function xr(){N.value=null,J.value=""}function Tr(s,f){const k=De.value;let B=Math.max(0,k.col+s),V=Math.max(0,k.row+f);(B>=r.colCount||V>=r.rowCount)&&Y(B,V);const oe=st(k.col,k.row),fe=st(B,V);oe&&fe&&oe.anchor===fe.anchor&&(s>0?B=oe.range.endCol+1:s<0&&(B=oe.range.startCol-1),f>0?V=oe.range.endRow+1:f<0&&(V=oe.range.startRow-1),(B>=r.colCount||V>=r.rowCount)&&Y(B,V)),B=Math.max(0,Math.min(r.colCount-1,B)),V=Math.max(0,Math.min(r.rowCount-1,V)),kn(B,V)}function Vr(s,f){P(f,s)}function _o(s){const f=ee.value;if(s<0||s>=f[r.colCount])return-1;let k=0,B=r.colCount-1;for(;k<B;){const V=k+B+1>>1;f[V]<=s?k=V:B=V-1}return k}function Ho(s){const f=el.value;if(s<0||s>=f[r.rowCount])return-1;let k=0,B=r.rowCount-1;for(;k<B;){const V=k+B+1>>1;f[V]<=s?k=V:B=V-1}return k}function cl(s,f){var V,oe;const k=Math.max(0,Math.min(Math.floor(s),r.rowCount)),B=Math.max(0,Math.min(Math.floor(f),r.colCount));Ce.rows=k,Ce.cols=B,(V=M.scheduleRender)==null||V.call(M),(oe=M.emitModelData)==null||oe.call(M)}function An(){var s,f;Ce.rows=0,Ce.cols=0,(s=M.scheduleRender)==null||s.call(M),(f=M.emitModelData)==null||f.call(M)}function Dr(){return{rows:Ce.rows,cols:Ce.cols}}function m(){let s=0,f=0;if(Ce.cols>0){const k=le.value,B=Math.min(Ce.cols,k.length);for(let V=0;V<B;V++)s+=k[V]}if(Ce.rows>0)for(let k=0;k<Ce.rows;k++)f+=$t(k);return{frozenRowsHeight:f,frozenColumnsWidth:s}}function v(){const{frozenColumnsWidth:s,frozenRowsHeight:f}=m(),k=qe(),B=bt(),V=52+k+s,oe=24+B+f,fe=Math.max(0,xt.w-52-k-11-s),ke=Math.max(0,xt.h-24-B-11-f),Be=[];return f>0&&s>0&&Be.push({kind:"corner",x:52+k,y:24+B,width:s,height:f,scrollLeft:0,scrollTop:0}),f>0&&Be.push({kind:"rows",x:V,y:24+B,width:fe,height:f,scrollLeft:ne.value,scrollTop:0}),s>0&&Be.push({kind:"columns",x:52+k,y:oe,width:s,height:ke,scrollLeft:0,scrollTop:ve.value}),Be.push({kind:"body",x:V,y:oe,width:fe,height:ke,scrollLeft:ne.value,scrollTop:ve.value}),Be}function T(s,f){const k=ee.value,B=el.value,V=k[f]??0,oe=B[s]??0,fe=st(f,s),ke=fe?(k[fe.range.endCol+1]??V)-V:(k[f+1]??V)-V,Be=fe?(B[fe.range.endRow+1]??oe)-oe:$t(s),We=f<Ce.cols,Ue=s<Ce.rows,rt=(We?0:-ne.value)+52+qe()+V,Ye=(Ue?0:-ve.value)+24+bt()+oe;return{x:rt,y:Ye,width:ke,height:Be}}function G(s,f){const{frozenColumnsWidth:k,frozenRowsHeight:B}=m(),V=qe(),oe=bt();if(s<52+V||f<24+oe)return null;const fe=k>0&&s<52+V+k,ke=B>0&&f<24+oe+B,Be=fe?s-52-V:s-52-V+ne.value,We=ke?f-24-oe:f-24-oe+ve.value,Ue=_o(Be),rt=Ho(We);return Ue<0||rt<0?null:{col:Ue,row:rt}}function F(s,f){return s<Ce.rows||f<Ce.cols}function P(s,f){if(F(s,f))return;const{frozenColumnsWidth:k,frozenRowsHeight:B}=m(),V=Math.max(0,xt.w-52-qe()-11-k),oe=Math.max(0,xt.h-24-bt()-11-B),fe=ee.value,ke=el.value,Be=(fe[f]??0)-k,We=(ke[s]??0)-B,Ue=st(f,s),rt=Ue?(fe[Ue.range.endCol+1]??0)-(fe[f]??0):le.value[f]??0,Ye=Ue?(ke[Ue.range.endRow+1]??0)-(ke[s]??0):$t(s);let gt=ne.value,Et=ve.value;Be<gt?gt=Be:Be+rt>gt+V&&(gt=Be+rt-V),We<Et?Et=We:We+Ye>Et+oe&&(Et=We+Ye-oe),gt=Math.max(0,gt),Et=Math.max(0,Et),Dt(gt,Et)}function Y(s,f){var oe;const k=s+1,B=f+1;let V=!1;if(k>=r.colCount){const fe=Math.max(r.colCount+c,k),ke=fe-r.colCount,Be=le.value;for(let We=0;We<ke;We++)Be.push(100);r.colCount=fe,V=!0}if(B>=r.rowCount){const fe=Math.max(r.rowCount+u,B),ke=fe-r.rowCount,Be=re.value;for(let We=0;We<ke;We++)Be.push(void 0);r.rowCount=fe,V=!0}V&&((oe=M.scheduleRender)==null||oe.call(M))}function Q(){return r.colCount!==a||r.rowCount!==i}function te(s,f,k){const B=rr(s,f,$e);if(!B.ok){B.reason==="target-merge-size"&&window.alert(g(n.value,"autofillMergeSizeError"));return}const V=ga(s,f,{cells:b},k,n.value,r.colCount,r.rowCount,pt),oe=Object.entries(V.cells).map(([ke,Be])=>{const We=ke.indexOf(",");return{col:parseInt(ke.substring(0,We),10),row:parseInt(ke.substring(We+1),10),value:Be?Be.value:""}}),fe=Lo(oe);if(!fe.valid){(async()=>await Zn(fe,f.startCol,f.startRow)==="continue"&&Fe(s,f,k))();return}Fe(s,f,k)}function Fe(s,f,k){var oe,fe,ke;(oe=M.saveUndo)==null||oe.call(M),Y(f.endCol,f.endRow);const B=ga(s,f,{cells:b},k,n.value,r.colCount,r.rowCount,pt);bn();for(const[Be,We]of Object.entries(B.cells)){const Ue=Be.indexOf(","),rt=parseInt(Be.substring(0,Ue),10),Ye=parseInt(Be.substring(Ue+1),10),gt=Vl(rt,Ye);if(gt&&!(rt===gt.range.startCol&&Ye===gt.range.startRow))continue;const Et=We.value;Et===""&&(We.styleId===void 0||We.styleId===0)?(Z.clear(Be),vl(Be)):(b[Be]={value:Et,...We.styleId!==void 0&&We.styleId>0?{styleId:We.styleId}:{}},Et.startsWith("=")?Z.set(Be,So(Et.slice(1),r.colCount,r.rowCount)):Z.clear(Be)),Z.markDirty(Be)}const V={startCol:Math.min(s.startCol,f.startCol),startRow:Math.min(s.startRow,f.startRow),endCol:Math.max(s.endCol,f.endCol),endRow:Math.max(s.endRow,f.endRow)};cn(V.startCol,V.startRow,V.endCol,V.endRow),(fe=M.scheduleRender)==null||fe.call(M),(ke=M.emitModelData)==null||ke.call(M)}function Me(s,f){var oe;let k=!1;const B=Math.max(1,Math.floor(s)),V=Math.max(1,Math.floor(f));if(B!==r.colCount){if(B>r.colCount){const fe=le.value;for(let ke=r.colCount;ke<B;ke++)fe.push(100)}else le.value=le.value.slice(0,B);r.colCount=B,k=!0}if(V!==r.rowCount){if(V>r.rowCount){const fe=re.value;for(let ke=r.rowCount;ke<V;ke++)fe.push(void 0)}else re.value=re.value.slice(0,V);r.rowCount=V,k=!0}k&&((oe=M.scheduleRender)==null||oe.call(M))}const M={props:l,locale:n,get colCount(){return r.colCount},get rowCount(){return r.rowCount},ensureCapacity:Y,hasDynamicDims:Q,setDims:Me,cells:b,styles:h,borders:C,merges:$e,formulaDeps:Z,selection:Le,activeCell:De,editingCell:N,editValue:J,colWidths:le,rowHeights:re,scrollX:ne,scrollY:ve,freeze:Ce,setFreeze:cl,clearFreeze:An,getFreeze:Dr,getFrozenMetrics:m,filter:_,getFilter:Kn,setFilter:fo,enableFilter:Ql,clearFilter:Fn,clearFilterColumn:qn,setFilterColumn:br,getColumnCandidates:yr,getDataRange:wl,getCurrentRegion:Yn,detectFilterRange:On,toggleAutoFilter:Cr,isColumnInFilterRange:wr,getFilterRange:Cn,isFilterEnabled:yl,isFilterColumnActive:Cl,isRowHidden:z,getFilteredOutRows:Zl,getVisibleRowCount:$,getVisibleRowAt:H,getVisibleRowIndex:he,getViewportRegions:v,cellToScreenRect:T,screenToCell:G,isCellFrozen:F,scrollCellIntoView:P,BASE_CELL_VPAD:_e,fontMetricsCache:de,fontMetricsCanvas:ze,measureFontMetrics:Re,_getFontMetricsForCell:Ht,getWrappedLines:Xe,cellFontSize:S,colPositions:ee,getRowHeight:gl,_isAutoRow:jt,rowPositions:el,totalWidth:wn,totalHeight:vn,selectCell:kn,selectRange:cn,selectAll:Xn,isSelected:In,isCellSelected:al,selectionMode:ie,cellKey:ll,delCell:vl,findMerge:Vl,_isMergeAnchor:Mt,_mergedSpan:Bt,expandSelectionForMerges:nl,getCellRaw:jn,getCellValue:En,setCellValue:mo,clearCellsInRange:sl,startEdit:yo,commitEdit:Nr,cancelEdit:xr,moveActive:Tr,ensureVisible:Vr,hitCol:_o,hitRow:Ho,registerStyle:pe,resolveStyle:se,rebuildStyleIndex:Ve,syncStyles:tt,registerBorder:Qe,resolveBorder:K,rebuildBorderIndex:it,syncBorders:I,getCellBorderSide:D,getMergeOwner:W,isSameMergeInternal:we,getRowOutlines:Ft,getColumnOutlines:Qt,addRowGroup:bl,addColumnGroup:Jl,removeOutline:xn,clearRowGroups:Tn,clearColumnGroups:so,clearAllOutlines:co,setOutlineCollapsed:Pn,toggleOutline:hr,getOutlineLevel:ue,getOutlineGutterSize:Oe,getRowOutlineLevel:w,getColumnOutlineLevel:be,isRowCollapsed:ce,isColumnCollapsed:Ze,isRowVisible:ot,isColumnVisible:E,isColHidden:y,getColWidth:d,adjustOutlinesForInsertRows:gr,adjustOutlinesForDeleteRows:Vn,adjustOutlinesForInsertCols:Dn,adjustOutlinesForDeleteCols:Gn,syncOutlines:uo,viewSize:xt,findHighlight:(s,f)=>null,autoFillState:q,applyAutoFill:te,conditionalFormats:R,resolveConditionalFormat:zl,addConditionalFormatRule:$l,updateConditionalFormatRule:dn,removeConditionalFormatRule:Dl,moveConditionalFormatRule:Rn,clearConditionalFormats:Oo,invalidateConditionalFormatCache:Fo,dataValidations:X,getDataValidationRules:un,getDataValidationRule:ho,hasDataValidation:Io,getListValidation:go,getValidationDropdown:kr,getValidationInputMessage:Er,validateCell:Ao,validateCells:Lo,createDataValidation:zo,updateDataValidation:Rr,removeDataValidation:Sr,clearDataValidation:Mr,getDataValidationsInRange:Br,applyDataValidationsToRange:bo,invalidateDataValidationCache:kl,isValidationAlertOpen:$o,confirmInvalidValue:Zn};return Jn=()=>{var s;return(s=M.saveUndo)==null?void 0:s.call(M)},Dt=(s,f)=>{var k;return(k=M.clampScroll)==null?void 0:k.call(M,s,f)},M}function R1(e,o){const l=t.ref([]),n=t.ref([]);function a(E){return C1(E)}function i(){return o.saveSheet(),{sheets:o.sheets.value.map(E=>({id:E.id,name:E.name,cells:a(E.cells),styles:[...E.styles],borders:E.borders?[...E.borders]:[{}],merges:E.merges?{...E.merges}:{},selection:E.selection?{...E.selection}:null,activeCell:E.activeCell?{...E.activeCell}:{col:0,row:0},scrollX:E.scrollX,scrollY:E.scrollY,colWidths:[...E.colWidths],rowHeights:[...E.rowHeights],colCount:E.colCount,rowCount:E.rowCount,freeze:{...E.freeze},filter:E.filter?JSON.parse(JSON.stringify(E.filter)):null,conditionalFormats:E.conditionalFormats?E.conditionalFormats.map(y=>({...y,ranges:y.ranges.map(d=>({...d}))})):[],dataValidations:E.dataValidations?E.dataValidations.map(y=>({...y,ranges:(y.ranges??[]).map(d=>({...d}))})):[],rowOutlines:E.rowOutlines?E.rowOutlines.map(y=>({...y})):[],columnOutlines:E.columnOutlines?E.columnOutlines.map(y=>({...y})):[]})),styles:[...e.styles],activeSheetIndex:o.activeSheetIndex.value}}function r(E){const y=o.sheets.value;o.sheets.value=E.sheets.map((d,w)=>{var ue;const be=((ue=y[w])==null?void 0:ue.freeze)??{rows:0,cols:0};return{...d,cells:a(d.cells),styles:[...d.styles],borders:d.borders?[...d.borders]:[{}],freeze:{rows:be.rows,cols:be.cols}}}),o.loadSheet(Math.max(0,Math.min(E.activeSheetIndex,o.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function c(){const E=i(),y=l.value[l.value.length-1];y&&JSON.stringify(y)===JSON.stringify(E)||(l.value.push(E),n.value=[],l.value.length>50&&l.value.shift())}e.saveUndo=c;function u(){var E,y,d;l.value.length&&(n.value.push(i()),r(l.value.pop()),(E=e.invalidateConditionalFormatCache)==null||E.call(e),(y=e.invalidateDataValidationCache)==null||y.call(e),(d=e.scheduleRender)==null||d.call(e),t.nextTick(()=>{var w;return(w=e.emitModelData)==null?void 0:w.call(e)}))}function b(){var E,y,d;n.value.length&&(l.value.push(i()),r(n.value.pop()),(E=e.invalidateConditionalFormatCache)==null||E.call(e),(y=e.invalidateDataValidationCache)==null||y.call(e),(d=e.scheduleRender)==null||d.call(e),t.nextTick(()=>{var w;return(w=e.emitModelData)==null?void 0:w.call(e)}))}const h=t.computed(()=>l.value.length>0),C=t.computed(()=>n.value.length>0),p=t.computed(()=>!!e.selection.value),x=t.ref(null);function R(){var d;const E=e.selection.value;if(!E)return;const y={};for(let w=E.startCol;w<=E.endCol;w++)for(let be=E.startRow;be<=E.endRow;be++)y[`${w-E.startCol},${be-E.startRow}`]=((d=e.cells[e.cellKey(w,be)])==null?void 0:d.styleId)??0;x.value={styles:y}}function O(){var d,w,be;const E=x.value,y=e.selection.value;if(!(!E||!y)){c();for(let ue=y.startCol;ue<=y.endCol;ue++)for(let Oe=y.startRow;Oe<=y.endRow;Oe++){const qe=e.findMerge(ue,Oe);if(qe&&(ue!==qe.range.startCol||Oe!==qe.range.startRow))continue;const bt=E.styles[`${ue-y.startCol},${Oe-y.startRow}`]??0,Ft=e.cellKey(ue,Oe),Qt=((d=e.cells[Ft])==null?void 0:d.value)??"";if(Qt===""&&bt===0)e.delCell(Ft);else{const Tt={value:Qt};bt>0&&(Tt.styleId=bt),e.cells[Ft]=Tt}}x.value=null,(w=e.scheduleRender)==null||w.call(e),(be=e.emitModelData)==null||be.call(e)}}function X(){var y,d,w;const E=e.selection.value;if(E){c();for(let be=E.startCol;be<=E.endCol;be++)for(let ue=E.startRow;ue<=E.endRow;ue++){const Oe=e.findMerge(be,ue);if(Oe&&(be!==Oe.range.startCol||ue!==Oe.range.startRow))continue;const qe=e.cellKey(be,ue),bt=((y=e.cells[qe])==null?void 0:y.value)??"";bt===""?e.delCell(qe):e.cells[qe]={value:bt}}(d=e.scheduleRender)==null||d.call(e),(w=e.emitModelData)==null||w.call(e)}}const j=t.computed(()=>qa.map(E=>({...E,label:E.value===""?g(e.locale.value,"fontDefault"):E.label}))),Ee=t.computed(()=>Ya.map(E=>({...E,label:String(E.value)}))),ae="\0",ge=t.computed(()=>{const E=e.selection.value;if(!E)return"";let y,d=!1;for(let w=E.startCol;w<=E.endCol&&!d;w++)for(let be=E.startRow;be<=E.endRow&&!d;be++){const ue=e.findMerge(w,be);if(ue&&(w!==ue.range.startCol||be!==ue.range.startRow))continue;const Oe=e.resolveStyle(e.cells[e.cellKey(w,be)]),qe=typeof(Oe==null?void 0:Oe.fontFamily)=="string"?Oe.fontFamily:"";y===void 0?y=qe:qe!==y&&(d=!0)}return d?ae:y??""}),me=t.computed(()=>{const E=e.selection.value;if(!E)return nn;let y,d=!1;for(let w=E.startCol;w<=E.endCol&&!d;w++)for(let be=E.startRow;be<=E.endRow&&!d;be++){const ue=e.findMerge(w,be);if(ue&&(w!==ue.range.startCol||be!==ue.range.startRow))continue;const Oe=e.cellFontSize(w,be);y===void 0?y=Oe:Oe!==y&&(d=!0)}return d?0:y??nn});function pe(E,y){var w,be,ue;const d=e.selection.value;if(d){c();for(let Oe=d.startCol;Oe<=d.endCol;Oe++)for(let qe=d.startRow;qe<=d.endRow;qe++){const bt=e.findMerge(Oe,qe);if(bt&&(Oe!==bt.range.startCol||qe!==bt.range.startRow))continue;const Ft=e.cellKey(Oe,qe),Qt=((w=e.cells[Ft])==null?void 0:w.value)??"";let bl={...e.resolveStyle(e.cells[Ft])??{}};if(y===""||y===null||y===void 0||y===0){const{[E]:xn,...Tn}=bl;bl=Tn}else bl[E]=y;const Jl=Object.keys(bl).length?e.registerStyle(bl):0;if(Qt===""&&Jl===0)e.delCell(Ft);else{const xn={value:Qt};Jl>0&&(xn.styleId=Jl),e.cells[Ft]=xn}}(be=e.scheduleRender)==null||be.call(e),(ue=e.emitModelData)==null||ue.call(e)}}function se(E){pe("fontFamily",E===""?"":E)}const Ve=t.ref(!1),tt=t.ref(!1),Qe=t.ref(!1),K=t.ref(!1),it=t.ref(!1);function I(E){pe("fontSize",E),Ve.value=!1}const D=t.computed(()=>ti.map(E=>({label:g(e.locale.value,E.labelKey),value:E.value,icon:E.icon}))),W=t.computed(()=>li.map(E=>({label:g(e.locale.value,E.labelKey),value:E.value,icon:E.icon}))),we=t.computed(()=>{const E=e.selection.value;if(!E)return"left";const y=e.resolveStyle(e.cells[e.cellKey(E.startCol,E.startRow)]),d=typeof(y==null?void 0:y.textAlign)=="string"?y.textAlign:"";return d==="center"||d==="right"?d:"left"}),$e=t.computed(()=>{const E=e.selection.value;if(!E)return"top";const y=e.resolveStyle(e.cells[e.cellKey(E.startCol,E.startRow)]),d=typeof(y==null?void 0:y.verticalAlign)=="string"?y.verticalAlign:"";return d==="middle"||d==="bottom"?d:"top"}),Z=t.computed(()=>{const E=e.selection.value;if(!E)return!1;const y=e.resolveStyle(e.cells[e.cellKey(E.startCol,E.startRow)]);return(y==null?void 0:y.wrap)==="wrap"});function Le(E){pe("textAlign",E)}function ie(E){pe("verticalAlign",E)}function De(){if(!e.selection.value)return;const y=Z.value;pe("wrap",y?void 0:"wrap")}const N=t.ref(""),J=Ve;t.watch(me,E=>{N.value=E===0?"":String(E)},{immediate:!0});function le(E){const y=E.replace(/[^\d]/g,"");N.value=y;const d=parseInt(y,10);!isNaN(d)&&d>=5&&d<=72&&d!==me.value&&pe("fontSize",d)}function re(){const E=N.value.trim();if(!E){N.value=me.value===0?"":String(me.value);return}let y=parseInt(E,10);isNaN(y)?y=me.value===0?nn:me.value:y=Math.max(5,Math.min(72,y)),N.value=String(y),y!==me.value&&pe("fontSize",y)}function ne(E){E.key==="Enter"&&E.target.blur()}function ve(E){E&&E.preventDefault(),J.value=!J.value,J.value&&(Qe&&(Qe.value=!1),tt&&(tt.value=!1),K.value=!1,it.value=!1)}function Ce(){const E=me.value===0?nn:me.value,y=Math.min(72,E+1);pe("fontSize",y),N.value=String(y),J.value=!1}function _(){const E=me.value===0?nn:me.value,y=Math.max(5,E-1);pe("fontSize",y),N.value=String(y),J.value=!1}function L(E){const y=e.selection.value;if(!y)return!1;let d,w=!1;for(let be=y.startCol;be<=y.endCol&&!w;be++)for(let ue=y.startRow;ue<=y.endRow&&!w;ue++){const Oe=e.findMerge(be,ue);if(Oe&&(be!==Oe.range.startCol||ue!==Oe.range.startRow))continue;const qe=e.resolveStyle(e.cells[e.cellKey(be,ue)]),bt=!!(qe!=null&&qe[E]);d===void 0?d=bt:bt!==d&&(w=!0)}return!w&&d===!0}const U=t.computed(()=>L("fontWeight")),q=t.computed(()=>L("fontStyle")),de=t.computed(()=>L("underline")),ze=t.computed(()=>L("strikethrough"));function Re(){pe("fontWeight",U.value?"":"bold")}function Pe(){pe("fontStyle",q.value?"":"italic")}function lt(){pe("underline",de.value?"":"underline")}function _e(){pe("strikethrough",ze.value?"":"line-through")}const Ct=t.ref(""),st=t.ref(""),ct=K,Vt=it;function $t(){ct.value=!ct.value,Vt.value=!1,tt&&(tt.value=!1),Qe&&(Qe.value=!1)}function _t(){Vt.value=!Vt.value,ct.value=!1,tt&&(tt.value=!1),Qe&&(Qe.value=!1)}function Ht(E){tt&&(tt.value=E),E&&(ct.value=!1,Vt.value=!1,Qe&&(Qe.value=!1))}function Xe(E){Ct.value=E,pe("color",E===""?"":E)}function S(E){st.value=E,pe("backgroundColor",E===""?"":E)}function ee(){pe("color",Ct.value===""?"":Ct.value)}function xt(){pe("backgroundColor",st.value===""?"":st.value)}const Dt=t.computed(()=>{const E=e.selection.value;if(!E)return"";let y,d=!1;for(let w=E.startCol;w<=E.endCol&&!d;w++)for(let be=E.startRow;be<=E.endRow&&!d;be++){const ue=e.findMerge(w,be);if(ue&&(w!==ue.range.startCol||be!==ue.range.startRow))continue;const Oe=e.resolveStyle(e.cells[e.cellKey(w,be)]),qe=typeof(Oe==null?void 0:Oe.color)=="string"?Oe.color:"";y===void 0?y=qe:qe!==y&&(d=!0)}return d?"":y??""}),tl=t.computed(()=>{const E=e.selection.value;if(!E)return"";let y,d=!1;for(let w=E.startCol;w<=E.endCol&&!d;w++)for(let be=E.startRow;be<=E.endRow&&!d;be++){const ue=e.findMerge(w,be);if(ue&&(w!==ue.range.startCol||be!==ue.range.startRow))continue;const Oe=e.resolveStyle(e.cells[e.cellKey(w,be)]),qe=typeof(Oe==null?void 0:Oe.backgroundColor)=="string"?Oe.backgroundColor:"";y===void 0?y=qe:qe!==y&&(d=!0)}return d?"":y??""}),gl=t.computed(()=>Pr(e.locale.value)),jt=t.ref(!1),Kt=t.computed(()=>{const E=e.selection.value;if(!E)return rn;let y,d=!1;for(let w=E.startCol;w<=E.endCol&&!d;w++)for(let be=E.startRow;be<=E.endRow&&!d;be++){const ue=e.findMerge(w,be);if(ue&&(w!==ue.range.startCol||be!==ue.range.startRow))continue;const Oe=e.resolveStyle(e.cells[e.cellKey(w,be)]),qe=(Oe==null?void 0:Oe.numberFormatCategory)==="custom"?on:typeof(Oe==null?void 0:Oe.numberFormat)=="string"?Oe.numberFormat:"";y===void 0?y=qe:qe!==y&&(d=!0)}return d?Kl:y??rn});function Zt(E){if((E==null?void 0:E.numberFormatCategory)==="custom")return on;const y=typeof(E==null?void 0:E.numberFormat)=="string"?E.numberFormat:"";return Ur(y,e.locale.value)}const jl=t.computed(()=>{const E=Kt.value;if(E!==Kl)return E===on?on:Ur(E,e.locale.value);const y=e.selection.value;if(!y)return rn;let d,w=!1;for(let be=y.startCol;be<=y.endCol&&!w;be++)for(let ue=y.startRow;ue<=y.endRow&&!w;ue++){const Oe=e.findMerge(be,ue);if(Oe&&(be!==Oe.range.startCol||ue!==Oe.range.startRow))continue;const qe=Zt(e.resolveStyle(e.cells[e.cellKey(be,ue)]));d===void 0?d=qe:qe!==d&&(w=!0)}return w?Kl:d??rn});function Zl(E){pe("numberFormat",E),z()}function z(){const E=e.selection.value;if(E)for(let y=E.startCol;y<=E.endCol;y++)for(let d=E.startRow;d<=E.endRow;d++){const w=e.findMerge(y,d);if(w&&(y!==w.range.startCol||d!==w.range.startRow))continue;const be=e.cellKey(y,d),ue=e.cells[be],Oe=e.resolveStyle(ue);if((Oe==null?void 0:Oe.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:qe,...bt}=Oe,Ft=Object.keys(bt).length?e.registerStyle(bt):0,Qt=(ue==null?void 0:ue.value)??"";if(Qt===""&&Ft===0)e.delCell(be);else{const Tt={value:Qt};Ft>0&&(Tt.styleId=Ft),e.cells[be]=Tt}}}function $(E){if(E===on){jt.value=!0;return}Zl(E)}function H(){jt.value=!0}function he(){const E=e.selection.value;if(!E)return[];const y=[];for(let d=E.startCol;d<=E.endCol;d++)for(let w=E.startRow;w<=E.endRow;w++){const be=e.findMerge(d,w);if(be&&(d!==be.range.startCol||w!==be.range.startRow))continue;const ue=e.cellKey(d,w),Oe=e.cells[ue],qe=e.resolveStyle(Oe),bt=typeof(qe==null?void 0:qe.numberFormat)=="string"?qe.numberFormat:rn,Ft=(Oe==null?void 0:Oe.value)??"",Qt=Ft.startsWith("=")?ta(d,w,e.cells,e.colCount,e.rowCount):Ft;Wr(bt,Qt)&&y.push({key:ue,nf:bt,decimals:ki(bt,Qt)})}return y}const Ne=t.computed(()=>he().some(E=>E.decimals<jo)),xe=t.computed(()=>he().some(E=>E.decimals>Zo));function He(E,y,d){var qe;const w=((qe=e.cells[E])==null?void 0:qe.value)??"",ue={...e.resolveStyle(e.cells[E])??{}};y===""?(delete ue.numberFormat,delete ue.numberFormatCategory):(ue.numberFormat=y,d==="custom"&&(ue.numberFormatCategory="custom"));const Oe=Object.keys(ue).length?e.registerStyle(ue):0;if(w===""&&Oe===0)e.delCell(E);else{const bt={value:w};Oe>0&&(bt.styleId=Oe),e.cells[E]=bt}}function Se(E){var w,be;const y=he(),d=[];for(const ue of y){const Oe=ue.decimals+E;if(Oe<Zo||Oe>jo)continue;const qe=Ri(ue.nf,Oe);qe==null||qe===ue.nf||d.push({key:ue.key,code:qe,category:xl(ue.nf)?"custom":void 0})}if(d.length){c();for(const ue of d)He(ue.key,ue.code,ue.category);(w=e.scheduleRender)==null||w.call(e),(be=e.emitModelData)==null||be.call(e)}}function ce(){Se(1)}function Ze(){Se(-1)}return{undoStack:l,redoStack:n,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:c,undo:u,redo:b,canUndo:h,canRedo:C,hasSelection:p,paintFmt:x,onPaintFormat:R,applyPaintFormat:O,clearFormat:X,fontFamilyOptions:j,fontSizeOptions:Ee,FONT_FAMILY_MIXED:ae,selFontFamily:ge,selFontSize:me,applyStyleToSelection:pe,onFontFamilyChange:se,onFontSizeChange:I,hAlignOptions:D,vAlignOptions:W,selHAlign:we,selVAlign:$e,selWrap:Z,onHAlignChange:Le,onVAlignChange:ie,onWrapToggle:De,fontSizeInput:N,fontSizeMenuOpen:J,onFontSizeInput:le,onFontSizeBlur:re,onFontSizeKeydown:ne,toggleFontSizeMenu:ve,onFontSizeStepUp:Ce,onFontSizeStepDown:_,selFontWeight:U,selFontStyle:q,selUnderline:de,selStrikethrough:ze,toggleFontWeight:Re,toggleFontStyle:Pe,toggleUnderline:lt,toggleStrikethrough:_e,cachedTextColor:Ct,cachedFillColor:st,textColorMenuOpen:ct,fillColorMenuOpen:Vt,_toggleTextColorMenu:$t,_toggleFillColorMenu:_t,onBorderMenuToggle:Ht,onTextColorChange:Xe,onFillColorChange:S,applyCachedTextColor:ee,applyCachedFillColor:xt,selTextColor:Dt,selFillColor:tl,nfOptions:gl,selNumberFormat:Kt,selNumberFormatDisplay:jl,NF_NUMBER_FORMAT_MIXED:Kl,nfDialogOpen:jt,onNumberFormatChange:$,openNumberFormatDialog:H,applyNumberFormatCode:Zl,canIncreaseDecimals:Ne,canDecreaseDecimals:xe,onIncreaseDecimals:ce,onDecreaseDecimals:Ze}}function S1(e,o){o.borderMenuOpen&&(e.borderMenuOpen=o.borderMenuOpen),o.mergeMenuOpen&&(e.mergeMenuOpen=o.mergeMenuOpen),(()=>{const n=e.borderMenuOpen,a=e.mergeMenuOpen;e.onBorderMenuToggle=i=>{n&&(n.value=i),i&&(e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1,a&&(a.value=!1))},e.toggleFontSizeMenu=i=>{i&&i.preventDefault(),e.fontSizeMenuOpen.value=!e.fontSizeMenuOpen.value,e.fontSizeMenuOpen.value&&(a&&(a.value=!1),n&&(n.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,n&&(n.value=!1),a&&(a.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,n&&(n.value=!1),a&&(a.value=!1)}})()}function M1(e,o){const l=t.ref("none"),n=t.ref(!1),a="#444";function i(N,J,le,re){if(N<0||J<0||N>=e.colCount||J>=e.rowCount)return;const ne=e.findMerge(N,J),ve=ne?ne.anchor:e.cellKey(N,J);if(!e.cells[ve]){if(!re)return;e.cells[ve]={value:""}}k1(e.cells[ve],le,re,e.styles,{get:_=>e.resolveBorder(_),getId:_=>e.registerBorder(_)},e.registerStyle)}function r(N,J,le){var L;const re=e.findMerge(N,J),ne=re?re.anchor:e.cellKey(N,J),ve=((L=e.cells[ne])==null?void 0:L.value)??"",Ce=e.resolveStyle(e.cells[ne])?{...e.resolveStyle(e.cells[ne])}:{},_=e.registerBorder(le);if(_>0?Ce.borderId=_:delete Ce.borderId,delete Ce.borderTopWidth,delete Ce.borderBottomWidth,delete Ce.borderLeftWidth,delete Ce.borderRightWidth,delete Ce.borderColor,ve===""&&!Object.keys(Ce).length)e.delCell(ne);else{const U=e.registerStyle(Ce);e.cells[ne]={value:ve,styleId:U||void 0}}}function c(N){var L,U;l.value=N;const J=e.selection.value;if(!J)return;o.saveUndo();const{startCol:le,startRow:re,endCol:ne,endRow:ve}=J,Ce={width:1,color:a},_={width:2,color:a};if(N==="none")for(let q=le;q<=ne;q++)for(let de=re;de<=ve;de++){const ze=e.findMerge(q,de);ze&&(q!==ze.range.startCol||de!==ze.range.startRow)||r(q,de,{})}else if(N==="all")for(let q=le;q<=ne;q++)for(let de=re;de<=ve;de++){const ze=e.findMerge(q,de);ze&&(q!==ze.range.startCol||de!==ze.range.startRow)||r(q,de,{top:Ce,right:Ce,bottom:Ce,left:Ce})}else if(N==="outer"||N==="thickOuter"){const q=N==="thickOuter"?_:Ce;for(let de=le;de<=ne;de++)i(de,re,"top",q);for(let de=le;de<=ne;de++)i(de,ve,"bottom",q);for(let de=re;de<=ve;de++)i(le,de,"left",q);for(let de=re;de<=ve;de++)i(ne,de,"right",q)}else{const de={top:{side:"top",edgeCheck:(ze,Re)=>Re===re},bottom:{side:"bottom",edgeCheck:(ze,Re)=>Re===ve},left:{side:"left",edgeCheck:(ze,Re)=>ze===le},right:{side:"right",edgeCheck:(ze,Re)=>ze===ne}}[N];if(de)for(let ze=le;ze<=ne;ze++)for(let Re=re;Re<=ve;Re++)de.edgeCheck(ze,Re)&&i(ze,Re,de.side,Ce)}(L=e.scheduleRender)==null||L.call(e),(U=e.emitModelData)==null||U.call(e)}function u(){c(l.value)}function b(N,J,le){const re=le.toLowerCase(),ne=e.findMerge(N,J);if(ne){if(re==="top"&&J!==ne.range.startRow||re==="bottom"&&J!==ne.range.endRow||re==="left"&&N!==ne.range.startCol||re==="right"&&N!==ne.range.endCol)return 0;const Ce=e.getCellBorderSide(e.cells[ne.anchor],re);return(Ce==null?void 0:Ce.width)??0}const ve=e.getCellBorderSide(e.cells[e.cellKey(N,J)],re);return(ve==null?void 0:ve.width)??0}const h=t.ref(!1);function C(N){h.value=N,N&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,n.value=!1,o.fontSizeMenuOpen.value=!1)}function p(N,J,le,re){const ne=[];for(const ve in e.merges){const Ce=e.merges[ve];Ce&&Ce.startCol<=le&&Ce.endCol>=N&&Ce.startRow<=re&&Ce.endRow>=J&&ne.push(ve)}for(const ve of ne)Reflect.deleteProperty(e.merges,ve)}function x(){var ve,Ce,_;const N=e.selection.value;if(!N||N.startCol===N.endCol&&N.startRow===N.endRow)return;o.saveUndo(),p(N.startCol,N.startRow,N.endCol,N.endRow);const J=e.cellKey(N.startCol,N.startRow),le=((ve=e.cells[J])==null?void 0:ve.value)??"";for(let L=N.startCol;L<=N.endCol;L++)for(let U=N.startRow;U<=N.endRow;U++)L===N.startCol&&U===N.startRow||e.clearCellsInRange(L,L,U,U);const re=e.resolveStyle(e.cells[J])?{...e.resolveStyle(e.cells[J])}:{};re.textAlign="center";const ne=e.registerStyle(re);e.cells[J]={value:le,styleId:ne||void 0},e.merges[J]={startCol:N.startCol,startRow:N.startRow,endCol:N.endCol,endRow:N.endRow},e.selectCell(N.startCol,N.startRow),(Ce=e.scheduleRender)==null||Ce.call(e),(_=e.emitModelData)==null||_.call(e)}function R(){var J,le,re;const N=e.selection.value;if(!(!N||N.startCol===N.endCol)){o.saveUndo();for(let ne=N.startRow;ne<=N.endRow;ne++){p(N.startCol,ne,N.endCol,ne);const ve=e.cellKey(N.startCol,ne);(J=e.cells[ve])==null||J.value;for(let Ce=N.startCol+1;Ce<=N.endCol;Ce++)e.clearCellsInRange(Ce,Ce,ne,ne);e.merges[ve]={startCol:N.startCol,startRow:ne,endCol:N.endCol,endRow:ne}}e.selectRange(N.startCol,N.startRow,N.endCol,N.endRow),(le=e.scheduleRender)==null||le.call(e),(re=e.emitModelData)==null||re.call(e)}}function O(){var le,re,ne;const N=e.selection.value;if(!N||N.startCol===N.endCol&&N.startRow===N.endRow)return;o.saveUndo(),p(N.startCol,N.startRow,N.endCol,N.endRow);const J=e.cellKey(N.startCol,N.startRow);(le=e.cells[J])==null||le.value;for(let ve=N.startCol;ve<=N.endCol;ve++)for(let Ce=N.startRow;Ce<=N.endRow;Ce++)ve===N.startCol&&Ce===N.startRow||e.clearCellsInRange(ve,ve,Ce,Ce);e.merges[J]={startCol:N.startCol,startRow:N.startRow,endCol:N.endCol,endRow:N.endRow},e.selectCell(N.startCol,N.startRow),(re=e.scheduleRender)==null||re.call(e),(ne=e.emitModelData)==null||ne.call(e)}function X(){var J,le;const N=e.selection.value;N&&(o.saveUndo(),p(N.startCol,N.startRow,N.endCol,N.endRow),(J=e.scheduleRender)==null||J.call(e),(le=e.emitModelData)==null||le.call(e))}function j(){const N=e.selection.value;if(!N)return;const J=e.findMerge(N.startCol,N.startRow);J&&N.startCol===J.range.startCol&&N.startRow===J.range.startRow&&N.endCol===J.range.endCol&&N.endRow===J.range.endRow?X():x()}function Ee(N){switch(N){case"mergeCenter":x();break;case"mergeAcross":R();break;case"mergeCells":O();break;case"unmergeCells":X();break}}let ae=null,ge=[],me=[];function pe(N,J,le,re){me=[];const ne={startCol:N,endCol:J,startRow:le,endRow:re};for(const{rule:ve,range:Ce}of e.getDataValidationsInRange(ne))me.push({...ve,ranges:[{...Ce}]})}function se(N,J,le,re){ge=[];for(let ne=le;ne<=re;ne++){const ve=[];for(let Ce=N;Ce<=J;Ce++){const _=e.cells[e.cellKey(Ce,ne)];ve.push((_==null?void 0:_.styleId)??0)}ge.push(ve)}}function Ve(N,J,le,re){const ne=e.cellKey(N,J);if(bn(),le===""||le==null){e.formulaDeps.clear(ne),re&&re>0?e.cells[ne]={value:"",styleId:re}:e.delCell(ne),e.formulaDeps.markDirty(ne);return}e.cells[ne]={value:le,styleId:re&&re>0?re:void 0},le.startsWith("=")?e.formulaDeps.set(ne,So(le.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(ne),e.formulaDeps.markDirty(ne)}function tt(){const N=e.selection.value;if(!N)return;ae={...N},se(N.startCol,N.endCol,N.startRow,N.endRow),pe(N.startCol,N.endCol,N.startRow,N.endRow);const J=[];for(let le=N.startRow;le<=N.endRow;le++){const re=[];for(let ne=N.startCol;ne<=N.endCol;ne++)re.push(e.getCellRaw(ne,le));J.push(re.join(" "))}Go(J.join(`
|
|
4
|
+
`))}function Qe(){const N=e.selection.value;if(N){if(N.startCol===0&&N.endCol===e.colCount-1){ae={...N},se(0,e.colCount-1,N.startRow,N.endRow),pe(0,e.colCount-1,N.startRow,N.endRow);const J=[];for(let le=N.startRow;le<=N.endRow;le++){const re=[];for(let ne=0;ne<e.colCount;ne++)re.push(e.getCellRaw(ne,le));J.push(re.join(" "))}Go(J.join(`
|
|
5
|
+
`))}else if(N.startRow===0&&N.endRow===e.rowCount-1){ae={...N},se(N.startCol,N.endCol,0,e.rowCount-1),pe(N.startCol,N.endCol,0,e.rowCount-1);const J=[];for(let le=0;le<e.rowCount;le++){const re=[];for(let ne=N.startCol;ne<=N.endCol;ne++)re.push(e.getCellRaw(ne,le));J.push(re.join(" "))}Go(J.join(`
|
|
6
|
+
`))}}}async function K(){var de;let N;try{N=await navigator.clipboard.readText()}catch{return}if(!N&&N!=="")return;const J=N.split(/\r?\n/),le=e.activeCell.value,re=ae,ne=re&&ge.length>0,ve=J.map(ze=>ze.split(" ").length),Ce=ve.length?Math.max(...ve):0,_=le.col+Ce-1,L=le.row+J.length-1;_>=0&&L>=0&&e.ensureCapacity(_,L);const U=[];for(let ze=0;ze<J.length;ze++){const Re=J[ze].split(" ");for(let Pe=0;Pe<Re.length;Pe++){const lt=le.col+Pe,_e=le.row+ze;let Ct=Re[Pe];Ct.startsWith("=")&&re&&(Ct=Mo(Ct,lt-(re.startCol+Pe),_e-(re.startRow+ze),e.colCount,e.rowCount,pt));const st=ne&&ze<ge.length&&Pe<(((de=ge[ze])==null?void 0:de.length)??0)?ge[ze][Pe]??null:null;U.push({c:lt,r:_e,val:Ct,styleId:st})}}const q=e.validateCells(U.map(ze=>({col:ze.c,row:ze.r,value:ze.val})));if(!(!q.valid&&await e.confirmInvalidValue(q,le.col,le.row)!=="continue")){for(const ze of U)ze.styleId!==null?Ve(ze.c,ze.r,ze.val,ze.styleId):e.setCellValue(ze.c,ze.r,ze.val);if(re&&me.length>0){const ze=le.col-re.startCol,Re=le.row-re.startRow,Pe={startCol:le.col,endCol:le.col+Ce-1,startRow:le.row,endRow:le.row+J.length-1},lt=me.map(_e=>({..._e,ranges:_e.ranges.map(Ct=>m1(Ct,ze,Re))}));e.applyDataValidationsToRange(lt,Pe,{silent:!0}),e.invalidateDataValidationCache()}}}function it(){var N;if(o.saveUndo(),tt(),e.selection.value){const J=e.selection.value;e.clearCellsInRange(J.startCol,J.endCol,J.startRow,J.endRow),(N=e.scheduleRender)==null||N.call(e)}}function I(){var N;if(e.selection.value){const J=e.selection.value;e.clearCellsInRange(J.startCol,J.endCol,J.startRow,J.endRow),(N=e.scheduleRender)==null||N.call(e)}}function D(){var ve,Ce;const N=e.selection.value;if(!N)return;o.saveUndo();const J=N.startCol,le=N.startRow,re=N.endCol,ne=N.endRow;if(le===ne)if(re+1<e.colCount){const _=`${pt(J)}${le+1}:${pt(re)}${le+1}`;e.setCellValue(re+1,le,`=SUM(${_})`)}else{const _=`${pt(J)}${le+1}:${pt(re-1)}${le+1}`;e.setCellValue(re,le,`=SUM(${_})`)}else for(let _=J;_<=re;_++)if(ne+1<e.rowCount){const L=`${pt(_)}${le+1}:${pt(_)}${ne+1}`;e.setCellValue(_,ne+1,`=SUM(${L})`)}else{const L=`${pt(_)}${le+1}:${pt(_)}${ne}`;e.setCellValue(_,ne,`=SUM(${L})`)}(ve=e.scheduleRender)==null||ve.call(e),(Ce=e.emitModelData)==null||Ce.call(e)}function W(){var ve,Ce;const N=e.selection.value;if(!N)return;o.saveUndo();const J=N.startCol,le=N.startRow,re=N.endCol,ne=N.endRow;if(le===ne)if(re+1<e.colCount){const _=`${pt(J)}${le+1}:${pt(re)}${le+1}`;e.setCellValue(re+1,le,`=AVERAGE(${_})`)}else{const _=`${pt(J)}${le+1}:${pt(re-1)}${le+1}`;e.setCellValue(re,le,`=AVERAGE(${_})`)}else for(let _=J;_<=re;_++)if(ne+1<e.rowCount){const L=`${pt(_)}${le+1}:${pt(_)}${ne+1}`;e.setCellValue(_,ne+1,`=AVERAGE(${L})`)}else{const L=`${pt(_)}${le+1}:${pt(_)}${ne}`;e.setCellValue(_,ne,`=AVERAGE(${L})`)}(ve=e.scheduleRender)==null||ve.call(e),(Ce=e.emitModelData)==null||Ce.call(e)}function we(){var ve,Ce;const N=e.selection.value;if(!N)return;o.saveUndo();const J=N.startCol,le=N.startRow,re=N.endCol,ne=N.endRow;if(le===ne)if(re+1<e.colCount){const _=`${pt(J)}${le+1}:${pt(re)}${le+1}`;e.setCellValue(re+1,le,`=COUNT(${_})`)}else{const _=`${pt(J)}${le+1}:${pt(re-1)}${le+1}`;e.setCellValue(re,le,`=COUNT(${_})`)}else for(let _=J;_<=re;_++)if(ne+1<e.rowCount){const L=`${pt(_)}${le+1}:${pt(_)}${ne+1}`;e.setCellValue(_,ne+1,`=COUNT(${L})`)}else{const L=`${pt(_)}${le+1}:${pt(_)}${ne}`;e.setCellValue(_,ne,`=COUNT(${L})`)}(ve=e.scheduleRender)==null||ve.call(e),(Ce=e.emitModelData)==null||Ce.call(e)}const $e=t.ref(!1);function Z(N){$e.value=N,N&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,n.value=!1,o.fontSizeMenuOpen.value=!1,h.value=!1)}function Le(){D(),$e.value=!1}function ie(){W(),$e.value=!1}function De(){we(),$e.value=!1}return{cachedBorder:l,borderMenuOpen:n,BORDER_COLOR:a,onBorderChange:c,setCellBorderSide:i,applyBorderToCell:r,applyCachedBorder:u,cellBorderWidth:b,mergeMenuOpen:h,onMergeMenuToggle:C,removeOverlappingMerges:p,mergeAndCenter:x,mergeAcross:R,mergeCells:O,unmergeCells:X,onApplyMerge:j,onMergeChange:Ee,copySourceRange:null,copySourceStyles:[],captureStyles:se,captureDataValidations:pe,setCellWithStyle:Ve,copyToClipboard:tt,copyRowCol:Qe,pasteFromClipboard:K,cutSelected:it,clearSelected:I,sumSelected:D,avgSelected:W,countSelected:we,calcMenuOpen:$e,onCalcMenuToggle:Z,onCalcSum:Le,onCalcAvg:ie,onCalcCount:De}}function B1(e,o,l,n){const a={},i=n(o),r=n(l);return i!=null&&(a.width=`${i}px`),r!=null&&(a.height=`${r}px`),a["--sp-formula-bar-bg"]=e.formulaBarBg,a["--sp-formula-bar-border"]=e.formulaBarBorder,a["--sp-formula-bar-label-color"]=e.formulaBarLabelText,a["--sp-formula-bar-label-bg"]=e.formulaBarLabelBg,a["--sp-formula-bar-label-border"]=e.formulaBarLabelBorder,a["--sp-formula-bar-input-bg"]=e.formulaBarInputBg,a["--sp-formula-bar-input-border"]=e.formulaBarInputBorder,a["--sp-formula-bar-input-color"]=e.formulaBarInputText,a["--sp-formula-bar-input-focus-border"]=e.formulaBarInputFocusBorder,a["--sp-formula-bar-input-focus-shadow"]=e.formulaBarInputFocusShadow,a["--sp-wrapper-bg"]=e.wrapperBg,a["--sp-cell-editor-border"]=e.cellEditorBorder,a["--sp-cell-editor-color"]=e.cellEditorText,a["--sp-cell-editor-bg"]=e.cellEditorBg,a["--sp-cell-editor-shadow"]=e.cellEditorShadow,a["--sp-tab-bar-bg"]=e.tabBarBg,a["--sp-tab-bar-border"]=e.tabBarBorder,a["--sp-tab-active-bg"]=e.tabActiveBg,a["--sp-tab-active-color"]=e.tabActiveText,a["--sp-tab-active-border"]=e.tabActiveBorder,a["--sp-tab-inactive-bg"]=e.tabInactiveBg,a["--sp-tab-inactive-color"]=e.tabInactiveText,a["--sp-tab-inactive-border"]=e.tabInactiveBorder,a["--sp-tab-hover-bg"]=e.tabHoverBg,a["--sp-tab-add-btn-color"]=e.tabAddBtnColor,a["--sp-tab-add-btn-hover-bg"]=e.tabAddBtnHoverBg,a["--sp-tab-scroll-btn-color"]=e.tabScrollBtnColor,a["--sp-tab-scroll-btn-hover-bg"]=e.tabScrollBtnHoverBg,a["--sp-scroll-thumb"]=e.scrollbarThumb,a["--sp-scroll-thumb-hover"]=e.scrollbarThumbHover,a["--sp-scroll-btn-bg"]=e.scrollBtnBg,a["--sp-scroll-btn-color"]=e.scrollBtnColor,a["--sp-scroll-btn-hover-bg"]=e.scrollBtnHoverBg,a["--sp-scroll-btn-active-bg"]=e.scrollBtnActiveBg,a["--sp-scroll-track-bg"]=e.scrollTrackBg,a["--sp-toolbar-bg"]=e.toolbarBg,a["--sp-toolbar-border"]=e.toolbarBorder,a["--sp-toolbar-btn-color"]=e.toolbarBtnColor,a["--sp-toolbar-btn-hover-bg"]=e.toolbarBtnHoverBg,a["--sp-toolbar-btn-disabled-color"]=e.toolbarBtnDisabledColor,a["--sp-toolbar-btn-active-color"]=e.toolbarBtnActiveColor,a}function Fa(e){return e==="number"?0:1}function Oa(e,o,l){var i;if(e==null||e.trim()==="")return{kind:"blank"};const n=o??"";if(n===Nl||n==="@")return{kind:"text",text:e};if(xl(n)){if(Al(e))return{kind:"number",num:Number(e)};const r=ql(e,l);return r?{kind:"number",num:r.serial}:{kind:"text",text:Il(e,n,l)}}const a=an(n);if(a.kind==="date"||a.kind==="duration"){const r=Number(e);return Number.isFinite(r)?{kind:"number",num:r}:{kind:"text",text:Il(e,n,l)}}if(a.kind==="number"){const r=Number(e);if(Number.isFinite(r)){const c=((i=a.sections.find(u=>u.hasDigits))==null?void 0:i.scale)??1;return{kind:"number",num:r*c}}return{kind:"text",text:Il(e,n,l)}}return{kind:"text",text:Il(e,n,l)}}function N1(e,o,l,n){if(e.kind==="blank"||o.kind==="blank")return e.kind==="blank"&&o.kind==="blank"?0:e.kind==="blank"?1:-1;const a=Fa(e.kind),i=Fa(o.kind);if(a!==i)return l==="asc"?a-i:i-a;let r;return e.kind==="number"?r=(e.num??0)-(o.num??0):r=(e.text??"").localeCompare(o.text??"",n,{numeric:!0}),l==="asc"?r:-r}function x1(e,o,l){const n=e.map((a,i)=>i);return n.sort((a,i)=>{const r=N1(e[a],e[i],o,l);return r!==0?r:a-i}),n}function T1(e){if(e.length<2||e[0].kind!=="text")return!1;for(let o=1;o<e.length;o++)if(e[o].kind==="number")return!0;return!1}function mr(e){return e?JSON.parse(JSON.stringify(e)):null}function Ia(e,o,l,n){if(!e)return null;const a=l-o+1,i={...e.range};return n?o<=i.endRow&&(o<=i.startRow&&(i.startRow+=a),i.endRow+=a):l<i.startRow?(i.startRow-=a,i.endRow-=a):o<=i.endRow&&(i.endRow-=Math.min(a,i.endRow-o+1),i.endRow<i.startRow&&(i.endRow=i.startRow)),{range:i,columns:e.columns}}function Aa(e,o,l,n){if(!e)return null;const a=l-o+1,i={...e.range},r={};if(n){o<=i.endCol&&(o<=i.startCol&&(i.startCol+=a),i.endCol+=a);for(const c in e.columns){const u=Number(c);r[u>=o?u+a:u]=e.columns[c]}}else{l<i.startCol?(i.startCol-=a,i.endCol-=a):o<=i.endCol&&(i.endCol-=Math.min(a,i.endCol-o+1),i.endCol<i.startCol&&(i.endCol=i.startCol));for(const c in e.columns){const u=Number(c);u>=o&&u<=l||(r[u>l?u-a:u]=e.columns[c])}}return{range:i,columns:r}}function La(e,o,l,n){if(o==="row"){const a=e.startRow,i=e.endRow;let r,c;if(i<l)r=a,c=i;else if(a>l+n-1)r=a-n,c=i-n;else if(r=a<l?a:l,c=i>l+n-1?i-n:l-1,c<r)return null;return{...e,startRow:r,endRow:c}}else{const a=e.startCol,i=e.endCol;let r,c;if(i<l)r=a,c=i;else if(a>l+n-1)r=a-n,c=i-n;else if(r=a<l?a:l,c=i>l+n-1?i-n:l-1,c<r)return null;return{...e,startCol:r,endCol:c}}}function za(e,o,l,n){if(o==="row"){const a=e.startRow,i=e.endRow;return a>=l?{...e,startRow:a+n,endRow:i+n}:i<l?e:{...e,endRow:i+n}}else{const a=e.startCol,i=e.endCol;return a>=l?{...e,startCol:a+n,endCol:i+n}:i<l?e:{...e,endCol:i+n}}}function V1(e,o,l){var a;const n=l-o+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],c=r.ranges.map(u=>La(u,"row",o,n)).filter(u=>u!==null);c.length===0?e.conditionalFormats.splice(i,1):r.ranges=c}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function D1(e,o,l){var a;const n=l-o+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>za(r,"row",o,n));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function F1(e,o,l){var a;const n=l-o+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],c=r.ranges.map(u=>La(u,"col",o,n)).filter(u=>u!==null);c.length===0?e.conditionalFormats.splice(i,1):r.ranges=c}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function O1(e,o,l){var a;const n=l-o+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>za(r,"col",o,n));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function $a(e,o,l,n){var a;for(let i=e.dataValidations.length-1;i>=0;i--){const r=e.dataValidations[i],c=(r.ranges??[]).map(u=>u1(u,o,l,n)).filter(u=>u!==null);c.length===0?e.dataValidations.splice(i,1):r.ranges=c}(a=e.invalidateDataValidationCache)==null||a.call(e)}function _a(e,o,l,n){var a;for(const i of e.dataValidations)i.ranges=(i.ranges??[]).map(r=>f1(r,o,l,n));(a=e.invalidateDataValidationCache)==null||a.call(e)}function I1(e,o,l,n,a){function i(z,$){const H=$-z+1,he=it(z,$),Ne=[],xe=[];for(const ce in e.cells){const Ze=ce.indexOf(",");if(Ze<0)continue;const ot=parseInt(ce.substring(0,Ze),10),E=parseInt(ce.substring(Ze+1),10);E>=z&&E<=$?xe.push(ce):E>$&&Ne.push({oldKey:ce,newKey:e.cellKey(ot,E-H),cell:e.cells[ce]})}for(const ce of xe)Reflect.deleteProperty(e.cells,ce);for(const ce of Ne)Reflect.deleteProperty(e.cells,ce.oldKey),e.cells[ce.newKey]=ce.cell;const He=e.rowHeights.value,Se=new Array(He.length);for(let ce=0;ce<z;ce++)Se[ce]=He[ce];for(let ce=z;ce<He.length-H;ce++)Se[ce]=He[ce+H];for(let ce=He.length-H;ce<He.length;ce++)Se[ce]=void 0;e.rowHeights.value=Se,K(he),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(Ia(e.getFilter(),z,$,!1)),V1(e,z,$),$a(e,"row",z,H),e.adjustOutlinesForDeleteRows(z,H)}function r(z,$){const H=$-z+1,he=e.rowCount,Ne=e.colCount,{lastRow:xe}=b();xe>=z&&xe+H>=he&&e.ensureCapacity(Ne-1,he-1+H);const He=e.rowCount,Se=D(z,$),ce=[];for(const E in e.cells){const y=E.indexOf(",");if(y<0)continue;const d=parseInt(E.substring(0,y),10),w=parseInt(E.substring(y+1),10);w>=z&&ce.push({oldKey:E,newKey:e.cellKey(d,w+H),cell:e.cells[E],oldRow:w})}ce.sort((E,y)=>y.oldRow-E.oldRow);for(const E of ce)Reflect.deleteProperty(e.cells,E.oldKey),e.cells[E.newKey]=E.cell;for(const E in e.cells){const y=E.indexOf(",");if(y<0)continue;const d=parseInt(E.substring(y+1),10);d>=z&&d<=$&&Reflect.deleteProperty(e.cells,E)}const Ze=e.rowHeights.value,ot=new Array(He);for(let E=0;E<z;E++)ot[E]=Ze[E];for(let E=z;E<=$;E++)ot[E]=void 0;for(let E=z;E<He;E++)ot[E+H]=Ze[E];e.rowHeights.value=ot,K(Se),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(Ia(e.getFilter(),z,$,!0)),D1(e,z,$),_a(e,"row",z,H),e.adjustOutlinesForInsertRows(z,H)}function c(z,$){const H=$-z+1,he=e.colCount,Ne=e.rowCount,{lastCol:xe}=b();xe>=z&&xe+H>=he&&e.ensureCapacity(he-1+H,Ne-1);const He=e.colCount,Se=W(z,$),ce=[];for(const E in e.cells){const y=E.indexOf(",");if(y<0)continue;const d=parseInt(E.substring(0,y),10),w=parseInt(E.substring(y+1),10);d>=z&&ce.push({oldKey:E,newKey:e.cellKey(d+H,w),cell:e.cells[E],oldCol:d})}ce.sort((E,y)=>y.oldCol-E.oldCol);for(const E of ce)Reflect.deleteProperty(e.cells,E.oldKey),e.cells[E.newKey]=E.cell;for(const E in e.cells){const y=E.indexOf(",");if(y<0)continue;const d=parseInt(E.substring(0,y),10);d>=z&&d<=$&&Reflect.deleteProperty(e.cells,E)}const Ze=e.colWidths.value,ot=new Array(He);for(let E=0;E<z;E++)ot[E]=Ze[E];for(let E=z;E<=$;E++)ot[E]=100;for(let E=z;E<He;E++)ot[E+H]=Ze[E];e.colWidths.value=ot,K(Se),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(Aa(e.getFilter(),z,$,!0)),O1(e,z,$),_a(e,"col",z,H),e.adjustOutlinesForInsertCols(z,H)}function u(z,$){const H=$-z+1,he=I(z,$),Ne=[],xe=[];for(const ce in e.cells){const Ze=ce.indexOf(",");if(Ze<0)continue;const ot=parseInt(ce.substring(0,Ze),10),E=parseInt(ce.substring(Ze+1),10);ot>=z&&ot<=$?xe.push(ce):ot>$&&Ne.push({oldKey:ce,newKey:e.cellKey(ot-H,E),cell:e.cells[ce]})}for(const ce of xe)Reflect.deleteProperty(e.cells,ce);for(const ce of Ne)Reflect.deleteProperty(e.cells,ce.oldKey),e.cells[ce.newKey]=ce.cell;const He=e.colWidths.value,Se=new Array(He.length);for(let ce=0;ce<z;ce++)Se[ce]=He[ce];for(let ce=z;ce<He.length-H;ce++)Se[ce]=He[ce+H];for(let ce=He.length-H;ce<He.length;ce++)Se[ce]=100;e.colWidths.value=Se,K(he),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(Aa(e.getFilter(),z,$,!1)),F1(e,z,$),$a(e,"col",z,H),e.adjustOutlinesForDeleteCols(z,H)}function b(){let z=-1,$=-1;for(const H in e.cells){const he=H.split(",");if(he.length===2){const Ne=parseInt(he[0],10),xe=parseInt(he[1],10),He=e.cells[H];He&&(He.value!==""||He.styleId!==void 0)&&(Ne>z&&(z=Ne),xe>$&&($=xe))}}for(let H=e.colCount-1;H>=0;H--){const he=e.colWidths.value[H];if(he!==void 0&&he!==100){H>z&&(z=H);break}}for(let H=e.rowCount-1;H>=0;H--)if(e.rowHeights.value[H]!==void 0){H>$&&($=H);break}return{lastCol:z,lastRow:$}}function h(z,$){const H=e.resolveStyle(e.cells[e.cellKey(z,$)]);return typeof(H==null?void 0:H.numberFormat)=="string"?H.numberFormat:""}function C(z,$,H){for(let he=$;he<=H;he++)if(e.getCellRaw(z,he).trim()!=="")return!0;return!1}function p(z){const{startRow:$,endRow:H,startCol:he,endCol:Ne}=z;let xe=he,He=Ne;for(;xe>0&&C(xe-1,$,H);)xe--;for(;He<e.colCount-1&&C(He+1,$,H);)He++;return{startRow:$,endRow:H,startCol:xe,endCol:He}}function x(z){const $=p(z);return $.startCol!==z.startCol||$.endCol!==z.endCol}function R(z,$,H,he=z){let Ne,xe;if(H)Ne=H.startRow,xe=H.endRow;else{const E=e.selection.value,y=!!E&&E.startRow===E.endRow&&E.startCol===E.endCol;Ne=y||!E?0:E.startRow,xe=y||!E?e.rowCount-1:E.endRow}let He=-1,Se=-1;for(let E=Ne;E<=xe;E++){let y=!1;for(let d=z;d<=$;d++)if(e.getCellRaw(d,E).trim()!==""){y=!0;break}y&&(He<0&&(He=E),Se=E)}if(He<0)return null;const ce=[];for(let E=He;E<=Se;E++){const y=e.getCellRaw(he,E);ce.push(Oa(y,h(he,E),e.locale.value))}const Ze=T1(ce)?He+1:He;let ot=!1;for(let E=He;E<=Se&&!ot;E++)for(let y=z;y<=$;y++){const d=e.cells[e.cellKey(y,E)];if(d&&d.value.startsWith("=")){ot=!0;break}}if(!ot)for(const E in e.merges){const y=e.merges[E];if(y&&y.startCol<=$&&y.endCol>=z&&y.startRow<=xe&&y.endRow>=Ne){ot=!0;break}}return{firstRow:He,lastRow:Se,sortStart:Ze,blocked:ot}}function O(z,$){const H=R(z,$);return!!H&&!H.blocked&&H.sortStart<H.lastRow}function X(z,$,H){var w,be;const he=$??e.selection.value;if(!he)return;const Ne=he.startCol,xe=he.endCol,He=H??Ne,Se=R(Ne,xe,{startRow:he.startRow,endRow:he.endRow},He);if(!Se||Se.blocked||Se.sortStart>=Se.lastRow)return;const ce=xe-Ne+1,Ze=Se.lastRow-Se.sortStart+1,ot=[],E=[];for(let ue=Se.sortStart;ue<=Se.lastRow;ue++){const Oe=new Array(ce);for(let bt=Ne;bt<=xe;bt++)Oe[bt-Ne]=e.cells[e.cellKey(bt,ue)]??null;ot.push(Oe);const qe=e.getCellRaw(He,ue);E.push(Oa(qe,h(He,ue),e.locale.value))}const y=x1(E,z,e.locale.value);let d=!1;for(let ue=0;ue<Ze;ue++)if(y[ue]!==ue){d=!0;break}if(d){o.saveUndo();for(let ue=0;ue<Ze;ue++){const Oe=ot[y[ue]],qe=Se.sortStart+ue;for(let bt=Ne;bt<=xe;bt++){const Ft=e.cellKey(bt,qe),Qt=Oe[bt-Ne],Tt=Qt?Qt.value:"",bl=(w=e.cells[Ft])==null?void 0:w.styleId;Tt!==""||bl!==void 0?e.cells[Ft]={value:Tt,styleId:bl}:e.delCell(Ft)}}bn();for(let ue=Se.sortStart;ue<=Se.lastRow;ue++)for(let Oe=Ne;Oe<=xe;Oe++)e.formulaDeps.markDirty(e.cellKey(Oe,ue));(be=e.scheduleRender)==null||be.call(e),de()}}const j=t.ref(!1),Ee=t.ref(null);function ae(z){const $=e.selection.value;if(!$||!x($))return!1;const H=p($);return Ee.value={order:z,originalRange:$,expandedRange:H},j.value=!0,!0}function ge(z){const $=Ee.value;if(!$)return;const{order:H,originalRange:he,expandedRange:Ne}=$;j.value=!1,Ee.value=null,X(H,z?Ne:he,he.startCol),se.value=H}function me(){j.value=!1,Ee.value=null}const pe=t.ref(!1),se=t.ref("asc");function Ve(z){pe.value=z,z&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,o.fontSizeMenuOpen.value=!1)}function tt(z){ae(z)||(se.value=z,X(z))}function Qe(){ae(se.value)||X(se.value)}function K(z){Object.keys(e.merges).forEach($=>Reflect.deleteProperty(e.merges,$));for(const $ of z)if(!($.newRange.startCol>$.newRange.endCol||$.newRange.startRow>$.newRange.endRow)&&(e.merges[$.newAnchorKey]={...$.newRange},$.anchorCell)){const H=$.anchorCell.value,he=$.anchorCell.styleId;H===""&&!he||(e.cells[$.newAnchorKey]={value:H,styleId:he||void 0})}}function it(z,$){const H=$-z+1,he=[];for(const Ne in e.merges){const xe=e.merges[Ne];if(!xe)continue;const He=e.cells[Ne]?{value:e.cells[Ne].value,styleId:e.cells[Ne].styleId??0}:{value:"",styleId:0},{startCol:Se,endCol:ce}=xe;let{startRow:Ze,endRow:ot}=xe;if(Ze>$){Ze-=H,ot-=H,he.push({newAnchorKey:e.cellKey(Se,Ze),newRange:{startCol:Se,startRow:Ze,endCol:ce,endRow:ot}});continue}if(ot<z){he.push({newAnchorKey:Ne,newRange:{startCol:Se,startRow:Ze,endCol:ce,endRow:ot}});continue}if(Ze>=z&&ot<=$||(Ze>=z&&Ze<=$&&(Ze=z),ot>=z&&ot<=$?ot=z-1:ot>$&&(ot-=H),Ze>ot))continue;const E=Se,y=Ze,d=e.cellKey(E,y),be=Ne.split(",").map(Number)[1],ue=be>=z&&be<=$||E!==xe.startCol||y!==be;he.push({newAnchorKey:d,newRange:{startCol:Se,startRow:Ze,endCol:ce,endRow:ot},anchorCell:ue?He:void 0})}return he}function I(z,$){const H=$-z+1,he=[];for(const Ne in e.merges){const xe=e.merges[Ne];if(!xe)continue;const He=e.cells[Ne]?{value:e.cells[Ne].value,styleId:e.cells[Ne].styleId??0}:{value:"",styleId:0};let{startCol:Se,endCol:ce}=xe;const{startRow:Ze,endRow:ot}=xe;if(Se>$){Se-=H,ce-=H,he.push({newAnchorKey:e.cellKey(Se,Ze),newRange:{startCol:Se,startRow:Ze,endCol:ce,endRow:ot}});continue}if(ce<z){he.push({newAnchorKey:Ne,newRange:{startCol:Se,startRow:Ze,endCol:ce,endRow:ot}});continue}if(Se>=z&&ce<=$||(Se>=z&&Se<=$&&(Se=z),ce>=z&&ce<=$?ce=z-1:ce>$&&(ce-=H),Se>ce))continue;const E=Se,y=Ze,d=e.cellKey(E,y),be=Ne.split(",").map(Number)[0],ue=be>=z&&be<=$||E!==be||y!==xe.startRow;he.push({newAnchorKey:d,newRange:{startCol:Se,startRow:Ze,endCol:ce,endRow:ot},anchorCell:ue?He:void 0})}return he}function D(z,$){const H=$-z+1,he=[];for(const Ne in e.merges){const xe=e.merges[Ne];if(!xe)continue;const{startCol:He,endCol:Se}=xe;let{startRow:ce,endRow:Ze}=xe;Ze<z?he.push({newAnchorKey:Ne,newRange:{startCol:He,startRow:ce,endCol:Se,endRow:Ze}}):ce<z?(Ze+=H,he.push({newAnchorKey:Ne,newRange:{startCol:He,startRow:ce,endCol:Se,endRow:Ze}})):(ce+=H,Ze+=H,he.push({newAnchorKey:e.cellKey(He,ce),newRange:{startCol:He,startRow:ce,endCol:Se,endRow:Ze}}))}return he}function W(z,$){const H=$-z+1,he=[];for(const Ne in e.merges){const xe=e.merges[Ne];if(!xe)continue;let{startCol:He,endCol:Se}=xe;const{startRow:ce,endRow:Ze}=xe;Se<z?he.push({newAnchorKey:Ne,newRange:{startCol:He,startRow:ce,endCol:Se,endRow:Ze}}):He<z?(Se+=H,he.push({newAnchorKey:Ne,newRange:{startCol:He,startRow:ce,endCol:Se,endRow:Ze}})):(He+=H,Se+=H,he.push({newAnchorKey:e.cellKey(He,ce),newRange:{startCol:He,startRow:ce,endCol:Se,endRow:Ze}}))}return he}let we=0;function $e(){return we++,`s_${we}`}function Z(z){if(!Array.isArray(z))return[];const $=[];for(const H of z){if(!H||typeof H!="object")continue;const he=H;if(!he.type||!Array.isArray(he.ranges)||he.ranges.length===0)continue;const Ne=he.ranges.filter(xe=>!!xe&&typeof xe.startCol=="number"&&typeof xe.startRow=="number"&&typeof xe.endCol=="number"&&typeof xe.endRow=="number").map(xe=>({startCol:Math.min(xe.startCol,xe.endCol),endCol:Math.max(xe.startCol,xe.endCol),startRow:Math.min(xe.startRow,xe.endRow),endRow:Math.max(xe.startRow,xe.endRow)}));Ne.length&&$.push({...he,id:he.id||`dv_${$.length}`,ranges:Ne})}return $}function Le(z,$){const H=Math.max(1,($==null?void 0:$.colCount)??e.colCount),he=Math.max(1,($==null?void 0:$.rowCount)??e.rowCount),Ne=new Array(H).fill(100),xe=new Array(he).fill(void 0);return{id:$e(),name:z,cells:{},merges:{},styles:[{}],borders:[{}],selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:Ne,rowHeights:xe,colCount:H,rowCount:he,freeze:{rows:0,cols:0},filter:null,conditionalFormats:[],dataValidations:[],rowOutlines:[],columnOutlines:[]}}const ie=t.ref([Le("Sheet1")]),De=t.ref(0);function N(){const z=ie.value[De.value];z&&(z.cells={...e.cells},z.merges={...e.merges},z.selection=e.selection.value?{...e.selection.value}:null,z.activeCell={...e.activeCell.value},z.scrollX=e.scrollX.value,z.scrollY=e.scrollY.value,z.colWidths=[...e.colWidths.value],z.rowHeights=[...e.rowHeights.value],z.styles=[...e.styles],z.borders=[...e.borders],z.colCount=e.colCount,z.rowCount=e.rowCount,z.freeze={rows:e.freeze.rows,cols:e.freeze.cols},z.filter=mr(e.getFilter()),z.conditionalFormats=[...e.conditionalFormats],z.dataValidations=[...e.dataValidations],z.rowOutlines=e.getRowOutlines(),z.columnOutlines=e.getColumnOutlines())}function J(z){var Ze,ot,E;const $=ie.value[z];if(!$)return;Object.keys(e.cells).forEach(y=>e.delCell(y)),Object.assign(e.cells,$.cells),Object.keys(e.merges).forEach(y=>Reflect.deleteProperty(e.merges,y)),$.merges&&Object.assign(e.merges,$.merges),e.selection.value=$.selection?{...$.selection}:null,e.activeCell.value={...$.activeCell};const H=e.activeCell.value,he=e.selection.value,Ne=e.findMerge(H.col,H.row);Ne&&Ne.anchor===e.cellKey(H.col,H.row)&&(!he||he.startCol===H.col&&he.startRow===H.row&&he.endCol===H.col&&he.endRow===H.row)&&e.selectCell(H.col,H.row),e.scrollX.value=$.scrollX,e.scrollY.value=$.scrollY,e.colWidths.value=[...$.colWidths],e.rowHeights.value=[...$.rowHeights];const xe=Math.max(1,$.colCount??e.colCount),He=Math.max(1,$.rowCount??e.rowCount);if((Ze=e.setDims)==null||Ze.call(e,xe,He),e.freeze.rows=Math.max(0,Math.min($.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min($.freeze.cols,e.colCount)),$.filter){const y=$.filter.range;e.setFilter({range:{startCol:Math.max(0,Math.min(y.startCol,e.colCount-1)),endCol:Math.max(0,Math.min(y.endCol,e.colCount-1)),startRow:Math.max(0,Math.min(y.startRow,e.rowCount-1)),endRow:Math.max(0,Math.min(y.endRow,e.rowCount-1))},columns:{...$.filter.columns}},!0)}else e.setFilter(null,!0);e.syncStyles($.styles),e.syncBorders($.borders??[{}]);const Se=$.conditionalFormats?$.conditionalFormats.map(y=>({...y,ranges:y.ranges.map(d=>({...d}))})):[];e.conditionalFormats.splice(0,e.conditionalFormats.length,...Se),(ot=e.invalidateConditionalFormatCache)==null||ot.call(e);const ce=Z($.dataValidations);e.dataValidations.splice(0,e.dataValidations.length,...ce),(E=e.invalidateDataValidationCache)==null||E.call(e),e.syncOutlines($.rowOutlines,$.columnOutlines),De.value=z}function le(z){z===De.value||z<0||z>=ie.value.length||(e.cancelEdit(),N(),J(z))}function re(z){return o.saveUndo(),e.cancelEdit(),N(),ie.value.push(Le(z??`Sheet${ie.value.length+1}`)),J(ie.value.length-1),ie.value.length-1}function ne(z){return ie.value.length<=1||(o.saveUndo(),e.cancelEdit(),ie.value.splice(z,1),J(Math.min(z,ie.value.length-1))),De.value}function ve(z,$){ie.value[z]&&$.trim()&&(o.saveUndo(),ie.value[z].name=$.trim())}function Ce(z){o.saveUndo(),e.cancelEdit(),N();const $=ie.value[z];if(!$)return z;let H=$.name;const he=H.match(/^(.*?)\s*\((\d+)\)$/);let Ne=he?parseInt(he[2],10)+1:2;he&&(H=he[1]);let xe=`${H} (${Ne})`;const He=new Set(ie.value.map(ce=>ce.name));for(;He.has(xe);)Ne++,xe=`${H} (${Ne})`;const Se={id:$e(),name:xe,cells:{...$.cells},merges:$.merges?{...$.merges}:{},styles:[...$.styles],borders:$.borders?[...$.borders]:[{}],selection:$.selection?{...$.selection}:null,activeCell:$.activeCell?{...$.activeCell}:{col:0,row:0},scrollX:$.scrollX,scrollY:$.scrollY,colWidths:[...$.colWidths],rowHeights:[...$.rowHeights],colCount:$.colCount,rowCount:$.rowCount,freeze:{...$.freeze},filter:mr($.filter),conditionalFormats:$.conditionalFormats?$.conditionalFormats.map(ce=>({...ce})):[],dataValidations:Z($.dataValidations),rowOutlines:$.rowOutlines?$.rowOutlines.map(ce=>({...ce})):[],columnOutlines:$.columnOutlines?$.columnOutlines.map(ce=>({...ce})):[]};return ie.value.splice(z+1,0,Se),J(z+1),z+1}function _(z,$){var xe;const H=z+$;if(H<0||H>=ie.value.length)return;o.saveUndo();const he=De.value,Ne=ie.value.splice(z,1)[0];ie.value.splice(H,0,Ne),he===z?De.value=H:z<he&&H>=he?De.value=he-1:z>he&&H<=he&&(De.value=he+1),(xe=e.scheduleRender)==null||xe.call(e)}const L=t.computed(()=>ie.value.length);let U="";const q=l;function de(){N();const z=ie.value.map(H=>{const he={};for(const[Se,ce]of Object.entries(H.cells))he[Se]={value:ce.value},ce.styleId&&ce.styleId>0&&(he[Se].styleId=ce.styleId);const Ne={name:H.name,cells:he};H.styles&&H.styles.length>1&&(Ne.styles=[...H.styles]),H.borders&&H.borders.length>1&&(Ne.borders=[...H.borders]),H.merges&&Object.keys(H.merges).length&&(Ne.merges={...H.merges});const xe={};for(let Se=0;Se<H.colWidths.length;Se++)H.colWidths[Se]!==100&&(xe[Se]=H.colWidths[Se]);Object.keys(xe).length&&(Ne.colWidths=xe);const He={};for(let Se=0;Se<H.rowHeights.length;Se++){const ce=H.rowHeights[Se];ce!=null&&(He[Se]=ce)}return Object.keys(He).length&&(Ne.rowHeights=He),H.colCount!==26&&(Ne.colCount=H.colCount),H.rowCount!==200&&(Ne.rowCount=H.rowCount),(H.freeze.rows!==0||H.freeze.cols!==0)&&(Ne.freeze={rows:H.freeze.rows,cols:H.freeze.cols}),H.filter&&(Ne.filter=mr(H.filter)),H.conditionalFormats&&H.conditionalFormats.length&&(Ne.conditionalFormats=H.conditionalFormats.map(Se=>({...Se}))),H.dataValidations&&H.dataValidations.length&&(Ne.dataValidations=H.dataValidations.map(Se=>({...Se,ranges:Se.ranges.map(ce=>({...ce}))}))),H.rowOutlines&&H.rowOutlines.length&&(Ne.rowOutlines=H.rowOutlines.map(Se=>({...Se}))),H.columnOutlines&&H.columnOutlines.length&&(Ne.columnOutlines=H.columnOutlines.map(Se=>({...Se}))),Ne}),$=JSON.stringify(z);$!==U&&(U=$,q.value=z,a&&(a.value=$))}e.emitModelData=de;let ze=!1;function Re(){ze||(ze=!0,Promise.resolve().then(()=>{ze=!1,de()}))}const Pe=t.computed(()=>e.props.theme==="dark"?ri:oi),lt=t.computed(()=>B1(Pe.value,e.props.width,e.props.height,Bn)),_e=t.computed(()=>{const z={};for(const[$,H]of Object.entries(lt.value))$.startsWith("--")&&(z[$]=H);return z}),Ct=t.ref(null),st=t.ref(null),ct=t.ref(null),Vt=t.ref(null),$t=t.ref(null),_t=t.reactive({w:800,h:600});e.viewSize&&t.watch(_t,z=>{e.viewSize&&(e.viewSize.w=z.w,e.viewSize.h=z.h)},{deep:!0});const Ht=48,Xe=28,S=11,ee=()=>Ht+e.getOutlineGutterSize("row"),xt=()=>Xe+e.getOutlineGutterSize("column"),Dt=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,_t.w-ee()-S))),tl=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,_t.h-xt()-S)));function gl(z,$){const H=Math.max(0,_t.w-ee()-S),he=Math.max(0,_t.h-xt()-S),Ne=z??e.scrollX.value,xe=$??e.scrollY.value,He=40,Se=Math.max(0,e.totalWidth.value-H),ce=Math.max(0,e.totalHeight.value-he);if(Ne>=Se-He&&Ne>e.scrollX.value||xe>=ce-He&&xe>e.scrollY.value){const Ze=Math.max(0,Math.ceil((Ne+H)/100)+2),ot=Math.max(0,Math.ceil((xe+he)/24)+2);e.ensureCapacity(Ze,ot)}e.scrollX.value=Math.max(0,Math.min(Ne,Math.max(0,e.totalWidth.value-H))),e.scrollY.value=Math.max(0,Math.min(xe,Math.max(0,e.totalHeight.value-he)))}e.clampScroll=gl;function jt(){var z;return typeof window>"u"?!1:!((z=window.matchMedia)!=null&&z.call(window,"(hover: none) and (pointer: coarse)").matches)}function Kt(z=!1){t.nextTick(()=>{const $=Vt.value;if($){if(!e.editingCell.value&&!jt()){document.activeElement===$&&$.blur();return}$.focus({preventScroll:!0}),z&&$.select()}})}function Zt(){Kt()}function jl(){var $;const z=e.selection.value;if(z){o.saveUndo();for(let H=z.startRow;H<=z.endRow;H++)e.rowHeights.value[H]=void 0;($=e.scheduleRender)==null||$.call(e),de()}}function Zl(){var $;const z=e.selection.value;if(z){o.saveUndo();for(let H=z.startCol;H<=z.endCol;H++)e.colWidths.value[H]=100;($=e.scheduleRender)==null||$.call(e),de()}}return{deleteRows:i,insertRows:r,insertCols:c,deleteCols:u,sortSelectedColumns:X,canSortColumns:O,sortMenuOpen:pe,cachedSortOrder:se,onSortMenuToggle:Ve,onSortChange:tt,applyCachedSort:Qe,sortConfirmOpen:j,prepareSortConfirmation:ae,confirmSort:ge,cancelSortConfirmation:me,sheets:ie,activeSheetIndex:De,saveSheet:N,loadSheet:J,switchSheet:le,addSheet:re,removeSheet:ne,renameSheet:ve,dupSheet:Ce,moveSheet:_,sheetCount:L,mkSheet:Le,emitModelData:de,scheduleOptEmit:Re,themeColors:Pe,outerStyle:lt,toolbarThemeVars:_e,wrapperRef:Ct,canvasRef:st,freezeCanvasRef:ct,editInputRef:Vt,formulaBarRef:$t,viewSize:_t,maxScrollX:Dt,maxScrollY:tl,clampScroll:gl,canFocusHiddenEditor:jt,focusEditInput:Kt,onCanvasFocus:Zt,resetRowHeight:jl,resetColWidth:Zl,modelData:q}}function Ha(e){return!!e&&e.width!==void 0&&e.width>0}function Gt(e,o,l,n){const a=Ha(e),i=Ha(o);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return o;const r=e.width??0,c=o.width??0;return r>c?e:c>r?o:e}function Wa(e,o){if(!e||typeof e!="object")return null;const l=e,n=l.columns??{},a=Object.keys(n).map(r=>Number(r)).filter(r=>!Number.isNaN(r));if(!l.range||typeof l.range.startRow!="number"){const r=a.length?Math.min(...a):0,c=a.length?Math.max(...a):0;let u=0;for(const b in o){const h=b.indexOf(",");if(h<0)continue;const C=parseInt(b.substring(h+1),10);C>u&&(u=C)}return{range:{startCol:r,startRow:0,endCol:c,endRow:Math.max(0,u)},columns:n}}const i={...l.range};for(const r of a)r<i.startCol&&(i.startCol=r),r>i.endCol&&(i.endCol=r);return{range:i,columns:n}}function A1(e,o,l,n,a){let i=!1,r=null,c=1,u,b=()=>{},h=()=>{},C=()=>{};function p(){i||(i=!0,requestAnimationFrame(()=>{i=!1,it(),I()}))}e.scheduleRender=p;function x(m){const{frozenColumnsWidth:v}=e.getFrozenMetrics(),T=v>0&&m<se()+v?m-se():m-se()+e.scrollX.value;return e.hitCol(T)}function R(m){const{frozenRowsHeight:v}=e.getFrozenMetrics(),T=v>0&&m<Ve()+v?m-Ve():m-Ve()+e.scrollY.value;return e.hitRow(T)}const O="#444",X=14,j=9,Ee=16,ae=Math.min(j-1,9);function ge(m){return 0}const me=()=>ge(),pe=()=>ge(),se=()=>52+me(),Ve=()=>24+pe();function tt(m,v){return Ee+2+(v-m.level)*j}function Qe(m,v){return 3+(v-m.level)*j}function K(m,v){const T=new Int8Array(v).fill(-1);if(!m.length)return T;const G=[...m].sort((P,Y)=>P.start-Y.start),F=new Map;G.forEach((P,Y)=>F.set(P.id,Y%2));for(const P of G){const Y=F.get(P.id),Q=Math.min(P.end,v-1);for(let te=Math.max(0,P.start);te<=Q;te++)T[te]===-1&&(T[te]=Y)}return T}function it(){const m=n.wrapperRef.value,v=n.canvasRef.value;if(!m||!v||(r=v.getContext("2d"),!r))return;c=window.devicePixelRatio||1;const T=m.getBoundingClientRect(),G=T.width,F=T.height;n.viewSize.w=G,n.viewSize.h=F,v.width=G*c,v.height=F*c,v.style.width=G+"px",v.style.height=F+"px",r.setTransform(c,0,0,c,0,0);const P=e.scrollX.value,Y=e.scrollY.value,Q=52,te=24,Fe=me(),Me=pe(),M=Q+Fe,s=te+Me,f=n.themeColors.value,k=e.getFilter(),B=e.colPositions.value,V=e.rowPositions.value,oe=K(e.getRowOutlines(),e.rowCount),fe=K(e.getColumnOutlines(),e.colCount),{frozenRowsHeight:ke,frozenColumnsWidth:Be}=e.getFrozenMetrics(),We=M+Be,Ue=s+ke,rt=Math.max(0,G-M-11-Be),Ye=Math.max(0,F-s-11-ke),gt=Math.max(0,e.freeze.cols-1),Et=Math.max(0,e.freeze.rows-1),qt=Math.max(e.freeze.cols,e.hitCol(Be+P));let Wt=qt;for(let A=qt;A<e.colCount&&!(M+B[A]-P>=G);A++)Wt=A;const El=Math.max(e.freeze.rows,e.hitRow(ke+Y));let Rl=El;for(let A=El;A<e.rowCount&&!(s+V[A]-Y>=F);A++)Rl=A;let dl=qt,Sl=Wt,ul=El,ol=Rl;Be>0&&(dl=0,Sl=Math.max(Sl,gt)),ke>0&&(ul=0,ol=Math.max(ol,Et));let _l=dl,Fl=ul;for(const A in e.merges){const Ae=e.merges[A];Ae&&(Ae.startRow>ol||Ae.endRow<ul||Ae.startCol>Sl||Ae.endCol<dl||(Ae.startCol<_l&&(_l=Ae.startCol),Ae.startRow<Fl&&(Fl=Ae.startRow)))}const Ln=new Array(Fl);for(let A=Fl;A<=ol;A++)Ln[A]=V[A+1]-V[A];r.fillStyle=f.bg,r.fillRect(0,0,G,F),r.fillStyle=f.gridBg,r.fillRect(M,s,G-M,F-s);const St=e.selection.value,mt=e.editingCell.value;b=(A,Ae,Ke,wt,Ot,Jt)=>{const kt=e.dataValidations.length>0;for(let Te=wt;Te<=Ot;Te++)if(!e.isRowCollapsed(Te))for(let Ge=Ae;Ge<=Ke;Ge++){if(e.isColumnCollapsed(Ge)||e.findMerge(Ge,Te))continue;const et=e.cellToScreenRect(Te,Ge),je=et.x,ht=et.y,ut=et.width,at=et.height;if(je+ut<M||ht+at<s||je>G||ht>F)continue;const zt=e.findHighlight?e.findHighlight(Ge,Te):null,Ut=e.resolveStyle(e.cells[e.cellKey(Ge,Te)]),Nt=typeof(Ut==null?void 0:Ut.backgroundColor)=="string"?Ut.backgroundColor:"";Nt&&(A.fillStyle=Nt,A.fillRect(je,ht,ut,at));const ft=e.resolveConditionalFormat(Ge,Te);if(ft!=null&&ft.backgroundColor&&(A.fillStyle=ft.backgroundColor,A.fillRect(je,ht,ut,at)),zt&&(A.fillStyle=zt==="active"?f.findActiveBg:f.findMatchBg,A.fillRect(je,ht,ut,at)),e.isSelected(Ge,Te)&&(A.fillStyle=f.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?A.fillRect(je,ht,(B[Ge+1]??0)-B[Ge],Jt[Te]):A.fillRect(je,ht,ut,at)),e.activeCell.value.col===Ge&&e.activeCell.value.row===Te&&(A.strokeStyle=f.activeCellBorder,A.lineWidth=2,A.strokeRect(je+1,ht+1,ut-2,at-2)),zt==="active"&&(A.strokeStyle=f.findActiveBg,A.lineWidth=2,A.strokeRect(je+1,ht+1,ut-2,at-2)),A.strokeStyle=f.gridLine,A.lineWidth=.5,A.strokeRect(je+.25,ht+.25,ut-.5,at-.5),!(mt&&mt.col===Ge&&mt.row===Te)){const Ie=e.resolveStyle(e.cells[e.cellKey(Ge,Te)]),ye=e.getCellValue(Ge,Te),nt=typeof(Ie==null?void 0:Ie.numberFormat)=="string"?Ie.numberFormat:"",Je=ye?Il(ye,nt,e.locale.value):"";if(Je){const yt=e.cellFontSize(Ge,Te),Rt=typeof(Ie==null?void 0:Ie.fontFamily)=="string"&&Ie.fontFamily?Ie.fontFamily:Mn,Pt=(Ie==null?void 0:Ie.fontWeight)==="bold"||(ft==null?void 0:ft.fontWeight)==="bold"?"bold":"normal",fl=(Ie==null?void 0:Ie.fontStyle)==="italic"||(ft==null?void 0:ft.fontStyle)==="italic"?"italic":"normal",Ul=(Ie==null?void 0:Ie.underline)==="underline"||(ft==null?void 0:ft.underline)==="underline",tn=(Ie==null?void 0:Ie.strikethrough)==="line-through"||(ft==null?void 0:ft.strikethrough)==="line-through",ml=(ft==null?void 0:ft.color)||(typeof(Ie==null?void 0:Ie.color)=="string"?Ie.color:""),Ol=typeof(Ie==null?void 0:Ie.textAlign)=="string"?Ie.textAlign:Xo(ye,nt)?"right":"left",pl=typeof(Ie==null?void 0:Ie.verticalAlign)=="string"?Ie.verticalAlign:"top";A.fillStyle=ml||f.cellText,A.font=`${fl} ${Pt} ${yt}px ${Rt}`,A.textBaseline="alphabetic",A.save(),A.beginPath(),A.rect(je+5,ht+1,ut-10,at-2),A.clip();const ln=(Ie==null?void 0:Ie.wrap)==="wrap";let rl=ut-10;k&&Te===k.range.startRow&&Ge>=k.range.startCol&&Ge<=k.range.endCol&&(rl=ut-10-Ct);let Ml=Je;const Bl=!ln&&_r(nt),Pl=Je===wo||Hr(ye,nt);if(Pl||Bl){if(Pl){const $n=Math.max(1,A.measureText("#").width),Co=Math.max(1,Math.floor(rl/$n));Ml="#".repeat(Co)}else if(e.getWrappedLines(A,Je,1e9,!1).some(pn=>pn&&A.measureText(pn).width>rl)){const pn=Math.max(1,A.measureText("#").width),to=Math.max(1,Math.floor(rl/pn));Ml="#".repeat(to)}}const il=e.getWrappedLines(A,Ml,rl,ln),{ascent:mn,descent:eo}=e.measureFontMetrics(Rt,yt,Pt,fl),Wo=mn+eo,ip=il.length*Wo;let Uo;pl==="middle"?Uo=ht+(at-ip)/2+mn:pl==="bottom"?Uo=ht+at-e.BASE_CELL_VPAD-eo-(il.length-1)*Wo:Uo=ht+e.BASE_CELL_VPAD+mn;for(let $n=0;$n<il.length;$n++){const Co=il[$n],pn=Uo+$n*Wo,to=A.measureText(Co);let Sn;if(Ol==="center"?Sn=je+ut/2-to.width/2:Ol==="right"?Sn=je+ut-5-to.width:Sn=je+5,A.fillText(Co,Sn,pn),Ul&&(A.strokeStyle=ml||f.cellText,A.lineWidth=1,A.beginPath(),A.moveTo(Sn,pn+eo+1),A.lineTo(Sn+to.width,pn+eo+1),A.stroke()),tn){A.strokeStyle=ml||f.cellText,A.lineWidth=1;const Ga=pn-mn+Wo*.42;A.beginPath(),A.moveTo(Sn,Ga),A.lineTo(Sn+to.width,Ga),A.stroke()}}A.restore()}}if(k&&Te===k.range.startRow&&Ge>=k.range.startCol&&Ge<=k.range.endCol&&xt(A,je,ht,ut,at,ra(k.columns[Ge]),f),kt&&e.getListValidation(Te,Ge)){const Ie=e.activeCell.value.col===Ge&&e.activeCell.value.row===Te;_t(A,je,ht,ut,at,Ie||e.isSelected(Ge,Te),f)}}};const vt=(A,Ae,Ke)=>{const wt=e.findMerge(A,Ae);return wt?e.getCellBorderSide(e.cells[wt.anchor],Ke):e.getCellBorderSide(e.cells[e.cellKey(A,Ae)],Ke)};h=(A,Ae,Ke,wt,Ot,Jt)=>{A.fillStyle=O;for(let kt=wt;kt<=Ot;kt++)if(!e.isRowCollapsed(kt))for(let Te=Ae;Te<=Ke;Te++){if(e.isColumnCollapsed(Te)||e.findMerge(Te,kt))continue;const dt=e.cellToScreenRect(kt,Te),et=dt.x,je=dt.y,ht=dt.width,ut=dt.height;if(et+ht<M||je+ut<s||et>G||je>F)continue;const at=e.cells[e.cellKey(Te,kt)],zt={top:e.getCellBorderSide(at,"top"),right:e.getCellBorderSide(at,"right"),bottom:e.getCellBorderSide(at,"bottom"),left:e.getCellBorderSide(at,"left")},Ut={top:vt(Te,kt-1,"bottom"),left:vt(Te-1,kt,"right"),bottom:vt(Te,kt+1,"top"),right:vt(Te+1,kt,"left")},Nt=Gt(Ut.top,zt.top),ft=Gt(Ut.left,zt.left),Ie=Gt(zt.bottom,Ut.bottom),ye=Gt(zt.right,Ut.right),nt=(Nt==null?void 0:Nt.width)??0,Je=(ft==null?void 0:ft.width)??0,yt=(Ie==null?void 0:Ie.width)??0,Rt=(ye==null?void 0:ye.width)??0;nt>0&&(A.fillStyle=(Nt==null?void 0:Nt.color)||O,A.fillRect(et,je,ht,nt)),yt>0&&(A.fillStyle=(Ie==null?void 0:Ie.color)||O,A.fillRect(et,je+ut-yt,ht,yt)),Je>0&&(A.fillStyle=(ft==null?void 0:ft.color)||O,A.fillRect(et,je,Je,ut)),Rt>0&&(A.fillStyle=(ye==null?void 0:ye.color)||O,A.fillRect(et+ht-Rt,je,Rt,ut));const Pt=Te>0&&e.isColumnCollapsed(Te-1),fl=Te<e.colCount-1&&e.isColumnCollapsed(Te+1),Ul=kt>0&&e.isRowCollapsed(kt-1),tn=kt<e.rowCount-1&&e.isRowCollapsed(kt+1),ml=Te<e.freeze.cols&&(()=>{try{const pl=A.canvas;return pl?String(pl.className||"")==="grid-canvas":!1}catch{return!1}})(),Ol=kt<e.freeze.rows&&(()=>{try{const pl=A.canvas;return pl?String(pl.className||"")==="grid-canvas":!1}catch{return!1}})();nt>0&&Je>0&&!Pt&&!Ul&&(A.fillStyle=(Nt==null?void 0:Nt.color)||(ft==null?void 0:ft.color)||O,A.fillRect(et-Je,je-nt,Je,nt)),nt>0&&Rt>0&&!fl&&!Ul&&!ml&&(A.fillStyle=(Nt==null?void 0:Nt.color)||(ye==null?void 0:ye.color)||O,A.fillRect(et+ht,je-nt,Rt,nt)),yt>0&&Je>0&&!Pt&&!tn&&!Ol&&(A.fillStyle=(Ie==null?void 0:Ie.color)||(ft==null?void 0:ft.color)||O,A.fillRect(et-Je,je+ut,Je,yt)),yt>0&&Rt>0&&!fl&&!tn&&!ml&&!Ol&&(A.fillStyle=(Ie==null?void 0:Ie.color)||(ye==null?void 0:ye.color)||O,A.fillRect(et+ht,je+ut,Rt,yt))}};const Hl=(A,Ae,Ke,wt,Ot,Jt,kt)=>{const Te=e.resolveStyle(e.cells[e.cellKey(Ae,Ke)]),Ge=e.getCellValue(Ae,Ke),dt=typeof(Te==null?void 0:Te.numberFormat)=="string"?Te.numberFormat:"",et=Ge?Il(Ge,dt,e.locale.value):"";if(!et||wt-10<=0||Ot-2<=0)return;const ht=e.cellFontSize(Ae,Ke),ut=typeof(Te==null?void 0:Te.fontFamily)=="string"&&Te.fontFamily?Te.fontFamily:Mn,at=e.resolveConditionalFormat(Ae,Ke),zt=(Te==null?void 0:Te.fontWeight)==="bold"||(at==null?void 0:at.fontWeight)==="bold"?"bold":"normal",Ut=(Te==null?void 0:Te.fontStyle)==="italic"||(at==null?void 0:at.fontStyle)==="italic"?"italic":"normal",Nt=(Te==null?void 0:Te.underline)==="underline"||(at==null?void 0:at.underline)==="underline",ft=(Te==null?void 0:Te.strikethrough)==="line-through"||(at==null?void 0:at.strikethrough)==="line-through",Ie=(at==null?void 0:at.color)||(typeof(Te==null?void 0:Te.color)=="string"?Te.color:""),ye=typeof(Te==null?void 0:Te.textAlign)=="string"?Te.textAlign:Xo(Ge,dt)?"right":"left",nt=typeof(Te==null?void 0:Te.verticalAlign)=="string"?Te.verticalAlign:"top";A.fillStyle=Ie||f.cellText,A.font=`${Ut} ${zt} ${ht}px ${ut}`,A.textBaseline="alphabetic",A.save(),A.beginPath(),A.rect(Jt+5,kt+1,wt-10,Ot-2),A.clip();const Je=(Te==null?void 0:Te.wrap)==="wrap",yt=wt-10;let Rt=et;const Pt=!Je&&_r(dt),fl=et===wo||Hr(Ge,dt);if(fl||Pt){if(fl){const rl=Math.max(1,A.measureText("#").width),Ml=Math.max(1,Math.floor(yt/rl));Rt="#".repeat(Ml)}else if(e.getWrappedLines(A,et,1e9,!1).some(Bl=>Bl&&A.measureText(Bl).width>yt)){const Bl=Math.max(1,A.measureText("#").width),Pl=Math.max(1,Math.floor(yt/Bl));Rt="#".repeat(Pl)}}const Ul=e.getWrappedLines(A,Rt,yt,Je),{ascent:tn,descent:ml}=e.measureFontMetrics(ut,ht,zt,Ut),Ol=tn+ml,pl=Ul.length*Ol;let ln;nt==="middle"?ln=kt+(Ot-pl)/2+tn:nt==="bottom"?ln=kt+Ot-e.BASE_CELL_VPAD-ml-(Ul.length-1)*Ol:ln=kt+e.BASE_CELL_VPAD+tn;for(let rl=0;rl<Ul.length;rl++){const Ml=Ul[rl],Bl=ln+rl*Ol,Pl=A.measureText(Ml);let il;if(ye==="center"?il=Jt+wt/2-Pl.width/2:ye==="right"?il=Jt+wt-5-Pl.width:il=Jt+5,A.fillText(Ml,il,Bl),Nt&&(A.strokeStyle=Ie||f.cellText,A.lineWidth=1,A.beginPath(),A.moveTo(il,Bl+ml+1),A.lineTo(il+Pl.width,Bl+ml+1),A.stroke()),ft){A.strokeStyle=Ie||f.cellText,A.lineWidth=1;const mn=Bl-tn+Ol*.42;A.beginPath(),A.moveTo(il,mn),A.lineTo(il+Pl.width,mn),A.stroke()}}A.restore()},Wl=(A,Ae,Ke,wt,Ot,Jt,kt,Te)=>{const Ge=Ae.startCol,dt=Ae.endCol,et=Ae.startRow,je=Ae.endRow,ht=wt,ut=Jt,at=kt&&dt+1===e.freeze.cols&&e.freeze.cols<e.colCount&&e.isColumnCollapsed(e.freeze.cols),zt=kt&&dt>=e.freeze.cols||at,Ut=Te&&je+1===e.freeze.rows&&e.freeze.rows<e.rowCount&&e.isRowCollapsed(e.freeze.rows),Nt=Te&&je>=e.freeze.rows||Ut,ft=e.cells[e.cellKey(Ge,et)],Ie={top:e.getCellBorderSide(ft,"top"),right:e.getCellBorderSide(ft,"right"),bottom:e.getCellBorderSide(ft,"bottom"),left:e.getCellBorderSide(ft,"left")};A.fillStyle=O;for(let ye=Ge;ye<=dt;ye++){if(kt&&ye>=e.freeze.cols||e.isSameMergeInternal(ye,et-1,ye,et))continue;const nt=vt(ye,et-1,"bottom"),Je=Gt(nt,Ie.top);if(Je&&Je.width&&Je.width>0){const yt=ye<e.freeze.cols?Q+B[ye]:Q+B[ye]-P;A.fillStyle=Je.color||O,A.fillRect(yt,ht,(B[ye+1]??0)-B[ye],Je.width)}}if(!Nt)for(let ye=Ge;ye<=dt;ye++){if(kt&&ye>=e.freeze.cols||e.isSameMergeInternal(ye,je,ye,je+1))continue;const nt=vt(ye,je+1,"top"),Je=Gt(Ie.bottom,nt);if(Je&&Je.width&&Je.width>0){const yt=ye<e.freeze.cols?Q+B[ye]:Q+B[ye]-P;A.fillStyle=Je.color||O,A.fillRect(yt,ht+ut-Je.width,(B[ye+1]??0)-B[ye],Je.width)}}for(let ye=et;ye<=je;ye++){if(Te&&ye>=e.freeze.rows||e.isSameMergeInternal(Ge-1,ye,Ge,ye))continue;const nt=vt(Ge-1,ye,"right"),Je=Gt(nt,Ie.left);if(Je&&Je.width&&Je.width>0){const yt=ye<e.freeze.rows?te+V[ye]:te+V[ye]-Y,Rt=V[ye+1]-V[ye];A.fillStyle=Je.color||O,A.fillRect(Ke,yt,Je.width,Rt)}}if(!zt)for(let ye=et;ye<=je;ye++){if(Te&&ye>=e.freeze.rows||e.isSameMergeInternal(dt,ye,dt+1,ye))continue;const nt=vt(dt+1,ye,"left"),Je=Gt(Ie.right,nt);if(Je&&Je.width&&Je.width>0){const yt=ye<e.freeze.rows?te+V[ye]:te+V[ye]-Y,Rt=V[ye+1]-V[ye];A.fillStyle=Je.color||O,A.fillRect(Ke+Ot-Je.width,yt,Je.width,Rt)}}{const ye=e.isSameMergeInternal(Ge,et-1,Ge,et)?Ie.top:Gt(vt(Ge,et-1,"bottom"),Ie.top),nt=e.isSameMergeInternal(Ge-1,et,Ge,et)?Ie.left:Gt(vt(Ge-1,et,"right"),Ie.left),Je=(ye==null?void 0:ye.width)??0,yt=(nt==null?void 0:nt.width)??0,Rt=Ge>0&&e.isColumnCollapsed(Ge-1),Pt=et>0&&e.isRowCollapsed(et-1);Je>0&&yt>0&&!Rt&&!Pt&&(A.fillStyle=(ye==null?void 0:ye.color)||(nt==null?void 0:nt.color)||O,A.fillRect(Ke-yt,wt-Je,yt,Je))}if(!zt){const ye=e.isSameMergeInternal(dt,et-1,dt,et)?Ie.top:Gt(vt(dt,et-1,"bottom"),Ie.top),nt=e.isSameMergeInternal(dt,et,dt+1,et)?Ie.right:Gt(Ie.right,vt(dt+1,et,"left")),Je=(ye==null?void 0:ye.width)??0,yt=(nt==null?void 0:nt.width)??0,Rt=dt<e.colCount-1&&e.isColumnCollapsed(dt+1),Pt=et>0&&e.isRowCollapsed(et-1);Je>0&&yt>0&&!Rt&&!Pt&&(A.fillStyle=(ye==null?void 0:ye.color)||(nt==null?void 0:nt.color)||O,A.fillRect(Ke+Ot,wt-Je,yt,Je))}if(!Nt){const ye=e.isSameMergeInternal(Ge,je,Ge,je+1)?Ie.bottom:Gt(Ie.bottom,vt(Ge,je+1,"top")),nt=e.isSameMergeInternal(Ge-1,je,Ge,je)?Ie.left:Gt(vt(Ge-1,je,"right"),Ie.left),Je=(ye==null?void 0:ye.width)??0,yt=(nt==null?void 0:nt.width)??0,Rt=Ge>0&&e.isColumnCollapsed(Ge-1),Pt=je<e.rowCount-1&&e.isRowCollapsed(je+1);Je>0&&yt>0&&!Rt&&!Pt&&(A.fillStyle=(ye==null?void 0:ye.color)||(nt==null?void 0:nt.color)||O,A.fillRect(Ke-yt,wt+Jt,yt,Je))}if(!zt&&!Nt){const ye=e.isSameMergeInternal(dt,je,dt,je+1)?Ie.bottom:Gt(Ie.bottom,vt(dt,je+1,"top")),nt=e.isSameMergeInternal(dt,je,dt+1,je)?Ie.right:Gt(Ie.right,vt(dt+1,je,"left")),Je=(ye==null?void 0:ye.width)??0,yt=(nt==null?void 0:nt.width)??0,Rt=dt<e.colCount-1&&e.isColumnCollapsed(dt+1),Pt=je<e.rowCount-1&&e.isRowCollapsed(je+1);Je>0&&yt>0&&!Rt&&!Pt&&(A.fillStyle=(ye==null?void 0:ye.color)||(nt==null?void 0:nt.color)||O,A.fillRect(Ke+Ot,wt+Jt,yt,Je))}};C=(A,Ae,Ke,wt,Ot)=>{var dt,et;const Jt=Ae+wt,kt=Ke+Ot,Te=Ae<We,Ge=Ke<Ue;for(const je in e.merges){const ht=e.merges[je];if(!ht)continue;const ut=ht.startCol,at=ht.startRow,zt=ht.endCol,Ut=ht.endRow,Nt=e.cellToScreenRect(at,ut),ft=e.cellToScreenRect(Ut,zt),Ie=Nt.x,ye=Nt.y,nt=ft.x+ft.width-Ie,Je=ft.y+ft.height-ye,yt=Te&&zt>=e.freeze.cols?Math.min(Jt,We):Math.min(Ie+nt,Jt),Rt=Ge&&Ut>=e.freeze.rows?Math.min(kt,Ue):Math.min(ye+Je,kt),Pt=Math.max(Ie,Ae),fl=Math.max(ye,Ke);if(yt<=Pt||Rt<=fl)continue;const Ul=(dt=e.resolveStyle(e.cells[e.cellKey(ut,at)]))==null?void 0:dt.backgroundColor,ml=((et=e.resolveConditionalFormat(ut,at))==null?void 0:et.backgroundColor)||Ul;ml&&(A.fillStyle=ml,A.fillRect(Pt,fl,yt-Pt,Rt-fl)),e.isSelected(ut,at)&&(A.fillStyle=f.selectionBg,A.fillRect(Pt,fl,yt-Pt,Rt-fl)),A.strokeStyle=f.gridLine,A.lineWidth=.5;const Ol=Ie+.25,pl=ye+.25,ln=yt-Ie-.5,rl=Rt-ye-.5;if(ln>0&&rl>0&&A.strokeRect(Ol,pl,ln,rl),Wl(A,ht,Ie,ye,nt,Je,Te,Ge),e.activeCell.value.col===ut&&e.activeCell.value.row===at&&(A.strokeStyle=f.activeCellBorder,A.lineWidth=2,A.strokeRect(Ie+1,ye+1,nt-2,Je-2)),e.getListValidation(at,ut)){const Ml=e.activeCell.value.col===ut&&e.activeCell.value.row===at;_t(A,Ie,ye,nt,Je,Ml,f)}if(!(e.editingCell.value&&e.editingCell.value.col===ut&&e.editingCell.value.row===at)){const Ml=B[zt+1]-B[ut],Bl=V[Ut+1]-V[at],Pl=ut<e.freeze.cols,il=at<e.freeze.rows,mn=Te?Ie:Pl?Ie-P:Ie,eo=Ge?ye:il?ye-Y:ye;Hl(A,ut,at,Ml,Bl,mn,eo)}}},r.save(),r.beginPath();const zn=Be>0?2:0,At=ke>0?2:0;r.rect(We-zn,Ue-At,rt+zn,Ye+At),r.clip(),b(r,_l,Sl,Fl,ol,Ln),h(r,_l,Sl,Fl,ol,Ln),C(r,We,Ue,rt,Ye),r.restore(),Be>0&&(r.strokeStyle=f.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(We+.5,te),r.lineTo(We+.5,F),r.stroke()),ke>0&&(r.strokeStyle=f.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Q,Ue+.5),r.lineTo(G,Ue+.5),r.stroke()),r.fillStyle=f.headerBg,r.fillRect(M,Me,G-M,te);for(let A=qt;A<=Wt;A++){const Ae=M+B[A]-P;if(e.isColumnCollapsed(A))continue;const Ke=(B[A+1]??0)-B[A];if(Ae+Ke<M||Ae>G)continue;const wt=fe[A];wt===0?(r.fillStyle=f.outlineGroupBg1,r.fillRect(Ae,Me,Ke,te)):wt===1&&(r.fillStyle=f.outlineGroupBg2,r.fillRect(Ae,Me,Ke,te)),St&&A>=St.startCol&&A<=St.endCol&&(r.fillStyle=f.selectionBg,r.fillRect(Ae,Me,Ke,te)),r.strokeStyle=f.headerBorder,r.lineWidth=.5,r.strokeRect(Ae+.25,Me+.25,Ke-.5,te-.5),St&&A>=St.startCol&&A<=St.endCol&&(r.strokeStyle=f.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ae,Me+te-1),r.lineTo(Ae+Ke,Me+te-1),r.stroke()),r.fillStyle=f.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(pt(A),Ae+Ke/2,Me+te/2)}if(Be>0){r.fillStyle=f.headerBg,r.fillRect(M,Me,Be,te);for(let A=0;A<=gt;A++){const Ae=M+B[A];if(e.isColumnCollapsed(A))continue;const Ke=(B[A+1]??0)-B[A];Ae+Ke<M||Ae>G||(St&&A>=St.startCol&&A<=St.endCol&&(r.fillStyle=f.selectionBg,r.fillRect(Ae,Me,Ke,te)),r.strokeStyle=f.headerBorder,r.lineWidth=.5,r.strokeRect(Ae+.25,Me+.25,Ke-.5,te-.5),St&&A>=St.startCol&&A<=St.endCol&&(r.strokeStyle=f.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ae,Me+te-1),r.lineTo(Ae+Ke,Me+te-1),r.stroke()),r.fillStyle=f.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(pt(A),Ae+Ke/2,Me+te/2))}}r.strokeStyle=f.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(M,s+.5),r.lineTo(G,s+.5),r.stroke(),r.fillStyle=f.headerBg,r.fillRect(0,s,M,F-s);for(let A=El;A<=Rl;A++){if(e.isRowHidden(A))continue;const Ae=s+V[A]-Y,Ke=Ln[A];if(Ae+Ke<s||Ae>F)continue;const wt=oe[A];wt===0?(r.fillStyle=f.outlineGroupBg1,r.fillRect(Fe,Ae,Q,Ke)):wt===1&&(r.fillStyle=f.outlineGroupBg2,r.fillRect(Fe,Ae,Q,Ke)),St&&A>=St.startRow&&A<=St.endRow&&(r.fillStyle=f.selectionBg,r.fillRect(Fe,Ae,Q,Ke)),r.strokeStyle=f.headerBorder,r.lineWidth=.5,r.strokeRect(Fe+.25,Ae+.25,Q-.5,Ke-.5),St&&A>=St.startRow&&A<=St.endRow&&(r.strokeStyle=f.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Fe+Q-1,Ae),r.lineTo(Fe+Q-1,Ae+Ke),r.stroke()),r.fillStyle=f.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(A+1),Fe+Q/2,Ae+Ke/2+.5)}if(ke>0){r.fillStyle=f.headerBg,r.fillRect(0,s,M,ke);for(let A=0;A<=Et;A++){if(e.isRowHidden(A))continue;const Ae=s+V[A],Ke=Ln[A];Ae+Ke<s||Ae>F||(St&&A>=St.startRow&&A<=St.endRow&&(r.fillStyle=f.selectionBg,r.fillRect(Fe,Ae,Q,Ke)),r.strokeStyle=f.headerBorder,r.lineWidth=.5,r.strokeRect(Fe+.25,Ae+.25,Q-.5,Ke-.5),St&&A>=St.startRow&&A<=St.endRow&&(r.strokeStyle=f.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Fe+Q-1,Ae),r.lineTo(Fe+Q-1,Ae+Ke),r.stroke()),r.fillStyle=f.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(A+1),Fe+Q/2,Ae+Ke/2+.5))}}r.strokeStyle=f.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(M+.5,s),r.lineTo(M+.5,F),r.stroke(),r.fillStyle=f.headerBg,r.fillRect(Fe,Me,Q,te),r.strokeStyle=f.headerSep,r.lineWidth=1,r.strokeRect(Fe+.5,Me+.5,Q-1,te-1);const Lt=Math.min(Q,te)*.32;r.fillStyle=f.activeCellBorder,r.beginPath(),r.moveTo(Fe+Q-1,Me+te-1-Lt),r.lineTo(Fe+Q-1-Lt,Me+te-1),r.lineTo(Fe+Q-1,Me+te-1),r.closePath(),r.fill();const fn=e.getOutlineLevel("row"),Qn=e.getOutlineLevel("column");if(e.getRowOutlines().length)for(const A of e.getRowOutlines()){const Ae=tt(A,fn),Ke=s+V[A.start]-Y,wt=Ae-ae/2,Ot=Ke-ae/2;r.fillStyle=f.headerBg,r.strokeStyle=f.headerText,r.lineWidth=1,$t(r,Math.round(wt),Math.round(Ot),ae,ae,2),r.fill(),r.stroke(),r.strokeStyle=f.headerText,r.lineWidth=1.4,r.beginPath(),r.moveTo(Ae-2,Ke),r.lineTo(Ae+2,Ke),r.stroke(),A.collapsed&&(r.beginPath(),r.moveTo(Ae,Ke-2),r.lineTo(Ae,Ke+2),r.stroke())}if(e.getColumnOutlines().length)for(const A of e.getColumnOutlines()){const Ae=Qe(A,Qn),Ke=M+B[A.start]-P,wt=Ke-ae/2,Ot=Ae-ae/2;r.fillStyle=f.headerBg,r.strokeStyle=f.headerText,r.lineWidth=1,$t(r,Math.round(wt),Math.round(Ot),ae,ae,2),r.fill(),r.stroke(),r.strokeStyle=f.headerText,r.lineWidth=1.4,r.beginPath(),r.moveTo(Ke-2,Ae),r.lineTo(Ke+2,Ae),r.stroke(),A.collapsed&&(r.beginPath(),r.moveTo(Ke,Ae-2),r.lineTo(Ke,Ae+2),r.stroke())}D(r,f),W(r,f)}function I(){const m=n.freezeCanvasRef.value,v=n.wrapperRef.value;if(!m||!v)return;const T=m.getContext("2d");if(!T)return;const G=v.getBoundingClientRect(),F=G.width,P=G.height,Y=52,Q=24,te=me(),Fe=pe(),Me=Y+te,M=Q+Fe,s=n.themeColors.value,f=e.colPositions.value,k=e.rowPositions.value,B=e.scrollX.value,V=e.scrollY.value;m.width=F*c,m.height=P*c,m.style.width=F+"px",m.style.height=P+"px",T.setTransform(c,0,0,c,0,0),T.clearRect(0,0,F,P);const{frozenRowsHeight:oe,frozenColumnsWidth:fe}=e.getFrozenMetrics();if(oe<=0&&fe<=0)return;const ke=Me+fe,Be=M+oe,We=Math.max(0,F-Me-11-fe),Ue=Math.max(0,P-M-11-oe),rt=Math.max(0,e.freeze.cols-1),Ye=Math.max(0,e.freeze.rows-1),gt=Math.max(e.freeze.cols,e.hitCol(fe+B));let Et=gt;for(let mt=gt;mt<e.colCount&&!(Me+f[mt]-B>=F);mt++)Et=mt;const qt=Math.max(e.freeze.rows,e.hitRow(oe+V));let Wt=qt;for(let mt=qt;mt<e.rowCount&&!(M+k[mt]-V>=P);mt++)Wt=mt;let El=gt,Rl=Et,dl=qt,Sl=Wt;fe>0&&(El=0,Rl=Math.max(Rl,rt)),oe>0&&(dl=0,Sl=Math.max(Sl,Ye));let ul=El,ol=dl;for(const mt in e.merges){const vt=e.merges[mt];vt&&(vt.startRow>Sl||vt.endRow<dl||vt.startCol>Rl||vt.endCol<El||(vt.startCol<ul&&(ul=vt.startCol),vt.startRow<ol&&(ol=vt.startRow)))}const _l=new Array(ol);for(let mt=ol;mt<=Sl;mt++)_l[mt]=k[mt+1]-k[mt];const Fl=(mt,vt,Hl)=>{const Wl=e.findMerge(mt,vt);return Wl?e.getCellBorderSide(e.cells[Wl.anchor],Hl):e.getCellBorderSide(e.cells[e.cellKey(mt,vt)],Hl)},Ln=(mt,vt,Hl,Wl,zn)=>{mt.fillStyle="#444";for(let At=Wl;At<=zn;At++)for(let Lt=vt;Lt<=Hl;Lt++){if(e.isRowCollapsed(At)||e.isColumnCollapsed(Lt))continue;const fn=e.findMerge(Lt,At);if(fn&&!(Lt===fn.range.startCol&&At===fn.range.startRow))continue;const Qn=e.cellToScreenRect(At,Lt),A=Qn.x,Ae=Qn.y,Ke=Qn.width,wt=Qn.height;if(A+Ke<Me||Ae+wt<M||A>F||Ae>P)continue;const Ot=e.cells[e.cellKey(Lt,At)],Jt={top:e.getCellBorderSide(Ot,"top"),right:e.getCellBorderSide(Ot,"right"),bottom:e.getCellBorderSide(Ot,"bottom"),left:e.getCellBorderSide(Ot,"left")};if(fn)continue;const kt={top:Fl(Lt,At-1,"bottom"),left:Fl(Lt-1,At,"right"),bottom:Fl(Lt,At+1,"top"),right:Fl(Lt+1,At,"left")},Te=Gt(kt.top,Jt.top),Ge=Gt(kt.left,Jt.left),dt=Gt(Jt.bottom,kt.bottom),et=Gt(Jt.right,kt.right),je=(Te==null?void 0:Te.width)??0,ht=(Ge==null?void 0:Ge.width)??0,ut=(dt==null?void 0:dt.width)??0,at=(et==null?void 0:et.width)??0;je>0&&(mt.fillStyle=(Te==null?void 0:Te.color)||"#444",mt.fillRect(A,Ae,Ke,je)),ut>0&&(mt.fillStyle=(dt==null?void 0:dt.color)||"#444",mt.fillRect(A,Ae+wt-ut,Ke,ut)),ht>0&&(mt.fillStyle=(Ge==null?void 0:Ge.color)||"#444",mt.fillRect(A,Ae,ht,wt)),at>0&&(mt.fillStyle=(et==null?void 0:et.color)||"#444",mt.fillRect(A+Ke-at,Ae,at,wt));const zt=Lt>0&&e.isColumnCollapsed(Lt-1),Ut=Lt<e.colCount-1&&e.isColumnCollapsed(Lt+1),Nt=At>0&&e.isRowCollapsed(At-1),ft=At<e.rowCount-1&&e.isRowCollapsed(At+1),Ie=Lt<e.freeze.cols,ye=At<e.freeze.rows;je>0&&ht>0&&!zt&&!Nt&&(mt.fillStyle=(Te==null?void 0:Te.color)||(Ge==null?void 0:Ge.color)||"#444",mt.fillRect(A-ht,Ae-je,ht,je)),je>0&&at>0&&!Ut&&!Nt&&!Ie&&(mt.fillStyle=(Te==null?void 0:Te.color)||(et==null?void 0:et.color)||"#444",mt.fillRect(A+Ke,Ae-je,at,je)),ut>0&&ht>0&&!zt&&!ft&&!ye&&(mt.fillStyle=(dt==null?void 0:dt.color)||(Ge==null?void 0:Ge.color)||"#444",mt.fillRect(A-ht,Ae+wt,ht,ut)),ut>0&&at>0&&!Ut&&!ft&&!Ie&&!ye&&(mt.fillStyle=(dt==null?void 0:dt.color)||(et==null?void 0:et.color)||"#444",mt.fillRect(A+Ke,Ae+wt,at,ut))}},St=(mt,vt,Hl,Wl,zn,At,Lt,fn)=>{Hl<=0||Wl<=0||(T.save(),T.beginPath(),T.rect(mt,vt,Hl,Wl),T.clip(),T.fillStyle=s.gridBg,T.fillRect(mt,vt,Hl,Wl),b(T,zn,At,Lt,fn,_l),Ln(T,zn,At,Lt,fn),C(T,mt,vt,Hl,Wl),T.restore())};fe>0&&oe>0&&St(Y,Q,fe,oe,0,rt,0,Ye),oe>0&&St(ke,Q,We,oe,ul,Rl,0,Ye),fe>0&&St(Y,Be,fe,Ue,0,rt,ol,Sl),T.strokeStyle=s.headerSep,T.lineWidth=1,fe>0&&(T.beginPath(),T.moveTo(ke+.5,Q),T.lineTo(ke+.5,P),T.stroke()),oe>0&&(T.beginPath(),T.moveTo(Y,Be+.5),T.lineTo(F,Be+.5),T.stroke()),T.fillStyle=s.headerBg,T.fillRect(0,0,Y,Q),T.strokeStyle=s.headerSep,T.lineWidth=1,T.strokeRect(.5,.5,Y-.5,Q-.5),D(T,s),W(T,s)}function D(m,v){const T=e.selection.value;if(!T||e.editingCell.value)return;const G=e.cellToScreenRect(T.endRow,T.endCol),F=G.x+G.width-6/2,P=G.y+G.height-6/2;if(F<se()||P<Ve())return;const{frozenColumnsWidth:Y,frozenRowsHeight:Q}=e.getFrozenMetrics();if(Y>0&&T.endCol>=e.freeze.cols&&F<se()+Y||Q>0&&T.endRow>=e.freeze.rows&&P<Ve()+Q)return;const te=rr(T,T,e.merges).ok;m.fillStyle=te?v.activeCellBorder:v.scrollTrack,m.fillRect(F,P,6,6),m.strokeStyle="#fff",m.lineWidth=1,m.strokeRect(F+.5,P+.5,6-1,6-1)}function W(m,v){const T=e.autoFillState.value;if(!T.active||!T.preview||!T.targetRange)return;const G=T.targetRange,F=e.cellToScreenRect(G.startRow,G.startCol),P=e.cellToScreenRect(G.endRow,G.endCol),Y=F.x,Q=F.y,te=P.x+P.width-Y,Fe=P.y+P.height-Q;Q<Ve()||Y<se()||(m.fillStyle=v.selectionBg,m.fillRect(Y,Q,te,Fe),m.strokeStyle=v.activeCellBorder,m.lineWidth=1.5,m.setLineDash([4,3]),m.strokeRect(Y+.5,Q+.5,te-1,Fe-1),m.setLineDash([]))}const we=t.computed(()=>pt(e.activeCell.value.col)+String(e.activeCell.value.row+1)),$e=t.ref(""),Z=t.ref(!1),Le=t.computed(()=>e.editingCell.value?$e.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(m,v)=>{if(m&&!v){const T=e.editValue.value||e.getCellRaw(m.col,m.row)||"";$e.value=T,le=!1}else!m&&v&&($e.value="",Z.value=!1,le=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||($e.value="",le=!1)});function ie(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),p())}function De(m){const v=m.target.value;e.editingCell.value?e.editValue.value=v:e.startEdit(v),$e.value=v,le=!0}function N(m){var T,G;const v={...e.activeCell.value};e.editingCell.value?(e.editValue.value=m,e.commitEdit()):((T=e.saveUndo)==null||T.call(e),e.setCellValue(v.col,v.row,m)),$e.value="",le=!1,p(),(G=n.emitModelData)==null||G.call(n)}let J=!1,le=!1;function re(){var P,Y,Q;if(J)return;const m=n.formulaBarRef.value,v=!!(m&&typeof document<"u"&&document.activeElement===m);if(!e.editingCell.value&&!v&&!le)return;const T={...e.activeCell.value},G=e.editingCell.value?e.editingCell.value.col:T.col,F=e.editingCell.value?e.editingCell.value.row:T.row;if(!e.editingCell.value){const te=e.getCellRaw(G,F),Fe=$e.value!==te;if(!le)return;J=!0,Fe&&((P=e.saveUndo)==null||P.call(e),e.setCellValue(G,F,$e.value),p(),(Y=n.emitModelData)==null||Y.call(n)),(Q=n.formulaBarRef.value)==null||Q.blur(),$e.value="",Z.value=!1,le=!1,t.nextTick(()=>{J=!1});return}J=!0,le?(e.editValue.value=$e.value,e.commitEdit().then(te=>{var Fe,Me;te&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(Fe=n.formulaBarRef.value)==null||Fe.blur(),$e.value="",Z.value=!1,le=!1,p(),n.focusEditInput(),(Me=n.emitModelData)==null||Me.call(n),t.nextTick(()=>{J=!1})})):v?($e.value=e.editValue.value,e.commitEdit().then(te=>{var Fe,Me;te&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(Fe=n.formulaBarRef.value)==null||Fe.blur(),$e.value="",Z.value=!1,le=!1,p(),n.focusEditInput(),(Me=n.emitModelData)==null||Me.call(n),t.nextTick(()=>{J=!1})})):e.commitEdit().then(()=>{var te,Fe;(te=n.formulaBarRef.value)==null||te.blur(),$e.value="",Z.value=!1,le=!1,p(),n.focusEditInput(),(Fe=n.emitModelData)==null||Fe.call(n),t.nextTick(()=>{J=!1})})}function ne(){var m;J||(J=!0,e.editingCell.value&&e.cancelEdit(),(m=n.formulaBarRef.value)==null||m.blur(),$e.value="",Z.value=!1,le=!1,p(),n.focusEditInput(),t.nextTick(()=>{J=!1}))}function ve(m){if(!m.isComposing){if(m.key==="Enter"&&(m.altKey||m.metaKey)&&!m.ctrlKey){m.preventDefault(),m.stopPropagation();const v=m.target;if(!v)return;e.editingCell.value||e.startEdit();const T=v.selectionStart??v.value.length,G=v.selectionEnd??v.value.length,F=v.value,P=F.substring(0,T)+`
|
|
7
|
+
`+F.substring(G),Y=T+1;$e.value=P,Z.value||(Z.value=!0),t.nextTick(()=>{try{v.setSelectionRange(Y,Y)}catch{}if(Z.value)try{v.scrollTop=v.scrollHeight}catch{}try{v.focus({preventScroll:!0})}catch{}});return}m.key==="Enter"?(m.preventDefault(),re()):m.key==="Escape"&&(m.preventDefault(),ne())}}function Ce(){re()}const _=t.ref(null),L=t.ref("");function U(m){_.value===null&&(n.switchSheet(m),p())}function q(m){m!==n.activeSheetIndex.value&&(n.saveSheet(),n.loadSheet(m),p()),_.value=m,L.value=n.sheets.value[m].name,t.nextTick(()=>{const v=document.querySelector(".tab-rename-input");v==null||v.focus(),v==null||v.select()})}function de(){_.value!==null&&(n.renameSheet(_.value,L.value),t.nextTick(()=>n.emitModelData())),_.value=null,L.value=""}function ze(){_.value=null,L.value=""}function Re(m){m.key==="Enter"?(m.preventDefault(),de()):m.key==="Escape"&&(m.preventDefault(),ze())}const Pe=t.ref(null);t.watch(Pe,m=>{m===null&&Zt()});const lt=t.ref(null),_e=t.ref(null),Ct=18,st=2,ct=2,Vt=new Path2D("M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z");function $t(m,v,T,G,F,P){const Y=Math.min(P,G/2,F/2);m.beginPath(),m.moveTo(v+Y,T),m.arcTo(v+G,T,v+G,T+F,Y),m.arcTo(v+G,T+F,v,T+F,Y),m.arcTo(v,T+F,v,T,Y),m.arcTo(v,T,v+G,T,Y),m.closePath()}function _t(m,v,T,G,F,P,Y){if(G<X+4||F<10)return;const Q=v+G-X,te=T+1,Fe=F-2;m.save(),P&&(m.fillStyle=Y.selectionBg,m.fillRect(Q,te,X,Fe)),m.fillStyle=Y.activeCellBorder;const Me=6,M=4,s=Q+X/2,f=te+Fe/2;m.beginPath(),m.moveTo(s-Me/2,f-M/2+.5),m.lineTo(s+Me/2,f-M/2+.5),m.lineTo(s,f+M/2+.5),m.closePath(),m.fill(),m.restore()}function Ht(m,v){if(e.dataValidations.length===0)return null;const T=e.screenToCell(m,v);if(!T)return null;const G=e.findMerge(T.col,T.row),F=G?G.range.startCol:T.col,P=G?G.range.startRow:T.row;if(!e.getListValidation(P,F))return null;const Y=e.cellToScreenRect(P,F);if(Y.width<X+4)return null;const Q=Y.x+Y.width-X;return m<Q||m>Y.x+Y.width||v<Y.y||v>Y.y+Y.height?null:{col:F,row:P}}function Xe(m,v){const T=e.getValidationDropdown(v,m);if(!T)return!1;const G=n.canvasRef.value;if(!G)return!1;e.activeCell.value.col===m&&e.activeCell.value.row===v||e.selectCell(m,v),e.ensureVisible(m,v),p();const F=e.cellToScreenRect(v,m),P=G.getBoundingClientRect();return _e.value={col:m,row:v,rule:T.rule,items:T.items,current:e.getCellRaw(m,v),x:P.left+F.x,y:P.top+F.y,width:F.width,height:F.height},!0}function S(){_e.value&&(_e.value=null,p())}async function ee(m){var P;const v=_e.value;if(!v)return;const{col:T,row:G}=v;_e.value=null;const F=e.validateCell(G,T,m);if(!F.valid&&await e.confirmInvalidValue(F,T,G)!=="continue"){p(),n.focusEditInput();return}o.saveUndo(),e.setCellValue(T,G,m),(P=e.emitModelData)==null||P.call(e),p(),n.focusEditInput()}function xt(m,v,T,G,F,P,Y){const Q=Math.min(G,Ct)-st,te=v+G-Q-st,Fe=T+st,Me=F-2*st;m.save(),m.fillStyle=P?Y.activeCellBorder:"#ececec",$t(m,te,Fe,Q,Me,ct),m.fill();const M=Math.min(Q,Me)*.72;m.translate(te+Q/2,Fe+Me/2),m.scale(M/1024,M/1024),m.translate(-512,-512),m.fillStyle=P?"#ffffff":"#5a5a5a",m.fill(Vt),m.restore()}function Dt(m,v){const T=e.getFilter();if(!T)return-1;const G=e.screenToCell(m,v);if(!G)return-1;const{col:F,row:P}=G;if(P!==T.range.startRow||F<T.range.startCol||F>T.range.endCol)return-1;const Y=e.cellToScreenRect(P,F),Q=Math.min(Y.width,Ct)-st,te=Y.x+Y.width-Q-st,Fe=Y.x+Y.width-st;return m>=te&&m<=Fe&&v>=Y.y+st&&v<=Y.y+Y.height-st?F:-1}function tl(m){const v=e.getFilter();if(!v)return;const T=n.canvasRef.value;if(!T)return;const G=T.getBoundingClientRect(),F=e.cellToScreenRect(v.range.startRow,m);lt.value={col:m,x:G.left+F.x+F.width-Ct,y:G.top+F.y+2}}function gl(){lt.value=null}let jt=null,Kt=null;function Zt(){jt&&(document.removeEventListener("click",jt),jt=null),Kt&&(document.removeEventListener("touchstart",Kt,{capture:!0}),Kt=null)}function jl(m,v){const T=e.getOutlineLevel("row"),G=e.getOutlineLevel("column"),F=e.rowPositions.value,P=e.colPositions.value,Y=e.scrollX.value,Q=e.scrollY.value,te=ae/2+1;if(v>=Ve())for(const Fe of e.getRowOutlines()){const Me=tt(Fe,T),M=Ve()+F[Fe.start]-Q;if(Math.abs(m-Me)<=te&&Math.abs(v-M)<=te)return{kind:"toggle",outlineId:Fe.id}}if(m>=se())for(const Fe of e.getColumnOutlines()){const Me=Qe(Fe,G),M=se()+P[Fe.start]-Y;if(Math.abs(v-Me)<=te&&Math.abs(m-M)<=te)return{kind:"toggle",outlineId:Fe.id}}return null}function Zl(m){for(const v of m)e.removeOutline(v);n.emitModelData(),p()}function z(m){const v=e.selection.value;if(!v)return he("outlineNeedRowsOrColumns"),!1;let T;if(m==="row"){if(v.startCol!==0||v.endCol!==e.colCount-1)return he("outlineNeedRowsOrColumns"),!1;if(v.startRow===v.endRow)return he("outlineInvalidRange"),!1;T=e.addRowGroup(v.startRow,v.endRow)}else{if(v.startRow!==0||v.endRow!==e.rowCount-1)return he("outlineNeedRowsOrColumns"),!1;if(v.startCol===v.endCol)return he("outlineInvalidRange"),!1;T=e.addColumnGroup(v.startCol,v.endCol)}return T.ok?!0:(he(T.code==="outlineCrossing"?"outlineCrossing":T.code==="outlineTooDeep"?"outlineTooDeep":"outlineInvalidRange"),!1)}function $(m){const v=e.selection.value;if(!v||m==="row"&&(v.startCol!==0||v.endCol!==e.colCount-1)||m==="column"&&(v.startRow!==0||v.endRow!==e.rowCount-1))return he("outlineNeedRowsOrColumns"),!1;const T=m==="row"?e.getRowOutlines():e.getColumnOutlines(),G=m==="row"?v.startRow:v.startCol,F=m==="row"?v.endRow:v.endCol,P=T.filter(Y=>G<=Y.start&&Y.end<=F);return P.length?(Zl(P.map(Y=>Y.id)),!0):(he("outlineUngroupPartial"),!1)}function H(m,v){const T=m==="row"?e.getRowOutlines():e.getColumnOutlines();if(T.length&&!T.every(G=>G.collapsed===v)){o.saveUndo();for(const G of T)e.setOutlineCollapsed(G.id,v,!0);n.emitModelData(),p()}}function he(m){const v=g(e.locale.value,m);if(u){u(v);return}window.alert(v)}function Ne(m,v,T){Zt();const G=140,F=T.length*28+8,P=Gl(n.wrapperRef.value),Y=P.right,Q=P.bottom;m+G>Y&&(m-=G),v+F>Q&&(v-=F),xe.value=!1,Pe.value={x:m,y:v,items:T},t.nextTick(()=>Se()),jt=()=>{Pe.value=null,Zt()},Kt=te=>{const Fe=te.target;Fe&&Fe.closest(".context-menu")||(Pe.value=null,Zt())},setTimeout(()=>{document.addEventListener("click",jt,{once:!0}),document.addEventListener("touchstart",Kt,{capture:!0})},0)}const xe=t.ref(!1);function He(m,v){}function Se(){const v=document.querySelector(".context-menu"),T=Pe.value;if(!v||!T){xe.value=!1;return}const G=T.x+140,F=Gl(n.wrapperRef.value),P=F.right,Y=F.bottom,Q=v.style.transform;v.style.transform="none";let te=0;if(v.querySelectorAll(".context-menu__item").forEach(Me=>{const M=Me.querySelector(":scope > .context-submenu");if(!M)return;const s=M.style.display;M.style.display="block";const f=M.getBoundingClientRect(),k=f.width,B=f.height;M.style.display=s,k>te&&(te=k),Me.getBoundingClientRect().top+B>Y-8?(M.style.top="auto",M.style.bottom="-5px"):(M.style.top="",M.style.bottom="")}),v.style.transform=Q,te===0){xe.value=!0;return}const Fe=P-G;xe.value=Fe<te+8}function ce(m,v){m.preventDefault(),m.stopPropagation(),Ne(m.clientX,m.clientY,[{label:g(e.locale.value,"insert"),action:()=>{n.addSheet(),p()}},{label:g(e.locale.value,"copy"),action:()=>{n.dupSheet(v)}},{label:g(e.locale.value,"rename"),action:()=>{q(v)}},{label:g(e.locale.value,"delete"),action:()=>{n.removeSheet(v),p()},disabled:n.sheetCount.value<=1},{label:g(e.locale.value,"moveSheetLeft"),action:()=>{n.moveSheet(v,-1)},disabled:v===0},{label:g(e.locale.value,"moveSheetRight"),action:()=>{n.moveSheet(v,1)},disabled:v===n.sheets.value.length-1}])}function Ze(m){m.preventDefault(),!(m.target.closest(".tab-item")||m.target.closest(".tab-bar__add-btn"))&&Ne(m.clientX,m.clientY,[{label:g(e.locale.value,"insert"),action:()=>{n.addSheet(),p()}}])}function ot(m){m.preventDefault(),e.selectAll(),p(),Ne(m.clientX,m.clientY,[{label:g(e.locale.value,"cut"),action:()=>{l.cutSelected(),n.emitModelData()}},{label:g(e.locale.value,"copy"),action:()=>l.copyToClipboard()},{label:g(e.locale.value,"paste"),action:()=>{o.saveUndo(),l.pasteFromClipboard().then(()=>{p(),t.nextTick(()=>n.emitModelData())})}},{label:g(e.locale.value,"delete"),action:()=>{o.saveUndo(),l.clearSelected();for(let v=0;v<e.colCount;v++)e.colWidths.value[v]=100;for(let v=0;v<e.rowCount;v++)e.rowHeights.value[v]=void 0;p(),n.emitModelData()}}])}function E(m,v){m.preventDefault();const T=m.clientX,G=m.clientY,F=e.selection.value;F&&F.startCol===0&&F.endCol===e.colCount-1&&v>=F.startRow&&v<=F.endRow||(e.selectRange(0,v,e.colCount-1,v,"row"),p());const P=e.selection.value;Ne(m.clientX,m.clientY,[{label:g(e.locale.value,"insert"),action:()=>{o.saveUndo(),n.insertRows(P.startRow,P.startRow),e.selectRange(0,P.startRow,e.colCount-1,P.startRow,"row"),p(),n.emitModelData()}},{label:g(e.locale.value,"cut"),action:()=>{o.saveUndo(),l.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,P.startRow,P.endRow),p(),n.emitModelData()}},{label:g(e.locale.value,"copy"),action:()=>l.copyRowCol()},{label:g(e.locale.value,"paste"),action:()=>{o.saveUndo(),l.pasteFromClipboard().then(()=>{p(),t.nextTick(()=>n.emitModelData())})}},{label:g(e.locale.value,"delete"),action:()=>{o.saveUndo(),n.deleteRows(P.startRow,P.endRow),p(),n.emitModelData()}},{label:`${g(e.locale.value,"rowHeight")}...`,action:()=>bt("row",T,G)},{label:g(e.locale.value,"autoRowHeight"),action:()=>n.resetRowHeight()},{label:g(e.locale.value,"freezeToRow"),action:()=>{e.setFreeze(v+1,e.freeze.cols),p()}},{label:g(e.locale.value,"outlineGroup"),children:[{label:g(e.locale.value,"outlineAddRowGroup"),action:()=>z("row")},{label:g(e.locale.value,"outlineUngroupRows"),action:()=>$("row")},{label:g(e.locale.value,"outlineClear"),action:()=>e.clearRowGroups()},{label:g(e.locale.value,"outlineExpandAll"),action:()=>H("row",!1)},{label:g(e.locale.value,"outlineCollapseAll"),action:()=>H("row",!0)}]}])}function y(m,v){m.preventDefault();const T=m.clientX,G=m.clientY,F=e.selection.value;F&&F.startRow===0&&F.endRow===e.rowCount-1&&v>=F.startCol&&v<=F.endCol||(e.selectRange(v,0,v,e.rowCount-1,"col"),p());const P=e.selection.value,Y=!n.canSortColumns(P.startCol,P.endCol);Ne(m.clientX,m.clientY,[{label:g(e.locale.value,"insert"),action:()=>{o.saveUndo(),n.insertCols(P.startCol,P.startCol),e.selectRange(P.startCol,0,P.startCol,e.rowCount-1,"col"),p(),n.emitModelData()}},{label:g(e.locale.value,"cut"),action:()=>{o.saveUndo(),l.copyRowCol(),e.clearCellsInRange(P.startCol,P.endCol,0,e.rowCount-1),p(),n.emitModelData()}},{label:g(e.locale.value,"copy"),action:()=>l.copyRowCol()},{label:g(e.locale.value,"paste"),action:()=>{o.saveUndo(),l.pasteFromClipboard().then(()=>{p(),t.nextTick(()=>n.emitModelData())})}},{label:g(e.locale.value,"delete"),action:()=>{o.saveUndo(),n.deleteCols(P.startCol,P.endCol),p(),n.emitModelData()}},{label:g(e.locale.value,"sort"),disabled:Y,children:[{label:g(e.locale.value,"sortAsc"),action:()=>{n.prepareSortConfirmation("asc")||n.sortSelectedColumns("asc")},disabled:Y},{label:g(e.locale.value,"sortDesc"),action:()=>{n.prepareSortConfirmation("desc")||n.sortSelectedColumns("desc")},disabled:Y}]},{label:`${g(e.locale.value,"colWidth")}...`,action:()=>bt("col",T,G)},{label:g(e.locale.value,"defaultColWidth"),action:()=>n.resetColWidth()},{label:g(e.locale.value,"freezeToCol"),action:()=>{e.setFreeze(e.freeze.rows,v+1),p()}},{label:g(e.locale.value,"outlineGroup"),children:[{label:g(e.locale.value,"outlineAddColumnGroup"),action:()=>z("column")},{label:g(e.locale.value,"outlineUngroupColumns"),action:()=>$("column")},{label:g(e.locale.value,"outlineClear"),action:()=>e.clearColumnGroups()},{label:g(e.locale.value,"outlineExpandAll"),action:()=>H("column",!1)},{label:g(e.locale.value,"outlineCollapseAll"),action:()=>H("column",!0)}]}])}function d(m,v,T){m.preventDefault(),e.isSelected(v,T)||(e.selectCell(v,T),p());const G=e.selection.value,F=!!(G&&G.startCol===G.endCol&&G.startRow===G.endRow);Ne(m.clientX,m.clientY,[{label:g(e.locale.value,"cut"),action:()=>{l.cutSelected(),n.emitModelData()}},{label:g(e.locale.value,"copy"),action:()=>l.copyToClipboard()},{label:g(e.locale.value,"paste"),action:()=>{o.saveUndo(),l.pasteFromClipboard().then(()=>{p(),t.nextTick(()=>n.emitModelData())})}},{label:g(e.locale.value,"delete"),action:()=>{o.saveUndo(),l.clearSelected(),p(),n.emitModelData()}},{label:g(e.locale.value,"calculate"),children:[{label:g(e.locale.value,"sum"),action:l.sumSelected,disabled:F},{label:g(e.locale.value,"avg"),action:l.avgSelected,disabled:F},{label:g(e.locale.value,"count"),action:l.countSelected,disabled:F}]},{label:`${g(e.locale.value,"dv")}...`,action:()=>{var P;return(P=e.requestDataValidationDialog)==null?void 0:P.call(e)}},{label:g(e.locale.value,"dvClearValidation"),action:()=>{o.saveUndo(),e.clearDataValidation(e.selection.value),p(),n.emitModelData()}}])}const w=t.ref(null),be=t.ref(null);let ue=null,Oe=null;function qe(){ue&&(document.removeEventListener("mousedown",ue),ue=null),Oe&&(document.removeEventListener("touchstart",Oe),Oe=null)}function bt(m,v,T){qe();const G=e.selection.value;let F="";if(G){const Me=m==="row"?e.getRowHeight(G.startRow):e.colWidths.value[G.startCol];F=Me!=null&&Me>0?String(Math.round(Me)):""}const P=220,Y=118;let Q=v,te=T;const Fe=Gl(n.wrapperRef.value);Q=Math.max(Fe.left+8,Math.min(Fe.right-P-8,Q)),te=Math.max(Fe.top+8,Math.min(Fe.bottom-Y-8,te)),be.value={type:m,x:Q,y:te,value:F,error:""},ue=()=>{be.value=null},Oe=()=>{be.value=null},setTimeout(()=>{document.addEventListener("mousedown",ue,{once:!0}),document.addEventListener("touchstart",Oe,{once:!0})},0),t.nextTick(()=>{const Me=w.value;Me&&(Me.focus(),Me.select())})}function Ft(m){const v=be.value;if(!v)return;const T=m.target,G=T.value,F=G.replace(/[^\d]/g,"");v.value=F,G!==F&&(T.value=F),v.error=""}function Qt(m){m.key==="Enter"?(m.preventDefault(),bl()):m.key==="Escape"&&(m.preventDefault(),Jl())}function Tt(){const m=be.value;if(!m)return;const v=m.value.trim(),T=Number(v),G=m.type==="row",F=G?24:30,P=G?500:1e3;if(v===""||!Number.isFinite(T)){Jl();return}const Y=Math.max(F,Math.min(P,Math.round(T)));m.value=String(Y),m.error=""}function bl(){const m=be.value,v=e.selection.value;if(!m||!v)return;const T=m.value.trim(),G=Number(T),F=m.type==="row",P=F?24:30,Y=F?500:1e3;if(T===""||!Number.isFinite(G)){m.error=g(e.locale.value,"dimNumberError");return}if(G<P||G>Y){m.error=g(e.locale.value,"dimRangeError").replace("{min}",String(P)).replace("{max}",String(Y));return}const Q=G;if(o.saveUndo(),F)for(let te=v.startRow;te<=v.endRow;te++)e.rowHeights.value[te]=Q;else for(let te=v.startCol;te<=v.endCol;te++)e.colWidths.value[te]=Q;p(),n.emitModelData(),Jl()}function Jl(){qe(),be.value=null}const xn=t.computed(()=>{const m=!e.editingCell.value,v=e.editingCell.value??e.activeCell.value,T=v.col,G=v.row,F=e.resolveStyle(e.cells[e.cellKey(T,G)]),P=e.cellFontSize(T,G),Y=typeof(F==null?void 0:F.fontFamily)=="string"&&F.fontFamily?F.fontFamily:Mn,Q=(F==null?void 0:F.fontWeight)==="bold"?"bold":"normal",te=(F==null?void 0:F.fontStyle)==="italic"?"italic":"normal",Fe=(F==null?void 0:F.underline)==="underline"?"underline":(F==null?void 0:F.strikethrough)==="line-through"?"line-through":"none",Me=(F==null?void 0:F.underline)==="underline"&&(F==null?void 0:F.strikethrough)==="line-through"?"underline line-through":Fe,M=typeof(F==null?void 0:F.color)=="string"?F.color:void 0,s=typeof(F==null?void 0:F.backgroundColor)=="string"?F.backgroundColor:void 0,f=typeof(F==null?void 0:F.numberFormat)=="string"?F.numberFormat:"",k=e.editValue.value??e.getCellValue(T,G),B=typeof(F==null?void 0:F.textAlign)=="string"?F.textAlign:Xo(k,f)?"right":"left",V=typeof(F==null?void 0:F.verticalAlign)=="string"?F.verticalAlign:"top",oe=e.findMerge(T,G),fe=oe?e.rowPositions.value[oe.range.endRow+1]-e.rowPositions.value[G]:e.getRowHeight(G),ke=2,{ascent:Be,descent:We}=e.measureFontMetrics(Y,P,Q,te),Ue=Be+We,Ye=(e.editValue.value?e.editValue.value.split(`
|
|
8
|
+
`).length:1)*Ue,gt=e.BASE_CELL_VPAD-ke;let Et=0,qt=0;V==="middle"?(Et=Math.floor((fe-Ye)/2),qt=Math.max(0,fe-Ye-Et)):V==="top"?(Et=gt,qt=Math.max(0,fe-Ye-Et)):V==="bottom"&&(qt=gt,Et=Math.max(0,fe-Ye-qt));const Wt=e.cellToScreenRect(G,T);return{left:`${Wt.x}px`,top:`${Wt.y}px`,width:`${Wt.width}px`,height:`${Wt.height}px`,fontFamily:Y,fontSize:`${P}px`,lineHeight:1,fontWeight:Q,fontStyle:te,textDecoration:Me,textAlign:B,paddingTop:`${Et}px`,paddingRight:"3px",paddingBottom:`${qt}px`,paddingLeft:"3px",opacity:m?0:1,pointerEvents:m?"none":"auto",color:m?"transparent":M,caretColor:m?"transparent":void 0,borderColor:m?"transparent":void 0,background:m?"transparent":s,boxShadow:m?"none":void 0}});function Tn(){return Math.max(0,n.viewSize.w-se()-11)}function so(){return Math.max(0,n.viewSize.h-Ve()-11)}const co=t.computed(()=>Math.max(0,Tn()-e.getFrozenMetrics().frozenColumnsWidth)),Pn=t.computed(()=>Math.max(0,so()-e.getFrozenMetrics().frozenRowsHeight)),hr=t.computed(()=>se()+e.getFrozenMetrics().frozenColumnsWidth),gr=t.computed(()=>Ve()+e.getFrozenMetrics().frozenRowsHeight),Vn=t.computed(()=>Math.max(0,co.value-11*2)),Dn=t.computed(()=>Math.max(0,Pn.value-11*2)),Gn=t.computed(()=>n.maxScrollX.value<=0?Vn.value:Math.max(24,co.value/e.totalWidth.value*Vn.value)),uo=t.computed(()=>n.maxScrollX.value<=0?0:e.scrollX.value/n.maxScrollX.value*(Vn.value-Gn.value)),Kn=t.computed(()=>n.maxScrollY.value<=0?Dn.value:Math.max(24,Pn.value/e.totalHeight.value*Dn.value)),fo=t.computed(()=>n.maxScrollY.value<=0?0:e.scrollY.value/n.maxScrollY.value*(Dn.value-Kn.value));let Ql=null,Fn=0,qn=0;function br(m){m.preventDefault(),Ql="v",Fn=m.clientY,qn=e.scrollY.value,document.addEventListener("mousemove",Yn),document.addEventListener("mouseup",On)}function yr(m){m.preventDefault(),Ql="h",Fn=m.clientX,qn=e.scrollX.value,document.addEventListener("mousemove",Yn),document.addEventListener("mouseup",On)}function Yn(m){if(Ql==="v"){const T=(m.clientY-Fn)/(Dn.value-Kn.value);n.clampScroll(null,qn+T*n.maxScrollY.value),p()}else if(Ql==="h"){const T=(m.clientX-Fn)/(Vn.value-Gn.value);n.clampScroll(qn+T*n.maxScrollX.value,null),p()}}function On(){Ql=null,document.removeEventListener("mousemove",Yn),document.removeEventListener("mouseup",On)}function Cr(m){if(Ql)return;const v=m.currentTarget.getBoundingClientRect(),T=m.clientY-v.top;T<fo.value?n.clampScroll(null,e.scrollY.value-so()):T>fo.value+Kn.value&&n.clampScroll(null,e.scrollY.value+so()),p()}function wr(m){if(Ql)return;const v=m.currentTarget.getBoundingClientRect(),T=m.clientX-v.left;T<uo.value?n.clampScroll(e.scrollX.value-Tn(),null):T>uo.value+Gn.value&&n.clampScroll(e.scrollX.value+Tn(),null),p()}let Cn=!1,yl=0,Cl=0,wl=!1,el=!1,wn=0,vn=0,ll=0,vl=0,kn=0,cn=0,Xn=0,In=0,al=!1,Vl=!1,Mt=0,Bt=0,nl="cell",jn=0,En=-1,mo=-1,sl=null,en=!1,zl=0,$l=0,dn=!1,Dl=null,Rn=null,Fo=0,Oo=0;function kl(m,v){const T=e.selection.value;if(!T||e.editingCell.value||!rr(T,T,e.merges).ok)return!1;const G=e.cellToScreenRect(T.endRow,T.endCol),F=G.x+G.width-6,P=G.y+G.height-6,Y=4;return m>=F-Y&&m<=F+6+Y&&v>=P-Y&&v<=P+6+Y}function po(){Dl=requestAnimationFrame(un)}function un(){if(!e.autoFillState.value.active||!Rn){Dl=null;return}const m=8;n.clampScroll(e.scrollX.value+Rn.x*m*.1,e.scrollY.value+Rn.y*m*.1);const v=e.screenToCell(Fo,Oo),T=e.autoFillState.value.sourceRange;if(v&&T){const G=ua(T,{col:v.col,row:v.row});G?e.autoFillState.value={...e.autoFillState.value,targetRange:G.targetRange,direction:G.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}p(),Dl=requestAnimationFrame(un)}function ho(){Dl!==null&&(cancelAnimationFrame(Dl),Dl=null),Rn=null}function Io(m,v){Fo=m,Oo=v;const T=e.screenToCell(m,v),G=e.autoFillState.value.sourceRange;if(T&&G){const Fe=ua(G,{col:T.col,row:T.row});Fe?e.autoFillState.value={...e.autoFillState.value,targetRange:Fe.targetRange,direction:Fe.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}const F=30,P=n.viewSize.w,Y=n.viewSize.h;let Q=0,te=0;m<se()+F?Q=-(se()+F-m):m>P-11-F&&(Q=m-(P-11-F)),v<Ve()+F?te=-(Ve()+F-v):v>Y-11-F&&(te=v-(Y-11-F)),Q!==0||te!==0?(Rn={x:Q,y:te},Dl===null&&po()):(Rn=null,Dl!==null&&(cancelAnimationFrame(Dl),Dl=null)),p()}function go(){ho();const m=e.autoFillState.value;m.targetRange&&m.direction&&m.sourceRange&&e.applyAutoFill(m.sourceRange,m.targetRange,m.direction),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}}function vr(m){if(m.button!==0)return;m.preventDefault(),Pe.value=null;const v=gn(m,n.canvasRef.value),T=Ht(v.x,v.y);if(T){if(e.editingCell.value){e.commitEdit().then(te=>{te&&Xe(T.col,T.row)});return}Xe(T.col,T.row);return}const G=Dt(v.x,v.y);if(G>=0){tl(G);return}const F=jl(v.x,v.y);if(F){F.kind==="toggle"&&(e.toggleOutline(F.outlineId),p(),n.emitModelData());return}if(v.y<Ve()&&v.x>=se()){const te=v.x-se()+e.scrollX.value,Fe=x(v.x),Me=Fe>=0?e.cellToScreenRect(0,Fe).x+e.colWidths.value[Fe]:-1;if(Fe>=0&&Math.abs(v.x-Me)<=4){o.saveUndo(),wl=!0,wn=Fe,ll=e.colWidths.value[Fe],vl=te,p();return}}if(v.x<se()&&v.y>=Ve()){const te=v.y-Ve()+e.scrollY.value,Fe=R(v.y),Me=Fe>=0?e.cellToScreenRect(Fe,0).y+e.getRowHeight(Fe):-1;if(Fe>=0&&Math.abs(v.y-Me)<=4){o.saveUndo(),el=!0,vn=Fe,ll=e.getRowHeight(Fe),vl=te,p();return}}if(kl(v.x,v.y)){const te=e.selection.value;te&&(e.autoFillState.value={active:!0,sourceRange:{...te},targetRange:null,direction:null,preview:!0},p());return}if(v.x<se()||v.y<Ve()){{const te=n.formulaBarRef.value,Fe=!!(te&&typeof document<"u"&&document.activeElement===te);(e.editingCell.value||Fe||le)&&re()}if(v.y<Ve()&&v.x>=se()){const te=x(v.x);te>=0&&(e.selectRange(te,0,te,e.rowCount-1,"col"),Cn=!0,yl=te,Cl=0)}else if(v.x<se()&&v.y>=Ve()){const te=R(v.y);te>=0&&(e.selectRange(0,te,e.colCount-1,te,"row"),Cn=!0,yl=0,Cl=te)}else v.x<se()&&v.y<Ve()&&e.selectAll();p();return}const P=e.screenToCell(v.x,v.y);if(!P)return;const Y=P.col,Q=P.row;{const te=n.formulaBarRef.value,Fe=!!(te&&typeof document<"u"&&document.activeElement===te);(e.editingCell.value||Fe||le)&&re()}if(m.shiftKey&&e.selection.value){const te=e.selection.value;e.selectRange(te.startCol,te.startRow,Y,Q)}else e.selectCell(Y,Q);Cn=!0,yl=Y,Cl=Q,n.focusEditInput(),p()}function kr(m){if(wl){const Y=gn(m,n.canvasRef.value).x-se()+e.scrollX.value-vl,Q=ll+Y;Q>=30&&Q<=1e3?e.colWidths.value[wn]=Q:Q<30?e.colWidths.value[wn]=30:e.colWidths.value[wn]=1e3,p();return}if(el){const Y=gn(m,n.canvasRef.value).y-Ve()+e.scrollY.value-vl,Q=ll+Y;Q>=24&&Q<=500?e.rowHeights.value[vn]=Q:Q<24?e.rowHeights.value[vn]=24:e.rowHeights.value[vn]=500,p();return}if(e.autoFillState.value.active){const P=gn(m,n.canvasRef.value);Io(P.x,P.y);return}if(!Cn){const P=n.canvasRef.value;if(!P)return;if(o.paintFmt.value){P.style.cursor="copy";return}const Y=gn(m,P);if(jl(Y.x,Y.y)){P.style.cursor="pointer";return}if(Dt(Y.x,Y.y)>=0){P.style.cursor="pointer";return}if(Ht(Y.x,Y.y)){P.style.cursor="pointer";return}if(Y.y<Ve()&&Y.x>=se()){const Q=x(Y.x),te=Q>=0?e.cellToScreenRect(0,Q).x+e.colWidths.value[Q]:-1;if(Q>=0&&Math.abs(Y.x-te)<=4){P.style.cursor="col-resize";return}}if(Y.x<se()&&Y.y>=Ve()){const Q=R(Y.y),te=Q>=0?e.cellToScreenRect(Q,0).y+e.getRowHeight(Q):-1;if(Q>=0&&Math.abs(Y.y-te)<=4){P.style.cursor="row-resize";return}}if(kl(Y.x,Y.y)){P.style.cursor="crosshair";return}P.style.cursor="cell";return}const v=gn(m,n.canvasRef.value);if(yl<0||Cl<0)return;if(v.x<se()||v.y<Ve()){if(v.y<Ve()&&v.x>=se()){const P=x(v.x);P>=0&&e.selectRange(Math.min(yl,P),0,Math.max(yl,P),e.rowCount-1,"col")}else if(v.x<se()&&v.y>=Ve()){const P=R(v.y);P>=0&&e.selectRange(0,Math.min(Cl,P),e.colCount-1,Math.max(Cl,P),"row")}p();return}const T=e.screenToCell(v.x,v.y);if(!T)return;const G=T.col,F=T.row;Cl===0&&yl>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(yl,G),0,Math.max(yl,G),e.rowCount-1,"col"):yl===0&&Cl>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(Cl,F),e.colCount-1,Math.max(Cl,F),"row"):e.selectRange(yl,Cl,G,F),p()}function Er(m){const v=wl||el;if(Cn=!1,wl=!1,el=!1,v&&n.scheduleOptEmit(),e.autoFillState.value.active){go();return}o.paintFmt.value&&o.applyPaintFormat()}function Ao(){ho();const m=wl||el;Cn=!1,wl=!1,el=!1,m&&n.scheduleOptEmit()}function Lo(m){m.preventDefault();const v=gn(m,n.canvasRef.value);if(v.x<se()&&v.y<Ve()){ot(m);return}if(v.y<Ve()&&v.x>=se()){const T=x(v.x);T>=0&&y(m,T);return}if(v.x<se()&&v.y>=Ve()){const T=R(v.y);T>=0&&E(m,T);return}if(v.x>=se()&&v.y>=Ve()){const T=e.screenToCell(v.x,v.y);T&&d(m,T.col,T.row)}}function zo(m){const v=gn(m,n.canvasRef.value);if(v.x<se()||v.y<Ve())return;const T=e.screenToCell(v.x,v.y);if(!T)return;const G=T.col,F=T.row;{const P=n.formulaBarRef.value,Y=!!(P&&typeof document<"u"&&document.activeElement===P);(e.editingCell.value||Y||le)&&re()}e.selectCell(G,F),e.ensureVisible(G,F),e.startEdit(),p(),n.focusEditInput()}function Rr(m){const v=e.scrollX.value+m.deltaX,T=e.scrollY.value+m.deltaY,G=40,F=n.maxScrollX.value,P=n.maxScrollY.value;if(v>=F-G&&m.deltaX>0||T>=P-G&&m.deltaY>0){const Y=Math.max(0,n.viewSize.w-28-11),Q=Math.max(0,n.viewSize.h-28-11),te=Math.max(0,Math.ceil((v+Y)/100)+2),Fe=Math.max(0,Math.ceil((T+Q)/24)+2);e.ensureCapacity(te,Fe)}n.clampScroll(v,T),p()}function Sr(m){if(m.touches.length!==1){al=!1;return}const v=m.touches[0],T=n.canvasRef.value;if(!T)return;const G=T.getBoundingClientRect(),F=v.clientX-G.left,P=v.clientY-G.top,Y=v.clientX,Q=v.clientY,te=(Me,M)=>({clientX:Me,clientY:M,preventDefault(){}});{const Me=n.formulaBarRef.value,M=!!(Me&&typeof document<"u"&&document.activeElement===Me);(e.editingCell.value||M||le)&&re()}if(kl(F,P)){m.preventDefault();const Me=e.selection.value;Me&&(e.autoFillState.value={active:!0,sourceRange:{...Me},targetRange:null,direction:null,preview:!0},al=!0,Vl=!1,nl="cell",kn=F,cn=P,Xn=e.scrollX.value,In=e.scrollY.value);return}const Fe=Dt(F,P);if(Fe>=0){m.preventDefault(),tl(Fe);return}if(P<Ve()&&F>=se()){const Me=x(F);if(Me>=0){const M=e.cellToScreenRect(0,Me).x+e.colWidths.value[Me];if(Math.abs(F-M)<=8){m.preventDefault(),o.saveUndo(),wl=!0,wn=Me,ll=e.colWidths.value[Me],vl=F-se()+e.scrollX.value,al=!0,Vl=!1;return}}}if(F<se()&&P>=Ve()){const Me=R(P);if(Me>=0){const M=e.cellToScreenRect(Me,0).y+e.getRowHeight(Me);if(Math.abs(P-M)<=8){m.preventDefault(),o.saveUndo(),el=!0,vn=Me,ll=e.getRowHeight(Me),vl=P-Ve()+e.scrollY.value,al=!0,Vl=!1;return}}}F>=se()&&P>=Ve()?(m.preventDefault(),al=!0,Vl=!1,en=!1,dn=!1,nl="cell",kn=F,cn=P,Xn=e.scrollX.value,In=e.scrollY.value,Mt=x(F),Bt=R(P),sl!==null&&clearTimeout(sl),sl=window.setTimeout(()=>{const Me=e.selection.value;if(!!Me&&Mt>=Me.startCol&&Mt<=Me.endCol&&Bt>=Me.startRow&&Bt<=Me.endRow){dn=!0,d(te(Y,Q),Mt,Bt);return}en=!0,zl=Mt,$l=Bt,Mt>=0&&Bt>=0&&(e.selectCell(Mt,Bt),p())},450)):F>=0&&P>=0&&(F<se()||P<Ve())&&(m.preventDefault(),al=!0,Vl=!1,en=!1,kn=F,cn=P,Xn=e.scrollX.value,In=e.scrollY.value,P<Ve()&&F>=se()?(nl="col",Mt=x(F),Bt=-1):F<se()&&P>=Ve()?(nl="row",Bt=R(P),Mt=-1):(nl="all",Mt=-1,Bt=-1),(nl==="col"||nl==="row"||nl==="all")&&(sl!==null&&clearTimeout(sl),sl=window.setTimeout(()=>{const Me=e.selection.value;if(nl==="all"){dn=!0,ot(te(Y,Q));return}if(nl==="col"){if(!!Me&&Me.startRow===0&&Me.endRow===e.rowCount-1&&Mt>=Me.startCol&&Mt<=Me.endCol){dn=!0,y(te(Y,Q),Mt);return}en=!0,zl=Mt,$l=-1,Mt>=0&&(e.selectRange(Mt,0,Mt,e.rowCount-1,"col"),p())}else{if(!!Me&&Me.startCol===0&&Me.endCol===e.colCount-1&&Bt>=Me.startRow&&Bt<=Me.endRow){dn=!0,E(te(Y,Q),Bt);return}en=!0,zl=-1,$l=Bt,Bt>=0&&(e.selectRange(0,Bt,e.colCount-1,Bt,"row"),p())}},450)))}function Mr(m){if(!al||m.touches.length!==1)return;const v=m.touches[0],T=n.canvasRef.value;if(!T)return;const G=T.getBoundingClientRect(),F=v.clientX-G.left,P=v.clientY-G.top;if(e.autoFillState.value.active){m.preventDefault(),Io(F,P);return}if(wl){const Y=F-se()+e.scrollX.value-vl;let Q=ll+Y;Q=Q<30?30:Q>1e3?1e3:Q,e.colWidths.value[wn]=Q,m.preventDefault(),p();return}if(el){const Y=P-Ve()+e.scrollY.value-vl;let Q=ll+Y;Q=Q<24?24:Q>500?500:Q,e.rowHeights.value[vn]=Q,m.preventDefault(),p();return}if(en){if(m.preventDefault(),zl>=0&&$l>=0){const Y=x(F),Q=R(P);Y>=0&&Q>=0&&(e.selectRange(zl,$l,Y,Q),p())}else if($l===-1&&zl>=0){const Y=x(F);Y>=0&&(e.selectRange(Math.min(zl,Y),0,Math.max(zl,Y),e.rowCount-1,"col"),p())}else if(zl===-1&&$l>=0){const Y=R(P);Y>=0&&(e.selectRange(0,Math.min($l,Y),e.colCount-1,Math.max($l,Y),"row"),p())}return}sl!==null&&(clearTimeout(sl),sl=null),(Math.abs(F-kn)>8||Math.abs(P-cn)>8)&&(Vl=!0,m.preventDefault(),n.clampScroll(Xn+(kn-F),In+(cn-P)),p())}function Br(){if(al){if(sl!==null&&(clearTimeout(sl),sl=null),dn){dn=!1,al=!1;return}if(e.autoFillState.value.active){go(),al=!1;return}if(wl||el){wl=!1,el=!1,n.scheduleOptEmit(),o.paintFmt.value&&o.applyPaintFormat(),al=!1;return}if(en){en=!1,o.paintFmt.value&&o.applyPaintFormat(),al=!1;return}if(al=!1,!Vl){if(nl==="cell"&&Mt>=0&&Bt>=0){const m=Date.now();Mt===En&&Bt===mo&&m-jn<300?(e.selectCell(Mt,Bt),e.startEdit(),p(),n.focusEditInput(),jn=0):(e.commitEdit(),e.selectCell(Mt,Bt),p(),jn=m),En=Mt,mo=Bt,n.focusEditInput()}else nl==="col"&&Mt>=0?(e.commitEdit(),e.selectRange(Mt,0,Mt,e.rowCount-1,"col"),p()):nl==="row"&&Bt>=0?(e.commitEdit(),e.selectRange(0,Bt,e.colCount-1,Bt,"row"),p()):nl==="all"&&(e.commitEdit(),e.selectAll(),p());o.paintFmt.value&&!e.editingCell.value&&o.applyPaintFormat()}}}function bo(m){return m.isComposing||m.key==="Process"||m.keyCode===229}function Zn(m){return m.key.length===1&&!m.ctrlKey&&!m.metaKey&&!m.altKey}function $o(m){if(e.autoFillState.value.active){m.key==="Escape"&&(m.preventDefault(),ho(),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1},p());return}if(e.editingCell.value)return;const v=m.ctrlKey||m.metaKey,T=m.shiftKey;switch(!0){case(m.altKey&&m.key==="ArrowDown"):m.preventDefault(),Xe(e.activeCell.value.col,e.activeCell.value.row);return;case(v&&(m.key==="c"||m.key==="C")):m.preventDefault(),l.copyToClipboard();return;case(v&&(m.key==="x"||m.key==="X")):m.preventDefault(),l.cutSelected();return;case(v&&(m.key==="z"||m.key==="Z")):m.preventDefault(),o.undo();return;case(v&&(m.key==="y"||m.key==="Y")):m.preventDefault(),o.redo();return;case(v&&(m.key==="v"||m.key==="V")):m.preventDefault(),o.saveUndo(),l.pasteFromClipboard().then(()=>{p(),t.nextTick(()=>n.emitModelData())});return;case(v&&(m.key==="a"||m.key==="A")):m.preventDefault(),e.selectAll(),p();return;case(v&&T&&(m.key==="l"||m.key==="L")):m.preventDefault(),e.toggleAutoFilter(),p();return;case(v&&m.key==="Home"):m.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),p();return;case(v&&m.key==="End"):m.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),p();return;case m.key==="Home":m.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),p();return;case m.key==="End":m.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),p();return;case m.key==="ArrowUp":m.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p();return;case m.key==="ArrowDown":m.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p();return;case m.key==="ArrowLeft":m.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p();return;case m.key==="ArrowRight":m.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p();return;case m.key==="Tab":m.preventDefault(),e.moveActive(T?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p();return;case m.key==="Enter":m.preventDefault(),e.moveActive(0,T?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p();return;case m.key==="F2":m.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),p(),n.focusEditInput();return;case m.key==="Delete":case m.key==="Backspace":m.preventDefault(),o.saveUndo(),l.clearSelected(),p();return;case m.key==="Escape":m.preventDefault(),e.cancelEdit(),o.paintFmt.value=null,p();return;case Zn(m):if(bo(m)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),p(),n.focusEditInput();return}m.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(m.key),p(),t.nextTick(()=>{const G=n.editInputRef.value;G&&(G.focus(),G.setSelectionRange(1,1))});return}}let Jn=!1,yo=!1;function Nr(m){const v=m.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(v),$e.value=v,p();return}e.editValue.value=v,$e.value=v}function xr(){Jn=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),$e.value="",p())}function Tr(m){Jn=!1,yo=!0,setTimeout(()=>{yo=!1},0);const v=m.target.value;e.editValue.value=v,$e.value=v}function Vr(m){if(!e.editingCell.value){if(Zn(m)||bo(m))return;$o(m);return}if(!(Jn||bo(m))&&!(yo&&(m.key==="Enter"||m.key==="Escape")))if(m.key==="Enter"&&(m.altKey||m.metaKey)){m.preventDefault();const v=n.editInputRef.value;if(!v)return;const T=v.selectionStart??v.value.length,G=v.selectionEnd??v.value.length,F=v.value,P=F.slice(0,T)+`
|
|
9
|
+
`+F.slice(G);e.editValue.value=P,v.value=P,v.selectionStart=v.selectionEnd=T+1,p()}else m.key==="Enter"?(m.preventDefault(),e.commitEdit().then(v=>{if(!v){p(),n.focusEditInput();return}e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p(),n.focusEditInput()})):m.key==="Tab"?(m.preventDefault(),e.commitEdit().then(v=>{if(!v){p(),n.focusEditInput();return}e.moveActive(m.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p(),n.focusEditInput()})):m.key==="Escape"&&(m.preventDefault(),e.cancelEdit(),p(),n.focusEditInput())}function _o(m){e.editingCell.value}function Ho(){setTimeout(()=>{e.isValidationAlertOpen()||e.editingCell.value&&e.commitEdit().then(()=>p())},0)}let cl=null;function An(){var v;const m=(v=n.wrapperRef.value)==null?void 0:v.getBoundingClientRect();if(m){const T=Bn(e.props.width),G=Bn(e.props.height);T!=null?n.viewSize.w=T:n.viewSize.w=m.width,G!=null?n.viewSize.h=G:n.viewSize.h=m.height}n.clampScroll(null,null),p()}function Dr(){t.onMounted(()=>{const m=Bn(e.props.width),v=Bn(e.props.height);(m==null||v==null)&&(cl=new ResizeObserver(()=>An()),n.wrapperRef.value&&cl.observe(n.wrapperRef.value)),t.nextTick(()=>{An(),n.focusEditInput()}),e.selectCell(0,0),n.modelData.value&&n.modelData.value.length>0&&(a.value=JSON.stringify(n.modelData.value),n.sheets.value=n.modelData.value.map(T=>{const G=n.mkSheet(T.name,{colCount:T.colCount,rowCount:T.rowCount}),{cells:F,styles:P}=Va(T.cells);if(Object.assign(G.cells,F),G.styles=T.styles??P,T.borders)G.borders=T.borders;else{const Y=Da(G.styles);G.styles=Y.styles,G.borders=Y.borders}if(T.colWidths)for(const[Y,Q]of Object.entries(T.colWidths)){const te=Number(Y);te>=0&&te<(G.colCount??e.colCount)&&Q>=30&&(G.colWidths[te]=Q)}if(T.rowHeights)for(const[Y,Q]of Object.entries(T.rowHeights)){const te=Number(Y);te>=0&&te<(G.rowCount??e.rowCount)&&Q>=24&&(G.rowHeights[te]=Q)}if(T.merges)for(const[Y,Q]of Object.entries(T.merges))G.merges[Y]={...Q};return G.freeze=T.freeze?{rows:T.freeze.rows,cols:T.freeze.cols}:{rows:0,cols:0},G.filter=Wa(T.filter,G.cells),G.dataValidations=Array.isArray(T.dataValidations)?[...T.dataValidations]:[],G}),n.sheets.value.length>0&&n.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const m=Bn(e.props.width),v=Bn(e.props.height);m!=null&&v!=null?(cl==null||cl.disconnect(),cl=null):!cl&&n.wrapperRef.value&&(cl=new ResizeObserver(()=>An()),cl.observe(n.wrapperRef.value)),t.nextTick(()=>An())}),t.watch(()=>e.props.theme,()=>p()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>n.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>n.emitModelData()),p()},{deep:!1}),t.watch(n.activeSheetIndex,()=>t.nextTick(()=>n.emitModelData())),t.watch(()=>n.modelData.value,m=>{if(!m||m.length===0)return;const v=JSON.stringify(m);if(v===a.value)return;a.value=v;const T=e.selection.value?{...e.selection.value}:null,G={...e.activeCell.value};n.sheets.value=m.map(Q=>{const te=n.mkSheet(Q.name),{cells:Fe,styles:Me}=Va(Q.cells);if(Object.assign(te.cells,Fe),te.styles=Q.styles??Me,Q.borders)te.borders=Q.borders;else{const M=Da(te.styles);te.styles=M.styles,te.borders=M.borders}if(Q.colWidths)for(const[M,s]of Object.entries(Q.colWidths)){const f=Number(M);f>=0&&f<e.colCount&&s>=30&&(te.colWidths[f]=s)}if(Q.rowHeights)for(const[M,s]of Object.entries(Q.rowHeights)){const f=Number(M);f>=0&&f<e.rowCount&&s>=24&&(te.rowHeights[f]=s)}if(Q.merges)for(const[M,s]of Object.entries(Q.merges))te.merges[M]={...s};return te.freeze=Q.freeze?{rows:Q.freeze.rows,cols:Q.freeze.cols}:{rows:0,cols:0},te.filter=Wa(Q.filter,te.cells),te.dataValidations=Array.isArray(Q.dataValidations)?[...Q.dataValidations]:[],te.rowOutlines=Array.isArray(Q.rowOutlines)?Q.rowOutlines.map(M=>({...M})):[],te.columnOutlines=Array.isArray(Q.columnOutlines)?Q.columnOutlines.map(M=>({...M})):[],te}),n.sheets.value.length>0&&n.loadSheet(0),T&&(e.selection.value=T),e.activeCell.value=G;const F=e.activeCell.value,P=e.selection.value,Y=e.findMerge(F.col,F.row);Y&&Y.anchor===e.cellKey(F.col,F.row)&&(!P||P.startCol===F.col&&P.startRow===F.row&&P.endCol===F.col&&P.endRow===F.row)&&e.selectCell(F.col,F.row),p()},{deep:!0}),t.onBeforeUnmount(()=>{cl==null||cl.disconnect()})}return{scheduleRender:p,render:it,renderFrozenOverlay:I,activeCellLabel:we,formulaBarDisplay:Le,formulaBarDraft:$e,formulaBarExpanded:Z,onFormulaBarFocus:ie,onFormulaBarInput:De,onFormulaBarKeydown:ve,onFormulaBarBlur:Ce,acceptFormulaBarEdit:re,cancelFormulaBarEdit:ne,insertFunctionIntoCell:N,renTab:_,renTabVal:L,onTabClick:U,onTabDblClick:q,commitTabRename:de,cclTabRename:ze,onTabRenameKd:Re,ctxMenu:Pe,ctxSubmenuLeft:xe,filterPopup:lt,isFilterButtonHit:Dt,openFilterPopup:tl,closeFilterPopup:gl,validationDropdown:_e,isValidationDropdownHit:Ht,openValidationDropdown:Xe,closeValidationDropdown:S,onValidationDropdownSelect:ee,onCtxItemEnter:He,onTabCtxMenu:ce,onTabBarCtx:Ze,onCornerCtx:ot,onRowHdrCtx:E,onColHdrCtx:y,onCellCtx:d,dimInputRef:w,dimPanel:be,openDimPanel:bt,onDimInput:Ft,onDimKeydown:Qt,onDimBlur:Tt,applyDimPanel:bl,closeDimPanel:Jl,outlineGroupRows:()=>z("row"),outlineGroupCols:()=>z("column"),outlineUngroupRows:()=>$("row"),outlineUngroupCols:()=>$("column"),outlineExpandRows:()=>H("row",!1),outlineCollapseRows:()=>H("row",!0),outlineExpandCols:()=>H("column",!1),outlineCollapseCols:()=>H("column",!0),get showOutlineAlert(){return u},set showOutlineAlert(m){u=m},editInputStyle:xn,hScrollbarW:co,vScrollbarH:Pn,hScrollbarLeft:hr,vScrollbarTop:gr,hTrackW:Vn,vTrackH:Dn,hThumbW:Gn,hThumbL:uo,vThumbH:Kn,vThumbT:fo,onVStart:br,onHStart:yr,onSbMove:Yn,onSbUp:On,onVTrk:Cr,onHTrk:wr,onMouseDown:vr,onMouseMove:kr,onMouseUp:Er,onMouseLeave:Ao,onCanvasCtx:Lo,onDblClick:zo,onWheel:Rr,onTouchStart:Sr,onTouchMove:Mr,onTouchEnd:Br,onKeydown:$o,onEditInput:Nr,onEditCompositionStart:xr,onEditCompositionEnd:Tr,onEditKd:Vr,onEditPaste:_o,onEditBlur:Ho,applySize:An,setupLifecycle:Dr}}function L1(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ua(e,o,l,n){return o?n?l?e===o:e.toLowerCase()===o.toLowerCase():l?e.includes(o):e.toLowerCase().includes(o.toLowerCase()):!1}function z1(e,o,l,n){if(!o)return e;if(n){const i=e.indexOf(o);return i<0?e:e.slice(0,i)+l+e.slice(i+o.length)}const a=e.toLowerCase().indexOf(o.toLowerCase());return a<0?e:e.slice(0,a)+l+e.slice(a+o.length)}function $1(e,o,l,n){return o?n?e.indexOf(o)<0?e:e.split(o).join(l):e.toLowerCase().indexOf(o.toLowerCase())<0?e:e.replace(new RegExp(L1(o),"gi"),()=>l):e}function pr(e,o,l,n,a,i,r){const c=[];if(r){for(let u=r.startRow;u<=r.endRow;u++)for(let b=r.startCol;b<=r.endCol;b++){const h=e[l(b,u)];h&&Ua(h.value,n,a,i)&&c.push({sheetIndex:o,col:b,row:u})}return c}for(const u in e){const b=e[u];if(b&&Ua(b.value,n,a,i)){const h=u.split(","),C=Number(h[0]),p=Number(h[1]);!Number.isNaN(C)&&!Number.isNaN(p)&&c.push({sheetIndex:o,col:C,row:p})}}return c}function _1(e,o,l,n){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),c=t.ref("sheet"),u=t.ref(!1),b=t.ref(!1),h=t.ref(-1),C=t.ref([]),p=t.ref(""),x=t.ref(0),R=t.ref(""),O=t.computed(()=>{const Z=new Set,Le=l.activeSheetIndex.value;for(const ie of C.value)ie.sheetIndex===Le&&Z.add(`${ie.col},${ie.row}`);return Z}),X=t.computed(()=>{if(h.value<0||h.value>=C.value.length)return null;const Z=C.value[h.value];return Z.sheetIndex!==l.activeSheetIndex.value?null:`${Z.col},${Z.row}`});e.findHighlight=(Z,Le)=>{const ie=`${Z},${Le}`;return X.value===ie?"active":O.value.has(ie)?"match":null};function j(Z){var De,N;const Le=e.cellKey(Z.col,Z.row);if(Z.sheetIndex===l.activeSheetIndex.value)return((De=e.cells[Le])==null?void 0:De.value)??"";const ie=l.sheets.value[Z.sheetIndex];return((N=ie==null?void 0:ie.cells[Le])==null?void 0:N.value)??""}function Ee(Z,Le){const ie=e.cellKey(Z.col,Z.row);if(Z.sheetIndex===l.activeSheetIndex.value)e.setCellValue(Z.col,Z.row,Le);else{const De=l.sheets.value[Z.sheetIndex];if(!De)return;const N=De.cells[ie];De.cells[ie]={value:String(Le),styleId:N==null?void 0:N.styleId}}}function ae(){if(R.value){p.value=R.value;return}if(!i.value){p.value="";return}if(c.value==="selection"&&!e.selection.value){p.value=g(e.locale.value,"findNeedSelection");return}if(C.value.length===0){p.value=g(e.locale.value,"findNoResult");return}p.value=""}function ge(){const Z=i.value,Le=[];if(Z)if(c.value==="workbook")l.sheets.value.forEach((ie,De)=>{Le.push(...pr(ie.cells,De,e.cellKey,Z,u.value,b.value))});else if(c.value==="selection"){const ie=e.selection.value;ie&&Le.push(...pr(e.cells,l.activeSheetIndex.value,e.cellKey,Z,u.value,b.value,ie))}else Le.push(...pr(e.cells,l.activeSheetIndex.value,e.cellKey,Z,u.value,b.value));C.value=Le,Le.length===0?h.value=-1:h.value>=Le.length?h.value=Le.length-1:h.value<0&&(h.value=0),ae()}function me(){if(h.value<0||h.value>=C.value.length)return;const Z=C.value[h.value];Z.sheetIndex!==l.activeSheetIndex.value&&l.switchSheet(Z.sheetIndex),c.value==="selection"?e.activeCell.value={col:Z.col,row:Z.row}:e.selectCell(Z.col,Z.row),e.ensureVisible(Z.col,Z.row)}const pe=typeof requestAnimationFrame=="function"?requestAnimationFrame:Z=>setTimeout(Z,16);let se=!1,Ve=!1;function tt(Z){if(se){Ve=Ve||Z;return}se=!0,Ve=Z,pe(()=>{var Le;se=!1,ge(),Ve&&C.value.length>0&&h.value>=0&&me(),Ve=!1,(Le=e.scheduleRender)==null||Le.call(e)})}function Qe(){var Z;a.value=!0,x.value++,ge(),C.value.length>0&&(h.value=0,me()),(Z=e.scheduleRender)==null||Z.call(e)}function K(){Qe()}function it(){var Z;a.value=!1,C.value=[],h.value=-1,R.value="",p.value="",(Z=e.scheduleRender)==null||Z.call(e)}function I(){var Z;C.value.length!==0&&(h.value=(h.value+1)%C.value.length,me(),(Z=e.scheduleRender)==null||Z.call(e))}function D(){var Z;C.value.length!==0&&(h.value=(h.value-1+C.value.length)%C.value.length,me(),(Z=e.scheduleRender)==null||Z.call(e))}function W(){var N,J;if(h.value<0||h.value>=C.value.length)return;const Z=C.value[h.value],Le=j(Z),ie=z1(Le,i.value,r.value,u.value);if(ie===Le)return;o.saveUndo(),Ee(Z,ie);const De=h.value;ge(),C.value.length>0?(h.value=Math.min(De,C.value.length-1),I()):h.value=-1,(N=e.emitModelData)==null||N.call(e),(J=e.scheduleRender)==null||J.call(e)}function we(){var De,N;const Z=i.value;if(!Z||C.value.length===0)return;o.saveUndo();let Le=0;const ie=C.value.slice();for(const J of ie){const le=j(J),re=$1(le,Z,r.value,u.value);re!==le&&(Ee(J,re),Le++)}C.value=[],h.value=-1,R.value=g(e.locale.value,"findReplacedAll").replace("{n}",String(Le)),ae(),(De=e.emitModelData)==null||De.call(e),(N=e.scheduleRender)==null||N.call(e)}function $e(){const Z=Le=>{if(!(Le.ctrlKey||Le.metaKey))return;const De=Le.key.toLowerCase();(De==="f"||De==="h")&&(Le.preventDefault(),Qe())};window.addEventListener("keydown",Z),t.onBeforeUnmount(()=>window.removeEventListener("keydown",Z))}return t.watch(i,()=>{a.value&&(R.value="",h.value=0,tt(!0))}),t.watch([c,u,b],()=>{a.value&&(R.value="",h.value=0,tt(!0))}),t.watch(e.cells,()=>{a.value&&tt(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&c.value==="selection"&&(h.value=0,tt(!0))}),t.watch([()=>o.undoStack.value.length,()=>o.redoStack.value.length],()=>{a.value&&tt(!1)}),{open:a,findText:i,replaceText:r,scope:c,matchCase:u,matchEntireCell:b,currentIndex:h,results:C,message:p,focusToken:x,activeSheetMatches:O,activeMatchKey:X,openFind:Qe,openReplace:K,close:it,recompute:ge,findNext:I,findPrev:D,replace:W,replaceAll:we,setupLifecycle:$e}}const H1={class:"formula-bar__cell-label"},W1={class:"formula-bar__buttons"},U1=["title","aria-label"],P1=["rows","value"],G1=["title"],K1={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},q1={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Y1=["value"],X1={key:2,class:"sb-corner"},j1=["onClick","onMouseenter"],Z1={class:"context-menu__label"},J1={key:0,class:"context-menu__arrow",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"22869"},Q1=["onClick"],ep={key:0,class:"cf-modal-mask"},tp={key:0,class:"cf-modal-mask"},lp={class:"dim-panel__title"},np={class:"dim-panel__body"},op=["value"],rp={key:0,class:"dim-panel__error"},ap={class:"dim-panel__footer"},Pa=It(t.defineComponent({__name:"spreader",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const o=e,l=t.useModel(e,"data"),n={value:""},a=E1(o,{rowCount:o.rowCount,colCount:o.colCount,theme:o.theme,locale:o.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:y=>{},mkSheet:y=>({id:"",name:y,cells:{},merges:{},styles:[{}],borders:[{}],selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[],colCount:0,rowCount:0,freeze:{rows:0,cols:0},filter:null,conditionalFormats:[],dataValidations:[],rowOutlines:[],columnOutlines:[]})},r=R1(a,i),c=M1(a,r);S1(r,{borderMenuOpen:c.borderMenuOpen,mergeMenuOpen:c.mergeMenuOpen});const u=I1(a,r,l,void 0,n);i.sheets=u.sheets,i.activeSheetIndex=u.activeSheetIndex,i.saveSheet=u.saveSheet,i.loadSheet=u.loadSheet,i.mkSheet=u.mkSheet;const b=A1(a,r,c,u,n);b.setupLifecycle();const h=_1(a,r,u);h.setupLifecycle();const C=t.reactive(a),p=t.reactive(r),x=t.reactive(c),R=t.reactive(u),O=u.sheets,X=u.activeSheetIndex,j=u.sortMenuOpen,Ee=u.cachedSortOrder,ae=t.ref(!1),ge=t.ref(!1),me=t.ref(!1),pe=t.ref(!1),se=t.ref(!1),Ve=t.ref(!1),tt=t.ref(!1),Qe=t.computed(()=>{const y=C.selection;return y?y.startCol===0&&y.endCol===C.colCount-1?"rows":y.startRow===0&&y.endRow===C.rowCount-1?"cols":null:null}),K=t.reactive(b),it=t.reactive(h),I=t.computed(()=>{const y=C.selection;return!!y&&y.startCol===y.endCol&&y.startRow===y.endRow}),D=t.computed(()=>{const y=C.selection;return y?u.canSortColumns(y.startCol,y.endCol):!1}),W=t.computed(()=>{if(C.getFilter()!==null)return!0;const y=C.selection;if(!y)return!0;const d=Math.min(y.startCol,y.endCol),w=Math.max(y.startCol,y.endCol),be=Math.min(y.startRow,y.endRow),ue=Math.max(y.startRow,y.endRow);for(const Oe in C.merges){const qe=C.merges[Oe];if(!(qe.startCol===qe.endCol&&qe.startRow===qe.endRow)&&d<=qe.endCol&&w>=qe.startCol&&be<=qe.endRow&&ue>=qe.startRow)return!1}return!0}),we=t.computed(()=>{const y=p.selNumberFormat;if(y!==Kl&&y!==on)return y;const d=C.activeCell,w=a.resolveStyle(C.cells[C.cellKey(d.col,d.row)]);return typeof(w==null?void 0:w.numberFormat)=="string"?w.numberFormat:""});function $e(y){r.nfDialogOpen.value=y}const Z=t.ref(!1);function Le(){Z.value=!0}function ie(y){Z.value=y}function De(y){b.insertFunctionIntoCell(y)}function N(){C.toggleAutoFilter(),K.scheduleRender()}function J(y){const d=C.getFilter();return d?C.getCellValue(y,d.range.startRow):""}const le=t.computed(()=>{const y=C.selection,d=y?y.startRow:C.activeCell.row,w=y?y.startCol:C.activeCell.col;return d===0&&w===0});function re(y){const d=C.freeze;if(y==="panes"){const w=C.selection,be=w?w.startRow:C.activeCell.row,ue=w?w.startCol:C.activeCell.col;C.setFreeze(be,ue)}else y==="firstRow"?C.setFreeze(1,d.cols):y==="firstCol"?C.setFreeze(d.rows,1):y==="unfreeze"&&C.clearFreeze();K.scheduleRender()}const ne=t.ref(null),ve=t.ref(!1),Ce=t.ref(!1),_=t.ref(null),L=t.ref("create"),U=t.computed(()=>{const y=C.selection;if(y){const w=pt(y.startCol)+(y.startRow+1),be=pt(y.endCol)+(y.endRow+1);return y.startCol===y.endCol&&y.startRow===y.endRow?w:`${w}:${be}`}const d=C.activeCell;return pt(d.col)+(d.row+1)});function q(y){var be;let d;["equal","notEqual","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","notBetween"].includes(y)?d={type:"cellIs",operator:y,value:""}:y==="textContains"?d={type:"textContains",value:""}:y==="textNotContains"?d={type:"textNotContains",value:""}:y==="blank"?d={type:"blank"}:y==="notBlank"?d={type:"notBlank"}:y==="duplicate"?d={type:"duplicate"}:y==="unique"?d={type:"unique"}:d={type:"cellIs",operator:"greaterThan",value:""},_.value={id:"",condition:d,format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},L.value="create",(be=ne.value)==null||be.closeOverflow(),Ce.value=!0}function de(){var y;_.value={id:"",condition:{type:"cellIs",operator:"greaterThan",value:""},format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},L.value="create",(y=ne.value)==null||y.closeOverflow(),Ce.value=!0}function ze(){var y;(y=ne.value)==null||y.closeOverflow(),ve.value=!0}function Re(y){C.clearConditionalFormats(y),K.scheduleRender()}function Pe(y){y.id?C.updateConditionalFormatRule(y.id,y):C.addConditionalFormatRule(y),Ce.value=!1}function lt(y){var d;_.value=y,L.value="edit",(d=ne.value)==null||d.closeOverflow(),Ce.value=!0}function _e(y){C.removeConditionalFormatRule(y)}function Ct(y,d){C.moveConditionalFormatRule(y,d)}function st(y,d){C.updateConditionalFormatRule(y,{enabled:d})}const ct=t.ref(!1),Vt=t.ref(null),$t=t.ref("create"),_t=t.computed(()=>{const y=C.selection;if(y){const w=pt(y.startCol)+(y.startRow+1),be=pt(y.endCol)+(y.endRow+1);return y.startCol===y.endCol&&y.startRow===y.endRow?w:`${w}:${be}`}const d=C.activeCell;return pt(d.col)+(d.row+1)}),Ht=t.ref(null);let Xe=null;function S(y){return new Promise(d=>{Xe=d,Ht.value={...y}})}a.showValidationAlert=S;const ee=t.ref(null);function xt(y){ee.value=y}function Dt(){ee.value=null}b.showOutlineAlert=xt,a.getSheetCellsById=y=>{const d=u.sheets.value.findIndex(w=>w.id===y||w.name===y);return d<0?null:d===u.activeSheetIndex.value?a.cells:u.sheets.value[d].cells},a.requestDataValidationDialog=()=>tl();function tl(){var w;const y=C.activeCell,d=a.getDataValidationRule(y.row,y.col);Vt.value=d?JSON.parse(JSON.stringify(d)):null,$t.value=d?"edit":"create",(w=ne.value)==null||w.closeOverflow(),ct.value=!0}function gl(y){if(y.type==="any"){y.ranges.forEach(d=>a.clearDataValidation(d)),ct.value=!1,b.scheduleRender();return}y.id?a.updateDataValidation(y.id,y):a.createDataValidation(y),ct.value=!1,b.scheduleRender()}function jt(){const y=C.selection;y&&a.clearDataValidation(y),ct.value=!1,b.scheduleRender()}function Kt(y){Ht.value=null;const d=Xe;Xe=null,t.nextTick(()=>{const w=C.editingCell;w&&(a.selectCell(w.col,w.row),a.ensureVisible(w.col,w.row),b.scheduleRender(),u.focusEditInput())}),d==null||d(y)}const Zt=t.computed(()=>{const y=C.activeCell,d=a.getValidationInputMessage(y.row,y.col);if(!d)return null;const w=a.cellToScreenRect(y.row,y.col),be=u.wrapperRef.value,ue=be?be.getBoundingClientRect():{left:0,top:0};return{title:d.title,message:d.message,x:ue.left+w.x,y:ue.top+w.y,width:w.width,height:w.height}});function jl(y){r.fontSizeMenuOpen.value=y}function Zl(y){r.textColorMenuOpen.value=y}function z(y){r.fillColorMenuOpen.value=y}function $(y){switch(y){case"group-rows":b.outlineGroupRows();break;case"group-cols":b.outlineGroupCols();break;case"ungroup-rows":b.outlineUngroupRows();break;case"ungroup-cols":b.outlineUngroupCols();break;case"clear-rows":a.clearRowGroups();break;case"clear-cols":a.clearColumnGroups();break;case"expand-rows":b.outlineExpandRows();break;case"expand-cols":b.outlineExpandCols();break;case"collapse-rows":b.outlineCollapseRows();break;case"collapse-cols":b.outlineCollapseCols();break}}function H(y){b.renTabVal.value=y}function he(){b.ctxMenu.value=null}const Ne=y=>{u.formulaBarRef.value=y};function xe(){b.formulaBarExpanded.value=!b.formulaBarExpanded.value}const He=t.ref(null),Se=y=>{u.wrapperRef.value=y,He.value=y},ce=y=>{u.canvasRef.value=y},Ze=y=>{u.freezeCanvasRef.value=y},ot=y=>{u.editInputRef.value=y},E=y=>{b.dimInputRef.value=y};return(y,d)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(R.outerStyle)},[t.createVNode(hd,{ref_key:"toolbarRef",ref:ne,locale:C.locale,"can-undo":p.canUndo,"can-redo":p.canRedo,"paint-fmt-active":p.paintFmt!==null,"has-selection":p.hasSelection,"font-family-options":p.fontFamilyOptions,"font-size-options":p.fontSizeOptions,"sel-font-family":p.selFontFamily,"sel-font-size":p.selFontSize,"font-size-input":p.fontSizeInput,"font-size-menu-open":p.fontSizeMenuOpen,"sel-font-weight":p.selFontWeight,"sel-font-style":p.selFontStyle,"sel-underline":p.selUnderline,"sel-strikethrough":p.selStrikethrough,"sel-text-color":p.selTextColor,"text-color-menu-open":p.textColorMenuOpen,"sel-fill-color":p.selFillColor,"fill-color-menu-open":p.fillColorMenuOpen,"cached-text-color":p.cachedTextColor,"cached-fill-color":p.cachedFillColor,"border-menu-open":x.borderMenuOpen,"cached-border":x.cachedBorder,"sort-menu-open":t.unref(j),"cached-sort-order":t.unref(Ee),"can-sort":D.value,"outline-menu-open":ae.value,"outline-axis":Qe.value,"can-filter":W.value,"filter-active":C.getFilter()!==null,"h-align-options":p.hAlignOptions,"v-align-options":p.vAlignOptions,"sel-h-align":p.selHAlign,"sel-v-align":p.selVAlign,"sel-wrap":p.selWrap,"merge-menu-open":x.mergeMenuOpen,"calc-menu-open":x.calcMenuOpen,"cf-menu-open":ge.value,"freeze-menu-open":me.value,"font-menu-open":pe.value,"h-align-menu-open":se.value,"v-align-menu-open":Ve.value,"num-fmt-menu-open":tt.value,"is-single-cell":I.value,"has-freeze":C.freeze.rows>0||C.freeze.cols>0,"freeze-panes-disabled":le.value,"sel-number-format":p.selNumberFormatDisplay,"nf-options":p.nfOptions,"can-increase-decimals":p.canIncreaseDecimals,"can-decrease-decimals":p.canDecreaseDecimals,"boundary-el":He.value,"theme-vars":R.toolbarThemeVars,onUndo:d[0]||(d[0]=w=>p.undo()),onRedo:d[1]||(d[1]=w=>p.redo()),onPaintFormat:p.onPaintFormat,onClearFormat:d[2]||(d[2]=w=>p.clearFormat()),onNumberFormatChange:d[3]||(d[3]=w=>p.onNumberFormatChange(w)),onIncreaseDecimals:p.onIncreaseDecimals,onDecreaseDecimals:p.onDecreaseDecimals,onFontFamilyChange:d[4]||(d[4]=w=>p.onFontFamilyChange(w)),onFontSizeInput:d[5]||(d[5]=w=>p.onFontSizeInput(w)),onFontSizeBlur:p.onFontSizeBlur,onFontSizeKeydown:d[6]||(d[6]=w=>p.onFontSizeKeydown(w)),onFontSizeChange:d[7]||(d[7]=w=>p.onFontSizeChange(w)),"onUpdate:fontSizeMenuOpen":d[8]||(d[8]=w=>jl(w)),onFontSizeToggle:d[9]||(d[9]=w=>p.toggleFontSizeMenu()),onFontSizeStepUp:p.onFontSizeStepUp,onFontSizeStepDown:p.onFontSizeStepDown,onBoldToggle:p.toggleFontWeight,onItalicToggle:p.toggleFontStyle,onUnderlineToggle:p.toggleUnderline,onStrikethroughToggle:p.toggleStrikethrough,onTextColorChange:d[10]||(d[10]=w=>p.onTextColorChange(w)),"onUpdate:textColorMenuOpen":d[11]||(d[11]=w=>Zl(w)),onFillColorChange:d[12]||(d[12]=w=>p.onFillColorChange(w)),"onUpdate:fillColorMenuOpen":d[13]||(d[13]=w=>z(w)),onApplyTextColor:p.applyCachedTextColor,onApplyFillColor:p.applyCachedFillColor,"onUpdate:borderMenuOpen":d[14]||(d[14]=w=>p.onBorderMenuToggle(w)),onBorderChange:d[15]||(d[15]=w=>x.onBorderChange(w)),onApplyBorder:x.applyCachedBorder,"onUpdate:sortMenuOpen":d[16]||(d[16]=w=>R.onSortMenuToggle(w)),onSortChange:d[17]||(d[17]=w=>R.onSortChange(w)),onApplySort:R.applyCachedSort,"onUpdate:outlineMenuOpen":d[18]||(d[18]=w=>ae.value=w),onOutlineAction:d[19]||(d[19]=w=>$(w)),onToggleFilter:N,onFreezeChange:d[20]||(d[20]=w=>re(w)),onHAlignChange:d[21]||(d[21]=w=>p.onHAlignChange(w)),onVAlignChange:d[22]||(d[22]=w=>p.onVAlignChange(w)),onWrapToggle:p.onWrapToggle,"onUpdate:mergeMenuOpen":d[23]||(d[23]=w=>x.onMergeMenuToggle(w)),onMergeChange:d[24]||(d[24]=w=>x.onMergeChange(w)),onApplyMerge:x.onApplyMerge,"onUpdate:calcMenuOpen":d[25]||(d[25]=w=>x.onCalcMenuToggle(w)),"onUpdate:cfMenuOpen":d[26]||(d[26]=w=>ge.value=w),"onUpdate:freezeMenuOpen":d[27]||(d[27]=w=>me.value=w),"onUpdate:fontMenuOpen":d[28]||(d[28]=w=>pe.value=w),"onUpdate:hAlignMenuOpen":d[29]||(d[29]=w=>se.value=w),"onUpdate:vAlignMenuOpen":d[30]||(d[30]=w=>Ve.value=w),"onUpdate:numFmtMenuOpen":d[31]||(d[31]=w=>tt.value=w),onCalcSum:x.onCalcSum,onCalcAvg:x.onCalcAvg,onCalcCount:x.onCalcCount,onFind:d[32]||(d[32]=w=>t.unref(h).openFind()),onCfPreset:d[33]||(d[33]=w=>q(w)),onCfNewRule:de,onCfManage:ze,onCfClear:d[34]||(d[34]=w=>Re(w)),onOpenDataValidation:tl},null,8,["locale","can-undo","can-redo","paint-fmt-active","has-selection","font-family-options","font-size-options","sel-font-family","sel-font-size","font-size-input","font-size-menu-open","sel-font-weight","sel-font-style","sel-underline","sel-strikethrough","sel-text-color","text-color-menu-open","sel-fill-color","fill-color-menu-open","cached-text-color","cached-fill-color","border-menu-open","cached-border","sort-menu-open","cached-sort-order","can-sort","outline-menu-open","outline-axis","can-filter","filter-active","h-align-options","v-align-options","sel-h-align","sel-v-align","sel-wrap","merge-menu-open","calc-menu-open","cf-menu-open","freeze-menu-open","font-menu-open","h-align-menu-open","v-align-menu-open","num-fmt-menu-open","is-single-cell","has-freeze","freeze-panes-disabled","sel-number-format","nf-options","can-increase-decimals","can-decrease-decimals","boundary-el","theme-vars","onPaintFormat","onIncreaseDecimals","onDecreaseDecimals","onFontSizeBlur","onFontSizeStepUp","onFontSizeStepDown","onBoldToggle","onItalicToggle","onUnderlineToggle","onStrikethroughToggle","onApplyTextColor","onApplyFillColor","onApplyBorder","onApplySort","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg","onCalcCount"]),t.createVNode(Pd,{open:it.open,"find-text":it.findText,"replace-text":it.replaceText,scope:it.scope,"match-case":it.matchCase,"match-entire-cell":it.matchEntireCell,"current-index":it.currentIndex,total:it.results.length,message:it.message,"focus-token":it.focusToken,locale:C.locale,"theme-vars":R.toolbarThemeVars,"onUpdate:findText":d[35]||(d[35]=w=>t.unref(h).findText.value=w),"onUpdate:replaceText":d[36]||(d[36]=w=>t.unref(h).replaceText.value=w),"onUpdate:scope":d[37]||(d[37]=w=>t.unref(h).scope.value=w),"onUpdate:matchCase":d[38]||(d[38]=w=>t.unref(h).matchCase.value=w),"onUpdate:matchEntireCell":d[39]||(d[39]=w=>t.unref(h).matchEntireCell.value=w),onPrev:d[40]||(d[40]=w=>t.unref(h).findPrev()),onNext:d[41]||(d[41]=w=>t.unref(h).findNext()),onReplace:d[42]||(d[42]=w=>t.unref(h).replace()),onReplaceAll:d[43]||(d[43]=w=>t.unref(h).replaceAll()),onClose:d[44]||(d[44]=w=>t.unref(h).close())},null,8,["open","find-text","replace-text","scope","match-case","match-entire-cell","current-index","total","message","focus-token","locale","theme-vars"]),t.createVNode(bu,{"model-open":p.nfDialogOpen,locale:C.locale,"current-format":we.value,"is-custom":p.selNumberFormat===t.unref(on),"onUpdate:modelOpen":d[45]||(d[45]=w=>$e(w)),onApply:d[46]||(d[46]=w=>p.applyNumberFormatCode(w))},null,8,["model-open","locale","current-format","is-custom"]),t.createVNode(Mu,{"model-open":R.sortConfirmOpen,locale:C.locale,"onUpdate:modelOpen":d[47]||(d[47]=w=>R.sortConfirmOpen=w),onConfirm:d[48]||(d[48]=w=>R.confirmSort(w)),onCancel:d[49]||(d[49]=w=>R.cancelSortConfirmation())},null,8,["model-open","locale"]),t.createVNode(Pu,{"model-open":Z.value,locale:C.locale,"onUpdate:modelOpen":d[50]||(d[50]=w=>ie(w)),onInsert:d[51]||(d[51]=w=>De(w))},null,8,["model-open","locale"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":K.formulaBarExpanded}])},[t.createElementVNode("div",H1,t.toDisplayString(K.activeCellLabel),1),t.createElementVNode("div",W1,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:d[52]||(d[52]=t.withModifiers(()=>{},["prevent"])),onClick:d[53]||(d[53]=t.withModifiers((...w)=>K.cancelFormulaBarEdit&&K.cancelFormulaBarEdit(...w),["stop"]))},[...d[113]||(d[113]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 3l8 8M11 3l-8 8",fill:"none",stroke:"#e53935","stroke-width":"1.8","stroke-linecap":"round"})],-1)])],32),t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--accept",title:"接受(Enter)","aria-label":"接受",onMousedown:d[54]||(d[54]=t.withModifiers(()=>{},["prevent"])),onClick:d[55]||(d[55]=t.withModifiers((...w)=>K.acceptFormulaBarEdit&&K.acceptFormulaBarEdit(...w),["stop"]))},[...d[114]||(d[114]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M2.5 7.5l3.5 3.5L12 3.5",fill:"none",stroke:"#2e7d32","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],32),t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--fx",title:t.unref(g)(C.locale,"insertFunctionTitle"),"aria-label":t.unref(g)(C.locale,"insertFunctionTitle"),onMousedown:d[56]||(d[56]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(Le,["stop"])},[...d[115]||(d[115]=[t.createElementVNode("svg",{class:"formula-bar__fx-icon",width:"16",height:"16",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[t.createElementVNode("path",{fill:"currentColor",d:"M841 370c3-3.3 2.7-8.3-0.6-11.3-1.5-1.3-3.4-2.1-5.3-2.1h-72.6c-2.4 0-4.6 1-6.1 2.8L633.5 504.6c-2.9 3.4-7.9 3.8-11.3 0.9-0.9-0.8-1.6-1.7-2.1-2.8l-63.5-141.3c-1.3-2.9-4.1-4.7-7.3-4.7H380.7l0.9-4.7 8-42.3c10.5-55.4 38-81.4 85.8-81.4 18.6 0 35.5 1.7 48.8 4.7l14.1-66.8c-22.6-4.7-35.2-6.1-54.9-6.1-103.3 0-156.4 44.3-175.9 147.3l-9.4 49.4h-97.6c-3.8 0-7.1 2.7-7.8 6.4L181.9 415c-0.9 4.3 1.9 8.6 6.2 9.5 0.5 0.1 1.1 0.2 1.6 0.2H284l-89 429.9c-0.9 4.3 1.9 8.6 6.2 9.5 0.5 0.1 1.1 0.2 1.6 0.2H269c3.8 0 7.1-2.7 7.8-6.4l89.7-433.1h135.8l68.2 139.1c1.4 2.9 1 6.4-1.2 8.8l-180.6 203c-2.9 3.3-2.6 8.4 0.7 11.3 1.5 1.3 3.4 2 5.3 2h72.7c2.4 0 4.6-1 6.1-2.8l123.7-146.7c2.8-3.4 7.9-3.8 11.3-1 0.9 0.8 1.6 1.7 2.1 2.8L676.4 784c1.3 2.8 4.1 4.7 7.3 4.7h64.6c4.4 0 8-3.6 8-8 0-1.2-0.3-2.4-0.8-3.5l-95.2-198.9c-1.4-2.9-0.9-6.4 1.3-8.8L841 370z"})],-1)])],40,U1)]),t.createElementVNode("textarea",{ref:Ne,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":K.formulaBarExpanded}]),rows:K.formulaBarExpanded?3:1,value:K.formulaBarDisplay,spellcheck:"false",onFocus:d[57]||(d[57]=(...w)=>K.onFormulaBarFocus&&K.onFormulaBarFocus(...w)),onInput:d[58]||(d[58]=(...w)=>K.onFormulaBarInput&&K.onFormulaBarInput(...w)),onKeydown:d[59]||(d[59]=(...w)=>K.onFormulaBarKeydown&&K.onFormulaBarKeydown(...w)),onBlur:d[60]||(d[60]=(...w)=>K.onFormulaBarBlur&&K.onFormulaBarBlur(...w))},null,42,P1),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:K.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:d[61]||(d[61]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(xe,["stop"])},[K.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",q1,[...d[117]||(d[117]=[t.createElementVNode("path",{d:"M2 8l4-4 4 4",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",K1,[...d[116]||(d[116]=[t.createElementVNode("path",{d:"M2 4l4 4 4-4",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))],40,G1)],2),t.createElementVNode("div",{ref:Se,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:ce,class:"grid-canvas",tabindex:"0",onMousedown:d[62]||(d[62]=(...w)=>K.onMouseDown&&K.onMouseDown(...w)),onMousemove:d[63]||(d[63]=(...w)=>K.onMouseMove&&K.onMouseMove(...w)),onMouseup:d[64]||(d[64]=(...w)=>K.onMouseUp&&K.onMouseUp(...w)),onMouseleave:d[65]||(d[65]=(...w)=>K.onMouseLeave&&K.onMouseLeave(...w)),onDblclick:d[66]||(d[66]=(...w)=>K.onDblClick&&K.onDblClick(...w)),onWheel:d[67]||(d[67]=t.withModifiers((...w)=>K.onWheel&&K.onWheel(...w),["prevent"])),onFocus:d[68]||(d[68]=(...w)=>R.onCanvasFocus&&R.onCanvasFocus(...w)),onKeydown:d[69]||(d[69]=(...w)=>K.onKeydown&&K.onKeydown(...w)),onContextmenu:d[70]||(d[70]=(...w)=>K.onCanvasCtx&&K.onCanvasCtx(...w)),onTouchstart:d[71]||(d[71]=t.withModifiers((...w)=>K.onTouchStart&&K.onTouchStart(...w),["prevent"])),onTouchmove:d[72]||(d[72]=t.withModifiers((...w)=>K.onTouchMove&&K.onTouchMove(...w),["prevent"])),onTouchend:d[73]||(d[73]=(...w)=>K.onTouchEnd&&K.onTouchEnd(...w))},null,32),t.createElementVNode("canvas",{ref:Ze,class:"grid-canvas grid-canvas--freeze","aria-hidden":"true"}),t.createElementVNode("textarea",{ref:ot,class:"cell-editor",value:C.editValue,style:t.normalizeStyle(K.editInputStyle),onInput:d[74]||(d[74]=(...w)=>K.onEditInput&&K.onEditInput(...w)),onKeydown:d[75]||(d[75]=(...w)=>K.onEditKd&&K.onEditKd(...w)),onCompositionstart:d[76]||(d[76]=(...w)=>K.onEditCompositionStart&&K.onEditCompositionStart(...w)),onCompositionend:d[77]||(d[77]=(...w)=>K.onEditCompositionEnd&&K.onEditCompositionEnd(...w)),onBlur:d[78]||(d[78]=(...w)=>K.onEditBlur&&K.onEditBlur(...w)),onPaste:d[79]||(d[79]=(...w)=>K.onEditPaste&&K.onEditPaste(...w))},null,44,Y1),R.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:K.vScrollbarTop+"px",height:`calc(100% - ${K.vScrollbarTop+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:d[80]||(d[80]=t.withModifiers(w=>{R.clampScroll(null,C.scrollY-50),K.scheduleRender()},["prevent"]))},[...d[118]||(d[118]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:d[82]||(d[82]=(...w)=>K.onVTrk&&K.onVTrk(...w))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:K.vThumbT+"px",height:K.vThumbH+"px"}),onMousedown:d[81]||(d[81]=(...w)=>K.onVStart&&K.onVStart(...w))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:d[83]||(d[83]=t.withModifiers(w=>{R.clampScroll(null,C.scrollY+50),K.scheduleRender()},["prevent"]))},[...d[119]||(d[119]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),R.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:K.hScrollbarLeft+"px",width:`calc(100% - ${K.hScrollbarLeft+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:d[84]||(d[84]=t.withModifiers(w=>{R.clampScroll(C.scrollX-50,null),K.scheduleRender()},["prevent"]))},[...d[120]||(d[120]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:d[86]||(d[86]=(...w)=>K.onHTrk&&K.onHTrk(...w))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:K.hThumbL+"px",width:K.hThumbW+"px"}),onMousedown:d[85]||(d[85]=(...w)=>K.onHStart&&K.onHStart(...w))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:d[87]||(d[87]=t.withModifiers(w=>{R.clampScroll(C.scrollX+50,null),K.scheduleRender()},["prevent"]))},[...d[121]||(d[121]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),R.maxScrollX>0&&R.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",X1)):t.createCommentVNode("",!0)]),t.createVNode(Nd,{locale:C.locale,sheets:t.unref(O),"active-sheet-index":t.unref(X),"ren-tab":K.renTab,"ren-tab-val":K.renTabVal,"boundary-el":He.value,onTabClick:d[88]||(d[88]=w=>K.onTabClick(w)),onTabDblclick:d[89]||(d[89]=w=>K.onTabDblClick(w)),onTabContextmenu:d[90]||(d[90]=w=>K.onTabCtxMenu(w.ev,w.i)),onTabRenameInput:d[91]||(d[91]=w=>H(w)),onTabRenameKeydown:d[92]||(d[92]=w=>K.onTabRenameKd(w)),onTabRenameCommit:K.commitTabRename,onTabbarContextmenu:d[93]||(d[93]=w=>K.onTabBarCtx(w)),onDeleteSheet:d[94]||(d[94]=w=>{R.removeSheet(w),K.scheduleRender()}),onAddSheet:d[95]||(d[95]=w=>{R.addSheet(),K.scheduleRender()})},null,8,["locale","sheets","active-sheet-index","ren-tab","ren-tab-val","boundary-el","onTabRenameCommit"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[K.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:K.ctxMenu.x+"px",top:K.ctxMenu.y+"px"}),onClick:d[96]||(d[96]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(K.ctxMenu.items,(w,be)=>(t.openBlock(),t.createElementBlock("div",{key:be,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":w.disabled}]),onClick:ue=>!w.disabled&&w.action&&(w.action(),he()),onMouseenter:ue=>K.onCtxItemEnter(ue,w)},[t.createElementVNode("span",Z1,t.toDisplayString(w.label),1),w.children?(t.openBlock(),t.createElementBlock("svg",J1,[...d[122]||(d[122]=[t.createElementVNode("path",{d:"M361.386667 180.053333a32 32 0 0 0 0 45.226667L648.106667 512l-286.72 286.72a32 32 0 1 0 45.226666 45.226667l309.333334-309.333334a32 32 0 0 0 0-45.226666L406.613333 180.053333a32 32 0 0 0-45.226666 0z","p-id":"22870"},null,-1)])])):t.createCommentVNode("",!0),w.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":K.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.children,(ue,Oe)=>(t.openBlock(),t.createElementBlock("div",{key:Oe,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":ue.disabled}]),onClick:t.withModifiers(qe=>!ue.disabled&&ue.action&&(ue.action(),he()),["stop"])},t.toDisplayString(ue.label),11,Q1))),128))],2)):t.createCommentVNode("",!0)],42,j1))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),K.filterPopup?(t.openBlock(),t.createBlock(gf,{key:K.filterPopup.col,col:K.filterPopup.col,"header-label":J(K.filterPopup.col),anchor:{x:K.filterPopup.x,y:K.filterPopup.y},locale:C.locale,"get-filter":C.getFilter,"set-filter":C.setFilter,"set-filter-column":C.setFilterColumn,"clear-filter-column":C.clearFilterColumn,"get-column-candidates":C.getColumnCandidates,close:K.closeFilterPopup,"boundary-el":He.value},null,8,["col","header-label","anchor","locale","get-filter","set-filter","set-filter-column","clear-filter-column","get-column-candidates","close","boundary-el"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[ve.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:d[98]||(d[98]=t.withModifiers(w=>ve.value=!1,["self"]))},[t.createVNode(Df,{locale:C.locale,rules:C.conditionalFormats,"theme-vars":R.toolbarThemeVars,onNew:de,onEdit:lt,onDelete:_e,onMove:Ct,onToggle:st,onClose:d[97]||(d[97]=w=>ve.value=!1)},null,8,["locale","rules","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[Ce.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:d[100]||(d[100]=t.withModifiers(w=>Ce.value=!1,["self"]))},[t.createVNode(ym,{locale:C.locale,mode:L.value,rule:_.value,"default-range-text":U.value,"theme-vars":R.toolbarThemeVars,onSave:Pe,onCancel:d[99]||(d[99]=w=>Ce.value=!1)},null,8,["locale","mode","rule","default-range-text","theme-vars"])])):t.createCommentVNode("",!0)])),K.validationDropdown?(t.openBlock(),t.createBlock(T0,{key:`${K.validationDropdown.col},${K.validationDropdown.row}`,items:K.validationDropdown.items,current:K.validationDropdown.current,locale:C.locale,x:K.validationDropdown.x,y:K.validationDropdown.y,width:K.validationDropdown.width,height:K.validationDropdown.height,"boundary-el":He.value,onSelect:d[101]||(d[101]=w=>t.unref(b).onValidationDropdownSelect(w)),onClose:d[102]||(d[102]=w=>t.unref(b).closeValidationDropdown())},null,8,["items","current","locale","x","y","width","height","boundary-el"])):t.createCommentVNode("",!0),Zt.value?(t.openBlock(),t.createBlock(H0,{key:2,title:Zt.value.title,message:Zt.value.message,x:Zt.value.x,y:Zt.value.y,width:Zt.value.width,height:Zt.value.height},null,8,["title","message","x","y","width","height"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[ct.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:d[104]||(d[104]=t.withModifiers(w=>ct.value=!1,["self"]))},[t.createVNode(v0,{locale:C.locale,mode:$t.value,rule:Vt.value,"default-range-text":_t.value,"theme-vars":R.toolbarThemeVars,onSave:gl,onClear:jt,onCancel:d[103]||(d[103]=w=>ct.value=!1)},null,8,["locale","mode","rule","default-range-text","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[Ht.value?(t.openBlock(),t.createElementBlock("div",ep,[t.createVNode(aa,{locale:C.locale,severity:Ht.value.severity,title:Ht.value.title,message:Ht.value.message,"theme-vars":R.toolbarThemeVars,onResolve:Kt},null,8,["locale","severity","title","message","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[ee.value?(t.openBlock(),t.createElementBlock("div",tp,[t.createVNode(aa,{locale:C.locale,severity:"information",title:t.unref(g)(C.locale,"outlineAlertTitle"),message:ee.value,"theme-vars":R.toolbarThemeVars,onResolve:Dt},null,8,["locale","title","message","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[K.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:K.dimPanel.x+"px",top:K.dimPanel.y+"px"}),onMousedown:d[110]||(d[110]=t.withModifiers(()=>{},["stop"])),onTouchstart:d[111]||(d[111]=t.withModifiers(()=>{},["stop"])),onClick:d[112]||(d[112]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",lp,t.toDisplayString(K.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",np,[t.createElementVNode("input",{ref:E,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":K.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:K.dimPanel.value,onInput:d[105]||(d[105]=(...w)=>K.onDimInput&&K.onDimInput(...w)),onKeydown:d[106]||(d[106]=(...w)=>K.onDimKeydown&&K.onDimKeydown(...w)),onBlur:d[107]||(d[107]=(...w)=>K.onDimBlur&&K.onDimBlur(...w))},null,42,op)]),K.dimPanel.error?(t.openBlock(),t.createElementBlock("div",rp,t.toDisplayString(K.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",ap,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:d[108]||(d[108]=(...w)=>K.applyDimPanel&&K.applyDimPanel(...w))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:d[109]||(d[109]=(...w)=>K.closeDimPanel&&K.closeDimPanel(...w))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-d41df7e2"]]);hn.Spreader=Pa,hn.default=Pa,Object.defineProperties(hn,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|