xiaodao-spreader 0.1.28 → 0.1.29

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.
@@ -1,9 +1,9 @@
1
- (function(Oo,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(Oo=typeof globalThis<"u"?globalThis:Oo||self,t(Oo.XiaoDaoSpreader={},Oo.Vue))})(this,function(Oo,t){"use strict";const gl={"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:"范围",scopeSheet:"当前工作表",scopeWorkbook:"整个工作簿",scopeSelection:"当前选区",matchCase:"区分大小写",matchEntireCell:"完整匹配",findNoResult:"未找到",findNeedSelection:"请先选择范围",findReplacedAll:"已替换 {n} 处",findClose:"关闭",freezePane:"冻结窗格",freezePanes:"冻结窗格",freezeFirstRow:"冻结首行",freezeFirstCol:"冻结首列",unfreezePanes:"取消冻结",freezeToRow:"冻结至此行",freezeToCol:"冻结至此列"},"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",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"}};function T(e,l){var n;return((n=gl[e])==null?void 0:n[l])??l}const Xo='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',ko=10,yl=[{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'}],bl=[{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}],Cl='<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>',vl='<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>',wl='<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>',kl='<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>',El='<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>',Sl='<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>',Rl=[{value:"left",labelKey:"alignLeft",icon:Cl},{value:"center",labelKey:"alignCenter",icon:vl},{value:"right",labelKey:"alignRight",icon:wl}],Ml=[{value:"top",labelKey:"alignTop",icon:kl},{value:"middle",labelKey:"alignMiddle",icon:El},{value:"bottom",labelKey:"alignBottom",icon:Sl}],zn=[{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>'}],xl={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)"},Bl={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)"},Eo="__nf_custom__",ho="",So="",oo="@",gn="__NF_INVALID__",kn=2958465,En=0;function no(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function Sn(e){return e==="zh-CN"?"¥":"$"}function Dl(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Ln(e){return e.replace(/"([^"]*)"/g,"$1")}function Tl(e){let l=e,n;const o=l.match(/^\[([^\]]+)\]/);o&&(n=o[1].toLowerCase(),l=l.slice(o[0].length)),l=Dl(l);const a=/E[+-]/i.test(l),i=l.includes("%"),r=l.search(/[0#?]/);if(r===-1)return{hasDigits:!1,decimals:0,minDecimals:0,minIntDigits:0,thousands:!1,scale:i?100:1,scientific:!1,prefix:l,suffix:"",color:n};let f=-1;for(let Z=l.length-1;Z>=0;Z--){const ie=l[Z];if(ie==="0"||ie==="#"||ie==="?"||ie==="E"){f=Z;break}}f<0&&(f=r);const m=r>0?l.slice(0,r):"",h=f<l.length-1?l.slice(f+1):"",S=l.slice(r,f+1),d=/[0#?]/.test(S),k=S.includes(",");let E=S.replace(/,/g,"");if(a){const Z=E.search(/E/i);Z>=0&&(E=E.slice(0,Z))}const J=E.indexOf("."),j=J>=0?E.slice(0,J):E,le=J>=0?E.slice(J+1):"",L=(le.match(/[0#?]/g)||[]).length,g=(le.match(/0/g)||[]).length,he=(j.match(/0/g)||[]).length;return{hasDigits:d,decimals:L,minDecimals:g,minIntDigits:he,thousands:k,scale:i?100:1,scientific:a,prefix:m,suffix:h,color:n}}function Nl(e){const l=[];let n=!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]":n=!0,l.push({type:"hour",len:0});break;case"[mm]":n=!0,l.push({type:"minute",len:2});break;case"[ss]":n=!0,l.push({type:"second",len:2});break;case"yyyy":l.push({type:"year",len:4});break;case"yy":case"y":l.push({type:"year",len:2});break;case"mmmm":l.push(n?{type:"minute",len:4}:{type:"monthName",len:4});break;case"mmm":l.push(n?{type:"minute",len:3}:{type:"monthName",len:3});break;case"mm":l.push(n?{type:"minute",len:2}:{type:"month",len:2});break;case"m":l.push(n?{type:"minute",len:1}:{type:"month",len:1});break;case"dddd":l.push({type:"weekday",len:4});break;case"ddd":l.push({type:"weekday",len:3});break;case"dd":l.push({type:"day",len:2});break;case"d":l.push({type:"day",len:1});break;case"hh":l.push({type:"hour",len:2});break;case"h":l.push({type:"hour",len:1});break;case"ss":l.push({type:"second",len:2});break;case"s":l.push({type:"second",len:1});break;case"AM/PM":case"am/pm":l.push({type:"ampm",len:2});break;default:i.startsWith('"')?l.push({type:"literal",text:Ln(i),len:0}):l.push({type:"literal",text:i,len:0})}}return{tokens:l,isDuration:n}}const $n=new Map;function Il(e){const l=e.replace(/\[[^\]]*\]/gi,i=>/^\[(h|mm|ss)\]$/i.test(i)?i:"");if(/[ydhs]/.test(l)||/AM\/PM/i.test(l)||/\[h\]/i.test(l)){const i=e.split(";")[0]??e,{tokens:r,isDuration:f}=Nl(i);return{kind:f?"duration":"date",sections:[],tokens:r,isDuration:f,raw:e}}return{kind:"number",sections:e.split(";").map(i=>Tl(i)),tokens:[],isDuration:!1,raw:e}}function Ro(e){const l=$n.get(e);if(l)return l;const n=Il(e);return $n.set(e,n),n}function _n(e,l,n,o,a){const i=Math.pow(10,l),r=Math.round((e+Number.EPSILON)*i)/i,f=r<0,m=Math.abs(r);let S=new Intl.NumberFormat("en-US",{useGrouping:o,minimumIntegerDigits:a,minimumFractionDigits:l,maximumFractionDigits:l}).format(m);if(n<l&&l>0){const k=S.indexOf(".");if(k>=0){const v=S.substring(0,k);let E=S.substring(k+1);E=E.replace(/0+$/,""),E.length<n&&(E=E+"0".repeat(n-E.length)),S=E?`${v}.${E}`:v}}return`${f?"-":""}${S}`}function Wn(e,l){if(e===0)return(l>0?"0."+"0".repeat(l):"0")+"E+00";const n=Math.floor(Math.log10(Math.abs(e))),o=e/Math.pow(10,n),a=_n(o,l,l,!1,1),i=(n>=0?"+":"-")+String(Math.abs(n)).padStart(2,"0");return`${a}E${i}`}function Fl(e,l,n){if(!n.hasDigits)return Ln(n.prefix+n.suffix);const o=n.scale===100?e*100:e,a=n.scientific?Wn(o,n.decimals):_n(o,n.decimals,n.minDecimals,n.thousands,n.minIntDigits);return l+n.prefix+a+n.suffix}function Al(e,l){const n=l.sections;if(n.length===0)return String(e);let o,a,i="";return e>0?(o=n[0],a=e):e<0?n[1]?(o=n[1],a=-e):(o=n[0],a=-e,i="-"):(o=n[2]??n[0],a=0),Fl(a,i,o)}function Vl(e){return new Date((e-25569)*864e5)}const Ol=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Hl=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Pn=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],zl=["January","February","March","April","May","June","July","August","September","October","November","December"],Ll=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Kn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function tn(e,l){return String(e).padStart(l,"0")}function $l(e,l,n,o){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),f=e.getUTCDay(),m=n==="zh-CN";let h="",S=!1;for(const d of l)switch(d.type){case"literal":h+=d.text??"";break;case"year":h+=d.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":h+=tn(S?e.getUTCMinutes():i,d.len);break;case"monthName":h+=d.len>=4?m?Ol[i-1]:zl[i-1]:m?Hl[i-1]:Ll[i-1];break;case"day":h+=tn(r,d.len);break;case"weekday":h+=d.len>=4?m?Pn[f]:Kn[f]:m?Pn[f].slice(2):Kn[f].slice(0,3);break;case"hour":{let k=e.getUTCHours();if(d.len===0){const v=Math.floor(o*86400);k=Math.floor(v/3600)}h+=String(k),S=!0;break}case"minute":h+=tn(e.getUTCMinutes(),d.len);break;case"second":h+=tn(e.getUTCSeconds(),d.len);break;case"ampm":{const k=e.getUTCHours();h+=k<12?m?"上午":"AM":m?"下午":"PM";break}}return h}function _l(e,l){const n=Math.floor(e*86400),o=Math.floor(n/3600),a=Math.floor(n%3600/60),i=n%60;let r="";for(const f of l)switch(f.type){case"literal":r+=f.text??"";break;case"hour":r+=String(o);break;case"minute":r+=tn(a,f.len||2);break;case"second":r+=tn(i,f.len||2);break;default:r+=""}return r}function Wl(e){if(e==="")return e;const l=Number(e);if(!isNaN(l)&&e.trim()!==""){const n=Math.abs(l);return n!==0&&(n>=1e15||n<1e-9)?Wn(l,9):e}return e}function Ho(e,l,n){if(no(l))return Wl(e);if(l==null||l===oo)return e;const o=Ro(l);if(o.kind==="date"||o.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(o.kind==="date"){if(i<En||i>kn)return gn}else if(i<0)return gn;return o.kind==="duration"?_l(i,o.tokens):$l(Vl(i),o.tokens,n,i)}const a=Number(e);return isNaN(a)?e:Al(a,o)}const Pl=["general","text","number","percent","scientific","accounting","financial","currency","currencyRounded","date","time","dateTime","duration","custom"];function Rn(e,l){if(l===oo||l==="@")return!1;if(no(l)){if(e==null||e===""||e.trim()==="")return!1;const o=Number(e);return!Number.isNaN(o)&&Number.isFinite(o)}const n=Ro(l);return!!(n.kind==="number"&&Un(n))}function Un(e){return e.sections.some(l=>l.hasDigits)}function Gn(e){if(e==null||no(e)||e===oo||e==="@")return!1;const l=Ro(e);return!!(l.kind==="date"||l.kind==="duration"||l.kind==="number"&&Un(l))}function Yn(e,l){if(l==null||no(l)||l===oo||l==="@")return!1;const n=Ro(l),o=Number(e);return Number.isFinite(o)?n.kind==="date"?o<En||o>kn:n.kind==="duration"?o<0:!1:!1}const Mn=30,xn=0;function sn(e){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}function Xn(e,l){if(e==null||e===ho||no(e))return sn(l);if(e===oo)return!1;const n=Ro(e);return n.kind==="date"||n.kind==="duration"?!1:n.sections.some(o=>o.hasDigits)}function Kl(e){if(!sn(e))return 0;const l=String(Number(e));return l.indexOf(".")<0||/e/i.test(l)?0:l.slice(l.indexOf(".")+1).length}function Ul(e,l){if(!Xn(e,l))return-1;if(e==null||e===ho||no(e))return Kl(l);const o=Ro(e).sections.find(a=>a.hasDigits);return o?o.decimals:-1}function Gl(e,l){let n=0;const o=/\[[^\]]*\]/g;let a;for(;(a=o.exec(e))!==null&&!/^\[(h|mm|ss)\]$/i.test(a[0]);)n=a.index+a[0].length;const i=e.slice(0,n),r=e.slice(n),f=r.search(/[0#?]/);if(f===-1)return e;let m=-1;for(let j=r.length-1;j>=0;j--){const le=r[j];if(le==="0"||le==="#"||le==="?"||le==="E"){m=j;break}}if(m<f)return e;const h=r.slice(f,m+1),S=h.search(/E[+-]/i),d=S>=0?h.slice(0,S):h,k=d.indexOf("."),v=k>=0?(d.slice(k+1).match(/[0#?]/g)||[]).length:0;if(v===l)return e;let E;if(k<0)E=l>0?d+"."+"0".repeat(l):d;else if(l>v)E=d+"0".repeat(l-v);else{let j=v-l;const le=d.split("");for(let L=le.length-1;L>=0&&j>0;L--){const g=le[L];(g==="0"||g==="#"||g==="?")&&(le.splice(L,1),j--)}E=le.join(""),l===0&&E.endsWith(".")&&(E=E.slice(0,-1))}const J=E+(S>=0?h.slice(S):"");return i+r.slice(0,f)+J+r.slice(m+1)}function Yl(e,l){if(!Number.isInteger(l)||l<xn||l>Mn||e===ho)return null;if(e==null||no(e))return l>0?"0."+"0".repeat(l):"0";if(e===oo)return null;const n=Ro(e);return n.kind==="date"||n.kind==="duration"||!n.sections.some(o=>o.hasDigits)?null:e.split(";").map(o=>Gl(o,l)).join(";")}const Bn=["¥","$","€","£"];function jn(e,l){if(e==null||e===ho)return e??So;if(no(e))return So;if(e===oo||e==="@")return oo;const n=Sn(l),o=l==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",a=l==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",i=`${n}#,##0.00;(${n}#,##0.00);${n}"-"`,r="#,##0.00;[Red](#,##0.00)";if(Zn(l).some(v=>v.value===e))return e;const m=e.replace(/\[[^\]]*\]/gi,v=>/^\[(h|mm|ss)\]$/i.test(v)?v:"");if(/\[(h|mm|ss)\]/i.test(m)&&!/[yd]/i.test(m))return"[h]:mm:ss";const h=/[yd]/i.test(m),S=/h|s|AM\/PM/i.test(m);if(h&&S)return a;if(h||/AM\/PM/i.test(m))return o;if(S)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 d=Bn.find(v=>e.startsWith(v));if(d)return e.includes("(")?i:/\.\d/.test(e.slice(d.length))?n+"#,##0.00":n+"#,##0";const k=Ro(e);return k.kind==="number"&&k.sections.some(v=>v.hasDigits)?"#,##0.00":Eo}function Xl(e,l){return new Date(Date.UTC(e,l,0)).getUTCDate()}function jl(e,l,n){const o=Date.UTC(e,l-1,n)/864e5+25569;return o<=60?o-1:o}function Dn(e,l,n=new Date){const o=e.trim();if(!o||o.startsWith("=")||sn(o))return null;const a=l==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",i=l==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",r="h:mm:ss";function f(k){const v=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(k);if(!v)return null;const E=Number(v[1]),J=Number(v[2]),j=v[3]!==void 0?Number(v[3]):0;return E>23||J>59||j>59?null:(E*3600+J*60+j)/86400}function m(k){let v=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(k),E,J,j;if(v)E=Number(v[1]),J=Number(v[2]),j=Number(v[3]);else if(v=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(k))E=Number(v[1]),J=Number(v[2]),j=Number(v[3]);else if(v=/^(\d{1,2})[-/](\d{1,2})$/.exec(k))E=n.getUTCFullYear(),J=Number(v[1]),j=Number(v[2]);else return null;if(E<1900||E>9999||J<1||J>12||j<1||j>Xl(E,J))return null;const le=jl(E,J,j);return le>=En&&le<=kn?le:null}const h=f(o);if(h!==null)return{serial:h,format:r};const S=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(o);if(S){const k=m(S[1].trim()),v=f(S[2]);if(k!==null&&v!==null)return{serial:k+v,format:i}}const d=m(o);return d!==null?{serial:d,format:a}:null}function Zl(e,l){const n=e.trim();if(!n||n.startsWith("=")||!(n.includes(",")||n.includes("%")||Bn.some(L=>n.startsWith(L)))||Dn(n,l))return null;const a=Bn.find(L=>n.startsWith(L)),i=a?n.slice(a.length).trim():n;if(!i)return null;const r=/^([+-]?)(\d{1,3}(?:,\d{3})+)(?:\.(\d+))?(%?)$/.exec(i)||/^([+-]?)(\d+)(?:\.(\d+))?(%?)$/.exec(i);if(!r)return null;const f=r[1]==="-"?-1:1,m=r[2].replace(/,/g,""),h=r[3],S=(r[4]??"")==="%",d=h?h.length:0,k=+(m+(h?"."+h:""));if(!Number.isFinite(k))return null;const E=i.includes(",")?"#,##0":"0",J=d>0?"."+"0".repeat(d):"",j=(a??"")+E+J+(S?"%":"");let le=k*f;return S&&(le=le/100),le=Math.round(le*1e12)/1e12,{num:le,format:j}}function ql(e,l,n,o){const a=Sn(e),i=o?"#,##0":"0",r=n>0?"."+"0".repeat(n):"",f=i+r;switch(l){case"general":return"";case"text":return oo;case"custom":return"";case"number":return f;case"percent":return f+"%";case"scientific":return"0."+"0".repeat(n)+"E+00";case"currency":return a+f;case"currencyRounded":return a+(o?"#,##0":"0");case"accounting":return`${a}${f};(${a}${f});${a}"-"`;case"financial":return`${f};[Red](${f})`;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 Zn(e){const l=Sn(e);return[{label:T(e,"nfGeneral"),value:So},{label:T(e,"nfText"),value:oo},{label:T(e,"nfNumber"),value:"#,##0.00"},{label:T(e,"nfPercent"),value:"0.00%"},{label:T(e,"nfScientific"),value:"0.00E+00"},{label:T(e,"nfAccounting"),value:`${l}#,##0.00;(${l}#,##0.00);${l}"-"`},{label:T(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:T(e,"nfCurrency"),value:l+"#,##0.00"},{label:T(e,"nfCurrencyRounded"),value:l+"#,##0"},{label:T(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:T(e,"nfTime"),value:"h:mm:ss"},{label:T(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:T(e,"nfDuration"),value:"[h]:mm:ss"},{label:T(e,"nfCustom"),value:Eo}]}const Jl=["title"],Ql=["innerHTML"],er={key:1,class:"sp-dropdown__value"},tr=["disabled"],or=["placeholder"],nr=["onClick"],lr=["innerHTML"],rr={class:"sp-dropdown__item-label"},ar={key:2,class:"sp-dropdown__empty"},ir=["disabled"],cr=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:""}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:l}){const n=e,o=l,a=t.ref(!1),i=t.ref(0),r=t.ref(null),f=t.ref(null),m=t.ref(null),h=t.ref({top:0,up:!1}),S=t.ref(void 0),d=t.ref(0),k=t.ref(!1),v=t.ref(""),E=t.ref(null),J=t.computed(()=>n.options.find(u=>String(u.value)===String(n.modelValue))),j=t.computed(()=>n.menuWidth!==void 0?n.menuWidth:S.value),le=t.computed(()=>{if(!n.searchable||!v.value.trim())return n.options;const u=v.value.trim().toLowerCase();return n.options.filter(D=>String(D.label??"").toLowerCase().includes(u))}),L=t.computed(()=>le.value.length>0),g=t.computed(()=>Math.min(n.visibleCount,le.value.length)),he=t.computed(()=>le.value.slice(i.value,i.value+g.value)),Z=t.computed(()=>i.value>0),ie=t.computed(()=>i.value+g.value<le.value.length),De=t.computed(()=>le.value.length>g.value);function _e(u){i.value=Math.max(0,Math.min(le.value.length-g.value,i.value+u))}function xe(){a.value=!0,n.searchable&&(v.value=""),n.modelOpen!==void 0&&o("update:modelOpen",!0);const u=n.triggerEl??r.value;if(!u)return;const D=u.getBoundingClientRect();S.value=D.width;const I=g.value*22+(De.value?2*15:0)+8+(n.searchable?34:0),$=window.innerHeight-D.bottom-4<I&&D.top-4>I;n.align==="right"?h.value={right:window.innerWidth-D.right,top:$?D.top-I-4:D.bottom+4,up:$}:h.value={left:D.left,top:$?D.top-I-4:D.bottom+4,up:$};const ne=le.value.findIndex(H=>String(H.value)===String(n.modelValue));i.value=ne>=0?Math.max(0,Math.min(ne-Math.floor(g.value/2),le.value.length-g.value)):0,n.searchable&&t.nextTick(()=>{var H;return(H=E.value)==null?void 0:H.focus()})}function we(){a.value=!1,v.value="",n.modelOpen!==void 0&&o("update:modelOpen",!1)}function Te(){a.value?we():xe()}function et(u){o("update:modelValue",u.value),o("change",u.value),we()}function Ve(u){var I,G;if(!a.value)return;const D=u.target;(I=r.value)!=null&&I.contains(D)||(G=m.value)!=null&&G.contains(D)||we()}function ke(u){a.value&&(u.preventDefault(),_e(u.deltaY>0?1:-1))}t.watch(a,u=>{t.nextTick(()=>{var D,I;u?((D=f.value)==null||D.addEventListener("wheel",ke,{passive:!1}),document.addEventListener("keydown",Be)):((I=f.value)==null||I.removeEventListener("wheel",ke),document.removeEventListener("keydown",Be))})});function Be(u){a.value&&u.key==="Escape"&&we()}t.watch(()=>n.modelOpen,u=>{u!==void 0&&u!==a.value&&(u?xe():we())});function Xe(u){a.value&&(d.value=u.touches[0].clientY,k.value=!0)}function Ge(u){if(!a.value||!k.value)return;const D=u.touches[0].clientY-d.value;Math.abs(D)>5&&(_e(D<0?1:-1),d.value=u.touches[0].clientY)}function oe(){k.value=!1}function ge(u){u.key==="Escape"&&(u.stopPropagation(),we())}return t.onMounted(()=>{document.addEventListener("pointerdown",Ve),window.addEventListener("resize",we),window.addEventListener("scroll",we,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",Ve),document.removeEventListener("keydown",Be),window.removeEventListener("resize",we),window.removeEventListener("scroll",we,!0)}),(u,D)=>{var I,G,$;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:Te},[(I=J.value)!=null&&I.icon||e.triggerIcon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:((G=J.value)==null?void 0:G.icon)||e.triggerIcon},null,8,Ql)):(t.openBlock(),t.createElementBlock("span",er,t.toDisplayString((($=J.value)==null?void 0:$.label)??e.fallbackLabel),1)),D[5]||(D[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,Jl)),(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:m,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":h.value.up}]),style:t.normalizeStyle({left:h.value.left!==void 0?h.value.left+"px":void 0,right:h.value.right!==void 0?h.value.right+"px":void 0,top:h.value.top+"px",minWidth:j.value!==void 0?typeof j.value=="number"?j.value+"px":j.value:void 0}),onKeydown:ge,onMousedown:D[4]||(D[4]=t.withModifiers(()=>{},["prevent"]))},[De.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!Z.value}]),disabled:!Z.value,onClick:D[0]||(D[0]=ne=>_e(-1))},[...D[6]||(D[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,tr)):t.createCommentVNode("",!0),e.searchable?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"searchInputRef",ref:E,"onUpdate:modelValue":D[1]||(D[1]=ne=>v.value=ne),class:"sp-dropdown__search",type:"text",placeholder:e.searchPlaceholder,onMousedown:D[2]||(D[2]=t.withModifiers(()=>{},["stop"]))},null,40,or)),[[t.vModelText,v.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:f,class:"sp-dropdown__list",onTouchstart:Xe,onTouchmove:Ge,onTouchend:oe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(he.value,ne=>(t.openBlock(),t.createElementBlock("button",{key:String(ne.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(ne.value)===String(e.modelValue)}]),onClick:H=>et(ne)},[ne.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:ne.icon},null,8,lr)):t.createCommentVNode("",!0),t.createElementVNode("span",rr,t.toDisplayString(ne.label),1)],10,nr))),128))],544),e.searchable&&!L.value?(t.openBlock(),t.createElementBlock("div",ar," 无匹配 ")):t.createCommentVNode("",!0),De.value?(t.openBlock(),t.createElementBlock("button",{key:3,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!ie.value}]),disabled:!ie.value,onClick:D[3]||(D[3]=ne=>_e(1))},[...D[7]||(D[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,ir)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),Zt=(e,l)=>{const n=e.__vccOpts||e;for(const[o,a]of l)n[o]=a;return n},Gt=Zt(cr,[["__scopeId","data-v-804e629f"]]),sr=["title","onClick"],qn=Zt(t.defineComponent({__name:"colorPicker",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:l,emit:n}){const o=e,a=n,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"}]],f=t.computed(()=>o.colorKey==="fill"?r:i);function m(L){return T(o.locale,L)}function h(L){const g=o.currentColor;return!g&&!L?!0:g?g.toLowerCase()===L.toLowerCase():!1}const S=t.ref(!1),d=t.ref(null),k=t.ref(null),v=t.ref({top:0});t.watch(()=>o.modelOpen,L=>{L!==void 0&&L!==S.value&&(L?J():j())});function E(L){const g=d.value,he=k.value,Z=L.target;g&&g.contains(Z)||he&&he.contains(Z)||j()}function J(){S.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const L=o.triggerEl??d.value;if(L){const g=L.getBoundingClientRect(),he=150,Z=120;let ie=window.innerWidth-g.right,De=g.bottom+4,_e;g.left-Z<4&&(ie=void 0,_e=Math.max(4,g.left)),De+he>window.innerHeight-4&&(De=g.top-he-4),De<4&&(De=4),v.value=ie!==void 0?{right:ie,top:De}:{left:_e,top:De}}document.addEventListener("pointerdown",E)})}function j(){S.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",E)}function le(L){a("update:modelValue",L),a("change",L),j()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",E)}),l({open:S,openMenu:J,close:j}),(L,g)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:d,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[S.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:k,class:"color-picker__menu",style:t.normalizeStyle({left:v.value.left!==void 0?v.value.left+"px":void 0,right:v.value.right!==void 0?v.value.right+"px":void 0,top:v.value.top+"px"}),onMousedown:g[0]||(g[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,(he,Z)=>(t.openBlock(),t.createElementBlock("div",{key:Z,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(he,ie=>(t.openBlock(),t.createElementBlock("button",{key:ie.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":h(ie.value)}]),title:m(ie.key),style:t.normalizeStyle({background:ie.value||"transparent",border:ie.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:De=>le(ie.value)},null,14,sr))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-70f3dfdc"]]),dr=["title","onClick"],ur={viewBox:"0 0 30 30",class:"border-picker__icon"},fr=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],mr={class:"border-picker__label"},pr=Zt(t.defineComponent({__name:"borderPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:l,emit:n}){const o=e,a=n,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}],f={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"]},m={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function h(L,g){return m[L].includes(g)?"thick":f[L].includes(g)?"solid":"dashed"}const S=t.ref(!1),d=t.ref(null),k=t.ref(null),v=t.ref({top:0});t.watch(()=>o.modelOpen,L=>{L!==void 0&&L!==S.value&&(L?J():j())});function E(L){const g=d.value,he=k.value,Z=L.target;g&&g.contains(Z)||he&&he.contains(Z)||j()}function J(){S.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const L=o.triggerEl??d.value;if(L){const g=L.getBoundingClientRect(),he=200,Z=160;let ie=window.innerWidth-g.right,De=g.bottom+4,_e;g.left-Z<4&&(ie=void 0,_e=Math.max(4,g.left)),De+he>window.innerHeight-4&&(De=g.top-he-4),De<4&&(De=4),v.value=ie!==void 0?{right:ie,top:De}:{left:_e,top:De}}document.addEventListener("pointerdown",E)})}function j(){S.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",E)}function le(L){a("change",L),j()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",E)}),l({open:S,openMenu:J,close:j}),(L,g)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:d,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[S.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:k,class:"border-picker__menu",style:t.normalizeStyle({left:v.value.left!==void 0?v.value.left+"px":void 0,right:v.value.right!==void 0?v.value.right+"px":void 0,top:v.value.top+"px"}),onMousedown:g[0]||(g[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,he=>t.createElementVNode("button",{key:he.key,class:"border-picker__item",title:t.unref(T)(e.locale,he.i18nKey),onClick:Z=>le(he.key)},[(t.openBlock(),t.createElementBlock("svg",ur,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,Z=>t.createElementVNode("line",{key:Z.name,x1:Z.x1,y1:Z.y1,x2:Z.x2,y2:Z.y2,stroke:"currentColor","stroke-width":h(he.key,Z.name)==="thick"?3:1.5,"stroke-dasharray":h(he.key,Z.name)==="dashed"?"0 4":"none","stroke-linecap":h(he.key,Z.name)==="dashed"?"round":"square"},null,8,fr)),64))])),t.createElementVNode("span",mr,t.toDisplayString(t.unref(T)(e.locale,he.i18nKey)),1)],8,dr)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-551c0ffe"]]),hr=["title","onClick"],gr={viewBox:"0 0 1024 1024",class:"sort-picker__icon",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},yr=["x1","y1","x2","y2"],br=["d"],Cr={class:"sort-picker__label"},vr=Zt(t.defineComponent({__name:"sortPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentSort:{default:"asc"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:l,emit:n}){const o=e,a=n,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}],f={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},m=t.ref(!1),h=t.ref(null),S=t.ref(null),d=t.ref({top:0});t.watch(()=>o.modelOpen,j=>{j!==void 0&&j!==m.value&&(j?v():E())});function k(j){const le=h.value,L=S.value,g=j.target;le&&le.contains(g)||L&&L.contains(g)||E()}function v(){m.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const j=o.triggerEl??h.value;if(j){const le=j.getBoundingClientRect(),L=84,g=160;let he=window.innerWidth-le.right,Z=le.bottom+4,ie;le.left-g<4&&(he=void 0,ie=Math.max(4,le.left)),Z+L>window.innerHeight-4&&(Z=le.top-L-4),Z<4&&(Z=4),d.value=he!==void 0?{right:he,top:Z}:{left:ie,top:Z}}document.addEventListener("pointerdown",k)})}function E(){m.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",k)}function J(j){a("change",j),E()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",k)}),l({open:m,openMenu:v,close:E}),(j,le)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:h,class:"sort-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[m.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:S,class:"sort-picker__menu",style:t.normalizeStyle({left:d.value.left!==void 0?d.value.left+"px":void 0,right:d.value.right!==void 0?d.value.right+"px":void 0,top:d.value.top+"px"}),onMousedown:le[0]||(le[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,L=>t.createElementVNode("button",{key:L.key,class:"sort-picker__item",title:t.unref(T)(e.locale,L.i18nKey),onClick:g=>J(L.key)},[(t.openBlock(),t.createElementBlock("svg",gr,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,g=>t.createElementVNode("line",{key:g.name,x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2},null,8,yr)),64)),t.createElementVNode("path",{d:f[L.key]},null,8,br)])),t.createElementVNode("span",Cr,t.toDisplayString(t.unref(T)(e.locale,L.i18nKey)),1)],8,hr)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-45929b74"]]),wr=["title","onClick"],kr=["innerHTML"],Er={class:"merge-picker__label"},Sr=Zt(t.defineComponent({__name:"mergePicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:l,emit:n}){const o=e,a=n,i=t.ref(!1),r=t.ref(null),f=t.ref(null),m=t.ref({top:0});t.watch(()=>o.modelOpen,v=>{v!==void 0&&v!==i.value&&(v?S():d())});function h(v){const E=r.value,J=f.value,j=v.target;E&&E.contains(j)||J&&J.contains(j)||d()}function S(){i.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const v=o.triggerEl??r.value;if(v){const E=v.getBoundingClientRect(),J=zn.length*30+12,j=160;let le=window.innerWidth-E.right,L=E.bottom+4,g;E.left-j<4&&(le=void 0,g=Math.max(4,E.left)),L+J>window.innerHeight-4&&(L=E.top-J-4),L<4&&(L=4),m.value=le!==void 0?{right:le,top:L}:{left:g,top:L}}document.addEventListener("pointerdown",h)})}function d(){i.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",h)}function k(v){a("change",v),d()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",h)}),l({open:i,openMenu:S,close:d}),(v,E)=>(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:f,class:"merge-picker__menu",style:t.normalizeStyle({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"}),onMousedown:E[0]||(E[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(zn),J=>(t.openBlock(),t.createElementBlock("button",{key:J.key,class:"merge-picker__item",title:t.unref(T)(e.locale,J.labelKey),onClick:j=>k(J.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:J.icon},null,8,kr),t.createElementVNode("span",Er,t.toDisplayString(t.unref(T)(e.locale,J.labelKey)),1)],8,wr))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-edd36208"]]),Rr=["disabled","title","onClick"],Mr={class:"calc-picker__label"},xr=Zt(t.defineComponent({__name:"calcPicker",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:l,emit:n}){const o=e,a=n,i=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),f=t.ref(null),m=t.ref(null),h=t.ref({top:0});t.watch(()=>o.modelOpen,E=>{E!==void 0&&E!==r.value&&(E?d():k())});function S(E){const J=f.value,j=m.value,le=E.target;J&&J.contains(le)||j&&j.contains(le)||k()}function d(){r.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const E=o.triggerEl??f.value;if(E){const J=E.getBoundingClientRect(),j=i.length*30+12,le=160;let L=window.innerWidth-J.right,g=J.bottom+4,he;J.left-le<4&&(L=void 0,he=Math.max(4,J.left)),g+j>window.innerHeight-4&&(g=J.top-j-4),g<4&&(g=4),h.value=L!==void 0?{right:L,top:g}:{left:he,top:g}}document.addEventListener("pointerdown",S)})}function k(){r.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",S)}function v(E){o.disabled||(a("change",E),k())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",S)}),l({open:r,openMenu:d,close:k}),(E,J)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:f,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:m,class:"calc-picker__menu",style:t.normalizeStyle({left:h.value.left!==void 0?h.value.left+"px":void 0,right:h.value.right!==void 0?h.value.right+"px":void 0,top:h.value.top+"px"}),onMousedown:J[0]||(J[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(T)(e.locale,j.labelKey),onClick:le=>v(j.key)},[t.createElementVNode("span",Mr,t.toDisplayString(t.unref(T)(e.locale,j.labelKey)),1)],10,Rr)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-01a18e00"]]),Br={class:"tb-item","data-key":"undo"},Dr=["title","disabled"],Tr={class:"tb-item","data-key":"redo"},Nr=["title","disabled"],Ir={class:"tb-item","data-key":"paint"},Fr=["title","disabled"],Ar={class:"tb-item","data-key":"clear"},Vr=["title","disabled"],Or={class:"tb-item","data-key":"font"},Hr={class:"tb-item","data-key":"fontSize"},zr={class:"toolbar-font-size"},Lr=["value","title"],$r=["title"],_r=["title","disabled"],Wr=["title","disabled"],Pr={class:"tb-item","data-key":"bold"},Kr=["title","disabled"],Ur={class:"tb-item","data-key":"italic"},Gr=["title","disabled"],Yr={class:"tb-item","data-key":"underline"},Xr=["title","disabled"],jr={class:"tb-item","data-key":"strike"},Zr=["title","disabled"],qr={class:"tb-item","data-key":"textColor"},Jr={class:"toolbar-split"},Qr=["title","disabled"],ea={viewBox:"0 0 1024 1024",fill:"currentColor"},ta=["fill"],oa=["title","disabled"],na={class:"tb-item","data-key":"fillColor"},la={class:"toolbar-split"},ra=["title","disabled"],aa={viewBox:"0 0 1024 1024",fill:"currentColor"},ia=["fill"],ca=["title","disabled"],sa={class:"tb-item","data-key":"border"},da={class:"toolbar-split"},ua=["title","disabled"],fa={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},ma=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],pa=["title","disabled"],ha={class:"tb-item","data-key":"hAlign"},ga={class:"tb-item","data-key":"vAlign"},ya={class:"tb-item","data-key":"wrap"},ba=["title"],Ca={class:"tb-item","data-key":"merge"},va={class:"toolbar-split"},wa=["title","disabled"],ka=["title","disabled"],Ea={class:"tb-item","data-key":"numFmt"},Sa={class:"toolbar-number-format-group"},Ra=["title","disabled"],Ma=["title","disabled"],xa={class:"tb-item","data-key":"calc"},Ba={class:"toolbar-split"},Da=["title","disabled"],Ta=["title","disabled"],Na={class:"tb-item","data-key":"sort"},Ia={class:"toolbar-split"},Fa=["title","disabled"],Aa={viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},Va=["x1","y1","x2","y2"],Oa=["d"],Ha=["title","disabled"],za={class:"tb-item","data-key":"freeze"},La={class:"tb-item","data-key":"find"},$a=["title"],Jn='<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>',_a='<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>',Wa='<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>',Pa='<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>',Tn=2,Ka=6,Ua=34,Ga=Zt(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},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},calcMenuOpen:{type:Boolean},isSingleCell:{type:Boolean},hasFreeze:{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","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","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"],setup(e,{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}],o={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"]},a={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function i(ee,p){return a[ee].includes(p)?"thick":o[ee].includes(p)?"solid":"dashed"}const 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}],f={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},m=["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","freeze","find"],h=t.ref(null),S=t.ref(null),d=t.ref(null),k=t.ref(null),v=t.ref(null),E=t.ref(null),J=t.ref(null),j=t.ref(null),le=t.ref(null),L=t.ref(null),g=t.ref(new Set),he=t.ref(!1),Z=t.ref(!1),ie=t.ref(0),De=new Map,_e=t.computed(()=>g.value.size>0);function xe(ee){return g.value.has(ee)}const we=t.computed(()=>{const ee=S.value;return ee instanceof HTMLElement?ee:void 0});function Te(ee){return we.value?!xe(ee):!0}function et(){for(const ee of m){const p=De.get(ee);if(p===void 0||p===0)return!0}return!1}function Ve(){if(!h.value)return;h.value.querySelectorAll(".tb-item").forEach(p=>{const F=p.dataset.key;if(!F)return;const Ue=p.offsetWidth;Ue>0?De.set(F,Ue):De.has(F)||De.set(F,0)})}function ke(ee,p){if(ee.size!==p.size)return!1;for(const F of ee)if(!p.has(F))return!1;return!0}let Be=0,Xe=0;function Ge(){Be&&cancelAnimationFrame(Be),!(Xe>60)&&(Xe++,Be=requestAnimationFrame(()=>requestAnimationFrame(oe)))}function oe(){if(!h.value)return;const ee=h.value.clientWidth-Ka*2;if(ee<=0){Ge();return}Xe=0,(De.size===0||et())&&Ve();let p=0;for(const Ue of m)p+=(De.get(Ue)??0)+Tn;const F=new Set;if(p>ee){const Ue=ee-Ua-Tn;let vt=0;for(let ce=0;ce<m.length;ce++){const We=m[ce],Je=(De.get(We)??0)+Tn;if(vt+Je>Ue){for(let gt=ce;gt<m.length;gt++)F.add(m[gt]);break}vt+=Je}}ke(F,g.value)||(g.value=F,ie.value++,F.size===0&&(he.value=!1))}let ge=null;const u=t.ref(0),D=t.computed(()=>{const ee=d.value,p={position:"fixed",top:"0px",right:"0px"};if(!ee)return{...H.themeVars,...p};u.value;const F=ee.getBoundingClientRect();return{...H.themeVars,position:"fixed",top:`${F.bottom+4}px`,right:`${window.innerWidth-F.right}px`}});function I(){he.value&&(u.value++,t.nextTick(()=>oe()))}function G(ee){var F,Ue;if(!he.value)return;const p=ee.target;(F=S.value)!=null&&F.contains(p)||(Ue=d.value)!=null&&Ue.contains(p)||(Z.value=!0,he.value=!1,t.nextTick(()=>{Z.value=!1}))}function $(){he.value=!he.value}function ne(){he.value=!1,c("find")}t.onMounted(()=>{Ge(),h.value&&(ge=new ResizeObserver(()=>{he.value||Ge()}),ge.observe(h.value)),document.addEventListener("pointerdown",G,!0),window.addEventListener("resize",I),window.addEventListener("load",Ge),window.addEventListener("orientationchange",Ge)}),t.onBeforeUnmount(()=>{Be&&cancelAnimationFrame(Be),ge==null||ge.disconnect(),document.removeEventListener("pointerdown",G,!0),window.removeEventListener("resize",I),window.removeEventListener("load",Ge),window.removeEventListener("orientationchange",Ge)});const H=e,c=l,y=t.computed(()=>H.selNumberFormat===ho?T(H.locale,"nfMixed"):""),at=t.computed(()=>{const ee=[{label:T(H.locale,"freezeFirstRow"),value:"firstRow",icon:_a},{label:T(H.locale,"freezeFirstCol"),value:"firstCol",icon:Wa}];return H.hasFreeze?ee.unshift({label:T(H.locale,"unfreezePanes"),value:"unfreeze",icon:Pa}):ee.unshift({label:T(H.locale,"freezePanes"),value:"panes",icon:Jn}),ee});return(ee,p)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:h,class:"toolbar",onMousedown:p[52]||(p[52]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("undo"),to:we.value},[t.createElementVNode("div",Br,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(T)(e.locale,"undo"),disabled:!e.canUndo,onClick:p[0]||(p[0]=F=>c("undo"))},[...p[54]||(p[54]=[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)])],10,Dr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("redo"),to:we.value},[t.createElementVNode("div",Tr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(T)(e.locale,"redo"),disabled:!e.canRedo,onClick:p[1]||(p[1]=F=>c("redo"))},[...p[55]||(p[55]=[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)])],10,Nr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("paint"),to:we.value},[t.createElementVNode("div",Ir,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(T)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:p[2]||(p[2]=F=>c("paint-format"))},[...p[56]||(p[56]=[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)])],10,Fr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("clear"),to:we.value},[t.createElementVNode("div",Ar,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(T)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:p[3]||(p[3]=F=>c("clear-format"))},[...p[57]||(p[57]=[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)])],10,Vr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("sep1"),to:we.value},[p[58]||(p[58]=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:Te("font"),to:we.value},[t.createElementVNode("div",Or,[t.createVNode(Gt,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:xe("font")?"100%":110,"menu-width":xe("font")?120:void 0,"visible-count":8,title:t.unref(T)(e.locale,"fontFamily"),align:"right",onChange:p[4]||(p[4]=F=>c("font-family-change",F))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("fontSize"),to:we.value},[t.createElementVNode("div",Hr,[t.createElementVNode("div",zr,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(T)(e.locale,"fontSize"),onMousedown:p[5]||(p[5]=t.withModifiers(()=>{},["stop"])),onInput:p[6]||(p[6]=F=>c("font-size-input",F.target.value)),onBlur:p[7]||(p[7]=F=>c("font-size-blur")),onKeydown:p[8]||(p[8]=F=>c("font-size-keydown",F))},null,40,Lr),t.createVNode(Gt,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:xe("fontSize")?"100%":56,"menu-width":xe("fontSize")?120:56,"visible-count":9,title:t.unref(T)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":L.value,"onUpdate:modelOpen":p[9]||(p[9]=F=>c("update:font-size-menu-open",F)),onChange:p[10]||(p[10]=F=>c("font-size-change",F))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:L,class:"toolbar-font-size__btn",type:"button",title:t.unref(T)(e.locale,"fontSize"),onMousedown:p[11]||(p[11]=t.withModifiers(()=>{},["prevent"])),onClick:p[12]||(p[12]=F=>c("font-size-toggle"))},[...p[59]||(p[59]=[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,$r),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(T)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:p[13]||(p[13]=t.withModifiers(()=>{},["prevent"])),onClick:p[14]||(p[14]=F=>c("font-size-step-down"))},[...p[60]||(p[60]=[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,_r),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(T)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:p[15]||(p[15]=t.withModifiers(()=>{},["prevent"])),onClick:p[16]||(p[16]=F=>c("font-size-step-up"))},[...p[61]||(p[61]=[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,Wr)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("sep2"),to:we.value},[p[62]||(p[62]=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:Te("bold"),to:we.value},[t.createElementVNode("div",Pr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(T)(e.locale,"bold"),disabled:!e.hasSelection,onClick:p[17]||(p[17]=F=>c("bold-toggle"))},[...p[63]||(p[63]=[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,Kr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("italic"),to:we.value},[t.createElementVNode("div",Ur,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(T)(e.locale,"italic"),disabled:!e.hasSelection,onClick:p[18]||(p[18]=F=>c("italic-toggle"))},[...p[64]||(p[64]=[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,Gr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("underline"),to:we.value},[t.createElementVNode("div",Yr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(T)(e.locale,"underline"),disabled:!e.hasSelection,onClick:p[19]||(p[19]=F=>c("underline-toggle"))},[...p[65]||(p[65]=[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,Xr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("strike"),to:we.value},[t.createElementVNode("div",jr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(T)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:p[20]||(p[20]=F=>c("strikethrough-toggle"))},[...p[66]||(p[66]=[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,Zr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("sep3"),to:we.value},[p[67]||(p[67]=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:Te("textColor"),to:we.value},[t.createElementVNode("div",qr,[t.createElementVNode("div",Jr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:p[21]||(p[21]=F=>c("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",ea,[p[68]||(p[68]=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,ta)]))],8,Qr),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:k,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:p[22]||(p[22]=F=>c("update:text-color-menu-open",!e.textColorMenuOpen))},[...p[69]||(p[69]=[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,oa),t.createVNode(qn,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":k.value,"onUpdate:modelOpen":p[23]||(p[23]=F=>c("update:text-color-menu-open",F)),onChange:p[24]||(p[24]=F=>c("text-color-change",F))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("fillColor"),to:we.value},[t.createElementVNode("div",na,[t.createElementVNode("div",la,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:p[25]||(p[25]=F=>c("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",aa,[p[70]||(p[70]=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,ia)]))],8,ra),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:v,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:p[26]||(p[26]=F=>c("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...p[71]||(p[71]=[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,ca),t.createVNode(qn,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":v.value,"onUpdate:modelOpen":p[27]||(p[27]=F=>c("update:fill-color-menu-open",F)),onChange:p[28]||(p[28]=F=>c("fill-color-change",F))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("border"),to:we.value},[t.createElementVNode("div",sa,[t.createElementVNode("div",da,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"borders"),disabled:!e.hasSelection,onClick:p[29]||(p[29]=F=>c("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",fa,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(n,F=>t.createElementVNode("line",{key:F.name,x1:F.x1,y1:F.y1,x2:F.x2,y2:F.y2,"stroke-width":i(e.cachedBorder,F.name)==="thick"?3:1.5,"stroke-dasharray":i(e.cachedBorder,F.name)==="dashed"?"0 4":"none","stroke-linecap":i(e.cachedBorder,F.name)==="dashed"?"round":"square"},null,8,ma)),64))]))],8,ua),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:E,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"borders"),disabled:!e.hasSelection,onClick:p[30]||(p[30]=F=>c("update:border-menu-open",!e.borderMenuOpen))},[...p[72]||(p[72]=[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,pa),t.createVNode(pr,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":E.value,"onUpdate:modelOpen":p[31]||(p[31]=F=>c("update:border-menu-open",F)),onChange:p[32]||(p[32]=F=>c("border-change",F))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("sep4"),to:we.value},[p[73]||(p[73]=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:Te("hAlign"),to:we.value},[t.createElementVNode("div",ha,[t.createVNode(Gt,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:xe("hAlign")?"100%":44,"menu-width":xe("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(T)(e.locale,"hAlign"),onChange:p[33]||(p[33]=F=>c("h-align-change",F))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("vAlign"),to:we.value},[t.createElementVNode("div",ga,[t.createVNode(Gt,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:xe("vAlign")?"100%":44,"menu-width":xe("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(T)(e.locale,"vAlign"),onChange:p[34]||(p[34]=F=>c("v-align-change",F))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",ya,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(T)(e.locale,"wrap"),onClick:p[35]||(p[35]=F=>c("wrap-toggle"))},[...p[74]||(p[74]=[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)])],10,ba)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("merge"),to:we.value},[t.createElementVNode("div",Ca,[t.createElementVNode("div",va,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:p[36]||(p[36]=F=>c("apply-merge"))},[...p[75]||(p[75]=[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)])],8,wa),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:j,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:p[37]||(p[37]=F=>c("update:merge-menu-open",!e.mergeMenuOpen))},[...p[76]||(p[76]=[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,ka),t.createVNode(Sr,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":j.value,"onUpdate:modelOpen":p[38]||(p[38]=F=>c("update:merge-menu-open",F)),onChange:p[39]||(p[39]=F=>c("merge-change",F))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("sep6"),to:we.value},[p[77]||(p[77]=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:Te("numFmt"),to:we.value},[t.createElementVNode("div",Ea,[t.createElementVNode("div",Sa,[t.createVNode(Gt,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:xe("numFmt")?"auto":92,"menu-width":(xe("numFmt"),150),"visible-count":8,title:t.unref(T)(e.locale,"numberFormat"),"fallback-label":y.value,align:"right",onChange:p[40]||(p[40]=F=>c("number-format-change",String(F)))},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(T)(e.locale,"nfIncreaseDecimals"),disabled:!e.canIncreaseDecimals,onClick:p[41]||(p[41]=F=>c("increase-decimals"))},[...p[78]||(p[78]=[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,Ra),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canDecreaseDecimals}]),title:t.unref(T)(e.locale,"nfDecreaseDecimals"),disabled:!e.canDecreaseDecimals,onClick:p[42]||(p[42]=F=>c("decrease-decimals"))},[...p[79]||(p[79]=[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,Ma)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("sep7"),to:we.value},[p[80]||(p[80]=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:Te("calc"),to:we.value},[t.createElementVNode("div",xa,[t.createElementVNode("div",Ba,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:p[43]||(p[43]=F=>c("calc-sum"))},[...p[81]||(p[81]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("path",{d:"M19 3H5l7 9-7 9h14v-2H8l5.5-7L8 5h11z"})],-1)])],8,Da),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:le,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:p[44]||(p[44]=F=>c("update:calc-menu-open",!e.calcMenuOpen))},[...p[82]||(p[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,Ta),t.createVNode(xr,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":le.value,disabled:e.isSingleCell,"onUpdate:modelOpen":p[45]||(p[45]=F=>c("update:calc-menu-open",F)),onChange:p[46]||(p[46]=F=>c(`calc-${F}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("sort"),to:we.value},[t.createElementVNode("div",Na,[t.createElementVNode("div",Ia,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.cachedSortOrder==="asc"?t.unref(T)(e.locale,"sortAsc"):t.unref(T)(e.locale,"sortDesc"),disabled:!e.canSort,onClick:p[47]||(p[47]=F=>c("apply-sort"))},[(t.openBlock(),t.createElementBlock("svg",Aa,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,F=>t.createElementVNode("line",{key:F.name,x1:F.x1,y1:F.y1,x2:F.x2,y2:F.y2},null,8,Va)),64)),t.createElementVNode("path",{d:f[e.cachedSortOrder]},null,8,Oa)]))],8,Fa),t.createElementVNode("button",{ref_key:"sortArrowRef",ref:J,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"sort"),disabled:!e.canSort,onClick:p[48]||(p[48]=F=>c("update:sort-menu-open",!e.sortMenuOpen))},[...p[83]||(p[83]=[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,Ha),t.createVNode(vr,{"model-open":e.sortMenuOpen,locale:e.locale,"current-sort":e.cachedSortOrder,"trigger-el":J.value,"onUpdate:modelOpen":p[49]||(p[49]=F=>c("update:sort-menu-open",F)),onChange:p[50]||(p[50]=F=>c("sort-change",F))},null,8,["model-open","locale","current-sort","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("freeze"),to:we.value},[t.createElementVNode("div",za,[t.createVNode(Gt,{class:"toolbar-freeze","model-value":"",options:at.value,width:xe("freeze")?"100%":44,"menu-width":xe("freeze")?120:void 0,"visible-count":4,align:"right",title:t.unref(T)(e.locale,"freezePane"),"trigger-icon":Jn,onChange:p[51]||(p[51]=F=>c("freeze-change",String(F)))},null,8,["options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Te("find"),to:we.value},[t.createElementVNode("div",La,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(T)(e.locale,"find"),onClick:ne},[...p[84]||(p[84]=[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)])],8,$a)])],8,["disabled","to"])),_e.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:d,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":he.value}]),type:"button",onClick:$},[...p[85]||(p[85]=[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.openBlock(),t.createElementBlock("div",{ref_key:"overflowMenuEl",ref:S,key:ie.value,class:t.normalizeClass(["overflow-menu",{"no-anim":Z.value}]),style:t.normalizeStyle(D.value),onMousedown:p[53]||(p[53]=t.withModifiers(()=>{},["prevent"]))},null,38)),[[t.vShow,he.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-a97a071a"]]),Ya=["title"],Xa={class:"tab-list"},ja=["onClick","onDblclick","onContextmenu"],Za=["value"],qa={key:1,class:"tab-item__name"},Ja=["title"],Qa=["disabled"],ei=["title","onClick"],ti={class:"tab-list-menu__name"},oi=["title","disabled","onClick"],ni=["disabled"],li=8,ri=Zt(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:l}){const n=e,o=l,a=t.ref(null),i=t.ref(!1),r=t.ref(0),f=t.ref({left:0,bottom:0}),m=t.ref(null),h=t.computed(()=>Math.min(li,n.sheets.length)),S=t.computed(()=>n.sheets.slice(r.value,r.value+h.value)),d=t.computed(()=>r.value>0),k=t.computed(()=>r.value+h.value<n.sheets.length),v=t.computed(()=>n.sheets.length>h.value),E=t.computed(()=>n.sheets.length>1);t.watch(()=>n.sheets.length,()=>{if(!i.value)return;const Ve=Math.max(0,n.sheets.length-h.value);r.value>Ve&&(r.value=Ve)});function J(Ve){r.value=Math.max(0,Math.min(n.sheets.length-h.value,r.value+Ve))}function j(){if(i.value){i.value=!1;return}const Ve=a.value;if(!Ve)return;const ke=Ve.getBoundingClientRect();f.value={left:ke.left,bottom:window.innerHeight-ke.top+4};const Be=n.activeSheetIndex;r.value=Be>=0?Math.max(0,Math.min(Be-Math.floor(h.value/2),n.sheets.length-h.value)):0,i.value=!0}function le(Ve){o("tab-click",Ve),i.value=!1}function L(Ve){E.value&&o("delete-sheet",Ve)}function g(Ve){var Xe;if(!i.value)return;const ke=Ve.target;if((Xe=a.value)!=null&&Xe.contains(ke))return;const Be=document.querySelector(".tab-list-menu");Be!=null&&Be.contains(ke)||(i.value=!1)}function he(Ve){i.value&&Ve.key==="Escape"&&(i.value=!1)}function Z(Ve){i.value&&(Ve.preventDefault(),J(Ve.deltaY>0?1:-1))}function ie(){i.value=!1}function De(Ve){!i.value||Ve.target===m.value||ie()}const _e=t.ref(0),xe=t.ref(!1);function we(Ve){i.value&&(_e.value=Ve.touches[0].clientY,xe.value=!0)}function Te(Ve){if(!i.value||!xe.value)return;const ke=Ve.touches[0].clientY-_e.value;Math.abs(ke)>5&&(J(ke<0?1:-1),_e.value=Ve.touches[0].clientY)}function et(){xe.value=!1}return t.watch(i,Ve=>{t.nextTick(()=>{var ke,Be;Ve?(ke=m.value)==null||ke.addEventListener("wheel",Z,{passive:!1}):(Be=m.value)==null||Be.removeEventListener("wheel",Z)})}),t.onMounted(()=>{document.addEventListener("pointerdown",g),document.addEventListener("keydown",he),window.addEventListener("resize",ie),window.addEventListener("scroll",De,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",g),document.removeEventListener("keydown",he),window.removeEventListener("resize",ie),window.removeEventListener("scroll",De,!0)}),(Ve,ke)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:ke[8]||(ke[8]=Be=>o("tabbar-contextmenu",Be))},[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(T)(e.locale,"sheetList"),onClick:j},[...ke[9]||(ke[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,Ya),t.createElementVNode("div",Xa,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(Be,Xe)=>(t.openBlock(),t.createElementBlock("div",{key:Be.id,class:t.normalizeClass(["tab-item",{"tab-item--active":Xe===e.activeSheetIndex}]),onClick:Ge=>o("tab-click",Xe),onDblclick:t.withModifiers(Ge=>o("tab-dblclick",Xe),["prevent"]),onContextmenu:Ge=>o("tab-contextmenu",{ev:Ge,i:Xe})},[e.renTab===Xe?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:ke[0]||(ke[0]=Ge=>o("tab-rename-input",Ge.target.value)),onKeydown:ke[1]||(ke[1]=Ge=>o("tab-rename-keydown",Ge)),onBlur:ke[2]||(ke[2]=Ge=>o("tab-rename-commit")),onClick:ke[3]||(ke[3]=t.withModifiers(()=>{},["stop"]))},null,40,Za)):(t.openBlock(),t.createElementBlock("span",qa,t.toDisplayString(Be.name),1))],42,ja))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(T)(e.locale,"addSheet"),onClick:ke[4]||(ke[4]=Be=>o("add-sheet"))}," + ",8,Ja),(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:f.value.left+"px",bottom:f.value.bottom+"px"}),onMousedown:ke[7]||(ke[7]=t.withModifiers(()=>{},["prevent"]))},[v.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!d.value}]),disabled:!d.value,onClick:ke[5]||(ke[5]=Be=>J(-1))},[...ke[10]||(ke[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,Qa)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:m,class:"tab-list-menu__list",onTouchstart:we,onTouchmove:Te,onTouchend:et},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(S.value,Be=>(t.openBlock(),t.createElementBlock("div",{key:Be.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(Be)===e.activeSheetIndex}]),title:Be.name,onClick:Xe=>le(e.sheets.indexOf(Be))},[t.createElementVNode("span",ti,t.toDisplayString(Be.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(T)(e.locale,"delete"),disabled:!E.value,onClick:t.withModifiers(Xe=>L(e.sheets.indexOf(Be)),["stop"])},[...ke[11]||(ke[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,oi)],10,ei))),128))],544),v.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!k.value}]),disabled:!k.value,onClick:ke[6]||(ke[6]=Be=>J(1))},[...ke[12]||(ke[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,ni)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-ec10bade"]]),ai=["placeholder","value"],ii=["placeholder","value"],ci={class:"find-bar__chk"},si=["checked"],di={class:"find-bar__chk"},ui=["checked"],fi={class:"find-bar__count"},mi=["title","disabled"],pi=["title","disabled"],hi=["disabled"],gi=["disabled"],yi=["title"],bi=Zt(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:l}){const n=e,o=l,a=t.ref(null),i=t.computed(()=>n.total>0?`${n.currentIndex+1}/${n.total}`:n.message||""),r=t.computed(()=>[{label:T(n.locale,"scopeSheet"),value:"sheet"},{label:T(n.locale,"scopeWorkbook"),value:"workbook"},{label:T(n.locale,"scopeSelection"),value:"selection"}]);t.watch(()=>n.focusToken,()=>{t.nextTick(()=>{var m;return(m=a.value)==null?void 0:m.focus()})});function f(m){m.key==="Enter"?(m.preventDefault(),m.shiftKey?o("prev"):o("next")):m.key==="Escape"&&(m.preventDefault(),o("close"))}return(m,h)=>e.open?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("input",{ref_key:"findInputRef",ref:a,class:"find-bar__input",placeholder:t.unref(T)(e.locale,"findPlaceholder"),value:e.findText,onInput:h[0]||(h[0]=S=>o("update:findText",S.target.value)),onKeydown:f},null,40,ai),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(T)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:h[1]||(h[1]=S=>o("update:replaceText",S.target.value)),onKeydown:f},null,40,ii),t.createVNode(Gt,{class:"find-bar__dropdown","model-value":e.scope,options:r.value,title:t.unref(T)(e.locale,"findScope"),"onUpdate:modelValue":h[2]||(h[2]=S=>m.$emit("update:scope",S))},null,8,["model-value","options","title"]),t.createElementVNode("label",ci,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchCase,onChange:h[3]||(h[3]=S=>o("update:matchCase",S.target.checked))},null,40,si),h[10]||(h[10]=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(T)(e.locale,"matchCase")),1)]),t.createElementVNode("label",di,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchEntireCell,onChange:h[4]||(h[4]=S=>o("update:matchEntireCell",S.target.checked))},null,40,ui),h[11]||(h[11]=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(T)(e.locale,"matchEntireCell")),1)]),t.createElementVNode("span",fi,t.toDisplayString(i.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(T)(e.locale,"findPrev"),disabled:e.total===0,onClick:h[5]||(h[5]=S=>o("prev"))},[...h[12]||(h[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,mi),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(T)(e.locale,"findNext"),disabled:e.total===0,onClick:h[6]||(h[6]=S=>o("next"))},[...h[13]||(h[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,pi),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:h[7]||(h[7]=S=>o("replace"))},t.toDisplayString(t.unref(T)(e.locale,"replace")),9,hi),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:h[8]||(h[8]=S=>o("replace-all"))},t.toDisplayString(t.unref(T)(e.locale,"replaceAll")),9,gi),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(T)(e.locale,"findClose"),onClick:h[9]||(h[9]=S=>o("close"))},[...h[14]||(h[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,yi)],4)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-3120909b"]]),Ci={class:"nf-dialog__header"},vi={class:"nf-dialog__title"},wi={class:"nf-dialog__body"},ki={class:"nf-field"},Ei={class:"nf-field__label"},Si={key:0,class:"nf-field"},Ri={class:"nf-field__label"},Mi={key:1,class:"nf-field nf-field--inline"},xi={class:"nf-checkbox"},Bi={key:2,class:"nf-field"},Di={class:"nf-field__label"},Ti={key:3,class:"nf-field"},Ni={class:"nf-field__label"},Ii={key:4,class:"nf-field"},Fi={class:"nf-field__label"},Ai={key:5,class:"nf-field"},Vi={class:"nf-field__label"},Oi={key:6,class:"nf-field"},Hi={class:"nf-field__label"},zi={class:"nf-field"},Li={class:"nf-field__label"},$i={class:"nf-dialog__footer"},_i={class:"nf-preview"},Wi={class:"nf-preview__label"},Pi={class:"nf-preview__value"},Ki={class:"nf-dialog__actions"},Ui=Zt(t.defineComponent({__name:"numberFormatDialog",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:l}){const n=e,o=l,a=t.ref(!1),i=t.ref("general"),r=t.ref(2),f=t.ref(!1),m=t.ref("$"),h=t.ref("m/d/yyyy"),S=t.ref("h:mm:ss"),d=t.ref("m/d/yyyy h:mm:ss"),k=t.ref("[h]:mm:ss"),v=t.ref(""),E=t.ref(null),J=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],j=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],le=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],L=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],g=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],he=t.computed(()=>n.locale==="zh-CN"?[...j,...le]:[...le,...j]),Z=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],ie=t.computed(()=>n.locale==="zh-CN"?[...L,...g]:[...g,...L]),De=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],_e={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"},xe=t.computed(()=>Pl.map(ce=>({label:T(n.locale,_e[ce]),value:ce}))),we=J.map(ce=>({label:ce.label,value:ce.value})),Te=t.computed(()=>he.value.map(ce=>({label:ce,value:ce}))),et=Z.map(ce=>({label:ce,value:ce})),Ve=t.computed(()=>ie.value.map(ce=>({label:ce,value:ce}))),ke=De.map(ce=>({label:ce,value:ce})),Be=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),Xe=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),Ge=t.computed(()=>i.value==="date"),oe=t.computed(()=>i.value==="time"),ge=t.computed(()=>i.value==="dateTime"),u=t.computed(()=>i.value==="duration"),D=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function I(){if(i.value==="general")return So;if(i.value==="text")return oo;if(i.value==="custom")return v.value;if(i.value==="date")return h.value;if(i.value==="time")return S.value;if(i.value==="dateTime")return d.value;if(i.value==="duration")return k.value;const ce=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?G(i.value,ce,f.value,m.value):ql(n.locale,i.value,ce,f.value)}function G(ce,We,Je,gt){const kt=Je?"#,##0":"0";if(ce==="currencyRounded")return gt+kt;const Vt=We>0?"."+"0".repeat(We):"",Ht=kt+Vt;return ce==="currency"?gt+Ht:`${gt}${Ht};(${gt}${Ht});${gt}"-"`}function $(ce){if(v.value=ce,no(ce)){i.value="general";return}if(ce==="@"){i.value="text";return}const We=ce.replace(/\[[^\]]*\]/gi,Vt=>/\[h\]/i.test(Vt)?Vt:"");if(/\[h\]/i.test(We)&&!/[yd]/i.test(We)){i.value="duration",De.includes(ce)&&(k.value=ce);return}const Je=/[yd]/i.test(We),gt=/h|s|AM\/PM/i.test(We);if(Je&&gt){i.value="dateTime",ie.value.includes(ce)&&(d.value=ce);return}if(Je||/AM\/PM/i.test(We)){gt&&!Je?(i.value="time",Z.includes(ce)&&(S.value=ce)):(i.value="date",he.value.includes(ce)&&(h.value=ce));return}if(ce.includes("%")){i.value="percent",r.value=ne(ce);return}if(/E[+-]/i.test(ce)){i.value="scientific",r.value=ne(ce);return}const kt=J.find(Vt=>ce.startsWith(Vt.value));if(ce.includes("[Red](")){i.value="financial",f.value=ce.includes(","),r.value=ne(ce);return}if(kt){ce.includes("(")?(i.value="accounting",m.value=kt.value,f.value=ce.includes(","),r.value=ne(ce)):/\.\d/.test(ce.slice(kt.value.length))?(i.value="currency",m.value=kt.value,f.value=ce.includes(","),r.value=ne(ce)):(i.value="currencyRounded",m.value=kt.value,f.value=ce.includes(","));return}i.value="number",f.value=ce.includes(","),r.value=ne(ce)}function ne(ce){const We=ce.match(/\.([0#?]+)/);return We?We[1].length:0}function H(){i.value!=="custom"&&(v.value=I())}function c(){}function y(){h.value=he.value[0],S.value=Z[0],d.value=ie.value[0],k.value=De[0]}function at(){a.value=!0,n.modelOpen!==void 0&&o("update:modelOpen",!0),y(),$(n.currentFormat??""),n.isCustom&&(i.value="custom"),t.nextTick(()=>{var ce;return(ce=E.value)==null?void 0:ce.focus()})}function ee(){a.value=!1,n.modelOpen!==void 0&&o("update:modelOpen",!1)}function p(){o("apply",v.value),ee()}function F(){ee()}function Ue(ce){ce.key==="Escape"&&ee()}t.watch(()=>n.modelOpen,ce=>{ce&&!a.value?at():!ce&&a.value&&ee()});const vt=t.computed(()=>Ho(n.sampleValue,v.value,n.locale));return(ce,We)=>(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:F,onKeydown:Ue},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:We[9]||(We[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Ci,[t.createElementVNode("span",vi,t.toDisplayString(t.unref(T)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:ee},[...We[10]||(We[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",wi,[t.createElementVNode("div",ki,[t.createElementVNode("label",Ei,t.toDisplayString(t.unref(T)(e.locale,"nfCategory")),1),t.createVNode(Gt,{class:"nf-field__dropdown","model-value":i.value,options:xe.value,"onUpdate:modelValue":We[0]||(We[0]=Je=>i.value=Je),onChange:H},null,8,["model-value","options"])]),D.value?(t.openBlock(),t.createElementBlock("div",Si,[t.createElementVNode("label",Ri,t.toDisplayString(t.unref(T)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":We[1]||(We[1]=Je=>r.value=Je),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:H},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),Be.value?(t.openBlock(),t.createElementBlock("div",Mi,[t.createElementVNode("label",xi,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":We[2]||(We[2]=Je=>f.value=Je),type:"checkbox",onChange:H},null,544),[[t.vModelCheckbox,f.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(T)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),Xe.value?(t.openBlock(),t.createElementBlock("div",Bi,[t.createElementVNode("label",Di,t.toDisplayString(t.unref(T)(e.locale,"nfSymbol")),1),t.createVNode(Gt,{class:"nf-field__dropdown","model-value":m.value,options:t.unref(we),"onUpdate:modelValue":We[3]||(We[3]=Je=>m.value=Je),onChange:H},null,8,["model-value","options"])])):t.createCommentVNode("",!0),Ge.value?(t.openBlock(),t.createElementBlock("div",Ti,[t.createElementVNode("label",Ni,t.toDisplayString(t.unref(T)(e.locale,"nfDateFormat")),1),t.createVNode(Gt,{class:"nf-field__dropdown","model-value":h.value,options:Te.value,"onUpdate:modelValue":We[4]||(We[4]=Je=>h.value=Je),onChange:H},null,8,["model-value","options"])])):t.createCommentVNode("",!0),oe.value?(t.openBlock(),t.createElementBlock("div",Ii,[t.createElementVNode("label",Fi,t.toDisplayString(t.unref(T)(e.locale,"nfTimeFormat")),1),t.createVNode(Gt,{class:"nf-field__dropdown","model-value":S.value,options:t.unref(et),"onUpdate:modelValue":We[5]||(We[5]=Je=>S.value=Je),onChange:H},null,8,["model-value","options"])])):t.createCommentVNode("",!0),ge.value?(t.openBlock(),t.createElementBlock("div",Ai,[t.createElementVNode("label",Vi,t.toDisplayString(t.unref(T)(e.locale,"nfDateTime")),1),t.createVNode(Gt,{class:"nf-field__dropdown","model-value":d.value,options:Ve.value,"onUpdate:modelValue":We[6]||(We[6]=Je=>d.value=Je),onChange:H},null,8,["model-value","options"])])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("div",Oi,[t.createElementVNode("label",Hi,t.toDisplayString(t.unref(T)(e.locale,"nfDuration")),1),t.createVNode(Gt,{class:"nf-field__dropdown","model-value":k.value,options:t.unref(ke),"onUpdate:modelValue":We[7]||(We[7]=Je=>k.value=Je),onChange:H},null,8,["model-value","options"])])):t.createCommentVNode("",!0),t.createElementVNode("div",zi,[t.createElementVNode("label",Li,t.toDisplayString(t.unref(T)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:E,"onUpdate:modelValue":We[8]||(We[8]=Je=>v.value=Je),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:c},null,544),[[t.vModelText,v.value]])])]),t.createElementVNode("div",$i,[t.createElementVNode("div",_i,[t.createElementVNode("span",Wi,t.toDisplayString(t.unref(T)(e.locale,"nfPreview")),1),t.createElementVNode("span",Pi,t.toDisplayString(vt.value||"—"),1)]),t.createElementVNode("div",Ki,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:p},t.toDisplayString(t.unref(T)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:ee},t.toDisplayString(t.unref(T)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-39792a0b"]]),Gi={class:"sort-confirm__header"},Yi={class:"sort-confirm__title"},Xi={class:"sort-confirm__body"},ji={class:"sort-confirm__message"},Zi={class:"sort-confirm__options"},qi={class:"sort-confirm__option"},Ji={class:"sort-confirm__option"},Qi={class:"sort-confirm__footer"},ec=Zt(t.defineComponent({__name:"sortConfirmDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","confirm","cancel"],setup(e,{emit:l}){const n=e,o=l,a=t.ref(!1),i=t.ref(!0),r=t.ref(null);t.watch(()=>n.modelOpen,v=>{v&&!a.value?f():!v&&a.value&&m()});function f(){i.value=!0,a.value=!0,n.modelOpen!==void 0&&o("update:modelOpen",!0),t.nextTick(()=>{var E;const v=(E=r.value)==null?void 0:E.querySelector(".sort-confirm__btn--primary");v==null||v.focus()})}function m(){a.value=!1,n.modelOpen!==void 0&&o("update:modelOpen",!1)}function h(){k()}function S(v){v.key==="Escape"&&k()}function d(){o("confirm",i.value),m()}function k(){o("cancel"),m()}return(v,E)=>(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:h,onKeydown:S},[t.createElementVNode("div",{ref_key:"dialogRef",ref:r,class:"sort-confirm",onMousedown:E[2]||(E[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Gi,[t.createElementVNode("span",Yi,t.toDisplayString(t.unref(T)(e.locale,"sortReminderTitle")),1),t.createElementVNode("button",{class:"sort-confirm__close",type:"button",onClick:k},[...E[3]||(E[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",Xi,[t.createElementVNode("p",ji,t.toDisplayString(t.unref(T)(e.locale,"sortReminderMessage")),1),t.createElementVNode("div",Zi,[t.createElementVNode("label",qi,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":E[0]||(E[0]=J=>i.value=J),type:"radio",value:!0},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(T)(e.locale,"sortExpandSelection")),1)]),t.createElementVNode("label",Ji,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":E[1]||(E[1]=J=>i.value=J),type:"radio",value:!1},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(T)(e.locale,"sortCurrentSelection")),1)])])]),t.createElementVNode("div",Qi,[t.createElementVNode("button",{class:"sort-confirm__btn sort-confirm__btn--primary",type:"button",onClick:d},t.toDisplayString(t.unref(T)(e.locale,"sort")),1),t.createElementVNode("button",{class:"sort-confirm__btn",type:"button",onClick:k},t.toDisplayString(t.unref(T)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-d26d5917"]]);function pt(e){let l="",n=e;do l=String.fromCharCode(65+n%26)+l,n=Math.floor(n/26)-1;while(n>=0);return l}function Nn(e){let l=0;for(let n=0;n<e.length;n++)l=l*26+(e.toUpperCase().charCodeAt(n)-64);return l-1}function jo(e){if(e==null)return null;if(typeof e=="number")return e;if(typeof e=="string"){const l=parseFloat(e);return e.endsWith("%")||isNaN(l)?null:l}return null}function In(e){navigator.clipboard.writeText(e).catch(()=>{const l=document.createElement("textarea");l.value=e,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.select(),document.execCommand("copy"),document.body.removeChild(l)})}function on(e,l){return`${e},${l}`}function dn(e,l,n){const o=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!o)return null;const a=Nn(o[1]),i=parseInt(o[2],10)-1;return a<0||a>=l||i<0||i>=n?null:{col:a,row:i}}function Zo(e,l){if(!l)return{x:0,y:0};const n=l.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}const Qn=[{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)"}],tc={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 oc(e){let l=0,n=null;for(let o=0;o<e.length;o++){const a=e[o];if(n){a===n&&(e[o+1]===n?o++:n=null);continue}if(a==='"'||a==="'"){n=a;continue}if(a==="(")l++;else if(a===")"&&(l--,l<0))return!1}return l===0}function nc(e){const l=e.trim();if(!l.startsWith("="))return{ok:!1,name:null};const n=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(l.slice(1).trim());if(!n)return{ok:!1,name:null};const o=n[1].toUpperCase(),a=tc[o];if(!a)return{ok:!1,name:o};const i=n[2];if(!oc(i))return{ok:!1,name:o};const r=qo(i),f=r.length===1&&r[0].trim()===""?0:r.length;return f<a.min||f>a.max?{ok:!1,name:o}:r.some(m=>m.trim()==="")?{ok:!1,name:o}:{ok:!0,name:o}}function nn(e,l,n){const o=e.split(":");if(o.length!==2)return null;const a=dn(o[0],l,n),i=dn(o[1],l,n);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 el(e){const l=e.trim();if(l==="")return"";const n=Number(l);return!isNaN(n)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(l)?n:e}function go(e,l,n,o,a){const i=n[on(e,l)];if(!i)return"";const r=i.value;return r.startsWith("=")?ol(on(e,l),n,o,a):el(r)}function tl(e,l,n,o,a){const i=go(e,l,n,o,a);if(i===null)return 0;if(typeof i=="number")return i;const r=parseFloat(String(i));return isNaN(r)?0:r}const un=new Map,yn=new Set;function bn(){un.clear(),yn.clear()}function ol(e,l,n,o){return lc(e,l,n,o,0)}function lc(e,l,n,o,a){if(yn.has(e))return null;if(un.has(e))return un.get(e);yn.add(e);const i=l[e];let r;if(!i)r=null;else{const f=i.value;if(!f.startsWith("="))r=el(f);else{const m=f.slice(1).trim(),h=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(m);r=h?al(h[1].toUpperCase(),h[2],l,n,o,a+1):_t(m,l,n,o,a+1)}}return yn.delete(e),un.set(e,r),r}function Fn(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function nl(e,l){return typeof e=="number"&&typeof l=="number"?e===l:String(e??"")===String(l??"")}function ll(e,l,n){let o;if(typeof e=="number"&&typeof l=="number")o=e<l?-1:e>l?1:0;else{const a=String(e??""),i=String(l??"");o=a<i?-1:a>i?1:0}switch(n){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 rl(e,l,n,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 rc(e,l,n,o,a,i){let f=l.trim();f.length>=2&&(f[0]==='"'&&f[f.length-1]==='"'||f[0]==="'"&&f[f.length-1]==="'")&&(f=f.slice(1,-1));const m=/^([<>=]+)([\s\S]*)$/.exec(f);if(m){const S=m[1],d=rl(m[2]);return ll(e,d,S)}const h=rl(f);return nl(e,h)}function ac(e,l,n,o,a){const i=e.trim(),r=["<=",">=","<>"];let f=null,m=-1,h=null,S=0;for(let k=0;k<i.length;k++){const v=i[k];if(h){v===h&&(i[k+1]===h?k++:h=null);continue}if(v==='"'||v==="'"){h=v;continue}if(v==="("&&S++,v===")"&&S--,S===0&&(v==="<"||v===">"||v==="=")){const E=i.slice(k,k+2);f=r.includes(E)?E:v,m=k;break}}if(f&&m>=0){const k=i.slice(0,m).trim(),v=i.slice(m+f.length).trim(),E=_t(k,l,n,o,a),J=_t(v,l,n,o,a);return ll(E,J,f)}const d=_t(i,l,n,o,a);return Fn(d)}function qo(e){const l=[];let n=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==="("&&n++,r===")"&&n--,r===","&&n===0){l.push(a),a="";continue}a+=r}return l.push(a),l}function _t(e,l,n,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 f=ic(i);if(f.length===0)return null;let m=0;const h=()=>{let v=S();for(;m<f.length;){const E=f[m];if(E.type==="op"&&(E.val==="+"||E.val==="-"))m++,v=An(v,S(),E.val);else break}return v},S=()=>{let v=d();for(;m<f.length;){const E=f[m];if(E.type==="op"&&(E.val==="*"||E.val==="/"))m++,v=An(v,d(),E.val);else break}return v},d=()=>{const v=f[m];return v&&v.type==="op"&&v.val==="-"?(m++,An(0,d(),"-")):v&&v.type==="op"&&v.val==="+"?(m++,d()):k()},k=()=>{const v=f[m];if(!v)return null;if(v.type==="num")return m++,Number(v.val);if(v.type==="str")return m++,v.val;if(v.type==="lp"){m++;const E=h();return f[m]&&f[m].type==="rp"&&m++,E}if(v.type==="ref"){m++;const E=dn(v.val,n,o);return E?go(E.col,E.row,l,n,o):null}if(v.type==="func"){const E=v.val.toUpperCase();if(m++,f[m]&&f[m].type==="lp"){const J=f[m];let j=0,le=null,L=m;for(;L<f.length;L++)if(f[L].type==="lp")j++;else if(f[L].type==="rp"&&(j--,j===0)){le=f[L];break}if(le){const g=i.slice(J.start+1,le.start);return m=L+1,al(E,g,l,n,o,a+1)}}return null}return m++,null};return h()}function ic(e){const l=[];let n=0;for(;n<e.length;){const o=e[n];if(/\s/.test(o)){n++;continue}if(o==='"'||o==="'"){const a=o,i=n;n++;let r="";for(;n<e.length;){if(e[n]===a){if(e[n+1]===a){r+=a,n+=2;continue}n++;break}r+=e[n],n++}l.push({type:"str",val:r,start:i});continue}if(/[0-9]/.test(o)||o==="."){const a=n;let i="";for(o==="."&&(i+=".",n++);n<e.length&&/[0-9]/.test(e[n]);)i+=e[n],n++;if(e[n]===".")for(i+=".",n++;n<e.length&&/[0-9]/.test(e[n]);)i+=e[n],n++;if(e[n]==="e"||e[n]==="E")for(i+=e[n],n++,(e[n]==="+"||e[n]==="-")&&(i+=e[n],n++);n<e.length&&/[0-9]/.test(e[n]);)i+=e[n],n++;l.push({type:"num",val:i,start:a});continue}if(/[A-Za-z_]/.test(o)){const a=n;let i="";for(;n<e.length&&/[A-Za-z0-9_]/.test(e[n]);)i+=e[n],n++;e[n]==="("?l.push({type:"func",val:i,start:a}):l.push({type:"ref",val:i,start:a});continue}if(o==="("){l.push({type:"lp",val:o,start:n}),n++;continue}if(o===")"){l.push({type:"rp",val:o,start:n}),n++;continue}if(o===","){l.push({type:"comma",val:o,start:n}),n++;continue}if(o==="+"||o==="-"||o==="*"||o==="/"){l.push({type:"op",val:o,start:n}),n++;continue}n++}return l}function An(e,l,n){if(typeof e!="number"||typeof l!="number")return null;switch(n){case"+":return e+l;case"-":return e-l;case"*":return e*l;case"/":return l===0?null:e/l}return null}function al(e,l,n,o,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=nn(l.trim(),o,a);if(!r)return null;if(e==="COUNT"){let m=0;for(let h=r.sc;h<=r.ec;h++)for(let S=r.sr;S<=r.er;S++)typeof go(h,S,n,o,a)=="number"&&m++;return m}let f=0;for(let m=r.sc;m<=r.ec;m++)for(let h=r.sr;h<=r.er;h++)f+=tl(m,h,n,o,a);if(isNaN(f))return null;if(e==="AVERAGE"){const m=(r.ec-r.sc+1)*(r.er-r.sr+1);return m===0?null:f/m}return f}case"IF":{const r=qo(l);if(r.length<3)return null;const f=ac(r[0],n,o,a,i);return _t(f?r[1]:r[2],n,o,a,i)}case"VLOOKUP":{const r=qo(l);if(r.length<3)return null;const f=_t(r[0],n,o,a,i),m=nn(r[1].trim(),o,a);if(!m)return null;const h=_t(r[2],n,o,a,i),S=typeof h=="number"?h:parseFloat(String(h));if(isNaN(S))return null;const d=m.sc+(S-1);if(d<m.sc||d>m.ec)return null;if(r.length>=4?Fn(_t(r[3],n,o,a,i)):!1){let v=-1,E=-1/0;for(let J=m.sr;J<=m.er;J++){const j=go(m.sc,J,n,o,a);typeof j=="number"&&typeof f=="number"&&j<=f&&j>E&&(E=j,v=J)}return v>=0?go(d,v,n,o,a):null}for(let v=m.sr;v<=m.er;v++){const E=go(m.sc,v,n,o,a);if(nl(E,f))return go(d,v,n,o,a)}return null}case"CONCATENATE":{const r=qo(l);let f="";for(const m of r){const h=_t(m,n,o,a,i);f+=h===null?"":typeof h=="number"?String(h):h}return f}case"MAX":case"MIN":{const r=nn(l.trim(),o,a);if(!r)return null;const f=[];for(let m=r.sc;m<=r.ec;m++)for(let h=r.sr;h<=r.er;h++){const S=go(m,h,n,o,a);typeof S=="number"&&f.push(S)}return f.length===0?null:e==="MAX"?Math.max(...f):Math.min(...f)}case"STDEV":{const r=nn(l.trim(),o,a);if(!r)return null;const f=[];for(let d=r.sc;d<=r.ec;d++)for(let k=r.sr;k<=r.er;k++){const v=go(d,k,n,o,a);typeof v=="number"&&f.push(v)}const m=f.length;if(m<2)return null;const h=f.reduce((d,k)=>d+k,0)/m,S=f.reduce((d,k)=>d+Math.pow(k-h,2),0)/(m-1);return Math.sqrt(S)}case"SIN":{const r=qo(l);if(r.length!==1)return null;const f=_t(r[0],n,o,a,i);return typeof f!="number"?null:Math.sin(f)}case"SUMIF":{const r=qo(l);if(r.length<2||r.length>3)return null;const f=nn(r[0].trim(),o,a);if(!f)return null;const m=r.length===3?nn(r[2].trim(),o,a):f;if(!m)return null;let h=0;for(let S=f.sr;S<=f.er;S++)for(let d=f.sc;d<=f.ec;d++){const k=go(d,S,n,o,a);rc(k,r[1])&&(h+=tl(m.sc+(d-f.sc),m.sr+(S-f.sr),n,o,a))}return h}case"PMT":{const r=qo(l);if(r.length<3||r.length>5)return null;const f=_t(r[0],n,o,a,i),m=_t(r[1],n,o,a,i),h=_t(r[2],n,o,a,i);if(typeof f!="number"||typeof m!="number"||typeof h!="number")return null;const S=r.length>=4?_t(r[3],n,o,a,i):0,d=typeof S=="number"?S:0,k=r.length>=5?_t(r[4],n,o,a,i):0,v=Fn(k)?1:0;if(f===0)return m===0?null:-(h+d)/m;const E=Math.pow(1+f,m);return-(d+h*E)*f/((1+f*v)*(E-1))}default:return null}}function Vn(e,l,n){const o=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=dn(i[1],l,n);if(r)if(i[2]){const f=dn(i[2],l,n);if(!f)continue;for(let m=Math.min(r.col,f.col);m<=Math.max(r.col,f.col);m++)for(let h=Math.min(r.row,f.row);h<=Math.max(r.row,f.row);h++)o.push(on(m,h))}else o.push(on(r.col,r.row))}return o}function il(e,l,n,o,a){const i=n[on(e,l)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const f=ol(on(e,l),n,o,a);return f===null?"#ERROR":String(f)}function cc(e,l,n,o,a,i){return l===0&&n===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,f,m,h,S)=>{const d=f?Nn(m):Nn(m)+l,k=h?parseInt(S,10)-1:parseInt(S,10)-1+n;let v;d<0?v="A":d>=o?v=i(o-1):v=i(d);let E;return k<0?E="1":k>=a?E=String(a):E=String(k+1),(f||"")+v+(h||"")+E})}class sc{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(l){var o;const n=this.deps.get(l);if(n){for(const a of n)(o=this.rev.get(a))==null||o.delete(l);this.deps.delete(l)}}set(l,n){if(this.clear(l),n.length!==0){this.deps.set(l,n);for(const o of n)this.rev.has(o)||this.rev.set(o,new Set),this.rev.get(o).add(l)}}markDirty(l){const n=[l];for(;n.length>0;){const o=n.pop(),a=this.rev.get(o);if(a)for(const i of a)this.dirty.has(i)||(this.dirty.add(i),n.push(i))}}getDirtyAndClear(){const l=this.dirty;return this.dirty=new Set,l}rebuild(l,n,o){this.deps.clear(),this.rev.clear(),this.dirty.clear(),un.clear();for(const[a,i]of Object.entries(l))if(i.value.startsWith("=")){const r=Vn(i.value.slice(1),n,o);this.set(a,r)}}}const dc={class:"ifn-dialog__header"},uc={class:"ifn-dialog__title"},fc={class:"ifn-dialog__body"},mc={class:"ifn-dialog__field"},pc={class:"ifn-dialog__label"},hc={key:0,class:"ifn-dialog__desc"},gc={class:"ifn-dialog__field"},yc={class:"ifn-dialog__label"},bc={class:"ifn-dialog__footer"},Cc=["disabled"],vc=Zt(t.defineComponent({__name:"insertFunctionDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","insert","cancel"],setup(e,{emit:l}){const n=e,o=l,a=t.ref(!1),i=t.ref(""),r=t.ref(""),f=t.ref(null),m=t.ref(null),h={SUM:"fnDescSum",AVERAGE:"fnDescAverage",COUNT:"fnDescCount",IF:"fnDescIf",VLOOKUP:"fnDescVlookup",CONCATENATE:"fnDescConcatenate",MAX:"fnDescMax",MIN:"fnDescMin",SIN:"fnDescSin",SUMIF:"fnDescSumif",PMT:"fnDescPmt",STDEV:"fnDescStdev"},S=t.computed(()=>Qn.map(Z=>({label:Z.name,value:Z.name}))),d=t.computed(()=>{const Z=String(i.value??"");return Z?T(n.locale,h[Z]??""):""}),k=t.computed(()=>nc(r.value)),v=t.computed(()=>i.value===""||i.value===null||!r.value.trim()||!k.value.ok?!1:k.value.name===String(i.value).toUpperCase());t.watch(()=>n.modelOpen,Z=>{Z&&!a.value?E():!Z&&a.value&&J()});function E(){r.value="",i.value="",a.value=!0,n.modelOpen!==void 0&&o("update:modelOpen",!0),t.nextTick(()=>{const Z=f.value;if(Z)try{Z.focus({preventScroll:!0}),Z.setSelectionRange(Z.value.length,Z.value.length)}catch{}})}function J(){a.value=!1,n.modelOpen!==void 0&&o("update:modelOpen",!1)}function j(Z){i.value=Z;const ie=Qn.find(De=>De.name===String(Z));ie&&(r.value="",le(ie.snippet))}function le(Z){const ie=r.value,De=f.value,_e=De?De.selectionStart??ie.length:ie.length,xe=De?De.selectionEnd??ie.length:ie.length,we=ie.trim()?Z:"="+Z;r.value=ie.slice(0,_e)+we+ie.slice(xe),t.nextTick(()=>{const Te=f.value;if(!Te)return;const et=_e+we.length;try{Te.focus({preventScroll:!0}),Te.setSelectionRange(et,et)}catch{}})}function L(){o("insert",r.value),J()}function g(){o("cancel"),J()}function he(Z){Z.key==="Escape"&&(Z.stopPropagation(),g())}return(Z,ie)=>(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(g,["self"]),onKeydown:he},[t.createElementVNode("div",{ref_key:"dialogRef",ref:m,class:"ifn-dialog",onMousedown:ie[1]||(ie[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",dc,[t.createElementVNode("span",uc,t.toDisplayString(t.unref(T)(e.locale,"insertFunctionTitle")),1),t.createElementVNode("button",{class:"ifn-dialog__close",type:"button",onClick:g},[...ie[2]||(ie[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",fc,[t.createElementVNode("div",mc,[t.createElementVNode("label",pc,t.toDisplayString(t.unref(T)(e.locale,"insertFunctionSelectLabel")),1),t.createVNode(Gt,{class:"ifn-dialog__dropdown","model-value":i.value,options:S.value,searchable:!0,"search-placeholder":t.unref(T)(e.locale,"insertFunctionSearchPlaceholder"),"fallback-label":t.unref(T)(e.locale,"insertFunctionPlaceholder"),title:t.unref(T)(e.locale,"insertFunctionSelectLabel"),"onUpdate:modelValue":j},null,8,["model-value","options","search-placeholder","fallback-label","title"]),d.value?(t.openBlock(),t.createElementBlock("div",hc,t.toDisplayString(d.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",gc,[t.createElementVNode("label",yc,t.toDisplayString(t.unref(T)(e.locale,"insertFunctionFormulaLabel")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:f,"onUpdate:modelValue":ie[0]||(ie[0]=De=>r.value=De),class:"ifn-dialog__textarea",spellcheck:"false"},null,512),[[t.vModelText,r.value]])])]),t.createElementVNode("div",bc,[t.createElementVNode("button",{class:"ifn-dialog__btn ifn-dialog__btn--primary",type:"button",disabled:!v.value,onClick:L},t.toDisplayString(t.unref(T)(e.locale,"insertFunctionBtn")),9,Cc),t.createElementVNode("button",{class:"ifn-dialog__btn",type:"button",onClick:g},t.toDisplayString(t.unref(T)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-f4e459b6"]]);class wc{constructor(l){if(l&&l.length>0){this.styles=l,this.index=new Map;for(let n=0;n<this.styles.length;n++){const o=this.stableKey(this.styles[n]);this.index.set(o,n)}}else this.styles=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(l){const n=Object.keys(l).sort(),o={};for(const a of n)o[a]=l[a];return JSON.stringify(o)}get(l){const n=this.styles[l];return n?l===0?n:Object.freeze(n):{}}getId(l){if(!l||Object.keys(l).length===0)return 0;const n=this.stableKey(l),o=this.index.get(n);if(o!==void 0)return o;const a=this.styles.length,i=Object.freeze({...l});return this.styles.push(i),this.index.set(n,a),a}getStyles(){return[...this.styles]}setStyles(l){this.styles=l,this.index=new Map;for(let n=0;n<this.styles.length;n++){const o=this.stableKey(this.styles[n]);this.index.set(o,n)}}compactStyles(l){const n=new Set;n.add(0);for(const r in l){const f=l[r].styleId??0;n.add(f)}const o=new Map,a=[{}];o.set(0,0);const i=Array.from(n).sort((r,f)=>r-f);for(const r of i)if(r!==0&&r<this.styles.length){const f=a.length;o.set(r,f),a.push(this.styles[r])}for(const r in l){const f=l[r],m=f.styleId??0,h=o.get(m);h!==void 0&&h!==m&&(f.styleId=h)}this.styles=a,this.index=new Map;for(let r=0;r<this.styles.length;r++){const f=this.stableKey(this.styles[r]);this.index.set(f,r)}return a}}function kc(e,l){if(!e)return null;const n=e.styleId;return n===void 0||n===0?null:l[n]??null}function cl(e){const l=new wc,n={};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=l.getId(a.style)),i.styleId===0&&delete i.styleId,n[o]=i}return{cells:n,styles:l.getStyles()}}function Ec(e){const l={};for(const[n,o]of Object.entries(e)){const a={value:o.value};o.styleId!==void 0&&o.styleId>0&&(a.styleId=o.styleId),l[n]=a}return l}class Sc{constructor(l){if(l&&l.length>0){this.borders=l,this.index=new Map;for(let n=0;n<this.borders.length;n++){const o=this.stableKey(this.borders[n]);this.index.set(o,n)}}else this.borders=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(l){const n=["top","right","bottom","left"],o={};for(const a of n){const i=l[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(l){const n=this.borders[l];return n?l===0?n:Object.freeze(n):{}}getId(l){if(!l||this.isEmptyBorder(l))return 0;const n=this.stableKey(l),o=this.index.get(n);if(o!==void 0)return o;const a=this.borders.length,i=Object.freeze(this.deepCloneBorder(l));return this.borders.push(i),this.index.set(n,a),a}isEmptyBorder(l){return!l.top&&!l.right&&!l.bottom&&!l.left}deepCloneBorder(l){const n={};return l.top&&(n.top={...l.top}),l.right&&(n.right={...l.right}),l.bottom&&(n.bottom={...l.bottom}),l.left&&(n.left={...l.left}),n}getBorders(){return[...this.borders]}setBorders(l){this.borders=l,this.index=new Map;for(let n=0;n<this.borders.length;n++){const o=this.stableKey(this.borders[n]);this.index.set(o,n)}}compactBorders(l){const n=new Set;n.add(0);for(const r of l){const f=r.borderId??0;n.add(f)}const o=new Map,a=[{}];o.set(0,0);const i=Array.from(n).sort((r,f)=>r-f);for(const r of i)if(r!==0&&r<this.borders.length){const f=a.length;o.set(r,f),a.push(this.borders[r])}for(const r of l){const f=r.borderId??0,m=o.get(f);m!==void 0&&m!==f&&(r.borderId=m)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const f=this.stableKey(this.borders[r]);this.index.set(f,r)}return a}}function Rc(e,l,n,o){if(!e)return;const a=e.styleId??0,i=n[a];if(!i)return;const r=i.borderId??0;if(r===0)return;const f=o.get(r);if(f)return f[l]}function Mc(e,l,n,o,a,i){const r=o[e.styleId??0]??{},f=r.borderId??0,m=f>0?a.get(f):{},h={top:m.top?{...m.top}:void 0,right:m.right?{...m.right}:void 0,bottom:m.bottom?{...m.bottom}:void 0,left:m.left?{...m.left}:void 0};n?h[l]={...n}:h[l]=void 0;const S=a.getId(h),d={...r};S===0?delete d.borderId:d.borderId=S,delete d.borderTopWidth,delete d.borderBottomWidth,delete d.borderLeftWidth,delete d.borderRightWidth,delete d.borderColor,Object.keys(d).length===0?e.styleId=0:e.styleId=i(d)}function sl(e){const l=new Sc,n=[];for(const o of e){if(!(o.borderTopWidth!==void 0||o.borderBottomWidth!==void 0||o.borderLeftWidth!==void 0||o.borderRightWidth!==void 0)){n.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 f=l.getId(r),m={...o};delete m.borderTopWidth,delete m.borderBottomWidth,delete m.borderLeftWidth,delete m.borderRightWidth,delete m.borderColor,f>0?m.borderId=f:delete m.borderId,n.push(m)}return{styles:n,borders:l.getBorders()}}function xc(e,l){const n=t.reactive({rowCount:e.rowCount??l.rowCount,colCount:e.colCount??l.colCount,width:e.width,height:e.height,theme:e.theme??l.theme,locale:e.locale??l.locale});t.watchEffect(()=>{n.rowCount=e.rowCount??l.rowCount,n.colCount=e.colCount??l.colCount,n.width=e.width,n.height=e.height,n.theme=e.theme??l.theme,n.locale=e.locale??l.locale});const o=t.computed(()=>n.locale==="zh-CN"?"zh-CN":"en-US"),a=n.colCount,i=n.rowCount,r=t.reactive({colCount:a,rowCount:i}),f=8,m=32,h=t.reactive({}),S=t.reactive([{}]),d=t.reactive([{}]);let k=new Map;k.set("{}",0);let v=new Map;v.set("{}",0);function E(w){const B=Object.keys(w).sort(),O={};for(const U of B)O[U]=w[U];return JSON.stringify(O)}function J(w){const B=["top","right","bottom","left"],O={};for(const U of B){const Q=w[U];if(Q&&(Q.width!==void 0||Q.color!==void 0||Q.style!==void 0)){const Se={};Q.width!==void 0&&(Se.width=Q.width),Q.color!==void 0&&(Se.color=Q.color),Q.style!==void 0&&(Se.style=Q.style),O[U]=Se}}return JSON.stringify(O)}function j(w){if(!w||Object.keys(w).length===0)return 0;const B=E(w),O=k.get(B);if(O!==void 0)return O;const U=S.length;return S.push(Object.freeze({...w})),k.set(B,U),U}function le(w){return kc(w,S)}function L(){k=new Map;for(let w=0;w<S.length;w++)k.set(E(S[w]),w)}function g(w){S.splice(0,S.length,...w),L()}function he(w){if(!w||!w.top&&!w.right&&!w.bottom&&!w.left)return 0;const B=J(w),O=v.get(B);if(O!==void 0)return O;const U=d.length;return d.push(Object.freeze({top:w.top?Object.freeze({...w.top}):void 0,right:w.right?Object.freeze({...w.right}):void 0,bottom:w.bottom?Object.freeze({...w.bottom}):void 0,left:w.left?Object.freeze({...w.left}):void 0})),v.set(B,U),U}function Z(w){return d[w]??{}}function ie(){v=new Map;for(let w=0;w<d.length;w++)v.set(J(d[w]),w)}function De(w){d.splice(0,d.length,...w),ie()}function _e(w,B){return Rc(w,B,S,{get:O=>d[O]??{}})}function xe(w,B){const O=ee(w,B);return O?O.anchor:null}function we(w,B,O,U){const Q=ee(w,B),Se=ee(O,U);return!Q||!Se?!1:Q.anchor===Se.anchor}const Te=t.reactive({}),et=new sc,Ve=t.ref(null),ke=t.ref("cell"),Be=t.ref({col:0,row:0}),Xe=t.ref(null),Ge=t.ref(""),oe=t.ref(new Array(r.colCount).fill(100)),ge=t.ref(new Array(r.rowCount).fill(void 0)),u=t.ref(0),D=t.ref(0),I=t.reactive({rows:0,cols:0}),G=new Map;let $=null;function ne(w,B,O,U){const Q=`${U} ${O} ${B}px ${w}`,Se=G.get(Q);if(Se)return Se;if(!$){if(typeof document>"u")return{ascent:B*.88,descent:B*.28};$=document.createElement("canvas")}const Ie=$.getContext("2d");if(!Ie)return{ascent:B*.88,descent:B*.28};Ie.font=Q;const Ke=Ie.measureText(" "),tt=Ke.fontBoundingBoxAscent,je=Ke.fontBoundingBoxDescent;if(typeof tt=="number"&&typeof je=="number"&&tt>0&&je>0){const Jt={ascent:tt,descent:je};return G.set(Q,Jt),Jt}const qe=["M","中","y","Ä","0"];let Ot=0,ct=0;for(const Jt of qe){const Lo=Ie.measureText(Jt),ln=Lo.actualBoundingBoxAscent||0,$o=Lo.actualBoundingBoxDescent||0;ln>Ot&&(Ot=ln),$o>ct&&(ct=$o)}const St=Math.max(Ot,B*.88),Ut=Math.max(ct,B*.28),zo={ascent:St,descent:Ut};return G.set(Q,zo),zo}const H=ne(Xo,ko,"normal","normal"),c=H.ascent+H.descent,y=Math.max(0,(24-c)/2);let at=(w,B)=>`${w},${B}`,ee=()=>null,p=()=>ko,F=t.computed(()=>[0]),Ue=()=>24,vt=(w,B,O,U)=>({startCol:Math.min(w,O),startRow:Math.min(B,U),endCol:Math.max(w,O),endRow:Math.max(B,U)});function ce(w,B){const O=le(h[at(w,B)]),U=p(w,B),Q=typeof(O==null?void 0:O.fontFamily)=="string"&&O.fontFamily?O.fontFamily:Xo,Se=(O==null?void 0:O.fontWeight)==="bold"?"bold":"normal",Ie=(O==null?void 0:O.fontStyle)==="italic"?"italic":"normal";return ne(Q,U,Se,Ie)}function We(w,B,O,U){if(!B)return[""];const Q=B.split(`
2
- `),Se=[];for(const Ie of Q)if(!U||O<=0)Se.push(Ie);else{let Ke="";for(let tt=0;tt<Ie.length;tt++){const je=Ie[tt],qe=Ke+je;w.measureText(qe).width>O&&Ke?(Se.push(Ke),Ke=je):Ke=qe}Se.push(Ke)}return Se}function Je(w,B){const O=le(h[at(w,B)]);return typeof(O==null?void 0:O.fontSize)=="number"&&O.fontSize>0?O.fontSize:ko}p=Je;const gt=t.computed(()=>{const w=[0];for(let B=0;B<r.colCount;B++)w.push(w[B]+oe.value[B]);return w});F=gt;const kt={w:800,h:600};let Vt=()=>{};const Ht=t.computed(()=>{const w=new Set;for(const B in h){const O=B.indexOf(",");if(O<0)continue;const U=parseInt(B.substring(O+1),10),Q=h[B];Q&&(Q.value!==""||Q.styleId!==void 0)&&w.add(U)}for(let B=0;B<ge.value.length;B++)ge.value[B]!==void 0&&w.add(B);for(const B in Te){const O=B.indexOf(",");if(O<0)continue;const U=parseInt(B.substring(O+1),10);w.add(U)}return w});function Kt(w){const B=ge.value[w];if(B!=null&&B>0)return B;if(!Ht.value.has(w))return 24;let O,U,Q=1;const Se=$?$.getContext("2d"):null,Ie=ne(Xo,ko,"normal","normal");O=Ie.ascent,U=Ie.descent;for(let qe=0;qe<r.colCount;qe++){const Ot=Je(qe,w),ct=le(h[at(qe,w)]),St=typeof(ct==null?void 0:ct.fontFamily)=="string"&&ct.fontFamily?ct.fontFamily:Xo,Ut=(ct==null?void 0:ct.fontWeight)==="bold"?"bold":"normal",zo=(ct==null?void 0:ct.fontStyle)==="italic"?"italic":"normal",Jt=ne(St,Ot,Ut,zo);Jt.ascent>O&&(O=Jt.ascent),Jt.descent>U&&(U=Jt.descent);const Lo=typeof(ct==null?void 0:ct.numberFormat)=="string"?ct.numberFormat:"",ln=me(qe,w),$o=Ho(ln,Lo,o.value);if($o){const Hn=(ct==null?void 0:ct.wrap)==="wrap";let _o;if(Hn&&Se){Se.font=`${zo} ${Ut} ${Ot}px ${St}`;const rn=ee(qe,w);let fn;rn&&qe===rn.range.startCol&&w===rn.range.startRow?fn=F.value[rn.range.endCol+1]-F.value[qe]:fn=oe.value[qe],_o=We(Se,$o,Math.max(0,fn-10),!0).length,_o>Q&&(Q=_o)}else _o=$o.split(`
3
- `).length,_o>Q&&(Q=_o)}}const Ke=O+U,tt=y*2+Q*Ke;return Math.min(500,Math.max(24,Math.round(tt)))}Ue=Kt;function lo(w){return ge.value[w]===void 0}const Wt=t.computed(()=>{const w=[0];for(let B=0;B<r.rowCount;B++)w.push(w[B]+Ue(B));return w}),yo=t.computed(()=>gt.value[r.colCount]),ro=t.computed(()=>Wt.value[r.rowCount]);function Yt(w,B){return`${w},${B}`}at=Yt;function Mo(w){Reflect.deleteProperty(h,w)}function xo(w,B){ke.value="cell";const O=ee(w,B);O?(Be.value={col:O.range.startCol,row:O.range.startRow},Ve.value={...O.range}):(Be.value={col:w,row:B},Ve.value={startCol:w,startRow:B,endCol:w,endRow:B})}function qt(w,B,O,U,Q="cell"){const Se=ee(w,B);if(Be.value=Se?{col:Se.range.startCol,row:Se.range.startRow}:{col:w,row:B},ke.value=Q,Q==="row"||Q==="col"){const Ie=Math.min(w,O),Ke=Math.max(w,O),tt=Math.min(B,U),je=Math.max(B,U);Ve.value={startCol:Ie,startRow:tt,endCol:Ke,endRow:je}}else Ve.value=vt(w,B,O,U)}function ao(){qt(0,0,r.colCount-1,r.rowCount-1,"all")}function uo(w,B){const O=Ve.value;return O?(ke.value==="cell"||ke.value==="all",w>=O.startCol&&w<=O.endCol&&B>=O.startRow&&B<=O.endRow):!1}function fo(w,B){return uo(w,B)}function io(w,B){for(const O in Te){const U=Te[O];if(U&&w>=U.startCol&&w<=U.endCol&&B>=U.startRow&&B<=U.endRow)return{range:U,anchor:O}}return null}ee=io;function x(w,B){return Te[Yt(w,B)]!==void 0}function M(w,B){const O=ee(w,B);if(O&&w===O.range.startCol&&B===O.range.startRow){const U=gt.value[O.range.endCol+1]-gt.value[w],Q=Wt.value[O.range.endRow+1]-Wt.value[B];return{w:U,h:Q}}return{w:oe.value[w],h:Ue(B)}}function N(w,B,O,U){let Q=Math.min(w,O),Se=Math.max(w,O),Ie=Math.min(B,U),Ke=Math.max(B,U),tt=!0;for(;tt;){tt=!1;for(const je in Te){const qe=Te[je];if(!qe)continue;qe.startCol<=Se&&qe.endCol>=Q&&qe.startRow<=Ke&&qe.endRow>=Ie&&(qe.startCol<Q&&(Q=qe.startCol,tt=!0),qe.endCol>Se&&(Se=qe.endCol,tt=!0),qe.startRow<Ie&&(Ie=qe.startRow,tt=!0),qe.endRow>Ke&&(Ke=qe.endRow,tt=!0))}}return{startCol:Q,startRow:Ie,endCol:Se,endRow:Ke}}vt=N;function te(w,B){var O;return((O=h[Yt(w,B)])==null?void 0:O.value)??""}function me(w,B){return bn(),il(w,B,h,r.colCount,r.rowCount)}function Ce(w,B,O){var Ke,tt;w>=0&&B>=0&&xt(w,B);const U=Yt(w,B);if(bn(),O===""||O==null){et.clear(U);const je=(Ke=h[U])==null?void 0:Ke.styleId;je!==void 0&&je>0?h[U]={value:"",styleId:je}:Mo(U),et.markDirty(U);return}const Q=String(O);if(!Q.startsWith("=")){const je=le(h[U]),qe=typeof(je==null?void 0:je.numberFormat)=="string"?je.numberFormat:"";if(no(qe)){const Ot=Dn(Q,o.value);if(Ot){const St={...je??{},numberFormat:Ot.format};h[U]={value:String(Ot.serial),styleId:j(St)},et.clear(U),et.markDirty(U);return}const ct=Zl(Q,o.value);if(ct){const St={...je??{},numberFormat:ct.format};h[U]={value:String(ct.num),styleId:j(St)},et.clear(U),et.markDirty(U);return}}}const Se=(tt=h[U])==null?void 0:tt.styleId,Ie={value:Q};Se!==void 0&&Se>0&&(Ie.styleId=Se),h[U]=Ie,Q.startsWith("=")?et.set(U,Vn(Q.slice(1),r.colCount,r.rowCount)):et.clear(U),et.markDirty(U)}function ye(w,B,O,U){for(let Q=w;Q<=B;Q++)for(let Se=O;Se<=U;Se++){const Ie=Yt(Q,Se);et.clear(Ie),Mo(Ie),et.markDirty(Ie)}}let ae=()=>{};function W(w){Xe.value||(Xe.value={...Be.value},w!==void 0?Ge.value=w:Ge.value||(Ge.value=te(Be.value.col,Be.value.row)))}function Oe(){Xe.value&&(ae(),Ce(Xe.value.col,Xe.value.row,Ge.value),Xe.value=null,Ge.value="")}function He(){Xe.value=null,Ge.value=""}function P(w,B){const O=Be.value;let U=Math.max(0,O.col+w),Q=Math.max(0,O.row+B);(U>=r.colCount||Q>=r.rowCount)&&xt(U,Q);const Se=ee(O.col,O.row),Ie=ee(U,Q);Se&&Ie&&Se.anchor===Ie.anchor&&(w>0?U=Se.range.endCol+1:w<0&&(U=Se.range.startCol-1),B>0?Q=Se.range.endRow+1:B<0&&(Q=Se.range.startRow-1),(U>=r.colCount||Q>=r.rowCount)&&xt(U,Q)),U=Math.max(0,Math.min(r.colCount-1,U)),Q=Math.max(0,Math.min(r.rowCount-1,Q)),xo(U,Q)}function Ne(w,B){ht(B,w)}function ot(w){const B=gt.value;if(w<0||w>=B[r.colCount])return-1;let O=0,U=r.colCount-1;for(;O<U;){const Q=O+U+1>>1;B[Q]<=w?O=Q:U=Q-1}return O}function b(w){const B=Wt.value;if(w<0||w>=B[r.rowCount])return-1;let O=0,U=r.rowCount-1;for(;O<U;){const Q=O+U+1>>1;B[Q]<=w?O=Q:U=Q-1}return O}function z(w,B){var Q,Se;const O=Math.max(0,Math.min(Math.floor(w),r.rowCount)),U=Math.max(0,Math.min(Math.floor(B),r.colCount));I.rows=O,I.cols=U,(Q=Qe.scheduleRender)==null||Q.call(Qe),(Se=Qe.emitModelData)==null||Se.call(Qe)}function _(){var w,B;I.rows=0,I.cols=0,(w=Qe.scheduleRender)==null||w.call(Qe),(B=Qe.emitModelData)==null||B.call(Qe)}function se(){return{rows:I.rows,cols:I.cols}}function de(){let w=0,B=0;if(I.cols>0){const O=oe.value,U=Math.min(I.cols,O.length);for(let Q=0;Q<U;Q++)w+=O[Q]}if(I.rows>0)for(let O=0;O<I.rows;O++)B+=Ue(O);return{frozenRowsHeight:B,frozenColumnsWidth:w}}function re(){const{frozenColumnsWidth:w,frozenRowsHeight:B}=de(),O=52+w,U=24+B,Q=Math.max(0,kt.w-52-11-w),Se=Math.max(0,kt.h-24-11-B),Ie=[];return B>0&&w>0&&Ie.push({kind:"corner",x:52,y:24,width:w,height:B,scrollLeft:0,scrollTop:0}),B>0&&Ie.push({kind:"rows",x:O,y:24,width:Q,height:B,scrollLeft:u.value,scrollTop:0}),w>0&&Ie.push({kind:"columns",x:52,y:U,width:w,height:Se,scrollLeft:0,scrollTop:D.value}),Ie.push({kind:"body",x:O,y:U,width:Q,height:Se,scrollLeft:u.value,scrollTop:D.value}),Ie}function be(w,B){const O=gt.value,U=Wt.value,Q=oe.value,Se=O[B]??0,Ie=U[w]??0,Ke=ee(B,w),tt=Ke?(O[Ke.range.endCol+1]??Se)-Se:Q[B]??0,je=Ke?(U[Ke.range.endRow+1]??Ie)-Ie:Ue(w),qe=B<I.cols,Ot=w<I.rows,ct=qe?52+Se:52+Se-u.value,St=Ot?24+Ie:24+Ie-D.value;return{x:ct,y:St,width:tt,height:je}}function Le(w,B){const{frozenColumnsWidth:O,frozenRowsHeight:U}=de();if(w<52||B<24)return null;const Q=O>0&&w<52+O,Se=U>0&&B<24+U,Ie=Q?w-52:w-52+u.value,Ke=Se?B-24:B-24+D.value,tt=ot(Ie),je=b(Ke);return tt<0||je<0?null:{col:tt,row:je}}function it(w,B){return w<I.rows||B<I.cols}function ht(w,B){if(it(w,B))return;const{frozenColumnsWidth:O,frozenRowsHeight:U}=de(),Q=Math.max(0,kt.w-52-11-O),Se=Math.max(0,kt.h-24-11-U),Ie=gt.value,Ke=Wt.value,tt=(Ie[B]??0)-O,je=(Ke[w]??0)-U,qe=ee(B,w),Ot=qe?(Ie[qe.range.endCol+1]??0)-(Ie[B]??0):oe.value[B]??0,ct=qe?(Ke[qe.range.endRow+1]??0)-(Ke[w]??0):Ue(w);let St=u.value,Ut=D.value;tt<St?St=tt:tt+Ot>St+Q&&(St=tt+Ot-Q),je<Ut?Ut=je:je+ct>Ut+Se&&(Ut=je+ct-Se),St=Math.max(0,St),Ut=Math.max(0,Ut),Vt(St,Ut)}function xt(w,B){var Se;const O=w+1,U=B+1;let Q=!1;if(O>=r.colCount){const Ie=Math.max(r.colCount+f,O),Ke=Ie-r.colCount,tt=oe.value;for(let je=0;je<Ke;je++)tt.push(100);r.colCount=Ie,Q=!0}if(U>=r.rowCount){const Ie=Math.max(r.rowCount+m,U),Ke=Ie-r.rowCount,tt=ge.value;for(let je=0;je<Ke;je++)tt.push(void 0);r.rowCount=Ie,Q=!0}Q&&((Se=Qe.scheduleRender)==null||Se.call(Qe))}function Bt(){return r.colCount!==a||r.rowCount!==i}function Nt(w,B){var Se;let O=!1;const U=Math.max(1,Math.floor(w)),Q=Math.max(1,Math.floor(B));if(U!==r.colCount){if(U>r.colCount){const Ie=oe.value;for(let Ke=r.colCount;Ke<U;Ke++)Ie.push(100)}else oe.value=oe.value.slice(0,U);r.colCount=U,O=!0}if(Q!==r.rowCount){if(Q>r.rowCount){const Ie=ge.value;for(let Ke=r.rowCount;Ke<Q;Ke++)Ie.push(void 0)}else ge.value=ge.value.slice(0,Q);r.rowCount=Q,O=!0}O&&((Se=Qe.scheduleRender)==null||Se.call(Qe))}const Qe={props:n,locale:o,get colCount(){return r.colCount},get rowCount(){return r.rowCount},ensureCapacity:xt,hasDynamicDims:Bt,setDims:Nt,cells:h,styles:S,borders:d,merges:Te,formulaDeps:et,selection:Ve,activeCell:Be,editingCell:Xe,editValue:Ge,colWidths:oe,rowHeights:ge,scrollX:u,scrollY:D,freeze:I,setFreeze:z,clearFreeze:_,getFreeze:se,getFrozenMetrics:de,getViewportRegions:re,cellToScreenRect:be,screenToCell:Le,isCellFrozen:it,scrollCellIntoView:ht,BASE_CELL_VPAD:y,fontMetricsCache:G,fontMetricsCanvas:$,measureFontMetrics:ne,_getFontMetricsForCell:ce,getWrappedLines:We,cellFontSize:Je,colPositions:gt,getRowHeight:Kt,_isAutoRow:lo,rowPositions:Wt,totalWidth:yo,totalHeight:ro,selectCell:xo,selectRange:qt,selectAll:ao,isSelected:uo,isCellSelected:fo,selectionMode:ke,cellKey:Yt,delCell:Mo,findMerge:io,_isMergeAnchor:x,_mergedSpan:M,expandSelectionForMerges:N,getCellRaw:te,getCellValue:me,setCellValue:Ce,clearCellsInRange:ye,startEdit:W,commitEdit:Oe,cancelEdit:He,moveActive:P,ensureVisible:Ne,hitCol:ot,hitRow:b,registerStyle:j,resolveStyle:le,rebuildStyleIndex:L,syncStyles:g,registerBorder:he,resolveBorder:Z,rebuildBorderIndex:ie,syncBorders:De,getCellBorderSide:_e,getMergeOwner:xe,isSameMergeInternal:we,viewSize:kt,findHighlight:(w,B)=>null};return ae=()=>{var w;return(w=Qe.saveUndo)==null?void 0:w.call(Qe)},Vt=(w,B)=>{var O;return(O=Qe.clampScroll)==null?void 0:O.call(Qe,w,B)},Qe}function Bc(e,l){const n=t.ref([]),o=t.ref([]);function a(b){return Ec(b)}function i(){return l.saveSheet(),{sheets:l.sheets.value.map(b=>({id:b.id,name:b.name,cells:a(b.cells),styles:[...b.styles],borders:b.borders?[...b.borders]:[{}],merges:b.merges?{...b.merges}:{},selection:b.selection?{...b.selection}:null,activeCell:b.activeCell?{...b.activeCell}:{col:0,row:0},scrollX:b.scrollX,scrollY:b.scrollY,colWidths:[...b.colWidths],rowHeights:[...b.rowHeights],colCount:b.colCount,rowCount:b.rowCount,freeze:{...b.freeze}})),styles:[...e.styles],activeSheetIndex:l.activeSheetIndex.value}}function r(b){const z=l.sheets.value;l.sheets.value=b.sheets.map((_,se)=>{var re;const de=((re=z[se])==null?void 0:re.freeze)??{rows:0,cols:0};return{..._,cells:a(_.cells),styles:[..._.styles],borders:_.borders?[..._.borders]:[{}],freeze:{rows:de.rows,cols:de.cols}}}),l.loadSheet(Math.max(0,Math.min(b.activeSheetIndex,l.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function f(){const b=i(),z=n.value[n.value.length-1];z&&JSON.stringify(z)===JSON.stringify(b)||(n.value.push(b),o.value=[],n.value.length>50&&n.value.shift())}e.saveUndo=f;function m(){var b;n.value.length&&(o.value.push(i()),r(n.value.pop()),(b=e.scheduleRender)==null||b.call(e),t.nextTick(()=>{var z;return(z=e.emitModelData)==null?void 0:z.call(e)}))}function h(){var b;o.value.length&&(n.value.push(i()),r(o.value.pop()),(b=e.scheduleRender)==null||b.call(e),t.nextTick(()=>{var z;return(z=e.emitModelData)==null?void 0:z.call(e)}))}const S=t.computed(()=>n.value.length>0),d=t.computed(()=>o.value.length>0),k=t.computed(()=>!!e.selection.value),v=t.ref(null);function E(){var _;const b=e.selection.value;if(!b)return;const z={};for(let se=b.startCol;se<=b.endCol;se++)for(let de=b.startRow;de<=b.endRow;de++)z[`${se-b.startCol},${de-b.startRow}`]=((_=e.cells[e.cellKey(se,de)])==null?void 0:_.styleId)??0;v.value={styles:z}}function J(){var _,se,de;const b=v.value,z=e.selection.value;if(!(!b||!z)){f();for(let re=z.startCol;re<=z.endCol;re++)for(let be=z.startRow;be<=z.endRow;be++){const Le=e.findMerge(re,be);if(Le&&(re!==Le.range.startCol||be!==Le.range.startRow))continue;const it=b.styles[`${re-z.startCol},${be-z.startRow}`]??0,ht=e.cellKey(re,be),xt=((_=e.cells[ht])==null?void 0:_.value)??"";if(xt===""&&it===0)e.delCell(ht);else{const Bt={value:xt};it>0&&(Bt.styleId=it),e.cells[ht]=Bt}}v.value=null,(se=e.scheduleRender)==null||se.call(e),(de=e.emitModelData)==null||de.call(e)}}function j(){var z,_,se;const b=e.selection.value;if(b){f();for(let de=b.startCol;de<=b.endCol;de++)for(let re=b.startRow;re<=b.endRow;re++){const be=e.findMerge(de,re);if(be&&(de!==be.range.startCol||re!==be.range.startRow))continue;const Le=e.cellKey(de,re),it=((z=e.cells[Le])==null?void 0:z.value)??"";it===""?e.delCell(Le):e.cells[Le]={value:it}}(_=e.scheduleRender)==null||_.call(e),(se=e.emitModelData)==null||se.call(e)}}const le=t.computed(()=>yl.map(b=>({...b,label:b.value===""?T(e.locale.value,"fontDefault"):b.label}))),L=t.computed(()=>bl.map(b=>({...b,label:String(b.value)}))),g="\0",he=t.computed(()=>{const b=e.selection.value;if(!b)return"";let z,_=!1;for(let se=b.startCol;se<=b.endCol&&!_;se++)for(let de=b.startRow;de<=b.endRow&&!_;de++){const re=e.findMerge(se,de);if(re&&(se!==re.range.startCol||de!==re.range.startRow))continue;const be=e.resolveStyle(e.cells[e.cellKey(se,de)]),Le=typeof(be==null?void 0:be.fontFamily)=="string"?be.fontFamily:"";z===void 0?z=Le:Le!==z&&(_=!0)}return _?g:z??""}),Z=t.computed(()=>{const b=e.selection.value;if(!b)return ko;let z,_=!1;for(let se=b.startCol;se<=b.endCol&&!_;se++)for(let de=b.startRow;de<=b.endRow&&!_;de++){const re=e.findMerge(se,de);if(re&&(se!==re.range.startCol||de!==re.range.startRow))continue;const be=e.cellFontSize(se,de);z===void 0?z=be:be!==z&&(_=!0)}return _?0:z??ko});function ie(b,z){var se,de,re;const _=e.selection.value;if(_){f();for(let be=_.startCol;be<=_.endCol;be++)for(let Le=_.startRow;Le<=_.endRow;Le++){const it=e.findMerge(be,Le);if(it&&(be!==it.range.startCol||Le!==it.range.startRow))continue;const ht=e.cellKey(be,Le),xt=((se=e.cells[ht])==null?void 0:se.value)??"";let Nt={...e.resolveStyle(e.cells[ht])??{}};if(z===""||z===null||z===void 0||z===0){const{[b]:w,...B}=Nt;Nt=B}else Nt[b]=z;const Qe=Object.keys(Nt).length?e.registerStyle(Nt):0;if(xt===""&&Qe===0)e.delCell(ht);else{const w={value:xt};Qe>0&&(w.styleId=Qe),e.cells[ht]=w}}(de=e.scheduleRender)==null||de.call(e),(re=e.emitModelData)==null||re.call(e)}}function De(b){ie("fontFamily",b===""?"":b)}const _e=t.ref(!1),xe=t.ref(!1),we=t.ref(!1),Te=t.ref(!1),et=t.ref(!1);function Ve(b){ie("fontSize",b),_e.value=!1}const ke=t.computed(()=>Rl.map(b=>({label:T(e.locale.value,b.labelKey),value:b.value,icon:b.icon}))),Be=t.computed(()=>Ml.map(b=>({label:T(e.locale.value,b.labelKey),value:b.value,icon:b.icon}))),Xe=t.computed(()=>{const b=e.selection.value;if(!b)return"left";const z=e.resolveStyle(e.cells[e.cellKey(b.startCol,b.startRow)]),_=typeof(z==null?void 0:z.textAlign)=="string"?z.textAlign:"";return _==="center"||_==="right"?_:"left"}),Ge=t.computed(()=>{const b=e.selection.value;if(!b)return"top";const z=e.resolveStyle(e.cells[e.cellKey(b.startCol,b.startRow)]),_=typeof(z==null?void 0:z.verticalAlign)=="string"?z.verticalAlign:"";return _==="middle"||_==="bottom"?_:"top"}),oe=t.computed(()=>{const b=e.selection.value;if(!b)return!1;const z=e.resolveStyle(e.cells[e.cellKey(b.startCol,b.startRow)]);return(z==null?void 0:z.wrap)==="wrap"});function ge(b){ie("textAlign",b)}function u(b){ie("verticalAlign",b)}function D(){if(!e.selection.value)return;const z=oe.value;ie("wrap",z?void 0:"wrap")}const I=t.ref(""),G=_e;t.watch(Z,b=>{I.value=b===0?"":String(b)},{immediate:!0});function $(b){const z=b.replace(/[^\d]/g,"");I.value=z;const _=parseInt(z,10);!isNaN(_)&&_>=5&&_<=72&&_!==Z.value&&ie("fontSize",_)}function ne(){const b=I.value.trim();if(!b){I.value=Z.value===0?"":String(Z.value);return}let z=parseInt(b,10);isNaN(z)?z=Z.value===0?ko:Z.value:z=Math.max(5,Math.min(72,z)),I.value=String(z),z!==Z.value&&ie("fontSize",z)}function H(b){b.key==="Enter"&&b.target.blur()}function c(b){b&&b.preventDefault(),G.value=!G.value,G.value&&(we&&(we.value=!1),xe&&(xe.value=!1),Te.value=!1,et.value=!1)}function y(){const b=Z.value===0?ko:Z.value,z=Math.min(72,b+1);ie("fontSize",z),I.value=String(z),G.value=!1}function at(){const b=Z.value===0?ko:Z.value,z=Math.max(5,b-1);ie("fontSize",z),I.value=String(z),G.value=!1}function ee(b){const z=e.selection.value;if(!z)return!1;let _,se=!1;for(let de=z.startCol;de<=z.endCol&&!se;de++)for(let re=z.startRow;re<=z.endRow&&!se;re++){const be=e.findMerge(de,re);if(be&&(de!==be.range.startCol||re!==be.range.startRow))continue;const Le=e.resolveStyle(e.cells[e.cellKey(de,re)]),it=!!(Le!=null&&Le[b]);_===void 0?_=it:it!==_&&(se=!0)}return!se&&_===!0}const p=t.computed(()=>ee("fontWeight")),F=t.computed(()=>ee("fontStyle")),Ue=t.computed(()=>ee("underline")),vt=t.computed(()=>ee("strikethrough"));function ce(){ie("fontWeight",p.value?"":"bold")}function We(){ie("fontStyle",F.value?"":"italic")}function Je(){ie("underline",Ue.value?"":"underline")}function gt(){ie("strikethrough",vt.value?"":"line-through")}const kt=t.ref(""),Vt=t.ref(""),Ht=Te,Kt=et;function lo(){Ht.value=!Ht.value,Kt.value=!1,xe&&(xe.value=!1),we&&(we.value=!1)}function Wt(){Kt.value=!Kt.value,Ht.value=!1,xe&&(xe.value=!1),we&&(we.value=!1)}function yo(b){xe&&(xe.value=b),b&&(Ht.value=!1,Kt.value=!1,we&&(we.value=!1))}function ro(b){kt.value=b,ie("color",b===""?"":b)}function Yt(b){Vt.value=b,ie("backgroundColor",b===""?"":b)}function Mo(){ie("color",kt.value===""?"":kt.value)}function xo(){ie("backgroundColor",Vt.value===""?"":Vt.value)}const qt=t.computed(()=>{const b=e.selection.value;if(!b)return"";let z,_=!1;for(let se=b.startCol;se<=b.endCol&&!_;se++)for(let de=b.startRow;de<=b.endRow&&!_;de++){const re=e.findMerge(se,de);if(re&&(se!==re.range.startCol||de!==re.range.startRow))continue;const be=e.resolveStyle(e.cells[e.cellKey(se,de)]),Le=typeof(be==null?void 0:be.color)=="string"?be.color:"";z===void 0?z=Le:Le!==z&&(_=!0)}return _?"":z??""}),ao=t.computed(()=>{const b=e.selection.value;if(!b)return"";let z,_=!1;for(let se=b.startCol;se<=b.endCol&&!_;se++)for(let de=b.startRow;de<=b.endRow&&!_;de++){const re=e.findMerge(se,de);if(re&&(se!==re.range.startCol||de!==re.range.startRow))continue;const be=e.resolveStyle(e.cells[e.cellKey(se,de)]),Le=typeof(be==null?void 0:be.backgroundColor)=="string"?be.backgroundColor:"";z===void 0?z=Le:Le!==z&&(_=!0)}return _?"":z??""}),uo=t.computed(()=>Zn(e.locale.value)),fo=t.ref(!1),io=t.computed(()=>{const b=e.selection.value;if(!b)return So;let z,_=!1;for(let se=b.startCol;se<=b.endCol&&!_;se++)for(let de=b.startRow;de<=b.endRow&&!_;de++){const re=e.findMerge(se,de);if(re&&(se!==re.range.startCol||de!==re.range.startRow))continue;const be=e.resolveStyle(e.cells[e.cellKey(se,de)]),Le=(be==null?void 0:be.numberFormatCategory)==="custom"?Eo:typeof(be==null?void 0:be.numberFormat)=="string"?be.numberFormat:"";z===void 0?z=Le:Le!==z&&(_=!0)}return _?ho:z??So});function x(b){if((b==null?void 0:b.numberFormatCategory)==="custom")return Eo;const z=typeof(b==null?void 0:b.numberFormat)=="string"?b.numberFormat:"";return jn(z,e.locale.value)}const M=t.computed(()=>{const b=io.value;if(b!==ho)return b===Eo?Eo:jn(b,e.locale.value);const z=e.selection.value;if(!z)return So;let _,se=!1;for(let de=z.startCol;de<=z.endCol&&!se;de++)for(let re=z.startRow;re<=z.endRow&&!se;re++){const be=e.findMerge(de,re);if(be&&(de!==be.range.startCol||re!==be.range.startRow))continue;const Le=x(e.resolveStyle(e.cells[e.cellKey(de,re)]));_===void 0?_=Le:Le!==_&&(se=!0)}return se?ho:_??So});function N(b){ie("numberFormat",b),te()}function te(){const b=e.selection.value;if(b)for(let z=b.startCol;z<=b.endCol;z++)for(let _=b.startRow;_<=b.endRow;_++){const se=e.findMerge(z,_);if(se&&(z!==se.range.startCol||_!==se.range.startRow))continue;const de=e.cellKey(z,_),re=e.cells[de],be=e.resolveStyle(re);if((be==null?void 0:be.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:Le,...it}=be,ht=Object.keys(it).length?e.registerStyle(it):0,xt=(re==null?void 0:re.value)??"";if(xt===""&&ht===0)e.delCell(de);else{const Bt={value:xt};ht>0&&(Bt.styleId=ht),e.cells[de]=Bt}}}function me(b){if(b===Eo){fo.value=!0;return}N(b)}function Ce(){fo.value=!0}function ye(){const b=e.selection.value;if(!b)return[];const z=[];for(let _=b.startCol;_<=b.endCol;_++)for(let se=b.startRow;se<=b.endRow;se++){const de=e.findMerge(_,se);if(de&&(_!==de.range.startCol||se!==de.range.startRow))continue;const re=e.cellKey(_,se),be=e.cells[re],Le=e.resolveStyle(be),it=typeof(Le==null?void 0:Le.numberFormat)=="string"?Le.numberFormat:So,ht=(be==null?void 0:be.value)??"",xt=ht.startsWith("=")?il(_,se,e.cells,e.colCount,e.rowCount):ht;Xn(it,xt)&&z.push({key:re,nf:it,decimals:Ul(it,xt)})}return z}const ae=t.computed(()=>ye().some(b=>b.decimals<Mn)),W=t.computed(()=>ye().some(b=>b.decimals>xn));function Oe(b,z,_){var Le;const se=((Le=e.cells[b])==null?void 0:Le.value)??"",re={...e.resolveStyle(e.cells[b])??{}};z===""?(delete re.numberFormat,delete re.numberFormatCategory):(re.numberFormat=z,_==="custom"&&(re.numberFormatCategory="custom"));const be=Object.keys(re).length?e.registerStyle(re):0;if(se===""&&be===0)e.delCell(b);else{const it={value:se};be>0&&(it.styleId=be),e.cells[b]=it}}function He(b){var se,de;const z=ye(),_=[];for(const re of z){const be=re.decimals+b;if(be<xn||be>Mn)continue;const Le=Yl(re.nf,be);Le==null||Le===re.nf||_.push({key:re.key,code:Le,category:no(re.nf)?"custom":void 0})}if(_.length){f();for(const re of _)Oe(re.key,re.code,re.category);(se=e.scheduleRender)==null||se.call(e),(de=e.emitModelData)==null||de.call(e)}}function P(){He(1)}function Ne(){He(-1)}return{undoStack:n,redoStack:o,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:f,undo:m,redo:h,canUndo:S,canRedo:d,hasSelection:k,paintFmt:v,onPaintFormat:E,applyPaintFormat:J,clearFormat:j,fontFamilyOptions:le,fontSizeOptions:L,FONT_FAMILY_MIXED:g,selFontFamily:he,selFontSize:Z,applyStyleToSelection:ie,onFontFamilyChange:De,onFontSizeChange:Ve,hAlignOptions:ke,vAlignOptions:Be,selHAlign:Xe,selVAlign:Ge,selWrap:oe,onHAlignChange:ge,onVAlignChange:u,onWrapToggle:D,fontSizeInput:I,fontSizeMenuOpen:G,onFontSizeInput:$,onFontSizeBlur:ne,onFontSizeKeydown:H,toggleFontSizeMenu:c,onFontSizeStepUp:y,onFontSizeStepDown:at,selFontWeight:p,selFontStyle:F,selUnderline:Ue,selStrikethrough:vt,toggleFontWeight:ce,toggleFontStyle:We,toggleUnderline:Je,toggleStrikethrough:gt,cachedTextColor:kt,cachedFillColor:Vt,textColorMenuOpen:Ht,fillColorMenuOpen:Kt,_toggleTextColorMenu:lo,_toggleFillColorMenu:Wt,onBorderMenuToggle:yo,onTextColorChange:ro,onFillColorChange:Yt,applyCachedTextColor:Mo,applyCachedFillColor:xo,selTextColor:qt,selFillColor:ao,nfOptions:uo,selNumberFormat:io,selNumberFormatDisplay:M,NF_NUMBER_FORMAT_MIXED:ho,nfDialogOpen:fo,onNumberFormatChange:me,openNumberFormatDialog:Ce,applyNumberFormatCode:N,canIncreaseDecimals:ae,canDecreaseDecimals:W,onIncreaseDecimals:P,onDecreaseDecimals:Ne}}function Dc(e,l){l.borderMenuOpen&&(e.borderMenuOpen=l.borderMenuOpen),l.mergeMenuOpen&&(e.mergeMenuOpen=l.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 Tc(e,l){const n=t.ref("none"),o=t.ref(!1),a="#444";function i(u,D,I,G){if(u<0||D<0||u>=e.colCount||D>=e.rowCount)return;const $=e.findMerge(u,D),ne=$?$.anchor:e.cellKey(u,D);if(!e.cells[ne]){if(!G)return;e.cells[ne]={value:""}}Mc(e.cells[ne],I,G,e.styles,{get:c=>e.resolveBorder(c),getId:c=>e.registerBorder(c)},e.registerStyle)}function r(u,D,I){var y;const G=e.findMerge(u,D),$=G?G.anchor:e.cellKey(u,D),ne=((y=e.cells[$])==null?void 0:y.value)??"",H=e.resolveStyle(e.cells[$])?{...e.resolveStyle(e.cells[$])}:{},c=e.registerBorder(I);if(c>0?H.borderId=c:delete H.borderId,delete H.borderTopWidth,delete H.borderBottomWidth,delete H.borderLeftWidth,delete H.borderRightWidth,delete H.borderColor,ne===""&&!Object.keys(H).length)e.delCell($);else{const at=e.registerStyle(H);e.cells[$]={value:ne,styleId:at||void 0}}}function f(u){var y,at;n.value=u;const D=e.selection.value;if(!D)return;l.saveUndo();const{startCol:I,startRow:G,endCol:$,endRow:ne}=D,H={width:1,color:a},c={width:2,color:a};if(u==="none")for(let ee=I;ee<=$;ee++)for(let p=G;p<=ne;p++){const F=e.findMerge(ee,p);F&&(ee!==F.range.startCol||p!==F.range.startRow)||r(ee,p,{})}else if(u==="all")for(let ee=I;ee<=$;ee++)for(let p=G;p<=ne;p++){const F=e.findMerge(ee,p);F&&(ee!==F.range.startCol||p!==F.range.startRow)||r(ee,p,{top:H,right:H,bottom:H,left:H})}else if(u==="outer"||u==="thickOuter"){const ee=u==="thickOuter"?c:H;for(let p=I;p<=$;p++)i(p,G,"top",ee);for(let p=I;p<=$;p++)i(p,ne,"bottom",ee);for(let p=G;p<=ne;p++)i(I,p,"left",ee);for(let p=G;p<=ne;p++)i($,p,"right",ee)}else{const p={top:{side:"top",edgeCheck:(F,Ue)=>Ue===G},bottom:{side:"bottom",edgeCheck:(F,Ue)=>Ue===ne},left:{side:"left",edgeCheck:(F,Ue)=>F===I},right:{side:"right",edgeCheck:(F,Ue)=>F===$}}[u];if(p)for(let F=I;F<=$;F++)for(let Ue=G;Ue<=ne;Ue++)p.edgeCheck(F,Ue)&&i(F,Ue,p.side,H)}(y=e.scheduleRender)==null||y.call(e),(at=e.emitModelData)==null||at.call(e)}function m(){f(n.value)}function h(u,D,I){const G=I.toLowerCase(),$=e.findMerge(u,D);if($){if(G==="top"&&D!==$.range.startRow||G==="bottom"&&D!==$.range.endRow||G==="left"&&u!==$.range.startCol||G==="right"&&u!==$.range.endCol)return 0;const H=e.getCellBorderSide(e.cells[$.anchor],G);return(H==null?void 0:H.width)??0}const ne=e.getCellBorderSide(e.cells[e.cellKey(u,D)],G);return(ne==null?void 0:ne.width)??0}const S=t.ref(!1);function d(u){S.value=u,u&&(l.textColorMenuOpen.value=!1,l.fillColorMenuOpen.value=!1,o.value=!1,l.fontSizeMenuOpen.value=!1)}function k(u,D,I,G){const $=[];for(const ne in e.merges){const H=e.merges[ne];H&&H.startCol<=I&&H.endCol>=u&&H.startRow<=G&&H.endRow>=D&&$.push(ne)}for(const ne of $)Reflect.deleteProperty(e.merges,ne)}function v(){var ne,H,c;const u=e.selection.value;if(!u||u.startCol===u.endCol&&u.startRow===u.endRow)return;l.saveUndo(),k(u.startCol,u.startRow,u.endCol,u.endRow);const D=e.cellKey(u.startCol,u.startRow),I=((ne=e.cells[D])==null?void 0:ne.value)??"";for(let y=u.startCol;y<=u.endCol;y++)for(let at=u.startRow;at<=u.endRow;at++)y===u.startCol&&at===u.startRow||e.clearCellsInRange(y,y,at,at);const G=e.resolveStyle(e.cells[D])?{...e.resolveStyle(e.cells[D])}:{};G.textAlign="center";const $=e.registerStyle(G);e.cells[D]={value:I,styleId:$||void 0},e.merges[D]={startCol:u.startCol,startRow:u.startRow,endCol:u.endCol,endRow:u.endRow},e.selectCell(u.startCol,u.startRow),(H=e.scheduleRender)==null||H.call(e),(c=e.emitModelData)==null||c.call(e)}function E(){var D,I,G;const u=e.selection.value;if(!(!u||u.startCol===u.endCol)){l.saveUndo();for(let $=u.startRow;$<=u.endRow;$++){k(u.startCol,$,u.endCol,$);const ne=e.cellKey(u.startCol,$);(D=e.cells[ne])==null||D.value;for(let H=u.startCol+1;H<=u.endCol;H++)e.clearCellsInRange(H,H,$,$);e.merges[ne]={startCol:u.startCol,startRow:$,endCol:u.endCol,endRow:$}}e.selectRange(u.startCol,u.startRow,u.endCol,u.endRow),(I=e.scheduleRender)==null||I.call(e),(G=e.emitModelData)==null||G.call(e)}}function J(){var I,G,$;const u=e.selection.value;if(!u||u.startCol===u.endCol&&u.startRow===u.endRow)return;l.saveUndo(),k(u.startCol,u.startRow,u.endCol,u.endRow);const D=e.cellKey(u.startCol,u.startRow);(I=e.cells[D])==null||I.value;for(let ne=u.startCol;ne<=u.endCol;ne++)for(let H=u.startRow;H<=u.endRow;H++)ne===u.startCol&&H===u.startRow||e.clearCellsInRange(ne,ne,H,H);e.merges[D]={startCol:u.startCol,startRow:u.startRow,endCol:u.endCol,endRow:u.endRow},e.selectCell(u.startCol,u.startRow),(G=e.scheduleRender)==null||G.call(e),($=e.emitModelData)==null||$.call(e)}function j(){var D,I;const u=e.selection.value;u&&(l.saveUndo(),k(u.startCol,u.startRow,u.endCol,u.endRow),(D=e.scheduleRender)==null||D.call(e),(I=e.emitModelData)==null||I.call(e))}function le(){const u=e.selection.value;if(!u)return;const D=e.findMerge(u.startCol,u.startRow);D&&u.startCol===D.range.startCol&&u.startRow===D.range.startRow&&u.endCol===D.range.endCol&&u.endRow===D.range.endRow?j():v()}function L(u){switch(u){case"mergeCenter":v();break;case"mergeAcross":E();break;case"mergeCells":J();break;case"unmergeCells":j();break}}let g=null,he=[];function Z(u,D,I,G){he=[];for(let $=I;$<=G;$++){const ne=[];for(let H=u;H<=D;H++){const c=e.cells[e.cellKey(H,$)];ne.push((c==null?void 0:c.styleId)??0)}he.push(ne)}}function ie(u,D,I,G){const $=e.cellKey(u,D);if(bn(),I===""||I==null){e.formulaDeps.clear($),G&&G>0?e.cells[$]={value:"",styleId:G}:e.delCell($),e.formulaDeps.markDirty($);return}e.cells[$]={value:I,styleId:G&&G>0?G:void 0},I.startsWith("=")?e.formulaDeps.set($,Vn(I.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear($),e.formulaDeps.markDirty($)}function De(){const u=e.selection.value;if(!u)return;g={...u},Z(u.startCol,u.endCol,u.startRow,u.endRow);const D=[];for(let I=u.startRow;I<=u.endRow;I++){const G=[];for(let $=u.startCol;$<=u.endCol;$++)G.push(e.getCellRaw($,I));D.push(G.join(" "))}In(D.join(`
4
- `))}function _e(){const u=e.selection.value;if(u){if(u.startCol===0&&u.endCol===e.colCount-1){g={...u},Z(0,e.colCount-1,u.startRow,u.endRow);const D=[];for(let I=u.startRow;I<=u.endRow;I++){const G=[];for(let $=0;$<e.colCount;$++)G.push(e.getCellRaw($,I));D.push(G.join(" "))}In(D.join(`
5
- `))}else if(u.startRow===0&&u.endRow===e.rowCount-1){g={...u},Z(u.startCol,u.endCol,0,e.rowCount-1);const D=[];for(let I=0;I<e.rowCount;I++){const G=[];for(let $=u.startCol;$<=u.endCol;$++)G.push(e.getCellRaw($,I));D.push(G.join(" "))}In(D.join(`
6
- `))}}}async function xe(){var at;let u;try{u=await navigator.clipboard.readText()}catch{return}if(!u&&u!=="")return;const D=u.split(/\r?\n/),I=e.activeCell.value,G=g,$=G&&he.length>0,ne=D.map(ee=>ee.split(" ").length),H=ne.length?Math.max(...ne):0,c=I.col+H-1,y=I.row+D.length-1;c>=0&&y>=0&&e.ensureCapacity(c,y);for(let ee=0;ee<D.length;ee++){const p=D[ee].split(" ");for(let F=0;F<p.length;F++){const Ue=I.col+F,vt=I.row+ee;let ce=p[F];if(ce.startsWith("=")&&G&&(ce=cc(ce,Ue-(G.startCol+F),vt-(G.startRow+ee),e.colCount,e.rowCount,pt)),$&&ee<he.length&&F<(((at=he[ee])==null?void 0:at.length)??0)){const We=he[ee][F]??null;ie(Ue,vt,ce,We)}else e.setCellValue(Ue,vt,ce)}}}function we(){var u;if(l.saveUndo(),De(),e.selection.value){const D=e.selection.value;e.clearCellsInRange(D.startCol,D.endCol,D.startRow,D.endRow),(u=e.scheduleRender)==null||u.call(e)}}function Te(){var u;if(e.selection.value){const D=e.selection.value;e.clearCellsInRange(D.startCol,D.endCol,D.startRow,D.endRow),(u=e.scheduleRender)==null||u.call(e)}}function et(){var ne,H;const u=e.selection.value;if(!u)return;l.saveUndo();const D=u.startCol,I=u.startRow,G=u.endCol,$=u.endRow;if(I===$)if(G+1<e.colCount){const c=`${pt(D)}${I+1}:${pt(G)}${I+1}`;e.setCellValue(G+1,I,`=SUM(${c})`)}else{const c=`${pt(D)}${I+1}:${pt(G-1)}${I+1}`;e.setCellValue(G,I,`=SUM(${c})`)}else for(let c=D;c<=G;c++)if($+1<e.rowCount){const y=`${pt(c)}${I+1}:${pt(c)}${$+1}`;e.setCellValue(c,$+1,`=SUM(${y})`)}else{const y=`${pt(c)}${I+1}:${pt(c)}${$}`;e.setCellValue(c,$,`=SUM(${y})`)}(ne=e.scheduleRender)==null||ne.call(e),(H=e.emitModelData)==null||H.call(e)}function Ve(){var ne,H;const u=e.selection.value;if(!u)return;l.saveUndo();const D=u.startCol,I=u.startRow,G=u.endCol,$=u.endRow;if(I===$)if(G+1<e.colCount){const c=`${pt(D)}${I+1}:${pt(G)}${I+1}`;e.setCellValue(G+1,I,`=AVERAGE(${c})`)}else{const c=`${pt(D)}${I+1}:${pt(G-1)}${I+1}`;e.setCellValue(G,I,`=AVERAGE(${c})`)}else for(let c=D;c<=G;c++)if($+1<e.rowCount){const y=`${pt(c)}${I+1}:${pt(c)}${$+1}`;e.setCellValue(c,$+1,`=AVERAGE(${y})`)}else{const y=`${pt(c)}${I+1}:${pt(c)}${$}`;e.setCellValue(c,$,`=AVERAGE(${y})`)}(ne=e.scheduleRender)==null||ne.call(e),(H=e.emitModelData)==null||H.call(e)}function ke(){var ne,H;const u=e.selection.value;if(!u)return;l.saveUndo();const D=u.startCol,I=u.startRow,G=u.endCol,$=u.endRow;if(I===$)if(G+1<e.colCount){const c=`${pt(D)}${I+1}:${pt(G)}${I+1}`;e.setCellValue(G+1,I,`=COUNT(${c})`)}else{const c=`${pt(D)}${I+1}:${pt(G-1)}${I+1}`;e.setCellValue(G,I,`=COUNT(${c})`)}else for(let c=D;c<=G;c++)if($+1<e.rowCount){const y=`${pt(c)}${I+1}:${pt(c)}${$+1}`;e.setCellValue(c,$+1,`=COUNT(${y})`)}else{const y=`${pt(c)}${I+1}:${pt(c)}${$}`;e.setCellValue(c,$,`=COUNT(${y})`)}(ne=e.scheduleRender)==null||ne.call(e),(H=e.emitModelData)==null||H.call(e)}const Be=t.ref(!1);function Xe(u){Be.value=u,u&&(l.textColorMenuOpen.value=!1,l.fillColorMenuOpen.value=!1,o.value=!1,l.fontSizeMenuOpen.value=!1,S.value=!1)}function Ge(){et(),Be.value=!1}function oe(){Ve(),Be.value=!1}function ge(){ke(),Be.value=!1}return{cachedBorder:n,borderMenuOpen:o,BORDER_COLOR:a,onBorderChange:f,setCellBorderSide:i,applyBorderToCell:r,applyCachedBorder:m,cellBorderWidth:h,mergeMenuOpen:S,onMergeMenuToggle:d,removeOverlappingMerges:k,mergeAndCenter:v,mergeAcross:E,mergeCells:J,unmergeCells:j,onApplyMerge:le,onMergeChange:L,copySourceRange:null,copySourceStyles:[],captureStyles:Z,setCellWithStyle:ie,copyToClipboard:De,copyRowCol:_e,pasteFromClipboard:xe,cutSelected:we,clearSelected:Te,sumSelected:et,avgSelected:Ve,countSelected:ke,calcMenuOpen:Be,onCalcMenuToggle:Xe,onCalcSum:Ge,onCalcAvg:oe,onCalcCount:ge}}function Nc(e,l,n,o){const a={},i=o(l),r=o(n);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 dl(e){return e==="number"?0:1}function ul(e,l,n){var i;if(e==null||e.trim()==="")return{kind:"blank"};const o=l??"";if(o===oo||o==="@")return{kind:"text",text:e};if(no(o)){if(sn(e))return{kind:"number",num:Number(e)};const r=Dn(e,n);return r?{kind:"number",num:r.serial}:{kind:"text",text:Ho(e,o,n)}}const a=Ro(o);if(a.kind==="date"||a.kind==="duration"){const r=Number(e);return Number.isFinite(r)?{kind:"number",num:r}:{kind:"text",text:Ho(e,o,n)}}if(a.kind==="number"){const r=Number(e);if(Number.isFinite(r)){const f=((i=a.sections.find(m=>m.hasDigits))==null?void 0:i.scale)??1;return{kind:"number",num:r*f}}return{kind:"text",text:Ho(e,o,n)}}return{kind:"text",text:Ho(e,o,n)}}function Ic(e,l,n,o){if(e.kind==="blank"||l.kind==="blank")return e.kind==="blank"&&l.kind==="blank"?0:e.kind==="blank"?1:-1;const a=dl(e.kind),i=dl(l.kind);if(a!==i)return n==="asc"?a-i:i-a;let r;return e.kind==="number"?r=(e.num??0)-(l.num??0):r=(e.text??"").localeCompare(l.text??"",o,{numeric:!0}),n==="asc"?r:-r}function Fc(e,l,n){const o=e.map((a,i)=>i);return o.sort((a,i)=>{const r=Ic(e[a],e[i],l,n);return r!==0?r:a-i}),o}function Ac(e){if(e.length<2||e[0].kind!=="text")return!1;for(let l=1;l<e.length;l++)if(e[l].kind==="number")return!0;return!1}function Vc(e,l,n,o,a){function i(x,M){const N=M-x+1,te=et(x,M),me=[],Ce=[];for(const W in e.cells){const Oe=W.indexOf(",");if(Oe<0)continue;const He=parseInt(W.substring(0,Oe),10),P=parseInt(W.substring(Oe+1),10);P>=x&&P<=M?Ce.push(W):P>M&&me.push({oldKey:W,newKey:e.cellKey(He,P-N),cell:e.cells[W]})}for(const W of Ce)Reflect.deleteProperty(e.cells,W);for(const W of me)Reflect.deleteProperty(e.cells,W.oldKey),e.cells[W.newKey]=W.cell;const ye=e.rowHeights.value,ae=new Array(ye.length);for(let W=0;W<x;W++)ae[W]=ye[W];for(let W=x;W<ye.length-N;W++)ae[W]=ye[W+N];for(let W=ye.length-N;W<ye.length;W++)ae[W]=void 0;e.rowHeights.value=ae,Te(te),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))}function r(x,M){const N=M-x+1,te=e.rowCount,me=e.colCount,{lastRow:Ce}=h();Ce>=x&&Ce+N>=te&&e.ensureCapacity(me-1,te-1+N);const ye=e.rowCount,ae=ke(x,M),W=[];for(const P in e.cells){const Ne=P.indexOf(",");if(Ne<0)continue;const ot=parseInt(P.substring(0,Ne),10),b=parseInt(P.substring(Ne+1),10);b>=x&&W.push({oldKey:P,newKey:e.cellKey(ot,b+N),cell:e.cells[P],oldRow:b})}W.sort((P,Ne)=>Ne.oldRow-P.oldRow);for(const P of W)Reflect.deleteProperty(e.cells,P.oldKey),e.cells[P.newKey]=P.cell;for(const P in e.cells){const Ne=P.indexOf(",");if(Ne<0)continue;const ot=parseInt(P.substring(Ne+1),10);ot>=x&&ot<=M&&Reflect.deleteProperty(e.cells,P)}const Oe=e.rowHeights.value,He=new Array(ye);for(let P=0;P<x;P++)He[P]=Oe[P];for(let P=x;P<=M;P++)He[P]=void 0;for(let P=x;P<ye;P++)He[P+N]=Oe[P];e.rowHeights.value=He,Te(ae),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))}function f(x,M){const N=M-x+1,te=e.colCount,me=e.rowCount,{lastCol:Ce}=h();Ce>=x&&Ce+N>=te&&e.ensureCapacity(te-1+N,me-1);const ye=e.colCount,ae=Be(x,M),W=[];for(const P in e.cells){const Ne=P.indexOf(",");if(Ne<0)continue;const ot=parseInt(P.substring(0,Ne),10),b=parseInt(P.substring(Ne+1),10);ot>=x&&W.push({oldKey:P,newKey:e.cellKey(ot+N,b),cell:e.cells[P],oldCol:ot})}W.sort((P,Ne)=>Ne.oldCol-P.oldCol);for(const P of W)Reflect.deleteProperty(e.cells,P.oldKey),e.cells[P.newKey]=P.cell;for(const P in e.cells){const Ne=P.indexOf(",");if(Ne<0)continue;const ot=parseInt(P.substring(0,Ne),10);ot>=x&&ot<=M&&Reflect.deleteProperty(e.cells,P)}const Oe=e.colWidths.value,He=new Array(ye);for(let P=0;P<x;P++)He[P]=Oe[P];for(let P=x;P<=M;P++)He[P]=100;for(let P=x;P<ye;P++)He[P+N]=Oe[P];e.colWidths.value=He,Te(ae),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))}function m(x,M){const N=M-x+1,te=Ve(x,M),me=[],Ce=[];for(const W in e.cells){const Oe=W.indexOf(",");if(Oe<0)continue;const He=parseInt(W.substring(0,Oe),10),P=parseInt(W.substring(Oe+1),10);He>=x&&He<=M?Ce.push(W):He>M&&me.push({oldKey:W,newKey:e.cellKey(He-N,P),cell:e.cells[W]})}for(const W of Ce)Reflect.deleteProperty(e.cells,W);for(const W of me)Reflect.deleteProperty(e.cells,W.oldKey),e.cells[W.newKey]=W.cell;const ye=e.colWidths.value,ae=new Array(ye.length);for(let W=0;W<x;W++)ae[W]=ye[W];for(let W=x;W<ye.length-N;W++)ae[W]=ye[W+N];for(let W=ye.length-N;W<ye.length;W++)ae[W]=100;e.colWidths.value=ae,Te(te),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))}function h(){let x=-1,M=-1;for(const N in e.cells){const te=N.split(",");if(te.length===2){const me=parseInt(te[0],10),Ce=parseInt(te[1],10),ye=e.cells[N];ye&&(ye.value!==""||ye.styleId!==void 0)&&(me>x&&(x=me),Ce>M&&(M=Ce))}}for(let N=e.colCount-1;N>=0;N--){const te=e.colWidths.value[N];if(te!==void 0&&te!==100){N>x&&(x=N);break}}for(let N=e.rowCount-1;N>=0;N--)if(e.rowHeights.value[N]!==void 0){N>M&&(M=N);break}return{lastCol:x,lastRow:M}}function S(x,M){const N=e.resolveStyle(e.cells[e.cellKey(x,M)]);return typeof(N==null?void 0:N.numberFormat)=="string"?N.numberFormat:""}function d(x,M,N){for(let te=M;te<=N;te++)if(e.getCellRaw(x,te).trim()!=="")return!0;return!1}function k(x){const{startRow:M,endRow:N,startCol:te,endCol:me}=x;let Ce=te,ye=me;for(;Ce>0&&d(Ce-1,M,N);)Ce--;for(;ye<e.colCount-1&&d(ye+1,M,N);)ye++;return{startRow:M,endRow:N,startCol:Ce,endCol:ye}}function v(x){const M=k(x);return M.startCol!==x.startCol||M.endCol!==x.endCol}function E(x,M,N,te=x){let me,Ce;if(N)me=N.startRow,Ce=N.endRow;else{const P=e.selection.value,Ne=!!P&&P.startRow===P.endRow&&P.startCol===P.endCol;me=Ne||!P?0:P.startRow,Ce=Ne||!P?e.rowCount-1:P.endRow}let ye=-1,ae=-1;for(let P=me;P<=Ce;P++){let Ne=!1;for(let ot=x;ot<=M;ot++)if(e.getCellRaw(ot,P).trim()!==""){Ne=!0;break}Ne&&(ye<0&&(ye=P),ae=P)}if(ye<0)return null;const W=[];for(let P=ye;P<=ae;P++){const Ne=e.getCellRaw(te,P);W.push(ul(Ne,S(te,P),e.locale.value))}const Oe=Ac(W)?ye+1:ye;let He=!1;for(let P=ye;P<=ae&&!He;P++)for(let Ne=x;Ne<=M;Ne++){const ot=e.cells[e.cellKey(Ne,P)];if(ot&&ot.value.startsWith("=")){He=!0;break}}if(!He)for(const P in e.merges){const Ne=e.merges[P];if(Ne&&Ne.startCol<=M&&Ne.endCol>=x&&Ne.startRow<=Ce&&Ne.endRow>=me){He=!0;break}}return{firstRow:ye,lastRow:ae,sortStart:Oe,blocked:He}}function J(x,M){const N=E(x,M);return!!N&&!N.blocked&&N.sortStart<N.lastRow}function j(x,M,N){var b,z;const te=M??e.selection.value;if(!te)return;const me=te.startCol,Ce=te.endCol,ye=N??me,ae=E(me,Ce,{startRow:te.startRow,endRow:te.endRow},ye);if(!ae||ae.blocked||ae.sortStart>=ae.lastRow)return;const W=Ce-me+1,Oe=ae.lastRow-ae.sortStart+1,He=[],P=[];for(let _=ae.sortStart;_<=ae.lastRow;_++){const se=new Array(W);for(let re=me;re<=Ce;re++)se[re-me]=e.cells[e.cellKey(re,_)]??null;He.push(se);const de=e.getCellRaw(ye,_);P.push(ul(de,S(ye,_),e.locale.value))}const Ne=Fc(P,x,e.locale.value);let ot=!1;for(let _=0;_<Oe;_++)if(Ne[_]!==_){ot=!0;break}if(ot){l.saveUndo();for(let _=0;_<Oe;_++){const se=He[Ne[_]],de=ae.sortStart+_;for(let re=me;re<=Ce;re++){const be=e.cellKey(re,de),Le=se[re-me],it=Le?Le.value:"",ht=(b=e.cells[be])==null?void 0:b.styleId;it!==""||ht!==void 0?e.cells[be]={value:it,styleId:ht}:e.delCell(be)}}bn();for(let _=ae.sortStart;_<=ae.lastRow;_++)for(let se=me;se<=Ce;se++)e.formulaDeps.markDirty(e.cellKey(se,_));(z=e.scheduleRender)==null||z.call(e),F()}}const le=t.ref(!1),L=t.ref(null);function g(x){const M=e.selection.value;if(!M||!v(M))return!1;const N=k(M);return L.value={order:x,originalRange:M,expandedRange:N},le.value=!0,!0}function he(x){const M=L.value;if(!M)return;const{order:N,originalRange:te,expandedRange:me}=M;le.value=!1,L.value=null,j(N,x?me:te,te.startCol),De.value=N}function Z(){le.value=!1,L.value=null}const ie=t.ref(!1),De=t.ref("asc");function _e(x){ie.value=x,x&&(l.textColorMenuOpen.value=!1,l.fillColorMenuOpen.value=!1,l.fontSizeMenuOpen.value=!1)}function xe(x){g(x)||(De.value=x,j(x))}function we(){g(De.value)||j(De.value)}function Te(x){Object.keys(e.merges).forEach(M=>Reflect.deleteProperty(e.merges,M));for(const M of x)if(!(M.newRange.startCol>M.newRange.endCol||M.newRange.startRow>M.newRange.endRow)&&(e.merges[M.newAnchorKey]={...M.newRange},M.anchorCell)){const N=M.anchorCell.value,te=M.anchorCell.styleId;N===""&&!te||(e.cells[M.newAnchorKey]={value:N,styleId:te||void 0})}}function et(x,M){const N=M-x+1,te=[];for(const me in e.merges){const Ce=e.merges[me];if(!Ce)continue;const ye=e.cells[me]?{value:e.cells[me].value,styleId:e.cells[me].styleId??0}:{value:"",styleId:0},{startCol:ae,endCol:W}=Ce;let{startRow:Oe,endRow:He}=Ce;if(Oe>M){Oe-=N,He-=N,te.push({newAnchorKey:e.cellKey(ae,Oe),newRange:{startCol:ae,startRow:Oe,endCol:W,endRow:He}});continue}if(He<x){te.push({newAnchorKey:me,newRange:{startCol:ae,startRow:Oe,endCol:W,endRow:He}});continue}if(Oe>=x&&He<=M||(Oe>=x&&Oe<=M&&(Oe=x),He>=x&&He<=M?He=x-1:He>M&&(He-=N),Oe>He))continue;const P=ae,Ne=Oe,ot=e.cellKey(P,Ne),z=me.split(",").map(Number)[1],_=z>=x&&z<=M||P!==Ce.startCol||Ne!==z;te.push({newAnchorKey:ot,newRange:{startCol:ae,startRow:Oe,endCol:W,endRow:He},anchorCell:_?ye:void 0})}return te}function Ve(x,M){const N=M-x+1,te=[];for(const me in e.merges){const Ce=e.merges[me];if(!Ce)continue;const ye=e.cells[me]?{value:e.cells[me].value,styleId:e.cells[me].styleId??0}:{value:"",styleId:0};let{startCol:ae,endCol:W}=Ce;const{startRow:Oe,endRow:He}=Ce;if(ae>M){ae-=N,W-=N,te.push({newAnchorKey:e.cellKey(ae,Oe),newRange:{startCol:ae,startRow:Oe,endCol:W,endRow:He}});continue}if(W<x){te.push({newAnchorKey:me,newRange:{startCol:ae,startRow:Oe,endCol:W,endRow:He}});continue}if(ae>=x&&W<=M||(ae>=x&&ae<=M&&(ae=x),W>=x&&W<=M?W=x-1:W>M&&(W-=N),ae>W))continue;const P=ae,Ne=Oe,ot=e.cellKey(P,Ne),z=me.split(",").map(Number)[0],_=z>=x&&z<=M||P!==z||Ne!==Ce.startRow;te.push({newAnchorKey:ot,newRange:{startCol:ae,startRow:Oe,endCol:W,endRow:He},anchorCell:_?ye:void 0})}return te}function ke(x,M){const N=M-x+1,te=[];for(const me in e.merges){const Ce=e.merges[me];if(!Ce)continue;const{startCol:ye,endCol:ae}=Ce;let{startRow:W,endRow:Oe}=Ce;Oe<x?te.push({newAnchorKey:me,newRange:{startCol:ye,startRow:W,endCol:ae,endRow:Oe}}):W>M?(W+=N,Oe+=N,te.push({newAnchorKey:e.cellKey(ye,W),newRange:{startCol:ye,startRow:W,endCol:ae,endRow:Oe}})):(Oe+=N,te.push({newAnchorKey:me,newRange:{startCol:ye,startRow:W,endCol:ae,endRow:Oe}}))}return te}function Be(x,M){const N=M-x+1,te=[];for(const me in e.merges){const Ce=e.merges[me];if(!Ce)continue;let{startCol:ye,endCol:ae}=Ce;const{startRow:W,endRow:Oe}=Ce;ae<x?te.push({newAnchorKey:me,newRange:{startCol:ye,startRow:W,endCol:ae,endRow:Oe}}):ye>M?(ye+=N,ae+=N,te.push({newAnchorKey:e.cellKey(ye,W),newRange:{startCol:ye,startRow:W,endCol:ae,endRow:Oe}})):(ae+=N,te.push({newAnchorKey:me,newRange:{startCol:ye,startRow:W,endCol:ae,endRow:Oe}}))}return te}let Xe=0;function Ge(){return Xe++,`s_${Xe}`}function oe(x,M){const N=Math.max(1,(M==null?void 0:M.colCount)??e.colCount),te=Math.max(1,(M==null?void 0:M.rowCount)??e.rowCount),me=new Array(N).fill(100),Ce=new Array(te).fill(void 0);return{id:Ge(),name:x,cells:{},merges:{},styles:[{}],borders:[{}],selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:me,rowHeights:Ce,colCount:N,rowCount:te,freeze:{rows:0,cols:0}}}const ge=t.ref([oe("Sheet1")]),u=t.ref(0);function D(){const x=ge.value[u.value];x&&(x.cells={...e.cells},x.merges={...e.merges},x.selection=e.selection.value?{...e.selection.value}:null,x.activeCell={...e.activeCell.value},x.scrollX=e.scrollX.value,x.scrollY=e.scrollY.value,x.colWidths=[...e.colWidths.value],x.rowHeights=[...e.rowHeights.value],x.styles=[...e.styles],x.borders=[...e.borders],x.colCount=e.colCount,x.rowCount=e.rowCount,x.freeze={rows:e.freeze.rows,cols:e.freeze.cols})}function I(x){var ae;const M=ge.value[x];if(!M)return;Object.keys(e.cells).forEach(W=>e.delCell(W)),Object.assign(e.cells,M.cells),Object.keys(e.merges).forEach(W=>Reflect.deleteProperty(e.merges,W)),M.merges&&Object.assign(e.merges,M.merges),e.selection.value=M.selection?{...M.selection}:null,e.activeCell.value={...M.activeCell};const N=e.activeCell.value,te=e.selection.value,me=e.findMerge(N.col,N.row);me&&me.anchor===e.cellKey(N.col,N.row)&&(!te||te.startCol===N.col&&te.startRow===N.row&&te.endCol===N.col&&te.endRow===N.row)&&e.selectCell(N.col,N.row),e.scrollX.value=M.scrollX,e.scrollY.value=M.scrollY,e.colWidths.value=[...M.colWidths],e.rowHeights.value=[...M.rowHeights];const Ce=Math.max(1,M.colCount??e.colCount),ye=Math.max(1,M.rowCount??e.rowCount);(ae=e.setDims)==null||ae.call(e,Ce,ye),e.freeze.rows=Math.max(0,Math.min(M.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(M.freeze.cols,e.colCount)),e.syncStyles(M.styles),e.syncBorders(M.borders??[{}]),u.value=x}function G(x){x===u.value||x<0||x>=ge.value.length||(e.cancelEdit(),D(),I(x))}function $(x){return l.saveUndo(),e.cancelEdit(),D(),ge.value.push(oe(x??`Sheet${ge.value.length+1}`)),I(ge.value.length-1),ge.value.length-1}function ne(x){return ge.value.length<=1||(l.saveUndo(),e.cancelEdit(),ge.value.splice(x,1),I(Math.min(x,ge.value.length-1))),u.value}function H(x,M){ge.value[x]&&M.trim()&&(l.saveUndo(),ge.value[x].name=M.trim())}function c(x){l.saveUndo(),e.cancelEdit(),D();const M=ge.value[x];if(!M)return x;let N=M.name;const te=N.match(/^(.*?)\s*\((\d+)\)$/);let me=te?parseInt(te[2],10)+1:2;te&&(N=te[1]);let Ce=`${N} (${me})`;const ye=new Set(ge.value.map(W=>W.name));for(;ye.has(Ce);)me++,Ce=`${N} (${me})`;const ae={id:Ge(),name:Ce,cells:{...M.cells},merges:M.merges?{...M.merges}:{},styles:[...M.styles],borders:M.borders?[...M.borders]:[{}],selection:M.selection?{...M.selection}:null,activeCell:M.activeCell?{...M.activeCell}:{col:0,row:0},scrollX:M.scrollX,scrollY:M.scrollY,colWidths:[...M.colWidths],rowHeights:[...M.rowHeights],colCount:M.colCount,rowCount:M.rowCount,freeze:{...M.freeze}};return ge.value.splice(x+1,0,ae),I(x+1),x+1}function y(x,M){var Ce;const N=x+M;if(N<0||N>=ge.value.length)return;l.saveUndo();const te=u.value,me=ge.value.splice(x,1)[0];ge.value.splice(N,0,me),te===x?u.value=N:x<te&&N>=te?u.value=te-1:x>te&&N<=te&&(u.value=te+1),(Ce=e.scheduleRender)==null||Ce.call(e)}const at=t.computed(()=>ge.value.length);let ee="";const p=n;function F(){D();const x=ge.value.map(N=>{const te={};for(const[ae,W]of Object.entries(N.cells))te[ae]={value:W.value},W.styleId&&W.styleId>0&&(te[ae].styleId=W.styleId);const me={name:N.name,cells:te};N.styles&&N.styles.length>1&&(me.styles=[...N.styles]),N.borders&&N.borders.length>1&&(me.borders=[...N.borders]),N.merges&&Object.keys(N.merges).length&&(me.merges={...N.merges});const Ce={};for(let ae=0;ae<N.colWidths.length;ae++)N.colWidths[ae]!==100&&(Ce[ae]=N.colWidths[ae]);Object.keys(Ce).length&&(me.colWidths=Ce);const ye={};for(let ae=0;ae<N.rowHeights.length;ae++){const W=N.rowHeights[ae];W!=null&&(ye[ae]=W)}return Object.keys(ye).length&&(me.rowHeights=ye),N.colCount!==26&&(me.colCount=N.colCount),N.rowCount!==200&&(me.rowCount=N.rowCount),(N.freeze.rows!==0||N.freeze.cols!==0)&&(me.freeze={rows:N.freeze.rows,cols:N.freeze.cols}),me}),M=JSON.stringify(x);M!==ee&&(ee=M,p.value=x,a&&(a.value=M))}e.emitModelData=F;let Ue=!1;function vt(){Ue||(Ue=!0,Promise.resolve().then(()=>{Ue=!1,F()}))}const ce=t.computed(()=>e.props.theme==="dark"?Bl:xl),We=t.computed(()=>Nc(ce.value,e.props.width,e.props.height,jo)),Je=t.computed(()=>{const x={};for(const[M,N]of Object.entries(We.value))M.startsWith("--")&&(x[M]=N);return x}),gt=t.ref(null),kt=t.ref(null),Vt=t.ref(null),Ht=t.ref(null),Kt=t.ref(null),lo=t.reactive({w:800,h:600});e.viewSize&&t.watch(lo,x=>{e.viewSize&&(e.viewSize.w=x.w,e.viewSize.h=x.h)},{deep:!0});const Wt=48,yo=28,ro=11,Yt=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,lo.w-Wt-ro))),Mo=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,lo.h-yo-ro)));function xo(x,M){const N=Math.max(0,lo.w-Wt-ro),te=Math.max(0,lo.h-yo-ro),me=x??e.scrollX.value,Ce=M??e.scrollY.value,ye=40,ae=Math.max(0,e.totalWidth.value-N),W=Math.max(0,e.totalHeight.value-te);if(me>=ae-ye&&me>e.scrollX.value||Ce>=W-ye&&Ce>e.scrollY.value){const Oe=Math.max(0,Math.ceil((me+N)/100)+2),He=Math.max(0,Math.ceil((Ce+te)/24)+2);e.ensureCapacity(Oe,He)}e.scrollX.value=Math.max(0,Math.min(me,Math.max(0,e.totalWidth.value-N))),e.scrollY.value=Math.max(0,Math.min(Ce,Math.max(0,e.totalHeight.value-te)))}e.clampScroll=xo;function qt(){var x;return typeof window>"u"?!1:!((x=window.matchMedia)!=null&&x.call(window,"(hover: none) and (pointer: coarse)").matches)}function ao(x=!1){t.nextTick(()=>{const M=Ht.value;if(M){if(!e.editingCell.value&&!qt()){document.activeElement===M&&M.blur();return}M.focus({preventScroll:!0}),x&&M.select()}})}function uo(){ao()}function fo(){var M;const x=e.selection.value;if(x){l.saveUndo();for(let N=x.startRow;N<=x.endRow;N++)e.rowHeights.value[N]=void 0;(M=e.scheduleRender)==null||M.call(e),F()}}function io(){var M;const x=e.selection.value;if(x){l.saveUndo();for(let N=x.startCol;N<=x.endCol;N++)e.colWidths.value[N]=100;(M=e.scheduleRender)==null||M.call(e),F()}}return{deleteRows:i,insertRows:r,insertCols:f,deleteCols:m,sortSelectedColumns:j,canSortColumns:J,sortMenuOpen:ie,cachedSortOrder:De,onSortMenuToggle:_e,onSortChange:xe,applyCachedSort:we,sortConfirmOpen:le,prepareSortConfirmation:g,confirmSort:he,cancelSortConfirmation:Z,sheets:ge,activeSheetIndex:u,saveSheet:D,loadSheet:I,switchSheet:G,addSheet:$,removeSheet:ne,renameSheet:H,dupSheet:c,moveSheet:y,sheetCount:at,mkSheet:oe,emitModelData:F,scheduleOptEmit:vt,themeColors:ce,outerStyle:We,toolbarThemeVars:Je,wrapperRef:gt,canvasRef:kt,freezeCanvasRef:Vt,editInputRef:Ht,formulaBarRef:Kt,viewSize:lo,maxScrollX:Yt,maxScrollY:Mo,clampScroll:xo,canFocusHiddenEditor:qt,focusEditInput:ao,onCanvasFocus:uo,resetRowHeight:fo,resetColWidth:io,modelData:p}}function fl(e){return!!e&&e.width!==void 0&&e.width>0}function Tt(e,l,n,o){const a=fl(e),i=fl(l);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return l;const r=e.width??0,f=l.width??0;return r>f?e:f>r?l:e}function Oc(e,l,n,o,a){let i=!1,r=null,f=1,m=()=>{},h=()=>{},S=()=>{};function d(){i||(i=!0,requestAnimationFrame(()=>{i=!1,J(),j()}))}e.scheduleRender=d;function k(s){const{frozenColumnsWidth:C}=e.getFrozenMetrics(),V=C>0&&s<52+C?s-52:s-52+e.scrollX.value;return e.hitCol(V)}function v(s){const{frozenRowsHeight:C}=e.getFrozenMetrics(),V=C>0&&s<24+C?s-24:s-24+e.scrollY.value;return e.hitRow(V)}const E="#444";function J(){const s=o.wrapperRef.value,C=o.canvasRef.value;if(!s||!C||(r=C.getContext("2d"),!r))return;f=window.devicePixelRatio||1;const V=s.getBoundingClientRect(),Y=V.width,A=V.height;o.viewSize.w=Y,o.viewSize.h=A,C.width=Y*f,C.height=A*f,C.style.width=Y+"px",C.style.height=A+"px",r.setTransform(f,0,0,f,0,0);const K=e.scrollX.value,ue=e.scrollY.value,X=52,pe=24,Fe=o.themeColors.value,It=e.colPositions.value,ut=e.rowPositions.value,Dt=e.colWidths.value,{frozenRowsHeight:ft,frozenColumnsWidth:Rt}=e.getFrozenMetrics(),Xt=X+Rt,jt=pe+ft,Jo=Math.max(0,Y-X-11-Rt),Bo=Math.max(0,A-pe-11-ft),Wo=Math.max(0,e.freeze.cols-1),Po=Math.max(0,e.freeze.rows-1),bo=Math.max(e.freeze.cols,e.hitCol(Rt+K));let Ko=bo;for(let R=bo;R<e.colCount&&!(X+It[R]-K>=Y);R++)Ko=R;const Do=Math.max(e.freeze.rows,e.hitRow(ft+ue));let mo=Do;for(let R=Do;R<e.rowCount&&!(pe+ut[R]-ue>=A);R++)mo=R;let Co=bo,zt=Ko,eo=Do,Lt=mo;Rt>0&&(Co=0,zt=Math.max(zt,Wo)),ft>0&&(eo=0,Lt=Math.max(Lt,Po));let Uo=Co,co=eo;for(const R in e.merges){const Ee=e.merges[R];Ee&&(Ee.startRow>Lt||Ee.endRow<eo||Ee.startCol>zt||Ee.endCol<Co||(Ee.startCol<Uo&&(Uo=Ee.startCol),Ee.startRow<co&&(co=Ee.startRow)))}const Go=new Array(co);for(let R=co;R<=Lt;R++)Go[R]=ut[R+1]-ut[R];r.fillStyle=Fe.bg,r.fillRect(0,0,Y,A),r.fillStyle=Fe.gridBg,r.fillRect(X,pe,Y-X,A-pe);const mt=e.selection.value,pn=e.editingCell.value;m=(R,Ee,$e,st,yt,Mt)=>{for(let Ze=st;Ze<=yt;Ze++)for(let ve=Ee;ve<=$e;ve++){if(e.findMerge(ve,Ze))continue;const Ye=e.cellToScreenRect(Ze,ve),ze=Ye.x,Ae=Ye.y,rt=Ye.width,dt=Ye.height;if(ze+rt<X||Ae+dt<pe||ze>Y||Ae>A)continue;const bt=e.findHighlight?e.findHighlight(ve,Ze):null,Ct=e.resolveStyle(e.cells[e.cellKey(ve,Ze)]),wt=typeof(Ct==null?void 0:Ct.backgroundColor)=="string"?Ct.backgroundColor:"";if(wt&&(R.fillStyle=wt,R.fillRect(ze,Ae,rt,dt)),bt&&(R.fillStyle=bt==="active"?Fe.findActiveBg:Fe.findMatchBg,R.fillRect(ze,Ae,rt,dt)),e.isSelected(ve,Ze)&&(R.fillStyle=Fe.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?R.fillRect(ze,Ae,Dt[ve],Mt[Ze]):R.fillRect(ze,Ae,rt,dt)),e.activeCell.value.col===ve&&e.activeCell.value.row===Ze&&(R.strokeStyle=Fe.activeCellBorder,R.lineWidth=2,R.strokeRect(ze+1,Ae+1,rt-2,dt-2)),bt==="active"&&(R.strokeStyle=Fe.findActiveBg,R.lineWidth=2,R.strokeRect(ze+1,Ae+1,rt-2,dt-2)),R.strokeStyle=Fe.gridLine,R.lineWidth=.5,R.strokeRect(ze+.25,Ae+.25,rt-.5,dt-.5),!(pn&&pn.col===ve&&pn.row===Ze)){const fe=e.resolveStyle(e.cells[e.cellKey(ve,Ze)]),q=e.getCellValue(ve,Ze),Re=typeof(fe==null?void 0:fe.numberFormat)=="string"?fe.numberFormat:"",Me=q?Ho(q,Re,e.locale.value):"";if(Me){const Pe=e.cellFontSize(ve,Ze),Et=typeof(fe==null?void 0:fe.fontFamily)=="string"&&fe.fontFamily?fe.fontFamily:Xo,Pt=(fe==null?void 0:fe.fontWeight)==="bold"?"bold":"normal",$t=(fe==null?void 0:fe.fontStyle)==="italic"?"italic":"normal",vo=(fe==null?void 0:fe.underline)==="underline",To=(fe==null?void 0:fe.strikethrough)==="line-through",wo=typeof(fe==null?void 0:fe.color)=="string"?fe.color:"",No=typeof(fe==null?void 0:fe.textAlign)=="string"?fe.textAlign:Rn(q,Re)?"right":"left",an=typeof(fe==null?void 0:fe.verticalAlign)=="string"?fe.verticalAlign:"top";R.fillStyle=wo||Fe.cellText,R.font=`${$t} ${Pt} ${Pe}px ${Et}`,R.textBaseline="alphabetic",R.save(),R.beginPath(),R.rect(ze+5,Ae+1,rt-10,dt-2),R.clip();const Io=(fe==null?void 0:fe.wrap)==="wrap",so=rt-10;let Fo=Me;const po=!Io&&Gn(Re),Ao=Me===gn||Yn(q,Re);if(Ao||po){if(Ao){const en=Math.max(1,R.measureText("#").width),hn=Math.max(1,Math.floor(so/en));Fo="#".repeat(hn)}else if(e.getWrappedLines(R,Me,1e9,!1).some(Vo=>Vo&&R.measureText(Vo).width>so)){const Vo=Math.max(1,R.measureText("#").width),cn=Math.max(1,Math.floor(so/Vo));Fo="#".repeat(cn)}}const to=e.getWrappedLines(R,Fo,so,Io),{ascent:Qo,descent:Cn}=e.measureFontMetrics(Et,Pe,Pt,$t),vn=Qo+Cn,as=to.length*vn;let wn;an==="middle"?wn=Ae+(dt-as)/2+Qo:an==="bottom"?wn=Ae+dt-e.BASE_CELL_VPAD-Cn-(to.length-1)*vn:wn=Ae+e.BASE_CELL_VPAD+Qo;for(let en=0;en<to.length;en++){const hn=to[en],Vo=wn+en*vn,cn=R.measureText(hn);let Yo;if(No==="center"?Yo=ze+rt/2-cn.width/2:No==="right"?Yo=ze+rt-5-cn.width:Yo=ze+5,R.fillText(hn,Yo,Vo),vo&&(R.strokeStyle=wo||Fe.cellText,R.lineWidth=1,R.beginPath(),R.moveTo(Yo,Vo+Cn+1),R.lineTo(Yo+cn.width,Vo+Cn+1),R.stroke()),To){R.strokeStyle=wo||Fe.cellText,R.lineWidth=1;const hl=Vo-Qo+vn*.42;R.beginPath(),R.moveTo(Yo,hl),R.lineTo(Yo+cn.width,hl),R.stroke()}}R.restore()}}}};const Ft=(R,Ee,$e)=>{const st=e.findMerge(R,Ee);return st?e.getCellBorderSide(e.cells[st.anchor],$e):e.getCellBorderSide(e.cells[e.cellKey(R,Ee)],$e)};h=(R,Ee,$e,st,yt,Mt)=>{R.fillStyle=E;for(let Ze=st;Ze<=yt;Ze++)for(let ve=Ee;ve<=$e;ve++){if(e.findMerge(ve,Ze))continue;const Ye=e.cellToScreenRect(Ze,ve),ze=Ye.x,Ae=Ye.y,rt=Ye.width,dt=Ye.height;if(ze+rt<X||Ae+dt<pe||ze>Y||Ae>A)continue;const bt=e.cells[e.cellKey(ve,Ze)],Ct={top:e.getCellBorderSide(bt,"top"),right:e.getCellBorderSide(bt,"right"),bottom:e.getCellBorderSide(bt,"bottom"),left:e.getCellBorderSide(bt,"left")},wt={top:Ft(ve,Ze-1,"bottom"),left:Ft(ve-1,Ze,"right"),bottom:Ft(ve,Ze+1,"top"),right:Ft(ve+1,Ze,"left")},fe=Tt(wt.top,Ct.top),q=Tt(wt.left,Ct.left),Re=Tt(Ct.bottom,wt.bottom),Me=Tt(Ct.right,wt.right),Pe=(fe==null?void 0:fe.width)??0,Et=(q==null?void 0:q.width)??0,Pt=(Re==null?void 0:Re.width)??0,$t=(Me==null?void 0:Me.width)??0;Pe>0&&(R.fillStyle=(fe==null?void 0:fe.color)||E,R.fillRect(ze,Ae,rt,Pe)),Pt>0&&(R.fillStyle=(Re==null?void 0:Re.color)||E,R.fillRect(ze,Ae+dt-Pt,rt,Pt)),Et>0&&(R.fillStyle=(q==null?void 0:q.color)||E,R.fillRect(ze,Ae,Et,dt)),$t>0&&(R.fillStyle=(Me==null?void 0:Me.color)||E,R.fillRect(ze+rt-$t,Ae,$t,dt)),Pe>0&&Et>0&&(R.fillStyle=(fe==null?void 0:fe.color)||(q==null?void 0:q.color)||E,R.fillRect(ze-Et,Ae-Pe,Et,Pe)),Pe>0&&$t>0&&(R.fillStyle=(fe==null?void 0:fe.color)||(Me==null?void 0:Me.color)||E,R.fillRect(ze+rt,Ae-Pe,$t,Pe)),Pt>0&&Et>0&&(R.fillStyle=(Re==null?void 0:Re.color)||(q==null?void 0:q.color)||E,R.fillRect(ze-Et,Ae+dt,Et,Pt)),Pt>0&&$t>0&&(R.fillStyle=(Re==null?void 0:Re.color)||(Me==null?void 0:Me.color)||E,R.fillRect(ze+rt,Ae+dt,$t,Pt))}};const nt=(R,Ee,$e,st,yt,Mt,Ze)=>{const ve=e.resolveStyle(e.cells[e.cellKey(Ee,$e)]),lt=e.getCellValue(Ee,$e),Ye=typeof(ve==null?void 0:ve.numberFormat)=="string"?ve.numberFormat:"",ze=lt?Ho(lt,Ye,e.locale.value):"";if(!ze)return;const Ae=e.cellFontSize(Ee,$e),rt=typeof(ve==null?void 0:ve.fontFamily)=="string"&&ve.fontFamily?ve.fontFamily:Xo,dt=(ve==null?void 0:ve.fontWeight)==="bold"?"bold":"normal",bt=(ve==null?void 0:ve.fontStyle)==="italic"?"italic":"normal",Ct=(ve==null?void 0:ve.underline)==="underline",wt=(ve==null?void 0:ve.strikethrough)==="line-through",fe=typeof(ve==null?void 0:ve.color)=="string"?ve.color:"",q=typeof(ve==null?void 0:ve.textAlign)=="string"?ve.textAlign:Rn(lt,Ye)?"right":"left",Re=typeof(ve==null?void 0:ve.verticalAlign)=="string"?ve.verticalAlign:"top";R.fillStyle=fe||Fe.cellText,R.font=`${bt} ${dt} ${Ae}px ${rt}`,R.textBaseline="alphabetic",R.save(),R.beginPath(),R.rect(Mt+5,Ze+1,st-10,yt-2),R.clip();const Me=(ve==null?void 0:ve.wrap)==="wrap",Pe=st-10;let Et=ze;const Pt=!Me&&Gn(Ye),$t=ze===gn||Yn(lt,Ye);if($t||Pt){if($t){const so=Math.max(1,R.measureText("#").width),Fo=Math.max(1,Math.floor(Pe/so));Et="#".repeat(Fo)}else if(e.getWrappedLines(R,ze,1e9,!1).some(po=>po&&R.measureText(po).width>Pe)){const po=Math.max(1,R.measureText("#").width),Ao=Math.max(1,Math.floor(Pe/po));Et="#".repeat(Ao)}}const vo=e.getWrappedLines(R,Et,Pe,Me),{ascent:To,descent:wo}=e.measureFontMetrics(rt,Ae,dt,bt),No=To+wo,an=vo.length*No;let Io;Re==="middle"?Io=Ze+(yt-an)/2+To:Re==="bottom"?Io=Ze+yt-e.BASE_CELL_VPAD-wo-(vo.length-1)*No:Io=Ze+e.BASE_CELL_VPAD+To;for(let so=0;so<vo.length;so++){const Fo=vo[so],po=Io+so*No,Ao=R.measureText(Fo);let to;if(q==="center"?to=Mt+st/2-Ao.width/2:q==="right"?to=Mt+st-5-Ao.width:to=Mt+5,R.fillText(Fo,to,po),Ct&&(R.strokeStyle=fe||Fe.cellText,R.lineWidth=1,R.beginPath(),R.moveTo(to,po+wo+1),R.lineTo(to+Ao.width,po+wo+1),R.stroke()),wt){R.strokeStyle=fe||Fe.cellText,R.lineWidth=1;const Qo=po-To+No*.42;R.beginPath(),R.moveTo(to,Qo),R.lineTo(to+Ao.width,Qo),R.stroke()}}R.restore()},At=(R,Ee,$e,st,yt,Mt,Ze,ve)=>{const lt=Ee.startCol,Ye=Ee.endCol,ze=Ee.startRow,Ae=Ee.endRow,rt=st,dt=Mt,bt=Ze&&Ye>=e.freeze.cols,Ct=ve&&Ae>=e.freeze.rows,wt=e.cells[e.cellKey(lt,ze)],fe={top:e.getCellBorderSide(wt,"top"),right:e.getCellBorderSide(wt,"right"),bottom:e.getCellBorderSide(wt,"bottom"),left:e.getCellBorderSide(wt,"left")};R.fillStyle=E;for(let q=lt;q<=Ye;q++){if(Ze&&q>=e.freeze.cols||e.isSameMergeInternal(q,ze-1,q,ze))continue;const Re=Ft(q,ze-1,"bottom"),Me=Tt(Re,fe.top);if(Me&&Me.width&&Me.width>0){const Pe=q<e.freeze.cols?X+It[q]:X+It[q]-K;R.fillStyle=Me.color||E,R.fillRect(Pe,rt,Dt[q],Me.width)}}if(!Ct)for(let q=lt;q<=Ye;q++){if(Ze&&q>=e.freeze.cols||e.isSameMergeInternal(q,Ae,q,Ae+1))continue;const Re=Ft(q,Ae+1,"top"),Me=Tt(fe.bottom,Re);if(Me&&Me.width&&Me.width>0){const Pe=q<e.freeze.cols?X+It[q]:X+It[q]-K;R.fillStyle=Me.color||E,R.fillRect(Pe,rt+dt-Me.width,Dt[q],Me.width)}}for(let q=ze;q<=Ae;q++){if(ve&&q>=e.freeze.rows||e.isSameMergeInternal(lt-1,q,lt,q))continue;const Re=Ft(lt-1,q,"right"),Me=Tt(Re,fe.left);if(Me&&Me.width&&Me.width>0){const Pe=q<e.freeze.rows?pe+ut[q]:pe+ut[q]-ue,Et=ut[q+1]-ut[q];R.fillStyle=Me.color||E,R.fillRect($e,Pe,Me.width,Et)}}if(!bt)for(let q=ze;q<=Ae;q++){if(ve&&q>=e.freeze.rows||e.isSameMergeInternal(Ye,q,Ye+1,q))continue;const Re=Ft(Ye+1,q,"left"),Me=Tt(fe.right,Re);if(Me&&Me.width&&Me.width>0){const Pe=q<e.freeze.rows?pe+ut[q]:pe+ut[q]-ue,Et=ut[q+1]-ut[q];R.fillStyle=Me.color||E,R.fillRect($e+yt-Me.width,Pe,Me.width,Et)}}{const q=e.isSameMergeInternal(lt,ze-1,lt,ze)?fe.top:Tt(Ft(lt,ze-1,"bottom"),fe.top),Re=e.isSameMergeInternal(lt-1,ze,lt,ze)?fe.left:Tt(Ft(lt-1,ze,"right"),fe.left),Me=(q==null?void 0:q.width)??0,Pe=(Re==null?void 0:Re.width)??0;Me>0&&Pe>0&&(R.fillStyle=(q==null?void 0:q.color)||(Re==null?void 0:Re.color)||E,R.fillRect($e-Pe,st-Me,Pe,Me))}if(!bt){const q=e.isSameMergeInternal(Ye,ze-1,Ye,ze)?fe.top:Tt(Ft(Ye,ze-1,"bottom"),fe.top),Re=e.isSameMergeInternal(Ye,ze,Ye+1,ze)?fe.right:Tt(fe.right,Ft(Ye+1,ze,"left")),Me=(q==null?void 0:q.width)??0,Pe=(Re==null?void 0:Re.width)??0;Me>0&&Pe>0&&(R.fillStyle=(q==null?void 0:q.color)||(Re==null?void 0:Re.color)||E,R.fillRect($e+yt,st-Me,Pe,Me))}if(!Ct){const q=e.isSameMergeInternal(lt,Ae,lt,Ae+1)?fe.bottom:Tt(fe.bottom,Ft(lt,Ae+1,"top")),Re=e.isSameMergeInternal(lt-1,Ae,lt,Ae)?fe.left:Tt(Ft(lt-1,Ae,"right"),fe.left),Me=(q==null?void 0:q.width)??0,Pe=(Re==null?void 0:Re.width)??0;Me>0&&Pe>0&&(R.fillStyle=(q==null?void 0:q.color)||(Re==null?void 0:Re.color)||E,R.fillRect($e-Pe,st+Mt,Pe,Me))}if(!bt&&!Ct){const q=e.isSameMergeInternal(Ye,Ae,Ye,Ae+1)?fe.bottom:Tt(fe.bottom,Ft(Ye,Ae+1,"top")),Re=e.isSameMergeInternal(Ye,Ae,Ye+1,Ae)?fe.right:Tt(fe.right,Ft(Ye+1,Ae,"left")),Me=(q==null?void 0:q.width)??0,Pe=(Re==null?void 0:Re.width)??0;Me>0&&Pe>0&&(R.fillStyle=(q==null?void 0:q.color)||(Re==null?void 0:Re.color)||E,R.fillRect($e+yt,st+Mt,Pe,Me))}};S=(R,Ee,$e,st,yt)=>{var Ye;const Mt=Ee+st,Ze=$e+yt,ve=Ee<Xt,lt=$e<jt;for(const ze in e.merges){const Ae=e.merges[ze];if(!Ae)continue;const rt=Ae.startCol,dt=Ae.startRow,bt=Ae.endCol,Ct=Ae.endRow,wt=e.cellToScreenRect(dt,rt),fe=e.cellToScreenRect(Ct,bt),q=wt.x,Re=wt.y,Me=fe.x+fe.width-q,Pe=fe.y+fe.height-Re,Et=ve&&bt>=e.freeze.cols?Math.min(Mt,Xt):Math.min(q+Me,Mt),Pt=lt&&Ct>=e.freeze.rows?Math.min(Ze,jt):Math.min(Re+Pe,Ze),$t=Math.max(q,Ee),vo=Math.max(Re,$e);if(Et<=$t||Pt<=vo)continue;const To=(Ye=e.resolveStyle(e.cells[e.cellKey(rt,dt)]))==null?void 0:Ye.backgroundColor;if(To&&(R.fillStyle=To,R.fillRect($t,vo,Et-$t,Pt-vo)),R.strokeStyle=Fe.gridLine,R.lineWidth=.5,R.strokeRect(q+.25,Re+.25,Et-q-.5,Pt-Re-.5),At(R,Ae,q,Re,Me,Pe,ve,lt),!(e.editingCell.value&&e.editingCell.value.col===rt&&e.editingCell.value.row===dt)){const wo=It[bt+1]-It[rt],No=ut[Ct+1]-ut[dt],an=ve?q:q-K,Io=lt?Re:Re-ue;nt(R,rt,dt,wo,No,an,Io)}}},r.save(),r.beginPath(),r.rect(Xt,jt,Jo,Bo),r.clip(),m(r,Uo,zt,co,Lt,Go),h(r,Uo,zt,co,Lt,Go),S(r,Xt,jt,Jo,Bo),r.restore(),Rt>0&&(r.strokeStyle=Fe.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Xt+.5,pe),r.lineTo(Xt+.5,A),r.stroke()),ft>0&&(r.strokeStyle=Fe.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(X,jt+.5),r.lineTo(Y,jt+.5),r.stroke()),r.fillStyle=Fe.headerBg,r.fillRect(X,0,Y-X,pe);for(let R=bo;R<=Ko;R++){const Ee=X+It[R]-K,$e=Dt[R];Ee+$e<X||Ee>Y||(mt&&R>=mt.startCol&&R<=mt.endCol&&(r.fillStyle=Fe.selectionBg,r.fillRect(Ee,0,$e,pe)),r.strokeStyle=Fe.headerBorder,r.lineWidth=.5,r.strokeRect(Ee+.25,.25,$e-.5,pe-.5),mt&&R>=mt.startCol&&R<=mt.endCol&&(r.strokeStyle=Fe.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ee,pe-1),r.lineTo(Ee+$e,pe-1),r.stroke()),r.fillStyle=Fe.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(pt(R),Ee+$e/2,pe/2))}if(Rt>0){r.fillStyle=Fe.headerBg,r.fillRect(X,0,Rt,pe);for(let R=0;R<=Wo;R++){const Ee=X+It[R],$e=Dt[R];Ee+$e<X||Ee>Y||(mt&&R>=mt.startCol&&R<=mt.endCol&&(r.fillStyle=Fe.selectionBg,r.fillRect(Ee,0,$e,pe)),r.strokeStyle=Fe.headerBorder,r.lineWidth=.5,r.strokeRect(Ee+.25,.25,$e-.5,pe-.5),mt&&R>=mt.startCol&&R<=mt.endCol&&(r.strokeStyle=Fe.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ee,pe-1),r.lineTo(Ee+$e,pe-1),r.stroke()),r.fillStyle=Fe.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(pt(R),Ee+$e/2,pe/2))}}r.strokeStyle=Fe.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(X,pe+.5),r.lineTo(Y,pe+.5),r.stroke(),r.fillStyle=Fe.headerBg,r.fillRect(0,pe,X,A-pe);for(let R=Do;R<=mo;R++){const Ee=pe+ut[R]-ue,$e=Go[R];Ee+$e<pe||Ee>A||(mt&&R>=mt.startRow&&R<=mt.endRow&&(r.fillStyle=Fe.selectionBg,r.fillRect(0,Ee,X,$e)),r.strokeStyle=Fe.headerBorder,r.lineWidth=.5,r.strokeRect(.25,Ee+.25,X-.5,$e-.5),mt&&R>=mt.startRow&&R<=mt.endRow&&(r.strokeStyle=Fe.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(X-1,Ee),r.lineTo(X-1,Ee+$e),r.stroke()),r.fillStyle=Fe.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(R+1),X/2,Ee+$e/2+.5))}if(ft>0){r.fillStyle=Fe.headerBg,r.fillRect(0,pe,X,ft);for(let R=0;R<=Po;R++){const Ee=pe+ut[R],$e=Go[R];Ee+$e<pe||Ee>A||(mt&&R>=mt.startRow&&R<=mt.endRow&&(r.fillStyle=Fe.selectionBg,r.fillRect(0,Ee,X,$e)),r.strokeStyle=Fe.headerBorder,r.lineWidth=.5,r.strokeRect(.25,Ee+.25,X-.5,$e-.5),mt&&R>=mt.startRow&&R<=mt.endRow&&(r.strokeStyle=Fe.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(X-1,Ee),r.lineTo(X-1,Ee+$e),r.stroke()),r.fillStyle=Fe.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(R+1),X/2,Ee+$e/2+.5))}}r.strokeStyle=Fe.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(X+.5,pe),r.lineTo(X+.5,A),r.stroke()}function j(){const s=o.freezeCanvasRef.value,C=o.wrapperRef.value;if(!s||!C)return;const V=s.getContext("2d");if(!V)return;const Y=C.getBoundingClientRect(),A=Y.width,K=Y.height,ue=52,X=24,pe=o.themeColors.value,Fe=e.colPositions.value,It=e.rowPositions.value,ut=e.scrollX.value,Dt=e.scrollY.value;s.width=A*f,s.height=K*f,s.style.width=A+"px",s.style.height=K+"px",V.setTransform(f,0,0,f,0,0),V.clearRect(0,0,A,K);const{frozenRowsHeight:ft,frozenColumnsWidth:Rt}=e.getFrozenMetrics();if(ft<=0&&Rt<=0)return;const Xt=ue+Rt,jt=X+ft,Jo=Math.max(0,A-ue-11-Rt),Bo=Math.max(0,K-X-11-ft),Wo=Math.max(0,e.freeze.cols-1),Po=Math.max(0,e.freeze.rows-1),bo=Math.max(e.freeze.cols,e.hitCol(Rt+ut));let Ko=bo;for(let nt=bo;nt<e.colCount&&!(ue+Fe[nt]-ut>=A);nt++)Ko=nt;const Do=Math.max(e.freeze.rows,e.hitRow(ft+Dt));let mo=Do;for(let nt=Do;nt<e.rowCount&&!(X+It[nt]-Dt>=K);nt++)mo=nt;let Co=bo,zt=Ko,eo=Do,Lt=mo;Rt>0&&(Co=0,zt=Math.max(zt,Wo)),ft>0&&(eo=0,Lt=Math.max(Lt,Po));let Uo=Co,co=eo;for(const nt in e.merges){const At=e.merges[nt];At&&(At.startRow>Lt||At.endRow<eo||At.startCol>zt||At.endCol<Co||(At.startCol<Uo&&(Uo=At.startCol),At.startRow<co&&(co=At.startRow)))}const Go=new Array(co);for(let nt=co;nt<=Lt;nt++)Go[nt]=It[nt+1]-It[nt];const mt=(nt,At,R)=>{const Ee=e.findMerge(nt,At);return Ee?e.getCellBorderSide(e.cells[Ee.anchor],R):e.getCellBorderSide(e.cells[e.cellKey(nt,At)],R)},pn=(nt,At,R,Ee,$e)=>{nt.fillStyle="#444";for(let st=Ee;st<=$e;st++)for(let yt=At;yt<=R;yt++){const Mt=e.findMerge(yt,st);if(Mt&&!(yt===Mt.range.startCol&&st===Mt.range.startRow))continue;const Ze=e.cellToScreenRect(st,yt),ve=Ze.x,lt=Ze.y,Ye=Ze.width,ze=Ze.height;if(ve+Ye<ue||lt+ze<X||ve>A||lt>K)continue;const Ae=e.cells[e.cellKey(yt,st)],rt={top:e.getCellBorderSide(Ae,"top"),right:e.getCellBorderSide(Ae,"right"),bottom:e.getCellBorderSide(Ae,"bottom"),left:e.getCellBorderSide(Ae,"left")};if(Mt)continue;const dt={top:mt(yt,st-1,"bottom"),left:mt(yt-1,st,"right"),bottom:mt(yt,st+1,"top"),right:mt(yt+1,st,"left")},bt=Tt(dt.top,rt.top),Ct=Tt(dt.left,rt.left),wt=Tt(rt.bottom,dt.bottom),fe=Tt(rt.right,dt.right),q=(bt==null?void 0:bt.width)??0,Re=(Ct==null?void 0:Ct.width)??0,Me=(wt==null?void 0:wt.width)??0,Pe=(fe==null?void 0:fe.width)??0;q>0&&(nt.fillStyle=(bt==null?void 0:bt.color)||"#444",nt.fillRect(ve,lt,Ye,q)),Me>0&&(nt.fillStyle=(wt==null?void 0:wt.color)||"#444",nt.fillRect(ve,lt+ze-Me,Ye,Me)),Re>0&&(nt.fillStyle=(Ct==null?void 0:Ct.color)||"#444",nt.fillRect(ve,lt,Re,ze)),Pe>0&&(nt.fillStyle=(fe==null?void 0:fe.color)||"#444",nt.fillRect(ve+Ye-Pe,lt,Pe,ze))}},Ft=(nt,At,R,Ee,$e,st,yt,Mt)=>{R<=0||Ee<=0||(V.save(),V.beginPath(),V.rect(nt,At,R,Ee),V.clip(),V.fillStyle=pe.gridBg,V.fillRect(nt,At,R,Ee),m(V,$e,st,yt,Mt,Go),pn(V,$e,st,yt,Mt),S(V,nt,At,R,Ee),V.restore())};Rt>0&&ft>0&&Ft(ue,X,Rt,ft,0,Wo,0,Po),ft>0&&Ft(Xt,X,Jo,ft,Uo,zt,0,Po),Rt>0&&Ft(ue,jt,Rt,Bo,0,Wo,co,Lt),V.strokeStyle=pe.headerSep,V.lineWidth=1,Rt>0&&(V.beginPath(),V.moveTo(Xt+.5,X),V.lineTo(Xt+.5,K),V.stroke()),ft>0&&(V.beginPath(),V.moveTo(ue,jt+.5),V.lineTo(A,jt+.5),V.stroke()),V.fillStyle=pe.headerBg,V.fillRect(0,0,ue,X),V.strokeStyle=pe.headerSep,V.lineWidth=1,V.strokeRect(.5,.5,ue-.5,X-.5)}const le=t.computed(()=>pt(e.activeCell.value.col)+String(e.activeCell.value.row+1)),L=t.ref(""),g=t.ref(!1),he=t.computed(()=>e.editingCell.value?L.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(s,C)=>{if(s&&!C){const V=e.editValue.value||e.getCellRaw(s.col,s.row)||"";L.value=V,xe=!1}else!s&&C&&(L.value="",g.value=!1,xe=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(L.value="",xe=!1)});function Z(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),d())}function ie(s){const C=s.target.value;e.editingCell.value?e.editValue.value=C:e.startEdit(C),L.value=C,xe=!0}function De(s){var V,Y;const C={...e.activeCell.value};e.editingCell.value?(e.editValue.value=s,e.commitEdit()):((V=e.saveUndo)==null||V.call(e),e.setCellValue(C.col,C.row,s)),L.value="",xe=!1,d(),(Y=o.emitModelData)==null||Y.call(o)}let _e=!1,xe=!1;function we(){var K,ue,X,pe,Fe,It,ut,Dt,ft;if(_e)return;const s=o.formulaBarRef.value,C=!!(s&&typeof document<"u"&&document.activeElement===s);if(!e.editingCell.value&&!C&&!xe)return;const V={...e.activeCell.value},Y=e.editingCell.value?e.editingCell.value.col:V.col,A=e.editingCell.value?e.editingCell.value.row:V.row;if(!e.editingCell.value){const Rt=e.getCellRaw(Y,A),Xt=L.value!==Rt;if(!xe)return;_e=!0,Xt&&((K=e.saveUndo)==null||K.call(e),e.setCellValue(Y,A,L.value),d(),(ue=o.emitModelData)==null||ue.call(o)),(X=o.formulaBarRef.value)==null||X.blur(),L.value="",g.value=!1,xe=!1,t.nextTick(()=>{_e=!1});return}_e=!0,xe?(e.editValue.value=L.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(pe=o.formulaBarRef.value)==null||pe.blur(),L.value="",g.value=!1,xe=!1,d(),o.focusEditInput(),(Fe=o.emitModelData)==null||Fe.call(o),t.nextTick(()=>{_e=!1})):C?(L.value=e.editValue.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(It=o.formulaBarRef.value)==null||It.blur(),L.value="",g.value=!1,xe=!1,d(),o.focusEditInput(),(ut=o.emitModelData)==null||ut.call(o),t.nextTick(()=>{_e=!1})):(e.commitEdit(),(Dt=o.formulaBarRef.value)==null||Dt.blur(),L.value="",g.value=!1,xe=!1,d(),o.focusEditInput(),(ft=o.emitModelData)==null||ft.call(o),t.nextTick(()=>{_e=!1}))}function Te(){var s;_e||(_e=!0,e.editingCell.value&&e.cancelEdit(),(s=o.formulaBarRef.value)==null||s.blur(),L.value="",g.value=!1,xe=!1,d(),o.focusEditInput(),t.nextTick(()=>{_e=!1}))}function et(s){if(!s.isComposing){if(s.key==="Enter"&&(s.altKey||s.metaKey)&&!s.ctrlKey){s.preventDefault(),s.stopPropagation();const C=s.target;if(!C)return;e.editingCell.value||e.startEdit();const V=C.selectionStart??C.value.length,Y=C.selectionEnd??C.value.length,A=C.value,K=A.substring(0,V)+`
7
- `+A.substring(Y),ue=V+1;L.value=K,g.value||(g.value=!0),t.nextTick(()=>{try{C.setSelectionRange(ue,ue)}catch{}if(g.value)try{C.scrollTop=C.scrollHeight}catch{}try{C.focus({preventScroll:!0})}catch{}});return}s.key==="Enter"?(s.preventDefault(),we()):s.key==="Escape"&&(s.preventDefault(),Te())}}function Ve(){we()}const ke=t.ref(null),Be=t.ref("");function Xe(s){ke.value===null&&(o.switchSheet(s),d())}function Ge(s){s!==o.activeSheetIndex.value&&(o.saveSheet(),o.loadSheet(s),d()),ke.value=s,Be.value=o.sheets.value[s].name,t.nextTick(()=>{const C=document.querySelector(".tab-rename-input");C==null||C.focus(),C==null||C.select()})}function oe(){ke.value!==null&&(o.renameSheet(ke.value,Be.value),t.nextTick(()=>o.emitModelData())),ke.value=null,Be.value=""}function ge(){ke.value=null,Be.value=""}function u(s){s.key==="Enter"?(s.preventDefault(),oe()):s.key==="Escape"&&(s.preventDefault(),ge())}const D=t.ref(null);let I=null;function G(){I&&(document.removeEventListener("click",I),I=null)}function $(s,C,V){G();const Y=140,A=V.length*28+8,K=window.innerWidth,ue=window.innerHeight;s+Y>K&&(s-=Y),C+A>ue&&(C-=A),D.value={x:s,y:C,items:V},I=()=>{D.value=null,G()},setTimeout(()=>document.addEventListener("click",I,{once:!0}),0)}const ne=t.ref(!1);function H(s,C){if(C.disabled){ne.value=!1;return}if(!C.children){ne.value=!1;return}const Y=s.currentTarget.querySelector(".context-submenu");if(!Y){ne.value=!1;return}const A=Y.getBoundingClientRect();ne.value=A.right>window.innerWidth}function c(s,C){s.preventDefault(),s.stopPropagation(),$(s.clientX,s.clientY,[{label:T(e.locale.value,"insert"),action:()=>{o.addSheet(),d()}},{label:T(e.locale.value,"copy"),action:()=>{o.dupSheet(C)}},{label:T(e.locale.value,"rename"),action:()=>{Ge(C)}},{label:T(e.locale.value,"delete"),action:()=>{o.removeSheet(C),d()},disabled:o.sheetCount.value<=1},{label:T(e.locale.value,"moveSheetLeft"),action:()=>{o.moveSheet(C,-1)},disabled:C===0},{label:T(e.locale.value,"moveSheetRight"),action:()=>{o.moveSheet(C,1)},disabled:C===o.sheets.value.length-1}])}function y(s){s.preventDefault(),!(s.target.closest(".tab-item")||s.target.closest(".tab-bar__add-btn"))&&$(s.clientX,s.clientY,[{label:T(e.locale.value,"insert"),action:()=>{o.addSheet(),d()}}])}function at(s){s.preventDefault(),e.selectAll(),d(),$(s.clientX,s.clientY,[{label:T(e.locale.value,"cut"),action:()=>{n.cutSelected(),o.emitModelData()}},{label:T(e.locale.value,"copy"),action:()=>n.copyToClipboard()},{label:T(e.locale.value,"paste"),action:()=>{l.saveUndo(),n.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>o.emitModelData())})}},{label:T(e.locale.value,"delete"),action:()=>{l.saveUndo(),n.clearSelected();for(let C=0;C<e.colCount;C++)e.colWidths.value[C]=100;for(let C=0;C<e.rowCount;C++)e.rowHeights.value[C]=void 0;d(),o.emitModelData()}}])}function ee(s,C){s.preventDefault();const V=s.clientX,Y=s.clientY,A=e.selection.value;A&&A.startCol===0&&A.endCol===e.colCount-1&&C>=A.startRow&&C<=A.endRow||(e.selectRange(0,C,e.colCount-1,C,"row"),d());const K=e.selection.value;$(s.clientX,s.clientY,[{label:T(e.locale.value,"insert"),action:()=>{l.saveUndo(),o.insertRows(K.startRow,K.endRow),d(),o.emitModelData()}},{label:T(e.locale.value,"cut"),action:()=>{l.saveUndo(),n.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,K.startRow,K.endRow),d(),o.emitModelData()}},{label:T(e.locale.value,"copy"),action:()=>n.copyRowCol()},{label:T(e.locale.value,"paste"),action:()=>{l.saveUndo(),n.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>o.emitModelData())})}},{label:T(e.locale.value,"delete"),action:()=>{l.saveUndo(),o.deleteRows(K.startRow,K.endRow),d(),o.emitModelData()}},{label:`${T(e.locale.value,"rowHeight")}...`,action:()=>Je("row",V,Y)},{label:T(e.locale.value,"autoRowHeight"),action:()=>o.resetRowHeight()},{label:T(e.locale.value,"freezeToRow"),action:()=>{e.setFreeze(C+1,e.freeze.cols),d()}}])}function p(s,C){s.preventDefault();const V=s.clientX,Y=s.clientY,A=e.selection.value;A&&A.startRow===0&&A.endRow===e.rowCount-1&&C>=A.startCol&&C<=A.endCol||(e.selectRange(C,0,C,e.rowCount-1,"col"),d());const K=e.selection.value,ue=!o.canSortColumns(K.startCol,K.endCol);$(s.clientX,s.clientY,[{label:T(e.locale.value,"insert"),action:()=>{l.saveUndo(),o.insertCols(K.startCol,K.endCol),d(),o.emitModelData()}},{label:T(e.locale.value,"cut"),action:()=>{l.saveUndo(),n.copyRowCol(),e.clearCellsInRange(K.startCol,K.endCol,0,e.rowCount-1),d(),o.emitModelData()}},{label:T(e.locale.value,"copy"),action:()=>n.copyRowCol()},{label:T(e.locale.value,"paste"),action:()=>{l.saveUndo(),n.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>o.emitModelData())})}},{label:T(e.locale.value,"delete"),action:()=>{l.saveUndo(),o.deleteCols(K.startCol,K.endCol),d(),o.emitModelData()}},{label:T(e.locale.value,"sort"),disabled:ue,children:[{label:T(e.locale.value,"sortAsc"),action:()=>{o.prepareSortConfirmation("asc")||o.sortSelectedColumns("asc")},disabled:ue},{label:T(e.locale.value,"sortDesc"),action:()=>{o.prepareSortConfirmation("desc")||o.sortSelectedColumns("desc")},disabled:ue}]},{label:`${T(e.locale.value,"colWidth")}...`,action:()=>Je("col",V,Y)},{label:T(e.locale.value,"defaultColWidth"),action:()=>o.resetColWidth()},{label:T(e.locale.value,"freezeToCol"),action:()=>{e.setFreeze(e.freeze.rows,C+1),d()}}])}function F(s,C,V){s.preventDefault(),e.isSelected(C,V)||(e.selectCell(C,V),d());const Y=e.selection.value,A=!!(Y&&Y.startCol===Y.endCol&&Y.startRow===Y.endRow);$(s.clientX,s.clientY,[{label:T(e.locale.value,"cut"),action:()=>{n.cutSelected(),o.emitModelData()}},{label:T(e.locale.value,"copy"),action:()=>n.copyToClipboard()},{label:T(e.locale.value,"paste"),action:()=>{l.saveUndo(),n.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>o.emitModelData())})}},{label:T(e.locale.value,"delete"),action:()=>{l.saveUndo(),n.clearSelected(),d(),o.emitModelData()}},{label:T(e.locale.value,"calculate"),children:[{label:T(e.locale.value,"sum"),action:n.sumSelected,disabled:A},{label:T(e.locale.value,"avg"),action:n.avgSelected,disabled:A},{label:T(e.locale.value,"count"),action:n.countSelected,disabled:A}]}])}const Ue=t.ref(null),vt=t.ref(null);let ce=null;function We(){ce&&(document.removeEventListener("mousedown",ce),ce=null)}function Je(s,C,V){We();const Y=e.selection.value;let A="";if(Y){const Fe=s==="row"?e.getRowHeight(Y.startRow):e.colWidths.value[Y.startCol];A=Fe!=null&&Fe>0?String(Math.round(Fe)):""}const K=220,ue=118;let X=C,pe=V;X+K>window.innerWidth&&(X=window.innerWidth-K-8),pe+ue>window.innerHeight&&(pe=window.innerHeight-ue-8),X<8&&(X=8),pe<8&&(pe=8),vt.value={type:s,x:X,y:pe,value:A,error:""},ce=()=>{vt.value=null},setTimeout(()=>document.addEventListener("mousedown",ce,{once:!0}),0),t.nextTick(()=>{const Fe=Ue.value;Fe&&(Fe.focus(),Fe.select())})}function gt(s){const C=vt.value;if(!C)return;const V=s.target,Y=V.value,A=Y.replace(/[^\d]/g,"");C.value=A,Y!==A&&(V.value=A),C.error=""}function kt(s){s.key==="Enter"?(s.preventDefault(),Ht()):s.key==="Escape"&&(s.preventDefault(),Kt())}function Vt(){const s=vt.value;if(!s)return;const C=s.value.trim(),V=Number(C),Y=s.type==="row",A=Y?24:30,K=Y?500:1e3;if(C===""||!Number.isFinite(V)){Kt();return}const ue=Math.max(A,Math.min(K,Math.round(V)));s.value=String(ue),s.error=""}function Ht(){const s=vt.value,C=e.selection.value;if(!s||!C)return;const V=s.value.trim(),Y=Number(V),A=s.type==="row",K=A?24:30,ue=A?500:1e3;if(V===""||!Number.isFinite(Y)){s.error=T(e.locale.value,"dimNumberError");return}if(Y<K||Y>ue){s.error=T(e.locale.value,"dimRangeError").replace("{min}",String(K)).replace("{max}",String(ue));return}const X=Y;if(l.saveUndo(),A)for(let pe=C.startRow;pe<=C.endRow;pe++)e.rowHeights.value[pe]=X;else for(let pe=C.startCol;pe<=C.endCol;pe++)e.colWidths.value[pe]=X;d(),o.emitModelData(),Kt()}function Kt(){We(),vt.value=null}const lo=t.computed(()=>{const s=!e.editingCell.value,C=e.editingCell.value??e.activeCell.value,V=C.col,Y=C.row,A=e.resolveStyle(e.cells[e.cellKey(V,Y)]),K=e.cellFontSize(V,Y),ue=typeof(A==null?void 0:A.fontFamily)=="string"&&A.fontFamily?A.fontFamily:Xo,X=(A==null?void 0:A.fontWeight)==="bold"?"bold":"normal",pe=(A==null?void 0:A.fontStyle)==="italic"?"italic":"normal",Fe=(A==null?void 0:A.underline)==="underline"?"underline":(A==null?void 0:A.strikethrough)==="line-through"?"line-through":"none",It=(A==null?void 0:A.underline)==="underline"&&(A==null?void 0:A.strikethrough)==="line-through"?"underline line-through":Fe,ut=typeof(A==null?void 0:A.color)=="string"?A.color:void 0,Dt=typeof(A==null?void 0:A.backgroundColor)=="string"?A.backgroundColor:void 0,ft=typeof(A==null?void 0:A.numberFormat)=="string"?A.numberFormat:"",Rt=e.editValue.value??e.getCellValue(V,Y),Xt=typeof(A==null?void 0:A.textAlign)=="string"?A.textAlign:Rn(Rt,ft)?"right":"left",jt=typeof(A==null?void 0:A.verticalAlign)=="string"?A.verticalAlign:"top",Jo=e.findMerge(V,Y),Bo=Jo?e.rowPositions.value[Jo.range.endRow+1]-e.rowPositions.value[Y]:e.getRowHeight(Y),Wo=2,{ascent:Po,descent:bo}=e.measureFontMetrics(ue,K,X,pe),Ko=Po+bo,mo=(e.editValue.value?e.editValue.value.split(`
8
- `).length:1)*Ko,Co=e.BASE_CELL_VPAD-Wo;let zt=0,eo=0;jt==="middle"?(zt=Math.floor((Bo-mo)/2),eo=Math.max(0,Bo-mo-zt)):jt==="top"?(zt=Co,eo=Math.max(0,Bo-mo-zt)):jt==="bottom"&&(eo=Co,zt=Math.max(0,Bo-mo-eo));const Lt=e.cellToScreenRect(Y,V);return{left:`${Lt.x}px`,top:`${Lt.y}px`,width:`${Lt.width}px`,height:`${Lt.height}px`,fontFamily:ue,fontSize:`${K}px`,lineHeight:1,fontWeight:X,fontStyle:pe,textDecoration:It,textAlign:Xt,paddingTop:`${zt}px`,paddingRight:"3px",paddingBottom:`${eo}px`,paddingLeft:"3px",opacity:s?0:1,pointerEvents:s?"none":"auto",color:s?"transparent":ut,caretColor:s?"transparent":void 0,borderColor:s?"transparent":void 0,background:s?"transparent":Dt,boxShadow:s?"none":void 0}});function Wt(){return Math.max(0,o.viewSize.w-52-11)}function yo(){return Math.max(0,o.viewSize.h-24-11)}const ro=t.computed(()=>Math.max(0,Wt()-e.getFrozenMetrics().frozenColumnsWidth)),Yt=t.computed(()=>Math.max(0,yo()-e.getFrozenMetrics().frozenRowsHeight)),Mo=t.computed(()=>52+e.getFrozenMetrics().frozenColumnsWidth),xo=t.computed(()=>24+e.getFrozenMetrics().frozenRowsHeight),qt=t.computed(()=>Math.max(0,ro.value-11*2)),ao=t.computed(()=>Math.max(0,Yt.value-11*2)),uo=t.computed(()=>o.maxScrollX.value<=0?qt.value:Math.max(24,ro.value/e.totalWidth.value*qt.value)),fo=t.computed(()=>o.maxScrollX.value<=0?0:e.scrollX.value/o.maxScrollX.value*(qt.value-uo.value)),io=t.computed(()=>o.maxScrollY.value<=0?ao.value:Math.max(24,Yt.value/e.totalHeight.value*ao.value)),x=t.computed(()=>o.maxScrollY.value<=0?0:e.scrollY.value/o.maxScrollY.value*(ao.value-io.value));let M=null,N=0,te=0;function me(s){s.preventDefault(),M="v",N=s.clientY,te=e.scrollY.value,document.addEventListener("mousemove",ye),document.addEventListener("mouseup",ae)}function Ce(s){s.preventDefault(),M="h",N=s.clientX,te=e.scrollX.value,document.addEventListener("mousemove",ye),document.addEventListener("mouseup",ae)}function ye(s){if(M==="v"){const V=(s.clientY-N)/(ao.value-io.value);o.clampScroll(null,te+V*o.maxScrollY.value),d()}else if(M==="h"){const V=(s.clientX-N)/(qt.value-uo.value);o.clampScroll(te+V*o.maxScrollX.value,null),d()}}function ae(){M=null,document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",ae)}function W(s){if(M)return;const C=s.currentTarget.getBoundingClientRect(),V=s.clientY-C.top;V<x.value?o.clampScroll(null,e.scrollY.value-yo()):V>x.value+io.value&&o.clampScroll(null,e.scrollY.value+yo()),d()}function Oe(s){if(M)return;const C=s.currentTarget.getBoundingClientRect(),V=s.clientX-C.left;V<fo.value?o.clampScroll(e.scrollX.value-Wt(),null):V>fo.value+uo.value&&o.clampScroll(e.scrollX.value+Wt(),null),d()}let He=!1,P=0,Ne=0,ot=!1,b=!1,z=0,_=0,se=0,de=0,re=0,be=0,Le=0,it=0,ht=!1,xt=!1,Bt=0,Nt=0,Qe="cell",w=0,B=-1,O=-1;function U(s){if(s.button!==0)return;s.preventDefault(),D.value=null;const C=Zo(s,o.canvasRef.value);if(C.y<24&&C.x>=52){const K=C.x-52+e.scrollX.value,ue=k(C.x),X=ue>=0?e.cellToScreenRect(0,ue).x+e.colWidths.value[ue]:-1;if(ue>=0&&Math.abs(C.x-X)<=4){l.saveUndo(),ot=!0,z=ue,se=e.colWidths.value[ue],de=K,d();return}}if(C.x<52&&C.y>=24){const K=C.y-24+e.scrollY.value,ue=v(C.y),X=ue>=0?e.cellToScreenRect(ue,0).y+e.getRowHeight(ue):-1;if(ue>=0&&Math.abs(C.y-X)<=4){l.saveUndo(),b=!0,_=ue,se=e.getRowHeight(ue),de=K,d();return}}if(C.x<52||C.y<24){{const K=o.formulaBarRef.value,ue=!!(K&&typeof document<"u"&&document.activeElement===K);(e.editingCell.value||ue||xe)&&we()}if(C.y<24&&C.x>=52){const K=k(C.x);K>=0&&(e.selectRange(K,0,K,e.rowCount-1,"col"),He=!0,P=K,Ne=0)}else if(C.x<52&&C.y>=24){const K=v(C.y);K>=0&&(e.selectRange(0,K,e.colCount-1,K,"row"),He=!0,P=0,Ne=K)}else C.x<52&&C.y<24&&e.selectAll();d();return}const V=e.screenToCell(C.x,C.y);if(!V)return;const Y=V.col,A=V.row;{const K=o.formulaBarRef.value,ue=!!(K&&typeof document<"u"&&document.activeElement===K);(e.editingCell.value||ue||xe)&&we()}if(s.shiftKey&&e.selection.value){const K=e.selection.value;e.selectRange(K.startCol,K.startRow,Y,A)}else e.selectCell(Y,A);He=!0,P=Y,Ne=A,o.focusEditInput(),d()}function Q(s){if(ot){const ue=Zo(s,o.canvasRef.value).x-52+e.scrollX.value-de,X=se+ue;X>=30&&X<=1e3?e.colWidths.value[z]=X:X<30?e.colWidths.value[z]=30:e.colWidths.value[z]=1e3,d();return}if(b){const ue=Zo(s,o.canvasRef.value).y-24+e.scrollY.value-de,X=se+ue;X>=24&&X<=500?e.rowHeights.value[_]=X:X<24?e.rowHeights.value[_]=24:e.rowHeights.value[_]=500,d();return}if(!He){const K=o.canvasRef.value;if(!K)return;if(l.paintFmt.value){K.style.cursor="copy";return}const ue=Zo(s,K);if(ue.y<24&&ue.x>=52){const X=k(ue.x),pe=X>=0?e.cellToScreenRect(0,X).x+e.colWidths.value[X]:-1;if(X>=0&&Math.abs(ue.x-pe)<=4){K.style.cursor="col-resize";return}}if(ue.x<52&&ue.y>=24){const X=v(ue.y),pe=X>=0?e.cellToScreenRect(X,0).y+e.getRowHeight(X):-1;if(X>=0&&Math.abs(ue.y-pe)<=4){K.style.cursor="row-resize";return}}K.style.cursor="cell";return}const C=Zo(s,o.canvasRef.value);if(P<0||Ne<0)return;if(C.x<52||C.y<24){if(C.y<24&&C.x>=52){const K=k(C.x);K>=0&&e.selectRange(Math.min(P,K),0,Math.max(P,K),e.rowCount-1,"col")}else if(C.x<52&&C.y>=24){const K=v(C.y);K>=0&&e.selectRange(0,Math.min(Ne,K),e.colCount-1,Math.max(Ne,K),"row")}d();return}const V=e.screenToCell(C.x,C.y);if(!V)return;const Y=V.col,A=V.row;Ne===0&&P>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(P,Y),0,Math.max(P,Y),e.rowCount-1,"col"):P===0&&Ne>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(Ne,A),e.colCount-1,Math.max(Ne,A),"row"):e.selectRange(P,Ne,Y,A),d()}function Se(s){const C=ot||b;He=!1,ot=!1,b=!1,C&&o.scheduleOptEmit(),l.paintFmt.value&&l.applyPaintFormat()}function Ie(){const s=ot||b;He=!1,ot=!1,b=!1,s&&o.scheduleOptEmit()}function Ke(s){s.preventDefault();const C=Zo(s,o.canvasRef.value);if(C.x<52&&C.y<24){at(s);return}if(C.y<24&&C.x>=52){const V=k(C.x);V>=0&&p(s,V);return}if(C.x<52&&C.y>=24){const V=v(C.y);V>=0&&ee(s,V);return}if(C.x>=52&&C.y>=24){const V=e.screenToCell(C.x,C.y);V&&F(s,V.col,V.row)}}function tt(s){const C=Zo(s,o.canvasRef.value);if(C.x<52||C.y<24)return;const V=e.screenToCell(C.x,C.y);if(!V)return;const Y=V.col,A=V.row;{const K=o.formulaBarRef.value,ue=!!(K&&typeof document<"u"&&document.activeElement===K);(e.editingCell.value||ue||xe)&&we()}e.selectCell(Y,A),e.ensureVisible(Y,A),e.startEdit(),d(),o.focusEditInput()}function je(s){const C=e.scrollX.value+s.deltaX,V=e.scrollY.value+s.deltaY,Y=40,A=o.maxScrollX.value,K=o.maxScrollY.value;if(C>=A-Y&&s.deltaX>0||V>=K-Y&&s.deltaY>0){const ue=Math.max(0,o.viewSize.w-28-11),X=Math.max(0,o.viewSize.h-28-11),pe=Math.max(0,Math.ceil((C+ue)/100)+2),Fe=Math.max(0,Math.ceil((V+X)/24)+2);e.ensureCapacity(pe,Fe)}o.clampScroll(C,V),d()}function qe(s){if(s.touches.length!==1){ht=!1;return}const C=s.touches[0],V=o.canvasRef.value;if(!V)return;const Y=V.getBoundingClientRect(),A=C.clientX-Y.left,K=C.clientY-Y.top;A>=52&&K>=24?(s.preventDefault(),ht=!0,xt=!1,Qe="cell",re=A,be=K,Le=e.scrollX.value,it=e.scrollY.value,Bt=k(A),Nt=v(K)):A>=0&&K>=0&&(A<52||K<24)&&(s.preventDefault(),ht=!0,xt=!1,re=A,be=K,Le=e.scrollX.value,it=e.scrollY.value,K<24&&A>=52?(Qe="col",Bt=k(A),Nt=-1):A<52&&K>=24?(Qe="row",Nt=v(K),Bt=-1):(Qe="all",Bt=-1,Nt=-1))}function Ot(s){if(!ht||s.touches.length!==1)return;const C=s.touches[0],V=o.canvasRef.value;if(!V)return;const Y=V.getBoundingClientRect(),A=C.clientX-Y.left,K=C.clientY-Y.top;(Math.abs(A-re)>8||Math.abs(K-be)>8)&&(xt=!0,s.preventDefault(),o.clampScroll(Le+(re-A),it+(be-K)),d())}function ct(){if(ht&&(ht=!1,!xt))if(Qe==="cell"&&Bt>=0&&Nt>=0){const s=Date.now();Bt===B&&Nt===O&&s-w<300?(e.selectCell(Bt,Nt),e.startEdit(),d(),o.focusEditInput(),w=0):(e.commitEdit(),e.selectCell(Bt,Nt),d(),w=s),B=Bt,O=Nt,o.focusEditInput()}else Qe==="col"&&Bt>=0?(e.commitEdit(),e.selectRange(Bt,0,Bt,e.rowCount-1,"col"),d()):Qe==="row"&&Nt>=0?(e.commitEdit(),e.selectRange(0,Nt,e.colCount-1,Nt,"row"),d()):Qe==="all"&&(e.commitEdit(),e.selectAll(),d())}function St(s){return s.isComposing||s.key==="Process"||s.keyCode===229}function Ut(s){return s.key.length===1&&!s.ctrlKey&&!s.metaKey&&!s.altKey}function zo(s){if(e.editingCell.value)return;const C=s.ctrlKey||s.metaKey,V=s.shiftKey;switch(!0){case(C&&(s.key==="c"||s.key==="C")):s.preventDefault(),n.copyToClipboard();return;case(C&&(s.key==="x"||s.key==="X")):s.preventDefault(),n.cutSelected();return;case(C&&(s.key==="z"||s.key==="Z")):s.preventDefault(),l.undo();return;case(C&&(s.key==="y"||s.key==="Y")):s.preventDefault(),l.redo();return;case(C&&(s.key==="v"||s.key==="V")):s.preventDefault(),l.saveUndo(),n.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>o.emitModelData())});return;case(C&&(s.key==="a"||s.key==="A")):s.preventDefault(),e.selectAll(),d();return;case(C&&s.key==="Home"):s.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),d();return;case(C&&s.key==="End"):s.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),d();return;case s.key==="Home":s.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),d();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),d();return;case s.key==="ArrowUp":s.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="ArrowDown":s.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="ArrowLeft":s.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="ArrowRight":s.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="Tab":s.preventDefault(),e.moveActive(V?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="Enter":s.preventDefault(),e.moveActive(0,V?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="F2":s.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),d(),o.focusEditInput();return;case s.key==="Delete":case s.key==="Backspace":s.preventDefault(),l.saveUndo(),n.clearSelected(),d();return;case s.key==="Escape":s.preventDefault(),e.cancelEdit(),l.paintFmt.value=null,d();return;case Ut(s):if(St(s)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),d(),o.focusEditInput();return}s.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(s.key),d(),t.nextTick(()=>{const Y=o.editInputRef.value;Y&&(Y.focus(),Y.setSelectionRange(1,1))});return}}let Jt=!1,Lo=!1;function ln(s){const C=s.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(C),L.value=C,d();return}e.editValue.value=C,L.value=C}function $o(){Jt=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),L.value="",d())}function Hn(s){Jt=!1,Lo=!0,setTimeout(()=>{Lo=!1},0);const C=s.target.value;e.editValue.value=C,L.value=C}function _o(s){if(!e.editingCell.value){if(Ut(s)||St(s))return;zo(s);return}if(!(Jt||St(s))&&!(Lo&&(s.key==="Enter"||s.key==="Escape")))if(s.key==="Enter"&&(s.altKey||s.metaKey)){s.preventDefault();const C=o.editInputRef.value;if(!C)return;const V=C.selectionStart??C.value.length,Y=C.selectionEnd??C.value.length,A=C.value,K=A.slice(0,V)+`
9
- `+A.slice(Y);e.editValue.value=K,C.value=K,C.selectionStart=C.selectionEnd=V+1,d()}else s.key==="Enter"?(s.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d(),o.focusEditInput()):s.key==="Tab"?(s.preventDefault(),e.commitEdit(),e.moveActive(s.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d(),o.focusEditInput()):s.key==="Escape"&&(s.preventDefault(),e.cancelEdit(),d(),o.focusEditInput())}function rn(s){e.editingCell.value}function fn(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),d())},0)}let Qt=null;function mn(){var C;const s=(C=o.wrapperRef.value)==null?void 0:C.getBoundingClientRect();if(s){const V=jo(e.props.width),Y=jo(e.props.height);V!=null?o.viewSize.w=V:o.viewSize.w=s.width,Y!=null?o.viewSize.h=Y:o.viewSize.h=s.height}o.clampScroll(null,null),d()}function rs(){t.onMounted(()=>{const s=jo(e.props.width),C=jo(e.props.height);(s==null||C==null)&&(Qt=new ResizeObserver(()=>mn()),o.wrapperRef.value&&Qt.observe(o.wrapperRef.value)),t.nextTick(()=>{mn(),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(V=>{const Y=o.mkSheet(V.name,{colCount:V.colCount,rowCount:V.rowCount}),{cells:A,styles:K}=cl(V.cells);if(Object.assign(Y.cells,A),Y.styles=V.styles??K,V.borders)Y.borders=V.borders;else{const ue=sl(Y.styles);Y.styles=ue.styles,Y.borders=ue.borders}if(V.colWidths)for(const[ue,X]of Object.entries(V.colWidths)){const pe=Number(ue);pe>=0&&pe<(Y.colCount??e.colCount)&&X>=30&&(Y.colWidths[pe]=X)}if(V.rowHeights)for(const[ue,X]of Object.entries(V.rowHeights)){const pe=Number(ue);pe>=0&&pe<(Y.rowCount??e.rowCount)&&X>=24&&(Y.rowHeights[pe]=X)}if(V.merges)for(const[ue,X]of Object.entries(V.merges))Y.merges[ue]={...X};return Y.freeze=V.freeze?{rows:V.freeze.rows,cols:V.freeze.cols}:{rows:0,cols:0},Y}),o.sheets.value.length>0&&o.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const s=jo(e.props.width),C=jo(e.props.height);s!=null&&C!=null?(Qt==null||Qt.disconnect(),Qt=null):!Qt&&o.wrapperRef.value&&(Qt=new ResizeObserver(()=>mn()),Qt.observe(o.wrapperRef.value)),t.nextTick(()=>mn())}),t.watch(()=>e.props.theme,()=>d()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>o.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>o.emitModelData()),d()},{deep:!1}),t.watch(o.activeSheetIndex,()=>t.nextTick(()=>o.emitModelData())),t.watch(()=>o.modelData.value,s=>{if(!s||s.length===0)return;const C=JSON.stringify(s);if(C===a.value)return;a.value=C;const V=e.selection.value?{...e.selection.value}:null,Y={...e.activeCell.value};o.sheets.value=s.map(X=>{const pe=o.mkSheet(X.name),{cells:Fe,styles:It}=cl(X.cells);if(Object.assign(pe.cells,Fe),pe.styles=X.styles??It,X.borders)pe.borders=X.borders;else{const ut=sl(pe.styles);pe.styles=ut.styles,pe.borders=ut.borders}if(X.colWidths)for(const[ut,Dt]of Object.entries(X.colWidths)){const ft=Number(ut);ft>=0&&ft<e.colCount&&Dt>=30&&(pe.colWidths[ft]=Dt)}if(X.rowHeights)for(const[ut,Dt]of Object.entries(X.rowHeights)){const ft=Number(ut);ft>=0&&ft<e.rowCount&&Dt>=24&&(pe.rowHeights[ft]=Dt)}if(X.merges)for(const[ut,Dt]of Object.entries(X.merges))pe.merges[ut]={...Dt};return pe.freeze=X.freeze?{rows:X.freeze.rows,cols:X.freeze.cols}:{rows:0,cols:0},pe}),o.sheets.value.length>0&&o.loadSheet(0),V&&(e.selection.value=V),e.activeCell.value=Y;const A=e.activeCell.value,K=e.selection.value,ue=e.findMerge(A.col,A.row);ue&&ue.anchor===e.cellKey(A.col,A.row)&&(!K||K.startCol===A.col&&K.startRow===A.row&&K.endCol===A.col&&K.endRow===A.row)&&e.selectCell(A.col,A.row),d()},{deep:!0}),t.onBeforeUnmount(()=>{Qt==null||Qt.disconnect()})}return{scheduleRender:d,render:J,renderFrozenOverlay:j,activeCellLabel:le,formulaBarDisplay:he,formulaBarDraft:L,formulaBarExpanded:g,onFormulaBarFocus:Z,onFormulaBarInput:ie,onFormulaBarKeydown:et,onFormulaBarBlur:Ve,acceptFormulaBarEdit:we,cancelFormulaBarEdit:Te,insertFunctionIntoCell:De,renTab:ke,renTabVal:Be,onTabClick:Xe,onTabDblClick:Ge,commitTabRename:oe,cclTabRename:ge,onTabRenameKd:u,ctxMenu:D,ctxSubmenuLeft:ne,onCtxItemEnter:H,onTabCtxMenu:c,onTabBarCtx:y,onCornerCtx:at,onRowHdrCtx:ee,onColHdrCtx:p,onCellCtx:F,dimInputRef:Ue,dimPanel:vt,openDimPanel:Je,onDimInput:gt,onDimKeydown:kt,onDimBlur:Vt,applyDimPanel:Ht,closeDimPanel:Kt,editInputStyle:lo,hScrollbarW:ro,vScrollbarH:Yt,hScrollbarLeft:Mo,vScrollbarTop:xo,hTrackW:qt,vTrackH:ao,hThumbW:uo,hThumbL:fo,vThumbH:io,vThumbT:x,onVStart:me,onHStart:Ce,onSbMove:ye,onSbUp:ae,onVTrk:W,onHTrk:Oe,onMouseDown:U,onMouseMove:Q,onMouseUp:Se,onMouseLeave:Ie,onCanvasCtx:Ke,onDblClick:tt,onWheel:je,onTouchStart:qe,onTouchMove:Ot,onTouchEnd:ct,onKeydown:zo,onEditInput:ln,onEditCompositionStart:$o,onEditCompositionEnd:Hn,onEditKd:_o,onEditPaste:rn,onEditBlur:fn,applySize:mn,setupLifecycle:rs}}function Hc(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ml(e,l,n,o){return l?o?n?e===l:e.toLowerCase()===l.toLowerCase():n?e.includes(l):e.toLowerCase().includes(l.toLowerCase()):!1}function zc(e,l,n,o){if(!l)return e;if(o){const i=e.indexOf(l);return i<0?e:e.slice(0,i)+n+e.slice(i+l.length)}const a=e.toLowerCase().indexOf(l.toLowerCase());return a<0?e:e.slice(0,a)+n+e.slice(a+l.length)}function Lc(e,l,n,o){return l?o?e.indexOf(l)<0?e:e.split(l).join(n):e.toLowerCase().indexOf(l.toLowerCase())<0?e:e.replace(new RegExp(Hc(l),"gi"),()=>n):e}function On(e,l,n,o,a,i,r){const f=[];if(r){for(let m=r.startRow;m<=r.endRow;m++)for(let h=r.startCol;h<=r.endCol;h++){const S=e[n(h,m)];S&&ml(S.value,o,a,i)&&f.push({sheetIndex:l,col:h,row:m})}return f}for(const m in e){const h=e[m];if(h&&ml(h.value,o,a,i)){const S=m.split(","),d=Number(S[0]),k=Number(S[1]);!Number.isNaN(d)&&!Number.isNaN(k)&&f.push({sheetIndex:l,col:d,row:k})}}return f}function $c(e,l,n,o){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),f=t.ref("sheet"),m=t.ref(!1),h=t.ref(!1),S=t.ref(-1),d=t.ref([]),k=t.ref(""),v=t.ref(0),E=t.ref(""),J=t.computed(()=>{const oe=new Set,ge=n.activeSheetIndex.value;for(const u of d.value)u.sheetIndex===ge&&oe.add(`${u.col},${u.row}`);return oe}),j=t.computed(()=>{if(S.value<0||S.value>=d.value.length)return null;const oe=d.value[S.value];return oe.sheetIndex!==n.activeSheetIndex.value?null:`${oe.col},${oe.row}`});e.findHighlight=(oe,ge)=>{const u=`${oe},${ge}`;return j.value===u?"active":J.value.has(u)?"match":null};function le(oe){var D,I;const ge=e.cellKey(oe.col,oe.row);if(oe.sheetIndex===n.activeSheetIndex.value)return((D=e.cells[ge])==null?void 0:D.value)??"";const u=n.sheets.value[oe.sheetIndex];return((I=u==null?void 0:u.cells[ge])==null?void 0:I.value)??""}function L(oe,ge){const u=e.cellKey(oe.col,oe.row);if(oe.sheetIndex===n.activeSheetIndex.value)e.setCellValue(oe.col,oe.row,ge);else{const D=n.sheets.value[oe.sheetIndex];if(!D)return;const I=D.cells[u];D.cells[u]={value:String(ge),styleId:I==null?void 0:I.styleId}}}function g(){if(E.value){k.value=E.value;return}if(!i.value){k.value="";return}if(f.value==="selection"&&!e.selection.value){k.value=T(e.locale.value,"findNeedSelection");return}if(d.value.length===0){k.value=T(e.locale.value,"findNoResult");return}k.value=""}function he(){const oe=i.value,ge=[];if(oe)if(f.value==="workbook")n.sheets.value.forEach((u,D)=>{ge.push(...On(u.cells,D,e.cellKey,oe,m.value,h.value))});else if(f.value==="selection"){const u=e.selection.value;u&&ge.push(...On(e.cells,n.activeSheetIndex.value,e.cellKey,oe,m.value,h.value,u))}else ge.push(...On(e.cells,n.activeSheetIndex.value,e.cellKey,oe,m.value,h.value));d.value=ge,ge.length===0?S.value=-1:S.value>=ge.length?S.value=ge.length-1:S.value<0&&(S.value=0),g()}function Z(){if(S.value<0||S.value>=d.value.length)return;const oe=d.value[S.value];oe.sheetIndex!==n.activeSheetIndex.value&&n.switchSheet(oe.sheetIndex),f.value==="selection"?e.activeCell.value={col:oe.col,row:oe.row}:e.selectCell(oe.col,oe.row),e.ensureVisible(oe.col,oe.row)}const ie=typeof requestAnimationFrame=="function"?requestAnimationFrame:oe=>setTimeout(oe,16);let De=!1,_e=!1;function xe(oe){if(De){_e=_e||oe;return}De=!0,_e=oe,ie(()=>{var ge;De=!1,he(),_e&&d.value.length>0&&S.value>=0&&Z(),_e=!1,(ge=e.scheduleRender)==null||ge.call(e)})}function we(){var oe;a.value=!0,v.value++,he(),d.value.length>0&&(S.value=0,Z()),(oe=e.scheduleRender)==null||oe.call(e)}function Te(){we()}function et(){var oe;a.value=!1,d.value=[],S.value=-1,E.value="",k.value="",(oe=e.scheduleRender)==null||oe.call(e)}function Ve(){var oe;d.value.length!==0&&(S.value=(S.value+1)%d.value.length,Z(),(oe=e.scheduleRender)==null||oe.call(e))}function ke(){var oe;d.value.length!==0&&(S.value=(S.value-1+d.value.length)%d.value.length,Z(),(oe=e.scheduleRender)==null||oe.call(e))}function Be(){var I,G;if(S.value<0||S.value>=d.value.length)return;const oe=d.value[S.value],ge=le(oe),u=zc(ge,i.value,r.value,m.value);if(u===ge)return;l.saveUndo(),L(oe,u);const D=S.value;he(),d.value.length>0?(S.value=Math.min(D,d.value.length-1),Ve()):S.value=-1,(I=e.emitModelData)==null||I.call(e),(G=e.scheduleRender)==null||G.call(e)}function Xe(){var D,I;const oe=i.value;if(!oe||d.value.length===0)return;l.saveUndo();let ge=0;const u=d.value.slice();for(const G of u){const $=le(G),ne=Lc($,oe,r.value,m.value);ne!==$&&(L(G,ne),ge++)}d.value=[],S.value=-1,E.value=T(e.locale.value,"findReplacedAll").replace("{n}",String(ge)),g(),(D=e.emitModelData)==null||D.call(e),(I=e.scheduleRender)==null||I.call(e)}function Ge(){const oe=ge=>{if(!(ge.ctrlKey||ge.metaKey))return;const D=ge.key.toLowerCase();(D==="f"||D==="h")&&(ge.preventDefault(),we())};window.addEventListener("keydown",oe),t.onBeforeUnmount(()=>window.removeEventListener("keydown",oe))}return t.watch(i,()=>{a.value&&(E.value="",S.value=0,xe(!0))}),t.watch([f,m,h],()=>{a.value&&(E.value="",S.value=0,xe(!0))}),t.watch(e.cells,()=>{a.value&&xe(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&f.value==="selection"&&(S.value=0,xe(!0))}),t.watch([()=>l.undoStack.value.length,()=>l.redoStack.value.length],()=>{a.value&&xe(!1)}),{open:a,findText:i,replaceText:r,scope:f,matchCase:m,matchEntireCell:h,currentIndex:S,results:d,message:k,focusToken:v,activeSheetMatches:J,activeMatchKey:j,openFind:we,openReplace:Te,close:et,recompute:he,findNext:Ve,findPrev:ke,replace:Be,replaceAll:Xe,setupLifecycle:Ge}}const _c={class:"formula-bar__cell-label"},Wc={class:"formula-bar__buttons"},Pc=["title","aria-label"],Kc=["rows","value"],Uc=["title"],Gc={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Yc={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Xc=["value"],jc={key:2,class:"sb-corner"},Zc=["onClick","onMouseenter"],qc={class:"context-menu__label"},Jc={key:0,class:"context-menu__arrow",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"22869"},Qc=["onClick"],es={class:"dim-panel__title"},ts={class:"dim-panel__body"},os=["value"],ns={key:0,class:"dim-panel__error"},ls={class:"dim-panel__footer"},pl=Zt(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 l=e,n=t.useModel(e,"data"),o={value:""},a=xc(l,{rowCount:l.rowCount,colCount:l.colCount,theme:l.theme,locale:l.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:H=>{},mkSheet:H=>({id:"",name:H,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}})},r=Bc(a,i),f=Tc(a,r);Dc(r,{borderMenuOpen:f.borderMenuOpen,mergeMenuOpen:f.mergeMenuOpen});const m=Vc(a,r,n,void 0,o);i.sheets=m.sheets,i.activeSheetIndex=m.activeSheetIndex,i.saveSheet=m.saveSheet,i.loadSheet=m.loadSheet,i.mkSheet=m.mkSheet;const h=Oc(a,r,f,m,o);h.setupLifecycle();const S=$c(a,r,m);S.setupLifecycle();const d=t.reactive(a),k=t.reactive(r),v=t.reactive(f),E=t.reactive(m),J=m.sheets,j=m.activeSheetIndex,le=m.sortMenuOpen,L=m.cachedSortOrder,g=t.reactive(h),he=t.reactive(S),Z=t.computed(()=>{const H=d.selection;return!!H&&H.startCol===H.endCol&&H.startRow===H.endRow}),ie=t.computed(()=>{const H=d.selection;return H?m.canSortColumns(H.startCol,H.endCol):!1}),De=t.computed(()=>{const H=k.selNumberFormat;if(H!==ho&&H!==Eo)return H;const c=d.activeCell,y=a.resolveStyle(d.cells[d.cellKey(c.col,c.row)]);return typeof(y==null?void 0:y.numberFormat)=="string"?y.numberFormat:""});function _e(H){r.nfDialogOpen.value=H}const xe=t.ref(!1);function we(){xe.value=!0}function Te(H){xe.value=H}function et(H){h.insertFunctionIntoCell(H)}function Ve(H){const c=d.freeze;if(H==="panes"){const y=d.selection,at=y?y.startRow:d.activeCell.row,ee=y?y.startCol:d.activeCell.col;d.setFreeze(at,ee)}else H==="firstRow"?d.setFreeze(1,c.cols):H==="firstCol"?d.setFreeze(c.rows,1):H==="unfreeze"&&d.clearFreeze();g.scheduleRender()}function ke(H){r.fontSizeMenuOpen.value=H}function Be(H){r.textColorMenuOpen.value=H}function Xe(H){r.fillColorMenuOpen.value=H}function Ge(H){h.renTabVal.value=H}function oe(){h.ctxMenu.value=null}const ge=H=>{m.formulaBarRef.value=H};function u(){h.formulaBarExpanded.value=!h.formulaBarExpanded.value}const D=H=>{m.wrapperRef.value=H},I=H=>{m.canvasRef.value=H},G=H=>{m.freezeCanvasRef.value=H},$=H=>{m.editInputRef.value=H},ne=H=>{h.dimInputRef.value=H};return(H,c)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(E.outerStyle)},[t.createVNode(Ga,{locale:d.locale,"can-undo":k.canUndo,"can-redo":k.canRedo,"paint-fmt-active":k.paintFmt!==null,"has-selection":k.hasSelection,"font-family-options":k.fontFamilyOptions,"font-size-options":k.fontSizeOptions,"sel-font-family":k.selFontFamily,"sel-font-size":k.selFontSize,"font-size-input":k.fontSizeInput,"font-size-menu-open":k.fontSizeMenuOpen,"sel-font-weight":k.selFontWeight,"sel-font-style":k.selFontStyle,"sel-underline":k.selUnderline,"sel-strikethrough":k.selStrikethrough,"sel-text-color":k.selTextColor,"text-color-menu-open":k.textColorMenuOpen,"sel-fill-color":k.selFillColor,"fill-color-menu-open":k.fillColorMenuOpen,"cached-text-color":k.cachedTextColor,"cached-fill-color":k.cachedFillColor,"border-menu-open":v.borderMenuOpen,"cached-border":v.cachedBorder,"sort-menu-open":t.unref(le),"cached-sort-order":t.unref(L),"can-sort":ie.value,"h-align-options":k.hAlignOptions,"v-align-options":k.vAlignOptions,"sel-h-align":k.selHAlign,"sel-v-align":k.selVAlign,"sel-wrap":k.selWrap,"merge-menu-open":v.mergeMenuOpen,"calc-menu-open":v.calcMenuOpen,"is-single-cell":Z.value,"has-freeze":d.freeze.rows>0||d.freeze.cols>0,"sel-number-format":k.selNumberFormatDisplay,"nf-options":k.nfOptions,"can-increase-decimals":k.canIncreaseDecimals,"can-decrease-decimals":k.canDecreaseDecimals,"theme-vars":E.toolbarThemeVars,onUndo:c[0]||(c[0]=y=>k.undo()),onRedo:c[1]||(c[1]=y=>k.redo()),onPaintFormat:k.onPaintFormat,onClearFormat:c[2]||(c[2]=y=>k.clearFormat()),onNumberFormatChange:c[3]||(c[3]=y=>k.onNumberFormatChange(y)),onIncreaseDecimals:k.onIncreaseDecimals,onDecreaseDecimals:k.onDecreaseDecimals,onFontFamilyChange:c[4]||(c[4]=y=>k.onFontFamilyChange(y)),onFontSizeInput:c[5]||(c[5]=y=>k.onFontSizeInput(y)),onFontSizeBlur:k.onFontSizeBlur,onFontSizeKeydown:c[6]||(c[6]=y=>k.onFontSizeKeydown(y)),onFontSizeChange:c[7]||(c[7]=y=>k.onFontSizeChange(y)),"onUpdate:fontSizeMenuOpen":c[8]||(c[8]=y=>ke(y)),onFontSizeToggle:c[9]||(c[9]=y=>k.toggleFontSizeMenu()),onFontSizeStepUp:k.onFontSizeStepUp,onFontSizeStepDown:k.onFontSizeStepDown,onBoldToggle:k.toggleFontWeight,onItalicToggle:k.toggleFontStyle,onUnderlineToggle:k.toggleUnderline,onStrikethroughToggle:k.toggleStrikethrough,onTextColorChange:c[10]||(c[10]=y=>k.onTextColorChange(y)),"onUpdate:textColorMenuOpen":c[11]||(c[11]=y=>Be(y)),onFillColorChange:c[12]||(c[12]=y=>k.onFillColorChange(y)),"onUpdate:fillColorMenuOpen":c[13]||(c[13]=y=>Xe(y)),onApplyTextColor:k.applyCachedTextColor,onApplyFillColor:k.applyCachedFillColor,"onUpdate:borderMenuOpen":c[14]||(c[14]=y=>k.onBorderMenuToggle(y)),onBorderChange:c[15]||(c[15]=y=>v.onBorderChange(y)),onApplyBorder:v.applyCachedBorder,"onUpdate:sortMenuOpen":c[16]||(c[16]=y=>E.onSortMenuToggle(y)),onSortChange:c[17]||(c[17]=y=>E.onSortChange(y)),onApplySort:E.applyCachedSort,onFreezeChange:c[18]||(c[18]=y=>Ve(y)),onHAlignChange:c[19]||(c[19]=y=>k.onHAlignChange(y)),onVAlignChange:c[20]||(c[20]=y=>k.onVAlignChange(y)),onWrapToggle:k.onWrapToggle,"onUpdate:mergeMenuOpen":c[21]||(c[21]=y=>v.onMergeMenuToggle(y)),onMergeChange:c[22]||(c[22]=y=>v.onMergeChange(y)),onApplyMerge:v.onApplyMerge,"onUpdate:calcMenuOpen":c[23]||(c[23]=y=>v.onCalcMenuToggle(y)),onCalcSum:v.onCalcSum,onCalcAvg:v.onCalcAvg,onCalcCount:v.onCalcCount,onFind:c[24]||(c[24]=y=>t.unref(S).openFind())},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","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","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(bi,{open:he.open,"find-text":he.findText,"replace-text":he.replaceText,scope:he.scope,"match-case":he.matchCase,"match-entire-cell":he.matchEntireCell,"current-index":he.currentIndex,total:he.results.length,message:he.message,"focus-token":he.focusToken,locale:d.locale,"theme-vars":E.toolbarThemeVars,"onUpdate:findText":c[25]||(c[25]=y=>t.unref(S).findText.value=y),"onUpdate:replaceText":c[26]||(c[26]=y=>t.unref(S).replaceText.value=y),"onUpdate:scope":c[27]||(c[27]=y=>t.unref(S).scope.value=y),"onUpdate:matchCase":c[28]||(c[28]=y=>t.unref(S).matchCase.value=y),"onUpdate:matchEntireCell":c[29]||(c[29]=y=>t.unref(S).matchEntireCell.value=y),onPrev:c[30]||(c[30]=y=>t.unref(S).findPrev()),onNext:c[31]||(c[31]=y=>t.unref(S).findNext()),onReplace:c[32]||(c[32]=y=>t.unref(S).replace()),onReplaceAll:c[33]||(c[33]=y=>t.unref(S).replaceAll()),onClose:c[34]||(c[34]=y=>t.unref(S).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(Ui,{"model-open":k.nfDialogOpen,locale:d.locale,"current-format":De.value,"is-custom":k.selNumberFormat===t.unref(Eo),"onUpdate:modelOpen":c[35]||(c[35]=y=>_e(y)),onApply:c[36]||(c[36]=y=>k.applyNumberFormatCode(y))},null,8,["model-open","locale","current-format","is-custom"]),t.createVNode(ec,{"model-open":E.sortConfirmOpen,locale:d.locale,"onUpdate:modelOpen":c[37]||(c[37]=y=>E.sortConfirmOpen=y),onConfirm:c[38]||(c[38]=y=>E.confirmSort(y)),onCancel:c[39]||(c[39]=y=>E.cancelSortConfirmation())},null,8,["model-open","locale"]),t.createVNode(vc,{"model-open":xe.value,locale:d.locale,"onUpdate:modelOpen":c[40]||(c[40]=y=>Te(y)),onInsert:c[41]||(c[41]=y=>et(y))},null,8,["model-open","locale"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":g.formulaBarExpanded}])},[t.createElementVNode("div",_c,t.toDisplayString(g.activeCellLabel),1),t.createElementVNode("div",Wc,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:c[42]||(c[42]=t.withModifiers(()=>{},["prevent"])),onClick:c[43]||(c[43]=t.withModifiers((...y)=>g.cancelFormulaBarEdit&&g.cancelFormulaBarEdit(...y),["stop"]))},[...c[94]||(c[94]=[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[44]||(c[44]=t.withModifiers(()=>{},["prevent"])),onClick:c[45]||(c[45]=t.withModifiers((...y)=>g.acceptFormulaBarEdit&&g.acceptFormulaBarEdit(...y),["stop"]))},[...c[95]||(c[95]=[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(T)(d.locale,"insertFunctionTitle"),"aria-label":t.unref(T)(d.locale,"insertFunctionTitle"),onMousedown:c[46]||(c[46]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(we,["stop"])},[...c[96]||(c[96]=[t.createElementVNode("span",{class:"formula-bar__fx-label"},"fx",-1)])],40,Pc)]),t.createElementVNode("textarea",{ref:ge,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":g.formulaBarExpanded}]),rows:g.formulaBarExpanded?3:1,value:g.formulaBarDisplay,spellcheck:"false",onFocus:c[47]||(c[47]=(...y)=>g.onFormulaBarFocus&&g.onFormulaBarFocus(...y)),onInput:c[48]||(c[48]=(...y)=>g.onFormulaBarInput&&g.onFormulaBarInput(...y)),onKeydown:c[49]||(c[49]=(...y)=>g.onFormulaBarKeydown&&g.onFormulaBarKeydown(...y)),onBlur:c[50]||(c[50]=(...y)=>g.onFormulaBarBlur&&g.onFormulaBarBlur(...y))},null,42,Kc),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:g.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:c[51]||(c[51]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(u,["stop"])},[g.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",Yc,[...c[98]||(c[98]=[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",Gc,[...c[97]||(c[97]=[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,Uc)],2),t.createElementVNode("div",{ref:D,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:I,class:"grid-canvas",tabindex:"0",onMousedown:c[52]||(c[52]=(...y)=>g.onMouseDown&&g.onMouseDown(...y)),onMousemove:c[53]||(c[53]=(...y)=>g.onMouseMove&&g.onMouseMove(...y)),onMouseup:c[54]||(c[54]=(...y)=>g.onMouseUp&&g.onMouseUp(...y)),onMouseleave:c[55]||(c[55]=(...y)=>g.onMouseLeave&&g.onMouseLeave(...y)),onDblclick:c[56]||(c[56]=(...y)=>g.onDblClick&&g.onDblClick(...y)),onWheel:c[57]||(c[57]=t.withModifiers((...y)=>g.onWheel&&g.onWheel(...y),["prevent"])),onFocus:c[58]||(c[58]=(...y)=>E.onCanvasFocus&&E.onCanvasFocus(...y)),onKeydown:c[59]||(c[59]=(...y)=>g.onKeydown&&g.onKeydown(...y)),onContextmenu:c[60]||(c[60]=(...y)=>g.onCanvasCtx&&g.onCanvasCtx(...y)),onTouchstart:c[61]||(c[61]=t.withModifiers((...y)=>g.onTouchStart&&g.onTouchStart(...y),["prevent"])),onTouchmove:c[62]||(c[62]=t.withModifiers((...y)=>g.onTouchMove&&g.onTouchMove(...y),["prevent"])),onTouchend:c[63]||(c[63]=(...y)=>g.onTouchEnd&&g.onTouchEnd(...y))},null,32),t.createElementVNode("canvas",{ref:G,class:"grid-canvas grid-canvas--freeze","aria-hidden":"true"}),t.createElementVNode("textarea",{ref:$,class:"cell-editor",value:d.editValue,style:t.normalizeStyle(g.editInputStyle),onInput:c[64]||(c[64]=(...y)=>g.onEditInput&&g.onEditInput(...y)),onKeydown:c[65]||(c[65]=(...y)=>g.onEditKd&&g.onEditKd(...y)),onCompositionstart:c[66]||(c[66]=(...y)=>g.onEditCompositionStart&&g.onEditCompositionStart(...y)),onCompositionend:c[67]||(c[67]=(...y)=>g.onEditCompositionEnd&&g.onEditCompositionEnd(...y)),onBlur:c[68]||(c[68]=(...y)=>g.onEditBlur&&g.onEditBlur(...y)),onPaste:c[69]||(c[69]=(...y)=>g.onEditPaste&&g.onEditPaste(...y))},null,44,Xc),E.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:g.vScrollbarTop+"px",height:`calc(100% - ${g.vScrollbarTop+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:c[70]||(c[70]=t.withModifiers(y=>{E.clampScroll(null,d.scrollY-50),g.scheduleRender()},["prevent"]))},[...c[99]||(c[99]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:c[72]||(c[72]=(...y)=>g.onVTrk&&g.onVTrk(...y))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:g.vThumbT+"px",height:g.vThumbH+"px"}),onMousedown:c[71]||(c[71]=(...y)=>g.onVStart&&g.onVStart(...y))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:c[73]||(c[73]=t.withModifiers(y=>{E.clampScroll(null,d.scrollY+50),g.scheduleRender()},["prevent"]))},[...c[100]||(c[100]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),E.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:g.hScrollbarLeft+"px",width:`calc(100% - ${g.hScrollbarLeft+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:c[74]||(c[74]=t.withModifiers(y=>{E.clampScroll(d.scrollX-50,null),g.scheduleRender()},["prevent"]))},[...c[101]||(c[101]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:c[76]||(c[76]=(...y)=>g.onHTrk&&g.onHTrk(...y))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:g.hThumbL+"px",width:g.hThumbW+"px"}),onMousedown:c[75]||(c[75]=(...y)=>g.onHStart&&g.onHStart(...y))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:c[77]||(c[77]=t.withModifiers(y=>{E.clampScroll(d.scrollX+50,null),g.scheduleRender()},["prevent"]))},[...c[102]||(c[102]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),E.maxScrollX>0&&E.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",jc)):t.createCommentVNode("",!0)]),t.createVNode(ri,{locale:d.locale,sheets:t.unref(J),"active-sheet-index":t.unref(j),"ren-tab":g.renTab,"ren-tab-val":g.renTabVal,onTabClick:c[78]||(c[78]=y=>g.onTabClick(y)),onTabDblclick:c[79]||(c[79]=y=>g.onTabDblClick(y)),onTabContextmenu:c[80]||(c[80]=y=>g.onTabCtxMenu(y.ev,y.i)),onTabRenameInput:c[81]||(c[81]=y=>Ge(y)),onTabRenameKeydown:c[82]||(c[82]=y=>g.onTabRenameKd(y)),onTabRenameCommit:g.commitTabRename,onTabbarContextmenu:c[83]||(c[83]=y=>g.onTabBarCtx(y)),onDeleteSheet:c[84]||(c[84]=y=>{E.removeSheet(y),g.scheduleRender()}),onAddSheet:c[85]||(c[85]=y=>{E.addSheet(),g.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(()=>[g.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:g.ctxMenu.x+"px",top:g.ctxMenu.y+"px"}),onClick:c[86]||(c[86]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.ctxMenu.items,(y,at)=>(t.openBlock(),t.createElementBlock("div",{key:at,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":y.disabled}]),onClick:ee=>!y.disabled&&y.action&&(y.action(),oe()),onMouseenter:ee=>g.onCtxItemEnter(ee,y)},[t.createElementVNode("span",qc,t.toDisplayString(y.label),1),y.children?(t.openBlock(),t.createElementBlock("svg",Jc,[...c[103]||(c[103]=[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),y.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":g.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.children,(ee,p)=>(t.openBlock(),t.createElementBlock("div",{key:p,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":ee.disabled}]),onClick:t.withModifiers(F=>!ee.disabled&&ee.action&&(ee.action(),oe()),["stop"])},t.toDisplayString(ee.label),11,Qc))),128))],2)):t.createCommentVNode("",!0)],42,Zc))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[g.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:g.dimPanel.x+"px",top:g.dimPanel.y+"px"}),onMousedown:c[92]||(c[92]=t.withModifiers(()=>{},["stop"])),onClick:c[93]||(c[93]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",es,t.toDisplayString(g.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",ts,[t.createElementVNode("input",{ref:ne,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":g.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:g.dimPanel.value,onInput:c[87]||(c[87]=(...y)=>g.onDimInput&&g.onDimInput(...y)),onKeydown:c[88]||(c[88]=(...y)=>g.onDimKeydown&&g.onDimKeydown(...y)),onBlur:c[89]||(c[89]=(...y)=>g.onDimBlur&&g.onDimBlur(...y))},null,42,os)]),g.dimPanel.error?(t.openBlock(),t.createElementBlock("div",ns,t.toDisplayString(g.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",ls,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:c[90]||(c[90]=(...y)=>g.applyDimPanel&&g.applyDimPanel(...y))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:c[91]||(c[91]=(...y)=>g.closeDimPanel&&g.closeDimPanel(...y))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-a7c5466d"]]);Oo.Spreader=pl,Oo.default=pl,Object.defineProperties(Oo,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(Ol,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(Ol=typeof globalThis<"u"?globalThis:Ol||self,t(Ol.XiaoDaoSpreader={},Ol.Vue))})(this,function(Ol,t){"use strict";const Vn={"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:"范围",scopeSheet:"当前工作表",scopeWorkbook:"整个工作簿",scopeSelection:"当前选区",matchCase:"区分大小写",matchEntireCell:"完整匹配",findNoResult:"未找到",findNeedSelection:"请先选择范围",findReplacedAll:"已替换 {n} 处",findClose:"关闭",freezePane:"冻结窗格",freezePanes:"冻结窗格",freezeFirstRow:"冻结首行",freezeFirstCol:"冻结首列",unfreezePanes:"取消冻结",freezeToRow:"冻结至此行",freezeToCol:"冻结至此列"},"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",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"}};function I(e,o){var n;return((n=Vn[e])==null?void 0:n[o])??o}const jl='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',El=10,Hn=[{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'}],On=[{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}],zn='<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>',Ln='<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>',_n='<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>',$n='<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>',Wn='<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>',Pn='<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>',Kn=[{value:"left",labelKey:"alignLeft",icon:zn},{value:"center",labelKey:"alignCenter",icon:Ln},{value:"right",labelKey:"alignRight",icon:_n}],Un=[{value:"top",labelKey:"alignTop",icon:$n},{value:"middle",labelKey:"alignMiddle",icon:Wn},{value:"bottom",labelKey:"alignBottom",icon:Pn}],Go=[{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>'}],Gn={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)"},Yn={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)"},Sl="__nf_custom__",gl="",Rl="",ol="@",Co="__NF_INVALID__",xo=2958465,Bo=0;function nl(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function Do(e){return e==="zh-CN"?"¥":"$"}function Xn(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Yo(e){return e.replace(/"([^"]*)"/g,"$1")}function jn(e){let o=e,n;const l=o.match(/^\[([^\]]+)\]/);l&&(n=l[1].toLowerCase(),o=o.slice(l[0].length)),o=Xn(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:n};let u=-1;for(let X=o.length-1;X>=0;X--){const ae=o[X];if(ae==="0"||ae==="#"||ae==="?"||ae==="E"){u=X;break}}u<0&&(u=r);const p=r>0?o.slice(0,r):"",h=u<o.length-1?o.slice(u+1):"",S=o.slice(r,u+1),d=/[0#?]/.test(S),v=S.includes(",");let k=S.replace(/,/g,"");if(a){const X=k.search(/E/i);X>=0&&(k=k.slice(0,X))}const Z=k.indexOf("."),J=Z>=0?k.slice(0,Z):k,P=Z>=0?k.slice(Z+1):"",$=(P.match(/[0#?]/g)||[]).length,y=(P.match(/0/g)||[]).length,Y=(J.match(/0/g)||[]).length;return{hasDigits:d,decimals:$,minDecimals:y,minIntDigits:Y,thousands:v,scale:i?100:1,scientific:a,prefix:p,suffix:h,color:n}}function Zn(e){const o=[];let n=!1;const l=/\[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=l.exec(e))!==null;){const i=a[0];switch(i){case"[h]":n=!0,o.push({type:"hour",len:0});break;case"[mm]":n=!0,o.push({type:"minute",len:2});break;case"[ss]":n=!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(n?{type:"minute",len:4}:{type:"monthName",len:4});break;case"mmm":o.push(n?{type:"minute",len:3}:{type:"monthName",len:3});break;case"mm":o.push(n?{type:"minute",len:2}:{type:"month",len:2});break;case"m":o.push(n?{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:Yo(i),len:0}):o.push({type:"literal",text:i,len:0})}}return{tokens:o,isDuration:n}}const Xo=new Map;function qn(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:u}=Zn(i);return{kind:u?"duration":"date",sections:[],tokens:r,isDuration:u,raw:e}}return{kind:"number",sections:e.split(";").map(i=>jn(i)),tokens:[],isDuration:!1,raw:e}}function Ml(e){const o=Xo.get(e);if(o)return o;const n=qn(e);return Xo.set(e,n),n}function jo(e,o,n,l,a){const i=Math.pow(10,o),r=Math.round((e+Number.EPSILON)*i)/i,u=r<0,p=Math.abs(r);let S=new Intl.NumberFormat("en-US",{useGrouping:l,minimumIntegerDigits:a,minimumFractionDigits:o,maximumFractionDigits:o}).format(p);if(n<o&&o>0){const v=S.indexOf(".");if(v>=0){const w=S.substring(0,v);let k=S.substring(v+1);k=k.replace(/0+$/,""),k.length<n&&(k=k+"0".repeat(n-k.length)),S=k?`${w}.${k}`:w}}return`${u?"-":""}${S}`}function Zo(e,o){if(e===0)return(o>0?"0."+"0".repeat(o):"0")+"E+00";const n=Math.floor(Math.log10(Math.abs(e))),l=e/Math.pow(10,n),a=jo(l,o,o,!1,1),i=(n>=0?"+":"-")+String(Math.abs(n)).padStart(2,"0");return`${a}E${i}`}function Jn(e,o,n){if(!n.hasDigits)return Yo(n.prefix+n.suffix);const l=n.scale===100?e*100:e,a=n.scientific?Zo(l,n.decimals):jo(l,n.decimals,n.minDecimals,n.thousands,n.minIntDigits);return o+n.prefix+a+n.suffix}function Qn(e,o){const n=o.sections;if(n.length===0)return String(e);let l,a,i="";return e>0?(l=n[0],a=e):e<0?n[1]?(l=n[1],a=-e):(l=n[0],a=-e,i="-"):(l=n[2]??n[0],a=0),Jn(a,i,l)}function er(e){return new Date((e-25569)*864e5)}const tr=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],lr=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],qo=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],or=["January","February","March","April","May","June","July","August","September","October","November","December"],nr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Jo=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function oo(e,o){return String(e).padStart(o,"0")}function rr(e,o,n,l){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),u=e.getUTCDay(),p=n==="zh-CN";let h="",S=!1;for(const d of o)switch(d.type){case"literal":h+=d.text??"";break;case"year":h+=d.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":h+=oo(S?e.getUTCMinutes():i,d.len);break;case"monthName":h+=d.len>=4?p?tr[i-1]:or[i-1]:p?lr[i-1]:nr[i-1];break;case"day":h+=oo(r,d.len);break;case"weekday":h+=d.len>=4?p?qo[u]:Jo[u]:p?qo[u].slice(2):Jo[u].slice(0,3);break;case"hour":{let v=e.getUTCHours();if(d.len===0){const w=Math.floor(l*86400);v=Math.floor(w/3600)}h+=String(v),S=!0;break}case"minute":h+=oo(e.getUTCMinutes(),d.len);break;case"second":h+=oo(e.getUTCSeconds(),d.len);break;case"ampm":{const v=e.getUTCHours();h+=v<12?p?"上午":"AM":p?"下午":"PM";break}}return h}function ar(e,o){const n=Math.floor(e*86400),l=Math.floor(n/3600),a=Math.floor(n%3600/60),i=n%60;let r="";for(const u of o)switch(u.type){case"literal":r+=u.text??"";break;case"hour":r+=String(l);break;case"minute":r+=oo(a,u.len||2);break;case"second":r+=oo(i,u.len||2);break;default:r+=""}return r}function ir(e){if(e==="")return e;const o=Number(e);if(!isNaN(o)&&e.trim()!==""){const n=Math.abs(o);return n!==0&&(n>=1e15||n<1e-9)?Zo(o,9):e}return e}function zl(e,o,n){if(nl(o))return ir(e);if(o==null||o===ol)return e;const l=Ml(o);if(l.kind==="date"||l.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(l.kind==="date"){if(i<Bo||i>xo)return Co}else if(i<0)return Co;return l.kind==="duration"?ar(i,l.tokens):rr(er(i),l.tokens,n,i)}const a=Number(e);return isNaN(a)?e:Qn(a,l)}const cr=["general","text","number","percent","scientific","accounting","financial","currency","currencyRounded","date","time","dateTime","duration","custom"];function To(e,o){if(o===ol||o==="@")return!1;if(nl(o)){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}const n=Ml(o);return!!(n.kind==="number"&&Qo(n))}function Qo(e){return e.sections.some(o=>o.hasDigits)}function en(e){if(e==null||nl(e)||e===ol||e==="@")return!1;const o=Ml(e);return!!(o.kind==="date"||o.kind==="duration"||o.kind==="number"&&Qo(o))}function tn(e,o){if(o==null||nl(o)||o===ol||o==="@")return!1;const n=Ml(o),l=Number(e);return Number.isFinite(l)?n.kind==="date"?l<Bo||l>xo:n.kind==="duration"?l<0:!1:!1}const No=30,Io=0;function no(e){if(e==null||e===""||e.trim()==="")return!1;const o=Number(e);return!Number.isNaN(o)&&Number.isFinite(o)}function ln(e,o){if(e==null||e===gl||nl(e))return no(o);if(e===ol)return!1;const n=Ml(e);return n.kind==="date"||n.kind==="duration"?!1:n.sections.some(l=>l.hasDigits)}function sr(e){if(!no(e))return 0;const o=String(Number(e));return o.indexOf(".")<0||/e/i.test(o)?0:o.slice(o.indexOf(".")+1).length}function dr(e,o){if(!ln(e,o))return-1;if(e==null||e===gl||nl(e))return sr(o);const l=Ml(e).sections.find(a=>a.hasDigits);return l?l.decimals:-1}function ur(e,o){let n=0;const l=/\[[^\]]*\]/g;let a;for(;(a=l.exec(e))!==null&&!/^\[(h|mm|ss)\]$/i.test(a[0]);)n=a.index+a[0].length;const i=e.slice(0,n),r=e.slice(n),u=r.search(/[0#?]/);if(u===-1)return e;let p=-1;for(let J=r.length-1;J>=0;J--){const P=r[J];if(P==="0"||P==="#"||P==="?"||P==="E"){p=J;break}}if(p<u)return e;const h=r.slice(u,p+1),S=h.search(/E[+-]/i),d=S>=0?h.slice(0,S):h,v=d.indexOf("."),w=v>=0?(d.slice(v+1).match(/[0#?]/g)||[]).length:0;if(w===o)return e;let k;if(v<0)k=o>0?d+"."+"0".repeat(o):d;else if(o>w)k=d+"0".repeat(o-w);else{let J=w-o;const P=d.split("");for(let $=P.length-1;$>=0&&J>0;$--){const y=P[$];(y==="0"||y==="#"||y==="?")&&(P.splice($,1),J--)}k=P.join(""),o===0&&k.endsWith(".")&&(k=k.slice(0,-1))}const Z=k+(S>=0?h.slice(S):"");return i+r.slice(0,u)+Z+r.slice(p+1)}function fr(e,o){if(!Number.isInteger(o)||o<Io||o>No||e===gl)return null;if(e==null||nl(e))return o>0?"0."+"0".repeat(o):"0";if(e===ol)return null;const n=Ml(e);return n.kind==="date"||n.kind==="duration"||!n.sections.some(l=>l.hasDigits)?null:e.split(";").map(l=>ur(l,o)).join(";")}const Fo=["¥","$","€","£"];function on(e,o){if(e==null||e===gl)return e??Rl;if(nl(e))return Rl;if(e===ol||e==="@")return ol;const n=Do(o),l=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=`${n}#,##0.00;(${n}#,##0.00);${n}"-"`,r="#,##0.00;[Red](#,##0.00)";if(nn(o).some(w=>w.value===e))return e;const p=e.replace(/\[[^\]]*\]/gi,w=>/^\[(h|mm|ss)\]$/i.test(w)?w:"");if(/\[(h|mm|ss)\]/i.test(p)&&!/[yd]/i.test(p))return"[h]:mm:ss";const h=/[yd]/i.test(p),S=/h|s|AM\/PM/i.test(p);if(h&&S)return a;if(h||/AM\/PM/i.test(p))return l;if(S)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 d=Fo.find(w=>e.startsWith(w));if(d)return e.includes("(")?i:/\.\d/.test(e.slice(d.length))?n+"#,##0.00":n+"#,##0";const v=Ml(e);return v.kind==="number"&&v.sections.some(w=>w.hasDigits)?"#,##0.00":Sl}function mr(e,o){return new Date(Date.UTC(e,o,0)).getUTCDate()}function pr(e,o,n){const l=Date.UTC(e,o-1,n)/864e5+25569;return l<=60?l-1:l}function vo(e,o,n=new Date){const l=e.trim();if(!l||l.startsWith("=")||no(l))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 u(v){const w=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(v);if(!w)return null;const k=Number(w[1]),Z=Number(w[2]),J=w[3]!==void 0?Number(w[3]):0;return k>23||Z>59||J>59?null:(k*3600+Z*60+J)/86400}function p(v){let w=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(v),k,Z,J;if(w)k=Number(w[1]),Z=Number(w[2]),J=Number(w[3]);else if(w=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(v))k=Number(w[1]),Z=Number(w[2]),J=Number(w[3]);else if(w=/^(\d{1,2})[-/](\d{1,2})$/.exec(v))k=n.getUTCFullYear(),Z=Number(w[1]),J=Number(w[2]);else return null;if(k<1900||k>9999||Z<1||Z>12||J<1||J>mr(k,Z))return null;const P=pr(k,Z,J);return P>=Bo&&P<=xo?P:null}const h=u(l);if(h!==null)return{serial:h,format:r};const S=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(l);if(S){const v=p(S[1].trim()),w=u(S[2]);if(v!==null&&w!==null)return{serial:v+w,format:i}}const d=p(l);return d!==null?{serial:d,format:a}:null}function hr(e,o){const n=e.trim();if(!n||n.startsWith("=")||!(n.includes(",")||n.includes("%")||Fo.some($=>n.startsWith($)))||vo(n,o))return null;const a=Fo.find($=>n.startsWith($)),i=a?n.slice(a.length).trim():n;if(!i)return null;const r=/^([+-]?)(\d{1,3}(?:,\d{3})+)(?:\.(\d+))?(%?)$/.exec(i)||/^([+-]?)(\d+)(?:\.(\d+))?(%?)$/.exec(i);if(!r)return null;const u=r[1]==="-"?-1:1,p=r[2].replace(/,/g,""),h=r[3],S=(r[4]??"")==="%",d=h?h.length:0,v=+(p+(h?"."+h:""));if(!Number.isFinite(v))return null;const k=i.includes(",")?"#,##0":"0",Z=d>0?"."+"0".repeat(d):"",J=(a??"")+k+Z+(S?"%":"");let P=v*u;return S&&(P=P/100),P=Math.round(P*1e12)/1e12,{num:P,format:J}}function gr(e,o,n,l){const a=Do(e),i=l?"#,##0":"0",r=n>0?"."+"0".repeat(n):"",u=i+r;switch(o){case"general":return"";case"text":return ol;case"custom":return"";case"number":return u;case"percent":return u+"%";case"scientific":return"0."+"0".repeat(n)+"E+00";case"currency":return a+u;case"currencyRounded":return a+(l?"#,##0":"0");case"accounting":return`${a}${u};(${a}${u});${a}"-"`;case"financial":return`${u};[Red](${u})`;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 nn(e){const o=Do(e);return[{label:I(e,"nfGeneral"),value:Rl},{label:I(e,"nfText"),value:ol},{label:I(e,"nfNumber"),value:"#,##0.00"},{label:I(e,"nfPercent"),value:"0.00%"},{label:I(e,"nfScientific"),value:"0.00E+00"},{label:I(e,"nfAccounting"),value:`${o}#,##0.00;(${o}#,##0.00);${o}"-"`},{label:I(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:I(e,"nfCurrency"),value:o+"#,##0.00"},{label:I(e,"nfCurrencyRounded"),value:o+"#,##0"},{label:I(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:I(e,"nfTime"),value:"h:mm:ss"},{label:I(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:I(e,"nfDuration"),value:"[h]:mm:ss"},{label:I(e,"nfCustom"),value:Sl}]}const yr=["title"],br=["innerHTML"],Cr={key:1,class:"sp-dropdown__value"},vr=["disabled"],wr=["placeholder"],kr=["onClick"],Er=["innerHTML"],Sr={class:"sp-dropdown__item-label"},Rr={key:2,class:"sp-dropdown__empty"},Mr=["disabled"],xr=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:""}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:o}){const n=e,l=o,a=t.ref(!1),i=t.ref(0),r=t.ref(null),u=t.ref(null),p=t.ref(null),h=t.ref({top:0,up:!1}),S=t.ref(void 0),d=t.ref(0),v=t.ref(!1),w=t.ref(""),k=t.ref(null),Z=t.computed(()=>n.options.find(f=>String(f.value)===String(n.modelValue))),J=t.computed(()=>n.menuWidth!==void 0?n.menuWidth:S.value),P=t.computed(()=>{if(!n.searchable||!w.value.trim())return n.options;const f=w.value.trim().toLowerCase();return n.options.filter(N=>String(N.label??"").toLowerCase().includes(f))}),$=t.computed(()=>P.value.length>0),y=t.computed(()=>Math.min(n.visibleCount,P.value.length)),Y=t.computed(()=>P.value.slice(i.value,i.value+y.value)),X=t.computed(()=>i.value>0),ae=t.computed(()=>i.value+y.value<P.value.length),De=t.computed(()=>P.value.length>y.value);function Je(f){i.value=Math.max(0,Math.min(P.value.length-y.value,i.value+f))}function Le(){a.value=!0,n.searchable&&(w.value=""),n.modelOpen!==void 0&&l("update:modelOpen",!0);const f=n.triggerEl??r.value;if(!f)return;const N=f.getBoundingClientRect();S.value=N.width;const A=y.value*22+(De.value?2*15:0)+8+(n.searchable?34:0),U=window.innerHeight-N.bottom-4<A&&N.top-4>A;n.align==="right"?h.value={right:window.innerWidth-N.right,top:U?N.top-A-4:N.bottom+4,up:U}:h.value={left:N.left,top:U?N.top-A-4:N.bottom+4,up:U};const ce=P.value.findIndex(V=>String(V.value)===String(n.modelValue));i.value=ce>=0?Math.max(0,Math.min(ce-Math.floor(y.value/2),P.value.length-y.value)):0,n.searchable&&t.nextTick(()=>{var V;return(V=k.value)==null?void 0:V.focus()})}function Ce(){a.value=!1,w.value="",n.modelOpen!==void 0&&l("update:modelOpen",!1)}function ve(){a.value?Ce():Le()}function Ke(f){l("update:modelValue",f.value),l("change",f.value),Ce()}function Ae(f){var A,Q;if(!a.value)return;const N=f.target;(A=r.value)!=null&&A.contains(N)||(Q=p.value)!=null&&Q.contains(N)||Ce()}function Be(f){a.value&&(f.preventDefault(),Je(f.deltaY>0?1:-1))}t.watch(a,f=>{t.nextTick(()=>{var N,A;f?((N=u.value)==null||N.addEventListener("wheel",Be,{passive:!1}),document.addEventListener("keydown",Ne)):((A=u.value)==null||A.removeEventListener("wheel",Be),document.removeEventListener("keydown",Ne))})});function Ne(f){a.value&&f.key==="Escape"&&Ce()}t.watch(()=>n.modelOpen,f=>{f!==void 0&&f!==a.value&&(f?Le():Ce())});function Ue(f){a.value&&(d.value=f.touches[0].clientY,v.value=!0)}function Xe(f){if(!a.value||!v.value)return;const N=f.touches[0].clientY-d.value;Math.abs(N)>5&&(Je(N<0?1:-1),d.value=f.touches[0].clientY)}function ie(){v.value=!1}function ge(f){f.key==="Escape"&&(f.stopPropagation(),Ce())}return t.onMounted(()=>{document.addEventListener("pointerdown",Ae),window.addEventListener("resize",Ce),window.addEventListener("scroll",Ce,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",Ae),document.removeEventListener("keydown",Ne),window.removeEventListener("resize",Ce),window.removeEventListener("scroll",Ce,!0)}),(f,N)=>{var A,Q,U;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:ve},[(A=Z.value)!=null&&A.icon||e.triggerIcon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:((Q=Z.value)==null?void 0:Q.icon)||e.triggerIcon},null,8,br)):(t.openBlock(),t.createElementBlock("span",Cr,t.toDisplayString(((U=Z.value)==null?void 0:U.label)??e.fallbackLabel),1)),N[5]||(N[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,yr)),(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:p,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":h.value.up}]),style:t.normalizeStyle({left:h.value.left!==void 0?h.value.left+"px":void 0,right:h.value.right!==void 0?h.value.right+"px":void 0,top:h.value.top+"px",minWidth:J.value!==void 0?typeof J.value=="number"?J.value+"px":J.value:void 0}),onKeydown:ge,onMousedown:N[4]||(N[4]=t.withModifiers(()=>{},["prevent"]))},[De.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:N[0]||(N[0]=ce=>Je(-1))},[...N[6]||(N[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,vr)):t.createCommentVNode("",!0),e.searchable?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"searchInputRef",ref:k,"onUpdate:modelValue":N[1]||(N[1]=ce=>w.value=ce),class:"sp-dropdown__search",type:"text",placeholder:e.searchPlaceholder,onMousedown:N[2]||(N[2]=t.withModifiers(()=>{},["stop"]))},null,40,wr)),[[t.vModelText,w.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:u,class:"sp-dropdown__list",onTouchstart:Ue,onTouchmove:Xe,onTouchend:ie},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Y.value,ce=>(t.openBlock(),t.createElementBlock("button",{key:String(ce.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(ce.value)===String(e.modelValue)}]),onClick:V=>Ke(ce)},[ce.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:ce.icon},null,8,Er)):t.createCommentVNode("",!0),t.createElementVNode("span",Sr,t.toDisplayString(ce.label),1)],10,kr))),128))],544),e.searchable&&!$.value?(t.openBlock(),t.createElementBlock("div",Rr," 无匹配 ")):t.createCommentVNode("",!0),De.value?(t.openBlock(),t.createElementBlock("button",{key:3,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!ae.value}]),disabled:!ae.value,onClick:N[3]||(N[3]=ce=>Je(1))},[...N[7]||(N[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,Mr)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),Jt=(e,o)=>{const n=e.__vccOpts||e;for(const[l,a]of o)n[l]=a;return n},Kt=Jt(xr,[["__scopeId","data-v-804e629f"]]),Br=["title","onClick"],rn=Jt(t.defineComponent({__name:"colorPicker",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:o,emit:n}){const l=e,a=n,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"}]],u=t.computed(()=>l.colorKey==="fill"?r:i);function p($){return I(l.locale,$)}function h($){const y=l.currentColor;return!y&&!$?!0:y?y.toLowerCase()===$.toLowerCase():!1}const S=t.ref(!1),d=t.ref(null),v=t.ref(null),w=t.ref({top:0});t.watch(()=>l.modelOpen,$=>{$!==void 0&&$!==S.value&&($?Z():J())});function k($){const y=d.value,Y=v.value,X=$.target;y&&y.contains(X)||Y&&Y.contains(X)||J()}function Z(){S.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const $=l.triggerEl??d.value;if($){const y=$.getBoundingClientRect(),Y=150,X=120;let ae=window.innerWidth-y.right,De=y.bottom+4,Je;y.left-X<4&&(ae=void 0,Je=Math.max(4,y.left)),De+Y>window.innerHeight-4&&(De=y.top-Y-4),De<4&&(De=4),w.value=ae!==void 0?{right:ae,top:De}:{left:Je,top:De}}document.addEventListener("pointerdown",k)})}function J(){S.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",k)}function P($){a("update:modelValue",$),a("change",$),J()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",k)}),o({open:S,openMenu:Z,close:J}),($,y)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:d,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[S.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:v,class:"color-picker__menu",style:t.normalizeStyle({left:w.value.left!==void 0?w.value.left+"px":void 0,right:w.value.right!==void 0?w.value.right+"px":void 0,top:w.value.top+"px"}),onMousedown:y[0]||(y[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,(Y,X)=>(t.openBlock(),t.createElementBlock("div",{key:X,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Y,ae=>(t.openBlock(),t.createElementBlock("button",{key:ae.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":h(ae.value)}]),title:p(ae.key),style:t.normalizeStyle({background:ae.value||"transparent",border:ae.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:De=>P(ae.value)},null,14,Br))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-70f3dfdc"]]),Dr=["title","onClick"],Tr={viewBox:"0 0 30 30",class:"border-picker__icon"},Nr=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Ir={class:"border-picker__label"},Fr=Jt(t.defineComponent({__name:"borderPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:o,emit:n}){const l=e,a=n,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}],u={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"]},p={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function h($,y){return p[$].includes(y)?"thick":u[$].includes(y)?"solid":"dashed"}const S=t.ref(!1),d=t.ref(null),v=t.ref(null),w=t.ref({top:0});t.watch(()=>l.modelOpen,$=>{$!==void 0&&$!==S.value&&($?Z():J())});function k($){const y=d.value,Y=v.value,X=$.target;y&&y.contains(X)||Y&&Y.contains(X)||J()}function Z(){S.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const $=l.triggerEl??d.value;if($){const y=$.getBoundingClientRect(),Y=200,X=160;let ae=window.innerWidth-y.right,De=y.bottom+4,Je;y.left-X<4&&(ae=void 0,Je=Math.max(4,y.left)),De+Y>window.innerHeight-4&&(De=y.top-Y-4),De<4&&(De=4),w.value=ae!==void 0?{right:ae,top:De}:{left:Je,top:De}}document.addEventListener("pointerdown",k)})}function J(){S.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",k)}function P($){a("change",$),J()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",k)}),o({open:S,openMenu:Z,close:J}),($,y)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:d,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[S.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:v,class:"border-picker__menu",style:t.normalizeStyle({left:w.value.left!==void 0?w.value.left+"px":void 0,right:w.value.right!==void 0?w.value.right+"px":void 0,top:w.value.top+"px"}),onMousedown:y[0]||(y[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,Y=>t.createElementVNode("button",{key:Y.key,class:"border-picker__item",title:t.unref(I)(e.locale,Y.i18nKey),onClick:X=>P(Y.key)},[(t.openBlock(),t.createElementBlock("svg",Tr,[(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":h(Y.key,X.name)==="thick"?3:1.5,"stroke-dasharray":h(Y.key,X.name)==="dashed"?"0 4":"none","stroke-linecap":h(Y.key,X.name)==="dashed"?"round":"square"},null,8,Nr)),64))])),t.createElementVNode("span",Ir,t.toDisplayString(t.unref(I)(e.locale,Y.i18nKey)),1)],8,Dr)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-551c0ffe"]]),Ar=["title","onClick"],Vr={viewBox:"0 0 1024 1024",class:"sort-picker__icon",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},Hr=["x1","y1","x2","y2"],Or=["d"],zr={class:"sort-picker__label"},Lr=Jt(t.defineComponent({__name:"sortPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentSort:{default:"asc"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:o,emit:n}){const l=e,a=n,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}],u={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},p=t.ref(!1),h=t.ref(null),S=t.ref(null),d=t.ref({top:0});t.watch(()=>l.modelOpen,J=>{J!==void 0&&J!==p.value&&(J?w():k())});function v(J){const P=h.value,$=S.value,y=J.target;P&&P.contains(y)||$&&$.contains(y)||k()}function w(){p.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const J=l.triggerEl??h.value;if(J){const P=J.getBoundingClientRect(),$=84,y=160;let Y=window.innerWidth-P.right,X=P.bottom+4,ae;P.left-y<4&&(Y=void 0,ae=Math.max(4,P.left)),X+$>window.innerHeight-4&&(X=P.top-$-4),X<4&&(X=4),d.value=Y!==void 0?{right:Y,top:X}:{left:ae,top:X}}document.addEventListener("pointerdown",v)})}function k(){p.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",v)}function Z(J){a("change",J),k()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",v)}),o({open:p,openMenu:w,close:k}),(J,P)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:h,class:"sort-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[p.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:S,class:"sort-picker__menu",style:t.normalizeStyle({left:d.value.left!==void 0?d.value.left+"px":void 0,right:d.value.right!==void 0?d.value.right+"px":void 0,top:d.value.top+"px"}),onMousedown:P[0]||(P[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,$=>t.createElementVNode("button",{key:$.key,class:"sort-picker__item",title:t.unref(I)(e.locale,$.i18nKey),onClick:y=>Z($.key)},[(t.openBlock(),t.createElementBlock("svg",Vr,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,y=>t.createElementVNode("line",{key:y.name,x1:y.x1,y1:y.y1,x2:y.x2,y2:y.y2},null,8,Hr)),64)),t.createElementVNode("path",{d:u[$.key]},null,8,Or)])),t.createElementVNode("span",zr,t.toDisplayString(t.unref(I)(e.locale,$.i18nKey)),1)],8,Ar)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-45929b74"]]),_r=["title","onClick"],$r=["innerHTML"],Wr={class:"merge-picker__label"},Pr=Jt(t.defineComponent({__name:"mergePicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:o,emit:n}){const l=e,a=n,i=t.ref(!1),r=t.ref(null),u=t.ref(null),p=t.ref({top:0});t.watch(()=>l.modelOpen,w=>{w!==void 0&&w!==i.value&&(w?S():d())});function h(w){const k=r.value,Z=u.value,J=w.target;k&&k.contains(J)||Z&&Z.contains(J)||d()}function S(){i.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const w=l.triggerEl??r.value;if(w){const k=w.getBoundingClientRect(),Z=Go.length*30+12,J=160;let P=window.innerWidth-k.right,$=k.bottom+4,y;k.left-J<4&&(P=void 0,y=Math.max(4,k.left)),$+Z>window.innerHeight-4&&($=k.top-Z-4),$<4&&($=4),p.value=P!==void 0?{right:P,top:$}:{left:y,top:$}}document.addEventListener("pointerdown",h)})}function d(){i.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",h)}function v(w){a("change",w),d()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",h)}),o({open:i,openMenu:S,close:d}),(w,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:u,class:"merge-picker__menu",style:t.normalizeStyle({left:p.value.left!==void 0?p.value.left+"px":void 0,right:p.value.right!==void 0?p.value.right+"px":void 0,top:p.value.top+"px"}),onMousedown:k[0]||(k[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Go),Z=>(t.openBlock(),t.createElementBlock("button",{key:Z.key,class:"merge-picker__item",title:t.unref(I)(e.locale,Z.labelKey),onClick:J=>v(Z.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:Z.icon},null,8,$r),t.createElementVNode("span",Wr,t.toDisplayString(t.unref(I)(e.locale,Z.labelKey)),1)],8,_r))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-edd36208"]]),Kr=["disabled","title","onClick"],Ur={class:"calc-picker__label"},Gr=Jt(t.defineComponent({__name:"calcPicker",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:o,emit:n}){const l=e,a=n,i=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),u=t.ref(null),p=t.ref(null),h=t.ref({top:0});t.watch(()=>l.modelOpen,k=>{k!==void 0&&k!==r.value&&(k?d():v())});function S(k){const Z=u.value,J=p.value,P=k.target;Z&&Z.contains(P)||J&&J.contains(P)||v()}function d(){r.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const k=l.triggerEl??u.value;if(k){const Z=k.getBoundingClientRect(),J=i.length*30+12,P=160;let $=window.innerWidth-Z.right,y=Z.bottom+4,Y;Z.left-P<4&&($=void 0,Y=Math.max(4,Z.left)),y+J>window.innerHeight-4&&(y=Z.top-J-4),y<4&&(y=4),h.value=$!==void 0?{right:$,top:y}:{left:Y,top:y}}document.addEventListener("pointerdown",S)})}function v(){r.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",S)}function w(k){l.disabled||(a("change",k),v())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",S)}),o({open:r,openMenu:d,close:v}),(k,Z)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:u,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:p,class:"calc-picker__menu",style:t.normalizeStyle({left:h.value.left!==void 0?h.value.left+"px":void 0,right:h.value.right!==void 0?h.value.right+"px":void 0,top:h.value.top+"px"}),onMousedown:Z[0]||(Z[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(I)(e.locale,J.labelKey),onClick:P=>w(J.key)},[t.createElementVNode("span",Ur,t.toDisplayString(t.unref(I)(e.locale,J.labelKey)),1)],10,Kr)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-01a18e00"]]),Yr={class:"tb-item","data-key":"undo"},Xr=["title","disabled"],jr={class:"tb-item","data-key":"redo"},Zr=["title","disabled"],qr={class:"tb-item","data-key":"paint"},Jr=["title","disabled"],Qr={class:"tb-item","data-key":"clear"},ea=["title","disabled"],ta={class:"tb-item","data-key":"font"},la={class:"tb-item","data-key":"fontSize"},oa={class:"toolbar-font-size"},na=["value","title"],ra=["title"],aa=["title","disabled"],ia=["title","disabled"],ca={class:"tb-item","data-key":"bold"},sa=["title","disabled"],da={class:"tb-item","data-key":"italic"},ua=["title","disabled"],fa={class:"tb-item","data-key":"underline"},ma=["title","disabled"],pa={class:"tb-item","data-key":"strike"},ha=["title","disabled"],ga={class:"tb-item","data-key":"textColor"},ya={class:"toolbar-split"},ba=["title","disabled"],Ca={viewBox:"0 0 1024 1024",fill:"currentColor"},va=["fill"],wa=["title","disabled"],ka={class:"tb-item","data-key":"fillColor"},Ea={class:"toolbar-split"},Sa=["title","disabled"],Ra={viewBox:"0 0 1024 1024",fill:"currentColor"},Ma=["fill"],xa=["title","disabled"],Ba={class:"tb-item","data-key":"border"},Da={class:"toolbar-split"},Ta=["title","disabled"],Na={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},Ia=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Fa=["title","disabled"],Aa={class:"tb-item","data-key":"hAlign"},Va={class:"tb-item","data-key":"vAlign"},Ha={class:"tb-item","data-key":"wrap"},Oa=["title"],za={class:"tb-item","data-key":"merge"},La={class:"toolbar-split"},_a=["title","disabled"],$a=["title","disabled"],Wa={class:"tb-item","data-key":"numFmt"},Pa={class:"toolbar-number-format-group"},Ka=["title","disabled"],Ua=["title","disabled"],Ga={class:"tb-item","data-key":"calc"},Ya={class:"toolbar-split"},Xa=["title","disabled"],ja=["title","disabled"],Za={class:"tb-item","data-key":"sort"},qa={class:"toolbar-split"},Ja=["title","disabled"],Qa={viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},ei=["x1","y1","x2","y2"],ti=["d"],li=["title","disabled"],oi={class:"tb-item","data-key":"freeze"},ni={class:"tb-item","data-key":"find"},ri=["title"],an='<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>',ai='<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>',ii='<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>',ci='<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>',Ao=2,si=6,di=34,ui=Jt(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},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},calcMenuOpen:{type:Boolean},isSingleCell:{type:Boolean},hasFreeze:{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","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","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"],setup(e,{emit:o}){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}],l={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"]},a={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function i(se,m){return a[se].includes(m)?"thick":l[se].includes(m)?"solid":"dashed"}const 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}],u={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},p=["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","freeze","find"],h=t.ref(null),S=t.ref(null),d=t.ref(null),v=t.ref(null),w=t.ref(null),k=t.ref(null),Z=t.ref(null),J=t.ref(null),P=t.ref(null),$=t.ref(null),y=t.ref(new Set),Y=t.ref(!1),X=t.ref(!1),ae=t.ref(0),De=new Map,Je=t.computed(()=>y.value.size>0);function Le(se){return y.value.has(se)}const Ce=t.computed(()=>{const se=S.value;return se instanceof HTMLElement?se:void 0});function ve(se){return Ce.value?!Le(se):!0}function Ke(){for(const se of p){const m=De.get(se);if(m===void 0||m===0)return!0}return!1}function Ae(){if(!h.value)return;h.value.querySelectorAll(".tb-item").forEach(m=>{const H=m.dataset.key;if(!H)return;const Qe=m.offsetWidth;Qe>0?De.set(H,Qe):De.has(H)||De.set(H,0)})}function Be(se,m){if(se.size!==m.size)return!1;for(const H of se)if(!m.has(H))return!1;return!0}let Ne=0,Ue=0;function Xe(){Ne&&cancelAnimationFrame(Ne),!(Ue>60)&&(Ue++,Ne=requestAnimationFrame(()=>requestAnimationFrame(ie)))}function ie(){if(!h.value)return;const se=h.value.clientWidth-si*2;if(se<=0){Xe();return}Ue=0,(De.size===0||Ke())&&Ae();let m=0;for(const Qe of p)m+=(De.get(Qe)??0)+Ao;const H=new Set;if(m>se){const Qe=se-di-Ao;let wt=0;for(let me=0;me<p.length;me++){const ze=p[me],lt=(De.get(ze)??0)+Ao;if(wt+lt>Qe){for(let kt=me;kt<p.length;kt++)H.add(p[kt]);break}wt+=lt}}Be(H,y.value)||(y.value=H,ae.value++,H.size===0&&(Y.value=!1))}let ge=null;const f=t.ref(0),N=t.computed(()=>{const se=d.value,m={position:"fixed",top:"0px",right:"0px"};if(!se)return{...V.themeVars,...m};f.value;const H=se.getBoundingClientRect();return{...V.themeVars,position:"fixed",top:`${H.bottom+4}px`,right:`${window.innerWidth-H.right}px`}});function A(){Y.value&&(f.value++,t.nextTick(()=>ie()))}function Q(se){var H,Qe;if(!Y.value)return;const m=se.target;(H=S.value)!=null&&H.contains(m)||(Qe=d.value)!=null&&Qe.contains(m)||(X.value=!0,Y.value=!1,t.nextTick(()=>{X.value=!1}))}function U(){Y.value=!Y.value}function ce(){Y.value=!1,c("find")}t.onMounted(()=>{Xe(),h.value&&(ge=new ResizeObserver(()=>{Y.value||Xe()}),ge.observe(h.value)),document.addEventListener("pointerdown",Q,!0),window.addEventListener("resize",A),window.addEventListener("load",Xe),window.addEventListener("orientationchange",Xe)}),t.onBeforeUnmount(()=>{Ne&&cancelAnimationFrame(Ne),ge==null||ge.disconnect(),document.removeEventListener("pointerdown",Q,!0),window.removeEventListener("resize",A),window.removeEventListener("load",Xe),window.removeEventListener("orientationchange",Xe)});const V=e,c=o,b=t.computed(()=>V.selNumberFormat===gl?I(V.locale,"nfMixed"):""),ft=t.computed(()=>{const se=[{label:I(V.locale,"freezeFirstRow"),value:"firstRow",icon:ai},{label:I(V.locale,"freezeFirstCol"),value:"firstCol",icon:ii}];return V.hasFreeze?se.unshift({label:I(V.locale,"unfreezePanes"),value:"unfreeze",icon:ci}):se.unshift({label:I(V.locale,"freezePanes"),value:"panes",icon:an}),se});return(se,m)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:h,class:"toolbar",onMousedown:m[52]||(m[52]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("undo"),to:Ce.value},[t.createElementVNode("div",Yr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(I)(e.locale,"undo"),disabled:!e.canUndo,onClick:m[0]||(m[0]=H=>c("undo"))},[...m[54]||(m[54]=[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)])],10,Xr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("redo"),to:Ce.value},[t.createElementVNode("div",jr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(I)(e.locale,"redo"),disabled:!e.canRedo,onClick:m[1]||(m[1]=H=>c("redo"))},[...m[55]||(m[55]=[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)])],10,Zr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("paint"),to:Ce.value},[t.createElementVNode("div",qr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(I)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:m[2]||(m[2]=H=>c("paint-format"))},[...m[56]||(m[56]=[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)])],10,Jr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("clear"),to:Ce.value},[t.createElementVNode("div",Qr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(I)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:m[3]||(m[3]=H=>c("clear-format"))},[...m[57]||(m[57]=[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)])],10,ea)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("sep1"),to:Ce.value},[m[58]||(m[58]=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:ve("font"),to:Ce.value},[t.createElementVNode("div",ta,[t.createVNode(Kt,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:Le("font")?"100%":110,"menu-width":Le("font")?120:void 0,"visible-count":8,title:t.unref(I)(e.locale,"fontFamily"),align:"right",onChange:m[4]||(m[4]=H=>c("font-family-change",H))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("fontSize"),to:Ce.value},[t.createElementVNode("div",la,[t.createElementVNode("div",oa,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(I)(e.locale,"fontSize"),onMousedown:m[5]||(m[5]=t.withModifiers(()=>{},["stop"])),onInput:m[6]||(m[6]=H=>c("font-size-input",H.target.value)),onBlur:m[7]||(m[7]=H=>c("font-size-blur")),onKeydown:m[8]||(m[8]=H=>c("font-size-keydown",H))},null,40,na),t.createVNode(Kt,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:Le("fontSize")?"100%":56,"menu-width":Le("fontSize")?120:56,"visible-count":9,title:t.unref(I)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":$.value,"onUpdate:modelOpen":m[9]||(m[9]=H=>c("update:font-size-menu-open",H)),onChange:m[10]||(m[10]=H=>c("font-size-change",H))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:$,class:"toolbar-font-size__btn",type:"button",title:t.unref(I)(e.locale,"fontSize"),onMousedown:m[11]||(m[11]=t.withModifiers(()=>{},["prevent"])),onClick:m[12]||(m[12]=H=>c("font-size-toggle"))},[...m[59]||(m[59]=[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,ra),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(I)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:m[13]||(m[13]=t.withModifiers(()=>{},["prevent"])),onClick:m[14]||(m[14]=H=>c("font-size-step-down"))},[...m[60]||(m[60]=[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,aa),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(I)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:m[15]||(m[15]=t.withModifiers(()=>{},["prevent"])),onClick:m[16]||(m[16]=H=>c("font-size-step-up"))},[...m[61]||(m[61]=[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,ia)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("sep2"),to:Ce.value},[m[62]||(m[62]=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:ve("bold"),to:Ce.value},[t.createElementVNode("div",ca,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(I)(e.locale,"bold"),disabled:!e.hasSelection,onClick:m[17]||(m[17]=H=>c("bold-toggle"))},[...m[63]||(m[63]=[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,sa)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("italic"),to:Ce.value},[t.createElementVNode("div",da,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(I)(e.locale,"italic"),disabled:!e.hasSelection,onClick:m[18]||(m[18]=H=>c("italic-toggle"))},[...m[64]||(m[64]=[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,ua)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("underline"),to:Ce.value},[t.createElementVNode("div",fa,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(I)(e.locale,"underline"),disabled:!e.hasSelection,onClick:m[19]||(m[19]=H=>c("underline-toggle"))},[...m[65]||(m[65]=[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,ma)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("strike"),to:Ce.value},[t.createElementVNode("div",pa,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(I)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:m[20]||(m[20]=H=>c("strikethrough-toggle"))},[...m[66]||(m[66]=[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,ha)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("sep3"),to:Ce.value},[m[67]||(m[67]=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:ve("textColor"),to:Ce.value},[t.createElementVNode("div",ga,[t.createElementVNode("div",ya,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(I)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:m[21]||(m[21]=H=>c("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",Ca,[m[68]||(m[68]=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,va)]))],8,ba),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:v,class:"toolbar-btn toolbar-split__arrow",title:t.unref(I)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:m[22]||(m[22]=H=>c("update:text-color-menu-open",!e.textColorMenuOpen))},[...m[69]||(m[69]=[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,wa),t.createVNode(rn,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":v.value,"onUpdate:modelOpen":m[23]||(m[23]=H=>c("update:text-color-menu-open",H)),onChange:m[24]||(m[24]=H=>c("text-color-change",H))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("fillColor"),to:Ce.value},[t.createElementVNode("div",ka,[t.createElementVNode("div",Ea,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(I)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:m[25]||(m[25]=H=>c("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",Ra,[m[70]||(m[70]=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,Ma)]))],8,Sa),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:w,class:"toolbar-btn toolbar-split__arrow",title:t.unref(I)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:m[26]||(m[26]=H=>c("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...m[71]||(m[71]=[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,xa),t.createVNode(rn,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":w.value,"onUpdate:modelOpen":m[27]||(m[27]=H=>c("update:fill-color-menu-open",H)),onChange:m[28]||(m[28]=H=>c("fill-color-change",H))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("border"),to:Ce.value},[t.createElementVNode("div",Ba,[t.createElementVNode("div",Da,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(I)(e.locale,"borders"),disabled:!e.hasSelection,onClick:m[29]||(m[29]=H=>c("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",Na,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(n,H=>t.createElementVNode("line",{key:H.name,x1:H.x1,y1:H.y1,x2:H.x2,y2:H.y2,"stroke-width":i(e.cachedBorder,H.name)==="thick"?3:1.5,"stroke-dasharray":i(e.cachedBorder,H.name)==="dashed"?"0 4":"none","stroke-linecap":i(e.cachedBorder,H.name)==="dashed"?"round":"square"},null,8,Ia)),64))]))],8,Ta),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:k,class:"toolbar-btn toolbar-split__arrow",title:t.unref(I)(e.locale,"borders"),disabled:!e.hasSelection,onClick:m[30]||(m[30]=H=>c("update:border-menu-open",!e.borderMenuOpen))},[...m[72]||(m[72]=[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,Fa),t.createVNode(Fr,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":k.value,"onUpdate:modelOpen":m[31]||(m[31]=H=>c("update:border-menu-open",H)),onChange:m[32]||(m[32]=H=>c("border-change",H))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("sep4"),to:Ce.value},[m[73]||(m[73]=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:ve("hAlign"),to:Ce.value},[t.createElementVNode("div",Aa,[t.createVNode(Kt,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:Le("hAlign")?"100%":44,"menu-width":Le("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(I)(e.locale,"hAlign"),onChange:m[33]||(m[33]=H=>c("h-align-change",H))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("vAlign"),to:Ce.value},[t.createElementVNode("div",Va,[t.createVNode(Kt,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:Le("vAlign")?"100%":44,"menu-width":Le("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(I)(e.locale,"vAlign"),onChange:m[34]||(m[34]=H=>c("v-align-change",H))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",Ha,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(I)(e.locale,"wrap"),onClick:m[35]||(m[35]=H=>c("wrap-toggle"))},[...m[74]||(m[74]=[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)])],10,Oa)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("merge"),to:Ce.value},[t.createElementVNode("div",za,[t.createElementVNode("div",La,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(I)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:m[36]||(m[36]=H=>c("apply-merge"))},[...m[75]||(m[75]=[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)])],8,_a),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:J,class:"toolbar-btn toolbar-split__arrow",title:t.unref(I)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:m[37]||(m[37]=H=>c("update:merge-menu-open",!e.mergeMenuOpen))},[...m[76]||(m[76]=[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,$a),t.createVNode(Pr,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":J.value,"onUpdate:modelOpen":m[38]||(m[38]=H=>c("update:merge-menu-open",H)),onChange:m[39]||(m[39]=H=>c("merge-change",H))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("sep6"),to:Ce.value},[m[77]||(m[77]=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:ve("numFmt"),to:Ce.value},[t.createElementVNode("div",Wa,[t.createElementVNode("div",Pa,[t.createVNode(Kt,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:Le("numFmt")?"auto":92,"menu-width":(Le("numFmt"),150),"visible-count":8,title:t.unref(I)(e.locale,"numberFormat"),"fallback-label":b.value,align:"right",onChange:m[40]||(m[40]=H=>c("number-format-change",String(H)))},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(I)(e.locale,"nfIncreaseDecimals"),disabled:!e.canIncreaseDecimals,onClick:m[41]||(m[41]=H=>c("increase-decimals"))},[...m[78]||(m[78]=[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,Ka),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canDecreaseDecimals}]),title:t.unref(I)(e.locale,"nfDecreaseDecimals"),disabled:!e.canDecreaseDecimals,onClick:m[42]||(m[42]=H=>c("decrease-decimals"))},[...m[79]||(m[79]=[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,Ua)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("sep7"),to:Ce.value},[m[80]||(m[80]=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:ve("calc"),to:Ce.value},[t.createElementVNode("div",Ga,[t.createElementVNode("div",Ya,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(I)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:m[43]||(m[43]=H=>c("calc-sum"))},[...m[81]||(m[81]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("path",{d:"M19 3H5l7 9-7 9h14v-2H8l5.5-7L8 5h11z"})],-1)])],8,Xa),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:P,class:"toolbar-btn toolbar-split__arrow",title:t.unref(I)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:m[44]||(m[44]=H=>c("update:calc-menu-open",!e.calcMenuOpen))},[...m[82]||(m[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,ja),t.createVNode(Gr,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":P.value,disabled:e.isSingleCell,"onUpdate:modelOpen":m[45]||(m[45]=H=>c("update:calc-menu-open",H)),onChange:m[46]||(m[46]=H=>c(`calc-${H}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("sort"),to:Ce.value},[t.createElementVNode("div",Za,[t.createElementVNode("div",qa,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.cachedSortOrder==="asc"?t.unref(I)(e.locale,"sortAsc"):t.unref(I)(e.locale,"sortDesc"),disabled:!e.canSort,onClick:m[47]||(m[47]=H=>c("apply-sort"))},[(t.openBlock(),t.createElementBlock("svg",Qa,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,H=>t.createElementVNode("line",{key:H.name,x1:H.x1,y1:H.y1,x2:H.x2,y2:H.y2},null,8,ei)),64)),t.createElementVNode("path",{d:u[e.cachedSortOrder]},null,8,ti)]))],8,Ja),t.createElementVNode("button",{ref_key:"sortArrowRef",ref:Z,class:"toolbar-btn toolbar-split__arrow",title:t.unref(I)(e.locale,"sort"),disabled:!e.canSort,onClick:m[48]||(m[48]=H=>c("update:sort-menu-open",!e.sortMenuOpen))},[...m[83]||(m[83]=[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,li),t.createVNode(Lr,{"model-open":e.sortMenuOpen,locale:e.locale,"current-sort":e.cachedSortOrder,"trigger-el":Z.value,"onUpdate:modelOpen":m[49]||(m[49]=H=>c("update:sort-menu-open",H)),onChange:m[50]||(m[50]=H=>c("sort-change",H))},null,8,["model-open","locale","current-sort","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("freeze"),to:Ce.value},[t.createElementVNode("div",oi,[t.createVNode(Kt,{class:"toolbar-freeze","model-value":"",options:ft.value,width:Le("freeze")?"100%":44,"menu-width":Le("freeze")?120:void 0,"visible-count":4,align:"right",title:t.unref(I)(e.locale,"freezePane"),"trigger-icon":an,onChange:m[51]||(m[51]=H=>c("freeze-change",String(H)))},null,8,["options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("find"),to:Ce.value},[t.createElementVNode("div",ni,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(I)(e.locale,"find"),onClick:ce},[...m[84]||(m[84]=[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)])],8,ri)])],8,["disabled","to"])),Je.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:d,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":Y.value}]),type:"button",onClick:U},[...m[85]||(m[85]=[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.openBlock(),t.createElementBlock("div",{ref_key:"overflowMenuEl",ref:S,key:ae.value,class:t.normalizeClass(["overflow-menu",{"no-anim":X.value}]),style:t.normalizeStyle(N.value),onMousedown:m[53]||(m[53]=t.withModifiers(()=>{},["prevent"]))},null,38)),[[t.vShow,Y.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-a97a071a"]]),fi=["title"],mi={class:"tab-list"},pi=["onClick","onDblclick","onContextmenu"],hi=["value"],gi={key:1,class:"tab-item__name"},yi=["title"],bi=["disabled"],Ci=["title","onClick"],vi={class:"tab-list-menu__name"},wi=["title","disabled","onClick"],ki=["disabled"],Ei=8,Si=Jt(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:o}){const n=e,l=o,a=t.ref(null),i=t.ref(!1),r=t.ref(0),u=t.ref({left:0,bottom:0}),p=t.ref(null),h=t.computed(()=>Math.min(Ei,n.sheets.length)),S=t.computed(()=>n.sheets.slice(r.value,r.value+h.value)),d=t.computed(()=>r.value>0),v=t.computed(()=>r.value+h.value<n.sheets.length),w=t.computed(()=>n.sheets.length>h.value),k=t.computed(()=>n.sheets.length>1);t.watch(()=>n.sheets.length,()=>{if(!i.value)return;const Ae=Math.max(0,n.sheets.length-h.value);r.value>Ae&&(r.value=Ae)});function Z(Ae){r.value=Math.max(0,Math.min(n.sheets.length-h.value,r.value+Ae))}function J(){if(i.value){i.value=!1;return}const Ae=a.value;if(!Ae)return;const Be=Ae.getBoundingClientRect();u.value={left:Be.left,bottom:window.innerHeight-Be.top+4};const Ne=n.activeSheetIndex;r.value=Ne>=0?Math.max(0,Math.min(Ne-Math.floor(h.value/2),n.sheets.length-h.value)):0,i.value=!0}function P(Ae){l("tab-click",Ae),i.value=!1}function $(Ae){k.value&&l("delete-sheet",Ae)}function y(Ae){var Ue;if(!i.value)return;const Be=Ae.target;if((Ue=a.value)!=null&&Ue.contains(Be))return;const Ne=document.querySelector(".tab-list-menu");Ne!=null&&Ne.contains(Be)||(i.value=!1)}function Y(Ae){i.value&&Ae.key==="Escape"&&(i.value=!1)}function X(Ae){i.value&&(Ae.preventDefault(),Z(Ae.deltaY>0?1:-1))}function ae(){i.value=!1}function De(Ae){!i.value||Ae.target===p.value||ae()}const Je=t.ref(0),Le=t.ref(!1);function Ce(Ae){i.value&&(Je.value=Ae.touches[0].clientY,Le.value=!0)}function ve(Ae){if(!i.value||!Le.value)return;const Be=Ae.touches[0].clientY-Je.value;Math.abs(Be)>5&&(Z(Be<0?1:-1),Je.value=Ae.touches[0].clientY)}function Ke(){Le.value=!1}return t.watch(i,Ae=>{t.nextTick(()=>{var Be,Ne;Ae?(Be=p.value)==null||Be.addEventListener("wheel",X,{passive:!1}):(Ne=p.value)==null||Ne.removeEventListener("wheel",X)})}),t.onMounted(()=>{document.addEventListener("pointerdown",y),document.addEventListener("keydown",Y),window.addEventListener("resize",ae),window.addEventListener("scroll",De,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",y),document.removeEventListener("keydown",Y),window.removeEventListener("resize",ae),window.removeEventListener("scroll",De,!0)}),(Ae,Be)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:Be[8]||(Be[8]=Ne=>l("tabbar-contextmenu",Ne))},[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(I)(e.locale,"sheetList"),onClick:J},[...Be[9]||(Be[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,fi),t.createElementVNode("div",mi,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(Ne,Ue)=>(t.openBlock(),t.createElementBlock("div",{key:Ne.id,class:t.normalizeClass(["tab-item",{"tab-item--active":Ue===e.activeSheetIndex}]),onClick:Xe=>l("tab-click",Ue),onDblclick:t.withModifiers(Xe=>l("tab-dblclick",Ue),["prevent"]),onContextmenu:Xe=>l("tab-contextmenu",{ev:Xe,i:Ue})},[e.renTab===Ue?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:Be[0]||(Be[0]=Xe=>l("tab-rename-input",Xe.target.value)),onKeydown:Be[1]||(Be[1]=Xe=>l("tab-rename-keydown",Xe)),onBlur:Be[2]||(Be[2]=Xe=>l("tab-rename-commit")),onClick:Be[3]||(Be[3]=t.withModifiers(()=>{},["stop"]))},null,40,hi)):(t.openBlock(),t.createElementBlock("span",gi,t.toDisplayString(Ne.name),1))],42,pi))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(I)(e.locale,"addSheet"),onClick:Be[4]||(Be[4]=Ne=>l("add-sheet"))}," + ",8,yi),(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:u.value.left+"px",bottom:u.value.bottom+"px"}),onMousedown:Be[7]||(Be[7]=t.withModifiers(()=>{},["prevent"]))},[w.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!d.value}]),disabled:!d.value,onClick:Be[5]||(Be[5]=Ne=>Z(-1))},[...Be[10]||(Be[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,bi)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:p,class:"tab-list-menu__list",onTouchstart:Ce,onTouchmove:ve,onTouchend:Ke},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(S.value,Ne=>(t.openBlock(),t.createElementBlock("div",{key:Ne.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(Ne)===e.activeSheetIndex}]),title:Ne.name,onClick:Ue=>P(e.sheets.indexOf(Ne))},[t.createElementVNode("span",vi,t.toDisplayString(Ne.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(I)(e.locale,"delete"),disabled:!k.value,onClick:t.withModifiers(Ue=>$(e.sheets.indexOf(Ne)),["stop"])},[...Be[11]||(Be[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,wi)],10,Ci))),128))],544),w.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!v.value}]),disabled:!v.value,onClick:Be[6]||(Be[6]=Ne=>Z(1))},[...Be[12]||(Be[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,ki)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-ec10bade"]]),Ri=["placeholder","value"],Mi=["placeholder","value"],xi={class:"find-bar__chk"},Bi=["checked"],Di={class:"find-bar__chk"},Ti=["checked"],Ni={class:"find-bar__count"},Ii=["title","disabled"],Fi=["title","disabled"],Ai=["disabled"],Vi=["disabled"],Hi=["title"],Oi=Jt(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 n=e,l=o,a=t.ref(null),i=t.computed(()=>n.total>0?`${n.currentIndex+1}/${n.total}`:n.message||""),r=t.computed(()=>[{label:I(n.locale,"scopeSheet"),value:"sheet"},{label:I(n.locale,"scopeWorkbook"),value:"workbook"},{label:I(n.locale,"scopeSelection"),value:"selection"}]);t.watch(()=>n.focusToken,()=>{t.nextTick(()=>{var p;return(p=a.value)==null?void 0:p.focus()})});function u(p){p.key==="Enter"?(p.preventDefault(),p.shiftKey?l("prev"):l("next")):p.key==="Escape"&&(p.preventDefault(),l("close"))}return(p,h)=>e.open?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("input",{ref_key:"findInputRef",ref:a,class:"find-bar__input",placeholder:t.unref(I)(e.locale,"findPlaceholder"),value:e.findText,onInput:h[0]||(h[0]=S=>l("update:findText",S.target.value)),onKeydown:u},null,40,Ri),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(I)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:h[1]||(h[1]=S=>l("update:replaceText",S.target.value)),onKeydown:u},null,40,Mi),t.createVNode(Kt,{class:"find-bar__dropdown","model-value":e.scope,options:r.value,title:t.unref(I)(e.locale,"findScope"),"onUpdate:modelValue":h[2]||(h[2]=S=>p.$emit("update:scope",S))},null,8,["model-value","options","title"]),t.createElementVNode("label",xi,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchCase,onChange:h[3]||(h[3]=S=>l("update:matchCase",S.target.checked))},null,40,Bi),h[10]||(h[10]=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(I)(e.locale,"matchCase")),1)]),t.createElementVNode("label",Di,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchEntireCell,onChange:h[4]||(h[4]=S=>l("update:matchEntireCell",S.target.checked))},null,40,Ti),h[11]||(h[11]=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(I)(e.locale,"matchEntireCell")),1)]),t.createElementVNode("span",Ni,t.toDisplayString(i.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(I)(e.locale,"findPrev"),disabled:e.total===0,onClick:h[5]||(h[5]=S=>l("prev"))},[...h[12]||(h[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,Ii),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(I)(e.locale,"findNext"),disabled:e.total===0,onClick:h[6]||(h[6]=S=>l("next"))},[...h[13]||(h[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,Fi),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:h[7]||(h[7]=S=>l("replace"))},t.toDisplayString(t.unref(I)(e.locale,"replace")),9,Ai),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:h[8]||(h[8]=S=>l("replace-all"))},t.toDisplayString(t.unref(I)(e.locale,"replaceAll")),9,Vi),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(I)(e.locale,"findClose"),onClick:h[9]||(h[9]=S=>l("close"))},[...h[14]||(h[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,Hi)],4)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-3120909b"]]),zi={class:"nf-dialog__header"},Li={class:"nf-dialog__title"},_i={class:"nf-dialog__body"},$i={class:"nf-field"},Wi={class:"nf-field__label"},Pi={key:0,class:"nf-field"},Ki={class:"nf-field__label"},Ui={key:1,class:"nf-field nf-field--inline"},Gi={class:"nf-checkbox"},Yi={key:2,class:"nf-field"},Xi={class:"nf-field__label"},ji={key:3,class:"nf-field"},Zi={class:"nf-field__label"},qi={key:4,class:"nf-field"},Ji={class:"nf-field__label"},Qi={key:5,class:"nf-field"},ec={class:"nf-field__label"},tc={key:6,class:"nf-field"},lc={class:"nf-field__label"},oc={class:"nf-field"},nc={class:"nf-field__label"},rc={class:"nf-dialog__footer"},ac={class:"nf-preview"},ic={class:"nf-preview__label"},cc={class:"nf-preview__value"},sc={class:"nf-dialog__actions"},dc=Jt(t.defineComponent({__name:"numberFormatDialog",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 n=e,l=o,a=t.ref(!1),i=t.ref("general"),r=t.ref(2),u=t.ref(!1),p=t.ref("$"),h=t.ref("m/d/yyyy"),S=t.ref("h:mm:ss"),d=t.ref("m/d/yyyy h:mm:ss"),v=t.ref("[h]:mm:ss"),w=t.ref(""),k=t.ref(null),Z=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],J=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],P=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],$=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],y=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],Y=t.computed(()=>n.locale==="zh-CN"?[...J,...P]:[...P,...J]),X=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],ae=t.computed(()=>n.locale==="zh-CN"?[...$,...y]:[...y,...$]),De=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],Je={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"},Le=t.computed(()=>cr.map(me=>({label:I(n.locale,Je[me]),value:me}))),Ce=Z.map(me=>({label:me.label,value:me.value})),ve=t.computed(()=>Y.value.map(me=>({label:me,value:me}))),Ke=X.map(me=>({label:me,value:me})),Ae=t.computed(()=>ae.value.map(me=>({label:me,value:me}))),Be=De.map(me=>({label:me,value:me})),Ne=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),Ue=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),Xe=t.computed(()=>i.value==="date"),ie=t.computed(()=>i.value==="time"),ge=t.computed(()=>i.value==="dateTime"),f=t.computed(()=>i.value==="duration"),N=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function A(){if(i.value==="general")return Rl;if(i.value==="text")return ol;if(i.value==="custom")return w.value;if(i.value==="date")return h.value;if(i.value==="time")return S.value;if(i.value==="dateTime")return d.value;if(i.value==="duration")return v.value;const me=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?Q(i.value,me,u.value,p.value):gr(n.locale,i.value,me,u.value)}function Q(me,ze,lt,kt){const ht=lt?"#,##0":"0";if(me==="currencyRounded")return kt+ht;const St=ze>0?"."+"0".repeat(ze):"",zt=ht+St;return me==="currency"?kt+zt:`${kt}${zt};(${kt}${zt});${kt}"-"`}function U(me){if(w.value=me,nl(me)){i.value="general";return}if(me==="@"){i.value="text";return}const ze=me.replace(/\[[^\]]*\]/gi,St=>/\[h\]/i.test(St)?St:"");if(/\[h\]/i.test(ze)&&!/[yd]/i.test(ze)){i.value="duration",De.includes(me)&&(v.value=me);return}const lt=/[yd]/i.test(ze),kt=/h|s|AM\/PM/i.test(ze);if(lt&&kt){i.value="dateTime",ae.value.includes(me)&&(d.value=me);return}if(lt||/AM\/PM/i.test(ze)){kt&&!lt?(i.value="time",X.includes(me)&&(S.value=me)):(i.value="date",Y.value.includes(me)&&(h.value=me));return}if(me.includes("%")){i.value="percent",r.value=ce(me);return}if(/E[+-]/i.test(me)){i.value="scientific",r.value=ce(me);return}const ht=Z.find(St=>me.startsWith(St.value));if(me.includes("[Red](")){i.value="financial",u.value=me.includes(","),r.value=ce(me);return}if(ht){me.includes("(")?(i.value="accounting",p.value=ht.value,u.value=me.includes(","),r.value=ce(me)):/\.\d/.test(me.slice(ht.value.length))?(i.value="currency",p.value=ht.value,u.value=me.includes(","),r.value=ce(me)):(i.value="currencyRounded",p.value=ht.value,u.value=me.includes(","));return}i.value="number",u.value=me.includes(","),r.value=ce(me)}function ce(me){const ze=me.match(/\.([0#?]+)/);return ze?ze[1].length:0}function V(){i.value!=="custom"&&(w.value=A())}function c(){}function b(){h.value=Y.value[0],S.value=X[0],d.value=ae.value[0],v.value=De[0]}function ft(){a.value=!0,n.modelOpen!==void 0&&l("update:modelOpen",!0),b(),U(n.currentFormat??""),n.isCustom&&(i.value="custom"),t.nextTick(()=>{var me;return(me=k.value)==null?void 0:me.focus()})}function se(){a.value=!1,n.modelOpen!==void 0&&l("update:modelOpen",!1)}function m(){l("apply",w.value),se()}function H(){se()}function Qe(me){me.key==="Escape"&&se()}t.watch(()=>n.modelOpen,me=>{me&&!a.value?ft():!me&&a.value&&se()});const wt=t.computed(()=>zl(n.sampleValue,w.value,n.locale));return(me,ze)=>(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:H,onKeydown:Qe},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:ze[9]||(ze[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",zi,[t.createElementVNode("span",Li,t.toDisplayString(t.unref(I)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:se},[...ze[10]||(ze[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",_i,[t.createElementVNode("div",$i,[t.createElementVNode("label",Wi,t.toDisplayString(t.unref(I)(e.locale,"nfCategory")),1),t.createVNode(Kt,{class:"nf-field__dropdown","model-value":i.value,options:Le.value,"onUpdate:modelValue":ze[0]||(ze[0]=lt=>i.value=lt),onChange:V},null,8,["model-value","options"])]),N.value?(t.openBlock(),t.createElementBlock("div",Pi,[t.createElementVNode("label",Ki,t.toDisplayString(t.unref(I)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ze[1]||(ze[1]=lt=>r.value=lt),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:V},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),Ne.value?(t.openBlock(),t.createElementBlock("div",Ui,[t.createElementVNode("label",Gi,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ze[2]||(ze[2]=lt=>u.value=lt),type:"checkbox",onChange:V},null,544),[[t.vModelCheckbox,u.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(I)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),Ue.value?(t.openBlock(),t.createElementBlock("div",Yi,[t.createElementVNode("label",Xi,t.toDisplayString(t.unref(I)(e.locale,"nfSymbol")),1),t.createVNode(Kt,{class:"nf-field__dropdown","model-value":p.value,options:t.unref(Ce),"onUpdate:modelValue":ze[3]||(ze[3]=lt=>p.value=lt),onChange:V},null,8,["model-value","options"])])):t.createCommentVNode("",!0),Xe.value?(t.openBlock(),t.createElementBlock("div",ji,[t.createElementVNode("label",Zi,t.toDisplayString(t.unref(I)(e.locale,"nfDateFormat")),1),t.createVNode(Kt,{class:"nf-field__dropdown","model-value":h.value,options:ve.value,"onUpdate:modelValue":ze[4]||(ze[4]=lt=>h.value=lt),onChange:V},null,8,["model-value","options"])])):t.createCommentVNode("",!0),ie.value?(t.openBlock(),t.createElementBlock("div",qi,[t.createElementVNode("label",Ji,t.toDisplayString(t.unref(I)(e.locale,"nfTimeFormat")),1),t.createVNode(Kt,{class:"nf-field__dropdown","model-value":S.value,options:t.unref(Ke),"onUpdate:modelValue":ze[5]||(ze[5]=lt=>S.value=lt),onChange:V},null,8,["model-value","options"])])):t.createCommentVNode("",!0),ge.value?(t.openBlock(),t.createElementBlock("div",Qi,[t.createElementVNode("label",ec,t.toDisplayString(t.unref(I)(e.locale,"nfDateTime")),1),t.createVNode(Kt,{class:"nf-field__dropdown","model-value":d.value,options:Ae.value,"onUpdate:modelValue":ze[6]||(ze[6]=lt=>d.value=lt),onChange:V},null,8,["model-value","options"])])):t.createCommentVNode("",!0),f.value?(t.openBlock(),t.createElementBlock("div",tc,[t.createElementVNode("label",lc,t.toDisplayString(t.unref(I)(e.locale,"nfDuration")),1),t.createVNode(Kt,{class:"nf-field__dropdown","model-value":v.value,options:t.unref(Be),"onUpdate:modelValue":ze[7]||(ze[7]=lt=>v.value=lt),onChange:V},null,8,["model-value","options"])])):t.createCommentVNode("",!0),t.createElementVNode("div",oc,[t.createElementVNode("label",nc,t.toDisplayString(t.unref(I)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:k,"onUpdate:modelValue":ze[8]||(ze[8]=lt=>w.value=lt),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:c},null,544),[[t.vModelText,w.value]])])]),t.createElementVNode("div",rc,[t.createElementVNode("div",ac,[t.createElementVNode("span",ic,t.toDisplayString(t.unref(I)(e.locale,"nfPreview")),1),t.createElementVNode("span",cc,t.toDisplayString(wt.value||"—"),1)]),t.createElementVNode("div",sc,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:m},t.toDisplayString(t.unref(I)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:se},t.toDisplayString(t.unref(I)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-39792a0b"]]),uc={class:"sort-confirm__header"},fc={class:"sort-confirm__title"},mc={class:"sort-confirm__body"},pc={class:"sort-confirm__message"},hc={class:"sort-confirm__options"},gc={class:"sort-confirm__option"},yc={class:"sort-confirm__option"},bc={class:"sort-confirm__footer"},Cc=Jt(t.defineComponent({__name:"sortConfirmDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","confirm","cancel"],setup(e,{emit:o}){const n=e,l=o,a=t.ref(!1),i=t.ref(!0),r=t.ref(null);t.watch(()=>n.modelOpen,w=>{w&&!a.value?u():!w&&a.value&&p()});function u(){i.value=!0,a.value=!0,n.modelOpen!==void 0&&l("update:modelOpen",!0),t.nextTick(()=>{var k;const w=(k=r.value)==null?void 0:k.querySelector(".sort-confirm__btn--primary");w==null||w.focus()})}function p(){a.value=!1,n.modelOpen!==void 0&&l("update:modelOpen",!1)}function h(){v()}function S(w){w.key==="Escape"&&v()}function d(){l("confirm",i.value),p()}function v(){l("cancel"),p()}return(w,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:h,onKeydown:S},[t.createElementVNode("div",{ref_key:"dialogRef",ref:r,class:"sort-confirm",onMousedown:k[2]||(k[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",uc,[t.createElementVNode("span",fc,t.toDisplayString(t.unref(I)(e.locale,"sortReminderTitle")),1),t.createElementVNode("button",{class:"sort-confirm__close",type:"button",onClick:v},[...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",mc,[t.createElementVNode("p",pc,t.toDisplayString(t.unref(I)(e.locale,"sortReminderMessage")),1),t.createElementVNode("div",hc,[t.createElementVNode("label",gc,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":k[0]||(k[0]=Z=>i.value=Z),type:"radio",value:!0},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(I)(e.locale,"sortExpandSelection")),1)]),t.createElementVNode("label",yc,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":k[1]||(k[1]=Z=>i.value=Z),type:"radio",value:!1},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(I)(e.locale,"sortCurrentSelection")),1)])])]),t.createElementVNode("div",bc,[t.createElementVNode("button",{class:"sort-confirm__btn sort-confirm__btn--primary",type:"button",onClick:d},t.toDisplayString(t.unref(I)(e.locale,"sort")),1),t.createElementVNode("button",{class:"sort-confirm__btn",type:"button",onClick:v},t.toDisplayString(t.unref(I)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-d26d5917"]]);function mt(e){let o="",n=e;do o=String.fromCharCode(65+n%26)+o,n=Math.floor(n/26)-1;while(n>=0);return o}function Vo(e){let o=0;for(let n=0;n<e.length;n++)o=o*26+(e.toUpperCase().charCodeAt(n)-64);return o-1}function Zl(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 Ho(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 ro(e,o){return`${e},${o}`}function mo(e,o,n){const l=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!l)return null;const a=Vo(l[1]),i=parseInt(l[2],10)-1;return a<0||a>=o||i<0||i>=n?null:{col:a,row:i}}function Ll(e,o){if(!o)return{x:0,y:0};const n=o.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}const cn=[{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)"}],vc={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 wc(e){let o=0,n=null;for(let l=0;l<e.length;l++){const a=e[l];if(n){a===n&&(e[l+1]===n?l++:n=null);continue}if(a==='"'||a==="'"){n=a;continue}if(a==="(")o++;else if(a===")"&&(o--,o<0))return!1}return o===0}function kc(e){const o=e.trim();if(!o.startsWith("="))return{ok:!1,name:null};const n=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(o.slice(1).trim());if(!n)return{ok:!1,name:null};const l=n[1].toUpperCase(),a=vc[l];if(!a)return{ok:!1,name:l};const i=n[2];if(!wc(i))return{ok:!1,name:l};const r=ql(i),u=r.length===1&&r[0].trim()===""?0:r.length;return u<a.min||u>a.max?{ok:!1,name:l}:r.some(p=>p.trim()==="")?{ok:!1,name:l}:{ok:!0,name:l}}function ao(e,o,n){const l=e.split(":");if(l.length!==2)return null;const a=mo(l[0],o,n),i=mo(l[1],o,n);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 sn(e){const o=e.trim();if(o==="")return"";const n=Number(o);return!isNaN(n)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(o)?n:e}function yl(e,o,n,l,a){const i=n[ro(e,o)];if(!i)return"";const r=i.value;return r.startsWith("=")?un(ro(e,o),n,l,a):sn(r)}function dn(e,o,n,l,a){const i=yl(e,o,n,l,a);if(i===null)return 0;if(typeof i=="number")return i;const r=parseFloat(String(i));return isNaN(r)?0:r}const po=new Map,wo=new Set;function ho(){po.clear(),wo.clear()}function un(e,o,n,l){return Ec(e,o,n,l,0)}function Ec(e,o,n,l,a){if(wo.has(e))return null;if(po.has(e))return po.get(e);wo.add(e);const i=o[e];let r;if(!i)r=null;else{const u=i.value;if(!u.startsWith("="))r=sn(u);else{const p=u.slice(1).trim(),h=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(p);r=h?hn(h[1].toUpperCase(),h[2],o,n,l,a+1):Wt(p,o,n,l,a+1)}}return wo.delete(e),po.set(e,r),r}function Oo(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function fn(e,o){return typeof e=="number"&&typeof o=="number"?e===o:String(e??"")===String(o??"")}function mn(e,o,n){let l;if(typeof e=="number"&&typeof o=="number")l=e<o?-1:e>o?1:0;else{const a=String(e??""),i=String(o??"");l=a<i?-1:a>i?1:0}switch(n){case"=":return l===0;case"<>":return l!==0;case"<":return l<0;case">":return l>0;case"<=":return l<=0;case">=":return l>=0}return!1}function pn(e,o,n,l){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 Sc(e,o,n,l,a,i){let u=o.trim();u.length>=2&&(u[0]==='"'&&u[u.length-1]==='"'||u[0]==="'"&&u[u.length-1]==="'")&&(u=u.slice(1,-1));const p=/^([<>=]+)([\s\S]*)$/.exec(u);if(p){const S=p[1],d=pn(p[2]);return mn(e,d,S)}const h=pn(u);return fn(e,h)}function Rc(e,o,n,l,a){const i=e.trim(),r=["<=",">=","<>"];let u=null,p=-1,h=null,S=0;for(let v=0;v<i.length;v++){const w=i[v];if(h){w===h&&(i[v+1]===h?v++:h=null);continue}if(w==='"'||w==="'"){h=w;continue}if(w==="("&&S++,w===")"&&S--,S===0&&(w==="<"||w===">"||w==="=")){const k=i.slice(v,v+2);u=r.includes(k)?k:w,p=v;break}}if(u&&p>=0){const v=i.slice(0,p).trim(),w=i.slice(p+u.length).trim(),k=Wt(v,o,n,l,a),Z=Wt(w,o,n,l,a);return mn(k,Z,u)}const d=Wt(i,o,n,l,a);return Oo(d)}function ql(e){const o=[];let n=0,l=null,a="";for(let i=0;i<e.length;i++){const r=e[i];if(l){a+=r,r===l&&(e[i+1]===l?(i++,a+=l):l=null);continue}if(r==='"'||r==="'"){l=r,a+=r;continue}if(r==="("&&n++,r===")"&&n--,r===","&&n===0){o.push(a),a="";continue}a+=r}return o.push(a),o}function Wt(e,o,n,l,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 u=Mc(i);if(u.length===0)return null;let p=0;const h=()=>{let w=S();for(;p<u.length;){const k=u[p];if(k.type==="op"&&(k.val==="+"||k.val==="-"))p++,w=zo(w,S(),k.val);else break}return w},S=()=>{let w=d();for(;p<u.length;){const k=u[p];if(k.type==="op"&&(k.val==="*"||k.val==="/"))p++,w=zo(w,d(),k.val);else break}return w},d=()=>{const w=u[p];return w&&w.type==="op"&&w.val==="-"?(p++,zo(0,d(),"-")):w&&w.type==="op"&&w.val==="+"?(p++,d()):v()},v=()=>{const w=u[p];if(!w)return null;if(w.type==="num")return p++,Number(w.val);if(w.type==="str")return p++,w.val;if(w.type==="lp"){p++;const k=h();return u[p]&&u[p].type==="rp"&&p++,k}if(w.type==="ref"){p++;const k=mo(w.val,n,l);return k?yl(k.col,k.row,o,n,l):null}if(w.type==="func"){const k=w.val.toUpperCase();if(p++,u[p]&&u[p].type==="lp"){const Z=u[p];let J=0,P=null,$=p;for(;$<u.length;$++)if(u[$].type==="lp")J++;else if(u[$].type==="rp"&&(J--,J===0)){P=u[$];break}if(P){const y=i.slice(Z.start+1,P.start);return p=$+1,hn(k,y,o,n,l,a+1)}}return null}return p++,null};return h()}function Mc(e){const o=[];let n=0;for(;n<e.length;){const l=e[n];if(/\s/.test(l)){n++;continue}if(l==='"'||l==="'"){const a=l,i=n;n++;let r="";for(;n<e.length;){if(e[n]===a){if(e[n+1]===a){r+=a,n+=2;continue}n++;break}r+=e[n],n++}o.push({type:"str",val:r,start:i});continue}if(/[0-9]/.test(l)||l==="."){const a=n;let i="";for(l==="."&&(i+=".",n++);n<e.length&&/[0-9]/.test(e[n]);)i+=e[n],n++;if(e[n]===".")for(i+=".",n++;n<e.length&&/[0-9]/.test(e[n]);)i+=e[n],n++;if(e[n]==="e"||e[n]==="E")for(i+=e[n],n++,(e[n]==="+"||e[n]==="-")&&(i+=e[n],n++);n<e.length&&/[0-9]/.test(e[n]);)i+=e[n],n++;o.push({type:"num",val:i,start:a});continue}if(/[A-Za-z_]/.test(l)){const a=n;let i="";for(;n<e.length&&/[A-Za-z0-9_]/.test(e[n]);)i+=e[n],n++;e[n]==="("?o.push({type:"func",val:i,start:a}):o.push({type:"ref",val:i,start:a});continue}if(l==="("){o.push({type:"lp",val:l,start:n}),n++;continue}if(l===")"){o.push({type:"rp",val:l,start:n}),n++;continue}if(l===","){o.push({type:"comma",val:l,start:n}),n++;continue}if(l==="+"||l==="-"||l==="*"||l==="/"){o.push({type:"op",val:l,start:n}),n++;continue}n++}return o}function zo(e,o,n){if(typeof e!="number"||typeof o!="number")return null;switch(n){case"+":return e+o;case"-":return e-o;case"*":return e*o;case"/":return o===0?null:e/o}return null}function hn(e,o,n,l,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=ao(o.trim(),l,a);if(!r)return null;if(e==="COUNT"){let p=0;for(let h=r.sc;h<=r.ec;h++)for(let S=r.sr;S<=r.er;S++)typeof yl(h,S,n,l,a)=="number"&&p++;return p}let u=0;for(let p=r.sc;p<=r.ec;p++)for(let h=r.sr;h<=r.er;h++)u+=dn(p,h,n,l,a);if(isNaN(u))return null;if(e==="AVERAGE"){const p=(r.ec-r.sc+1)*(r.er-r.sr+1);return p===0?null:u/p}return u}case"IF":{const r=ql(o);if(r.length<3)return null;const u=Rc(r[0],n,l,a,i);return Wt(u?r[1]:r[2],n,l,a,i)}case"VLOOKUP":{const r=ql(o);if(r.length<3)return null;const u=Wt(r[0],n,l,a,i),p=ao(r[1].trim(),l,a);if(!p)return null;const h=Wt(r[2],n,l,a,i),S=typeof h=="number"?h:parseFloat(String(h));if(isNaN(S))return null;const d=p.sc+(S-1);if(d<p.sc||d>p.ec)return null;if(r.length>=4?Oo(Wt(r[3],n,l,a,i)):!1){let w=-1,k=-1/0;for(let Z=p.sr;Z<=p.er;Z++){const J=yl(p.sc,Z,n,l,a);typeof J=="number"&&typeof u=="number"&&J<=u&&J>k&&(k=J,w=Z)}return w>=0?yl(d,w,n,l,a):null}for(let w=p.sr;w<=p.er;w++){const k=yl(p.sc,w,n,l,a);if(fn(k,u))return yl(d,w,n,l,a)}return null}case"CONCATENATE":{const r=ql(o);let u="";for(const p of r){const h=Wt(p,n,l,a,i);u+=h===null?"":typeof h=="number"?String(h):h}return u}case"MAX":case"MIN":{const r=ao(o.trim(),l,a);if(!r)return null;const u=[];for(let p=r.sc;p<=r.ec;p++)for(let h=r.sr;h<=r.er;h++){const S=yl(p,h,n,l,a);typeof S=="number"&&u.push(S)}return u.length===0?null:e==="MAX"?Math.max(...u):Math.min(...u)}case"STDEV":{const r=ao(o.trim(),l,a);if(!r)return null;const u=[];for(let d=r.sc;d<=r.ec;d++)for(let v=r.sr;v<=r.er;v++){const w=yl(d,v,n,l,a);typeof w=="number"&&u.push(w)}const p=u.length;if(p<2)return null;const h=u.reduce((d,v)=>d+v,0)/p,S=u.reduce((d,v)=>d+Math.pow(v-h,2),0)/(p-1);return Math.sqrt(S)}case"SIN":{const r=ql(o);if(r.length!==1)return null;const u=Wt(r[0],n,l,a,i);return typeof u!="number"?null:Math.sin(u)}case"SUMIF":{const r=ql(o);if(r.length<2||r.length>3)return null;const u=ao(r[0].trim(),l,a);if(!u)return null;const p=r.length===3?ao(r[2].trim(),l,a):u;if(!p)return null;let h=0;for(let S=u.sr;S<=u.er;S++)for(let d=u.sc;d<=u.ec;d++){const v=yl(d,S,n,l,a);Sc(v,r[1])&&(h+=dn(p.sc+(d-u.sc),p.sr+(S-u.sr),n,l,a))}return h}case"PMT":{const r=ql(o);if(r.length<3||r.length>5)return null;const u=Wt(r[0],n,l,a,i),p=Wt(r[1],n,l,a,i),h=Wt(r[2],n,l,a,i);if(typeof u!="number"||typeof p!="number"||typeof h!="number")return null;const S=r.length>=4?Wt(r[3],n,l,a,i):0,d=typeof S=="number"?S:0,v=r.length>=5?Wt(r[4],n,l,a,i):0,w=Oo(v)?1:0;if(u===0)return p===0?null:-(h+d)/p;const k=Math.pow(1+u,p);return-(d+h*k)*u/((1+u*w)*(k-1))}default:return null}}function ko(e,o,n){const l=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=mo(i[1],o,n);if(r)if(i[2]){const u=mo(i[2],o,n);if(!u)continue;for(let p=Math.min(r.col,u.col);p<=Math.max(r.col,u.col);p++)for(let h=Math.min(r.row,u.row);h<=Math.max(r.row,u.row);h++)l.push(ro(p,h))}else l.push(ro(r.col,r.row))}return l}function gn(e,o,n,l,a){const i=n[ro(e,o)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const u=un(ro(e,o),n,l,a);return u===null?"#ERROR":String(u)}function yn(e,o,n,l,a,i){return o===0&&n===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,u,p,h,S)=>{const d=u?Vo(p):Vo(p)+o,v=h?parseInt(S,10)-1:parseInt(S,10)-1+n;let w;d<0?w="A":d>=l?w=i(l-1):w=i(d);let k;return v<0?k="1":v>=a?k=String(a):k=String(v+1),(u||"")+w+(h||"")+k})}class xc{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(o){var l;const n=this.deps.get(o);if(n){for(const a of n)(l=this.rev.get(a))==null||l.delete(o);this.deps.delete(o)}}set(o,n){if(this.clear(o),n.length!==0){this.deps.set(o,n);for(const l of n)this.rev.has(l)||this.rev.set(l,new Set),this.rev.get(l).add(o)}}markDirty(o){const n=[o];for(;n.length>0;){const l=n.pop(),a=this.rev.get(l);if(a)for(const i of a)this.dirty.has(i)||(this.dirty.add(i),n.push(i))}}getDirtyAndClear(){const o=this.dirty;return this.dirty=new Set,o}rebuild(o,n,l){this.deps.clear(),this.rev.clear(),this.dirty.clear(),po.clear();for(const[a,i]of Object.entries(o))if(i.value.startsWith("=")){const r=ko(i.value.slice(1),n,l);this.set(a,r)}}}const Bc={class:"ifn-dialog__header"},Dc={class:"ifn-dialog__title"},Tc={class:"ifn-dialog__body"},Nc={class:"ifn-dialog__field"},Ic={class:"ifn-dialog__label"},Fc={key:0,class:"ifn-dialog__desc"},Ac={class:"ifn-dialog__field"},Vc={class:"ifn-dialog__label"},Hc={class:"ifn-dialog__footer"},Oc=["disabled"],zc=Jt(t.defineComponent({__name:"insertFunctionDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","insert","cancel"],setup(e,{emit:o}){const n=e,l=o,a=t.ref(!1),i=t.ref(""),r=t.ref(""),u=t.ref(null),p=t.ref(null),h={SUM:"fnDescSum",AVERAGE:"fnDescAverage",COUNT:"fnDescCount",IF:"fnDescIf",VLOOKUP:"fnDescVlookup",CONCATENATE:"fnDescConcatenate",MAX:"fnDescMax",MIN:"fnDescMin",SIN:"fnDescSin",SUMIF:"fnDescSumif",PMT:"fnDescPmt",STDEV:"fnDescStdev"},S=t.computed(()=>cn.map(X=>({label:X.name,value:X.name}))),d=t.computed(()=>{const X=String(i.value??"");return X?I(n.locale,h[X]??""):""}),v=t.computed(()=>kc(r.value)),w=t.computed(()=>i.value===""||i.value===null||!r.value.trim()||!v.value.ok?!1:v.value.name===String(i.value).toUpperCase());t.watch(()=>n.modelOpen,X=>{X&&!a.value?k():!X&&a.value&&Z()});function k(){r.value="",i.value="",a.value=!0,n.modelOpen!==void 0&&l("update:modelOpen",!0),t.nextTick(()=>{const X=u.value;if(X)try{X.focus({preventScroll:!0}),X.setSelectionRange(X.value.length,X.value.length)}catch{}})}function Z(){a.value=!1,n.modelOpen!==void 0&&l("update:modelOpen",!1)}function J(X){i.value=X;const ae=cn.find(De=>De.name===String(X));ae&&(r.value="",P(ae.snippet))}function P(X){const ae=r.value,De=u.value,Je=De?De.selectionStart??ae.length:ae.length,Le=De?De.selectionEnd??ae.length:ae.length,Ce=ae.trim()?X:"="+X;r.value=ae.slice(0,Je)+Ce+ae.slice(Le),t.nextTick(()=>{const ve=u.value;if(!ve)return;const Ke=Je+Ce.length;try{ve.focus({preventScroll:!0}),ve.setSelectionRange(Ke,Ke)}catch{}})}function $(){l("insert",r.value),Z()}function y(){l("cancel"),Z()}function Y(X){X.key==="Escape"&&(X.stopPropagation(),y())}return(X,ae)=>(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(y,["self"]),onKeydown:Y},[t.createElementVNode("div",{ref_key:"dialogRef",ref:p,class:"ifn-dialog",onMousedown:ae[1]||(ae[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Bc,[t.createElementVNode("span",Dc,t.toDisplayString(t.unref(I)(e.locale,"insertFunctionTitle")),1),t.createElementVNode("button",{class:"ifn-dialog__close",type:"button",onClick:y},[...ae[2]||(ae[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",Tc,[t.createElementVNode("div",Nc,[t.createElementVNode("label",Ic,t.toDisplayString(t.unref(I)(e.locale,"insertFunctionSelectLabel")),1),t.createVNode(Kt,{class:"ifn-dialog__dropdown","model-value":i.value,options:S.value,searchable:!0,"search-placeholder":t.unref(I)(e.locale,"insertFunctionSearchPlaceholder"),"fallback-label":t.unref(I)(e.locale,"insertFunctionPlaceholder"),title:t.unref(I)(e.locale,"insertFunctionSelectLabel"),"onUpdate:modelValue":J},null,8,["model-value","options","search-placeholder","fallback-label","title"]),d.value?(t.openBlock(),t.createElementBlock("div",Fc,t.toDisplayString(d.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",Ac,[t.createElementVNode("label",Vc,t.toDisplayString(t.unref(I)(e.locale,"insertFunctionFormulaLabel")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:u,"onUpdate:modelValue":ae[0]||(ae[0]=De=>r.value=De),class:"ifn-dialog__textarea",spellcheck:"false"},null,512),[[t.vModelText,r.value]])])]),t.createElementVNode("div",Hc,[t.createElementVNode("button",{class:"ifn-dialog__btn ifn-dialog__btn--primary",type:"button",disabled:!w.value,onClick:$},t.toDisplayString(t.unref(I)(e.locale,"insertFunctionBtn")),9,Oc),t.createElementVNode("button",{class:"ifn-dialog__btn",type:"button",onClick:y},t.toDisplayString(t.unref(I)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-f4e459b6"]]);function _l(e,o){return`${e},${o}`}function bn(e,o){if(e.startsWith("="))return{kind:"formula",formula:e};const n=vo(e,o);if(n)return{kind:"date",serial:n.serial};const l=/^(.*?)(\d+)$/.exec(e);if(l){const a=l[1],i=l[2];if(a!==""&&/^\d+$/.test(i))return{kind:"text-number",prefix:a,num:parseInt(i,10),digits:i.length}}return no(e)?{kind:"number",num:parseFloat(e)}:{kind:"text",text:e}}function Lo(e,o){for(let n=2;n<e.length;n++)if(e[n]-e[n-1]!==o)return!1;return!0}function Cn(e){const o=e.length;if(o===0)return{kind:"copy",sourceValues:[]};if(e.some(n=>n.kind==="formula"))return{kind:"formula"};if(e.every(n=>n.kind==="date")){const n=e[0],l=o>=2?e[1].serial-n.serial:1;return{kind:"date-linear",baseSerial:n.serial,step:l,sourceLen:o}}if(e.every(n=>n.kind==="number")){if(o===1)return{kind:"copy",sourceValues:[...e]};const n=e.map(a=>a.num),l=n[1]-n[0];return Lo(n,l)?{kind:"linear",step:l,base:n[0],sourceLen:o}:{kind:"copy",sourceValues:[...e]}}if(e.every(n=>n.kind==="text-number")){const n=e[0];if(e.every(a=>a.kind==="text-number"&&a.prefix===n.prefix)){if(o===1)return{kind:"copy",sourceValues:[...e]};const a=e.map(r=>r.num),i=a[1]-a[0];if(Lo(a,i))return{kind:"text-number",prefix:n.prefix,step:i,base:n.num,digits:n.digits,sourceLen:o}}return{kind:"copy",sourceValues:[...e]}}if(e.every(n=>n.kind==="text")){const n=e.every(l=>l.text.length===1&&/[a-zA-Z]/.test(l.text));if(o>=2&&n){const l=e.map(i=>i.text.charCodeAt(0)),a=l[1]-l[0];if(a!==0&&Lo(l,a))return{kind:"text-series",step:a,baseCharCode:l[0],sourceLen:o}}return{kind:"copy",sourceValues:[...e]}}return{kind:"copy",sourceValues:[...e]}}function vn(e,o,n){switch(e.kind){case"copy":{const l=e.sourceValues.length;return l===0?{kind:"text",text:""}:e.sourceValues[o%l]}case"linear":return{kind:"number",num:e.base+e.step*(n+o)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base+e.step*(n+o),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial+e.step*(n+o)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode+e.step*(n+o))};case"formula":return{kind:"formula",formula:""}}}function wn(e,o){switch(e.kind){case"copy":{const n=e.sourceValues.length;return n===0?{kind:"text",text:""}:e.sourceValues[n-1-o%n]}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 Eo(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 kn(e,o){const n=o.row<e.startRow?e.startRow-o.row:o.row>e.endRow?o.row-e.endRow:0,l=o.col<e.startCol?e.startCol-o.col:o.col>e.endCol?o.col-e.endCol:0;if(n===0&&l===0)return null;const a=n>=l?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 En(e,o,n,l,a,i){return yn(e,n.col-o.col,n.row-o.row,l,a,i)}function Sn(e,o){return!(e.endCol<o.startCol||e.startCol>o.endCol||e.endRow<o.startRow||e.startRow>o.endRow)}function Lc(e,o){return o.startCol>=e.startCol&&o.endCol<=e.endCol&&o.startRow>=e.startRow&&o.endRow<=e.endRow}function _o(e,o,n){const l=Object.keys(n);for(const a of l){const i=n[a];if(Sn(e,i)&&!Lc(e,i))return!1}for(const a of l){const i=n[a];if(Sn(o,i))return!1}return!0}function Rn(e,o,n,l){const a=o.length;if(a!==0){if(e.kind==="copy"){const i=l?a-1-n%a:n%a;return o[i]}return l?o[0]:o[a-1]}}function _c(e,o,n,l,a,i,r,u){const p={cells:{},merges:{}},h=l==="up"||l==="down",S=l==="up"||l==="left";if(h){const d=e.endRow-e.startRow+1;for(let v=e.startCol;v<=e.endCol;v++){const w=[],k=[];for(let P=e.startRow;P<=e.endRow;P++){const $=n.cells[_l(v,P)];w.push($?bn($.value,a):{kind:"text",text:""}),k.push($==null?void 0:$.styleId)}const Z=Cn(w),J=w.length;for(let P=o.startRow;P<=o.endRow;P++){const $=S?o.endRow-P:P-o.startRow;if(Z.kind==="formula"){const y=S?e.endRow-((o.endRow-P)%d+d)%d:e.startRow+((P-e.startRow)%d+d)%d,Y=n.cells[_l(v,y)],X=Y?Y.value:"",ae=En(X,{col:v,row:y},{col:v,row:P},i,r,u);p.cells[_l(v,P)]=Eo({kind:"formula",formula:ae},Y==null?void 0:Y.styleId)}else{const y=S?wn(Z,$):vn(Z,$,J),Y=Rn(Z,k,$,S);p.cells[_l(v,P)]=Eo(y,Y)}}}}else{const d=e.endCol-e.startCol+1;for(let v=e.startRow;v<=e.endRow;v++){const w=[],k=[];for(let P=e.startCol;P<=e.endCol;P++){const $=n.cells[_l(P,v)];w.push($?bn($.value,a):{kind:"text",text:""}),k.push($==null?void 0:$.styleId)}const Z=Cn(w),J=w.length;for(let P=o.startCol;P<=o.endCol;P++){const $=S?o.endCol-P:P-o.startCol;if(Z.kind==="formula"){const y=S?e.endCol-((o.endCol-P)%d+d)%d:e.startCol+((P-e.startCol)%d+d)%d,Y=n.cells[_l(y,v)],X=Y?Y.value:"",ae=En(X,{col:y,row:v},{col:P,row:v},i,r,u);p.cells[_l(P,v)]=Eo({kind:"formula",formula:ae},Y==null?void 0:Y.styleId)}else{const y=S?wn(Z,$):vn(Z,$,J),Y=Rn(Z,k,$,S);p.cells[_l(P,v)]=Eo(y,Y)}}}}return p}class $c{constructor(o){if(o&&o.length>0){this.styles=o,this.index=new Map;for(let n=0;n<this.styles.length;n++){const l=this.stableKey(this.styles[n]);this.index.set(l,n)}}else this.styles=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(o){const n=Object.keys(o).sort(),l={};for(const a of n)l[a]=o[a];return JSON.stringify(l)}get(o){const n=this.styles[o];return n?o===0?n:Object.freeze(n):{}}getId(o){if(!o||Object.keys(o).length===0)return 0;const n=this.stableKey(o),l=this.index.get(n);if(l!==void 0)return l;const a=this.styles.length,i=Object.freeze({...o});return this.styles.push(i),this.index.set(n,a),a}getStyles(){return[...this.styles]}setStyles(o){this.styles=o,this.index=new Map;for(let n=0;n<this.styles.length;n++){const l=this.stableKey(this.styles[n]);this.index.set(l,n)}}compactStyles(o){const n=new Set;n.add(0);for(const r in o){const u=o[r].styleId??0;n.add(u)}const l=new Map,a=[{}];l.set(0,0);const i=Array.from(n).sort((r,u)=>r-u);for(const r of i)if(r!==0&&r<this.styles.length){const u=a.length;l.set(r,u),a.push(this.styles[r])}for(const r in o){const u=o[r],p=u.styleId??0,h=l.get(p);h!==void 0&&h!==p&&(u.styleId=h)}this.styles=a,this.index=new Map;for(let r=0;r<this.styles.length;r++){const u=this.stableKey(this.styles[r]);this.index.set(u,r)}return a}}function Wc(e,o){if(!e)return null;const n=e.styleId;return n===void 0||n===0?null:o[n]??null}function Mn(e){const o=new $c,n={};for(const[l,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,n[l]=i}return{cells:n,styles:o.getStyles()}}function Pc(e){const o={};for(const[n,l]of Object.entries(e)){const a={value:l.value};l.styleId!==void 0&&l.styleId>0&&(a.styleId=l.styleId),o[n]=a}return o}class Kc{constructor(o){if(o&&o.length>0){this.borders=o,this.index=new Map;for(let n=0;n<this.borders.length;n++){const l=this.stableKey(this.borders[n]);this.index.set(l,n)}}else this.borders=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(o){const n=["top","right","bottom","left"],l={};for(const a of n){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),l[a]=r}}return JSON.stringify(l)}get(o){const n=this.borders[o];return n?o===0?n:Object.freeze(n):{}}getId(o){if(!o||this.isEmptyBorder(o))return 0;const n=this.stableKey(o),l=this.index.get(n);if(l!==void 0)return l;const a=this.borders.length,i=Object.freeze(this.deepCloneBorder(o));return this.borders.push(i),this.index.set(n,a),a}isEmptyBorder(o){return!o.top&&!o.right&&!o.bottom&&!o.left}deepCloneBorder(o){const n={};return o.top&&(n.top={...o.top}),o.right&&(n.right={...o.right}),o.bottom&&(n.bottom={...o.bottom}),o.left&&(n.left={...o.left}),n}getBorders(){return[...this.borders]}setBorders(o){this.borders=o,this.index=new Map;for(let n=0;n<this.borders.length;n++){const l=this.stableKey(this.borders[n]);this.index.set(l,n)}}compactBorders(o){const n=new Set;n.add(0);for(const r of o){const u=r.borderId??0;n.add(u)}const l=new Map,a=[{}];l.set(0,0);const i=Array.from(n).sort((r,u)=>r-u);for(const r of i)if(r!==0&&r<this.borders.length){const u=a.length;l.set(r,u),a.push(this.borders[r])}for(const r of o){const u=r.borderId??0,p=l.get(u);p!==void 0&&p!==u&&(r.borderId=p)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const u=this.stableKey(this.borders[r]);this.index.set(u,r)}return a}}function Uc(e,o,n,l){if(!e)return;const a=e.styleId??0,i=n[a];if(!i)return;const r=i.borderId??0;if(r===0)return;const u=l.get(r);if(u)return u[o]}function Gc(e,o,n,l,a,i){const r=l[e.styleId??0]??{},u=r.borderId??0,p=u>0?a.get(u):{},h={top:p.top?{...p.top}:void 0,right:p.right?{...p.right}:void 0,bottom:p.bottom?{...p.bottom}:void 0,left:p.left?{...p.left}:void 0};n?h[o]={...n}:h[o]=void 0;const S=a.getId(h),d={...r};S===0?delete d.borderId:d.borderId=S,delete d.borderTopWidth,delete d.borderBottomWidth,delete d.borderLeftWidth,delete d.borderRightWidth,delete d.borderColor,Object.keys(d).length===0?e.styleId=0:e.styleId=i(d)}function xn(e){const o=new Kc,n=[];for(const l of e){if(!(l.borderTopWidth!==void 0||l.borderBottomWidth!==void 0||l.borderLeftWidth!==void 0||l.borderRightWidth!==void 0)){n.push(l);continue}const i=typeof l.borderColor=="string"?l.borderColor:void 0,r={};l.borderTopWidth!==void 0&&l.borderTopWidth>0&&(r.top={width:l.borderTopWidth,color:i}),l.borderBottomWidth!==void 0&&l.borderBottomWidth>0&&(r.bottom={width:l.borderBottomWidth,color:i}),l.borderLeftWidth!==void 0&&l.borderLeftWidth>0&&(r.left={width:l.borderLeftWidth,color:i}),l.borderRightWidth!==void 0&&l.borderRightWidth>0&&(r.right={width:l.borderRightWidth,color:i});const u=o.getId(r),p={...l};delete p.borderTopWidth,delete p.borderBottomWidth,delete p.borderLeftWidth,delete p.borderRightWidth,delete p.borderColor,u>0?p.borderId=u:delete p.borderId,n.push(p)}return{styles:n,borders:o.getBorders()}}function Yc(e,o){const n=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(()=>{n.rowCount=e.rowCount??o.rowCount,n.colCount=e.colCount??o.colCount,n.width=e.width,n.height=e.height,n.theme=e.theme??o.theme,n.locale=e.locale??o.locale});const l=t.computed(()=>n.locale==="zh-CN"?"zh-CN":"en-US"),a=n.colCount,i=n.rowCount,r=t.reactive({colCount:a,rowCount:i}),u=8,p=32,h=t.reactive({}),S=t.reactive([{}]),d=t.reactive([{}]);let v=new Map;v.set("{}",0);let w=new Map;w.set("{}",0);function k(E){const x=Object.keys(E).sort(),O={};for(const W of x)O[W]=E[W];return JSON.stringify(O)}function Z(E){const x=["top","right","bottom","left"],O={};for(const W of x){const q=E[W];if(q&&(q.width!==void 0||q.color!==void 0||q.style!==void 0)){const Ee={};q.width!==void 0&&(Ee.width=q.width),q.color!==void 0&&(Ee.color=q.color),q.style!==void 0&&(Ee.style=q.style),O[W]=Ee}}return JSON.stringify(O)}function J(E){if(!E||Object.keys(E).length===0)return 0;const x=k(E),O=v.get(x);if(O!==void 0)return O;const W=S.length;return S.push(Object.freeze({...E})),v.set(x,W),W}function P(E){return Wc(E,S)}function $(){v=new Map;for(let E=0;E<S.length;E++)v.set(k(S[E]),E)}function y(E){S.splice(0,S.length,...E),$()}function Y(E){if(!E||!E.top&&!E.right&&!E.bottom&&!E.left)return 0;const x=Z(E),O=w.get(x);if(O!==void 0)return O;const W=d.length;return d.push(Object.freeze({top:E.top?Object.freeze({...E.top}):void 0,right:E.right?Object.freeze({...E.right}):void 0,bottom:E.bottom?Object.freeze({...E.bottom}):void 0,left:E.left?Object.freeze({...E.left}):void 0})),w.set(x,W),W}function X(E){return d[E]??{}}function ae(){w=new Map;for(let E=0;E<d.length;E++)w.set(Z(d[E]),E)}function De(E){d.splice(0,d.length,...E),ae()}function Je(E,x){return Uc(E,x,S,{get:O=>d[O]??{}})}function Le(E,x){const O=m(E,x);return O?O.anchor:null}function Ce(E,x,O,W){const q=m(E,x),Ee=m(O,W);return!q||!Ee?!1:q.anchor===Ee.anchor}const ve=t.reactive({}),Ke=new xc,Ae=t.ref(null),Be=t.ref("cell"),Ne=t.ref({col:0,row:0}),Ue=t.ref(null),Xe=t.ref(""),ie=t.ref(new Array(r.colCount).fill(100)),ge=t.ref(new Array(r.rowCount).fill(void 0)),f=t.ref(0),N=t.ref(0),A=t.reactive({rows:0,cols:0}),Q=t.shallowRef({active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}),U=new Map;let ce=null;function V(E,x,O,W){const q=`${W} ${O} ${x}px ${E}`,Ee=U.get(q);if(Ee)return Ee;if(!ce){if(typeof document>"u")return{ascent:x*.88,descent:x*.28};ce=document.createElement("canvas")}const Te=ce.getContext("2d");if(!Te)return{ascent:x*.88,descent:x*.28};Te.font=q;const We=Te.measureText(" "),Ze=We.fontBoundingBoxAscent,Pe=We.fontBoundingBoxDescent;if(typeof Ze=="number"&&typeof Pe=="number"&&Ze>0&&Pe>0){const ml={ascent:Ze,descent:Pe};return U.set(q,ml),ml}const Ye=["M","中","y","Ä","0"];let Tt=0,it=0;for(const ml of Ye){const io=Te.measureText(ml),co=io.actualBoundingBoxAscent||0,$l=io.actualBoundingBoxDescent||0;co>Tt&&(Tt=co),$l>it&&(it=$l)}const Nt=Math.max(Tt,x*.88),jt=Math.max(it,x*.28),Jl={ascent:Nt,descent:jt};return U.set(q,Jl),Jl}const c=V(jl,El,"normal","normal"),b=c.ascent+c.descent,ft=Math.max(0,(24-b)/2);let se=(E,x)=>`${E},${x}`,m=()=>null,H=()=>El,Qe=t.computed(()=>[0]),wt=()=>24,me=(E,x,O,W)=>({startCol:Math.min(E,O),startRow:Math.min(x,W),endCol:Math.max(E,O),endRow:Math.max(x,W)});function ze(E,x){const O=P(h[se(E,x)]),W=H(E,x),q=typeof(O==null?void 0:O.fontFamily)=="string"&&O.fontFamily?O.fontFamily:jl,Ee=(O==null?void 0:O.fontWeight)==="bold"?"bold":"normal",Te=(O==null?void 0:O.fontStyle)==="italic"?"italic":"normal";return V(q,W,Ee,Te)}function lt(E,x,O,W){if(!x)return[""];const q=x.split(`
2
+ `),Ee=[];for(const Te of q)if(!W||O<=0)Ee.push(Te);else{let We="";for(let Ze=0;Ze<Te.length;Ze++){const Pe=Te[Ze],Ye=We+Pe;E.measureText(Ye).width>O&&We?(Ee.push(We),We=Pe):We=Ye}Ee.push(We)}return Ee}function kt(E,x){const O=P(h[se(E,x)]);return typeof(O==null?void 0:O.fontSize)=="number"&&O.fontSize>0?O.fontSize:El}H=kt;const ht=t.computed(()=>{const E=[0];for(let x=0;x<r.colCount;x++)E.push(E[x]+ie.value[x]);return E});Qe=ht;const St={w:800,h:600};let zt=()=>{};const sl=t.computed(()=>{const E=new Set;for(const x in h){const O=x.indexOf(",");if(O<0)continue;const W=parseInt(x.substring(O+1),10),q=h[x];q&&(q.value!==""||q.styleId!==void 0)&&E.add(W)}for(let x=0;x<ge.value.length;x++)ge.value[x]!==void 0&&E.add(x);for(const x in ve){const O=x.indexOf(",");if(O<0)continue;const W=parseInt(x.substring(O+1),10);E.add(W)}return E});function Ut(E){const x=ge.value[E];if(x!=null&&x>0)return x;if(!sl.value.has(E))return 24;let O,W,q=1;const Ee=ce?ce.getContext("2d"):null,Te=V(jl,El,"normal","normal");O=Te.ascent,W=Te.descent;for(let Ye=0;Ye<r.colCount;Ye++){const Tt=kt(Ye,E),it=P(h[se(Ye,E)]),Nt=typeof(it==null?void 0:it.fontFamily)=="string"&&it.fontFamily?it.fontFamily:jl,jt=(it==null?void 0:it.fontWeight)==="bold"?"bold":"normal",Jl=(it==null?void 0:it.fontStyle)==="italic"?"italic":"normal",ml=V(Nt,Tt,jt,Jl);ml.ascent>O&&(O=ml.ascent),ml.descent>W&&(W=ml.descent);const io=typeof(it==null?void 0:it.numberFormat)=="string"?it.numberFormat:"",co=ye(Ye,E),$l=zl(co,io,l.value);if($l){const Wo=(it==null?void 0:it.wrap)==="wrap";let Wl;if(Wo&&Ee){Ee.font=`${Jl} ${jt} ${Tt}px ${Nt}`;const so=m(Ye,E);let Ql;so&&Ye===so.range.startCol&&E===so.range.startRow?Ql=Qe.value[so.range.endCol+1]-Qe.value[Ye]:Ql=ie.value[Ye],Wl=lt(Ee,$l,Math.max(0,Ql-10),!0).length,Wl>q&&(q=Wl)}else Wl=$l.split(`
3
+ `).length,Wl>q&&(q=Wl)}}const We=O+W,Ze=ft*2+q*We;return Math.min(500,Math.max(24,Math.round(Ze)))}wt=Ut;function dl(E){return ge.value[E]===void 0}const Gt=t.computed(()=>{const E=[0];for(let x=0;x<r.rowCount;x++)E.push(E[x]+wt(x));return E}),rl=t.computed(()=>ht.value[r.colCount]),xl=t.computed(()=>Gt.value[r.rowCount]);function Yt(E,x){return`${E},${x}`}se=Yt;function Qt(E){Reflect.deleteProperty(h,E)}function Bl(E,x){Be.value="cell";const O=m(E,x);O?(Ne.value={col:O.range.startCol,row:O.range.startRow},Ae.value={...O.range}):(Ne.value={col:E,row:x},Ae.value={startCol:E,startRow:x,endCol:E,endRow:x})}function bl(E,x,O,W,q="cell"){const Ee=m(E,x);if(Ne.value=Ee?{col:Ee.range.startCol,row:Ee.range.startRow}:{col:E,row:x},Be.value=q,q==="row"||q==="col"){const Te=Math.min(E,O),We=Math.max(E,O),Ze=Math.min(x,W),Pe=Math.max(x,W);Ae.value={startCol:Te,startRow:Ze,endCol:We,endRow:Pe}}else Ae.value=me(E,x,O,W)}function ul(){bl(0,0,r.colCount-1,r.rowCount-1,"all")}function Xt(E,x){const O=Ae.value;return O?(Be.value==="cell"||Be.value==="all",E>=O.startCol&&E<=O.endCol&&x>=O.startRow&&x<=O.endRow):!1}function fl(E,x){return Xt(E,x)}function B(E,x){for(const O in ve){const W=ve[O];if(W&&E>=W.startCol&&E<=W.endCol&&x>=W.startRow&&x<=W.endRow)return{range:W,anchor:O}}return null}m=B;function T(E,x){return ve[Yt(E,x)]!==void 0}function F(E,x){const O=m(E,x);if(O&&E===O.range.startCol&&x===O.range.startRow){const W=ht.value[O.range.endCol+1]-ht.value[E],q=Gt.value[O.range.endRow+1]-Gt.value[x];return{w:W,h:q}}return{w:ie.value[E],h:wt(x)}}function oe(E,x,O,W){let q=Math.min(E,O),Ee=Math.max(E,O),Te=Math.min(x,W),We=Math.max(x,W),Ze=!0;for(;Ze;){Ze=!1;for(const Pe in ve){const Ye=ve[Pe];if(!Ye)continue;Ye.startCol<=Ee&&Ye.endCol>=q&&Ye.startRow<=We&&Ye.endRow>=Te&&(Ye.startCol<q&&(q=Ye.startCol,Ze=!0),Ye.endCol>Ee&&(Ee=Ye.endCol,Ze=!0),Ye.startRow<Te&&(Te=Ye.startRow,Ze=!0),Ye.endRow>We&&(We=Ye.endRow,Ze=!0))}}return{startCol:q,startRow:Te,endCol:Ee,endRow:We}}me=oe;function de(E,x){var O;return((O=h[Yt(E,x)])==null?void 0:O.value)??""}function ye(E,x){return ho(),gn(E,x,h,r.colCount,r.rowCount)}function we(E,x,O){var We,Ze;E>=0&&x>=0&&xt(E,x);const W=Yt(E,x);if(ho(),O===""||O==null){Ke.clear(W);const Pe=(We=h[W])==null?void 0:We.styleId;Pe!==void 0&&Pe>0?h[W]={value:"",styleId:Pe}:Qt(W),Ke.markDirty(W);return}const q=String(O);if(!q.startsWith("=")){const Pe=P(h[W]),Ye=typeof(Pe==null?void 0:Pe.numberFormat)=="string"?Pe.numberFormat:"";if(nl(Ye)){const Tt=vo(q,l.value);if(Tt){const Nt={...Pe??{},numberFormat:Tt.format};h[W]={value:String(Tt.serial),styleId:J(Nt)},Ke.clear(W),Ke.markDirty(W);return}const it=hr(q,l.value);if(it){const Nt={...Pe??{},numberFormat:it.format};h[W]={value:String(it.num),styleId:J(Nt)},Ke.clear(W),Ke.markDirty(W);return}}}const Ee=(Ze=h[W])==null?void 0:Ze.styleId,Te={value:q};Ee!==void 0&&Ee>0&&(Te.styleId=Ee),h[W]=Te,q.startsWith("=")?Ke.set(W,ko(q.slice(1),r.colCount,r.rowCount)):Ke.clear(W),Ke.markDirty(W)}function fe(E,x,O,W){for(let q=E;q<=x;q++)for(let Ee=O;Ee<=W;Ee++){const Te=Yt(q,Ee);Ke.clear(Te),Qt(Te),Ke.markDirty(Te)}}let K=()=>{};function Ie(E){Ue.value||(Ue.value={...Ne.value},E!==void 0?Xe.value=E:Xe.value||(Xe.value=de(Ne.value.col,Ne.value.row)))}function _e(){Ue.value&&(K(),we(Ue.value.col,Ue.value.row,Xe.value),Ue.value=null,Xe.value="")}function ee(){Ue.value=null,Xe.value=""}function He(E,x){const O=Ne.value;let W=Math.max(0,O.col+E),q=Math.max(0,O.row+x);(W>=r.colCount||q>=r.rowCount)&&xt(W,q);const Ee=m(O.col,O.row),Te=m(W,q);Ee&&Te&&Ee.anchor===Te.anchor&&(E>0?W=Ee.range.endCol+1:E<0&&(W=Ee.range.startCol-1),x>0?q=Ee.range.endRow+1:x<0&&(q=Ee.range.startRow-1),(W>=r.colCount||q>=r.rowCount)&&xt(W,q)),W=Math.max(0,Math.min(r.colCount-1,W)),q=Math.max(0,Math.min(r.rowCount-1,q)),Bl(W,q)}function et(E,x){Vt(x,E)}function C(E){const x=ht.value;if(E<0||E>=x[r.colCount])return-1;let O=0,W=r.colCount-1;for(;O<W;){const q=O+W+1>>1;x[q]<=E?O=q:W=q-1}return O}function L(E){const x=Gt.value;if(E<0||E>=x[r.rowCount])return-1;let O=0,W=r.rowCount-1;for(;O<W;){const q=O+W+1>>1;x[q]<=E?O=q:W=q-1}return O}function G(E,x){var q,Ee;const O=Math.max(0,Math.min(Math.floor(E),r.rowCount)),W=Math.max(0,Math.min(Math.floor(x),r.colCount));A.rows=O,A.cols=W,(q=Ge.scheduleRender)==null||q.call(Ge),(Ee=Ge.emitModelData)==null||Ee.call(Ge)}function ue(){var E,x;A.rows=0,A.cols=0,(E=Ge.scheduleRender)==null||E.call(Ge),(x=Ge.emitModelData)==null||x.call(Ge)}function he(){return{rows:A.rows,cols:A.cols}}function ne(){let E=0,x=0;if(A.cols>0){const O=ie.value,W=Math.min(A.cols,O.length);for(let q=0;q<W;q++)E+=O[q]}if(A.rows>0)for(let O=0;O<A.rows;O++)x+=wt(O);return{frozenRowsHeight:x,frozenColumnsWidth:E}}function be(){const{frozenColumnsWidth:E,frozenRowsHeight:x}=ne(),O=52+E,W=24+x,q=Math.max(0,St.w-52-11-E),Ee=Math.max(0,St.h-24-11-x),Te=[];return x>0&&E>0&&Te.push({kind:"corner",x:52,y:24,width:E,height:x,scrollLeft:0,scrollTop:0}),x>0&&Te.push({kind:"rows",x:O,y:24,width:q,height:x,scrollLeft:f.value,scrollTop:0}),E>0&&Te.push({kind:"columns",x:52,y:W,width:E,height:Ee,scrollLeft:0,scrollTop:N.value}),Te.push({kind:"body",x:O,y:W,width:q,height:Ee,scrollLeft:f.value,scrollTop:N.value}),Te}function Ve(E,x){const O=ht.value,W=Gt.value,q=ie.value,Ee=O[x]??0,Te=W[E]??0,We=m(x,E),Ze=We?(O[We.range.endCol+1]??Ee)-Ee:q[x]??0,Pe=We?(W[We.range.endRow+1]??Te)-Te:wt(E),Ye=x<A.cols,Tt=E<A.rows,it=Ye?52+Ee:52+Ee-f.value,Nt=Tt?24+Te:24+Te-N.value;return{x:it,y:Nt,width:Ze,height:Pe}}function at(E,x){const{frozenColumnsWidth:O,frozenRowsHeight:W}=ne();if(E<52||x<24)return null;const q=O>0&&E<52+O,Ee=W>0&&x<24+W,Te=q?E-52:E-52+f.value,We=Ee?x-24:x-24+N.value,Ze=C(Te),Pe=L(We);return Ze<0||Pe<0?null:{col:Ze,row:Pe}}function yt(E,x){return E<A.rows||x<A.cols}function Vt(E,x){if(yt(E,x))return;const{frozenColumnsWidth:O,frozenRowsHeight:W}=ne(),q=Math.max(0,St.w-52-11-O),Ee=Math.max(0,St.h-24-11-W),Te=ht.value,We=Gt.value,Ze=(Te[x]??0)-O,Pe=(We[E]??0)-W,Ye=m(x,E),Tt=Ye?(Te[Ye.range.endCol+1]??0)-(Te[x]??0):ie.value[x]??0,it=Ye?(We[Ye.range.endRow+1]??0)-(We[E]??0):wt(E);let Nt=f.value,jt=N.value;Ze<Nt?Nt=Ze:Ze+Tt>Nt+q&&(Nt=Ze+Tt-q),Pe<jt?jt=Pe:Pe+it>jt+Ee&&(jt=Pe+it-Ee),Nt=Math.max(0,Nt),jt=Math.max(0,jt),zt(Nt,jt)}function xt(E,x){var Ee;const O=E+1,W=x+1;let q=!1;if(O>=r.colCount){const Te=Math.max(r.colCount+u,O),We=Te-r.colCount,Ze=ie.value;for(let Pe=0;Pe<We;Pe++)Ze.push(100);r.colCount=Te,q=!0}if(W>=r.rowCount){const Te=Math.max(r.rowCount+p,W),We=Te-r.rowCount,Ze=ge.value;for(let Pe=0;Pe<We;Pe++)Ze.push(void 0);r.rowCount=Te,q=!0}q&&((Ee=Ge.scheduleRender)==null||Ee.call(Ge))}function el(){return r.colCount!==a||r.rowCount!==i}function Ht(E,x,O){var Ee,Te,We;if(!_o(E,x,ve))return;(Ee=Ge.saveUndo)==null||Ee.call(Ge),xt(x.endCol,x.endRow);const W=_c(E,x,{cells:h},O,l.value,r.colCount,r.rowCount,mt);ho();for(const[Ze,Pe]of Object.entries(W.cells)){const Ye=Pe.value;Ye===""&&(Pe.styleId===void 0||Pe.styleId===0)?(Ke.clear(Ze),Qt(Ze)):(h[Ze]={value:Ye,...Pe.styleId!==void 0&&Pe.styleId>0?{styleId:Pe.styleId}:{}},Ye.startsWith("=")?Ke.set(Ze,ko(Ye.slice(1),r.colCount,r.rowCount)):Ke.clear(Ze)),Ke.markDirty(Ze)}const q={startCol:Math.min(E.startCol,x.startCol),startRow:Math.min(E.startRow,x.startRow),endCol:Math.max(E.endCol,x.endCol),endRow:Math.max(E.endRow,x.endRow)};bl(q.startCol,q.startRow,q.endCol,q.endRow),(Te=Ge.scheduleRender)==null||Te.call(Ge),(We=Ge.emitModelData)==null||We.call(Ge)}function Ot(E,x){var Ee;let O=!1;const W=Math.max(1,Math.floor(E)),q=Math.max(1,Math.floor(x));if(W!==r.colCount){if(W>r.colCount){const Te=ie.value;for(let We=r.colCount;We<W;We++)Te.push(100)}else ie.value=ie.value.slice(0,W);r.colCount=W,O=!0}if(q!==r.rowCount){if(q>r.rowCount){const Te=ge.value;for(let We=r.rowCount;We<q;We++)Te.push(void 0)}else ge.value=ge.value.slice(0,q);r.rowCount=q,O=!0}O&&((Ee=Ge.scheduleRender)==null||Ee.call(Ge))}const Ge={props:n,locale:l,get colCount(){return r.colCount},get rowCount(){return r.rowCount},ensureCapacity:xt,hasDynamicDims:el,setDims:Ot,cells:h,styles:S,borders:d,merges:ve,formulaDeps:Ke,selection:Ae,activeCell:Ne,editingCell:Ue,editValue:Xe,colWidths:ie,rowHeights:ge,scrollX:f,scrollY:N,freeze:A,setFreeze:G,clearFreeze:ue,getFreeze:he,getFrozenMetrics:ne,getViewportRegions:be,cellToScreenRect:Ve,screenToCell:at,isCellFrozen:yt,scrollCellIntoView:Vt,BASE_CELL_VPAD:ft,fontMetricsCache:U,fontMetricsCanvas:ce,measureFontMetrics:V,_getFontMetricsForCell:ze,getWrappedLines:lt,cellFontSize:kt,colPositions:ht,getRowHeight:Ut,_isAutoRow:dl,rowPositions:Gt,totalWidth:rl,totalHeight:xl,selectCell:Bl,selectRange:bl,selectAll:ul,isSelected:Xt,isCellSelected:fl,selectionMode:Be,cellKey:Yt,delCell:Qt,findMerge:B,_isMergeAnchor:T,_mergedSpan:F,expandSelectionForMerges:oe,getCellRaw:de,getCellValue:ye,setCellValue:we,clearCellsInRange:fe,startEdit:Ie,commitEdit:_e,cancelEdit:ee,moveActive:He,ensureVisible:et,hitCol:C,hitRow:L,registerStyle:J,resolveStyle:P,rebuildStyleIndex:$,syncStyles:y,registerBorder:Y,resolveBorder:X,rebuildBorderIndex:ae,syncBorders:De,getCellBorderSide:Je,getMergeOwner:Le,isSameMergeInternal:Ce,viewSize:St,findHighlight:(E,x)=>null,autoFillState:Q,applyAutoFill:Ht};return K=()=>{var E;return(E=Ge.saveUndo)==null?void 0:E.call(Ge)},zt=(E,x)=>{var O;return(O=Ge.clampScroll)==null?void 0:O.call(Ge,E,x)},Ge}function Xc(e,o){const n=t.ref([]),l=t.ref([]);function a(C){return Pc(C)}function i(){return o.saveSheet(),{sheets:o.sheets.value.map(C=>({id:C.id,name:C.name,cells:a(C.cells),styles:[...C.styles],borders:C.borders?[...C.borders]:[{}],merges:C.merges?{...C.merges}:{},selection:C.selection?{...C.selection}:null,activeCell:C.activeCell?{...C.activeCell}:{col:0,row:0},scrollX:C.scrollX,scrollY:C.scrollY,colWidths:[...C.colWidths],rowHeights:[...C.rowHeights],colCount:C.colCount,rowCount:C.rowCount,freeze:{...C.freeze}})),styles:[...e.styles],activeSheetIndex:o.activeSheetIndex.value}}function r(C){const L=o.sheets.value;o.sheets.value=C.sheets.map((G,ue)=>{var ne;const he=((ne=L[ue])==null?void 0:ne.freeze)??{rows:0,cols:0};return{...G,cells:a(G.cells),styles:[...G.styles],borders:G.borders?[...G.borders]:[{}],freeze:{rows:he.rows,cols:he.cols}}}),o.loadSheet(Math.max(0,Math.min(C.activeSheetIndex,o.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function u(){const C=i(),L=n.value[n.value.length-1];L&&JSON.stringify(L)===JSON.stringify(C)||(n.value.push(C),l.value=[],n.value.length>50&&n.value.shift())}e.saveUndo=u;function p(){var C;n.value.length&&(l.value.push(i()),r(n.value.pop()),(C=e.scheduleRender)==null||C.call(e),t.nextTick(()=>{var L;return(L=e.emitModelData)==null?void 0:L.call(e)}))}function h(){var C;l.value.length&&(n.value.push(i()),r(l.value.pop()),(C=e.scheduleRender)==null||C.call(e),t.nextTick(()=>{var L;return(L=e.emitModelData)==null?void 0:L.call(e)}))}const S=t.computed(()=>n.value.length>0),d=t.computed(()=>l.value.length>0),v=t.computed(()=>!!e.selection.value),w=t.ref(null);function k(){var G;const C=e.selection.value;if(!C)return;const L={};for(let ue=C.startCol;ue<=C.endCol;ue++)for(let he=C.startRow;he<=C.endRow;he++)L[`${ue-C.startCol},${he-C.startRow}`]=((G=e.cells[e.cellKey(ue,he)])==null?void 0:G.styleId)??0;w.value={styles:L}}function Z(){var G,ue,he;const C=w.value,L=e.selection.value;if(!(!C||!L)){u();for(let ne=L.startCol;ne<=L.endCol;ne++)for(let be=L.startRow;be<=L.endRow;be++){const Ve=e.findMerge(ne,be);if(Ve&&(ne!==Ve.range.startCol||be!==Ve.range.startRow))continue;const at=C.styles[`${ne-L.startCol},${be-L.startRow}`]??0,yt=e.cellKey(ne,be),Vt=((G=e.cells[yt])==null?void 0:G.value)??"";if(Vt===""&&at===0)e.delCell(yt);else{const xt={value:Vt};at>0&&(xt.styleId=at),e.cells[yt]=xt}}w.value=null,(ue=e.scheduleRender)==null||ue.call(e),(he=e.emitModelData)==null||he.call(e)}}function J(){var L,G,ue;const C=e.selection.value;if(C){u();for(let he=C.startCol;he<=C.endCol;he++)for(let ne=C.startRow;ne<=C.endRow;ne++){const be=e.findMerge(he,ne);if(be&&(he!==be.range.startCol||ne!==be.range.startRow))continue;const Ve=e.cellKey(he,ne),at=((L=e.cells[Ve])==null?void 0:L.value)??"";at===""?e.delCell(Ve):e.cells[Ve]={value:at}}(G=e.scheduleRender)==null||G.call(e),(ue=e.emitModelData)==null||ue.call(e)}}const P=t.computed(()=>Hn.map(C=>({...C,label:C.value===""?I(e.locale.value,"fontDefault"):C.label}))),$=t.computed(()=>On.map(C=>({...C,label:String(C.value)}))),y="\0",Y=t.computed(()=>{const C=e.selection.value;if(!C)return"";let L,G=!1;for(let ue=C.startCol;ue<=C.endCol&&!G;ue++)for(let he=C.startRow;he<=C.endRow&&!G;he++){const ne=e.findMerge(ue,he);if(ne&&(ue!==ne.range.startCol||he!==ne.range.startRow))continue;const be=e.resolveStyle(e.cells[e.cellKey(ue,he)]),Ve=typeof(be==null?void 0:be.fontFamily)=="string"?be.fontFamily:"";L===void 0?L=Ve:Ve!==L&&(G=!0)}return G?y:L??""}),X=t.computed(()=>{const C=e.selection.value;if(!C)return El;let L,G=!1;for(let ue=C.startCol;ue<=C.endCol&&!G;ue++)for(let he=C.startRow;he<=C.endRow&&!G;he++){const ne=e.findMerge(ue,he);if(ne&&(ue!==ne.range.startCol||he!==ne.range.startRow))continue;const be=e.cellFontSize(ue,he);L===void 0?L=be:be!==L&&(G=!0)}return G?0:L??El});function ae(C,L){var ue,he,ne;const G=e.selection.value;if(G){u();for(let be=G.startCol;be<=G.endCol;be++)for(let Ve=G.startRow;Ve<=G.endRow;Ve++){const at=e.findMerge(be,Ve);if(at&&(be!==at.range.startCol||Ve!==at.range.startRow))continue;const yt=e.cellKey(be,Ve),Vt=((ue=e.cells[yt])==null?void 0:ue.value)??"";let el={...e.resolveStyle(e.cells[yt])??{}};if(L===""||L===null||L===void 0||L===0){const{[C]:Ot,...Ge}=el;el=Ge}else el[C]=L;const Ht=Object.keys(el).length?e.registerStyle(el):0;if(Vt===""&&Ht===0)e.delCell(yt);else{const Ot={value:Vt};Ht>0&&(Ot.styleId=Ht),e.cells[yt]=Ot}}(he=e.scheduleRender)==null||he.call(e),(ne=e.emitModelData)==null||ne.call(e)}}function De(C){ae("fontFamily",C===""?"":C)}const Je=t.ref(!1),Le=t.ref(!1),Ce=t.ref(!1),ve=t.ref(!1),Ke=t.ref(!1);function Ae(C){ae("fontSize",C),Je.value=!1}const Be=t.computed(()=>Kn.map(C=>({label:I(e.locale.value,C.labelKey),value:C.value,icon:C.icon}))),Ne=t.computed(()=>Un.map(C=>({label:I(e.locale.value,C.labelKey),value:C.value,icon:C.icon}))),Ue=t.computed(()=>{const C=e.selection.value;if(!C)return"left";const L=e.resolveStyle(e.cells[e.cellKey(C.startCol,C.startRow)]),G=typeof(L==null?void 0:L.textAlign)=="string"?L.textAlign:"";return G==="center"||G==="right"?G:"left"}),Xe=t.computed(()=>{const C=e.selection.value;if(!C)return"top";const L=e.resolveStyle(e.cells[e.cellKey(C.startCol,C.startRow)]),G=typeof(L==null?void 0:L.verticalAlign)=="string"?L.verticalAlign:"";return G==="middle"||G==="bottom"?G:"top"}),ie=t.computed(()=>{const C=e.selection.value;if(!C)return!1;const L=e.resolveStyle(e.cells[e.cellKey(C.startCol,C.startRow)]);return(L==null?void 0:L.wrap)==="wrap"});function ge(C){ae("textAlign",C)}function f(C){ae("verticalAlign",C)}function N(){if(!e.selection.value)return;const L=ie.value;ae("wrap",L?void 0:"wrap")}const A=t.ref(""),Q=Je;t.watch(X,C=>{A.value=C===0?"":String(C)},{immediate:!0});function U(C){const L=C.replace(/[^\d]/g,"");A.value=L;const G=parseInt(L,10);!isNaN(G)&&G>=5&&G<=72&&G!==X.value&&ae("fontSize",G)}function ce(){const C=A.value.trim();if(!C){A.value=X.value===0?"":String(X.value);return}let L=parseInt(C,10);isNaN(L)?L=X.value===0?El:X.value:L=Math.max(5,Math.min(72,L)),A.value=String(L),L!==X.value&&ae("fontSize",L)}function V(C){C.key==="Enter"&&C.target.blur()}function c(C){C&&C.preventDefault(),Q.value=!Q.value,Q.value&&(Ce&&(Ce.value=!1),Le&&(Le.value=!1),ve.value=!1,Ke.value=!1)}function b(){const C=X.value===0?El:X.value,L=Math.min(72,C+1);ae("fontSize",L),A.value=String(L),Q.value=!1}function ft(){const C=X.value===0?El:X.value,L=Math.max(5,C-1);ae("fontSize",L),A.value=String(L),Q.value=!1}function se(C){const L=e.selection.value;if(!L)return!1;let G,ue=!1;for(let he=L.startCol;he<=L.endCol&&!ue;he++)for(let ne=L.startRow;ne<=L.endRow&&!ue;ne++){const be=e.findMerge(he,ne);if(be&&(he!==be.range.startCol||ne!==be.range.startRow))continue;const Ve=e.resolveStyle(e.cells[e.cellKey(he,ne)]),at=!!(Ve!=null&&Ve[C]);G===void 0?G=at:at!==G&&(ue=!0)}return!ue&&G===!0}const m=t.computed(()=>se("fontWeight")),H=t.computed(()=>se("fontStyle")),Qe=t.computed(()=>se("underline")),wt=t.computed(()=>se("strikethrough"));function me(){ae("fontWeight",m.value?"":"bold")}function ze(){ae("fontStyle",H.value?"":"italic")}function lt(){ae("underline",Qe.value?"":"underline")}function kt(){ae("strikethrough",wt.value?"":"line-through")}const ht=t.ref(""),St=t.ref(""),zt=ve,sl=Ke;function Ut(){zt.value=!zt.value,sl.value=!1,Le&&(Le.value=!1),Ce&&(Ce.value=!1)}function dl(){sl.value=!sl.value,zt.value=!1,Le&&(Le.value=!1),Ce&&(Ce.value=!1)}function Gt(C){Le&&(Le.value=C),C&&(zt.value=!1,sl.value=!1,Ce&&(Ce.value=!1))}function rl(C){ht.value=C,ae("color",C===""?"":C)}function xl(C){St.value=C,ae("backgroundColor",C===""?"":C)}function Yt(){ae("color",ht.value===""?"":ht.value)}function Qt(){ae("backgroundColor",St.value===""?"":St.value)}const Bl=t.computed(()=>{const C=e.selection.value;if(!C)return"";let L,G=!1;for(let ue=C.startCol;ue<=C.endCol&&!G;ue++)for(let he=C.startRow;he<=C.endRow&&!G;he++){const ne=e.findMerge(ue,he);if(ne&&(ue!==ne.range.startCol||he!==ne.range.startRow))continue;const be=e.resolveStyle(e.cells[e.cellKey(ue,he)]),Ve=typeof(be==null?void 0:be.color)=="string"?be.color:"";L===void 0?L=Ve:Ve!==L&&(G=!0)}return G?"":L??""}),bl=t.computed(()=>{const C=e.selection.value;if(!C)return"";let L,G=!1;for(let ue=C.startCol;ue<=C.endCol&&!G;ue++)for(let he=C.startRow;he<=C.endRow&&!G;he++){const ne=e.findMerge(ue,he);if(ne&&(ue!==ne.range.startCol||he!==ne.range.startRow))continue;const be=e.resolveStyle(e.cells[e.cellKey(ue,he)]),Ve=typeof(be==null?void 0:be.backgroundColor)=="string"?be.backgroundColor:"";L===void 0?L=Ve:Ve!==L&&(G=!0)}return G?"":L??""}),ul=t.computed(()=>nn(e.locale.value)),Xt=t.ref(!1),fl=t.computed(()=>{const C=e.selection.value;if(!C)return Rl;let L,G=!1;for(let ue=C.startCol;ue<=C.endCol&&!G;ue++)for(let he=C.startRow;he<=C.endRow&&!G;he++){const ne=e.findMerge(ue,he);if(ne&&(ue!==ne.range.startCol||he!==ne.range.startRow))continue;const be=e.resolveStyle(e.cells[e.cellKey(ue,he)]),Ve=(be==null?void 0:be.numberFormatCategory)==="custom"?Sl:typeof(be==null?void 0:be.numberFormat)=="string"?be.numberFormat:"";L===void 0?L=Ve:Ve!==L&&(G=!0)}return G?gl:L??Rl});function B(C){if((C==null?void 0:C.numberFormatCategory)==="custom")return Sl;const L=typeof(C==null?void 0:C.numberFormat)=="string"?C.numberFormat:"";return on(L,e.locale.value)}const T=t.computed(()=>{const C=fl.value;if(C!==gl)return C===Sl?Sl:on(C,e.locale.value);const L=e.selection.value;if(!L)return Rl;let G,ue=!1;for(let he=L.startCol;he<=L.endCol&&!ue;he++)for(let ne=L.startRow;ne<=L.endRow&&!ue;ne++){const be=e.findMerge(he,ne);if(be&&(he!==be.range.startCol||ne!==be.range.startRow))continue;const Ve=B(e.resolveStyle(e.cells[e.cellKey(he,ne)]));G===void 0?G=Ve:Ve!==G&&(ue=!0)}return ue?gl:G??Rl});function F(C){ae("numberFormat",C),oe()}function oe(){const C=e.selection.value;if(C)for(let L=C.startCol;L<=C.endCol;L++)for(let G=C.startRow;G<=C.endRow;G++){const ue=e.findMerge(L,G);if(ue&&(L!==ue.range.startCol||G!==ue.range.startRow))continue;const he=e.cellKey(L,G),ne=e.cells[he],be=e.resolveStyle(ne);if((be==null?void 0:be.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:Ve,...at}=be,yt=Object.keys(at).length?e.registerStyle(at):0,Vt=(ne==null?void 0:ne.value)??"";if(Vt===""&&yt===0)e.delCell(he);else{const xt={value:Vt};yt>0&&(xt.styleId=yt),e.cells[he]=xt}}}function de(C){if(C===Sl){Xt.value=!0;return}F(C)}function ye(){Xt.value=!0}function we(){const C=e.selection.value;if(!C)return[];const L=[];for(let G=C.startCol;G<=C.endCol;G++)for(let ue=C.startRow;ue<=C.endRow;ue++){const he=e.findMerge(G,ue);if(he&&(G!==he.range.startCol||ue!==he.range.startRow))continue;const ne=e.cellKey(G,ue),be=e.cells[ne],Ve=e.resolveStyle(be),at=typeof(Ve==null?void 0:Ve.numberFormat)=="string"?Ve.numberFormat:Rl,yt=(be==null?void 0:be.value)??"",Vt=yt.startsWith("=")?gn(G,ue,e.cells,e.colCount,e.rowCount):yt;ln(at,Vt)&&L.push({key:ne,nf:at,decimals:dr(at,Vt)})}return L}const fe=t.computed(()=>we().some(C=>C.decimals<No)),K=t.computed(()=>we().some(C=>C.decimals>Io));function Ie(C,L,G){var Ve;const ue=((Ve=e.cells[C])==null?void 0:Ve.value)??"",ne={...e.resolveStyle(e.cells[C])??{}};L===""?(delete ne.numberFormat,delete ne.numberFormatCategory):(ne.numberFormat=L,G==="custom"&&(ne.numberFormatCategory="custom"));const be=Object.keys(ne).length?e.registerStyle(ne):0;if(ue===""&&be===0)e.delCell(C);else{const at={value:ue};be>0&&(at.styleId=be),e.cells[C]=at}}function _e(C){var ue,he;const L=we(),G=[];for(const ne of L){const be=ne.decimals+C;if(be<Io||be>No)continue;const Ve=fr(ne.nf,be);Ve==null||Ve===ne.nf||G.push({key:ne.key,code:Ve,category:nl(ne.nf)?"custom":void 0})}if(G.length){u();for(const ne of G)Ie(ne.key,ne.code,ne.category);(ue=e.scheduleRender)==null||ue.call(e),(he=e.emitModelData)==null||he.call(e)}}function ee(){_e(1)}function He(){_e(-1)}return{undoStack:n,redoStack:l,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:u,undo:p,redo:h,canUndo:S,canRedo:d,hasSelection:v,paintFmt:w,onPaintFormat:k,applyPaintFormat:Z,clearFormat:J,fontFamilyOptions:P,fontSizeOptions:$,FONT_FAMILY_MIXED:y,selFontFamily:Y,selFontSize:X,applyStyleToSelection:ae,onFontFamilyChange:De,onFontSizeChange:Ae,hAlignOptions:Be,vAlignOptions:Ne,selHAlign:Ue,selVAlign:Xe,selWrap:ie,onHAlignChange:ge,onVAlignChange:f,onWrapToggle:N,fontSizeInput:A,fontSizeMenuOpen:Q,onFontSizeInput:U,onFontSizeBlur:ce,onFontSizeKeydown:V,toggleFontSizeMenu:c,onFontSizeStepUp:b,onFontSizeStepDown:ft,selFontWeight:m,selFontStyle:H,selUnderline:Qe,selStrikethrough:wt,toggleFontWeight:me,toggleFontStyle:ze,toggleUnderline:lt,toggleStrikethrough:kt,cachedTextColor:ht,cachedFillColor:St,textColorMenuOpen:zt,fillColorMenuOpen:sl,_toggleTextColorMenu:Ut,_toggleFillColorMenu:dl,onBorderMenuToggle:Gt,onTextColorChange:rl,onFillColorChange:xl,applyCachedTextColor:Yt,applyCachedFillColor:Qt,selTextColor:Bl,selFillColor:bl,nfOptions:ul,selNumberFormat:fl,selNumberFormatDisplay:T,NF_NUMBER_FORMAT_MIXED:gl,nfDialogOpen:Xt,onNumberFormatChange:de,openNumberFormatDialog:ye,applyNumberFormatCode:F,canIncreaseDecimals:fe,canDecreaseDecimals:K,onIncreaseDecimals:ee,onDecreaseDecimals:He}}function jc(e,o){o.borderMenuOpen&&(e.borderMenuOpen=o.borderMenuOpen),o.mergeMenuOpen&&(e.mergeMenuOpen=o.mergeMenuOpen),(()=>{const l=e.borderMenuOpen,a=e.mergeMenuOpen;e.onBorderMenuToggle=i=>{l&&(l.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),l&&(l.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,l&&(l.value=!1),a&&(a.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,l&&(l.value=!1),a&&(a.value=!1)}})()}function Zc(e,o){const n=t.ref("none"),l=t.ref(!1),a="#444";function i(f,N,A,Q){if(f<0||N<0||f>=e.colCount||N>=e.rowCount)return;const U=e.findMerge(f,N),ce=U?U.anchor:e.cellKey(f,N);if(!e.cells[ce]){if(!Q)return;e.cells[ce]={value:""}}Gc(e.cells[ce],A,Q,e.styles,{get:c=>e.resolveBorder(c),getId:c=>e.registerBorder(c)},e.registerStyle)}function r(f,N,A){var b;const Q=e.findMerge(f,N),U=Q?Q.anchor:e.cellKey(f,N),ce=((b=e.cells[U])==null?void 0:b.value)??"",V=e.resolveStyle(e.cells[U])?{...e.resolveStyle(e.cells[U])}:{},c=e.registerBorder(A);if(c>0?V.borderId=c:delete V.borderId,delete V.borderTopWidth,delete V.borderBottomWidth,delete V.borderLeftWidth,delete V.borderRightWidth,delete V.borderColor,ce===""&&!Object.keys(V).length)e.delCell(U);else{const ft=e.registerStyle(V);e.cells[U]={value:ce,styleId:ft||void 0}}}function u(f){var b,ft;n.value=f;const N=e.selection.value;if(!N)return;o.saveUndo();const{startCol:A,startRow:Q,endCol:U,endRow:ce}=N,V={width:1,color:a},c={width:2,color:a};if(f==="none")for(let se=A;se<=U;se++)for(let m=Q;m<=ce;m++){const H=e.findMerge(se,m);H&&(se!==H.range.startCol||m!==H.range.startRow)||r(se,m,{})}else if(f==="all")for(let se=A;se<=U;se++)for(let m=Q;m<=ce;m++){const H=e.findMerge(se,m);H&&(se!==H.range.startCol||m!==H.range.startRow)||r(se,m,{top:V,right:V,bottom:V,left:V})}else if(f==="outer"||f==="thickOuter"){const se=f==="thickOuter"?c:V;for(let m=A;m<=U;m++)i(m,Q,"top",se);for(let m=A;m<=U;m++)i(m,ce,"bottom",se);for(let m=Q;m<=ce;m++)i(A,m,"left",se);for(let m=Q;m<=ce;m++)i(U,m,"right",se)}else{const m={top:{side:"top",edgeCheck:(H,Qe)=>Qe===Q},bottom:{side:"bottom",edgeCheck:(H,Qe)=>Qe===ce},left:{side:"left",edgeCheck:(H,Qe)=>H===A},right:{side:"right",edgeCheck:(H,Qe)=>H===U}}[f];if(m)for(let H=A;H<=U;H++)for(let Qe=Q;Qe<=ce;Qe++)m.edgeCheck(H,Qe)&&i(H,Qe,m.side,V)}(b=e.scheduleRender)==null||b.call(e),(ft=e.emitModelData)==null||ft.call(e)}function p(){u(n.value)}function h(f,N,A){const Q=A.toLowerCase(),U=e.findMerge(f,N);if(U){if(Q==="top"&&N!==U.range.startRow||Q==="bottom"&&N!==U.range.endRow||Q==="left"&&f!==U.range.startCol||Q==="right"&&f!==U.range.endCol)return 0;const V=e.getCellBorderSide(e.cells[U.anchor],Q);return(V==null?void 0:V.width)??0}const ce=e.getCellBorderSide(e.cells[e.cellKey(f,N)],Q);return(ce==null?void 0:ce.width)??0}const S=t.ref(!1);function d(f){S.value=f,f&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,l.value=!1,o.fontSizeMenuOpen.value=!1)}function v(f,N,A,Q){const U=[];for(const ce in e.merges){const V=e.merges[ce];V&&V.startCol<=A&&V.endCol>=f&&V.startRow<=Q&&V.endRow>=N&&U.push(ce)}for(const ce of U)Reflect.deleteProperty(e.merges,ce)}function w(){var ce,V,c;const f=e.selection.value;if(!f||f.startCol===f.endCol&&f.startRow===f.endRow)return;o.saveUndo(),v(f.startCol,f.startRow,f.endCol,f.endRow);const N=e.cellKey(f.startCol,f.startRow),A=((ce=e.cells[N])==null?void 0:ce.value)??"";for(let b=f.startCol;b<=f.endCol;b++)for(let ft=f.startRow;ft<=f.endRow;ft++)b===f.startCol&&ft===f.startRow||e.clearCellsInRange(b,b,ft,ft);const Q=e.resolveStyle(e.cells[N])?{...e.resolveStyle(e.cells[N])}:{};Q.textAlign="center";const U=e.registerStyle(Q);e.cells[N]={value:A,styleId:U||void 0},e.merges[N]={startCol:f.startCol,startRow:f.startRow,endCol:f.endCol,endRow:f.endRow},e.selectCell(f.startCol,f.startRow),(V=e.scheduleRender)==null||V.call(e),(c=e.emitModelData)==null||c.call(e)}function k(){var N,A,Q;const f=e.selection.value;if(!(!f||f.startCol===f.endCol)){o.saveUndo();for(let U=f.startRow;U<=f.endRow;U++){v(f.startCol,U,f.endCol,U);const ce=e.cellKey(f.startCol,U);(N=e.cells[ce])==null||N.value;for(let V=f.startCol+1;V<=f.endCol;V++)e.clearCellsInRange(V,V,U,U);e.merges[ce]={startCol:f.startCol,startRow:U,endCol:f.endCol,endRow:U}}e.selectRange(f.startCol,f.startRow,f.endCol,f.endRow),(A=e.scheduleRender)==null||A.call(e),(Q=e.emitModelData)==null||Q.call(e)}}function Z(){var A,Q,U;const f=e.selection.value;if(!f||f.startCol===f.endCol&&f.startRow===f.endRow)return;o.saveUndo(),v(f.startCol,f.startRow,f.endCol,f.endRow);const N=e.cellKey(f.startCol,f.startRow);(A=e.cells[N])==null||A.value;for(let ce=f.startCol;ce<=f.endCol;ce++)for(let V=f.startRow;V<=f.endRow;V++)ce===f.startCol&&V===f.startRow||e.clearCellsInRange(ce,ce,V,V);e.merges[N]={startCol:f.startCol,startRow:f.startRow,endCol:f.endCol,endRow:f.endRow},e.selectCell(f.startCol,f.startRow),(Q=e.scheduleRender)==null||Q.call(e),(U=e.emitModelData)==null||U.call(e)}function J(){var N,A;const f=e.selection.value;f&&(o.saveUndo(),v(f.startCol,f.startRow,f.endCol,f.endRow),(N=e.scheduleRender)==null||N.call(e),(A=e.emitModelData)==null||A.call(e))}function P(){const f=e.selection.value;if(!f)return;const N=e.findMerge(f.startCol,f.startRow);N&&f.startCol===N.range.startCol&&f.startRow===N.range.startRow&&f.endCol===N.range.endCol&&f.endRow===N.range.endRow?J():w()}function $(f){switch(f){case"mergeCenter":w();break;case"mergeAcross":k();break;case"mergeCells":Z();break;case"unmergeCells":J();break}}let y=null,Y=[];function X(f,N,A,Q){Y=[];for(let U=A;U<=Q;U++){const ce=[];for(let V=f;V<=N;V++){const c=e.cells[e.cellKey(V,U)];ce.push((c==null?void 0:c.styleId)??0)}Y.push(ce)}}function ae(f,N,A,Q){const U=e.cellKey(f,N);if(ho(),A===""||A==null){e.formulaDeps.clear(U),Q&&Q>0?e.cells[U]={value:"",styleId:Q}:e.delCell(U),e.formulaDeps.markDirty(U);return}e.cells[U]={value:A,styleId:Q&&Q>0?Q:void 0},A.startsWith("=")?e.formulaDeps.set(U,ko(A.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(U),e.formulaDeps.markDirty(U)}function De(){const f=e.selection.value;if(!f)return;y={...f},X(f.startCol,f.endCol,f.startRow,f.endRow);const N=[];for(let A=f.startRow;A<=f.endRow;A++){const Q=[];for(let U=f.startCol;U<=f.endCol;U++)Q.push(e.getCellRaw(U,A));N.push(Q.join(" "))}Ho(N.join(`
4
+ `))}function Je(){const f=e.selection.value;if(f){if(f.startCol===0&&f.endCol===e.colCount-1){y={...f},X(0,e.colCount-1,f.startRow,f.endRow);const N=[];for(let A=f.startRow;A<=f.endRow;A++){const Q=[];for(let U=0;U<e.colCount;U++)Q.push(e.getCellRaw(U,A));N.push(Q.join(" "))}Ho(N.join(`
5
+ `))}else if(f.startRow===0&&f.endRow===e.rowCount-1){y={...f},X(f.startCol,f.endCol,0,e.rowCount-1);const N=[];for(let A=0;A<e.rowCount;A++){const Q=[];for(let U=f.startCol;U<=f.endCol;U++)Q.push(e.getCellRaw(U,A));N.push(Q.join(" "))}Ho(N.join(`
6
+ `))}}}async function Le(){var ft;let f;try{f=await navigator.clipboard.readText()}catch{return}if(!f&&f!=="")return;const N=f.split(/\r?\n/),A=e.activeCell.value,Q=y,U=Q&&Y.length>0,ce=N.map(se=>se.split(" ").length),V=ce.length?Math.max(...ce):0,c=A.col+V-1,b=A.row+N.length-1;c>=0&&b>=0&&e.ensureCapacity(c,b);for(let se=0;se<N.length;se++){const m=N[se].split(" ");for(let H=0;H<m.length;H++){const Qe=A.col+H,wt=A.row+se;let me=m[H];if(me.startsWith("=")&&Q&&(me=yn(me,Qe-(Q.startCol+H),wt-(Q.startRow+se),e.colCount,e.rowCount,mt)),U&&se<Y.length&&H<(((ft=Y[se])==null?void 0:ft.length)??0)){const ze=Y[se][H]??null;ae(Qe,wt,me,ze)}else e.setCellValue(Qe,wt,me)}}}function Ce(){var f;if(o.saveUndo(),De(),e.selection.value){const N=e.selection.value;e.clearCellsInRange(N.startCol,N.endCol,N.startRow,N.endRow),(f=e.scheduleRender)==null||f.call(e)}}function ve(){var f;if(e.selection.value){const N=e.selection.value;e.clearCellsInRange(N.startCol,N.endCol,N.startRow,N.endRow),(f=e.scheduleRender)==null||f.call(e)}}function Ke(){var ce,V;const f=e.selection.value;if(!f)return;o.saveUndo();const N=f.startCol,A=f.startRow,Q=f.endCol,U=f.endRow;if(A===U)if(Q+1<e.colCount){const c=`${mt(N)}${A+1}:${mt(Q)}${A+1}`;e.setCellValue(Q+1,A,`=SUM(${c})`)}else{const c=`${mt(N)}${A+1}:${mt(Q-1)}${A+1}`;e.setCellValue(Q,A,`=SUM(${c})`)}else for(let c=N;c<=Q;c++)if(U+1<e.rowCount){const b=`${mt(c)}${A+1}:${mt(c)}${U+1}`;e.setCellValue(c,U+1,`=SUM(${b})`)}else{const b=`${mt(c)}${A+1}:${mt(c)}${U}`;e.setCellValue(c,U,`=SUM(${b})`)}(ce=e.scheduleRender)==null||ce.call(e),(V=e.emitModelData)==null||V.call(e)}function Ae(){var ce,V;const f=e.selection.value;if(!f)return;o.saveUndo();const N=f.startCol,A=f.startRow,Q=f.endCol,U=f.endRow;if(A===U)if(Q+1<e.colCount){const c=`${mt(N)}${A+1}:${mt(Q)}${A+1}`;e.setCellValue(Q+1,A,`=AVERAGE(${c})`)}else{const c=`${mt(N)}${A+1}:${mt(Q-1)}${A+1}`;e.setCellValue(Q,A,`=AVERAGE(${c})`)}else for(let c=N;c<=Q;c++)if(U+1<e.rowCount){const b=`${mt(c)}${A+1}:${mt(c)}${U+1}`;e.setCellValue(c,U+1,`=AVERAGE(${b})`)}else{const b=`${mt(c)}${A+1}:${mt(c)}${U}`;e.setCellValue(c,U,`=AVERAGE(${b})`)}(ce=e.scheduleRender)==null||ce.call(e),(V=e.emitModelData)==null||V.call(e)}function Be(){var ce,V;const f=e.selection.value;if(!f)return;o.saveUndo();const N=f.startCol,A=f.startRow,Q=f.endCol,U=f.endRow;if(A===U)if(Q+1<e.colCount){const c=`${mt(N)}${A+1}:${mt(Q)}${A+1}`;e.setCellValue(Q+1,A,`=COUNT(${c})`)}else{const c=`${mt(N)}${A+1}:${mt(Q-1)}${A+1}`;e.setCellValue(Q,A,`=COUNT(${c})`)}else for(let c=N;c<=Q;c++)if(U+1<e.rowCount){const b=`${mt(c)}${A+1}:${mt(c)}${U+1}`;e.setCellValue(c,U+1,`=COUNT(${b})`)}else{const b=`${mt(c)}${A+1}:${mt(c)}${U}`;e.setCellValue(c,U,`=COUNT(${b})`)}(ce=e.scheduleRender)==null||ce.call(e),(V=e.emitModelData)==null||V.call(e)}const Ne=t.ref(!1);function Ue(f){Ne.value=f,f&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,l.value=!1,o.fontSizeMenuOpen.value=!1,S.value=!1)}function Xe(){Ke(),Ne.value=!1}function ie(){Ae(),Ne.value=!1}function ge(){Be(),Ne.value=!1}return{cachedBorder:n,borderMenuOpen:l,BORDER_COLOR:a,onBorderChange:u,setCellBorderSide:i,applyBorderToCell:r,applyCachedBorder:p,cellBorderWidth:h,mergeMenuOpen:S,onMergeMenuToggle:d,removeOverlappingMerges:v,mergeAndCenter:w,mergeAcross:k,mergeCells:Z,unmergeCells:J,onApplyMerge:P,onMergeChange:$,copySourceRange:null,copySourceStyles:[],captureStyles:X,setCellWithStyle:ae,copyToClipboard:De,copyRowCol:Je,pasteFromClipboard:Le,cutSelected:Ce,clearSelected:ve,sumSelected:Ke,avgSelected:Ae,countSelected:Be,calcMenuOpen:Ne,onCalcMenuToggle:Ue,onCalcSum:Xe,onCalcAvg:ie,onCalcCount:ge}}function qc(e,o,n,l){const a={},i=l(o),r=l(n);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 Bn(e){return e==="number"?0:1}function Dn(e,o,n){var i;if(e==null||e.trim()==="")return{kind:"blank"};const l=o??"";if(l===ol||l==="@")return{kind:"text",text:e};if(nl(l)){if(no(e))return{kind:"number",num:Number(e)};const r=vo(e,n);return r?{kind:"number",num:r.serial}:{kind:"text",text:zl(e,l,n)}}const a=Ml(l);if(a.kind==="date"||a.kind==="duration"){const r=Number(e);return Number.isFinite(r)?{kind:"number",num:r}:{kind:"text",text:zl(e,l,n)}}if(a.kind==="number"){const r=Number(e);if(Number.isFinite(r)){const u=((i=a.sections.find(p=>p.hasDigits))==null?void 0:i.scale)??1;return{kind:"number",num:r*u}}return{kind:"text",text:zl(e,l,n)}}return{kind:"text",text:zl(e,l,n)}}function Jc(e,o,n,l){if(e.kind==="blank"||o.kind==="blank")return e.kind==="blank"&&o.kind==="blank"?0:e.kind==="blank"?1:-1;const a=Bn(e.kind),i=Bn(o.kind);if(a!==i)return n==="asc"?a-i:i-a;let r;return e.kind==="number"?r=(e.num??0)-(o.num??0):r=(e.text??"").localeCompare(o.text??"",l,{numeric:!0}),n==="asc"?r:-r}function Qc(e,o,n){const l=e.map((a,i)=>i);return l.sort((a,i)=>{const r=Jc(e[a],e[i],o,n);return r!==0?r:a-i}),l}function es(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 ts(e,o,n,l,a){function i(B,T){const F=T-B+1,oe=Ke(B,T),de=[],ye=[];for(const K in e.cells){const Ie=K.indexOf(",");if(Ie<0)continue;const _e=parseInt(K.substring(0,Ie),10),ee=parseInt(K.substring(Ie+1),10);ee>=B&&ee<=T?ye.push(K):ee>T&&de.push({oldKey:K,newKey:e.cellKey(_e,ee-F),cell:e.cells[K]})}for(const K of ye)Reflect.deleteProperty(e.cells,K);for(const K of de)Reflect.deleteProperty(e.cells,K.oldKey),e.cells[K.newKey]=K.cell;const we=e.rowHeights.value,fe=new Array(we.length);for(let K=0;K<B;K++)fe[K]=we[K];for(let K=B;K<we.length-F;K++)fe[K]=we[K+F];for(let K=we.length-F;K<we.length;K++)fe[K]=void 0;e.rowHeights.value=fe,ve(oe),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))}function r(B,T){const F=T-B+1,oe=e.rowCount,de=e.colCount,{lastRow:ye}=h();ye>=B&&ye+F>=oe&&e.ensureCapacity(de-1,oe-1+F);const we=e.rowCount,fe=Be(B,T),K=[];for(const ee in e.cells){const He=ee.indexOf(",");if(He<0)continue;const et=parseInt(ee.substring(0,He),10),C=parseInt(ee.substring(He+1),10);C>=B&&K.push({oldKey:ee,newKey:e.cellKey(et,C+F),cell:e.cells[ee],oldRow:C})}K.sort((ee,He)=>He.oldRow-ee.oldRow);for(const ee of K)Reflect.deleteProperty(e.cells,ee.oldKey),e.cells[ee.newKey]=ee.cell;for(const ee in e.cells){const He=ee.indexOf(",");if(He<0)continue;const et=parseInt(ee.substring(He+1),10);et>=B&&et<=T&&Reflect.deleteProperty(e.cells,ee)}const Ie=e.rowHeights.value,_e=new Array(we);for(let ee=0;ee<B;ee++)_e[ee]=Ie[ee];for(let ee=B;ee<=T;ee++)_e[ee]=void 0;for(let ee=B;ee<we;ee++)_e[ee+F]=Ie[ee];e.rowHeights.value=_e,ve(fe),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))}function u(B,T){const F=T-B+1,oe=e.colCount,de=e.rowCount,{lastCol:ye}=h();ye>=B&&ye+F>=oe&&e.ensureCapacity(oe-1+F,de-1);const we=e.colCount,fe=Ne(B,T),K=[];for(const ee in e.cells){const He=ee.indexOf(",");if(He<0)continue;const et=parseInt(ee.substring(0,He),10),C=parseInt(ee.substring(He+1),10);et>=B&&K.push({oldKey:ee,newKey:e.cellKey(et+F,C),cell:e.cells[ee],oldCol:et})}K.sort((ee,He)=>He.oldCol-ee.oldCol);for(const ee of K)Reflect.deleteProperty(e.cells,ee.oldKey),e.cells[ee.newKey]=ee.cell;for(const ee in e.cells){const He=ee.indexOf(",");if(He<0)continue;const et=parseInt(ee.substring(0,He),10);et>=B&&et<=T&&Reflect.deleteProperty(e.cells,ee)}const Ie=e.colWidths.value,_e=new Array(we);for(let ee=0;ee<B;ee++)_e[ee]=Ie[ee];for(let ee=B;ee<=T;ee++)_e[ee]=100;for(let ee=B;ee<we;ee++)_e[ee+F]=Ie[ee];e.colWidths.value=_e,ve(fe),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))}function p(B,T){const F=T-B+1,oe=Ae(B,T),de=[],ye=[];for(const K in e.cells){const Ie=K.indexOf(",");if(Ie<0)continue;const _e=parseInt(K.substring(0,Ie),10),ee=parseInt(K.substring(Ie+1),10);_e>=B&&_e<=T?ye.push(K):_e>T&&de.push({oldKey:K,newKey:e.cellKey(_e-F,ee),cell:e.cells[K]})}for(const K of ye)Reflect.deleteProperty(e.cells,K);for(const K of de)Reflect.deleteProperty(e.cells,K.oldKey),e.cells[K.newKey]=K.cell;const we=e.colWidths.value,fe=new Array(we.length);for(let K=0;K<B;K++)fe[K]=we[K];for(let K=B;K<we.length-F;K++)fe[K]=we[K+F];for(let K=we.length-F;K<we.length;K++)fe[K]=100;e.colWidths.value=fe,ve(oe),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))}function h(){let B=-1,T=-1;for(const F in e.cells){const oe=F.split(",");if(oe.length===2){const de=parseInt(oe[0],10),ye=parseInt(oe[1],10),we=e.cells[F];we&&(we.value!==""||we.styleId!==void 0)&&(de>B&&(B=de),ye>T&&(T=ye))}}for(let F=e.colCount-1;F>=0;F--){const oe=e.colWidths.value[F];if(oe!==void 0&&oe!==100){F>B&&(B=F);break}}for(let F=e.rowCount-1;F>=0;F--)if(e.rowHeights.value[F]!==void 0){F>T&&(T=F);break}return{lastCol:B,lastRow:T}}function S(B,T){const F=e.resolveStyle(e.cells[e.cellKey(B,T)]);return typeof(F==null?void 0:F.numberFormat)=="string"?F.numberFormat:""}function d(B,T,F){for(let oe=T;oe<=F;oe++)if(e.getCellRaw(B,oe).trim()!=="")return!0;return!1}function v(B){const{startRow:T,endRow:F,startCol:oe,endCol:de}=B;let ye=oe,we=de;for(;ye>0&&d(ye-1,T,F);)ye--;for(;we<e.colCount-1&&d(we+1,T,F);)we++;return{startRow:T,endRow:F,startCol:ye,endCol:we}}function w(B){const T=v(B);return T.startCol!==B.startCol||T.endCol!==B.endCol}function k(B,T,F,oe=B){let de,ye;if(F)de=F.startRow,ye=F.endRow;else{const ee=e.selection.value,He=!!ee&&ee.startRow===ee.endRow&&ee.startCol===ee.endCol;de=He||!ee?0:ee.startRow,ye=He||!ee?e.rowCount-1:ee.endRow}let we=-1,fe=-1;for(let ee=de;ee<=ye;ee++){let He=!1;for(let et=B;et<=T;et++)if(e.getCellRaw(et,ee).trim()!==""){He=!0;break}He&&(we<0&&(we=ee),fe=ee)}if(we<0)return null;const K=[];for(let ee=we;ee<=fe;ee++){const He=e.getCellRaw(oe,ee);K.push(Dn(He,S(oe,ee),e.locale.value))}const Ie=es(K)?we+1:we;let _e=!1;for(let ee=we;ee<=fe&&!_e;ee++)for(let He=B;He<=T;He++){const et=e.cells[e.cellKey(He,ee)];if(et&&et.value.startsWith("=")){_e=!0;break}}if(!_e)for(const ee in e.merges){const He=e.merges[ee];if(He&&He.startCol<=T&&He.endCol>=B&&He.startRow<=ye&&He.endRow>=de){_e=!0;break}}return{firstRow:we,lastRow:fe,sortStart:Ie,blocked:_e}}function Z(B,T){const F=k(B,T);return!!F&&!F.blocked&&F.sortStart<F.lastRow}function J(B,T,F){var C,L;const oe=T??e.selection.value;if(!oe)return;const de=oe.startCol,ye=oe.endCol,we=F??de,fe=k(de,ye,{startRow:oe.startRow,endRow:oe.endRow},we);if(!fe||fe.blocked||fe.sortStart>=fe.lastRow)return;const K=ye-de+1,Ie=fe.lastRow-fe.sortStart+1,_e=[],ee=[];for(let G=fe.sortStart;G<=fe.lastRow;G++){const ue=new Array(K);for(let ne=de;ne<=ye;ne++)ue[ne-de]=e.cells[e.cellKey(ne,G)]??null;_e.push(ue);const he=e.getCellRaw(we,G);ee.push(Dn(he,S(we,G),e.locale.value))}const He=Qc(ee,B,e.locale.value);let et=!1;for(let G=0;G<Ie;G++)if(He[G]!==G){et=!0;break}if(et){o.saveUndo();for(let G=0;G<Ie;G++){const ue=_e[He[G]],he=fe.sortStart+G;for(let ne=de;ne<=ye;ne++){const be=e.cellKey(ne,he),Ve=ue[ne-de],at=Ve?Ve.value:"",yt=(C=e.cells[be])==null?void 0:C.styleId;at!==""||yt!==void 0?e.cells[be]={value:at,styleId:yt}:e.delCell(be)}}ho();for(let G=fe.sortStart;G<=fe.lastRow;G++)for(let ue=de;ue<=ye;ue++)e.formulaDeps.markDirty(e.cellKey(ue,G));(L=e.scheduleRender)==null||L.call(e),H()}}const P=t.ref(!1),$=t.ref(null);function y(B){const T=e.selection.value;if(!T||!w(T))return!1;const F=v(T);return $.value={order:B,originalRange:T,expandedRange:F},P.value=!0,!0}function Y(B){const T=$.value;if(!T)return;const{order:F,originalRange:oe,expandedRange:de}=T;P.value=!1,$.value=null,J(F,B?de:oe,oe.startCol),De.value=F}function X(){P.value=!1,$.value=null}const ae=t.ref(!1),De=t.ref("asc");function Je(B){ae.value=B,B&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,o.fontSizeMenuOpen.value=!1)}function Le(B){y(B)||(De.value=B,J(B))}function Ce(){y(De.value)||J(De.value)}function ve(B){Object.keys(e.merges).forEach(T=>Reflect.deleteProperty(e.merges,T));for(const T of B)if(!(T.newRange.startCol>T.newRange.endCol||T.newRange.startRow>T.newRange.endRow)&&(e.merges[T.newAnchorKey]={...T.newRange},T.anchorCell)){const F=T.anchorCell.value,oe=T.anchorCell.styleId;F===""&&!oe||(e.cells[T.newAnchorKey]={value:F,styleId:oe||void 0})}}function Ke(B,T){const F=T-B+1,oe=[];for(const de in e.merges){const ye=e.merges[de];if(!ye)continue;const we=e.cells[de]?{value:e.cells[de].value,styleId:e.cells[de].styleId??0}:{value:"",styleId:0},{startCol:fe,endCol:K}=ye;let{startRow:Ie,endRow:_e}=ye;if(Ie>T){Ie-=F,_e-=F,oe.push({newAnchorKey:e.cellKey(fe,Ie),newRange:{startCol:fe,startRow:Ie,endCol:K,endRow:_e}});continue}if(_e<B){oe.push({newAnchorKey:de,newRange:{startCol:fe,startRow:Ie,endCol:K,endRow:_e}});continue}if(Ie>=B&&_e<=T||(Ie>=B&&Ie<=T&&(Ie=B),_e>=B&&_e<=T?_e=B-1:_e>T&&(_e-=F),Ie>_e))continue;const ee=fe,He=Ie,et=e.cellKey(ee,He),L=de.split(",").map(Number)[1],G=L>=B&&L<=T||ee!==ye.startCol||He!==L;oe.push({newAnchorKey:et,newRange:{startCol:fe,startRow:Ie,endCol:K,endRow:_e},anchorCell:G?we:void 0})}return oe}function Ae(B,T){const F=T-B+1,oe=[];for(const de in e.merges){const ye=e.merges[de];if(!ye)continue;const we=e.cells[de]?{value:e.cells[de].value,styleId:e.cells[de].styleId??0}:{value:"",styleId:0};let{startCol:fe,endCol:K}=ye;const{startRow:Ie,endRow:_e}=ye;if(fe>T){fe-=F,K-=F,oe.push({newAnchorKey:e.cellKey(fe,Ie),newRange:{startCol:fe,startRow:Ie,endCol:K,endRow:_e}});continue}if(K<B){oe.push({newAnchorKey:de,newRange:{startCol:fe,startRow:Ie,endCol:K,endRow:_e}});continue}if(fe>=B&&K<=T||(fe>=B&&fe<=T&&(fe=B),K>=B&&K<=T?K=B-1:K>T&&(K-=F),fe>K))continue;const ee=fe,He=Ie,et=e.cellKey(ee,He),L=de.split(",").map(Number)[0],G=L>=B&&L<=T||ee!==L||He!==ye.startRow;oe.push({newAnchorKey:et,newRange:{startCol:fe,startRow:Ie,endCol:K,endRow:_e},anchorCell:G?we:void 0})}return oe}function Be(B,T){const F=T-B+1,oe=[];for(const de in e.merges){const ye=e.merges[de];if(!ye)continue;const{startCol:we,endCol:fe}=ye;let{startRow:K,endRow:Ie}=ye;Ie<B?oe.push({newAnchorKey:de,newRange:{startCol:we,startRow:K,endCol:fe,endRow:Ie}}):K>T?(K+=F,Ie+=F,oe.push({newAnchorKey:e.cellKey(we,K),newRange:{startCol:we,startRow:K,endCol:fe,endRow:Ie}})):(Ie+=F,oe.push({newAnchorKey:de,newRange:{startCol:we,startRow:K,endCol:fe,endRow:Ie}}))}return oe}function Ne(B,T){const F=T-B+1,oe=[];for(const de in e.merges){const ye=e.merges[de];if(!ye)continue;let{startCol:we,endCol:fe}=ye;const{startRow:K,endRow:Ie}=ye;fe<B?oe.push({newAnchorKey:de,newRange:{startCol:we,startRow:K,endCol:fe,endRow:Ie}}):we>T?(we+=F,fe+=F,oe.push({newAnchorKey:e.cellKey(we,K),newRange:{startCol:we,startRow:K,endCol:fe,endRow:Ie}})):(fe+=F,oe.push({newAnchorKey:de,newRange:{startCol:we,startRow:K,endCol:fe,endRow:Ie}}))}return oe}let Ue=0;function Xe(){return Ue++,`s_${Ue}`}function ie(B,T){const F=Math.max(1,(T==null?void 0:T.colCount)??e.colCount),oe=Math.max(1,(T==null?void 0:T.rowCount)??e.rowCount),de=new Array(F).fill(100),ye=new Array(oe).fill(void 0);return{id:Xe(),name:B,cells:{},merges:{},styles:[{}],borders:[{}],selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:de,rowHeights:ye,colCount:F,rowCount:oe,freeze:{rows:0,cols:0}}}const ge=t.ref([ie("Sheet1")]),f=t.ref(0);function N(){const B=ge.value[f.value];B&&(B.cells={...e.cells},B.merges={...e.merges},B.selection=e.selection.value?{...e.selection.value}:null,B.activeCell={...e.activeCell.value},B.scrollX=e.scrollX.value,B.scrollY=e.scrollY.value,B.colWidths=[...e.colWidths.value],B.rowHeights=[...e.rowHeights.value],B.styles=[...e.styles],B.borders=[...e.borders],B.colCount=e.colCount,B.rowCount=e.rowCount,B.freeze={rows:e.freeze.rows,cols:e.freeze.cols})}function A(B){var fe;const T=ge.value[B];if(!T)return;Object.keys(e.cells).forEach(K=>e.delCell(K)),Object.assign(e.cells,T.cells),Object.keys(e.merges).forEach(K=>Reflect.deleteProperty(e.merges,K)),T.merges&&Object.assign(e.merges,T.merges),e.selection.value=T.selection?{...T.selection}:null,e.activeCell.value={...T.activeCell};const F=e.activeCell.value,oe=e.selection.value,de=e.findMerge(F.col,F.row);de&&de.anchor===e.cellKey(F.col,F.row)&&(!oe||oe.startCol===F.col&&oe.startRow===F.row&&oe.endCol===F.col&&oe.endRow===F.row)&&e.selectCell(F.col,F.row),e.scrollX.value=T.scrollX,e.scrollY.value=T.scrollY,e.colWidths.value=[...T.colWidths],e.rowHeights.value=[...T.rowHeights];const ye=Math.max(1,T.colCount??e.colCount),we=Math.max(1,T.rowCount??e.rowCount);(fe=e.setDims)==null||fe.call(e,ye,we),e.freeze.rows=Math.max(0,Math.min(T.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(T.freeze.cols,e.colCount)),e.syncStyles(T.styles),e.syncBorders(T.borders??[{}]),f.value=B}function Q(B){B===f.value||B<0||B>=ge.value.length||(e.cancelEdit(),N(),A(B))}function U(B){return o.saveUndo(),e.cancelEdit(),N(),ge.value.push(ie(B??`Sheet${ge.value.length+1}`)),A(ge.value.length-1),ge.value.length-1}function ce(B){return ge.value.length<=1||(o.saveUndo(),e.cancelEdit(),ge.value.splice(B,1),A(Math.min(B,ge.value.length-1))),f.value}function V(B,T){ge.value[B]&&T.trim()&&(o.saveUndo(),ge.value[B].name=T.trim())}function c(B){o.saveUndo(),e.cancelEdit(),N();const T=ge.value[B];if(!T)return B;let F=T.name;const oe=F.match(/^(.*?)\s*\((\d+)\)$/);let de=oe?parseInt(oe[2],10)+1:2;oe&&(F=oe[1]);let ye=`${F} (${de})`;const we=new Set(ge.value.map(K=>K.name));for(;we.has(ye);)de++,ye=`${F} (${de})`;const fe={id:Xe(),name:ye,cells:{...T.cells},merges:T.merges?{...T.merges}:{},styles:[...T.styles],borders:T.borders?[...T.borders]:[{}],selection:T.selection?{...T.selection}:null,activeCell:T.activeCell?{...T.activeCell}:{col:0,row:0},scrollX:T.scrollX,scrollY:T.scrollY,colWidths:[...T.colWidths],rowHeights:[...T.rowHeights],colCount:T.colCount,rowCount:T.rowCount,freeze:{...T.freeze}};return ge.value.splice(B+1,0,fe),A(B+1),B+1}function b(B,T){var ye;const F=B+T;if(F<0||F>=ge.value.length)return;o.saveUndo();const oe=f.value,de=ge.value.splice(B,1)[0];ge.value.splice(F,0,de),oe===B?f.value=F:B<oe&&F>=oe?f.value=oe-1:B>oe&&F<=oe&&(f.value=oe+1),(ye=e.scheduleRender)==null||ye.call(e)}const ft=t.computed(()=>ge.value.length);let se="";const m=n;function H(){N();const B=ge.value.map(F=>{const oe={};for(const[fe,K]of Object.entries(F.cells))oe[fe]={value:K.value},K.styleId&&K.styleId>0&&(oe[fe].styleId=K.styleId);const de={name:F.name,cells:oe};F.styles&&F.styles.length>1&&(de.styles=[...F.styles]),F.borders&&F.borders.length>1&&(de.borders=[...F.borders]),F.merges&&Object.keys(F.merges).length&&(de.merges={...F.merges});const ye={};for(let fe=0;fe<F.colWidths.length;fe++)F.colWidths[fe]!==100&&(ye[fe]=F.colWidths[fe]);Object.keys(ye).length&&(de.colWidths=ye);const we={};for(let fe=0;fe<F.rowHeights.length;fe++){const K=F.rowHeights[fe];K!=null&&(we[fe]=K)}return Object.keys(we).length&&(de.rowHeights=we),F.colCount!==26&&(de.colCount=F.colCount),F.rowCount!==200&&(de.rowCount=F.rowCount),(F.freeze.rows!==0||F.freeze.cols!==0)&&(de.freeze={rows:F.freeze.rows,cols:F.freeze.cols}),de}),T=JSON.stringify(B);T!==se&&(se=T,m.value=B,a&&(a.value=T))}e.emitModelData=H;let Qe=!1;function wt(){Qe||(Qe=!0,Promise.resolve().then(()=>{Qe=!1,H()}))}const me=t.computed(()=>e.props.theme==="dark"?Yn:Gn),ze=t.computed(()=>qc(me.value,e.props.width,e.props.height,Zl)),lt=t.computed(()=>{const B={};for(const[T,F]of Object.entries(ze.value))T.startsWith("--")&&(B[T]=F);return B}),kt=t.ref(null),ht=t.ref(null),St=t.ref(null),zt=t.ref(null),sl=t.ref(null),Ut=t.reactive({w:800,h:600});e.viewSize&&t.watch(Ut,B=>{e.viewSize&&(e.viewSize.w=B.w,e.viewSize.h=B.h)},{deep:!0});const dl=48,Gt=28,rl=11,xl=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,Ut.w-dl-rl))),Yt=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,Ut.h-Gt-rl)));function Qt(B,T){const F=Math.max(0,Ut.w-dl-rl),oe=Math.max(0,Ut.h-Gt-rl),de=B??e.scrollX.value,ye=T??e.scrollY.value,we=40,fe=Math.max(0,e.totalWidth.value-F),K=Math.max(0,e.totalHeight.value-oe);if(de>=fe-we&&de>e.scrollX.value||ye>=K-we&&ye>e.scrollY.value){const Ie=Math.max(0,Math.ceil((de+F)/100)+2),_e=Math.max(0,Math.ceil((ye+oe)/24)+2);e.ensureCapacity(Ie,_e)}e.scrollX.value=Math.max(0,Math.min(de,Math.max(0,e.totalWidth.value-F))),e.scrollY.value=Math.max(0,Math.min(ye,Math.max(0,e.totalHeight.value-oe)))}e.clampScroll=Qt;function Bl(){var B;return typeof window>"u"?!1:!((B=window.matchMedia)!=null&&B.call(window,"(hover: none) and (pointer: coarse)").matches)}function bl(B=!1){t.nextTick(()=>{const T=zt.value;if(T){if(!e.editingCell.value&&!Bl()){document.activeElement===T&&T.blur();return}T.focus({preventScroll:!0}),B&&T.select()}})}function ul(){bl()}function Xt(){var T;const B=e.selection.value;if(B){o.saveUndo();for(let F=B.startRow;F<=B.endRow;F++)e.rowHeights.value[F]=void 0;(T=e.scheduleRender)==null||T.call(e),H()}}function fl(){var T;const B=e.selection.value;if(B){o.saveUndo();for(let F=B.startCol;F<=B.endCol;F++)e.colWidths.value[F]=100;(T=e.scheduleRender)==null||T.call(e),H()}}return{deleteRows:i,insertRows:r,insertCols:u,deleteCols:p,sortSelectedColumns:J,canSortColumns:Z,sortMenuOpen:ae,cachedSortOrder:De,onSortMenuToggle:Je,onSortChange:Le,applyCachedSort:Ce,sortConfirmOpen:P,prepareSortConfirmation:y,confirmSort:Y,cancelSortConfirmation:X,sheets:ge,activeSheetIndex:f,saveSheet:N,loadSheet:A,switchSheet:Q,addSheet:U,removeSheet:ce,renameSheet:V,dupSheet:c,moveSheet:b,sheetCount:ft,mkSheet:ie,emitModelData:H,scheduleOptEmit:wt,themeColors:me,outerStyle:ze,toolbarThemeVars:lt,wrapperRef:kt,canvasRef:ht,freezeCanvasRef:St,editInputRef:zt,formulaBarRef:sl,viewSize:Ut,maxScrollX:xl,maxScrollY:Yt,clampScroll:Qt,canFocusHiddenEditor:Bl,focusEditInput:bl,onCanvasFocus:ul,resetRowHeight:Xt,resetColWidth:fl,modelData:m}}function Tn(e){return!!e&&e.width!==void 0&&e.width>0}function Dt(e,o,n,l){const a=Tn(e),i=Tn(o);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return o;const r=e.width??0,u=o.width??0;return r>u?e:u>r?o:e}function ls(e,o,n,l,a){let i=!1,r=null,u=1,p=()=>{},h=()=>{},S=()=>{};function d(){i||(i=!0,requestAnimationFrame(()=>{i=!1,Z(),J()}))}e.scheduleRender=d;function v(s){const{frozenColumnsWidth:g}=e.getFrozenMetrics(),M=g>0&&s<52+g?s-52:s-52+e.scrollX.value;return e.hitCol(M)}function w(s){const{frozenRowsHeight:g}=e.getFrozenMetrics(),M=g>0&&s<24+g?s-24:s-24+e.scrollY.value;return e.hitRow(M)}const k="#444";function Z(){const s=l.wrapperRef.value,g=l.canvasRef.value;if(!s||!g||(r=g.getContext("2d"),!r))return;u=window.devicePixelRatio||1;const M=s.getBoundingClientRect(),_=M.width,D=M.height;l.viewSize.w=_,l.viewSize.h=D,g.width=_*u,g.height=D*u,g.style.width=_+"px",g.style.height=D+"px",r.setTransform(u,0,0,u,0,0);const z=e.scrollX.value,te=e.scrollY.value,j=52,re=24,Me=l.themeColors.value,It=e.colPositions.value,dt=e.rowPositions.value,Bt=e.colWidths.value,{frozenRowsHeight:ut,frozenColumnsWidth:Rt}=e.getFrozenMetrics(),Zt=j+Rt,qt=re+ut,eo=Math.max(0,_-j-11-Rt),Dl=Math.max(0,D-re-11-ut),Pl=Math.max(0,e.freeze.cols-1),Kl=Math.max(0,e.freeze.rows-1),Cl=Math.max(e.freeze.cols,e.hitCol(Rt+z));let Ul=Cl;for(let R=Cl;R<e.colCount&&!(j+It[R]-z>=_);R++)Ul=R;const Tl=Math.max(e.freeze.rows,e.hitRow(ut+te));let pl=Tl;for(let R=Tl;R<e.rowCount&&!(re+dt[R]-te>=D);R++)pl=R;let vl=Cl,Lt=Ul,tl=Tl,_t=pl;Rt>0&&(vl=0,Lt=Math.max(Lt,Pl)),ut>0&&(tl=0,_t=Math.max(_t,Kl));let Gl=vl,il=tl;for(const R in e.merges){const Se=e.merges[R];Se&&(Se.startRow>_t||Se.endRow<tl||Se.startCol>Lt||Se.endCol<vl||(Se.startCol<Gl&&(Gl=Se.startCol),Se.startRow<il&&(il=Se.startRow)))}const Yl=new Array(il);for(let R=il;R<=_t;R++)Yl[R]=dt[R+1]-dt[R];r.fillStyle=Me.bg,r.fillRect(0,0,_,D),r.fillStyle=Me.gridBg,r.fillRect(j,re,_-j,D-re);const pt=e.selection.value,yo=e.editingCell.value;p=(R,Se,$e,ct,gt,Mt)=>{for(let tt=ct;tt<=gt;tt++)for(let ke=Se;ke<=$e;ke++){if(e.findMerge(ke,tt))continue;const qe=e.cellToScreenRect(tt,ke),Oe=qe.x,Fe=qe.y,rt=qe.width,st=qe.height;if(Oe+rt<j||Fe+st<re||Oe>_||Fe>D)continue;const bt=e.findHighlight?e.findHighlight(ke,tt):null,Ct=e.resolveStyle(e.cells[e.cellKey(ke,tt)]),vt=typeof(Ct==null?void 0:Ct.backgroundColor)=="string"?Ct.backgroundColor:"";if(vt&&(R.fillStyle=vt,R.fillRect(Oe,Fe,rt,st)),bt&&(R.fillStyle=bt==="active"?Me.findActiveBg:Me.findMatchBg,R.fillRect(Oe,Fe,rt,st)),e.isSelected(ke,tt)&&(R.fillStyle=Me.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?R.fillRect(Oe,Fe,Bt[ke],Mt[tt]):R.fillRect(Oe,Fe,rt,st)),e.activeCell.value.col===ke&&e.activeCell.value.row===tt&&(R.strokeStyle=Me.activeCellBorder,R.lineWidth=2,R.strokeRect(Oe+1,Fe+1,rt-2,st-2)),bt==="active"&&(R.strokeStyle=Me.findActiveBg,R.lineWidth=2,R.strokeRect(Oe+1,Fe+1,rt-2,st-2)),R.strokeStyle=Me.gridLine,R.lineWidth=.5,R.strokeRect(Oe+.25,Fe+.25,rt-.5,st-.5),!(yo&&yo.col===ke&&yo.row===tt)){const pe=e.resolveStyle(e.cells[e.cellKey(ke,tt)]),le=e.getCellValue(ke,tt),Re=typeof(pe==null?void 0:pe.numberFormat)=="string"?pe.numberFormat:"",xe=le?zl(le,Re,e.locale.value):"";if(xe){const je=e.cellFontSize(ke,tt),Et=typeof(pe==null?void 0:pe.fontFamily)=="string"&&pe.fontFamily?pe.fontFamily:jl,Pt=(pe==null?void 0:pe.fontWeight)==="bold"?"bold":"normal",$t=(pe==null?void 0:pe.fontStyle)==="italic"?"italic":"normal",wl=(pe==null?void 0:pe.underline)==="underline",Nl=(pe==null?void 0:pe.strikethrough)==="line-through",kl=typeof(pe==null?void 0:pe.color)=="string"?pe.color:"",Il=typeof(pe==null?void 0:pe.textAlign)=="string"?pe.textAlign:To(le,Re)?"right":"left",uo=typeof(pe==null?void 0:pe.verticalAlign)=="string"?pe.verticalAlign:"top";R.fillStyle=kl||Me.cellText,R.font=`${$t} ${Pt} ${je}px ${Et}`,R.textBaseline="alphabetic",R.save(),R.beginPath(),R.rect(Oe+5,Fe+1,rt-10,st-2),R.clip();const Fl=(pe==null?void 0:pe.wrap)==="wrap",cl=rt-10;let Al=xe;const hl=!Fl&&en(Re),Vl=xe===Co||tn(le,Re);if(Vl||hl){if(Vl){const lo=Math.max(1,R.measureText("#").width),bo=Math.max(1,Math.floor(cl/lo));Al="#".repeat(bo)}else if(e.getWrappedLines(R,xe,1e9,!1).some(Hl=>Hl&&R.measureText(Hl).width>cl)){const Hl=Math.max(1,R.measureText("#").width),fo=Math.max(1,Math.floor(cl/Hl));Al="#".repeat(fo)}}const ll=e.getWrappedLines(R,Al,cl,Fl),{ascent:to,descent:So}=e.measureFontMetrics(Et,je,Pt,$t),Ro=to+So,Is=ll.length*Ro;let Mo;uo==="middle"?Mo=Fe+(st-Is)/2+to:uo==="bottom"?Mo=Fe+st-e.BASE_CELL_VPAD-So-(ll.length-1)*Ro:Mo=Fe+e.BASE_CELL_VPAD+to;for(let lo=0;lo<ll.length;lo++){const bo=ll[lo],Hl=Mo+lo*Ro,fo=R.measureText(bo);let Xl;if(Il==="center"?Xl=Oe+rt/2-fo.width/2:Il==="right"?Xl=Oe+rt-5-fo.width:Xl=Oe+5,R.fillText(bo,Xl,Hl),wl&&(R.strokeStyle=kl||Me.cellText,R.lineWidth=1,R.beginPath(),R.moveTo(Xl,Hl+So+1),R.lineTo(Xl+fo.width,Hl+So+1),R.stroke()),Nl){R.strokeStyle=kl||Me.cellText,R.lineWidth=1;const An=Hl-to+Ro*.42;R.beginPath(),R.moveTo(Xl,An),R.lineTo(Xl+fo.width,An),R.stroke()}}R.restore()}}}};const Ft=(R,Se,$e)=>{const ct=e.findMerge(R,Se);return ct?e.getCellBorderSide(e.cells[ct.anchor],$e):e.getCellBorderSide(e.cells[e.cellKey(R,Se)],$e)};h=(R,Se,$e,ct,gt,Mt)=>{R.fillStyle=k;for(let tt=ct;tt<=gt;tt++)for(let ke=Se;ke<=$e;ke++){if(e.findMerge(ke,tt))continue;const qe=e.cellToScreenRect(tt,ke),Oe=qe.x,Fe=qe.y,rt=qe.width,st=qe.height;if(Oe+rt<j||Fe+st<re||Oe>_||Fe>D)continue;const bt=e.cells[e.cellKey(ke,tt)],Ct={top:e.getCellBorderSide(bt,"top"),right:e.getCellBorderSide(bt,"right"),bottom:e.getCellBorderSide(bt,"bottom"),left:e.getCellBorderSide(bt,"left")},vt={top:Ft(ke,tt-1,"bottom"),left:Ft(ke-1,tt,"right"),bottom:Ft(ke,tt+1,"top"),right:Ft(ke+1,tt,"left")},pe=Dt(vt.top,Ct.top),le=Dt(vt.left,Ct.left),Re=Dt(Ct.bottom,vt.bottom),xe=Dt(Ct.right,vt.right),je=(pe==null?void 0:pe.width)??0,Et=(le==null?void 0:le.width)??0,Pt=(Re==null?void 0:Re.width)??0,$t=(xe==null?void 0:xe.width)??0;je>0&&(R.fillStyle=(pe==null?void 0:pe.color)||k,R.fillRect(Oe,Fe,rt,je)),Pt>0&&(R.fillStyle=(Re==null?void 0:Re.color)||k,R.fillRect(Oe,Fe+st-Pt,rt,Pt)),Et>0&&(R.fillStyle=(le==null?void 0:le.color)||k,R.fillRect(Oe,Fe,Et,st)),$t>0&&(R.fillStyle=(xe==null?void 0:xe.color)||k,R.fillRect(Oe+rt-$t,Fe,$t,st)),je>0&&Et>0&&(R.fillStyle=(pe==null?void 0:pe.color)||(le==null?void 0:le.color)||k,R.fillRect(Oe-Et,Fe-je,Et,je)),je>0&&$t>0&&(R.fillStyle=(pe==null?void 0:pe.color)||(xe==null?void 0:xe.color)||k,R.fillRect(Oe+rt,Fe-je,$t,je)),Pt>0&&Et>0&&(R.fillStyle=(Re==null?void 0:Re.color)||(le==null?void 0:le.color)||k,R.fillRect(Oe-Et,Fe+st,Et,Pt)),Pt>0&&$t>0&&(R.fillStyle=(Re==null?void 0:Re.color)||(xe==null?void 0:xe.color)||k,R.fillRect(Oe+rt,Fe+st,$t,Pt))}};const ot=(R,Se,$e,ct,gt,Mt,tt)=>{const ke=e.resolveStyle(e.cells[e.cellKey(Se,$e)]),nt=e.getCellValue(Se,$e),qe=typeof(ke==null?void 0:ke.numberFormat)=="string"?ke.numberFormat:"",Oe=nt?zl(nt,qe,e.locale.value):"";if(!Oe)return;const Fe=e.cellFontSize(Se,$e),rt=typeof(ke==null?void 0:ke.fontFamily)=="string"&&ke.fontFamily?ke.fontFamily:jl,st=(ke==null?void 0:ke.fontWeight)==="bold"?"bold":"normal",bt=(ke==null?void 0:ke.fontStyle)==="italic"?"italic":"normal",Ct=(ke==null?void 0:ke.underline)==="underline",vt=(ke==null?void 0:ke.strikethrough)==="line-through",pe=typeof(ke==null?void 0:ke.color)=="string"?ke.color:"",le=typeof(ke==null?void 0:ke.textAlign)=="string"?ke.textAlign:To(nt,qe)?"right":"left",Re=typeof(ke==null?void 0:ke.verticalAlign)=="string"?ke.verticalAlign:"top";R.fillStyle=pe||Me.cellText,R.font=`${bt} ${st} ${Fe}px ${rt}`,R.textBaseline="alphabetic",R.save(),R.beginPath(),R.rect(Mt+5,tt+1,ct-10,gt-2),R.clip();const xe=(ke==null?void 0:ke.wrap)==="wrap",je=ct-10;let Et=Oe;const Pt=!xe&&en(qe),$t=Oe===Co||tn(nt,qe);if($t||Pt){if($t){const cl=Math.max(1,R.measureText("#").width),Al=Math.max(1,Math.floor(je/cl));Et="#".repeat(Al)}else if(e.getWrappedLines(R,Oe,1e9,!1).some(hl=>hl&&R.measureText(hl).width>je)){const hl=Math.max(1,R.measureText("#").width),Vl=Math.max(1,Math.floor(je/hl));Et="#".repeat(Vl)}}const wl=e.getWrappedLines(R,Et,je,xe),{ascent:Nl,descent:kl}=e.measureFontMetrics(rt,Fe,st,bt),Il=Nl+kl,uo=wl.length*Il;let Fl;Re==="middle"?Fl=tt+(gt-uo)/2+Nl:Re==="bottom"?Fl=tt+gt-e.BASE_CELL_VPAD-kl-(wl.length-1)*Il:Fl=tt+e.BASE_CELL_VPAD+Nl;for(let cl=0;cl<wl.length;cl++){const Al=wl[cl],hl=Fl+cl*Il,Vl=R.measureText(Al);let ll;if(le==="center"?ll=Mt+ct/2-Vl.width/2:le==="right"?ll=Mt+ct-5-Vl.width:ll=Mt+5,R.fillText(Al,ll,hl),Ct&&(R.strokeStyle=pe||Me.cellText,R.lineWidth=1,R.beginPath(),R.moveTo(ll,hl+kl+1),R.lineTo(ll+Vl.width,hl+kl+1),R.stroke()),vt){R.strokeStyle=pe||Me.cellText,R.lineWidth=1;const to=hl-Nl+Il*.42;R.beginPath(),R.moveTo(ll,to),R.lineTo(ll+Vl.width,to),R.stroke()}}R.restore()},At=(R,Se,$e,ct,gt,Mt,tt,ke)=>{const nt=Se.startCol,qe=Se.endCol,Oe=Se.startRow,Fe=Se.endRow,rt=ct,st=Mt,bt=tt&&qe>=e.freeze.cols,Ct=ke&&Fe>=e.freeze.rows,vt=e.cells[e.cellKey(nt,Oe)],pe={top:e.getCellBorderSide(vt,"top"),right:e.getCellBorderSide(vt,"right"),bottom:e.getCellBorderSide(vt,"bottom"),left:e.getCellBorderSide(vt,"left")};R.fillStyle=k;for(let le=nt;le<=qe;le++){if(tt&&le>=e.freeze.cols||e.isSameMergeInternal(le,Oe-1,le,Oe))continue;const Re=Ft(le,Oe-1,"bottom"),xe=Dt(Re,pe.top);if(xe&&xe.width&&xe.width>0){const je=le<e.freeze.cols?j+It[le]:j+It[le]-z;R.fillStyle=xe.color||k,R.fillRect(je,rt,Bt[le],xe.width)}}if(!Ct)for(let le=nt;le<=qe;le++){if(tt&&le>=e.freeze.cols||e.isSameMergeInternal(le,Fe,le,Fe+1))continue;const Re=Ft(le,Fe+1,"top"),xe=Dt(pe.bottom,Re);if(xe&&xe.width&&xe.width>0){const je=le<e.freeze.cols?j+It[le]:j+It[le]-z;R.fillStyle=xe.color||k,R.fillRect(je,rt+st-xe.width,Bt[le],xe.width)}}for(let le=Oe;le<=Fe;le++){if(ke&&le>=e.freeze.rows||e.isSameMergeInternal(nt-1,le,nt,le))continue;const Re=Ft(nt-1,le,"right"),xe=Dt(Re,pe.left);if(xe&&xe.width&&xe.width>0){const je=le<e.freeze.rows?re+dt[le]:re+dt[le]-te,Et=dt[le+1]-dt[le];R.fillStyle=xe.color||k,R.fillRect($e,je,xe.width,Et)}}if(!bt)for(let le=Oe;le<=Fe;le++){if(ke&&le>=e.freeze.rows||e.isSameMergeInternal(qe,le,qe+1,le))continue;const Re=Ft(qe+1,le,"left"),xe=Dt(pe.right,Re);if(xe&&xe.width&&xe.width>0){const je=le<e.freeze.rows?re+dt[le]:re+dt[le]-te,Et=dt[le+1]-dt[le];R.fillStyle=xe.color||k,R.fillRect($e+gt-xe.width,je,xe.width,Et)}}{const le=e.isSameMergeInternal(nt,Oe-1,nt,Oe)?pe.top:Dt(Ft(nt,Oe-1,"bottom"),pe.top),Re=e.isSameMergeInternal(nt-1,Oe,nt,Oe)?pe.left:Dt(Ft(nt-1,Oe,"right"),pe.left),xe=(le==null?void 0:le.width)??0,je=(Re==null?void 0:Re.width)??0;xe>0&&je>0&&(R.fillStyle=(le==null?void 0:le.color)||(Re==null?void 0:Re.color)||k,R.fillRect($e-je,ct-xe,je,xe))}if(!bt){const le=e.isSameMergeInternal(qe,Oe-1,qe,Oe)?pe.top:Dt(Ft(qe,Oe-1,"bottom"),pe.top),Re=e.isSameMergeInternal(qe,Oe,qe+1,Oe)?pe.right:Dt(pe.right,Ft(qe+1,Oe,"left")),xe=(le==null?void 0:le.width)??0,je=(Re==null?void 0:Re.width)??0;xe>0&&je>0&&(R.fillStyle=(le==null?void 0:le.color)||(Re==null?void 0:Re.color)||k,R.fillRect($e+gt,ct-xe,je,xe))}if(!Ct){const le=e.isSameMergeInternal(nt,Fe,nt,Fe+1)?pe.bottom:Dt(pe.bottom,Ft(nt,Fe+1,"top")),Re=e.isSameMergeInternal(nt-1,Fe,nt,Fe)?pe.left:Dt(Ft(nt-1,Fe,"right"),pe.left),xe=(le==null?void 0:le.width)??0,je=(Re==null?void 0:Re.width)??0;xe>0&&je>0&&(R.fillStyle=(le==null?void 0:le.color)||(Re==null?void 0:Re.color)||k,R.fillRect($e-je,ct+Mt,je,xe))}if(!bt&&!Ct){const le=e.isSameMergeInternal(qe,Fe,qe,Fe+1)?pe.bottom:Dt(pe.bottom,Ft(qe,Fe+1,"top")),Re=e.isSameMergeInternal(qe,Fe,qe+1,Fe)?pe.right:Dt(pe.right,Ft(qe+1,Fe,"left")),xe=(le==null?void 0:le.width)??0,je=(Re==null?void 0:Re.width)??0;xe>0&&je>0&&(R.fillStyle=(le==null?void 0:le.color)||(Re==null?void 0:Re.color)||k,R.fillRect($e+gt,ct+Mt,je,xe))}};S=(R,Se,$e,ct,gt)=>{var qe;const Mt=Se+ct,tt=$e+gt,ke=Se<Zt,nt=$e<qt;for(const Oe in e.merges){const Fe=e.merges[Oe];if(!Fe)continue;const rt=Fe.startCol,st=Fe.startRow,bt=Fe.endCol,Ct=Fe.endRow,vt=e.cellToScreenRect(st,rt),pe=e.cellToScreenRect(Ct,bt),le=vt.x,Re=vt.y,xe=pe.x+pe.width-le,je=pe.y+pe.height-Re,Et=ke&&bt>=e.freeze.cols?Math.min(Mt,Zt):Math.min(le+xe,Mt),Pt=nt&&Ct>=e.freeze.rows?Math.min(tt,qt):Math.min(Re+je,tt),$t=Math.max(le,Se),wl=Math.max(Re,$e);if(Et<=$t||Pt<=wl)continue;const Nl=(qe=e.resolveStyle(e.cells[e.cellKey(rt,st)]))==null?void 0:qe.backgroundColor;if(Nl&&(R.fillStyle=Nl,R.fillRect($t,wl,Et-$t,Pt-wl)),R.strokeStyle=Me.gridLine,R.lineWidth=.5,R.strokeRect(le+.25,Re+.25,Et-le-.5,Pt-Re-.5),At(R,Fe,le,Re,xe,je,ke,nt),!(e.editingCell.value&&e.editingCell.value.col===rt&&e.editingCell.value.row===st)){const kl=It[bt+1]-It[rt],Il=dt[Ct+1]-dt[st],uo=ke?le:le-z,Fl=nt?Re:Re-te;ot(R,rt,st,kl,Il,uo,Fl)}}},r.save(),r.beginPath(),r.rect(Zt,qt,eo,Dl),r.clip(),p(r,Gl,Lt,il,_t,Yl),h(r,Gl,Lt,il,_t,Yl),S(r,Zt,qt,eo,Dl),r.restore(),Rt>0&&(r.strokeStyle=Me.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Zt+.5,re),r.lineTo(Zt+.5,D),r.stroke()),ut>0&&(r.strokeStyle=Me.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(j,qt+.5),r.lineTo(_,qt+.5),r.stroke()),r.fillStyle=Me.headerBg,r.fillRect(j,0,_-j,re);for(let R=Cl;R<=Ul;R++){const Se=j+It[R]-z,$e=Bt[R];Se+$e<j||Se>_||(pt&&R>=pt.startCol&&R<=pt.endCol&&(r.fillStyle=Me.selectionBg,r.fillRect(Se,0,$e,re)),r.strokeStyle=Me.headerBorder,r.lineWidth=.5,r.strokeRect(Se+.25,.25,$e-.5,re-.5),pt&&R>=pt.startCol&&R<=pt.endCol&&(r.strokeStyle=Me.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Se,re-1),r.lineTo(Se+$e,re-1),r.stroke()),r.fillStyle=Me.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(mt(R),Se+$e/2,re/2))}if(Rt>0){r.fillStyle=Me.headerBg,r.fillRect(j,0,Rt,re);for(let R=0;R<=Pl;R++){const Se=j+It[R],$e=Bt[R];Se+$e<j||Se>_||(pt&&R>=pt.startCol&&R<=pt.endCol&&(r.fillStyle=Me.selectionBg,r.fillRect(Se,0,$e,re)),r.strokeStyle=Me.headerBorder,r.lineWidth=.5,r.strokeRect(Se+.25,.25,$e-.5,re-.5),pt&&R>=pt.startCol&&R<=pt.endCol&&(r.strokeStyle=Me.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Se,re-1),r.lineTo(Se+$e,re-1),r.stroke()),r.fillStyle=Me.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(mt(R),Se+$e/2,re/2))}}r.strokeStyle=Me.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(j,re+.5),r.lineTo(_,re+.5),r.stroke(),r.fillStyle=Me.headerBg,r.fillRect(0,re,j,D-re);for(let R=Tl;R<=pl;R++){const Se=re+dt[R]-te,$e=Yl[R];Se+$e<re||Se>D||(pt&&R>=pt.startRow&&R<=pt.endRow&&(r.fillStyle=Me.selectionBg,r.fillRect(0,Se,j,$e)),r.strokeStyle=Me.headerBorder,r.lineWidth=.5,r.strokeRect(.25,Se+.25,j-.5,$e-.5),pt&&R>=pt.startRow&&R<=pt.endRow&&(r.strokeStyle=Me.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(j-1,Se),r.lineTo(j-1,Se+$e),r.stroke()),r.fillStyle=Me.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(R+1),j/2,Se+$e/2+.5))}if(ut>0){r.fillStyle=Me.headerBg,r.fillRect(0,re,j,ut);for(let R=0;R<=Kl;R++){const Se=re+dt[R],$e=Yl[R];Se+$e<re||Se>D||(pt&&R>=pt.startRow&&R<=pt.endRow&&(r.fillStyle=Me.selectionBg,r.fillRect(0,Se,j,$e)),r.strokeStyle=Me.headerBorder,r.lineWidth=.5,r.strokeRect(.25,Se+.25,j-.5,$e-.5),pt&&R>=pt.startRow&&R<=pt.endRow&&(r.strokeStyle=Me.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(j-1,Se),r.lineTo(j-1,Se+$e),r.stroke()),r.fillStyle=Me.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(R+1),j/2,Se+$e/2+.5))}}r.strokeStyle=Me.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(j+.5,re),r.lineTo(j+.5,D),r.stroke(),P(r,Me),$(r,Me)}function J(){const s=l.freezeCanvasRef.value,g=l.wrapperRef.value;if(!s||!g)return;const M=s.getContext("2d");if(!M)return;const _=g.getBoundingClientRect(),D=_.width,z=_.height,te=52,j=24,re=l.themeColors.value,Me=e.colPositions.value,It=e.rowPositions.value,dt=e.scrollX.value,Bt=e.scrollY.value;s.width=D*u,s.height=z*u,s.style.width=D+"px",s.style.height=z+"px",M.setTransform(u,0,0,u,0,0),M.clearRect(0,0,D,z);const{frozenRowsHeight:ut,frozenColumnsWidth:Rt}=e.getFrozenMetrics();if(ut<=0&&Rt<=0)return;const Zt=te+Rt,qt=j+ut,eo=Math.max(0,D-te-11-Rt),Dl=Math.max(0,z-j-11-ut),Pl=Math.max(0,e.freeze.cols-1),Kl=Math.max(0,e.freeze.rows-1),Cl=Math.max(e.freeze.cols,e.hitCol(Rt+dt));let Ul=Cl;for(let ot=Cl;ot<e.colCount&&!(te+Me[ot]-dt>=D);ot++)Ul=ot;const Tl=Math.max(e.freeze.rows,e.hitRow(ut+Bt));let pl=Tl;for(let ot=Tl;ot<e.rowCount&&!(j+It[ot]-Bt>=z);ot++)pl=ot;let vl=Cl,Lt=Ul,tl=Tl,_t=pl;Rt>0&&(vl=0,Lt=Math.max(Lt,Pl)),ut>0&&(tl=0,_t=Math.max(_t,Kl));let Gl=vl,il=tl;for(const ot in e.merges){const At=e.merges[ot];At&&(At.startRow>_t||At.endRow<tl||At.startCol>Lt||At.endCol<vl||(At.startCol<Gl&&(Gl=At.startCol),At.startRow<il&&(il=At.startRow)))}const Yl=new Array(il);for(let ot=il;ot<=_t;ot++)Yl[ot]=It[ot+1]-It[ot];const pt=(ot,At,R)=>{const Se=e.findMerge(ot,At);return Se?e.getCellBorderSide(e.cells[Se.anchor],R):e.getCellBorderSide(e.cells[e.cellKey(ot,At)],R)},yo=(ot,At,R,Se,$e)=>{ot.fillStyle="#444";for(let ct=Se;ct<=$e;ct++)for(let gt=At;gt<=R;gt++){const Mt=e.findMerge(gt,ct);if(Mt&&!(gt===Mt.range.startCol&&ct===Mt.range.startRow))continue;const tt=e.cellToScreenRect(ct,gt),ke=tt.x,nt=tt.y,qe=tt.width,Oe=tt.height;if(ke+qe<te||nt+Oe<j||ke>D||nt>z)continue;const Fe=e.cells[e.cellKey(gt,ct)],rt={top:e.getCellBorderSide(Fe,"top"),right:e.getCellBorderSide(Fe,"right"),bottom:e.getCellBorderSide(Fe,"bottom"),left:e.getCellBorderSide(Fe,"left")};if(Mt)continue;const st={top:pt(gt,ct-1,"bottom"),left:pt(gt-1,ct,"right"),bottom:pt(gt,ct+1,"top"),right:pt(gt+1,ct,"left")},bt=Dt(st.top,rt.top),Ct=Dt(st.left,rt.left),vt=Dt(rt.bottom,st.bottom),pe=Dt(rt.right,st.right),le=(bt==null?void 0:bt.width)??0,Re=(Ct==null?void 0:Ct.width)??0,xe=(vt==null?void 0:vt.width)??0,je=(pe==null?void 0:pe.width)??0;le>0&&(ot.fillStyle=(bt==null?void 0:bt.color)||"#444",ot.fillRect(ke,nt,qe,le)),xe>0&&(ot.fillStyle=(vt==null?void 0:vt.color)||"#444",ot.fillRect(ke,nt+Oe-xe,qe,xe)),Re>0&&(ot.fillStyle=(Ct==null?void 0:Ct.color)||"#444",ot.fillRect(ke,nt,Re,Oe)),je>0&&(ot.fillStyle=(pe==null?void 0:pe.color)||"#444",ot.fillRect(ke+qe-je,nt,je,Oe))}},Ft=(ot,At,R,Se,$e,ct,gt,Mt)=>{R<=0||Se<=0||(M.save(),M.beginPath(),M.rect(ot,At,R,Se),M.clip(),M.fillStyle=re.gridBg,M.fillRect(ot,At,R,Se),p(M,$e,ct,gt,Mt,Yl),yo(M,$e,ct,gt,Mt),S(M,ot,At,R,Se),M.restore())};Rt>0&&ut>0&&Ft(te,j,Rt,ut,0,Pl,0,Kl),ut>0&&Ft(Zt,j,eo,ut,Gl,Lt,0,Kl),Rt>0&&Ft(te,qt,Rt,Dl,0,Pl,il,_t),M.strokeStyle=re.headerSep,M.lineWidth=1,Rt>0&&(M.beginPath(),M.moveTo(Zt+.5,j),M.lineTo(Zt+.5,z),M.stroke()),ut>0&&(M.beginPath(),M.moveTo(te,qt+.5),M.lineTo(D,qt+.5),M.stroke()),M.fillStyle=re.headerBg,M.fillRect(0,0,te,j),M.strokeStyle=re.headerSep,M.lineWidth=1,M.strokeRect(.5,.5,te-.5,j-.5),P(M,re),$(M,re)}function P(s,g){const M=e.selection.value;if(!M||e.editingCell.value)return;const _=e.cellToScreenRect(M.endRow,M.endCol),D=_o(M,M,e.merges),z=_.x+_.width-6/2,te=_.y+_.height-6/2;s.fillStyle=D?g.activeCellBorder:g.scrollTrack,s.fillRect(z,te,6,6),s.strokeStyle="#fff",s.lineWidth=1,s.strokeRect(z+.5,te+.5,6-1,6-1)}function $(s,g){const M=e.autoFillState.value;if(!M.active||!M.preview||!M.targetRange)return;const _=M.targetRange,D=e.cellToScreenRect(_.startRow,_.startCol),z=e.cellToScreenRect(_.endRow,_.endCol),te=D.x,j=D.y,re=z.x+z.width-te,Me=z.y+z.height-j;s.fillStyle=g.selectionBg,s.fillRect(te,j,re,Me),s.strokeStyle=g.activeCellBorder,s.lineWidth=1.5,s.setLineDash([4,3]),s.strokeRect(te+.5,j+.5,re-1,Me-1),s.setLineDash([])}const y=t.computed(()=>mt(e.activeCell.value.col)+String(e.activeCell.value.row+1)),Y=t.ref(""),X=t.ref(!1),ae=t.computed(()=>e.editingCell.value?Y.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(s,g)=>{if(s&&!g){const M=e.editValue.value||e.getCellRaw(s.col,s.row)||"";Y.value=M,ve=!1}else!s&&g&&(Y.value="",X.value=!1,ve=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(Y.value="",ve=!1)});function De(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),d())}function Je(s){const g=s.target.value;e.editingCell.value?e.editValue.value=g:e.startEdit(g),Y.value=g,ve=!0}function Le(s){var M,_;const g={...e.activeCell.value};e.editingCell.value?(e.editValue.value=s,e.commitEdit()):((M=e.saveUndo)==null||M.call(e),e.setCellValue(g.col,g.row,s)),Y.value="",ve=!1,d(),(_=l.emitModelData)==null||_.call(l)}let Ce=!1,ve=!1;function Ke(){var z,te,j,re,Me,It,dt,Bt,ut;if(Ce)return;const s=l.formulaBarRef.value,g=!!(s&&typeof document<"u"&&document.activeElement===s);if(!e.editingCell.value&&!g&&!ve)return;const M={...e.activeCell.value},_=e.editingCell.value?e.editingCell.value.col:M.col,D=e.editingCell.value?e.editingCell.value.row:M.row;if(!e.editingCell.value){const Rt=e.getCellRaw(_,D),Zt=Y.value!==Rt;if(!ve)return;Ce=!0,Zt&&((z=e.saveUndo)==null||z.call(e),e.setCellValue(_,D,Y.value),d(),(te=l.emitModelData)==null||te.call(l)),(j=l.formulaBarRef.value)==null||j.blur(),Y.value="",X.value=!1,ve=!1,t.nextTick(()=>{Ce=!1});return}Ce=!0,ve?(e.editValue.value=Y.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(re=l.formulaBarRef.value)==null||re.blur(),Y.value="",X.value=!1,ve=!1,d(),l.focusEditInput(),(Me=l.emitModelData)==null||Me.call(l),t.nextTick(()=>{Ce=!1})):g?(Y.value=e.editValue.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(It=l.formulaBarRef.value)==null||It.blur(),Y.value="",X.value=!1,ve=!1,d(),l.focusEditInput(),(dt=l.emitModelData)==null||dt.call(l),t.nextTick(()=>{Ce=!1})):(e.commitEdit(),(Bt=l.formulaBarRef.value)==null||Bt.blur(),Y.value="",X.value=!1,ve=!1,d(),l.focusEditInput(),(ut=l.emitModelData)==null||ut.call(l),t.nextTick(()=>{Ce=!1}))}function Ae(){var s;Ce||(Ce=!0,e.editingCell.value&&e.cancelEdit(),(s=l.formulaBarRef.value)==null||s.blur(),Y.value="",X.value=!1,ve=!1,d(),l.focusEditInput(),t.nextTick(()=>{Ce=!1}))}function Be(s){if(!s.isComposing){if(s.key==="Enter"&&(s.altKey||s.metaKey)&&!s.ctrlKey){s.preventDefault(),s.stopPropagation();const g=s.target;if(!g)return;e.editingCell.value||e.startEdit();const M=g.selectionStart??g.value.length,_=g.selectionEnd??g.value.length,D=g.value,z=D.substring(0,M)+`
7
+ `+D.substring(_),te=M+1;Y.value=z,X.value||(X.value=!0),t.nextTick(()=>{try{g.setSelectionRange(te,te)}catch{}if(X.value)try{g.scrollTop=g.scrollHeight}catch{}try{g.focus({preventScroll:!0})}catch{}});return}s.key==="Enter"?(s.preventDefault(),Ke()):s.key==="Escape"&&(s.preventDefault(),Ae())}}function Ne(){Ke()}const Ue=t.ref(null),Xe=t.ref("");function ie(s){Ue.value===null&&(l.switchSheet(s),d())}function ge(s){s!==l.activeSheetIndex.value&&(l.saveSheet(),l.loadSheet(s),d()),Ue.value=s,Xe.value=l.sheets.value[s].name,t.nextTick(()=>{const g=document.querySelector(".tab-rename-input");g==null||g.focus(),g==null||g.select()})}function f(){Ue.value!==null&&(l.renameSheet(Ue.value,Xe.value),t.nextTick(()=>l.emitModelData())),Ue.value=null,Xe.value=""}function N(){Ue.value=null,Xe.value=""}function A(s){s.key==="Enter"?(s.preventDefault(),f()):s.key==="Escape"&&(s.preventDefault(),N())}const Q=t.ref(null);let U=null;function ce(){U&&(document.removeEventListener("click",U),U=null)}function V(s,g,M){ce();const _=140,D=M.length*28+8,z=window.innerWidth,te=window.innerHeight;s+_>z&&(s-=_),g+D>te&&(g-=D),Q.value={x:s,y:g,items:M},U=()=>{Q.value=null,ce()},setTimeout(()=>document.addEventListener("click",U,{once:!0}),0)}const c=t.ref(!1);function b(s,g){if(g.disabled){c.value=!1;return}if(!g.children){c.value=!1;return}const _=s.currentTarget.querySelector(".context-submenu");if(!_){c.value=!1;return}const D=_.getBoundingClientRect();c.value=D.right>window.innerWidth}function ft(s,g){s.preventDefault(),s.stopPropagation(),V(s.clientX,s.clientY,[{label:I(e.locale.value,"insert"),action:()=>{l.addSheet(),d()}},{label:I(e.locale.value,"copy"),action:()=>{l.dupSheet(g)}},{label:I(e.locale.value,"rename"),action:()=>{ge(g)}},{label:I(e.locale.value,"delete"),action:()=>{l.removeSheet(g),d()},disabled:l.sheetCount.value<=1},{label:I(e.locale.value,"moveSheetLeft"),action:()=>{l.moveSheet(g,-1)},disabled:g===0},{label:I(e.locale.value,"moveSheetRight"),action:()=>{l.moveSheet(g,1)},disabled:g===l.sheets.value.length-1}])}function se(s){s.preventDefault(),!(s.target.closest(".tab-item")||s.target.closest(".tab-bar__add-btn"))&&V(s.clientX,s.clientY,[{label:I(e.locale.value,"insert"),action:()=>{l.addSheet(),d()}}])}function m(s){s.preventDefault(),e.selectAll(),d(),V(s.clientX,s.clientY,[{label:I(e.locale.value,"cut"),action:()=>{n.cutSelected(),l.emitModelData()}},{label:I(e.locale.value,"copy"),action:()=>n.copyToClipboard()},{label:I(e.locale.value,"paste"),action:()=>{o.saveUndo(),n.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>l.emitModelData())})}},{label:I(e.locale.value,"delete"),action:()=>{o.saveUndo(),n.clearSelected();for(let g=0;g<e.colCount;g++)e.colWidths.value[g]=100;for(let g=0;g<e.rowCount;g++)e.rowHeights.value[g]=void 0;d(),l.emitModelData()}}])}function H(s,g){s.preventDefault();const M=s.clientX,_=s.clientY,D=e.selection.value;D&&D.startCol===0&&D.endCol===e.colCount-1&&g>=D.startRow&&g<=D.endRow||(e.selectRange(0,g,e.colCount-1,g,"row"),d());const z=e.selection.value;V(s.clientX,s.clientY,[{label:I(e.locale.value,"insert"),action:()=>{o.saveUndo(),l.insertRows(z.startRow,z.endRow),d(),l.emitModelData()}},{label:I(e.locale.value,"cut"),action:()=>{o.saveUndo(),n.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,z.startRow,z.endRow),d(),l.emitModelData()}},{label:I(e.locale.value,"copy"),action:()=>n.copyRowCol()},{label:I(e.locale.value,"paste"),action:()=>{o.saveUndo(),n.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>l.emitModelData())})}},{label:I(e.locale.value,"delete"),action:()=>{o.saveUndo(),l.deleteRows(z.startRow,z.endRow),d(),l.emitModelData()}},{label:`${I(e.locale.value,"rowHeight")}...`,action:()=>ht("row",M,_)},{label:I(e.locale.value,"autoRowHeight"),action:()=>l.resetRowHeight()},{label:I(e.locale.value,"freezeToRow"),action:()=>{e.setFreeze(g+1,e.freeze.cols),d()}}])}function Qe(s,g){s.preventDefault();const M=s.clientX,_=s.clientY,D=e.selection.value;D&&D.startRow===0&&D.endRow===e.rowCount-1&&g>=D.startCol&&g<=D.endCol||(e.selectRange(g,0,g,e.rowCount-1,"col"),d());const z=e.selection.value,te=!l.canSortColumns(z.startCol,z.endCol);V(s.clientX,s.clientY,[{label:I(e.locale.value,"insert"),action:()=>{o.saveUndo(),l.insertCols(z.startCol,z.endCol),d(),l.emitModelData()}},{label:I(e.locale.value,"cut"),action:()=>{o.saveUndo(),n.copyRowCol(),e.clearCellsInRange(z.startCol,z.endCol,0,e.rowCount-1),d(),l.emitModelData()}},{label:I(e.locale.value,"copy"),action:()=>n.copyRowCol()},{label:I(e.locale.value,"paste"),action:()=>{o.saveUndo(),n.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>l.emitModelData())})}},{label:I(e.locale.value,"delete"),action:()=>{o.saveUndo(),l.deleteCols(z.startCol,z.endCol),d(),l.emitModelData()}},{label:I(e.locale.value,"sort"),disabled:te,children:[{label:I(e.locale.value,"sortAsc"),action:()=>{l.prepareSortConfirmation("asc")||l.sortSelectedColumns("asc")},disabled:te},{label:I(e.locale.value,"sortDesc"),action:()=>{l.prepareSortConfirmation("desc")||l.sortSelectedColumns("desc")},disabled:te}]},{label:`${I(e.locale.value,"colWidth")}...`,action:()=>ht("col",M,_)},{label:I(e.locale.value,"defaultColWidth"),action:()=>l.resetColWidth()},{label:I(e.locale.value,"freezeToCol"),action:()=>{e.setFreeze(e.freeze.rows,g+1),d()}}])}function wt(s,g,M){s.preventDefault(),e.isSelected(g,M)||(e.selectCell(g,M),d());const _=e.selection.value,D=!!(_&&_.startCol===_.endCol&&_.startRow===_.endRow);V(s.clientX,s.clientY,[{label:I(e.locale.value,"cut"),action:()=>{n.cutSelected(),l.emitModelData()}},{label:I(e.locale.value,"copy"),action:()=>n.copyToClipboard()},{label:I(e.locale.value,"paste"),action:()=>{o.saveUndo(),n.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>l.emitModelData())})}},{label:I(e.locale.value,"delete"),action:()=>{o.saveUndo(),n.clearSelected(),d(),l.emitModelData()}},{label:I(e.locale.value,"calculate"),children:[{label:I(e.locale.value,"sum"),action:n.sumSelected,disabled:D},{label:I(e.locale.value,"avg"),action:n.avgSelected,disabled:D},{label:I(e.locale.value,"count"),action:n.countSelected,disabled:D}]}])}const me=t.ref(null),ze=t.ref(null);let lt=null;function kt(){lt&&(document.removeEventListener("mousedown",lt),lt=null)}function ht(s,g,M){kt();const _=e.selection.value;let D="";if(_){const Me=s==="row"?e.getRowHeight(_.startRow):e.colWidths.value[_.startCol];D=Me!=null&&Me>0?String(Math.round(Me)):""}const z=220,te=118;let j=g,re=M;j+z>window.innerWidth&&(j=window.innerWidth-z-8),re+te>window.innerHeight&&(re=window.innerHeight-te-8),j<8&&(j=8),re<8&&(re=8),ze.value={type:s,x:j,y:re,value:D,error:""},lt=()=>{ze.value=null},setTimeout(()=>document.addEventListener("mousedown",lt,{once:!0}),0),t.nextTick(()=>{const Me=me.value;Me&&(Me.focus(),Me.select())})}function St(s){const g=ze.value;if(!g)return;const M=s.target,_=M.value,D=_.replace(/[^\d]/g,"");g.value=D,_!==D&&(M.value=D),g.error=""}function zt(s){s.key==="Enter"?(s.preventDefault(),Ut()):s.key==="Escape"&&(s.preventDefault(),dl())}function sl(){const s=ze.value;if(!s)return;const g=s.value.trim(),M=Number(g),_=s.type==="row",D=_?24:30,z=_?500:1e3;if(g===""||!Number.isFinite(M)){dl();return}const te=Math.max(D,Math.min(z,Math.round(M)));s.value=String(te),s.error=""}function Ut(){const s=ze.value,g=e.selection.value;if(!s||!g)return;const M=s.value.trim(),_=Number(M),D=s.type==="row",z=D?24:30,te=D?500:1e3;if(M===""||!Number.isFinite(_)){s.error=I(e.locale.value,"dimNumberError");return}if(_<z||_>te){s.error=I(e.locale.value,"dimRangeError").replace("{min}",String(z)).replace("{max}",String(te));return}const j=_;if(o.saveUndo(),D)for(let re=g.startRow;re<=g.endRow;re++)e.rowHeights.value[re]=j;else for(let re=g.startCol;re<=g.endCol;re++)e.colWidths.value[re]=j;d(),l.emitModelData(),dl()}function dl(){kt(),ze.value=null}const Gt=t.computed(()=>{const s=!e.editingCell.value,g=e.editingCell.value??e.activeCell.value,M=g.col,_=g.row,D=e.resolveStyle(e.cells[e.cellKey(M,_)]),z=e.cellFontSize(M,_),te=typeof(D==null?void 0:D.fontFamily)=="string"&&D.fontFamily?D.fontFamily:jl,j=(D==null?void 0:D.fontWeight)==="bold"?"bold":"normal",re=(D==null?void 0:D.fontStyle)==="italic"?"italic":"normal",Me=(D==null?void 0:D.underline)==="underline"?"underline":(D==null?void 0:D.strikethrough)==="line-through"?"line-through":"none",It=(D==null?void 0:D.underline)==="underline"&&(D==null?void 0:D.strikethrough)==="line-through"?"underline line-through":Me,dt=typeof(D==null?void 0:D.color)=="string"?D.color:void 0,Bt=typeof(D==null?void 0:D.backgroundColor)=="string"?D.backgroundColor:void 0,ut=typeof(D==null?void 0:D.numberFormat)=="string"?D.numberFormat:"",Rt=e.editValue.value??e.getCellValue(M,_),Zt=typeof(D==null?void 0:D.textAlign)=="string"?D.textAlign:To(Rt,ut)?"right":"left",qt=typeof(D==null?void 0:D.verticalAlign)=="string"?D.verticalAlign:"top",eo=e.findMerge(M,_),Dl=eo?e.rowPositions.value[eo.range.endRow+1]-e.rowPositions.value[_]:e.getRowHeight(_),Pl=2,{ascent:Kl,descent:Cl}=e.measureFontMetrics(te,z,j,re),Ul=Kl+Cl,pl=(e.editValue.value?e.editValue.value.split(`
8
+ `).length:1)*Ul,vl=e.BASE_CELL_VPAD-Pl;let Lt=0,tl=0;qt==="middle"?(Lt=Math.floor((Dl-pl)/2),tl=Math.max(0,Dl-pl-Lt)):qt==="top"?(Lt=vl,tl=Math.max(0,Dl-pl-Lt)):qt==="bottom"&&(tl=vl,Lt=Math.max(0,Dl-pl-tl));const _t=e.cellToScreenRect(_,M);return{left:`${_t.x}px`,top:`${_t.y}px`,width:`${_t.width}px`,height:`${_t.height}px`,fontFamily:te,fontSize:`${z}px`,lineHeight:1,fontWeight:j,fontStyle:re,textDecoration:It,textAlign:Zt,paddingTop:`${Lt}px`,paddingRight:"3px",paddingBottom:`${tl}px`,paddingLeft:"3px",opacity:s?0:1,pointerEvents:s?"none":"auto",color:s?"transparent":dt,caretColor:s?"transparent":void 0,borderColor:s?"transparent":void 0,background:s?"transparent":Bt,boxShadow:s?"none":void 0}});function rl(){return Math.max(0,l.viewSize.w-52-11)}function xl(){return Math.max(0,l.viewSize.h-24-11)}const Yt=t.computed(()=>Math.max(0,rl()-e.getFrozenMetrics().frozenColumnsWidth)),Qt=t.computed(()=>Math.max(0,xl()-e.getFrozenMetrics().frozenRowsHeight)),Bl=t.computed(()=>52+e.getFrozenMetrics().frozenColumnsWidth),bl=t.computed(()=>24+e.getFrozenMetrics().frozenRowsHeight),ul=t.computed(()=>Math.max(0,Yt.value-11*2)),Xt=t.computed(()=>Math.max(0,Qt.value-11*2)),fl=t.computed(()=>l.maxScrollX.value<=0?ul.value:Math.max(24,Yt.value/e.totalWidth.value*ul.value)),B=t.computed(()=>l.maxScrollX.value<=0?0:e.scrollX.value/l.maxScrollX.value*(ul.value-fl.value)),T=t.computed(()=>l.maxScrollY.value<=0?Xt.value:Math.max(24,Qt.value/e.totalHeight.value*Xt.value)),F=t.computed(()=>l.maxScrollY.value<=0?0:e.scrollY.value/l.maxScrollY.value*(Xt.value-T.value));let oe=null,de=0,ye=0;function we(s){s.preventDefault(),oe="v",de=s.clientY,ye=e.scrollY.value,document.addEventListener("mousemove",K),document.addEventListener("mouseup",Ie)}function fe(s){s.preventDefault(),oe="h",de=s.clientX,ye=e.scrollX.value,document.addEventListener("mousemove",K),document.addEventListener("mouseup",Ie)}function K(s){if(oe==="v"){const M=(s.clientY-de)/(Xt.value-T.value);l.clampScroll(null,ye+M*l.maxScrollY.value),d()}else if(oe==="h"){const M=(s.clientX-de)/(ul.value-fl.value);l.clampScroll(ye+M*l.maxScrollX.value,null),d()}}function Ie(){oe=null,document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",Ie)}function _e(s){if(oe)return;const g=s.currentTarget.getBoundingClientRect(),M=s.clientY-g.top;M<F.value?l.clampScroll(null,e.scrollY.value-xl()):M>F.value+T.value&&l.clampScroll(null,e.scrollY.value+xl()),d()}function ee(s){if(oe)return;const g=s.currentTarget.getBoundingClientRect(),M=s.clientX-g.left;M<B.value?l.clampScroll(e.scrollX.value-rl(),null):M>B.value+fl.value&&l.clampScroll(e.scrollX.value+rl(),null),d()}let He=!1,et=0,C=0,L=!1,G=!1,ue=0,he=0,ne=0,be=0,Ve=0,at=0,yt=0,Vt=0,xt=!1,el=!1,Ht=0,Ot=0,Ge="cell",E=0,x=-1,O=-1,W=null,q=null,Ee=0,Te=0;function We(s,g){const M=e.selection.value;if(!M||e.editingCell.value||!_o(M,M,e.merges))return!1;const _=e.cellToScreenRect(M.endRow,M.endCol),D=_.x+_.width-6,z=_.y+_.height-6,te=4;return s>=D-te&&s<=D+6+te&&g>=z-te&&g<=z+6+te}function Ze(){W=requestAnimationFrame(Pe)}function Pe(){if(!e.autoFillState.value.active||!q){W=null;return}const s=8;l.clampScroll(e.scrollX.value+q.x*s*.1,e.scrollY.value+q.y*s*.1);const g=e.screenToCell(Ee,Te),M=e.autoFillState.value.sourceRange;if(g&&M){const _=kn(M,{col:g.col,row:g.row});_?e.autoFillState.value={...e.autoFillState.value,targetRange:_.targetRange,direction:_.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}d(),W=requestAnimationFrame(Pe)}function Ye(){W!==null&&(cancelAnimationFrame(W),W=null),q=null}function Tt(s,g){Ee=s,Te=g;const M=e.screenToCell(s,g),_=e.autoFillState.value.sourceRange;if(M&&_){const Me=kn(_,{col:M.col,row:M.row});Me?e.autoFillState.value={...e.autoFillState.value,targetRange:Me.targetRange,direction:Me.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}const D=30,z=l.viewSize.w,te=l.viewSize.h;let j=0,re=0;s<52+D?j=-(52+D-s):s>z-11-D&&(j=s-(z-11-D)),g<24+D?re=-(24+D-g):g>te-11-D&&(re=g-(te-11-D)),j!==0||re!==0?(q={x:j,y:re},W===null&&Ze()):(q=null,W!==null&&(cancelAnimationFrame(W),W=null)),d()}function it(){Ye();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 Nt(s){if(s.button!==0)return;s.preventDefault(),Q.value=null;const g=Ll(s,l.canvasRef.value);if(g.y<24&&g.x>=52){const z=g.x-52+e.scrollX.value,te=v(g.x),j=te>=0?e.cellToScreenRect(0,te).x+e.colWidths.value[te]:-1;if(te>=0&&Math.abs(g.x-j)<=4){o.saveUndo(),L=!0,ue=te,ne=e.colWidths.value[te],be=z,d();return}}if(g.x<52&&g.y>=24){const z=g.y-24+e.scrollY.value,te=w(g.y),j=te>=0?e.cellToScreenRect(te,0).y+e.getRowHeight(te):-1;if(te>=0&&Math.abs(g.y-j)<=4){o.saveUndo(),G=!0,he=te,ne=e.getRowHeight(te),be=z,d();return}}if(We(g.x,g.y)){const z=e.selection.value;z&&(e.autoFillState.value={active:!0,sourceRange:{...z},targetRange:null,direction:null,preview:!0},d());return}if(g.x<52||g.y<24){{const z=l.formulaBarRef.value,te=!!(z&&typeof document<"u"&&document.activeElement===z);(e.editingCell.value||te||ve)&&Ke()}if(g.y<24&&g.x>=52){const z=v(g.x);z>=0&&(e.selectRange(z,0,z,e.rowCount-1,"col"),He=!0,et=z,C=0)}else if(g.x<52&&g.y>=24){const z=w(g.y);z>=0&&(e.selectRange(0,z,e.colCount-1,z,"row"),He=!0,et=0,C=z)}else g.x<52&&g.y<24&&e.selectAll();d();return}const M=e.screenToCell(g.x,g.y);if(!M)return;const _=M.col,D=M.row;{const z=l.formulaBarRef.value,te=!!(z&&typeof document<"u"&&document.activeElement===z);(e.editingCell.value||te||ve)&&Ke()}if(s.shiftKey&&e.selection.value){const z=e.selection.value;e.selectRange(z.startCol,z.startRow,_,D)}else e.selectCell(_,D);He=!0,et=_,C=D,l.focusEditInput(),d()}function jt(s){if(L){const te=Ll(s,l.canvasRef.value).x-52+e.scrollX.value-be,j=ne+te;j>=30&&j<=1e3?e.colWidths.value[ue]=j:j<30?e.colWidths.value[ue]=30:e.colWidths.value[ue]=1e3,d();return}if(G){const te=Ll(s,l.canvasRef.value).y-24+e.scrollY.value-be,j=ne+te;j>=24&&j<=500?e.rowHeights.value[he]=j:j<24?e.rowHeights.value[he]=24:e.rowHeights.value[he]=500,d();return}if(e.autoFillState.value.active){const z=Ll(s,l.canvasRef.value);Tt(z.x,z.y);return}if(!He){const z=l.canvasRef.value;if(!z)return;if(o.paintFmt.value){z.style.cursor="copy";return}const te=Ll(s,z);if(te.y<24&&te.x>=52){const j=v(te.x),re=j>=0?e.cellToScreenRect(0,j).x+e.colWidths.value[j]:-1;if(j>=0&&Math.abs(te.x-re)<=4){z.style.cursor="col-resize";return}}if(te.x<52&&te.y>=24){const j=w(te.y),re=j>=0?e.cellToScreenRect(j,0).y+e.getRowHeight(j):-1;if(j>=0&&Math.abs(te.y-re)<=4){z.style.cursor="row-resize";return}}if(We(te.x,te.y)){z.style.cursor="crosshair";return}z.style.cursor="cell";return}const g=Ll(s,l.canvasRef.value);if(et<0||C<0)return;if(g.x<52||g.y<24){if(g.y<24&&g.x>=52){const z=v(g.x);z>=0&&e.selectRange(Math.min(et,z),0,Math.max(et,z),e.rowCount-1,"col")}else if(g.x<52&&g.y>=24){const z=w(g.y);z>=0&&e.selectRange(0,Math.min(C,z),e.colCount-1,Math.max(C,z),"row")}d();return}const M=e.screenToCell(g.x,g.y);if(!M)return;const _=M.col,D=M.row;C===0&&et>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(et,_),0,Math.max(et,_),e.rowCount-1,"col"):et===0&&C>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(C,D),e.colCount-1,Math.max(C,D),"row"):e.selectRange(et,C,_,D),d()}function Jl(s){const g=L||G;if(He=!1,L=!1,G=!1,g&&l.scheduleOptEmit(),e.autoFillState.value.active){it();return}o.paintFmt.value&&o.applyPaintFormat()}function ml(){Ye();const s=L||G;He=!1,L=!1,G=!1,s&&l.scheduleOptEmit()}function io(s){s.preventDefault();const g=Ll(s,l.canvasRef.value);if(g.x<52&&g.y<24){m(s);return}if(g.y<24&&g.x>=52){const M=v(g.x);M>=0&&Qe(s,M);return}if(g.x<52&&g.y>=24){const M=w(g.y);M>=0&&H(s,M);return}if(g.x>=52&&g.y>=24){const M=e.screenToCell(g.x,g.y);M&&wt(s,M.col,M.row)}}function co(s){const g=Ll(s,l.canvasRef.value);if(g.x<52||g.y<24)return;const M=e.screenToCell(g.x,g.y);if(!M)return;const _=M.col,D=M.row;{const z=l.formulaBarRef.value,te=!!(z&&typeof document<"u"&&document.activeElement===z);(e.editingCell.value||te||ve)&&Ke()}e.selectCell(_,D),e.ensureVisible(_,D),e.startEdit(),d(),l.focusEditInput()}function $l(s){const g=e.scrollX.value+s.deltaX,M=e.scrollY.value+s.deltaY,_=40,D=l.maxScrollX.value,z=l.maxScrollY.value;if(g>=D-_&&s.deltaX>0||M>=z-_&&s.deltaY>0){const te=Math.max(0,l.viewSize.w-28-11),j=Math.max(0,l.viewSize.h-28-11),re=Math.max(0,Math.ceil((g+te)/100)+2),Me=Math.max(0,Math.ceil((M+j)/24)+2);e.ensureCapacity(re,Me)}l.clampScroll(g,M),d()}function Wo(s){if(s.touches.length!==1){xt=!1;return}const g=s.touches[0],M=l.canvasRef.value;if(!M)return;const _=M.getBoundingClientRect(),D=g.clientX-_.left,z=g.clientY-_.top;if(We(D,z)){s.preventDefault();const te=e.selection.value;te&&(e.autoFillState.value={active:!0,sourceRange:{...te},targetRange:null,direction:null,preview:!0},xt=!0,el=!1,Ge="cell",Ve=D,at=z,yt=e.scrollX.value,Vt=e.scrollY.value);return}D>=52&&z>=24?(s.preventDefault(),xt=!0,el=!1,Ge="cell",Ve=D,at=z,yt=e.scrollX.value,Vt=e.scrollY.value,Ht=v(D),Ot=w(z)):D>=0&&z>=0&&(D<52||z<24)&&(s.preventDefault(),xt=!0,el=!1,Ve=D,at=z,yt=e.scrollX.value,Vt=e.scrollY.value,z<24&&D>=52?(Ge="col",Ht=v(D),Ot=-1):D<52&&z>=24?(Ge="row",Ot=w(z),Ht=-1):(Ge="all",Ht=-1,Ot=-1))}function Wl(s){if(!xt||s.touches.length!==1)return;const g=s.touches[0],M=l.canvasRef.value;if(!M)return;const _=M.getBoundingClientRect(),D=g.clientX-_.left,z=g.clientY-_.top;if(e.autoFillState.value.active){s.preventDefault(),Tt(D,z);return}(Math.abs(D-Ve)>8||Math.abs(z-at)>8)&&(el=!0,s.preventDefault(),l.clampScroll(yt+(Ve-D),Vt+(at-z)),d())}function so(){if(xt){if(e.autoFillState.value.active){it(),xt=!1;return}if(xt=!1,!el)if(Ge==="cell"&&Ht>=0&&Ot>=0){const s=Date.now();Ht===x&&Ot===O&&s-E<300?(e.selectCell(Ht,Ot),e.startEdit(),d(),l.focusEditInput(),E=0):(e.commitEdit(),e.selectCell(Ht,Ot),d(),E=s),x=Ht,O=Ot,l.focusEditInput()}else Ge==="col"&&Ht>=0?(e.commitEdit(),e.selectRange(Ht,0,Ht,e.rowCount-1,"col"),d()):Ge==="row"&&Ot>=0?(e.commitEdit(),e.selectRange(0,Ot,e.colCount-1,Ot,"row"),d()):Ge==="all"&&(e.commitEdit(),e.selectAll(),d())}}function Ql(s){return s.isComposing||s.key==="Process"||s.keyCode===229}function Po(s){return s.key.length===1&&!s.ctrlKey&&!s.metaKey&&!s.altKey}function Fn(s){if(e.autoFillState.value.active){s.key==="Escape"&&(s.preventDefault(),Ye(),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1},d());return}if(e.editingCell.value)return;const g=s.ctrlKey||s.metaKey,M=s.shiftKey;switch(!0){case(g&&(s.key==="c"||s.key==="C")):s.preventDefault(),n.copyToClipboard();return;case(g&&(s.key==="x"||s.key==="X")):s.preventDefault(),n.cutSelected();return;case(g&&(s.key==="z"||s.key==="Z")):s.preventDefault(),o.undo();return;case(g&&(s.key==="y"||s.key==="Y")):s.preventDefault(),o.redo();return;case(g&&(s.key==="v"||s.key==="V")):s.preventDefault(),o.saveUndo(),n.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>l.emitModelData())});return;case(g&&(s.key==="a"||s.key==="A")):s.preventDefault(),e.selectAll(),d();return;case(g&&s.key==="Home"):s.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),d();return;case(g&&s.key==="End"):s.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),d();return;case s.key==="Home":s.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),d();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),d();return;case s.key==="ArrowUp":s.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="ArrowDown":s.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="ArrowLeft":s.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="ArrowRight":s.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="Tab":s.preventDefault(),e.moveActive(M?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="Enter":s.preventDefault(),e.moveActive(0,M?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="F2":s.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),d(),l.focusEditInput();return;case s.key==="Delete":case s.key==="Backspace":s.preventDefault(),o.saveUndo(),n.clearSelected(),d();return;case s.key==="Escape":s.preventDefault(),e.cancelEdit(),o.paintFmt.value=null,d();return;case Po(s):if(Ql(s)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),d(),l.focusEditInput();return}s.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(s.key),d(),t.nextTick(()=>{const _=l.editInputRef.value;_&&(_.focus(),_.setSelectionRange(1,1))});return}}let Ko=!1,Uo=!1;function Rs(s){const g=s.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(g),Y.value=g,d();return}e.editValue.value=g,Y.value=g}function Ms(){Ko=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),Y.value="",d())}function xs(s){Ko=!1,Uo=!0,setTimeout(()=>{Uo=!1},0);const g=s.target.value;e.editValue.value=g,Y.value=g}function Bs(s){if(!e.editingCell.value){if(Po(s)||Ql(s))return;Fn(s);return}if(!(Ko||Ql(s))&&!(Uo&&(s.key==="Enter"||s.key==="Escape")))if(s.key==="Enter"&&(s.altKey||s.metaKey)){s.preventDefault();const g=l.editInputRef.value;if(!g)return;const M=g.selectionStart??g.value.length,_=g.selectionEnd??g.value.length,D=g.value,z=D.slice(0,M)+`
9
+ `+D.slice(_);e.editValue.value=z,g.value=z,g.selectionStart=g.selectionEnd=M+1,d()}else s.key==="Enter"?(s.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d(),l.focusEditInput()):s.key==="Tab"?(s.preventDefault(),e.commitEdit(),e.moveActive(s.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d(),l.focusEditInput()):s.key==="Escape"&&(s.preventDefault(),e.cancelEdit(),d(),l.focusEditInput())}function Ds(s){e.editingCell.value}function Ts(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),d())},0)}let al=null;function go(){var g;const s=(g=l.wrapperRef.value)==null?void 0:g.getBoundingClientRect();if(s){const M=Zl(e.props.width),_=Zl(e.props.height);M!=null?l.viewSize.w=M:l.viewSize.w=s.width,_!=null?l.viewSize.h=_:l.viewSize.h=s.height}l.clampScroll(null,null),d()}function Ns(){t.onMounted(()=>{const s=Zl(e.props.width),g=Zl(e.props.height);(s==null||g==null)&&(al=new ResizeObserver(()=>go()),l.wrapperRef.value&&al.observe(l.wrapperRef.value)),t.nextTick(()=>{go(),l.focusEditInput()}),e.selectCell(0,0),l.modelData.value&&l.modelData.value.length>0&&(a.value=JSON.stringify(l.modelData.value),l.sheets.value=l.modelData.value.map(M=>{const _=l.mkSheet(M.name,{colCount:M.colCount,rowCount:M.rowCount}),{cells:D,styles:z}=Mn(M.cells);if(Object.assign(_.cells,D),_.styles=M.styles??z,M.borders)_.borders=M.borders;else{const te=xn(_.styles);_.styles=te.styles,_.borders=te.borders}if(M.colWidths)for(const[te,j]of Object.entries(M.colWidths)){const re=Number(te);re>=0&&re<(_.colCount??e.colCount)&&j>=30&&(_.colWidths[re]=j)}if(M.rowHeights)for(const[te,j]of Object.entries(M.rowHeights)){const re=Number(te);re>=0&&re<(_.rowCount??e.rowCount)&&j>=24&&(_.rowHeights[re]=j)}if(M.merges)for(const[te,j]of Object.entries(M.merges))_.merges[te]={...j};return _.freeze=M.freeze?{rows:M.freeze.rows,cols:M.freeze.cols}:{rows:0,cols:0},_}),l.sheets.value.length>0&&l.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const s=Zl(e.props.width),g=Zl(e.props.height);s!=null&&g!=null?(al==null||al.disconnect(),al=null):!al&&l.wrapperRef.value&&(al=new ResizeObserver(()=>go()),al.observe(l.wrapperRef.value)),t.nextTick(()=>go())}),t.watch(()=>e.props.theme,()=>d()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>l.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>l.emitModelData()),d()},{deep:!1}),t.watch(l.activeSheetIndex,()=>t.nextTick(()=>l.emitModelData())),t.watch(()=>l.modelData.value,s=>{if(!s||s.length===0)return;const g=JSON.stringify(s);if(g===a.value)return;a.value=g;const M=e.selection.value?{...e.selection.value}:null,_={...e.activeCell.value};l.sheets.value=s.map(j=>{const re=l.mkSheet(j.name),{cells:Me,styles:It}=Mn(j.cells);if(Object.assign(re.cells,Me),re.styles=j.styles??It,j.borders)re.borders=j.borders;else{const dt=xn(re.styles);re.styles=dt.styles,re.borders=dt.borders}if(j.colWidths)for(const[dt,Bt]of Object.entries(j.colWidths)){const ut=Number(dt);ut>=0&&ut<e.colCount&&Bt>=30&&(re.colWidths[ut]=Bt)}if(j.rowHeights)for(const[dt,Bt]of Object.entries(j.rowHeights)){const ut=Number(dt);ut>=0&&ut<e.rowCount&&Bt>=24&&(re.rowHeights[ut]=Bt)}if(j.merges)for(const[dt,Bt]of Object.entries(j.merges))re.merges[dt]={...Bt};return re.freeze=j.freeze?{rows:j.freeze.rows,cols:j.freeze.cols}:{rows:0,cols:0},re}),l.sheets.value.length>0&&l.loadSheet(0),M&&(e.selection.value=M),e.activeCell.value=_;const D=e.activeCell.value,z=e.selection.value,te=e.findMerge(D.col,D.row);te&&te.anchor===e.cellKey(D.col,D.row)&&(!z||z.startCol===D.col&&z.startRow===D.row&&z.endCol===D.col&&z.endRow===D.row)&&e.selectCell(D.col,D.row),d()},{deep:!0}),t.onBeforeUnmount(()=>{al==null||al.disconnect()})}return{scheduleRender:d,render:Z,renderFrozenOverlay:J,activeCellLabel:y,formulaBarDisplay:ae,formulaBarDraft:Y,formulaBarExpanded:X,onFormulaBarFocus:De,onFormulaBarInput:Je,onFormulaBarKeydown:Be,onFormulaBarBlur:Ne,acceptFormulaBarEdit:Ke,cancelFormulaBarEdit:Ae,insertFunctionIntoCell:Le,renTab:Ue,renTabVal:Xe,onTabClick:ie,onTabDblClick:ge,commitTabRename:f,cclTabRename:N,onTabRenameKd:A,ctxMenu:Q,ctxSubmenuLeft:c,onCtxItemEnter:b,onTabCtxMenu:ft,onTabBarCtx:se,onCornerCtx:m,onRowHdrCtx:H,onColHdrCtx:Qe,onCellCtx:wt,dimInputRef:me,dimPanel:ze,openDimPanel:ht,onDimInput:St,onDimKeydown:zt,onDimBlur:sl,applyDimPanel:Ut,closeDimPanel:dl,editInputStyle:Gt,hScrollbarW:Yt,vScrollbarH:Qt,hScrollbarLeft:Bl,vScrollbarTop:bl,hTrackW:ul,vTrackH:Xt,hThumbW:fl,hThumbL:B,vThumbH:T,vThumbT:F,onVStart:we,onHStart:fe,onSbMove:K,onSbUp:Ie,onVTrk:_e,onHTrk:ee,onMouseDown:Nt,onMouseMove:jt,onMouseUp:Jl,onMouseLeave:ml,onCanvasCtx:io,onDblClick:co,onWheel:$l,onTouchStart:Wo,onTouchMove:Wl,onTouchEnd:so,onKeydown:Fn,onEditInput:Rs,onEditCompositionStart:Ms,onEditCompositionEnd:xs,onEditKd:Bs,onEditPaste:Ds,onEditBlur:Ts,applySize:go,setupLifecycle:Ns}}function os(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nn(e,o,n,l){return o?l?n?e===o:e.toLowerCase()===o.toLowerCase():n?e.includes(o):e.toLowerCase().includes(o.toLowerCase()):!1}function ns(e,o,n,l){if(!o)return e;if(l){const i=e.indexOf(o);return i<0?e:e.slice(0,i)+n+e.slice(i+o.length)}const a=e.toLowerCase().indexOf(o.toLowerCase());return a<0?e:e.slice(0,a)+n+e.slice(a+o.length)}function rs(e,o,n,l){return o?l?e.indexOf(o)<0?e:e.split(o).join(n):e.toLowerCase().indexOf(o.toLowerCase())<0?e:e.replace(new RegExp(os(o),"gi"),()=>n):e}function $o(e,o,n,l,a,i,r){const u=[];if(r){for(let p=r.startRow;p<=r.endRow;p++)for(let h=r.startCol;h<=r.endCol;h++){const S=e[n(h,p)];S&&Nn(S.value,l,a,i)&&u.push({sheetIndex:o,col:h,row:p})}return u}for(const p in e){const h=e[p];if(h&&Nn(h.value,l,a,i)){const S=p.split(","),d=Number(S[0]),v=Number(S[1]);!Number.isNaN(d)&&!Number.isNaN(v)&&u.push({sheetIndex:o,col:d,row:v})}}return u}function as(e,o,n,l){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),u=t.ref("sheet"),p=t.ref(!1),h=t.ref(!1),S=t.ref(-1),d=t.ref([]),v=t.ref(""),w=t.ref(0),k=t.ref(""),Z=t.computed(()=>{const ie=new Set,ge=n.activeSheetIndex.value;for(const f of d.value)f.sheetIndex===ge&&ie.add(`${f.col},${f.row}`);return ie}),J=t.computed(()=>{if(S.value<0||S.value>=d.value.length)return null;const ie=d.value[S.value];return ie.sheetIndex!==n.activeSheetIndex.value?null:`${ie.col},${ie.row}`});e.findHighlight=(ie,ge)=>{const f=`${ie},${ge}`;return J.value===f?"active":Z.value.has(f)?"match":null};function P(ie){var N,A;const ge=e.cellKey(ie.col,ie.row);if(ie.sheetIndex===n.activeSheetIndex.value)return((N=e.cells[ge])==null?void 0:N.value)??"";const f=n.sheets.value[ie.sheetIndex];return((A=f==null?void 0:f.cells[ge])==null?void 0:A.value)??""}function $(ie,ge){const f=e.cellKey(ie.col,ie.row);if(ie.sheetIndex===n.activeSheetIndex.value)e.setCellValue(ie.col,ie.row,ge);else{const N=n.sheets.value[ie.sheetIndex];if(!N)return;const A=N.cells[f];N.cells[f]={value:String(ge),styleId:A==null?void 0:A.styleId}}}function y(){if(k.value){v.value=k.value;return}if(!i.value){v.value="";return}if(u.value==="selection"&&!e.selection.value){v.value=I(e.locale.value,"findNeedSelection");return}if(d.value.length===0){v.value=I(e.locale.value,"findNoResult");return}v.value=""}function Y(){const ie=i.value,ge=[];if(ie)if(u.value==="workbook")n.sheets.value.forEach((f,N)=>{ge.push(...$o(f.cells,N,e.cellKey,ie,p.value,h.value))});else if(u.value==="selection"){const f=e.selection.value;f&&ge.push(...$o(e.cells,n.activeSheetIndex.value,e.cellKey,ie,p.value,h.value,f))}else ge.push(...$o(e.cells,n.activeSheetIndex.value,e.cellKey,ie,p.value,h.value));d.value=ge,ge.length===0?S.value=-1:S.value>=ge.length?S.value=ge.length-1:S.value<0&&(S.value=0),y()}function X(){if(S.value<0||S.value>=d.value.length)return;const ie=d.value[S.value];ie.sheetIndex!==n.activeSheetIndex.value&&n.switchSheet(ie.sheetIndex),u.value==="selection"?e.activeCell.value={col:ie.col,row:ie.row}:e.selectCell(ie.col,ie.row),e.ensureVisible(ie.col,ie.row)}const ae=typeof requestAnimationFrame=="function"?requestAnimationFrame:ie=>setTimeout(ie,16);let De=!1,Je=!1;function Le(ie){if(De){Je=Je||ie;return}De=!0,Je=ie,ae(()=>{var ge;De=!1,Y(),Je&&d.value.length>0&&S.value>=0&&X(),Je=!1,(ge=e.scheduleRender)==null||ge.call(e)})}function Ce(){var ie;a.value=!0,w.value++,Y(),d.value.length>0&&(S.value=0,X()),(ie=e.scheduleRender)==null||ie.call(e)}function ve(){Ce()}function Ke(){var ie;a.value=!1,d.value=[],S.value=-1,k.value="",v.value="",(ie=e.scheduleRender)==null||ie.call(e)}function Ae(){var ie;d.value.length!==0&&(S.value=(S.value+1)%d.value.length,X(),(ie=e.scheduleRender)==null||ie.call(e))}function Be(){var ie;d.value.length!==0&&(S.value=(S.value-1+d.value.length)%d.value.length,X(),(ie=e.scheduleRender)==null||ie.call(e))}function Ne(){var A,Q;if(S.value<0||S.value>=d.value.length)return;const ie=d.value[S.value],ge=P(ie),f=ns(ge,i.value,r.value,p.value);if(f===ge)return;o.saveUndo(),$(ie,f);const N=S.value;Y(),d.value.length>0?(S.value=Math.min(N,d.value.length-1),Ae()):S.value=-1,(A=e.emitModelData)==null||A.call(e),(Q=e.scheduleRender)==null||Q.call(e)}function Ue(){var N,A;const ie=i.value;if(!ie||d.value.length===0)return;o.saveUndo();let ge=0;const f=d.value.slice();for(const Q of f){const U=P(Q),ce=rs(U,ie,r.value,p.value);ce!==U&&($(Q,ce),ge++)}d.value=[],S.value=-1,k.value=I(e.locale.value,"findReplacedAll").replace("{n}",String(ge)),y(),(N=e.emitModelData)==null||N.call(e),(A=e.scheduleRender)==null||A.call(e)}function Xe(){const ie=ge=>{if(!(ge.ctrlKey||ge.metaKey))return;const N=ge.key.toLowerCase();(N==="f"||N==="h")&&(ge.preventDefault(),Ce())};window.addEventListener("keydown",ie),t.onBeforeUnmount(()=>window.removeEventListener("keydown",ie))}return t.watch(i,()=>{a.value&&(k.value="",S.value=0,Le(!0))}),t.watch([u,p,h],()=>{a.value&&(k.value="",S.value=0,Le(!0))}),t.watch(e.cells,()=>{a.value&&Le(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&u.value==="selection"&&(S.value=0,Le(!0))}),t.watch([()=>o.undoStack.value.length,()=>o.redoStack.value.length],()=>{a.value&&Le(!1)}),{open:a,findText:i,replaceText:r,scope:u,matchCase:p,matchEntireCell:h,currentIndex:S,results:d,message:v,focusToken:w,activeSheetMatches:Z,activeMatchKey:J,openFind:Ce,openReplace:ve,close:Ke,recompute:Y,findNext:Ae,findPrev:Be,replace:Ne,replaceAll:Ue,setupLifecycle:Xe}}const is={class:"formula-bar__cell-label"},cs={class:"formula-bar__buttons"},ss=["title","aria-label"],ds=["rows","value"],us=["title"],fs={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},ms={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},ps=["value"],hs={key:2,class:"sb-corner"},gs=["onClick","onMouseenter"],ys={class:"context-menu__label"},bs={key:0,class:"context-menu__arrow",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"22869"},Cs=["onClick"],vs={class:"dim-panel__title"},ws={class:"dim-panel__body"},ks=["value"],Es={key:0,class:"dim-panel__error"},Ss={class:"dim-panel__footer"},In=Jt(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,n=t.useModel(e,"data"),l={value:""},a=Yc(o,{rowCount:o.rowCount,colCount:o.colCount,theme:o.theme,locale:o.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:V=>{},mkSheet:V=>({id:"",name:V,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}})},r=Xc(a,i),u=Zc(a,r);jc(r,{borderMenuOpen:u.borderMenuOpen,mergeMenuOpen:u.mergeMenuOpen});const p=ts(a,r,n,void 0,l);i.sheets=p.sheets,i.activeSheetIndex=p.activeSheetIndex,i.saveSheet=p.saveSheet,i.loadSheet=p.loadSheet,i.mkSheet=p.mkSheet;const h=ls(a,r,u,p,l);h.setupLifecycle();const S=as(a,r,p);S.setupLifecycle();const d=t.reactive(a),v=t.reactive(r),w=t.reactive(u),k=t.reactive(p),Z=p.sheets,J=p.activeSheetIndex,P=p.sortMenuOpen,$=p.cachedSortOrder,y=t.reactive(h),Y=t.reactive(S),X=t.computed(()=>{const V=d.selection;return!!V&&V.startCol===V.endCol&&V.startRow===V.endRow}),ae=t.computed(()=>{const V=d.selection;return V?p.canSortColumns(V.startCol,V.endCol):!1}),De=t.computed(()=>{const V=v.selNumberFormat;if(V!==gl&&V!==Sl)return V;const c=d.activeCell,b=a.resolveStyle(d.cells[d.cellKey(c.col,c.row)]);return typeof(b==null?void 0:b.numberFormat)=="string"?b.numberFormat:""});function Je(V){r.nfDialogOpen.value=V}const Le=t.ref(!1);function Ce(){Le.value=!0}function ve(V){Le.value=V}function Ke(V){h.insertFunctionIntoCell(V)}function Ae(V){const c=d.freeze;if(V==="panes"){const b=d.selection,ft=b?b.startRow:d.activeCell.row,se=b?b.startCol:d.activeCell.col;d.setFreeze(ft,se)}else V==="firstRow"?d.setFreeze(1,c.cols):V==="firstCol"?d.setFreeze(c.rows,1):V==="unfreeze"&&d.clearFreeze();y.scheduleRender()}function Be(V){r.fontSizeMenuOpen.value=V}function Ne(V){r.textColorMenuOpen.value=V}function Ue(V){r.fillColorMenuOpen.value=V}function Xe(V){h.renTabVal.value=V}function ie(){h.ctxMenu.value=null}const ge=V=>{p.formulaBarRef.value=V};function f(){h.formulaBarExpanded.value=!h.formulaBarExpanded.value}const N=V=>{p.wrapperRef.value=V},A=V=>{p.canvasRef.value=V},Q=V=>{p.freezeCanvasRef.value=V},U=V=>{p.editInputRef.value=V},ce=V=>{h.dimInputRef.value=V};return(V,c)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(k.outerStyle)},[t.createVNode(ui,{locale:d.locale,"can-undo":v.canUndo,"can-redo":v.canRedo,"paint-fmt-active":v.paintFmt!==null,"has-selection":v.hasSelection,"font-family-options":v.fontFamilyOptions,"font-size-options":v.fontSizeOptions,"sel-font-family":v.selFontFamily,"sel-font-size":v.selFontSize,"font-size-input":v.fontSizeInput,"font-size-menu-open":v.fontSizeMenuOpen,"sel-font-weight":v.selFontWeight,"sel-font-style":v.selFontStyle,"sel-underline":v.selUnderline,"sel-strikethrough":v.selStrikethrough,"sel-text-color":v.selTextColor,"text-color-menu-open":v.textColorMenuOpen,"sel-fill-color":v.selFillColor,"fill-color-menu-open":v.fillColorMenuOpen,"cached-text-color":v.cachedTextColor,"cached-fill-color":v.cachedFillColor,"border-menu-open":w.borderMenuOpen,"cached-border":w.cachedBorder,"sort-menu-open":t.unref(P),"cached-sort-order":t.unref($),"can-sort":ae.value,"h-align-options":v.hAlignOptions,"v-align-options":v.vAlignOptions,"sel-h-align":v.selHAlign,"sel-v-align":v.selVAlign,"sel-wrap":v.selWrap,"merge-menu-open":w.mergeMenuOpen,"calc-menu-open":w.calcMenuOpen,"is-single-cell":X.value,"has-freeze":d.freeze.rows>0||d.freeze.cols>0,"sel-number-format":v.selNumberFormatDisplay,"nf-options":v.nfOptions,"can-increase-decimals":v.canIncreaseDecimals,"can-decrease-decimals":v.canDecreaseDecimals,"theme-vars":k.toolbarThemeVars,onUndo:c[0]||(c[0]=b=>v.undo()),onRedo:c[1]||(c[1]=b=>v.redo()),onPaintFormat:v.onPaintFormat,onClearFormat:c[2]||(c[2]=b=>v.clearFormat()),onNumberFormatChange:c[3]||(c[3]=b=>v.onNumberFormatChange(b)),onIncreaseDecimals:v.onIncreaseDecimals,onDecreaseDecimals:v.onDecreaseDecimals,onFontFamilyChange:c[4]||(c[4]=b=>v.onFontFamilyChange(b)),onFontSizeInput:c[5]||(c[5]=b=>v.onFontSizeInput(b)),onFontSizeBlur:v.onFontSizeBlur,onFontSizeKeydown:c[6]||(c[6]=b=>v.onFontSizeKeydown(b)),onFontSizeChange:c[7]||(c[7]=b=>v.onFontSizeChange(b)),"onUpdate:fontSizeMenuOpen":c[8]||(c[8]=b=>Be(b)),onFontSizeToggle:c[9]||(c[9]=b=>v.toggleFontSizeMenu()),onFontSizeStepUp:v.onFontSizeStepUp,onFontSizeStepDown:v.onFontSizeStepDown,onBoldToggle:v.toggleFontWeight,onItalicToggle:v.toggleFontStyle,onUnderlineToggle:v.toggleUnderline,onStrikethroughToggle:v.toggleStrikethrough,onTextColorChange:c[10]||(c[10]=b=>v.onTextColorChange(b)),"onUpdate:textColorMenuOpen":c[11]||(c[11]=b=>Ne(b)),onFillColorChange:c[12]||(c[12]=b=>v.onFillColorChange(b)),"onUpdate:fillColorMenuOpen":c[13]||(c[13]=b=>Ue(b)),onApplyTextColor:v.applyCachedTextColor,onApplyFillColor:v.applyCachedFillColor,"onUpdate:borderMenuOpen":c[14]||(c[14]=b=>v.onBorderMenuToggle(b)),onBorderChange:c[15]||(c[15]=b=>w.onBorderChange(b)),onApplyBorder:w.applyCachedBorder,"onUpdate:sortMenuOpen":c[16]||(c[16]=b=>k.onSortMenuToggle(b)),onSortChange:c[17]||(c[17]=b=>k.onSortChange(b)),onApplySort:k.applyCachedSort,onFreezeChange:c[18]||(c[18]=b=>Ae(b)),onHAlignChange:c[19]||(c[19]=b=>v.onHAlignChange(b)),onVAlignChange:c[20]||(c[20]=b=>v.onVAlignChange(b)),onWrapToggle:v.onWrapToggle,"onUpdate:mergeMenuOpen":c[21]||(c[21]=b=>w.onMergeMenuToggle(b)),onMergeChange:c[22]||(c[22]=b=>w.onMergeChange(b)),onApplyMerge:w.onApplyMerge,"onUpdate:calcMenuOpen":c[23]||(c[23]=b=>w.onCalcMenuToggle(b)),onCalcSum:w.onCalcSum,onCalcAvg:w.onCalcAvg,onCalcCount:w.onCalcCount,onFind:c[24]||(c[24]=b=>t.unref(S).openFind())},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","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","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(Oi,{open:Y.open,"find-text":Y.findText,"replace-text":Y.replaceText,scope:Y.scope,"match-case":Y.matchCase,"match-entire-cell":Y.matchEntireCell,"current-index":Y.currentIndex,total:Y.results.length,message:Y.message,"focus-token":Y.focusToken,locale:d.locale,"theme-vars":k.toolbarThemeVars,"onUpdate:findText":c[25]||(c[25]=b=>t.unref(S).findText.value=b),"onUpdate:replaceText":c[26]||(c[26]=b=>t.unref(S).replaceText.value=b),"onUpdate:scope":c[27]||(c[27]=b=>t.unref(S).scope.value=b),"onUpdate:matchCase":c[28]||(c[28]=b=>t.unref(S).matchCase.value=b),"onUpdate:matchEntireCell":c[29]||(c[29]=b=>t.unref(S).matchEntireCell.value=b),onPrev:c[30]||(c[30]=b=>t.unref(S).findPrev()),onNext:c[31]||(c[31]=b=>t.unref(S).findNext()),onReplace:c[32]||(c[32]=b=>t.unref(S).replace()),onReplaceAll:c[33]||(c[33]=b=>t.unref(S).replaceAll()),onClose:c[34]||(c[34]=b=>t.unref(S).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(dc,{"model-open":v.nfDialogOpen,locale:d.locale,"current-format":De.value,"is-custom":v.selNumberFormat===t.unref(Sl),"onUpdate:modelOpen":c[35]||(c[35]=b=>Je(b)),onApply:c[36]||(c[36]=b=>v.applyNumberFormatCode(b))},null,8,["model-open","locale","current-format","is-custom"]),t.createVNode(Cc,{"model-open":k.sortConfirmOpen,locale:d.locale,"onUpdate:modelOpen":c[37]||(c[37]=b=>k.sortConfirmOpen=b),onConfirm:c[38]||(c[38]=b=>k.confirmSort(b)),onCancel:c[39]||(c[39]=b=>k.cancelSortConfirmation())},null,8,["model-open","locale"]),t.createVNode(zc,{"model-open":Le.value,locale:d.locale,"onUpdate:modelOpen":c[40]||(c[40]=b=>ve(b)),onInsert:c[41]||(c[41]=b=>Ke(b))},null,8,["model-open","locale"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":y.formulaBarExpanded}])},[t.createElementVNode("div",is,t.toDisplayString(y.activeCellLabel),1),t.createElementVNode("div",cs,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:c[42]||(c[42]=t.withModifiers(()=>{},["prevent"])),onClick:c[43]||(c[43]=t.withModifiers((...b)=>y.cancelFormulaBarEdit&&y.cancelFormulaBarEdit(...b),["stop"]))},[...c[94]||(c[94]=[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[44]||(c[44]=t.withModifiers(()=>{},["prevent"])),onClick:c[45]||(c[45]=t.withModifiers((...b)=>y.acceptFormulaBarEdit&&y.acceptFormulaBarEdit(...b),["stop"]))},[...c[95]||(c[95]=[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(I)(d.locale,"insertFunctionTitle"),"aria-label":t.unref(I)(d.locale,"insertFunctionTitle"),onMousedown:c[46]||(c[46]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(Ce,["stop"])},[...c[96]||(c[96]=[t.createElementVNode("span",{class:"formula-bar__fx-label"},"fx",-1)])],40,ss)]),t.createElementVNode("textarea",{ref:ge,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":y.formulaBarExpanded}]),rows:y.formulaBarExpanded?3:1,value:y.formulaBarDisplay,spellcheck:"false",onFocus:c[47]||(c[47]=(...b)=>y.onFormulaBarFocus&&y.onFormulaBarFocus(...b)),onInput:c[48]||(c[48]=(...b)=>y.onFormulaBarInput&&y.onFormulaBarInput(...b)),onKeydown:c[49]||(c[49]=(...b)=>y.onFormulaBarKeydown&&y.onFormulaBarKeydown(...b)),onBlur:c[50]||(c[50]=(...b)=>y.onFormulaBarBlur&&y.onFormulaBarBlur(...b))},null,42,ds),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:y.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:c[51]||(c[51]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(f,["stop"])},[y.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",ms,[...c[98]||(c[98]=[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",fs,[...c[97]||(c[97]=[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,us)],2),t.createElementVNode("div",{ref:N,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:A,class:"grid-canvas",tabindex:"0",onMousedown:c[52]||(c[52]=(...b)=>y.onMouseDown&&y.onMouseDown(...b)),onMousemove:c[53]||(c[53]=(...b)=>y.onMouseMove&&y.onMouseMove(...b)),onMouseup:c[54]||(c[54]=(...b)=>y.onMouseUp&&y.onMouseUp(...b)),onMouseleave:c[55]||(c[55]=(...b)=>y.onMouseLeave&&y.onMouseLeave(...b)),onDblclick:c[56]||(c[56]=(...b)=>y.onDblClick&&y.onDblClick(...b)),onWheel:c[57]||(c[57]=t.withModifiers((...b)=>y.onWheel&&y.onWheel(...b),["prevent"])),onFocus:c[58]||(c[58]=(...b)=>k.onCanvasFocus&&k.onCanvasFocus(...b)),onKeydown:c[59]||(c[59]=(...b)=>y.onKeydown&&y.onKeydown(...b)),onContextmenu:c[60]||(c[60]=(...b)=>y.onCanvasCtx&&y.onCanvasCtx(...b)),onTouchstart:c[61]||(c[61]=t.withModifiers((...b)=>y.onTouchStart&&y.onTouchStart(...b),["prevent"])),onTouchmove:c[62]||(c[62]=t.withModifiers((...b)=>y.onTouchMove&&y.onTouchMove(...b),["prevent"])),onTouchend:c[63]||(c[63]=(...b)=>y.onTouchEnd&&y.onTouchEnd(...b))},null,32),t.createElementVNode("canvas",{ref:Q,class:"grid-canvas grid-canvas--freeze","aria-hidden":"true"}),t.createElementVNode("textarea",{ref:U,class:"cell-editor",value:d.editValue,style:t.normalizeStyle(y.editInputStyle),onInput:c[64]||(c[64]=(...b)=>y.onEditInput&&y.onEditInput(...b)),onKeydown:c[65]||(c[65]=(...b)=>y.onEditKd&&y.onEditKd(...b)),onCompositionstart:c[66]||(c[66]=(...b)=>y.onEditCompositionStart&&y.onEditCompositionStart(...b)),onCompositionend:c[67]||(c[67]=(...b)=>y.onEditCompositionEnd&&y.onEditCompositionEnd(...b)),onBlur:c[68]||(c[68]=(...b)=>y.onEditBlur&&y.onEditBlur(...b)),onPaste:c[69]||(c[69]=(...b)=>y.onEditPaste&&y.onEditPaste(...b))},null,44,ps),k.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:y.vScrollbarTop+"px",height:`calc(100% - ${y.vScrollbarTop+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:c[70]||(c[70]=t.withModifiers(b=>{k.clampScroll(null,d.scrollY-50),y.scheduleRender()},["prevent"]))},[...c[99]||(c[99]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:c[72]||(c[72]=(...b)=>y.onVTrk&&y.onVTrk(...b))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:y.vThumbT+"px",height:y.vThumbH+"px"}),onMousedown:c[71]||(c[71]=(...b)=>y.onVStart&&y.onVStart(...b))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:c[73]||(c[73]=t.withModifiers(b=>{k.clampScroll(null,d.scrollY+50),y.scheduleRender()},["prevent"]))},[...c[100]||(c[100]=[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:y.hScrollbarLeft+"px",width:`calc(100% - ${y.hScrollbarLeft+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:c[74]||(c[74]=t.withModifiers(b=>{k.clampScroll(d.scrollX-50,null),y.scheduleRender()},["prevent"]))},[...c[101]||(c[101]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:c[76]||(c[76]=(...b)=>y.onHTrk&&y.onHTrk(...b))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:y.hThumbL+"px",width:y.hThumbW+"px"}),onMousedown:c[75]||(c[75]=(...b)=>y.onHStart&&y.onHStart(...b))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:c[77]||(c[77]=t.withModifiers(b=>{k.clampScroll(d.scrollX+50,null),y.scheduleRender()},["prevent"]))},[...c[102]||(c[102]=[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",hs)):t.createCommentVNode("",!0)]),t.createVNode(Si,{locale:d.locale,sheets:t.unref(Z),"active-sheet-index":t.unref(J),"ren-tab":y.renTab,"ren-tab-val":y.renTabVal,onTabClick:c[78]||(c[78]=b=>y.onTabClick(b)),onTabDblclick:c[79]||(c[79]=b=>y.onTabDblClick(b)),onTabContextmenu:c[80]||(c[80]=b=>y.onTabCtxMenu(b.ev,b.i)),onTabRenameInput:c[81]||(c[81]=b=>Xe(b)),onTabRenameKeydown:c[82]||(c[82]=b=>y.onTabRenameKd(b)),onTabRenameCommit:y.commitTabRename,onTabbarContextmenu:c[83]||(c[83]=b=>y.onTabBarCtx(b)),onDeleteSheet:c[84]||(c[84]=b=>{k.removeSheet(b),y.scheduleRender()}),onAddSheet:c[85]||(c[85]=b=>{k.addSheet(),y.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(()=>[y.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:y.ctxMenu.x+"px",top:y.ctxMenu.y+"px"}),onClick:c[86]||(c[86]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.ctxMenu.items,(b,ft)=>(t.openBlock(),t.createElementBlock("div",{key:ft,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":b.disabled}]),onClick:se=>!b.disabled&&b.action&&(b.action(),ie()),onMouseenter:se=>y.onCtxItemEnter(se,b)},[t.createElementVNode("span",ys,t.toDisplayString(b.label),1),b.children?(t.openBlock(),t.createElementBlock("svg",bs,[...c[103]||(c[103]=[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),b.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":y.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.children,(se,m)=>(t.openBlock(),t.createElementBlock("div",{key:m,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":se.disabled}]),onClick:t.withModifiers(H=>!se.disabled&&se.action&&(se.action(),ie()),["stop"])},t.toDisplayString(se.label),11,Cs))),128))],2)):t.createCommentVNode("",!0)],42,gs))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[y.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:y.dimPanel.x+"px",top:y.dimPanel.y+"px"}),onMousedown:c[92]||(c[92]=t.withModifiers(()=>{},["stop"])),onClick:c[93]||(c[93]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",vs,t.toDisplayString(y.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",ws,[t.createElementVNode("input",{ref:ce,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":y.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:y.dimPanel.value,onInput:c[87]||(c[87]=(...b)=>y.onDimInput&&y.onDimInput(...b)),onKeydown:c[88]||(c[88]=(...b)=>y.onDimKeydown&&y.onDimKeydown(...b)),onBlur:c[89]||(c[89]=(...b)=>y.onDimBlur&&y.onDimBlur(...b))},null,42,ks)]),y.dimPanel.error?(t.openBlock(),t.createElementBlock("div",Es,t.toDisplayString(y.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Ss,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:c[90]||(c[90]=(...b)=>y.applyDimPanel&&y.applyDimPanel(...b))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:c[91]||(c[91]=(...b)=>y.closeDimPanel&&y.closeDimPanel(...b))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-a7c5466d"]]);Ol.Spreader=In,Ol.default=In,Object.defineProperties(Ol,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});