xiaodao-spreader 0.1.26 → 0.1.27

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(Ut,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(Ut=typeof globalThis<"u"?globalThis:Ut||self,t(Ut.XiaoDaoSpreader={},Ut.Vue))})(this,function(Ut,t){"use strict";const Nn={"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:"关闭"},"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"}};function T(e,o){var n;return((n=Nn[e])==null?void 0:n[o])??o}const sl='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',Ht=10,Tn=[{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'}],An=[{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}],Vn='<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>',In='<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>',Fn='<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>',On='<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>',Hn='<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>',Ln='<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>',$n=[{value:"left",labelKey:"alignLeft",icon:Vn},{value:"center",labelKey:"alignCenter",icon:In},{value:"right",labelKey:"alignRight",icon:Fn}],_n=[{value:"top",labelKey:"alignTop",icon:On},{value:"middle",labelKey:"alignMiddle",icon:Hn},{value:"bottom",labelKey:"alignBottom",icon:Ln}],Yl=[{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>'}],zn={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)"},Wn={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)"},Lt="__nf_custom__",Dt="",$t="",vt="@",Bl="__NF_INVALID__",Dl=2958465,Nl=0;function Ct(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function Tl(e){return e==="zh-CN"?"¥":"$"}function Un(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Xl(e){return e.replace(/"([^"]*)"/g,"$1")}function Kn(e){let o=e,n;const l=o.match(/^\[([^\]]+)\]/);l&&(n=l[1].toLowerCase(),o=o.slice(l[0].length)),o=Un(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 m=-1;for(let P=o.length-1;P>=0;P--){const ee=o[P];if(ee==="0"||ee==="#"||ee==="?"||ee==="E"){m=P;break}}m<0&&(m=r);const c=r>0?o.slice(0,r):"",g=m<o.length-1?o.slice(m+1):"",k=o.slice(r,m+1),S=/[0#?]/.test(k),y=k.includes(",");let E=k.replace(/,/g,"");if(a){const P=E.search(/E/i);P>=0&&(E=E.slice(0,P))}const j=E.indexOf("."),Z=j>=0?E.slice(0,j):E,te=j>=0?E.slice(j+1):"",K=(te.match(/[0#?]/g)||[]).length,b=(te.match(/0/g)||[]).length,le=(Z.match(/0/g)||[]).length;return{hasDigits:S,decimals:K,minDecimals:b,minIntDigits:le,thousands:y,scale:i?100:1,scientific:a,prefix:c,suffix:g,color:n}}function Pn(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:Xl(i),len:0}):o.push({type:"literal",text:i,len:0})}}return{tokens:o,isDuration:n}}const jl=new Map;function Gn(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:m}=Pn(i);return{kind:m?"duration":"date",sections:[],tokens:r,isDuration:m,raw:e}}return{kind:"number",sections:e.split(";").map(i=>Kn(i)),tokens:[],isDuration:!1,raw:e}}function _t(e){const o=jl.get(e);if(o)return o;const n=Gn(e);return jl.set(e,n),n}function Zl(e,o,n,l,a){const i=Math.pow(10,o),r=Math.round((e+Number.EPSILON)*i)/i,m=r<0,c=Math.abs(r);let k=new Intl.NumberFormat("en-US",{useGrouping:l,minimumIntegerDigits:a,minimumFractionDigits:o,maximumFractionDigits:o}).format(c);if(n<o&&o>0){const y=k.indexOf(".");if(y>=0){const v=k.substring(0,y);let E=k.substring(y+1);E=E.replace(/0+$/,""),E.length<n&&(E=E+"0".repeat(n-E.length)),k=E?`${v}.${E}`:v}}return`${m?"-":""}${k}`}function ql(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=Zl(l,o,o,!1,1),i=(n>=0?"+":"-")+String(Math.abs(n)).padStart(2,"0");return`${a}E${i}`}function Yn(e,o,n){if(!n.hasDigits)return Xl(n.prefix+n.suffix);const l=n.scale===100?e*100:e,a=n.scientific?ql(l,n.decimals):Zl(l,n.decimals,n.minDecimals,n.thousands,n.minIntDigits);return o+n.prefix+a+n.suffix}function Xn(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),Yn(a,i,l)}function jn(e){return new Date((e-25569)*864e5)}const Zn=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],qn=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Jl=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],Jn=["January","February","March","April","May","June","July","August","September","October","November","December"],Qn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ql=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function tl(e,o){return String(e).padStart(o,"0")}function eo(e,o,n,l){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),m=e.getUTCDay(),c=n==="zh-CN";let g="",k=!1;for(const S of o)switch(S.type){case"literal":g+=S.text??"";break;case"year":g+=S.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":g+=tl(k?e.getUTCMinutes():i,S.len);break;case"monthName":g+=S.len>=4?c?Zn[i-1]:Jn[i-1]:c?qn[i-1]:Qn[i-1];break;case"day":g+=tl(r,S.len);break;case"weekday":g+=S.len>=4?c?Jl[m]:Ql[m]:c?Jl[m].slice(2):Ql[m].slice(0,3);break;case"hour":{let y=e.getUTCHours();if(S.len===0){const v=Math.floor(l*86400);y=Math.floor(v/3600)}g+=String(y),k=!0;break}case"minute":g+=tl(e.getUTCMinutes(),S.len);break;case"second":g+=tl(e.getUTCSeconds(),S.len);break;case"ampm":{const y=e.getUTCHours();g+=y<12?c?"上午":"AM":c?"下午":"PM";break}}return g}function to(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 m of o)switch(m.type){case"literal":r+=m.text??"";break;case"hour":r+=String(l);break;case"minute":r+=tl(a,m.len||2);break;case"second":r+=tl(i,m.len||2);break;default:r+=""}return r}function lo(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)?ql(o,9):e}return e}function Zt(e,o,n){if(Ct(o))return lo(e);if(o==null||o===vt)return e;const l=_t(o);if(l.kind==="date"||l.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(l.kind==="date"){if(i<Nl||i>Dl)return Bl}else if(i<0)return Bl;return l.kind==="duration"?to(i,l.tokens):eo(jn(i),l.tokens,n,i)}const a=Number(e);return isNaN(a)?e:Xn(a,l)}const no=["general","text","number","percent","scientific","accounting","financial","currency","currencyRounded","date","time","dateTime","duration","custom"];function en(e,o){if(o===vt||o==="@")return!1;if(Ct(o)){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}const n=_t(o);return!!(n.kind==="number"&&tn(n))}function tn(e){return e.sections.some(o=>o.hasDigits)}function oo(e){if(e==null||Ct(e)||e===vt||e==="@")return!1;const o=_t(e);return!!(o.kind==="date"||o.kind==="duration"||o.kind==="number"&&tn(o))}function ro(e,o){if(o==null||Ct(o)||o===vt||o==="@")return!1;const n=_t(o),l=Number(e);return Number.isFinite(l)?n.kind==="date"?l<Nl||l>Dl:n.kind==="duration"?l<0:!1:!1}const Al=30,Vl=0;function dl(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===Dt||Ct(e))return dl(o);if(e===vt)return!1;const n=_t(e);return n.kind==="date"||n.kind==="duration"?!1:n.sections.some(l=>l.hasDigits)}function ao(e){if(!dl(e))return 0;const o=String(Number(e));return o.indexOf(".")<0||/e/i.test(o)?0:o.slice(o.indexOf(".")+1).length}function io(e,o){if(!ln(e,o))return-1;if(e==null||e===Dt||Ct(e))return ao(o);const l=_t(e).sections.find(a=>a.hasDigits);return l?l.decimals:-1}function co(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),m=r.search(/[0#?]/);if(m===-1)return e;let c=-1;for(let Z=r.length-1;Z>=0;Z--){const te=r[Z];if(te==="0"||te==="#"||te==="?"||te==="E"){c=Z;break}}if(c<m)return e;const g=r.slice(m,c+1),k=g.search(/E[+-]/i),S=k>=0?g.slice(0,k):g,y=S.indexOf("."),v=y>=0?(S.slice(y+1).match(/[0#?]/g)||[]).length:0;if(v===o)return e;let E;if(y<0)E=o>0?S+"."+"0".repeat(o):S;else if(o>v)E=S+"0".repeat(o-v);else{let Z=v-o;const te=S.split("");for(let K=te.length-1;K>=0&&Z>0;K--){const b=te[K];(b==="0"||b==="#"||b==="?")&&(te.splice(K,1),Z--)}E=te.join(""),o===0&&E.endsWith(".")&&(E=E.slice(0,-1))}const j=E+(k>=0?g.slice(k):"");return i+r.slice(0,m)+j+r.slice(c+1)}function so(e,o){if(!Number.isInteger(o)||o<Vl||o>Al||e===Dt)return null;if(e==null||Ct(e))return o>0?"0."+"0".repeat(o):"0";if(e===vt)return null;const n=_t(e);return n.kind==="date"||n.kind==="duration"||!n.sections.some(l=>l.hasDigits)?null:e.split(";").map(l=>co(l,o)).join(";")}const Il=["¥","$","€","£"];function nn(e,o){if(e==null||e===Dt)return e??$t;if(Ct(e))return $t;if(e===vt||e==="@")return vt;const n=Tl(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(on(o).some(v=>v.value===e))return e;const c=e.replace(/\[[^\]]*\]/gi,v=>/^\[(h|mm|ss)\]$/i.test(v)?v:"");if(/\[(h|mm|ss)\]/i.test(c)&&!/[yd]/i.test(c))return"[h]:mm:ss";const g=/[yd]/i.test(c),k=/h|s|AM\/PM/i.test(c);if(g&&k)return a;if(g||/AM\/PM/i.test(c))return l;if(k)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 S=Il.find(v=>e.startsWith(v));if(S)return e.includes("(")?i:/\.\d/.test(e.slice(S.length))?n+"#,##0.00":n+"#,##0";const y=_t(e);return y.kind==="number"&&y.sections.some(v=>v.hasDigits)?"#,##0.00":Lt}function uo(e,o){return new Date(Date.UTC(e,o,0)).getUTCDate()}function fo(e,o,n){const l=Date.UTC(e,o-1,n)/864e5+25569;return l<=60?l-1:l}function Fl(e,o,n=new Date){const l=e.trim();if(!l||l.startsWith("=")||dl(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 m(y){const v=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(y);if(!v)return null;const E=Number(v[1]),j=Number(v[2]),Z=v[3]!==void 0?Number(v[3]):0;return E>23||j>59||Z>59?null:(E*3600+j*60+Z)/86400}function c(y){let v=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(y),E,j,Z;if(v)E=Number(v[1]),j=Number(v[2]),Z=Number(v[3]);else if(v=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(y))E=Number(v[1]),j=Number(v[2]),Z=Number(v[3]);else if(v=/^(\d{1,2})[-/](\d{1,2})$/.exec(y))E=n.getUTCFullYear(),j=Number(v[1]),Z=Number(v[2]);else return null;if(E<1900||E>9999||j<1||j>12||Z<1||Z>uo(E,j))return null;const te=fo(E,j,Z);return te>=Nl&&te<=Dl?te:null}const g=m(l);if(g!==null)return{serial:g,format:r};const k=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(l);if(k){const y=c(k[1].trim()),v=m(k[2]);if(y!==null&&v!==null)return{serial:y+v,format:i}}const S=c(l);return S!==null?{serial:S,format:a}:null}function mo(e,o){const n=e.trim();if(!n||n.startsWith("=")||!(n.includes(",")||n.includes("%")||Il.some(K=>n.startsWith(K)))||Fl(n,o))return null;const a=Il.find(K=>n.startsWith(K)),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 m=r[1]==="-"?-1:1,c=r[2].replace(/,/g,""),g=r[3],k=(r[4]??"")==="%",S=g?g.length:0,y=+(c+(g?"."+g:""));if(!Number.isFinite(y))return null;const E=i.includes(",")?"#,##0":"0",j=S>0?"."+"0".repeat(S):"",Z=(a??"")+E+j+(k?"%":"");let te=y*m;return k&&(te=te/100),te=Math.round(te*1e12)/1e12,{num:te,format:Z}}function po(e,o,n,l){const a=Tl(e),i=l?"#,##0":"0",r=n>0?"."+"0".repeat(n):"",m=i+r;switch(o){case"general":return"";case"text":return vt;case"custom":return"";case"number":return m;case"percent":return m+"%";case"scientific":return"0."+"0".repeat(n)+"E+00";case"currency":return a+m;case"currencyRounded":return a+(l?"#,##0":"0");case"accounting":return`${a}${m};(${a}${m});${a}"-"`;case"financial":return`${m};[Red](${m})`;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 on(e){const o=Tl(e);return[{label:T(e,"nfGeneral"),value:$t},{label:T(e,"nfText"),value:vt},{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:`${o}#,##0.00;(${o}#,##0.00);${o}"-"`},{label:T(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:T(e,"nfCurrency"),value:o+"#,##0.00"},{label:T(e,"nfCurrencyRounded"),value:o+"#,##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:Lt}]}const ho=["title"],go=["innerHTML"],bo={key:1,class:"sp-dropdown__value"},yo=["disabled"],vo=["placeholder"],Co=["onClick"],wo=["innerHTML"],ko={class:"sp-dropdown__item-label"},Eo={key:2,class:"sp-dropdown__empty"},So=["disabled"],xo=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:""}},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),m=t.ref(null),c=t.ref(null),g=t.ref({top:0,up:!1}),k=t.ref(void 0),S=t.ref(0),y=t.ref(!1),v=t.ref(""),E=t.ref(null),j=t.computed(()=>n.options.find(p=>String(p.value)===String(n.modelValue))),Z=t.computed(()=>n.menuWidth!==void 0?n.menuWidth:k.value),te=t.computed(()=>{if(!n.searchable||!v.value.trim())return n.options;const p=v.value.trim().toLowerCase();return n.options.filter(D=>String(D.label??"").toLowerCase().includes(p))}),K=t.computed(()=>te.value.length>0),b=t.computed(()=>Math.min(n.visibleCount,te.value.length)),le=t.computed(()=>te.value.slice(i.value,i.value+b.value)),P=t.computed(()=>i.value>0),ee=t.computed(()=>i.value+b.value<te.value.length),Ce=t.computed(()=>te.value.length>b.value);function Me(p){i.value=Math.max(0,Math.min(te.value.length-b.value,i.value+p))}function ge(){a.value=!0,n.searchable&&(v.value=""),n.modelOpen!==void 0&&l("update:modelOpen",!0);const p=n.triggerEl??r.value;if(!p)return;const D=p.getBoundingClientRect();k.value=D.width;const I=b.value*22+(Ce.value?2*15:0)+8+(n.searchable?34:0),x=window.innerHeight-D.bottom-4<I&&D.top-4>I;n.align==="right"?g.value={right:window.innerWidth-D.right,top:x?D.top-I-4:D.bottom+4,up:x}:g.value={left:D.left,top:x?D.top-I-4:D.bottom+4,up:x};const s=te.value.findIndex(u=>String(u.value)===String(n.modelValue));i.value=s>=0?Math.max(0,Math.min(s-Math.floor(b.value/2),te.value.length-b.value)):0,n.searchable&&t.nextTick(()=>{var u;return(u=E.value)==null?void 0:u.focus()})}function se(){a.value=!1,v.value="",n.modelOpen!==void 0&&l("update:modelOpen",!1)}function Re(){a.value?se():ge()}function Ke(p){l("update:modelValue",p.value),l("change",p.value),se()}function we(p){var I,U;if(!a.value)return;const D=p.target;(I=r.value)!=null&&I.contains(D)||(U=c.value)!=null&&U.contains(D)||se()}function me(p){a.value&&(p.preventDefault(),Me(p.deltaY>0?1:-1))}t.watch(a,p=>{t.nextTick(()=>{var D,I;p?((D=m.value)==null||D.addEventListener("wheel",me,{passive:!1}),document.addEventListener("keydown",ye)):((I=m.value)==null||I.removeEventListener("wheel",me),document.removeEventListener("keydown",ye))})});function ye(p){a.value&&p.key==="Escape"&&se()}t.watch(()=>n.modelOpen,p=>{p!==void 0&&p!==a.value&&(p?ge():se())});function Le(p){a.value&&(S.value=p.touches[0].clientY,y.value=!0)}function $e(p){if(!a.value||!y.value)return;const D=p.touches[0].clientY-S.value;Math.abs(D)>5&&(Me(D<0?1:-1),S.value=p.touches[0].clientY)}function G(){y.value=!1}function pe(p){p.key==="Escape"&&(p.stopPropagation(),se())}return t.onMounted(()=>{document.addEventListener("pointerdown",we),window.addEventListener("resize",se),window.addEventListener("scroll",se,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",we),document.removeEventListener("keydown",ye),window.removeEventListener("resize",se),window.removeEventListener("scroll",se,!0)}),(p,D)=>{var I,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:Re},[(I=j.value)!=null&&I.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:j.value.icon},null,8,go)):(t.openBlock(),t.createElementBlock("span",bo,t.toDisplayString(((U=j.value)==null?void 0:U.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,ho)),(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:c,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":g.value.up}]),style:t.normalizeStyle({left:g.value.left!==void 0?g.value.left+"px":void 0,right:g.value.right!==void 0?g.value.right+"px":void 0,top:g.value.top+"px",minWidth:Z.value!==void 0?typeof Z.value=="number"?Z.value+"px":Z.value:void 0}),onKeydown:pe,onMousedown:D[4]||(D[4]=t.withModifiers(()=>{},["prevent"]))},[Ce.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!P.value}]),disabled:!P.value,onClick:D[0]||(D[0]=x=>Me(-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,yo)):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]=x=>v.value=x),class:"sp-dropdown__search",type:"text",placeholder:e.searchPlaceholder,onMousedown:D[2]||(D[2]=t.withModifiers(()=>{},["stop"]))},null,40,vo)),[[t.vModelText,v.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:m,class:"sp-dropdown__list",onTouchstart:Le,onTouchmove:$e,onTouchend:G},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(le.value,x=>(t.openBlock(),t.createElementBlock("button",{key:String(x.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(x.value)===String(e.modelValue)}]),onClick:s=>Ke(x)},[x.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:x.icon},null,8,wo)):t.createCommentVNode("",!0),t.createElementVNode("span",ko,t.toDisplayString(x.label),1)],10,Co))),128))],544),e.searchable&&!K.value?(t.openBlock(),t.createElementBlock("div",Eo," 无匹配 ")):t.createCommentVNode("",!0),Ce.value?(t.openBlock(),t.createElementBlock("button",{key:3,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!ee.value}]),disabled:!ee.value,onClick:D[3]||(D[3]=x=>Me(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,So)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),ht=(e,o)=>{const n=e.__vccOpts||e;for(const[l,a]of o)n[l]=a;return n},gt=ht(xo,[["__scopeId","data-v-ee298762"]]),Ro=["title","onClick"],rn=ht(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"}]],m=t.computed(()=>l.colorKey==="fill"?r:i);function c(K){return T(l.locale,K)}function g(K){const b=l.currentColor;return!b&&!K?!0:b?b.toLowerCase()===K.toLowerCase():!1}const k=t.ref(!1),S=t.ref(null),y=t.ref(null),v=t.ref({top:0});t.watch(()=>l.modelOpen,K=>{K!==void 0&&K!==k.value&&(K?j():Z())});function E(K){const b=S.value,le=y.value,P=K.target;b&&b.contains(P)||le&&le.contains(P)||Z()}function j(){k.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const K=l.triggerEl??S.value;if(K){const b=K.getBoundingClientRect(),le=150,P=120;let ee=window.innerWidth-b.right,Ce=b.bottom+4,Me;b.left-P<4&&(ee=void 0,Me=Math.max(4,b.left)),Ce+le>window.innerHeight-4&&(Ce=b.top-le-4),Ce<4&&(Ce=4),v.value=ee!==void 0?{right:ee,top:Ce}:{left:Me,top:Ce}}document.addEventListener("pointerdown",E)})}function Z(){k.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",E)}function te(K){a("update:modelValue",K),a("change",K),Z()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",E)}),o({open:k,openMenu:j,close:Z}),(K,b)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:S,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[k.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:y,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:b[0]||(b[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.value,(le,P)=>(t.openBlock(),t.createElementBlock("div",{key:P,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(le,ee=>(t.openBlock(),t.createElementBlock("button",{key:ee.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":g(ee.value)}]),title:c(ee.key),style:t.normalizeStyle({background:ee.value||"transparent",border:ee.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:Ce=>te(ee.value)},null,14,Ro))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-70f3dfdc"]]),Mo=["title","onClick"],Bo={viewBox:"0 0 30 30",class:"border-picker__icon"},Do=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],No={class:"border-picker__label"},To=ht(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}],m={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"]},c={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function g(K,b){return c[K].includes(b)?"thick":m[K].includes(b)?"solid":"dashed"}const k=t.ref(!1),S=t.ref(null),y=t.ref(null),v=t.ref({top:0});t.watch(()=>l.modelOpen,K=>{K!==void 0&&K!==k.value&&(K?j():Z())});function E(K){const b=S.value,le=y.value,P=K.target;b&&b.contains(P)||le&&le.contains(P)||Z()}function j(){k.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const K=l.triggerEl??S.value;if(K){const b=K.getBoundingClientRect(),le=200,P=160;let ee=window.innerWidth-b.right,Ce=b.bottom+4,Me;b.left-P<4&&(ee=void 0,Me=Math.max(4,b.left)),Ce+le>window.innerHeight-4&&(Ce=b.top-le-4),Ce<4&&(Ce=4),v.value=ee!==void 0?{right:ee,top:Ce}:{left:Me,top:Ce}}document.addEventListener("pointerdown",E)})}function Z(){k.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",E)}function te(K){a("change",K),Z()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",E)}),o({open:k,openMenu:j,close:Z}),(K,b)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:S,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[k.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:y,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:b[0]||(b[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,le=>t.createElementVNode("button",{key:le.key,class:"border-picker__item",title:t.unref(T)(e.locale,le.i18nKey),onClick:P=>te(le.key)},[(t.openBlock(),t.createElementBlock("svg",Bo,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,P=>t.createElementVNode("line",{key:P.name,x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,stroke:"currentColor","stroke-width":g(le.key,P.name)==="thick"?3:1.5,"stroke-dasharray":g(le.key,P.name)==="dashed"?"0 4":"none","stroke-linecap":g(le.key,P.name)==="dashed"?"round":"square"},null,8,Do)),64))])),t.createElementVNode("span",No,t.toDisplayString(t.unref(T)(e.locale,le.i18nKey)),1)],8,Mo)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-551c0ffe"]]),Ao=["title","onClick"],Vo={viewBox:"0 0 1024 1024",class:"sort-picker__icon",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},Io=["x1","y1","x2","y2"],Fo=["d"],Oo={class:"sort-picker__label"},Ho=ht(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}],m={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},c=t.ref(!1),g=t.ref(null),k=t.ref(null),S=t.ref({top:0});t.watch(()=>l.modelOpen,Z=>{Z!==void 0&&Z!==c.value&&(Z?v():E())});function y(Z){const te=g.value,K=k.value,b=Z.target;te&&te.contains(b)||K&&K.contains(b)||E()}function v(){c.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const Z=l.triggerEl??g.value;if(Z){const te=Z.getBoundingClientRect(),K=84,b=160;let le=window.innerWidth-te.right,P=te.bottom+4,ee;te.left-b<4&&(le=void 0,ee=Math.max(4,te.left)),P+K>window.innerHeight-4&&(P=te.top-K-4),P<4&&(P=4),S.value=le!==void 0?{right:le,top:P}:{left:ee,top:P}}document.addEventListener("pointerdown",y)})}function E(){c.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",y)}function j(Z){a("change",Z),E()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",y)}),o({open:c,openMenu:v,close:E}),(Z,te)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:g,class:"sort-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[c.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:k,class:"sort-picker__menu",style:t.normalizeStyle({left:S.value.left!==void 0?S.value.left+"px":void 0,right:S.value.right!==void 0?S.value.right+"px":void 0,top:S.value.top+"px"}),onMousedown:te[0]||(te[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,K=>t.createElementVNode("button",{key:K.key,class:"sort-picker__item",title:t.unref(T)(e.locale,K.i18nKey),onClick:b=>j(K.key)},[(t.openBlock(),t.createElementBlock("svg",Vo,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,b=>t.createElementVNode("line",{key:b.name,x1:b.x1,y1:b.y1,x2:b.x2,y2:b.y2},null,8,Io)),64)),t.createElementVNode("path",{d:m[K.key]},null,8,Fo)])),t.createElementVNode("span",Oo,t.toDisplayString(t.unref(T)(e.locale,K.i18nKey)),1)],8,Ao)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-45929b74"]]),Lo=["title","onClick"],$o=["innerHTML"],_o={class:"merge-picker__label"},zo=ht(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),m=t.ref(null),c=t.ref({top:0});t.watch(()=>l.modelOpen,v=>{v!==void 0&&v!==i.value&&(v?k():S())});function g(v){const E=r.value,j=m.value,Z=v.target;E&&E.contains(Z)||j&&j.contains(Z)||S()}function k(){i.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const v=l.triggerEl??r.value;if(v){const E=v.getBoundingClientRect(),j=Yl.length*30+12,Z=160;let te=window.innerWidth-E.right,K=E.bottom+4,b;E.left-Z<4&&(te=void 0,b=Math.max(4,E.left)),K+j>window.innerHeight-4&&(K=E.top-j-4),K<4&&(K=4),c.value=te!==void 0?{right:te,top:K}:{left:b,top:K}}document.addEventListener("pointerdown",g)})}function S(){i.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",g)}function y(v){a("change",v),S()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",g)}),o({open:i,openMenu:k,close:S}),(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:m,class:"merge-picker__menu",style:t.normalizeStyle({left:c.value.left!==void 0?c.value.left+"px":void 0,right:c.value.right!==void 0?c.value.right+"px":void 0,top:c.value.top+"px"}),onMousedown:E[0]||(E[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Yl),j=>(t.openBlock(),t.createElementBlock("button",{key:j.key,class:"merge-picker__item",title:t.unref(T)(e.locale,j.labelKey),onClick:Z=>y(j.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:j.icon},null,8,$o),t.createElementVNode("span",_o,t.toDisplayString(t.unref(T)(e.locale,j.labelKey)),1)],8,Lo))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-edd36208"]]),Wo=["disabled","title","onClick"],Uo={class:"calc-picker__label"},Ko=ht(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),m=t.ref(null),c=t.ref(null),g=t.ref({top:0});t.watch(()=>l.modelOpen,E=>{E!==void 0&&E!==r.value&&(E?S():y())});function k(E){const j=m.value,Z=c.value,te=E.target;j&&j.contains(te)||Z&&Z.contains(te)||y()}function S(){r.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const E=l.triggerEl??m.value;if(E){const j=E.getBoundingClientRect(),Z=i.length*30+12,te=160;let K=window.innerWidth-j.right,b=j.bottom+4,le;j.left-te<4&&(K=void 0,le=Math.max(4,j.left)),b+Z>window.innerHeight-4&&(b=j.top-Z-4),b<4&&(b=4),g.value=K!==void 0?{right:K,top:b}:{left:le,top:b}}document.addEventListener("pointerdown",k)})}function y(){r.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",k)}function v(E){l.disabled||(a("change",E),y())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",k)}),o({open:r,openMenu:S,close:y}),(E,j)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:m,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:c,class:"calc-picker__menu",style:t.normalizeStyle({left:g.value.left!==void 0?g.value.left+"px":void 0,right:g.value.right!==void 0?g.value.right+"px":void 0,top:g.value.top+"px"}),onMousedown:j[0]||(j[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,Z=>t.createElementVNode("button",{key:Z.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(T)(e.locale,Z.labelKey),onClick:te=>v(Z.key)},[t.createElementVNode("span",Uo,t.toDisplayString(t.unref(T)(e.locale,Z.labelKey)),1)],10,Wo)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-01a18e00"]]),Po={class:"tb-item","data-key":"undo"},Go=["title","disabled"],Yo={class:"tb-item","data-key":"redo"},Xo=["title","disabled"],jo={class:"tb-item","data-key":"paint"},Zo=["title","disabled"],qo={class:"tb-item","data-key":"clear"},Jo=["title","disabled"],Qo={class:"tb-item","data-key":"font"},er={class:"tb-item","data-key":"fontSize"},tr={class:"toolbar-font-size"},lr=["value","title"],nr=["title"],or=["title","disabled"],rr=["title","disabled"],ar={class:"tb-item","data-key":"bold"},ir=["title","disabled"],cr={class:"tb-item","data-key":"italic"},sr=["title","disabled"],dr={class:"tb-item","data-key":"underline"},ur=["title","disabled"],fr={class:"tb-item","data-key":"strike"},mr=["title","disabled"],pr={class:"tb-item","data-key":"textColor"},hr={class:"toolbar-split"},gr=["title","disabled"],br={viewBox:"0 0 1024 1024",fill:"currentColor"},yr=["fill"],vr=["title","disabled"],Cr={class:"tb-item","data-key":"fillColor"},wr={class:"toolbar-split"},kr=["title","disabled"],Er={viewBox:"0 0 1024 1024",fill:"currentColor"},Sr=["fill"],xr=["title","disabled"],Rr={class:"tb-item","data-key":"border"},Mr={class:"toolbar-split"},Br=["title","disabled"],Dr={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},Nr=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Tr=["title","disabled"],Ar={class:"tb-item","data-key":"hAlign"},Vr={class:"tb-item","data-key":"vAlign"},Ir={class:"tb-item","data-key":"wrap"},Fr=["title"],Or={class:"tb-item","data-key":"merge"},Hr={class:"toolbar-split"},Lr=["title","disabled"],$r=["title","disabled"],_r={class:"tb-item","data-key":"numFmt"},zr={class:"toolbar-number-format-group"},Wr=["title","disabled"],Ur=["title","disabled"],Kr={class:"tb-item","data-key":"calc"},Pr={class:"toolbar-split"},Gr=["title","disabled"],Yr=["title","disabled"],Xr={class:"tb-item","data-key":"sort"},jr={class:"toolbar-split"},Zr=["title","disabled"],qr={viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},Jr=["x1","y1","x2","y2"],Qr=["d"],ea=["title","disabled"],ta={class:"tb-item","data-key":"find"},la=["title"],Ol=2,na=6,oa=34,ra=ht(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},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","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(Ee,h){return a[Ee].includes(h)?"thick":l[Ee].includes(h)?"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}],m={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},c=["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","find"],g=t.ref(null),k=t.ref(null),S=t.ref(null),y=t.ref(null),v=t.ref(null),E=t.ref(null),j=t.ref(null),Z=t.ref(null),te=t.ref(null),K=t.ref(null),b=t.ref(new Set),le=t.ref(!1),P=t.ref(!1),ee=t.ref(0),Ce=new Map,Me=t.computed(()=>b.value.size>0);function ge(Ee){return b.value.has(Ee)}const se=t.computed(()=>{const Ee=k.value;return Ee instanceof HTMLElement?Ee:void 0});function Re(Ee){return se.value?!ge(Ee):!0}function Ke(){for(const Ee of c){const h=Ce.get(Ee);if(h===void 0||h===0)return!0}return!1}function we(){if(!g.value)return;g.value.querySelectorAll(".tb-item").forEach(h=>{const B=h.dataset.key;if(!B)return;const Be=h.offsetWidth;Be>0?Ce.set(B,Be):Ce.has(B)||Ce.set(B,0)})}function me(Ee,h){if(Ee.size!==h.size)return!1;for(const B of Ee)if(!h.has(B))return!1;return!0}let ye=0,Le=0;function $e(){ye&&cancelAnimationFrame(ye),!(Le>60)&&(Le++,ye=requestAnimationFrame(()=>requestAnimationFrame(G)))}function G(){if(!g.value)return;const Ee=g.value.clientWidth-na*2;if(Ee<=0){$e();return}Le=0,(Ce.size===0||Ke())&&we();let h=0;for(const Be of c)h+=(Ce.get(Be)??0)+Ol;const B=new Set;if(h>Ee){const Be=Ee-oa-Ol;let je=0;for(let it=0;it<c.length;it++){const ie=c[it],Te=(Ce.get(ie)??0)+Ol;if(je+Te>Be){for(let Fe=it;Fe<c.length;Fe++)B.add(c[Fe]);break}je+=Te}}me(B,b.value)||(b.value=B,ee.value++,B.size===0&&(le.value=!1))}let pe=null;const p=t.ref(0),D=t.computed(()=>{const Ee=S.value,h={position:"fixed",top:"0px",right:"0px"};if(!Ee)return{...u.themeVars,...h};p.value;const B=Ee.getBoundingClientRect();return{...u.themeVars,position:"fixed",top:`${B.bottom+4}px`,right:`${window.innerWidth-B.right}px`}});function I(){le.value&&(p.value++,t.nextTick(()=>G()))}function U(Ee){var B,Be;if(!le.value)return;const h=Ee.target;(B=k.value)!=null&&B.contains(h)||(Be=S.value)!=null&&Be.contains(h)||(P.value=!0,le.value=!1,t.nextTick(()=>{P.value=!1}))}function x(){le.value=!le.value}function s(){le.value=!1,O("find")}t.onMounted(()=>{$e(),g.value&&(pe=new ResizeObserver(()=>{le.value||$e()}),pe.observe(g.value)),document.addEventListener("pointerdown",U,!0),window.addEventListener("resize",I),window.addEventListener("load",$e),window.addEventListener("orientationchange",$e)}),t.onBeforeUnmount(()=>{ye&&cancelAnimationFrame(ye),pe==null||pe.disconnect(),document.removeEventListener("pointerdown",U,!0),window.removeEventListener("resize",I),window.removeEventListener("load",$e),window.removeEventListener("orientationchange",$e)});const u=e,O=o,ke=t.computed(()=>u.selNumberFormat===Dt?T(u.locale,"nfMixed"):"");return(Ee,h)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:g,class:"toolbar",onMousedown:h[51]||(h[51]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("undo"),to:se.value},[t.createElementVNode("div",Po,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(T)(e.locale,"undo"),disabled:!e.canUndo,onClick:h[0]||(h[0]=B=>O("undo"))},[...h[53]||(h[53]=[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,Go)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("redo"),to:se.value},[t.createElementVNode("div",Yo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(T)(e.locale,"redo"),disabled:!e.canRedo,onClick:h[1]||(h[1]=B=>O("redo"))},[...h[54]||(h[54]=[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,Xo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("paint"),to:se.value},[t.createElementVNode("div",jo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(T)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:h[2]||(h[2]=B=>O("paint-format"))},[...h[55]||(h[55]=[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,Zo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("clear"),to:se.value},[t.createElementVNode("div",qo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(T)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:h[3]||(h[3]=B=>O("clear-format"))},[...h[56]||(h[56]=[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,Jo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("sep1"),to:se.value},[h[57]||(h[57]=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:Re("font"),to:se.value},[t.createElementVNode("div",Qo,[t.createVNode(gt,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:ge("font")?"100%":110,"menu-width":ge("font")?120:void 0,"visible-count":8,title:t.unref(T)(e.locale,"fontFamily"),align:"right",onChange:h[4]||(h[4]=B=>O("font-family-change",B))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("fontSize"),to:se.value},[t.createElementVNode("div",er,[t.createElementVNode("div",tr,[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:h[5]||(h[5]=t.withModifiers(()=>{},["stop"])),onInput:h[6]||(h[6]=B=>O("font-size-input",B.target.value)),onBlur:h[7]||(h[7]=B=>O("font-size-blur")),onKeydown:h[8]||(h[8]=B=>O("font-size-keydown",B))},null,40,lr),t.createVNode(gt,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:ge("fontSize")?"100%":56,"menu-width":ge("fontSize")?120:56,"visible-count":9,title:t.unref(T)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":K.value,"onUpdate:modelOpen":h[9]||(h[9]=B=>O("update:font-size-menu-open",B)),onChange:h[10]||(h[10]=B=>O("font-size-change",B))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:K,class:"toolbar-font-size__btn",type:"button",title:t.unref(T)(e.locale,"fontSize"),onMousedown:h[11]||(h[11]=t.withModifiers(()=>{},["prevent"])),onClick:h[12]||(h[12]=B=>O("font-size-toggle"))},[...h[58]||(h[58]=[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,nr),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(T)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:h[13]||(h[13]=t.withModifiers(()=>{},["prevent"])),onClick:h[14]||(h[14]=B=>O("font-size-step-down"))},[...h[59]||(h[59]=[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,or),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(T)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:h[15]||(h[15]=t.withModifiers(()=>{},["prevent"])),onClick:h[16]||(h[16]=B=>O("font-size-step-up"))},[...h[60]||(h[60]=[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,rr)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("sep2"),to:se.value},[h[61]||(h[61]=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:Re("bold"),to:se.value},[t.createElementVNode("div",ar,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(T)(e.locale,"bold"),disabled:!e.hasSelection,onClick:h[17]||(h[17]=B=>O("bold-toggle"))},[...h[62]||(h[62]=[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,ir)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("italic"),to:se.value},[t.createElementVNode("div",cr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(T)(e.locale,"italic"),disabled:!e.hasSelection,onClick:h[18]||(h[18]=B=>O("italic-toggle"))},[...h[63]||(h[63]=[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,sr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("underline"),to:se.value},[t.createElementVNode("div",dr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(T)(e.locale,"underline"),disabled:!e.hasSelection,onClick:h[19]||(h[19]=B=>O("underline-toggle"))},[...h[64]||(h[64]=[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,ur)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("strike"),to:se.value},[t.createElementVNode("div",fr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(T)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:h[20]||(h[20]=B=>O("strikethrough-toggle"))},[...h[65]||(h[65]=[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,mr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("sep3"),to:se.value},[h[66]||(h[66]=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:Re("textColor"),to:se.value},[t.createElementVNode("div",pr,[t.createElementVNode("div",hr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:h[21]||(h[21]=B=>O("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",br,[h[67]||(h[67]=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,yr)]))],8,gr),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:y,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:h[22]||(h[22]=B=>O("update:text-color-menu-open",!e.textColorMenuOpen))},[...h[68]||(h[68]=[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,vr),t.createVNode(rn,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":y.value,"onUpdate:modelOpen":h[23]||(h[23]=B=>O("update:text-color-menu-open",B)),onChange:h[24]||(h[24]=B=>O("text-color-change",B))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("fillColor"),to:se.value},[t.createElementVNode("div",Cr,[t.createElementVNode("div",wr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:h[25]||(h[25]=B=>O("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",Er,[h[69]||(h[69]=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,Sr)]))],8,kr),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:h[26]||(h[26]=B=>O("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...h[70]||(h[70]=[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,xr),t.createVNode(rn,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":v.value,"onUpdate:modelOpen":h[27]||(h[27]=B=>O("update:fill-color-menu-open",B)),onChange:h[28]||(h[28]=B=>O("fill-color-change",B))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("border"),to:se.value},[t.createElementVNode("div",Rr,[t.createElementVNode("div",Mr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"borders"),disabled:!e.hasSelection,onClick:h[29]||(h[29]=B=>O("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",Dr,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(n,B=>t.createElementVNode("line",{key:B.name,x1:B.x1,y1:B.y1,x2:B.x2,y2:B.y2,"stroke-width":i(e.cachedBorder,B.name)==="thick"?3:1.5,"stroke-dasharray":i(e.cachedBorder,B.name)==="dashed"?"0 4":"none","stroke-linecap":i(e.cachedBorder,B.name)==="dashed"?"round":"square"},null,8,Nr)),64))]))],8,Br),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:h[30]||(h[30]=B=>O("update:border-menu-open",!e.borderMenuOpen))},[...h[71]||(h[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,Tr),t.createVNode(To,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":E.value,"onUpdate:modelOpen":h[31]||(h[31]=B=>O("update:border-menu-open",B)),onChange:h[32]||(h[32]=B=>O("border-change",B))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("sep4"),to:se.value},[h[72]||(h[72]=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:Re("hAlign"),to:se.value},[t.createElementVNode("div",Ar,[t.createVNode(gt,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:ge("hAlign")?"100%":44,"menu-width":ge("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(T)(e.locale,"hAlign"),onChange:h[33]||(h[33]=B=>O("h-align-change",B))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("vAlign"),to:se.value},[t.createElementVNode("div",Vr,[t.createVNode(gt,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:ge("vAlign")?"100%":44,"menu-width":ge("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(T)(e.locale,"vAlign"),onChange:h[34]||(h[34]=B=>O("v-align-change",B))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",Ir,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(T)(e.locale,"wrap"),onClick:h[35]||(h[35]=B=>O("wrap-toggle"))},[...h[73]||(h[73]=[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,Fr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("merge"),to:se.value},[t.createElementVNode("div",Or,[t.createElementVNode("div",Hr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:h[36]||(h[36]=B=>O("apply-merge"))},[...h[74]||(h[74]=[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,Lr),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:Z,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:h[37]||(h[37]=B=>O("update:merge-menu-open",!e.mergeMenuOpen))},[...h[75]||(h[75]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,$r),t.createVNode(zo,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":Z.value,"onUpdate:modelOpen":h[38]||(h[38]=B=>O("update:merge-menu-open",B)),onChange:h[39]||(h[39]=B=>O("merge-change",B))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("sep6"),to:se.value},[h[76]||(h[76]=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:Re("numFmt"),to:se.value},[t.createElementVNode("div",_r,[t.createElementVNode("div",zr,[t.createVNode(gt,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:ge("numFmt")?"auto":92,"menu-width":(ge("numFmt"),150),"visible-count":8,title:t.unref(T)(e.locale,"numberFormat"),"fallback-label":ke.value,align:"right",onChange:h[40]||(h[40]=B=>O("number-format-change",String(B)))},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:h[41]||(h[41]=B=>O("increase-decimals"))},[...h[77]||(h[77]=[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,Wr),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:h[42]||(h[42]=B=>O("decrease-decimals"))},[...h[78]||(h[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 18.5l-4.2-5.2h2.7V5.5h3v7.8h2.7z"})],-1)])],10,Ur)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("sep7"),to:se.value},[h[79]||(h[79]=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:Re("calc"),to:se.value},[t.createElementVNode("div",Kr,[t.createElementVNode("div",Pr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:h[43]||(h[43]=B=>O("calc-sum"))},[...h[80]||(h[80]=[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,Gr),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:te,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:h[44]||(h[44]=B=>O("update:calc-menu-open",!e.calcMenuOpen))},[...h[81]||(h[81]=[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,Yr),t.createVNode(Ko,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":te.value,disabled:e.isSingleCell,"onUpdate:modelOpen":h[45]||(h[45]=B=>O("update:calc-menu-open",B)),onChange:h[46]||(h[46]=B=>O(`calc-${B}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("sort"),to:se.value},[t.createElementVNode("div",Xr,[t.createElementVNode("div",jr,[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:h[47]||(h[47]=B=>O("apply-sort"))},[(t.openBlock(),t.createElementBlock("svg",qr,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,B=>t.createElementVNode("line",{key:B.name,x1:B.x1,y1:B.y1,x2:B.x2,y2:B.y2},null,8,Jr)),64)),t.createElementVNode("path",{d:m[e.cachedSortOrder]},null,8,Qr)]))],8,Zr),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:h[48]||(h[48]=B=>O("update:sort-menu-open",!e.sortMenuOpen))},[...h[82]||(h[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,ea),t.createVNode(Ho,{"model-open":e.sortMenuOpen,locale:e.locale,"current-sort":e.cachedSortOrder,"trigger-el":j.value,"onUpdate:modelOpen":h[49]||(h[49]=B=>O("update:sort-menu-open",B)),onChange:h[50]||(h[50]=B=>O("sort-change",B))},null,8,["model-open","locale","current-sort","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Re("find"),to:se.value},[t.createElementVNode("div",ta,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(T)(e.locale,"find"),onClick:s},[...h[83]||(h[83]=[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,la)])],8,["disabled","to"])),Me.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:S,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":le.value}]),type:"button",onClick:x},[...h[84]||(h[84]=[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:k,key:ee.value,class:t.normalizeClass(["overflow-menu",{"no-anim":P.value}]),style:t.normalizeStyle(D.value),onMousedown:h[52]||(h[52]=t.withModifiers(()=>{},["prevent"]))},null,38)),[[t.vShow,le.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-4f17f13a"]]),aa=["title"],ia={class:"tab-list"},ca=["onClick","onDblclick","onContextmenu"],sa=["value"],da={key:1,class:"tab-item__name"},ua=["title"],fa=["disabled"],ma=["title","onClick"],pa={class:"tab-list-menu__name"},ha=["title","disabled","onClick"],ga=["disabled"],ba=8,ya=ht(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),m=t.ref({left:0,bottom:0}),c=t.ref(null),g=t.computed(()=>Math.min(ba,n.sheets.length)),k=t.computed(()=>n.sheets.slice(r.value,r.value+g.value)),S=t.computed(()=>r.value>0),y=t.computed(()=>r.value+g.value<n.sheets.length),v=t.computed(()=>n.sheets.length>g.value),E=t.computed(()=>n.sheets.length>1);t.watch(()=>n.sheets.length,()=>{if(!i.value)return;const we=Math.max(0,n.sheets.length-g.value);r.value>we&&(r.value=we)});function j(we){r.value=Math.max(0,Math.min(n.sheets.length-g.value,r.value+we))}function Z(){if(i.value){i.value=!1;return}const we=a.value;if(!we)return;const me=we.getBoundingClientRect();m.value={left:me.left,bottom:window.innerHeight-me.top+4};const ye=n.activeSheetIndex;r.value=ye>=0?Math.max(0,Math.min(ye-Math.floor(g.value/2),n.sheets.length-g.value)):0,i.value=!0}function te(we){l("tab-click",we),i.value=!1}function K(we){E.value&&l("delete-sheet",we)}function b(we){var Le;if(!i.value)return;const me=we.target;if((Le=a.value)!=null&&Le.contains(me))return;const ye=document.querySelector(".tab-list-menu");ye!=null&&ye.contains(me)||(i.value=!1)}function le(we){i.value&&we.key==="Escape"&&(i.value=!1)}function P(we){i.value&&(we.preventDefault(),j(we.deltaY>0?1:-1))}function ee(){i.value=!1}function Ce(we){!i.value||we.target===c.value||ee()}const Me=t.ref(0),ge=t.ref(!1);function se(we){i.value&&(Me.value=we.touches[0].clientY,ge.value=!0)}function Re(we){if(!i.value||!ge.value)return;const me=we.touches[0].clientY-Me.value;Math.abs(me)>5&&(j(me<0?1:-1),Me.value=we.touches[0].clientY)}function Ke(){ge.value=!1}return t.watch(i,we=>{t.nextTick(()=>{var me,ye;we?(me=c.value)==null||me.addEventListener("wheel",P,{passive:!1}):(ye=c.value)==null||ye.removeEventListener("wheel",P)})}),t.onMounted(()=>{document.addEventListener("pointerdown",b),document.addEventListener("keydown",le),window.addEventListener("resize",ee),window.addEventListener("scroll",Ce,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",b),document.removeEventListener("keydown",le),window.removeEventListener("resize",ee),window.removeEventListener("scroll",Ce,!0)}),(we,me)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:me[8]||(me[8]=ye=>l("tabbar-contextmenu",ye))},[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:Z},[...me[9]||(me[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,aa),t.createElementVNode("div",ia,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(ye,Le)=>(t.openBlock(),t.createElementBlock("div",{key:ye.id,class:t.normalizeClass(["tab-item",{"tab-item--active":Le===e.activeSheetIndex}]),onClick:$e=>l("tab-click",Le),onDblclick:t.withModifiers($e=>l("tab-dblclick",Le),["prevent"]),onContextmenu:$e=>l("tab-contextmenu",{ev:$e,i:Le})},[e.renTab===Le?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:me[0]||(me[0]=$e=>l("tab-rename-input",$e.target.value)),onKeydown:me[1]||(me[1]=$e=>l("tab-rename-keydown",$e)),onBlur:me[2]||(me[2]=$e=>l("tab-rename-commit")),onClick:me[3]||(me[3]=t.withModifiers(()=>{},["stop"]))},null,40,sa)):(t.openBlock(),t.createElementBlock("span",da,t.toDisplayString(ye.name),1))],42,ca))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(T)(e.locale,"addSheet"),onClick:me[4]||(me[4]=ye=>l("add-sheet"))}," + ",8,ua),(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:m.value.left+"px",bottom:m.value.bottom+"px"}),onMousedown:me[7]||(me[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":!S.value}]),disabled:!S.value,onClick:me[5]||(me[5]=ye=>j(-1))},[...me[10]||(me[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,fa)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:c,class:"tab-list-menu__list",onTouchstart:se,onTouchmove:Re,onTouchend:Ke},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,ye=>(t.openBlock(),t.createElementBlock("div",{key:ye.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(ye)===e.activeSheetIndex}]),title:ye.name,onClick:Le=>te(e.sheets.indexOf(ye))},[t.createElementVNode("span",pa,t.toDisplayString(ye.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(Le=>K(e.sheets.indexOf(ye)),["stop"])},[...me[11]||(me[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,ha)],10,ma))),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":!y.value}]),disabled:!y.value,onClick:me[6]||(me[6]=ye=>j(1))},[...me[12]||(me[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,ga)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-ec10bade"]]),va=["placeholder","value"],Ca=["placeholder","value"],wa={class:"find-bar__chk"},ka=["checked"],Ea={class:"find-bar__chk"},Sa=["checked"],xa={class:"find-bar__count"},Ra=["title","disabled"],Ma=["title","disabled"],Ba=["disabled"],Da=["disabled"],Na=["title"],Ta=ht(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: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 c;return(c=a.value)==null?void 0:c.focus()})});function m(c){c.key==="Enter"?(c.preventDefault(),c.shiftKey?l("prev"):l("next")):c.key==="Escape"&&(c.preventDefault(),l("close"))}return(c,g)=>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:g[0]||(g[0]=k=>l("update:findText",k.target.value)),onKeydown:m},null,40,va),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(T)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:g[1]||(g[1]=k=>l("update:replaceText",k.target.value)),onKeydown:m},null,40,Ca),t.createVNode(gt,{class:"find-bar__dropdown","model-value":e.scope,options:r.value,title:t.unref(T)(e.locale,"findScope"),"onUpdate:modelValue":g[2]||(g[2]=k=>c.$emit("update:scope",k))},null,8,["model-value","options","title"]),t.createElementVNode("label",wa,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchCase,onChange:g[3]||(g[3]=k=>l("update:matchCase",k.target.checked))},null,40,ka),g[10]||(g[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",Ea,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchEntireCell,onChange:g[4]||(g[4]=k=>l("update:matchEntireCell",k.target.checked))},null,40,Sa),g[11]||(g[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",xa,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:g[5]||(g[5]=k=>l("prev"))},[...g[12]||(g[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,Ra),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(T)(e.locale,"findNext"),disabled:e.total===0,onClick:g[6]||(g[6]=k=>l("next"))},[...g[13]||(g[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,Ma),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:g[7]||(g[7]=k=>l("replace"))},t.toDisplayString(t.unref(T)(e.locale,"replace")),9,Ba),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:g[8]||(g[8]=k=>l("replace-all"))},t.toDisplayString(t.unref(T)(e.locale,"replaceAll")),9,Da),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(T)(e.locale,"findClose"),onClick:g[9]||(g[9]=k=>l("close"))},[...g[14]||(g[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,Na)],4)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-3120909b"]]),Aa={class:"nf-dialog__header"},Va={class:"nf-dialog__title"},Ia={class:"nf-dialog__body"},Fa={class:"nf-field"},Oa={class:"nf-field__label"},Ha={key:0,class:"nf-field"},La={class:"nf-field__label"},$a={key:1,class:"nf-field nf-field--inline"},_a={class:"nf-checkbox"},za={key:2,class:"nf-field"},Wa={class:"nf-field__label"},Ua={key:3,class:"nf-field"},Ka={class:"nf-field__label"},Pa={key:4,class:"nf-field"},Ga={class:"nf-field__label"},Ya={key:5,class:"nf-field"},Xa={class:"nf-field__label"},ja={key:6,class:"nf-field"},Za={class:"nf-field__label"},qa={class:"nf-field"},Ja={class:"nf-field__label"},Qa={class:"nf-dialog__footer"},ei={class:"nf-preview"},ti={class:"nf-preview__label"},li={class:"nf-preview__value"},ni={class:"nf-dialog__actions"},oi=ht(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),m=t.ref(!1),c=t.ref("$"),g=t.ref("m/d/yyyy"),k=t.ref("h:mm:ss"),S=t.ref("m/d/yyyy h:mm:ss"),y=t.ref("[h]:mm:ss"),v=t.ref(""),E=t.ref(null),j=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],Z=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],te=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],K=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],b=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],le=t.computed(()=>n.locale==="zh-CN"?[...Z,...te]:[...te,...Z]),P=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],ee=t.computed(()=>n.locale==="zh-CN"?[...K,...b]:[...b,...K]),Ce=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],Me={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"},ge=t.computed(()=>no.map(ie=>({label:T(n.locale,Me[ie]),value:ie}))),se=j.map(ie=>({label:ie.label,value:ie.value})),Re=t.computed(()=>le.value.map(ie=>({label:ie,value:ie}))),Ke=P.map(ie=>({label:ie,value:ie})),we=t.computed(()=>ee.value.map(ie=>({label:ie,value:ie}))),me=Ce.map(ie=>({label:ie,value:ie})),ye=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),Le=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),$e=t.computed(()=>i.value==="date"),G=t.computed(()=>i.value==="time"),pe=t.computed(()=>i.value==="dateTime"),p=t.computed(()=>i.value==="duration"),D=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function I(){if(i.value==="general")return $t;if(i.value==="text")return vt;if(i.value==="custom")return v.value;if(i.value==="date")return g.value;if(i.value==="time")return k.value;if(i.value==="dateTime")return S.value;if(i.value==="duration")return y.value;const ie=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?U(i.value,ie,m.value,c.value):po(n.locale,i.value,ie,m.value)}function U(ie,Te,Fe,ot){const Je=Fe?"#,##0":"0";if(ie==="currencyRounded")return ot+Je;const qe=Te>0?"."+"0".repeat(Te):"",Qe=Je+qe;return ie==="currency"?ot+Qe:`${ot}${Qe};(${ot}${Qe});${ot}"-"`}function x(ie){if(v.value=ie,Ct(ie)){i.value="general";return}if(ie==="@"){i.value="text";return}const Te=ie.replace(/\[[^\]]*\]/gi,qe=>/\[h\]/i.test(qe)?qe:"");if(/\[h\]/i.test(Te)&&!/[yd]/i.test(Te)){i.value="duration",Ce.includes(ie)&&(y.value=ie);return}const Fe=/[yd]/i.test(Te),ot=/h|s|AM\/PM/i.test(Te);if(Fe&&ot){i.value="dateTime",ee.value.includes(ie)&&(S.value=ie);return}if(Fe||/AM\/PM/i.test(Te)){ot&&!Fe?(i.value="time",P.includes(ie)&&(k.value=ie)):(i.value="date",le.value.includes(ie)&&(g.value=ie));return}if(ie.includes("%")){i.value="percent",r.value=s(ie);return}if(/E[+-]/i.test(ie)){i.value="scientific",r.value=s(ie);return}const Je=j.find(qe=>ie.startsWith(qe.value));if(ie.includes("[Red](")){i.value="financial",m.value=ie.includes(","),r.value=s(ie);return}if(Je){ie.includes("(")?(i.value="accounting",c.value=Je.value,m.value=ie.includes(","),r.value=s(ie)):/\.\d/.test(ie.slice(Je.value.length))?(i.value="currency",c.value=Je.value,m.value=ie.includes(","),r.value=s(ie)):(i.value="currencyRounded",c.value=Je.value,m.value=ie.includes(","));return}i.value="number",m.value=ie.includes(","),r.value=s(ie)}function s(ie){const Te=ie.match(/\.([0#?]+)/);return Te?Te[1].length:0}function u(){i.value!=="custom"&&(v.value=I())}function O(){}function ke(){g.value=le.value[0],k.value=P[0],S.value=ee.value[0],y.value=Ce[0]}function Ee(){a.value=!0,n.modelOpen!==void 0&&l("update:modelOpen",!0),ke(),x(n.currentFormat??""),n.isCustom&&(i.value="custom"),t.nextTick(()=>{var ie;return(ie=E.value)==null?void 0:ie.focus()})}function h(){a.value=!1,n.modelOpen!==void 0&&l("update:modelOpen",!1)}function B(){l("apply",v.value),h()}function Be(){h()}function je(ie){ie.key==="Escape"&&h()}t.watch(()=>n.modelOpen,ie=>{ie&&!a.value?Ee():!ie&&a.value&&h()});const it=t.computed(()=>Zt(n.sampleValue,v.value,n.locale));return(ie,Te)=>(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:Be,onKeydown:je},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:Te[9]||(Te[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Aa,[t.createElementVNode("span",Va,t.toDisplayString(t.unref(T)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:h},[...Te[10]||(Te[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",Ia,[t.createElementVNode("div",Fa,[t.createElementVNode("label",Oa,t.toDisplayString(t.unref(T)(e.locale,"nfCategory")),1),t.createVNode(gt,{class:"nf-field__dropdown","model-value":i.value,options:ge.value,"onUpdate:modelValue":Te[0]||(Te[0]=Fe=>i.value=Fe),onChange:u},null,8,["model-value","options"])]),D.value?(t.openBlock(),t.createElementBlock("div",Ha,[t.createElementVNode("label",La,t.toDisplayString(t.unref(T)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":Te[1]||(Te[1]=Fe=>r.value=Fe),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:u},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),ye.value?(t.openBlock(),t.createElementBlock("div",$a,[t.createElementVNode("label",_a,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":Te[2]||(Te[2]=Fe=>m.value=Fe),type:"checkbox",onChange:u},null,544),[[t.vModelCheckbox,m.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(T)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),Le.value?(t.openBlock(),t.createElementBlock("div",za,[t.createElementVNode("label",Wa,t.toDisplayString(t.unref(T)(e.locale,"nfSymbol")),1),t.createVNode(gt,{class:"nf-field__dropdown","model-value":c.value,options:t.unref(se),"onUpdate:modelValue":Te[3]||(Te[3]=Fe=>c.value=Fe),onChange:u},null,8,["model-value","options"])])):t.createCommentVNode("",!0),$e.value?(t.openBlock(),t.createElementBlock("div",Ua,[t.createElementVNode("label",Ka,t.toDisplayString(t.unref(T)(e.locale,"nfDateFormat")),1),t.createVNode(gt,{class:"nf-field__dropdown","model-value":g.value,options:Re.value,"onUpdate:modelValue":Te[4]||(Te[4]=Fe=>g.value=Fe),onChange:u},null,8,["model-value","options"])])):t.createCommentVNode("",!0),G.value?(t.openBlock(),t.createElementBlock("div",Pa,[t.createElementVNode("label",Ga,t.toDisplayString(t.unref(T)(e.locale,"nfTimeFormat")),1),t.createVNode(gt,{class:"nf-field__dropdown","model-value":k.value,options:t.unref(Ke),"onUpdate:modelValue":Te[5]||(Te[5]=Fe=>k.value=Fe),onChange:u},null,8,["model-value","options"])])):t.createCommentVNode("",!0),pe.value?(t.openBlock(),t.createElementBlock("div",Ya,[t.createElementVNode("label",Xa,t.toDisplayString(t.unref(T)(e.locale,"nfDateTime")),1),t.createVNode(gt,{class:"nf-field__dropdown","model-value":S.value,options:we.value,"onUpdate:modelValue":Te[6]||(Te[6]=Fe=>S.value=Fe),onChange:u},null,8,["model-value","options"])])):t.createCommentVNode("",!0),p.value?(t.openBlock(),t.createElementBlock("div",ja,[t.createElementVNode("label",Za,t.toDisplayString(t.unref(T)(e.locale,"nfDuration")),1),t.createVNode(gt,{class:"nf-field__dropdown","model-value":y.value,options:t.unref(me),"onUpdate:modelValue":Te[7]||(Te[7]=Fe=>y.value=Fe),onChange:u},null,8,["model-value","options"])])):t.createCommentVNode("",!0),t.createElementVNode("div",qa,[t.createElementVNode("label",Ja,t.toDisplayString(t.unref(T)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:E,"onUpdate:modelValue":Te[8]||(Te[8]=Fe=>v.value=Fe),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:O},null,544),[[t.vModelText,v.value]])])]),t.createElementVNode("div",Qa,[t.createElementVNode("div",ei,[t.createElementVNode("span",ti,t.toDisplayString(t.unref(T)(e.locale,"nfPreview")),1),t.createElementVNode("span",li,t.toDisplayString(it.value||"—"),1)]),t.createElementVNode("div",ni,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:B},t.toDisplayString(t.unref(T)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:h},t.toDisplayString(t.unref(T)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-c9c08f15"]]),ri={class:"sort-confirm__header"},ai={class:"sort-confirm__title"},ii={class:"sort-confirm__body"},ci={class:"sort-confirm__message"},si={class:"sort-confirm__options"},di={class:"sort-confirm__option"},ui={class:"sort-confirm__option"},fi={class:"sort-confirm__footer"},mi=ht(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,v=>{v&&!a.value?m():!v&&a.value&&c()});function m(){i.value=!0,a.value=!0,n.modelOpen!==void 0&&l("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 c(){a.value=!1,n.modelOpen!==void 0&&l("update:modelOpen",!1)}function g(){y()}function k(v){v.key==="Escape"&&y()}function S(){l("confirm",i.value),c()}function y(){l("cancel"),c()}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:g,onKeydown:k},[t.createElementVNode("div",{ref_key:"dialogRef",ref:r,class:"sort-confirm",onMousedown:E[2]||(E[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",ri,[t.createElementVNode("span",ai,t.toDisplayString(t.unref(T)(e.locale,"sortReminderTitle")),1),t.createElementVNode("button",{class:"sort-confirm__close",type:"button",onClick:y},[...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",ii,[t.createElementVNode("p",ci,t.toDisplayString(t.unref(T)(e.locale,"sortReminderMessage")),1),t.createElementVNode("div",si,[t.createElementVNode("label",di,[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",ui,[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",fi,[t.createElementVNode("button",{class:"sort-confirm__btn sort-confirm__btn--primary",type:"button",onClick:S},t.toDisplayString(t.unref(T)(e.locale,"sort")),1),t.createElementVNode("button",{class:"sort-confirm__btn",type:"button",onClick:y},t.toDisplayString(t.unref(T)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-09f7a339"]]);function Xe(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 Hl(e){let o=0;for(let n=0;n<e.length;n++)o=o*26+(e.toUpperCase().charCodeAt(n)-64);return o-1}function qt(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 Ll(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 ll(e,o){return`${e},${o}`}function ul(e,o,n){const l=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!l)return null;const a=Hl(l[1]),i=parseInt(l[2],10)-1;return a<0||a>=o||i<0||i>=n?null:{col:a,row:i}}function Jt(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 an=[{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)"}],pi={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 hi(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 gi(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=pi[l];if(!a)return{ok:!1,name:l};const i=n[2];if(!hi(i))return{ok:!1,name:l};const r=Qt(i),m=r.length===1&&r[0].trim()===""?0:r.length;return m<a.min||m>a.max?{ok:!1,name:l}:r.some(c=>c.trim()==="")?{ok:!1,name:l}:{ok:!0,name:l}}function nl(e,o,n){const l=e.split(":");if(l.length!==2)return null;const a=ul(l[0],o,n),i=ul(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 cn(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 Nt(e,o,n,l,a){const i=n[ll(e,o)];if(!i)return"";const r=i.value;return r.startsWith("=")?dn(ll(e,o),n,l,a):cn(r)}function sn(e,o,n,l,a){const i=Nt(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 fl=new Map,yl=new Set;function vl(){fl.clear(),yl.clear()}function dn(e,o,n,l){return bi(e,o,n,l,0)}function bi(e,o,n,l,a){if(yl.has(e))return null;if(fl.has(e))return fl.get(e);yl.add(e);const i=o[e];let r;if(!i)r=null;else{const m=i.value;if(!m.startsWith("="))r=cn(m);else{const c=m.slice(1).trim(),g=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(c);r=g?pn(g[1].toUpperCase(),g[2],o,n,l,a+1):ut(c,o,n,l,a+1)}}return yl.delete(e),fl.set(e,r),r}function $l(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function un(e,o){return typeof e=="number"&&typeof o=="number"?e===o:String(e??"")===String(o??"")}function fn(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 mn(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 yi(e,o,n,l,a,i){let m=o.trim();m.length>=2&&(m[0]==='"'&&m[m.length-1]==='"'||m[0]==="'"&&m[m.length-1]==="'")&&(m=m.slice(1,-1));const c=/^([<>=]+)([\s\S]*)$/.exec(m);if(c){const k=c[1],S=mn(c[2]);return fn(e,S,k)}const g=mn(m);return un(e,g)}function vi(e,o,n,l,a){const i=e.trim(),r=["<=",">=","<>"];let m=null,c=-1,g=null,k=0;for(let y=0;y<i.length;y++){const v=i[y];if(g){v===g&&(i[y+1]===g?y++:g=null);continue}if(v==='"'||v==="'"){g=v;continue}if(v==="("&&k++,v===")"&&k--,k===0&&(v==="<"||v===">"||v==="=")){const E=i.slice(y,y+2);m=r.includes(E)?E:v,c=y;break}}if(m&&c>=0){const y=i.slice(0,c).trim(),v=i.slice(c+m.length).trim(),E=ut(y,o,n,l,a),j=ut(v,o,n,l,a);return fn(E,j,m)}const S=ut(i,o,n,l,a);return $l(S)}function Qt(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 ut(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 m=Ci(i);if(m.length===0)return null;let c=0;const g=()=>{let v=k();for(;c<m.length;){const E=m[c];if(E.type==="op"&&(E.val==="+"||E.val==="-"))c++,v=_l(v,k(),E.val);else break}return v},k=()=>{let v=S();for(;c<m.length;){const E=m[c];if(E.type==="op"&&(E.val==="*"||E.val==="/"))c++,v=_l(v,S(),E.val);else break}return v},S=()=>{const v=m[c];return v&&v.type==="op"&&v.val==="-"?(c++,_l(0,S(),"-")):v&&v.type==="op"&&v.val==="+"?(c++,S()):y()},y=()=>{const v=m[c];if(!v)return null;if(v.type==="num")return c++,Number(v.val);if(v.type==="str")return c++,v.val;if(v.type==="lp"){c++;const E=g();return m[c]&&m[c].type==="rp"&&c++,E}if(v.type==="ref"){c++;const E=ul(v.val,n,l);return E?Nt(E.col,E.row,o,n,l):null}if(v.type==="func"){const E=v.val.toUpperCase();if(c++,m[c]&&m[c].type==="lp"){const j=m[c];let Z=0,te=null,K=c;for(;K<m.length;K++)if(m[K].type==="lp")Z++;else if(m[K].type==="rp"&&(Z--,Z===0)){te=m[K];break}if(te){const b=i.slice(j.start+1,te.start);return c=K+1,pn(E,b,o,n,l,a+1)}}return null}return c++,null};return g()}function Ci(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 _l(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 pn(e,o,n,l,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=nl(o.trim(),l,a);if(!r)return null;if(e==="COUNT"){let c=0;for(let g=r.sc;g<=r.ec;g++)for(let k=r.sr;k<=r.er;k++)typeof Nt(g,k,n,l,a)=="number"&&c++;return c}let m=0;for(let c=r.sc;c<=r.ec;c++)for(let g=r.sr;g<=r.er;g++)m+=sn(c,g,n,l,a);if(isNaN(m))return null;if(e==="AVERAGE"){const c=(r.ec-r.sc+1)*(r.er-r.sr+1);return c===0?null:m/c}return m}case"IF":{const r=Qt(o);if(r.length<3)return null;const m=vi(r[0],n,l,a,i);return ut(m?r[1]:r[2],n,l,a,i)}case"VLOOKUP":{const r=Qt(o);if(r.length<3)return null;const m=ut(r[0],n,l,a,i),c=nl(r[1].trim(),l,a);if(!c)return null;const g=ut(r[2],n,l,a,i),k=typeof g=="number"?g:parseFloat(String(g));if(isNaN(k))return null;const S=c.sc+(k-1);if(S<c.sc||S>c.ec)return null;if(r.length>=4?$l(ut(r[3],n,l,a,i)):!1){let v=-1,E=-1/0;for(let j=c.sr;j<=c.er;j++){const Z=Nt(c.sc,j,n,l,a);typeof Z=="number"&&typeof m=="number"&&Z<=m&&Z>E&&(E=Z,v=j)}return v>=0?Nt(S,v,n,l,a):null}for(let v=c.sr;v<=c.er;v++){const E=Nt(c.sc,v,n,l,a);if(un(E,m))return Nt(S,v,n,l,a)}return null}case"CONCATENATE":{const r=Qt(o);let m="";for(const c of r){const g=ut(c,n,l,a,i);m+=g===null?"":typeof g=="number"?String(g):g}return m}case"MAX":case"MIN":{const r=nl(o.trim(),l,a);if(!r)return null;const m=[];for(let c=r.sc;c<=r.ec;c++)for(let g=r.sr;g<=r.er;g++){const k=Nt(c,g,n,l,a);typeof k=="number"&&m.push(k)}return m.length===0?null:e==="MAX"?Math.max(...m):Math.min(...m)}case"STDEV":{const r=nl(o.trim(),l,a);if(!r)return null;const m=[];for(let S=r.sc;S<=r.ec;S++)for(let y=r.sr;y<=r.er;y++){const v=Nt(S,y,n,l,a);typeof v=="number"&&m.push(v)}const c=m.length;if(c<2)return null;const g=m.reduce((S,y)=>S+y,0)/c,k=m.reduce((S,y)=>S+Math.pow(y-g,2),0)/(c-1);return Math.sqrt(k)}case"SIN":{const r=Qt(o);if(r.length!==1)return null;const m=ut(r[0],n,l,a,i);return typeof m!="number"?null:Math.sin(m)}case"SUMIF":{const r=Qt(o);if(r.length<2||r.length>3)return null;const m=nl(r[0].trim(),l,a);if(!m)return null;const c=r.length===3?nl(r[2].trim(),l,a):m;if(!c)return null;let g=0;for(let k=m.sr;k<=m.er;k++)for(let S=m.sc;S<=m.ec;S++){const y=Nt(S,k,n,l,a);yi(y,r[1])&&(g+=sn(c.sc+(S-m.sc),c.sr+(k-m.sr),n,l,a))}return g}case"PMT":{const r=Qt(o);if(r.length<3||r.length>5)return null;const m=ut(r[0],n,l,a,i),c=ut(r[1],n,l,a,i),g=ut(r[2],n,l,a,i);if(typeof m!="number"||typeof c!="number"||typeof g!="number")return null;const k=r.length>=4?ut(r[3],n,l,a,i):0,S=typeof k=="number"?k:0,y=r.length>=5?ut(r[4],n,l,a,i):0,v=$l(y)?1:0;if(m===0)return c===0?null:-(g+S)/c;const E=Math.pow(1+m,c);return-(S+g*E)*m/((1+m*v)*(E-1))}default:return null}}function zl(e,o,n){const l=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=ul(i[1],o,n);if(r)if(i[2]){const m=ul(i[2],o,n);if(!m)continue;for(let c=Math.min(r.col,m.col);c<=Math.max(r.col,m.col);c++)for(let g=Math.min(r.row,m.row);g<=Math.max(r.row,m.row);g++)l.push(ll(c,g))}else l.push(ll(r.col,r.row))}return l}function hn(e,o,n,l,a){const i=n[ll(e,o)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const m=dn(ll(e,o),n,l,a);return m===null?"#ERROR":String(m)}function wi(e,o,n,l,a,i){return o===0&&n===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,m,c,g,k)=>{const S=m?Hl(c):Hl(c)+o,y=g?parseInt(k,10)-1:parseInt(k,10)-1+n;let v;S<0?v="A":S>=l?v=i(l-1):v=i(S);let E;return y<0?E="1":y>=a?E=String(a):E=String(y+1),(m||"")+v+(g||"")+E})}class ki{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(),fl.clear();for(const[a,i]of Object.entries(o))if(i.value.startsWith("=")){const r=zl(i.value.slice(1),n,l);this.set(a,r)}}}const Ei={class:"ifn-dialog__header"},Si={class:"ifn-dialog__title"},xi={class:"ifn-dialog__body"},Ri={class:"ifn-dialog__field"},Mi={class:"ifn-dialog__label"},Bi={key:0,class:"ifn-dialog__desc"},Di={class:"ifn-dialog__field"},Ni={class:"ifn-dialog__label"},Ti={class:"ifn-dialog__footer"},Ai=["disabled"],Vi=ht(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(""),m=t.ref(null),c=t.ref(null),g={SUM:"fnDescSum",AVERAGE:"fnDescAverage",COUNT:"fnDescCount",IF:"fnDescIf",VLOOKUP:"fnDescVlookup",CONCATENATE:"fnDescConcatenate",MAX:"fnDescMax",MIN:"fnDescMin",SIN:"fnDescSin",SUMIF:"fnDescSumif",PMT:"fnDescPmt",STDEV:"fnDescStdev"},k=t.computed(()=>an.map(P=>({label:P.name,value:P.name}))),S=t.computed(()=>{const P=String(i.value??"");return P?T(n.locale,g[P]??""):""}),y=t.computed(()=>gi(r.value)),v=t.computed(()=>i.value===""||i.value===null||!r.value.trim()||!y.value.ok?!1:y.value.name===String(i.value).toUpperCase());t.watch(()=>n.modelOpen,P=>{P&&!a.value?E():!P&&a.value&&j()});function E(){r.value="",i.value="",a.value=!0,n.modelOpen!==void 0&&l("update:modelOpen",!0),t.nextTick(()=>{const P=m.value;if(P)try{P.focus({preventScroll:!0}),P.setSelectionRange(P.value.length,P.value.length)}catch{}})}function j(){a.value=!1,n.modelOpen!==void 0&&l("update:modelOpen",!1)}function Z(P){i.value=P;const ee=an.find(Ce=>Ce.name===String(P));ee&&(r.value="",te(ee.snippet))}function te(P){const ee=r.value,Ce=m.value,Me=Ce?Ce.selectionStart??ee.length:ee.length,ge=Ce?Ce.selectionEnd??ee.length:ee.length,se=ee.trim()?P:"="+P;r.value=ee.slice(0,Me)+se+ee.slice(ge),t.nextTick(()=>{const Re=m.value;if(!Re)return;const Ke=Me+se.length;try{Re.focus({preventScroll:!0}),Re.setSelectionRange(Ke,Ke)}catch{}})}function K(){l("insert",r.value),j()}function b(){l("cancel"),j()}function le(P){P.key==="Escape"&&(P.stopPropagation(),b())}return(P,ee)=>(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(b,["self"]),onKeydown:le},[t.createElementVNode("div",{ref_key:"dialogRef",ref:c,class:"ifn-dialog",onMousedown:ee[1]||(ee[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Ei,[t.createElementVNode("span",Si,t.toDisplayString(t.unref(T)(e.locale,"insertFunctionTitle")),1),t.createElementVNode("button",{class:"ifn-dialog__close",type:"button",onClick:b},[...ee[2]||(ee[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",xi,[t.createElementVNode("div",Ri,[t.createElementVNode("label",Mi,t.toDisplayString(t.unref(T)(e.locale,"insertFunctionSelectLabel")),1),t.createVNode(gt,{class:"ifn-dialog__dropdown","model-value":i.value,options:k.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":Z},null,8,["model-value","options","search-placeholder","fallback-label","title"]),S.value?(t.openBlock(),t.createElementBlock("div",Bi,t.toDisplayString(S.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",Di,[t.createElementVNode("label",Ni,t.toDisplayString(t.unref(T)(e.locale,"insertFunctionFormulaLabel")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:m,"onUpdate:modelValue":ee[0]||(ee[0]=Ce=>r.value=Ce),class:"ifn-dialog__textarea",spellcheck:"false"},null,512),[[t.vModelText,r.value]])])]),t.createElementVNode("div",Ti,[t.createElementVNode("button",{class:"ifn-dialog__btn ifn-dialog__btn--primary",type:"button",disabled:!v.value,onClick:K},t.toDisplayString(t.unref(T)(e.locale,"insertFunctionBtn")),9,Ai),t.createElementVNode("button",{class:"ifn-dialog__btn",type:"button",onClick:b},t.toDisplayString(t.unref(T)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-2eec9073"]]);class Ii{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 m=o[r].styleId??0;n.add(m)}const l=new Map,a=[{}];l.set(0,0);const i=Array.from(n).sort((r,m)=>r-m);for(const r of i)if(r!==0&&r<this.styles.length){const m=a.length;l.set(r,m),a.push(this.styles[r])}for(const r in o){const m=o[r],c=m.styleId??0,g=l.get(c);g!==void 0&&g!==c&&(m.styleId=g)}this.styles=a,this.index=new Map;for(let r=0;r<this.styles.length;r++){const m=this.stableKey(this.styles[r]);this.index.set(m,r)}return a}}function Fi(e,o){if(!e)return null;const n=e.styleId;return n===void 0||n===0?null:o[n]??null}function gn(e){const o=new Ii,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 Oi(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 Hi{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 m=r.borderId??0;n.add(m)}const l=new Map,a=[{}];l.set(0,0);const i=Array.from(n).sort((r,m)=>r-m);for(const r of i)if(r!==0&&r<this.borders.length){const m=a.length;l.set(r,m),a.push(this.borders[r])}for(const r of o){const m=r.borderId??0,c=l.get(m);c!==void 0&&c!==m&&(r.borderId=c)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const m=this.stableKey(this.borders[r]);this.index.set(m,r)}return a}}function Li(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 m=l.get(r);if(m)return m[o]}function $i(e,o,n,l,a,i){const r=l[e.styleId??0]??{},m=r.borderId??0,c=m>0?a.get(m):{},g={top:c.top?{...c.top}:void 0,right:c.right?{...c.right}:void 0,bottom:c.bottom?{...c.bottom}:void 0,left:c.left?{...c.left}:void 0};n?g[o]={...n}:g[o]=void 0;const k=a.getId(g),S={...r};k===0?delete S.borderId:S.borderId=k,delete S.borderTopWidth,delete S.borderBottomWidth,delete S.borderLeftWidth,delete S.borderRightWidth,delete S.borderColor,Object.keys(S).length===0?e.styleId=0:e.styleId=i(S)}function bn(e){const o=new Hi,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 m=o.getId(r),c={...l};delete c.borderTopWidth,delete c.borderBottomWidth,delete c.borderLeftWidth,delete c.borderRightWidth,delete c.borderColor,m>0?c.borderId=m:delete c.borderId,n.push(c)}return{styles:n,borders:o.getBorders()}}function _i(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({}),m=t.reactive([{}]),c=t.reactive([{}]);let g=new Map;g.set("{}",0);let k=new Map;k.set("{}",0);function S(C){const V=Object.keys(C).sort(),F={};for(const Q of V)F[Q]=C[Q];return JSON.stringify(F)}function y(C){const V=["top","right","bottom","left"],F={};for(const Q of V){const oe=C[Q];if(oe&&(oe.width!==void 0||oe.color!==void 0||oe.style!==void 0)){const d={};oe.width!==void 0&&(d.width=oe.width),oe.color!==void 0&&(d.color=oe.color),oe.style!==void 0&&(d.style=oe.style),F[Q]=d}}return JSON.stringify(F)}function v(C){if(!C||Object.keys(C).length===0)return 0;const V=S(C),F=g.get(V);if(F!==void 0)return F;const Q=m.length;return m.push(Object.freeze({...C})),g.set(V,Q),Q}function E(C){return Fi(C,m)}function j(){g=new Map;for(let C=0;C<m.length;C++)g.set(S(m[C]),C)}function Z(C){m.splice(0,m.length,...C),j()}function te(C){if(!C||!C.top&&!C.right&&!C.bottom&&!C.left)return 0;const V=y(C),F=k.get(V);if(F!==void 0)return F;const Q=c.length;return c.push(Object.freeze({top:C.top?Object.freeze({...C.top}):void 0,right:C.right?Object.freeze({...C.right}):void 0,bottom:C.bottom?Object.freeze({...C.bottom}):void 0,left:C.left?Object.freeze({...C.left}):void 0})),k.set(V,Q),Q}function K(C){return c[C]??{}}function b(){k=new Map;for(let C=0;C<c.length;C++)k.set(y(c[C]),C)}function le(C){c.splice(0,c.length,...C),b()}function P(C,V){return Li(C,V,m,{get:F=>c[F]??{}})}function ee(C,V){const F=x(C,V);return F?F.anchor:null}function Ce(C,V,F,Q){const oe=x(C,V),d=x(F,Q);return!oe||!d?!1:oe.anchor===d.anchor}const Me=t.reactive({}),ge=new ki,se=t.ref(null),Re=t.ref("cell"),Ke=t.ref({col:0,row:0}),we=t.ref(null),me=t.ref(""),ye=t.ref(new Array(a).fill(100)),Le=t.ref(new Array(i).fill(void 0)),$e=t.ref(0),G=t.ref(0),pe=(24-Ht)/2,p=new Map;let D=null;function I(C,V,F,Q){const oe=`${Q} ${F} ${V}px ${C}`,d=p.get(oe);if(d)return d;if(!D){if(typeof document>"u")return{ascent:V*.88,descent:V*.28};D=document.createElement("canvas")}const R=D.getContext("2d");if(!R)return{ascent:V*.88,descent:V*.28};R.font=oe;const _=R.measureText(" "),$=_.fontBoundingBoxAscent,z=_.fontBoundingBoxDescent;if(typeof $=="number"&&typeof z=="number"&&$>0&&z>0){const at={ascent:$,descent:z};return p.set(oe,at),at}const H=["M","中","y","Ä","0"];let ne=0,ae=0;for(const at of H){const wt=R.measureText(at),Vt=wt.actualBoundingBoxAscent||0,kt=wt.actualBoundingBoxDescent||0;Vt>ne&&(ne=Vt),kt>ae&&(ae=kt)}const ze=Math.max(ne,V*.88),lt=Math.max(ae,V*.28),rt={ascent:ze,descent:lt};return p.set(oe,rt),rt}let U=(C,V)=>`${C},${V}`,x=()=>null,s=()=>Ht,u=t.computed(()=>[0]),O=()=>24,ke=(C,V,F,Q)=>({startCol:Math.min(C,F),startRow:Math.min(V,Q),endCol:Math.max(C,F),endRow:Math.max(V,Q)});function Ee(C,V){const F=E(r[U(C,V)]),Q=s(C,V),oe=typeof(F==null?void 0:F.fontFamily)=="string"&&F.fontFamily?F.fontFamily:sl,d=(F==null?void 0:F.fontWeight)==="bold"?"bold":"normal",R=(F==null?void 0:F.fontStyle)==="italic"?"italic":"normal";return I(oe,Q,d,R)}function h(C,V,F,Q){if(!V)return[""];const oe=V.split(`
2
- `),d=[];for(const R of oe)if(!Q||F<=0)d.push(R);else{let _="";for(let $=0;$<R.length;$++){const z=R[$],H=_+z;C.measureText(H).width>F&&_?(d.push(_),_=z):_=H}d.push(_)}return d}function B(C,V){const F=E(r[U(C,V)]);return typeof(F==null?void 0:F.fontSize)=="number"&&F.fontSize>0?F.fontSize:Ht}s=B;const Be=t.computed(()=>{const C=[0];for(let V=0;V<a;V++)C.push(C[V]+ye.value[V]);return C});u=Be;const je={w:800,h:600};let it=()=>{};function ie(C){const V=Le.value[C];if(V!=null&&V>0)return V;let F,Q,oe=1;const d=D?D.getContext("2d"):null,R=I(sl,Ht,"normal","normal");F=R.ascent,Q=R.descent;for(let H=0;H<a;H++){const ne=B(H,C),ae=E(r[U(H,C)]),ze=typeof(ae==null?void 0:ae.fontFamily)=="string"&&ae.fontFamily?ae.fontFamily:sl,lt=(ae==null?void 0:ae.fontWeight)==="bold"?"bold":"normal",rt=(ae==null?void 0:ae.fontStyle)==="italic"?"italic":"normal",at=I(ze,ne,lt,rt);at.ascent>F&&(F=at.ascent),at.descent>Q&&(Q=at.descent);const wt=typeof(ae==null?void 0:ae.numberFormat)=="string"?ae.numberFormat:"",Vt=Pt(H,C),kt=Zt(Vt,wt,l.value);if(kt){const ml=(ae==null?void 0:ae.wrap)==="wrap";let Gt;if(ml&&d){d.font=`${rt} ${lt} ${ne}px ${ze}`;const ol=x(H,C);let pl;ol&&H===ol.range.startCol&&C===ol.range.startRow?pl=u.value[ol.range.endCol+1]-u.value[H]:pl=ye.value[H],Gt=h(d,kt,Math.max(0,pl-10),!0).length,Gt>oe&&(oe=Gt)}else Gt=kt.split(`
3
- `).length,Gt>oe&&(oe=Gt)}}const _=F+Q,$=pe*2+oe*_;return Math.min(500,Math.max(24,Math.round($)))}O=ie;function Te(C){return Le.value[C]===void 0}const Fe=t.computed(()=>{const C=[0];for(let V=0;V<i;V++)C.push(C[V]+O(V));return C}),ot=t.computed(()=>Be.value[a]),Je=t.computed(()=>Fe.value[i]);function qe(C,V){return`${C},${V}`}U=qe;function Qe(C){Reflect.deleteProperty(r,C)}function ct(C,V){Re.value="cell";const F=x(C,V);F?(Ke.value={col:F.range.startCol,row:F.range.startRow},se.value={...F.range}):(Ke.value={col:C,row:V},se.value={startCol:C,startRow:V,endCol:C,endRow:V})}function bt(C,V,F,Q,oe="cell"){const d=x(C,V);if(Ke.value=d?{col:d.range.startCol,row:d.range.startRow}:{col:C,row:V},Re.value=oe,oe==="row"||oe==="col"){const R=Math.min(C,F),_=Math.max(C,F),$=Math.min(V,Q),z=Math.max(V,Q);se.value={startCol:R,startRow:$,endCol:_,endRow:z}}else se.value=ke(C,V,F,Q)}function yt(){bt(0,0,a-1,i-1,"all")}function Tt(C,V){const F=se.value;return F?(Re.value==="cell"||Re.value==="all",C>=F.startCol&&C<=F.endCol&&V>=F.startRow&&V<=F.endRow):!1}function At(C,V){return Tt(C,V)}function xt(C,V){for(const F in Me){const Q=Me[F];if(Q&&C>=Q.startCol&&C<=Q.endCol&&V>=Q.startRow&&V<=Q.endRow)return{range:Q,anchor:F}}return null}x=xt;function mt(C,V){return Me[qe(C,V)]!==void 0}function Rt(C,V){const F=x(C,V);if(F&&C===F.range.startCol&&V===F.range.startRow){const Q=Be.value[F.range.endCol+1]-Be.value[C],oe=Fe.value[F.range.endRow+1]-Fe.value[V];return{w:Q,h:oe}}return{w:ye.value[C],h:O(V)}}function Mt(C,V,F,Q){let oe=Math.min(C,F),d=Math.max(C,F),R=Math.min(V,Q),_=Math.max(V,Q),$=!0;for(;$;){$=!1;for(const z in Me){const H=Me[z];if(!H)continue;H.startCol<=d&&H.endCol>=oe&&H.startRow<=_&&H.endRow>=R&&(H.startCol<oe&&(oe=H.startCol,$=!0),H.endCol>d&&(d=H.endCol,$=!0),H.startRow<R&&(R=H.startRow,$=!0),H.endRow>_&&(_=H.endRow,$=!0))}}return{startCol:oe,startRow:R,endCol:d,endRow:_}}ke=Mt;function Kt(C,V){var F;return((F=r[qe(C,V)])==null?void 0:F.value)??""}function Pt(C,V){return vl(),hn(C,V,r,a,i)}function A(C,V,F){var _,$;const Q=qe(C,V);if(vl(),F===""||F==null){ge.clear(Q);const z=(_=r[Q])==null?void 0:_.styleId;z!==void 0&&z>0?r[Q]={value:"",styleId:z}:Qe(Q),ge.markDirty(Q);return}const oe=String(F);if(!oe.startsWith("=")){const z=E(r[Q]),H=typeof(z==null?void 0:z.numberFormat)=="string"?z.numberFormat:"";if(Ct(H)){const ne=Fl(oe,l.value);if(ne){const ze={...z??{},numberFormat:ne.format};r[Q]={value:String(ne.serial),styleId:v(ze)},ge.clear(Q),ge.markDirty(Q);return}const ae=mo(oe,l.value);if(ae){const ze={...z??{},numberFormat:ae.format};r[Q]={value:String(ae.num),styleId:v(ze)},ge.clear(Q),ge.markDirty(Q);return}}}const d=($=r[Q])==null?void 0:$.styleId,R={value:oe};d!==void 0&&d>0&&(R.styleId=d),r[Q]=R,oe.startsWith("=")?ge.set(Q,zl(oe.slice(1),a,i)):ge.clear(Q),ge.markDirty(Q)}function N(C,V,F,Q){for(let oe=C;oe<=V;oe++)for(let d=F;d<=Q;d++){const R=qe(oe,d);ge.clear(R),Qe(R),ge.markDirty(R)}}let W=()=>{};function ue(C){we.value||(we.value={...Ke.value},C!==void 0?me.value=C:me.value||(me.value=Kt(Ke.value.col,Ke.value.row)))}function L(){we.value&&(W(),A(we.value.col,we.value.row,me.value),we.value=null,me.value="")}function X(){we.value=null,me.value=""}function fe(C,V){const F=Ke.value;let Q=Math.max(0,Math.min(a-1,F.col+C)),oe=Math.max(0,Math.min(i-1,F.row+V));const d=x(F.col,F.row),R=x(Q,oe);d&&R&&d.anchor===R.anchor&&(C>0?Q=d.range.endCol+1:C<0&&(Q=d.range.startCol-1),V>0?oe=d.range.endRow+1:V<0&&(oe=d.range.startRow-1),Q=Math.max(0,Math.min(a-1,Q)),oe=Math.max(0,Math.min(i-1,oe))),ct(Q,oe)}function re(C,V){const F=Math.max(0,je.w-52-11),Q=Math.max(0,je.h-24-11),oe=Be.value[C],d=Fe.value[V],R=x(C,V),_=R?Be.value[R.range.endCol+1]-Be.value[C]:ye.value[C],$=R?Fe.value[R.range.endRow+1]-Fe.value[V]:O(V);let z=$e.value,H=G.value;oe<z?z=oe:oe+_>z+F&&(z=oe+_-F),d<H?H=d:d+$>H+Q&&(H=d+$-Q),it(z,H)}function Se(C){const V=Be.value;if(C<0||C>=V[a])return-1;let F=0,Q=a-1;for(;F<Q;){const oe=F+Q+1>>1;V[oe]<=C?F=oe:Q=oe-1}return F}function Ie(C){const V=Fe.value;if(C<0||C>=V[i])return-1;let F=0,Q=i-1;for(;F<Q;){const oe=F+Q+1>>1;V[oe]<=C?F=oe:Q=oe-1}return F}const Oe={props:n,locale:l,colCount:a,rowCount:i,cells:r,styles:m,borders:c,merges:Me,formulaDeps:ge,selection:se,activeCell:Ke,editingCell:we,editValue:me,colWidths:ye,rowHeights:Le,scrollX:$e,scrollY:G,BASE_CELL_VPAD:pe,fontMetricsCache:p,fontMetricsCanvas:D,measureFontMetrics:I,_getFontMetricsForCell:Ee,getWrappedLines:h,cellFontSize:B,colPositions:Be,getRowHeight:ie,_isAutoRow:Te,rowPositions:Fe,totalWidth:ot,totalHeight:Je,selectCell:ct,selectRange:bt,selectAll:yt,isSelected:Tt,isCellSelected:At,selectionMode:Re,cellKey:qe,delCell:Qe,findMerge:xt,_isMergeAnchor:mt,_mergedSpan:Rt,expandSelectionForMerges:Mt,getCellRaw:Kt,getCellValue:Pt,setCellValue:A,clearCellsInRange:N,startEdit:ue,commitEdit:L,cancelEdit:X,moveActive:fe,ensureVisible:re,hitCol:Se,hitRow:Ie,registerStyle:v,resolveStyle:E,rebuildStyleIndex:j,syncStyles:Z,registerBorder:te,resolveBorder:K,rebuildBorderIndex:b,syncBorders:le,getCellBorderSide:P,getMergeOwner:ee,isSameMergeInternal:Ce,viewSize:je,findHighlight:(C,V)=>null};return W=()=>{var C;return(C=Oe.saveUndo)==null?void 0:C.call(Oe)},it=(C,V)=>{var F;return(F=Oe.clampScroll)==null?void 0:F.call(Oe,C,V)},Oe}function zi(e,o){const n=t.ref([]),l=t.ref([]);function a(d){return Oi(d)}function i(){return o.saveSheet(),{sheets:o.sheets.value.map(d=>({id:d.id,name:d.name,cells:a(d.cells),styles:[...d.styles],borders:d.borders?[...d.borders]:[{}],merges:d.merges?{...d.merges}:{},selection:d.selection?{...d.selection}:null,activeCell:d.activeCell?{...d.activeCell}:{col:0,row:0},scrollX:d.scrollX,scrollY:d.scrollY,colWidths:[...d.colWidths],rowHeights:[...d.rowHeights]})),styles:[...e.styles],activeSheetIndex:o.activeSheetIndex.value}}function r(d){o.sheets.value=d.sheets.map(R=>({...R,cells:a(R.cells),styles:[...R.styles],borders:R.borders?[...R.borders]:[{}]})),o.loadSheet(Math.max(0,Math.min(d.activeSheetIndex,o.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function m(){const d=i(),R=n.value[n.value.length-1];R&&JSON.stringify(R)===JSON.stringify(d)||(n.value.push(d),l.value=[],n.value.length>50&&n.value.shift())}e.saveUndo=m;function c(){var d;n.value.length&&(l.value.push(i()),r(n.value.pop()),(d=e.scheduleRender)==null||d.call(e),t.nextTick(()=>{var R;return(R=e.emitModelData)==null?void 0:R.call(e)}))}function g(){var d;l.value.length&&(n.value.push(i()),r(l.value.pop()),(d=e.scheduleRender)==null||d.call(e),t.nextTick(()=>{var R;return(R=e.emitModelData)==null?void 0:R.call(e)}))}const k=t.computed(()=>n.value.length>0),S=t.computed(()=>l.value.length>0),y=t.computed(()=>!!e.selection.value),v=t.ref(null);function E(){var _;const d=e.selection.value;if(!d)return;const R={};for(let $=d.startCol;$<=d.endCol;$++)for(let z=d.startRow;z<=d.endRow;z++)R[`${$-d.startCol},${z-d.startRow}`]=((_=e.cells[e.cellKey($,z)])==null?void 0:_.styleId)??0;v.value={styles:R}}function j(){var _,$,z;const d=v.value,R=e.selection.value;if(!(!d||!R)){m();for(let H=R.startCol;H<=R.endCol;H++)for(let ne=R.startRow;ne<=R.endRow;ne++){const ae=e.findMerge(H,ne);if(ae&&(H!==ae.range.startCol||ne!==ae.range.startRow))continue;const ze=d.styles[`${H-R.startCol},${ne-R.startRow}`]??0,lt=e.cellKey(H,ne),rt=((_=e.cells[lt])==null?void 0:_.value)??"";if(rt===""&&ze===0)e.delCell(lt);else{const at={value:rt};ze>0&&(at.styleId=ze),e.cells[lt]=at}}v.value=null,($=e.scheduleRender)==null||$.call(e),(z=e.emitModelData)==null||z.call(e)}}function Z(){var R,_,$;const d=e.selection.value;if(d){m();for(let z=d.startCol;z<=d.endCol;z++)for(let H=d.startRow;H<=d.endRow;H++){const ne=e.findMerge(z,H);if(ne&&(z!==ne.range.startCol||H!==ne.range.startRow))continue;const ae=e.cellKey(z,H),ze=((R=e.cells[ae])==null?void 0:R.value)??"";ze===""?e.delCell(ae):e.cells[ae]={value:ze}}(_=e.scheduleRender)==null||_.call(e),($=e.emitModelData)==null||$.call(e)}}const te=t.computed(()=>Tn.map(d=>({...d,label:d.value===""?T(e.locale.value,"fontDefault"):d.label}))),K=t.computed(()=>An.map(d=>({...d,label:String(d.value)}))),b="\0",le=t.computed(()=>{const d=e.selection.value;if(!d)return"";let R,_=!1;for(let $=d.startCol;$<=d.endCol&&!_;$++)for(let z=d.startRow;z<=d.endRow&&!_;z++){const H=e.findMerge($,z);if(H&&($!==H.range.startCol||z!==H.range.startRow))continue;const ne=e.resolveStyle(e.cells[e.cellKey($,z)]),ae=typeof(ne==null?void 0:ne.fontFamily)=="string"?ne.fontFamily:"";R===void 0?R=ae:ae!==R&&(_=!0)}return _?b:R??""}),P=t.computed(()=>{const d=e.selection.value;if(!d)return Ht;let R,_=!1;for(let $=d.startCol;$<=d.endCol&&!_;$++)for(let z=d.startRow;z<=d.endRow&&!_;z++){const H=e.findMerge($,z);if(H&&($!==H.range.startCol||z!==H.range.startRow))continue;const ne=e.cellFontSize($,z);R===void 0?R=ne:ne!==R&&(_=!0)}return _?0:R??Ht});function ee(d,R){var $,z,H;const _=e.selection.value;if(_){m();for(let ne=_.startCol;ne<=_.endCol;ne++)for(let ae=_.startRow;ae<=_.endRow;ae++){const ze=e.findMerge(ne,ae);if(ze&&(ne!==ze.range.startCol||ae!==ze.range.startRow))continue;const lt=e.cellKey(ne,ae),rt=(($=e.cells[lt])==null?void 0:$.value)??"";let wt={...e.resolveStyle(e.cells[lt])??{}};if(R===""||R===null||R===void 0||R===0){const{[d]:kt,...ml}=wt;wt=ml}else wt[d]=R;const Vt=Object.keys(wt).length?e.registerStyle(wt):0;if(rt===""&&Vt===0)e.delCell(lt);else{const kt={value:rt};Vt>0&&(kt.styleId=Vt),e.cells[lt]=kt}}(z=e.scheduleRender)==null||z.call(e),(H=e.emitModelData)==null||H.call(e)}}function Ce(d){ee("fontFamily",d===""?"":d)}const Me=t.ref(!1),ge=t.ref(!1),se=t.ref(!1),Re=t.ref(!1),Ke=t.ref(!1);function we(d){ee("fontSize",d),Me.value=!1}const me=t.computed(()=>$n.map(d=>({label:T(e.locale.value,d.labelKey),value:d.value,icon:d.icon}))),ye=t.computed(()=>_n.map(d=>({label:T(e.locale.value,d.labelKey),value:d.value,icon:d.icon}))),Le=t.computed(()=>{const d=e.selection.value;if(!d)return"left";const R=e.resolveStyle(e.cells[e.cellKey(d.startCol,d.startRow)]),_=typeof(R==null?void 0:R.textAlign)=="string"?R.textAlign:"";return _==="center"||_==="right"?_:"left"}),$e=t.computed(()=>{const d=e.selection.value;if(!d)return"top";const R=e.resolveStyle(e.cells[e.cellKey(d.startCol,d.startRow)]),_=typeof(R==null?void 0:R.verticalAlign)=="string"?R.verticalAlign:"";return _==="middle"||_==="bottom"?_:"top"}),G=t.computed(()=>{const d=e.selection.value;if(!d)return!1;const R=e.resolveStyle(e.cells[e.cellKey(d.startCol,d.startRow)]);return(R==null?void 0:R.wrap)==="wrap"});function pe(d){ee("textAlign",d)}function p(d){ee("verticalAlign",d)}function D(){if(!e.selection.value)return;const R=G.value;ee("wrap",R?void 0:"wrap")}const I=t.ref(""),U=Me;t.watch(P,d=>{I.value=d===0?"":String(d)},{immediate:!0});function x(d){const R=d.replace(/[^\d]/g,"");I.value=R;const _=parseInt(R,10);!isNaN(_)&&_>=5&&_<=72&&_!==P.value&&ee("fontSize",_)}function s(){const d=I.value.trim();if(!d){I.value=P.value===0?"":String(P.value);return}let R=parseInt(d,10);isNaN(R)?R=P.value===0?Ht:P.value:R=Math.max(5,Math.min(72,R)),I.value=String(R),R!==P.value&&ee("fontSize",R)}function u(d){d.key==="Enter"&&d.target.blur()}function O(d){d&&d.preventDefault(),U.value=!U.value,U.value&&(se&&(se.value=!1),ge&&(ge.value=!1),Re.value=!1,Ke.value=!1)}function ke(){const d=P.value===0?Ht:P.value,R=Math.min(72,d+1);ee("fontSize",R),I.value=String(R),U.value=!1}function Ee(){const d=P.value===0?Ht:P.value,R=Math.max(5,d-1);ee("fontSize",R),I.value=String(R),U.value=!1}function h(d){const R=e.selection.value;if(!R)return!1;let _,$=!1;for(let z=R.startCol;z<=R.endCol&&!$;z++)for(let H=R.startRow;H<=R.endRow&&!$;H++){const ne=e.findMerge(z,H);if(ne&&(z!==ne.range.startCol||H!==ne.range.startRow))continue;const ae=e.resolveStyle(e.cells[e.cellKey(z,H)]),ze=!!(ae!=null&&ae[d]);_===void 0?_=ze:ze!==_&&($=!0)}return!$&&_===!0}const B=t.computed(()=>h("fontWeight")),Be=t.computed(()=>h("fontStyle")),je=t.computed(()=>h("underline")),it=t.computed(()=>h("strikethrough"));function ie(){ee("fontWeight",B.value?"":"bold")}function Te(){ee("fontStyle",Be.value?"":"italic")}function Fe(){ee("underline",je.value?"":"underline")}function ot(){ee("strikethrough",it.value?"":"line-through")}const Je=t.ref(""),qe=t.ref(""),Qe=Re,ct=Ke;function bt(){Qe.value=!Qe.value,ct.value=!1,ge&&(ge.value=!1),se&&(se.value=!1)}function yt(){ct.value=!ct.value,Qe.value=!1,ge&&(ge.value=!1),se&&(se.value=!1)}function Tt(d){ge&&(ge.value=d),d&&(Qe.value=!1,ct.value=!1,se&&(se.value=!1))}function At(d){Je.value=d,ee("color",d===""?"":d)}function xt(d){qe.value=d,ee("backgroundColor",d===""?"":d)}function mt(){ee("color",Je.value===""?"":Je.value)}function Rt(){ee("backgroundColor",qe.value===""?"":qe.value)}const Mt=t.computed(()=>{const d=e.selection.value;if(!d)return"";let R,_=!1;for(let $=d.startCol;$<=d.endCol&&!_;$++)for(let z=d.startRow;z<=d.endRow&&!_;z++){const H=e.findMerge($,z);if(H&&($!==H.range.startCol||z!==H.range.startRow))continue;const ne=e.resolveStyle(e.cells[e.cellKey($,z)]),ae=typeof(ne==null?void 0:ne.color)=="string"?ne.color:"";R===void 0?R=ae:ae!==R&&(_=!0)}return _?"":R??""}),Kt=t.computed(()=>{const d=e.selection.value;if(!d)return"";let R,_=!1;for(let $=d.startCol;$<=d.endCol&&!_;$++)for(let z=d.startRow;z<=d.endRow&&!_;z++){const H=e.findMerge($,z);if(H&&($!==H.range.startCol||z!==H.range.startRow))continue;const ne=e.resolveStyle(e.cells[e.cellKey($,z)]),ae=typeof(ne==null?void 0:ne.backgroundColor)=="string"?ne.backgroundColor:"";R===void 0?R=ae:ae!==R&&(_=!0)}return _?"":R??""}),Pt=t.computed(()=>on(e.locale.value)),A=t.ref(!1),N=t.computed(()=>{const d=e.selection.value;if(!d)return $t;let R,_=!1;for(let $=d.startCol;$<=d.endCol&&!_;$++)for(let z=d.startRow;z<=d.endRow&&!_;z++){const H=e.findMerge($,z);if(H&&($!==H.range.startCol||z!==H.range.startRow))continue;const ne=e.resolveStyle(e.cells[e.cellKey($,z)]),ae=(ne==null?void 0:ne.numberFormatCategory)==="custom"?Lt:typeof(ne==null?void 0:ne.numberFormat)=="string"?ne.numberFormat:"";R===void 0?R=ae:ae!==R&&(_=!0)}return _?Dt:R??$t});function W(d){if((d==null?void 0:d.numberFormatCategory)==="custom")return Lt;const R=typeof(d==null?void 0:d.numberFormat)=="string"?d.numberFormat:"";return nn(R,e.locale.value)}const ue=t.computed(()=>{const d=N.value;if(d!==Dt)return d===Lt?Lt:nn(d,e.locale.value);const R=e.selection.value;if(!R)return $t;let _,$=!1;for(let z=R.startCol;z<=R.endCol&&!$;z++)for(let H=R.startRow;H<=R.endRow&&!$;H++){const ne=e.findMerge(z,H);if(ne&&(z!==ne.range.startCol||H!==ne.range.startRow))continue;const ae=W(e.resolveStyle(e.cells[e.cellKey(z,H)]));_===void 0?_=ae:ae!==_&&($=!0)}return $?Dt:_??$t});function L(d){ee("numberFormat",d),X()}function X(){const d=e.selection.value;if(d)for(let R=d.startCol;R<=d.endCol;R++)for(let _=d.startRow;_<=d.endRow;_++){const $=e.findMerge(R,_);if($&&(R!==$.range.startCol||_!==$.range.startRow))continue;const z=e.cellKey(R,_),H=e.cells[z],ne=e.resolveStyle(H);if((ne==null?void 0:ne.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:ae,...ze}=ne,lt=Object.keys(ze).length?e.registerStyle(ze):0,rt=(H==null?void 0:H.value)??"";if(rt===""&&lt===0)e.delCell(z);else{const at={value:rt};lt>0&&(at.styleId=lt),e.cells[z]=at}}}function fe(d){if(d===Lt){A.value=!0;return}L(d)}function re(){A.value=!0}function Se(){const d=e.selection.value;if(!d)return[];const R=[];for(let _=d.startCol;_<=d.endCol;_++)for(let $=d.startRow;$<=d.endRow;$++){const z=e.findMerge(_,$);if(z&&(_!==z.range.startCol||$!==z.range.startRow))continue;const H=e.cellKey(_,$),ne=e.cells[H],ae=e.resolveStyle(ne),ze=typeof(ae==null?void 0:ae.numberFormat)=="string"?ae.numberFormat:$t,lt=(ne==null?void 0:ne.value)??"",rt=lt.startsWith("=")?hn(_,$,e.cells,e.colCount,e.rowCount):lt;ln(ze,rt)&&R.push({key:H,nf:ze,decimals:io(ze,rt)})}return R}const Ie=t.computed(()=>Se().some(d=>d.decimals<Al)),Oe=t.computed(()=>Se().some(d=>d.decimals>Vl));function C(d,R,_){var ae;const $=((ae=e.cells[d])==null?void 0:ae.value)??"",H={...e.resolveStyle(e.cells[d])??{}};R===""?(delete H.numberFormat,delete H.numberFormatCategory):(H.numberFormat=R,_==="custom"&&(H.numberFormatCategory="custom"));const ne=Object.keys(H).length?e.registerStyle(H):0;if($===""&&ne===0)e.delCell(d);else{const ze={value:$};ne>0&&(ze.styleId=ne),e.cells[d]=ze}}function V(d){var $,z;const R=Se(),_=[];for(const H of R){const ne=H.decimals+d;if(ne<Vl||ne>Al)continue;const ae=so(H.nf,ne);ae==null||ae===H.nf||_.push({key:H.key,code:ae,category:Ct(H.nf)?"custom":void 0})}if(_.length){m();for(const H of _)C(H.key,H.code,H.category);($=e.scheduleRender)==null||$.call(e),(z=e.emitModelData)==null||z.call(e)}}function F(){V(1)}function Q(){V(-1)}return{undoStack:n,redoStack:l,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:m,undo:c,redo:g,canUndo:k,canRedo:S,hasSelection:y,paintFmt:v,onPaintFormat:E,applyPaintFormat:j,clearFormat:Z,fontFamilyOptions:te,fontSizeOptions:K,FONT_FAMILY_MIXED:b,selFontFamily:le,selFontSize:P,applyStyleToSelection:ee,onFontFamilyChange:Ce,onFontSizeChange:we,hAlignOptions:me,vAlignOptions:ye,selHAlign:Le,selVAlign:$e,selWrap:G,onHAlignChange:pe,onVAlignChange:p,onWrapToggle:D,fontSizeInput:I,fontSizeMenuOpen:U,onFontSizeInput:x,onFontSizeBlur:s,onFontSizeKeydown:u,toggleFontSizeMenu:O,onFontSizeStepUp:ke,onFontSizeStepDown:Ee,selFontWeight:B,selFontStyle:Be,selUnderline:je,selStrikethrough:it,toggleFontWeight:ie,toggleFontStyle:Te,toggleUnderline:Fe,toggleStrikethrough:ot,cachedTextColor:Je,cachedFillColor:qe,textColorMenuOpen:Qe,fillColorMenuOpen:ct,_toggleTextColorMenu:bt,_toggleFillColorMenu:yt,onBorderMenuToggle:Tt,onTextColorChange:At,onFillColorChange:xt,applyCachedTextColor:mt,applyCachedFillColor:Rt,selTextColor:Mt,selFillColor:Kt,nfOptions:Pt,selNumberFormat:N,selNumberFormatDisplay:ue,NF_NUMBER_FORMAT_MIXED:Dt,nfDialogOpen:A,onNumberFormatChange:fe,openNumberFormatDialog:re,applyNumberFormatCode:L,canIncreaseDecimals:Ie,canDecreaseDecimals:Oe,onIncreaseDecimals:F,onDecreaseDecimals:Q}}function Wi(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 Ui(e,o){const n=t.ref("none"),l=t.ref(!1),a="#444";function i(p,D,I,U){if(p<0||D<0||p>=e.colCount||D>=e.rowCount)return;const x=e.findMerge(p,D),s=x?x.anchor:e.cellKey(p,D);if(!e.cells[s]){if(!U)return;e.cells[s]={value:""}}$i(e.cells[s],I,U,e.styles,{get:O=>e.resolveBorder(O),getId:O=>e.registerBorder(O)},e.registerStyle)}function r(p,D,I){var ke;const U=e.findMerge(p,D),x=U?U.anchor:e.cellKey(p,D),s=((ke=e.cells[x])==null?void 0:ke.value)??"",u=e.resolveStyle(e.cells[x])?{...e.resolveStyle(e.cells[x])}:{},O=e.registerBorder(I);if(O>0?u.borderId=O:delete u.borderId,delete u.borderTopWidth,delete u.borderBottomWidth,delete u.borderLeftWidth,delete u.borderRightWidth,delete u.borderColor,s===""&&!Object.keys(u).length)e.delCell(x);else{const Ee=e.registerStyle(u);e.cells[x]={value:s,styleId:Ee||void 0}}}function m(p){var ke,Ee;n.value=p;const D=e.selection.value;if(!D)return;o.saveUndo();const{startCol:I,startRow:U,endCol:x,endRow:s}=D,u={width:1,color:a},O={width:2,color:a};if(p==="none")for(let h=I;h<=x;h++)for(let B=U;B<=s;B++){const Be=e.findMerge(h,B);Be&&(h!==Be.range.startCol||B!==Be.range.startRow)||r(h,B,{})}else if(p==="all")for(let h=I;h<=x;h++)for(let B=U;B<=s;B++){const Be=e.findMerge(h,B);Be&&(h!==Be.range.startCol||B!==Be.range.startRow)||r(h,B,{top:u,right:u,bottom:u,left:u})}else if(p==="outer"||p==="thickOuter"){const h=p==="thickOuter"?O:u;for(let B=I;B<=x;B++)i(B,U,"top",h);for(let B=I;B<=x;B++)i(B,s,"bottom",h);for(let B=U;B<=s;B++)i(I,B,"left",h);for(let B=U;B<=s;B++)i(x,B,"right",h)}else{const B={top:{side:"top",edgeCheck:(Be,je)=>je===U},bottom:{side:"bottom",edgeCheck:(Be,je)=>je===s},left:{side:"left",edgeCheck:(Be,je)=>Be===I},right:{side:"right",edgeCheck:(Be,je)=>Be===x}}[p];if(B)for(let Be=I;Be<=x;Be++)for(let je=U;je<=s;je++)B.edgeCheck(Be,je)&&i(Be,je,B.side,u)}(ke=e.scheduleRender)==null||ke.call(e),(Ee=e.emitModelData)==null||Ee.call(e)}function c(){m(n.value)}function g(p,D,I){const U=I.toLowerCase(),x=e.findMerge(p,D);if(x){if(U==="top"&&D!==x.range.startRow||U==="bottom"&&D!==x.range.endRow||U==="left"&&p!==x.range.startCol||U==="right"&&p!==x.range.endCol)return 0;const u=e.getCellBorderSide(e.cells[x.anchor],U);return(u==null?void 0:u.width)??0}const s=e.getCellBorderSide(e.cells[e.cellKey(p,D)],U);return(s==null?void 0:s.width)??0}const k=t.ref(!1);function S(p){k.value=p,p&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,l.value=!1,o.fontSizeMenuOpen.value=!1)}function y(p,D,I,U){const x=[];for(const s in e.merges){const u=e.merges[s];u&&u.startCol<=I&&u.endCol>=p&&u.startRow<=U&&u.endRow>=D&&x.push(s)}for(const s of x)Reflect.deleteProperty(e.merges,s)}function v(){var s,u,O;const p=e.selection.value;if(!p||p.startCol===p.endCol&&p.startRow===p.endRow)return;o.saveUndo(),y(p.startCol,p.startRow,p.endCol,p.endRow);const D=e.cellKey(p.startCol,p.startRow),I=((s=e.cells[D])==null?void 0:s.value)??"";for(let ke=p.startCol;ke<=p.endCol;ke++)for(let Ee=p.startRow;Ee<=p.endRow;Ee++)ke===p.startCol&&Ee===p.startRow||e.clearCellsInRange(ke,ke,Ee,Ee);const U=e.resolveStyle(e.cells[D])?{...e.resolveStyle(e.cells[D])}:{};U.textAlign="center";const x=e.registerStyle(U);e.cells[D]={value:I,styleId:x||void 0},e.merges[D]={startCol:p.startCol,startRow:p.startRow,endCol:p.endCol,endRow:p.endRow},e.selectCell(p.startCol,p.startRow),(u=e.scheduleRender)==null||u.call(e),(O=e.emitModelData)==null||O.call(e)}function E(){var D,I,U;const p=e.selection.value;if(!(!p||p.startCol===p.endCol)){o.saveUndo();for(let x=p.startRow;x<=p.endRow;x++){y(p.startCol,x,p.endCol,x);const s=e.cellKey(p.startCol,x);(D=e.cells[s])==null||D.value;for(let u=p.startCol+1;u<=p.endCol;u++)e.clearCellsInRange(u,u,x,x);e.merges[s]={startCol:p.startCol,startRow:x,endCol:p.endCol,endRow:x}}e.selectRange(p.startCol,p.startRow,p.endCol,p.endRow),(I=e.scheduleRender)==null||I.call(e),(U=e.emitModelData)==null||U.call(e)}}function j(){var I,U,x;const p=e.selection.value;if(!p||p.startCol===p.endCol&&p.startRow===p.endRow)return;o.saveUndo(),y(p.startCol,p.startRow,p.endCol,p.endRow);const D=e.cellKey(p.startCol,p.startRow);(I=e.cells[D])==null||I.value;for(let s=p.startCol;s<=p.endCol;s++)for(let u=p.startRow;u<=p.endRow;u++)s===p.startCol&&u===p.startRow||e.clearCellsInRange(s,s,u,u);e.merges[D]={startCol:p.startCol,startRow:p.startRow,endCol:p.endCol,endRow:p.endRow},e.selectCell(p.startCol,p.startRow),(U=e.scheduleRender)==null||U.call(e),(x=e.emitModelData)==null||x.call(e)}function Z(){var D,I;const p=e.selection.value;p&&(o.saveUndo(),y(p.startCol,p.startRow,p.endCol,p.endRow),(D=e.scheduleRender)==null||D.call(e),(I=e.emitModelData)==null||I.call(e))}function te(){const p=e.selection.value;if(!p)return;const D=e.findMerge(p.startCol,p.startRow);D&&p.startCol===D.range.startCol&&p.startRow===D.range.startRow&&p.endCol===D.range.endCol&&p.endRow===D.range.endRow?Z():v()}function K(p){switch(p){case"mergeCenter":v();break;case"mergeAcross":E();break;case"mergeCells":j();break;case"unmergeCells":Z();break}}let b=null,le=[];function P(p,D,I,U){le=[];for(let x=I;x<=U;x++){const s=[];for(let u=p;u<=D;u++){const O=e.cells[e.cellKey(u,x)];s.push((O==null?void 0:O.styleId)??0)}le.push(s)}}function ee(p,D,I,U){const x=e.cellKey(p,D);if(vl(),I===""||I==null){e.formulaDeps.clear(x),U&&U>0?e.cells[x]={value:"",styleId:U}:e.delCell(x),e.formulaDeps.markDirty(x);return}e.cells[x]={value:I,styleId:U&&U>0?U:void 0},I.startsWith("=")?e.formulaDeps.set(x,zl(I.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(x),e.formulaDeps.markDirty(x)}function Ce(){const p=e.selection.value;if(!p)return;b={...p},P(p.startCol,p.endCol,p.startRow,p.endRow);const D=[];for(let I=p.startRow;I<=p.endRow;I++){const U=[];for(let x=p.startCol;x<=p.endCol;x++)U.push(e.getCellRaw(x,I));D.push(U.join(" "))}Ll(D.join(`
4
- `))}function Me(){const p=e.selection.value;if(p){if(p.startCol===0&&p.endCol===e.colCount-1){b={...p},P(0,e.colCount-1,p.startRow,p.endRow);const D=[];for(let I=p.startRow;I<=p.endRow;I++){const U=[];for(let x=0;x<e.colCount;x++)U.push(e.getCellRaw(x,I));D.push(U.join(" "))}Ll(D.join(`
5
- `))}else if(p.startRow===0&&p.endRow===e.rowCount-1){b={...p},P(p.startCol,p.endCol,0,e.rowCount-1);const D=[];for(let I=0;I<e.rowCount;I++){const U=[];for(let x=p.startCol;x<=p.endCol;x++)U.push(e.getCellRaw(x,I));D.push(U.join(" "))}Ll(D.join(`
6
- `))}}}async function ge(){var s;let p;try{p=await navigator.clipboard.readText()}catch{return}if(!p&&p!=="")return;const D=p.split(/\r?\n/),I=e.activeCell.value,U=b,x=U&&le.length>0;for(let u=0;u<D.length;u++){const O=D[u].split(" ");for(let ke=0;ke<O.length;ke++){const Ee=I.col+ke,h=I.row+u;if(Ee<e.colCount&&h<e.rowCount){let B=O[ke];if(B.startsWith("=")&&U&&(B=wi(B,Ee-(U.startCol+ke),h-(U.startRow+u),e.colCount,e.rowCount,Xe)),x&&u<le.length&&ke<(((s=le[u])==null?void 0:s.length)??0)){const Be=le[u][ke]??null;ee(Ee,h,B,Be)}else e.setCellValue(Ee,h,B)}}}}function se(){var p;if(o.saveUndo(),Ce(),e.selection.value){const D=e.selection.value;e.clearCellsInRange(D.startCol,D.endCol,D.startRow,D.endRow),(p=e.scheduleRender)==null||p.call(e)}}function Re(){var p;if(e.selection.value){const D=e.selection.value;e.clearCellsInRange(D.startCol,D.endCol,D.startRow,D.endRow),(p=e.scheduleRender)==null||p.call(e)}}function Ke(){var s,u;const p=e.selection.value;if(!p)return;o.saveUndo();const D=p.startCol,I=p.startRow,U=p.endCol,x=p.endRow;if(I===x)if(U+1<e.colCount){const O=`${Xe(D)}${I+1}:${Xe(U)}${I+1}`;e.setCellValue(U+1,I,`=SUM(${O})`)}else{const O=`${Xe(D)}${I+1}:${Xe(U-1)}${I+1}`;e.setCellValue(U,I,`=SUM(${O})`)}else for(let O=D;O<=U;O++)if(x+1<e.rowCount){const ke=`${Xe(O)}${I+1}:${Xe(O)}${x+1}`;e.setCellValue(O,x+1,`=SUM(${ke})`)}else{const ke=`${Xe(O)}${I+1}:${Xe(O)}${x}`;e.setCellValue(O,x,`=SUM(${ke})`)}(s=e.scheduleRender)==null||s.call(e),(u=e.emitModelData)==null||u.call(e)}function we(){var s,u;const p=e.selection.value;if(!p)return;o.saveUndo();const D=p.startCol,I=p.startRow,U=p.endCol,x=p.endRow;if(I===x)if(U+1<e.colCount){const O=`${Xe(D)}${I+1}:${Xe(U)}${I+1}`;e.setCellValue(U+1,I,`=AVERAGE(${O})`)}else{const O=`${Xe(D)}${I+1}:${Xe(U-1)}${I+1}`;e.setCellValue(U,I,`=AVERAGE(${O})`)}else for(let O=D;O<=U;O++)if(x+1<e.rowCount){const ke=`${Xe(O)}${I+1}:${Xe(O)}${x+1}`;e.setCellValue(O,x+1,`=AVERAGE(${ke})`)}else{const ke=`${Xe(O)}${I+1}:${Xe(O)}${x}`;e.setCellValue(O,x,`=AVERAGE(${ke})`)}(s=e.scheduleRender)==null||s.call(e),(u=e.emitModelData)==null||u.call(e)}function me(){var s,u;const p=e.selection.value;if(!p)return;o.saveUndo();const D=p.startCol,I=p.startRow,U=p.endCol,x=p.endRow;if(I===x)if(U+1<e.colCount){const O=`${Xe(D)}${I+1}:${Xe(U)}${I+1}`;e.setCellValue(U+1,I,`=COUNT(${O})`)}else{const O=`${Xe(D)}${I+1}:${Xe(U-1)}${I+1}`;e.setCellValue(U,I,`=COUNT(${O})`)}else for(let O=D;O<=U;O++)if(x+1<e.rowCount){const ke=`${Xe(O)}${I+1}:${Xe(O)}${x+1}`;e.setCellValue(O,x+1,`=COUNT(${ke})`)}else{const ke=`${Xe(O)}${I+1}:${Xe(O)}${x}`;e.setCellValue(O,x,`=COUNT(${ke})`)}(s=e.scheduleRender)==null||s.call(e),(u=e.emitModelData)==null||u.call(e)}const ye=t.ref(!1);function Le(p){ye.value=p,p&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,l.value=!1,o.fontSizeMenuOpen.value=!1,k.value=!1)}function $e(){Ke(),ye.value=!1}function G(){we(),ye.value=!1}function pe(){me(),ye.value=!1}return{cachedBorder:n,borderMenuOpen:l,BORDER_COLOR:a,onBorderChange:m,setCellBorderSide:i,applyBorderToCell:r,applyCachedBorder:c,cellBorderWidth:g,mergeMenuOpen:k,onMergeMenuToggle:S,removeOverlappingMerges:y,mergeAndCenter:v,mergeAcross:E,mergeCells:j,unmergeCells:Z,onApplyMerge:te,onMergeChange:K,copySourceRange:null,copySourceStyles:[],captureStyles:P,setCellWithStyle:ee,copyToClipboard:Ce,copyRowCol:Me,pasteFromClipboard:ge,cutSelected:se,clearSelected:Re,sumSelected:Ke,avgSelected:we,countSelected:me,calcMenuOpen:ye,onCalcMenuToggle:Le,onCalcSum:$e,onCalcAvg:G,onCalcCount:pe}}function Ki(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 yn(e){return e==="number"?0:1}function vn(e,o,n){var i;if(e==null||e.trim()==="")return{kind:"blank"};const l=o??"";if(l===vt||l==="@")return{kind:"text",text:e};if(Ct(l)){if(dl(e))return{kind:"number",num:Number(e)};const r=Fl(e,n);return r?{kind:"number",num:r.serial}:{kind:"text",text:Zt(e,l,n)}}const a=_t(l);if(a.kind==="date"||a.kind==="duration"){const r=Number(e);return Number.isFinite(r)?{kind:"number",num:r}:{kind:"text",text:Zt(e,l,n)}}if(a.kind==="number"){const r=Number(e);if(Number.isFinite(r)){const m=((i=a.sections.find(c=>c.hasDigits))==null?void 0:i.scale)??1;return{kind:"number",num:r*m}}return{kind:"text",text:Zt(e,l,n)}}return{kind:"text",text:Zt(e,l,n)}}function Pi(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=yn(e.kind),i=yn(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 Gi(e,o,n){const l=e.map((a,i)=>i);return l.sort((a,i)=>{const r=Pi(e[a],e[i],o,n);return r!==0?r:a-i}),l}function Yi(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 Xi(e,o,n,l,a){function i(A,N){const W=N-A+1,ue=Re(A,N);for(let L=A;L<=N;L++)for(let X=0;X<e.colCount;X++)e.delCell(e.cellKey(X,L));for(let L=A;L<e.rowCount-W;L++){for(let X=0;X<e.colCount;X++){const fe=e.cellKey(X,L+W),re=e.cellKey(X,L);e.cells[fe]?(e.cells[re]=e.cells[fe],e.delCell(fe)):e.delCell(re)}e.rowHeights.value[L]=e.rowHeights.value[L+W]}for(let L=e.rowCount-W;L<e.rowCount;L++){for(let X=0;X<e.colCount;X++)e.delCell(e.cellKey(X,L));e.rowHeights.value[L]=void 0}se(ue)}function r(A,N){const W=N-A+1;if(N>=e.rowCount-1)return;const ue=we(A,N);for(let L=e.rowCount-1;L>N;L--){for(let X=0;X<e.colCount;X++){const fe=e.cellKey(X,L-W),re=e.cellKey(X,L);e.cells[fe]?e.cells[re]=e.cells[fe]:e.delCell(re)}e.rowHeights.value[L]=e.rowHeights.value[L-W]}for(let L=N+1;L<=N+W;L++){for(let X=0;X<e.colCount;X++)e.delCell(e.cellKey(X,L));e.rowHeights.value[L]=void 0}se(ue)}function m(A,N){const W=N-A+1;if(N>=e.colCount-1)return;const ue=me(A,N);for(let L=e.colCount-1;L>N;L--){for(let X=0;X<e.rowCount;X++){const fe=e.cellKey(L-W,X),re=e.cellKey(L,X);e.cells[fe]?e.cells[re]=e.cells[fe]:e.delCell(re)}e.colWidths.value[L]=e.colWidths.value[L-W]}for(let L=N+1;L<=N+W;L++){for(let X=0;X<e.rowCount;X++)e.delCell(e.cellKey(L,X));e.colWidths.value[L]=100}se(ue)}function c(A,N){const W=N-A+1,ue=Ke(A,N);for(let L=A;L<=N;L++)for(let X=0;X<e.rowCount;X++)e.delCell(e.cellKey(L,X));for(let L=A;L<e.colCount-W;L++){for(let X=0;X<e.rowCount;X++){const fe=e.cellKey(L+W,X),re=e.cellKey(L,X);e.cells[fe]?(e.cells[re]=e.cells[fe],e.delCell(fe)):e.delCell(re)}e.colWidths.value[L]=e.colWidths.value[L+W]}for(let L=e.colCount-W;L<e.colCount;L++){for(let X=0;X<e.rowCount;X++)e.delCell(e.cellKey(L,X));e.colWidths.value[L]=100}se(ue)}function g(A,N){const W=e.resolveStyle(e.cells[e.cellKey(A,N)]);return typeof(W==null?void 0:W.numberFormat)=="string"?W.numberFormat:""}function k(A,N,W){for(let ue=N;ue<=W;ue++)if(e.getCellRaw(A,ue).trim()!=="")return!0;return!1}function S(A){const{startRow:N,endRow:W,startCol:ue,endCol:L}=A;let X=ue,fe=L;for(;X>0&&k(X-1,N,W);)X--;for(;fe<e.colCount-1&&k(fe+1,N,W);)fe++;return{startRow:N,endRow:W,startCol:X,endCol:fe}}function y(A){const N=S(A);return N.startCol!==A.startCol||N.endCol!==A.endCol}function v(A,N,W,ue=A){let L,X;if(W)L=W.startRow,X=W.endRow;else{const C=e.selection.value,V=!!C&&C.startRow===C.endRow&&C.startCol===C.endCol;L=V||!C?0:C.startRow,X=V||!C?e.rowCount-1:C.endRow}let fe=-1,re=-1;for(let C=L;C<=X;C++){let V=!1;for(let F=A;F<=N;F++)if(e.getCellRaw(F,C).trim()!==""){V=!0;break}V&&(fe<0&&(fe=C),re=C)}if(fe<0)return null;const Se=[];for(let C=fe;C<=re;C++){const V=e.getCellRaw(ue,C);Se.push(vn(V,g(ue,C),e.locale.value))}const Ie=Yi(Se)?fe+1:fe;let Oe=!1;for(let C=fe;C<=re&&!Oe;C++)for(let V=A;V<=N;V++){const F=e.cells[e.cellKey(V,C)];if(F&&F.value.startsWith("=")){Oe=!0;break}}if(!Oe)for(const C in e.merges){const V=e.merges[C];if(V&&V.startCol<=N&&V.endCol>=A&&V.startRow<=X&&V.endRow>=L){Oe=!0;break}}return{firstRow:fe,lastRow:re,sortStart:Ie,blocked:Oe}}function E(A,N){const W=v(A,N);return!!W&&!W.blocked&&W.sortStart<W.lastRow}function j(A,N,W){var Q,oe;const ue=N??e.selection.value;if(!ue)return;const L=ue.startCol,X=ue.endCol,fe=W??L,re=v(L,X,{startRow:ue.startRow,endRow:ue.endRow},fe);if(!re||re.blocked||re.sortStart>=re.lastRow)return;const Se=X-L+1,Ie=re.lastRow-re.sortStart+1,Oe=[],C=[];for(let d=re.sortStart;d<=re.lastRow;d++){const R=new Array(Se);for(let $=L;$<=X;$++)R[$-L]=e.cells[e.cellKey($,d)]??null;Oe.push(R);const _=e.getCellRaw(fe,d);C.push(vn(_,g(fe,d),e.locale.value))}const V=Gi(C,A,e.locale.value);let F=!1;for(let d=0;d<Ie;d++)if(V[d]!==d){F=!0;break}if(F){o.saveUndo();for(let d=0;d<Ie;d++){const R=Oe[V[d]],_=re.sortStart+d;for(let $=L;$<=X;$++){const z=e.cellKey($,_),H=R[$-L],ne=H?H.value:"",ae=(Q=e.cells[z])==null?void 0:Q.styleId;ne!==""||ae!==void 0?e.cells[z]={value:ne,styleId:ae}:e.delCell(z)}}vl();for(let d=re.sortStart;d<=re.lastRow;d++)for(let R=L;R<=X;R++)e.formulaDeps.markDirty(e.cellKey(R,d));(oe=e.scheduleRender)==null||oe.call(e),B()}}const Z=t.ref(!1),te=t.ref(null);function K(A){const N=e.selection.value;if(!N||!y(N))return!1;const W=S(N);return te.value={order:A,originalRange:N,expandedRange:W},Z.value=!0,!0}function b(A){const N=te.value;if(!N)return;const{order:W,originalRange:ue,expandedRange:L}=N;Z.value=!1,te.value=null,j(W,A?L:ue,ue.startCol),ee.value=W}function le(){Z.value=!1,te.value=null}const P=t.ref(!1),ee=t.ref("asc");function Ce(A){P.value=A,A&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,o.fontSizeMenuOpen.value=!1)}function Me(A){K(A)||(ee.value=A,j(A))}function ge(){K(ee.value)||j(ee.value)}function se(A){Object.keys(e.merges).forEach(N=>Reflect.deleteProperty(e.merges,N));for(const N of A)if(!(N.newRange.startCol>N.newRange.endCol||N.newRange.startRow>N.newRange.endRow)&&(e.merges[N.newAnchorKey]={...N.newRange},N.anchorCell)){const W=N.anchorCell.value,ue=N.anchorCell.styleId;W===""&&!ue||(e.cells[N.newAnchorKey]={value:W,styleId:ue||void 0})}}function Re(A,N){const W=N-A+1,ue=[];for(const L in e.merges){const X=e.merges[L];if(!X)continue;const fe=e.cells[L]?{value:e.cells[L].value,styleId:e.cells[L].styleId??0}:{value:"",styleId:0},{startCol:re,endCol:Se}=X;let{startRow:Ie,endRow:Oe}=X;if(Ie>N){Ie-=W,Oe-=W,ue.push({newAnchorKey:e.cellKey(re,Ie),newRange:{startCol:re,startRow:Ie,endCol:Se,endRow:Oe}});continue}if(Oe<A){ue.push({newAnchorKey:L,newRange:{startCol:re,startRow:Ie,endCol:Se,endRow:Oe}});continue}if(Ie>=A&&Oe<=N||(Ie>=A&&Ie<=N&&(Ie=A),Oe>=A&&Oe<=N?Oe=A-1:Oe>N&&(Oe-=W),Ie>Oe))continue;const C=re,V=Ie,F=e.cellKey(C,V),oe=L.split(",").map(Number)[1],d=oe>=A&&oe<=N||C!==X.startCol||V!==oe;ue.push({newAnchorKey:F,newRange:{startCol:re,startRow:Ie,endCol:Se,endRow:Oe},anchorCell:d?fe:void 0})}return ue}function Ke(A,N){const W=N-A+1,ue=[];for(const L in e.merges){const X=e.merges[L];if(!X)continue;const fe=e.cells[L]?{value:e.cells[L].value,styleId:e.cells[L].styleId??0}:{value:"",styleId:0};let{startCol:re,endCol:Se}=X;const{startRow:Ie,endRow:Oe}=X;if(re>N){re-=W,Se-=W,ue.push({newAnchorKey:e.cellKey(re,Ie),newRange:{startCol:re,startRow:Ie,endCol:Se,endRow:Oe}});continue}if(Se<A){ue.push({newAnchorKey:L,newRange:{startCol:re,startRow:Ie,endCol:Se,endRow:Oe}});continue}if(re>=A&&Se<=N||(re>=A&&re<=N&&(re=A),Se>=A&&Se<=N?Se=A-1:Se>N&&(Se-=W),re>Se))continue;const C=re,V=Ie,F=e.cellKey(C,V),oe=L.split(",").map(Number)[0],d=oe>=A&&oe<=N||C!==oe||V!==X.startRow;ue.push({newAnchorKey:F,newRange:{startCol:re,startRow:Ie,endCol:Se,endRow:Oe},anchorCell:d?fe:void 0})}return ue}function we(A,N){const W=N-A+1,ue=[];for(const L in e.merges){const X=e.merges[L];if(!X)continue;const{startCol:fe,endCol:re}=X;let{startRow:Se,endRow:Ie}=X;Ie<A?ue.push({newAnchorKey:L,newRange:{startCol:fe,startRow:Se,endCol:re,endRow:Ie}}):Se>N?(Se+=W,Ie+=W,ue.push({newAnchorKey:e.cellKey(fe,Se),newRange:{startCol:fe,startRow:Se,endCol:re,endRow:Ie}})):(Ie+=W,ue.push({newAnchorKey:L,newRange:{startCol:fe,startRow:Se,endCol:re,endRow:Ie}}))}return ue}function me(A,N){const W=N-A+1,ue=[];for(const L in e.merges){const X=e.merges[L];if(!X)continue;let{startCol:fe,endCol:re}=X;const{startRow:Se,endRow:Ie}=X;re<A?ue.push({newAnchorKey:L,newRange:{startCol:fe,startRow:Se,endCol:re,endRow:Ie}}):fe>N?(fe+=W,re+=W,ue.push({newAnchorKey:e.cellKey(fe,Se),newRange:{startCol:fe,startRow:Se,endCol:re,endRow:Ie}})):(re+=W,ue.push({newAnchorKey:L,newRange:{startCol:fe,startRow:Se,endCol:re,endRow:Ie}}))}return ue}let ye=0;function Le(){return ye++,`s_${ye}`}function $e(A){return{id:Le(),name:A,cells:{},merges:{},styles:[{}],borders:[{}],selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:new Array(e.colCount).fill(100),rowHeights:new Array(e.rowCount).fill(void 0)}}const G=t.ref([$e("Sheet1")]),pe=t.ref(0);function p(){const A=G.value[pe.value];A&&(A.cells={...e.cells},A.merges={...e.merges},A.selection=e.selection.value?{...e.selection.value}:null,A.activeCell={...e.activeCell.value},A.scrollX=e.scrollX.value,A.scrollY=e.scrollY.value,A.colWidths=[...e.colWidths.value],A.rowHeights=[...e.rowHeights.value],A.styles=[...e.styles],A.borders=[...e.borders])}function D(A){const N=G.value[A];N&&(Object.keys(e.cells).forEach(W=>e.delCell(W)),Object.assign(e.cells,N.cells),Object.keys(e.merges).forEach(W=>Reflect.deleteProperty(e.merges,W)),N.merges&&Object.assign(e.merges,N.merges),e.selection.value=N.selection?{...N.selection}:null,e.activeCell.value={...N.activeCell},e.scrollX.value=N.scrollX,e.scrollY.value=N.scrollY,e.colWidths.value=[...N.colWidths],e.rowHeights.value=[...N.rowHeights],e.syncStyles(N.styles),e.syncBorders(N.borders??[{}]),pe.value=A)}function I(A){A===pe.value||A<0||A>=G.value.length||(e.cancelEdit(),p(),D(A))}function U(A){return o.saveUndo(),e.cancelEdit(),p(),G.value.push($e(A??`Sheet${G.value.length+1}`)),D(G.value.length-1),G.value.length-1}function x(A){return G.value.length<=1||(o.saveUndo(),e.cancelEdit(),G.value.splice(A,1),D(Math.min(A,G.value.length-1))),pe.value}function s(A,N){G.value[A]&&N.trim()&&(o.saveUndo(),G.value[A].name=N.trim())}function u(A){o.saveUndo(),e.cancelEdit(),p();const N=G.value[A];if(!N)return A;let W=N.name;const ue=W.match(/^(.*?)\s*\((\d+)\)$/);let L=ue?parseInt(ue[2],10)+1:2;ue&&(W=ue[1]);let X=`${W} (${L})`;const fe=new Set(G.value.map(Se=>Se.name));for(;fe.has(X);)L++,X=`${W} (${L})`;const re={id:Le(),name:X,cells:{...N.cells},merges:N.merges?{...N.merges}:{},styles:[...N.styles],borders:N.borders?[...N.borders]:[{}],selection:N.selection?{...N.selection}:null,activeCell:N.activeCell?{...N.activeCell}:{col:0,row:0},scrollX:N.scrollX,scrollY:N.scrollY,colWidths:[...N.colWidths],rowHeights:[...N.rowHeights]};return G.value.splice(A+1,0,re),D(A+1),A+1}function O(A,N){var X;const W=A+N;if(W<0||W>=G.value.length)return;o.saveUndo();const ue=pe.value,L=G.value.splice(A,1)[0];G.value.splice(W,0,L),ue===A?pe.value=W:A<ue&&W>=ue?pe.value=ue-1:A>ue&&W<=ue&&(pe.value=ue+1),(X=e.scheduleRender)==null||X.call(e)}const ke=t.computed(()=>G.value.length);let Ee="";const h=n;function B(){p();const A=G.value.map(W=>{const ue={};for(const[re,Se]of Object.entries(W.cells))ue[re]={value:Se.value},Se.styleId&&Se.styleId>0&&(ue[re].styleId=Se.styleId);const L={name:W.name,cells:ue};W.styles&&W.styles.length>1&&(L.styles=[...W.styles]),W.borders&&W.borders.length>1&&(L.borders=[...W.borders]),W.merges&&Object.keys(W.merges).length&&(L.merges={...W.merges});const X={};for(let re=0;re<W.colWidths.length;re++)W.colWidths[re]!==100&&(X[re]=W.colWidths[re]);Object.keys(X).length&&(L.colWidths=X);const fe={};for(let re=0;re<W.rowHeights.length;re++){const Se=W.rowHeights[re];Se!=null&&(fe[re]=Se)}return Object.keys(fe).length&&(L.rowHeights=fe),L}),N=JSON.stringify(A);N!==Ee&&(Ee=N,h.value=A,a&&(a.value=N))}e.emitModelData=B;let Be=!1;function je(){Be||(Be=!0,Promise.resolve().then(()=>{Be=!1,B()}))}const it=t.computed(()=>e.props.theme==="dark"?Wn:zn),ie=t.computed(()=>Ki(it.value,e.props.width,e.props.height,qt)),Te=t.computed(()=>{const A={};for(const[N,W]of Object.entries(ie.value))N.startsWith("--")&&(A[N]=W);return A}),Fe=t.ref(null),ot=t.ref(null),Je=t.ref(null),qe=t.ref(null),Qe=t.reactive({w:800,h:600});e.viewSize&&t.watch(Qe,A=>{e.viewSize&&(e.viewSize.w=A.w,e.viewSize.h=A.h)},{deep:!0});const ct=48,bt=28,yt=11,Tt=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,Qe.w-ct-yt))),At=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,Qe.h-bt-yt)));function xt(A,N){const W=Math.max(0,Qe.w-ct-yt),ue=Math.max(0,Qe.h-bt-yt);e.scrollX.value=Math.max(0,Math.min(A??e.scrollX.value,Math.max(0,e.totalWidth.value-W))),e.scrollY.value=Math.max(0,Math.min(N??e.scrollY.value,Math.max(0,e.totalHeight.value-ue)))}e.clampScroll=xt;function mt(){var A;return typeof window>"u"?!1:!((A=window.matchMedia)!=null&&A.call(window,"(hover: none) and (pointer: coarse)").matches)}function Rt(A=!1){t.nextTick(()=>{const N=Je.value;if(N){if(!e.editingCell.value&&!mt()){document.activeElement===N&&N.blur();return}N.focus({preventScroll:!0}),A&&N.select()}})}function Mt(){Rt()}function Kt(){var N;const A=e.selection.value;if(A){o.saveUndo();for(let W=A.startRow;W<=A.endRow;W++)e.rowHeights.value[W]=void 0;(N=e.scheduleRender)==null||N.call(e),B()}}function Pt(){var N;const A=e.selection.value;if(A){o.saveUndo();for(let W=A.startCol;W<=A.endCol;W++)e.colWidths.value[W]=100;(N=e.scheduleRender)==null||N.call(e),B()}}return{deleteRows:i,insertRows:r,insertCols:m,deleteCols:c,sortSelectedColumns:j,canSortColumns:E,sortMenuOpen:P,cachedSortOrder:ee,onSortMenuToggle:Ce,onSortChange:Me,applyCachedSort:ge,sortConfirmOpen:Z,prepareSortConfirmation:K,confirmSort:b,cancelSortConfirmation:le,sheets:G,activeSheetIndex:pe,saveSheet:p,loadSheet:D,switchSheet:I,addSheet:U,removeSheet:x,renameSheet:s,dupSheet:u,moveSheet:O,sheetCount:ke,mkSheet:$e,emitModelData:B,scheduleOptEmit:je,themeColors:it,outerStyle:ie,toolbarThemeVars:Te,wrapperRef:Fe,canvasRef:ot,editInputRef:Je,formulaBarRef:qe,viewSize:Qe,maxScrollX:Tt,maxScrollY:At,clampScroll:xt,canFocusHiddenEditor:mt,focusEditInput:Rt,onCanvasFocus:Mt,resetRowHeight:Kt,resetColWidth:Pt,modelData:h}}function Cn(e){return!!e&&e.width!==void 0&&e.width>0}function ft(e,o,n,l){const a=Cn(e),i=Cn(o);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return o;const r=e.width??0,m=o.width??0;return r>m?e:m>r?o:e}function ji(e,o,n,l,a){let i=!1,r=null,m=1;function c(){i||(i=!0,requestAnimationFrame(()=>{i=!1,k()}))}e.scheduleRender=c;const g="#444";function k(){const f=l.canvasRef.value;if(!f)return;const w=l.wrapperRef.value;if(!w||(r=f.getContext("2d"),!r))return;m=window.devicePixelRatio||1;const Y=w.getBoundingClientRect(),q=Y.width,M=Y.height;l.viewSize.w=q,l.viewSize.h=M,f.width=q*m,f.height=M*m,f.style.width=q+"px",f.style.height=M+"px",r.setTransform(m,0,0,m,0,0);const J=e.scrollX.value,xe=e.scrollY.value,De=52,be=24,Ve=l.themeColors.value,et=e.colPositions.value,st=e.rowPositions.value,Bt=e.colWidths.value,St=[];for(let de=0;de<e.rowCount;de++)St[de]=st[de+1]-st[de];const zt=Math.max(0,e.hitCol(J));let rl=zt;for(let de=zt;de<e.colCount&&!(De+et[de]-J>=q);de++)rl=de;const Yt=rl,It=Math.max(0,e.hitRow(xe));let wl=It;for(let de=It;de<e.rowCount&&!(be+st[de]-xe>=M);de++)wl=de;const Ft=wl;let al=zt,il=It;for(const de in e.merges){const ve=e.merges[de];ve&&(ve.startRow>Ft||ve.endRow<It||ve.startCol>Yt||ve.endCol<zt||(ve.startCol<al&&(al=ve.startCol),ve.startRow<il&&(il=ve.startRow)))}r.fillStyle=Ve.bg,r.fillRect(0,0,q,M),r.fillStyle=Ve.gridBg,r.fillRect(De,be,q-De,M-be),r.save(),r.beginPath(),r.rect(De,be,q-De,M-be),r.clip();const pt=e.selection.value,gl=e.editingCell.value;for(let de=il;de<=Ft;de++)for(let ve=al;ve<=Yt;ve++){const He=e.findMerge(ve,de);if(He&&!(ve===He.range.startCol&&de===He.range.startRow))continue;const _e=De+et[ve]-J,Ge=be+st[de]-xe;let tt=Bt[ve],nt=St[de];if(He&&(tt=et[He.range.endCol+1]-et[ve],nt=st[He.range.endRow+1]-st[de]),_e+tt<De||Ge+nt<be||_e>q||Ge>M)continue;const Xt=e.findHighlight?e.findHighlight(ve,de):null,Ye=e.resolveStyle(e.cells[e.cellKey(ve,de)]),Ze=typeof(Ye==null?void 0:Ye.backgroundColor)=="string"?Ye.backgroundColor:"";if(Ze&&(r.fillStyle=Ze,r.fillRect(_e,Ge,tt,nt)),Xt&&(r.fillStyle=Xt==="active"?Ve.findActiveBg:Ve.findMatchBg,r.fillRect(_e,Ge,tt,nt)),e.isSelected(ve,de)&&(r.fillStyle=Ve.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?r.fillRect(_e,Ge,Bt[ve],St[de]):r.fillRect(_e,Ge,tt,nt)),e.activeCell.value.col===ve&&e.activeCell.value.row===de&&(r.strokeStyle=Ve.activeCellBorder,r.lineWidth=2,r.strokeRect(_e+1,Ge+1,tt-2,nt-2)),Xt==="active"&&(r.strokeStyle=Ve.findActiveBg,r.lineWidth=2,r.strokeRect(_e+1,Ge+1,tt-2,nt-2)),r.strokeStyle=Ve.gridLine,r.lineWidth=.5,r.strokeRect(_e+.25,Ge+.25,tt-.5,nt-.5),!(gl&&gl.col===ve&&gl.row===de)){const he=e.resolveStyle(e.cells[e.cellKey(ve,de)]),We=e.getCellValue(ve,de),Ue=typeof(he==null?void 0:he.numberFormat)=="string"?he.numberFormat:"",ce=We?Zt(We,Ue,e.locale.value):"";if(ce){const Ae=e.cellFontSize(ve,de),Ne=typeof(he==null?void 0:he.fontFamily)=="string"&&he.fontFamily?he.fontFamily:sl,Pe=(he==null?void 0:he.fontWeight)==="bold"?"bold":"normal",Ot=(he==null?void 0:he.fontStyle)==="italic"?"italic":"normal",xc=(he==null?void 0:he.underline)==="underline",Rc=(he==null?void 0:he.strikethrough)==="line-through",Pl=typeof(he==null?void 0:he.color)=="string"?he.color:"",xn=typeof(he==null?void 0:he.textAlign)=="string"?he.textAlign:en(We,Ue)?"right":"left",Rn=typeof(he==null?void 0:he.verticalAlign)=="string"?he.verticalAlign:"top";r.fillStyle=Pl||Ve.cellText,r.font=`${Ot} ${Pe} ${Ae}px ${Ne}`,r.textBaseline="alphabetic",r.save(),r.beginPath(),r.rect(_e+5,Ge+1,tt-10,nt-2),r.clip();const Mn=(he==null?void 0:he.wrap)==="wrap",kl=tt-10;let Gl=ce;const Mc=!Mn&&oo(Ue),Bn=ce===Bl||ro(We,Ue);if(Bn||Mc){if(Bn){const el=Math.max(1,r.measureText("#").width),bl=Math.max(1,Math.floor(kl/el));Gl="#".repeat(bl)}else if(e.getWrappedLines(r,ce,1e9,!1).some(Wt=>Wt&&r.measureText(Wt).width>kl)){const Wt=Math.max(1,r.measureText("#").width),cl=Math.max(1,Math.floor(kl/Wt));Gl="#".repeat(cl)}}const El=e.getWrappedLines(r,Gl,kl,Mn),{ascent:Sl,descent:xl}=e.measureFontMetrics(Ne,Ae,Pe,Ot),Rl=Sl+xl,Bc=El.length*Rl;let Ml;Rn==="middle"?Ml=Ge+(nt-Bc)/2+Sl:Rn==="bottom"?Ml=Ge+nt-e.BASE_CELL_VPAD-xl-(El.length-1)*Rl:Ml=Ge+e.BASE_CELL_VPAD+Sl;for(let el=0;el<El.length;el++){const bl=El[el],Wt=Ml+el*Rl,cl=r.measureText(bl);let jt;if(xn==="center"?jt=_e+tt/2-cl.width/2:xn==="right"?jt=_e+tt-5-cl.width:jt=_e+5,r.fillText(bl,jt,Wt),xc&&(r.strokeStyle=Pl||Ve.cellText,r.lineWidth=1,r.beginPath(),r.moveTo(jt,Wt+xl+1),r.lineTo(jt+cl.width,Wt+xl+1),r.stroke()),Rc){r.strokeStyle=Pl||Ve.cellText,r.lineWidth=1;const Dn=Wt-Sl+Rl*.42;r.beginPath(),r.moveTo(jt,Dn),r.lineTo(jt+cl.width,Dn),r.stroke()}}r.restore()}}}const dt=(de,ve,He)=>{const _e=e.findMerge(de,ve);return _e?e.getCellBorderSide(e.cells[_e.anchor],He):e.getCellBorderSide(e.cells[e.cellKey(de,ve)],He)};r.fillStyle=g;for(let de=il;de<=Ft;de++)for(let ve=al;ve<=Yt;ve++){const He=e.findMerge(ve,de);if(He&&!(ve===He.range.startCol&&de===He.range.startRow))continue;const _e=De+et[ve]-J,Ge=be+st[de]-xe;let tt=Bt[ve],nt=St[de];if(He&&(tt=et[He.range.endCol+1]-et[ve],nt=st[He.range.endRow+1]-st[de]),_e+tt<De||Ge+nt<be||_e>q||Ge>M)continue;const Xt=e.cells[e.cellKey(ve,de)],Ye={top:e.getCellBorderSide(Xt,"top"),right:e.getCellBorderSide(Xt,"right"),bottom:e.getCellBorderSide(Xt,"bottom"),left:e.getCellBorderSide(Xt,"left")};if(He){const Ze=He.range.startRow,he=He.range.endRow,We=He.range.startCol,Ue=He.range.endCol;for(let ce=We;ce<=Ue;ce++){if(e.isSameMergeInternal(ce,Ze-1,ce,Ze))continue;const Ae=dt(ce,Ze-1,"bottom"),Ne=ft(Ae,Ye.top);if(Ne&&Ne.width&&Ne.width>0){const Pe=De+et[ce]-J;r.fillStyle=Ne.color||g,r.fillRect(Pe,Ge,Bt[ce],Ne.width)}}for(let ce=We;ce<=Ue;ce++){if(e.isSameMergeInternal(ce,he,ce,he+1))continue;const Ae=dt(ce,he+1,"top"),Ne=ft(Ye.bottom,Ae);if(Ne&&Ne.width&&Ne.width>0){const Pe=De+et[ce]-J;r.fillStyle=Ne.color||g,r.fillRect(Pe,Ge+nt-Ne.width,Bt[ce],Ne.width)}}for(let ce=Ze;ce<=he;ce++){if(e.isSameMergeInternal(We-1,ce,We,ce))continue;const Ae=dt(We-1,ce,"right"),Ne=ft(Ae,Ye.left);if(Ne&&Ne.width&&Ne.width>0){const Pe=be+st[ce]-xe;r.fillStyle=Ne.color||g,r.fillRect(_e,Pe,Ne.width,St[ce])}}for(let ce=Ze;ce<=he;ce++){if(e.isSameMergeInternal(Ue,ce,Ue+1,ce))continue;const Ae=dt(Ue+1,ce,"left"),Ne=ft(Ye.right,Ae);if(Ne&&Ne.width&&Ne.width>0){const Pe=be+st[ce]-xe;r.fillStyle=Ne.color||g,r.fillRect(_e+tt-Ne.width,Pe,Ne.width,St[ce])}}{const ce=e.isSameMergeInternal(We,Ze-1,We,Ze)?Ye.top:ft(dt(We,Ze-1,"bottom"),Ye.top),Ae=e.isSameMergeInternal(We-1,Ze,We,Ze)?Ye.left:ft(dt(We-1,Ze,"right"),Ye.left),Ne=(ce==null?void 0:ce.width)??0,Pe=(Ae==null?void 0:Ae.width)??0;Ne>0&&Pe>0&&(r.fillStyle=(ce==null?void 0:ce.color)||(Ae==null?void 0:Ae.color)||g,r.fillRect(_e-Pe,Ge-Ne,Pe,Ne))}{const ce=e.isSameMergeInternal(Ue,Ze-1,Ue,Ze)?Ye.top:ft(dt(Ue,Ze-1,"bottom"),Ye.top),Ae=e.isSameMergeInternal(Ue,Ze,Ue+1,Ze)?Ye.right:ft(Ye.right,dt(Ue+1,Ze,"left")),Ne=(ce==null?void 0:ce.width)??0,Pe=(Ae==null?void 0:Ae.width)??0;Ne>0&&Pe>0&&(r.fillStyle=(ce==null?void 0:ce.color)||(Ae==null?void 0:Ae.color)||g,r.fillRect(_e+tt,Ge-Ne,Pe,Ne))}{const ce=e.isSameMergeInternal(We,he,We,he+1)?Ye.bottom:ft(Ye.bottom,dt(We,he+1,"top")),Ae=e.isSameMergeInternal(We-1,he,We,he)?Ye.left:ft(dt(We-1,he,"right"),Ye.left),Ne=(ce==null?void 0:ce.width)??0,Pe=(Ae==null?void 0:Ae.width)??0;Ne>0&&Pe>0&&(r.fillStyle=(ce==null?void 0:ce.color)||(Ae==null?void 0:Ae.color)||g,r.fillRect(_e-Pe,Ge+nt,Pe,Ne))}{const ce=e.isSameMergeInternal(Ue,he,Ue,he+1)?Ye.bottom:ft(Ye.bottom,dt(Ue,he+1,"top")),Ae=e.isSameMergeInternal(Ue,he,Ue+1,he)?Ye.right:ft(Ye.right,dt(Ue+1,he,"left")),Ne=(ce==null?void 0:ce.width)??0,Pe=(Ae==null?void 0:Ae.width)??0;Ne>0&&Pe>0&&(r.fillStyle=(ce==null?void 0:ce.color)||(Ae==null?void 0:Ae.color)||g,r.fillRect(_e+tt,Ge+nt,Pe,Ne))}}else{const Ze={top:dt(ve,de-1,"bottom"),left:dt(ve-1,de,"right"),bottom:dt(ve,de+1,"top"),right:dt(ve+1,de,"left")},he=ft(Ze.top,Ye.top),We=ft(Ze.left,Ye.left),Ue=ft(Ye.bottom,Ze.bottom),ce=ft(Ye.right,Ze.right),Ae=(he==null?void 0:he.width)??0,Ne=(We==null?void 0:We.width)??0,Pe=(Ue==null?void 0:Ue.width)??0,Ot=(ce==null?void 0:ce.width)??0;Ae>0&&(r.fillStyle=(he==null?void 0:he.color)||g,r.fillRect(_e,Ge,tt,Ae)),Pe>0&&(r.fillStyle=(Ue==null?void 0:Ue.color)||g,r.fillRect(_e,Ge+nt-Pe,tt,Pe)),Ne>0&&(r.fillStyle=(We==null?void 0:We.color)||g,r.fillRect(_e,Ge,Ne,nt)),Ot>0&&(r.fillStyle=(ce==null?void 0:ce.color)||g,r.fillRect(_e+tt-Ot,Ge,Ot,nt)),Ae>0&&Ne>0&&(r.fillStyle=(he==null?void 0:he.color)||(We==null?void 0:We.color)||g,r.fillRect(_e-Ne,Ge-Ae,Ne,Ae)),Ae>0&&Ot>0&&(r.fillStyle=(he==null?void 0:he.color)||(ce==null?void 0:ce.color)||g,r.fillRect(_e+tt,Ge-Ae,Ot,Ae)),Pe>0&&Ne>0&&(r.fillStyle=(Ue==null?void 0:Ue.color)||(We==null?void 0:We.color)||g,r.fillRect(_e-Ne,Ge+nt,Ne,Pe)),Pe>0&&Ot>0&&(r.fillStyle=(Ue==null?void 0:Ue.color)||(ce==null?void 0:ce.color)||g,r.fillRect(_e+tt,Ge+nt,Ot,Pe))}}r.restore(),r.fillStyle=Ve.headerBg,r.fillRect(De,0,q-De,be);for(let de=zt;de<=Yt;de++){const ve=De+et[de]-J,He=Bt[de];ve+He<De||ve>q||(pt&&de>=pt.startCol&&de<=pt.endCol&&(r.fillStyle=Ve.selectionBg,r.fillRect(ve,0,He,be)),r.strokeStyle=Ve.headerBorder,r.lineWidth=.5,r.strokeRect(ve+.25,.25,He-.5,be-.5),pt&&de>=pt.startCol&&de<=pt.endCol&&(r.strokeStyle=Ve.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(ve,be-1),r.lineTo(ve+He,be-1),r.stroke()),r.fillStyle=Ve.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(Xe(de),ve+He/2,be/2))}r.strokeStyle=Ve.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(De,be+.5),r.lineTo(q,be+.5),r.stroke(),r.fillStyle=Ve.headerBg,r.fillRect(0,be,De,M-be);for(let de=It;de<=Ft;de++){const ve=be+st[de]-xe,He=St[de];ve+He<be||ve>M||(pt&&de>=pt.startRow&&de<=pt.endRow&&(r.fillStyle=Ve.selectionBg,r.fillRect(0,ve,De,He)),r.strokeStyle=Ve.headerBorder,r.lineWidth=.5,r.strokeRect(.25,ve+.25,De-.5,He-.5),pt&&de>=pt.startRow&&de<=pt.endRow&&(r.strokeStyle=Ve.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(De-1,ve),r.lineTo(De-1,ve+He),r.stroke()),r.fillStyle=Ve.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(de+1),De/2,ve+He/2+.5))}r.strokeStyle=Ve.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(De+.5,be),r.lineTo(De+.5,M),r.stroke(),r.fillStyle=Ve.headerBg,r.fillRect(0,0,De,be),r.strokeStyle=Ve.headerSep,r.lineWidth=1,r.strokeRect(.5,.5,De-.5,be-.5)}const S=t.computed(()=>Xe(e.activeCell.value.col)+String(e.activeCell.value.row+1)),y=t.ref(""),v=t.ref(!1),E=t.computed(()=>e.editingCell.value?y.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(f,w)=>{if(f&&!w){const Y=e.editValue.value||e.getCellRaw(f.col,f.row)||"";y.value=Y,b=!1}else!f&&w&&(y.value="",v.value=!1,b=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(y.value="",b=!1)});function j(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),c())}function Z(f){const w=f.target.value;e.editingCell.value?e.editValue.value=w:e.startEdit(w),y.value=w,b=!0}function te(f){var Y,q;const w={...e.activeCell.value};e.editingCell.value?(e.editValue.value=f,e.commitEdit()):((Y=e.saveUndo)==null||Y.call(e),e.setCellValue(w.col,w.row,f)),y.value="",b=!1,c(),(q=l.emitModelData)==null||q.call(l)}let K=!1,b=!1;function le(){var J,xe,De,be,Ve,et,st,Bt,St;if(K)return;const f=l.formulaBarRef.value,w=!!(f&&typeof document<"u"&&document.activeElement===f);if(!e.editingCell.value&&!w&&!b)return;const Y={...e.activeCell.value},q=e.editingCell.value?e.editingCell.value.col:Y.col,M=e.editingCell.value?e.editingCell.value.row:Y.row;if(!e.editingCell.value){const zt=e.getCellRaw(q,M),rl=y.value!==zt;if(!b)return;K=!0,rl&&((J=e.saveUndo)==null||J.call(e),e.setCellValue(q,M,y.value),c(),(xe=l.emitModelData)==null||xe.call(l)),(De=l.formulaBarRef.value)==null||De.blur(),y.value="",v.value=!1,b=!1,t.nextTick(()=>{K=!1});return}K=!0,b?(e.editValue.value=y.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(be=l.formulaBarRef.value)==null||be.blur(),y.value="",v.value=!1,b=!1,c(),l.focusEditInput(),(Ve=l.emitModelData)==null||Ve.call(l),t.nextTick(()=>{K=!1})):w?(y.value=e.editValue.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(et=l.formulaBarRef.value)==null||et.blur(),y.value="",v.value=!1,b=!1,c(),l.focusEditInput(),(st=l.emitModelData)==null||st.call(l),t.nextTick(()=>{K=!1})):(e.commitEdit(),(Bt=l.formulaBarRef.value)==null||Bt.blur(),y.value="",v.value=!1,b=!1,c(),l.focusEditInput(),(St=l.emitModelData)==null||St.call(l),t.nextTick(()=>{K=!1}))}function P(){var f;K||(K=!0,e.editingCell.value&&e.cancelEdit(),(f=l.formulaBarRef.value)==null||f.blur(),y.value="",v.value=!1,b=!1,c(),l.focusEditInput(),t.nextTick(()=>{K=!1}))}function ee(f){if(!f.isComposing){if(f.key==="Enter"&&(f.altKey||f.metaKey)&&!f.ctrlKey){f.preventDefault(),f.stopPropagation();const w=f.target;if(!w)return;e.editingCell.value||e.startEdit();const Y=w.selectionStart??w.value.length,q=w.selectionEnd??w.value.length,M=w.value,J=M.substring(0,Y)+`
7
- `+M.substring(q),xe=Y+1;y.value=J,v.value||(v.value=!0),t.nextTick(()=>{try{w.setSelectionRange(xe,xe)}catch{}if(v.value)try{w.scrollTop=w.scrollHeight}catch{}try{w.focus({preventScroll:!0})}catch{}});return}f.key==="Enter"?(f.preventDefault(),le()):f.key==="Escape"&&(f.preventDefault(),P())}}function Ce(){le()}const Me=t.ref(null),ge=t.ref("");function se(f){Me.value===null&&(l.switchSheet(f),c())}function Re(f){f!==l.activeSheetIndex.value&&(l.saveSheet(),l.loadSheet(f),c()),Me.value=f,ge.value=l.sheets.value[f].name,t.nextTick(()=>{const w=document.querySelector(".tab-rename-input");w==null||w.focus(),w==null||w.select()})}function Ke(){Me.value!==null&&(l.renameSheet(Me.value,ge.value),t.nextTick(()=>l.emitModelData())),Me.value=null,ge.value=""}function we(){Me.value=null,ge.value=""}function me(f){f.key==="Enter"?(f.preventDefault(),Ke()):f.key==="Escape"&&(f.preventDefault(),we())}const ye=t.ref(null);let Le=null;function $e(){Le&&(document.removeEventListener("click",Le),Le=null)}function G(f,w,Y){$e();const q=140,M=Y.length*28+8,J=window.innerWidth,xe=window.innerHeight;f+q>J&&(f-=q),w+M>xe&&(w-=M),ye.value={x:f,y:w,items:Y},Le=()=>{ye.value=null,$e()},setTimeout(()=>document.addEventListener("click",Le,{once:!0}),0)}const pe=t.ref(!1);function p(f,w){if(w.disabled){pe.value=!1;return}if(!w.children){pe.value=!1;return}const q=f.currentTarget.querySelector(".context-submenu");if(!q){pe.value=!1;return}const M=q.getBoundingClientRect();pe.value=M.right>window.innerWidth}function D(f,w){f.preventDefault(),f.stopPropagation(),G(f.clientX,f.clientY,[{label:T(e.locale.value,"insert"),action:()=>{l.addSheet(),c()}},{label:T(e.locale.value,"copy"),action:()=>{l.dupSheet(w)}},{label:T(e.locale.value,"rename"),action:()=>{Re(w)}},{label:T(e.locale.value,"delete"),action:()=>{l.removeSheet(w),c()},disabled:l.sheetCount.value<=1},{label:T(e.locale.value,"moveSheetLeft"),action:()=>{l.moveSheet(w,-1)},disabled:w===0},{label:T(e.locale.value,"moveSheetRight"),action:()=>{l.moveSheet(w,1)},disabled:w===l.sheets.value.length-1}])}function I(f){f.preventDefault(),!(f.target.closest(".tab-item")||f.target.closest(".tab-bar__add-btn"))&&G(f.clientX,f.clientY,[{label:T(e.locale.value,"insert"),action:()=>{l.addSheet(),c()}}])}function U(f){f.preventDefault(),e.selectAll(),c(),G(f.clientX,f.clientY,[{label:T(e.locale.value,"cut"),action:()=>{n.cutSelected(),l.emitModelData()}},{label:T(e.locale.value,"copy"),action:()=>n.copyToClipboard()},{label:T(e.locale.value,"paste"),action:()=>{o.saveUndo(),n.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())})}},{label:T(e.locale.value,"delete"),action:()=>{o.saveUndo(),n.clearSelected();for(let w=0;w<e.colCount;w++)e.colWidths.value[w]=100;for(let w=0;w<e.rowCount;w++)e.rowHeights.value[w]=void 0;c(),l.emitModelData()}}])}function x(f,w){f.preventDefault();const Y=f.clientX,q=f.clientY,M=e.selection.value;M&&M.startCol===0&&M.endCol===e.colCount-1&&w>=M.startRow&&w<=M.endRow||(e.selectRange(0,w,e.colCount-1,w,"row"),c());const J=e.selection.value;G(f.clientX,f.clientY,[{label:T(e.locale.value,"insert"),action:()=>{o.saveUndo(),l.insertRows(J.startRow,J.endRow),c(),l.emitModelData()},disabled:J.endRow>=e.rowCount-1},{label:T(e.locale.value,"cut"),action:()=>{o.saveUndo(),n.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,J.startRow,J.endRow),c(),l.emitModelData()}},{label:T(e.locale.value,"copy"),action:()=>n.copyRowCol()},{label:T(e.locale.value,"paste"),action:()=>{o.saveUndo(),n.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())})}},{label:T(e.locale.value,"delete"),action:()=>{o.saveUndo(),l.deleteRows(J.startRow,J.endRow),c(),l.emitModelData()}},{label:`${T(e.locale.value,"rowHeight")}...`,action:()=>B("row",Y,q)},{label:T(e.locale.value,"autoRowHeight"),action:()=>l.resetRowHeight()}])}function s(f,w){f.preventDefault();const Y=f.clientX,q=f.clientY,M=e.selection.value;M&&M.startRow===0&&M.endRow===e.rowCount-1&&w>=M.startCol&&w<=M.endCol||(e.selectRange(w,0,w,e.rowCount-1,"col"),c());const J=e.selection.value,xe=!l.canSortColumns(J.startCol,J.endCol);G(f.clientX,f.clientY,[{label:T(e.locale.value,"insert"),action:()=>{o.saveUndo(),l.insertCols(J.startCol,J.endCol),c(),l.emitModelData()},disabled:J.endCol>=e.colCount-1},{label:T(e.locale.value,"cut"),action:()=>{o.saveUndo(),n.copyRowCol(),e.clearCellsInRange(J.startCol,J.endCol,0,e.rowCount-1),c(),l.emitModelData()}},{label:T(e.locale.value,"copy"),action:()=>n.copyRowCol()},{label:T(e.locale.value,"paste"),action:()=>{o.saveUndo(),n.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())})}},{label:T(e.locale.value,"delete"),action:()=>{o.saveUndo(),l.deleteCols(J.startCol,J.endCol),c(),l.emitModelData()}},{label:T(e.locale.value,"sort"),disabled:xe,children:[{label:T(e.locale.value,"sortAsc"),action:()=>{l.prepareSortConfirmation("asc")||l.sortSelectedColumns("asc")},disabled:xe},{label:T(e.locale.value,"sortDesc"),action:()=>{l.prepareSortConfirmation("desc")||l.sortSelectedColumns("desc")},disabled:xe}]},{label:`${T(e.locale.value,"colWidth")}...`,action:()=>B("col",Y,q)},{label:T(e.locale.value,"defaultColWidth"),action:()=>l.resetColWidth()}])}function u(f,w,Y){f.preventDefault(),e.isSelected(w,Y)||(e.selectCell(w,Y),c());const q=e.selection.value,M=!!(q&&q.startCol===q.endCol&&q.startRow===q.endRow);G(f.clientX,f.clientY,[{label:T(e.locale.value,"cut"),action:()=>{n.cutSelected(),l.emitModelData()}},{label:T(e.locale.value,"copy"),action:()=>n.copyToClipboard()},{label:T(e.locale.value,"paste"),action:()=>{o.saveUndo(),n.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())})}},{label:T(e.locale.value,"delete"),action:()=>{o.saveUndo(),n.clearSelected(),c(),l.emitModelData()}},{label:T(e.locale.value,"calculate"),children:[{label:T(e.locale.value,"sum"),action:n.sumSelected,disabled:M},{label:T(e.locale.value,"avg"),action:n.avgSelected,disabled:M},{label:T(e.locale.value,"count"),action:n.countSelected,disabled:M}]}])}const O=t.ref(null),ke=t.ref(null);let Ee=null;function h(){Ee&&(document.removeEventListener("mousedown",Ee),Ee=null)}function B(f,w,Y){h();const q=e.selection.value;let M="";if(q){const Ve=f==="row"?e.getRowHeight(q.startRow):e.colWidths.value[q.startCol];M=Ve!=null&&Ve>0?String(Math.round(Ve)):""}const J=220,xe=118;let De=w,be=Y;De+J>window.innerWidth&&(De=window.innerWidth-J-8),be+xe>window.innerHeight&&(be=window.innerHeight-xe-8),De<8&&(De=8),be<8&&(be=8),ke.value={type:f,x:De,y:be,value:M,error:""},Ee=()=>{ke.value=null},setTimeout(()=>document.addEventListener("mousedown",Ee,{once:!0}),0),t.nextTick(()=>{const Ve=O.value;Ve&&(Ve.focus(),Ve.select())})}function Be(f){const w=ke.value;if(!w)return;const Y=f.target,q=Y.value,M=q.replace(/[^\d]/g,"");w.value=M,q!==M&&(Y.value=M),w.error=""}function je(f){f.key==="Enter"?(f.preventDefault(),ie()):f.key==="Escape"&&(f.preventDefault(),Te())}function it(){const f=ke.value;if(!f)return;const w=f.value.trim(),Y=Number(w),q=f.type==="row",M=q?24:30,J=q?500:1e3;if(w===""||!Number.isFinite(Y)){Te();return}const xe=Math.max(M,Math.min(J,Math.round(Y)));f.value=String(xe),f.error=""}function ie(){const f=ke.value,w=e.selection.value;if(!f||!w)return;const Y=f.value.trim(),q=Number(Y),M=f.type==="row",J=M?24:30,xe=M?500:1e3;if(Y===""||!Number.isFinite(q)){f.error=T(e.locale.value,"dimNumberError");return}if(q<J||q>xe){f.error=T(e.locale.value,"dimRangeError").replace("{min}",String(J)).replace("{max}",String(xe));return}const De=q;if(o.saveUndo(),M)for(let be=w.startRow;be<=w.endRow;be++)e.rowHeights.value[be]=De;else for(let be=w.startCol;be<=w.endCol;be++)e.colWidths.value[be]=De;c(),l.emitModelData(),Te()}function Te(){h(),ke.value=null}const Fe=t.computed(()=>{const f=!e.editingCell.value,w=e.editingCell.value??e.activeCell.value,Y=w.col,q=w.row,M=e.resolveStyle(e.cells[e.cellKey(Y,q)]),J=e.cellFontSize(Y,q),xe=typeof(M==null?void 0:M.fontFamily)=="string"&&M.fontFamily?M.fontFamily:sl,De=(M==null?void 0:M.fontWeight)==="bold"?"bold":"normal",be=(M==null?void 0:M.fontStyle)==="italic"?"italic":"normal",Ve=(M==null?void 0:M.underline)==="underline"?"underline":(M==null?void 0:M.strikethrough)==="line-through"?"line-through":"none",et=(M==null?void 0:M.underline)==="underline"&&(M==null?void 0:M.strikethrough)==="line-through"?"underline line-through":Ve,st=typeof(M==null?void 0:M.color)=="string"?M.color:void 0,Bt=typeof(M==null?void 0:M.backgroundColor)=="string"?M.backgroundColor:void 0,St=typeof(M==null?void 0:M.numberFormat)=="string"?M.numberFormat:"",zt=e.editValue.value??e.getCellValue(Y,q),rl=typeof(M==null?void 0:M.textAlign)=="string"?M.textAlign:en(zt,St)?"right":"left",Yt=typeof(M==null?void 0:M.verticalAlign)=="string"?M.verticalAlign:"top",It=e.findMerge(Y,q),wl=It?e.colPositions.value[It.range.endCol+1]-e.colPositions.value[Y]:e.colWidths.value[Y],Ft=It?e.rowPositions.value[It.range.endRow+1]-e.rowPositions.value[q]:e.getRowHeight(q),al=2,{ascent:il,descent:pt}=e.measureFontMetrics(xe,J,De,be),gl=il+pt,de=(e.editValue.value?e.editValue.value.split(`
8
- `).length:1)*gl,ve=e.BASE_CELL_VPAD-al;let He=0,_e=0;return Yt==="middle"?(He=Math.floor((Ft-de)/2),_e=Math.max(0,Ft-de-He)):Yt==="top"?(He=ve,_e=Math.max(0,Ft-de-He)):Yt==="bottom"&&(_e=ve,He=Math.max(0,Ft-de-_e)),{left:`${52+e.colPositions.value[Y]-e.scrollX.value}px`,top:`${24+e.rowPositions.value[q]-e.scrollY.value}px`,width:`${wl}px`,height:`${Ft}px`,fontFamily:xe,fontSize:`${J}px`,lineHeight:1,fontWeight:De,fontStyle:be,textDecoration:et,textAlign:rl,paddingTop:`${He}px`,paddingRight:"3px",paddingBottom:`${_e}px`,paddingLeft:"3px",opacity:f?0:1,pointerEvents:f?"none":"auto",color:f?"transparent":st,caretColor:f?"transparent":void 0,borderColor:f?"transparent":void 0,background:f?"transparent":Bt,boxShadow:f?"none":void 0}});function ot(){return Math.max(0,l.viewSize.w-52-11)}function Je(){return Math.max(0,l.viewSize.h-24-11)}const qe=t.computed(()=>ot()),Qe=t.computed(()=>Je()),ct=t.computed(()=>Math.max(0,qe.value-11*2)),bt=t.computed(()=>Math.max(0,Qe.value-11*2)),yt=t.computed(()=>l.maxScrollX.value<=0?ct.value:Math.max(24,ot()/e.totalWidth.value*ct.value)),Tt=t.computed(()=>l.maxScrollX.value<=0?0:e.scrollX.value/l.maxScrollX.value*(ct.value-yt.value)),At=t.computed(()=>l.maxScrollY.value<=0?bt.value:Math.max(24,Je()/e.totalHeight.value*bt.value)),xt=t.computed(()=>l.maxScrollY.value<=0?0:e.scrollY.value/l.maxScrollY.value*(bt.value-At.value));let mt=null,Rt=0,Mt=0;function Kt(f){f.preventDefault(),mt="v",Rt=f.clientY,Mt=e.scrollY.value,document.addEventListener("mousemove",A),document.addEventListener("mouseup",N)}function Pt(f){f.preventDefault(),mt="h",Rt=f.clientX,Mt=e.scrollX.value,document.addEventListener("mousemove",A),document.addEventListener("mouseup",N)}function A(f){if(mt==="v"){const Y=(f.clientY-Rt)/(bt.value-At.value);l.clampScroll(null,Mt+Y*l.maxScrollY.value),c()}else if(mt==="h"){const Y=(f.clientX-Rt)/(ct.value-yt.value);l.clampScroll(Mt+Y*l.maxScrollX.value,null),c()}}function N(){mt=null,document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",N)}function W(f){if(mt)return;const w=f.currentTarget.getBoundingClientRect(),Y=f.clientY-w.top;Y<xt.value?l.clampScroll(null,e.scrollY.value-Je()):Y>xt.value+At.value&&l.clampScroll(null,e.scrollY.value+Je()),c()}function ue(f){if(mt)return;const w=f.currentTarget.getBoundingClientRect(),Y=f.clientX-w.left;Y<Tt.value?l.clampScroll(e.scrollX.value-ot(),null):Y>Tt.value+yt.value&&l.clampScroll(e.scrollX.value+ot(),null),c()}let L=!1,X=0,fe=0,re=!1,Se=!1,Ie=0,Oe=0,C=0,V=0,F=0,Q=0,oe=0,d=0,R=!1,_=!1,$=0,z=0,H="cell",ne=0,ae=-1,ze=-1;function lt(f){if(f.button!==0)return;f.preventDefault(),ye.value=null;const w=Jt(f,l.canvasRef.value);if(w.y<24&&w.x>=52){const M=w.x-52+e.scrollX.value,J=e.hitCol(M);if(J>=0&&Math.abs(w.x-(52+e.colPositions.value[J+1]-e.scrollX.value))<=4){o.saveUndo(),re=!0,Ie=J,C=e.colWidths.value[J],V=M,c();return}}if(w.x<52&&w.y>=24){const M=w.y-24+e.scrollY.value,J=e.hitRow(M);if(J>=0&&Math.abs(w.y-(24+e.rowPositions.value[J+1]-e.scrollY.value))<=4){o.saveUndo(),Se=!0,Oe=J,C=e.getRowHeight(J),V=M,c();return}}if(w.x<52||w.y<24){{const M=l.formulaBarRef.value,J=!!(M&&typeof document<"u"&&document.activeElement===M);(e.editingCell.value||J||b)&&le()}if(w.y<24&&w.x>=52){const M=e.hitCol(w.x-52+e.scrollX.value);M>=0&&(e.selectRange(M,0,M,e.rowCount-1,"col"),L=!0,X=M,fe=0)}else if(w.x<52&&w.y>=24){const M=e.hitRow(w.y-24+e.scrollY.value);M>=0&&(e.selectRange(0,M,e.colCount-1,M,"row"),L=!0,X=0,fe=M)}else w.x<52&&w.y<24&&e.selectAll();c();return}const Y=e.hitCol(w.x-52+e.scrollX.value),q=e.hitRow(w.y-24+e.scrollY.value);if(!(Y<0||q<0)){{const M=l.formulaBarRef.value,J=!!(M&&typeof document<"u"&&document.activeElement===M);(e.editingCell.value||J||b)&&le()}if(f.shiftKey&&e.selection.value){const M=e.selection.value;e.selectRange(M.startCol,M.startRow,Y,q)}else e.selectCell(Y,q);L=!0,X=Y,fe=q,l.focusEditInput(),c()}}function rt(f){if(re){const J=Jt(f,l.canvasRef.value).x-52+e.scrollX.value-V,xe=C+J;xe>=30&&xe<=1e3?e.colWidths.value[Ie]=xe:xe<30?e.colWidths.value[Ie]=30:e.colWidths.value[Ie]=1e3,c();return}if(Se){const J=Jt(f,l.canvasRef.value).y-24+e.scrollY.value-V,xe=C+J;xe>=24&&xe<=500?e.rowHeights.value[Oe]=xe:xe<24?e.rowHeights.value[Oe]=24:e.rowHeights.value[Oe]=500,c();return}if(!L){const M=l.canvasRef.value;if(!M)return;if(o.paintFmt.value){M.style.cursor="copy";return}const J=Jt(f,M);if(J.y<24&&J.x>=52){const xe=e.hitCol(J.x-52+e.scrollX.value);if(xe>=0&&Math.abs(J.x-(52+e.colPositions.value[xe+1]-e.scrollX.value))<=4){M.style.cursor="col-resize";return}}if(J.x<52&&J.y>=24){const xe=e.hitRow(J.y-24+e.scrollY.value);if(xe>=0&&Math.abs(J.y-(24+e.rowPositions.value[xe+1]-e.scrollY.value))<=4){M.style.cursor="row-resize";return}}M.style.cursor="cell";return}const w=Jt(f,l.canvasRef.value);if(X<0||fe<0)return;if(w.x<52||w.y<24){if(w.y<24&&w.x>=52){const M=e.hitCol(w.x-52+e.scrollX.value);M>=0&&e.selectRange(Math.min(X,M),0,Math.max(X,M),e.rowCount-1,"col")}else if(w.x<52&&w.y>=24){const M=e.hitRow(w.y-24+e.scrollY.value);M>=0&&e.selectRange(0,Math.min(fe,M),e.colCount-1,Math.max(fe,M),"row")}c();return}const Y=e.hitCol(w.x-52+e.scrollX.value),q=e.hitRow(w.y-24+e.scrollY.value);Y<0||q<0||(fe===0&&X>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(X,Y),0,Math.max(X,Y),e.rowCount-1,"col"):X===0&&fe>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(fe,q),e.colCount-1,Math.max(fe,q),"row"):e.selectRange(X,fe,Y,q),c())}function at(f){const w=re||Se;L=!1,re=!1,Se=!1,w&&l.scheduleOptEmit(),o.paintFmt.value&&o.applyPaintFormat()}function wt(){const f=re||Se;L=!1,re=!1,Se=!1,f&&l.scheduleOptEmit()}function Vt(f){f.preventDefault();const w=Jt(f,l.canvasRef.value);if(w.x<52&&w.y<24){U(f);return}if(w.y<24&&w.x>=52){const Y=e.hitCol(w.x-52+e.scrollX.value);Y>=0&&s(f,Y);return}if(w.x<52&&w.y>=24){const Y=e.hitRow(w.y-24+e.scrollY.value);Y>=0&&x(f,Y);return}if(w.x>=52&&w.y>=24){const Y=e.hitCol(w.x-52+e.scrollX.value),q=e.hitRow(w.y-24+e.scrollY.value);Y>=0&&q>=0&&u(f,Y,q)}}function kt(f){const w=Jt(f,l.canvasRef.value);if(w.x<52||w.y<24)return;const Y=e.hitCol(w.x-52+e.scrollX.value),q=e.hitRow(w.y-24+e.scrollY.value);if(!(Y<0||q<0)){{const M=l.formulaBarRef.value,J=!!(M&&typeof document<"u"&&document.activeElement===M);(e.editingCell.value||J||b)&&le()}e.selectCell(Y,q),e.ensureVisible(Y,q),e.startEdit(),c(),l.focusEditInput()}}function ml(f){l.clampScroll(e.scrollX.value+f.deltaX,e.scrollY.value+f.deltaY),c()}function Gt(f){if(f.touches.length!==1){R=!1;return}const w=f.touches[0],Y=l.canvasRef.value;if(!Y)return;const q=Y.getBoundingClientRect(),M=w.clientX-q.left,J=w.clientY-q.top;M>=52&&J>=24?(f.preventDefault(),R=!0,_=!1,H="cell",F=M,Q=J,oe=e.scrollX.value,d=e.scrollY.value,$=e.hitCol(M-52+e.scrollX.value),z=e.hitRow(J-24+e.scrollY.value)):M>=0&&J>=0&&(M<52||J<24)&&(f.preventDefault(),R=!0,_=!1,F=M,Q=J,oe=e.scrollX.value,d=e.scrollY.value,J<24&&M>=52?(H="col",$=e.hitCol(M-52+e.scrollX.value),z=-1):M<52&&J>=24?(H="row",z=e.hitRow(J-24+e.scrollY.value),$=-1):(H="all",$=-1,z=-1))}function ol(f){if(!R||f.touches.length!==1)return;const w=f.touches[0],Y=l.canvasRef.value;if(!Y)return;const q=Y.getBoundingClientRect(),M=w.clientX-q.left,J=w.clientY-q.top;(Math.abs(M-F)>8||Math.abs(J-Q)>8)&&(_=!0,f.preventDefault(),l.clampScroll(oe+(F-M),d+(Q-J)),c())}function pl(){if(R&&(R=!1,!_))if(H==="cell"&&$>=0&&z>=0){const f=Date.now();$===ae&&z===ze&&f-ne<300?(e.selectCell($,z),e.startEdit(),c(),l.focusEditInput(),ne=0):(e.commitEdit(),e.selectCell($,z),c(),ne=f),ae=$,ze=z,l.focusEditInput()}else H==="col"&&$>=0?(e.commitEdit(),e.selectRange($,0,$,e.rowCount-1,"col"),c()):H==="row"&&z>=0?(e.commitEdit(),e.selectRange(0,z,e.colCount-1,z,"row"),c()):H==="all"&&(e.commitEdit(),e.selectAll(),c())}function Cl(f){return f.isComposing||f.key==="Process"||f.keyCode===229}function En(f){return f.key.length===1&&!f.ctrlKey&&!f.metaKey&&!f.altKey}function Sn(f){if(e.editingCell.value)return;const w=f.ctrlKey||f.metaKey,Y=f.shiftKey;switch(!0){case(w&&(f.key==="c"||f.key==="C")):f.preventDefault(),n.copyToClipboard();return;case(w&&(f.key==="x"||f.key==="X")):f.preventDefault(),n.cutSelected();return;case(w&&(f.key==="z"||f.key==="Z")):f.preventDefault(),o.undo();return;case(w&&(f.key==="y"||f.key==="Y")):f.preventDefault(),o.redo();return;case(w&&(f.key==="v"||f.key==="V")):f.preventDefault(),o.saveUndo(),n.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())});return;case(w&&(f.key==="a"||f.key==="A")):f.preventDefault(),e.selectAll(),c();return;case(w&&f.key==="Home"):f.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),c();return;case(w&&f.key==="End"):f.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),c();return;case f.key==="Home":f.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),c();return;case f.key==="End":f.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),c();return;case f.key==="ArrowUp":f.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case f.key==="ArrowDown":f.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case f.key==="ArrowLeft":f.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case f.key==="ArrowRight":f.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case f.key==="Tab":f.preventDefault(),e.moveActive(Y?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case f.key==="Enter":f.preventDefault(),e.moveActive(0,Y?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case f.key==="F2":f.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),c(),l.focusEditInput();return;case f.key==="Delete":case f.key==="Backspace":f.preventDefault(),o.saveUndo(),n.clearSelected(),c();return;case f.key==="Escape":f.preventDefault(),e.cancelEdit(),o.paintFmt.value=null,c();return;case En(f):if(Cl(f)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),c(),l.focusEditInput();return}f.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(f.key),c(),t.nextTick(()=>{const q=l.editInputRef.value;q&&(q.focus(),q.setSelectionRange(1,1))});return}}let Ul=!1,Kl=!1;function yc(f){const w=f.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(w),y.value=w,c();return}e.editValue.value=w,y.value=w}function vc(){Ul=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),y.value="",c())}function Cc(f){Ul=!1,Kl=!0,setTimeout(()=>{Kl=!1},0);const w=f.target.value;e.editValue.value=w,y.value=w}function wc(f){if(!e.editingCell.value){if(En(f)||Cl(f))return;Sn(f);return}if(!(Ul||Cl(f))&&!(Kl&&(f.key==="Enter"||f.key==="Escape")))if(f.key==="Enter"&&(f.altKey||f.metaKey)){f.preventDefault();const w=l.editInputRef.value;if(!w)return;const Y=w.selectionStart??w.value.length,q=w.selectionEnd??w.value.length,M=w.value,J=M.slice(0,Y)+`
9
- `+M.slice(q);e.editValue.value=J,w.value=J,w.selectionStart=w.selectionEnd=Y+1,c()}else f.key==="Enter"?(f.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c(),l.focusEditInput()):f.key==="Tab"?(f.preventDefault(),e.commitEdit(),e.moveActive(f.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c(),l.focusEditInput()):f.key==="Escape"&&(f.preventDefault(),e.cancelEdit(),c(),l.focusEditInput())}function kc(f){e.editingCell.value}function Ec(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),c())},0)}let Et=null;function hl(){var w;const f=(w=l.wrapperRef.value)==null?void 0:w.getBoundingClientRect();if(f){const Y=qt(e.props.width),q=qt(e.props.height);Y!=null?l.viewSize.w=Y:l.viewSize.w=f.width,q!=null?l.viewSize.h=q:l.viewSize.h=f.height}l.clampScroll(null,null),c()}function Sc(){t.onMounted(()=>{const f=qt(e.props.width),w=qt(e.props.height);(f==null||w==null)&&(Et=new ResizeObserver(()=>hl()),l.wrapperRef.value&&Et.observe(l.wrapperRef.value)),t.nextTick(()=>{hl(),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(Y=>{const q=l.mkSheet(Y.name),{cells:M,styles:J}=gn(Y.cells);if(Object.assign(q.cells,M),q.styles=Y.styles??J,Y.borders)q.borders=Y.borders;else{const xe=bn(q.styles);q.styles=xe.styles,q.borders=xe.borders}if(Y.colWidths)for(const[xe,De]of Object.entries(Y.colWidths)){const be=Number(xe);be>=0&&be<e.colCount&&De>=30&&(q.colWidths[be]=De)}if(Y.rowHeights)for(const[xe,De]of Object.entries(Y.rowHeights)){const be=Number(xe);be>=0&&be<e.rowCount&&De>=24&&(q.rowHeights[be]=De)}if(Y.merges)for(const[xe,De]of Object.entries(Y.merges))q.merges[xe]={...De};return q}),l.sheets.value.length>0&&l.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const f=qt(e.props.width),w=qt(e.props.height);f!=null&&w!=null?(Et==null||Et.disconnect(),Et=null):!Et&&l.wrapperRef.value&&(Et=new ResizeObserver(()=>hl()),Et.observe(l.wrapperRef.value)),t.nextTick(()=>hl())}),t.watch(()=>e.props.theme,()=>c()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>l.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>l.emitModelData()),c()},{deep:!1}),t.watch(l.activeSheetIndex,()=>t.nextTick(()=>l.emitModelData())),t.watch(()=>l.modelData.value,f=>{if(!f||f.length===0)return;const w=JSON.stringify(f);if(w===a.value)return;a.value=w;const Y=e.selection.value?{...e.selection.value}:null,q={...e.activeCell.value};l.sheets.value=f.map(M=>{const J=l.mkSheet(M.name),{cells:xe,styles:De}=gn(M.cells);if(Object.assign(J.cells,xe),J.styles=M.styles??De,M.borders)J.borders=M.borders;else{const be=bn(J.styles);J.styles=be.styles,J.borders=be.borders}if(M.colWidths)for(const[be,Ve]of Object.entries(M.colWidths)){const et=Number(be);et>=0&&et<e.colCount&&Ve>=30&&(J.colWidths[et]=Ve)}if(M.rowHeights)for(const[be,Ve]of Object.entries(M.rowHeights)){const et=Number(be);et>=0&&et<e.rowCount&&Ve>=24&&(J.rowHeights[et]=Ve)}if(M.merges)for(const[be,Ve]of Object.entries(M.merges))J.merges[be]={...Ve};return J}),l.sheets.value.length>0&&l.loadSheet(0),Y&&(e.selection.value=Y),e.activeCell.value=q,c()},{deep:!0}),t.onBeforeUnmount(()=>{Et==null||Et.disconnect()})}return{scheduleRender:c,render:k,activeCellLabel:S,formulaBarDisplay:E,formulaBarDraft:y,formulaBarExpanded:v,onFormulaBarFocus:j,onFormulaBarInput:Z,onFormulaBarKeydown:ee,onFormulaBarBlur:Ce,acceptFormulaBarEdit:le,cancelFormulaBarEdit:P,insertFunctionIntoCell:te,renTab:Me,renTabVal:ge,onTabClick:se,onTabDblClick:Re,commitTabRename:Ke,cclTabRename:we,onTabRenameKd:me,ctxMenu:ye,ctxSubmenuLeft:pe,onCtxItemEnter:p,onTabCtxMenu:D,onTabBarCtx:I,onCornerCtx:U,onRowHdrCtx:x,onColHdrCtx:s,onCellCtx:u,dimInputRef:O,dimPanel:ke,openDimPanel:B,onDimInput:Be,onDimKeydown:je,onDimBlur:it,applyDimPanel:ie,closeDimPanel:Te,editInputStyle:Fe,hScrollbarW:qe,vScrollbarH:Qe,hTrackW:ct,vTrackH:bt,hThumbW:yt,hThumbL:Tt,vThumbH:At,vThumbT:xt,onVStart:Kt,onHStart:Pt,onSbMove:A,onSbUp:N,onVTrk:W,onHTrk:ue,onMouseDown:lt,onMouseMove:rt,onMouseUp:at,onMouseLeave:wt,onCanvasCtx:Vt,onDblClick:kt,onWheel:ml,onTouchStart:Gt,onTouchMove:ol,onTouchEnd:pl,onKeydown:Sn,onEditInput:yc,onEditCompositionStart:vc,onEditCompositionEnd:Cc,onEditKd:wc,onEditPaste:kc,onEditBlur:Ec,applySize:hl,setupLifecycle:Sc}}function Zi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function wn(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 qi(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 Ji(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(Zi(o),"gi"),()=>n):e}function Wl(e,o,n,l,a,i,r){const m=[];if(r){for(let c=r.startRow;c<=r.endRow;c++)for(let g=r.startCol;g<=r.endCol;g++){const k=e[n(g,c)];k&&wn(k.value,l,a,i)&&m.push({sheetIndex:o,col:g,row:c})}return m}for(const c in e){const g=e[c];if(g&&wn(g.value,l,a,i)){const k=c.split(","),S=Number(k[0]),y=Number(k[1]);!Number.isNaN(S)&&!Number.isNaN(y)&&m.push({sheetIndex:o,col:S,row:y})}}return m}function Qi(e,o,n,l){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),m=t.ref("sheet"),c=t.ref(!1),g=t.ref(!1),k=t.ref(-1),S=t.ref([]),y=t.ref(""),v=t.ref(0),E=t.ref(""),j=t.computed(()=>{const G=new Set,pe=n.activeSheetIndex.value;for(const p of S.value)p.sheetIndex===pe&&G.add(`${p.col},${p.row}`);return G}),Z=t.computed(()=>{if(k.value<0||k.value>=S.value.length)return null;const G=S.value[k.value];return G.sheetIndex!==n.activeSheetIndex.value?null:`${G.col},${G.row}`});e.findHighlight=(G,pe)=>{const p=`${G},${pe}`;return Z.value===p?"active":j.value.has(p)?"match":null};function te(G){var D,I;const pe=e.cellKey(G.col,G.row);if(G.sheetIndex===n.activeSheetIndex.value)return((D=e.cells[pe])==null?void 0:D.value)??"";const p=n.sheets.value[G.sheetIndex];return((I=p==null?void 0:p.cells[pe])==null?void 0:I.value)??""}function K(G,pe){const p=e.cellKey(G.col,G.row);if(G.sheetIndex===n.activeSheetIndex.value)e.setCellValue(G.col,G.row,pe);else{const D=n.sheets.value[G.sheetIndex];if(!D)return;const I=D.cells[p];D.cells[p]={value:String(pe),styleId:I==null?void 0:I.styleId}}}function b(){if(E.value){y.value=E.value;return}if(!i.value){y.value="";return}if(m.value==="selection"&&!e.selection.value){y.value=T(e.locale.value,"findNeedSelection");return}if(S.value.length===0){y.value=T(e.locale.value,"findNoResult");return}y.value=""}function le(){const G=i.value,pe=[];if(G)if(m.value==="workbook")n.sheets.value.forEach((p,D)=>{pe.push(...Wl(p.cells,D,e.cellKey,G,c.value,g.value))});else if(m.value==="selection"){const p=e.selection.value;p&&pe.push(...Wl(e.cells,n.activeSheetIndex.value,e.cellKey,G,c.value,g.value,p))}else pe.push(...Wl(e.cells,n.activeSheetIndex.value,e.cellKey,G,c.value,g.value));S.value=pe,pe.length===0?k.value=-1:k.value>=pe.length?k.value=pe.length-1:k.value<0&&(k.value=0),b()}function P(){if(k.value<0||k.value>=S.value.length)return;const G=S.value[k.value];G.sheetIndex!==n.activeSheetIndex.value&&n.switchSheet(G.sheetIndex),m.value==="selection"?e.activeCell.value={col:G.col,row:G.row}:e.selectCell(G.col,G.row),e.ensureVisible(G.col,G.row)}const ee=typeof requestAnimationFrame=="function"?requestAnimationFrame:G=>setTimeout(G,16);let Ce=!1,Me=!1;function ge(G){if(Ce){Me=Me||G;return}Ce=!0,Me=G,ee(()=>{var pe;Ce=!1,le(),Me&&S.value.length>0&&k.value>=0&&P(),Me=!1,(pe=e.scheduleRender)==null||pe.call(e)})}function se(){var G;a.value=!0,v.value++,le(),S.value.length>0&&(k.value=0,P()),(G=e.scheduleRender)==null||G.call(e)}function Re(){se()}function Ke(){var G;a.value=!1,S.value=[],k.value=-1,E.value="",y.value="",(G=e.scheduleRender)==null||G.call(e)}function we(){var G;S.value.length!==0&&(k.value=(k.value+1)%S.value.length,P(),(G=e.scheduleRender)==null||G.call(e))}function me(){var G;S.value.length!==0&&(k.value=(k.value-1+S.value.length)%S.value.length,P(),(G=e.scheduleRender)==null||G.call(e))}function ye(){var I,U;if(k.value<0||k.value>=S.value.length)return;const G=S.value[k.value],pe=te(G),p=qi(pe,i.value,r.value,c.value);if(p===pe)return;o.saveUndo(),K(G,p);const D=k.value;le(),S.value.length>0?(k.value=Math.min(D,S.value.length-1),we()):k.value=-1,(I=e.emitModelData)==null||I.call(e),(U=e.scheduleRender)==null||U.call(e)}function Le(){var D,I;const G=i.value;if(!G||S.value.length===0)return;o.saveUndo();let pe=0;const p=S.value.slice();for(const U of p){const x=te(U),s=Ji(x,G,r.value,c.value);s!==x&&(K(U,s),pe++)}S.value=[],k.value=-1,E.value=T(e.locale.value,"findReplacedAll").replace("{n}",String(pe)),b(),(D=e.emitModelData)==null||D.call(e),(I=e.scheduleRender)==null||I.call(e)}function $e(){const G=pe=>{if(!(pe.ctrlKey||pe.metaKey))return;const D=pe.key.toLowerCase();(D==="f"||D==="h")&&(pe.preventDefault(),se())};window.addEventListener("keydown",G),t.onBeforeUnmount(()=>window.removeEventListener("keydown",G))}return t.watch(i,()=>{a.value&&(E.value="",k.value=0,ge(!0))}),t.watch([m,c,g],()=>{a.value&&(E.value="",k.value=0,ge(!0))}),t.watch(e.cells,()=>{a.value&&ge(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&m.value==="selection"&&(k.value=0,ge(!0))}),t.watch([()=>o.undoStack.value.length,()=>o.redoStack.value.length],()=>{a.value&&ge(!1)}),{open:a,findText:i,replaceText:r,scope:m,matchCase:c,matchEntireCell:g,currentIndex:k,results:S,message:y,focusToken:v,activeSheetMatches:j,activeMatchKey:Z,openFind:se,openReplace:Re,close:Ke,recompute:le,findNext:we,findPrev:me,replace:ye,replaceAll:Le,setupLifecycle:$e}}const ec={class:"formula-bar__cell-label"},tc={class:"formula-bar__buttons"},lc=["title","aria-label"],nc=["rows","value"],oc=["title"],rc={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},ac={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},ic=["value"],cc={key:2,class:"sb-corner"},sc=["onClick","onMouseenter"],dc={class:"context-menu__label"},uc={key:0,class:"context-menu__arrow",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"22869"},fc=["onClick"],mc={class:"dim-panel__title"},pc={class:"dim-panel__body"},hc=["value"],gc={key:0,class:"dim-panel__error"},bc={class:"dim-panel__footer"},kn=ht(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=_i(o,{rowCount:o.rowCount,colCount:o.colCount,theme:o.theme,locale:o.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:x=>{},mkSheet:x=>({id:"",name:x,cells:{},merges:{},styles:[{}],borders:[{}],selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[]})},r=zi(a,i),m=Ui(a,r);Wi(r,{borderMenuOpen:m.borderMenuOpen,mergeMenuOpen:m.mergeMenuOpen});const c=Xi(a,r,n,void 0,l);i.sheets=c.sheets,i.activeSheetIndex=c.activeSheetIndex,i.saveSheet=c.saveSheet,i.loadSheet=c.loadSheet,i.mkSheet=c.mkSheet;const g=ji(a,r,m,c,l);g.setupLifecycle();const k=Qi(a,r,c);k.setupLifecycle();const S=t.reactive(a),y=t.reactive(r),v=t.reactive(m),E=t.reactive(c),j=c.sheets,Z=c.activeSheetIndex,te=c.sortMenuOpen,K=c.cachedSortOrder,b=t.reactive(g),le=t.reactive(k),P=t.computed(()=>{const x=S.selection;return!!x&&x.startCol===x.endCol&&x.startRow===x.endRow}),ee=t.computed(()=>{const x=S.selection;return x?c.canSortColumns(x.startCol,x.endCol):!1}),Ce=t.computed(()=>{const x=y.selNumberFormat;if(x!==Dt&&x!==Lt)return x;const s=S.activeCell,u=a.resolveStyle(S.cells[S.cellKey(s.col,s.row)]);return typeof(u==null?void 0:u.numberFormat)=="string"?u.numberFormat:""});function Me(x){r.nfDialogOpen.value=x}const ge=t.ref(!1);function se(){ge.value=!0}function Re(x){ge.value=x}function Ke(x){g.insertFunctionIntoCell(x)}function we(x){r.fontSizeMenuOpen.value=x}function me(x){r.textColorMenuOpen.value=x}function ye(x){r.fillColorMenuOpen.value=x}function Le(x){g.renTabVal.value=x}function $e(){g.ctxMenu.value=null}const G=x=>{c.formulaBarRef.value=x};function pe(){g.formulaBarExpanded.value=!g.formulaBarExpanded.value}const p=x=>{c.wrapperRef.value=x},D=x=>{c.canvasRef.value=x},I=x=>{c.editInputRef.value=x},U=x=>{g.dimInputRef.value=x};return(x,s)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(E.outerStyle)},[t.createVNode(ra,{locale:S.locale,"can-undo":y.canUndo,"can-redo":y.canRedo,"paint-fmt-active":y.paintFmt!==null,"has-selection":y.hasSelection,"font-family-options":y.fontFamilyOptions,"font-size-options":y.fontSizeOptions,"sel-font-family":y.selFontFamily,"sel-font-size":y.selFontSize,"font-size-input":y.fontSizeInput,"font-size-menu-open":y.fontSizeMenuOpen,"sel-font-weight":y.selFontWeight,"sel-font-style":y.selFontStyle,"sel-underline":y.selUnderline,"sel-strikethrough":y.selStrikethrough,"sel-text-color":y.selTextColor,"text-color-menu-open":y.textColorMenuOpen,"sel-fill-color":y.selFillColor,"fill-color-menu-open":y.fillColorMenuOpen,"cached-text-color":y.cachedTextColor,"cached-fill-color":y.cachedFillColor,"border-menu-open":v.borderMenuOpen,"cached-border":v.cachedBorder,"sort-menu-open":t.unref(te),"cached-sort-order":t.unref(K),"can-sort":ee.value,"h-align-options":y.hAlignOptions,"v-align-options":y.vAlignOptions,"sel-h-align":y.selHAlign,"sel-v-align":y.selVAlign,"sel-wrap":y.selWrap,"merge-menu-open":v.mergeMenuOpen,"calc-menu-open":v.calcMenuOpen,"is-single-cell":P.value,"sel-number-format":y.selNumberFormatDisplay,"nf-options":y.nfOptions,"can-increase-decimals":y.canIncreaseDecimals,"can-decrease-decimals":y.canDecreaseDecimals,"theme-vars":E.toolbarThemeVars,onUndo:s[0]||(s[0]=u=>y.undo()),onRedo:s[1]||(s[1]=u=>y.redo()),onPaintFormat:y.onPaintFormat,onClearFormat:s[2]||(s[2]=u=>y.clearFormat()),onNumberFormatChange:s[3]||(s[3]=u=>y.onNumberFormatChange(u)),onIncreaseDecimals:y.onIncreaseDecimals,onDecreaseDecimals:y.onDecreaseDecimals,onFontFamilyChange:s[4]||(s[4]=u=>y.onFontFamilyChange(u)),onFontSizeInput:s[5]||(s[5]=u=>y.onFontSizeInput(u)),onFontSizeBlur:y.onFontSizeBlur,onFontSizeKeydown:s[6]||(s[6]=u=>y.onFontSizeKeydown(u)),onFontSizeChange:s[7]||(s[7]=u=>y.onFontSizeChange(u)),"onUpdate:fontSizeMenuOpen":s[8]||(s[8]=u=>we(u)),onFontSizeToggle:s[9]||(s[9]=u=>y.toggleFontSizeMenu()),onFontSizeStepUp:y.onFontSizeStepUp,onFontSizeStepDown:y.onFontSizeStepDown,onBoldToggle:y.toggleFontWeight,onItalicToggle:y.toggleFontStyle,onUnderlineToggle:y.toggleUnderline,onStrikethroughToggle:y.toggleStrikethrough,onTextColorChange:s[10]||(s[10]=u=>y.onTextColorChange(u)),"onUpdate:textColorMenuOpen":s[11]||(s[11]=u=>me(u)),onFillColorChange:s[12]||(s[12]=u=>y.onFillColorChange(u)),"onUpdate:fillColorMenuOpen":s[13]||(s[13]=u=>ye(u)),onApplyTextColor:y.applyCachedTextColor,onApplyFillColor:y.applyCachedFillColor,"onUpdate:borderMenuOpen":s[14]||(s[14]=u=>y.onBorderMenuToggle(u)),onBorderChange:s[15]||(s[15]=u=>v.onBorderChange(u)),onApplyBorder:v.applyCachedBorder,"onUpdate:sortMenuOpen":s[16]||(s[16]=u=>E.onSortMenuToggle(u)),onSortChange:s[17]||(s[17]=u=>E.onSortChange(u)),onApplySort:E.applyCachedSort,onHAlignChange:s[18]||(s[18]=u=>y.onHAlignChange(u)),onVAlignChange:s[19]||(s[19]=u=>y.onVAlignChange(u)),onWrapToggle:y.onWrapToggle,"onUpdate:mergeMenuOpen":s[20]||(s[20]=u=>v.onMergeMenuToggle(u)),onMergeChange:s[21]||(s[21]=u=>v.onMergeChange(u)),onApplyMerge:v.onApplyMerge,"onUpdate:calcMenuOpen":s[22]||(s[22]=u=>v.onCalcMenuToggle(u)),onCalcSum:v.onCalcSum,onCalcAvg:v.onCalcAvg,onCalcCount:v.onCalcCount,onFind:s[23]||(s[23]=u=>t.unref(k).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","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(Ta,{open:le.open,"find-text":le.findText,"replace-text":le.replaceText,scope:le.scope,"match-case":le.matchCase,"match-entire-cell":le.matchEntireCell,"current-index":le.currentIndex,total:le.results.length,message:le.message,"focus-token":le.focusToken,locale:S.locale,"theme-vars":E.toolbarThemeVars,"onUpdate:findText":s[24]||(s[24]=u=>t.unref(k).findText.value=u),"onUpdate:replaceText":s[25]||(s[25]=u=>t.unref(k).replaceText.value=u),"onUpdate:scope":s[26]||(s[26]=u=>t.unref(k).scope.value=u),"onUpdate:matchCase":s[27]||(s[27]=u=>t.unref(k).matchCase.value=u),"onUpdate:matchEntireCell":s[28]||(s[28]=u=>t.unref(k).matchEntireCell.value=u),onPrev:s[29]||(s[29]=u=>t.unref(k).findPrev()),onNext:s[30]||(s[30]=u=>t.unref(k).findNext()),onReplace:s[31]||(s[31]=u=>t.unref(k).replace()),onReplaceAll:s[32]||(s[32]=u=>t.unref(k).replaceAll()),onClose:s[33]||(s[33]=u=>t.unref(k).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(oi,{"model-open":y.nfDialogOpen,locale:S.locale,"current-format":Ce.value,"is-custom":y.selNumberFormat===t.unref(Lt),"onUpdate:modelOpen":s[34]||(s[34]=u=>Me(u)),onApply:s[35]||(s[35]=u=>y.applyNumberFormatCode(u))},null,8,["model-open","locale","current-format","is-custom"]),t.createVNode(mi,{"model-open":E.sortConfirmOpen,locale:S.locale,"onUpdate:modelOpen":s[36]||(s[36]=u=>E.sortConfirmOpen=u),onConfirm:s[37]||(s[37]=u=>E.confirmSort(u)),onCancel:s[38]||(s[38]=u=>E.cancelSortConfirmation())},null,8,["model-open","locale"]),t.createVNode(Vi,{"model-open":ge.value,locale:S.locale,"onUpdate:modelOpen":s[39]||(s[39]=u=>Re(u)),onInsert:s[40]||(s[40]=u=>Ke(u))},null,8,["model-open","locale"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":b.formulaBarExpanded}])},[t.createElementVNode("div",ec,t.toDisplayString(b.activeCellLabel),1),t.createElementVNode("div",tc,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:s[41]||(s[41]=t.withModifiers(()=>{},["prevent"])),onClick:s[42]||(s[42]=t.withModifiers((...u)=>b.cancelFormulaBarEdit&&b.cancelFormulaBarEdit(...u),["stop"]))},[...s[93]||(s[93]=[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:s[43]||(s[43]=t.withModifiers(()=>{},["prevent"])),onClick:s[44]||(s[44]=t.withModifiers((...u)=>b.acceptFormulaBarEdit&&b.acceptFormulaBarEdit(...u),["stop"]))},[...s[94]||(s[94]=[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)(S.locale,"insertFunctionTitle"),"aria-label":t.unref(T)(S.locale,"insertFunctionTitle"),onMousedown:s[45]||(s[45]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(se,["stop"])},[...s[95]||(s[95]=[t.createElementVNode("span",{class:"formula-bar__fx-label"},"fx",-1)])],40,lc)]),t.createElementVNode("textarea",{ref:G,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":b.formulaBarExpanded}]),rows:b.formulaBarExpanded?3:1,value:b.formulaBarDisplay,spellcheck:"false",onFocus:s[46]||(s[46]=(...u)=>b.onFormulaBarFocus&&b.onFormulaBarFocus(...u)),onInput:s[47]||(s[47]=(...u)=>b.onFormulaBarInput&&b.onFormulaBarInput(...u)),onKeydown:s[48]||(s[48]=(...u)=>b.onFormulaBarKeydown&&b.onFormulaBarKeydown(...u)),onBlur:s[49]||(s[49]=(...u)=>b.onFormulaBarBlur&&b.onFormulaBarBlur(...u))},null,42,nc),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:b.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:s[50]||(s[50]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(pe,["stop"])},[b.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",ac,[...s[97]||(s[97]=[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",rc,[...s[96]||(s[96]=[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,oc)],2),t.createElementVNode("div",{ref:p,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:D,class:"grid-canvas",tabindex:"0",onMousedown:s[51]||(s[51]=(...u)=>b.onMouseDown&&b.onMouseDown(...u)),onMousemove:s[52]||(s[52]=(...u)=>b.onMouseMove&&b.onMouseMove(...u)),onMouseup:s[53]||(s[53]=(...u)=>b.onMouseUp&&b.onMouseUp(...u)),onMouseleave:s[54]||(s[54]=(...u)=>b.onMouseLeave&&b.onMouseLeave(...u)),onDblclick:s[55]||(s[55]=(...u)=>b.onDblClick&&b.onDblClick(...u)),onWheel:s[56]||(s[56]=t.withModifiers((...u)=>b.onWheel&&b.onWheel(...u),["prevent"])),onFocus:s[57]||(s[57]=(...u)=>E.onCanvasFocus&&E.onCanvasFocus(...u)),onKeydown:s[58]||(s[58]=(...u)=>b.onKeydown&&b.onKeydown(...u)),onContextmenu:s[59]||(s[59]=(...u)=>b.onCanvasCtx&&b.onCanvasCtx(...u)),onTouchstart:s[60]||(s[60]=t.withModifiers((...u)=>b.onTouchStart&&b.onTouchStart(...u),["prevent"])),onTouchmove:s[61]||(s[61]=t.withModifiers((...u)=>b.onTouchMove&&b.onTouchMove(...u),["prevent"])),onTouchend:s[62]||(s[62]=(...u)=>b.onTouchEnd&&b.onTouchEnd(...u))},null,32),t.createElementVNode("textarea",{ref:I,class:"cell-editor",value:S.editValue,style:t.normalizeStyle(b.editInputStyle),onInput:s[63]||(s[63]=(...u)=>b.onEditInput&&b.onEditInput(...u)),onKeydown:s[64]||(s[64]=(...u)=>b.onEditKd&&b.onEditKd(...u)),onCompositionstart:s[65]||(s[65]=(...u)=>b.onEditCompositionStart&&b.onEditCompositionStart(...u)),onCompositionend:s[66]||(s[66]=(...u)=>b.onEditCompositionEnd&&b.onEditCompositionEnd(...u)),onBlur:s[67]||(s[67]=(...u)=>b.onEditBlur&&b.onEditBlur(...u)),onPaste:s[68]||(s[68]=(...u)=>b.onEditPaste&&b.onEditPaste(...u))},null,44,ic),E.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:t.unref(24)+"px",height:`calc(100% - ${t.unref(24)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:s[69]||(s[69]=t.withModifiers(u=>{E.clampScroll(null,S.scrollY-50),b.scheduleRender()},["prevent"]))},[...s[98]||(s[98]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:s[71]||(s[71]=(...u)=>b.onVTrk&&b.onVTrk(...u))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:b.vThumbT+"px",height:b.vThumbH+"px"}),onMousedown:s[70]||(s[70]=(...u)=>b.onVStart&&b.onVStart(...u))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:s[72]||(s[72]=t.withModifiers(u=>{E.clampScroll(null,S.scrollY+50),b.scheduleRender()},["prevent"]))},[...s[99]||(s[99]=[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:t.unref(52)+"px",width:`calc(100% - ${t.unref(52)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:s[73]||(s[73]=t.withModifiers(u=>{E.clampScroll(S.scrollX-50,null),b.scheduleRender()},["prevent"]))},[...s[100]||(s[100]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:s[75]||(s[75]=(...u)=>b.onHTrk&&b.onHTrk(...u))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:b.hThumbL+"px",width:b.hThumbW+"px"}),onMousedown:s[74]||(s[74]=(...u)=>b.onHStart&&b.onHStart(...u))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:s[76]||(s[76]=t.withModifiers(u=>{E.clampScroll(S.scrollX+50,null),b.scheduleRender()},["prevent"]))},[...s[101]||(s[101]=[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",cc)):t.createCommentVNode("",!0)]),t.createVNode(ya,{locale:S.locale,sheets:t.unref(j),"active-sheet-index":t.unref(Z),"ren-tab":b.renTab,"ren-tab-val":b.renTabVal,onTabClick:s[77]||(s[77]=u=>b.onTabClick(u)),onTabDblclick:s[78]||(s[78]=u=>b.onTabDblClick(u)),onTabContextmenu:s[79]||(s[79]=u=>b.onTabCtxMenu(u.ev,u.i)),onTabRenameInput:s[80]||(s[80]=u=>Le(u)),onTabRenameKeydown:s[81]||(s[81]=u=>b.onTabRenameKd(u)),onTabRenameCommit:b.commitTabRename,onTabbarContextmenu:s[82]||(s[82]=u=>b.onTabBarCtx(u)),onDeleteSheet:s[83]||(s[83]=u=>{E.removeSheet(u),b.scheduleRender()}),onAddSheet:s[84]||(s[84]=u=>{E.addSheet(),b.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(()=>[b.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:b.ctxMenu.x+"px",top:b.ctxMenu.y+"px"}),onClick:s[85]||(s[85]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.ctxMenu.items,(u,O)=>(t.openBlock(),t.createElementBlock("div",{key:O,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":u.disabled}]),onClick:ke=>!u.disabled&&u.action&&(u.action(),$e()),onMouseenter:ke=>b.onCtxItemEnter(ke,u)},[t.createElementVNode("span",dc,t.toDisplayString(u.label),1),u.children?(t.openBlock(),t.createElementBlock("svg",uc,[...s[102]||(s[102]=[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),u.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":b.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.children,(ke,Ee)=>(t.openBlock(),t.createElementBlock("div",{key:Ee,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":ke.disabled}]),onClick:t.withModifiers(h=>!ke.disabled&&ke.action&&(ke.action(),$e()),["stop"])},t.toDisplayString(ke.label),11,fc))),128))],2)):t.createCommentVNode("",!0)],42,sc))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[b.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:b.dimPanel.x+"px",top:b.dimPanel.y+"px"}),onMousedown:s[91]||(s[91]=t.withModifiers(()=>{},["stop"])),onClick:s[92]||(s[92]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",mc,t.toDisplayString(b.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",pc,[t.createElementVNode("input",{ref:U,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":b.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:b.dimPanel.value,onInput:s[86]||(s[86]=(...u)=>b.onDimInput&&b.onDimInput(...u)),onKeydown:s[87]||(s[87]=(...u)=>b.onDimKeydown&&b.onDimKeydown(...u)),onBlur:s[88]||(s[88]=(...u)=>b.onDimBlur&&b.onDimBlur(...u))},null,42,hc)]),b.dimPanel.error?(t.openBlock(),t.createElementBlock("div",gc,t.toDisplayString(b.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",bc,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:s[89]||(s[89]=(...u)=>b.applyDimPanel&&b.applyDimPanel(...u))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:s[90]||(s[90]=(...u)=>b.closeDimPanel&&b.closeDimPanel(...u))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-86e52c54"]]);Ut.Spreader=kn,Ut.default=kn,Object.defineProperties(Ut,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(Xt,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(Xt=typeof globalThis<"u"?globalThis:Xt||self,t(Xt.XiaoDaoSpreader={},Xt.Vue))})(this,function(Xt,t){"use strict";const Fn={"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:"关闭"},"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"}};function F(e,r){var o;return((o=Fn[e])==null?void 0:o[r])??r}const fl='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',zt=10,On=[{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'}],Hn=[{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}],Ln='<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>',$n='<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>',zn='<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>',Un='<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:Ln},{value:"center",labelKey:"alignCenter",icon:$n},{value:"right",labelKey:"alignRight",icon:_n}],Pn=[{value:"top",labelKey:"alignTop",icon:zn},{value:"middle",labelKey:"alignMiddle",icon:Wn},{value:"bottom",labelKey:"alignBottom",icon:Un}],Ql=[{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)"},Wt="__nf_custom__",Ft="",Ut="",xt="@",Fl="__NF_INVALID__",Ol=2958465,Hl=0;function Rt(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function Ll(e){return e==="zh-CN"?"¥":"$"}function Xn(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function en(e){return e.replace(/"([^"]*)"/g,"$1")}function jn(e){let r=e,o;const l=r.match(/^\[([^\]]+)\]/);l&&(o=l[1].toLowerCase(),r=r.slice(l[0].length)),r=Xn(r);const a=/E[+-]/i.test(r),i=r.includes("%"),n=r.search(/[0#?]/);if(n===-1)return{hasDigits:!1,decimals:0,minDecimals:0,minIntDigits:0,thousands:!1,scale:i?100:1,scientific:!1,prefix:r,suffix:"",color:o};let p=-1;for(let G=r.length-1;G>=0;G--){const ne=r[G];if(ne==="0"||ne==="#"||ne==="?"||ne==="E"){p=G;break}}p<0&&(p=n);const c=n>0?r.slice(0,n):"",h=p<r.length-1?r.slice(p+1):"",S=r.slice(n,p+1),x=/[0#?]/.test(S),C=S.includes(",");let R=S.replace(/,/g,"");if(a){const G=R.search(/E/i);G>=0&&(R=R.slice(0,G))}const X=R.indexOf("."),Y=X>=0?R.slice(0,X):R,te=X>=0?R.slice(X+1):"",W=(te.match(/[0#?]/g)||[]).length,y=(te.match(/0/g)||[]).length,oe=(Y.match(/0/g)||[]).length;return{hasDigits:x,decimals:W,minDecimals:y,minIntDigits:oe,thousands:C,scale:i?100:1,scientific:a,prefix:c,suffix:h,color:o}}function Zn(e){const r=[];let o=!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]":o=!0,r.push({type:"hour",len:0});break;case"[mm]":o=!0,r.push({type:"minute",len:2});break;case"[ss]":o=!0,r.push({type:"second",len:2});break;case"yyyy":r.push({type:"year",len:4});break;case"yy":case"y":r.push({type:"year",len:2});break;case"mmmm":r.push(o?{type:"minute",len:4}:{type:"monthName",len:4});break;case"mmm":r.push(o?{type:"minute",len:3}:{type:"monthName",len:3});break;case"mm":r.push(o?{type:"minute",len:2}:{type:"month",len:2});break;case"m":r.push(o?{type:"minute",len:1}:{type:"month",len:1});break;case"dddd":r.push({type:"weekday",len:4});break;case"ddd":r.push({type:"weekday",len:3});break;case"dd":r.push({type:"day",len:2});break;case"d":r.push({type:"day",len:1});break;case"hh":r.push({type:"hour",len:2});break;case"h":r.push({type:"hour",len:1});break;case"ss":r.push({type:"second",len:2});break;case"s":r.push({type:"second",len:1});break;case"AM/PM":case"am/pm":r.push({type:"ampm",len:2});break;default:i.startsWith('"')?r.push({type:"literal",text:en(i),len:0}):r.push({type:"literal",text:i,len:0})}}return{tokens:r,isDuration:o}}const tn=new Map;function qn(e){const r=e.replace(/\[[^\]]*\]/gi,i=>/^\[(h|mm|ss)\]$/i.test(i)?i:"");if(/[ydhs]/.test(r)||/AM\/PM/i.test(r)||/\[h\]/i.test(r)){const i=e.split(";")[0]??e,{tokens:n,isDuration:p}=Zn(i);return{kind:p?"duration":"date",sections:[],tokens:n,isDuration:p,raw:e}}return{kind:"number",sections:e.split(";").map(i=>jn(i)),tokens:[],isDuration:!1,raw:e}}function Kt(e){const r=tn.get(e);if(r)return r;const o=qn(e);return tn.set(e,o),o}function ln(e,r,o,l,a){const i=Math.pow(10,r),n=Math.round((e+Number.EPSILON)*i)/i,p=n<0,c=Math.abs(n);let S=new Intl.NumberFormat("en-US",{useGrouping:l,minimumIntegerDigits:a,minimumFractionDigits:r,maximumFractionDigits:r}).format(c);if(o<r&&r>0){const C=S.indexOf(".");if(C>=0){const w=S.substring(0,C);let R=S.substring(C+1);R=R.replace(/0+$/,""),R.length<o&&(R=R+"0".repeat(o-R.length)),S=R?`${w}.${R}`:w}}return`${p?"-":""}${S}`}function nn(e,r){if(e===0)return(r>0?"0."+"0".repeat(r):"0")+"E+00";const o=Math.floor(Math.log10(Math.abs(e))),l=e/Math.pow(10,o),a=ln(l,r,r,!1,1),i=(o>=0?"+":"-")+String(Math.abs(o)).padStart(2,"0");return`${a}E${i}`}function Jn(e,r,o){if(!o.hasDigits)return en(o.prefix+o.suffix);const l=o.scale===100?e*100:e,a=o.scientific?nn(l,o.decimals):ln(l,o.decimals,o.minDecimals,o.thousands,o.minIntDigits);return r+o.prefix+a+o.suffix}function Qn(e,r){const o=r.sections;if(o.length===0)return String(e);let l,a,i="";return e>0?(l=o[0],a=e):e<0?o[1]?(l=o[1],a=-e):(l=o[0],a=-e,i="-"):(l=o[2]??o[0],a=0),Jn(a,i,l)}function eo(e){return new Date((e-25569)*864e5)}const to=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],lo=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],on=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],no=["January","February","March","April","May","June","July","August","September","October","November","December"],oo=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],rn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function ml(e,r){return String(e).padStart(r,"0")}function ro(e,r,o,l){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,n=e.getUTCDate(),p=e.getUTCDay(),c=o==="zh-CN";let h="",S=!1;for(const x of r)switch(x.type){case"literal":h+=x.text??"";break;case"year":h+=x.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":h+=ml(S?e.getUTCMinutes():i,x.len);break;case"monthName":h+=x.len>=4?c?to[i-1]:no[i-1]:c?lo[i-1]:oo[i-1];break;case"day":h+=ml(n,x.len);break;case"weekday":h+=x.len>=4?c?on[p]:rn[p]:c?on[p].slice(2):rn[p].slice(0,3);break;case"hour":{let C=e.getUTCHours();if(x.len===0){const w=Math.floor(l*86400);C=Math.floor(w/3600)}h+=String(C),S=!0;break}case"minute":h+=ml(e.getUTCMinutes(),x.len);break;case"second":h+=ml(e.getUTCSeconds(),x.len);break;case"ampm":{const C=e.getUTCHours();h+=C<12?c?"上午":"AM":c?"下午":"PM";break}}return h}function ao(e,r){const o=Math.floor(e*86400),l=Math.floor(o/3600),a=Math.floor(o%3600/60),i=o%60;let n="";for(const p of r)switch(p.type){case"literal":n+=p.text??"";break;case"hour":n+=String(l);break;case"minute":n+=ml(a,p.len||2);break;case"second":n+=ml(i,p.len||2);break;default:n+=""}return n}function io(e){if(e==="")return e;const r=Number(e);if(!isNaN(r)&&e.trim()!==""){const o=Math.abs(r);return o!==0&&(o>=1e15||o<1e-9)?nn(r,9):e}return e}function ll(e,r,o){if(Rt(r))return io(e);if(r==null||r===xt)return e;const l=Kt(r);if(l.kind==="date"||l.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(l.kind==="date"){if(i<Hl||i>Ol)return Fl}else if(i<0)return Fl;return l.kind==="duration"?ao(i,l.tokens):ro(eo(i),l.tokens,o,i)}const a=Number(e);return isNaN(a)?e:Qn(a,l)}const co=["general","text","number","percent","scientific","accounting","financial","currency","currencyRounded","date","time","dateTime","duration","custom"];function an(e,r){if(r===xt||r==="@")return!1;if(Rt(r)){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}const o=Kt(r);return!!(o.kind==="number"&&cn(o))}function cn(e){return e.sections.some(r=>r.hasDigits)}function so(e){if(e==null||Rt(e)||e===xt||e==="@")return!1;const r=Kt(e);return!!(r.kind==="date"||r.kind==="duration"||r.kind==="number"&&cn(r))}function uo(e,r){if(r==null||Rt(r)||r===xt||r==="@")return!1;const o=Kt(r),l=Number(e);return Number.isFinite(l)?o.kind==="date"?l<Hl||l>Ol:o.kind==="duration"?l<0:!1:!1}const $l=30,_l=0;function vl(e){if(e==null||e===""||e.trim()==="")return!1;const r=Number(e);return!Number.isNaN(r)&&Number.isFinite(r)}function sn(e,r){if(e==null||e===Ft||Rt(e))return vl(r);if(e===xt)return!1;const o=Kt(e);return o.kind==="date"||o.kind==="duration"?!1:o.sections.some(l=>l.hasDigits)}function fo(e){if(!vl(e))return 0;const r=String(Number(e));return r.indexOf(".")<0||/e/i.test(r)?0:r.slice(r.indexOf(".")+1).length}function mo(e,r){if(!sn(e,r))return-1;if(e==null||e===Ft||Rt(e))return fo(r);const l=Kt(e).sections.find(a=>a.hasDigits);return l?l.decimals:-1}function po(e,r){let o=0;const l=/\[[^\]]*\]/g;let a;for(;(a=l.exec(e))!==null&&!/^\[(h|mm|ss)\]$/i.test(a[0]);)o=a.index+a[0].length;const i=e.slice(0,o),n=e.slice(o),p=n.search(/[0#?]/);if(p===-1)return e;let c=-1;for(let Y=n.length-1;Y>=0;Y--){const te=n[Y];if(te==="0"||te==="#"||te==="?"||te==="E"){c=Y;break}}if(c<p)return e;const h=n.slice(p,c+1),S=h.search(/E[+-]/i),x=S>=0?h.slice(0,S):h,C=x.indexOf("."),w=C>=0?(x.slice(C+1).match(/[0#?]/g)||[]).length:0;if(w===r)return e;let R;if(C<0)R=r>0?x+"."+"0".repeat(r):x;else if(r>w)R=x+"0".repeat(r-w);else{let Y=w-r;const te=x.split("");for(let W=te.length-1;W>=0&&Y>0;W--){const y=te[W];(y==="0"||y==="#"||y==="?")&&(te.splice(W,1),Y--)}R=te.join(""),r===0&&R.endsWith(".")&&(R=R.slice(0,-1))}const X=R+(S>=0?h.slice(S):"");return i+n.slice(0,p)+X+n.slice(c+1)}function ho(e,r){if(!Number.isInteger(r)||r<_l||r>$l||e===Ft)return null;if(e==null||Rt(e))return r>0?"0."+"0".repeat(r):"0";if(e===xt)return null;const o=Kt(e);return o.kind==="date"||o.kind==="duration"||!o.sections.some(l=>l.hasDigits)?null:e.split(";").map(l=>po(l,r)).join(";")}const zl=["¥","$","€","£"];function dn(e,r){if(e==null||e===Ft)return e??Ut;if(Rt(e))return Ut;if(e===xt||e==="@")return xt;const o=Ll(r),l=r==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",a=r==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",i=`${o}#,##0.00;(${o}#,##0.00);${o}"-"`,n="#,##0.00;[Red](#,##0.00)";if(un(r).some(w=>w.value===e))return e;const c=e.replace(/\[[^\]]*\]/gi,w=>/^\[(h|mm|ss)\]$/i.test(w)?w:"");if(/\[(h|mm|ss)\]/i.test(c)&&!/[yd]/i.test(c))return"[h]:mm:ss";const h=/[yd]/i.test(c),S=/h|s|AM\/PM/i.test(c);if(h&&S)return a;if(h||/AM\/PM/i.test(c))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 n;const x=zl.find(w=>e.startsWith(w));if(x)return e.includes("(")?i:/\.\d/.test(e.slice(x.length))?o+"#,##0.00":o+"#,##0";const C=Kt(e);return C.kind==="number"&&C.sections.some(w=>w.hasDigits)?"#,##0.00":Wt}function go(e,r){return new Date(Date.UTC(e,r,0)).getUTCDate()}function yo(e,r,o){const l=Date.UTC(e,r-1,o)/864e5+25569;return l<=60?l-1:l}function Wl(e,r,o=new Date){const l=e.trim();if(!l||l.startsWith("=")||vl(l))return null;const a=r==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",i=r==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",n="h:mm:ss";function p(C){const w=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(C);if(!w)return null;const R=Number(w[1]),X=Number(w[2]),Y=w[3]!==void 0?Number(w[3]):0;return R>23||X>59||Y>59?null:(R*3600+X*60+Y)/86400}function c(C){let w=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(C),R,X,Y;if(w)R=Number(w[1]),X=Number(w[2]),Y=Number(w[3]);else if(w=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(C))R=Number(w[1]),X=Number(w[2]),Y=Number(w[3]);else if(w=/^(\d{1,2})[-/](\d{1,2})$/.exec(C))R=o.getUTCFullYear(),X=Number(w[1]),Y=Number(w[2]);else return null;if(R<1900||R>9999||X<1||X>12||Y<1||Y>go(R,X))return null;const te=yo(R,X,Y);return te>=Hl&&te<=Ol?te:null}const h=p(l);if(h!==null)return{serial:h,format:n};const S=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(l);if(S){const C=c(S[1].trim()),w=p(S[2]);if(C!==null&&w!==null)return{serial:C+w,format:i}}const x=c(l);return x!==null?{serial:x,format:a}:null}function bo(e,r){const o=e.trim();if(!o||o.startsWith("=")||!(o.includes(",")||o.includes("%")||zl.some(W=>o.startsWith(W)))||Wl(o,r))return null;const a=zl.find(W=>o.startsWith(W)),i=a?o.slice(a.length).trim():o;if(!i)return null;const n=/^([+-]?)(\d{1,3}(?:,\d{3})+)(?:\.(\d+))?(%?)$/.exec(i)||/^([+-]?)(\d+)(?:\.(\d+))?(%?)$/.exec(i);if(!n)return null;const p=n[1]==="-"?-1:1,c=n[2].replace(/,/g,""),h=n[3],S=(n[4]??"")==="%",x=h?h.length:0,C=+(c+(h?"."+h:""));if(!Number.isFinite(C))return null;const R=i.includes(",")?"#,##0":"0",X=x>0?"."+"0".repeat(x):"",Y=(a??"")+R+X+(S?"%":"");let te=C*p;return S&&(te=te/100),te=Math.round(te*1e12)/1e12,{num:te,format:Y}}function Co(e,r,o,l){const a=Ll(e),i=l?"#,##0":"0",n=o>0?"."+"0".repeat(o):"",p=i+n;switch(r){case"general":return"";case"text":return xt;case"custom":return"";case"number":return p;case"percent":return p+"%";case"scientific":return"0."+"0".repeat(o)+"E+00";case"currency":return a+p;case"currencyRounded":return a+(l?"#,##0":"0");case"accounting":return`${a}${p};(${a}${p});${a}"-"`;case"financial":return`${p};[Red](${p})`;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 un(e){const r=Ll(e);return[{label:F(e,"nfGeneral"),value:Ut},{label:F(e,"nfText"),value:xt},{label:F(e,"nfNumber"),value:"#,##0.00"},{label:F(e,"nfPercent"),value:"0.00%"},{label:F(e,"nfScientific"),value:"0.00E+00"},{label:F(e,"nfAccounting"),value:`${r}#,##0.00;(${r}#,##0.00);${r}"-"`},{label:F(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:F(e,"nfCurrency"),value:r+"#,##0.00"},{label:F(e,"nfCurrencyRounded"),value:r+"#,##0"},{label:F(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:F(e,"nfTime"),value:"h:mm:ss"},{label:F(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:F(e,"nfDuration"),value:"[h]:mm:ss"},{label:F(e,"nfCustom"),value:Wt}]}const vo=["title"],wo=["innerHTML"],ko={key:1,class:"sp-dropdown__value"},Eo=["disabled"],So=["placeholder"],xo=["onClick"],Ro=["innerHTML"],Mo={class:"sp-dropdown__item-label"},Bo={key:2,class:"sp-dropdown__empty"},Do=["disabled"],No=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:""}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:r}){const o=e,l=r,a=t.ref(!1),i=t.ref(0),n=t.ref(null),p=t.ref(null),c=t.ref(null),h=t.ref({top:0,up:!1}),S=t.ref(void 0),x=t.ref(0),C=t.ref(!1),w=t.ref(""),R=t.ref(null),X=t.computed(()=>o.options.find(m=>String(m.value)===String(o.modelValue))),Y=t.computed(()=>o.menuWidth!==void 0?o.menuWidth:S.value),te=t.computed(()=>{if(!o.searchable||!w.value.trim())return o.options;const m=w.value.trim().toLowerCase();return o.options.filter(I=>String(I.label??"").toLowerCase().includes(m))}),W=t.computed(()=>te.value.length>0),y=t.computed(()=>Math.min(o.visibleCount,te.value.length)),oe=t.computed(()=>te.value.slice(i.value,i.value+y.value)),G=t.computed(()=>i.value>0),ne=t.computed(()=>i.value+y.value<te.value.length),be=t.computed(()=>te.value.length>y.value);function Fe(m){i.value=Math.max(0,Math.min(te.value.length-y.value,i.value+m))}function Me(){a.value=!0,o.searchable&&(w.value=""),o.modelOpen!==void 0&&l("update:modelOpen",!0);const m=o.triggerEl??n.value;if(!m)return;const I=m.getBoundingClientRect();S.value=I.width;const H=y.value*22+(be.value?2*15:0)+8+(o.searchable?34:0),D=window.innerHeight-I.bottom-4<H&&I.top-4>H;o.align==="right"?h.value={right:window.innerWidth-I.right,top:D?I.top-H-4:I.bottom+4,up:D}:h.value={left:I.left,top:D?I.top-H-4:I.bottom+4,up:D};const s=te.value.findIndex(u=>String(u.value)===String(o.modelValue));i.value=s>=0?Math.max(0,Math.min(s-Math.floor(y.value/2),te.value.length-y.value)):0,o.searchable&&t.nextTick(()=>{var u;return(u=R.value)==null?void 0:u.focus()})}function fe(){a.value=!1,w.value="",o.modelOpen!==void 0&&l("update:modelOpen",!1)}function Ce(){a.value?fe():Me()}function Ke(m){l("update:modelValue",m.value),l("change",m.value),fe()}function Se(m){var H,z;if(!a.value)return;const I=m.target;(H=n.value)!=null&&H.contains(I)||(z=c.value)!=null&&z.contains(I)||fe()}function pe(m){a.value&&(m.preventDefault(),Fe(m.deltaY>0?1:-1))}t.watch(a,m=>{t.nextTick(()=>{var I,H;m?((I=p.value)==null||I.addEventListener("wheel",pe,{passive:!1}),document.addEventListener("keydown",ye)):((H=p.value)==null||H.removeEventListener("wheel",pe),document.removeEventListener("keydown",ye))})});function ye(m){a.value&&m.key==="Escape"&&fe()}t.watch(()=>o.modelOpen,m=>{m!==void 0&&m!==a.value&&(m?Me():fe())});function Oe(m){a.value&&(x.value=m.touches[0].clientY,C.value=!0)}function He(m){if(!a.value||!C.value)return;const I=m.touches[0].clientY-x.value;Math.abs(I)>5&&(Fe(I<0?1:-1),x.value=m.touches[0].clientY)}function Q(){C.value=!1}function ae(m){m.key==="Escape"&&(m.stopPropagation(),fe())}return t.onMounted(()=>{document.addEventListener("pointerdown",Se),window.addEventListener("resize",fe),window.addEventListener("scroll",fe,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",Se),document.removeEventListener("keydown",ye),window.removeEventListener("resize",fe),window.removeEventListener("scroll",fe,!0)}),(m,I)=>{var H,z;return t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:n,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:Ce},[(H=X.value)!=null&&H.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:X.value.icon},null,8,wo)):(t.openBlock(),t.createElementBlock("span",ko,t.toDisplayString(((z=X.value)==null?void 0:z.label)??e.fallbackLabel),1)),I[5]||(I[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,vo)),(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:c,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:Y.value!==void 0?typeof Y.value=="number"?Y.value+"px":Y.value:void 0}),onKeydown:ae,onMousedown:I[4]||(I[4]=t.withModifiers(()=>{},["prevent"]))},[be.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!G.value}]),disabled:!G.value,onClick:I[0]||(I[0]=D=>Fe(-1))},[...I[6]||(I[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,Eo)):t.createCommentVNode("",!0),e.searchable?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"searchInputRef",ref:R,"onUpdate:modelValue":I[1]||(I[1]=D=>w.value=D),class:"sp-dropdown__search",type:"text",placeholder:e.searchPlaceholder,onMousedown:I[2]||(I[2]=t.withModifiers(()=>{},["stop"]))},null,40,So)),[[t.vModelText,w.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:p,class:"sp-dropdown__list",onTouchstart:Oe,onTouchmove:He,onTouchend:Q},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe.value,D=>(t.openBlock(),t.createElementBlock("button",{key:String(D.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(D.value)===String(e.modelValue)}]),onClick:s=>Ke(D)},[D.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:D.icon},null,8,Ro)):t.createCommentVNode("",!0),t.createElementVNode("span",Mo,t.toDisplayString(D.label),1)],10,xo))),128))],544),e.searchable&&!W.value?(t.openBlock(),t.createElementBlock("div",Bo," 无匹配 ")):t.createCommentVNode("",!0),be.value?(t.openBlock(),t.createElementBlock("button",{key:3,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!ne.value}]),disabled:!ne.value,onClick:I[3]||(I[3]=D=>Fe(1))},[...I[7]||(I[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,Do)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),kt=(e,r)=>{const o=e.__vccOpts||e;for(const[l,a]of r)o[l]=a;return o},Et=kt(No,[["__scopeId","data-v-00f4d6e6"]]),To=["title","onClick"],fn=kt(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:r,emit:o}){const l=e,a=o,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"}]],n=[[{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"}]],p=t.computed(()=>l.colorKey==="fill"?n:i);function c(W){return F(l.locale,W)}function h(W){const y=l.currentColor;return!y&&!W?!0:y?y.toLowerCase()===W.toLowerCase():!1}const S=t.ref(!1),x=t.ref(null),C=t.ref(null),w=t.ref({top:0});t.watch(()=>l.modelOpen,W=>{W!==void 0&&W!==S.value&&(W?X():Y())});function R(W){const y=x.value,oe=C.value,G=W.target;y&&y.contains(G)||oe&&oe.contains(G)||Y()}function X(){S.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const W=l.triggerEl??x.value;if(W){const y=W.getBoundingClientRect(),oe=150,G=120;let ne=window.innerWidth-y.right,be=y.bottom+4,Fe;y.left-G<4&&(ne=void 0,Fe=Math.max(4,y.left)),be+oe>window.innerHeight-4&&(be=y.top-oe-4),be<4&&(be=4),w.value=ne!==void 0?{right:ne,top:be}:{left:Fe,top:be}}document.addEventListener("pointerdown",R)})}function Y(){S.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",R)}function te(W){a("update:modelValue",W),a("change",W),Y()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",R)}),r({open:S,openMenu:X,close:Y}),(W,y)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:x,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:C,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(p.value,(oe,G)=>(t.openBlock(),t.createElementBlock("div",{key:G,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe,ne=>(t.openBlock(),t.createElementBlock("button",{key:ne.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":h(ne.value)}]),title:c(ne.key),style:t.normalizeStyle({background:ne.value||"transparent",border:ne.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:be=>te(ne.value)},null,14,To))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-70f3dfdc"]]),Io=["title","onClick"],Ao={viewBox:"0 0 30 30",class:"border-picker__icon"},Vo=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Fo={class:"border-picker__label"},Oo=kt(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:r,emit:o}){const l=e,a=o,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"}],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}],p={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"]},c={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function h(W,y){return c[W].includes(y)?"thick":p[W].includes(y)?"solid":"dashed"}const S=t.ref(!1),x=t.ref(null),C=t.ref(null),w=t.ref({top:0});t.watch(()=>l.modelOpen,W=>{W!==void 0&&W!==S.value&&(W?X():Y())});function R(W){const y=x.value,oe=C.value,G=W.target;y&&y.contains(G)||oe&&oe.contains(G)||Y()}function X(){S.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const W=l.triggerEl??x.value;if(W){const y=W.getBoundingClientRect(),oe=200,G=160;let ne=window.innerWidth-y.right,be=y.bottom+4,Fe;y.left-G<4&&(ne=void 0,Fe=Math.max(4,y.left)),be+oe>window.innerHeight-4&&(be=y.top-oe-4),be<4&&(be=4),w.value=ne!==void 0?{right:ne,top:be}:{left:Fe,top:be}}document.addEventListener("pointerdown",R)})}function Y(){S.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",R)}function te(W){a("change",W),Y()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",R)}),r({open:S,openMenu:X,close:Y}),(W,y)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:x,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:C,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,oe=>t.createElementVNode("button",{key:oe.key,class:"border-picker__item",title:t.unref(F)(e.locale,oe.i18nKey),onClick:G=>te(oe.key)},[(t.openBlock(),t.createElementBlock("svg",Ao,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(n,G=>t.createElementVNode("line",{key:G.name,x1:G.x1,y1:G.y1,x2:G.x2,y2:G.y2,stroke:"currentColor","stroke-width":h(oe.key,G.name)==="thick"?3:1.5,"stroke-dasharray":h(oe.key,G.name)==="dashed"?"0 4":"none","stroke-linecap":h(oe.key,G.name)==="dashed"?"round":"square"},null,8,Vo)),64))])),t.createElementVNode("span",Fo,t.toDisplayString(t.unref(F)(e.locale,oe.i18nKey)),1)],8,Io)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-551c0ffe"]]),Ho=["title","onClick"],Lo={viewBox:"0 0 1024 1024",class:"sort-picker__icon",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},$o=["x1","y1","x2","y2"],_o=["d"],zo={class:"sort-picker__label"},Wo=kt(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:r,emit:o}){const l=e,a=o,i=[{key:"asc",i18nKey:"sortAsc"},{key:"desc",i18nKey:"sortDesc"}],n=[{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}],p={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},c=t.ref(!1),h=t.ref(null),S=t.ref(null),x=t.ref({top:0});t.watch(()=>l.modelOpen,Y=>{Y!==void 0&&Y!==c.value&&(Y?w():R())});function C(Y){const te=h.value,W=S.value,y=Y.target;te&&te.contains(y)||W&&W.contains(y)||R()}function w(){c.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const Y=l.triggerEl??h.value;if(Y){const te=Y.getBoundingClientRect(),W=84,y=160;let oe=window.innerWidth-te.right,G=te.bottom+4,ne;te.left-y<4&&(oe=void 0,ne=Math.max(4,te.left)),G+W>window.innerHeight-4&&(G=te.top-W-4),G<4&&(G=4),x.value=oe!==void 0?{right:oe,top:G}:{left:ne,top:G}}document.addEventListener("pointerdown",C)})}function R(){c.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",C)}function X(Y){a("change",Y),R()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",C)}),r({open:c,openMenu:w,close:R}),(Y,te)=>(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(()=>[c.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:S,class:"sort-picker__menu",style:t.normalizeStyle({left:x.value.left!==void 0?x.value.left+"px":void 0,right:x.value.right!==void 0?x.value.right+"px":void 0,top:x.value.top+"px"}),onMousedown:te[0]||(te[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,W=>t.createElementVNode("button",{key:W.key,class:"sort-picker__item",title:t.unref(F)(e.locale,W.i18nKey),onClick:y=>X(W.key)},[(t.openBlock(),t.createElementBlock("svg",Lo,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(n,y=>t.createElementVNode("line",{key:y.name,x1:y.x1,y1:y.y1,x2:y.x2,y2:y.y2},null,8,$o)),64)),t.createElementVNode("path",{d:p[W.key]},null,8,_o)])),t.createElementVNode("span",zo,t.toDisplayString(t.unref(F)(e.locale,W.i18nKey)),1)],8,Ho)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-45929b74"]]),Uo=["title","onClick"],Ko=["innerHTML"],Po={class:"merge-picker__label"},Go=kt(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:r,emit:o}){const l=e,a=o,i=t.ref(!1),n=t.ref(null),p=t.ref(null),c=t.ref({top:0});t.watch(()=>l.modelOpen,w=>{w!==void 0&&w!==i.value&&(w?S():x())});function h(w){const R=n.value,X=p.value,Y=w.target;R&&R.contains(Y)||X&&X.contains(Y)||x()}function S(){i.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const w=l.triggerEl??n.value;if(w){const R=w.getBoundingClientRect(),X=Ql.length*30+12,Y=160;let te=window.innerWidth-R.right,W=R.bottom+4,y;R.left-Y<4&&(te=void 0,y=Math.max(4,R.left)),W+X>window.innerHeight-4&&(W=R.top-X-4),W<4&&(W=4),c.value=te!==void 0?{right:te,top:W}:{left:y,top:W}}document.addEventListener("pointerdown",h)})}function x(){i.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",h)}function C(w){a("change",w),x()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",h)}),r({open:i,openMenu:S,close:x}),(w,R)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:n,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:p,class:"merge-picker__menu",style:t.normalizeStyle({left:c.value.left!==void 0?c.value.left+"px":void 0,right:c.value.right!==void 0?c.value.right+"px":void 0,top:c.value.top+"px"}),onMousedown:R[0]||(R[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Ql),X=>(t.openBlock(),t.createElementBlock("button",{key:X.key,class:"merge-picker__item",title:t.unref(F)(e.locale,X.labelKey),onClick:Y=>C(X.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:X.icon},null,8,Ko),t.createElementVNode("span",Po,t.toDisplayString(t.unref(F)(e.locale,X.labelKey)),1)],8,Uo))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-edd36208"]]),Yo=["disabled","title","onClick"],Xo={class:"calc-picker__label"},jo=kt(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:r,emit:o}){const l=e,a=o,i=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],n=t.ref(!1),p=t.ref(null),c=t.ref(null),h=t.ref({top:0});t.watch(()=>l.modelOpen,R=>{R!==void 0&&R!==n.value&&(R?x():C())});function S(R){const X=p.value,Y=c.value,te=R.target;X&&X.contains(te)||Y&&Y.contains(te)||C()}function x(){n.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const R=l.triggerEl??p.value;if(R){const X=R.getBoundingClientRect(),Y=i.length*30+12,te=160;let W=window.innerWidth-X.right,y=X.bottom+4,oe;X.left-te<4&&(W=void 0,oe=Math.max(4,X.left)),y+Y>window.innerHeight-4&&(y=X.top-Y-4),y<4&&(y=4),h.value=W!==void 0?{right:W,top:y}:{left:oe,top:y}}document.addEventListener("pointerdown",S)})}function C(){n.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",S)}function w(R){l.disabled||(a("change",R),C())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",S)}),r({open:n,openMenu:x,close:C}),(R,X)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:p,class:"calc-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[n.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:c,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:X[0]||(X[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,Y=>t.createElementVNode("button",{key:Y.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(F)(e.locale,Y.labelKey),onClick:te=>w(Y.key)},[t.createElementVNode("span",Xo,t.toDisplayString(t.unref(F)(e.locale,Y.labelKey)),1)],10,Yo)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-01a18e00"]]),Zo={class:"tb-item","data-key":"undo"},qo=["title","disabled"],Jo={class:"tb-item","data-key":"redo"},Qo=["title","disabled"],er={class:"tb-item","data-key":"paint"},tr=["title","disabled"],lr={class:"tb-item","data-key":"clear"},nr=["title","disabled"],or={class:"tb-item","data-key":"font"},rr={class:"tb-item","data-key":"fontSize"},ar={class:"toolbar-font-size"},ir=["value","title"],cr=["title"],sr=["title","disabled"],dr=["title","disabled"],ur={class:"tb-item","data-key":"bold"},fr=["title","disabled"],mr={class:"tb-item","data-key":"italic"},pr=["title","disabled"],hr={class:"tb-item","data-key":"underline"},gr=["title","disabled"],yr={class:"tb-item","data-key":"strike"},br=["title","disabled"],Cr={class:"tb-item","data-key":"textColor"},vr={class:"toolbar-split"},wr=["title","disabled"],kr={viewBox:"0 0 1024 1024",fill:"currentColor"},Er=["fill"],Sr=["title","disabled"],xr={class:"tb-item","data-key":"fillColor"},Rr={class:"toolbar-split"},Mr=["title","disabled"],Br={viewBox:"0 0 1024 1024",fill:"currentColor"},Dr=["fill"],Nr=["title","disabled"],Tr={class:"tb-item","data-key":"border"},Ir={class:"toolbar-split"},Ar=["title","disabled"],Vr={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},Fr=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Or=["title","disabled"],Hr={class:"tb-item","data-key":"hAlign"},Lr={class:"tb-item","data-key":"vAlign"},$r={class:"tb-item","data-key":"wrap"},_r=["title"],zr={class:"tb-item","data-key":"merge"},Wr={class:"toolbar-split"},Ur=["title","disabled"],Kr=["title","disabled"],Pr={class:"tb-item","data-key":"numFmt"},Gr={class:"toolbar-number-format-group"},Yr=["title","disabled"],Xr=["title","disabled"],jr={class:"tb-item","data-key":"calc"},Zr={class:"toolbar-split"},qr=["title","disabled"],Jr=["title","disabled"],Qr={class:"tb-item","data-key":"sort"},ea={class:"toolbar-split"},ta=["title","disabled"],la={viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},na=["x1","y1","x2","y2"],oa=["d"],ra=["title","disabled"],aa={class:"tb-item","data-key":"find"},ia=["title"],Ul=2,ca=6,sa=34,da=kt(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},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","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:r}){const o=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],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(he,g){return a[he].includes(g)?"thick":l[he].includes(g)?"solid":"dashed"}const n=[{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}],p={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},c=["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","find"],h=t.ref(null),S=t.ref(null),x=t.ref(null),C=t.ref(null),w=t.ref(null),R=t.ref(null),X=t.ref(null),Y=t.ref(null),te=t.ref(null),W=t.ref(null),y=t.ref(new Set),oe=t.ref(!1),G=t.ref(!1),ne=t.ref(0),be=new Map,Fe=t.computed(()=>y.value.size>0);function Me(he){return y.value.has(he)}const fe=t.computed(()=>{const he=S.value;return he instanceof HTMLElement?he:void 0});function Ce(he){return fe.value?!Me(he):!0}function Ke(){for(const he of c){const g=be.get(he);if(g===void 0||g===0)return!0}return!1}function Se(){if(!h.value)return;h.value.querySelectorAll(".tb-item").forEach(g=>{const A=g.dataset.key;if(!A)return;const Re=g.offsetWidth;Re>0?be.set(A,Re):be.has(A)||be.set(A,0)})}function pe(he,g){if(he.size!==g.size)return!1;for(const A of he)if(!g.has(A))return!1;return!0}let ye=0,Oe=0;function He(){ye&&cancelAnimationFrame(ye),!(Oe>60)&&(Oe++,ye=requestAnimationFrame(()=>requestAnimationFrame(Q)))}function Q(){if(!h.value)return;const he=h.value.clientWidth-ca*2;if(he<=0){He();return}Oe=0,(be.size===0||Ke())&&Se();let g=0;for(const Re of c)g+=(be.get(Re)??0)+Ul;const A=new Set;if(g>he){const Re=he-sa-Ul;let Ze=0;for(let dt=0;dt<c.length;dt++){const ie=c[dt],Be=(be.get(ie)??0)+Ul;if(Ze+Be>Re){for(let Le=dt;Le<c.length;Le++)A.add(c[Le]);break}Ze+=Be}}pe(A,y.value)||(y.value=A,ne.value++,A.size===0&&(oe.value=!1))}let ae=null;const m=t.ref(0),I=t.computed(()=>{const he=x.value,g={position:"fixed",top:"0px",right:"0px"};if(!he)return{...u.themeVars,...g};m.value;const A=he.getBoundingClientRect();return{...u.themeVars,position:"fixed",top:`${A.bottom+4}px`,right:`${window.innerWidth-A.right}px`}});function H(){oe.value&&(m.value++,t.nextTick(()=>Q()))}function z(he){var A,Re;if(!oe.value)return;const g=he.target;(A=S.value)!=null&&A.contains(g)||(Re=x.value)!=null&&Re.contains(g)||(G.value=!0,oe.value=!1,t.nextTick(()=>{G.value=!1}))}function D(){oe.value=!oe.value}function s(){oe.value=!1,L("find")}t.onMounted(()=>{He(),h.value&&(ae=new ResizeObserver(()=>{oe.value||He()}),ae.observe(h.value)),document.addEventListener("pointerdown",z,!0),window.addEventListener("resize",H),window.addEventListener("load",He),window.addEventListener("orientationchange",He)}),t.onBeforeUnmount(()=>{ye&&cancelAnimationFrame(ye),ae==null||ae.disconnect(),document.removeEventListener("pointerdown",z,!0),window.removeEventListener("resize",H),window.removeEventListener("load",He),window.removeEventListener("orientationchange",He)});const u=e,L=r,xe=t.computed(()=>u.selNumberFormat===Ft?F(u.locale,"nfMixed"):"");return(he,g)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:h,class:"toolbar",onMousedown:g[51]||(g[51]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("undo"),to:fe.value},[t.createElementVNode("div",Zo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(F)(e.locale,"undo"),disabled:!e.canUndo,onClick:g[0]||(g[0]=A=>L("undo"))},[...g[53]||(g[53]=[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,qo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("redo"),to:fe.value},[t.createElementVNode("div",Jo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(F)(e.locale,"redo"),disabled:!e.canRedo,onClick:g[1]||(g[1]=A=>L("redo"))},[...g[54]||(g[54]=[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,Qo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("paint"),to:fe.value},[t.createElementVNode("div",er,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(F)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:g[2]||(g[2]=A=>L("paint-format"))},[...g[55]||(g[55]=[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,tr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("clear"),to:fe.value},[t.createElementVNode("div",lr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(F)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:g[3]||(g[3]=A=>L("clear-format"))},[...g[56]||(g[56]=[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,nr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep1"),to:fe.value},[g[57]||(g[57]=t.createElementVNode("div",{class:"tb-item","data-key":"sep1"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("font"),to:fe.value},[t.createElementVNode("div",or,[t.createVNode(Et,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:Me("font")?"100%":110,"menu-width":Me("font")?120:void 0,"visible-count":8,title:t.unref(F)(e.locale,"fontFamily"),align:"right",onChange:g[4]||(g[4]=A=>L("font-family-change",A))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("fontSize"),to:fe.value},[t.createElementVNode("div",rr,[t.createElementVNode("div",ar,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(F)(e.locale,"fontSize"),onMousedown:g[5]||(g[5]=t.withModifiers(()=>{},["stop"])),onInput:g[6]||(g[6]=A=>L("font-size-input",A.target.value)),onBlur:g[7]||(g[7]=A=>L("font-size-blur")),onKeydown:g[8]||(g[8]=A=>L("font-size-keydown",A))},null,40,ir),t.createVNode(Et,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:Me("fontSize")?"100%":56,"menu-width":Me("fontSize")?120:56,"visible-count":9,title:t.unref(F)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":W.value,"onUpdate:modelOpen":g[9]||(g[9]=A=>L("update:font-size-menu-open",A)),onChange:g[10]||(g[10]=A=>L("font-size-change",A))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:W,class:"toolbar-font-size__btn",type:"button",title:t.unref(F)(e.locale,"fontSize"),onMousedown:g[11]||(g[11]=t.withModifiers(()=>{},["prevent"])),onClick:g[12]||(g[12]=A=>L("font-size-toggle"))},[...g[58]||(g[58]=[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,cr),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(F)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:g[13]||(g[13]=t.withModifiers(()=>{},["prevent"])),onClick:g[14]||(g[14]=A=>L("font-size-step-down"))},[...g[59]||(g[59]=[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,sr),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(F)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:g[15]||(g[15]=t.withModifiers(()=>{},["prevent"])),onClick:g[16]||(g[16]=A=>L("font-size-step-up"))},[...g[60]||(g[60]=[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,dr)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep2"),to:fe.value},[g[61]||(g[61]=t.createElementVNode("div",{class:"tb-item","data-key":"sep2"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("bold"),to:fe.value},[t.createElementVNode("div",ur,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(F)(e.locale,"bold"),disabled:!e.hasSelection,onClick:g[17]||(g[17]=A=>L("bold-toggle"))},[...g[62]||(g[62]=[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,fr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("italic"),to:fe.value},[t.createElementVNode("div",mr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(F)(e.locale,"italic"),disabled:!e.hasSelection,onClick:g[18]||(g[18]=A=>L("italic-toggle"))},[...g[63]||(g[63]=[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,pr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("underline"),to:fe.value},[t.createElementVNode("div",hr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(F)(e.locale,"underline"),disabled:!e.hasSelection,onClick:g[19]||(g[19]=A=>L("underline-toggle"))},[...g[64]||(g[64]=[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,gr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("strike"),to:fe.value},[t.createElementVNode("div",yr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(F)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:g[20]||(g[20]=A=>L("strikethrough-toggle"))},[...g[65]||(g[65]=[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,br)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep3"),to:fe.value},[g[66]||(g[66]=t.createElementVNode("div",{class:"tb-item","data-key":"sep3"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("textColor"),to:fe.value},[t.createElementVNode("div",Cr,[t.createElementVNode("div",vr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(F)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:g[21]||(g[21]=A=>L("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",kr,[g[67]||(g[67]=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,Er)]))],8,wr),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:C,class:"toolbar-btn toolbar-split__arrow",title:t.unref(F)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:g[22]||(g[22]=A=>L("update:text-color-menu-open",!e.textColorMenuOpen))},[...g[68]||(g[68]=[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,Sr),t.createVNode(fn,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":C.value,"onUpdate:modelOpen":g[23]||(g[23]=A=>L("update:text-color-menu-open",A)),onChange:g[24]||(g[24]=A=>L("text-color-change",A))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("fillColor"),to:fe.value},[t.createElementVNode("div",xr,[t.createElementVNode("div",Rr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(F)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:g[25]||(g[25]=A=>L("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",Br,[g[69]||(g[69]=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,Dr)]))],8,Mr),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:w,class:"toolbar-btn toolbar-split__arrow",title:t.unref(F)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:g[26]||(g[26]=A=>L("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...g[70]||(g[70]=[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,Nr),t.createVNode(fn,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":w.value,"onUpdate:modelOpen":g[27]||(g[27]=A=>L("update:fill-color-menu-open",A)),onChange:g[28]||(g[28]=A=>L("fill-color-change",A))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("border"),to:fe.value},[t.createElementVNode("div",Tr,[t.createElementVNode("div",Ir,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(F)(e.locale,"borders"),disabled:!e.hasSelection,onClick:g[29]||(g[29]=A=>L("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",Vr,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(o,A=>t.createElementVNode("line",{key:A.name,x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,"stroke-width":i(e.cachedBorder,A.name)==="thick"?3:1.5,"stroke-dasharray":i(e.cachedBorder,A.name)==="dashed"?"0 4":"none","stroke-linecap":i(e.cachedBorder,A.name)==="dashed"?"round":"square"},null,8,Fr)),64))]))],8,Ar),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:R,class:"toolbar-btn toolbar-split__arrow",title:t.unref(F)(e.locale,"borders"),disabled:!e.hasSelection,onClick:g[30]||(g[30]=A=>L("update:border-menu-open",!e.borderMenuOpen))},[...g[71]||(g[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,Or),t.createVNode(Oo,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":R.value,"onUpdate:modelOpen":g[31]||(g[31]=A=>L("update:border-menu-open",A)),onChange:g[32]||(g[32]=A=>L("border-change",A))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep4"),to:fe.value},[g[72]||(g[72]=t.createElementVNode("div",{class:"tb-item","data-key":"sep4"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("hAlign"),to:fe.value},[t.createElementVNode("div",Hr,[t.createVNode(Et,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:Me("hAlign")?"100%":44,"menu-width":Me("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(F)(e.locale,"hAlign"),onChange:g[33]||(g[33]=A=>L("h-align-change",A))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("vAlign"),to:fe.value},[t.createElementVNode("div",Lr,[t.createVNode(Et,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:Me("vAlign")?"100%":44,"menu-width":Me("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(F)(e.locale,"vAlign"),onChange:g[34]||(g[34]=A=>L("v-align-change",A))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",$r,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(F)(e.locale,"wrap"),onClick:g[35]||(g[35]=A=>L("wrap-toggle"))},[...g[73]||(g[73]=[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,_r)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("merge"),to:fe.value},[t.createElementVNode("div",zr,[t.createElementVNode("div",Wr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(F)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:g[36]||(g[36]=A=>L("apply-merge"))},[...g[74]||(g[74]=[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,Ur),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:Y,class:"toolbar-btn toolbar-split__arrow",title:t.unref(F)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:g[37]||(g[37]=A=>L("update:merge-menu-open",!e.mergeMenuOpen))},[...g[75]||(g[75]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Kr),t.createVNode(Go,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":Y.value,"onUpdate:modelOpen":g[38]||(g[38]=A=>L("update:merge-menu-open",A)),onChange:g[39]||(g[39]=A=>L("merge-change",A))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep6"),to:fe.value},[g[76]||(g[76]=t.createElementVNode("div",{class:"tb-item","data-key":"sep6"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("numFmt"),to:fe.value},[t.createElementVNode("div",Pr,[t.createElementVNode("div",Gr,[t.createVNode(Et,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:Me("numFmt")?"auto":92,"menu-width":(Me("numFmt"),150),"visible-count":8,title:t.unref(F)(e.locale,"numberFormat"),"fallback-label":xe.value,align:"right",onChange:g[40]||(g[40]=A=>L("number-format-change",String(A)))},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(F)(e.locale,"nfIncreaseDecimals"),disabled:!e.canIncreaseDecimals,onClick:g[41]||(g[41]=A=>L("increase-decimals"))},[...g[77]||(g[77]=[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,Yr),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canDecreaseDecimals}]),title:t.unref(F)(e.locale,"nfDecreaseDecimals"),disabled:!e.canDecreaseDecimals,onClick:g[42]||(g[42]=A=>L("decrease-decimals"))},[...g[78]||(g[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 18.5l-4.2-5.2h2.7V5.5h3v7.8h2.7z"})],-1)])],10,Xr)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep7"),to:fe.value},[g[79]||(g[79]=t.createElementVNode("div",{class:"tb-item","data-key":"sep7"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("calc"),to:fe.value},[t.createElementVNode("div",jr,[t.createElementVNode("div",Zr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(F)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:g[43]||(g[43]=A=>L("calc-sum"))},[...g[80]||(g[80]=[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,qr),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:te,class:"toolbar-btn toolbar-split__arrow",title:t.unref(F)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:g[44]||(g[44]=A=>L("update:calc-menu-open",!e.calcMenuOpen))},[...g[81]||(g[81]=[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,Jr),t.createVNode(jo,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":te.value,disabled:e.isSingleCell,"onUpdate:modelOpen":g[45]||(g[45]=A=>L("update:calc-menu-open",A)),onChange:g[46]||(g[46]=A=>L(`calc-${A}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sort"),to:fe.value},[t.createElementVNode("div",Qr,[t.createElementVNode("div",ea,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.cachedSortOrder==="asc"?t.unref(F)(e.locale,"sortAsc"):t.unref(F)(e.locale,"sortDesc"),disabled:!e.canSort,onClick:g[47]||(g[47]=A=>L("apply-sort"))},[(t.openBlock(),t.createElementBlock("svg",la,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(n,A=>t.createElementVNode("line",{key:A.name,x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2},null,8,na)),64)),t.createElementVNode("path",{d:p[e.cachedSortOrder]},null,8,oa)]))],8,ta),t.createElementVNode("button",{ref_key:"sortArrowRef",ref:X,class:"toolbar-btn toolbar-split__arrow",title:t.unref(F)(e.locale,"sort"),disabled:!e.canSort,onClick:g[48]||(g[48]=A=>L("update:sort-menu-open",!e.sortMenuOpen))},[...g[82]||(g[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,ra),t.createVNode(Wo,{"model-open":e.sortMenuOpen,locale:e.locale,"current-sort":e.cachedSortOrder,"trigger-el":X.value,"onUpdate:modelOpen":g[49]||(g[49]=A=>L("update:sort-menu-open",A)),onChange:g[50]||(g[50]=A=>L("sort-change",A))},null,8,["model-open","locale","current-sort","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("find"),to:fe.value},[t.createElementVNode("div",aa,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(F)(e.locale,"find"),onClick:s},[...g[83]||(g[83]=[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,ia)])],8,["disabled","to"])),Fe.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:x,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":oe.value}]),type:"button",onClick:D},[...g[84]||(g[84]=[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:ne.value,class:t.normalizeClass(["overflow-menu",{"no-anim":G.value}]),style:t.normalizeStyle(I.value),onMousedown:g[52]||(g[52]=t.withModifiers(()=>{},["prevent"]))},null,38)),[[t.vShow,oe.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-4f17f13a"]]),ua=["title"],fa={class:"tab-list"},ma=["onClick","onDblclick","onContextmenu"],pa=["value"],ha={key:1,class:"tab-item__name"},ga=["title"],ya=["disabled"],ba=["title","onClick"],Ca={class:"tab-list-menu__name"},va=["title","disabled","onClick"],wa=["disabled"],ka=8,Ea=kt(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:r}){const o=e,l=r,a=t.ref(null),i=t.ref(!1),n=t.ref(0),p=t.ref({left:0,bottom:0}),c=t.ref(null),h=t.computed(()=>Math.min(ka,o.sheets.length)),S=t.computed(()=>o.sheets.slice(n.value,n.value+h.value)),x=t.computed(()=>n.value>0),C=t.computed(()=>n.value+h.value<o.sheets.length),w=t.computed(()=>o.sheets.length>h.value),R=t.computed(()=>o.sheets.length>1);t.watch(()=>o.sheets.length,()=>{if(!i.value)return;const Se=Math.max(0,o.sheets.length-h.value);n.value>Se&&(n.value=Se)});function X(Se){n.value=Math.max(0,Math.min(o.sheets.length-h.value,n.value+Se))}function Y(){if(i.value){i.value=!1;return}const Se=a.value;if(!Se)return;const pe=Se.getBoundingClientRect();p.value={left:pe.left,bottom:window.innerHeight-pe.top+4};const ye=o.activeSheetIndex;n.value=ye>=0?Math.max(0,Math.min(ye-Math.floor(h.value/2),o.sheets.length-h.value)):0,i.value=!0}function te(Se){l("tab-click",Se),i.value=!1}function W(Se){R.value&&l("delete-sheet",Se)}function y(Se){var Oe;if(!i.value)return;const pe=Se.target;if((Oe=a.value)!=null&&Oe.contains(pe))return;const ye=document.querySelector(".tab-list-menu");ye!=null&&ye.contains(pe)||(i.value=!1)}function oe(Se){i.value&&Se.key==="Escape"&&(i.value=!1)}function G(Se){i.value&&(Se.preventDefault(),X(Se.deltaY>0?1:-1))}function ne(){i.value=!1}function be(Se){!i.value||Se.target===c.value||ne()}const Fe=t.ref(0),Me=t.ref(!1);function fe(Se){i.value&&(Fe.value=Se.touches[0].clientY,Me.value=!0)}function Ce(Se){if(!i.value||!Me.value)return;const pe=Se.touches[0].clientY-Fe.value;Math.abs(pe)>5&&(X(pe<0?1:-1),Fe.value=Se.touches[0].clientY)}function Ke(){Me.value=!1}return t.watch(i,Se=>{t.nextTick(()=>{var pe,ye;Se?(pe=c.value)==null||pe.addEventListener("wheel",G,{passive:!1}):(ye=c.value)==null||ye.removeEventListener("wheel",G)})}),t.onMounted(()=>{document.addEventListener("pointerdown",y),document.addEventListener("keydown",oe),window.addEventListener("resize",ne),window.addEventListener("scroll",be,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",y),document.removeEventListener("keydown",oe),window.removeEventListener("resize",ne),window.removeEventListener("scroll",be,!0)}),(Se,pe)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:pe[8]||(pe[8]=ye=>l("tabbar-contextmenu",ye))},[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(F)(e.locale,"sheetList"),onClick:Y},[...pe[9]||(pe[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,ua),t.createElementVNode("div",fa,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(ye,Oe)=>(t.openBlock(),t.createElementBlock("div",{key:ye.id,class:t.normalizeClass(["tab-item",{"tab-item--active":Oe===e.activeSheetIndex}]),onClick:He=>l("tab-click",Oe),onDblclick:t.withModifiers(He=>l("tab-dblclick",Oe),["prevent"]),onContextmenu:He=>l("tab-contextmenu",{ev:He,i:Oe})},[e.renTab===Oe?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:pe[0]||(pe[0]=He=>l("tab-rename-input",He.target.value)),onKeydown:pe[1]||(pe[1]=He=>l("tab-rename-keydown",He)),onBlur:pe[2]||(pe[2]=He=>l("tab-rename-commit")),onClick:pe[3]||(pe[3]=t.withModifiers(()=>{},["stop"]))},null,40,pa)):(t.openBlock(),t.createElementBlock("span",ha,t.toDisplayString(ye.name),1))],42,ma))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(F)(e.locale,"addSheet"),onClick:pe[4]||(pe[4]=ye=>l("add-sheet"))}," + ",8,ga),(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:p.value.left+"px",bottom:p.value.bottom+"px"}),onMousedown:pe[7]||(pe[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":!x.value}]),disabled:!x.value,onClick:pe[5]||(pe[5]=ye=>X(-1))},[...pe[10]||(pe[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,ya)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:c,class:"tab-list-menu__list",onTouchstart:fe,onTouchmove:Ce,onTouchend:Ke},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(S.value,ye=>(t.openBlock(),t.createElementBlock("div",{key:ye.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(ye)===e.activeSheetIndex}]),title:ye.name,onClick:Oe=>te(e.sheets.indexOf(ye))},[t.createElementVNode("span",Ca,t.toDisplayString(ye.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(F)(e.locale,"delete"),disabled:!R.value,onClick:t.withModifiers(Oe=>W(e.sheets.indexOf(ye)),["stop"])},[...pe[11]||(pe[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,va)],10,ba))),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":!C.value}]),disabled:!C.value,onClick:pe[6]||(pe[6]=ye=>X(1))},[...pe[12]||(pe[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,wa)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-ec10bade"]]),Sa=["placeholder","value"],xa=["placeholder","value"],Ra={class:"find-bar__chk"},Ma=["checked"],Ba={class:"find-bar__chk"},Da=["checked"],Na={class:"find-bar__count"},Ta=["title","disabled"],Ia=["title","disabled"],Aa=["disabled"],Va=["disabled"],Fa=["title"],Oa=kt(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:r}){const o=e,l=r,a=t.ref(null),i=t.computed(()=>o.total>0?`${o.currentIndex+1}/${o.total}`:o.message||""),n=t.computed(()=>[{label:F(o.locale,"scopeSheet"),value:"sheet"},{label:F(o.locale,"scopeWorkbook"),value:"workbook"},{label:F(o.locale,"scopeSelection"),value:"selection"}]);t.watch(()=>o.focusToken,()=>{t.nextTick(()=>{var c;return(c=a.value)==null?void 0:c.focus()})});function p(c){c.key==="Enter"?(c.preventDefault(),c.shiftKey?l("prev"):l("next")):c.key==="Escape"&&(c.preventDefault(),l("close"))}return(c,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(F)(e.locale,"findPlaceholder"),value:e.findText,onInput:h[0]||(h[0]=S=>l("update:findText",S.target.value)),onKeydown:p},null,40,Sa),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(F)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:h[1]||(h[1]=S=>l("update:replaceText",S.target.value)),onKeydown:p},null,40,xa),t.createVNode(Et,{class:"find-bar__dropdown","model-value":e.scope,options:n.value,title:t.unref(F)(e.locale,"findScope"),"onUpdate:modelValue":h[2]||(h[2]=S=>c.$emit("update:scope",S))},null,8,["model-value","options","title"]),t.createElementVNode("label",Ra,[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,Ma),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(F)(e.locale,"matchCase")),1)]),t.createElementVNode("label",Ba,[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,Da),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(F)(e.locale,"matchEntireCell")),1)]),t.createElementVNode("span",Na,t.toDisplayString(i.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(F)(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,Ta),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(F)(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,Ia),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(F)(e.locale,"replace")),9,Aa),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(F)(e.locale,"replaceAll")),9,Va),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(F)(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,Fa)],4)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-3120909b"]]),Ha={class:"nf-dialog__header"},La={class:"nf-dialog__title"},$a={class:"nf-dialog__body"},_a={class:"nf-field"},za={class:"nf-field__label"},Wa={key:0,class:"nf-field"},Ua={class:"nf-field__label"},Ka={key:1,class:"nf-field nf-field--inline"},Pa={class:"nf-checkbox"},Ga={key:2,class:"nf-field"},Ya={class:"nf-field__label"},Xa={key:3,class:"nf-field"},ja={class:"nf-field__label"},Za={key:4,class:"nf-field"},qa={class:"nf-field__label"},Ja={key:5,class:"nf-field"},Qa={class:"nf-field__label"},ei={key:6,class:"nf-field"},ti={class:"nf-field__label"},li={class:"nf-field"},ni={class:"nf-field__label"},oi={class:"nf-dialog__footer"},ri={class:"nf-preview"},ai={class:"nf-preview__label"},ii={class:"nf-preview__value"},ci={class:"nf-dialog__actions"},si=kt(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:r}){const o=e,l=r,a=t.ref(!1),i=t.ref("general"),n=t.ref(2),p=t.ref(!1),c=t.ref("$"),h=t.ref("m/d/yyyy"),S=t.ref("h:mm:ss"),x=t.ref("m/d/yyyy h:mm:ss"),C=t.ref("[h]:mm:ss"),w=t.ref(""),R=t.ref(null),X=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],Y=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],te=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],W=['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"],oe=t.computed(()=>o.locale==="zh-CN"?[...Y,...te]:[...te,...Y]),G=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],ne=t.computed(()=>o.locale==="zh-CN"?[...W,...y]:[...y,...W]),be=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],Fe={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"},Me=t.computed(()=>co.map(ie=>({label:F(o.locale,Fe[ie]),value:ie}))),fe=X.map(ie=>({label:ie.label,value:ie.value})),Ce=t.computed(()=>oe.value.map(ie=>({label:ie,value:ie}))),Ke=G.map(ie=>({label:ie,value:ie})),Se=t.computed(()=>ne.value.map(ie=>({label:ie,value:ie}))),pe=be.map(ie=>({label:ie,value:ie})),ye=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),Oe=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),He=t.computed(()=>i.value==="date"),Q=t.computed(()=>i.value==="time"),ae=t.computed(()=>i.value==="dateTime"),m=t.computed(()=>i.value==="duration"),I=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function H(){if(i.value==="general")return Ut;if(i.value==="text")return xt;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 x.value;if(i.value==="duration")return C.value;const ie=Math.max(0,Math.min(30,n.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?z(i.value,ie,p.value,c.value):Co(o.locale,i.value,ie,p.value)}function z(ie,Be,Le,at){const lt=Le?"#,##0":"0";if(ie==="currencyRounded")return at+lt;const ct=Be>0?"."+"0".repeat(Be):"",ft=lt+ct;return ie==="currency"?at+ft:`${at}${ft};(${at}${ft});${at}"-"`}function D(ie){if(w.value=ie,Rt(ie)){i.value="general";return}if(ie==="@"){i.value="text";return}const Be=ie.replace(/\[[^\]]*\]/gi,ct=>/\[h\]/i.test(ct)?ct:"");if(/\[h\]/i.test(Be)&&!/[yd]/i.test(Be)){i.value="duration",be.includes(ie)&&(C.value=ie);return}const Le=/[yd]/i.test(Be),at=/h|s|AM\/PM/i.test(Be);if(Le&&at){i.value="dateTime",ne.value.includes(ie)&&(x.value=ie);return}if(Le||/AM\/PM/i.test(Be)){at&&!Le?(i.value="time",G.includes(ie)&&(S.value=ie)):(i.value="date",oe.value.includes(ie)&&(h.value=ie));return}if(ie.includes("%")){i.value="percent",n.value=s(ie);return}if(/E[+-]/i.test(ie)){i.value="scientific",n.value=s(ie);return}const lt=X.find(ct=>ie.startsWith(ct.value));if(ie.includes("[Red](")){i.value="financial",p.value=ie.includes(","),n.value=s(ie);return}if(lt){ie.includes("(")?(i.value="accounting",c.value=lt.value,p.value=ie.includes(","),n.value=s(ie)):/\.\d/.test(ie.slice(lt.value.length))?(i.value="currency",c.value=lt.value,p.value=ie.includes(","),n.value=s(ie)):(i.value="currencyRounded",c.value=lt.value,p.value=ie.includes(","));return}i.value="number",p.value=ie.includes(","),n.value=s(ie)}function s(ie){const Be=ie.match(/\.([0#?]+)/);return Be?Be[1].length:0}function u(){i.value!=="custom"&&(w.value=H())}function L(){}function xe(){h.value=oe.value[0],S.value=G[0],x.value=ne.value[0],C.value=be[0]}function he(){a.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0),xe(),D(o.currentFormat??""),o.isCustom&&(i.value="custom"),t.nextTick(()=>{var ie;return(ie=R.value)==null?void 0:ie.focus()})}function g(){a.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function A(){l("apply",w.value),g()}function Re(){g()}function Ze(ie){ie.key==="Escape"&&g()}t.watch(()=>o.modelOpen,ie=>{ie&&!a.value?he():!ie&&a.value&&g()});const dt=t.computed(()=>ll(o.sampleValue,w.value,o.locale));return(ie,Be)=>(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:Re,onKeydown:Ze},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:Be[9]||(Be[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Ha,[t.createElementVNode("span",La,t.toDisplayString(t.unref(F)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:g},[...Be[10]||(Be[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",$a,[t.createElementVNode("div",_a,[t.createElementVNode("label",za,t.toDisplayString(t.unref(F)(e.locale,"nfCategory")),1),t.createVNode(Et,{class:"nf-field__dropdown","model-value":i.value,options:Me.value,"onUpdate:modelValue":Be[0]||(Be[0]=Le=>i.value=Le),onChange:u},null,8,["model-value","options"])]),I.value?(t.openBlock(),t.createElementBlock("div",Wa,[t.createElementVNode("label",Ua,t.toDisplayString(t.unref(F)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":Be[1]||(Be[1]=Le=>n.value=Le),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:u},null,544),[[t.vModelText,n.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),ye.value?(t.openBlock(),t.createElementBlock("div",Ka,[t.createElementVNode("label",Pa,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":Be[2]||(Be[2]=Le=>p.value=Le),type:"checkbox",onChange:u},null,544),[[t.vModelCheckbox,p.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(F)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),Oe.value?(t.openBlock(),t.createElementBlock("div",Ga,[t.createElementVNode("label",Ya,t.toDisplayString(t.unref(F)(e.locale,"nfSymbol")),1),t.createVNode(Et,{class:"nf-field__dropdown","model-value":c.value,options:t.unref(fe),"onUpdate:modelValue":Be[3]||(Be[3]=Le=>c.value=Le),onChange:u},null,8,["model-value","options"])])):t.createCommentVNode("",!0),He.value?(t.openBlock(),t.createElementBlock("div",Xa,[t.createElementVNode("label",ja,t.toDisplayString(t.unref(F)(e.locale,"nfDateFormat")),1),t.createVNode(Et,{class:"nf-field__dropdown","model-value":h.value,options:Ce.value,"onUpdate:modelValue":Be[4]||(Be[4]=Le=>h.value=Le),onChange:u},null,8,["model-value","options"])])):t.createCommentVNode("",!0),Q.value?(t.openBlock(),t.createElementBlock("div",Za,[t.createElementVNode("label",qa,t.toDisplayString(t.unref(F)(e.locale,"nfTimeFormat")),1),t.createVNode(Et,{class:"nf-field__dropdown","model-value":S.value,options:t.unref(Ke),"onUpdate:modelValue":Be[5]||(Be[5]=Le=>S.value=Le),onChange:u},null,8,["model-value","options"])])):t.createCommentVNode("",!0),ae.value?(t.openBlock(),t.createElementBlock("div",Ja,[t.createElementVNode("label",Qa,t.toDisplayString(t.unref(F)(e.locale,"nfDateTime")),1),t.createVNode(Et,{class:"nf-field__dropdown","model-value":x.value,options:Se.value,"onUpdate:modelValue":Be[6]||(Be[6]=Le=>x.value=Le),onChange:u},null,8,["model-value","options"])])):t.createCommentVNode("",!0),m.value?(t.openBlock(),t.createElementBlock("div",ei,[t.createElementVNode("label",ti,t.toDisplayString(t.unref(F)(e.locale,"nfDuration")),1),t.createVNode(Et,{class:"nf-field__dropdown","model-value":C.value,options:t.unref(pe),"onUpdate:modelValue":Be[7]||(Be[7]=Le=>C.value=Le),onChange:u},null,8,["model-value","options"])])):t.createCommentVNode("",!0),t.createElementVNode("div",li,[t.createElementVNode("label",ni,t.toDisplayString(t.unref(F)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:R,"onUpdate:modelValue":Be[8]||(Be[8]=Le=>w.value=Le),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:L},null,544),[[t.vModelText,w.value]])])]),t.createElementVNode("div",oi,[t.createElementVNode("div",ri,[t.createElementVNode("span",ai,t.toDisplayString(t.unref(F)(e.locale,"nfPreview")),1),t.createElementVNode("span",ii,t.toDisplayString(dt.value||"—"),1)]),t.createElementVNode("div",ci,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:A},t.toDisplayString(t.unref(F)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:g},t.toDisplayString(t.unref(F)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-39792a0b"]]),di={class:"sort-confirm__header"},ui={class:"sort-confirm__title"},fi={class:"sort-confirm__body"},mi={class:"sort-confirm__message"},pi={class:"sort-confirm__options"},hi={class:"sort-confirm__option"},gi={class:"sort-confirm__option"},yi={class:"sort-confirm__footer"},bi=kt(t.defineComponent({__name:"sortConfirmDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","confirm","cancel"],setup(e,{emit:r}){const o=e,l=r,a=t.ref(!1),i=t.ref(!0),n=t.ref(null);t.watch(()=>o.modelOpen,w=>{w&&!a.value?p():!w&&a.value&&c()});function p(){i.value=!0,a.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0),t.nextTick(()=>{var R;const w=(R=n.value)==null?void 0:R.querySelector(".sort-confirm__btn--primary");w==null||w.focus()})}function c(){a.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function h(){C()}function S(w){w.key==="Escape"&&C()}function x(){l("confirm",i.value),c()}function C(){l("cancel"),c()}return(w,R)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"sort-confirm"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"sort-confirm__mask",onMousedown:h,onKeydown:S},[t.createElementVNode("div",{ref_key:"dialogRef",ref:n,class:"sort-confirm",onMousedown:R[2]||(R[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",di,[t.createElementVNode("span",ui,t.toDisplayString(t.unref(F)(e.locale,"sortReminderTitle")),1),t.createElementVNode("button",{class:"sort-confirm__close",type:"button",onClick:C},[...R[3]||(R[3]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])])]),t.createElementVNode("div",fi,[t.createElementVNode("p",mi,t.toDisplayString(t.unref(F)(e.locale,"sortReminderMessage")),1),t.createElementVNode("div",pi,[t.createElementVNode("label",hi,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":R[0]||(R[0]=X=>i.value=X),type:"radio",value:!0},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(F)(e.locale,"sortExpandSelection")),1)]),t.createElementVNode("label",gi,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":R[1]||(R[1]=X=>i.value=X),type:"radio",value:!1},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(F)(e.locale,"sortCurrentSelection")),1)])])]),t.createElementVNode("div",yi,[t.createElementVNode("button",{class:"sort-confirm__btn sort-confirm__btn--primary",type:"button",onClick:x},t.toDisplayString(t.unref(F)(e.locale,"sort")),1),t.createElementVNode("button",{class:"sort-confirm__btn",type:"button",onClick:C},t.toDisplayString(t.unref(F)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-d26d5917"]]);function et(e){let r="",o=e;do r=String.fromCharCode(65+o%26)+r,o=Math.floor(o/26)-1;while(o>=0);return r}function Kl(e){let r=0;for(let o=0;o<e.length;o++)r=r*26+(e.toUpperCase().charCodeAt(o)-64);return r-1}function nl(e){if(e==null)return null;if(typeof e=="number")return e;if(typeof e=="string"){const r=parseFloat(e);return e.endsWith("%")||isNaN(r)?null:r}return null}function Pl(e){navigator.clipboard.writeText(e).catch(()=>{const r=document.createElement("textarea");r.value=e,r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r)})}function pl(e,r){return`${e},${r}`}function wl(e,r,o){const l=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!l)return null;const a=Kl(l[1]),i=parseInt(l[2],10)-1;return a<0||a>=r||i<0||i>=o?null:{col:a,row:i}}function ol(e,r){if(!r)return{x:0,y:0};const o=r.getBoundingClientRect();return{x:e.clientX-o.left,y:e.clientY-o.top}}const mn=[{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)"}],Ci={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 vi(e){let r=0,o=null;for(let l=0;l<e.length;l++){const a=e[l];if(o){a===o&&(e[l+1]===o?l++:o=null);continue}if(a==='"'||a==="'"){o=a;continue}if(a==="(")r++;else if(a===")"&&(r--,r<0))return!1}return r===0}function wi(e){const r=e.trim();if(!r.startsWith("="))return{ok:!1,name:null};const o=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(r.slice(1).trim());if(!o)return{ok:!1,name:null};const l=o[1].toUpperCase(),a=Ci[l];if(!a)return{ok:!1,name:l};const i=o[2];if(!vi(i))return{ok:!1,name:l};const n=rl(i),p=n.length===1&&n[0].trim()===""?0:n.length;return p<a.min||p>a.max?{ok:!1,name:l}:n.some(c=>c.trim()==="")?{ok:!1,name:l}:{ok:!0,name:l}}function hl(e,r,o){const l=e.split(":");if(l.length!==2)return null;const a=wl(l[0],r,o),i=wl(l[1],r,o);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 pn(e){const r=e.trim();if(r==="")return"";const o=Number(r);return!isNaN(o)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(r)?o:e}function Ot(e,r,o,l,a){const i=o[pl(e,r)];if(!i)return"";const n=i.value;return n.startsWith("=")?gn(pl(e,r),o,l,a):pn(n)}function hn(e,r,o,l,a){const i=Ot(e,r,o,l,a);if(i===null)return 0;if(typeof i=="number")return i;const n=parseFloat(String(i));return isNaN(n)?0:n}const kl=new Map,Ml=new Set;function Bl(){kl.clear(),Ml.clear()}function gn(e,r,o,l){return ki(e,r,o,l,0)}function ki(e,r,o,l,a){if(Ml.has(e))return null;if(kl.has(e))return kl.get(e);Ml.add(e);const i=r[e];let n;if(!i)n=null;else{const p=i.value;if(!p.startsWith("="))n=pn(p);else{const c=p.slice(1).trim(),h=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(c);n=h?vn(h[1].toUpperCase(),h[2],r,o,l,a+1):ht(c,r,o,l,a+1)}}return Ml.delete(e),kl.set(e,n),n}function Gl(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function yn(e,r){return typeof e=="number"&&typeof r=="number"?e===r:String(e??"")===String(r??"")}function bn(e,r,o){let l;if(typeof e=="number"&&typeof r=="number")l=e<r?-1:e>r?1:0;else{const a=String(e??""),i=String(r??"");l=a<i?-1:a>i?1:0}switch(o){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 Cn(e,r,o,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 Ei(e,r,o,l,a,i){let p=r.trim();p.length>=2&&(p[0]==='"'&&p[p.length-1]==='"'||p[0]==="'"&&p[p.length-1]==="'")&&(p=p.slice(1,-1));const c=/^([<>=]+)([\s\S]*)$/.exec(p);if(c){const S=c[1],x=Cn(c[2]);return bn(e,x,S)}const h=Cn(p);return yn(e,h)}function Si(e,r,o,l,a){const i=e.trim(),n=["<=",">=","<>"];let p=null,c=-1,h=null,S=0;for(let C=0;C<i.length;C++){const w=i[C];if(h){w===h&&(i[C+1]===h?C++:h=null);continue}if(w==='"'||w==="'"){h=w;continue}if(w==="("&&S++,w===")"&&S--,S===0&&(w==="<"||w===">"||w==="=")){const R=i.slice(C,C+2);p=n.includes(R)?R:w,c=C;break}}if(p&&c>=0){const C=i.slice(0,c).trim(),w=i.slice(c+p.length).trim(),R=ht(C,r,o,l,a),X=ht(w,r,o,l,a);return bn(R,X,p)}const x=ht(i,r,o,l,a);return Gl(x)}function rl(e){const r=[];let o=0,l=null,a="";for(let i=0;i<e.length;i++){const n=e[i];if(l){a+=n,n===l&&(e[i+1]===l?(i++,a+=l):l=null);continue}if(n==='"'||n==="'"){l=n,a+=n;continue}if(n==="("&&o++,n===")"&&o--,n===","&&o===0){r.push(a),a="";continue}a+=n}return r.push(a),r}function ht(e,r,o,l,a){if(a>20)return null;const i=e.trim();if(i==="")return null;const n=i.toUpperCase();if(n==="TRUE")return 1;if(n==="FALSE")return 0;const p=xi(i);if(p.length===0)return null;let c=0;const h=()=>{let w=S();for(;c<p.length;){const R=p[c];if(R.type==="op"&&(R.val==="+"||R.val==="-"))c++,w=Yl(w,S(),R.val);else break}return w},S=()=>{let w=x();for(;c<p.length;){const R=p[c];if(R.type==="op"&&(R.val==="*"||R.val==="/"))c++,w=Yl(w,x(),R.val);else break}return w},x=()=>{const w=p[c];return w&&w.type==="op"&&w.val==="-"?(c++,Yl(0,x(),"-")):w&&w.type==="op"&&w.val==="+"?(c++,x()):C()},C=()=>{const w=p[c];if(!w)return null;if(w.type==="num")return c++,Number(w.val);if(w.type==="str")return c++,w.val;if(w.type==="lp"){c++;const R=h();return p[c]&&p[c].type==="rp"&&c++,R}if(w.type==="ref"){c++;const R=wl(w.val,o,l);return R?Ot(R.col,R.row,r,o,l):null}if(w.type==="func"){const R=w.val.toUpperCase();if(c++,p[c]&&p[c].type==="lp"){const X=p[c];let Y=0,te=null,W=c;for(;W<p.length;W++)if(p[W].type==="lp")Y++;else if(p[W].type==="rp"&&(Y--,Y===0)){te=p[W];break}if(te){const y=i.slice(X.start+1,te.start);return c=W+1,vn(R,y,r,o,l,a+1)}}return null}return c++,null};return h()}function xi(e){const r=[];let o=0;for(;o<e.length;){const l=e[o];if(/\s/.test(l)){o++;continue}if(l==='"'||l==="'"){const a=l,i=o;o++;let n="";for(;o<e.length;){if(e[o]===a){if(e[o+1]===a){n+=a,o+=2;continue}o++;break}n+=e[o],o++}r.push({type:"str",val:n,start:i});continue}if(/[0-9]/.test(l)||l==="."){const a=o;let i="";for(l==="."&&(i+=".",o++);o<e.length&&/[0-9]/.test(e[o]);)i+=e[o],o++;if(e[o]===".")for(i+=".",o++;o<e.length&&/[0-9]/.test(e[o]);)i+=e[o],o++;if(e[o]==="e"||e[o]==="E")for(i+=e[o],o++,(e[o]==="+"||e[o]==="-")&&(i+=e[o],o++);o<e.length&&/[0-9]/.test(e[o]);)i+=e[o],o++;r.push({type:"num",val:i,start:a});continue}if(/[A-Za-z_]/.test(l)){const a=o;let i="";for(;o<e.length&&/[A-Za-z0-9_]/.test(e[o]);)i+=e[o],o++;e[o]==="("?r.push({type:"func",val:i,start:a}):r.push({type:"ref",val:i,start:a});continue}if(l==="("){r.push({type:"lp",val:l,start:o}),o++;continue}if(l===")"){r.push({type:"rp",val:l,start:o}),o++;continue}if(l===","){r.push({type:"comma",val:l,start:o}),o++;continue}if(l==="+"||l==="-"||l==="*"||l==="/"){r.push({type:"op",val:l,start:o}),o++;continue}o++}return r}function Yl(e,r,o){if(typeof e!="number"||typeof r!="number")return null;switch(o){case"+":return e+r;case"-":return e-r;case"*":return e*r;case"/":return r===0?null:e/r}return null}function vn(e,r,o,l,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const n=hl(r.trim(),l,a);if(!n)return null;if(e==="COUNT"){let c=0;for(let h=n.sc;h<=n.ec;h++)for(let S=n.sr;S<=n.er;S++)typeof Ot(h,S,o,l,a)=="number"&&c++;return c}let p=0;for(let c=n.sc;c<=n.ec;c++)for(let h=n.sr;h<=n.er;h++)p+=hn(c,h,o,l,a);if(isNaN(p))return null;if(e==="AVERAGE"){const c=(n.ec-n.sc+1)*(n.er-n.sr+1);return c===0?null:p/c}return p}case"IF":{const n=rl(r);if(n.length<3)return null;const p=Si(n[0],o,l,a,i);return ht(p?n[1]:n[2],o,l,a,i)}case"VLOOKUP":{const n=rl(r);if(n.length<3)return null;const p=ht(n[0],o,l,a,i),c=hl(n[1].trim(),l,a);if(!c)return null;const h=ht(n[2],o,l,a,i),S=typeof h=="number"?h:parseFloat(String(h));if(isNaN(S))return null;const x=c.sc+(S-1);if(x<c.sc||x>c.ec)return null;if(n.length>=4?Gl(ht(n[3],o,l,a,i)):!1){let w=-1,R=-1/0;for(let X=c.sr;X<=c.er;X++){const Y=Ot(c.sc,X,o,l,a);typeof Y=="number"&&typeof p=="number"&&Y<=p&&Y>R&&(R=Y,w=X)}return w>=0?Ot(x,w,o,l,a):null}for(let w=c.sr;w<=c.er;w++){const R=Ot(c.sc,w,o,l,a);if(yn(R,p))return Ot(x,w,o,l,a)}return null}case"CONCATENATE":{const n=rl(r);let p="";for(const c of n){const h=ht(c,o,l,a,i);p+=h===null?"":typeof h=="number"?String(h):h}return p}case"MAX":case"MIN":{const n=hl(r.trim(),l,a);if(!n)return null;const p=[];for(let c=n.sc;c<=n.ec;c++)for(let h=n.sr;h<=n.er;h++){const S=Ot(c,h,o,l,a);typeof S=="number"&&p.push(S)}return p.length===0?null:e==="MAX"?Math.max(...p):Math.min(...p)}case"STDEV":{const n=hl(r.trim(),l,a);if(!n)return null;const p=[];for(let x=n.sc;x<=n.ec;x++)for(let C=n.sr;C<=n.er;C++){const w=Ot(x,C,o,l,a);typeof w=="number"&&p.push(w)}const c=p.length;if(c<2)return null;const h=p.reduce((x,C)=>x+C,0)/c,S=p.reduce((x,C)=>x+Math.pow(C-h,2),0)/(c-1);return Math.sqrt(S)}case"SIN":{const n=rl(r);if(n.length!==1)return null;const p=ht(n[0],o,l,a,i);return typeof p!="number"?null:Math.sin(p)}case"SUMIF":{const n=rl(r);if(n.length<2||n.length>3)return null;const p=hl(n[0].trim(),l,a);if(!p)return null;const c=n.length===3?hl(n[2].trim(),l,a):p;if(!c)return null;let h=0;for(let S=p.sr;S<=p.er;S++)for(let x=p.sc;x<=p.ec;x++){const C=Ot(x,S,o,l,a);Ei(C,n[1])&&(h+=hn(c.sc+(x-p.sc),c.sr+(S-p.sr),o,l,a))}return h}case"PMT":{const n=rl(r);if(n.length<3||n.length>5)return null;const p=ht(n[0],o,l,a,i),c=ht(n[1],o,l,a,i),h=ht(n[2],o,l,a,i);if(typeof p!="number"||typeof c!="number"||typeof h!="number")return null;const S=n.length>=4?ht(n[3],o,l,a,i):0,x=typeof S=="number"?S:0,C=n.length>=5?ht(n[4],o,l,a,i):0,w=Gl(C)?1:0;if(p===0)return c===0?null:-(h+x)/c;const R=Math.pow(1+p,c);return-(x+h*R)*p/((1+p*w)*(R-1))}default:return null}}function Xl(e,r,o){const l=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const n=wl(i[1],r,o);if(n)if(i[2]){const p=wl(i[2],r,o);if(!p)continue;for(let c=Math.min(n.col,p.col);c<=Math.max(n.col,p.col);c++)for(let h=Math.min(n.row,p.row);h<=Math.max(n.row,p.row);h++)l.push(pl(c,h))}else l.push(pl(n.col,n.row))}return l}function wn(e,r,o,l,a){const i=o[pl(e,r)];if(!i)return"";const n=i.value;if(!n.startsWith("="))return n;const p=gn(pl(e,r),o,l,a);return p===null?"#ERROR":String(p)}function Ri(e,r,o,l,a,i){return r===0&&o===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(n,p,c,h,S)=>{const x=p?Kl(c):Kl(c)+r,C=h?parseInt(S,10)-1:parseInt(S,10)-1+o;let w;x<0?w="A":x>=l?w=i(l-1):w=i(x);let R;return C<0?R="1":C>=a?R=String(a):R=String(C+1),(p||"")+w+(h||"")+R})}class Mi{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(r){var l;const o=this.deps.get(r);if(o){for(const a of o)(l=this.rev.get(a))==null||l.delete(r);this.deps.delete(r)}}set(r,o){if(this.clear(r),o.length!==0){this.deps.set(r,o);for(const l of o)this.rev.has(l)||this.rev.set(l,new Set),this.rev.get(l).add(r)}}markDirty(r){const o=[r];for(;o.length>0;){const l=o.pop(),a=this.rev.get(l);if(a)for(const i of a)this.dirty.has(i)||(this.dirty.add(i),o.push(i))}}getDirtyAndClear(){const r=this.dirty;return this.dirty=new Set,r}rebuild(r,o,l){this.deps.clear(),this.rev.clear(),this.dirty.clear(),kl.clear();for(const[a,i]of Object.entries(r))if(i.value.startsWith("=")){const n=Xl(i.value.slice(1),o,l);this.set(a,n)}}}const Bi={class:"ifn-dialog__header"},Di={class:"ifn-dialog__title"},Ni={class:"ifn-dialog__body"},Ti={class:"ifn-dialog__field"},Ii={class:"ifn-dialog__label"},Ai={key:0,class:"ifn-dialog__desc"},Vi={class:"ifn-dialog__field"},Fi={class:"ifn-dialog__label"},Oi={class:"ifn-dialog__footer"},Hi=["disabled"],Li=kt(t.defineComponent({__name:"insertFunctionDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","insert","cancel"],setup(e,{emit:r}){const o=e,l=r,a=t.ref(!1),i=t.ref(""),n=t.ref(""),p=t.ref(null),c=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(()=>mn.map(G=>({label:G.name,value:G.name}))),x=t.computed(()=>{const G=String(i.value??"");return G?F(o.locale,h[G]??""):""}),C=t.computed(()=>wi(n.value)),w=t.computed(()=>i.value===""||i.value===null||!n.value.trim()||!C.value.ok?!1:C.value.name===String(i.value).toUpperCase());t.watch(()=>o.modelOpen,G=>{G&&!a.value?R():!G&&a.value&&X()});function R(){n.value="",i.value="",a.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0),t.nextTick(()=>{const G=p.value;if(G)try{G.focus({preventScroll:!0}),G.setSelectionRange(G.value.length,G.value.length)}catch{}})}function X(){a.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function Y(G){i.value=G;const ne=mn.find(be=>be.name===String(G));ne&&(n.value="",te(ne.snippet))}function te(G){const ne=n.value,be=p.value,Fe=be?be.selectionStart??ne.length:ne.length,Me=be?be.selectionEnd??ne.length:ne.length,fe=ne.trim()?G:"="+G;n.value=ne.slice(0,Fe)+fe+ne.slice(Me),t.nextTick(()=>{const Ce=p.value;if(!Ce)return;const Ke=Fe+fe.length;try{Ce.focus({preventScroll:!0}),Ce.setSelectionRange(Ke,Ke)}catch{}})}function W(){l("insert",n.value),X()}function y(){l("cancel"),X()}function oe(G){G.key==="Escape"&&(G.stopPropagation(),y())}return(G,ne)=>(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:oe},[t.createElementVNode("div",{ref_key:"dialogRef",ref:c,class:"ifn-dialog",onMousedown:ne[1]||(ne[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Bi,[t.createElementVNode("span",Di,t.toDisplayString(t.unref(F)(e.locale,"insertFunctionTitle")),1),t.createElementVNode("button",{class:"ifn-dialog__close",type:"button",onClick:y},[...ne[2]||(ne[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",Ni,[t.createElementVNode("div",Ti,[t.createElementVNode("label",Ii,t.toDisplayString(t.unref(F)(e.locale,"insertFunctionSelectLabel")),1),t.createVNode(Et,{class:"ifn-dialog__dropdown","model-value":i.value,options:S.value,searchable:!0,"search-placeholder":t.unref(F)(e.locale,"insertFunctionSearchPlaceholder"),"fallback-label":t.unref(F)(e.locale,"insertFunctionPlaceholder"),title:t.unref(F)(e.locale,"insertFunctionSelectLabel"),"onUpdate:modelValue":Y},null,8,["model-value","options","search-placeholder","fallback-label","title"]),x.value?(t.openBlock(),t.createElementBlock("div",Ai,t.toDisplayString(x.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",Vi,[t.createElementVNode("label",Fi,t.toDisplayString(t.unref(F)(e.locale,"insertFunctionFormulaLabel")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:p,"onUpdate:modelValue":ne[0]||(ne[0]=be=>n.value=be),class:"ifn-dialog__textarea",spellcheck:"false"},null,512),[[t.vModelText,n.value]])])]),t.createElementVNode("div",Oi,[t.createElementVNode("button",{class:"ifn-dialog__btn ifn-dialog__btn--primary",type:"button",disabled:!w.value,onClick:W},t.toDisplayString(t.unref(F)(e.locale,"insertFunctionBtn")),9,Hi),t.createElementVNode("button",{class:"ifn-dialog__btn",type:"button",onClick:y},t.toDisplayString(t.unref(F)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-f4e459b6"]]);class $i{constructor(r){if(r&&r.length>0){this.styles=r,this.index=new Map;for(let o=0;o<this.styles.length;o++){const l=this.stableKey(this.styles[o]);this.index.set(l,o)}}else this.styles=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(r){const o=Object.keys(r).sort(),l={};for(const a of o)l[a]=r[a];return JSON.stringify(l)}get(r){const o=this.styles[r];return o?r===0?o:Object.freeze(o):{}}getId(r){if(!r||Object.keys(r).length===0)return 0;const o=this.stableKey(r),l=this.index.get(o);if(l!==void 0)return l;const a=this.styles.length,i=Object.freeze({...r});return this.styles.push(i),this.index.set(o,a),a}getStyles(){return[...this.styles]}setStyles(r){this.styles=r,this.index=new Map;for(let o=0;o<this.styles.length;o++){const l=this.stableKey(this.styles[o]);this.index.set(l,o)}}compactStyles(r){const o=new Set;o.add(0);for(const n in r){const p=r[n].styleId??0;o.add(p)}const l=new Map,a=[{}];l.set(0,0);const i=Array.from(o).sort((n,p)=>n-p);for(const n of i)if(n!==0&&n<this.styles.length){const p=a.length;l.set(n,p),a.push(this.styles[n])}for(const n in r){const p=r[n],c=p.styleId??0,h=l.get(c);h!==void 0&&h!==c&&(p.styleId=h)}this.styles=a,this.index=new Map;for(let n=0;n<this.styles.length;n++){const p=this.stableKey(this.styles[n]);this.index.set(p,n)}return a}}function _i(e,r){if(!e)return null;const o=e.styleId;return o===void 0||o===0?null:r[o]??null}function kn(e){const r=new $i,o={};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=r.getId(a.style)),i.styleId===0&&delete i.styleId,o[l]=i}return{cells:o,styles:r.getStyles()}}function zi(e){const r={};for(const[o,l]of Object.entries(e)){const a={value:l.value};l.styleId!==void 0&&l.styleId>0&&(a.styleId=l.styleId),r[o]=a}return r}class Wi{constructor(r){if(r&&r.length>0){this.borders=r,this.index=new Map;for(let o=0;o<this.borders.length;o++){const l=this.stableKey(this.borders[o]);this.index.set(l,o)}}else this.borders=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(r){const o=["top","right","bottom","left"],l={};for(const a of o){const i=r[a];if(i&&(i.width!==void 0||i.color!==void 0||i.style!==void 0)){const n={};i.width!==void 0&&(n.width=i.width),i.color!==void 0&&(n.color=i.color),i.style!==void 0&&(n.style=i.style),l[a]=n}}return JSON.stringify(l)}get(r){const o=this.borders[r];return o?r===0?o:Object.freeze(o):{}}getId(r){if(!r||this.isEmptyBorder(r))return 0;const o=this.stableKey(r),l=this.index.get(o);if(l!==void 0)return l;const a=this.borders.length,i=Object.freeze(this.deepCloneBorder(r));return this.borders.push(i),this.index.set(o,a),a}isEmptyBorder(r){return!r.top&&!r.right&&!r.bottom&&!r.left}deepCloneBorder(r){const o={};return r.top&&(o.top={...r.top}),r.right&&(o.right={...r.right}),r.bottom&&(o.bottom={...r.bottom}),r.left&&(o.left={...r.left}),o}getBorders(){return[...this.borders]}setBorders(r){this.borders=r,this.index=new Map;for(let o=0;o<this.borders.length;o++){const l=this.stableKey(this.borders[o]);this.index.set(l,o)}}compactBorders(r){const o=new Set;o.add(0);for(const n of r){const p=n.borderId??0;o.add(p)}const l=new Map,a=[{}];l.set(0,0);const i=Array.from(o).sort((n,p)=>n-p);for(const n of i)if(n!==0&&n<this.borders.length){const p=a.length;l.set(n,p),a.push(this.borders[n])}for(const n of r){const p=n.borderId??0,c=l.get(p);c!==void 0&&c!==p&&(n.borderId=c)}this.borders=a,this.index=new Map;for(let n=0;n<this.borders.length;n++){const p=this.stableKey(this.borders[n]);this.index.set(p,n)}return a}}function Ui(e,r,o,l){if(!e)return;const a=e.styleId??0,i=o[a];if(!i)return;const n=i.borderId??0;if(n===0)return;const p=l.get(n);if(p)return p[r]}function Ki(e,r,o,l,a,i){const n=l[e.styleId??0]??{},p=n.borderId??0,c=p>0?a.get(p):{},h={top:c.top?{...c.top}:void 0,right:c.right?{...c.right}:void 0,bottom:c.bottom?{...c.bottom}:void 0,left:c.left?{...c.left}:void 0};o?h[r]={...o}:h[r]=void 0;const S=a.getId(h),x={...n};S===0?delete x.borderId:x.borderId=S,delete x.borderTopWidth,delete x.borderBottomWidth,delete x.borderLeftWidth,delete x.borderRightWidth,delete x.borderColor,Object.keys(x).length===0?e.styleId=0:e.styleId=i(x)}function En(e){const r=new Wi,o=[];for(const l of e){if(!(l.borderTopWidth!==void 0||l.borderBottomWidth!==void 0||l.borderLeftWidth!==void 0||l.borderRightWidth!==void 0)){o.push(l);continue}const i=typeof l.borderColor=="string"?l.borderColor:void 0,n={};l.borderTopWidth!==void 0&&l.borderTopWidth>0&&(n.top={width:l.borderTopWidth,color:i}),l.borderBottomWidth!==void 0&&l.borderBottomWidth>0&&(n.bottom={width:l.borderBottomWidth,color:i}),l.borderLeftWidth!==void 0&&l.borderLeftWidth>0&&(n.left={width:l.borderLeftWidth,color:i}),l.borderRightWidth!==void 0&&l.borderRightWidth>0&&(n.right={width:l.borderRightWidth,color:i});const p=r.getId(n),c={...l};delete c.borderTopWidth,delete c.borderBottomWidth,delete c.borderLeftWidth,delete c.borderRightWidth,delete c.borderColor,p>0?c.borderId=p:delete c.borderId,o.push(c)}return{styles:o,borders:r.getBorders()}}function Pi(e,r){const o=t.reactive({rowCount:e.rowCount??r.rowCount,colCount:e.colCount??r.colCount,width:e.width,height:e.height,theme:e.theme??r.theme,locale:e.locale??r.locale});t.watchEffect(()=>{o.rowCount=e.rowCount??r.rowCount,o.colCount=e.colCount??r.colCount,o.width=e.width,o.height=e.height,o.theme=e.theme??r.theme,o.locale=e.locale??r.locale});const l=t.computed(()=>o.locale==="zh-CN"?"zh-CN":"en-US"),a=o.colCount,i=o.rowCount,n=t.reactive({colCount:a,rowCount:i}),p=8,c=32,h=t.reactive({}),S=t.reactive([{}]),x=t.reactive([{}]);let C=new Map;C.set("{}",0);let w=new Map;w.set("{}",0);function R(f){const b=Object.keys(f).sort(),k={};for(const V of b)k[V]=f[V];return JSON.stringify(k)}function X(f){const b=["top","right","bottom","left"],k={};for(const V of b){const $=f[V];if($&&($.width!==void 0||$.color!==void 0||$.style!==void 0)){const ue={};$.width!==void 0&&(ue.width=$.width),$.color!==void 0&&(ue.color=$.color),$.style!==void 0&&(ue.style=$.style),k[V]=ue}}return JSON.stringify(k)}function Y(f){if(!f||Object.keys(f).length===0)return 0;const b=R(f),k=C.get(b);if(k!==void 0)return k;const V=S.length;return S.push(Object.freeze({...f})),C.set(b,V),V}function te(f){return _i(f,S)}function W(){C=new Map;for(let f=0;f<S.length;f++)C.set(R(S[f]),f)}function y(f){S.splice(0,S.length,...f),W()}function oe(f){if(!f||!f.top&&!f.right&&!f.bottom&&!f.left)return 0;const b=X(f),k=w.get(b);if(k!==void 0)return k;const V=x.length;return x.push(Object.freeze({top:f.top?Object.freeze({...f.top}):void 0,right:f.right?Object.freeze({...f.right}):void 0,bottom:f.bottom?Object.freeze({...f.bottom}):void 0,left:f.left?Object.freeze({...f.left}):void 0})),w.set(b,V),V}function G(f){return x[f]??{}}function ne(){w=new Map;for(let f=0;f<x.length;f++)w.set(X(x[f]),f)}function be(f){x.splice(0,x.length,...f),ne()}function Fe(f,b){return Ui(f,b,S,{get:k=>x[k]??{}})}function Me(f,b){const k=he(f,b);return k?k.anchor:null}function fe(f,b,k,V){const $=he(f,b),ue=he(k,V);return!$||!ue?!1:$.anchor===ue.anchor}const Ce=t.reactive({}),Ke=new Mi,Se=t.ref(null),pe=t.ref("cell"),ye=t.ref({col:0,row:0}),Oe=t.ref(null),He=t.ref(""),Q=t.ref(new Array(n.colCount).fill(100)),ae=t.ref(new Array(n.rowCount).fill(void 0)),m=t.ref(0),I=t.ref(0),H=new Map;let z=null;function D(f,b,k,V){const $=`${V} ${k} ${b}px ${f}`,ue=H.get($);if(ue)return ue;if(!z){if(typeof document>"u")return{ascent:b*.88,descent:b*.28};z=document.createElement("canvas")}const ke=z.getContext("2d");if(!ke)return{ascent:b*.88,descent:b*.28};ke.font=$;const $e=ke.measureText(" "),Pe=$e.fontBoundingBoxAscent,ze=$e.fontBoundingBoxDescent;if(typeof Pe=="number"&&typeof ze=="number"&&Pe>0&&ze>0){const Dt={ascent:Pe,descent:ze};return H.set($,Dt),Dt}const _e=["M","中","y","Ä","0"];let yt=0,Qe=0;for(const Dt of _e){const il=ke.measureText(Dt),Zt=il.actualBoundingBoxAscent||0,Lt=il.actualBoundingBoxDescent||0;Zt>yt&&(yt=Zt),Lt>Qe&&(Qe=Lt)}const Ht=Math.max(yt,b*.88),gl=Math.max(Qe,b*.28),Pt={ascent:Ht,descent:gl};return H.set($,Pt),Pt}const s=D(fl,zt,"normal","normal"),u=s.ascent+s.descent,L=Math.max(0,(24-u)/2);let xe=(f,b)=>`${f},${b}`,he=()=>null,g=()=>zt,A=t.computed(()=>[0]),Re=()=>24,Ze=(f,b,k,V)=>({startCol:Math.min(f,k),startRow:Math.min(b,V),endCol:Math.max(f,k),endRow:Math.max(b,V)});function dt(f,b){const k=te(h[xe(f,b)]),V=g(f,b),$=typeof(k==null?void 0:k.fontFamily)=="string"&&k.fontFamily?k.fontFamily:fl,ue=(k==null?void 0:k.fontWeight)==="bold"?"bold":"normal",ke=(k==null?void 0:k.fontStyle)==="italic"?"italic":"normal";return D($,V,ue,ke)}function ie(f,b,k,V){if(!b)return[""];const $=b.split(`
2
+ `),ue=[];for(const ke of $)if(!V||k<=0)ue.push(ke);else{let $e="";for(let Pe=0;Pe<ke.length;Pe++){const ze=ke[Pe],_e=$e+ze;f.measureText(_e).width>k&&$e?(ue.push($e),$e=ze):$e=_e}ue.push($e)}return ue}function Be(f,b){const k=te(h[xe(f,b)]);return typeof(k==null?void 0:k.fontSize)=="number"&&k.fontSize>0?k.fontSize:zt}g=Be;const Le=t.computed(()=>{const f=[0];for(let b=0;b<n.colCount;b++)f.push(f[b]+Q.value[b]);return f});A=Le;const at={w:800,h:600};let lt=()=>{};const ct=t.computed(()=>{const f=new Set;for(const b in h){const k=b.indexOf(",");if(k<0)continue;const V=parseInt(b.substring(k+1),10),$=h[b];$&&($.value!==""||$.styleId!==void 0)&&f.add(V)}for(let b=0;b<ae.value.length;b++)ae.value[b]!==void 0&&f.add(b);for(const b in Ce){const k=b.indexOf(",");if(k<0)continue;const V=parseInt(b.substring(k+1),10);f.add(V)}return f});function ft(f){const b=ae.value[f];if(b!=null&&b>0)return b;if(!ct.value.has(f))return 24;let k,V,$=1;const ue=z?z.getContext("2d"):null,ke=D(fl,zt,"normal","normal");k=ke.ascent,V=ke.descent;for(let _e=0;_e<n.colCount;_e++){const yt=Be(_e,f),Qe=te(h[xe(_e,f)]),Ht=typeof(Qe==null?void 0:Qe.fontFamily)=="string"&&Qe.fontFamily?Qe.fontFamily:fl,gl=(Qe==null?void 0:Qe.fontWeight)==="bold"?"bold":"normal",Pt=(Qe==null?void 0:Qe.fontStyle)==="italic"?"italic":"normal",Dt=D(Ht,yt,gl,Pt);Dt.ascent>k&&(k=Dt.ascent),Dt.descent>V&&(V=Dt.descent);const il=typeof(Qe==null?void 0:Qe.numberFormat)=="string"?Qe.numberFormat:"",Zt=ee(_e,f),Lt=ll(Zt,il,l.value);if(Lt){const Zl=(Qe==null?void 0:Qe.wrap)==="wrap";let qt;if(Zl&&ue){ue.font=`${Pt} ${gl} ${yt}px ${Ht}`;const yl=he(_e,f);let El;yl&&_e===yl.range.startCol&&f===yl.range.startRow?El=A.value[yl.range.endCol+1]-A.value[_e]:El=Q.value[_e],qt=ie(ue,Lt,Math.max(0,El-10),!0).length,qt>$&&($=qt)}else qt=Lt.split(`
3
+ `).length,qt>$&&($=qt)}}const $e=k+V,Pe=L*2+$*$e;return Math.min(500,Math.max(24,Math.round(Pe)))}Re=ft;function st(f){return ae.value[f]===void 0}const ut=t.computed(()=>{const f=[0];for(let b=0;b<n.rowCount;b++)f.push(f[b]+Re(b));return f}),Tt=t.computed(()=>Le.value[n.colCount]),Mt=t.computed(()=>ut.value[n.rowCount]);function bt(f,b){return`${f},${b}`}xe=bt;function It(f){Reflect.deleteProperty(h,f)}function Ct(f,b){pe.value="cell";const k=he(f,b);k?(ye.value={col:k.range.startCol,row:k.range.startRow},Se.value={...k.range}):(ye.value={col:f,row:b},Se.value={startCol:f,startRow:b,endCol:f,endRow:b})}function Bt(f,b,k,V,$="cell"){const ue=he(f,b);if(ye.value=ue?{col:ue.range.startCol,row:ue.range.startRow}:{col:f,row:b},pe.value=$,$==="row"||$==="col"){const ke=Math.min(f,k),$e=Math.max(f,k),Pe=Math.min(b,V),ze=Math.max(b,V);Se.value={startCol:ke,startRow:Pe,endCol:$e,endRow:ze}}else Se.value=Ze(f,b,k,V)}function At(){Bt(0,0,n.colCount-1,n.rowCount-1,"all")}function jt(f,b){const k=Se.value;return k?(pe.value==="cell"||pe.value==="all",f>=k.startCol&&f<=k.endCol&&b>=k.startRow&&b<=k.endRow):!1}function al(f,b){return jt(f,b)}function St(f,b){for(const k in Ce){const V=Ce[k];if(V&&f>=V.startCol&&f<=V.endCol&&b>=V.startRow&&b<=V.endRow)return{range:V,anchor:k}}return null}he=St;function B(f,b){return Ce[bt(f,b)]!==void 0}function N(f,b){const k=he(f,b);if(k&&f===k.range.startCol&&b===k.range.startRow){const V=Le.value[k.range.endCol+1]-Le.value[f],$=ut.value[k.range.endRow+1]-ut.value[b];return{w:V,h:$}}return{w:Q.value[f],h:Re(b)}}function O(f,b,k,V){let $=Math.min(f,k),ue=Math.max(f,k),ke=Math.min(b,V),$e=Math.max(b,V),Pe=!0;for(;Pe;){Pe=!1;for(const ze in Ce){const _e=Ce[ze];if(!_e)continue;_e.startCol<=ue&&_e.endCol>=$&&_e.startRow<=$e&&_e.endRow>=ke&&(_e.startCol<$&&($=_e.startCol,Pe=!0),_e.endCol>ue&&(ue=_e.endCol,Pe=!0),_e.startRow<ke&&(ke=_e.startRow,Pe=!0),_e.endRow>$e&&($e=_e.endRow,Pe=!0))}}return{startCol:$,startRow:ke,endCol:ue,endRow:$e}}Ze=O;function J(f,b){var k;return((k=h[bt(f,b)])==null?void 0:k.value)??""}function ee(f,b){return Bl(),wn(f,b,h,n.colCount,n.rowCount)}function re(f,b,k){var $e,Pe;f>=0&&b>=0&&v(f,b);const V=bt(f,b);if(Bl(),k===""||k==null){Ke.clear(V);const ze=($e=h[V])==null?void 0:$e.styleId;ze!==void 0&&ze>0?h[V]={value:"",styleId:ze}:It(V),Ke.markDirty(V);return}const $=String(k);if(!$.startsWith("=")){const ze=te(h[V]),_e=typeof(ze==null?void 0:ze.numberFormat)=="string"?ze.numberFormat:"";if(Rt(_e)){const yt=Wl($,l.value);if(yt){const Ht={...ze??{},numberFormat:yt.format};h[V]={value:String(yt.serial),styleId:Y(Ht)},Ke.clear(V),Ke.markDirty(V);return}const Qe=bo($,l.value);if(Qe){const Ht={...ze??{},numberFormat:Qe.format};h[V]={value:String(Qe.num),styleId:Y(Ht)},Ke.clear(V),Ke.markDirty(V);return}}}const ue=(Pe=h[V])==null?void 0:Pe.styleId,ke={value:$};ue!==void 0&&ue>0&&(ke.styleId=ue),h[V]=ke,$.startsWith("=")?Ke.set(V,Xl($.slice(1),n.colCount,n.rowCount)):Ke.clear(V),Ke.markDirty(V)}function se(f,b,k,V){for(let $=f;$<=b;$++)for(let ue=k;ue<=V;ue++){const ke=bt($,ue);Ke.clear(ke),It(ke),Ke.markDirty(ke)}}let le=()=>{};function _(f){Oe.value||(Oe.value={...ye.value},f!==void 0?He.value=f:He.value||(He.value=J(ye.value.col,ye.value.row)))}function we(){Oe.value&&(le(),re(Oe.value.col,Oe.value.row,He.value),Oe.value=null,He.value="")}function De(){Oe.value=null,He.value=""}function U(f,b){const k=ye.value;let V=Math.max(0,k.col+f),$=Math.max(0,k.row+b);(V>=n.colCount||$>=n.rowCount)&&v(V,$);const ue=he(k.col,k.row),ke=he(V,$);ue&&ke&&ue.anchor===ke.anchor&&(f>0?V=ue.range.endCol+1:f<0&&(V=ue.range.startCol-1),b>0?$=ue.range.endRow+1:b<0&&($=ue.range.startRow-1),(V>=n.colCount||$>=n.rowCount)&&v(V,$)),V=Math.max(0,Math.min(n.colCount-1,V)),$=Math.max(0,Math.min(n.rowCount-1,$)),Ct(V,$)}function Ne(f,b){const k=Math.max(0,at.w-52-11),V=Math.max(0,at.h-24-11),$=Le.value[f],ue=ut.value[b],ke=he(f,b),$e=ke?Le.value[ke.range.endCol+1]-Le.value[f]:Q.value[f],Pe=ke?ut.value[ke.range.endRow+1]-ut.value[b]:Re(b);let ze=m.value,_e=I.value;$<ze?ze=$:$+$e>ze+k&&(ze=$+$e-k),ue<_e?_e=ue:ue+Pe>_e+V&&(_e=ue+Pe-V),lt(ze,_e)}function Xe(f){const b=Le.value;if(f<0||f>=b[n.colCount])return-1;let k=0,V=n.colCount-1;for(;k<V;){const $=k+V+1>>1;b[$]<=f?k=$:V=$-1}return k}function mt(f){const b=ut.value;if(f<0||f>=b[n.rowCount])return-1;let k=0,V=n.rowCount-1;for(;k<V;){const $=k+V+1>>1;b[$]<=f?k=$:V=$-1}return k}function v(f,b){var ue;const k=f+1,V=b+1;let $=!1;if(k>=n.colCount){const ke=Math.max(n.colCount+p,k),$e=ke-n.colCount,Pe=Q.value;for(let ze=0;ze<$e;ze++)Pe.push(100);n.colCount=ke,$=!0}if(V>=n.rowCount){const ke=Math.max(n.rowCount+c,V),$e=ke-n.rowCount,Pe=ae.value;for(let ze=0;ze<$e;ze++)Pe.push(void 0);n.rowCount=ke,$=!0}$&&((ue=j.scheduleRender)==null||ue.call(j))}function T(){return n.colCount!==a||n.rowCount!==i}function q(f,b){var ue;let k=!1;const V=Math.max(1,Math.floor(f)),$=Math.max(1,Math.floor(b));if(V!==n.colCount){if(V>n.colCount){const ke=Q.value;for(let $e=n.colCount;$e<V;$e++)ke.push(100)}else Q.value=Q.value.slice(0,V);n.colCount=V,k=!0}if($!==n.rowCount){if($>n.rowCount){const ke=ae.value;for(let $e=n.rowCount;$e<$;$e++)ke.push(void 0)}else ae.value=ae.value.slice(0,$);n.rowCount=$,k=!0}k&&((ue=j.scheduleRender)==null||ue.call(j))}const j={props:o,locale:l,get colCount(){return n.colCount},get rowCount(){return n.rowCount},ensureCapacity:v,hasDynamicDims:T,setDims:q,cells:h,styles:S,borders:x,merges:Ce,formulaDeps:Ke,selection:Se,activeCell:ye,editingCell:Oe,editValue:He,colWidths:Q,rowHeights:ae,scrollX:m,scrollY:I,BASE_CELL_VPAD:L,fontMetricsCache:H,fontMetricsCanvas:z,measureFontMetrics:D,_getFontMetricsForCell:dt,getWrappedLines:ie,cellFontSize:Be,colPositions:Le,getRowHeight:ft,_isAutoRow:st,rowPositions:ut,totalWidth:Tt,totalHeight:Mt,selectCell:Ct,selectRange:Bt,selectAll:At,isSelected:jt,isCellSelected:al,selectionMode:pe,cellKey:bt,delCell:It,findMerge:St,_isMergeAnchor:B,_mergedSpan:N,expandSelectionForMerges:O,getCellRaw:J,getCellValue:ee,setCellValue:re,clearCellsInRange:se,startEdit:_,commitEdit:we,cancelEdit:De,moveActive:U,ensureVisible:Ne,hitCol:Xe,hitRow:mt,registerStyle:Y,resolveStyle:te,rebuildStyleIndex:W,syncStyles:y,registerBorder:oe,resolveBorder:G,rebuildBorderIndex:ne,syncBorders:be,getCellBorderSide:Fe,getMergeOwner:Me,isSameMergeInternal:fe,viewSize:at,findHighlight:(f,b)=>null};return le=()=>{var f;return(f=j.saveUndo)==null?void 0:f.call(j)},lt=(f,b)=>{var k;return(k=j.clampScroll)==null?void 0:k.call(j,f,b)},j}function Gi(e,r){const o=t.ref([]),l=t.ref([]);function a(v){return zi(v)}function i(){return r.saveSheet(),{sheets:r.sheets.value.map(v=>({id:v.id,name:v.name,cells:a(v.cells),styles:[...v.styles],borders:v.borders?[...v.borders]:[{}],merges:v.merges?{...v.merges}:{},selection:v.selection?{...v.selection}:null,activeCell:v.activeCell?{...v.activeCell}:{col:0,row:0},scrollX:v.scrollX,scrollY:v.scrollY,colWidths:[...v.colWidths],rowHeights:[...v.rowHeights],colCount:v.colCount,rowCount:v.rowCount})),styles:[...e.styles],activeSheetIndex:r.activeSheetIndex.value}}function n(v){r.sheets.value=v.sheets.map(T=>({...T,cells:a(T.cells),styles:[...T.styles],borders:T.borders?[...T.borders]:[{}]})),r.loadSheet(Math.max(0,Math.min(v.activeSheetIndex,r.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function p(){const v=i(),T=o.value[o.value.length-1];T&&JSON.stringify(T)===JSON.stringify(v)||(o.value.push(v),l.value=[],o.value.length>50&&o.value.shift())}e.saveUndo=p;function c(){var v;o.value.length&&(l.value.push(i()),n(o.value.pop()),(v=e.scheduleRender)==null||v.call(e),t.nextTick(()=>{var T;return(T=e.emitModelData)==null?void 0:T.call(e)}))}function h(){var v;l.value.length&&(o.value.push(i()),n(l.value.pop()),(v=e.scheduleRender)==null||v.call(e),t.nextTick(()=>{var T;return(T=e.emitModelData)==null?void 0:T.call(e)}))}const S=t.computed(()=>o.value.length>0),x=t.computed(()=>l.value.length>0),C=t.computed(()=>!!e.selection.value),w=t.ref(null);function R(){var q;const v=e.selection.value;if(!v)return;const T={};for(let j=v.startCol;j<=v.endCol;j++)for(let f=v.startRow;f<=v.endRow;f++)T[`${j-v.startCol},${f-v.startRow}`]=((q=e.cells[e.cellKey(j,f)])==null?void 0:q.styleId)??0;w.value={styles:T}}function X(){var q,j,f;const v=w.value,T=e.selection.value;if(!(!v||!T)){p();for(let b=T.startCol;b<=T.endCol;b++)for(let k=T.startRow;k<=T.endRow;k++){const V=e.findMerge(b,k);if(V&&(b!==V.range.startCol||k!==V.range.startRow))continue;const $=v.styles[`${b-T.startCol},${k-T.startRow}`]??0,ue=e.cellKey(b,k),ke=((q=e.cells[ue])==null?void 0:q.value)??"";if(ke===""&&$===0)e.delCell(ue);else{const $e={value:ke};$>0&&($e.styleId=$),e.cells[ue]=$e}}w.value=null,(j=e.scheduleRender)==null||j.call(e),(f=e.emitModelData)==null||f.call(e)}}function Y(){var T,q,j;const v=e.selection.value;if(v){p();for(let f=v.startCol;f<=v.endCol;f++)for(let b=v.startRow;b<=v.endRow;b++){const k=e.findMerge(f,b);if(k&&(f!==k.range.startCol||b!==k.range.startRow))continue;const V=e.cellKey(f,b),$=((T=e.cells[V])==null?void 0:T.value)??"";$===""?e.delCell(V):e.cells[V]={value:$}}(q=e.scheduleRender)==null||q.call(e),(j=e.emitModelData)==null||j.call(e)}}const te=t.computed(()=>On.map(v=>({...v,label:v.value===""?F(e.locale.value,"fontDefault"):v.label}))),W=t.computed(()=>Hn.map(v=>({...v,label:String(v.value)}))),y="\0",oe=t.computed(()=>{const v=e.selection.value;if(!v)return"";let T,q=!1;for(let j=v.startCol;j<=v.endCol&&!q;j++)for(let f=v.startRow;f<=v.endRow&&!q;f++){const b=e.findMerge(j,f);if(b&&(j!==b.range.startCol||f!==b.range.startRow))continue;const k=e.resolveStyle(e.cells[e.cellKey(j,f)]),V=typeof(k==null?void 0:k.fontFamily)=="string"?k.fontFamily:"";T===void 0?T=V:V!==T&&(q=!0)}return q?y:T??""}),G=t.computed(()=>{const v=e.selection.value;if(!v)return zt;let T,q=!1;for(let j=v.startCol;j<=v.endCol&&!q;j++)for(let f=v.startRow;f<=v.endRow&&!q;f++){const b=e.findMerge(j,f);if(b&&(j!==b.range.startCol||f!==b.range.startRow))continue;const k=e.cellFontSize(j,f);T===void 0?T=k:k!==T&&(q=!0)}return q?0:T??zt});function ne(v,T){var j,f,b;const q=e.selection.value;if(q){p();for(let k=q.startCol;k<=q.endCol;k++)for(let V=q.startRow;V<=q.endRow;V++){const $=e.findMerge(k,V);if($&&(k!==$.range.startCol||V!==$.range.startRow))continue;const ue=e.cellKey(k,V),ke=((j=e.cells[ue])==null?void 0:j.value)??"";let Pe={...e.resolveStyle(e.cells[ue])??{}};if(T===""||T===null||T===void 0||T===0){const{[v]:_e,...yt}=Pe;Pe=yt}else Pe[v]=T;const ze=Object.keys(Pe).length?e.registerStyle(Pe):0;if(ke===""&&ze===0)e.delCell(ue);else{const _e={value:ke};ze>0&&(_e.styleId=ze),e.cells[ue]=_e}}(f=e.scheduleRender)==null||f.call(e),(b=e.emitModelData)==null||b.call(e)}}function be(v){ne("fontFamily",v===""?"":v)}const Fe=t.ref(!1),Me=t.ref(!1),fe=t.ref(!1),Ce=t.ref(!1),Ke=t.ref(!1);function Se(v){ne("fontSize",v),Fe.value=!1}const pe=t.computed(()=>Kn.map(v=>({label:F(e.locale.value,v.labelKey),value:v.value,icon:v.icon}))),ye=t.computed(()=>Pn.map(v=>({label:F(e.locale.value,v.labelKey),value:v.value,icon:v.icon}))),Oe=t.computed(()=>{const v=e.selection.value;if(!v)return"left";const T=e.resolveStyle(e.cells[e.cellKey(v.startCol,v.startRow)]),q=typeof(T==null?void 0:T.textAlign)=="string"?T.textAlign:"";return q==="center"||q==="right"?q:"left"}),He=t.computed(()=>{const v=e.selection.value;if(!v)return"top";const T=e.resolveStyle(e.cells[e.cellKey(v.startCol,v.startRow)]),q=typeof(T==null?void 0:T.verticalAlign)=="string"?T.verticalAlign:"";return q==="middle"||q==="bottom"?q:"top"}),Q=t.computed(()=>{const v=e.selection.value;if(!v)return!1;const T=e.resolveStyle(e.cells[e.cellKey(v.startCol,v.startRow)]);return(T==null?void 0:T.wrap)==="wrap"});function ae(v){ne("textAlign",v)}function m(v){ne("verticalAlign",v)}function I(){if(!e.selection.value)return;const T=Q.value;ne("wrap",T?void 0:"wrap")}const H=t.ref(""),z=Fe;t.watch(G,v=>{H.value=v===0?"":String(v)},{immediate:!0});function D(v){const T=v.replace(/[^\d]/g,"");H.value=T;const q=parseInt(T,10);!isNaN(q)&&q>=5&&q<=72&&q!==G.value&&ne("fontSize",q)}function s(){const v=H.value.trim();if(!v){H.value=G.value===0?"":String(G.value);return}let T=parseInt(v,10);isNaN(T)?T=G.value===0?zt:G.value:T=Math.max(5,Math.min(72,T)),H.value=String(T),T!==G.value&&ne("fontSize",T)}function u(v){v.key==="Enter"&&v.target.blur()}function L(v){v&&v.preventDefault(),z.value=!z.value,z.value&&(fe&&(fe.value=!1),Me&&(Me.value=!1),Ce.value=!1,Ke.value=!1)}function xe(){const v=G.value===0?zt:G.value,T=Math.min(72,v+1);ne("fontSize",T),H.value=String(T),z.value=!1}function he(){const v=G.value===0?zt:G.value,T=Math.max(5,v-1);ne("fontSize",T),H.value=String(T),z.value=!1}function g(v){const T=e.selection.value;if(!T)return!1;let q,j=!1;for(let f=T.startCol;f<=T.endCol&&!j;f++)for(let b=T.startRow;b<=T.endRow&&!j;b++){const k=e.findMerge(f,b);if(k&&(f!==k.range.startCol||b!==k.range.startRow))continue;const V=e.resolveStyle(e.cells[e.cellKey(f,b)]),$=!!(V!=null&&V[v]);q===void 0?q=$:$!==q&&(j=!0)}return!j&&q===!0}const A=t.computed(()=>g("fontWeight")),Re=t.computed(()=>g("fontStyle")),Ze=t.computed(()=>g("underline")),dt=t.computed(()=>g("strikethrough"));function ie(){ne("fontWeight",A.value?"":"bold")}function Be(){ne("fontStyle",Re.value?"":"italic")}function Le(){ne("underline",Ze.value?"":"underline")}function at(){ne("strikethrough",dt.value?"":"line-through")}const lt=t.ref(""),ct=t.ref(""),ft=Ce,st=Ke;function ut(){ft.value=!ft.value,st.value=!1,Me&&(Me.value=!1),fe&&(fe.value=!1)}function Tt(){st.value=!st.value,ft.value=!1,Me&&(Me.value=!1),fe&&(fe.value=!1)}function Mt(v){Me&&(Me.value=v),v&&(ft.value=!1,st.value=!1,fe&&(fe.value=!1))}function bt(v){lt.value=v,ne("color",v===""?"":v)}function It(v){ct.value=v,ne("backgroundColor",v===""?"":v)}function Ct(){ne("color",lt.value===""?"":lt.value)}function Bt(){ne("backgroundColor",ct.value===""?"":ct.value)}const At=t.computed(()=>{const v=e.selection.value;if(!v)return"";let T,q=!1;for(let j=v.startCol;j<=v.endCol&&!q;j++)for(let f=v.startRow;f<=v.endRow&&!q;f++){const b=e.findMerge(j,f);if(b&&(j!==b.range.startCol||f!==b.range.startRow))continue;const k=e.resolveStyle(e.cells[e.cellKey(j,f)]),V=typeof(k==null?void 0:k.color)=="string"?k.color:"";T===void 0?T=V:V!==T&&(q=!0)}return q?"":T??""}),jt=t.computed(()=>{const v=e.selection.value;if(!v)return"";let T,q=!1;for(let j=v.startCol;j<=v.endCol&&!q;j++)for(let f=v.startRow;f<=v.endRow&&!q;f++){const b=e.findMerge(j,f);if(b&&(j!==b.range.startCol||f!==b.range.startRow))continue;const k=e.resolveStyle(e.cells[e.cellKey(j,f)]),V=typeof(k==null?void 0:k.backgroundColor)=="string"?k.backgroundColor:"";T===void 0?T=V:V!==T&&(q=!0)}return q?"":T??""}),al=t.computed(()=>un(e.locale.value)),St=t.ref(!1),B=t.computed(()=>{const v=e.selection.value;if(!v)return Ut;let T,q=!1;for(let j=v.startCol;j<=v.endCol&&!q;j++)for(let f=v.startRow;f<=v.endRow&&!q;f++){const b=e.findMerge(j,f);if(b&&(j!==b.range.startCol||f!==b.range.startRow))continue;const k=e.resolveStyle(e.cells[e.cellKey(j,f)]),V=(k==null?void 0:k.numberFormatCategory)==="custom"?Wt:typeof(k==null?void 0:k.numberFormat)=="string"?k.numberFormat:"";T===void 0?T=V:V!==T&&(q=!0)}return q?Ft:T??Ut});function N(v){if((v==null?void 0:v.numberFormatCategory)==="custom")return Wt;const T=typeof(v==null?void 0:v.numberFormat)=="string"?v.numberFormat:"";return dn(T,e.locale.value)}const O=t.computed(()=>{const v=B.value;if(v!==Ft)return v===Wt?Wt:dn(v,e.locale.value);const T=e.selection.value;if(!T)return Ut;let q,j=!1;for(let f=T.startCol;f<=T.endCol&&!j;f++)for(let b=T.startRow;b<=T.endRow&&!j;b++){const k=e.findMerge(f,b);if(k&&(f!==k.range.startCol||b!==k.range.startRow))continue;const V=N(e.resolveStyle(e.cells[e.cellKey(f,b)]));q===void 0?q=V:V!==q&&(j=!0)}return j?Ft:q??Ut});function J(v){ne("numberFormat",v),ee()}function ee(){const v=e.selection.value;if(v)for(let T=v.startCol;T<=v.endCol;T++)for(let q=v.startRow;q<=v.endRow;q++){const j=e.findMerge(T,q);if(j&&(T!==j.range.startCol||q!==j.range.startRow))continue;const f=e.cellKey(T,q),b=e.cells[f],k=e.resolveStyle(b);if((k==null?void 0:k.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:V,...$}=k,ue=Object.keys($).length?e.registerStyle($):0,ke=(b==null?void 0:b.value)??"";if(ke===""&&ue===0)e.delCell(f);else{const $e={value:ke};ue>0&&($e.styleId=ue),e.cells[f]=$e}}}function re(v){if(v===Wt){St.value=!0;return}J(v)}function se(){St.value=!0}function le(){const v=e.selection.value;if(!v)return[];const T=[];for(let q=v.startCol;q<=v.endCol;q++)for(let j=v.startRow;j<=v.endRow;j++){const f=e.findMerge(q,j);if(f&&(q!==f.range.startCol||j!==f.range.startRow))continue;const b=e.cellKey(q,j),k=e.cells[b],V=e.resolveStyle(k),$=typeof(V==null?void 0:V.numberFormat)=="string"?V.numberFormat:Ut,ue=(k==null?void 0:k.value)??"",ke=ue.startsWith("=")?wn(q,j,e.cells,e.colCount,e.rowCount):ue;sn($,ke)&&T.push({key:b,nf:$,decimals:mo($,ke)})}return T}const _=t.computed(()=>le().some(v=>v.decimals<$l)),we=t.computed(()=>le().some(v=>v.decimals>_l));function De(v,T,q){var V;const j=((V=e.cells[v])==null?void 0:V.value)??"",b={...e.resolveStyle(e.cells[v])??{}};T===""?(delete b.numberFormat,delete b.numberFormatCategory):(b.numberFormat=T,q==="custom"&&(b.numberFormatCategory="custom"));const k=Object.keys(b).length?e.registerStyle(b):0;if(j===""&&k===0)e.delCell(v);else{const $={value:j};k>0&&($.styleId=k),e.cells[v]=$}}function U(v){var j,f;const T=le(),q=[];for(const b of T){const k=b.decimals+v;if(k<_l||k>$l)continue;const V=ho(b.nf,k);V==null||V===b.nf||q.push({key:b.key,code:V,category:Rt(b.nf)?"custom":void 0})}if(q.length){p();for(const b of q)De(b.key,b.code,b.category);(j=e.scheduleRender)==null||j.call(e),(f=e.emitModelData)==null||f.call(e)}}function Ne(){U(1)}function Xe(){U(-1)}return{undoStack:o,redoStack:l,cloneCells:a,takeSnap:i,restoreSnap:n,saveUndo:p,undo:c,redo:h,canUndo:S,canRedo:x,hasSelection:C,paintFmt:w,onPaintFormat:R,applyPaintFormat:X,clearFormat:Y,fontFamilyOptions:te,fontSizeOptions:W,FONT_FAMILY_MIXED:y,selFontFamily:oe,selFontSize:G,applyStyleToSelection:ne,onFontFamilyChange:be,onFontSizeChange:Se,hAlignOptions:pe,vAlignOptions:ye,selHAlign:Oe,selVAlign:He,selWrap:Q,onHAlignChange:ae,onVAlignChange:m,onWrapToggle:I,fontSizeInput:H,fontSizeMenuOpen:z,onFontSizeInput:D,onFontSizeBlur:s,onFontSizeKeydown:u,toggleFontSizeMenu:L,onFontSizeStepUp:xe,onFontSizeStepDown:he,selFontWeight:A,selFontStyle:Re,selUnderline:Ze,selStrikethrough:dt,toggleFontWeight:ie,toggleFontStyle:Be,toggleUnderline:Le,toggleStrikethrough:at,cachedTextColor:lt,cachedFillColor:ct,textColorMenuOpen:ft,fillColorMenuOpen:st,_toggleTextColorMenu:ut,_toggleFillColorMenu:Tt,onBorderMenuToggle:Mt,onTextColorChange:bt,onFillColorChange:It,applyCachedTextColor:Ct,applyCachedFillColor:Bt,selTextColor:At,selFillColor:jt,nfOptions:al,selNumberFormat:B,selNumberFormatDisplay:O,NF_NUMBER_FORMAT_MIXED:Ft,nfDialogOpen:St,onNumberFormatChange:re,openNumberFormatDialog:se,applyNumberFormatCode:J,canIncreaseDecimals:_,canDecreaseDecimals:we,onIncreaseDecimals:Ne,onDecreaseDecimals:Xe}}function Yi(e,r){r.borderMenuOpen&&(e.borderMenuOpen=r.borderMenuOpen),r.mergeMenuOpen&&(e.mergeMenuOpen=r.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 Xi(e,r){const o=t.ref("none"),l=t.ref(!1),a="#444";function i(m,I,H,z){if(m<0||I<0||m>=e.colCount||I>=e.rowCount)return;const D=e.findMerge(m,I),s=D?D.anchor:e.cellKey(m,I);if(!e.cells[s]){if(!z)return;e.cells[s]={value:""}}Ki(e.cells[s],H,z,e.styles,{get:L=>e.resolveBorder(L),getId:L=>e.registerBorder(L)},e.registerStyle)}function n(m,I,H){var xe;const z=e.findMerge(m,I),D=z?z.anchor:e.cellKey(m,I),s=((xe=e.cells[D])==null?void 0:xe.value)??"",u=e.resolveStyle(e.cells[D])?{...e.resolveStyle(e.cells[D])}:{},L=e.registerBorder(H);if(L>0?u.borderId=L:delete u.borderId,delete u.borderTopWidth,delete u.borderBottomWidth,delete u.borderLeftWidth,delete u.borderRightWidth,delete u.borderColor,s===""&&!Object.keys(u).length)e.delCell(D);else{const he=e.registerStyle(u);e.cells[D]={value:s,styleId:he||void 0}}}function p(m){var xe,he;o.value=m;const I=e.selection.value;if(!I)return;r.saveUndo();const{startCol:H,startRow:z,endCol:D,endRow:s}=I,u={width:1,color:a},L={width:2,color:a};if(m==="none")for(let g=H;g<=D;g++)for(let A=z;A<=s;A++){const Re=e.findMerge(g,A);Re&&(g!==Re.range.startCol||A!==Re.range.startRow)||n(g,A,{})}else if(m==="all")for(let g=H;g<=D;g++)for(let A=z;A<=s;A++){const Re=e.findMerge(g,A);Re&&(g!==Re.range.startCol||A!==Re.range.startRow)||n(g,A,{top:u,right:u,bottom:u,left:u})}else if(m==="outer"||m==="thickOuter"){const g=m==="thickOuter"?L:u;for(let A=H;A<=D;A++)i(A,z,"top",g);for(let A=H;A<=D;A++)i(A,s,"bottom",g);for(let A=z;A<=s;A++)i(H,A,"left",g);for(let A=z;A<=s;A++)i(D,A,"right",g)}else{const A={top:{side:"top",edgeCheck:(Re,Ze)=>Ze===z},bottom:{side:"bottom",edgeCheck:(Re,Ze)=>Ze===s},left:{side:"left",edgeCheck:(Re,Ze)=>Re===H},right:{side:"right",edgeCheck:(Re,Ze)=>Re===D}}[m];if(A)for(let Re=H;Re<=D;Re++)for(let Ze=z;Ze<=s;Ze++)A.edgeCheck(Re,Ze)&&i(Re,Ze,A.side,u)}(xe=e.scheduleRender)==null||xe.call(e),(he=e.emitModelData)==null||he.call(e)}function c(){p(o.value)}function h(m,I,H){const z=H.toLowerCase(),D=e.findMerge(m,I);if(D){if(z==="top"&&I!==D.range.startRow||z==="bottom"&&I!==D.range.endRow||z==="left"&&m!==D.range.startCol||z==="right"&&m!==D.range.endCol)return 0;const u=e.getCellBorderSide(e.cells[D.anchor],z);return(u==null?void 0:u.width)??0}const s=e.getCellBorderSide(e.cells[e.cellKey(m,I)],z);return(s==null?void 0:s.width)??0}const S=t.ref(!1);function x(m){S.value=m,m&&(r.textColorMenuOpen.value=!1,r.fillColorMenuOpen.value=!1,l.value=!1,r.fontSizeMenuOpen.value=!1)}function C(m,I,H,z){const D=[];for(const s in e.merges){const u=e.merges[s];u&&u.startCol<=H&&u.endCol>=m&&u.startRow<=z&&u.endRow>=I&&D.push(s)}for(const s of D)Reflect.deleteProperty(e.merges,s)}function w(){var s,u,L;const m=e.selection.value;if(!m||m.startCol===m.endCol&&m.startRow===m.endRow)return;r.saveUndo(),C(m.startCol,m.startRow,m.endCol,m.endRow);const I=e.cellKey(m.startCol,m.startRow),H=((s=e.cells[I])==null?void 0:s.value)??"";for(let xe=m.startCol;xe<=m.endCol;xe++)for(let he=m.startRow;he<=m.endRow;he++)xe===m.startCol&&he===m.startRow||e.clearCellsInRange(xe,xe,he,he);const z=e.resolveStyle(e.cells[I])?{...e.resolveStyle(e.cells[I])}:{};z.textAlign="center";const D=e.registerStyle(z);e.cells[I]={value:H,styleId:D||void 0},e.merges[I]={startCol:m.startCol,startRow:m.startRow,endCol:m.endCol,endRow:m.endRow},e.selectCell(m.startCol,m.startRow),(u=e.scheduleRender)==null||u.call(e),(L=e.emitModelData)==null||L.call(e)}function R(){var I,H,z;const m=e.selection.value;if(!(!m||m.startCol===m.endCol)){r.saveUndo();for(let D=m.startRow;D<=m.endRow;D++){C(m.startCol,D,m.endCol,D);const s=e.cellKey(m.startCol,D);(I=e.cells[s])==null||I.value;for(let u=m.startCol+1;u<=m.endCol;u++)e.clearCellsInRange(u,u,D,D);e.merges[s]={startCol:m.startCol,startRow:D,endCol:m.endCol,endRow:D}}e.selectRange(m.startCol,m.startRow,m.endCol,m.endRow),(H=e.scheduleRender)==null||H.call(e),(z=e.emitModelData)==null||z.call(e)}}function X(){var H,z,D;const m=e.selection.value;if(!m||m.startCol===m.endCol&&m.startRow===m.endRow)return;r.saveUndo(),C(m.startCol,m.startRow,m.endCol,m.endRow);const I=e.cellKey(m.startCol,m.startRow);(H=e.cells[I])==null||H.value;for(let s=m.startCol;s<=m.endCol;s++)for(let u=m.startRow;u<=m.endRow;u++)s===m.startCol&&u===m.startRow||e.clearCellsInRange(s,s,u,u);e.merges[I]={startCol:m.startCol,startRow:m.startRow,endCol:m.endCol,endRow:m.endRow},e.selectCell(m.startCol,m.startRow),(z=e.scheduleRender)==null||z.call(e),(D=e.emitModelData)==null||D.call(e)}function Y(){var I,H;const m=e.selection.value;m&&(r.saveUndo(),C(m.startCol,m.startRow,m.endCol,m.endRow),(I=e.scheduleRender)==null||I.call(e),(H=e.emitModelData)==null||H.call(e))}function te(){const m=e.selection.value;if(!m)return;const I=e.findMerge(m.startCol,m.startRow);I&&m.startCol===I.range.startCol&&m.startRow===I.range.startRow&&m.endCol===I.range.endCol&&m.endRow===I.range.endRow?Y():w()}function W(m){switch(m){case"mergeCenter":w();break;case"mergeAcross":R();break;case"mergeCells":X();break;case"unmergeCells":Y();break}}let y=null,oe=[];function G(m,I,H,z){oe=[];for(let D=H;D<=z;D++){const s=[];for(let u=m;u<=I;u++){const L=e.cells[e.cellKey(u,D)];s.push((L==null?void 0:L.styleId)??0)}oe.push(s)}}function ne(m,I,H,z){const D=e.cellKey(m,I);if(Bl(),H===""||H==null){e.formulaDeps.clear(D),z&&z>0?e.cells[D]={value:"",styleId:z}:e.delCell(D),e.formulaDeps.markDirty(D);return}e.cells[D]={value:H,styleId:z&&z>0?z:void 0},H.startsWith("=")?e.formulaDeps.set(D,Xl(H.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(D),e.formulaDeps.markDirty(D)}function be(){const m=e.selection.value;if(!m)return;y={...m},G(m.startCol,m.endCol,m.startRow,m.endRow);const I=[];for(let H=m.startRow;H<=m.endRow;H++){const z=[];for(let D=m.startCol;D<=m.endCol;D++)z.push(e.getCellRaw(D,H));I.push(z.join(" "))}Pl(I.join(`
4
+ `))}function Fe(){const m=e.selection.value;if(m){if(m.startCol===0&&m.endCol===e.colCount-1){y={...m},G(0,e.colCount-1,m.startRow,m.endRow);const I=[];for(let H=m.startRow;H<=m.endRow;H++){const z=[];for(let D=0;D<e.colCount;D++)z.push(e.getCellRaw(D,H));I.push(z.join(" "))}Pl(I.join(`
5
+ `))}else if(m.startRow===0&&m.endRow===e.rowCount-1){y={...m},G(m.startCol,m.endCol,0,e.rowCount-1);const I=[];for(let H=0;H<e.rowCount;H++){const z=[];for(let D=m.startCol;D<=m.endCol;D++)z.push(e.getCellRaw(D,H));I.push(z.join(" "))}Pl(I.join(`
6
+ `))}}}async function Me(){var he;let m;try{m=await navigator.clipboard.readText()}catch{return}if(!m&&m!=="")return;const I=m.split(/\r?\n/),H=e.activeCell.value,z=y,D=z&&oe.length>0,s=I.map(g=>g.split(" ").length),u=s.length?Math.max(...s):0,L=H.col+u-1,xe=H.row+I.length-1;L>=0&&xe>=0&&e.ensureCapacity(L,xe);for(let g=0;g<I.length;g++){const A=I[g].split(" ");for(let Re=0;Re<A.length;Re++){const Ze=H.col+Re,dt=H.row+g;let ie=A[Re];if(ie.startsWith("=")&&z&&(ie=Ri(ie,Ze-(z.startCol+Re),dt-(z.startRow+g),e.colCount,e.rowCount,et)),D&&g<oe.length&&Re<(((he=oe[g])==null?void 0:he.length)??0)){const Be=oe[g][Re]??null;ne(Ze,dt,ie,Be)}else e.setCellValue(Ze,dt,ie)}}}function fe(){var m;if(r.saveUndo(),be(),e.selection.value){const I=e.selection.value;e.clearCellsInRange(I.startCol,I.endCol,I.startRow,I.endRow),(m=e.scheduleRender)==null||m.call(e)}}function Ce(){var m;if(e.selection.value){const I=e.selection.value;e.clearCellsInRange(I.startCol,I.endCol,I.startRow,I.endRow),(m=e.scheduleRender)==null||m.call(e)}}function Ke(){var s,u;const m=e.selection.value;if(!m)return;r.saveUndo();const I=m.startCol,H=m.startRow,z=m.endCol,D=m.endRow;if(H===D)if(z+1<e.colCount){const L=`${et(I)}${H+1}:${et(z)}${H+1}`;e.setCellValue(z+1,H,`=SUM(${L})`)}else{const L=`${et(I)}${H+1}:${et(z-1)}${H+1}`;e.setCellValue(z,H,`=SUM(${L})`)}else for(let L=I;L<=z;L++)if(D+1<e.rowCount){const xe=`${et(L)}${H+1}:${et(L)}${D+1}`;e.setCellValue(L,D+1,`=SUM(${xe})`)}else{const xe=`${et(L)}${H+1}:${et(L)}${D}`;e.setCellValue(L,D,`=SUM(${xe})`)}(s=e.scheduleRender)==null||s.call(e),(u=e.emitModelData)==null||u.call(e)}function Se(){var s,u;const m=e.selection.value;if(!m)return;r.saveUndo();const I=m.startCol,H=m.startRow,z=m.endCol,D=m.endRow;if(H===D)if(z+1<e.colCount){const L=`${et(I)}${H+1}:${et(z)}${H+1}`;e.setCellValue(z+1,H,`=AVERAGE(${L})`)}else{const L=`${et(I)}${H+1}:${et(z-1)}${H+1}`;e.setCellValue(z,H,`=AVERAGE(${L})`)}else for(let L=I;L<=z;L++)if(D+1<e.rowCount){const xe=`${et(L)}${H+1}:${et(L)}${D+1}`;e.setCellValue(L,D+1,`=AVERAGE(${xe})`)}else{const xe=`${et(L)}${H+1}:${et(L)}${D}`;e.setCellValue(L,D,`=AVERAGE(${xe})`)}(s=e.scheduleRender)==null||s.call(e),(u=e.emitModelData)==null||u.call(e)}function pe(){var s,u;const m=e.selection.value;if(!m)return;r.saveUndo();const I=m.startCol,H=m.startRow,z=m.endCol,D=m.endRow;if(H===D)if(z+1<e.colCount){const L=`${et(I)}${H+1}:${et(z)}${H+1}`;e.setCellValue(z+1,H,`=COUNT(${L})`)}else{const L=`${et(I)}${H+1}:${et(z-1)}${H+1}`;e.setCellValue(z,H,`=COUNT(${L})`)}else for(let L=I;L<=z;L++)if(D+1<e.rowCount){const xe=`${et(L)}${H+1}:${et(L)}${D+1}`;e.setCellValue(L,D+1,`=COUNT(${xe})`)}else{const xe=`${et(L)}${H+1}:${et(L)}${D}`;e.setCellValue(L,D,`=COUNT(${xe})`)}(s=e.scheduleRender)==null||s.call(e),(u=e.emitModelData)==null||u.call(e)}const ye=t.ref(!1);function Oe(m){ye.value=m,m&&(r.textColorMenuOpen.value=!1,r.fillColorMenuOpen.value=!1,l.value=!1,r.fontSizeMenuOpen.value=!1,S.value=!1)}function He(){Ke(),ye.value=!1}function Q(){Se(),ye.value=!1}function ae(){pe(),ye.value=!1}return{cachedBorder:o,borderMenuOpen:l,BORDER_COLOR:a,onBorderChange:p,setCellBorderSide:i,applyBorderToCell:n,applyCachedBorder:c,cellBorderWidth:h,mergeMenuOpen:S,onMergeMenuToggle:x,removeOverlappingMerges:C,mergeAndCenter:w,mergeAcross:R,mergeCells:X,unmergeCells:Y,onApplyMerge:te,onMergeChange:W,copySourceRange:null,copySourceStyles:[],captureStyles:G,setCellWithStyle:ne,copyToClipboard:be,copyRowCol:Fe,pasteFromClipboard:Me,cutSelected:fe,clearSelected:Ce,sumSelected:Ke,avgSelected:Se,countSelected:pe,calcMenuOpen:ye,onCalcMenuToggle:Oe,onCalcSum:He,onCalcAvg:Q,onCalcCount:ae}}function ji(e,r,o,l){const a={},i=l(r),n=l(o);return i!=null&&(a.width=`${i}px`),n!=null&&(a.height=`${n}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 Sn(e){return e==="number"?0:1}function xn(e,r,o){var i;if(e==null||e.trim()==="")return{kind:"blank"};const l=r??"";if(l===xt||l==="@")return{kind:"text",text:e};if(Rt(l)){if(vl(e))return{kind:"number",num:Number(e)};const n=Wl(e,o);return n?{kind:"number",num:n.serial}:{kind:"text",text:ll(e,l,o)}}const a=Kt(l);if(a.kind==="date"||a.kind==="duration"){const n=Number(e);return Number.isFinite(n)?{kind:"number",num:n}:{kind:"text",text:ll(e,l,o)}}if(a.kind==="number"){const n=Number(e);if(Number.isFinite(n)){const p=((i=a.sections.find(c=>c.hasDigits))==null?void 0:i.scale)??1;return{kind:"number",num:n*p}}return{kind:"text",text:ll(e,l,o)}}return{kind:"text",text:ll(e,l,o)}}function Zi(e,r,o,l){if(e.kind==="blank"||r.kind==="blank")return e.kind==="blank"&&r.kind==="blank"?0:e.kind==="blank"?1:-1;const a=Sn(e.kind),i=Sn(r.kind);if(a!==i)return o==="asc"?a-i:i-a;let n;return e.kind==="number"?n=(e.num??0)-(r.num??0):n=(e.text??"").localeCompare(r.text??"",l,{numeric:!0}),o==="asc"?n:-n}function qi(e,r,o){const l=e.map((a,i)=>i);return l.sort((a,i)=>{const n=Zi(e[a],e[i],r,o);return n!==0?n:a-i}),l}function Ji(e){if(e.length<2||e[0].kind!=="text")return!1;for(let r=1;r<e.length;r++)if(e[r].kind==="number")return!0;return!1}function Qi(e,r,o,l,a){function i(B,N){const O=N-B+1,J=Ke(B,N),ee=[],re=[];for(const _ in e.cells){const we=_.indexOf(",");if(we<0)continue;const De=parseInt(_.substring(0,we),10),U=parseInt(_.substring(we+1),10);U>=B&&U<=N?re.push(_):U>N&&ee.push({oldKey:_,newKey:e.cellKey(De,U-O),cell:e.cells[_]})}for(const _ of re)Reflect.deleteProperty(e.cells,_);for(const _ of ee)Reflect.deleteProperty(e.cells,_.oldKey),e.cells[_.newKey]=_.cell;const se=e.rowHeights.value,le=new Array(se.length);for(let _=0;_<B;_++)le[_]=se[_];for(let _=B;_<se.length-O;_++)le[_]=se[_+O];for(let _=se.length-O;_<se.length;_++)le[_]=void 0;e.rowHeights.value=le,Ce(J)}function n(B,N){const O=N-B+1,J=e.rowCount,ee=e.colCount,{lastRow:re}=h();re>=B&&re+O>=J&&e.ensureCapacity(ee-1,J-1+O);const se=e.rowCount,le=pe(B,N),_=[];for(const U in e.cells){const Ne=U.indexOf(",");if(Ne<0)continue;const Xe=parseInt(U.substring(0,Ne),10),mt=parseInt(U.substring(Ne+1),10);mt>=B&&_.push({oldKey:U,newKey:e.cellKey(Xe,mt+O),cell:e.cells[U],oldRow:mt})}_.sort((U,Ne)=>Ne.oldRow-U.oldRow);for(const U of _)Reflect.deleteProperty(e.cells,U.oldKey),e.cells[U.newKey]=U.cell;for(const U in e.cells){const Ne=U.indexOf(",");if(Ne<0)continue;const Xe=parseInt(U.substring(Ne+1),10);Xe>=B&&Xe<=N&&Reflect.deleteProperty(e.cells,U)}const we=e.rowHeights.value,De=new Array(se);for(let U=0;U<B;U++)De[U]=we[U];for(let U=B;U<=N;U++)De[U]=void 0;for(let U=B;U<se;U++)De[U+O]=we[U];e.rowHeights.value=De,Ce(le)}function p(B,N){const O=N-B+1,J=e.colCount,ee=e.rowCount,{lastCol:re}=h();re>=B&&re+O>=J&&e.ensureCapacity(J-1+O,ee-1);const se=e.colCount,le=ye(B,N),_=[];for(const U in e.cells){const Ne=U.indexOf(",");if(Ne<0)continue;const Xe=parseInt(U.substring(0,Ne),10),mt=parseInt(U.substring(Ne+1),10);Xe>=B&&_.push({oldKey:U,newKey:e.cellKey(Xe+O,mt),cell:e.cells[U],oldCol:Xe})}_.sort((U,Ne)=>Ne.oldCol-U.oldCol);for(const U of _)Reflect.deleteProperty(e.cells,U.oldKey),e.cells[U.newKey]=U.cell;for(const U in e.cells){const Ne=U.indexOf(",");if(Ne<0)continue;const Xe=parseInt(U.substring(0,Ne),10);Xe>=B&&Xe<=N&&Reflect.deleteProperty(e.cells,U)}const we=e.colWidths.value,De=new Array(se);for(let U=0;U<B;U++)De[U]=we[U];for(let U=B;U<=N;U++)De[U]=100;for(let U=B;U<se;U++)De[U+O]=we[U];e.colWidths.value=De,Ce(le)}function c(B,N){const O=N-B+1,J=Se(B,N),ee=[],re=[];for(const _ in e.cells){const we=_.indexOf(",");if(we<0)continue;const De=parseInt(_.substring(0,we),10),U=parseInt(_.substring(we+1),10);De>=B&&De<=N?re.push(_):De>N&&ee.push({oldKey:_,newKey:e.cellKey(De-O,U),cell:e.cells[_]})}for(const _ of re)Reflect.deleteProperty(e.cells,_);for(const _ of ee)Reflect.deleteProperty(e.cells,_.oldKey),e.cells[_.newKey]=_.cell;const se=e.colWidths.value,le=new Array(se.length);for(let _=0;_<B;_++)le[_]=se[_];for(let _=B;_<se.length-O;_++)le[_]=se[_+O];for(let _=se.length-O;_<se.length;_++)le[_]=100;e.colWidths.value=le,Ce(J)}function h(){let B=-1,N=-1;for(const O in e.cells){const J=O.split(",");if(J.length===2){const ee=parseInt(J[0],10),re=parseInt(J[1],10),se=e.cells[O];se&&(se.value!==""||se.styleId!==void 0)&&(ee>B&&(B=ee),re>N&&(N=re))}}for(let O=e.colCount-1;O>=0;O--){const J=e.colWidths.value[O];if(J!==void 0&&J!==100){O>B&&(B=O);break}}for(let O=e.rowCount-1;O>=0;O--)if(e.rowHeights.value[O]!==void 0){O>N&&(N=O);break}return{lastCol:B,lastRow:N}}function S(B,N){const O=e.resolveStyle(e.cells[e.cellKey(B,N)]);return typeof(O==null?void 0:O.numberFormat)=="string"?O.numberFormat:""}function x(B,N,O){for(let J=N;J<=O;J++)if(e.getCellRaw(B,J).trim()!=="")return!0;return!1}function C(B){const{startRow:N,endRow:O,startCol:J,endCol:ee}=B;let re=J,se=ee;for(;re>0&&x(re-1,N,O);)re--;for(;se<e.colCount-1&&x(se+1,N,O);)se++;return{startRow:N,endRow:O,startCol:re,endCol:se}}function w(B){const N=C(B);return N.startCol!==B.startCol||N.endCol!==B.endCol}function R(B,N,O,J=B){let ee,re;if(O)ee=O.startRow,re=O.endRow;else{const U=e.selection.value,Ne=!!U&&U.startRow===U.endRow&&U.startCol===U.endCol;ee=Ne||!U?0:U.startRow,re=Ne||!U?e.rowCount-1:U.endRow}let se=-1,le=-1;for(let U=ee;U<=re;U++){let Ne=!1;for(let Xe=B;Xe<=N;Xe++)if(e.getCellRaw(Xe,U).trim()!==""){Ne=!0;break}Ne&&(se<0&&(se=U),le=U)}if(se<0)return null;const _=[];for(let U=se;U<=le;U++){const Ne=e.getCellRaw(J,U);_.push(xn(Ne,S(J,U),e.locale.value))}const we=Ji(_)?se+1:se;let De=!1;for(let U=se;U<=le&&!De;U++)for(let Ne=B;Ne<=N;Ne++){const Xe=e.cells[e.cellKey(Ne,U)];if(Xe&&Xe.value.startsWith("=")){De=!0;break}}if(!De)for(const U in e.merges){const Ne=e.merges[U];if(Ne&&Ne.startCol<=N&&Ne.endCol>=B&&Ne.startRow<=re&&Ne.endRow>=ee){De=!0;break}}return{firstRow:se,lastRow:le,sortStart:we,blocked:De}}function X(B,N){const O=R(B,N);return!!O&&!O.blocked&&O.sortStart<O.lastRow}function Y(B,N,O){var mt,v;const J=N??e.selection.value;if(!J)return;const ee=J.startCol,re=J.endCol,se=O??ee,le=R(ee,re,{startRow:J.startRow,endRow:J.endRow},se);if(!le||le.blocked||le.sortStart>=le.lastRow)return;const _=re-ee+1,we=le.lastRow-le.sortStart+1,De=[],U=[];for(let T=le.sortStart;T<=le.lastRow;T++){const q=new Array(_);for(let f=ee;f<=re;f++)q[f-ee]=e.cells[e.cellKey(f,T)]??null;De.push(q);const j=e.getCellRaw(se,T);U.push(xn(j,S(se,T),e.locale.value))}const Ne=qi(U,B,e.locale.value);let Xe=!1;for(let T=0;T<we;T++)if(Ne[T]!==T){Xe=!0;break}if(Xe){r.saveUndo();for(let T=0;T<we;T++){const q=De[Ne[T]],j=le.sortStart+T;for(let f=ee;f<=re;f++){const b=e.cellKey(f,j),k=q[f-ee],V=k?k.value:"",$=(mt=e.cells[b])==null?void 0:mt.styleId;V!==""||$!==void 0?e.cells[b]={value:V,styleId:$}:e.delCell(b)}}Bl();for(let T=le.sortStart;T<=le.lastRow;T++)for(let q=ee;q<=re;q++)e.formulaDeps.markDirty(e.cellKey(q,T));(v=e.scheduleRender)==null||v.call(e),Re()}}const te=t.ref(!1),W=t.ref(null);function y(B){const N=e.selection.value;if(!N||!w(N))return!1;const O=C(N);return W.value={order:B,originalRange:N,expandedRange:O},te.value=!0,!0}function oe(B){const N=W.value;if(!N)return;const{order:O,originalRange:J,expandedRange:ee}=N;te.value=!1,W.value=null,Y(O,B?ee:J,J.startCol),be.value=O}function G(){te.value=!1,W.value=null}const ne=t.ref(!1),be=t.ref("asc");function Fe(B){ne.value=B,B&&(r.textColorMenuOpen.value=!1,r.fillColorMenuOpen.value=!1,r.fontSizeMenuOpen.value=!1)}function Me(B){y(B)||(be.value=B,Y(B))}function fe(){y(be.value)||Y(be.value)}function Ce(B){Object.keys(e.merges).forEach(N=>Reflect.deleteProperty(e.merges,N));for(const N of B)if(!(N.newRange.startCol>N.newRange.endCol||N.newRange.startRow>N.newRange.endRow)&&(e.merges[N.newAnchorKey]={...N.newRange},N.anchorCell)){const O=N.anchorCell.value,J=N.anchorCell.styleId;O===""&&!J||(e.cells[N.newAnchorKey]={value:O,styleId:J||void 0})}}function Ke(B,N){const O=N-B+1,J=[];for(const ee in e.merges){const re=e.merges[ee];if(!re)continue;const se=e.cells[ee]?{value:e.cells[ee].value,styleId:e.cells[ee].styleId??0}:{value:"",styleId:0},{startCol:le,endCol:_}=re;let{startRow:we,endRow:De}=re;if(we>N){we-=O,De-=O,J.push({newAnchorKey:e.cellKey(le,we),newRange:{startCol:le,startRow:we,endCol:_,endRow:De}});continue}if(De<B){J.push({newAnchorKey:ee,newRange:{startCol:le,startRow:we,endCol:_,endRow:De}});continue}if(we>=B&&De<=N||(we>=B&&we<=N&&(we=B),De>=B&&De<=N?De=B-1:De>N&&(De-=O),we>De))continue;const U=le,Ne=we,Xe=e.cellKey(U,Ne),v=ee.split(",").map(Number)[1],T=v>=B&&v<=N||U!==re.startCol||Ne!==v;J.push({newAnchorKey:Xe,newRange:{startCol:le,startRow:we,endCol:_,endRow:De},anchorCell:T?se:void 0})}return J}function Se(B,N){const O=N-B+1,J=[];for(const ee in e.merges){const re=e.merges[ee];if(!re)continue;const se=e.cells[ee]?{value:e.cells[ee].value,styleId:e.cells[ee].styleId??0}:{value:"",styleId:0};let{startCol:le,endCol:_}=re;const{startRow:we,endRow:De}=re;if(le>N){le-=O,_-=O,J.push({newAnchorKey:e.cellKey(le,we),newRange:{startCol:le,startRow:we,endCol:_,endRow:De}});continue}if(_<B){J.push({newAnchorKey:ee,newRange:{startCol:le,startRow:we,endCol:_,endRow:De}});continue}if(le>=B&&_<=N||(le>=B&&le<=N&&(le=B),_>=B&&_<=N?_=B-1:_>N&&(_-=O),le>_))continue;const U=le,Ne=we,Xe=e.cellKey(U,Ne),v=ee.split(",").map(Number)[0],T=v>=B&&v<=N||U!==v||Ne!==re.startRow;J.push({newAnchorKey:Xe,newRange:{startCol:le,startRow:we,endCol:_,endRow:De},anchorCell:T?se:void 0})}return J}function pe(B,N){const O=N-B+1,J=[];for(const ee in e.merges){const re=e.merges[ee];if(!re)continue;const{startCol:se,endCol:le}=re;let{startRow:_,endRow:we}=re;we<B?J.push({newAnchorKey:ee,newRange:{startCol:se,startRow:_,endCol:le,endRow:we}}):_>N?(_+=O,we+=O,J.push({newAnchorKey:e.cellKey(se,_),newRange:{startCol:se,startRow:_,endCol:le,endRow:we}})):(we+=O,J.push({newAnchorKey:ee,newRange:{startCol:se,startRow:_,endCol:le,endRow:we}}))}return J}function ye(B,N){const O=N-B+1,J=[];for(const ee in e.merges){const re=e.merges[ee];if(!re)continue;let{startCol:se,endCol:le}=re;const{startRow:_,endRow:we}=re;le<B?J.push({newAnchorKey:ee,newRange:{startCol:se,startRow:_,endCol:le,endRow:we}}):se>N?(se+=O,le+=O,J.push({newAnchorKey:e.cellKey(se,_),newRange:{startCol:se,startRow:_,endCol:le,endRow:we}})):(le+=O,J.push({newAnchorKey:ee,newRange:{startCol:se,startRow:_,endCol:le,endRow:we}}))}return J}let Oe=0;function He(){return Oe++,`s_${Oe}`}function Q(B,N){const O=Math.max(1,(N==null?void 0:N.colCount)??e.colCount),J=Math.max(1,(N==null?void 0:N.rowCount)??e.rowCount),ee=new Array(O).fill(100),re=new Array(J).fill(void 0);return{id:He(),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:ee,rowHeights:re,colCount:O,rowCount:J}}const ae=t.ref([Q("Sheet1")]),m=t.ref(0);function I(){const B=ae.value[m.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)}function H(B){var ee;const N=ae.value[B];if(!N)return;Object.keys(e.cells).forEach(re=>e.delCell(re)),Object.assign(e.cells,N.cells),Object.keys(e.merges).forEach(re=>Reflect.deleteProperty(e.merges,re)),N.merges&&Object.assign(e.merges,N.merges),e.selection.value=N.selection?{...N.selection}:null,e.activeCell.value={...N.activeCell},e.scrollX.value=N.scrollX,e.scrollY.value=N.scrollY,e.colWidths.value=[...N.colWidths],e.rowHeights.value=[...N.rowHeights];const O=Math.max(1,N.colCount??e.colCount),J=Math.max(1,N.rowCount??e.rowCount);(ee=e.setDims)==null||ee.call(e,O,J),e.syncStyles(N.styles),e.syncBorders(N.borders??[{}]),m.value=B}function z(B){B===m.value||B<0||B>=ae.value.length||(e.cancelEdit(),I(),H(B))}function D(B){return r.saveUndo(),e.cancelEdit(),I(),ae.value.push(Q(B??`Sheet${ae.value.length+1}`)),H(ae.value.length-1),ae.value.length-1}function s(B){return ae.value.length<=1||(r.saveUndo(),e.cancelEdit(),ae.value.splice(B,1),H(Math.min(B,ae.value.length-1))),m.value}function u(B,N){ae.value[B]&&N.trim()&&(r.saveUndo(),ae.value[B].name=N.trim())}function L(B){r.saveUndo(),e.cancelEdit(),I();const N=ae.value[B];if(!N)return B;let O=N.name;const J=O.match(/^(.*?)\s*\((\d+)\)$/);let ee=J?parseInt(J[2],10)+1:2;J&&(O=J[1]);let re=`${O} (${ee})`;const se=new Set(ae.value.map(_=>_.name));for(;se.has(re);)ee++,re=`${O} (${ee})`;const le={id:He(),name:re,cells:{...N.cells},merges:N.merges?{...N.merges}:{},styles:[...N.styles],borders:N.borders?[...N.borders]:[{}],selection:N.selection?{...N.selection}:null,activeCell:N.activeCell?{...N.activeCell}:{col:0,row:0},scrollX:N.scrollX,scrollY:N.scrollY,colWidths:[...N.colWidths],rowHeights:[...N.rowHeights],colCount:N.colCount,rowCount:N.rowCount};return ae.value.splice(B+1,0,le),H(B+1),B+1}function xe(B,N){var re;const O=B+N;if(O<0||O>=ae.value.length)return;r.saveUndo();const J=m.value,ee=ae.value.splice(B,1)[0];ae.value.splice(O,0,ee),J===B?m.value=O:B<J&&O>=J?m.value=J-1:B>J&&O<=J&&(m.value=J+1),(re=e.scheduleRender)==null||re.call(e)}const he=t.computed(()=>ae.value.length);let g="";const A=o;function Re(){I();const B=ae.value.map(O=>{const J={};for(const[le,_]of Object.entries(O.cells))J[le]={value:_.value},_.styleId&&_.styleId>0&&(J[le].styleId=_.styleId);const ee={name:O.name,cells:J};O.styles&&O.styles.length>1&&(ee.styles=[...O.styles]),O.borders&&O.borders.length>1&&(ee.borders=[...O.borders]),O.merges&&Object.keys(O.merges).length&&(ee.merges={...O.merges});const re={};for(let le=0;le<O.colWidths.length;le++)O.colWidths[le]!==100&&(re[le]=O.colWidths[le]);Object.keys(re).length&&(ee.colWidths=re);const se={};for(let le=0;le<O.rowHeights.length;le++){const _=O.rowHeights[le];_!=null&&(se[le]=_)}return Object.keys(se).length&&(ee.rowHeights=se),O.colCount!==26&&(ee.colCount=O.colCount),O.rowCount!==200&&(ee.rowCount=O.rowCount),ee}),N=JSON.stringify(B);N!==g&&(g=N,A.value=B,a&&(a.value=N))}e.emitModelData=Re;let Ze=!1;function dt(){Ze||(Ze=!0,Promise.resolve().then(()=>{Ze=!1,Re()}))}const ie=t.computed(()=>e.props.theme==="dark"?Yn:Gn),Be=t.computed(()=>ji(ie.value,e.props.width,e.props.height,nl)),Le=t.computed(()=>{const B={};for(const[N,O]of Object.entries(Be.value))N.startsWith("--")&&(B[N]=O);return B}),at=t.ref(null),lt=t.ref(null),ct=t.ref(null),ft=t.ref(null),st=t.reactive({w:800,h:600});e.viewSize&&t.watch(st,B=>{e.viewSize&&(e.viewSize.w=B.w,e.viewSize.h=B.h)},{deep:!0});const ut=48,Tt=28,Mt=11,bt=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,st.w-ut-Mt))),It=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,st.h-Tt-Mt)));function Ct(B,N){const O=Math.max(0,st.w-ut-Mt),J=Math.max(0,st.h-Tt-Mt),ee=B??e.scrollX.value,re=N??e.scrollY.value,se=40,le=Math.max(0,e.totalWidth.value-O),_=Math.max(0,e.totalHeight.value-J);if(ee>=le-se&&ee>e.scrollX.value||re>=_-se&&re>e.scrollY.value){const we=Math.max(0,Math.ceil((ee+O)/100)+2),De=Math.max(0,Math.ceil((re+J)/24)+2);e.ensureCapacity(we,De)}e.scrollX.value=Math.max(0,Math.min(ee,Math.max(0,e.totalWidth.value-O))),e.scrollY.value=Math.max(0,Math.min(re,Math.max(0,e.totalHeight.value-J)))}e.clampScroll=Ct;function Bt(){var B;return typeof window>"u"?!1:!((B=window.matchMedia)!=null&&B.call(window,"(hover: none) and (pointer: coarse)").matches)}function At(B=!1){t.nextTick(()=>{const N=ct.value;if(N){if(!e.editingCell.value&&!Bt()){document.activeElement===N&&N.blur();return}N.focus({preventScroll:!0}),B&&N.select()}})}function jt(){At()}function al(){var N;const B=e.selection.value;if(B){r.saveUndo();for(let O=B.startRow;O<=B.endRow;O++)e.rowHeights.value[O]=void 0;(N=e.scheduleRender)==null||N.call(e),Re()}}function St(){var N;const B=e.selection.value;if(B){r.saveUndo();for(let O=B.startCol;O<=B.endCol;O++)e.colWidths.value[O]=100;(N=e.scheduleRender)==null||N.call(e),Re()}}return{deleteRows:i,insertRows:n,insertCols:p,deleteCols:c,sortSelectedColumns:Y,canSortColumns:X,sortMenuOpen:ne,cachedSortOrder:be,onSortMenuToggle:Fe,onSortChange:Me,applyCachedSort:fe,sortConfirmOpen:te,prepareSortConfirmation:y,confirmSort:oe,cancelSortConfirmation:G,sheets:ae,activeSheetIndex:m,saveSheet:I,loadSheet:H,switchSheet:z,addSheet:D,removeSheet:s,renameSheet:u,dupSheet:L,moveSheet:xe,sheetCount:he,mkSheet:Q,emitModelData:Re,scheduleOptEmit:dt,themeColors:ie,outerStyle:Be,toolbarThemeVars:Le,wrapperRef:at,canvasRef:lt,editInputRef:ct,formulaBarRef:ft,viewSize:st,maxScrollX:bt,maxScrollY:It,clampScroll:Ct,canFocusHiddenEditor:Bt,focusEditInput:At,onCanvasFocus:jt,resetRowHeight:al,resetColWidth:St,modelData:A}}function Rn(e){return!!e&&e.width!==void 0&&e.width>0}function gt(e,r,o,l){const a=Rn(e),i=Rn(r);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return r;const n=e.width??0,p=r.width??0;return n>p?e:p>n?r:e}function ec(e,r,o,l,a){let i=!1,n=null,p=1;function c(){i||(i=!0,requestAnimationFrame(()=>{i=!1,S()}))}e.scheduleRender=c;const h="#444";function S(){const d=l.canvasRef.value;if(!d)return;const E=l.wrapperRef.value;if(!E||(n=d.getContext("2d"),!n))return;p=window.devicePixelRatio||1;const K=E.getBoundingClientRect(),P=K.width,M=K.height;l.viewSize.w=P,l.viewSize.h=M,d.width=P*p,d.height=M*p,d.style.width=P+"px",d.style.height=M+"px",n.setTransform(p,0,0,p,0,0);const Z=e.scrollX.value,Ee=e.scrollY.value,Te=52,ge=24,Ae=l.themeColors.value,nt=e.colPositions.value,it=e.rowPositions.value,Vt=e.colWidths.value,$t=Math.max(0,e.hitCol(Z));let bl=$t;for(let de=$t;de<e.colCount&&!(Te+nt[de]-Z>=P);de++)bl=de;const Jt=bl,Gt=Math.max(0,e.hitRow(Ee));let cl=Gt;for(let de=Gt;de<e.rowCount&&!(ge+it[de]-Ee>=M);de++)cl=de;const sl=cl;let _t=$t,Qt=Gt;for(const de in e.merges){const ve=e.merges[de];ve&&(ve.startRow>sl||ve.endRow<Gt||ve.startCol>Jt||ve.endCol<$t||(ve.startCol<_t&&(_t=ve.startCol),ve.startRow<Qt&&(Qt=ve.startRow)))}const dl=new Array(Qt);for(let de=Qt;de<=sl;de++)dl[de]=it[de+1]-it[de];n.fillStyle=Ae.bg,n.fillRect(0,0,P,M),n.fillStyle=Ae.gridBg,n.fillRect(Te,ge,P-Te,M-ge),n.save(),n.beginPath(),n.rect(Te,ge,P-Te,M-ge),n.clip();const vt=e.selection.value,xl=e.editingCell.value;for(let de=Qt;de<=sl;de++)for(let ve=_t;ve<=Jt;ve++){const We=e.findMerge(ve,de);if(We&&!(ve===We.range.startCol&&de===We.range.startRow))continue;const Ue=Te+nt[ve]-Z,qe=ge+it[de]-Ee;let ot=Vt[ve],rt=dl[de];if(We&&(ot=nt[We.range.endCol+1]-nt[ve],rt=it[We.range.endRow+1]-it[de]),Ue+ot<Te||qe+rt<ge||Ue>P||qe>M)continue;const el=e.findHighlight?e.findHighlight(ve,de):null,Je=e.resolveStyle(e.cells[e.cellKey(ve,de)]),tt=typeof(Je==null?void 0:Je.backgroundColor)=="string"?Je.backgroundColor:"";if(tt&&(n.fillStyle=tt,n.fillRect(Ue,qe,ot,rt)),el&&(n.fillStyle=el==="active"?Ae.findActiveBg:Ae.findMatchBg,n.fillRect(Ue,qe,ot,rt)),e.isSelected(ve,de)&&(n.fillStyle=Ae.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?n.fillRect(Ue,qe,Vt[ve],dl[de]):n.fillRect(Ue,qe,ot,rt)),e.activeCell.value.col===ve&&e.activeCell.value.row===de&&(n.strokeStyle=Ae.activeCellBorder,n.lineWidth=2,n.strokeRect(Ue+1,qe+1,ot-2,rt-2)),el==="active"&&(n.strokeStyle=Ae.findActiveBg,n.lineWidth=2,n.strokeRect(Ue+1,qe+1,ot-2,rt-2)),n.strokeStyle=Ae.gridLine,n.lineWidth=.5,n.strokeRect(Ue+.25,qe+.25,ot-.5,rt-.5),!(xl&&xl.col===ve&&xl.row===de)){const me=e.resolveStyle(e.cells[e.cellKey(ve,de)]),Ge=e.getCellValue(ve,de),Ye=typeof(me==null?void 0:me.numberFormat)=="string"?me.numberFormat:"",ce=Ge?ll(Ge,Ye,e.locale.value):"";if(ce){const Ve=e.cellFontSize(ve,de),Ie=typeof(me==null?void 0:me.fontFamily)=="string"&&me.fontFamily?me.fontFamily:fl,je=(me==null?void 0:me.fontWeight)==="bold"?"bold":"normal",wt=(me==null?void 0:me.fontStyle)==="italic"?"italic":"normal",xc=(me==null?void 0:me.underline)==="underline",Rc=(me==null?void 0:me.strikethrough)==="line-through",ql=typeof(me==null?void 0:me.color)=="string"?me.color:"",Nn=typeof(me==null?void 0:me.textAlign)=="string"?me.textAlign:an(Ge,Ye)?"right":"left",Tn=typeof(me==null?void 0:me.verticalAlign)=="string"?me.verticalAlign:"top";n.fillStyle=ql||Ae.cellText,n.font=`${wt} ${je} ${Ve}px ${Ie}`,n.textBaseline="alphabetic",n.save(),n.beginPath(),n.rect(Ue+5,qe+1,ot-10,rt-2),n.clip();const In=(me==null?void 0:me.wrap)==="wrap",Dl=ot-10;let Jl=ce;const Mc=!In&&so(Ye),An=ce===Fl||uo(Ge,Ye);if(An||Mc){if(An){const ul=Math.max(1,n.measureText("#").width),Rl=Math.max(1,Math.floor(Dl/ul));Jl="#".repeat(Rl)}else if(e.getWrappedLines(n,ce,1e9,!1).some(Yt=>Yt&&n.measureText(Yt).width>Dl)){const Yt=Math.max(1,n.measureText("#").width),Cl=Math.max(1,Math.floor(Dl/Yt));Jl="#".repeat(Cl)}}const Nl=e.getWrappedLines(n,Jl,Dl,In),{ascent:Tl,descent:Il}=e.measureFontMetrics(Ie,Ve,je,wt),Al=Tl+Il,Bc=Nl.length*Al;let Vl;Tn==="middle"?Vl=qe+(rt-Bc)/2+Tl:Tn==="bottom"?Vl=qe+rt-e.BASE_CELL_VPAD-Il-(Nl.length-1)*Al:Vl=qe+e.BASE_CELL_VPAD+Tl;for(let ul=0;ul<Nl.length;ul++){const Rl=Nl[ul],Yt=Vl+ul*Al,Cl=n.measureText(Rl);let tl;if(Nn==="center"?tl=Ue+ot/2-Cl.width/2:Nn==="right"?tl=Ue+ot-5-Cl.width:tl=Ue+5,n.fillText(Rl,tl,Yt),xc&&(n.strokeStyle=ql||Ae.cellText,n.lineWidth=1,n.beginPath(),n.moveTo(tl,Yt+Il+1),n.lineTo(tl+Cl.width,Yt+Il+1),n.stroke()),Rc){n.strokeStyle=ql||Ae.cellText,n.lineWidth=1;const Vn=Yt-Tl+Al*.42;n.beginPath(),n.moveTo(tl,Vn),n.lineTo(tl+Cl.width,Vn),n.stroke()}}n.restore()}}}const pt=(de,ve,We)=>{const Ue=e.findMerge(de,ve);return Ue?e.getCellBorderSide(e.cells[Ue.anchor],We):e.getCellBorderSide(e.cells[e.cellKey(de,ve)],We)};n.fillStyle=h;for(let de=Qt;de<=sl;de++)for(let ve=_t;ve<=Jt;ve++){const We=e.findMerge(ve,de);if(We&&!(ve===We.range.startCol&&de===We.range.startRow))continue;const Ue=Te+nt[ve]-Z,qe=ge+it[de]-Ee;let ot=Vt[ve],rt=dl[de];if(We&&(ot=nt[We.range.endCol+1]-nt[ve],rt=it[We.range.endRow+1]-it[de]),Ue+ot<Te||qe+rt<ge||Ue>P||qe>M)continue;const el=e.cells[e.cellKey(ve,de)],Je={top:e.getCellBorderSide(el,"top"),right:e.getCellBorderSide(el,"right"),bottom:e.getCellBorderSide(el,"bottom"),left:e.getCellBorderSide(el,"left")};if(We){const tt=We.range.startRow,me=We.range.endRow,Ge=We.range.startCol,Ye=We.range.endCol;for(let ce=Ge;ce<=Ye;ce++){if(e.isSameMergeInternal(ce,tt-1,ce,tt))continue;const Ve=pt(ce,tt-1,"bottom"),Ie=gt(Ve,Je.top);if(Ie&&Ie.width&&Ie.width>0){const je=Te+nt[ce]-Z;n.fillStyle=Ie.color||h,n.fillRect(je,qe,Vt[ce],Ie.width)}}for(let ce=Ge;ce<=Ye;ce++){if(e.isSameMergeInternal(ce,me,ce,me+1))continue;const Ve=pt(ce,me+1,"top"),Ie=gt(Je.bottom,Ve);if(Ie&&Ie.width&&Ie.width>0){const je=Te+nt[ce]-Z;n.fillStyle=Ie.color||h,n.fillRect(je,qe+rt-Ie.width,Vt[ce],Ie.width)}}for(let ce=tt;ce<=me;ce++){if(e.isSameMergeInternal(Ge-1,ce,Ge,ce))continue;const Ve=pt(Ge-1,ce,"right"),Ie=gt(Ve,Je.left);if(Ie&&Ie.width&&Ie.width>0){const je=ge+it[ce]-Ee,wt=it[ce+1]-it[ce];n.fillStyle=Ie.color||h,n.fillRect(Ue,je,Ie.width,wt)}}for(let ce=tt;ce<=me;ce++){if(e.isSameMergeInternal(Ye,ce,Ye+1,ce))continue;const Ve=pt(Ye+1,ce,"left"),Ie=gt(Je.right,Ve);if(Ie&&Ie.width&&Ie.width>0){const je=ge+it[ce]-Ee,wt=it[ce+1]-it[ce];n.fillStyle=Ie.color||h,n.fillRect(Ue+ot-Ie.width,je,Ie.width,wt)}}{const ce=e.isSameMergeInternal(Ge,tt-1,Ge,tt)?Je.top:gt(pt(Ge,tt-1,"bottom"),Je.top),Ve=e.isSameMergeInternal(Ge-1,tt,Ge,tt)?Je.left:gt(pt(Ge-1,tt,"right"),Je.left),Ie=(ce==null?void 0:ce.width)??0,je=(Ve==null?void 0:Ve.width)??0;Ie>0&&je>0&&(n.fillStyle=(ce==null?void 0:ce.color)||(Ve==null?void 0:Ve.color)||h,n.fillRect(Ue-je,qe-Ie,je,Ie))}{const ce=e.isSameMergeInternal(Ye,tt-1,Ye,tt)?Je.top:gt(pt(Ye,tt-1,"bottom"),Je.top),Ve=e.isSameMergeInternal(Ye,tt,Ye+1,tt)?Je.right:gt(Je.right,pt(Ye+1,tt,"left")),Ie=(ce==null?void 0:ce.width)??0,je=(Ve==null?void 0:Ve.width)??0;Ie>0&&je>0&&(n.fillStyle=(ce==null?void 0:ce.color)||(Ve==null?void 0:Ve.color)||h,n.fillRect(Ue+ot,qe-Ie,je,Ie))}{const ce=e.isSameMergeInternal(Ge,me,Ge,me+1)?Je.bottom:gt(Je.bottom,pt(Ge,me+1,"top")),Ve=e.isSameMergeInternal(Ge-1,me,Ge,me)?Je.left:gt(pt(Ge-1,me,"right"),Je.left),Ie=(ce==null?void 0:ce.width)??0,je=(Ve==null?void 0:Ve.width)??0;Ie>0&&je>0&&(n.fillStyle=(ce==null?void 0:ce.color)||(Ve==null?void 0:Ve.color)||h,n.fillRect(Ue-je,qe+rt,je,Ie))}{const ce=e.isSameMergeInternal(Ye,me,Ye,me+1)?Je.bottom:gt(Je.bottom,pt(Ye,me+1,"top")),Ve=e.isSameMergeInternal(Ye,me,Ye+1,me)?Je.right:gt(Je.right,pt(Ye+1,me,"left")),Ie=(ce==null?void 0:ce.width)??0,je=(Ve==null?void 0:Ve.width)??0;Ie>0&&je>0&&(n.fillStyle=(ce==null?void 0:ce.color)||(Ve==null?void 0:Ve.color)||h,n.fillRect(Ue+ot,qe+rt,je,Ie))}}else{const tt={top:pt(ve,de-1,"bottom"),left:pt(ve-1,de,"right"),bottom:pt(ve,de+1,"top"),right:pt(ve+1,de,"left")},me=gt(tt.top,Je.top),Ge=gt(tt.left,Je.left),Ye=gt(Je.bottom,tt.bottom),ce=gt(Je.right,tt.right),Ve=(me==null?void 0:me.width)??0,Ie=(Ge==null?void 0:Ge.width)??0,je=(Ye==null?void 0:Ye.width)??0,wt=(ce==null?void 0:ce.width)??0;Ve>0&&(n.fillStyle=(me==null?void 0:me.color)||h,n.fillRect(Ue,qe,ot,Ve)),je>0&&(n.fillStyle=(Ye==null?void 0:Ye.color)||h,n.fillRect(Ue,qe+rt-je,ot,je)),Ie>0&&(n.fillStyle=(Ge==null?void 0:Ge.color)||h,n.fillRect(Ue,qe,Ie,rt)),wt>0&&(n.fillStyle=(ce==null?void 0:ce.color)||h,n.fillRect(Ue+ot-wt,qe,wt,rt)),Ve>0&&Ie>0&&(n.fillStyle=(me==null?void 0:me.color)||(Ge==null?void 0:Ge.color)||h,n.fillRect(Ue-Ie,qe-Ve,Ie,Ve)),Ve>0&&wt>0&&(n.fillStyle=(me==null?void 0:me.color)||(ce==null?void 0:ce.color)||h,n.fillRect(Ue+ot,qe-Ve,wt,Ve)),je>0&&Ie>0&&(n.fillStyle=(Ye==null?void 0:Ye.color)||(Ge==null?void 0:Ge.color)||h,n.fillRect(Ue-Ie,qe+rt,Ie,je)),je>0&&wt>0&&(n.fillStyle=(Ye==null?void 0:Ye.color)||(ce==null?void 0:ce.color)||h,n.fillRect(Ue+ot,qe+rt,wt,je))}}n.restore(),n.fillStyle=Ae.headerBg,n.fillRect(Te,0,P-Te,ge);for(let de=$t;de<=Jt;de++){const ve=Te+nt[de]-Z,We=Vt[de];ve+We<Te||ve>P||(vt&&de>=vt.startCol&&de<=vt.endCol&&(n.fillStyle=Ae.selectionBg,n.fillRect(ve,0,We,ge)),n.strokeStyle=Ae.headerBorder,n.lineWidth=.5,n.strokeRect(ve+.25,.25,We-.5,ge-.5),vt&&de>=vt.startCol&&de<=vt.endCol&&(n.strokeStyle=Ae.activeCellBorder,n.lineWidth=2,n.beginPath(),n.moveTo(ve,ge-1),n.lineTo(ve+We,ge-1),n.stroke()),n.fillStyle=Ae.headerText,n.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',n.textAlign="center",n.textBaseline="middle",n.fillText(et(de),ve+We/2,ge/2))}n.strokeStyle=Ae.headerSep,n.lineWidth=1,n.beginPath(),n.moveTo(Te,ge+.5),n.lineTo(P,ge+.5),n.stroke(),n.fillStyle=Ae.headerBg,n.fillRect(0,ge,Te,M-ge);for(let de=Gt;de<=sl;de++){const ve=ge+it[de]-Ee,We=dl[de];ve+We<ge||ve>M||(vt&&de>=vt.startRow&&de<=vt.endRow&&(n.fillStyle=Ae.selectionBg,n.fillRect(0,ve,Te,We)),n.strokeStyle=Ae.headerBorder,n.lineWidth=.5,n.strokeRect(.25,ve+.25,Te-.5,We-.5),vt&&de>=vt.startRow&&de<=vt.endRow&&(n.strokeStyle=Ae.activeCellBorder,n.lineWidth=2,n.beginPath(),n.moveTo(Te-1,ve),n.lineTo(Te-1,ve+We),n.stroke()),n.fillStyle=Ae.headerText,n.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',n.textAlign="center",n.textBaseline="middle",n.fillText(String(de+1),Te/2,ve+We/2+.5))}n.strokeStyle=Ae.headerSep,n.lineWidth=1,n.beginPath(),n.moveTo(Te+.5,ge),n.lineTo(Te+.5,M),n.stroke(),n.fillStyle=Ae.headerBg,n.fillRect(0,0,Te,ge),n.strokeStyle=Ae.headerSep,n.lineWidth=1,n.strokeRect(.5,.5,Te-.5,ge-.5)}const x=t.computed(()=>et(e.activeCell.value.col)+String(e.activeCell.value.row+1)),C=t.ref(""),w=t.ref(!1),R=t.computed(()=>e.editingCell.value?C.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(d,E)=>{if(d&&!E){const K=e.editValue.value||e.getCellRaw(d.col,d.row)||"";C.value=K,y=!1}else!d&&E&&(C.value="",w.value=!1,y=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(C.value="",y=!1)});function X(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),c())}function Y(d){const E=d.target.value;e.editingCell.value?e.editValue.value=E:e.startEdit(E),C.value=E,y=!0}function te(d){var K,P;const E={...e.activeCell.value};e.editingCell.value?(e.editValue.value=d,e.commitEdit()):((K=e.saveUndo)==null||K.call(e),e.setCellValue(E.col,E.row,d)),C.value="",y=!1,c(),(P=l.emitModelData)==null||P.call(l)}let W=!1,y=!1;function oe(){var Z,Ee,Te,ge,Ae,nt,it,Vt,$t;if(W)return;const d=l.formulaBarRef.value,E=!!(d&&typeof document<"u"&&document.activeElement===d);if(!e.editingCell.value&&!E&&!y)return;const K={...e.activeCell.value},P=e.editingCell.value?e.editingCell.value.col:K.col,M=e.editingCell.value?e.editingCell.value.row:K.row;if(!e.editingCell.value){const bl=e.getCellRaw(P,M),Jt=C.value!==bl;if(!y)return;W=!0,Jt&&((Z=e.saveUndo)==null||Z.call(e),e.setCellValue(P,M,C.value),c(),(Ee=l.emitModelData)==null||Ee.call(l)),(Te=l.formulaBarRef.value)==null||Te.blur(),C.value="",w.value=!1,y=!1,t.nextTick(()=>{W=!1});return}W=!0,y?(e.editValue.value=C.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(ge=l.formulaBarRef.value)==null||ge.blur(),C.value="",w.value=!1,y=!1,c(),l.focusEditInput(),(Ae=l.emitModelData)==null||Ae.call(l),t.nextTick(()=>{W=!1})):E?(C.value=e.editValue.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(nt=l.formulaBarRef.value)==null||nt.blur(),C.value="",w.value=!1,y=!1,c(),l.focusEditInput(),(it=l.emitModelData)==null||it.call(l),t.nextTick(()=>{W=!1})):(e.commitEdit(),(Vt=l.formulaBarRef.value)==null||Vt.blur(),C.value="",w.value=!1,y=!1,c(),l.focusEditInput(),($t=l.emitModelData)==null||$t.call(l),t.nextTick(()=>{W=!1}))}function G(){var d;W||(W=!0,e.editingCell.value&&e.cancelEdit(),(d=l.formulaBarRef.value)==null||d.blur(),C.value="",w.value=!1,y=!1,c(),l.focusEditInput(),t.nextTick(()=>{W=!1}))}function ne(d){if(!d.isComposing){if(d.key==="Enter"&&(d.altKey||d.metaKey)&&!d.ctrlKey){d.preventDefault(),d.stopPropagation();const E=d.target;if(!E)return;e.editingCell.value||e.startEdit();const K=E.selectionStart??E.value.length,P=E.selectionEnd??E.value.length,M=E.value,Z=M.substring(0,K)+`
7
+ `+M.substring(P),Ee=K+1;C.value=Z,w.value||(w.value=!0),t.nextTick(()=>{try{E.setSelectionRange(Ee,Ee)}catch{}if(w.value)try{E.scrollTop=E.scrollHeight}catch{}try{E.focus({preventScroll:!0})}catch{}});return}d.key==="Enter"?(d.preventDefault(),oe()):d.key==="Escape"&&(d.preventDefault(),G())}}function be(){oe()}const Fe=t.ref(null),Me=t.ref("");function fe(d){Fe.value===null&&(l.switchSheet(d),c())}function Ce(d){d!==l.activeSheetIndex.value&&(l.saveSheet(),l.loadSheet(d),c()),Fe.value=d,Me.value=l.sheets.value[d].name,t.nextTick(()=>{const E=document.querySelector(".tab-rename-input");E==null||E.focus(),E==null||E.select()})}function Ke(){Fe.value!==null&&(l.renameSheet(Fe.value,Me.value),t.nextTick(()=>l.emitModelData())),Fe.value=null,Me.value=""}function Se(){Fe.value=null,Me.value=""}function pe(d){d.key==="Enter"?(d.preventDefault(),Ke()):d.key==="Escape"&&(d.preventDefault(),Se())}const ye=t.ref(null);let Oe=null;function He(){Oe&&(document.removeEventListener("click",Oe),Oe=null)}function Q(d,E,K){He();const P=140,M=K.length*28+8,Z=window.innerWidth,Ee=window.innerHeight;d+P>Z&&(d-=P),E+M>Ee&&(E-=M),ye.value={x:d,y:E,items:K},Oe=()=>{ye.value=null,He()},setTimeout(()=>document.addEventListener("click",Oe,{once:!0}),0)}const ae=t.ref(!1);function m(d,E){if(E.disabled){ae.value=!1;return}if(!E.children){ae.value=!1;return}const P=d.currentTarget.querySelector(".context-submenu");if(!P){ae.value=!1;return}const M=P.getBoundingClientRect();ae.value=M.right>window.innerWidth}function I(d,E){d.preventDefault(),d.stopPropagation(),Q(d.clientX,d.clientY,[{label:F(e.locale.value,"insert"),action:()=>{l.addSheet(),c()}},{label:F(e.locale.value,"copy"),action:()=>{l.dupSheet(E)}},{label:F(e.locale.value,"rename"),action:()=>{Ce(E)}},{label:F(e.locale.value,"delete"),action:()=>{l.removeSheet(E),c()},disabled:l.sheetCount.value<=1},{label:F(e.locale.value,"moveSheetLeft"),action:()=>{l.moveSheet(E,-1)},disabled:E===0},{label:F(e.locale.value,"moveSheetRight"),action:()=>{l.moveSheet(E,1)},disabled:E===l.sheets.value.length-1}])}function H(d){d.preventDefault(),!(d.target.closest(".tab-item")||d.target.closest(".tab-bar__add-btn"))&&Q(d.clientX,d.clientY,[{label:F(e.locale.value,"insert"),action:()=>{l.addSheet(),c()}}])}function z(d){d.preventDefault(),e.selectAll(),c(),Q(d.clientX,d.clientY,[{label:F(e.locale.value,"cut"),action:()=>{o.cutSelected(),l.emitModelData()}},{label:F(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:F(e.locale.value,"paste"),action:()=>{r.saveUndo(),o.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())})}},{label:F(e.locale.value,"delete"),action:()=>{r.saveUndo(),o.clearSelected();for(let E=0;E<e.colCount;E++)e.colWidths.value[E]=100;for(let E=0;E<e.rowCount;E++)e.rowHeights.value[E]=void 0;c(),l.emitModelData()}}])}function D(d,E){d.preventDefault();const K=d.clientX,P=d.clientY,M=e.selection.value;M&&M.startCol===0&&M.endCol===e.colCount-1&&E>=M.startRow&&E<=M.endRow||(e.selectRange(0,E,e.colCount-1,E,"row"),c());const Z=e.selection.value;Q(d.clientX,d.clientY,[{label:F(e.locale.value,"insert"),action:()=>{r.saveUndo(),l.insertRows(Z.startRow,Z.endRow),c(),l.emitModelData()}},{label:F(e.locale.value,"cut"),action:()=>{r.saveUndo(),o.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,Z.startRow,Z.endRow),c(),l.emitModelData()}},{label:F(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:F(e.locale.value,"paste"),action:()=>{r.saveUndo(),o.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())})}},{label:F(e.locale.value,"delete"),action:()=>{r.saveUndo(),l.deleteRows(Z.startRow,Z.endRow),c(),l.emitModelData()}},{label:`${F(e.locale.value,"rowHeight")}...`,action:()=>A("row",K,P)},{label:F(e.locale.value,"autoRowHeight"),action:()=>l.resetRowHeight()}])}function s(d,E){d.preventDefault();const K=d.clientX,P=d.clientY,M=e.selection.value;M&&M.startRow===0&&M.endRow===e.rowCount-1&&E>=M.startCol&&E<=M.endCol||(e.selectRange(E,0,E,e.rowCount-1,"col"),c());const Z=e.selection.value,Ee=!l.canSortColumns(Z.startCol,Z.endCol);Q(d.clientX,d.clientY,[{label:F(e.locale.value,"insert"),action:()=>{r.saveUndo(),l.insertCols(Z.startCol,Z.endCol),c(),l.emitModelData()}},{label:F(e.locale.value,"cut"),action:()=>{r.saveUndo(),o.copyRowCol(),e.clearCellsInRange(Z.startCol,Z.endCol,0,e.rowCount-1),c(),l.emitModelData()}},{label:F(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:F(e.locale.value,"paste"),action:()=>{r.saveUndo(),o.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())})}},{label:F(e.locale.value,"delete"),action:()=>{r.saveUndo(),l.deleteCols(Z.startCol,Z.endCol),c(),l.emitModelData()}},{label:F(e.locale.value,"sort"),disabled:Ee,children:[{label:F(e.locale.value,"sortAsc"),action:()=>{l.prepareSortConfirmation("asc")||l.sortSelectedColumns("asc")},disabled:Ee},{label:F(e.locale.value,"sortDesc"),action:()=>{l.prepareSortConfirmation("desc")||l.sortSelectedColumns("desc")},disabled:Ee}]},{label:`${F(e.locale.value,"colWidth")}...`,action:()=>A("col",K,P)},{label:F(e.locale.value,"defaultColWidth"),action:()=>l.resetColWidth()}])}function u(d,E,K){d.preventDefault(),e.isSelected(E,K)||(e.selectCell(E,K),c());const P=e.selection.value,M=!!(P&&P.startCol===P.endCol&&P.startRow===P.endRow);Q(d.clientX,d.clientY,[{label:F(e.locale.value,"cut"),action:()=>{o.cutSelected(),l.emitModelData()}},{label:F(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:F(e.locale.value,"paste"),action:()=>{r.saveUndo(),o.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())})}},{label:F(e.locale.value,"delete"),action:()=>{r.saveUndo(),o.clearSelected(),c(),l.emitModelData()}},{label:F(e.locale.value,"calculate"),children:[{label:F(e.locale.value,"sum"),action:o.sumSelected,disabled:M},{label:F(e.locale.value,"avg"),action:o.avgSelected,disabled:M},{label:F(e.locale.value,"count"),action:o.countSelected,disabled:M}]}])}const L=t.ref(null),xe=t.ref(null);let he=null;function g(){he&&(document.removeEventListener("mousedown",he),he=null)}function A(d,E,K){g();const P=e.selection.value;let M="";if(P){const Ae=d==="row"?e.getRowHeight(P.startRow):e.colWidths.value[P.startCol];M=Ae!=null&&Ae>0?String(Math.round(Ae)):""}const Z=220,Ee=118;let Te=E,ge=K;Te+Z>window.innerWidth&&(Te=window.innerWidth-Z-8),ge+Ee>window.innerHeight&&(ge=window.innerHeight-Ee-8),Te<8&&(Te=8),ge<8&&(ge=8),xe.value={type:d,x:Te,y:ge,value:M,error:""},he=()=>{xe.value=null},setTimeout(()=>document.addEventListener("mousedown",he,{once:!0}),0),t.nextTick(()=>{const Ae=L.value;Ae&&(Ae.focus(),Ae.select())})}function Re(d){const E=xe.value;if(!E)return;const K=d.target,P=K.value,M=P.replace(/[^\d]/g,"");E.value=M,P!==M&&(K.value=M),E.error=""}function Ze(d){d.key==="Enter"?(d.preventDefault(),ie()):d.key==="Escape"&&(d.preventDefault(),Be())}function dt(){const d=xe.value;if(!d)return;const E=d.value.trim(),K=Number(E),P=d.type==="row",M=P?24:30,Z=P?500:1e3;if(E===""||!Number.isFinite(K)){Be();return}const Ee=Math.max(M,Math.min(Z,Math.round(K)));d.value=String(Ee),d.error=""}function ie(){const d=xe.value,E=e.selection.value;if(!d||!E)return;const K=d.value.trim(),P=Number(K),M=d.type==="row",Z=M?24:30,Ee=M?500:1e3;if(K===""||!Number.isFinite(P)){d.error=F(e.locale.value,"dimNumberError");return}if(P<Z||P>Ee){d.error=F(e.locale.value,"dimRangeError").replace("{min}",String(Z)).replace("{max}",String(Ee));return}const Te=P;if(r.saveUndo(),M)for(let ge=E.startRow;ge<=E.endRow;ge++)e.rowHeights.value[ge]=Te;else for(let ge=E.startCol;ge<=E.endCol;ge++)e.colWidths.value[ge]=Te;c(),l.emitModelData(),Be()}function Be(){g(),xe.value=null}const Le=t.computed(()=>{const d=!e.editingCell.value,E=e.editingCell.value??e.activeCell.value,K=E.col,P=E.row,M=e.resolveStyle(e.cells[e.cellKey(K,P)]),Z=e.cellFontSize(K,P),Ee=typeof(M==null?void 0:M.fontFamily)=="string"&&M.fontFamily?M.fontFamily:fl,Te=(M==null?void 0:M.fontWeight)==="bold"?"bold":"normal",ge=(M==null?void 0:M.fontStyle)==="italic"?"italic":"normal",Ae=(M==null?void 0:M.underline)==="underline"?"underline":(M==null?void 0:M.strikethrough)==="line-through"?"line-through":"none",nt=(M==null?void 0:M.underline)==="underline"&&(M==null?void 0:M.strikethrough)==="line-through"?"underline line-through":Ae,it=typeof(M==null?void 0:M.color)=="string"?M.color:void 0,Vt=typeof(M==null?void 0:M.backgroundColor)=="string"?M.backgroundColor:void 0,$t=typeof(M==null?void 0:M.numberFormat)=="string"?M.numberFormat:"",bl=e.editValue.value??e.getCellValue(K,P),Jt=typeof(M==null?void 0:M.textAlign)=="string"?M.textAlign:an(bl,$t)?"right":"left",Gt=typeof(M==null?void 0:M.verticalAlign)=="string"?M.verticalAlign:"top",cl=e.findMerge(K,P),sl=cl?e.colPositions.value[cl.range.endCol+1]-e.colPositions.value[K]:e.colWidths.value[K],_t=cl?e.rowPositions.value[cl.range.endRow+1]-e.rowPositions.value[P]:e.getRowHeight(P),Qt=2,{ascent:dl,descent:vt}=e.measureFontMetrics(Ee,Z,Te,ge),xl=dl+vt,de=(e.editValue.value?e.editValue.value.split(`
8
+ `).length:1)*xl,ve=e.BASE_CELL_VPAD-Qt;let We=0,Ue=0;return Gt==="middle"?(We=Math.floor((_t-de)/2),Ue=Math.max(0,_t-de-We)):Gt==="top"?(We=ve,Ue=Math.max(0,_t-de-We)):Gt==="bottom"&&(Ue=ve,We=Math.max(0,_t-de-Ue)),{left:`${52+e.colPositions.value[K]-e.scrollX.value}px`,top:`${24+e.rowPositions.value[P]-e.scrollY.value}px`,width:`${sl}px`,height:`${_t}px`,fontFamily:Ee,fontSize:`${Z}px`,lineHeight:1,fontWeight:Te,fontStyle:ge,textDecoration:nt,textAlign:Jt,paddingTop:`${We}px`,paddingRight:"3px",paddingBottom:`${Ue}px`,paddingLeft:"3px",opacity:d?0:1,pointerEvents:d?"none":"auto",color:d?"transparent":it,caretColor:d?"transparent":void 0,borderColor:d?"transparent":void 0,background:d?"transparent":Vt,boxShadow:d?"none":void 0}});function at(){return Math.max(0,l.viewSize.w-52-11)}function lt(){return Math.max(0,l.viewSize.h-24-11)}const ct=t.computed(()=>at()),ft=t.computed(()=>lt()),st=t.computed(()=>Math.max(0,ct.value-11*2)),ut=t.computed(()=>Math.max(0,ft.value-11*2)),Tt=t.computed(()=>l.maxScrollX.value<=0?st.value:Math.max(24,at()/e.totalWidth.value*st.value)),Mt=t.computed(()=>l.maxScrollX.value<=0?0:e.scrollX.value/l.maxScrollX.value*(st.value-Tt.value)),bt=t.computed(()=>l.maxScrollY.value<=0?ut.value:Math.max(24,lt()/e.totalHeight.value*ut.value)),It=t.computed(()=>l.maxScrollY.value<=0?0:e.scrollY.value/l.maxScrollY.value*(ut.value-bt.value));let Ct=null,Bt=0,At=0;function jt(d){d.preventDefault(),Ct="v",Bt=d.clientY,At=e.scrollY.value,document.addEventListener("mousemove",St),document.addEventListener("mouseup",B)}function al(d){d.preventDefault(),Ct="h",Bt=d.clientX,At=e.scrollX.value,document.addEventListener("mousemove",St),document.addEventListener("mouseup",B)}function St(d){if(Ct==="v"){const K=(d.clientY-Bt)/(ut.value-bt.value);l.clampScroll(null,At+K*l.maxScrollY.value),c()}else if(Ct==="h"){const K=(d.clientX-Bt)/(st.value-Tt.value);l.clampScroll(At+K*l.maxScrollX.value,null),c()}}function B(){Ct=null,document.removeEventListener("mousemove",St),document.removeEventListener("mouseup",B)}function N(d){if(Ct)return;const E=d.currentTarget.getBoundingClientRect(),K=d.clientY-E.top;K<It.value?l.clampScroll(null,e.scrollY.value-lt()):K>It.value+bt.value&&l.clampScroll(null,e.scrollY.value+lt()),c()}function O(d){if(Ct)return;const E=d.currentTarget.getBoundingClientRect(),K=d.clientX-E.left;K<Mt.value?l.clampScroll(e.scrollX.value-at(),null):K>Mt.value+Tt.value&&l.clampScroll(e.scrollX.value+at(),null),c()}let J=!1,ee=0,re=0,se=!1,le=!1,_=0,we=0,De=0,U=0,Ne=0,Xe=0,mt=0,v=0,T=!1,q=!1,j=0,f=0,b="cell",k=0,V=-1,$=-1;function ue(d){if(d.button!==0)return;d.preventDefault(),ye.value=null;const E=ol(d,l.canvasRef.value);if(E.y<24&&E.x>=52){const M=E.x-52+e.scrollX.value,Z=e.hitCol(M);if(Z>=0&&Math.abs(E.x-(52+e.colPositions.value[Z+1]-e.scrollX.value))<=4){r.saveUndo(),se=!0,_=Z,De=e.colWidths.value[Z],U=M,c();return}}if(E.x<52&&E.y>=24){const M=E.y-24+e.scrollY.value,Z=e.hitRow(M);if(Z>=0&&Math.abs(E.y-(24+e.rowPositions.value[Z+1]-e.scrollY.value))<=4){r.saveUndo(),le=!0,we=Z,De=e.getRowHeight(Z),U=M,c();return}}if(E.x<52||E.y<24){{const M=l.formulaBarRef.value,Z=!!(M&&typeof document<"u"&&document.activeElement===M);(e.editingCell.value||Z||y)&&oe()}if(E.y<24&&E.x>=52){const M=e.hitCol(E.x-52+e.scrollX.value);M>=0&&(e.selectRange(M,0,M,e.rowCount-1,"col"),J=!0,ee=M,re=0)}else if(E.x<52&&E.y>=24){const M=e.hitRow(E.y-24+e.scrollY.value);M>=0&&(e.selectRange(0,M,e.colCount-1,M,"row"),J=!0,ee=0,re=M)}else E.x<52&&E.y<24&&e.selectAll();c();return}const K=e.hitCol(E.x-52+e.scrollX.value),P=e.hitRow(E.y-24+e.scrollY.value);if(!(K<0||P<0)){{const M=l.formulaBarRef.value,Z=!!(M&&typeof document<"u"&&document.activeElement===M);(e.editingCell.value||Z||y)&&oe()}if(d.shiftKey&&e.selection.value){const M=e.selection.value;e.selectRange(M.startCol,M.startRow,K,P)}else e.selectCell(K,P);J=!0,ee=K,re=P,l.focusEditInput(),c()}}function ke(d){if(se){const Z=ol(d,l.canvasRef.value).x-52+e.scrollX.value-U,Ee=De+Z;Ee>=30&&Ee<=1e3?e.colWidths.value[_]=Ee:Ee<30?e.colWidths.value[_]=30:e.colWidths.value[_]=1e3,c();return}if(le){const Z=ol(d,l.canvasRef.value).y-24+e.scrollY.value-U,Ee=De+Z;Ee>=24&&Ee<=500?e.rowHeights.value[we]=Ee:Ee<24?e.rowHeights.value[we]=24:e.rowHeights.value[we]=500,c();return}if(!J){const M=l.canvasRef.value;if(!M)return;if(r.paintFmt.value){M.style.cursor="copy";return}const Z=ol(d,M);if(Z.y<24&&Z.x>=52){const Ee=e.hitCol(Z.x-52+e.scrollX.value);if(Ee>=0&&Math.abs(Z.x-(52+e.colPositions.value[Ee+1]-e.scrollX.value))<=4){M.style.cursor="col-resize";return}}if(Z.x<52&&Z.y>=24){const Ee=e.hitRow(Z.y-24+e.scrollY.value);if(Ee>=0&&Math.abs(Z.y-(24+e.rowPositions.value[Ee+1]-e.scrollY.value))<=4){M.style.cursor="row-resize";return}}M.style.cursor="cell";return}const E=ol(d,l.canvasRef.value);if(ee<0||re<0)return;if(E.x<52||E.y<24){if(E.y<24&&E.x>=52){const M=e.hitCol(E.x-52+e.scrollX.value);M>=0&&e.selectRange(Math.min(ee,M),0,Math.max(ee,M),e.rowCount-1,"col")}else if(E.x<52&&E.y>=24){const M=e.hitRow(E.y-24+e.scrollY.value);M>=0&&e.selectRange(0,Math.min(re,M),e.colCount-1,Math.max(re,M),"row")}c();return}const K=e.hitCol(E.x-52+e.scrollX.value),P=e.hitRow(E.y-24+e.scrollY.value);K<0||P<0||(re===0&&ee>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(ee,K),0,Math.max(ee,K),e.rowCount-1,"col"):ee===0&&re>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(re,P),e.colCount-1,Math.max(re,P),"row"):e.selectRange(ee,re,K,P),c())}function $e(d){const E=se||le;J=!1,se=!1,le=!1,E&&l.scheduleOptEmit(),r.paintFmt.value&&r.applyPaintFormat()}function Pe(){const d=se||le;J=!1,se=!1,le=!1,d&&l.scheduleOptEmit()}function ze(d){d.preventDefault();const E=ol(d,l.canvasRef.value);if(E.x<52&&E.y<24){z(d);return}if(E.y<24&&E.x>=52){const K=e.hitCol(E.x-52+e.scrollX.value);K>=0&&s(d,K);return}if(E.x<52&&E.y>=24){const K=e.hitRow(E.y-24+e.scrollY.value);K>=0&&D(d,K);return}if(E.x>=52&&E.y>=24){const K=e.hitCol(E.x-52+e.scrollX.value),P=e.hitRow(E.y-24+e.scrollY.value);K>=0&&P>=0&&u(d,K,P)}}function _e(d){const E=ol(d,l.canvasRef.value);if(E.x<52||E.y<24)return;const K=e.hitCol(E.x-52+e.scrollX.value),P=e.hitRow(E.y-24+e.scrollY.value);if(!(K<0||P<0)){{const M=l.formulaBarRef.value,Z=!!(M&&typeof document<"u"&&document.activeElement===M);(e.editingCell.value||Z||y)&&oe()}e.selectCell(K,P),e.ensureVisible(K,P),e.startEdit(),c(),l.focusEditInput()}}function yt(d){const E=e.scrollX.value+d.deltaX,K=e.scrollY.value+d.deltaY,P=40,M=l.maxScrollX.value,Z=l.maxScrollY.value;if(E>=M-P&&d.deltaX>0||K>=Z-P&&d.deltaY>0){const Ee=Math.max(0,l.viewSize.w-28-11),Te=Math.max(0,l.viewSize.h-28-11),ge=Math.max(0,Math.ceil((E+Ee)/100)+2),Ae=Math.max(0,Math.ceil((K+Te)/24)+2);e.ensureCapacity(ge,Ae)}l.clampScroll(E,K),c()}function Qe(d){if(d.touches.length!==1){T=!1;return}const E=d.touches[0],K=l.canvasRef.value;if(!K)return;const P=K.getBoundingClientRect(),M=E.clientX-P.left,Z=E.clientY-P.top;M>=52&&Z>=24?(d.preventDefault(),T=!0,q=!1,b="cell",Ne=M,Xe=Z,mt=e.scrollX.value,v=e.scrollY.value,j=e.hitCol(M-52+e.scrollX.value),f=e.hitRow(Z-24+e.scrollY.value)):M>=0&&Z>=0&&(M<52||Z<24)&&(d.preventDefault(),T=!0,q=!1,Ne=M,Xe=Z,mt=e.scrollX.value,v=e.scrollY.value,Z<24&&M>=52?(b="col",j=e.hitCol(M-52+e.scrollX.value),f=-1):M<52&&Z>=24?(b="row",f=e.hitRow(Z-24+e.scrollY.value),j=-1):(b="all",j=-1,f=-1))}function Ht(d){if(!T||d.touches.length!==1)return;const E=d.touches[0],K=l.canvasRef.value;if(!K)return;const P=K.getBoundingClientRect(),M=E.clientX-P.left,Z=E.clientY-P.top;(Math.abs(M-Ne)>8||Math.abs(Z-Xe)>8)&&(q=!0,d.preventDefault(),l.clampScroll(mt+(Ne-M),v+(Xe-Z)),c())}function gl(){if(T&&(T=!1,!q))if(b==="cell"&&j>=0&&f>=0){const d=Date.now();j===V&&f===$&&d-k<300?(e.selectCell(j,f),e.startEdit(),c(),l.focusEditInput(),k=0):(e.commitEdit(),e.selectCell(j,f),c(),k=d),V=j,$=f,l.focusEditInput()}else b==="col"&&j>=0?(e.commitEdit(),e.selectRange(j,0,j,e.rowCount-1,"col"),c()):b==="row"&&f>=0?(e.commitEdit(),e.selectRange(0,f,e.colCount-1,f,"row"),c()):b==="all"&&(e.commitEdit(),e.selectAll(),c())}function Pt(d){return d.isComposing||d.key==="Process"||d.keyCode===229}function Dt(d){return d.key.length===1&&!d.ctrlKey&&!d.metaKey&&!d.altKey}function il(d){if(e.editingCell.value)return;const E=d.ctrlKey||d.metaKey,K=d.shiftKey;switch(!0){case(E&&(d.key==="c"||d.key==="C")):d.preventDefault(),o.copyToClipboard();return;case(E&&(d.key==="x"||d.key==="X")):d.preventDefault(),o.cutSelected();return;case(E&&(d.key==="z"||d.key==="Z")):d.preventDefault(),r.undo();return;case(E&&(d.key==="y"||d.key==="Y")):d.preventDefault(),r.redo();return;case(E&&(d.key==="v"||d.key==="V")):d.preventDefault(),r.saveUndo(),o.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())});return;case(E&&(d.key==="a"||d.key==="A")):d.preventDefault(),e.selectAll(),c();return;case(E&&d.key==="Home"):d.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),c();return;case(E&&d.key==="End"):d.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),c();return;case d.key==="Home":d.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),c();return;case d.key==="End":d.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),c();return;case d.key==="ArrowUp":d.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case d.key==="ArrowDown":d.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case d.key==="ArrowLeft":d.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case d.key==="ArrowRight":d.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case d.key==="Tab":d.preventDefault(),e.moveActive(K?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case d.key==="Enter":d.preventDefault(),e.moveActive(0,K?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case d.key==="F2":d.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),c(),l.focusEditInput();return;case d.key==="Delete":case d.key==="Backspace":d.preventDefault(),r.saveUndo(),o.clearSelected(),c();return;case d.key==="Escape":d.preventDefault(),e.cancelEdit(),r.paintFmt.value=null,c();return;case Dt(d):if(Pt(d)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),c(),l.focusEditInput();return}d.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(d.key),c(),t.nextTick(()=>{const P=l.editInputRef.value;P&&(P.focus(),P.setSelectionRange(1,1))});return}}let Zt=!1,Lt=!1;function Zl(d){const E=d.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(E),C.value=E,c();return}e.editValue.value=E,C.value=E}function qt(){Zt=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),C.value="",c())}function yl(d){Zt=!1,Lt=!0,setTimeout(()=>{Lt=!1},0);const E=d.target.value;e.editValue.value=E,C.value=E}function El(d){if(!e.editingCell.value){if(Dt(d)||Pt(d))return;il(d);return}if(!(Zt||Pt(d))&&!(Lt&&(d.key==="Enter"||d.key==="Escape")))if(d.key==="Enter"&&(d.altKey||d.metaKey)){d.preventDefault();const E=l.editInputRef.value;if(!E)return;const K=E.selectionStart??E.value.length,P=E.selectionEnd??E.value.length,M=E.value,Z=M.slice(0,K)+`
9
+ `+M.slice(P);e.editValue.value=Z,E.value=Z,E.selectionStart=E.selectionEnd=K+1,c()}else d.key==="Enter"?(d.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c(),l.focusEditInput()):d.key==="Tab"?(d.preventDefault(),e.commitEdit(),e.moveActive(d.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c(),l.focusEditInput()):d.key==="Escape"&&(d.preventDefault(),e.cancelEdit(),c(),l.focusEditInput())}function Dn(d){e.editingCell.value}function Ec(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),c())},0)}let Nt=null;function Sl(){var E;const d=(E=l.wrapperRef.value)==null?void 0:E.getBoundingClientRect();if(d){const K=nl(e.props.width),P=nl(e.props.height);K!=null?l.viewSize.w=K:l.viewSize.w=d.width,P!=null?l.viewSize.h=P:l.viewSize.h=d.height}l.clampScroll(null,null),c()}function Sc(){t.onMounted(()=>{const d=nl(e.props.width),E=nl(e.props.height);(d==null||E==null)&&(Nt=new ResizeObserver(()=>Sl()),l.wrapperRef.value&&Nt.observe(l.wrapperRef.value)),t.nextTick(()=>{Sl(),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(K=>{const P=l.mkSheet(K.name,{colCount:K.colCount,rowCount:K.rowCount}),{cells:M,styles:Z}=kn(K.cells);if(Object.assign(P.cells,M),P.styles=K.styles??Z,K.borders)P.borders=K.borders;else{const Ee=En(P.styles);P.styles=Ee.styles,P.borders=Ee.borders}if(K.colWidths)for(const[Ee,Te]of Object.entries(K.colWidths)){const ge=Number(Ee);ge>=0&&ge<(P.colCount??e.colCount)&&Te>=30&&(P.colWidths[ge]=Te)}if(K.rowHeights)for(const[Ee,Te]of Object.entries(K.rowHeights)){const ge=Number(Ee);ge>=0&&ge<(P.rowCount??e.rowCount)&&Te>=24&&(P.rowHeights[ge]=Te)}if(K.merges)for(const[Ee,Te]of Object.entries(K.merges))P.merges[Ee]={...Te};return P}),l.sheets.value.length>0&&l.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const d=nl(e.props.width),E=nl(e.props.height);d!=null&&E!=null?(Nt==null||Nt.disconnect(),Nt=null):!Nt&&l.wrapperRef.value&&(Nt=new ResizeObserver(()=>Sl()),Nt.observe(l.wrapperRef.value)),t.nextTick(()=>Sl())}),t.watch(()=>e.props.theme,()=>c()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>l.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>l.emitModelData()),c()},{deep:!1}),t.watch(l.activeSheetIndex,()=>t.nextTick(()=>l.emitModelData())),t.watch(()=>l.modelData.value,d=>{if(!d||d.length===0)return;const E=JSON.stringify(d);if(E===a.value)return;a.value=E;const K=e.selection.value?{...e.selection.value}:null,P={...e.activeCell.value};l.sheets.value=d.map(M=>{const Z=l.mkSheet(M.name),{cells:Ee,styles:Te}=kn(M.cells);if(Object.assign(Z.cells,Ee),Z.styles=M.styles??Te,M.borders)Z.borders=M.borders;else{const ge=En(Z.styles);Z.styles=ge.styles,Z.borders=ge.borders}if(M.colWidths)for(const[ge,Ae]of Object.entries(M.colWidths)){const nt=Number(ge);nt>=0&&nt<e.colCount&&Ae>=30&&(Z.colWidths[nt]=Ae)}if(M.rowHeights)for(const[ge,Ae]of Object.entries(M.rowHeights)){const nt=Number(ge);nt>=0&&nt<e.rowCount&&Ae>=24&&(Z.rowHeights[nt]=Ae)}if(M.merges)for(const[ge,Ae]of Object.entries(M.merges))Z.merges[ge]={...Ae};return Z}),l.sheets.value.length>0&&l.loadSheet(0),K&&(e.selection.value=K),e.activeCell.value=P,c()},{deep:!0}),t.onBeforeUnmount(()=>{Nt==null||Nt.disconnect()})}return{scheduleRender:c,render:S,activeCellLabel:x,formulaBarDisplay:R,formulaBarDraft:C,formulaBarExpanded:w,onFormulaBarFocus:X,onFormulaBarInput:Y,onFormulaBarKeydown:ne,onFormulaBarBlur:be,acceptFormulaBarEdit:oe,cancelFormulaBarEdit:G,insertFunctionIntoCell:te,renTab:Fe,renTabVal:Me,onTabClick:fe,onTabDblClick:Ce,commitTabRename:Ke,cclTabRename:Se,onTabRenameKd:pe,ctxMenu:ye,ctxSubmenuLeft:ae,onCtxItemEnter:m,onTabCtxMenu:I,onTabBarCtx:H,onCornerCtx:z,onRowHdrCtx:D,onColHdrCtx:s,onCellCtx:u,dimInputRef:L,dimPanel:xe,openDimPanel:A,onDimInput:Re,onDimKeydown:Ze,onDimBlur:dt,applyDimPanel:ie,closeDimPanel:Be,editInputStyle:Le,hScrollbarW:ct,vScrollbarH:ft,hTrackW:st,vTrackH:ut,hThumbW:Tt,hThumbL:Mt,vThumbH:bt,vThumbT:It,onVStart:jt,onHStart:al,onSbMove:St,onSbUp:B,onVTrk:N,onHTrk:O,onMouseDown:ue,onMouseMove:ke,onMouseUp:$e,onMouseLeave:Pe,onCanvasCtx:ze,onDblClick:_e,onWheel:yt,onTouchStart:Qe,onTouchMove:Ht,onTouchEnd:gl,onKeydown:il,onEditInput:Zl,onEditCompositionStart:qt,onEditCompositionEnd:yl,onEditKd:El,onEditPaste:Dn,onEditBlur:Ec,applySize:Sl,setupLifecycle:Sc}}function tc(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Mn(e,r,o,l){return r?l?o?e===r:e.toLowerCase()===r.toLowerCase():o?e.includes(r):e.toLowerCase().includes(r.toLowerCase()):!1}function lc(e,r,o,l){if(!r)return e;if(l){const i=e.indexOf(r);return i<0?e:e.slice(0,i)+o+e.slice(i+r.length)}const a=e.toLowerCase().indexOf(r.toLowerCase());return a<0?e:e.slice(0,a)+o+e.slice(a+r.length)}function nc(e,r,o,l){return r?l?e.indexOf(r)<0?e:e.split(r).join(o):e.toLowerCase().indexOf(r.toLowerCase())<0?e:e.replace(new RegExp(tc(r),"gi"),()=>o):e}function jl(e,r,o,l,a,i,n){const p=[];if(n){for(let c=n.startRow;c<=n.endRow;c++)for(let h=n.startCol;h<=n.endCol;h++){const S=e[o(h,c)];S&&Mn(S.value,l,a,i)&&p.push({sheetIndex:r,col:h,row:c})}return p}for(const c in e){const h=e[c];if(h&&Mn(h.value,l,a,i)){const S=c.split(","),x=Number(S[0]),C=Number(S[1]);!Number.isNaN(x)&&!Number.isNaN(C)&&p.push({sheetIndex:r,col:x,row:C})}}return p}function oc(e,r,o,l){const a=t.ref(!1),i=t.ref(""),n=t.ref(""),p=t.ref("sheet"),c=t.ref(!1),h=t.ref(!1),S=t.ref(-1),x=t.ref([]),C=t.ref(""),w=t.ref(0),R=t.ref(""),X=t.computed(()=>{const Q=new Set,ae=o.activeSheetIndex.value;for(const m of x.value)m.sheetIndex===ae&&Q.add(`${m.col},${m.row}`);return Q}),Y=t.computed(()=>{if(S.value<0||S.value>=x.value.length)return null;const Q=x.value[S.value];return Q.sheetIndex!==o.activeSheetIndex.value?null:`${Q.col},${Q.row}`});e.findHighlight=(Q,ae)=>{const m=`${Q},${ae}`;return Y.value===m?"active":X.value.has(m)?"match":null};function te(Q){var I,H;const ae=e.cellKey(Q.col,Q.row);if(Q.sheetIndex===o.activeSheetIndex.value)return((I=e.cells[ae])==null?void 0:I.value)??"";const m=o.sheets.value[Q.sheetIndex];return((H=m==null?void 0:m.cells[ae])==null?void 0:H.value)??""}function W(Q,ae){const m=e.cellKey(Q.col,Q.row);if(Q.sheetIndex===o.activeSheetIndex.value)e.setCellValue(Q.col,Q.row,ae);else{const I=o.sheets.value[Q.sheetIndex];if(!I)return;const H=I.cells[m];I.cells[m]={value:String(ae),styleId:H==null?void 0:H.styleId}}}function y(){if(R.value){C.value=R.value;return}if(!i.value){C.value="";return}if(p.value==="selection"&&!e.selection.value){C.value=F(e.locale.value,"findNeedSelection");return}if(x.value.length===0){C.value=F(e.locale.value,"findNoResult");return}C.value=""}function oe(){const Q=i.value,ae=[];if(Q)if(p.value==="workbook")o.sheets.value.forEach((m,I)=>{ae.push(...jl(m.cells,I,e.cellKey,Q,c.value,h.value))});else if(p.value==="selection"){const m=e.selection.value;m&&ae.push(...jl(e.cells,o.activeSheetIndex.value,e.cellKey,Q,c.value,h.value,m))}else ae.push(...jl(e.cells,o.activeSheetIndex.value,e.cellKey,Q,c.value,h.value));x.value=ae,ae.length===0?S.value=-1:S.value>=ae.length?S.value=ae.length-1:S.value<0&&(S.value=0),y()}function G(){if(S.value<0||S.value>=x.value.length)return;const Q=x.value[S.value];Q.sheetIndex!==o.activeSheetIndex.value&&o.switchSheet(Q.sheetIndex),p.value==="selection"?e.activeCell.value={col:Q.col,row:Q.row}:e.selectCell(Q.col,Q.row),e.ensureVisible(Q.col,Q.row)}const ne=typeof requestAnimationFrame=="function"?requestAnimationFrame:Q=>setTimeout(Q,16);let be=!1,Fe=!1;function Me(Q){if(be){Fe=Fe||Q;return}be=!0,Fe=Q,ne(()=>{var ae;be=!1,oe(),Fe&&x.value.length>0&&S.value>=0&&G(),Fe=!1,(ae=e.scheduleRender)==null||ae.call(e)})}function fe(){var Q;a.value=!0,w.value++,oe(),x.value.length>0&&(S.value=0,G()),(Q=e.scheduleRender)==null||Q.call(e)}function Ce(){fe()}function Ke(){var Q;a.value=!1,x.value=[],S.value=-1,R.value="",C.value="",(Q=e.scheduleRender)==null||Q.call(e)}function Se(){var Q;x.value.length!==0&&(S.value=(S.value+1)%x.value.length,G(),(Q=e.scheduleRender)==null||Q.call(e))}function pe(){var Q;x.value.length!==0&&(S.value=(S.value-1+x.value.length)%x.value.length,G(),(Q=e.scheduleRender)==null||Q.call(e))}function ye(){var H,z;if(S.value<0||S.value>=x.value.length)return;const Q=x.value[S.value],ae=te(Q),m=lc(ae,i.value,n.value,c.value);if(m===ae)return;r.saveUndo(),W(Q,m);const I=S.value;oe(),x.value.length>0?(S.value=Math.min(I,x.value.length-1),Se()):S.value=-1,(H=e.emitModelData)==null||H.call(e),(z=e.scheduleRender)==null||z.call(e)}function Oe(){var I,H;const Q=i.value;if(!Q||x.value.length===0)return;r.saveUndo();let ae=0;const m=x.value.slice();for(const z of m){const D=te(z),s=nc(D,Q,n.value,c.value);s!==D&&(W(z,s),ae++)}x.value=[],S.value=-1,R.value=F(e.locale.value,"findReplacedAll").replace("{n}",String(ae)),y(),(I=e.emitModelData)==null||I.call(e),(H=e.scheduleRender)==null||H.call(e)}function He(){const Q=ae=>{if(!(ae.ctrlKey||ae.metaKey))return;const I=ae.key.toLowerCase();(I==="f"||I==="h")&&(ae.preventDefault(),fe())};window.addEventListener("keydown",Q),t.onBeforeUnmount(()=>window.removeEventListener("keydown",Q))}return t.watch(i,()=>{a.value&&(R.value="",S.value=0,Me(!0))}),t.watch([p,c,h],()=>{a.value&&(R.value="",S.value=0,Me(!0))}),t.watch(e.cells,()=>{a.value&&Me(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&p.value==="selection"&&(S.value=0,Me(!0))}),t.watch([()=>r.undoStack.value.length,()=>r.redoStack.value.length],()=>{a.value&&Me(!1)}),{open:a,findText:i,replaceText:n,scope:p,matchCase:c,matchEntireCell:h,currentIndex:S,results:x,message:C,focusToken:w,activeSheetMatches:X,activeMatchKey:Y,openFind:fe,openReplace:Ce,close:Ke,recompute:oe,findNext:Se,findPrev:pe,replace:ye,replaceAll:Oe,setupLifecycle:He}}const rc={class:"formula-bar__cell-label"},ac={class:"formula-bar__buttons"},ic=["title","aria-label"],cc=["rows","value"],sc=["title"],dc={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},uc={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},fc=["value"],mc={key:2,class:"sb-corner"},pc=["onClick","onMouseenter"],hc={class:"context-menu__label"},gc={key:0,class:"context-menu__arrow",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"22869"},yc=["onClick"],bc={class:"dim-panel__title"},Cc={class:"dim-panel__body"},vc=["value"],wc={key:0,class:"dim-panel__error"},kc={class:"dim-panel__footer"},Bn=kt(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 r=e,o=t.useModel(e,"data"),l={value:""},a=Pi(r,{rowCount:r.rowCount,colCount:r.colCount,theme:r.theme,locale:r.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:D=>{},mkSheet:D=>({id:"",name:D,cells:{},merges:{},styles:[{}],borders:[{}],selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[],colCount:0,rowCount:0})},n=Gi(a,i),p=Xi(a,n);Yi(n,{borderMenuOpen:p.borderMenuOpen,mergeMenuOpen:p.mergeMenuOpen});const c=Qi(a,n,o,void 0,l);i.sheets=c.sheets,i.activeSheetIndex=c.activeSheetIndex,i.saveSheet=c.saveSheet,i.loadSheet=c.loadSheet,i.mkSheet=c.mkSheet;const h=ec(a,n,p,c,l);h.setupLifecycle();const S=oc(a,n,c);S.setupLifecycle();const x=t.reactive(a),C=t.reactive(n),w=t.reactive(p),R=t.reactive(c),X=c.sheets,Y=c.activeSheetIndex,te=c.sortMenuOpen,W=c.cachedSortOrder,y=t.reactive(h),oe=t.reactive(S),G=t.computed(()=>{const D=x.selection;return!!D&&D.startCol===D.endCol&&D.startRow===D.endRow}),ne=t.computed(()=>{const D=x.selection;return D?c.canSortColumns(D.startCol,D.endCol):!1}),be=t.computed(()=>{const D=C.selNumberFormat;if(D!==Ft&&D!==Wt)return D;const s=x.activeCell,u=a.resolveStyle(x.cells[x.cellKey(s.col,s.row)]);return typeof(u==null?void 0:u.numberFormat)=="string"?u.numberFormat:""});function Fe(D){n.nfDialogOpen.value=D}const Me=t.ref(!1);function fe(){Me.value=!0}function Ce(D){Me.value=D}function Ke(D){h.insertFunctionIntoCell(D)}function Se(D){n.fontSizeMenuOpen.value=D}function pe(D){n.textColorMenuOpen.value=D}function ye(D){n.fillColorMenuOpen.value=D}function Oe(D){h.renTabVal.value=D}function He(){h.ctxMenu.value=null}const Q=D=>{c.formulaBarRef.value=D};function ae(){h.formulaBarExpanded.value=!h.formulaBarExpanded.value}const m=D=>{c.wrapperRef.value=D},I=D=>{c.canvasRef.value=D},H=D=>{c.editInputRef.value=D},z=D=>{h.dimInputRef.value=D};return(D,s)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(R.outerStyle)},[t.createVNode(da,{locale:x.locale,"can-undo":C.canUndo,"can-redo":C.canRedo,"paint-fmt-active":C.paintFmt!==null,"has-selection":C.hasSelection,"font-family-options":C.fontFamilyOptions,"font-size-options":C.fontSizeOptions,"sel-font-family":C.selFontFamily,"sel-font-size":C.selFontSize,"font-size-input":C.fontSizeInput,"font-size-menu-open":C.fontSizeMenuOpen,"sel-font-weight":C.selFontWeight,"sel-font-style":C.selFontStyle,"sel-underline":C.selUnderline,"sel-strikethrough":C.selStrikethrough,"sel-text-color":C.selTextColor,"text-color-menu-open":C.textColorMenuOpen,"sel-fill-color":C.selFillColor,"fill-color-menu-open":C.fillColorMenuOpen,"cached-text-color":C.cachedTextColor,"cached-fill-color":C.cachedFillColor,"border-menu-open":w.borderMenuOpen,"cached-border":w.cachedBorder,"sort-menu-open":t.unref(te),"cached-sort-order":t.unref(W),"can-sort":ne.value,"h-align-options":C.hAlignOptions,"v-align-options":C.vAlignOptions,"sel-h-align":C.selHAlign,"sel-v-align":C.selVAlign,"sel-wrap":C.selWrap,"merge-menu-open":w.mergeMenuOpen,"calc-menu-open":w.calcMenuOpen,"is-single-cell":G.value,"sel-number-format":C.selNumberFormatDisplay,"nf-options":C.nfOptions,"can-increase-decimals":C.canIncreaseDecimals,"can-decrease-decimals":C.canDecreaseDecimals,"theme-vars":R.toolbarThemeVars,onUndo:s[0]||(s[0]=u=>C.undo()),onRedo:s[1]||(s[1]=u=>C.redo()),onPaintFormat:C.onPaintFormat,onClearFormat:s[2]||(s[2]=u=>C.clearFormat()),onNumberFormatChange:s[3]||(s[3]=u=>C.onNumberFormatChange(u)),onIncreaseDecimals:C.onIncreaseDecimals,onDecreaseDecimals:C.onDecreaseDecimals,onFontFamilyChange:s[4]||(s[4]=u=>C.onFontFamilyChange(u)),onFontSizeInput:s[5]||(s[5]=u=>C.onFontSizeInput(u)),onFontSizeBlur:C.onFontSizeBlur,onFontSizeKeydown:s[6]||(s[6]=u=>C.onFontSizeKeydown(u)),onFontSizeChange:s[7]||(s[7]=u=>C.onFontSizeChange(u)),"onUpdate:fontSizeMenuOpen":s[8]||(s[8]=u=>Se(u)),onFontSizeToggle:s[9]||(s[9]=u=>C.toggleFontSizeMenu()),onFontSizeStepUp:C.onFontSizeStepUp,onFontSizeStepDown:C.onFontSizeStepDown,onBoldToggle:C.toggleFontWeight,onItalicToggle:C.toggleFontStyle,onUnderlineToggle:C.toggleUnderline,onStrikethroughToggle:C.toggleStrikethrough,onTextColorChange:s[10]||(s[10]=u=>C.onTextColorChange(u)),"onUpdate:textColorMenuOpen":s[11]||(s[11]=u=>pe(u)),onFillColorChange:s[12]||(s[12]=u=>C.onFillColorChange(u)),"onUpdate:fillColorMenuOpen":s[13]||(s[13]=u=>ye(u)),onApplyTextColor:C.applyCachedTextColor,onApplyFillColor:C.applyCachedFillColor,"onUpdate:borderMenuOpen":s[14]||(s[14]=u=>C.onBorderMenuToggle(u)),onBorderChange:s[15]||(s[15]=u=>w.onBorderChange(u)),onApplyBorder:w.applyCachedBorder,"onUpdate:sortMenuOpen":s[16]||(s[16]=u=>R.onSortMenuToggle(u)),onSortChange:s[17]||(s[17]=u=>R.onSortChange(u)),onApplySort:R.applyCachedSort,onHAlignChange:s[18]||(s[18]=u=>C.onHAlignChange(u)),onVAlignChange:s[19]||(s[19]=u=>C.onVAlignChange(u)),onWrapToggle:C.onWrapToggle,"onUpdate:mergeMenuOpen":s[20]||(s[20]=u=>w.onMergeMenuToggle(u)),onMergeChange:s[21]||(s[21]=u=>w.onMergeChange(u)),onApplyMerge:w.onApplyMerge,"onUpdate:calcMenuOpen":s[22]||(s[22]=u=>w.onCalcMenuToggle(u)),onCalcSum:w.onCalcSum,onCalcAvg:w.onCalcAvg,onCalcCount:w.onCalcCount,onFind:s[23]||(s[23]=u=>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","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(Oa,{open:oe.open,"find-text":oe.findText,"replace-text":oe.replaceText,scope:oe.scope,"match-case":oe.matchCase,"match-entire-cell":oe.matchEntireCell,"current-index":oe.currentIndex,total:oe.results.length,message:oe.message,"focus-token":oe.focusToken,locale:x.locale,"theme-vars":R.toolbarThemeVars,"onUpdate:findText":s[24]||(s[24]=u=>t.unref(S).findText.value=u),"onUpdate:replaceText":s[25]||(s[25]=u=>t.unref(S).replaceText.value=u),"onUpdate:scope":s[26]||(s[26]=u=>t.unref(S).scope.value=u),"onUpdate:matchCase":s[27]||(s[27]=u=>t.unref(S).matchCase.value=u),"onUpdate:matchEntireCell":s[28]||(s[28]=u=>t.unref(S).matchEntireCell.value=u),onPrev:s[29]||(s[29]=u=>t.unref(S).findPrev()),onNext:s[30]||(s[30]=u=>t.unref(S).findNext()),onReplace:s[31]||(s[31]=u=>t.unref(S).replace()),onReplaceAll:s[32]||(s[32]=u=>t.unref(S).replaceAll()),onClose:s[33]||(s[33]=u=>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(si,{"model-open":C.nfDialogOpen,locale:x.locale,"current-format":be.value,"is-custom":C.selNumberFormat===t.unref(Wt),"onUpdate:modelOpen":s[34]||(s[34]=u=>Fe(u)),onApply:s[35]||(s[35]=u=>C.applyNumberFormatCode(u))},null,8,["model-open","locale","current-format","is-custom"]),t.createVNode(bi,{"model-open":R.sortConfirmOpen,locale:x.locale,"onUpdate:modelOpen":s[36]||(s[36]=u=>R.sortConfirmOpen=u),onConfirm:s[37]||(s[37]=u=>R.confirmSort(u)),onCancel:s[38]||(s[38]=u=>R.cancelSortConfirmation())},null,8,["model-open","locale"]),t.createVNode(Li,{"model-open":Me.value,locale:x.locale,"onUpdate:modelOpen":s[39]||(s[39]=u=>Ce(u)),onInsert:s[40]||(s[40]=u=>Ke(u))},null,8,["model-open","locale"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":y.formulaBarExpanded}])},[t.createElementVNode("div",rc,t.toDisplayString(y.activeCellLabel),1),t.createElementVNode("div",ac,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:s[41]||(s[41]=t.withModifiers(()=>{},["prevent"])),onClick:s[42]||(s[42]=t.withModifiers((...u)=>y.cancelFormulaBarEdit&&y.cancelFormulaBarEdit(...u),["stop"]))},[...s[93]||(s[93]=[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:s[43]||(s[43]=t.withModifiers(()=>{},["prevent"])),onClick:s[44]||(s[44]=t.withModifiers((...u)=>y.acceptFormulaBarEdit&&y.acceptFormulaBarEdit(...u),["stop"]))},[...s[94]||(s[94]=[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(F)(x.locale,"insertFunctionTitle"),"aria-label":t.unref(F)(x.locale,"insertFunctionTitle"),onMousedown:s[45]||(s[45]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(fe,["stop"])},[...s[95]||(s[95]=[t.createElementVNode("span",{class:"formula-bar__fx-label"},"fx",-1)])],40,ic)]),t.createElementVNode("textarea",{ref:Q,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":y.formulaBarExpanded}]),rows:y.formulaBarExpanded?3:1,value:y.formulaBarDisplay,spellcheck:"false",onFocus:s[46]||(s[46]=(...u)=>y.onFormulaBarFocus&&y.onFormulaBarFocus(...u)),onInput:s[47]||(s[47]=(...u)=>y.onFormulaBarInput&&y.onFormulaBarInput(...u)),onKeydown:s[48]||(s[48]=(...u)=>y.onFormulaBarKeydown&&y.onFormulaBarKeydown(...u)),onBlur:s[49]||(s[49]=(...u)=>y.onFormulaBarBlur&&y.onFormulaBarBlur(...u))},null,42,cc),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:y.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:s[50]||(s[50]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(ae,["stop"])},[y.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",uc,[...s[97]||(s[97]=[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",dc,[...s[96]||(s[96]=[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,sc)],2),t.createElementVNode("div",{ref:m,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:I,class:"grid-canvas",tabindex:"0",onMousedown:s[51]||(s[51]=(...u)=>y.onMouseDown&&y.onMouseDown(...u)),onMousemove:s[52]||(s[52]=(...u)=>y.onMouseMove&&y.onMouseMove(...u)),onMouseup:s[53]||(s[53]=(...u)=>y.onMouseUp&&y.onMouseUp(...u)),onMouseleave:s[54]||(s[54]=(...u)=>y.onMouseLeave&&y.onMouseLeave(...u)),onDblclick:s[55]||(s[55]=(...u)=>y.onDblClick&&y.onDblClick(...u)),onWheel:s[56]||(s[56]=t.withModifiers((...u)=>y.onWheel&&y.onWheel(...u),["prevent"])),onFocus:s[57]||(s[57]=(...u)=>R.onCanvasFocus&&R.onCanvasFocus(...u)),onKeydown:s[58]||(s[58]=(...u)=>y.onKeydown&&y.onKeydown(...u)),onContextmenu:s[59]||(s[59]=(...u)=>y.onCanvasCtx&&y.onCanvasCtx(...u)),onTouchstart:s[60]||(s[60]=t.withModifiers((...u)=>y.onTouchStart&&y.onTouchStart(...u),["prevent"])),onTouchmove:s[61]||(s[61]=t.withModifiers((...u)=>y.onTouchMove&&y.onTouchMove(...u),["prevent"])),onTouchend:s[62]||(s[62]=(...u)=>y.onTouchEnd&&y.onTouchEnd(...u))},null,32),t.createElementVNode("textarea",{ref:H,class:"cell-editor",value:x.editValue,style:t.normalizeStyle(y.editInputStyle),onInput:s[63]||(s[63]=(...u)=>y.onEditInput&&y.onEditInput(...u)),onKeydown:s[64]||(s[64]=(...u)=>y.onEditKd&&y.onEditKd(...u)),onCompositionstart:s[65]||(s[65]=(...u)=>y.onEditCompositionStart&&y.onEditCompositionStart(...u)),onCompositionend:s[66]||(s[66]=(...u)=>y.onEditCompositionEnd&&y.onEditCompositionEnd(...u)),onBlur:s[67]||(s[67]=(...u)=>y.onEditBlur&&y.onEditBlur(...u)),onPaste:s[68]||(s[68]=(...u)=>y.onEditPaste&&y.onEditPaste(...u))},null,44,fc),R.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:t.unref(24)+"px",height:`calc(100% - ${t.unref(24)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:s[69]||(s[69]=t.withModifiers(u=>{R.clampScroll(null,x.scrollY-50),y.scheduleRender()},["prevent"]))},[...s[98]||(s[98]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:s[71]||(s[71]=(...u)=>y.onVTrk&&y.onVTrk(...u))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:y.vThumbT+"px",height:y.vThumbH+"px"}),onMousedown:s[70]||(s[70]=(...u)=>y.onVStart&&y.onVStart(...u))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:s[72]||(s[72]=t.withModifiers(u=>{R.clampScroll(null,x.scrollY+50),y.scheduleRender()},["prevent"]))},[...s[99]||(s[99]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),R.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:t.unref(52)+"px",width:`calc(100% - ${t.unref(52)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:s[73]||(s[73]=t.withModifiers(u=>{R.clampScroll(x.scrollX-50,null),y.scheduleRender()},["prevent"]))},[...s[100]||(s[100]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:s[75]||(s[75]=(...u)=>y.onHTrk&&y.onHTrk(...u))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:y.hThumbL+"px",width:y.hThumbW+"px"}),onMousedown:s[74]||(s[74]=(...u)=>y.onHStart&&y.onHStart(...u))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:s[76]||(s[76]=t.withModifiers(u=>{R.clampScroll(x.scrollX+50,null),y.scheduleRender()},["prevent"]))},[...s[101]||(s[101]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),R.maxScrollX>0&&R.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",mc)):t.createCommentVNode("",!0)]),t.createVNode(Ea,{locale:x.locale,sheets:t.unref(X),"active-sheet-index":t.unref(Y),"ren-tab":y.renTab,"ren-tab-val":y.renTabVal,onTabClick:s[77]||(s[77]=u=>y.onTabClick(u)),onTabDblclick:s[78]||(s[78]=u=>y.onTabDblClick(u)),onTabContextmenu:s[79]||(s[79]=u=>y.onTabCtxMenu(u.ev,u.i)),onTabRenameInput:s[80]||(s[80]=u=>Oe(u)),onTabRenameKeydown:s[81]||(s[81]=u=>y.onTabRenameKd(u)),onTabRenameCommit:y.commitTabRename,onTabbarContextmenu:s[82]||(s[82]=u=>y.onTabBarCtx(u)),onDeleteSheet:s[83]||(s[83]=u=>{R.removeSheet(u),y.scheduleRender()}),onAddSheet:s[84]||(s[84]=u=>{R.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:s[85]||(s[85]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.ctxMenu.items,(u,L)=>(t.openBlock(),t.createElementBlock("div",{key:L,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":u.disabled}]),onClick:xe=>!u.disabled&&u.action&&(u.action(),He()),onMouseenter:xe=>y.onCtxItemEnter(xe,u)},[t.createElementVNode("span",hc,t.toDisplayString(u.label),1),u.children?(t.openBlock(),t.createElementBlock("svg",gc,[...s[102]||(s[102]=[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),u.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(u.children,(xe,he)=>(t.openBlock(),t.createElementBlock("div",{key:he,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":xe.disabled}]),onClick:t.withModifiers(g=>!xe.disabled&&xe.action&&(xe.action(),He()),["stop"])},t.toDisplayString(xe.label),11,yc))),128))],2)):t.createCommentVNode("",!0)],42,pc))),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:s[91]||(s[91]=t.withModifiers(()=>{},["stop"])),onClick:s[92]||(s[92]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",bc,t.toDisplayString(y.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",Cc,[t.createElementVNode("input",{ref:z,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:s[86]||(s[86]=(...u)=>y.onDimInput&&y.onDimInput(...u)),onKeydown:s[87]||(s[87]=(...u)=>y.onDimKeydown&&y.onDimKeydown(...u)),onBlur:s[88]||(s[88]=(...u)=>y.onDimBlur&&y.onDimBlur(...u))},null,42,vc)]),y.dimPanel.error?(t.openBlock(),t.createElementBlock("div",wc,t.toDisplayString(y.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",kc,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:s[89]||(s[89]=(...u)=>y.applyDimPanel&&y.applyDimPanel(...u))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:s[90]||(s[90]=(...u)=>y.closeDimPanel&&y.closeDimPanel(...u))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-c870f7c9"]]);Xt.Spreader=Bn,Xt.default=Bn,Object.defineProperties(Xt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});