xiaodao-spreader 0.1.21 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ZH.md +3 -1
- package/README.md +3 -1
- package/dist/style.css +1 -1
- package/dist/types/components/spreader/components/dropdown.vue.d.ts +7 -0
- package/dist/types/components/spreader/components/pickers/insertFunctionDialog.vue.d.ts +20 -0
- package/dist/types/components/spreader/components/pickers/sortConfirmDialog.vue.d.ts +19 -0
- package/dist/types/components/spreader/components/pickers/sortPicker.vue.d.ts +29 -0
- package/dist/types/components/spreader/components/toolbar.vue.d.ts +11 -0
- package/dist/types/components/spreader/composables/interactions.d.ts +1 -0
- package/dist/types/components/spreader/composables/sheets-ops.d.ts +14 -1
- package/dist/types/components/spreader/core/formula.d.ts +15 -0
- package/dist/types/components/spreader/core/number-format.d.ts +17 -1
- package/dist/types/components/spreader/core/sort-core.d.ts +46 -0
- package/dist/xiaodao-spreader.es.js +5299 -4502
- package/dist/xiaodao-spreader.umd.js +9 -9
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(Lt,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(Lt=typeof globalThis<"u"?globalThis:Lt||self,t(Lt.XiaoDaoSpreader={},Lt.Vue))})(this,function(Lt,t){"use strict";const vn={"zh-CN":{insert:"插入",delete:"删除",rename:"重命名",moveLeft:"左移",moveRight:"右移",cut:"剪切",copy:"复制",paste:"粘贴",addSheet:"新建工作表",sheetList:"工作表列表",moveSheetLeft:"左移",moveSheetRight:"右移",scrollUp:"向上滚动",scrollDown:"向下滚动",scrollLeft:"向左滚动",scrollRight:"向右滚动",calculate:"计算",sum:"求和",avg:"平均值",count:"计数",undo:"撤销",redo:"重做",paintFormat:"格式刷",clearFormat:"清除格式",fontFamily:"字体",fontSize:"字号",fontSizeIncrease:"增大字号",fontSizeDecrease:"减小字号",bold:"加粗",italic:"斜体",underline:"下划线",strikethrough:"删除线",fontColor:"文字颜色",fillColor:"填充颜色",borders:"边框",hAlign:"水平对齐",vAlign:"垂直对齐",alignLeft:"左端对齐",alignCenter:"居中对齐",alignRight:"右端对齐",alignTop:"顶端对齐",alignMiddle:"垂直居中",alignBottom:"底端对齐",wrap:"自动换行",mergeCells:"合并单元格",mergeCenter:"合并后居中",mergeAcross:"跨越合并",unmergeCells:"取消合并单元格",borderBottom:"下框线",borderTop:"上框线",borderLeft:"左框线",borderRight:"右框线",borderNone:"无框线",borderAll:"所有框线",borderOuter:"外框线",borderThickOuter:"粗外框线",fontDefault:"默认",rowHeight:"行高",colWidth:"列宽",autoRowHeight:"自动行高",defaultColWidth:"默认列宽",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:"分类",nfCatGeneral:"常规",nfCatNumber:"数值",nfCatCurrency:"货币",nfCatAccounting:"会计专用",nfCatFinancial:"财务",nfCatPercent:"百分比",nfCatScientific:"科学计数",nfCatDate:"日期",nfCatTime:"时间",nfCatText:"文本",nfCatCurrencyRounded:"货币取整",nfCatDateTime:"日期和时间",nfCatDuration:"持续时间",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",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",nfCatGeneral:"General",nfCatNumber:"Number",nfCatCurrency:"Currency",nfCatAccounting:"Accounting",nfCatFinancial:"Financial",nfCatPercent:"Percentage",nfCatScientific:"Scientific",nfCatDate:"Date",nfCatTime:"Time",nfCatText:"Text",nfCatCurrencyRounded:"Currency Rounded",nfCatDateTime:"Date & Time",nfCatDuration:"Duration",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,n){var o;return((o=vn[e])==null?void 0:o[n])??n}const al='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',It=10,Cn=[{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'}],wn=[{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}],kn='<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>',En='<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>',Sn='<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>',Rn='<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>',Bn='<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>',xn='<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>',Mn=[{value:"left",labelKey:"alignLeft",icon:kn},{value:"center",labelKey:"alignCenter",icon:En},{value:"right",labelKey:"alignRight",icon:Sn}],Dn=[{value:"top",labelKey:"alignTop",icon:Rn},{value:"middle",labelKey:"alignMiddle",icon:Bn},{value:"bottom",labelKey:"alignBottom",icon:xn}],Kl=[{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>'}],Tn={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)"},Nn={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)"},At="__nf_custom__",kt="",Vt="",bt="@",kl="__NF_INVALID__",El=2958465,Sl=0;function vt(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function Rl(e){return e==="zh-CN"?"¥":"$"}function In(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Ul(e){return e.replace(/"([^"]*)"/g,"$1")}function An(e){let n=e,o;const l=n.match(/^\[([^\]]+)\]/);l&&(o=l[1].toLowerCase(),n=n.slice(l[0].length)),n=In(n);const a=/E[+-]/i.test(n),i=n.includes("%"),r=n.search(/[0#?]/);if(r===-1)return{hasDigits:!1,decimals:0,minDecimals:0,minIntDigits:0,thousands:!1,scale:i?100:1,scientific:!1,prefix:n,suffix:"",color:o};let h=-1;for(let ne=n.length-1;ne>=0;ne--){const se=n[ne];if(se==="0"||se==="#"||se==="?"||se==="E"){h=ne;break}}h<0&&(h=r);const c=r>0?n.slice(0,r):"",y=h<n.length-1?n.slice(h+1):"",S=n.slice(r,h+1),x=/[0#?]/.test(S),C=S.includes(",");let R=S.replace(/,/g,"");if(a){const ne=R.search(/E/i);ne>=0&&(R=R.slice(0,ne))}const Z=R.indexOf("."),Q=Z>=0?R.slice(0,Z):R,g=Z>=0?R.slice(Z+1):"",F=(g.match(/[0#?]/g)||[]).length,X=(g.match(/0/g)||[]).length,me=(Q.match(/0/g)||[]).length;return{hasDigits:x,decimals:F,minDecimals:X,minIntDigits:me,thousands:C,scale:i?100:1,scientific:a,prefix:c,suffix:y,color:o}}function Vn(e){const n=[];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,n.push({type:"hour",len:0});break;case"[mm]":o=!0,n.push({type:"minute",len:2});break;case"[ss]":o=!0,n.push({type:"second",len:2});break;case"yyyy":n.push({type:"year",len:4});break;case"yy":case"y":n.push({type:"year",len:2});break;case"mmmm":n.push({type:"monthName",len:4});break;case"mmm":n.push({type:"monthName",len:3});break;case"mm":n.push({type:"month",len:2});break;case"m":n.push({type:"month",len:1});break;case"dddd":n.push({type:"weekday",len:4});break;case"ddd":n.push({type:"weekday",len:3});break;case"dd":n.push({type:"day",len:2});break;case"d":n.push({type:"day",len:1});break;case"hh":n.push({type:"hour",len:2});break;case"h":n.push({type:"hour",len:1});break;case"ss":n.push({type:"second",len:2});break;case"s":n.push({type:"second",len:1});break;case"AM/PM":case"am/pm":n.push({type:"ampm",len:2});break;default:i.startsWith('"')?n.push({type:"literal",text:Ul(i),len:0}):n.push({type:"literal",text:i,len:0})}}return{tokens:n,isDuration:o}}const Pl=new Map;function Fn(e){const n=e.replace(/\[[^\]]*\]/gi,i=>/^\[(h|mm|ss)\]$/i.test(i)?i:"");if(/[ydhs]/.test(n)||/AM\/PM/i.test(n)||/\[h\]/i.test(n)){const i=e.split(";")[0]??e,{tokens:r,isDuration:h}=Vn(i);return{kind:h?"duration":"date",sections:[],tokens:r,isDuration:h,raw:e}}return{kind:"number",sections:e.split(";").map(i=>An(i)),tokens:[],isDuration:!1,raw:e}}function $t(e){const n=Pl.get(e);if(n)return n;const o=Fn(e);return Pl.set(e,o),o}function Gl(e,n,o,l,a){const i=Math.pow(10,n),r=Math.round((e+Number.EPSILON)*i)/i,h=r<0,c=Math.abs(r);let S=new Intl.NumberFormat("en-US",{useGrouping:l,minimumIntegerDigits:a,minimumFractionDigits:n,maximumFractionDigits:n}).format(c);if(o<n&&n>0){const C=S.indexOf(".");if(C>=0){const b=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?`${b}.${R}`:b}}return`${h?"-":""}${S}`}function Yl(e,n){if(e===0)return(n>0?"0."+"0".repeat(n):"0")+"E+00";const o=Math.floor(Math.log10(Math.abs(e))),l=e/Math.pow(10,o),a=Gl(l,n,n,!1,1),i=(o>=0?"+":"-")+String(Math.abs(o)).padStart(2,"0");return`${a}E${i}`}function Hn(e,n,o){if(!o.hasDigits)return Ul(o.prefix+o.suffix);const l=o.scale===100?e*100:e,a=o.scientific?Yl(l,o.decimals):Gl(l,o.decimals,o.minDecimals,o.thousands,o.minIntDigits);return n+o.prefix+a+o.suffix}function On(e,n){const o=n.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),Hn(a,i,l)}function Ln(e){return new Date((e-25569)*864e5)}const $n=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],zn=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Xl=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],Wn=["January","February","March","April","May","June","July","August","September","October","November","December"],_n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],jl=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function qt(e,n){return String(e).padStart(n,"0")}function Kn(e,n,o,l){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),h=e.getUTCDay(),c=o==="zh-CN";let y="",S=!1;for(const x of n)switch(x.type){case"literal":y+=x.text??"";break;case"year":y+=x.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":y+=qt(S?e.getUTCMinutes():i,x.len);break;case"monthName":y+=x.len>=4?c?$n[i-1]:Wn[i-1]:c?zn[i-1]:_n[i-1];break;case"day":y+=qt(r,x.len);break;case"weekday":y+=x.len>=4?c?Xl[h]:jl[h]:c?Xl[h].slice(2):jl[h].slice(0,3);break;case"hour":{let C=e.getUTCHours();if(x.len===0){const b=Math.floor(l*86400);C=Math.floor(b/3600)}y+=String(C),S=!0;break}case"minute":y+=qt(e.getUTCMinutes(),x.len);break;case"second":y+=qt(e.getUTCSeconds(),x.len);break;case"ampm":{const C=e.getUTCHours();y+=C<12?c?"上午":"AM":c?"下午":"PM";break}}return y}function Un(e,n){const o=Math.floor(e*86400),l=Math.floor(o/3600),a=Math.floor(o%3600/60),i=o%60;let r="";for(const h of n)switch(h.type){case"literal":r+=h.text??"";break;case"hour":r+=String(l);break;case"minute":r+=qt(a,h.len||2);break;case"second":r+=qt(i,h.len||2);break;default:r+=""}return r}function Pn(e){if(e==="")return e;const n=Number(e);if(!isNaN(n)&&e.trim()!==""){const o=Math.abs(n);return o!==0&&(o>=1e15||o<1e-9)?Yl(n,9):e}return e}function Bl(e,n,o){if(vt(n))return Pn(e);if(n==null||n===bt)return e;const l=$t(n);if(l.kind==="date"||l.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(l.kind==="date"){if(i<Sl||i>El)return kl}else if(i<0)return kl;return l.kind==="duration"?Un(i,l.tokens):Kn(Ln(i),l.tokens,o,i)}const a=Number(e);return isNaN(a)?e:On(a,l)}const Gn=["general","number","currency","currencyRounded","accounting","financial","percent","scientific","date","time","dateTime","duration","text","custom"];function Zl(e,n){if(n===bt||n==="@")return!1;if(vt(n)){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}const o=$t(n);return!!(o.kind==="number"&&ql(o))}function ql(e){return e.sections.some(n=>n.hasDigits)}function Yn(e){if(e==null||vt(e)||e===bt||e==="@")return!1;const n=$t(e);return!!(n.kind==="date"||n.kind==="duration"||n.kind==="number"&&ql(n))}function Xn(e,n){if(n==null||vt(n)||n===bt||n==="@")return!1;const o=$t(n),l=Number(e);return Number.isFinite(l)?o.kind==="date"?l<Sl||l>El:o.kind==="duration"?l<0:!1:!1}const xl=30,Ml=0;function Dl(e){if(e==null||e===""||e.trim()==="")return!1;const n=Number(e);return!Number.isNaN(n)&&Number.isFinite(n)}function Jl(e,n){if(e==null||e===kt||vt(e))return Dl(n);if(e===bt)return!1;const o=$t(e);return o.kind==="date"||o.kind==="duration"?!1:o.sections.some(l=>l.hasDigits)}function jn(e,n){if(!Jl(e,n))return-1;if(e==null||e===kt||vt(e))return 0;const l=$t(e).sections.find(a=>a.hasDigits);return l?l.decimals:-1}function Zn(e,n){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),r=e.slice(o),h=r.search(/[0#?]/);if(h===-1)return e;let c=-1;for(let Q=r.length-1;Q>=0;Q--){const g=r[Q];if(g==="0"||g==="#"||g==="?"||g==="E"){c=Q;break}}if(c<h)return e;const y=r.slice(h,c+1),S=y.search(/E[+-]/i),x=S>=0?y.slice(0,S):y,C=x.indexOf("."),b=C>=0?(x.slice(C+1).match(/[0#?]/g)||[]).length:0;if(b===n)return e;let R;if(C<0)R=n>0?x+"."+"0".repeat(n):x;else if(n>b)R=x+"0".repeat(n-b);else{let Q=b-n;const g=x.split("");for(let F=g.length-1;F>=0&&Q>0;F--){const X=g[F];(X==="0"||X==="#"||X==="?")&&(g.splice(F,1),Q--)}R=g.join(""),n===0&&R.endsWith(".")&&(R=R.slice(0,-1))}const Z=R+(S>=0?y.slice(S):"");return i+r.slice(0,h)+Z+r.slice(c+1)}function qn(e,n){if(!Number.isInteger(n)||n<Ml||n>xl||e===kt)return null;if(e==null||vt(e))return n>0?"0."+"0".repeat(n):"0";if(e===bt)return null;const o=$t(e);return o.kind==="date"||o.kind==="duration"||!o.sections.some(l=>l.hasDigits)?null:e.split(";").map(l=>Zn(l,n)).join(";")}const Jn=["¥","$","€","£"];function Ql(e,n){if(e==null||e===kt)return e??Vt;if(vt(e))return Vt;if(e===bt||e==="@")return bt;const o=Rl(n),l=n==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",a=n==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",i=`${o}#,##0.00;(${o}#,##0.00);${o}"-"`,r="#,##0.00;[Red](#,##0.00)";if(en(n).some(b=>b.value===e))return e;const c=e.replace(/\[[^\]]*\]/gi,b=>/^\[(h|mm|ss)\]$/i.test(b)?b:"");if(/\[(h|mm|ss)\]/i.test(c)&&!/[yd]/i.test(c))return"[h]:mm:ss";const y=/[yd]/i.test(c),S=/h|s|AM\/PM/i.test(c);if(y&&S)return a;if(y||/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 r;const x=Jn.find(b=>e.startsWith(b));if(x)return e.includes("(")?i:/\.\d/.test(e.slice(x.length))?o+"#,##0.00":o+"#,##0";const C=$t(e);return C.kind==="number"&&C.sections.some(b=>b.hasDigits)?"#,##0.00":At}function Qn(e,n){return new Date(Date.UTC(e,n,0)).getUTCDate()}function eo(e,n,o){const l=Date.UTC(e,n-1,o)/864e5+25569;return l<=60?l-1:l}function to(e,n,o=new Date){const l=e.trim();if(!l||l.startsWith("=")||Dl(l))return null;const a=n==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",i=n==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",r="h:mm:ss";function h(C){const b=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(C);if(!b)return null;const R=Number(b[1]),Z=Number(b[2]),Q=b[3]!==void 0?Number(b[3]):0;return R>23||Z>59||Q>59?null:(R*3600+Z*60+Q)/86400}function c(C){let b=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(C),R,Z,Q;if(b)R=Number(b[1]),Z=Number(b[2]),Q=Number(b[3]);else if(b=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(C))R=Number(b[1]),Z=Number(b[2]),Q=Number(b[3]);else if(b=/^(\d{1,2})[-/](\d{1,2})$/.exec(C))R=o.getUTCFullYear(),Z=Number(b[1]),Q=Number(b[2]);else return null;if(R<1900||R>9999||Z<1||Z>12||Q<1||Q>Qn(R,Z))return null;const g=eo(R,Z,Q);return g>=Sl&&g<=El?g:null}const y=h(l);if(y!==null)return{serial:y,format:r};const S=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(l);if(S){const C=c(S[1].trim()),b=h(S[2]);if(C!==null&&b!==null)return{serial:C+b,format:i}}const x=c(l);return x!==null?{serial:x,format:a}:null}function lo(e,n,o,l){const a=Rl(e),i=l?"#,##0":"0",r=o>0?"."+"0".repeat(o):"",h=i+r;switch(n){case"general":return"";case"text":return bt;case"custom":return"";case"number":return h;case"percent":return h+"%";case"scientific":return"0."+"0".repeat(o)+"E+00";case"currency":return a+h;case"currencyRounded":return a+(l?"#,##0":"0");case"accounting":return`${a}${h};(${a}${h});${a}"-"`;case"financial":return`${h};[Red](${h})`;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 en(e){const n=Rl(e);return[{label:T(e,"nfGeneral"),value:Vt},{label:T(e,"nfText"),value:bt},{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:`${n}#,##0.00;(${n}#,##0.00);${n}"-"`},{label:T(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:T(e,"nfCurrency"),value:n+"#,##0.00"},{label:T(e,"nfCurrencyRounded"),value:n+"#,##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:At}]}const no=["title"],oo=["innerHTML"],ro={key:1,class:"sp-dropdown__value"},ao=["disabled"],io=["onClick"],co=["innerHTML"],so={class:"sp-dropdown__item-label"},uo=["disabled"],fo=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:""}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:n}){const o=e,l=n,a=t.ref(!1),i=t.ref(0),r=t.ref(null),h=t.ref(null),c=t.ref(null),y=t.ref({top:0,up:!1}),S=t.ref(0),x=t.ref(!1),C=t.computed(()=>o.options.find(q=>String(q.value)===String(o.modelValue))),b=t.computed(()=>o.menuWidth),R=t.computed(()=>Math.min(o.visibleCount,o.options.length)),Z=t.computed(()=>o.options.slice(i.value,i.value+R.value)),Q=t.computed(()=>i.value>0),g=t.computed(()=>i.value+R.value<o.options.length),F=t.computed(()=>o.options.length>R.value);function X(q){i.value=Math.max(0,Math.min(o.options.length-R.value,i.value+q))}function me(){a.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0);const q=o.triggerEl??r.value;if(!q)return;const be=q.getBoundingClientRect(),oe=R.value*22+(F.value?2*15:0)+8,m=window.innerHeight-be.bottom-4<oe&&be.top-4>oe;o.align==="right"?y.value={right:window.innerWidth-be.right,top:m?be.top-oe-4:be.bottom+4,up:m}:y.value={left:be.left,top:m?be.top-oe-4:be.bottom+4,up:m};const p=o.options.findIndex(N=>String(N.value)===String(o.modelValue));i.value=p>=0?Math.max(0,Math.min(p-Math.floor(R.value/2),o.options.length-R.value)):0}function ne(){a.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function se(){a.value?ne():me()}function ue(q){l("update:modelValue",q.value),l("change",q.value),ne()}function pe(q){var oe,s;if(!a.value)return;const be=q.target;(oe=r.value)!=null&&oe.contains(be)||(s=c.value)!=null&&s.contains(be)||ne()}function Ne(q){a.value&&(q.preventDefault(),X(q.deltaY>0?1:-1))}t.watch(a,q=>{t.nextTick(()=>{var be,oe;q?((be=h.value)==null||be.addEventListener("wheel",Ne,{passive:!1}),document.addEventListener("keydown",Ae)):((oe=h.value)==null||oe.removeEventListener("wheel",Ne),document.removeEventListener("keydown",Ae))})});function Ae(q){a.value&&q.key==="Escape"&&ne()}t.watch(()=>o.modelOpen,q=>{q!==void 0&&q!==a.value&&(q?me():ne())});function Pe(q){a.value&&(S.value=q.touches[0].clientY,x.value=!0)}function He(q){if(!a.value||!x.value)return;const be=q.touches[0].clientY-S.value;Math.abs(be)>5&&(X(be<0?1:-1),S.value=q.touches[0].clientY)}function we(){x.value=!1}function re(q){q.key==="Escape"&&ne()}return t.onMounted(()=>{document.addEventListener("pointerdown",pe),window.addEventListener("resize",ne),window.addEventListener("scroll",ne,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",pe),document.removeEventListener("keydown",Ae),window.removeEventListener("resize",ne),window.removeEventListener("scroll",ne,!0)}),(q,be)=>{var oe,s;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:se},[(oe=C.value)!=null&&oe.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:C.value.icon},null,8,oo)):(t.openBlock(),t.createElementBlock("span",ro,t.toDisplayString(((s=C.value)==null?void 0:s.label)??e.fallbackLabel),1)),be[3]||(be[3]=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,no)),(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":y.value.up}]),style:t.normalizeStyle({left:y.value.left!==void 0?y.value.left+"px":void 0,right:y.value.right!==void 0?y.value.right+"px":void 0,top:y.value.top+"px",minWidth:b.value!==void 0?typeof b.value=="number"?b.value+"px":b.value:void 0}),onKeydown:re,onMousedown:be[2]||(be[2]=t.withModifiers(()=>{},["prevent"]))},[F.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!Q.value}]),disabled:!Q.value,onClick:be[0]||(be[0]=m=>X(-1))},[...be[4]||(be[4]=[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,ao)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:h,class:"sp-dropdown__list",onTouchstart:Pe,onTouchmove:He,onTouchend:we},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Z.value,m=>(t.openBlock(),t.createElementBlock("button",{key:String(m.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(m.value)===String(e.modelValue)}]),onClick:p=>ue(m)},[m.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:m.icon},null,8,co)):t.createCommentVNode("",!0),t.createElementVNode("span",so,t.toDisplayString(m.label),1)],10,io))),128))],544),F.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!g.value}]),disabled:!g.value,onClick:be[1]||(be[1]=m=>X(1))},[...be[5]||(be[5]=[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,uo)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),Et=(e,n)=>{const o=e.__vccOpts||e;for(const[l,a]of n)o[l]=a;return o},il=Et(fo,[["__scopeId","data-v-0152ad1e"]]),mo=["title","onClick"],tn=Et(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:n,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"}]],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"}]],h=t.computed(()=>l.colorKey==="fill"?r:i);function c(F){return T(l.locale,F)}function y(F){const X=l.currentColor;return!X&&!F?!0:X?X.toLowerCase()===F.toLowerCase():!1}const S=t.ref(!1),x=t.ref(null),C=t.ref(null),b=t.ref({top:0});t.watch(()=>l.modelOpen,F=>{F!==void 0&&F!==S.value&&(F?Z():Q())});function R(F){const X=x.value,me=C.value,ne=F.target;X&&X.contains(ne)||me&&me.contains(ne)||Q()}function Z(){S.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const F=l.triggerEl??x.value;if(F){const X=F.getBoundingClientRect(),me=150,ne=120;let se=window.innerWidth-X.right,ue=X.bottom+4,pe;X.left-ne<4&&(se=void 0,pe=Math.max(4,X.left)),ue+me>window.innerHeight-4&&(ue=X.top-me-4),ue<4&&(ue=4),b.value=se!==void 0?{right:se,top:ue}:{left:pe,top:ue}}document.addEventListener("pointerdown",R)})}function Q(){S.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",R)}function g(F){a("update:modelValue",F),a("change",F),Q()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",R)}),n({open:S,openMenu:Z,close:Q}),(F,X)=>(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:b.value.left!==void 0?b.value.left+"px":void 0,right:b.value.right!==void 0?b.value.right+"px":void 0,top:b.value.top+"px"}),onMousedown:X[0]||(X[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,(me,ne)=>(t.openBlock(),t.createElementBlock("div",{key:ne,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(me,se=>(t.openBlock(),t.createElementBlock("button",{key:se.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":y(se.value)}]),title:c(se.key),style:t.normalizeStyle({background:se.value||"transparent",border:se.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:ue=>g(se.value)},null,14,mo))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-70f3dfdc"]]),po=["title","onClick"],ho={viewBox:"0 0 30 30",class:"border-picker__icon"},go=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],yo={class:"border-picker__label"},bo=Et(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:n,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"}],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}],h={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 y(F,X){return c[F].includes(X)?"thick":h[F].includes(X)?"solid":"dashed"}const S=t.ref(!1),x=t.ref(null),C=t.ref(null),b=t.ref({top:0});t.watch(()=>l.modelOpen,F=>{F!==void 0&&F!==S.value&&(F?Z():Q())});function R(F){const X=x.value,me=C.value,ne=F.target;X&&X.contains(ne)||me&&me.contains(ne)||Q()}function Z(){S.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const F=l.triggerEl??x.value;if(F){const X=F.getBoundingClientRect(),me=200,ne=160;let se=window.innerWidth-X.right,ue=X.bottom+4,pe;X.left-ne<4&&(se=void 0,pe=Math.max(4,X.left)),ue+me>window.innerHeight-4&&(ue=X.top-me-4),ue<4&&(ue=4),b.value=se!==void 0?{right:se,top:ue}:{left:pe,top:ue}}document.addEventListener("pointerdown",R)})}function Q(){S.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",R)}function g(F){a("change",F),Q()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",R)}),n({open:S,openMenu:Z,close:Q}),(F,X)=>(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:b.value.left!==void 0?b.value.left+"px":void 0,right:b.value.right!==void 0?b.value.right+"px":void 0,top:b.value.top+"px"}),onMousedown:X[0]||(X[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,me=>t.createElementVNode("button",{key:me.key,class:"border-picker__item",title:t.unref(T)(e.locale,me.i18nKey),onClick:ne=>g(me.key)},[(t.openBlock(),t.createElementBlock("svg",ho,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,ne=>t.createElementVNode("line",{key:ne.name,x1:ne.x1,y1:ne.y1,x2:ne.x2,y2:ne.y2,stroke:"currentColor","stroke-width":y(me.key,ne.name)==="thick"?3:1.5,"stroke-dasharray":y(me.key,ne.name)==="dashed"?"0 4":"none","stroke-linecap":y(me.key,ne.name)==="dashed"?"round":"square"},null,8,go)),64))])),t.createElementVNode("span",yo,t.toDisplayString(t.unref(T)(e.locale,me.i18nKey)),1)],8,po)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-551c0ffe"]]),vo=["title","onClick"],Co=["innerHTML"],wo={class:"merge-picker__label"},ko=Et(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:n,emit:o}){const l=e,a=o,i=t.ref(!1),r=t.ref(null),h=t.ref(null),c=t.ref({top:0});t.watch(()=>l.modelOpen,b=>{b!==void 0&&b!==i.value&&(b?S():x())});function y(b){const R=r.value,Z=h.value,Q=b.target;R&&R.contains(Q)||Z&&Z.contains(Q)||x()}function S(){i.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const b=l.triggerEl??r.value;if(b){const R=b.getBoundingClientRect(),Z=Kl.length*30+12,Q=160;let g=window.innerWidth-R.right,F=R.bottom+4,X;R.left-Q<4&&(g=void 0,X=Math.max(4,R.left)),F+Z>window.innerHeight-4&&(F=R.top-Z-4),F<4&&(F=4),c.value=g!==void 0?{right:g,top:F}:{left:X,top:F}}document.addEventListener("pointerdown",y)})}function x(){i.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",y)}function C(b){a("change",b),x()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",y)}),n({open:i,openMenu:S,close:x}),(b,R)=>(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:h,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(Kl),Z=>(t.openBlock(),t.createElementBlock("button",{key:Z.key,class:"merge-picker__item",title:t.unref(T)(e.locale,Z.labelKey),onClick:Q=>C(Z.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:Z.icon},null,8,Co),t.createElementVNode("span",wo,t.toDisplayString(t.unref(T)(e.locale,Z.labelKey)),1)],8,vo))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-edd36208"]]),Eo=["disabled","title","onClick"],So={class:"calc-picker__label"},Ro=Et(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:n,emit:o}){const l=e,a=o,i=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),h=t.ref(null),c=t.ref(null),y=t.ref({top:0});t.watch(()=>l.modelOpen,R=>{R!==void 0&&R!==r.value&&(R?x():C())});function S(R){const Z=h.value,Q=c.value,g=R.target;Z&&Z.contains(g)||Q&&Q.contains(g)||C()}function x(){r.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const R=l.triggerEl??h.value;if(R){const Z=R.getBoundingClientRect(),Q=i.length*30+12,g=160;let F=window.innerWidth-Z.right,X=Z.bottom+4,me;Z.left-g<4&&(F=void 0,me=Math.max(4,Z.left)),X+Q>window.innerHeight-4&&(X=Z.top-Q-4),X<4&&(X=4),y.value=F!==void 0?{right:F,top:X}:{left:me,top:X}}document.addEventListener("pointerdown",S)})}function C(){r.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",S)}function b(R){l.disabled||(a("change",R),C())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",S)}),n({open:r,openMenu:x,close:C}),(R,Z)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:h,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:y.value.left!==void 0?y.value.left+"px":void 0,right:y.value.right!==void 0?y.value.right+"px":void 0,top:y.value.top+"px"}),onMousedown:Z[0]||(Z[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,Q=>t.createElementVNode("button",{key:Q.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(T)(e.locale,Q.labelKey),onClick:g=>b(Q.key)},[t.createElementVNode("span",So,t.toDisplayString(t.unref(T)(e.locale,Q.labelKey)),1)],10,Eo)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-01a18e00"]]),Bo={class:"tb-item","data-key":"undo"},xo=["title","disabled"],Mo={class:"tb-item","data-key":"redo"},Do=["title","disabled"],To={class:"tb-item","data-key":"paint"},No=["title","disabled"],Io={class:"tb-item","data-key":"clear"},Ao=["title","disabled"],Vo={class:"tb-item","data-key":"font"},Fo={class:"tb-item","data-key":"fontSize"},Ho={class:"toolbar-font-size"},Oo=["value","title"],Lo=["title"],$o=["title","disabled"],zo=["title","disabled"],Wo={class:"tb-item","data-key":"bold"},_o=["title","disabled"],Ko={class:"tb-item","data-key":"italic"},Uo=["title","disabled"],Po={class:"tb-item","data-key":"underline"},Go=["title","disabled"],Yo={class:"tb-item","data-key":"strike"},Xo=["title","disabled"],jo={class:"tb-item","data-key":"textColor"},Zo={class:"toolbar-split"},qo=["title","disabled"],Jo={viewBox:"0 0 1024 1024",fill:"currentColor"},Qo=["fill"],er=["title","disabled"],tr={class:"tb-item","data-key":"fillColor"},lr={class:"toolbar-split"},nr=["title","disabled"],or={viewBox:"0 0 1024 1024",fill:"currentColor"},rr=["fill"],ar=["title","disabled"],ir={class:"tb-item","data-key":"border"},cr={class:"toolbar-split"},sr=["title","disabled"],dr={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},ur=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],fr=["title","disabled"],mr={class:"tb-item","data-key":"hAlign"},pr={class:"tb-item","data-key":"vAlign"},hr={class:"tb-item","data-key":"wrap"},gr=["title"],yr={class:"tb-item","data-key":"merge"},br={class:"toolbar-split"},vr=["title","disabled"],Cr=["title","disabled"],wr={class:"tb-item","data-key":"numFmt"},kr=["title","disabled"],Er=["title","disabled"],Sr={class:"tb-item","data-key":"calc"},Rr={class:"toolbar-split"},Br=["title","disabled"],xr=["title","disabled"],Mr={class:"tb-item","data-key":"find"},Dr=["title"],Tl=2,Tr=6,Nr=34,Ir=Et(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:{},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","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:merge-menu-open","update:calc-menu-open","border-change","merge-change"],setup(e,{emit:n}){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(K,u){return a[K].includes(u)?"thick":l[K].includes(u)?"solid":"dashed"}const r=["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","find"],h=t.ref(null),c=t.ref(null),y=t.ref(null),S=t.ref(null),x=t.ref(null),C=t.ref(null),b=t.ref(null),R=t.ref(null),Z=t.ref(null),Q=t.ref(new Set),g=t.ref(!1),F=t.ref(!1),X=t.ref(0),me=new Map,ne=t.computed(()=>Q.value.size>0);function se(K){return Q.value.has(K)}const ue=t.computed(()=>{const K=c.value;return K instanceof HTMLElement?K:void 0});function pe(K){return ue.value?!se(K):!0}function Ne(){for(const K of r){const u=me.get(K);if(u===void 0||u===0)return!0}return!1}function Ae(){if(!h.value)return;h.value.querySelectorAll(".tb-item").forEach(u=>{const M=u.dataset.key;if(!M)return;const le=u.offsetWidth;le>0?me.set(M,le):me.has(M)||me.set(M,0)})}function Pe(K,u){if(K.size!==u.size)return!1;for(const M of K)if(!u.has(M))return!1;return!0}let He=0,we=0;function re(){He&&cancelAnimationFrame(He),!(we>60)&&(we++,He=requestAnimationFrame(()=>requestAnimationFrame(q)))}function q(){if(!h.value)return;const K=h.value.clientWidth-Tr*2;if(K<=0){re();return}we=0,(me.size===0||Ne())&&Ae();let u=0;for(const le of r)u+=(me.get(le)??0)+Tl;const M=new Set;if(u>K){const le=K-Nr-Tl;let ie=0;for(let P=0;P<r.length;P++){const xe=r[P],$e=(me.get(xe)??0)+Tl;if(ie+$e>le){for(let Ze=P;Ze<r.length;Ze++)M.add(r[Ze]);break}ie+=$e}}Pe(M,Q.value)||(Q.value=M,X.value++,M.size===0&&(g.value=!1))}let be=null;const oe=t.ref(0),s=t.computed(()=>{const K=y.value,u={position:"fixed",top:"0px",right:"0px"};if(!K)return{...W.themeVars,...u};oe.value;const M=K.getBoundingClientRect();return{...W.themeVars,position:"fixed",top:`${M.bottom+4}px`,right:`${window.innerWidth-M.right}px`}});function m(){g.value&&(oe.value++,t.nextTick(()=>q()))}function p(K){var M,le;if(!g.value)return;const u=K.target;(M=c.value)!=null&&M.contains(u)||(le=y.value)!=null&&le.contains(u)||(F.value=!0,g.value=!1,t.nextTick(()=>{F.value=!1}))}function N(){g.value=!g.value}function A(){g.value=!1,k("find")}t.onMounted(()=>{re(),h.value&&(be=new ResizeObserver(()=>{g.value||re()}),be.observe(h.value)),document.addEventListener("pointerdown",p,!0),window.addEventListener("resize",m),window.addEventListener("load",re),window.addEventListener("orientationchange",re)}),t.onBeforeUnmount(()=>{He&&cancelAnimationFrame(He),be==null||be.disconnect(),document.removeEventListener("pointerdown",p,!0),window.removeEventListener("resize",m),window.removeEventListener("load",re),window.removeEventListener("orientationchange",re)});const W=e,k=n,he=t.computed(()=>W.selNumberFormat===kt?T(W.locale,"nfMixed"):"");return(K,u)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:h,class:"toolbar",onMousedown:u[47]||(u[47]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("undo"),to:ue.value},[t.createElementVNode("div",Bo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(T)(e.locale,"undo"),disabled:!e.canUndo,onClick:u[0]||(u[0]=M=>k("undo"))},[...u[49]||(u[49]=[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,xo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("redo"),to:ue.value},[t.createElementVNode("div",Mo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(T)(e.locale,"redo"),disabled:!e.canRedo,onClick:u[1]||(u[1]=M=>k("redo"))},[...u[50]||(u[50]=[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,Do)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("paint"),to:ue.value},[t.createElementVNode("div",To,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(T)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:u[2]||(u[2]=M=>k("paint-format"))},[...u[51]||(u[51]=[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,No)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("clear"),to:ue.value},[t.createElementVNode("div",Io,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(T)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:u[3]||(u[3]=M=>k("clear-format"))},[...u[52]||(u[52]=[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,Ao)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep1"),to:ue.value},[u[53]||(u[53]=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:pe("font"),to:ue.value},[t.createElementVNode("div",Vo,[t.createVNode(il,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:se("font")?"100%":110,"menu-width":se("font")?120:void 0,"visible-count":8,title:t.unref(T)(e.locale,"fontFamily"),align:"right",onChange:u[4]||(u[4]=M=>k("font-family-change",M))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("fontSize"),to:ue.value},[t.createElementVNode("div",Fo,[t.createElementVNode("div",Ho,[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:u[5]||(u[5]=t.withModifiers(()=>{},["stop"])),onInput:u[6]||(u[6]=M=>k("font-size-input",M.target.value)),onBlur:u[7]||(u[7]=M=>k("font-size-blur")),onKeydown:u[8]||(u[8]=M=>k("font-size-keydown",M))},null,40,Oo),t.createVNode(il,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:se("fontSize")?"100%":56,"menu-width":se("fontSize")?120:56,"visible-count":9,title:t.unref(T)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":Z.value,"onUpdate:modelOpen":u[9]||(u[9]=M=>k("update:font-size-menu-open",M)),onChange:u[10]||(u[10]=M=>k("font-size-change",M))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:Z,class:"toolbar-font-size__btn",type:"button",title:t.unref(T)(e.locale,"fontSize"),onMousedown:u[11]||(u[11]=t.withModifiers(()=>{},["prevent"])),onClick:u[12]||(u[12]=M=>k("font-size-toggle"))},[...u[54]||(u[54]=[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,Lo),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(T)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:u[13]||(u[13]=t.withModifiers(()=>{},["prevent"])),onClick:u[14]||(u[14]=M=>k("font-size-step-down"))},[...u[55]||(u[55]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-177c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h177c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z"})],-1)])],40,$o),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(T)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:u[15]||(u[15]=t.withModifiers(()=>{},["prevent"])),onClick:u[16]||(u[16]=M=>k("font-size-step-up"))},[...u[56]||(u[56]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-59v-59c0-16.29-13.21-29.5-29.5-29.5s-29.5 13.21-29.5 29.5v59h-59c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h59v59c0 16.29 13.21 29.5 29.5 29.5s29.5-13.21 29.5-29.5v-59h59c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z"})],-1)])],40,zo)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep2"),to:ue.value},[u[57]||(u[57]=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:pe("bold"),to:ue.value},[t.createElementVNode("div",Wo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(T)(e.locale,"bold"),disabled:!e.hasSelection,onClick:u[17]||(u[17]=M=>k("bold-toggle"))},[...u[58]||(u[58]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M733.610667 467.712A267.562667 267.562667 0 0 0 548.010667 10.581333H183.466667a53.333333 53.333333 0 0 0 0 106.666667h43.221333a10.666667 10.666667 0 0 1 10.666667 10.666667V896a10.666667 10.666667 0 0 1-10.666667 10.666667H183.466667a53.333333 53.333333 0 1 0 0 106.666666h425.088a287.658667 287.658667 0 0 0 125.013333-545.536z m-185.6-350.464a160.512 160.512 0 0 1 0 320.981333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666V128a10.666667 10.666667 0 0 1 10.666667-10.666667z m60.586666 789.333333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666v-340.352a10.666667 10.666667 0 0 1 10.666667-10.666667H608.597333a180.864 180.864 0 0 1 0 361.685333z"})])],-1)])],10,_o)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("italic"),to:ue.value},[t.createElementVNode("div",Ko,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(T)(e.locale,"italic"),disabled:!e.hasSelection,onClick:u[18]||(u[18]=M=>k("italic-toggle"))},[...u[59]||(u[59]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M960 10.581333h-325.845333a53.333333 53.333333 0 0 0 0 106.666667h46.336a10.666667 10.666667 0 0 1 9.002666 16.384L203.946667 896.725333a21.333333 21.333333 0 0 1-18.005334 9.856H64a53.333333 53.333333 0 0 0 0 106.666667h325.845333a53.333333 53.333333 0 0 0 0-106.666667H343.509333a10.666667 10.666667 0 0 1-9.002666-16.384L820.053333 127.146667a21.333333 21.333333 0 0 1 18.005334-9.898667H960a53.333333 53.333333 0 0 0 0-106.666667z"})])],-1)])],10,Uo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("underline"),to:ue.value},[t.createElementVNode("div",Po,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(T)(e.locale,"underline"),disabled:!e.hasSelection,onClick:u[19]||(u[19]=M=>k("underline-toggle"))},[...u[60]||(u[60]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M960 906.581333h-896a53.333333 53.333333 0 0 0 0 106.666667h896a53.333333 53.333333 0 0 0 0-106.666667zM84.394667 117.248h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a358.784 358.784 0 0 0 717.568 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667h58.154666a53.333333 53.333333 0 0 0 0-106.666666H695.466667a53.333333 53.333333 0 0 0 0 106.666666h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a252.117333 252.117333 0 0 1-504.234667 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667H328.533333a53.333333 53.333333 0 1 0 0-106.666666H84.394667a53.333333 53.333333 0 0 0 0 106.666666z"})])],-1)])],10,Go)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("strike"),to:ue.value},[t.createElementVNode("div",Yo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(T)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:u[20]||(u[20]=M=>k("strikethrough-toggle"))},[...u[61]||(u[61]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M1013.333333 552.618667A53.333333 53.333333 0 0 0 960 499.2h-381.269333a20.992 20.992 0 0 1-12.032-3.84c-30.805333-21.888-63.232-41.856-94.634667-61.098667-119.466667-73.173333-192-123.733333-192-207.488 0-95.36 94.165333-109.610667 150.314667-109.610666a193.706667 193.706667 0 0 1 131.456 32.597333 113.578667 113.578667 0 0 1 19.072 84.906667v12.8a53.333333 53.333333 0 1 0 106.666666 0v-11.434667a208.512 208.512 0 0 0-49.706666-161.152C595.157333 31.616 527.317333 10.581333 430.549333 10.581333c-156.074667 0-256.981333 84.864-256.981333 216.277334 0 118.314667 80.725333 192.512 170.666667 252.885333a10.666667 10.666667 0 0 1-5.930667 19.541333H64a53.333333 53.333333 0 0 0 0 106.666667h468.352a10.709333 10.709333 0 0 1 6.784 2.474667 185.130667 185.130667 0 0 1 82.432 147.882666c0 139.434667-146.176 150.272-191.018667 150.272-77.397333 0-133.930667-17.28-163.584-50.048a144.810667 144.810667 0 0 1-27.733333-115.2 53.333333 53.333333 0 0 0-106.154667-10.496A245.76 245.76 0 0 0 187.733333 928.128c51.2 56.490667 132.864 85.333333 242.688 85.333333 178.090667 0 297.685333-103.253333 297.685334-256.938666a258.517333 258.517333 0 0 0-36.224-134.272 10.666667 10.666667 0 0 1 9.216-16.085334H960a53.333333 53.333333 0 0 0 53.333333-53.546666z"})])],-1)])],10,Xo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep3"),to:ue.value},[u[62]||(u[62]=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:pe("textColor"),to:ue.value},[t.createElementVNode("div",jo,[t.createElementVNode("div",Zo,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:u[21]||(u[21]=M=>k("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",Jo,[u[63]||(u[63]=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,Qo)]))],8,qo),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:S,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:u[22]||(u[22]=M=>k("update:text-color-menu-open",!e.textColorMenuOpen))},[...u[64]||(u[64]=[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,er),t.createVNode(tn,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":S.value,"onUpdate:modelOpen":u[23]||(u[23]=M=>k("update:text-color-menu-open",M)),onChange:u[24]||(u[24]=M=>k("text-color-change",M))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("fillColor"),to:ue.value},[t.createElementVNode("div",tr,[t.createElementVNode("div",lr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:u[25]||(u[25]=M=>k("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",or,[u[65]||(u[65]=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,rr)]))],8,nr),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:x,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:u[26]||(u[26]=M=>k("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...u[66]||(u[66]=[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,ar),t.createVNode(tn,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":x.value,"onUpdate:modelOpen":u[27]||(u[27]=M=>k("update:fill-color-menu-open",M)),onChange:u[28]||(u[28]=M=>k("fill-color-change",M))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("border"),to:ue.value},[t.createElementVNode("div",ir,[t.createElementVNode("div",cr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"borders"),disabled:!e.hasSelection,onClick:u[29]||(u[29]=M=>k("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",dr,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(o,M=>t.createElementVNode("line",{key:M.name,x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2,"stroke-width":i(e.cachedBorder,M.name)==="thick"?3:1.5,"stroke-dasharray":i(e.cachedBorder,M.name)==="dashed"?"0 4":"none","stroke-linecap":i(e.cachedBorder,M.name)==="dashed"?"round":"square"},null,8,ur)),64))]))],8,sr),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:C,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"borders"),disabled:!e.hasSelection,onClick:u[30]||(u[30]=M=>k("update:border-menu-open",!e.borderMenuOpen))},[...u[67]||(u[67]=[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,fr),t.createVNode(bo,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":C.value,"onUpdate:modelOpen":u[31]||(u[31]=M=>k("update:border-menu-open",M)),onChange:u[32]||(u[32]=M=>k("border-change",M))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep4"),to:ue.value},[u[68]||(u[68]=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:pe("hAlign"),to:ue.value},[t.createElementVNode("div",mr,[t.createVNode(il,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:se("hAlign")?"100%":44,"menu-width":se("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(T)(e.locale,"hAlign"),onChange:u[33]||(u[33]=M=>k("h-align-change",M))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("vAlign"),to:ue.value},[t.createElementVNode("div",pr,[t.createVNode(il,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:se("vAlign")?"100%":44,"menu-width":se("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(T)(e.locale,"vAlign"),onChange:u[34]||(u[34]=M=>k("v-align-change",M))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",hr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(T)(e.locale,"wrap"),onClick:u[35]||(u[35]=M=>k("wrap-toggle"))},[...u[69]||(u[69]=[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,gr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("merge"),to:ue.value},[t.createElementVNode("div",yr,[t.createElementVNode("div",br,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:u[36]||(u[36]=M=>k("apply-merge"))},[...u[70]||(u[70]=[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,vr),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:b,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:u[37]||(u[37]=M=>k("update:merge-menu-open",!e.mergeMenuOpen))},[...u[71]||(u[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,Cr),t.createVNode(ko,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":b.value,"onUpdate:modelOpen":u[38]||(u[38]=M=>k("update:merge-menu-open",M)),onChange:u[39]||(u[39]=M=>k("merge-change",M))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep6"),to:ue.value},[u[72]||(u[72]=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:pe("numFmt"),to:ue.value},[t.createElementVNode("div",wr,[t.createVNode(il,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:se("numFmt")?"100%":92,"menu-width":(se("numFmt"),150),"visible-count":8,title:t.unref(T)(e.locale,"numberFormat"),"fallback-label":he.value,align:"right",onChange:u[40]||(u[40]=M=>k("number-format-change",String(M)))},null,8,["model-value","options","width","menu-width","title","fallback-label"]),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canIncreaseDecimals}]),title:t.unref(T)(e.locale,"nfIncreaseDecimals"),disabled:!e.canIncreaseDecimals,onClick:u[41]||(u[41]=M=>k("increase-decimals"))},[...u[73]||(u[73]=[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,kr),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canDecreaseDecimals}]),title:t.unref(T)(e.locale,"nfDecreaseDecimals"),disabled:!e.canDecreaseDecimals,onClick:u[42]||(u[42]=M=>k("decrease-decimals"))},[...u[74]||(u[74]=[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,Er)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep7"),to:ue.value},[u[75]||(u[75]=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:pe("calc"),to:ue.value},[t.createElementVNode("div",Sr,[t.createElementVNode("div",Rr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:u[43]||(u[43]=M=>k("calc-sum"))},[...u[76]||(u[76]=[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,Br),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:R,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:u[44]||(u[44]=M=>k("update:calc-menu-open",!e.calcMenuOpen))},[...u[77]||(u[77]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,xr),t.createVNode(Ro,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":R.value,disabled:e.isSingleCell,"onUpdate:modelOpen":u[45]||(u[45]=M=>k("update:calc-menu-open",M)),onChange:u[46]||(u[46]=M=>k(`calc-${M}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("find"),to:ue.value},[t.createElementVNode("div",Mr,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(T)(e.locale,"find"),onClick:A},[...u[78]||(u[78]=[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,Dr)])],8,["disabled","to"])),ne.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:y,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":g.value}]),type:"button",onClick:N},[...u[79]||(u[79]=[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:c,key:X.value,class:t.normalizeClass(["overflow-menu",{"no-anim":F.value}]),style:t.normalizeStyle(s.value),onMousedown:u[48]||(u[48]=t.withModifiers(()=>{},["prevent"]))},null,38)),[[t.vShow,g.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-94d2ccc1"]]),Ar=["title"],Vr={class:"tab-list"},Fr=["onClick","onDblclick","onContextmenu"],Hr=["value"],Or={key:1,class:"tab-item__name"},Lr=["title"],$r=["disabled"],zr=["title","onClick"],Wr={class:"tab-list-menu__name"},_r=["title","disabled","onClick"],Kr=["disabled"],Ur=8,Pr=Et(t.defineComponent({__name:"tabbar",props:{locale:{},sheets:{},activeSheetIndex:{},renTab:{},renTabVal:{}},emits:["tab-click","tab-dblclick","delete-sheet","tab-contextmenu","tab-rename-input","tab-rename-keydown","tab-rename-commit","add-sheet","tabbar-contextmenu"],setup(e,{emit:n}){const o=e,l=n,a=t.ref(null),i=t.ref(!1),r=t.ref(0),h=t.ref({left:0,bottom:0}),c=t.ref(null),y=t.computed(()=>Math.min(Ur,o.sheets.length)),S=t.computed(()=>o.sheets.slice(r.value,r.value+y.value)),x=t.computed(()=>r.value>0),C=t.computed(()=>r.value+y.value<o.sheets.length),b=t.computed(()=>o.sheets.length>y.value),R=t.computed(()=>o.sheets.length>1);t.watch(()=>o.sheets.length,()=>{if(!i.value)return;const we=Math.max(0,o.sheets.length-y.value);r.value>we&&(r.value=we)});function Z(we){r.value=Math.max(0,Math.min(o.sheets.length-y.value,r.value+we))}function Q(){if(i.value){i.value=!1;return}const we=a.value;if(!we)return;const re=we.getBoundingClientRect();h.value={left:re.left,bottom:window.innerHeight-re.top+4};const q=o.activeSheetIndex;r.value=q>=0?Math.max(0,Math.min(q-Math.floor(y.value/2),o.sheets.length-y.value)):0,i.value=!0}function g(we){l("tab-click",we),i.value=!1}function F(we){R.value&&l("delete-sheet",we)}function X(we){var be;if(!i.value)return;const re=we.target;if((be=a.value)!=null&&be.contains(re))return;const q=document.querySelector(".tab-list-menu");q!=null&&q.contains(re)||(i.value=!1)}function me(we){i.value&&we.key==="Escape"&&(i.value=!1)}function ne(we){i.value&&(we.preventDefault(),Z(we.deltaY>0?1:-1))}function se(){i.value=!1}function ue(we){!i.value||we.target===c.value||se()}const pe=t.ref(0),Ne=t.ref(!1);function Ae(we){i.value&&(pe.value=we.touches[0].clientY,Ne.value=!0)}function Pe(we){if(!i.value||!Ne.value)return;const re=we.touches[0].clientY-pe.value;Math.abs(re)>5&&(Z(re<0?1:-1),pe.value=we.touches[0].clientY)}function He(){Ne.value=!1}return t.watch(i,we=>{t.nextTick(()=>{var re,q;we?(re=c.value)==null||re.addEventListener("wheel",ne,{passive:!1}):(q=c.value)==null||q.removeEventListener("wheel",ne)})}),t.onMounted(()=>{document.addEventListener("pointerdown",X),document.addEventListener("keydown",me),window.addEventListener("resize",se),window.addEventListener("scroll",ue,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",X),document.removeEventListener("keydown",me),window.removeEventListener("resize",se),window.removeEventListener("scroll",ue,!0)}),(we,re)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:re[8]||(re[8]=q=>l("tabbar-contextmenu",q))},[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:Q},[...re[9]||(re[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,Ar),t.createElementVNode("div",Vr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(q,be)=>(t.openBlock(),t.createElementBlock("div",{key:q.id,class:t.normalizeClass(["tab-item",{"tab-item--active":be===e.activeSheetIndex}]),onClick:oe=>l("tab-click",be),onDblclick:t.withModifiers(oe=>l("tab-dblclick",be),["prevent"]),onContextmenu:oe=>l("tab-contextmenu",{ev:oe,i:be})},[e.renTab===be?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:re[0]||(re[0]=oe=>l("tab-rename-input",oe.target.value)),onKeydown:re[1]||(re[1]=oe=>l("tab-rename-keydown",oe)),onBlur:re[2]||(re[2]=oe=>l("tab-rename-commit")),onClick:re[3]||(re[3]=t.withModifiers(()=>{},["stop"]))},null,40,Hr)):(t.openBlock(),t.createElementBlock("span",Or,t.toDisplayString(q.name),1))],42,Fr))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(T)(e.locale,"addSheet"),onClick:re[4]||(re[4]=q=>l("add-sheet"))}," + ",8,Lr),(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:h.value.left+"px",bottom:h.value.bottom+"px"}),onMousedown:re[7]||(re[7]=t.withModifiers(()=>{},["prevent"]))},[b.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:re[5]||(re[5]=q=>Z(-1))},[...re[10]||(re[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,$r)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:c,class:"tab-list-menu__list",onTouchstart:Ae,onTouchmove:Pe,onTouchend:He},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(S.value,q=>(t.openBlock(),t.createElementBlock("div",{key:q.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(q)===e.activeSheetIndex}]),title:q.name,onClick:be=>g(e.sheets.indexOf(q))},[t.createElementVNode("span",Wr,t.toDisplayString(q.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(T)(e.locale,"delete"),disabled:!R.value,onClick:t.withModifiers(be=>F(e.sheets.indexOf(q)),["stop"])},[...re[11]||(re[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,_r)],10,zr))),128))],544),b.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:re[6]||(re[6]=q=>Z(1))},[...re[12]||(re[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,Kr)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-ec10bade"]]),Gr=["placeholder","value"],Yr=["placeholder","value"],Xr=["value","title"],jr={value:"sheet"},Zr={value:"workbook"},qr={value:"selection"},Jr={class:"find-bar__chk"},Qr=["checked"],ea={class:"find-bar__chk"},ta=["checked"],la={class:"find-bar__count"},na=["title","disabled"],oa=["title","disabled"],ra=["disabled"],aa=["disabled"],ia=["title"],ca=Et(t.defineComponent({__name:"find-replace-bar",props:{open:{type:Boolean},findText:{},replaceText:{},scope:{},matchCase:{type:Boolean},matchEntireCell:{type:Boolean},currentIndex:{},total:{},message:{},focusToken:{},locale:{},themeVars:{}},emits:["update:findText","update:replaceText","update:scope","update:matchCase","update:matchEntireCell","prev","next","replace","replace-all","close"],setup(e,{emit:n}){const o=e,l=n,a=t.ref(null),i=t.computed(()=>o.total>0?`${o.currentIndex+1}/${o.total}`:o.message||"");t.watch(()=>o.focusToken,()=>{t.nextTick(()=>{var c;return(c=a.value)==null?void 0:c.focus()})});function r(c){c.key==="Enter"?(c.preventDefault(),c.shiftKey?l("prev"):l("next")):c.key==="Escape"&&(c.preventDefault(),l("close"))}function h(c){l("update:scope",c.target.value)}return(c,y)=>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:y[0]||(y[0]=S=>l("update:findText",S.target.value)),onKeydown:r},null,40,Gr),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(T)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:y[1]||(y[1]=S=>l("update:replaceText",S.target.value)),onKeydown:r},null,40,Yr),t.createElementVNode("select",{class:"find-bar__select",value:e.scope,title:t.unref(T)(e.locale,"findScope"),onChange:h},[t.createElementVNode("option",jr,t.toDisplayString(t.unref(T)(e.locale,"scopeSheet")),1),t.createElementVNode("option",Zr,t.toDisplayString(t.unref(T)(e.locale,"scopeWorkbook")),1),t.createElementVNode("option",qr,t.toDisplayString(t.unref(T)(e.locale,"scopeSelection")),1)],40,Xr),t.createElementVNode("label",Jr,[t.createElementVNode("input",{type:"checkbox",checked:e.matchCase,onChange:y[2]||(y[2]=S=>l("update:matchCase",S.target.checked))},null,40,Qr),t.createTextVNode(t.toDisplayString(t.unref(T)(e.locale,"matchCase")),1)]),t.createElementVNode("label",ea,[t.createElementVNode("input",{type:"checkbox",checked:e.matchEntireCell,onChange:y[3]||(y[3]=S=>l("update:matchEntireCell",S.target.checked))},null,40,ta),t.createTextVNode(t.toDisplayString(t.unref(T)(e.locale,"matchEntireCell")),1)]),t.createElementVNode("span",la,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:y[4]||(y[4]=S=>l("prev"))},[...y[9]||(y[9]=[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,na),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(T)(e.locale,"findNext"),disabled:e.total===0,onClick:y[5]||(y[5]=S=>l("next"))},[...y[10]||(y[10]=[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,oa),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:y[6]||(y[6]=S=>l("replace"))},t.toDisplayString(t.unref(T)(e.locale,"replace")),9,ra),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:y[7]||(y[7]=S=>l("replace-all"))},t.toDisplayString(t.unref(T)(e.locale,"replaceAll")),9,aa),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(T)(e.locale,"findClose"),onClick:y[8]||(y[8]=S=>l("close"))},[...y[11]||(y[11]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 451.669L369.664 294.336a32 32 0 0 0-45.312 45.312L466.688 497 309.355 654.336a32 32 0 0 0 45.312 45.312L512 542.688l157.333 157.334a32 32 0 0 0 45.312-45.312L557.312 497 714.645 339.664a32 32 0 0 0-45.312-45.312z"})],-1)])],8,ia)],4)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-8d54f890"]]),sa={class:"nf-dialog__header"},da={class:"nf-dialog__title"},ua={class:"nf-dialog__body"},fa={class:"nf-field"},ma={class:"nf-field__label"},pa=["value"],ha={key:0,class:"nf-field"},ga={class:"nf-field__label"},ya={key:1,class:"nf-field nf-field--inline"},ba={class:"nf-checkbox"},va={key:2,class:"nf-field"},Ca={class:"nf-field__label"},wa=["value"],ka={key:3,class:"nf-field"},Ea={class:"nf-field__label"},Sa=["value"],Ra={key:4,class:"nf-field"},Ba={class:"nf-field__label"},xa=["value"],Ma={key:5,class:"nf-field"},Da={class:"nf-field__label"},Ta=["value"],Na={key:6,class:"nf-field"},Ia={class:"nf-field__label"},Aa=["value"],Va={class:"nf-field"},Fa={class:"nf-field__label"},Ha={class:"nf-dialog__footer"},Oa={class:"nf-preview"},La={class:"nf-preview__label"},$a={class:"nf-preview__value"},za={class:"nf-dialog__actions"},Wa=Et(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:n}){const o=e,l=n,a=t.ref(!1),i=t.ref("general"),r=t.ref(2),h=t.ref(!1),c=t.ref("$"),y=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"),b=t.ref(""),R=t.ref(null),Z=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],Q=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],g=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],F=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],X=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],me=t.computed(()=>o.locale==="zh-CN"?[...Q,...g]:[...g,...Q]),ne=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],se=t.computed(()=>o.locale==="zh-CN"?[...F,...X]:[...X,...F]),ue=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],pe={general:"nfCatGeneral",number:"nfCatNumber",currency:"nfCatCurrency",currencyRounded:"nfCatCurrencyRounded",accounting:"nfCatAccounting",financial:"nfCatFinancial",percent:"nfCatPercent",scientific:"nfCatScientific",date:"nfCatDate",time:"nfCatTime",dateTime:"nfCatDateTime",duration:"nfCatDuration",text:"nfCatText",custom:"nfCatCustom"},Ne=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),Ae=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),Pe=t.computed(()=>i.value==="date"),He=t.computed(()=>i.value==="time"),we=t.computed(()=>i.value==="dateTime"),re=t.computed(()=>i.value==="duration"),q=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function be(){if(i.value==="general")return Vt;if(i.value==="text")return bt;if(i.value==="custom")return b.value;if(i.value==="date")return y.value;if(i.value==="time")return S.value;if(i.value==="dateTime")return x.value;if(i.value==="duration")return C.value;const le=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?oe(i.value,le,h.value,c.value):lo(o.locale,i.value,le,h.value)}function oe(le,ie,P,xe){const $e=P?"#,##0":"0";if(le==="currencyRounded")return xe+$e;const Ze=ie>0?"."+"0".repeat(ie):"",at=$e+Ze;return le==="currency"?xe+at:`${xe}${at};(${xe}${at});${xe}"-"`}function s(le){if(b.value=le,vt(le)){i.value="general";return}if(le==="@"){i.value="text";return}const ie=le.replace(/\[[^\]]*\]/gi,Ze=>/\[h\]/i.test(Ze)?Ze:"");if(/\[h\]/i.test(ie)&&!/[yd]/i.test(ie)){i.value="duration",ue.includes(le)&&(C.value=le);return}const P=/[yd]/i.test(ie),xe=/h|s|AM\/PM/i.test(ie);if(P&&xe){i.value="dateTime",se.value.includes(le)&&(x.value=le);return}if(P||/AM\/PM/i.test(ie)){xe&&!P?(i.value="time",ne.includes(le)&&(S.value=le)):(i.value="date",me.value.includes(le)&&(y.value=le));return}if(le.includes("%")){i.value="percent",r.value=m(le);return}if(/E[+-]/i.test(le)){i.value="scientific",r.value=m(le);return}const $e=Z.find(Ze=>le.startsWith(Ze.value));if(le.includes("[Red](")){i.value="financial",h.value=le.includes(","),r.value=m(le);return}if($e){le.includes("(")?(i.value="accounting",c.value=$e.value,h.value=le.includes(","),r.value=m(le)):/\.\d/.test(le.slice($e.value.length))?(i.value="currency",c.value=$e.value,h.value=le.includes(","),r.value=m(le)):(i.value="currencyRounded",c.value=$e.value,h.value=le.includes(","));return}i.value="number",h.value=le.includes(","),r.value=m(le)}function m(le){const ie=le.match(/\.([0#?]+)/);return ie?ie[1].length:0}function p(){i.value!=="custom"&&(b.value=be())}function N(){}function A(){y.value=me.value[0],S.value=ne[0],x.value=se.value[0],C.value=ue[0]}function W(){a.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0),A(),s(o.currentFormat??""),o.isCustom&&(i.value="custom"),t.nextTick(()=>{var le;return(le=R.value)==null?void 0:le.focus()})}function k(){a.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function he(){l("apply",b.value),k()}function K(){k()}function u(le){le.key==="Escape"&&k()}t.watch(()=>o.modelOpen,le=>{le&&!a.value?W():!le&&a.value&&k()});const M=t.computed(()=>Bl(o.sampleValue,b.value,o.locale));return(le,ie)=>(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:K,onKeydown:u},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:ie[9]||(ie[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",sa,[t.createElementVNode("span",da,t.toDisplayString(t.unref(T)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:k},[...ie[10]||(ie[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",ua,[t.createElementVNode("div",fa,[t.createElementVNode("label",ma,t.toDisplayString(t.unref(T)(e.locale,"nfCategory")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ie[0]||(ie[0]=P=>i.value=P),class:"nf-field__select",onChange:p},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Gn),P=>(t.openBlock(),t.createElementBlock("option",{key:P,value:P},t.toDisplayString(t.unref(T)(e.locale,pe[P])),9,pa))),128))],544),[[t.vModelSelect,i.value]])]),q.value?(t.openBlock(),t.createElementBlock("div",ha,[t.createElementVNode("label",ga,t.toDisplayString(t.unref(T)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ie[1]||(ie[1]=P=>r.value=P),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:p},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),Ne.value?(t.openBlock(),t.createElementBlock("div",ya,[t.createElementVNode("label",ba,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ie[2]||(ie[2]=P=>h.value=P),type:"checkbox",onChange:p},null,544),[[t.vModelCheckbox,h.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(T)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),Ae.value?(t.openBlock(),t.createElementBlock("div",va,[t.createElementVNode("label",Ca,t.toDisplayString(t.unref(T)(e.locale,"nfSymbol")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ie[3]||(ie[3]=P=>c.value=P),class:"nf-field__select",onChange:p},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(Z,P=>t.createElementVNode("option",{key:P.value,value:P.value},t.toDisplayString(P.label),9,wa)),64))],544),[[t.vModelSelect,c.value]])])):t.createCommentVNode("",!0),Pe.value?(t.openBlock(),t.createElementBlock("div",ka,[t.createElementVNode("label",Ea,t.toDisplayString(t.unref(T)(e.locale,"nfDateFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ie[4]||(ie[4]=P=>y.value=P),class:"nf-field__select",onChange:p},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(me.value,P=>(t.openBlock(),t.createElementBlock("option",{key:P,value:P},t.toDisplayString(P),9,Sa))),128))],544),[[t.vModelSelect,y.value]])])):t.createCommentVNode("",!0),He.value?(t.openBlock(),t.createElementBlock("div",Ra,[t.createElementVNode("label",Ba,t.toDisplayString(t.unref(T)(e.locale,"nfTimeFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ie[5]||(ie[5]=P=>S.value=P),class:"nf-field__select",onChange:p},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ne,P=>t.createElementVNode("option",{key:P,value:P},t.toDisplayString(P),9,xa)),64))],544),[[t.vModelSelect,S.value]])])):t.createCommentVNode("",!0),we.value?(t.openBlock(),t.createElementBlock("div",Ma,[t.createElementVNode("label",Da,t.toDisplayString(t.unref(T)(e.locale,"nfDateTime")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ie[6]||(ie[6]=P=>x.value=P),class:"nf-field__select",onChange:p},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(se.value,P=>(t.openBlock(),t.createElementBlock("option",{key:P,value:P},t.toDisplayString(P),9,Ta))),128))],544),[[t.vModelSelect,x.value]])])):t.createCommentVNode("",!0),re.value?(t.openBlock(),t.createElementBlock("div",Na,[t.createElementVNode("label",Ia,t.toDisplayString(t.unref(T)(e.locale,"nfDuration")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ie[7]||(ie[7]=P=>C.value=P),class:"nf-field__select",onChange:p},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ue,P=>t.createElementVNode("option",{key:P,value:P},t.toDisplayString(P),9,Aa)),64))],544),[[t.vModelSelect,C.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",Va,[t.createElementVNode("label",Fa,t.toDisplayString(t.unref(T)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:R,"onUpdate:modelValue":ie[8]||(ie[8]=P=>b.value=P),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:N},null,544),[[t.vModelText,b.value]])])]),t.createElementVNode("div",Ha,[t.createElementVNode("div",Oa,[t.createElementVNode("span",La,t.toDisplayString(t.unref(T)(e.locale,"nfPreview")),1),t.createElementVNode("span",$a,t.toDisplayString(M.value||"—"),1)]),t.createElementVNode("div",za,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:he},t.toDisplayString(t.unref(T)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:k},t.toDisplayString(t.unref(T)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-75101bf8"]]);function Ue(e){let n="",o=e;do n=String.fromCharCode(65+o%26)+n,o=Math.floor(o/26)-1;while(o>=0);return n}function Nl(e){let n=0;for(let o=0;o<e.length;o++)n=n*26+(e.toUpperCase().charCodeAt(o)-64);return n-1}function Gt(e){if(e==null)return null;if(typeof e=="number")return e;if(typeof e=="string"){const n=parseFloat(e);return e.endsWith("%")||isNaN(n)?null:n}return null}function Il(e){navigator.clipboard.writeText(e).catch(()=>{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)})}function Jt(e,n){return`${e},${n}`}function cl(e,n,o){const l=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!l)return null;const a=Nl(l[1]),i=parseInt(l[2],10)-1;return a<0||a>=n||i<0||i>=o?null:{col:a,row:i}}function Yt(e,n){if(!n)return{x:0,y:0};const o=n.getBoundingClientRect();return{x:e.clientX-o.left,y:e.clientY-o.top}}function ln(e,n,o){const l=e.split(":");if(l.length!==2)return null;const a=cl(l[0],n,o),i=cl(l[1],n,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 nn(e){const n=e.trim();if(n==="")return"";const o=Number(n);return!isNaN(o)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(n)?o:e}function Xt(e,n,o,l,a){const i=o[Jt(e,n)];if(!i)return"";const r=i.value;return r.startsWith("=")?on(Jt(e,n),o,l,a):nn(r)}function _a(e,n,o,l,a){const i=Xt(e,n,o,l,a);if(i===null)return 0;if(typeof i=="number")return i;const r=parseFloat(String(i));return isNaN(r)?0:r}const sl=new Map,pl=new Set;function Al(){sl.clear(),pl.clear()}function on(e,n,o,l){return Ka(e,n,o,l,0)}function Ka(e,n,o,l,a){if(pl.has(e))return null;if(sl.has(e))return sl.get(e);pl.add(e);const i=n[e];let r;if(!i)r=null;else{const h=i.value;if(!h.startsWith("="))r=nn(h);else{const c=h.slice(1).trim(),y=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(c);r=y?an(y[1].toUpperCase(),y[2],n,o,l,a+1):null}}return pl.delete(e),sl.set(e,r),r}function rn(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function Ua(e,n){return typeof e=="number"&&typeof n=="number"?e===n:String(e??"")===String(n??"")}function Pa(e,n,o){let l;if(typeof e=="number"&&typeof n=="number")l=e<n?-1:e>n?1:0;else{const a=String(e??""),i=String(n??"");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 Ga(e,n,o,l,a){const i=e.trim(),r=["<=",">=","<>"];let h=null,c=-1,y=null,S=0;for(let C=0;C<i.length;C++){const b=i[C];if(y){b===y&&(i[C+1]===y?C++:y=null);continue}if(b==='"'||b==="'"){y=b;continue}if(b==="("&&S++,b===")"&&S--,S===0&&(b==="<"||b===">"||b==="=")){const R=i.slice(C,C+2);h=r.includes(R)?R:b,c=C;break}}if(h&&c>=0){const C=i.slice(0,c).trim(),b=i.slice(c+h.length).trim(),R=Ft(C,n,o,l,a),Z=Ft(b,n,o,l,a);return Pa(R,Z,h)}const x=Ft(i,n,o,l,a);return rn(x)}function Vl(e){const n=[];let o=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==="("&&o++,r===")"&&o--,r===","&&o===0){n.push(a),a="";continue}a+=r}return n.push(a),n}function Ft(e,n,o,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 h=Ya(i);if(h.length===0)return null;let c=0;const y=()=>{let b=S();for(;c<h.length;){const R=h[c];if(R.type==="op"&&(R.val==="+"||R.val==="-"))c++,b=Fl(b,S(),R.val);else break}return b},S=()=>{let b=x();for(;c<h.length;){const R=h[c];if(R.type==="op"&&(R.val==="*"||R.val==="/"))c++,b=Fl(b,x(),R.val);else break}return b},x=()=>{const b=h[c];return b&&b.type==="op"&&b.val==="-"?(c++,Fl(0,x(),"-")):b&&b.type==="op"&&b.val==="+"?(c++,x()):C()},C=()=>{const b=h[c];if(!b)return null;if(b.type==="num")return c++,Number(b.val);if(b.type==="str")return c++,b.val;if(b.type==="lp"){c++;const R=y();return h[c]&&h[c].type==="rp"&&c++,R}if(b.type==="ref"){c++;const R=cl(b.val,o,l);return R?Xt(R.col,R.row,n,o,l):null}if(b.type==="func"){const R=b.val.toUpperCase();if(c++,h[c]&&h[c].type==="lp"){const Z=h[c];let Q=0,g=null,F=c;for(;F<h.length;F++)if(h[F].type==="lp")Q++;else if(h[F].type==="rp"&&(Q--,Q===0)){g=h[F];break}if(g){const X=i.slice(Z.start+1,g.start);return c=F+1,an(R,X,n,o,l,a+1)}}return null}return c++,null};return y()}function Ya(e){const n=[];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 r="";for(;o<e.length;){if(e[o]===a){if(e[o+1]===a){r+=a,o+=2;continue}o++;break}r+=e[o],o++}n.push({type:"str",val:r,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++;n.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]==="("?n.push({type:"func",val:i,start:a}):n.push({type:"ref",val:i,start:a});continue}if(l==="("){n.push({type:"lp",val:l,start:o}),o++;continue}if(l===")"){n.push({type:"rp",val:l,start:o}),o++;continue}if(l===","){n.push({type:"comma",val:l,start:o}),o++;continue}if(l==="+"||l==="-"||l==="*"||l==="/"){n.push({type:"op",val:l,start:o}),o++;continue}o++}return n}function Fl(e,n,o){if(typeof e!="number"||typeof n!="number")return null;switch(o){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return n===0?null:e/n}return null}function an(e,n,o,l,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=ln(n.trim(),l,a);if(!r)return null;if(e==="COUNT"){let c=0;for(let y=r.sc;y<=r.ec;y++)for(let S=r.sr;S<=r.er;S++)typeof Xt(y,S,o,l,a)=="number"&&c++;return c}let h=0;for(let c=r.sc;c<=r.ec;c++)for(let y=r.sr;y<=r.er;y++)h+=_a(c,y,o,l,a);if(isNaN(h))return null;if(e==="AVERAGE"){const c=(r.ec-r.sc+1)*(r.er-r.sr+1);return c===0?null:h/c}return h}case"IF":{const r=Vl(n);if(r.length<3)return null;const h=Ga(r[0],o,l,a,i);return Ft(h?r[1]:r[2],o,l,a,i)}case"VLOOKUP":{const r=Vl(n);if(r.length<3)return null;const h=Ft(r[0],o,l,a,i),c=ln(r[1].trim(),l,a);if(!c)return null;const y=Ft(r[2],o,l,a,i),S=typeof y=="number"?y:parseFloat(String(y));if(isNaN(S))return null;const x=c.sc+(S-1);if(x<c.sc||x>c.ec)return null;if(r.length>=4?rn(Ft(r[3],o,l,a,i)):!1){let b=-1,R=-1/0;for(let Z=c.sr;Z<=c.er;Z++){const Q=Xt(c.sc,Z,o,l,a);typeof Q=="number"&&typeof h=="number"&&Q<=h&&Q>R&&(R=Q,b=Z)}return b>=0?Xt(x,b,o,l,a):null}for(let b=c.sr;b<=c.er;b++){const R=Xt(c.sc,b,o,l,a);if(Ua(R,h))return Xt(x,b,o,l,a)}return null}case"CONCATENATE":{const r=Vl(n);let h="";for(const c of r){const y=Ft(c,o,l,a,i);h+=y===null?"":typeof y=="number"?String(y):y}return h}default:return null}}function Hl(e,n,o){const l=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=cl(i[1],n,o);if(r)if(i[2]){const h=cl(i[2],n,o);if(!h)continue;for(let c=Math.min(r.col,h.col);c<=Math.max(r.col,h.col);c++)for(let y=Math.min(r.row,h.row);y<=Math.max(r.row,h.row);y++)l.push(Jt(c,y))}else l.push(Jt(r.col,r.row))}return l}function Xa(e,n,o,l,a){const i=o[Jt(e,n)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const h=on(Jt(e,n),o,l,a);return h===null?"#ERROR":String(h)}function ja(e,n,o,l,a,i){return n===0&&o===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,h,c,y,S)=>{const x=h?Nl(c):Nl(c)+n,C=y?parseInt(S,10)-1:parseInt(S,10)-1+o;let b;x<0?b="A":x>=l?b=i(l-1):b=i(x);let R;return C<0?R="1":C>=a?R=String(a):R=String(C+1),(h||"")+b+(y||"")+R})}class Za{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(n){var l;const o=this.deps.get(n);if(o){for(const a of o)(l=this.rev.get(a))==null||l.delete(n);this.deps.delete(n)}}set(n,o){if(this.clear(n),o.length!==0){this.deps.set(n,o);for(const l of o)this.rev.has(l)||this.rev.set(l,new Set),this.rev.get(l).add(n)}}markDirty(n){const o=[n];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 n=this.dirty;return this.dirty=new Set,n}rebuild(n,o,l){this.deps.clear(),this.rev.clear(),this.dirty.clear(),sl.clear();for(const[a,i]of Object.entries(n))if(i.value.startsWith("=")){const r=Hl(i.value.slice(1),o,l);this.set(a,r)}}}class qa{constructor(n){if(n&&n.length>0){this.styles=n,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(n){const o=Object.keys(n).sort(),l={};for(const a of o)l[a]=n[a];return JSON.stringify(l)}get(n){const o=this.styles[n];return o?n===0?o:Object.freeze(o):{}}getId(n){if(!n||Object.keys(n).length===0)return 0;const o=this.stableKey(n),l=this.index.get(o);if(l!==void 0)return l;const a=this.styles.length,i=Object.freeze({...n});return this.styles.push(i),this.index.set(o,a),a}getStyles(){return[...this.styles]}setStyles(n){this.styles=n,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(n){const o=new Set;o.add(0);for(const r in n){const h=n[r].styleId??0;o.add(h)}const l=new Map,a=[{}];l.set(0,0);const i=Array.from(o).sort((r,h)=>r-h);for(const r of i)if(r!==0&&r<this.styles.length){const h=a.length;l.set(r,h),a.push(this.styles[r])}for(const r in n){const h=n[r],c=h.styleId??0,y=l.get(c);y!==void 0&&y!==c&&(h.styleId=y)}this.styles=a,this.index=new Map;for(let r=0;r<this.styles.length;r++){const h=this.stableKey(this.styles[r]);this.index.set(h,r)}return a}}function Ja(e,n){if(!e)return null;const o=e.styleId;return o===void 0||o===0?null:n[o]??null}function cn(e){const n=new qa,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=n.getId(a.style)),i.styleId===0&&delete i.styleId,o[l]=i}return{cells:o,styles:n.getStyles()}}function Qa(e){const n={};for(const[o,l]of Object.entries(e)){const a={value:l.value};l.styleId!==void 0&&l.styleId>0&&(a.styleId=l.styleId),n[o]=a}return n}class ei{constructor(n){if(n&&n.length>0){this.borders=n,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(n){const o=["top","right","bottom","left"],l={};for(const a of o){const i=n[a];if(i&&(i.width!==void 0||i.color!==void 0||i.style!==void 0)){const r={};i.width!==void 0&&(r.width=i.width),i.color!==void 0&&(r.color=i.color),i.style!==void 0&&(r.style=i.style),l[a]=r}}return JSON.stringify(l)}get(n){const o=this.borders[n];return o?n===0?o:Object.freeze(o):{}}getId(n){if(!n||this.isEmptyBorder(n))return 0;const o=this.stableKey(n),l=this.index.get(o);if(l!==void 0)return l;const a=this.borders.length,i=Object.freeze(this.deepCloneBorder(n));return this.borders.push(i),this.index.set(o,a),a}isEmptyBorder(n){return!n.top&&!n.right&&!n.bottom&&!n.left}deepCloneBorder(n){const o={};return n.top&&(o.top={...n.top}),n.right&&(o.right={...n.right}),n.bottom&&(o.bottom={...n.bottom}),n.left&&(o.left={...n.left}),o}getBorders(){return[...this.borders]}setBorders(n){this.borders=n,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(n){const o=new Set;o.add(0);for(const r of n){const h=r.borderId??0;o.add(h)}const l=new Map,a=[{}];l.set(0,0);const i=Array.from(o).sort((r,h)=>r-h);for(const r of i)if(r!==0&&r<this.borders.length){const h=a.length;l.set(r,h),a.push(this.borders[r])}for(const r of n){const h=r.borderId??0,c=l.get(h);c!==void 0&&c!==h&&(r.borderId=c)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const h=this.stableKey(this.borders[r]);this.index.set(h,r)}return a}}function ti(e,n,o,l){if(!e)return;const a=e.styleId??0,i=o[a];if(!i)return;const r=i.borderId??0;if(r===0)return;const h=l.get(r);if(h)return h[n]}function li(e,n,o,l,a,i){const r=l[e.styleId??0]??{},h=r.borderId??0,c=h>0?a.get(h):{},y={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?y[n]={...o}:y[n]=void 0;const S=a.getId(y),x={...r};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 sn(e){const n=new ei,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,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 h=n.getId(r),c={...l};delete c.borderTopWidth,delete c.borderBottomWidth,delete c.borderLeftWidth,delete c.borderRightWidth,delete c.borderColor,h>0?c.borderId=h:delete c.borderId,o.push(c)}return{styles:o,borders:n.getBorders()}}function ni(e,n){const o=t.reactive({rowCount:e.rowCount??n.rowCount,colCount:e.colCount??n.colCount,width:e.width,height:e.height,theme:e.theme??n.theme,locale:e.locale??n.locale});t.watchEffect(()=>{o.rowCount=e.rowCount??n.rowCount,o.colCount=e.colCount??n.colCount,o.width=e.width,o.height=e.height,o.theme=e.theme??n.theme,o.locale=e.locale??n.locale});const l=t.computed(()=>o.locale==="zh-CN"?"zh-CN":"en-US"),a=o.colCount,i=o.rowCount,r=t.reactive({}),h=t.reactive([{}]),c=t.reactive([{}]);let y=new Map;y.set("{}",0);let S=new Map;S.set("{}",0);function x(B){const V=Object.keys(B).sort(),H={};for(const ee of V)H[ee]=B[ee];return JSON.stringify(H)}function C(B){const V=["top","right","bottom","left"],H={};for(const ee of V){const de=B[ee];if(de&&(de.width!==void 0||de.color!==void 0||de.style!==void 0)){const f={};de.width!==void 0&&(f.width=de.width),de.color!==void 0&&(f.color=de.color),de.style!==void 0&&(f.style=de.style),H[ee]=f}}return JSON.stringify(H)}function b(B){if(!B||Object.keys(B).length===0)return 0;const V=x(B),H=y.get(V);if(H!==void 0)return H;const ee=h.length;return h.push(Object.freeze({...B})),y.set(V,ee),ee}function R(B){return Ja(B,h)}function Z(){y=new Map;for(let B=0;B<h.length;B++)y.set(x(h[B]),B)}function Q(B){h.splice(0,h.length,...B),Z()}function g(B){if(!B||!B.top&&!B.right&&!B.bottom&&!B.left)return 0;const V=C(B),H=S.get(V);if(H!==void 0)return H;const ee=c.length;return c.push(Object.freeze({top:B.top?Object.freeze({...B.top}):void 0,right:B.right?Object.freeze({...B.right}):void 0,bottom:B.bottom?Object.freeze({...B.bottom}):void 0,left:B.left?Object.freeze({...B.left}):void 0})),S.set(V,ee),ee}function F(B){return c[B]??{}}function X(){S=new Map;for(let B=0;B<c.length;B++)S.set(C(c[B]),B)}function me(B){c.splice(0,c.length,...B),X()}function ne(B,V){return ti(B,V,h,{get:H=>c[H]??{}})}function se(B,V){const H=k(B,V);return H?H.anchor:null}function ue(B,V,H,ee){const de=k(B,V),f=k(H,ee);return!de||!f?!1:de.anchor===f.anchor}const pe=t.reactive({}),Ne=new Za,Ae=t.ref(null),Pe=t.ref("cell"),He=t.ref({col:0,row:0}),we=t.ref(null),re=t.ref(""),q=t.ref(new Array(a).fill(100)),be=t.ref(new Array(i).fill(void 0)),oe=t.ref(0),s=t.ref(0),m=(24-It)/2,p=new Map;let N=null;function A(B,V,H,ee){const de=`${ee} ${H} ${V}px ${B}`,f=p.get(de);if(f)return f;if(!N){if(typeof document>"u")return{ascent:V*.88,descent:V*.28};N=document.createElement("canvas")}const E=N.getContext("2d");if(!E)return{ascent:V*.88,descent:V*.28};E.font=de;const I=E.measureText(" "),$=I.fontBoundingBoxAscent,z=I.fontBoundingBoxDescent;if(typeof $=="number"&&typeof z=="number"&&$>0&&z>0){const et={ascent:$,descent:z};return p.set(de,et),et}const L=["M","中","y","Ä","0"];let te=0,fe=0;for(const et of L){const pt=E.measureText(et),Mt=pt.actualBoundingBoxAscent||0,ht=pt.actualBoundingBoxDescent||0;Mt>te&&(te=Mt),ht>fe&&(fe=ht)}const We=Math.max(te,V*.88),qe=Math.max(fe,V*.28),rt={ascent:We,descent:qe};return p.set(de,rt),rt}let W=(B,V)=>`${B},${V}`,k=()=>null,he=()=>It,K=t.computed(()=>[0]),u=()=>24,M=(B,V,H,ee)=>({startCol:Math.min(B,H),startRow:Math.min(V,ee),endCol:Math.max(B,H),endRow:Math.max(V,ee)});function le(B,V){const H=R(r[W(B,V)]),ee=he(B,V),de=typeof(H==null?void 0:H.fontFamily)=="string"&&H.fontFamily?H.fontFamily:al,f=(H==null?void 0:H.fontWeight)==="bold"?"bold":"normal",E=(H==null?void 0:H.fontStyle)==="italic"?"italic":"normal";return A(de,ee,f,E)}function ie(B,V,H,ee){if(!V)return[""];const de=V.split(`
|
|
2
|
-
`),
|
|
3
|
-
`).length,_t>de&&(de=_t)}}const I=H+ee,$=m*2+de*I;return Math.min(500,Math.max(24,Math.round($)))}u=at;function O(B){return be.value[B]===void 0}const D=t.computed(()=>{const B=[0];for(let V=0;V<i;V++)B.push(B[V]+u(V));return B}),j=t.computed(()=>xe.value[a]),ke=t.computed(()=>D.value[i]);function _(B,V){return`${B},${V}`}W=_;function J(B){Reflect.deleteProperty(r,B)}function Be(B,V){Pe.value="cell";const H=k(B,V);H?(He.value={col:H.range.startCol,row:H.range.startRow},Ae.value={...H.range}):(He.value={col:B,row:V},Ae.value={startCol:B,startRow:V,endCol:B,endRow:V})}function ge(B,V,H,ee,de="cell"){const f=k(B,V);if(He.value=f?{col:f.range.startCol,row:f.range.startRow}:{col:B,row:V},Pe.value=de,de==="row"||de==="col"){const E=Math.min(B,H),I=Math.max(B,H),$=Math.min(V,ee),z=Math.max(V,ee);Ae.value={startCol:E,startRow:$,endCol:I,endRow:z}}else Ae.value=M(B,V,H,ee)}function Me(){ge(0,0,a-1,i-1,"all")}function Ve(B,V){const H=Ae.value;return H?(Pe.value==="cell"||Pe.value==="all",B>=H.startCol&&B<=H.endCol&&V>=H.startRow&&V<=H.endRow):!1}function Ye(B,V){return Ve(B,V)}function Qe(B,V){for(const H in pe){const ee=pe[H];if(ee&&B>=ee.startCol&&B<=ee.endCol&&V>=ee.startRow&&V<=ee.endRow)return{range:ee,anchor:H}}return null}k=Qe;function ct(B,V){return pe[_(B,V)]!==void 0}function mt(B,V){const H=k(B,V);if(H&&B===H.range.startCol&&V===H.range.startRow){const ee=xe.value[H.range.endCol+1]-xe.value[B],de=D.value[H.range.endRow+1]-D.value[V];return{w:ee,h:de}}return{w:q.value[B],h:u(V)}}function zt(B,V,H,ee){let de=Math.min(B,H),f=Math.max(B,H),E=Math.min(V,ee),I=Math.max(V,ee),$=!0;for(;$;){$=!1;for(const z in pe){const L=pe[z];if(!L)continue;L.startCol<=f&&L.endCol>=de&&L.startRow<=I&&L.endRow>=E&&(L.startCol<de&&(de=L.startCol,$=!0),L.endCol>f&&(f=L.endCol,$=!0),L.startRow<E&&(E=L.startRow,$=!0),L.endRow>I&&(I=L.endRow,$=!0))}}return{startCol:de,startRow:E,endCol:f,endRow:I}}M=zt;function st(B,V){var H;return((H=r[_(B,V)])==null?void 0:H.value)??""}function ft(B,V){return Al(),Xa(B,V,r,a,i)}function Ct(B,V,H){var I,$;const ee=_(B,V);if(Al(),H===""||H==null){Ne.clear(ee);const z=(I=r[ee])==null?void 0:I.styleId;z!==void 0&&z>0?r[ee]={value:"",styleId:z}:J(ee),Ne.markDirty(ee);return}const de=String(H);if(!de.startsWith("=")){const z=R(r[ee]),L=typeof(z==null?void 0:z.numberFormat)=="string"?z.numberFormat:"";if(vt(L)){const te=to(de,l.value);if(te){const fe={...z??{},numberFormat:te.format};r[ee]={value:String(te.serial),styleId:b(fe)},Ne.clear(ee),Ne.markDirty(ee);return}}}const f=($=r[ee])==null?void 0:$.styleId,E={value:de};f!==void 0&&f>0&&(E.styleId=f),r[ee]=E,de.startsWith("=")?Ne.set(ee,Hl(de.slice(1),a,i)):Ne.clear(ee),Ne.markDirty(ee)}function Qt(B,V,H,ee){for(let de=B;de<=V;de++)for(let f=H;f<=ee;f++){const E=_(de,f);Ne.clear(E),J(E),Ne.markDirty(E)}}let el=()=>{};function St(B){we.value||(we.value={...He.value},B!==void 0?re.value=B:re.value||(re.value=st(He.value.col,He.value.row)))}function ot(){we.value&&(el(),Ct(we.value.col,we.value.row,re.value),we.value=null,re.value="")}function it(){we.value=null,re.value=""}function Rt(B,V){const H=He.value;let ee=Math.max(0,Math.min(a-1,H.col+B)),de=Math.max(0,Math.min(i-1,H.row+V));const f=k(H.col,H.row),E=k(ee,de);f&&E&&f.anchor===E.anchor&&(B>0?ee=f.range.endCol+1:B<0&&(ee=f.range.startCol-1),V>0?de=f.range.endRow+1:V<0&&(de=f.range.startRow-1),ee=Math.max(0,Math.min(a-1,ee)),de=Math.max(0,Math.min(i-1,de))),Be(ee,de)}function Bt(B,V){const H=Math.max(0,$e.w-52-11),ee=Math.max(0,$e.h-24-11),de=xe.value[B],f=D.value[V],E=k(B,V),I=E?xe.value[E.range.endCol+1]-xe.value[B]:q.value[B],$=E?D.value[E.range.endRow+1]-D.value[V]:u(V);let z=oe.value,L=s.value;de<z?z=de:de+I>z+H&&(z=de+I-H),f<L?L=f:f+$>L+ee&&(L=f+$-ee),Ze(z,L)}function xt(B){const V=xe.value;if(B<0||B>=V[a])return-1;let H=0,ee=a-1;for(;H<ee;){const de=H+ee+1>>1;V[de]<=B?H=de:ee=de-1}return H}function Wt(B){const V=D.value;if(B<0||B>=V[i])return-1;let H=0,ee=i-1;for(;H<ee;){const de=H+ee+1>>1;V[de]<=B?H=de:ee=de-1}return H}const dt={props:o,locale:l,colCount:a,rowCount:i,cells:r,styles:h,borders:c,merges:pe,formulaDeps:Ne,selection:Ae,activeCell:He,editingCell:we,editValue:re,colWidths:q,rowHeights:be,scrollX:oe,scrollY:s,BASE_CELL_VPAD:m,fontMetricsCache:p,fontMetricsCanvas:N,measureFontMetrics:A,_getFontMetricsForCell:le,getWrappedLines:ie,cellFontSize:P,colPositions:xe,getRowHeight:at,_isAutoRow:O,rowPositions:D,totalWidth:j,totalHeight:ke,selectCell:Be,selectRange:ge,selectAll:Me,isSelected:Ve,isCellSelected:Ye,selectionMode:Pe,cellKey:_,delCell:J,findMerge:Qe,_isMergeAnchor:ct,_mergedSpan:mt,expandSelectionForMerges:zt,getCellRaw:st,getCellValue:ft,setCellValue:Ct,clearCellsInRange:Qt,startEdit:St,commitEdit:ot,cancelEdit:it,moveActive:Rt,ensureVisible:Bt,hitCol:xt,hitRow:Wt,registerStyle:b,resolveStyle:R,rebuildStyleIndex:Z,syncStyles:Q,registerBorder:g,resolveBorder:F,rebuildBorderIndex:X,syncBorders:me,getCellBorderSide:ne,getMergeOwner:se,isSameMergeInternal:ue,viewSize:$e,findHighlight:(B,V)=>null};return el=()=>{var B;return(B=dt.saveUndo)==null?void 0:B.call(dt)},Ze=(B,V)=>{var H;return(H=dt.clampScroll)==null?void 0:H.call(dt,B,V)},dt}function oi(e,n){const o=t.ref([]),l=t.ref([]);function a(f){return Qa(f)}function i(){return n.saveSheet(),{sheets:n.sheets.value.map(f=>({id:f.id,name:f.name,cells:a(f.cells),styles:[...f.styles],borders:f.borders?[...f.borders]:[{}],merges:f.merges?{...f.merges}:{},selection:f.selection?{...f.selection}:null,activeCell:f.activeCell?{...f.activeCell}:{col:0,row:0},scrollX:f.scrollX,scrollY:f.scrollY,colWidths:[...f.colWidths],rowHeights:[...f.rowHeights]})),styles:[...e.styles],activeSheetIndex:n.activeSheetIndex.value}}function r(f){n.sheets.value=f.sheets.map(E=>({...E,cells:a(E.cells),styles:[...E.styles],borders:E.borders?[...E.borders]:[{}]})),n.loadSheet(Math.max(0,Math.min(f.activeSheetIndex,n.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function h(){const f=i(),E=o.value[o.value.length-1];E&&JSON.stringify(E)===JSON.stringify(f)||(o.value.push(f),l.value=[],o.value.length>50&&o.value.shift())}e.saveUndo=h;function c(){var f;o.value.length&&(l.value.push(i()),r(o.value.pop()),(f=e.scheduleRender)==null||f.call(e),t.nextTick(()=>{var E;return(E=e.emitModelData)==null?void 0:E.call(e)}))}function y(){var f;l.value.length&&(o.value.push(i()),r(l.value.pop()),(f=e.scheduleRender)==null||f.call(e),t.nextTick(()=>{var E;return(E=e.emitModelData)==null?void 0:E.call(e)}))}const S=t.computed(()=>o.value.length>0),x=t.computed(()=>l.value.length>0),C=t.computed(()=>!!e.selection.value),b=t.ref(null);function R(){var I;const f=e.selection.value;if(!f)return;const E={};for(let $=f.startCol;$<=f.endCol;$++)for(let z=f.startRow;z<=f.endRow;z++)E[`${$-f.startCol},${z-f.startRow}`]=((I=e.cells[e.cellKey($,z)])==null?void 0:I.styleId)??0;b.value={styles:E}}function Z(){var I,$,z;const f=b.value,E=e.selection.value;if(!(!f||!E)){h();for(let L=E.startCol;L<=E.endCol;L++)for(let te=E.startRow;te<=E.endRow;te++){const fe=e.findMerge(L,te);if(fe&&(L!==fe.range.startCol||te!==fe.range.startRow))continue;const We=f.styles[`${L-E.startCol},${te-E.startRow}`]??0,qe=e.cellKey(L,te),rt=((I=e.cells[qe])==null?void 0:I.value)??"";if(rt===""&&We===0)e.delCell(qe);else{const et={value:rt};We>0&&(et.styleId=We),e.cells[qe]=et}}b.value=null,($=e.scheduleRender)==null||$.call(e),(z=e.emitModelData)==null||z.call(e)}}function Q(){var E,I,$;const f=e.selection.value;if(f){h();for(let z=f.startCol;z<=f.endCol;z++)for(let L=f.startRow;L<=f.endRow;L++){const te=e.findMerge(z,L);if(te&&(z!==te.range.startCol||L!==te.range.startRow))continue;const fe=e.cellKey(z,L),We=((E=e.cells[fe])==null?void 0:E.value)??"";We===""?e.delCell(fe):e.cells[fe]={value:We}}(I=e.scheduleRender)==null||I.call(e),($=e.emitModelData)==null||$.call(e)}}const g=t.computed(()=>Cn.map(f=>({...f,label:f.value===""?T(e.locale.value,"fontDefault"):f.label}))),F=t.computed(()=>wn.map(f=>({...f,label:String(f.value)}))),X="\0",me=t.computed(()=>{const f=e.selection.value;if(!f)return"";let E,I=!1;for(let $=f.startCol;$<=f.endCol&&!I;$++)for(let z=f.startRow;z<=f.endRow&&!I;z++){const L=e.findMerge($,z);if(L&&($!==L.range.startCol||z!==L.range.startRow))continue;const te=e.resolveStyle(e.cells[e.cellKey($,z)]),fe=typeof(te==null?void 0:te.fontFamily)=="string"?te.fontFamily:"";E===void 0?E=fe:fe!==E&&(I=!0)}return I?X:E??""}),ne=t.computed(()=>{const f=e.selection.value;if(!f)return It;let E,I=!1;for(let $=f.startCol;$<=f.endCol&&!I;$++)for(let z=f.startRow;z<=f.endRow&&!I;z++){const L=e.findMerge($,z);if(L&&($!==L.range.startCol||z!==L.range.startRow))continue;const te=e.cellFontSize($,z);E===void 0?E=te:te!==E&&(I=!0)}return I?0:E??It});function se(f,E){var $,z,L;const I=e.selection.value;if(I){h();for(let te=I.startCol;te<=I.endCol;te++)for(let fe=I.startRow;fe<=I.endRow;fe++){const We=e.findMerge(te,fe);if(We&&(te!==We.range.startCol||fe!==We.range.startRow))continue;const qe=e.cellKey(te,fe),rt=(($=e.cells[qe])==null?void 0:$.value)??"";let pt={...e.resolveStyle(e.cells[qe])??{}};if(E===""||E===null||E===void 0||E===0){const{[f]:ht,...dl}=pt;pt=dl}else pt[f]=E;const Mt=Object.keys(pt).length?e.registerStyle(pt):0;if(rt===""&&Mt===0)e.delCell(qe);else{const ht={value:rt};Mt>0&&(ht.styleId=Mt),e.cells[qe]=ht}}(z=e.scheduleRender)==null||z.call(e),(L=e.emitModelData)==null||L.call(e)}}function ue(f){se("fontFamily",f===""?"":f)}const pe=t.ref(!1),Ne=t.ref(!1),Ae=t.ref(!1),Pe=t.ref(!1),He=t.ref(!1);function we(f){se("fontSize",f),pe.value=!1}const re=t.computed(()=>Mn.map(f=>({label:T(e.locale.value,f.labelKey),value:f.value,icon:f.icon}))),q=t.computed(()=>Dn.map(f=>({label:T(e.locale.value,f.labelKey),value:f.value,icon:f.icon}))),be=t.computed(()=>{const f=e.selection.value;if(!f)return"left";const E=e.resolveStyle(e.cells[e.cellKey(f.startCol,f.startRow)]),I=typeof(E==null?void 0:E.textAlign)=="string"?E.textAlign:"";return I==="center"||I==="right"?I:"left"}),oe=t.computed(()=>{const f=e.selection.value;if(!f)return"top";const E=e.resolveStyle(e.cells[e.cellKey(f.startCol,f.startRow)]),I=typeof(E==null?void 0:E.verticalAlign)=="string"?E.verticalAlign:"";return I==="middle"||I==="bottom"?I:"top"}),s=t.computed(()=>{const f=e.selection.value;if(!f)return!1;const E=e.resolveStyle(e.cells[e.cellKey(f.startCol,f.startRow)]);return(E==null?void 0:E.wrap)==="wrap"});function m(f){se("textAlign",f)}function p(f){se("verticalAlign",f)}function N(){if(!e.selection.value)return;const E=s.value;se("wrap",E?void 0:"wrap")}const A=t.ref(""),W=pe;t.watch(ne,f=>{A.value=f===0?"":String(f)},{immediate:!0});function k(f){const E=f.replace(/[^\d]/g,"");A.value=E;const I=parseInt(E,10);!isNaN(I)&&I>=5&&I<=72&&I!==ne.value&&se("fontSize",I)}function he(){const f=A.value.trim();if(!f){A.value=ne.value===0?"":String(ne.value);return}let E=parseInt(f,10);isNaN(E)?E=ne.value===0?It:ne.value:E=Math.max(5,Math.min(72,E)),A.value=String(E),E!==ne.value&&se("fontSize",E)}function K(f){f.key==="Enter"&&f.target.blur()}function u(f){f&&f.preventDefault(),W.value=!W.value,W.value&&(Ae&&(Ae.value=!1),Ne&&(Ne.value=!1),Pe.value=!1,He.value=!1)}function M(){const f=ne.value===0?It:ne.value,E=Math.min(72,f+1);se("fontSize",E),A.value=String(E),W.value=!1}function le(){const f=ne.value===0?It:ne.value,E=Math.max(5,f-1);se("fontSize",E),A.value=String(E),W.value=!1}function ie(f){const E=e.selection.value;if(!E)return!1;let I,$=!1;for(let z=E.startCol;z<=E.endCol&&!$;z++)for(let L=E.startRow;L<=E.endRow&&!$;L++){const te=e.findMerge(z,L);if(te&&(z!==te.range.startCol||L!==te.range.startRow))continue;const fe=e.resolveStyle(e.cells[e.cellKey(z,L)]),We=!!(fe!=null&&fe[f]);I===void 0?I=We:We!==I&&($=!0)}return!$&&I===!0}const P=t.computed(()=>ie("fontWeight")),xe=t.computed(()=>ie("fontStyle")),$e=t.computed(()=>ie("underline")),Ze=t.computed(()=>ie("strikethrough"));function at(){se("fontWeight",P.value?"":"bold")}function O(){se("fontStyle",xe.value?"":"italic")}function D(){se("underline",$e.value?"":"underline")}function j(){se("strikethrough",Ze.value?"":"line-through")}const ke=t.ref(""),_=t.ref(""),J=Pe,Be=He;function ge(){J.value=!J.value,Be.value=!1,Ne&&(Ne.value=!1),Ae&&(Ae.value=!1)}function Me(){Be.value=!Be.value,J.value=!1,Ne&&(Ne.value=!1),Ae&&(Ae.value=!1)}function Ve(f){Ne&&(Ne.value=f),f&&(J.value=!1,Be.value=!1,Ae&&(Ae.value=!1))}function Ye(f){ke.value=f,se("color",f===""?"":f)}function Qe(f){_.value=f,se("backgroundColor",f===""?"":f)}function ct(){se("color",ke.value===""?"":ke.value)}function mt(){se("backgroundColor",_.value===""?"":_.value)}const zt=t.computed(()=>{const f=e.selection.value;if(!f)return"";let E,I=!1;for(let $=f.startCol;$<=f.endCol&&!I;$++)for(let z=f.startRow;z<=f.endRow&&!I;z++){const L=e.findMerge($,z);if(L&&($!==L.range.startCol||z!==L.range.startRow))continue;const te=e.resolveStyle(e.cells[e.cellKey($,z)]),fe=typeof(te==null?void 0:te.color)=="string"?te.color:"";E===void 0?E=fe:fe!==E&&(I=!0)}return I?"":E??""}),st=t.computed(()=>{const f=e.selection.value;if(!f)return"";let E,I=!1;for(let $=f.startCol;$<=f.endCol&&!I;$++)for(let z=f.startRow;z<=f.endRow&&!I;z++){const L=e.findMerge($,z);if(L&&($!==L.range.startCol||z!==L.range.startRow))continue;const te=e.resolveStyle(e.cells[e.cellKey($,z)]),fe=typeof(te==null?void 0:te.backgroundColor)=="string"?te.backgroundColor:"";E===void 0?E=fe:fe!==E&&(I=!0)}return I?"":E??""}),ft=t.computed(()=>en(e.locale.value)),Ct=t.ref(!1),Qt=t.computed(()=>{const f=e.selection.value;if(!f)return Vt;let E,I=!1;for(let $=f.startCol;$<=f.endCol&&!I;$++)for(let z=f.startRow;z<=f.endRow&&!I;z++){const L=e.findMerge($,z);if(L&&($!==L.range.startCol||z!==L.range.startRow))continue;const te=e.resolveStyle(e.cells[e.cellKey($,z)]),fe=(te==null?void 0:te.numberFormatCategory)==="custom"?At:typeof(te==null?void 0:te.numberFormat)=="string"?te.numberFormat:"";E===void 0?E=fe:fe!==E&&(I=!0)}return I?kt:E??Vt});function el(f){if((f==null?void 0:f.numberFormatCategory)==="custom")return At;const E=typeof(f==null?void 0:f.numberFormat)=="string"?f.numberFormat:"";return Ql(E,e.locale.value)}const St=t.computed(()=>{const f=Qt.value;if(f!==kt)return f===At?At:Ql(f,e.locale.value);const E=e.selection.value;if(!E)return Vt;let I,$=!1;for(let z=E.startCol;z<=E.endCol&&!$;z++)for(let L=E.startRow;L<=E.endRow&&!$;L++){const te=e.findMerge(z,L);if(te&&(z!==te.range.startCol||L!==te.range.startRow))continue;const fe=el(e.resolveStyle(e.cells[e.cellKey(z,L)]));I===void 0?I=fe:fe!==I&&($=!0)}return $?kt:I??Vt});function ot(f){se("numberFormat",f),it()}function it(){const f=e.selection.value;if(f)for(let E=f.startCol;E<=f.endCol;E++)for(let I=f.startRow;I<=f.endRow;I++){const $=e.findMerge(E,I);if($&&(E!==$.range.startCol||I!==$.range.startRow))continue;const z=e.cellKey(E,I),L=e.cells[z],te=e.resolveStyle(L);if((te==null?void 0:te.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:fe,...We}=te,qe=Object.keys(We).length?e.registerStyle(We):0,rt=(L==null?void 0:L.value)??"";if(rt===""&&qe===0)e.delCell(z);else{const et={value:rt};qe>0&&(et.styleId=qe),e.cells[z]=et}}}function Rt(f){if(f===At){Ct.value=!0;return}ot(f)}function Bt(){Ct.value=!0}function xt(){const f=e.selection.value;if(!f)return[];const E=[];for(let I=f.startCol;I<=f.endCol;I++)for(let $=f.startRow;$<=f.endRow;$++){const z=e.findMerge(I,$);if(z&&(I!==z.range.startCol||$!==z.range.startRow))continue;const L=e.cellKey(I,$),te=e.cells[L],fe=e.resolveStyle(te),We=typeof(fe==null?void 0:fe.numberFormat)=="string"?fe.numberFormat:Vt,qe=(te==null?void 0:te.value)??"";Jl(We,qe)&&E.push({key:L,nf:We,decimals:jn(We,qe)})}return E}const Wt=t.computed(()=>xt().some(f=>f.decimals<xl)),dt=t.computed(()=>xt().some(f=>f.decimals>Ml));function B(f,E,I){var fe;const $=((fe=e.cells[f])==null?void 0:fe.value)??"",L={...e.resolveStyle(e.cells[f])??{}};E===""?(delete L.numberFormat,delete L.numberFormatCategory):(L.numberFormat=E,I==="custom"&&(L.numberFormatCategory="custom"));const te=Object.keys(L).length?e.registerStyle(L):0;if($===""&&te===0)e.delCell(f);else{const We={value:$};te>0&&(We.styleId=te),e.cells[f]=We}}function V(f){var $,z;const E=xt(),I=[];for(const L of E){const te=L.decimals+f;if(te<Ml||te>xl)continue;const fe=qn(L.nf,te);fe==null||fe===L.nf||I.push({key:L.key,code:fe,category:vt(L.nf)?"custom":void 0})}if(I.length){h();for(const L of I)B(L.key,L.code,L.category);($=e.scheduleRender)==null||$.call(e),(z=e.emitModelData)==null||z.call(e)}}function H(){V(1)}function ee(){V(-1)}return{undoStack:o,redoStack:l,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:h,undo:c,redo:y,canUndo:S,canRedo:x,hasSelection:C,paintFmt:b,onPaintFormat:R,applyPaintFormat:Z,clearFormat:Q,fontFamilyOptions:g,fontSizeOptions:F,FONT_FAMILY_MIXED:X,selFontFamily:me,selFontSize:ne,applyStyleToSelection:se,onFontFamilyChange:ue,onFontSizeChange:we,hAlignOptions:re,vAlignOptions:q,selHAlign:be,selVAlign:oe,selWrap:s,onHAlignChange:m,onVAlignChange:p,onWrapToggle:N,fontSizeInput:A,fontSizeMenuOpen:W,onFontSizeInput:k,onFontSizeBlur:he,onFontSizeKeydown:K,toggleFontSizeMenu:u,onFontSizeStepUp:M,onFontSizeStepDown:le,selFontWeight:P,selFontStyle:xe,selUnderline:$e,selStrikethrough:Ze,toggleFontWeight:at,toggleFontStyle:O,toggleUnderline:D,toggleStrikethrough:j,cachedTextColor:ke,cachedFillColor:_,textColorMenuOpen:J,fillColorMenuOpen:Be,_toggleTextColorMenu:ge,_toggleFillColorMenu:Me,onBorderMenuToggle:Ve,onTextColorChange:Ye,onFillColorChange:Qe,applyCachedTextColor:ct,applyCachedFillColor:mt,selTextColor:zt,selFillColor:st,nfOptions:ft,selNumberFormat:Qt,selNumberFormatDisplay:St,NF_NUMBER_FORMAT_MIXED:kt,nfDialogOpen:Ct,onNumberFormatChange:Rt,openNumberFormatDialog:Bt,applyNumberFormatCode:ot,canIncreaseDecimals:Wt,canDecreaseDecimals:dt,onIncreaseDecimals:H,onDecreaseDecimals:ee}}function ri(e,n){n.borderMenuOpen&&(e.borderMenuOpen=n.borderMenuOpen),n.mergeMenuOpen&&(e.mergeMenuOpen=n.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 ai(e,n){const o=t.ref("none"),l=t.ref(!1),a="#444";function i(p,N,A,W){if(p<0||N<0||p>=e.colCount||N>=e.rowCount)return;const k=e.findMerge(p,N),he=k?k.anchor:e.cellKey(p,N);if(!e.cells[he]){if(!W)return;e.cells[he]={value:""}}li(e.cells[he],A,W,e.styles,{get:u=>e.resolveBorder(u),getId:u=>e.registerBorder(u)},e.registerStyle)}function r(p,N,A){var M;const W=e.findMerge(p,N),k=W?W.anchor:e.cellKey(p,N),he=((M=e.cells[k])==null?void 0:M.value)??"",K=e.resolveStyle(e.cells[k])?{...e.resolveStyle(e.cells[k])}:{},u=e.registerBorder(A);if(u>0?K.borderId=u:delete K.borderId,delete K.borderTopWidth,delete K.borderBottomWidth,delete K.borderLeftWidth,delete K.borderRightWidth,delete K.borderColor,he===""&&!Object.keys(K).length)e.delCell(k);else{const le=e.registerStyle(K);e.cells[k]={value:he,styleId:le||void 0}}}function h(p){var M,le;o.value=p;const N=e.selection.value;if(!N)return;n.saveUndo();const{startCol:A,startRow:W,endCol:k,endRow:he}=N,K={width:1,color:a},u={width:2,color:a};if(p==="none")for(let ie=A;ie<=k;ie++)for(let P=W;P<=he;P++){const xe=e.findMerge(ie,P);xe&&(ie!==xe.range.startCol||P!==xe.range.startRow)||r(ie,P,{})}else if(p==="all")for(let ie=A;ie<=k;ie++)for(let P=W;P<=he;P++){const xe=e.findMerge(ie,P);xe&&(ie!==xe.range.startCol||P!==xe.range.startRow)||r(ie,P,{top:K,right:K,bottom:K,left:K})}else if(p==="outer"||p==="thickOuter"){const ie=p==="thickOuter"?u:K;for(let P=A;P<=k;P++)i(P,W,"top",ie);for(let P=A;P<=k;P++)i(P,he,"bottom",ie);for(let P=W;P<=he;P++)i(A,P,"left",ie);for(let P=W;P<=he;P++)i(k,P,"right",ie)}else{const P={top:{side:"top",edgeCheck:(xe,$e)=>$e===W},bottom:{side:"bottom",edgeCheck:(xe,$e)=>$e===he},left:{side:"left",edgeCheck:(xe,$e)=>xe===A},right:{side:"right",edgeCheck:(xe,$e)=>xe===k}}[p];if(P)for(let xe=A;xe<=k;xe++)for(let $e=W;$e<=he;$e++)P.edgeCheck(xe,$e)&&i(xe,$e,P.side,K)}(M=e.scheduleRender)==null||M.call(e),(le=e.emitModelData)==null||le.call(e)}function c(){h(o.value)}function y(p,N,A){const W=A.toLowerCase(),k=e.findMerge(p,N);if(k){if(W==="top"&&N!==k.range.startRow||W==="bottom"&&N!==k.range.endRow||W==="left"&&p!==k.range.startCol||W==="right"&&p!==k.range.endCol)return 0;const K=e.getCellBorderSide(e.cells[k.anchor],W);return(K==null?void 0:K.width)??0}const he=e.getCellBorderSide(e.cells[e.cellKey(p,N)],W);return(he==null?void 0:he.width)??0}const S=t.ref(!1);function x(p){S.value=p,p&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,l.value=!1,n.fontSizeMenuOpen.value=!1)}function C(p,N,A,W){const k=[];for(const he in e.merges){const K=e.merges[he];K&&K.startCol<=A&&K.endCol>=p&&K.startRow<=W&&K.endRow>=N&&k.push(he)}for(const he of k)Reflect.deleteProperty(e.merges,he)}function b(){var he,K,u;const p=e.selection.value;if(!p||p.startCol===p.endCol&&p.startRow===p.endRow)return;n.saveUndo(),C(p.startCol,p.startRow,p.endCol,p.endRow);const N=e.cellKey(p.startCol,p.startRow),A=((he=e.cells[N])==null?void 0:he.value)??"";for(let M=p.startCol;M<=p.endCol;M++)for(let le=p.startRow;le<=p.endRow;le++)M===p.startCol&&le===p.startRow||e.clearCellsInRange(M,M,le,le);const W=e.resolveStyle(e.cells[N])?{...e.resolveStyle(e.cells[N])}:{};W.textAlign="center";const k=e.registerStyle(W);e.cells[N]={value:A,styleId:k||void 0},e.merges[N]={startCol:p.startCol,startRow:p.startRow,endCol:p.endCol,endRow:p.endRow},e.selectCell(p.startCol,p.startRow),(K=e.scheduleRender)==null||K.call(e),(u=e.emitModelData)==null||u.call(e)}function R(){var N,A,W;const p=e.selection.value;if(!(!p||p.startCol===p.endCol)){n.saveUndo();for(let k=p.startRow;k<=p.endRow;k++){C(p.startCol,k,p.endCol,k);const he=e.cellKey(p.startCol,k);(N=e.cells[he])==null||N.value;for(let K=p.startCol+1;K<=p.endCol;K++)e.clearCellsInRange(K,K,k,k);e.merges[he]={startCol:p.startCol,startRow:k,endCol:p.endCol,endRow:k}}e.selectRange(p.startCol,p.startRow,p.endCol,p.endRow),(A=e.scheduleRender)==null||A.call(e),(W=e.emitModelData)==null||W.call(e)}}function Z(){var A,W,k;const p=e.selection.value;if(!p||p.startCol===p.endCol&&p.startRow===p.endRow)return;n.saveUndo(),C(p.startCol,p.startRow,p.endCol,p.endRow);const N=e.cellKey(p.startCol,p.startRow);(A=e.cells[N])==null||A.value;for(let he=p.startCol;he<=p.endCol;he++)for(let K=p.startRow;K<=p.endRow;K++)he===p.startCol&&K===p.startRow||e.clearCellsInRange(he,he,K,K);e.merges[N]={startCol:p.startCol,startRow:p.startRow,endCol:p.endCol,endRow:p.endRow},e.selectCell(p.startCol,p.startRow),(W=e.scheduleRender)==null||W.call(e),(k=e.emitModelData)==null||k.call(e)}function Q(){var N,A;const p=e.selection.value;p&&(n.saveUndo(),C(p.startCol,p.startRow,p.endCol,p.endRow),(N=e.scheduleRender)==null||N.call(e),(A=e.emitModelData)==null||A.call(e))}function g(){const p=e.selection.value;if(!p)return;const N=e.findMerge(p.startCol,p.startRow);N&&p.startCol===N.range.startCol&&p.startRow===N.range.startRow&&p.endCol===N.range.endCol&&p.endRow===N.range.endRow?Q():b()}function F(p){switch(p){case"mergeCenter":b();break;case"mergeAcross":R();break;case"mergeCells":Z();break;case"unmergeCells":Q();break}}let X=null,me=[];function ne(p,N,A,W){me=[];for(let k=A;k<=W;k++){const he=[];for(let K=p;K<=N;K++){const u=e.cells[e.cellKey(K,k)];he.push((u==null?void 0:u.styleId)??0)}me.push(he)}}function se(p,N,A,W){const k=e.cellKey(p,N);if(Al(),A===""||A==null){e.formulaDeps.clear(k),W&&W>0?e.cells[k]={value:"",styleId:W}:e.delCell(k),e.formulaDeps.markDirty(k);return}e.cells[k]={value:A,styleId:W&&W>0?W:void 0},A.startsWith("=")?e.formulaDeps.set(k,Hl(A.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(k),e.formulaDeps.markDirty(k)}function ue(){const p=e.selection.value;if(!p)return;X={...p},ne(p.startCol,p.endCol,p.startRow,p.endRow);const N=[];for(let A=p.startRow;A<=p.endRow;A++){const W=[];for(let k=p.startCol;k<=p.endCol;k++)W.push(e.getCellRaw(k,A));N.push(W.join(" "))}Il(N.join(`
|
|
4
|
-
`))}function
|
|
5
|
-
`))}else if(
|
|
6
|
-
`))}}}async function Ne(){var he;let p;try{p=await navigator.clipboard.readText()}catch{return}if(!p&&p!=="")return;const N=p.split(/\r?\n/),A=e.activeCell.value,W=X,k=W&&me.length>0;for(let K=0;K<N.length;K++){const u=N[K].split(" ");for(let M=0;M<u.length;M++){const le=A.col+M,ie=A.row+K;if(le<e.colCount&&ie<e.rowCount){let P=u[M];if(P.startsWith("=")&&W&&(P=ja(P,le-(W.startCol+M),ie-(W.startRow+K),e.colCount,e.rowCount,Ue)),k&&K<me.length&&M<(((he=me[K])==null?void 0:he.length)??0)){const xe=me[K][M]??null;se(le,ie,P,xe)}else e.setCellValue(le,ie,P)}}}}function Ae(){var p;if(n.saveUndo(),ue(),e.selection.value){const N=e.selection.value;e.clearCellsInRange(N.startCol,N.endCol,N.startRow,N.endRow),(p=e.scheduleRender)==null||p.call(e)}}function Pe(){var p;if(e.selection.value){const N=e.selection.value;e.clearCellsInRange(N.startCol,N.endCol,N.startRow,N.endRow),(p=e.scheduleRender)==null||p.call(e)}}function He(){var he,K;const p=e.selection.value;if(!p)return;n.saveUndo();const N=p.startCol,A=p.startRow,W=p.endCol,k=p.endRow;if(A===k)if(W+1<e.colCount){const u=`${Ue(N)}${A+1}:${Ue(W)}${A+1}`;e.setCellValue(W+1,A,`=SUM(${u})`)}else{const u=`${Ue(N)}${A+1}:${Ue(W-1)}${A+1}`;e.setCellValue(W,A,`=SUM(${u})`)}else for(let u=N;u<=W;u++)if(k+1<e.rowCount){const M=`${Ue(u)}${A+1}:${Ue(u)}${k+1}`;e.setCellValue(u,k+1,`=SUM(${M})`)}else{const M=`${Ue(u)}${A+1}:${Ue(u)}${k}`;e.setCellValue(u,k,`=SUM(${M})`)}(he=e.scheduleRender)==null||he.call(e),(K=e.emitModelData)==null||K.call(e)}function we(){var he,K;const p=e.selection.value;if(!p)return;n.saveUndo();const N=p.startCol,A=p.startRow,W=p.endCol,k=p.endRow;if(A===k)if(W+1<e.colCount){const u=`${Ue(N)}${A+1}:${Ue(W)}${A+1}`;e.setCellValue(W+1,A,`=AVERAGE(${u})`)}else{const u=`${Ue(N)}${A+1}:${Ue(W-1)}${A+1}`;e.setCellValue(W,A,`=AVERAGE(${u})`)}else for(let u=N;u<=W;u++)if(k+1<e.rowCount){const M=`${Ue(u)}${A+1}:${Ue(u)}${k+1}`;e.setCellValue(u,k+1,`=AVERAGE(${M})`)}else{const M=`${Ue(u)}${A+1}:${Ue(u)}${k}`;e.setCellValue(u,k,`=AVERAGE(${M})`)}(he=e.scheduleRender)==null||he.call(e),(K=e.emitModelData)==null||K.call(e)}function re(){var he,K;const p=e.selection.value;if(!p)return;n.saveUndo();const N=p.startCol,A=p.startRow,W=p.endCol,k=p.endRow;if(A===k)if(W+1<e.colCount){const u=`${Ue(N)}${A+1}:${Ue(W)}${A+1}`;e.setCellValue(W+1,A,`=COUNT(${u})`)}else{const u=`${Ue(N)}${A+1}:${Ue(W-1)}${A+1}`;e.setCellValue(W,A,`=COUNT(${u})`)}else for(let u=N;u<=W;u++)if(k+1<e.rowCount){const M=`${Ue(u)}${A+1}:${Ue(u)}${k+1}`;e.setCellValue(u,k+1,`=COUNT(${M})`)}else{const M=`${Ue(u)}${A+1}:${Ue(u)}${k}`;e.setCellValue(u,k,`=COUNT(${M})`)}(he=e.scheduleRender)==null||he.call(e),(K=e.emitModelData)==null||K.call(e)}const q=t.ref(!1);function be(p){q.value=p,p&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,l.value=!1,n.fontSizeMenuOpen.value=!1,S.value=!1)}function oe(){He(),q.value=!1}function s(){we(),q.value=!1}function m(){re(),q.value=!1}return{cachedBorder:o,borderMenuOpen:l,BORDER_COLOR:a,onBorderChange:h,setCellBorderSide:i,applyBorderToCell:r,applyCachedBorder:c,cellBorderWidth:y,mergeMenuOpen:S,onMergeMenuToggle:x,removeOverlappingMerges:C,mergeAndCenter:b,mergeAcross:R,mergeCells:Z,unmergeCells:Q,onApplyMerge:g,onMergeChange:F,copySourceRange:null,copySourceStyles:[],captureStyles:ne,setCellWithStyle:se,copyToClipboard:ue,copyRowCol:pe,pasteFromClipboard:Ne,cutSelected:Ae,clearSelected:Pe,sumSelected:He,avgSelected:we,countSelected:re,calcMenuOpen:q,onCalcMenuToggle:be,onCalcSum:oe,onCalcAvg:s,onCalcCount:m}}function ii(e,n,o,l){const a={},i=l(n),r=l(o);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 ci(e,n,o,l,a){function i(O,D){const j=D-O+1,ke=S(O,D);for(let _=O;_<=D;_++)for(let J=0;J<e.colCount;J++)e.delCell(e.cellKey(J,_));for(let _=O;_<e.rowCount-j;_++){for(let J=0;J<e.colCount;J++){const Be=e.cellKey(J,_+j),ge=e.cellKey(J,_);e.cells[Be]?(e.cells[ge]=e.cells[Be],e.delCell(Be)):e.delCell(ge)}e.rowHeights.value[_]=e.rowHeights.value[_+j]}for(let _=e.rowCount-j;_<e.rowCount;_++){for(let J=0;J<e.colCount;J++)e.delCell(e.cellKey(J,_));e.rowHeights.value[_]=void 0}y(ke)}function r(O,D){const j=D-O+1;if(D>=e.rowCount-1)return;const ke=C(O,D);for(let _=e.rowCount-1;_>D;_--){for(let J=0;J<e.colCount;J++){const Be=e.cellKey(J,_-j),ge=e.cellKey(J,_);e.cells[Be]?e.cells[ge]=e.cells[Be]:e.delCell(ge)}e.rowHeights.value[_]=e.rowHeights.value[_-j]}for(let _=D+1;_<=D+j;_++){for(let J=0;J<e.colCount;J++)e.delCell(e.cellKey(J,_));e.rowHeights.value[_]=void 0}y(ke)}function h(O,D){const j=D-O+1;if(D>=e.colCount-1)return;const ke=b(O,D);for(let _=e.colCount-1;_>D;_--){for(let J=0;J<e.rowCount;J++){const Be=e.cellKey(_-j,J),ge=e.cellKey(_,J);e.cells[Be]?e.cells[ge]=e.cells[Be]:e.delCell(ge)}e.colWidths.value[_]=e.colWidths.value[_-j]}for(let _=D+1;_<=D+j;_++){for(let J=0;J<e.rowCount;J++)e.delCell(e.cellKey(_,J));e.colWidths.value[_]=100}y(ke)}function c(O,D){const j=D-O+1,ke=x(O,D);for(let _=O;_<=D;_++)for(let J=0;J<e.rowCount;J++)e.delCell(e.cellKey(_,J));for(let _=O;_<e.colCount-j;_++){for(let J=0;J<e.rowCount;J++){const Be=e.cellKey(_+j,J),ge=e.cellKey(_,J);e.cells[Be]?(e.cells[ge]=e.cells[Be],e.delCell(Be)):e.delCell(ge)}e.colWidths.value[_]=e.colWidths.value[_+j]}for(let _=e.colCount-j;_<e.colCount;_++){for(let J=0;J<e.rowCount;J++)e.delCell(e.cellKey(_,J));e.colWidths.value[_]=100}y(ke)}function y(O){Object.keys(e.merges).forEach(D=>Reflect.deleteProperty(e.merges,D));for(const D of O)if(!(D.newRange.startCol>D.newRange.endCol||D.newRange.startRow>D.newRange.endRow)&&(e.merges[D.newAnchorKey]={...D.newRange},D.anchorCell)){const j=D.anchorCell.value,ke=D.anchorCell.styleId;j===""&&!ke||(e.cells[D.newAnchorKey]={value:j,styleId:ke||void 0})}}function S(O,D){const j=D-O+1,ke=[];for(const _ in e.merges){const J=e.merges[_];if(!J)continue;const Be=e.cells[_]?{value:e.cells[_].value,styleId:e.cells[_].styleId??0}:{value:"",styleId:0},{startCol:ge,endCol:Me}=J;let{startRow:Ve,endRow:Ye}=J;if(Ve>D){Ve-=j,Ye-=j,ke.push({newAnchorKey:e.cellKey(ge,Ve),newRange:{startCol:ge,startRow:Ve,endCol:Me,endRow:Ye}});continue}if(Ye<O){ke.push({newAnchorKey:_,newRange:{startCol:ge,startRow:Ve,endCol:Me,endRow:Ye}});continue}if(Ve>=O&&Ye<=D||(Ve>=O&&Ve<=D&&(Ve=O),Ye>=O&&Ye<=D?Ye=O-1:Ye>D&&(Ye-=j),Ve>Ye))continue;const Qe=ge,ct=Ve,mt=e.cellKey(Qe,ct),st=_.split(",").map(Number)[1],ft=st>=O&&st<=D||Qe!==J.startCol||ct!==st;ke.push({newAnchorKey:mt,newRange:{startCol:ge,startRow:Ve,endCol:Me,endRow:Ye},anchorCell:ft?Be:void 0})}return ke}function x(O,D){const j=D-O+1,ke=[];for(const _ in e.merges){const J=e.merges[_];if(!J)continue;const Be=e.cells[_]?{value:e.cells[_].value,styleId:e.cells[_].styleId??0}:{value:"",styleId:0};let{startCol:ge,endCol:Me}=J;const{startRow:Ve,endRow:Ye}=J;if(ge>D){ge-=j,Me-=j,ke.push({newAnchorKey:e.cellKey(ge,Ve),newRange:{startCol:ge,startRow:Ve,endCol:Me,endRow:Ye}});continue}if(Me<O){ke.push({newAnchorKey:_,newRange:{startCol:ge,startRow:Ve,endCol:Me,endRow:Ye}});continue}if(ge>=O&&Me<=D||(ge>=O&&ge<=D&&(ge=O),Me>=O&&Me<=D?Me=O-1:Me>D&&(Me-=j),ge>Me))continue;const Qe=ge,ct=Ve,mt=e.cellKey(Qe,ct),st=_.split(",").map(Number)[0],ft=st>=O&&st<=D||Qe!==st||ct!==J.startRow;ke.push({newAnchorKey:mt,newRange:{startCol:ge,startRow:Ve,endCol:Me,endRow:Ye},anchorCell:ft?Be:void 0})}return ke}function C(O,D){const j=D-O+1,ke=[];for(const _ in e.merges){const J=e.merges[_];if(!J)continue;const{startCol:Be,endCol:ge}=J;let{startRow:Me,endRow:Ve}=J;Ve<O?ke.push({newAnchorKey:_,newRange:{startCol:Be,startRow:Me,endCol:ge,endRow:Ve}}):Me>D?(Me+=j,Ve+=j,ke.push({newAnchorKey:e.cellKey(Be,Me),newRange:{startCol:Be,startRow:Me,endCol:ge,endRow:Ve}})):(Ve+=j,ke.push({newAnchorKey:_,newRange:{startCol:Be,startRow:Me,endCol:ge,endRow:Ve}}))}return ke}function b(O,D){const j=D-O+1,ke=[];for(const _ in e.merges){const J=e.merges[_];if(!J)continue;let{startCol:Be,endCol:ge}=J;const{startRow:Me,endRow:Ve}=J;ge<O?ke.push({newAnchorKey:_,newRange:{startCol:Be,startRow:Me,endCol:ge,endRow:Ve}}):Be>D?(Be+=j,ge+=j,ke.push({newAnchorKey:e.cellKey(Be,Me),newRange:{startCol:Be,startRow:Me,endCol:ge,endRow:Ve}})):(ge+=j,ke.push({newAnchorKey:_,newRange:{startCol:Be,startRow:Me,endCol:ge,endRow:Ve}}))}return ke}let R=0;function Z(){return R++,`s_${R}`}function Q(O){return{id:Z(),name:O,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([Q("Sheet1")]),F=t.ref(0);function X(){const O=g.value[F.value];O&&(O.cells={...e.cells},O.merges={...e.merges},O.selection=e.selection.value?{...e.selection.value}:null,O.activeCell={...e.activeCell.value},O.scrollX=e.scrollX.value,O.scrollY=e.scrollY.value,O.colWidths=[...e.colWidths.value],O.rowHeights=[...e.rowHeights.value],O.styles=[...e.styles],O.borders=[...e.borders])}function me(O){const D=g.value[O];D&&(Object.keys(e.cells).forEach(j=>e.delCell(j)),Object.assign(e.cells,D.cells),Object.keys(e.merges).forEach(j=>Reflect.deleteProperty(e.merges,j)),D.merges&&Object.assign(e.merges,D.merges),e.selection.value=D.selection?{...D.selection}:null,e.activeCell.value={...D.activeCell},e.scrollX.value=D.scrollX,e.scrollY.value=D.scrollY,e.colWidths.value=[...D.colWidths],e.rowHeights.value=[...D.rowHeights],e.syncStyles(D.styles),e.syncBorders(D.borders??[{}]),F.value=O)}function ne(O){O===F.value||O<0||O>=g.value.length||(e.cancelEdit(),X(),me(O))}function se(O){return n.saveUndo(),e.cancelEdit(),X(),g.value.push(Q(O??`Sheet${g.value.length+1}`)),me(g.value.length-1),g.value.length-1}function ue(O){return g.value.length<=1||(n.saveUndo(),e.cancelEdit(),g.value.splice(O,1),me(Math.min(O,g.value.length-1))),F.value}function pe(O,D){g.value[O]&&D.trim()&&(n.saveUndo(),g.value[O].name=D.trim())}function Ne(O){n.saveUndo(),e.cancelEdit(),X();const D=g.value[O];if(!D)return O;let j=D.name;const ke=j.match(/^(.*?)\s*\((\d+)\)$/);let _=ke?parseInt(ke[2],10)+1:2;ke&&(j=ke[1]);let J=`${j} (${_})`;const Be=new Set(g.value.map(Me=>Me.name));for(;Be.has(J);)_++,J=`${j} (${_})`;const ge={id:Z(),name:J,cells:{...D.cells},merges:D.merges?{...D.merges}:{},styles:[...D.styles],borders:D.borders?[...D.borders]:[{}],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]};return g.value.splice(O+1,0,ge),me(O+1),O+1}function Ae(O,D){var J;const j=O+D;if(j<0||j>=g.value.length)return;n.saveUndo();const ke=F.value,_=g.value.splice(O,1)[0];g.value.splice(j,0,_),ke===O?F.value=j:O<ke&&j>=ke?F.value=ke-1:O>ke&&j<=ke&&(F.value=ke+1),(J=e.scheduleRender)==null||J.call(e)}const Pe=t.computed(()=>g.value.length);let He="";const we=o;function re(){X();const O=g.value.map(j=>{const ke={};for(const[ge,Me]of Object.entries(j.cells))ke[ge]={value:Me.value},Me.styleId&&Me.styleId>0&&(ke[ge].styleId=Me.styleId);const _={name:j.name,cells:ke};j.styles&&j.styles.length>1&&(_.styles=[...j.styles]),j.borders&&j.borders.length>1&&(_.borders=[...j.borders]),j.merges&&Object.keys(j.merges).length&&(_.merges={...j.merges});const J={};for(let ge=0;ge<j.colWidths.length;ge++)j.colWidths[ge]!==100&&(J[ge]=j.colWidths[ge]);Object.keys(J).length&&(_.colWidths=J);const Be={};for(let ge=0;ge<j.rowHeights.length;ge++){const Me=j.rowHeights[ge];Me!=null&&(Be[ge]=Me)}return Object.keys(Be).length&&(_.rowHeights=Be),_}),D=JSON.stringify(O);D!==He&&(He=D,we.value=O,a&&(a.value=D))}e.emitModelData=re;let q=!1;function be(){q||(q=!0,Promise.resolve().then(()=>{q=!1,re()}))}const oe=t.computed(()=>e.props.theme==="dark"?Nn:Tn),s=t.computed(()=>ii(oe.value,e.props.width,e.props.height,Gt)),m=t.computed(()=>{const O={};for(const[D,j]of Object.entries(s.value))D.startsWith("--")&&(O[D]=j);return O}),p=t.ref(null),N=t.ref(null),A=t.ref(null),W=t.ref(null),k=t.reactive({w:800,h:600});e.viewSize&&t.watch(k,O=>{e.viewSize&&(e.viewSize.w=O.w,e.viewSize.h=O.h)},{deep:!0});const he=48,K=28,u=11,M=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,k.w-he-u))),le=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,k.h-K-u)));function ie(O,D){const j=Math.max(0,k.w-he-u),ke=Math.max(0,k.h-K-u);e.scrollX.value=Math.max(0,Math.min(O??e.scrollX.value,Math.max(0,e.totalWidth.value-j))),e.scrollY.value=Math.max(0,Math.min(D??e.scrollY.value,Math.max(0,e.totalHeight.value-ke)))}e.clampScroll=ie;function P(){var O;return typeof window>"u"?!1:!((O=window.matchMedia)!=null&&O.call(window,"(hover: none) and (pointer: coarse)").matches)}function xe(O=!1){t.nextTick(()=>{const D=A.value;if(D){if(!e.editingCell.value&&!P()){document.activeElement===D&&D.blur();return}D.focus({preventScroll:!0}),O&&D.select()}})}function $e(){xe()}function Ze(){var D;const O=e.selection.value;if(O){n.saveUndo();for(let j=O.startRow;j<=O.endRow;j++)e.rowHeights.value[j]=void 0;(D=e.scheduleRender)==null||D.call(e),re()}}function at(){var D;const O=e.selection.value;if(O){n.saveUndo();for(let j=O.startCol;j<=O.endCol;j++)e.colWidths.value[j]=100;(D=e.scheduleRender)==null||D.call(e),re()}}return{deleteRows:i,insertRows:r,insertCols:h,deleteCols:c,sheets:g,activeSheetIndex:F,saveSheet:X,loadSheet:me,switchSheet:ne,addSheet:se,removeSheet:ue,renameSheet:pe,dupSheet:Ne,moveSheet:Ae,sheetCount:Pe,mkSheet:Q,emitModelData:re,scheduleOptEmit:be,themeColors:oe,outerStyle:s,toolbarThemeVars:m,wrapperRef:p,canvasRef:N,editInputRef:A,formulaBarRef:W,viewSize:k,maxScrollX:M,maxScrollY:le,clampScroll:ie,canFocusHiddenEditor:P,focusEditInput:xe,onCanvasFocus:$e,resetRowHeight:Ze,resetColWidth:at,modelData:we}}function dn(e){return!!e&&e.width!==void 0&&e.width>0}function nt(e,n,o,l){const a=dn(e),i=dn(n);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return n;const r=e.width??0,h=n.width??0;return r>h?e:h>r?n:e}function si(e,n,o,l,a){let i=!1,r=null,h=1;function c(){i||(i=!0,requestAnimationFrame(()=>{i=!1,S()}))}e.scheduleRender=c;const y="#444";function S(){const d=l.canvasRef.value;if(!d)return;const v=l.wrapperRef.value;if(!v||(r=d.getContext("2d"),!r))return;h=window.devicePixelRatio||1;const U=v.getBoundingClientRect(),G=U.width,w=U.height;l.viewSize.w=G,l.viewSize.h=w,d.width=G*h,d.height=w*h,d.style.width=G+"px",d.style.height=w+"px",r.setTransform(h,0,0,h,0,0);const Y=e.scrollX.value,Ee=e.scrollY.value,Se=52,ve=24,Te=l.themeColors.value,Xe=e.colPositions.value,tt=e.rowPositions.value,wt=e.colWidths.value,yt=[];for(let ce=0;ce<e.rowCount;ce++)yt[ce]=tt[ce+1]-tt[ce];const Ht=Math.max(0,e.hitCol(Y));let ll=Ht;for(let ce=Ht;ce<e.colCount&&!(Se+Xe[ce]-Y>=G);ce++)ll=ce;const Kt=ll,Dt=Math.max(0,e.hitRow(Ee));let hl=Dt;for(let ce=Dt;ce<e.rowCount&&!(ve+tt[ce]-Ee>=w);ce++)hl=ce;const Tt=hl;let nl=Ht,ol=Dt;for(const ce in e.merges){const Ce=e.merges[ce];Ce&&(Ce.startRow>Tt||Ce.endRow<Dt||Ce.startCol>Kt||Ce.endCol<Ht||(Ce.startCol<nl&&(nl=Ce.startCol),Ce.startRow<ol&&(ol=Ce.startRow)))}r.fillStyle=Te.bg,r.fillRect(0,0,G,w),r.fillStyle=Te.gridBg,r.fillRect(Se,ve,G-Se,w-ve),r.save(),r.beginPath(),r.rect(Se,ve,G-Se,w-ve),r.clip();const ut=e.selection.value,fl=e.editingCell.value;for(let ce=ol;ce<=Tt;ce++)for(let Ce=nl;Ce<=Kt;Ce++){const Ie=e.findMerge(Ce,ce);if(Ie&&!(Ce===Ie.range.startCol&&ce===Ie.range.startRow))continue;const Fe=Se+Xe[Ce]-Y,_e=ve+tt[ce]-Ee;let je=wt[Ce],Je=yt[ce];if(Ie&&(je=Xe[Ie.range.endCol+1]-Xe[Ce],Je=tt[Ie.range.endRow+1]-tt[ce]),Fe+je<Se||_e+Je<ve||Fe>G||_e>w)continue;const Ut=e.findHighlight?e.findHighlight(Ce,ce):null,Ke=e.resolveStyle(e.cells[e.cellKey(Ce,ce)]),Ge=typeof(Ke==null?void 0:Ke.backgroundColor)=="string"?Ke.backgroundColor:"";if(Ge&&(r.fillStyle=Ge,r.fillRect(Fe,_e,je,Je)),Ut&&(r.fillStyle=Ut==="active"?Te.findActiveBg:Te.findMatchBg,r.fillRect(Fe,_e,je,Je)),e.isSelected(Ce,ce)&&(r.fillStyle=Te.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?r.fillRect(Fe,_e,wt[Ce],yt[ce]):r.fillRect(Fe,_e,je,Je)),e.activeCell.value.col===Ce&&e.activeCell.value.row===ce&&(r.strokeStyle=Te.activeCellBorder,r.lineWidth=2,r.strokeRect(Fe+1,_e+1,je-2,Je-2)),Ut==="active"&&(r.strokeStyle=Te.findActiveBg,r.lineWidth=2,r.strokeRect(Fe+1,_e+1,je-2,Je-2)),r.strokeStyle=Te.gridLine,r.lineWidth=.5,r.strokeRect(Fe+.25,_e+.25,je-.5,Je-.5),!(fl&&fl.col===Ce&&fl.row===ce)){const ye=e.resolveStyle(e.cells[e.cellKey(Ce,ce)]),Oe=e.getCellValue(Ce,ce),Le=typeof(ye==null?void 0:ye.numberFormat)=="string"?ye.numberFormat:"",ae=Oe?Bl(Oe,Le,e.locale.value):"";if(ae){const De=e.cellFontSize(Ce,ce),Re=typeof(ye==null?void 0:ye.fontFamily)=="string"&&ye.fontFamily?ye.fontFamily:al,ze=(ye==null?void 0:ye.fontWeight)==="bold"?"bold":"normal",Nt=(ye==null?void 0:ye.fontStyle)==="italic"?"italic":"normal",Li=(ye==null?void 0:ye.underline)==="underline",$i=(ye==null?void 0:ye.strikethrough)==="line-through",Wl=typeof(ye==null?void 0:ye.color)=="string"?ye.color:"",pn=typeof(ye==null?void 0:ye.textAlign)=="string"?ye.textAlign:Zl(Oe,Le)?"right":"left",hn=typeof(ye==null?void 0:ye.verticalAlign)=="string"?ye.verticalAlign:"top";r.fillStyle=Wl||Te.cellText,r.font=`${Nt} ${ze} ${De}px ${Re}`,r.textBaseline="alphabetic",r.save(),r.beginPath(),r.rect(Fe+5,_e+1,je-10,Je-2),r.clip();const gn=(ye==null?void 0:ye.wrap)==="wrap",gl=je-10;let _l=ae;const zi=!gn&&Yn(Le),yn=ae===kl||Xn(Oe,Le);if(yn||zi){if(yn){const Zt=Math.max(1,r.measureText("#").width),ml=Math.max(1,Math.floor(gl/Zt));_l="#".repeat(ml)}else if(e.getWrappedLines(r,ae,1e9,!1).some(Ot=>Ot&&r.measureText(Ot).width>gl)){const Ot=Math.max(1,r.measureText("#").width),rl=Math.max(1,Math.floor(gl/Ot));_l="#".repeat(rl)}}const yl=e.getWrappedLines(r,_l,gl,gn),{ascent:bl,descent:vl}=e.measureFontMetrics(Re,De,ze,Nt),Cl=bl+vl,Wi=yl.length*Cl;let wl;hn==="middle"?wl=_e+(Je-Wi)/2+bl:hn==="bottom"?wl=_e+Je-e.BASE_CELL_VPAD-vl-(yl.length-1)*Cl:wl=_e+e.BASE_CELL_VPAD+bl;for(let Zt=0;Zt<yl.length;Zt++){const ml=yl[Zt],Ot=wl+Zt*Cl,rl=r.measureText(ml);let Pt;if(pn==="center"?Pt=Fe+je/2-rl.width/2:pn==="right"?Pt=Fe+je-5-rl.width:Pt=Fe+5,r.fillText(ml,Pt,Ot),Li&&(r.strokeStyle=Wl||Te.cellText,r.lineWidth=1,r.beginPath(),r.moveTo(Pt,Ot+vl+1),r.lineTo(Pt+rl.width,Ot+vl+1),r.stroke()),$i){r.strokeStyle=Wl||Te.cellText,r.lineWidth=1;const bn=Ot-bl+Cl*.42;r.beginPath(),r.moveTo(Pt,bn),r.lineTo(Pt+rl.width,bn),r.stroke()}}r.restore()}}}const lt=(ce,Ce,Ie)=>{const Fe=e.findMerge(ce,Ce);return Fe?e.getCellBorderSide(e.cells[Fe.anchor],Ie):e.getCellBorderSide(e.cells[e.cellKey(ce,Ce)],Ie)};r.fillStyle=y;for(let ce=ol;ce<=Tt;ce++)for(let Ce=nl;Ce<=Kt;Ce++){const Ie=e.findMerge(Ce,ce);if(Ie&&!(Ce===Ie.range.startCol&&ce===Ie.range.startRow))continue;const Fe=Se+Xe[Ce]-Y,_e=ve+tt[ce]-Ee;let je=wt[Ce],Je=yt[ce];if(Ie&&(je=Xe[Ie.range.endCol+1]-Xe[Ce],Je=tt[Ie.range.endRow+1]-tt[ce]),Fe+je<Se||_e+Je<ve||Fe>G||_e>w)continue;const Ut=e.cells[e.cellKey(Ce,ce)],Ke={top:e.getCellBorderSide(Ut,"top"),right:e.getCellBorderSide(Ut,"right"),bottom:e.getCellBorderSide(Ut,"bottom"),left:e.getCellBorderSide(Ut,"left")};if(Ie){const Ge=Ie.range.startRow,ye=Ie.range.endRow,Oe=Ie.range.startCol,Le=Ie.range.endCol;for(let ae=Oe;ae<=Le;ae++){if(e.isSameMergeInternal(ae,Ge-1,ae,Ge))continue;const De=lt(ae,Ge-1,"bottom"),Re=nt(De,Ke.top);if(Re&&Re.width&&Re.width>0){const ze=Se+Xe[ae]-Y;r.fillStyle=Re.color||y,r.fillRect(ze,_e,wt[ae],Re.width)}}for(let ae=Oe;ae<=Le;ae++){if(e.isSameMergeInternal(ae,ye,ae,ye+1))continue;const De=lt(ae,ye+1,"top"),Re=nt(Ke.bottom,De);if(Re&&Re.width&&Re.width>0){const ze=Se+Xe[ae]-Y;r.fillStyle=Re.color||y,r.fillRect(ze,_e+Je-Re.width,wt[ae],Re.width)}}for(let ae=Ge;ae<=ye;ae++){if(e.isSameMergeInternal(Oe-1,ae,Oe,ae))continue;const De=lt(Oe-1,ae,"right"),Re=nt(De,Ke.left);if(Re&&Re.width&&Re.width>0){const ze=ve+tt[ae]-Ee;r.fillStyle=Re.color||y,r.fillRect(Fe,ze,Re.width,yt[ae])}}for(let ae=Ge;ae<=ye;ae++){if(e.isSameMergeInternal(Le,ae,Le+1,ae))continue;const De=lt(Le+1,ae,"left"),Re=nt(Ke.right,De);if(Re&&Re.width&&Re.width>0){const ze=ve+tt[ae]-Ee;r.fillStyle=Re.color||y,r.fillRect(Fe+je-Re.width,ze,Re.width,yt[ae])}}{const ae=e.isSameMergeInternal(Oe,Ge-1,Oe,Ge)?Ke.top:nt(lt(Oe,Ge-1,"bottom"),Ke.top),De=e.isSameMergeInternal(Oe-1,Ge,Oe,Ge)?Ke.left:nt(lt(Oe-1,Ge,"right"),Ke.left),Re=(ae==null?void 0:ae.width)??0,ze=(De==null?void 0:De.width)??0;Re>0&&ze>0&&(r.fillStyle=(ae==null?void 0:ae.color)||(De==null?void 0:De.color)||y,r.fillRect(Fe-ze,_e-Re,ze,Re))}{const ae=e.isSameMergeInternal(Le,Ge-1,Le,Ge)?Ke.top:nt(lt(Le,Ge-1,"bottom"),Ke.top),De=e.isSameMergeInternal(Le,Ge,Le+1,Ge)?Ke.right:nt(Ke.right,lt(Le+1,Ge,"left")),Re=(ae==null?void 0:ae.width)??0,ze=(De==null?void 0:De.width)??0;Re>0&&ze>0&&(r.fillStyle=(ae==null?void 0:ae.color)||(De==null?void 0:De.color)||y,r.fillRect(Fe+je,_e-Re,ze,Re))}{const ae=e.isSameMergeInternal(Oe,ye,Oe,ye+1)?Ke.bottom:nt(Ke.bottom,lt(Oe,ye+1,"top")),De=e.isSameMergeInternal(Oe-1,ye,Oe,ye)?Ke.left:nt(lt(Oe-1,ye,"right"),Ke.left),Re=(ae==null?void 0:ae.width)??0,ze=(De==null?void 0:De.width)??0;Re>0&&ze>0&&(r.fillStyle=(ae==null?void 0:ae.color)||(De==null?void 0:De.color)||y,r.fillRect(Fe-ze,_e+Je,ze,Re))}{const ae=e.isSameMergeInternal(Le,ye,Le,ye+1)?Ke.bottom:nt(Ke.bottom,lt(Le,ye+1,"top")),De=e.isSameMergeInternal(Le,ye,Le+1,ye)?Ke.right:nt(Ke.right,lt(Le+1,ye,"left")),Re=(ae==null?void 0:ae.width)??0,ze=(De==null?void 0:De.width)??0;Re>0&&ze>0&&(r.fillStyle=(ae==null?void 0:ae.color)||(De==null?void 0:De.color)||y,r.fillRect(Fe+je,_e+Je,ze,Re))}}else{const Ge={top:lt(Ce,ce-1,"bottom"),left:lt(Ce-1,ce,"right"),bottom:lt(Ce,ce+1,"top"),right:lt(Ce+1,ce,"left")},ye=nt(Ge.top,Ke.top),Oe=nt(Ge.left,Ke.left),Le=nt(Ke.bottom,Ge.bottom),ae=nt(Ke.right,Ge.right),De=(ye==null?void 0:ye.width)??0,Re=(Oe==null?void 0:Oe.width)??0,ze=(Le==null?void 0:Le.width)??0,Nt=(ae==null?void 0:ae.width)??0;De>0&&(r.fillStyle=(ye==null?void 0:ye.color)||y,r.fillRect(Fe,_e,je,De)),ze>0&&(r.fillStyle=(Le==null?void 0:Le.color)||y,r.fillRect(Fe,_e+Je-ze,je,ze)),Re>0&&(r.fillStyle=(Oe==null?void 0:Oe.color)||y,r.fillRect(Fe,_e,Re,Je)),Nt>0&&(r.fillStyle=(ae==null?void 0:ae.color)||y,r.fillRect(Fe+je-Nt,_e,Nt,Je)),De>0&&Re>0&&(r.fillStyle=(ye==null?void 0:ye.color)||(Oe==null?void 0:Oe.color)||y,r.fillRect(Fe-Re,_e-De,Re,De)),De>0&&Nt>0&&(r.fillStyle=(ye==null?void 0:ye.color)||(ae==null?void 0:ae.color)||y,r.fillRect(Fe+je,_e-De,Nt,De)),ze>0&&Re>0&&(r.fillStyle=(Le==null?void 0:Le.color)||(Oe==null?void 0:Oe.color)||y,r.fillRect(Fe-Re,_e+Je,Re,ze)),ze>0&&Nt>0&&(r.fillStyle=(Le==null?void 0:Le.color)||(ae==null?void 0:ae.color)||y,r.fillRect(Fe+je,_e+Je,Nt,ze))}}r.restore(),r.fillStyle=Te.headerBg,r.fillRect(Se,0,G-Se,ve);for(let ce=Ht;ce<=Kt;ce++){const Ce=Se+Xe[ce]-Y,Ie=wt[ce];Ce+Ie<Se||Ce>G||(ut&&ce>=ut.startCol&&ce<=ut.endCol&&(r.fillStyle=Te.selectionBg,r.fillRect(Ce,0,Ie,ve)),r.strokeStyle=Te.headerBorder,r.lineWidth=.5,r.strokeRect(Ce+.25,.25,Ie-.5,ve-.5),ut&&ce>=ut.startCol&&ce<=ut.endCol&&(r.strokeStyle=Te.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ce,ve-1),r.lineTo(Ce+Ie,ve-1),r.stroke()),r.fillStyle=Te.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(Ue(ce),Ce+Ie/2,ve/2))}r.strokeStyle=Te.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Se,ve+.5),r.lineTo(G,ve+.5),r.stroke(),r.fillStyle=Te.headerBg,r.fillRect(0,ve,Se,w-ve);for(let ce=Dt;ce<=Tt;ce++){const Ce=ve+tt[ce]-Ee,Ie=yt[ce];Ce+Ie<ve||Ce>w||(ut&&ce>=ut.startRow&&ce<=ut.endRow&&(r.fillStyle=Te.selectionBg,r.fillRect(0,Ce,Se,Ie)),r.strokeStyle=Te.headerBorder,r.lineWidth=.5,r.strokeRect(.25,Ce+.25,Se-.5,Ie-.5),ut&&ce>=ut.startRow&&ce<=ut.endRow&&(r.strokeStyle=Te.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Se-1,Ce),r.lineTo(Se-1,Ce+Ie),r.stroke()),r.fillStyle=Te.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(ce+1),Se/2,Ce+Ie/2+.5))}r.strokeStyle=Te.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Se+.5,ve),r.lineTo(Se+.5,w),r.stroke(),r.fillStyle=Te.headerBg,r.fillRect(0,0,Se,ve),r.strokeStyle=Te.headerSep,r.lineWidth=1,r.strokeRect(.5,.5,Se-.5,ve-.5)}const x=t.computed(()=>Ue(e.activeCell.value.col)+String(e.activeCell.value.row+1)),C=t.ref(""),b=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,v)=>{if(d&&!v){const U=e.editValue.value||e.getCellRaw(d.col,d.row)||"";C.value=U,F=!1}else!d&&v&&(C.value="",b.value=!1,F=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(C.value="",F=!1)});function Z(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),c())}function Q(d){const v=d.target.value;C.value=v,F=!0,e.editingCell.value||e.startEdit()}let g=!1,F=!1;function X(){var Y,Ee,Se,ve,Te,Xe,tt,wt,yt;if(g)return;const d=l.formulaBarRef.value,v=!!(d&&typeof document<"u"&&document.activeElement===d);if(!e.editingCell.value&&!v&&!F)return;const U={...e.activeCell.value},G=e.editingCell.value?e.editingCell.value.col:U.col,w=e.editingCell.value?e.editingCell.value.row:U.row;if(!e.editingCell.value){const Ht=e.getCellRaw(G,w),ll=C.value!==Ht;if(!F)return;g=!0,ll&&((Y=e.saveUndo)==null||Y.call(e),e.setCellValue(G,w,C.value),c(),(Ee=l.emitModelData)==null||Ee.call(l)),(Se=l.formulaBarRef.value)==null||Se.blur(),C.value="",b.value=!1,F=!1,t.nextTick(()=>{g=!1});return}g=!0,F?(e.editValue.value=C.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(ve=l.formulaBarRef.value)==null||ve.blur(),C.value="",b.value=!1,F=!1,c(),l.focusEditInput(),(Te=l.emitModelData)==null||Te.call(l),t.nextTick(()=>{g=!1})):v?(C.value=e.editValue.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(Xe=l.formulaBarRef.value)==null||Xe.blur(),C.value="",b.value=!1,F=!1,c(),l.focusEditInput(),(tt=l.emitModelData)==null||tt.call(l),t.nextTick(()=>{g=!1})):(e.commitEdit(),(wt=l.formulaBarRef.value)==null||wt.blur(),C.value="",b.value=!1,F=!1,c(),l.focusEditInput(),(yt=l.emitModelData)==null||yt.call(l),t.nextTick(()=>{g=!1}))}function me(){var d;g||(g=!0,e.editingCell.value&&e.cancelEdit(),(d=l.formulaBarRef.value)==null||d.blur(),C.value="",b.value=!1,F=!1,c(),l.focusEditInput(),t.nextTick(()=>{g=!1}))}function ne(d){if(!d.isComposing){if(d.key==="Enter"&&(d.altKey||d.metaKey)&&!d.ctrlKey){d.preventDefault(),d.stopPropagation();const v=d.target;if(!v)return;e.editingCell.value||e.startEdit();const U=v.selectionStart??v.value.length,G=v.selectionEnd??v.value.length,w=v.value,Y=w.substring(0,U)+`
|
|
7
|
-
`+
|
|
8
|
-
`).length:1)*fl,Ce=e.BASE_CELL_VPAD-nl;let Ie=0,Fe=0;return Kt==="middle"?(Ie=Math.floor((Tt-ce)/2),Fe=Math.max(0,Tt-ce-Ie)):Kt==="top"?(Ie=Ce,Fe=Math.max(0,Tt-ce-Ie)):Kt==="bottom"&&(Fe=Ce,Ie=Math.max(0,Tt-ce-Fe)),{left:`${52+e.colPositions.value[U]-e.scrollX.value}px`,top:`${24+e.rowPositions.value[G]-e.scrollY.value}px`,width:`${hl}px`,height:`${Tt}px`,fontFamily:Ee,fontSize:`${Y}px`,lineHeight:1,fontWeight:Se,fontStyle:ve,textDecoration:Xe,textAlign:ll,paddingTop:`${Ie}px`,paddingRight:"3px",paddingBottom:`${Fe}px`,paddingLeft:"3px",opacity:d?0:1,pointerEvents:d?"none":"auto",color:d?"transparent":tt,caretColor:d?"transparent":void 0,borderColor:d?"transparent":void 0,background:d?"transparent":wt,boxShadow:d?"none":void 0}});function D(){return Math.max(0,l.viewSize.w-52-11)}function j(){return Math.max(0,l.viewSize.h-24-11)}const ke=t.computed(()=>D()),_=t.computed(()=>j()),J=t.computed(()=>Math.max(0,ke.value-11*2)),Be=t.computed(()=>Math.max(0,_.value-11*2)),ge=t.computed(()=>l.maxScrollX.value<=0?J.value:Math.max(24,D()/e.totalWidth.value*J.value)),Me=t.computed(()=>l.maxScrollX.value<=0?0:e.scrollX.value/l.maxScrollX.value*(J.value-ge.value)),Ve=t.computed(()=>l.maxScrollY.value<=0?Be.value:Math.max(24,j()/e.totalHeight.value*Be.value)),Ye=t.computed(()=>l.maxScrollY.value<=0?0:e.scrollY.value/l.maxScrollY.value*(Be.value-Ve.value));let Qe=null,ct=0,mt=0;function zt(d){d.preventDefault(),Qe="v",ct=d.clientY,mt=e.scrollY.value,document.addEventListener("mousemove",ft),document.addEventListener("mouseup",Ct)}function st(d){d.preventDefault(),Qe="h",ct=d.clientX,mt=e.scrollX.value,document.addEventListener("mousemove",ft),document.addEventListener("mouseup",Ct)}function ft(d){if(Qe==="v"){const U=(d.clientY-ct)/(Be.value-Ve.value);l.clampScroll(null,mt+U*l.maxScrollY.value),c()}else if(Qe==="h"){const U=(d.clientX-ct)/(J.value-ge.value);l.clampScroll(mt+U*l.maxScrollX.value,null),c()}}function Ct(){Qe=null,document.removeEventListener("mousemove",ft),document.removeEventListener("mouseup",Ct)}function Qt(d){if(Qe)return;const v=d.currentTarget.getBoundingClientRect(),U=d.clientY-v.top;U<Ye.value?l.clampScroll(null,e.scrollY.value-j()):U>Ye.value+Ve.value&&l.clampScroll(null,e.scrollY.value+j()),c()}function el(d){if(Qe)return;const v=d.currentTarget.getBoundingClientRect(),U=d.clientX-v.left;U<Me.value?l.clampScroll(e.scrollX.value-D(),null):U>Me.value+ge.value&&l.clampScroll(e.scrollX.value+D(),null),c()}let St=!1,ot=0,it=0,Rt=!1,Bt=!1,xt=0,Wt=0,dt=0,B=0,V=0,H=0,ee=0,de=0,f=!1,E=!1,I=0,$=0,z="cell",L=0,te=-1,fe=-1;function We(d){if(d.button!==0)return;d.preventDefault(),re.value=null;const v=Yt(d,l.canvasRef.value);if(v.y<24&&v.x>=52){const w=v.x-52+e.scrollX.value,Y=e.hitCol(w);if(Y>=0&&Math.abs(v.x-(52+e.colPositions.value[Y+1]-e.scrollX.value))<=4){n.saveUndo(),Rt=!0,xt=Y,dt=e.colWidths.value[Y],B=w,c();return}}if(v.x<52&&v.y>=24){const w=v.y-24+e.scrollY.value,Y=e.hitRow(w);if(Y>=0&&Math.abs(v.y-(24+e.rowPositions.value[Y+1]-e.scrollY.value))<=4){n.saveUndo(),Bt=!0,Wt=Y,dt=e.getRowHeight(Y),B=w,c();return}}if(v.x<52||v.y<24){{const w=l.formulaBarRef.value,Y=!!(w&&typeof document<"u"&&document.activeElement===w);(e.editingCell.value||Y||F)&&X()}if(v.y<24&&v.x>=52){const w=e.hitCol(v.x-52+e.scrollX.value);w>=0&&(e.selectRange(w,0,w,e.rowCount-1,"col"),St=!0,ot=w,it=0)}else if(v.x<52&&v.y>=24){const w=e.hitRow(v.y-24+e.scrollY.value);w>=0&&(e.selectRange(0,w,e.colCount-1,w,"row"),St=!0,ot=0,it=w)}else v.x<52&&v.y<24&&e.selectAll();c();return}const U=e.hitCol(v.x-52+e.scrollX.value),G=e.hitRow(v.y-24+e.scrollY.value);if(!(U<0||G<0)){{const w=l.formulaBarRef.value,Y=!!(w&&typeof document<"u"&&document.activeElement===w);(e.editingCell.value||Y||F)&&X()}if(d.shiftKey&&e.selection.value){const w=e.selection.value;e.selectRange(w.startCol,w.startRow,U,G)}else e.selectCell(U,G);St=!0,ot=U,it=G,l.focusEditInput(),c()}}function qe(d){if(Rt){const Y=Yt(d,l.canvasRef.value).x-52+e.scrollX.value-B,Ee=dt+Y;Ee>=30&&Ee<=1e3?e.colWidths.value[xt]=Ee:Ee<30?e.colWidths.value[xt]=30:e.colWidths.value[xt]=1e3,c();return}if(Bt){const Y=Yt(d,l.canvasRef.value).y-24+e.scrollY.value-B,Ee=dt+Y;Ee>=24&&Ee<=500?e.rowHeights.value[Wt]=Ee:Ee<24?e.rowHeights.value[Wt]=24:e.rowHeights.value[Wt]=500,c();return}if(!St){const w=l.canvasRef.value;if(!w)return;if(n.paintFmt.value){w.style.cursor="copy";return}const Y=Yt(d,w);if(Y.y<24&&Y.x>=52){const Ee=e.hitCol(Y.x-52+e.scrollX.value);if(Ee>=0&&Math.abs(Y.x-(52+e.colPositions.value[Ee+1]-e.scrollX.value))<=4){w.style.cursor="col-resize";return}}if(Y.x<52&&Y.y>=24){const Ee=e.hitRow(Y.y-24+e.scrollY.value);if(Ee>=0&&Math.abs(Y.y-(24+e.rowPositions.value[Ee+1]-e.scrollY.value))<=4){w.style.cursor="row-resize";return}}w.style.cursor="cell";return}const v=Yt(d,l.canvasRef.value);if(ot<0||it<0)return;if(v.x<52||v.y<24){if(v.y<24&&v.x>=52){const w=e.hitCol(v.x-52+e.scrollX.value);w>=0&&e.selectRange(Math.min(ot,w),0,Math.max(ot,w),e.rowCount-1,"col")}else if(v.x<52&&v.y>=24){const w=e.hitRow(v.y-24+e.scrollY.value);w>=0&&e.selectRange(0,Math.min(it,w),e.colCount-1,Math.max(it,w),"row")}c();return}const U=e.hitCol(v.x-52+e.scrollX.value),G=e.hitRow(v.y-24+e.scrollY.value);U<0||G<0||(it===0&&ot>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(ot,U),0,Math.max(ot,U),e.rowCount-1,"col"):ot===0&&it>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(it,G),e.colCount-1,Math.max(it,G),"row"):e.selectRange(ot,it,U,G),c())}function rt(d){const v=Rt||Bt;St=!1,Rt=!1,Bt=!1,v&&l.scheduleOptEmit(),n.paintFmt.value&&n.applyPaintFormat()}function et(){const d=Rt||Bt;St=!1,Rt=!1,Bt=!1,d&&l.scheduleOptEmit()}function pt(d){d.preventDefault();const v=Yt(d,l.canvasRef.value);if(v.x<52&&v.y<24){A(d);return}if(v.y<24&&v.x>=52){const U=e.hitCol(v.x-52+e.scrollX.value);U>=0&&k(d,U);return}if(v.x<52&&v.y>=24){const U=e.hitRow(v.y-24+e.scrollY.value);U>=0&&W(d,U);return}if(v.x>=52&&v.y>=24){const U=e.hitCol(v.x-52+e.scrollX.value),G=e.hitRow(v.y-24+e.scrollY.value);U>=0&&G>=0&&he(d,U,G)}}function Mt(d){const v=Yt(d,l.canvasRef.value);if(v.x<52||v.y<24)return;const U=e.hitCol(v.x-52+e.scrollX.value),G=e.hitRow(v.y-24+e.scrollY.value);if(!(U<0||G<0)){{const w=l.formulaBarRef.value,Y=!!(w&&typeof document<"u"&&document.activeElement===w);(e.editingCell.value||Y||F)&&X()}e.selectCell(U,G),e.ensureVisible(U,G),e.startEdit(),c(),l.focusEditInput()}}function ht(d){l.clampScroll(e.scrollX.value+d.deltaX,e.scrollY.value+d.deltaY),c()}function dl(d){if(d.touches.length!==1){f=!1;return}const v=d.touches[0],U=l.canvasRef.value;if(!U)return;const G=U.getBoundingClientRect(),w=v.clientX-G.left,Y=v.clientY-G.top;w>=52&&Y>=24?(d.preventDefault(),f=!0,E=!1,z="cell",V=w,H=Y,ee=e.scrollX.value,de=e.scrollY.value,I=e.hitCol(w-52+e.scrollX.value),$=e.hitRow(Y-24+e.scrollY.value)):w>=0&&Y>=0&&(w<52||Y<24)&&(d.preventDefault(),f=!0,E=!1,V=w,H=Y,ee=e.scrollX.value,de=e.scrollY.value,Y<24&&w>=52?(z="col",I=e.hitCol(w-52+e.scrollX.value),$=-1):w<52&&Y>=24?(z="row",$=e.hitRow(Y-24+e.scrollY.value),I=-1):(z="all",I=-1,$=-1))}function _t(d){if(!f||d.touches.length!==1)return;const v=d.touches[0],U=l.canvasRef.value;if(!U)return;const G=U.getBoundingClientRect(),w=v.clientX-G.left,Y=v.clientY-G.top;(Math.abs(w-V)>8||Math.abs(Y-H)>8)&&(E=!0,d.preventDefault(),l.clampScroll(ee+(V-w),de+(H-Y)),c())}function tl(){if(f&&(f=!1,!E))if(z==="cell"&&I>=0&&$>=0){const d=Date.now();I===te&&$===fe&&d-L<300?(e.selectCell(I,$),e.startEdit(),c(),l.focusEditInput(),L=0):(e.commitEdit(),e.selectCell(I,$),c(),L=d),te=I,fe=$,l.focusEditInput()}else z==="col"&&I>=0?(e.commitEdit(),e.selectRange(I,0,I,e.rowCount-1,"col"),c()):z==="row"&&$>=0?(e.commitEdit(),e.selectRange(0,$,e.colCount-1,$,"row"),c()):z==="all"&&(e.commitEdit(),e.selectAll(),c())}function jt(d){return d.isComposing||d.key==="Process"||d.keyCode===229}function Ll(d){return d.key.length===1&&!d.ctrlKey&&!d.metaKey&&!d.altKey}function mn(d){if(e.editingCell.value)return;const v=d.ctrlKey||d.metaKey,U=d.shiftKey;switch(!0){case(v&&(d.key==="c"||d.key==="C")):d.preventDefault(),o.copyToClipboard();return;case(v&&(d.key==="x"||d.key==="X")):d.preventDefault(),o.cutSelected();return;case(v&&(d.key==="z"||d.key==="Z")):d.preventDefault(),n.undo();return;case(v&&(d.key==="y"||d.key==="Y")):d.preventDefault(),n.redo();return;case(v&&(d.key==="v"||d.key==="V")):d.preventDefault(),n.saveUndo(),o.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())});return;case(v&&(d.key==="a"||d.key==="A")):d.preventDefault(),e.selectAll(),c();return;case(v&&d.key==="Home"):d.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),c();return;case(v&&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(U?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case d.key==="Enter":d.preventDefault(),e.moveActive(0,U?-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(),n.saveUndo(),o.clearSelected(),c();return;case d.key==="Escape":d.preventDefault(),e.cancelEdit(),n.paintFmt.value=null,c();return;case Ll(d):if(jt(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 G=l.editInputRef.value;G&&(G.focus(),G.setSelectionRange(1,1))});return}}let $l=!1,zl=!1;function Ni(d){const v=d.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(v),C.value=v,c();return}e.editValue.value=v,C.value=v}function Ii(){$l=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),C.value="",c())}function Ai(d){$l=!1,zl=!0,setTimeout(()=>{zl=!1},0);const v=d.target.value;e.editValue.value=v,C.value=v}function Vi(d){if(!e.editingCell.value){if(Ll(d)||jt(d))return;mn(d);return}if(!($l||jt(d))&&!(zl&&(d.key==="Enter"||d.key==="Escape")))if(d.key==="Enter"&&(d.altKey||d.metaKey)){d.preventDefault();const v=l.editInputRef.value;if(!v)return;const U=v.selectionStart??v.value.length,G=v.selectionEnd??v.value.length,w=v.value,Y=w.slice(0,U)+`
|
|
9
|
-
`+w.slice(G);e.editValue.value=Y,v.value=Y,v.selectionStart=v.selectionEnd=U+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 Fi(d){e.editingCell.value}function Hi(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),c())},0)}let gt=null;function ul(){var v;const d=(v=l.wrapperRef.value)==null?void 0:v.getBoundingClientRect();if(d){const U=Gt(e.props.width),G=Gt(e.props.height);U!=null?l.viewSize.w=U:l.viewSize.w=d.width,G!=null?l.viewSize.h=G:l.viewSize.h=d.height}l.clampScroll(null,null),c()}function Oi(){t.onMounted(()=>{const d=Gt(e.props.width),v=Gt(e.props.height);(d==null||v==null)&&(gt=new ResizeObserver(()=>ul()),l.wrapperRef.value&>.observe(l.wrapperRef.value)),t.nextTick(()=>{ul(),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(U=>{const G=l.mkSheet(U.name),{cells:w,styles:Y}=cn(U.cells);if(Object.assign(G.cells,w),G.styles=U.styles??Y,U.borders)G.borders=U.borders;else{const Ee=sn(G.styles);G.styles=Ee.styles,G.borders=Ee.borders}if(U.colWidths)for(const[Ee,Se]of Object.entries(U.colWidths)){const ve=Number(Ee);ve>=0&&ve<e.colCount&&Se>=30&&(G.colWidths[ve]=Se)}if(U.rowHeights)for(const[Ee,Se]of Object.entries(U.rowHeights)){const ve=Number(Ee);ve>=0&&ve<e.rowCount&&Se>=24&&(G.rowHeights[ve]=Se)}if(U.merges)for(const[Ee,Se]of Object.entries(U.merges))G.merges[Ee]={...Se};return G}),l.sheets.value.length>0&&l.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const d=Gt(e.props.width),v=Gt(e.props.height);d!=null&&v!=null?(gt==null||gt.disconnect(),gt=null):!gt&&l.wrapperRef.value&&(gt=new ResizeObserver(()=>ul()),gt.observe(l.wrapperRef.value)),t.nextTick(()=>ul())}),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 v=JSON.stringify(d);if(v===a.value)return;a.value=v;const U=e.selection.value?{...e.selection.value}:null,G={...e.activeCell.value};l.sheets.value=d.map(w=>{const Y=l.mkSheet(w.name),{cells:Ee,styles:Se}=cn(w.cells);if(Object.assign(Y.cells,Ee),Y.styles=w.styles??Se,w.borders)Y.borders=w.borders;else{const ve=sn(Y.styles);Y.styles=ve.styles,Y.borders=ve.borders}if(w.colWidths)for(const[ve,Te]of Object.entries(w.colWidths)){const Xe=Number(ve);Xe>=0&&Xe<e.colCount&&Te>=30&&(Y.colWidths[Xe]=Te)}if(w.rowHeights)for(const[ve,Te]of Object.entries(w.rowHeights)){const Xe=Number(ve);Xe>=0&&Xe<e.rowCount&&Te>=24&&(Y.rowHeights[Xe]=Te)}if(w.merges)for(const[ve,Te]of Object.entries(w.merges))Y.merges[ve]={...Te};return Y}),l.sheets.value.length>0&&l.loadSheet(0),U&&(e.selection.value=U),e.activeCell.value=G,c()},{deep:!0}),t.onBeforeUnmount(()=>{gt==null||gt.disconnect()})}return{scheduleRender:c,render:S,activeCellLabel:x,formulaBarDisplay:R,formulaBarDraft:C,formulaBarExpanded:b,onFormulaBarFocus:Z,onFormulaBarInput:Q,onFormulaBarKeydown:ne,onFormulaBarBlur:se,acceptFormulaBarEdit:X,cancelFormulaBarEdit:me,renTab:ue,renTabVal:pe,onTabClick:Ne,onTabDblClick:Ae,commitTabRename:Pe,cclTabRename:He,onTabRenameKd:we,ctxMenu:re,ctxSubmenuLeft:s,onCtxItemEnter:m,onTabCtxMenu:p,onTabBarCtx:N,onCornerCtx:A,onRowHdrCtx:W,onColHdrCtx:k,onCellCtx:he,dimInputRef:K,dimPanel:u,openDimPanel:ie,onDimInput:P,onDimKeydown:xe,onDimBlur:$e,applyDimPanel:Ze,closeDimPanel:at,editInputStyle:O,hScrollbarW:ke,vScrollbarH:_,hTrackW:J,vTrackH:Be,hThumbW:ge,hThumbL:Me,vThumbH:Ve,vThumbT:Ye,onVStart:zt,onHStart:st,onSbMove:ft,onSbUp:Ct,onVTrk:Qt,onHTrk:el,onMouseDown:We,onMouseMove:qe,onMouseUp:rt,onMouseLeave:et,onCanvasCtx:pt,onDblClick:Mt,onWheel:ht,onTouchStart:dl,onTouchMove:_t,onTouchEnd:tl,onKeydown:mn,onEditInput:Ni,onEditCompositionStart:Ii,onEditCompositionEnd:Ai,onEditKd:Vi,onEditPaste:Fi,onEditBlur:Hi,applySize:ul,setupLifecycle:Oi}}function di(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function un(e,n,o,l){return n?l?o?e===n:e.toLowerCase()===n.toLowerCase():o?e.includes(n):e.toLowerCase().includes(n.toLowerCase()):!1}function ui(e,n,o,l){if(!n)return e;if(l){const i=e.indexOf(n);return i<0?e:e.slice(0,i)+o+e.slice(i+n.length)}const a=e.toLowerCase().indexOf(n.toLowerCase());return a<0?e:e.slice(0,a)+o+e.slice(a+n.length)}function fi(e,n,o,l){return n?l?e.indexOf(n)<0?e:e.split(n).join(o):e.toLowerCase().indexOf(n.toLowerCase())<0?e:e.replace(new RegExp(di(n),"gi"),()=>o):e}function Ol(e,n,o,l,a,i,r){const h=[];if(r){for(let c=r.startRow;c<=r.endRow;c++)for(let y=r.startCol;y<=r.endCol;y++){const S=e[o(y,c)];S&&un(S.value,l,a,i)&&h.push({sheetIndex:n,col:y,row:c})}return h}for(const c in e){const y=e[c];if(y&&un(y.value,l,a,i)){const S=c.split(","),x=Number(S[0]),C=Number(S[1]);!Number.isNaN(x)&&!Number.isNaN(C)&&h.push({sheetIndex:n,col:x,row:C})}}return h}function mi(e,n,o,l){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),h=t.ref("sheet"),c=t.ref(!1),y=t.ref(!1),S=t.ref(-1),x=t.ref([]),C=t.ref(""),b=t.ref(0),R=t.ref(""),Z=t.computed(()=>{const s=new Set,m=o.activeSheetIndex.value;for(const p of x.value)p.sheetIndex===m&&s.add(`${p.col},${p.row}`);return s}),Q=t.computed(()=>{if(S.value<0||S.value>=x.value.length)return null;const s=x.value[S.value];return s.sheetIndex!==o.activeSheetIndex.value?null:`${s.col},${s.row}`});e.findHighlight=(s,m)=>{const p=`${s},${m}`;return Q.value===p?"active":Z.value.has(p)?"match":null};function g(s){var N,A;const m=e.cellKey(s.col,s.row);if(s.sheetIndex===o.activeSheetIndex.value)return((N=e.cells[m])==null?void 0:N.value)??"";const p=o.sheets.value[s.sheetIndex];return((A=p==null?void 0:p.cells[m])==null?void 0:A.value)??""}function F(s,m){const p=e.cellKey(s.col,s.row);if(s.sheetIndex===o.activeSheetIndex.value)e.setCellValue(s.col,s.row,m);else{const N=o.sheets.value[s.sheetIndex];if(!N)return;const A=N.cells[p];N.cells[p]={value:String(m),styleId:A==null?void 0:A.styleId}}}function X(){if(R.value){C.value=R.value;return}if(!i.value){C.value="";return}if(h.value==="selection"&&!e.selection.value){C.value=T(e.locale.value,"findNeedSelection");return}if(x.value.length===0){C.value=T(e.locale.value,"findNoResult");return}C.value=""}function me(){const s=i.value,m=[];if(s)if(h.value==="workbook")o.sheets.value.forEach((p,N)=>{m.push(...Ol(p.cells,N,e.cellKey,s,c.value,y.value))});else if(h.value==="selection"){const p=e.selection.value;p&&m.push(...Ol(e.cells,o.activeSheetIndex.value,e.cellKey,s,c.value,y.value,p))}else m.push(...Ol(e.cells,o.activeSheetIndex.value,e.cellKey,s,c.value,y.value));x.value=m,m.length===0?S.value=-1:S.value>=m.length?S.value=m.length-1:S.value<0&&(S.value=0),X()}function ne(){if(S.value<0||S.value>=x.value.length)return;const s=x.value[S.value];s.sheetIndex!==o.activeSheetIndex.value&&o.switchSheet(s.sheetIndex),h.value==="selection"?e.activeCell.value={col:s.col,row:s.row}:e.selectCell(s.col,s.row),e.ensureVisible(s.col,s.row)}const se=typeof requestAnimationFrame=="function"?requestAnimationFrame:s=>setTimeout(s,16);let ue=!1,pe=!1;function Ne(s){if(ue){pe=pe||s;return}ue=!0,pe=s,se(()=>{var m;ue=!1,me(),pe&&x.value.length>0&&S.value>=0&&ne(),pe=!1,(m=e.scheduleRender)==null||m.call(e)})}function Ae(){var s;a.value=!0,b.value++,me(),x.value.length>0&&(S.value=0,ne()),(s=e.scheduleRender)==null||s.call(e)}function Pe(){Ae()}function He(){var s;a.value=!1,x.value=[],S.value=-1,R.value="",C.value="",(s=e.scheduleRender)==null||s.call(e)}function we(){var s;x.value.length!==0&&(S.value=(S.value+1)%x.value.length,ne(),(s=e.scheduleRender)==null||s.call(e))}function re(){var s;x.value.length!==0&&(S.value=(S.value-1+x.value.length)%x.value.length,ne(),(s=e.scheduleRender)==null||s.call(e))}function q(){var A,W;if(S.value<0||S.value>=x.value.length)return;const s=x.value[S.value],m=g(s),p=ui(m,i.value,r.value,c.value);if(p===m)return;n.saveUndo(),F(s,p);const N=S.value;me(),x.value.length>0?(S.value=Math.min(N,x.value.length-1),we()):S.value=-1,(A=e.emitModelData)==null||A.call(e),(W=e.scheduleRender)==null||W.call(e)}function be(){var N,A;const s=i.value;if(!s||x.value.length===0)return;n.saveUndo();let m=0;const p=x.value.slice();for(const W of p){const k=g(W),he=fi(k,s,r.value,c.value);he!==k&&(F(W,he),m++)}x.value=[],S.value=-1,R.value=T(e.locale.value,"findReplacedAll").replace("{n}",String(m)),X(),(N=e.emitModelData)==null||N.call(e),(A=e.scheduleRender)==null||A.call(e)}function oe(){const s=m=>{if(!(m.ctrlKey||m.metaKey))return;const N=m.key.toLowerCase();(N==="f"||N==="h")&&(m.preventDefault(),Ae())};window.addEventListener("keydown",s),t.onBeforeUnmount(()=>window.removeEventListener("keydown",s))}return t.watch(i,()=>{a.value&&(R.value="",S.value=0,Ne(!0))}),t.watch([h,c,y],()=>{a.value&&(R.value="",S.value=0,Ne(!0))}),t.watch(e.cells,()=>{a.value&&Ne(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&h.value==="selection"&&(S.value=0,Ne(!0))}),t.watch([()=>n.undoStack.value.length,()=>n.redoStack.value.length],()=>{a.value&&Ne(!1)}),{open:a,findText:i,replaceText:r,scope:h,matchCase:c,matchEntireCell:y,currentIndex:S,results:x,message:C,focusToken:b,activeSheetMatches:Z,activeMatchKey:Q,openFind:Ae,openReplace:Pe,close:He,recompute:me,findNext:we,findPrev:re,replace:q,replaceAll:be,setupLifecycle:oe}}const pi={class:"formula-bar__cell-label"},hi={class:"formula-bar__buttons"},gi=["rows","value"],yi=["title"],bi={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},vi={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Ci=["value"],wi={key:2,class:"sb-corner"},ki=["onClick","onMouseenter"],Ei={class:"context-menu__label"},Si={key:0,class:"context-menu__arrow"},Ri=["onClick"],Bi={class:"dim-panel__title"},xi={class:"dim-panel__body"},Mi=["value"],Di={key:0,class:"dim-panel__error"},Ti={class:"dim-panel__footer"},fn=Et(t.defineComponent({__name:"spreader",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const n=e,o=t.useModel(e,"data"),l={value:""},a=ni(n,{rowCount:n.rowCount,colCount:n.colCount,theme:n.theme,locale:n.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:oe=>{},mkSheet:oe=>({id:"",name:oe,cells:{},merges:{},styles:[{}],borders:[{}],selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[]})},r=oi(a,i),h=ai(a,r);ri(r,{borderMenuOpen:h.borderMenuOpen,mergeMenuOpen:h.mergeMenuOpen});const c=ci(a,r,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 y=si(a,r,h,c,l);y.setupLifecycle();const S=mi(a,r,c);S.setupLifecycle();const x=t.reactive(a),C=t.reactive(r),b=t.reactive(h),R=t.reactive(c),Z=c.sheets,Q=c.activeSheetIndex,g=t.reactive(y),F=t.reactive(S),X=t.computed(()=>{const oe=x.selection;return!!oe&&oe.startCol===oe.endCol&&oe.startRow===oe.endRow}),me=t.computed(()=>{const oe=C.selNumberFormat;if(oe!==kt&&oe!==At)return oe;const s=x.activeCell,m=a.resolveStyle(x.cells[x.cellKey(s.col,s.row)]);return typeof(m==null?void 0:m.numberFormat)=="string"?m.numberFormat:""});function ne(oe){r.nfDialogOpen.value=oe}function se(oe){r.fontSizeMenuOpen.value=oe}function ue(oe){r.textColorMenuOpen.value=oe}function pe(oe){r.fillColorMenuOpen.value=oe}function Ne(oe){y.renTabVal.value=oe}function Ae(){y.ctxMenu.value=null}const Pe=oe=>{c.formulaBarRef.value=oe};function He(){y.formulaBarExpanded.value=!y.formulaBarExpanded.value}const we=oe=>{c.wrapperRef.value=oe},re=oe=>{c.canvasRef.value=oe},q=oe=>{c.editInputRef.value=oe},be=oe=>{y.dimInputRef.value=oe};return(oe,s)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(R.outerStyle)},[t.createVNode(Ir,{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":b.borderMenuOpen,"cached-border":b.cachedBorder,"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":b.mergeMenuOpen,"calc-menu-open":b.calcMenuOpen,"is-single-cell":X.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]=m=>C.undo()),onRedo:s[1]||(s[1]=m=>C.redo()),onPaintFormat:C.onPaintFormat,onClearFormat:s[2]||(s[2]=m=>C.clearFormat()),onNumberFormatChange:s[3]||(s[3]=m=>C.onNumberFormatChange(m)),onIncreaseDecimals:C.onIncreaseDecimals,onDecreaseDecimals:C.onDecreaseDecimals,onFontFamilyChange:s[4]||(s[4]=m=>C.onFontFamilyChange(m)),onFontSizeInput:s[5]||(s[5]=m=>C.onFontSizeInput(m)),onFontSizeBlur:C.onFontSizeBlur,onFontSizeKeydown:s[6]||(s[6]=m=>C.onFontSizeKeydown(m)),onFontSizeChange:s[7]||(s[7]=m=>C.onFontSizeChange(m)),"onUpdate:fontSizeMenuOpen":s[8]||(s[8]=m=>se(m)),onFontSizeToggle:s[9]||(s[9]=m=>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]=m=>C.onTextColorChange(m)),"onUpdate:textColorMenuOpen":s[11]||(s[11]=m=>ue(m)),onFillColorChange:s[12]||(s[12]=m=>C.onFillColorChange(m)),"onUpdate:fillColorMenuOpen":s[13]||(s[13]=m=>pe(m)),onApplyTextColor:C.applyCachedTextColor,onApplyFillColor:C.applyCachedFillColor,"onUpdate:borderMenuOpen":s[14]||(s[14]=m=>C.onBorderMenuToggle(m)),onBorderChange:s[15]||(s[15]=m=>b.onBorderChange(m)),onApplyBorder:b.applyCachedBorder,onHAlignChange:s[16]||(s[16]=m=>C.onHAlignChange(m)),onVAlignChange:s[17]||(s[17]=m=>C.onVAlignChange(m)),onWrapToggle:C.onWrapToggle,"onUpdate:mergeMenuOpen":s[18]||(s[18]=m=>b.onMergeMenuToggle(m)),onMergeChange:s[19]||(s[19]=m=>b.onMergeChange(m)),onApplyMerge:b.onApplyMerge,"onUpdate:calcMenuOpen":s[20]||(s[20]=m=>b.onCalcMenuToggle(m)),onCalcSum:b.onCalcSum,onCalcAvg:b.onCalcAvg,onCalcCount:b.onCalcCount,onFind:s[21]||(s[21]=m=>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","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","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg","onCalcCount"]),t.createVNode(ca,{open:F.open,"find-text":F.findText,"replace-text":F.replaceText,scope:F.scope,"match-case":F.matchCase,"match-entire-cell":F.matchEntireCell,"current-index":F.currentIndex,total:F.results.length,message:F.message,"focus-token":F.focusToken,locale:x.locale,"theme-vars":R.toolbarThemeVars,"onUpdate:findText":s[22]||(s[22]=m=>t.unref(S).findText.value=m),"onUpdate:replaceText":s[23]||(s[23]=m=>t.unref(S).replaceText.value=m),"onUpdate:scope":s[24]||(s[24]=m=>t.unref(S).scope.value=m),"onUpdate:matchCase":s[25]||(s[25]=m=>t.unref(S).matchCase.value=m),"onUpdate:matchEntireCell":s[26]||(s[26]=m=>t.unref(S).matchEntireCell.value=m),onPrev:s[27]||(s[27]=m=>t.unref(S).findPrev()),onNext:s[28]||(s[28]=m=>t.unref(S).findNext()),onReplace:s[29]||(s[29]=m=>t.unref(S).replace()),onReplaceAll:s[30]||(s[30]=m=>t.unref(S).replaceAll()),onClose:s[31]||(s[31]=m=>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(Wa,{"model-open":C.nfDialogOpen,locale:x.locale,"current-format":me.value,"is-custom":C.selNumberFormat===t.unref(At),"onUpdate:modelOpen":s[32]||(s[32]=m=>ne(m)),onApply:s[33]||(s[33]=m=>C.applyNumberFormatCode(m))},null,8,["model-open","locale","current-format","is-custom"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":g.formulaBarExpanded}])},[t.createElementVNode("div",pi,t.toDisplayString(g.activeCellLabel),1),t.createElementVNode("div",hi,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:s[34]||(s[34]=t.withModifiers(()=>{},["prevent"])),onClick:s[35]||(s[35]=t.withModifiers((...m)=>g.cancelFormulaBarEdit&&g.cancelFormulaBarEdit(...m),["stop"]))},[...s[85]||(s[85]=[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[36]||(s[36]=t.withModifiers(()=>{},["prevent"])),onClick:s[37]||(s[37]=t.withModifiers((...m)=>g.acceptFormulaBarEdit&&g.acceptFormulaBarEdit(...m),["stop"]))},[...s[86]||(s[86]=[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("textarea",{ref:Pe,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":g.formulaBarExpanded}]),rows:g.formulaBarExpanded?3:1,value:g.formulaBarDisplay,spellcheck:"false",onFocus:s[38]||(s[38]=(...m)=>g.onFormulaBarFocus&&g.onFormulaBarFocus(...m)),onInput:s[39]||(s[39]=(...m)=>g.onFormulaBarInput&&g.onFormulaBarInput(...m)),onKeydown:s[40]||(s[40]=(...m)=>g.onFormulaBarKeydown&&g.onFormulaBarKeydown(...m)),onBlur:s[41]||(s[41]=(...m)=>g.onFormulaBarBlur&&g.onFormulaBarBlur(...m))},null,42,gi),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:g.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:s[42]||(s[42]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(He,["stop"])},[g.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",vi,[...s[88]||(s[88]=[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",bi,[...s[87]||(s[87]=[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,yi)],2),t.createElementVNode("div",{ref:we,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:re,class:"grid-canvas",tabindex:"0",onMousedown:s[43]||(s[43]=(...m)=>g.onMouseDown&&g.onMouseDown(...m)),onMousemove:s[44]||(s[44]=(...m)=>g.onMouseMove&&g.onMouseMove(...m)),onMouseup:s[45]||(s[45]=(...m)=>g.onMouseUp&&g.onMouseUp(...m)),onMouseleave:s[46]||(s[46]=(...m)=>g.onMouseLeave&&g.onMouseLeave(...m)),onDblclick:s[47]||(s[47]=(...m)=>g.onDblClick&&g.onDblClick(...m)),onWheel:s[48]||(s[48]=t.withModifiers((...m)=>g.onWheel&&g.onWheel(...m),["prevent"])),onFocus:s[49]||(s[49]=(...m)=>R.onCanvasFocus&&R.onCanvasFocus(...m)),onKeydown:s[50]||(s[50]=(...m)=>g.onKeydown&&g.onKeydown(...m)),onContextmenu:s[51]||(s[51]=(...m)=>g.onCanvasCtx&&g.onCanvasCtx(...m)),onTouchstart:s[52]||(s[52]=t.withModifiers((...m)=>g.onTouchStart&&g.onTouchStart(...m),["prevent"])),onTouchmove:s[53]||(s[53]=t.withModifiers((...m)=>g.onTouchMove&&g.onTouchMove(...m),["prevent"])),onTouchend:s[54]||(s[54]=(...m)=>g.onTouchEnd&&g.onTouchEnd(...m))},null,32),t.createElementVNode("textarea",{ref:q,class:"cell-editor",value:x.editValue,style:t.normalizeStyle(g.editInputStyle),onInput:s[55]||(s[55]=(...m)=>g.onEditInput&&g.onEditInput(...m)),onKeydown:s[56]||(s[56]=(...m)=>g.onEditKd&&g.onEditKd(...m)),onCompositionstart:s[57]||(s[57]=(...m)=>g.onEditCompositionStart&&g.onEditCompositionStart(...m)),onCompositionend:s[58]||(s[58]=(...m)=>g.onEditCompositionEnd&&g.onEditCompositionEnd(...m)),onBlur:s[59]||(s[59]=(...m)=>g.onEditBlur&&g.onEditBlur(...m)),onPaste:s[60]||(s[60]=(...m)=>g.onEditPaste&&g.onEditPaste(...m))},null,44,Ci),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[61]||(s[61]=t.withModifiers(m=>{R.clampScroll(null,x.scrollY-50),g.scheduleRender()},["prevent"]))},[...s[89]||(s[89]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:s[63]||(s[63]=(...m)=>g.onVTrk&&g.onVTrk(...m))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:g.vThumbT+"px",height:g.vThumbH+"px"}),onMousedown:s[62]||(s[62]=(...m)=>g.onVStart&&g.onVStart(...m))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:s[64]||(s[64]=t.withModifiers(m=>{R.clampScroll(null,x.scrollY+50),g.scheduleRender()},["prevent"]))},[...s[90]||(s[90]=[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[65]||(s[65]=t.withModifiers(m=>{R.clampScroll(x.scrollX-50,null),g.scheduleRender()},["prevent"]))},[...s[91]||(s[91]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:s[67]||(s[67]=(...m)=>g.onHTrk&&g.onHTrk(...m))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:g.hThumbL+"px",width:g.hThumbW+"px"}),onMousedown:s[66]||(s[66]=(...m)=>g.onHStart&&g.onHStart(...m))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:s[68]||(s[68]=t.withModifiers(m=>{R.clampScroll(x.scrollX+50,null),g.scheduleRender()},["prevent"]))},[...s[92]||(s[92]=[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",wi)):t.createCommentVNode("",!0)]),t.createVNode(Pr,{locale:x.locale,sheets:t.unref(Z),"active-sheet-index":t.unref(Q),"ren-tab":g.renTab,"ren-tab-val":g.renTabVal,onTabClick:s[69]||(s[69]=m=>g.onTabClick(m)),onTabDblclick:s[70]||(s[70]=m=>g.onTabDblClick(m)),onTabContextmenu:s[71]||(s[71]=m=>g.onTabCtxMenu(m.ev,m.i)),onTabRenameInput:s[72]||(s[72]=m=>Ne(m)),onTabRenameKeydown:s[73]||(s[73]=m=>g.onTabRenameKd(m)),onTabRenameCommit:g.commitTabRename,onTabbarContextmenu:s[74]||(s[74]=m=>g.onTabBarCtx(m)),onDeleteSheet:s[75]||(s[75]=m=>{R.removeSheet(m),g.scheduleRender()}),onAddSheet:s[76]||(s[76]=m=>{R.addSheet(),g.scheduleRender()})},null,8,["locale","sheets","active-sheet-index","ren-tab","ren-tab-val","onTabRenameCommit"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[g.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:g.ctxMenu.x+"px",top:g.ctxMenu.y+"px"}),onClick:s[77]||(s[77]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.ctxMenu.items,(m,p)=>(t.openBlock(),t.createElementBlock("div",{key:p,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":m.disabled}]),onClick:N=>!m.disabled&&m.action&&(m.action(),Ae()),onMouseenter:N=>g.onCtxItemEnter(N,m)},[t.createElementVNode("span",Ei,t.toDisplayString(m.label),1),m.children?(t.openBlock(),t.createElementBlock("span",Si)):t.createCommentVNode("",!0),m.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":g.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.children,(N,A)=>(t.openBlock(),t.createElementBlock("div",{key:A,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":N.disabled}]),onClick:t.withModifiers(W=>!N.disabled&&N.action&&(N.action(),Ae()),["stop"])},t.toDisplayString(N.label),11,Ri))),128))],2)):t.createCommentVNode("",!0)],42,ki))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[g.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:g.dimPanel.x+"px",top:g.dimPanel.y+"px"}),onMousedown:s[83]||(s[83]=t.withModifiers(()=>{},["stop"])),onClick:s[84]||(s[84]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Bi,t.toDisplayString(g.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",xi,[t.createElementVNode("input",{ref:be,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":g.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:g.dimPanel.value,onInput:s[78]||(s[78]=(...m)=>g.onDimInput&&g.onDimInput(...m)),onKeydown:s[79]||(s[79]=(...m)=>g.onDimKeydown&&g.onDimKeydown(...m)),onBlur:s[80]||(s[80]=(...m)=>g.onDimBlur&&g.onDimBlur(...m))},null,42,Mi),s[93]||(s[93]=t.createElementVNode("span",{class:"dim-panel__unit"},"px",-1))]),g.dimPanel.error?(t.openBlock(),t.createElementBlock("div",Di,t.toDisplayString(g.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Ti,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:s[81]||(s[81]=(...m)=>g.applyDimPanel&&g.applyDimPanel(...m))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:s[82]||(s[82]=(...m)=>g.closeDimPanel&&g.closeDimPanel(...m))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-e9e7c7f1"]]);Lt.Spreader=fn,Lt.default=fn,Object.defineProperties(Lt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(Wt,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(Wt=typeof globalThis<"u"?globalThis:Wt||self,t(Wt.XiaoDaoSpreader={},Wt.Vue))})(this,function(Wt,t){"use strict";const Rn={"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:"将多个文本连接合并为一个文本",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",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=Rn[e])==null?void 0:n[o])??o}const il='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',Ft=10,xn=[{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'}],Bn=[{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}],Mn='<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>',Dn='<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>',Nn='<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>',Tn='<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>',Vn='<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>',An='<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>',In=[{value:"left",labelKey:"alignLeft",icon:Mn},{value:"center",labelKey:"alignCenter",icon:Dn},{value:"right",labelKey:"alignRight",icon:Nn}],Fn=[{value:"top",labelKey:"alignTop",icon:Tn},{value:"middle",labelKey:"alignMiddle",icon:Vn},{value:"bottom",labelKey:"alignBottom",icon:An}],Pl=[{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>'}],On={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)"},Hn={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)"},Ot="__nf_custom__",Mt="",Ht="",yt="@",Bl="__NF_INVALID__",Ml=2958465,Dl=0;function Ct(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function Nl(e){return e==="zh-CN"?"¥":"$"}function Ln(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Gl(e){return e.replace(/"([^"]*)"/g,"$1")}function $n(e){let o=e,n;const l=o.match(/^\[([^\]]+)\]/);l&&(n=l[1].toLowerCase(),o=o.slice(l[0].length)),o=Ln(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 g=-1;for(let P=o.length-1;P>=0;P--){const ee=o[P];if(ee==="0"||ee==="#"||ee==="?"||ee==="E"){g=P;break}}g<0&&(g=r);const c=r>0?o.slice(0,r):"",b=g<o.length-1?o.slice(g+1):"",R=o.slice(r,g+1),B=/[0#?]/.test(R),C=R.includes(",");let k=R.replace(/,/g,"");if(a){const P=k.search(/E/i);P>=0&&(k=k.slice(0,P))}const j=k.indexOf("."),Z=j>=0?k.slice(0,j):k,te=j>=0?k.slice(j+1):"",U=(te.match(/[0#?]/g)||[]).length,h=(te.match(/0/g)||[]).length,le=(Z.match(/0/g)||[]).length;return{hasDigits:B,decimals:U,minDecimals:h,minIntDigits:le,thousands:C,scale:i?100:1,scientific:a,prefix:c,suffix:b,color:n}}function _n(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:Gl(i),len:0}):o.push({type:"literal",text:i,len:0})}}return{tokens:o,isDuration:n}}const Yl=new Map;function zn(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:g}=_n(i);return{kind:g?"duration":"date",sections:[],tokens:r,isDuration:g,raw:e}}return{kind:"number",sections:e.split(";").map(i=>$n(i)),tokens:[],isDuration:!1,raw:e}}function Lt(e){const o=Yl.get(e);if(o)return o;const n=zn(e);return Yl.set(e,n),n}function Xl(e,o,n,l,a){const i=Math.pow(10,o),r=Math.round((e+Number.EPSILON)*i)/i,g=r<0,c=Math.abs(r);let R=new Intl.NumberFormat("en-US",{useGrouping:l,minimumIntegerDigits:a,minimumFractionDigits:o,maximumFractionDigits:o}).format(c);if(n<o&&o>0){const C=R.indexOf(".");if(C>=0){const y=R.substring(0,C);let k=R.substring(C+1);k=k.replace(/0+$/,""),k.length<n&&(k=k+"0".repeat(n-k.length)),R=k?`${y}.${k}`:y}}return`${g?"-":""}${R}`}function jl(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=Xl(l,o,o,!1,1),i=(n>=0?"+":"-")+String(Math.abs(n)).padStart(2,"0");return`${a}E${i}`}function Wn(e,o,n){if(!n.hasDigits)return Gl(n.prefix+n.suffix);const l=n.scale===100?e*100:e,a=n.scientific?jl(l,n.decimals):Xl(l,n.decimals,n.minDecimals,n.thousands,n.minIntDigits);return o+n.prefix+a+n.suffix}function Kn(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),Wn(a,i,l)}function Un(e){return new Date((e-25569)*864e5)}const Pn=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Gn=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Zl=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],Yn=["January","February","March","April","May","June","July","August","September","October","November","December"],Xn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ql=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function el(e,o){return String(e).padStart(o,"0")}function jn(e,o,n,l){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),g=e.getUTCDay(),c=n==="zh-CN";let b="",R=!1;for(const B of o)switch(B.type){case"literal":b+=B.text??"";break;case"year":b+=B.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":b+=el(R?e.getUTCMinutes():i,B.len);break;case"monthName":b+=B.len>=4?c?Pn[i-1]:Yn[i-1]:c?Gn[i-1]:Xn[i-1];break;case"day":b+=el(r,B.len);break;case"weekday":b+=B.len>=4?c?Zl[g]:ql[g]:c?Zl[g].slice(2):ql[g].slice(0,3);break;case"hour":{let C=e.getUTCHours();if(B.len===0){const y=Math.floor(l*86400);C=Math.floor(y/3600)}b+=String(C),R=!0;break}case"minute":b+=el(e.getUTCMinutes(),B.len);break;case"second":b+=el(e.getUTCSeconds(),B.len);break;case"ampm":{const C=e.getUTCHours();b+=C<12?c?"上午":"AM":c?"下午":"PM";break}}return b}function Zn(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 g of o)switch(g.type){case"literal":r+=g.text??"";break;case"hour":r+=String(l);break;case"minute":r+=el(a,g.len||2);break;case"second":r+=el(i,g.len||2);break;default:r+=""}return r}function qn(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)?jl(o,9):e}return e}function jt(e,o,n){if(Ct(o))return qn(e);if(o==null||o===yt)return e;const l=Lt(o);if(l.kind==="date"||l.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(l.kind==="date"){if(i<Dl||i>Ml)return Bl}else if(i<0)return Bl;return l.kind==="duration"?Zn(i,l.tokens):jn(Un(i),l.tokens,n,i)}const a=Number(e);return isNaN(a)?e:Kn(a,l)}const Jn=["general","text","number","percent","scientific","accounting","financial","currency","currencyRounded","date","time","dateTime","duration","custom"];function Jl(e,o){if(o===yt||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=Lt(o);return!!(n.kind==="number"&&Ql(n))}function Ql(e){return e.sections.some(o=>o.hasDigits)}function Qn(e){if(e==null||Ct(e)||e===yt||e==="@")return!1;const o=Lt(e);return!!(o.kind==="date"||o.kind==="duration"||o.kind==="number"&&Ql(o))}function eo(e,o){if(o==null||Ct(o)||o===yt||o==="@")return!1;const n=Lt(o),l=Number(e);return Number.isFinite(l)?n.kind==="date"?l<Dl||l>Ml:n.kind==="duration"?l<0:!1:!1}const Tl=30,Vl=0;function hl(e){if(e==null||e===""||e.trim()==="")return!1;const o=Number(e);return!Number.isNaN(o)&&Number.isFinite(o)}function en(e,o){if(e==null||e===Mt||Ct(e))return hl(o);if(e===yt)return!1;const n=Lt(e);return n.kind==="date"||n.kind==="duration"?!1:n.sections.some(l=>l.hasDigits)}function to(e,o){if(!en(e,o))return-1;if(e==null||e===Mt||Ct(e))return 0;const l=Lt(e).sections.find(a=>a.hasDigits);return l?l.decimals:-1}function lo(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),g=r.search(/[0#?]/);if(g===-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<g)return e;const b=r.slice(g,c+1),R=b.search(/E[+-]/i),B=R>=0?b.slice(0,R):b,C=B.indexOf("."),y=C>=0?(B.slice(C+1).match(/[0#?]/g)||[]).length:0;if(y===o)return e;let k;if(C<0)k=o>0?B+"."+"0".repeat(o):B;else if(o>y)k=B+"0".repeat(o-y);else{let Z=y-o;const te=B.split("");for(let U=te.length-1;U>=0&&Z>0;U--){const h=te[U];(h==="0"||h==="#"||h==="?")&&(te.splice(U,1),Z--)}k=te.join(""),o===0&&k.endsWith(".")&&(k=k.slice(0,-1))}const j=k+(R>=0?b.slice(R):"");return i+r.slice(0,g)+j+r.slice(c+1)}function no(e,o){if(!Number.isInteger(o)||o<Vl||o>Tl||e===Mt)return null;if(e==null||Ct(e))return o>0?"0."+"0".repeat(o):"0";if(e===yt)return null;const n=Lt(e);return n.kind==="date"||n.kind==="duration"||!n.sections.some(l=>l.hasDigits)?null:e.split(";").map(l=>lo(l,o)).join(";")}const Al=["¥","$","€","£"];function tn(e,o){if(e==null||e===Mt)return e??Ht;if(Ct(e))return Ht;if(e===yt||e==="@")return yt;const n=Nl(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(ln(o).some(y=>y.value===e))return e;const c=e.replace(/\[[^\]]*\]/gi,y=>/^\[(h|mm|ss)\]$/i.test(y)?y:"");if(/\[(h|mm|ss)\]/i.test(c)&&!/[yd]/i.test(c))return"[h]:mm:ss";const b=/[yd]/i.test(c),R=/h|s|AM\/PM/i.test(c);if(b&&R)return a;if(b||/AM\/PM/i.test(c))return l;if(R)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 B=Al.find(y=>e.startsWith(y));if(B)return e.includes("(")?i:/\.\d/.test(e.slice(B.length))?n+"#,##0.00":n+"#,##0";const C=Lt(e);return C.kind==="number"&&C.sections.some(y=>y.hasDigits)?"#,##0.00":Ot}function oo(e,o){return new Date(Date.UTC(e,o,0)).getUTCDate()}function ro(e,o,n){const l=Date.UTC(e,o-1,n)/864e5+25569;return l<=60?l-1:l}function Il(e,o,n=new Date){const l=e.trim();if(!l||l.startsWith("=")||hl(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 g(C){const y=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(C);if(!y)return null;const k=Number(y[1]),j=Number(y[2]),Z=y[3]!==void 0?Number(y[3]):0;return k>23||j>59||Z>59?null:(k*3600+j*60+Z)/86400}function c(C){let y=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(C),k,j,Z;if(y)k=Number(y[1]),j=Number(y[2]),Z=Number(y[3]);else if(y=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(C))k=Number(y[1]),j=Number(y[2]),Z=Number(y[3]);else if(y=/^(\d{1,2})[-/](\d{1,2})$/.exec(C))k=n.getUTCFullYear(),j=Number(y[1]),Z=Number(y[2]);else return null;if(k<1900||k>9999||j<1||j>12||Z<1||Z>oo(k,j))return null;const te=ro(k,j,Z);return te>=Dl&&te<=Ml?te:null}const b=g(l);if(b!==null)return{serial:b,format:r};const R=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(l);if(R){const C=c(R[1].trim()),y=g(R[2]);if(C!==null&&y!==null)return{serial:C+y,format:i}}const B=c(l);return B!==null?{serial:B,format:a}:null}function ao(e,o){const n=e.trim();if(!n||n.startsWith("=")||!(n.includes(",")||n.includes("%")||Al.some(U=>n.startsWith(U)))||Il(n,o))return null;const a=Al.find(U=>n.startsWith(U)),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 g=r[1]==="-"?-1:1,c=r[2].replace(/,/g,""),b=r[3],R=(r[4]??"")==="%",B=b?b.length:0,C=+(c+(b?"."+b:""));if(!Number.isFinite(C))return null;const k=i.includes(",")?"#,##0":"0",j=B>0?"."+"0".repeat(B):"",Z=(a??"")+k+j+(R?"%":"");let te=C*g;return R&&(te=te/100),te=Math.round(te*1e12)/1e12,{num:te,format:Z}}function io(e,o,n,l){const a=Nl(e),i=l?"#,##0":"0",r=n>0?"."+"0".repeat(n):"",g=i+r;switch(o){case"general":return"";case"text":return yt;case"custom":return"";case"number":return g;case"percent":return g+"%";case"scientific":return"0."+"0".repeat(n)+"E+00";case"currency":return a+g;case"currencyRounded":return a+(l?"#,##0":"0");case"accounting":return`${a}${g};(${a}${g});${a}"-"`;case"financial":return`${g};[Red](${g})`;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 ln(e){const o=Nl(e);return[{label:T(e,"nfGeneral"),value:Ht},{label:T(e,"nfText"),value:yt},{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:Ot}]}const co=["title"],so=["innerHTML"],uo={key:1,class:"sp-dropdown__value"},fo=["disabled"],mo=["placeholder"],po=["onClick"],ho=["innerHTML"],go={class:"sp-dropdown__item-label"},bo={key:2,class:"sp-dropdown__empty"},yo=["disabled"],Co=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),g=t.ref(null),c=t.ref(null),b=t.ref({top:0,up:!1}),R=t.ref(void 0),B=t.ref(0),C=t.ref(!1),y=t.ref(""),k=t.ref(null),j=t.computed(()=>n.options.find(m=>String(m.value)===String(n.modelValue))),Z=t.computed(()=>n.menuWidth!==void 0?n.menuWidth:R.value),te=t.computed(()=>{if(!n.searchable||!y.value.trim())return n.options;const m=y.value.trim().toLowerCase();return n.options.filter(D=>String(D.label??"").toLowerCase().includes(m))}),U=t.computed(()=>te.value.length>0),h=t.computed(()=>Math.min(n.visibleCount,te.value.length)),le=t.computed(()=>te.value.slice(i.value,i.value+h.value)),P=t.computed(()=>i.value>0),ee=t.computed(()=>i.value+h.value<te.value.length),ve=t.computed(()=>te.value.length>h.value);function Be(m){i.value=Math.max(0,Math.min(te.value.length-h.value,i.value+m))}function ge(){a.value=!0,n.searchable&&(y.value=""),n.modelOpen!==void 0&&l("update:modelOpen",!0);const m=n.triggerEl??r.value;if(!m)return;const D=m.getBoundingClientRect();R.value=D.width;const I=h.value*22+(ve.value?2*15:0)+8+(n.searchable?34:0),E=window.innerHeight-D.bottom-4<I&&D.top-4>I;n.align==="right"?b.value={right:window.innerWidth-D.right,top:E?D.top-I-4:D.bottom+4,up:E}:b.value={left:D.left,top:E?D.top-I-4:D.bottom+4,up:E};const s=te.value.findIndex(u=>String(u.value)===String(n.modelValue));i.value=s>=0?Math.max(0,Math.min(s-Math.floor(h.value/2),te.value.length-h.value)):0,n.searchable&&t.nextTick(()=>{var u;return(u=k.value)==null?void 0:u.focus()})}function se(){a.value=!1,y.value="",n.modelOpen!==void 0&&l("update:modelOpen",!1)}function xe(){a.value?se():ge()}function Ue(m){l("update:modelValue",m.value),l("change",m.value),se()}function we(m){var I,K;if(!a.value)return;const D=m.target;(I=r.value)!=null&&I.contains(D)||(K=c.value)!=null&&K.contains(D)||se()}function me(m){a.value&&(m.preventDefault(),Be(m.deltaY>0?1:-1))}t.watch(a,m=>{t.nextTick(()=>{var D,I;m?((D=g.value)==null||D.addEventListener("wheel",me,{passive:!1}),document.addEventListener("keydown",ye)):((I=g.value)==null||I.removeEventListener("wheel",me),document.removeEventListener("keydown",ye))})});function ye(m){a.value&&m.key==="Escape"&&se()}t.watch(()=>n.modelOpen,m=>{m!==void 0&&m!==a.value&&(m?ge():se())});function Le(m){a.value&&(B.value=m.touches[0].clientY,C.value=!0)}function $e(m){if(!a.value||!C.value)return;const D=m.touches[0].clientY-B.value;Math.abs(D)>5&&(Be(D<0?1:-1),B.value=m.touches[0].clientY)}function G(){C.value=!1}function pe(m){m.key==="Escape"&&(m.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)}),(m,D)=>{var I,K;return t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"sp-dropdown",style:t.normalizeStyle(typeof e.width=="number"?{width:e.width+"px"}:{width:e.width})},[e.hideTrigger?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__trigger",{"sp-dropdown__trigger--open":a.value}]),title:e.title,onClick:xe},[(I=j.value)!=null&&I.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:j.value.icon},null,8,so)):(t.openBlock(),t.createElementBlock("span",uo,t.toDisplayString(((K=j.value)==null?void 0:K.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,co)),(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":b.value.up}]),style:t.normalizeStyle({left:b.value.left!==void 0?b.value.left+"px":void 0,right:b.value.right!==void 0?b.value.right+"px":void 0,top:b.value.top+"px",minWidth: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"]))},[ve.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]=E=>Be(-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,fo)):t.createCommentVNode("",!0),e.searchable?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"searchInputRef",ref:k,"onUpdate:modelValue":D[1]||(D[1]=E=>y.value=E),class:"sp-dropdown__search",type:"text",placeholder:e.searchPlaceholder,onMousedown:D[2]||(D[2]=t.withModifiers(()=>{},["stop"]))},null,40,mo)),[[t.vModelText,y.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:g,class:"sp-dropdown__list",onTouchstart:Le,onTouchmove:$e,onTouchend:G},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(le.value,E=>(t.openBlock(),t.createElementBlock("button",{key:String(E.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(E.value)===String(e.modelValue)}]),onClick:s=>Ue(E)},[E.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:E.icon},null,8,ho)):t.createCommentVNode("",!0),t.createElementVNode("span",go,t.toDisplayString(E.label),1)],10,po))),128))],544),e.searchable&&!U.value?(t.openBlock(),t.createElementBlock("div",bo," 无匹配 ")):t.createCommentVNode("",!0),ve.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]=E=>Be(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,yo)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),pt=(e,o)=>{const n=e.__vccOpts||e;for(const[l,a]of o)n[l]=a;return n},ht=pt(Co,[["__scopeId","data-v-ee298762"]]),vo=["title","onClick"],nn=pt(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"}]],g=t.computed(()=>l.colorKey==="fill"?r:i);function c(U){return T(l.locale,U)}function b(U){const h=l.currentColor;return!h&&!U?!0:h?h.toLowerCase()===U.toLowerCase():!1}const R=t.ref(!1),B=t.ref(null),C=t.ref(null),y=t.ref({top:0});t.watch(()=>l.modelOpen,U=>{U!==void 0&&U!==R.value&&(U?j():Z())});function k(U){const h=B.value,le=C.value,P=U.target;h&&h.contains(P)||le&&le.contains(P)||Z()}function j(){R.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const U=l.triggerEl??B.value;if(U){const h=U.getBoundingClientRect(),le=150,P=120;let ee=window.innerWidth-h.right,ve=h.bottom+4,Be;h.left-P<4&&(ee=void 0,Be=Math.max(4,h.left)),ve+le>window.innerHeight-4&&(ve=h.top-le-4),ve<4&&(ve=4),y.value=ee!==void 0?{right:ee,top:ve}:{left:Be,top:ve}}document.addEventListener("pointerdown",k)})}function Z(){R.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",k)}function te(U){a("update:modelValue",U),a("change",U),Z()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",k)}),o({open:R,openMenu:j,close:Z}),(U,h)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:B,class:"color-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:"color-picker__menu",style:t.normalizeStyle({left:y.value.left!==void 0?y.value.left+"px":void 0,right:y.value.right!==void 0?y.value.right+"px":void 0,top:y.value.top+"px"}),onMousedown:h[0]||(h[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.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":b(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:ve=>te(ee.value)},null,14,vo))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-70f3dfdc"]]),wo=["title","onClick"],ko={viewBox:"0 0 30 30",class:"border-picker__icon"},Eo=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],So={class:"border-picker__label"},Ro=pt(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}],g={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 b(U,h){return c[U].includes(h)?"thick":g[U].includes(h)?"solid":"dashed"}const R=t.ref(!1),B=t.ref(null),C=t.ref(null),y=t.ref({top:0});t.watch(()=>l.modelOpen,U=>{U!==void 0&&U!==R.value&&(U?j():Z())});function k(U){const h=B.value,le=C.value,P=U.target;h&&h.contains(P)||le&&le.contains(P)||Z()}function j(){R.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const U=l.triggerEl??B.value;if(U){const h=U.getBoundingClientRect(),le=200,P=160;let ee=window.innerWidth-h.right,ve=h.bottom+4,Be;h.left-P<4&&(ee=void 0,Be=Math.max(4,h.left)),ve+le>window.innerHeight-4&&(ve=h.top-le-4),ve<4&&(ve=4),y.value=ee!==void 0?{right:ee,top:ve}:{left:Be,top:ve}}document.addEventListener("pointerdown",k)})}function Z(){R.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",k)}function te(U){a("change",U),Z()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",k)}),o({open:R,openMenu:j,close:Z}),(U,h)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:B,class:"border-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:"border-picker__menu",style:t.normalizeStyle({left:y.value.left!==void 0?y.value.left+"px":void 0,right:y.value.right!==void 0?y.value.right+"px":void 0,top:y.value.top+"px"}),onMousedown:h[0]||(h[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,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",ko,[(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":b(le.key,P.name)==="thick"?3:1.5,"stroke-dasharray":b(le.key,P.name)==="dashed"?"0 4":"none","stroke-linecap":b(le.key,P.name)==="dashed"?"round":"square"},null,8,Eo)),64))])),t.createElementVNode("span",So,t.toDisplayString(t.unref(T)(e.locale,le.i18nKey)),1)],8,wo)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-551c0ffe"]]),xo=["title","onClick"],Bo={viewBox:"0 0 1024 1024",class:"sort-picker__icon",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},Mo=["x1","y1","x2","y2"],Do=["d"],No={class:"sort-picker__label"},To=pt(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}],g={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},c=t.ref(!1),b=t.ref(null),R=t.ref(null),B=t.ref({top:0});t.watch(()=>l.modelOpen,Z=>{Z!==void 0&&Z!==c.value&&(Z?y():k())});function C(Z){const te=b.value,U=R.value,h=Z.target;te&&te.contains(h)||U&&U.contains(h)||k()}function y(){c.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const Z=l.triggerEl??b.value;if(Z){const te=Z.getBoundingClientRect(),U=84,h=160;let le=window.innerWidth-te.right,P=te.bottom+4,ee;te.left-h<4&&(le=void 0,ee=Math.max(4,te.left)),P+U>window.innerHeight-4&&(P=te.top-U-4),P<4&&(P=4),B.value=le!==void 0?{right:le,top:P}:{left:ee,top:P}}document.addEventListener("pointerdown",C)})}function k(){c.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",C)}function j(Z){a("change",Z),k()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",C)}),o({open:c,openMenu:y,close:k}),(Z,te)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:b,class:"sort-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[c.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:R,class:"sort-picker__menu",style:t.normalizeStyle({left:B.value.left!==void 0?B.value.left+"px":void 0,right:B.value.right!==void 0?B.value.right+"px":void 0,top:B.value.top+"px"}),onMousedown:te[0]||(te[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,U=>t.createElementVNode("button",{key:U.key,class:"sort-picker__item",title:t.unref(T)(e.locale,U.i18nKey),onClick:h=>j(U.key)},[(t.openBlock(),t.createElementBlock("svg",Bo,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,h=>t.createElementVNode("line",{key:h.name,x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2},null,8,Mo)),64)),t.createElementVNode("path",{d:g[U.key]},null,8,Do)])),t.createElementVNode("span",No,t.toDisplayString(t.unref(T)(e.locale,U.i18nKey)),1)],8,xo)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-45929b74"]]),Vo=["title","onClick"],Ao=["innerHTML"],Io={class:"merge-picker__label"},Fo=pt(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),g=t.ref(null),c=t.ref({top:0});t.watch(()=>l.modelOpen,y=>{y!==void 0&&y!==i.value&&(y?R():B())});function b(y){const k=r.value,j=g.value,Z=y.target;k&&k.contains(Z)||j&&j.contains(Z)||B()}function R(){i.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const y=l.triggerEl??r.value;if(y){const k=y.getBoundingClientRect(),j=Pl.length*30+12,Z=160;let te=window.innerWidth-k.right,U=k.bottom+4,h;k.left-Z<4&&(te=void 0,h=Math.max(4,k.left)),U+j>window.innerHeight-4&&(U=k.top-j-4),U<4&&(U=4),c.value=te!==void 0?{right:te,top:U}:{left:h,top:U}}document.addEventListener("pointerdown",b)})}function B(){i.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",b)}function C(y){a("change",y),B()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",b)}),o({open:i,openMenu:R,close:B}),(y,k)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"merge-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:g,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:k[0]||(k[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Pl),j=>(t.openBlock(),t.createElementBlock("button",{key:j.key,class:"merge-picker__item",title:t.unref(T)(e.locale,j.labelKey),onClick:Z=>C(j.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:j.icon},null,8,Ao),t.createElementVNode("span",Io,t.toDisplayString(t.unref(T)(e.locale,j.labelKey)),1)],8,Vo))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-edd36208"]]),Oo=["disabled","title","onClick"],Ho={class:"calc-picker__label"},Lo=pt(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),g=t.ref(null),c=t.ref(null),b=t.ref({top:0});t.watch(()=>l.modelOpen,k=>{k!==void 0&&k!==r.value&&(k?B():C())});function R(k){const j=g.value,Z=c.value,te=k.target;j&&j.contains(te)||Z&&Z.contains(te)||C()}function B(){r.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const k=l.triggerEl??g.value;if(k){const j=k.getBoundingClientRect(),Z=i.length*30+12,te=160;let U=window.innerWidth-j.right,h=j.bottom+4,le;j.left-te<4&&(U=void 0,le=Math.max(4,j.left)),h+Z>window.innerHeight-4&&(h=j.top-Z-4),h<4&&(h=4),b.value=U!==void 0?{right:U,top:h}:{left:le,top:h}}document.addEventListener("pointerdown",R)})}function C(){r.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",R)}function y(k){l.disabled||(a("change",k),C())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",R)}),o({open:r,openMenu:B,close:C}),(k,j)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:g,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:b.value.left!==void 0?b.value.left+"px":void 0,right:b.value.right!==void 0?b.value.right+"px":void 0,top:b.value.top+"px"}),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=>y(Z.key)},[t.createElementVNode("span",Ho,t.toDisplayString(t.unref(T)(e.locale,Z.labelKey)),1)],10,Oo)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-01a18e00"]]),$o={class:"tb-item","data-key":"undo"},_o=["title","disabled"],zo={class:"tb-item","data-key":"redo"},Wo=["title","disabled"],Ko={class:"tb-item","data-key":"paint"},Uo=["title","disabled"],Po={class:"tb-item","data-key":"clear"},Go=["title","disabled"],Yo={class:"tb-item","data-key":"font"},Xo={class:"tb-item","data-key":"fontSize"},jo={class:"toolbar-font-size"},Zo=["value","title"],qo=["title"],Jo=["title","disabled"],Qo=["title","disabled"],er={class:"tb-item","data-key":"bold"},tr=["title","disabled"],lr={class:"tb-item","data-key":"italic"},nr=["title","disabled"],or={class:"tb-item","data-key":"underline"},rr=["title","disabled"],ar={class:"tb-item","data-key":"strike"},ir=["title","disabled"],cr={class:"tb-item","data-key":"textColor"},sr={class:"toolbar-split"},dr=["title","disabled"],ur={viewBox:"0 0 1024 1024",fill:"currentColor"},fr=["fill"],mr=["title","disabled"],pr={class:"tb-item","data-key":"fillColor"},hr={class:"toolbar-split"},gr=["title","disabled"],br={viewBox:"0 0 1024 1024",fill:"currentColor"},yr=["fill"],Cr=["title","disabled"],vr={class:"tb-item","data-key":"border"},wr={class:"toolbar-split"},kr=["title","disabled"],Er={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},Sr=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Rr=["title","disabled"],xr={class:"tb-item","data-key":"hAlign"},Br={class:"tb-item","data-key":"vAlign"},Mr={class:"tb-item","data-key":"wrap"},Dr=["title"],Nr={class:"tb-item","data-key":"merge"},Tr={class:"toolbar-split"},Vr=["title","disabled"],Ar=["title","disabled"],Ir={class:"tb-item","data-key":"numFmt"},Fr={class:"toolbar-number-format-group"},Or=["title","disabled"],Hr=["title","disabled"],Lr={class:"tb-item","data-key":"calc"},$r={class:"toolbar-split"},_r=["title","disabled"],zr=["title","disabled"],Wr={class:"tb-item","data-key":"sort"},Kr={class:"toolbar-split"},Ur=["title","disabled"],Pr={viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},Gr=["x1","y1","x2","y2"],Yr=["d"],Xr=["title","disabled"],jr={class:"tb-item","data-key":"find"},Zr=["title"],Fl=2,qr=6,Jr=34,Qr=pt(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,p){return a[Ee].includes(p)?"thick":l[Ee].includes(p)?"solid":"dashed"}const r=[{name:"bar1",x1:96,y1:224,x2:352,y2:224},{name:"bar2",x1:96,y1:512,x2:512,y2:512},{name:"bar3",x1:96,y1:800,x2:672,y2:800}],g={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"],b=t.ref(null),R=t.ref(null),B=t.ref(null),C=t.ref(null),y=t.ref(null),k=t.ref(null),j=t.ref(null),Z=t.ref(null),te=t.ref(null),U=t.ref(null),h=t.ref(new Set),le=t.ref(!1),P=t.ref(!1),ee=t.ref(0),ve=new Map,Be=t.computed(()=>h.value.size>0);function ge(Ee){return h.value.has(Ee)}const se=t.computed(()=>{const Ee=R.value;return Ee instanceof HTMLElement?Ee:void 0});function xe(Ee){return se.value?!ge(Ee):!0}function Ue(){for(const Ee of c){const p=ve.get(Ee);if(p===void 0||p===0)return!0}return!1}function we(){if(!b.value)return;b.value.querySelectorAll(".tb-item").forEach(p=>{const M=p.dataset.key;if(!M)return;const Me=p.offsetWidth;Me>0?ve.set(M,Me):ve.has(M)||ve.set(M,0)})}function me(Ee,p){if(Ee.size!==p.size)return!1;for(const M of Ee)if(!p.has(M))return!1;return!0}let ye=0,Le=0;function $e(){ye&&cancelAnimationFrame(ye),!(Le>60)&&(Le++,ye=requestAnimationFrame(()=>requestAnimationFrame(G)))}function G(){if(!b.value)return;const Ee=b.value.clientWidth-qr*2;if(Ee<=0){$e();return}Le=0,(ve.size===0||Ue())&&we();let p=0;for(const Me of c)p+=(ve.get(Me)??0)+Fl;const M=new Set;if(p>Ee){const Me=Ee-Jr-Fl;let je=0;for(let at=0;at<c.length;at++){const ie=c[at],Te=(ve.get(ie)??0)+Fl;if(je+Te>Me){for(let Fe=at;Fe<c.length;Fe++)M.add(c[Fe]);break}je+=Te}}me(M,h.value)||(h.value=M,ee.value++,M.size===0&&(le.value=!1))}let pe=null;const m=t.ref(0),D=t.computed(()=>{const Ee=B.value,p={position:"fixed",top:"0px",right:"0px"};if(!Ee)return{...u.themeVars,...p};m.value;const M=Ee.getBoundingClientRect();return{...u.themeVars,position:"fixed",top:`${M.bottom+4}px`,right:`${window.innerWidth-M.right}px`}});function I(){le.value&&(m.value++,t.nextTick(()=>G()))}function K(Ee){var M,Me;if(!le.value)return;const p=Ee.target;(M=R.value)!=null&&M.contains(p)||(Me=B.value)!=null&&Me.contains(p)||(P.value=!0,le.value=!1,t.nextTick(()=>{P.value=!1}))}function E(){le.value=!le.value}function s(){le.value=!1,O("find")}t.onMounted(()=>{$e(),b.value&&(pe=new ResizeObserver(()=>{le.value||$e()}),pe.observe(b.value)),document.addEventListener("pointerdown",K,!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",K,!0),window.removeEventListener("resize",I),window.removeEventListener("load",$e),window.removeEventListener("orientationchange",$e)});const u=e,O=o,ke=t.computed(()=>u.selNumberFormat===Mt?T(u.locale,"nfMixed"):"");return(Ee,p)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:b,class:"toolbar",onMousedown:p[51]||(p[51]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("undo"),to:se.value},[t.createElementVNode("div",$o,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(T)(e.locale,"undo"),disabled:!e.canUndo,onClick:p[0]||(p[0]=M=>O("undo"))},[...p[53]||(p[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,_o)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("redo"),to:se.value},[t.createElementVNode("div",zo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(T)(e.locale,"redo"),disabled:!e.canRedo,onClick:p[1]||(p[1]=M=>O("redo"))},[...p[54]||(p[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,Wo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("paint"),to:se.value},[t.createElementVNode("div",Ko,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(T)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:p[2]||(p[2]=M=>O("paint-format"))},[...p[55]||(p[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,Uo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("clear"),to:se.value},[t.createElementVNode("div",Po,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(T)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:p[3]||(p[3]=M=>O("clear-format"))},[...p[56]||(p[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,Go)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("sep1"),to:se.value},[p[57]||(p[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:xe("font"),to:se.value},[t.createElementVNode("div",Yo,[t.createVNode(ht,{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:p[4]||(p[4]=M=>O("font-family-change",M))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("fontSize"),to:se.value},[t.createElementVNode("div",Xo,[t.createElementVNode("div",jo,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(T)(e.locale,"fontSize"),onMousedown:p[5]||(p[5]=t.withModifiers(()=>{},["stop"])),onInput:p[6]||(p[6]=M=>O("font-size-input",M.target.value)),onBlur:p[7]||(p[7]=M=>O("font-size-blur")),onKeydown:p[8]||(p[8]=M=>O("font-size-keydown",M))},null,40,Zo),t.createVNode(ht,{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":U.value,"onUpdate:modelOpen":p[9]||(p[9]=M=>O("update:font-size-menu-open",M)),onChange:p[10]||(p[10]=M=>O("font-size-change",M))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:U,class:"toolbar-font-size__btn",type:"button",title:t.unref(T)(e.locale,"fontSize"),onMousedown:p[11]||(p[11]=t.withModifiers(()=>{},["prevent"])),onClick:p[12]||(p[12]=M=>O("font-size-toggle"))},[...p[58]||(p[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,qo),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(T)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:p[13]||(p[13]=t.withModifiers(()=>{},["prevent"])),onClick:p[14]||(p[14]=M=>O("font-size-step-down"))},[...p[59]||(p[59]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-177c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h177c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z"})],-1)])],40,Jo),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(T)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:p[15]||(p[15]=t.withModifiers(()=>{},["prevent"])),onClick:p[16]||(p[16]=M=>O("font-size-step-up"))},[...p[60]||(p[60]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-59v-59c0-16.29-13.21-29.5-29.5-29.5s-29.5 13.21-29.5 29.5v59h-59c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h59v59c0 16.29 13.21 29.5 29.5 29.5s29.5-13.21 29.5-29.5v-59h59c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z"})],-1)])],40,Qo)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("sep2"),to:se.value},[p[61]||(p[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:xe("bold"),to:se.value},[t.createElementVNode("div",er,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(T)(e.locale,"bold"),disabled:!e.hasSelection,onClick:p[17]||(p[17]=M=>O("bold-toggle"))},[...p[62]||(p[62]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M733.610667 467.712A267.562667 267.562667 0 0 0 548.010667 10.581333H183.466667a53.333333 53.333333 0 0 0 0 106.666667h43.221333a10.666667 10.666667 0 0 1 10.666667 10.666667V896a10.666667 10.666667 0 0 1-10.666667 10.666667H183.466667a53.333333 53.333333 0 1 0 0 106.666666h425.088a287.658667 287.658667 0 0 0 125.013333-545.536z m-185.6-350.464a160.512 160.512 0 0 1 0 320.981333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666V128a10.666667 10.666667 0 0 1 10.666667-10.666667z m60.586666 789.333333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666v-340.352a10.666667 10.666667 0 0 1 10.666667-10.666667H608.597333a180.864 180.864 0 0 1 0 361.685333z"})])],-1)])],10,tr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("italic"),to:se.value},[t.createElementVNode("div",lr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(T)(e.locale,"italic"),disabled:!e.hasSelection,onClick:p[18]||(p[18]=M=>O("italic-toggle"))},[...p[63]||(p[63]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M960 10.581333h-325.845333a53.333333 53.333333 0 0 0 0 106.666667h46.336a10.666667 10.666667 0 0 1 9.002666 16.384L203.946667 896.725333a21.333333 21.333333 0 0 1-18.005334 9.856H64a53.333333 53.333333 0 0 0 0 106.666667h325.845333a53.333333 53.333333 0 0 0 0-106.666667H343.509333a10.666667 10.666667 0 0 1-9.002666-16.384L820.053333 127.146667a21.333333 21.333333 0 0 1 18.005334-9.898667H960a53.333333 53.333333 0 0 0 0-106.666667z"})])],-1)])],10,nr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("underline"),to:se.value},[t.createElementVNode("div",or,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(T)(e.locale,"underline"),disabled:!e.hasSelection,onClick:p[19]||(p[19]=M=>O("underline-toggle"))},[...p[64]||(p[64]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M960 906.581333h-896a53.333333 53.333333 0 0 0 0 106.666667h896a53.333333 53.333333 0 0 0 0-106.666667zM84.394667 117.248h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a358.784 358.784 0 0 0 717.568 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667h58.154666a53.333333 53.333333 0 0 0 0-106.666666H695.466667a53.333333 53.333333 0 0 0 0 106.666666h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a252.117333 252.117333 0 0 1-504.234667 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667H328.533333a53.333333 53.333333 0 1 0 0-106.666666H84.394667a53.333333 53.333333 0 0 0 0 106.666666z"})])],-1)])],10,rr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("strike"),to:se.value},[t.createElementVNode("div",ar,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(T)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:p[20]||(p[20]=M=>O("strikethrough-toggle"))},[...p[65]||(p[65]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M1013.333333 552.618667A53.333333 53.333333 0 0 0 960 499.2h-381.269333a20.992 20.992 0 0 1-12.032-3.84c-30.805333-21.888-63.232-41.856-94.634667-61.098667-119.466667-73.173333-192-123.733333-192-207.488 0-95.36 94.165333-109.610667 150.314667-109.610666a193.706667 193.706667 0 0 1 131.456 32.597333 113.578667 113.578667 0 0 1 19.072 84.906667v12.8a53.333333 53.333333 0 1 0 106.666666 0v-11.434667a208.512 208.512 0 0 0-49.706666-161.152C595.157333 31.616 527.317333 10.581333 430.549333 10.581333c-156.074667 0-256.981333 84.864-256.981333 216.277334 0 118.314667 80.725333 192.512 170.666667 252.885333a10.666667 10.666667 0 0 1-5.930667 19.541333H64a53.333333 53.333333 0 0 0 0 106.666667h468.352a10.709333 10.709333 0 0 1 6.784 2.474667 185.130667 185.130667 0 0 1 82.432 147.882666c0 139.434667-146.176 150.272-191.018667 150.272-77.397333 0-133.930667-17.28-163.584-50.048a144.810667 144.810667 0 0 1-27.733333-115.2 53.333333 53.333333 0 0 0-106.154667-10.496A245.76 245.76 0 0 0 187.733333 928.128c51.2 56.490667 132.864 85.333333 242.688 85.333333 178.090667 0 297.685333-103.253333 297.685334-256.938666a258.517333 258.517333 0 0 0-36.224-134.272 10.666667 10.666667 0 0 1 9.216-16.085334H960a53.333333 53.333333 0 0 0 53.333333-53.546666z"})])],-1)])],10,ir)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("sep3"),to:se.value},[p[66]||(p[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:xe("textColor"),to:se.value},[t.createElementVNode("div",cr,[t.createElementVNode("div",sr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:p[21]||(p[21]=M=>O("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",ur,[p[67]||(p[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,fr)]))],8,dr),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:C,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:p[22]||(p[22]=M=>O("update:text-color-menu-open",!e.textColorMenuOpen))},[...p[68]||(p[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,mr),t.createVNode(nn,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":C.value,"onUpdate:modelOpen":p[23]||(p[23]=M=>O("update:text-color-menu-open",M)),onChange:p[24]||(p[24]=M=>O("text-color-change",M))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("fillColor"),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,"fillColor"),disabled:!e.hasSelection,onClick:p[25]||(p[25]=M=>O("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",br,[p[69]||(p[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,yr)]))],8,gr),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:y,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:p[26]||(p[26]=M=>O("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...p[70]||(p[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,Cr),t.createVNode(nn,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":y.value,"onUpdate:modelOpen":p[27]||(p[27]=M=>O("update:fill-color-menu-open",M)),onChange:p[28]||(p[28]=M=>O("fill-color-change",M))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("border"),to:se.value},[t.createElementVNode("div",vr,[t.createElementVNode("div",wr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"borders"),disabled:!e.hasSelection,onClick:p[29]||(p[29]=M=>O("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",Er,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(n,M=>t.createElementVNode("line",{key:M.name,x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2,"stroke-width":i(e.cachedBorder,M.name)==="thick"?3:1.5,"stroke-dasharray":i(e.cachedBorder,M.name)==="dashed"?"0 4":"none","stroke-linecap":i(e.cachedBorder,M.name)==="dashed"?"round":"square"},null,8,Sr)),64))]))],8,kr),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:k,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"borders"),disabled:!e.hasSelection,onClick:p[30]||(p[30]=M=>O("update:border-menu-open",!e.borderMenuOpen))},[...p[71]||(p[71]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Rr),t.createVNode(Ro,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":k.value,"onUpdate:modelOpen":p[31]||(p[31]=M=>O("update:border-menu-open",M)),onChange:p[32]||(p[32]=M=>O("border-change",M))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("sep4"),to:se.value},[p[72]||(p[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:xe("hAlign"),to:se.value},[t.createElementVNode("div",xr,[t.createVNode(ht,{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:p[33]||(p[33]=M=>O("h-align-change",M))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("vAlign"),to:se.value},[t.createElementVNode("div",Br,[t.createVNode(ht,{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:p[34]||(p[34]=M=>O("v-align-change",M))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",Mr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(T)(e.locale,"wrap"),onClick:p[35]||(p[35]=M=>O("wrap-toggle"))},[...p[73]||(p[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,Dr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("merge"),to:se.value},[t.createElementVNode("div",Nr,[t.createElementVNode("div",Tr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:p[36]||(p[36]=M=>O("apply-merge"))},[...p[74]||(p[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,Vr),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:p[37]||(p[37]=M=>O("update:merge-menu-open",!e.mergeMenuOpen))},[...p[75]||(p[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,Ar),t.createVNode(Fo,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":Z.value,"onUpdate:modelOpen":p[38]||(p[38]=M=>O("update:merge-menu-open",M)),onChange:p[39]||(p[39]=M=>O("merge-change",M))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("sep6"),to:se.value},[p[76]||(p[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:xe("numFmt"),to:se.value},[t.createElementVNode("div",Ir,[t.createElementVNode("div",Fr,[t.createVNode(ht,{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:p[40]||(p[40]=M=>O("number-format-change",String(M)))},null,8,["model-value","options","width","menu-width","title","fallback-label"]),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canIncreaseDecimals}]),title:t.unref(T)(e.locale,"nfIncreaseDecimals"),disabled:!e.canIncreaseDecimals,onClick:p[41]||(p[41]=M=>O("increase-decimals"))},[...p[77]||(p[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,Or),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canDecreaseDecimals}]),title:t.unref(T)(e.locale,"nfDecreaseDecimals"),disabled:!e.canDecreaseDecimals,onClick:p[42]||(p[42]=M=>O("decrease-decimals"))},[...p[78]||(p[78]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("text",{x:"0.5",y:"16","font-size":"9","font-weight":"700","font-family":"Arial, sans-serif"},".00"),t.createElementVNode("path",{d:"M19 18.5l-4.2-5.2h2.7V5.5h3v7.8h2.7z"})],-1)])],10,Hr)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("sep7"),to:se.value},[p[79]||(p[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:xe("calc"),to:se.value},[t.createElementVNode("div",Lr,[t.createElementVNode("div",$r,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:p[43]||(p[43]=M=>O("calc-sum"))},[...p[80]||(p[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,_r),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:p[44]||(p[44]=M=>O("update:calc-menu-open",!e.calcMenuOpen))},[...p[81]||(p[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,zr),t.createVNode(Lo,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":te.value,disabled:e.isSingleCell,"onUpdate:modelOpen":p[45]||(p[45]=M=>O("update:calc-menu-open",M)),onChange:p[46]||(p[46]=M=>O(`calc-${M}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("sort"),to:se.value},[t.createElementVNode("div",Wr,[t.createElementVNode("div",Kr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.cachedSortOrder==="asc"?t.unref(T)(e.locale,"sortAsc"):t.unref(T)(e.locale,"sortDesc"),disabled:!e.canSort,onClick:p[47]||(p[47]=M=>O("apply-sort"))},[(t.openBlock(),t.createElementBlock("svg",Pr,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,M=>t.createElementVNode("line",{key:M.name,x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2},null,8,Gr)),64)),t.createElementVNode("path",{d:g[e.cachedSortOrder]},null,8,Yr)]))],8,Ur),t.createElementVNode("button",{ref_key:"sortArrowRef",ref:j,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"sort"),disabled:!e.canSort,onClick:p[48]||(p[48]=M=>O("update:sort-menu-open",!e.sortMenuOpen))},[...p[82]||(p[82]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Xr),t.createVNode(To,{"model-open":e.sortMenuOpen,locale:e.locale,"current-sort":e.cachedSortOrder,"trigger-el":j.value,"onUpdate:modelOpen":p[49]||(p[49]=M=>O("update:sort-menu-open",M)),onChange:p[50]||(p[50]=M=>O("sort-change",M))},null,8,["model-open","locale","current-sort","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("find"),to:se.value},[t.createElementVNode("div",jr,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(T)(e.locale,"find"),onClick:s},[...p[83]||(p[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,Zr)])],8,["disabled","to"])),Be.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:B,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":le.value}]),type:"button",onClick:E},[...p[84]||(p[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:R,key:ee.value,class:t.normalizeClass(["overflow-menu",{"no-anim":P.value}]),style:t.normalizeStyle(D.value),onMousedown:p[52]||(p[52]=t.withModifiers(()=>{},["prevent"]))},null,38)),[[t.vShow,le.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-afcb334e"]]),ea=["title"],ta={class:"tab-list"},la=["onClick","onDblclick","onContextmenu"],na=["value"],oa={key:1,class:"tab-item__name"},ra=["title"],aa=["disabled"],ia=["title","onClick"],ca={class:"tab-list-menu__name"},sa=["title","disabled","onClick"],da=["disabled"],ua=8,fa=pt(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),g=t.ref({left:0,bottom:0}),c=t.ref(null),b=t.computed(()=>Math.min(ua,n.sheets.length)),R=t.computed(()=>n.sheets.slice(r.value,r.value+b.value)),B=t.computed(()=>r.value>0),C=t.computed(()=>r.value+b.value<n.sheets.length),y=t.computed(()=>n.sheets.length>b.value),k=t.computed(()=>n.sheets.length>1);t.watch(()=>n.sheets.length,()=>{if(!i.value)return;const we=Math.max(0,n.sheets.length-b.value);r.value>we&&(r.value=we)});function j(we){r.value=Math.max(0,Math.min(n.sheets.length-b.value,r.value+we))}function Z(){if(i.value){i.value=!1;return}const we=a.value;if(!we)return;const me=we.getBoundingClientRect();g.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(b.value/2),n.sheets.length-b.value)):0,i.value=!0}function te(we){l("tab-click",we),i.value=!1}function U(we){k.value&&l("delete-sheet",we)}function h(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 ve(we){!i.value||we.target===c.value||ee()}const Be=t.ref(0),ge=t.ref(!1);function se(we){i.value&&(Be.value=we.touches[0].clientY,ge.value=!0)}function xe(we){if(!i.value||!ge.value)return;const me=we.touches[0].clientY-Be.value;Math.abs(me)>5&&(j(me<0?1:-1),Be.value=we.touches[0].clientY)}function Ue(){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",h),document.addEventListener("keydown",le),window.addEventListener("resize",ee),window.addEventListener("scroll",ve,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",h),document.removeEventListener("keydown",le),window.removeEventListener("resize",ee),window.removeEventListener("scroll",ve,!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,ea),t.createElementVNode("div",ta,[(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,na)):(t.openBlock(),t.createElementBlock("span",oa,t.toDisplayString(ye.name),1))],42,la))),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,ra),(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:g.value.left+"px",bottom:g.value.bottom+"px"}),onMousedown:me[7]||(me[7]=t.withModifiers(()=>{},["prevent"]))},[y.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!B.value}]),disabled:!B.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,aa)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:c,class:"tab-list-menu__list",onTouchstart:se,onTouchmove:xe,onTouchend:Ue},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(R.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",ca,t.toDisplayString(ye.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(T)(e.locale,"delete"),disabled:!k.value,onClick:t.withModifiers(Le=>U(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,sa)],10,ia))),128))],544),y.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: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,da)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-ec10bade"]]),ma=["placeholder","value"],pa=["placeholder","value"],ha={class:"find-bar__chk"},ga=["checked"],ba={class:"find-bar__chk"},ya=["checked"],Ca={class:"find-bar__count"},va=["title","disabled"],wa=["title","disabled"],ka=["disabled"],Ea=["disabled"],Sa=["title"],Ra=pt(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 g(c){c.key==="Enter"?(c.preventDefault(),c.shiftKey?l("prev"):l("next")):c.key==="Escape"&&(c.preventDefault(),l("close"))}return(c,b)=>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:b[0]||(b[0]=R=>l("update:findText",R.target.value)),onKeydown:g},null,40,ma),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(T)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:b[1]||(b[1]=R=>l("update:replaceText",R.target.value)),onKeydown:g},null,40,pa),t.createVNode(ht,{class:"find-bar__dropdown","model-value":e.scope,options:r.value,title:t.unref(T)(e.locale,"findScope"),"onUpdate:modelValue":b[2]||(b[2]=R=>c.$emit("update:scope",R))},null,8,["model-value","options","title"]),t.createElementVNode("label",ha,[t.createElementVNode("input",{type:"checkbox",checked:e.matchCase,onChange:b[3]||(b[3]=R=>l("update:matchCase",R.target.checked))},null,40,ga),t.createTextVNode(t.toDisplayString(t.unref(T)(e.locale,"matchCase")),1)]),t.createElementVNode("label",ba,[t.createElementVNode("input",{type:"checkbox",checked:e.matchEntireCell,onChange:b[4]||(b[4]=R=>l("update:matchEntireCell",R.target.checked))},null,40,ya),t.createTextVNode(t.toDisplayString(t.unref(T)(e.locale,"matchEntireCell")),1)]),t.createElementVNode("span",Ca,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:b[5]||(b[5]=R=>l("prev"))},[...b[10]||(b[10]=[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,va),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(T)(e.locale,"findNext"),disabled:e.total===0,onClick:b[6]||(b[6]=R=>l("next"))},[...b[11]||(b[11]=[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,wa),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:b[7]||(b[7]=R=>l("replace"))},t.toDisplayString(t.unref(T)(e.locale,"replace")),9,ka),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:b[8]||(b[8]=R=>l("replace-all"))},t.toDisplayString(t.unref(T)(e.locale,"replaceAll")),9,Ea),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(T)(e.locale,"findClose"),onClick:b[9]||(b[9]=R=>l("close"))},[...b[12]||(b[12]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 451.669L369.664 294.336a32 32 0 0 0-45.312 45.312L466.688 497 309.355 654.336a32 32 0 0 0 45.312 45.312L512 542.688l157.333 157.334a32 32 0 0 0 45.312-45.312L557.312 497 714.645 339.664a32 32 0 0 0-45.312-45.312z"})],-1)])],8,Sa)],4)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-1c766a56"]]),xa={class:"nf-dialog__header"},Ba={class:"nf-dialog__title"},Ma={class:"nf-dialog__body"},Da={class:"nf-field"},Na={class:"nf-field__label"},Ta={key:0,class:"nf-field"},Va={class:"nf-field__label"},Aa={key:1,class:"nf-field nf-field--inline"},Ia={class:"nf-checkbox"},Fa={key:2,class:"nf-field"},Oa={class:"nf-field__label"},Ha={key:3,class:"nf-field"},La={class:"nf-field__label"},$a={key:4,class:"nf-field"},_a={class:"nf-field__label"},za={key:5,class:"nf-field"},Wa={class:"nf-field__label"},Ka={key:6,class:"nf-field"},Ua={class:"nf-field__label"},Pa={class:"nf-field"},Ga={class:"nf-field__label"},Ya={class:"nf-dialog__footer"},Xa={class:"nf-preview"},ja={class:"nf-preview__label"},Za={class:"nf-preview__value"},qa={class:"nf-dialog__actions"},Ja=pt(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),g=t.ref(!1),c=t.ref("$"),b=t.ref("m/d/yyyy"),R=t.ref("h:mm:ss"),B=t.ref("m/d/yyyy h:mm:ss"),C=t.ref("[h]:mm:ss"),y=t.ref(""),k=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"],U=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],h=["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"?[...U,...h]:[...h,...U]),ve=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],Be={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(()=>Jn.map(ie=>({label:T(n.locale,Be[ie]),value:ie}))),se=j.map(ie=>({label:ie.label,value:ie.value})),xe=t.computed(()=>le.value.map(ie=>({label:ie,value:ie}))),Ue=P.map(ie=>({label:ie,value:ie})),we=t.computed(()=>ee.value.map(ie=>({label:ie,value:ie}))),me=ve.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"),m=t.computed(()=>i.value==="duration"),D=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function I(){if(i.value==="general")return Ht;if(i.value==="text")return yt;if(i.value==="custom")return y.value;if(i.value==="date")return b.value;if(i.value==="time")return R.value;if(i.value==="dateTime")return B.value;if(i.value==="duration")return C.value;const ie=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?K(i.value,ie,g.value,c.value):io(n.locale,i.value,ie,g.value)}function K(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 E(ie){if(y.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",ve.includes(ie)&&(C.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)&&(B.value=ie);return}if(Fe||/AM\/PM/i.test(Te)){ot&&!Fe?(i.value="time",P.includes(ie)&&(R.value=ie)):(i.value="date",le.value.includes(ie)&&(b.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",g.value=ie.includes(","),r.value=s(ie);return}if(Je){ie.includes("(")?(i.value="accounting",c.value=Je.value,g.value=ie.includes(","),r.value=s(ie)):/\.\d/.test(ie.slice(Je.value.length))?(i.value="currency",c.value=Je.value,g.value=ie.includes(","),r.value=s(ie)):(i.value="currencyRounded",c.value=Je.value,g.value=ie.includes(","));return}i.value="number",g.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"&&(y.value=I())}function O(){}function ke(){b.value=le.value[0],R.value=P[0],B.value=ee.value[0],C.value=ve[0]}function Ee(){a.value=!0,n.modelOpen!==void 0&&l("update:modelOpen",!0),ke(),E(n.currentFormat??""),n.isCustom&&(i.value="custom"),t.nextTick(()=>{var ie;return(ie=k.value)==null?void 0:ie.focus()})}function p(){a.value=!1,n.modelOpen!==void 0&&l("update:modelOpen",!1)}function M(){l("apply",y.value),p()}function Me(){p()}function je(ie){ie.key==="Escape"&&p()}t.watch(()=>n.modelOpen,ie=>{ie&&!a.value?Ee():!ie&&a.value&&p()});const at=t.computed(()=>jt(n.sampleValue,y.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:Me,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",xa,[t.createElementVNode("span",Ba,t.toDisplayString(t.unref(T)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:p},[...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",Ma,[t.createElementVNode("div",Da,[t.createElementVNode("label",Na,t.toDisplayString(t.unref(T)(e.locale,"nfCategory")),1),t.createVNode(ht,{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",Ta,[t.createElementVNode("label",Va,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",Aa,[t.createElementVNode("label",Ia,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":Te[2]||(Te[2]=Fe=>g.value=Fe),type:"checkbox",onChange:u},null,544),[[t.vModelCheckbox,g.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(T)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),Le.value?(t.openBlock(),t.createElementBlock("div",Fa,[t.createElementVNode("label",Oa,t.toDisplayString(t.unref(T)(e.locale,"nfSymbol")),1),t.createVNode(ht,{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",Ha,[t.createElementVNode("label",La,t.toDisplayString(t.unref(T)(e.locale,"nfDateFormat")),1),t.createVNode(ht,{class:"nf-field__dropdown","model-value":b.value,options:xe.value,"onUpdate:modelValue":Te[4]||(Te[4]=Fe=>b.value=Fe),onChange:u},null,8,["model-value","options"])])):t.createCommentVNode("",!0),G.value?(t.openBlock(),t.createElementBlock("div",$a,[t.createElementVNode("label",_a,t.toDisplayString(t.unref(T)(e.locale,"nfTimeFormat")),1),t.createVNode(ht,{class:"nf-field__dropdown","model-value":R.value,options:t.unref(Ue),"onUpdate:modelValue":Te[5]||(Te[5]=Fe=>R.value=Fe),onChange:u},null,8,["model-value","options"])])):t.createCommentVNode("",!0),pe.value?(t.openBlock(),t.createElementBlock("div",za,[t.createElementVNode("label",Wa,t.toDisplayString(t.unref(T)(e.locale,"nfDateTime")),1),t.createVNode(ht,{class:"nf-field__dropdown","model-value":B.value,options:we.value,"onUpdate:modelValue":Te[6]||(Te[6]=Fe=>B.value=Fe),onChange:u},null,8,["model-value","options"])])):t.createCommentVNode("",!0),m.value?(t.openBlock(),t.createElementBlock("div",Ka,[t.createElementVNode("label",Ua,t.toDisplayString(t.unref(T)(e.locale,"nfDuration")),1),t.createVNode(ht,{class:"nf-field__dropdown","model-value":C.value,options:t.unref(me),"onUpdate:modelValue":Te[7]||(Te[7]=Fe=>C.value=Fe),onChange:u},null,8,["model-value","options"])])):t.createCommentVNode("",!0),t.createElementVNode("div",Pa,[t.createElementVNode("label",Ga,t.toDisplayString(t.unref(T)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:k,"onUpdate:modelValue":Te[8]||(Te[8]=Fe=>y.value=Fe),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:O},null,544),[[t.vModelText,y.value]])])]),t.createElementVNode("div",Ya,[t.createElementVNode("div",Xa,[t.createElementVNode("span",ja,t.toDisplayString(t.unref(T)(e.locale,"nfPreview")),1),t.createElementVNode("span",Za,t.toDisplayString(at.value||"—"),1)]),t.createElementVNode("div",qa,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:M},t.toDisplayString(t.unref(T)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:p},t.toDisplayString(t.unref(T)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-c9c08f15"]]),Qa={class:"sort-confirm__header"},ei={class:"sort-confirm__title"},ti={class:"sort-confirm__body"},li={class:"sort-confirm__message"},ni={class:"sort-confirm__options"},oi={class:"sort-confirm__option"},ri={class:"sort-confirm__option"},ai={class:"sort-confirm__footer"},ii=pt(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,y=>{y&&!a.value?g():!y&&a.value&&c()});function g(){i.value=!0,a.value=!0,n.modelOpen!==void 0&&l("update:modelOpen",!0),t.nextTick(()=>{var k;const y=(k=r.value)==null?void 0:k.querySelector(".sort-confirm__btn--primary");y==null||y.focus()})}function c(){a.value=!1,n.modelOpen!==void 0&&l("update:modelOpen",!1)}function b(){C()}function R(y){y.key==="Escape"&&C()}function B(){l("confirm",i.value),c()}function C(){l("cancel"),c()}return(y,k)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"sort-confirm"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"sort-confirm__mask",onMousedown:b,onKeydown:R},[t.createElementVNode("div",{ref_key:"dialogRef",ref:r,class:"sort-confirm",onMousedown:k[2]||(k[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Qa,[t.createElementVNode("span",ei,t.toDisplayString(t.unref(T)(e.locale,"sortReminderTitle")),1),t.createElementVNode("button",{class:"sort-confirm__close",type:"button",onClick:C},[...k[3]||(k[3]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])])]),t.createElementVNode("div",ti,[t.createElementVNode("p",li,t.toDisplayString(t.unref(T)(e.locale,"sortReminderMessage")),1),t.createElementVNode("div",ni,[t.createElementVNode("label",oi,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":k[0]||(k[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",ri,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":k[1]||(k[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",ai,[t.createElementVNode("button",{class:"sort-confirm__btn sort-confirm__btn--primary",type:"button",onClick:B},t.toDisplayString(t.unref(T)(e.locale,"sort")),1),t.createElementVNode("button",{class:"sort-confirm__btn",type:"button",onClick:C},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 Ol(e){let o=0;for(let n=0;n<e.length;n++)o=o*26+(e.toUpperCase().charCodeAt(n)-64);return o-1}function Zt(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 Hl(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 tl(e,o){return`${e},${o}`}function cl(e,o,n){const l=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!l)return null;const a=Ol(l[1]),i=parseInt(l[2],10)-1;return a<0||a>=o||i<0||i>=n?null:{col:a,row:i}}function qt(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 on=[{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)"}],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}};function si(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 di(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=ci[l];if(!a)return{ok:!1,name:l};const i=n[2];if(!si(i))return{ok:!1,name:l};const r=yl(i),g=r.length===1&&r[0].trim()===""?0:r.length;return g<a.min||g>a.max?{ok:!1,name:l}:r.some(c=>c.trim()==="")?{ok:!1,name:l}:{ok:!0,name:l}}function rn(e,o,n){const l=e.split(":");if(l.length!==2)return null;const a=cl(l[0],o,n),i=cl(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 an(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 Jt(e,o,n,l,a){const i=n[tl(e,o)];if(!i)return"";const r=i.value;return r.startsWith("=")?cn(tl(e,o),n,l,a):an(r)}function ui(e,o,n,l,a){const i=Jt(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 sl=new Map,gl=new Set;function bl(){sl.clear(),gl.clear()}function cn(e,o,n,l){return fi(e,o,n,l,0)}function fi(e,o,n,l,a){if(gl.has(e))return null;if(sl.has(e))return sl.get(e);gl.add(e);const i=o[e];let r;if(!i)r=null;else{const g=i.value;if(!g.startsWith("="))r=an(g);else{const c=g.slice(1).trim(),b=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(c);r=b?dn(b[1].toUpperCase(),b[2],o,n,l,a+1):null}}return gl.delete(e),sl.set(e,r),r}function sn(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function mi(e,o){return typeof e=="number"&&typeof o=="number"?e===o:String(e??"")===String(o??"")}function pi(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 hi(e,o,n,l,a){const i=e.trim(),r=["<=",">=","<>"];let g=null,c=-1,b=null,R=0;for(let C=0;C<i.length;C++){const y=i[C];if(b){y===b&&(i[C+1]===b?C++:b=null);continue}if(y==='"'||y==="'"){b=y;continue}if(y==="("&&R++,y===")"&&R--,R===0&&(y==="<"||y===">"||y==="=")){const k=i.slice(C,C+2);g=r.includes(k)?k:y,c=C;break}}if(g&&c>=0){const C=i.slice(0,c).trim(),y=i.slice(c+g.length).trim(),k=$t(C,o,n,l,a),j=$t(y,o,n,l,a);return pi(k,j,g)}const B=$t(i,o,n,l,a);return sn(B)}function yl(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 $t(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 g=gi(i);if(g.length===0)return null;let c=0;const b=()=>{let y=R();for(;c<g.length;){const k=g[c];if(k.type==="op"&&(k.val==="+"||k.val==="-"))c++,y=Ll(y,R(),k.val);else break}return y},R=()=>{let y=B();for(;c<g.length;){const k=g[c];if(k.type==="op"&&(k.val==="*"||k.val==="/"))c++,y=Ll(y,B(),k.val);else break}return y},B=()=>{const y=g[c];return y&&y.type==="op"&&y.val==="-"?(c++,Ll(0,B(),"-")):y&&y.type==="op"&&y.val==="+"?(c++,B()):C()},C=()=>{const y=g[c];if(!y)return null;if(y.type==="num")return c++,Number(y.val);if(y.type==="str")return c++,y.val;if(y.type==="lp"){c++;const k=b();return g[c]&&g[c].type==="rp"&&c++,k}if(y.type==="ref"){c++;const k=cl(y.val,n,l);return k?Jt(k.col,k.row,o,n,l):null}if(y.type==="func"){const k=y.val.toUpperCase();if(c++,g[c]&&g[c].type==="lp"){const j=g[c];let Z=0,te=null,U=c;for(;U<g.length;U++)if(g[U].type==="lp")Z++;else if(g[U].type==="rp"&&(Z--,Z===0)){te=g[U];break}if(te){const h=i.slice(j.start+1,te.start);return c=U+1,dn(k,h,o,n,l,a+1)}}return null}return c++,null};return b()}function gi(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 Ll(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 dn(e,o,n,l,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=rn(o.trim(),l,a);if(!r)return null;if(e==="COUNT"){let c=0;for(let b=r.sc;b<=r.ec;b++)for(let R=r.sr;R<=r.er;R++)typeof Jt(b,R,n,l,a)=="number"&&c++;return c}let g=0;for(let c=r.sc;c<=r.ec;c++)for(let b=r.sr;b<=r.er;b++)g+=ui(c,b,n,l,a);if(isNaN(g))return null;if(e==="AVERAGE"){const c=(r.ec-r.sc+1)*(r.er-r.sr+1);return c===0?null:g/c}return g}case"IF":{const r=yl(o);if(r.length<3)return null;const g=hi(r[0],n,l,a,i);return $t(g?r[1]:r[2],n,l,a,i)}case"VLOOKUP":{const r=yl(o);if(r.length<3)return null;const g=$t(r[0],n,l,a,i),c=rn(r[1].trim(),l,a);if(!c)return null;const b=$t(r[2],n,l,a,i),R=typeof b=="number"?b:parseFloat(String(b));if(isNaN(R))return null;const B=c.sc+(R-1);if(B<c.sc||B>c.ec)return null;if(r.length>=4?sn($t(r[3],n,l,a,i)):!1){let y=-1,k=-1/0;for(let j=c.sr;j<=c.er;j++){const Z=Jt(c.sc,j,n,l,a);typeof Z=="number"&&typeof g=="number"&&Z<=g&&Z>k&&(k=Z,y=j)}return y>=0?Jt(B,y,n,l,a):null}for(let y=c.sr;y<=c.er;y++){const k=Jt(c.sc,y,n,l,a);if(mi(k,g))return Jt(B,y,n,l,a)}return null}case"CONCATENATE":{const r=yl(o);let g="";for(const c of r){const b=$t(c,n,l,a,i);g+=b===null?"":typeof b=="number"?String(b):b}return g}default:return null}}function $l(e,o,n){const l=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=cl(i[1],o,n);if(r)if(i[2]){const g=cl(i[2],o,n);if(!g)continue;for(let c=Math.min(r.col,g.col);c<=Math.max(r.col,g.col);c++)for(let b=Math.min(r.row,g.row);b<=Math.max(r.row,g.row);b++)l.push(tl(c,b))}else l.push(tl(r.col,r.row))}return l}function bi(e,o,n,l,a){const i=n[tl(e,o)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const g=cn(tl(e,o),n,l,a);return g===null?"#ERROR":String(g)}function yi(e,o,n,l,a,i){return o===0&&n===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,g,c,b,R)=>{const B=g?Ol(c):Ol(c)+o,C=b?parseInt(R,10)-1:parseInt(R,10)-1+n;let y;B<0?y="A":B>=l?y=i(l-1):y=i(B);let k;return C<0?k="1":C>=a?k=String(a):k=String(C+1),(g||"")+y+(b||"")+k})}class Ci{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(),sl.clear();for(const[a,i]of Object.entries(o))if(i.value.startsWith("=")){const r=$l(i.value.slice(1),n,l);this.set(a,r)}}}const vi={class:"ifn-dialog__header"},wi={class:"ifn-dialog__title"},ki={class:"ifn-dialog__body"},Ei={class:"ifn-dialog__field"},Si={class:"ifn-dialog__label"},Ri={key:0,class:"ifn-dialog__desc"},xi={class:"ifn-dialog__field"},Bi={class:"ifn-dialog__label"},Mi={class:"ifn-dialog__footer"},Di=["disabled"],Ni=pt(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(""),g=t.ref(null),c=t.ref(null),b={SUM:"fnDescSum",AVERAGE:"fnDescAverage",COUNT:"fnDescCount",IF:"fnDescIf",VLOOKUP:"fnDescVlookup",CONCATENATE:"fnDescConcatenate"},R=t.computed(()=>on.map(P=>({label:P.name,value:P.name}))),B=t.computed(()=>{const P=String(i.value??"");return P?T(n.locale,b[P]??""):""}),C=t.computed(()=>di(r.value)),y=t.computed(()=>i.value===""||i.value===null||!r.value.trim()||!C.value.ok?!1:C.value.name===String(i.value).toUpperCase());t.watch(()=>n.modelOpen,P=>{P&&!a.value?k():!P&&a.value&&j()});function k(){r.value="",i.value="",a.value=!0,n.modelOpen!==void 0&&l("update:modelOpen",!0),t.nextTick(()=>{const P=g.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=on.find(ve=>ve.name===String(P));ee&&(r.value="",te(ee.snippet))}function te(P){const ee=r.value,ve=g.value,Be=ve?ve.selectionStart??ee.length:ee.length,ge=ve?ve.selectionEnd??ee.length:ee.length,se=ee.trim()?P:"="+P;r.value=ee.slice(0,Be)+se+ee.slice(ge),t.nextTick(()=>{const xe=g.value;if(!xe)return;const Ue=Be+se.length;try{xe.focus({preventScroll:!0}),xe.setSelectionRange(Ue,Ue)}catch{}})}function U(){l("insert",r.value),j()}function h(){l("cancel"),j()}function le(P){P.key==="Escape"&&(P.stopPropagation(),h())}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(h,["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",vi,[t.createElementVNode("span",wi,t.toDisplayString(t.unref(T)(e.locale,"insertFunctionTitle")),1),t.createElementVNode("button",{class:"ifn-dialog__close",type:"button",onClick:h},[...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",ki,[t.createElementVNode("div",Ei,[t.createElementVNode("label",Si,t.toDisplayString(t.unref(T)(e.locale,"insertFunctionSelectLabel")),1),t.createVNode(ht,{class:"ifn-dialog__dropdown","model-value":i.value,options:R.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"]),B.value?(t.openBlock(),t.createElementBlock("div",Ri,t.toDisplayString(B.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",xi,[t.createElementVNode("label",Bi,t.toDisplayString(t.unref(T)(e.locale,"insertFunctionFormulaLabel")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:g,"onUpdate:modelValue":ee[0]||(ee[0]=ve=>r.value=ve),class:"ifn-dialog__textarea",spellcheck:"false"},null,512),[[t.vModelText,r.value]])])]),t.createElementVNode("div",Mi,[t.createElementVNode("button",{class:"ifn-dialog__btn ifn-dialog__btn--primary",type:"button",disabled:!y.value,onClick:U},t.toDisplayString(t.unref(T)(e.locale,"insertFunctionBtn")),9,Di),t.createElementVNode("button",{class:"ifn-dialog__btn",type:"button",onClick:h},t.toDisplayString(t.unref(T)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-1e9431b0"]]);class Ti{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 g=o[r].styleId??0;n.add(g)}const l=new Map,a=[{}];l.set(0,0);const i=Array.from(n).sort((r,g)=>r-g);for(const r of i)if(r!==0&&r<this.styles.length){const g=a.length;l.set(r,g),a.push(this.styles[r])}for(const r in o){const g=o[r],c=g.styleId??0,b=l.get(c);b!==void 0&&b!==c&&(g.styleId=b)}this.styles=a,this.index=new Map;for(let r=0;r<this.styles.length;r++){const g=this.stableKey(this.styles[r]);this.index.set(g,r)}return a}}function Vi(e,o){if(!e)return null;const n=e.styleId;return n===void 0||n===0?null:o[n]??null}function un(e){const o=new Ti,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 Ai(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 Ii{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 g=r.borderId??0;n.add(g)}const l=new Map,a=[{}];l.set(0,0);const i=Array.from(n).sort((r,g)=>r-g);for(const r of i)if(r!==0&&r<this.borders.length){const g=a.length;l.set(r,g),a.push(this.borders[r])}for(const r of o){const g=r.borderId??0,c=l.get(g);c!==void 0&&c!==g&&(r.borderId=c)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const g=this.stableKey(this.borders[r]);this.index.set(g,r)}return a}}function Fi(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 g=l.get(r);if(g)return g[o]}function Oi(e,o,n,l,a,i){const r=l[e.styleId??0]??{},g=r.borderId??0,c=g>0?a.get(g):{},b={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?b[o]={...n}:b[o]=void 0;const R=a.getId(b),B={...r};R===0?delete B.borderId:B.borderId=R,delete B.borderTopWidth,delete B.borderBottomWidth,delete B.borderLeftWidth,delete B.borderRightWidth,delete B.borderColor,Object.keys(B).length===0?e.styleId=0:e.styleId=i(B)}function fn(e){const o=new Ii,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 g=o.getId(r),c={...l};delete c.borderTopWidth,delete c.borderBottomWidth,delete c.borderLeftWidth,delete c.borderRightWidth,delete c.borderColor,g>0?c.borderId=g:delete c.borderId,n.push(c)}return{styles:n,borders:o.getBorders()}}function Hi(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({}),g=t.reactive([{}]),c=t.reactive([{}]);let b=new Map;b.set("{}",0);let R=new Map;R.set("{}",0);function B(v){const A=Object.keys(v).sort(),F={};for(const Q of A)F[Q]=v[Q];return JSON.stringify(F)}function C(v){const A=["top","right","bottom","left"],F={};for(const Q of A){const oe=v[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 y(v){if(!v||Object.keys(v).length===0)return 0;const A=B(v),F=b.get(A);if(F!==void 0)return F;const Q=g.length;return g.push(Object.freeze({...v})),b.set(A,Q),Q}function k(v){return Vi(v,g)}function j(){b=new Map;for(let v=0;v<g.length;v++)b.set(B(g[v]),v)}function Z(v){g.splice(0,g.length,...v),j()}function te(v){if(!v||!v.top&&!v.right&&!v.bottom&&!v.left)return 0;const A=C(v),F=R.get(A);if(F!==void 0)return F;const Q=c.length;return c.push(Object.freeze({top:v.top?Object.freeze({...v.top}):void 0,right:v.right?Object.freeze({...v.right}):void 0,bottom:v.bottom?Object.freeze({...v.bottom}):void 0,left:v.left?Object.freeze({...v.left}):void 0})),R.set(A,Q),Q}function U(v){return c[v]??{}}function h(){R=new Map;for(let v=0;v<c.length;v++)R.set(C(c[v]),v)}function le(v){c.splice(0,c.length,...v),h()}function P(v,A){return Fi(v,A,g,{get:F=>c[F]??{}})}function ee(v,A){const F=E(v,A);return F?F.anchor:null}function ve(v,A,F,Q){const oe=E(v,A),d=E(F,Q);return!oe||!d?!1:oe.anchor===d.anchor}const Be=t.reactive({}),ge=new Ci,se=t.ref(null),xe=t.ref("cell"),Ue=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-Ft)/2,m=new Map;let D=null;function I(v,A,F,Q){const oe=`${Q} ${F} ${A}px ${v}`,d=m.get(oe);if(d)return d;if(!D){if(typeof document>"u")return{ascent:A*.88,descent:A*.28};D=document.createElement("canvas")}const S=D.getContext("2d");if(!S)return{ascent:A*.88,descent:A*.28};S.font=oe;const W=S.measureText(" "),$=W.fontBoundingBoxAscent,_=W.fontBoundingBoxDescent;if(typeof $=="number"&&typeof _=="number"&&$>0&&_>0){const rt={ascent:$,descent:_};return m.set(oe,rt),rt}const H=["M","中","y","Ä","0"];let ne=0,ae=0;for(const rt of H){const vt=S.measureText(rt),Tt=vt.actualBoundingBoxAscent||0,wt=vt.actualBoundingBoxDescent||0;Tt>ne&&(ne=Tt),wt>ae&&(ae=wt)}const ze=Math.max(ne,A*.88),lt=Math.max(ae,A*.28),ut={ascent:ze,descent:lt};return m.set(oe,ut),ut}let K=(v,A)=>`${v},${A}`,E=()=>null,s=()=>Ft,u=t.computed(()=>[0]),O=()=>24,ke=(v,A,F,Q)=>({startCol:Math.min(v,F),startRow:Math.min(A,Q),endCol:Math.max(v,F),endRow:Math.max(A,Q)});function Ee(v,A){const F=k(r[K(v,A)]),Q=s(v,A),oe=typeof(F==null?void 0:F.fontFamily)=="string"&&F.fontFamily?F.fontFamily:il,d=(F==null?void 0:F.fontWeight)==="bold"?"bold":"normal",S=(F==null?void 0:F.fontStyle)==="italic"?"italic":"normal";return I(oe,Q,d,S)}function p(v,A,F,Q){if(!A)return[""];const oe=A.split(`
|
|
2
|
+
`),d=[];for(const S of oe)if(!Q||F<=0)d.push(S);else{let W="";for(let $=0;$<S.length;$++){const _=S[$],H=W+_;v.measureText(H).width>F&&W?(d.push(W),W=_):W=H}d.push(W)}return d}function M(v,A){const F=k(r[K(v,A)]);return typeof(F==null?void 0:F.fontSize)=="number"&&F.fontSize>0?F.fontSize:Ft}s=M;const Me=t.computed(()=>{const v=[0];for(let A=0;A<a;A++)v.push(v[A]+ye.value[A]);return v});u=Me;const je={w:800,h:600};let at=()=>{};function ie(v){const A=Le.value[v];if(A!=null&&A>0)return A;let F,Q,oe=1;const d=D?D.getContext("2d"):null,S=I(il,Ft,"normal","normal");F=S.ascent,Q=S.descent;for(let H=0;H<a;H++){const ne=M(H,v),ae=k(r[K(H,v)]),ze=typeof(ae==null?void 0:ae.fontFamily)=="string"&&ae.fontFamily?ae.fontFamily:il,lt=(ae==null?void 0:ae.fontWeight)==="bold"?"bold":"normal",ut=(ae==null?void 0:ae.fontStyle)==="italic"?"italic":"normal",rt=I(ze,ne,lt,ut);rt.ascent>F&&(F=rt.ascent),rt.descent>Q&&(Q=rt.descent);const vt=typeof(ae==null?void 0:ae.numberFormat)=="string"?ae.numberFormat:"",Tt=Ut(H,v),wt=jt(Tt,vt,l.value);if(wt){const dl=(ae==null?void 0:ae.wrap)==="wrap";let Pt;if(dl&&d){d.font=`${ut} ${lt} ${ne}px ${ze}`;const ll=E(H,v);let ul;ll&&H===ll.range.startCol&&v===ll.range.startRow?ul=u.value[ll.range.endCol+1]-u.value[H]:ul=ye.value[H],Pt=p(d,wt,Math.max(0,ul-10),!0).length,Pt>oe&&(oe=Pt)}else Pt=wt.split(`
|
|
3
|
+
`).length,Pt>oe&&(oe=Pt)}}const W=F+Q,$=pe*2+oe*W;return Math.min(500,Math.max(24,Math.round($)))}O=ie;function Te(v){return Le.value[v]===void 0}const Fe=t.computed(()=>{const v=[0];for(let A=0;A<i;A++)v.push(v[A]+O(A));return v}),ot=t.computed(()=>Me.value[a]),Je=t.computed(()=>Fe.value[i]);function qe(v,A){return`${v},${A}`}K=qe;function Qe(v){Reflect.deleteProperty(r,v)}function it(v,A){xe.value="cell";const F=E(v,A);F?(Ue.value={col:F.range.startCol,row:F.range.startRow},se.value={...F.range}):(Ue.value={col:v,row:A},se.value={startCol:v,startRow:A,endCol:v,endRow:A})}function gt(v,A,F,Q,oe="cell"){const d=E(v,A);if(Ue.value=d?{col:d.range.startCol,row:d.range.startRow}:{col:v,row:A},xe.value=oe,oe==="row"||oe==="col"){const S=Math.min(v,F),W=Math.max(v,F),$=Math.min(A,Q),_=Math.max(A,Q);se.value={startCol:S,startRow:$,endCol:W,endRow:_}}else se.value=ke(v,A,F,Q)}function bt(){gt(0,0,a-1,i-1,"all")}function Dt(v,A){const F=se.value;return F?(xe.value==="cell"||xe.value==="all",v>=F.startCol&&v<=F.endCol&&A>=F.startRow&&A<=F.endRow):!1}function Nt(v,A){return Dt(v,A)}function St(v,A){for(const F in Be){const Q=Be[F];if(Q&&v>=Q.startCol&&v<=Q.endCol&&A>=Q.startRow&&A<=Q.endRow)return{range:Q,anchor:F}}return null}E=St;function ft(v,A){return Be[qe(v,A)]!==void 0}function Rt(v,A){const F=E(v,A);if(F&&v===F.range.startCol&&A===F.range.startRow){const Q=Me.value[F.range.endCol+1]-Me.value[v],oe=Fe.value[F.range.endRow+1]-Fe.value[A];return{w:Q,h:oe}}return{w:ye.value[v],h:O(A)}}function xt(v,A,F,Q){let oe=Math.min(v,F),d=Math.max(v,F),S=Math.min(A,Q),W=Math.max(A,Q),$=!0;for(;$;){$=!1;for(const _ in Be){const H=Be[_];if(!H)continue;H.startCol<=d&&H.endCol>=oe&&H.startRow<=W&&H.endRow>=S&&(H.startCol<oe&&(oe=H.startCol,$=!0),H.endCol>d&&(d=H.endCol,$=!0),H.startRow<S&&(S=H.startRow,$=!0),H.endRow>W&&(W=H.endRow,$=!0))}}return{startCol:oe,startRow:S,endCol:d,endRow:W}}ke=xt;function Kt(v,A){var F;return((F=r[qe(v,A)])==null?void 0:F.value)??""}function Ut(v,A){return bl(),bi(v,A,r,a,i)}function V(v,A,F){var W,$;const Q=qe(v,A);if(bl(),F===""||F==null){ge.clear(Q);const _=(W=r[Q])==null?void 0:W.styleId;_!==void 0&&_>0?r[Q]={value:"",styleId:_}:Qe(Q),ge.markDirty(Q);return}const oe=String(F);if(!oe.startsWith("=")){const _=k(r[Q]),H=typeof(_==null?void 0:_.numberFormat)=="string"?_.numberFormat:"";if(Ct(H)){const ne=Il(oe,l.value);if(ne){const ze={..._??{},numberFormat:ne.format};r[Q]={value:String(ne.serial),styleId:y(ze)},ge.clear(Q),ge.markDirty(Q);return}const ae=ao(oe,l.value);if(ae){const ze={..._??{},numberFormat:ae.format};r[Q]={value:String(ae.num),styleId:y(ze)},ge.clear(Q),ge.markDirty(Q);return}}}const d=($=r[Q])==null?void 0:$.styleId,S={value:oe};d!==void 0&&d>0&&(S.styleId=d),r[Q]=S,oe.startsWith("=")?ge.set(Q,$l(oe.slice(1),a,i)):ge.clear(Q),ge.markDirty(Q)}function N(v,A,F,Q){for(let oe=v;oe<=A;oe++)for(let d=F;d<=Q;d++){const S=qe(oe,d);ge.clear(S),Qe(S),ge.markDirty(S)}}let z=()=>{};function ue(v){we.value||(we.value={...Ue.value},v!==void 0?me.value=v:me.value||(me.value=Kt(Ue.value.col,Ue.value.row)))}function L(){we.value&&(z(),V(we.value.col,we.value.row,me.value),we.value=null,me.value="")}function X(){we.value=null,me.value=""}function fe(v,A){const F=Ue.value;let Q=Math.max(0,Math.min(a-1,F.col+v)),oe=Math.max(0,Math.min(i-1,F.row+A));const d=E(F.col,F.row),S=E(Q,oe);d&&S&&d.anchor===S.anchor&&(v>0?Q=d.range.endCol+1:v<0&&(Q=d.range.startCol-1),A>0?oe=d.range.endRow+1:A<0&&(oe=d.range.startRow-1),Q=Math.max(0,Math.min(a-1,Q)),oe=Math.max(0,Math.min(i-1,oe))),it(Q,oe)}function re(v,A){const F=Math.max(0,je.w-52-11),Q=Math.max(0,je.h-24-11),oe=Me.value[v],d=Fe.value[A],S=E(v,A),W=S?Me.value[S.range.endCol+1]-Me.value[v]:ye.value[v],$=S?Fe.value[S.range.endRow+1]-Fe.value[A]:O(A);let _=$e.value,H=G.value;oe<_?_=oe:oe+W>_+F&&(_=oe+W-F),d<H?H=d:d+$>H+Q&&(H=d+$-Q),at(_,H)}function Se(v){const A=Me.value;if(v<0||v>=A[a])return-1;let F=0,Q=a-1;for(;F<Q;){const oe=F+Q+1>>1;A[oe]<=v?F=oe:Q=oe-1}return F}function Ie(v){const A=Fe.value;if(v<0||v>=A[i])return-1;let F=0,Q=i-1;for(;F<Q;){const oe=F+Q+1>>1;A[oe]<=v?F=oe:Q=oe-1}return F}const Oe={props:n,locale:l,colCount:a,rowCount:i,cells:r,styles:g,borders:c,merges:Be,formulaDeps:ge,selection:se,activeCell:Ue,editingCell:we,editValue:me,colWidths:ye,rowHeights:Le,scrollX:$e,scrollY:G,BASE_CELL_VPAD:pe,fontMetricsCache:m,fontMetricsCanvas:D,measureFontMetrics:I,_getFontMetricsForCell:Ee,getWrappedLines:p,cellFontSize:M,colPositions:Me,getRowHeight:ie,_isAutoRow:Te,rowPositions:Fe,totalWidth:ot,totalHeight:Je,selectCell:it,selectRange:gt,selectAll:bt,isSelected:Dt,isCellSelected:Nt,selectionMode:xe,cellKey:qe,delCell:Qe,findMerge:St,_isMergeAnchor:ft,_mergedSpan:Rt,expandSelectionForMerges:xt,getCellRaw:Kt,getCellValue:Ut,setCellValue:V,clearCellsInRange:N,startEdit:ue,commitEdit:L,cancelEdit:X,moveActive:fe,ensureVisible:re,hitCol:Se,hitRow:Ie,registerStyle:y,resolveStyle:k,rebuildStyleIndex:j,syncStyles:Z,registerBorder:te,resolveBorder:U,rebuildBorderIndex:h,syncBorders:le,getCellBorderSide:P,getMergeOwner:ee,isSameMergeInternal:ve,viewSize:je,findHighlight:(v,A)=>null};return z=()=>{var v;return(v=Oe.saveUndo)==null?void 0:v.call(Oe)},at=(v,A)=>{var F;return(F=Oe.clampScroll)==null?void 0:F.call(Oe,v,A)},Oe}function Li(e,o){const n=t.ref([]),l=t.ref([]);function a(d){return Ai(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(S=>({...S,cells:a(S.cells),styles:[...S.styles],borders:S.borders?[...S.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 g(){const d=i(),S=n.value[n.value.length-1];S&&JSON.stringify(S)===JSON.stringify(d)||(n.value.push(d),l.value=[],n.value.length>50&&n.value.shift())}e.saveUndo=g;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 S;return(S=e.emitModelData)==null?void 0:S.call(e)}))}function b(){var d;l.value.length&&(n.value.push(i()),r(l.value.pop()),(d=e.scheduleRender)==null||d.call(e),t.nextTick(()=>{var S;return(S=e.emitModelData)==null?void 0:S.call(e)}))}const R=t.computed(()=>n.value.length>0),B=t.computed(()=>l.value.length>0),C=t.computed(()=>!!e.selection.value),y=t.ref(null);function k(){var W;const d=e.selection.value;if(!d)return;const S={};for(let $=d.startCol;$<=d.endCol;$++)for(let _=d.startRow;_<=d.endRow;_++)S[`${$-d.startCol},${_-d.startRow}`]=((W=e.cells[e.cellKey($,_)])==null?void 0:W.styleId)??0;y.value={styles:S}}function j(){var W,$,_;const d=y.value,S=e.selection.value;if(!(!d||!S)){g();for(let H=S.startCol;H<=S.endCol;H++)for(let ne=S.startRow;ne<=S.endRow;ne++){const ae=e.findMerge(H,ne);if(ae&&(H!==ae.range.startCol||ne!==ae.range.startRow))continue;const ze=d.styles[`${H-S.startCol},${ne-S.startRow}`]??0,lt=e.cellKey(H,ne),ut=((W=e.cells[lt])==null?void 0:W.value)??"";if(ut===""&&ze===0)e.delCell(lt);else{const rt={value:ut};ze>0&&(rt.styleId=ze),e.cells[lt]=rt}}y.value=null,($=e.scheduleRender)==null||$.call(e),(_=e.emitModelData)==null||_.call(e)}}function Z(){var S,W,$;const d=e.selection.value;if(d){g();for(let _=d.startCol;_<=d.endCol;_++)for(let H=d.startRow;H<=d.endRow;H++){const ne=e.findMerge(_,H);if(ne&&(_!==ne.range.startCol||H!==ne.range.startRow))continue;const ae=e.cellKey(_,H),ze=((S=e.cells[ae])==null?void 0:S.value)??"";ze===""?e.delCell(ae):e.cells[ae]={value:ze}}(W=e.scheduleRender)==null||W.call(e),($=e.emitModelData)==null||$.call(e)}}const te=t.computed(()=>xn.map(d=>({...d,label:d.value===""?T(e.locale.value,"fontDefault"):d.label}))),U=t.computed(()=>Bn.map(d=>({...d,label:String(d.value)}))),h="\0",le=t.computed(()=>{const d=e.selection.value;if(!d)return"";let S,W=!1;for(let $=d.startCol;$<=d.endCol&&!W;$++)for(let _=d.startRow;_<=d.endRow&&!W;_++){const H=e.findMerge($,_);if(H&&($!==H.range.startCol||_!==H.range.startRow))continue;const ne=e.resolveStyle(e.cells[e.cellKey($,_)]),ae=typeof(ne==null?void 0:ne.fontFamily)=="string"?ne.fontFamily:"";S===void 0?S=ae:ae!==S&&(W=!0)}return W?h:S??""}),P=t.computed(()=>{const d=e.selection.value;if(!d)return Ft;let S,W=!1;for(let $=d.startCol;$<=d.endCol&&!W;$++)for(let _=d.startRow;_<=d.endRow&&!W;_++){const H=e.findMerge($,_);if(H&&($!==H.range.startCol||_!==H.range.startRow))continue;const ne=e.cellFontSize($,_);S===void 0?S=ne:ne!==S&&(W=!0)}return W?0:S??Ft});function ee(d,S){var $,_,H;const W=e.selection.value;if(W){g();for(let ne=W.startCol;ne<=W.endCol;ne++)for(let ae=W.startRow;ae<=W.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),ut=(($=e.cells[lt])==null?void 0:$.value)??"";let vt={...e.resolveStyle(e.cells[lt])??{}};if(S===""||S===null||S===void 0||S===0){const{[d]:wt,...dl}=vt;vt=dl}else vt[d]=S;const Tt=Object.keys(vt).length?e.registerStyle(vt):0;if(ut===""&&Tt===0)e.delCell(lt);else{const wt={value:ut};Tt>0&&(wt.styleId=Tt),e.cells[lt]=wt}}(_=e.scheduleRender)==null||_.call(e),(H=e.emitModelData)==null||H.call(e)}}function ve(d){ee("fontFamily",d===""?"":d)}const Be=t.ref(!1),ge=t.ref(!1),se=t.ref(!1),xe=t.ref(!1),Ue=t.ref(!1);function we(d){ee("fontSize",d),Be.value=!1}const me=t.computed(()=>In.map(d=>({label:T(e.locale.value,d.labelKey),value:d.value,icon:d.icon}))),ye=t.computed(()=>Fn.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 S=e.resolveStyle(e.cells[e.cellKey(d.startCol,d.startRow)]),W=typeof(S==null?void 0:S.textAlign)=="string"?S.textAlign:"";return W==="center"||W==="right"?W:"left"}),$e=t.computed(()=>{const d=e.selection.value;if(!d)return"top";const S=e.resolveStyle(e.cells[e.cellKey(d.startCol,d.startRow)]),W=typeof(S==null?void 0:S.verticalAlign)=="string"?S.verticalAlign:"";return W==="middle"||W==="bottom"?W:"top"}),G=t.computed(()=>{const d=e.selection.value;if(!d)return!1;const S=e.resolveStyle(e.cells[e.cellKey(d.startCol,d.startRow)]);return(S==null?void 0:S.wrap)==="wrap"});function pe(d){ee("textAlign",d)}function m(d){ee("verticalAlign",d)}function D(){if(!e.selection.value)return;const S=G.value;ee("wrap",S?void 0:"wrap")}const I=t.ref(""),K=Be;t.watch(P,d=>{I.value=d===0?"":String(d)},{immediate:!0});function E(d){const S=d.replace(/[^\d]/g,"");I.value=S;const W=parseInt(S,10);!isNaN(W)&&W>=5&&W<=72&&W!==P.value&&ee("fontSize",W)}function s(){const d=I.value.trim();if(!d){I.value=P.value===0?"":String(P.value);return}let S=parseInt(d,10);isNaN(S)?S=P.value===0?Ft:P.value:S=Math.max(5,Math.min(72,S)),I.value=String(S),S!==P.value&&ee("fontSize",S)}function u(d){d.key==="Enter"&&d.target.blur()}function O(d){d&&d.preventDefault(),K.value=!K.value,K.value&&(se&&(se.value=!1),ge&&(ge.value=!1),xe.value=!1,Ue.value=!1)}function ke(){const d=P.value===0?Ft:P.value,S=Math.min(72,d+1);ee("fontSize",S),I.value=String(S),K.value=!1}function Ee(){const d=P.value===0?Ft:P.value,S=Math.max(5,d-1);ee("fontSize",S),I.value=String(S),K.value=!1}function p(d){const S=e.selection.value;if(!S)return!1;let W,$=!1;for(let _=S.startCol;_<=S.endCol&&!$;_++)for(let H=S.startRow;H<=S.endRow&&!$;H++){const ne=e.findMerge(_,H);if(ne&&(_!==ne.range.startCol||H!==ne.range.startRow))continue;const ae=e.resolveStyle(e.cells[e.cellKey(_,H)]),ze=!!(ae!=null&&ae[d]);W===void 0?W=ze:ze!==W&&($=!0)}return!$&&W===!0}const M=t.computed(()=>p("fontWeight")),Me=t.computed(()=>p("fontStyle")),je=t.computed(()=>p("underline")),at=t.computed(()=>p("strikethrough"));function ie(){ee("fontWeight",M.value?"":"bold")}function Te(){ee("fontStyle",Me.value?"":"italic")}function Fe(){ee("underline",je.value?"":"underline")}function ot(){ee("strikethrough",at.value?"":"line-through")}const Je=t.ref(""),qe=t.ref(""),Qe=xe,it=Ue;function gt(){Qe.value=!Qe.value,it.value=!1,ge&&(ge.value=!1),se&&(se.value=!1)}function bt(){it.value=!it.value,Qe.value=!1,ge&&(ge.value=!1),se&&(se.value=!1)}function Dt(d){ge&&(ge.value=d),d&&(Qe.value=!1,it.value=!1,se&&(se.value=!1))}function Nt(d){Je.value=d,ee("color",d===""?"":d)}function St(d){qe.value=d,ee("backgroundColor",d===""?"":d)}function ft(){ee("color",Je.value===""?"":Je.value)}function Rt(){ee("backgroundColor",qe.value===""?"":qe.value)}const xt=t.computed(()=>{const d=e.selection.value;if(!d)return"";let S,W=!1;for(let $=d.startCol;$<=d.endCol&&!W;$++)for(let _=d.startRow;_<=d.endRow&&!W;_++){const H=e.findMerge($,_);if(H&&($!==H.range.startCol||_!==H.range.startRow))continue;const ne=e.resolveStyle(e.cells[e.cellKey($,_)]),ae=typeof(ne==null?void 0:ne.color)=="string"?ne.color:"";S===void 0?S=ae:ae!==S&&(W=!0)}return W?"":S??""}),Kt=t.computed(()=>{const d=e.selection.value;if(!d)return"";let S,W=!1;for(let $=d.startCol;$<=d.endCol&&!W;$++)for(let _=d.startRow;_<=d.endRow&&!W;_++){const H=e.findMerge($,_);if(H&&($!==H.range.startCol||_!==H.range.startRow))continue;const ne=e.resolveStyle(e.cells[e.cellKey($,_)]),ae=typeof(ne==null?void 0:ne.backgroundColor)=="string"?ne.backgroundColor:"";S===void 0?S=ae:ae!==S&&(W=!0)}return W?"":S??""}),Ut=t.computed(()=>ln(e.locale.value)),V=t.ref(!1),N=t.computed(()=>{const d=e.selection.value;if(!d)return Ht;let S,W=!1;for(let $=d.startCol;$<=d.endCol&&!W;$++)for(let _=d.startRow;_<=d.endRow&&!W;_++){const H=e.findMerge($,_);if(H&&($!==H.range.startCol||_!==H.range.startRow))continue;const ne=e.resolveStyle(e.cells[e.cellKey($,_)]),ae=(ne==null?void 0:ne.numberFormatCategory)==="custom"?Ot:typeof(ne==null?void 0:ne.numberFormat)=="string"?ne.numberFormat:"";S===void 0?S=ae:ae!==S&&(W=!0)}return W?Mt:S??Ht});function z(d){if((d==null?void 0:d.numberFormatCategory)==="custom")return Ot;const S=typeof(d==null?void 0:d.numberFormat)=="string"?d.numberFormat:"";return tn(S,e.locale.value)}const ue=t.computed(()=>{const d=N.value;if(d!==Mt)return d===Ot?Ot:tn(d,e.locale.value);const S=e.selection.value;if(!S)return Ht;let W,$=!1;for(let _=S.startCol;_<=S.endCol&&!$;_++)for(let H=S.startRow;H<=S.endRow&&!$;H++){const ne=e.findMerge(_,H);if(ne&&(_!==ne.range.startCol||H!==ne.range.startRow))continue;const ae=z(e.resolveStyle(e.cells[e.cellKey(_,H)]));W===void 0?W=ae:ae!==W&&($=!0)}return $?Mt:W??Ht});function L(d){ee("numberFormat",d),X()}function X(){const d=e.selection.value;if(d)for(let S=d.startCol;S<=d.endCol;S++)for(let W=d.startRow;W<=d.endRow;W++){const $=e.findMerge(S,W);if($&&(S!==$.range.startCol||W!==$.range.startRow))continue;const _=e.cellKey(S,W),H=e.cells[_],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,ut=(H==null?void 0:H.value)??"";if(ut===""&<===0)e.delCell(_);else{const rt={value:ut};lt>0&&(rt.styleId=lt),e.cells[_]=rt}}}function fe(d){if(d===Ot){V.value=!0;return}L(d)}function re(){V.value=!0}function Se(){const d=e.selection.value;if(!d)return[];const S=[];for(let W=d.startCol;W<=d.endCol;W++)for(let $=d.startRow;$<=d.endRow;$++){const _=e.findMerge(W,$);if(_&&(W!==_.range.startCol||$!==_.range.startRow))continue;const H=e.cellKey(W,$),ne=e.cells[H],ae=e.resolveStyle(ne),ze=typeof(ae==null?void 0:ae.numberFormat)=="string"?ae.numberFormat:Ht,lt=(ne==null?void 0:ne.value)??"";en(ze,lt)&&S.push({key:H,nf:ze,decimals:to(ze,lt)})}return S}const Ie=t.computed(()=>Se().some(d=>d.decimals<Tl)),Oe=t.computed(()=>Se().some(d=>d.decimals>Vl));function v(d,S,W){var ae;const $=((ae=e.cells[d])==null?void 0:ae.value)??"",H={...e.resolveStyle(e.cells[d])??{}};S===""?(delete H.numberFormat,delete H.numberFormatCategory):(H.numberFormat=S,W==="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 A(d){var $,_;const S=Se(),W=[];for(const H of S){const ne=H.decimals+d;if(ne<Vl||ne>Tl)continue;const ae=no(H.nf,ne);ae==null||ae===H.nf||W.push({key:H.key,code:ae,category:Ct(H.nf)?"custom":void 0})}if(W.length){g();for(const H of W)v(H.key,H.code,H.category);($=e.scheduleRender)==null||$.call(e),(_=e.emitModelData)==null||_.call(e)}}function F(){A(1)}function Q(){A(-1)}return{undoStack:n,redoStack:l,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:g,undo:c,redo:b,canUndo:R,canRedo:B,hasSelection:C,paintFmt:y,onPaintFormat:k,applyPaintFormat:j,clearFormat:Z,fontFamilyOptions:te,fontSizeOptions:U,FONT_FAMILY_MIXED:h,selFontFamily:le,selFontSize:P,applyStyleToSelection:ee,onFontFamilyChange:ve,onFontSizeChange:we,hAlignOptions:me,vAlignOptions:ye,selHAlign:Le,selVAlign:$e,selWrap:G,onHAlignChange:pe,onVAlignChange:m,onWrapToggle:D,fontSizeInput:I,fontSizeMenuOpen:K,onFontSizeInput:E,onFontSizeBlur:s,onFontSizeKeydown:u,toggleFontSizeMenu:O,onFontSizeStepUp:ke,onFontSizeStepDown:Ee,selFontWeight:M,selFontStyle:Me,selUnderline:je,selStrikethrough:at,toggleFontWeight:ie,toggleFontStyle:Te,toggleUnderline:Fe,toggleStrikethrough:ot,cachedTextColor:Je,cachedFillColor:qe,textColorMenuOpen:Qe,fillColorMenuOpen:it,_toggleTextColorMenu:gt,_toggleFillColorMenu:bt,onBorderMenuToggle:Dt,onTextColorChange:Nt,onFillColorChange:St,applyCachedTextColor:ft,applyCachedFillColor:Rt,selTextColor:xt,selFillColor:Kt,nfOptions:Ut,selNumberFormat:N,selNumberFormatDisplay:ue,NF_NUMBER_FORMAT_MIXED:Mt,nfDialogOpen:V,onNumberFormatChange:fe,openNumberFormatDialog:re,applyNumberFormatCode:L,canIncreaseDecimals:Ie,canDecreaseDecimals:Oe,onIncreaseDecimals:F,onDecreaseDecimals:Q}}function $i(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 _i(e,o){const n=t.ref("none"),l=t.ref(!1),a="#444";function i(m,D,I,K){if(m<0||D<0||m>=e.colCount||D>=e.rowCount)return;const E=e.findMerge(m,D),s=E?E.anchor:e.cellKey(m,D);if(!e.cells[s]){if(!K)return;e.cells[s]={value:""}}Oi(e.cells[s],I,K,e.styles,{get:O=>e.resolveBorder(O),getId:O=>e.registerBorder(O)},e.registerStyle)}function r(m,D,I){var ke;const K=e.findMerge(m,D),E=K?K.anchor:e.cellKey(m,D),s=((ke=e.cells[E])==null?void 0:ke.value)??"",u=e.resolveStyle(e.cells[E])?{...e.resolveStyle(e.cells[E])}:{},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(E);else{const Ee=e.registerStyle(u);e.cells[E]={value:s,styleId:Ee||void 0}}}function g(m){var ke,Ee;n.value=m;const D=e.selection.value;if(!D)return;o.saveUndo();const{startCol:I,startRow:K,endCol:E,endRow:s}=D,u={width:1,color:a},O={width:2,color:a};if(m==="none")for(let p=I;p<=E;p++)for(let M=K;M<=s;M++){const Me=e.findMerge(p,M);Me&&(p!==Me.range.startCol||M!==Me.range.startRow)||r(p,M,{})}else if(m==="all")for(let p=I;p<=E;p++)for(let M=K;M<=s;M++){const Me=e.findMerge(p,M);Me&&(p!==Me.range.startCol||M!==Me.range.startRow)||r(p,M,{top:u,right:u,bottom:u,left:u})}else if(m==="outer"||m==="thickOuter"){const p=m==="thickOuter"?O:u;for(let M=I;M<=E;M++)i(M,K,"top",p);for(let M=I;M<=E;M++)i(M,s,"bottom",p);for(let M=K;M<=s;M++)i(I,M,"left",p);for(let M=K;M<=s;M++)i(E,M,"right",p)}else{const M={top:{side:"top",edgeCheck:(Me,je)=>je===K},bottom:{side:"bottom",edgeCheck:(Me,je)=>je===s},left:{side:"left",edgeCheck:(Me,je)=>Me===I},right:{side:"right",edgeCheck:(Me,je)=>Me===E}}[m];if(M)for(let Me=I;Me<=E;Me++)for(let je=K;je<=s;je++)M.edgeCheck(Me,je)&&i(Me,je,M.side,u)}(ke=e.scheduleRender)==null||ke.call(e),(Ee=e.emitModelData)==null||Ee.call(e)}function c(){g(n.value)}function b(m,D,I){const K=I.toLowerCase(),E=e.findMerge(m,D);if(E){if(K==="top"&&D!==E.range.startRow||K==="bottom"&&D!==E.range.endRow||K==="left"&&m!==E.range.startCol||K==="right"&&m!==E.range.endCol)return 0;const u=e.getCellBorderSide(e.cells[E.anchor],K);return(u==null?void 0:u.width)??0}const s=e.getCellBorderSide(e.cells[e.cellKey(m,D)],K);return(s==null?void 0:s.width)??0}const R=t.ref(!1);function B(m){R.value=m,m&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,l.value=!1,o.fontSizeMenuOpen.value=!1)}function C(m,D,I,K){const E=[];for(const s in e.merges){const u=e.merges[s];u&&u.startCol<=I&&u.endCol>=m&&u.startRow<=K&&u.endRow>=D&&E.push(s)}for(const s of E)Reflect.deleteProperty(e.merges,s)}function y(){var s,u,O;const m=e.selection.value;if(!m||m.startCol===m.endCol&&m.startRow===m.endRow)return;o.saveUndo(),C(m.startCol,m.startRow,m.endCol,m.endRow);const D=e.cellKey(m.startCol,m.startRow),I=((s=e.cells[D])==null?void 0:s.value)??"";for(let ke=m.startCol;ke<=m.endCol;ke++)for(let Ee=m.startRow;Ee<=m.endRow;Ee++)ke===m.startCol&&Ee===m.startRow||e.clearCellsInRange(ke,ke,Ee,Ee);const K=e.resolveStyle(e.cells[D])?{...e.resolveStyle(e.cells[D])}:{};K.textAlign="center";const E=e.registerStyle(K);e.cells[D]={value:I,styleId:E||void 0},e.merges[D]={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),(O=e.emitModelData)==null||O.call(e)}function k(){var D,I,K;const m=e.selection.value;if(!(!m||m.startCol===m.endCol)){o.saveUndo();for(let E=m.startRow;E<=m.endRow;E++){C(m.startCol,E,m.endCol,E);const s=e.cellKey(m.startCol,E);(D=e.cells[s])==null||D.value;for(let u=m.startCol+1;u<=m.endCol;u++)e.clearCellsInRange(u,u,E,E);e.merges[s]={startCol:m.startCol,startRow:E,endCol:m.endCol,endRow:E}}e.selectRange(m.startCol,m.startRow,m.endCol,m.endRow),(I=e.scheduleRender)==null||I.call(e),(K=e.emitModelData)==null||K.call(e)}}function j(){var I,K,E;const m=e.selection.value;if(!m||m.startCol===m.endCol&&m.startRow===m.endRow)return;o.saveUndo(),C(m.startCol,m.startRow,m.endCol,m.endRow);const D=e.cellKey(m.startCol,m.startRow);(I=e.cells[D])==null||I.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[D]={startCol:m.startCol,startRow:m.startRow,endCol:m.endCol,endRow:m.endRow},e.selectCell(m.startCol,m.startRow),(K=e.scheduleRender)==null||K.call(e),(E=e.emitModelData)==null||E.call(e)}function Z(){var D,I;const m=e.selection.value;m&&(o.saveUndo(),C(m.startCol,m.startRow,m.endCol,m.endRow),(D=e.scheduleRender)==null||D.call(e),(I=e.emitModelData)==null||I.call(e))}function te(){const m=e.selection.value;if(!m)return;const D=e.findMerge(m.startCol,m.startRow);D&&m.startCol===D.range.startCol&&m.startRow===D.range.startRow&&m.endCol===D.range.endCol&&m.endRow===D.range.endRow?Z():y()}function U(m){switch(m){case"mergeCenter":y();break;case"mergeAcross":k();break;case"mergeCells":j();break;case"unmergeCells":Z();break}}let h=null,le=[];function P(m,D,I,K){le=[];for(let E=I;E<=K;E++){const s=[];for(let u=m;u<=D;u++){const O=e.cells[e.cellKey(u,E)];s.push((O==null?void 0:O.styleId)??0)}le.push(s)}}function ee(m,D,I,K){const E=e.cellKey(m,D);if(bl(),I===""||I==null){e.formulaDeps.clear(E),K&&K>0?e.cells[E]={value:"",styleId:K}:e.delCell(E),e.formulaDeps.markDirty(E);return}e.cells[E]={value:I,styleId:K&&K>0?K:void 0},I.startsWith("=")?e.formulaDeps.set(E,$l(I.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(E),e.formulaDeps.markDirty(E)}function ve(){const m=e.selection.value;if(!m)return;h={...m},P(m.startCol,m.endCol,m.startRow,m.endRow);const D=[];for(let I=m.startRow;I<=m.endRow;I++){const K=[];for(let E=m.startCol;E<=m.endCol;E++)K.push(e.getCellRaw(E,I));D.push(K.join(" "))}Hl(D.join(`
|
|
4
|
+
`))}function Be(){const m=e.selection.value;if(m){if(m.startCol===0&&m.endCol===e.colCount-1){h={...m},P(0,e.colCount-1,m.startRow,m.endRow);const D=[];for(let I=m.startRow;I<=m.endRow;I++){const K=[];for(let E=0;E<e.colCount;E++)K.push(e.getCellRaw(E,I));D.push(K.join(" "))}Hl(D.join(`
|
|
5
|
+
`))}else if(m.startRow===0&&m.endRow===e.rowCount-1){h={...m},P(m.startCol,m.endCol,0,e.rowCount-1);const D=[];for(let I=0;I<e.rowCount;I++){const K=[];for(let E=m.startCol;E<=m.endCol;E++)K.push(e.getCellRaw(E,I));D.push(K.join(" "))}Hl(D.join(`
|
|
6
|
+
`))}}}async function ge(){var s;let m;try{m=await navigator.clipboard.readText()}catch{return}if(!m&&m!=="")return;const D=m.split(/\r?\n/),I=e.activeCell.value,K=h,E=K&&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,p=I.row+u;if(Ee<e.colCount&&p<e.rowCount){let M=O[ke];if(M.startsWith("=")&&K&&(M=yi(M,Ee-(K.startCol+ke),p-(K.startRow+u),e.colCount,e.rowCount,Xe)),E&&u<le.length&&ke<(((s=le[u])==null?void 0:s.length)??0)){const Me=le[u][ke]??null;ee(Ee,p,M,Me)}else e.setCellValue(Ee,p,M)}}}}function se(){var m;if(o.saveUndo(),ve(),e.selection.value){const D=e.selection.value;e.clearCellsInRange(D.startCol,D.endCol,D.startRow,D.endRow),(m=e.scheduleRender)==null||m.call(e)}}function xe(){var m;if(e.selection.value){const D=e.selection.value;e.clearCellsInRange(D.startCol,D.endCol,D.startRow,D.endRow),(m=e.scheduleRender)==null||m.call(e)}}function Ue(){var s,u;const m=e.selection.value;if(!m)return;o.saveUndo();const D=m.startCol,I=m.startRow,K=m.endCol,E=m.endRow;if(I===E)if(K+1<e.colCount){const O=`${Xe(D)}${I+1}:${Xe(K)}${I+1}`;e.setCellValue(K+1,I,`=SUM(${O})`)}else{const O=`${Xe(D)}${I+1}:${Xe(K-1)}${I+1}`;e.setCellValue(K,I,`=SUM(${O})`)}else for(let O=D;O<=K;O++)if(E+1<e.rowCount){const ke=`${Xe(O)}${I+1}:${Xe(O)}${E+1}`;e.setCellValue(O,E+1,`=SUM(${ke})`)}else{const ke=`${Xe(O)}${I+1}:${Xe(O)}${E}`;e.setCellValue(O,E,`=SUM(${ke})`)}(s=e.scheduleRender)==null||s.call(e),(u=e.emitModelData)==null||u.call(e)}function we(){var s,u;const m=e.selection.value;if(!m)return;o.saveUndo();const D=m.startCol,I=m.startRow,K=m.endCol,E=m.endRow;if(I===E)if(K+1<e.colCount){const O=`${Xe(D)}${I+1}:${Xe(K)}${I+1}`;e.setCellValue(K+1,I,`=AVERAGE(${O})`)}else{const O=`${Xe(D)}${I+1}:${Xe(K-1)}${I+1}`;e.setCellValue(K,I,`=AVERAGE(${O})`)}else for(let O=D;O<=K;O++)if(E+1<e.rowCount){const ke=`${Xe(O)}${I+1}:${Xe(O)}${E+1}`;e.setCellValue(O,E+1,`=AVERAGE(${ke})`)}else{const ke=`${Xe(O)}${I+1}:${Xe(O)}${E}`;e.setCellValue(O,E,`=AVERAGE(${ke})`)}(s=e.scheduleRender)==null||s.call(e),(u=e.emitModelData)==null||u.call(e)}function me(){var s,u;const m=e.selection.value;if(!m)return;o.saveUndo();const D=m.startCol,I=m.startRow,K=m.endCol,E=m.endRow;if(I===E)if(K+1<e.colCount){const O=`${Xe(D)}${I+1}:${Xe(K)}${I+1}`;e.setCellValue(K+1,I,`=COUNT(${O})`)}else{const O=`${Xe(D)}${I+1}:${Xe(K-1)}${I+1}`;e.setCellValue(K,I,`=COUNT(${O})`)}else for(let O=D;O<=K;O++)if(E+1<e.rowCount){const ke=`${Xe(O)}${I+1}:${Xe(O)}${E+1}`;e.setCellValue(O,E+1,`=COUNT(${ke})`)}else{const ke=`${Xe(O)}${I+1}:${Xe(O)}${E}`;e.setCellValue(O,E,`=COUNT(${ke})`)}(s=e.scheduleRender)==null||s.call(e),(u=e.emitModelData)==null||u.call(e)}const ye=t.ref(!1);function Le(m){ye.value=m,m&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,l.value=!1,o.fontSizeMenuOpen.value=!1,R.value=!1)}function $e(){Ue(),ye.value=!1}function G(){we(),ye.value=!1}function pe(){me(),ye.value=!1}return{cachedBorder:n,borderMenuOpen:l,BORDER_COLOR:a,onBorderChange:g,setCellBorderSide:i,applyBorderToCell:r,applyCachedBorder:c,cellBorderWidth:b,mergeMenuOpen:R,onMergeMenuToggle:B,removeOverlappingMerges:C,mergeAndCenter:y,mergeAcross:k,mergeCells:j,unmergeCells:Z,onApplyMerge:te,onMergeChange:U,copySourceRange:null,copySourceStyles:[],captureStyles:P,setCellWithStyle:ee,copyToClipboard:ve,copyRowCol:Be,pasteFromClipboard:ge,cutSelected:se,clearSelected:xe,sumSelected:Ue,avgSelected:we,countSelected:me,calcMenuOpen:ye,onCalcMenuToggle:Le,onCalcSum:$e,onCalcAvg:G,onCalcCount:pe}}function zi(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 mn(e){return e==="number"?0:1}function pn(e,o,n){var i;if(e==null||e.trim()==="")return{kind:"blank"};const l=o??"";if(l===yt||l==="@")return{kind:"text",text:e};if(Ct(l)){if(hl(e))return{kind:"number",num:Number(e)};const r=Il(e,n);return r?{kind:"number",num:r.serial}:{kind:"text",text:jt(e,l,n)}}const a=Lt(l);if(a.kind==="date"||a.kind==="duration"){const r=Number(e);return Number.isFinite(r)?{kind:"number",num:r}:{kind:"text",text:jt(e,l,n)}}if(a.kind==="number"){const r=Number(e);if(Number.isFinite(r)){const g=((i=a.sections.find(c=>c.hasDigits))==null?void 0:i.scale)??1;return{kind:"number",num:r*g}}return{kind:"text",text:jt(e,l,n)}}return{kind:"text",text:jt(e,l,n)}}function Wi(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=mn(e.kind),i=mn(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 Ki(e,o,n){const l=e.map((a,i)=>i);return l.sort((a,i)=>{const r=Wi(e[a],e[i],o,n);return r!==0?r:a-i}),l}function Ui(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 Pi(e,o,n,l,a){function i(V,N){const z=N-V+1,ue=xe(V,N);for(let L=V;L<=N;L++)for(let X=0;X<e.colCount;X++)e.delCell(e.cellKey(X,L));for(let L=V;L<e.rowCount-z;L++){for(let X=0;X<e.colCount;X++){const fe=e.cellKey(X,L+z),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+z]}for(let L=e.rowCount-z;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(V,N){const z=N-V+1;if(N>=e.rowCount-1)return;const ue=we(V,N);for(let L=e.rowCount-1;L>N;L--){for(let X=0;X<e.colCount;X++){const fe=e.cellKey(X,L-z),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-z]}for(let L=N+1;L<=N+z;L++){for(let X=0;X<e.colCount;X++)e.delCell(e.cellKey(X,L));e.rowHeights.value[L]=void 0}se(ue)}function g(V,N){const z=N-V+1;if(N>=e.colCount-1)return;const ue=me(V,N);for(let L=e.colCount-1;L>N;L--){for(let X=0;X<e.rowCount;X++){const fe=e.cellKey(L-z,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-z]}for(let L=N+1;L<=N+z;L++){for(let X=0;X<e.rowCount;X++)e.delCell(e.cellKey(L,X));e.colWidths.value[L]=100}se(ue)}function c(V,N){const z=N-V+1,ue=Ue(V,N);for(let L=V;L<=N;L++)for(let X=0;X<e.rowCount;X++)e.delCell(e.cellKey(L,X));for(let L=V;L<e.colCount-z;L++){for(let X=0;X<e.rowCount;X++){const fe=e.cellKey(L+z,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+z]}for(let L=e.colCount-z;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 b(V,N){const z=e.resolveStyle(e.cells[e.cellKey(V,N)]);return typeof(z==null?void 0:z.numberFormat)=="string"?z.numberFormat:""}function R(V,N,z){for(let ue=N;ue<=z;ue++)if(e.getCellRaw(V,ue).trim()!=="")return!0;return!1}function B(V){const{startRow:N,endRow:z,startCol:ue,endCol:L}=V;let X=ue,fe=L;for(;X>0&&R(X-1,N,z);)X--;for(;fe<e.colCount-1&&R(fe+1,N,z);)fe++;return{startRow:N,endRow:z,startCol:X,endCol:fe}}function C(V){const N=B(V);return N.startCol!==V.startCol||N.endCol!==V.endCol}function y(V,N,z,ue=V){let L,X;if(z)L=z.startRow,X=z.endRow;else{const v=e.selection.value,A=!!v&&v.startRow===v.endRow&&v.startCol===v.endCol;L=A||!v?0:v.startRow,X=A||!v?e.rowCount-1:v.endRow}let fe=-1,re=-1;for(let v=L;v<=X;v++){let A=!1;for(let F=V;F<=N;F++)if(e.getCellRaw(F,v).trim()!==""){A=!0;break}A&&(fe<0&&(fe=v),re=v)}if(fe<0)return null;const Se=[];for(let v=fe;v<=re;v++){const A=e.getCellRaw(ue,v);Se.push(pn(A,b(ue,v),e.locale.value))}const Ie=Ui(Se)?fe+1:fe;let Oe=!1;for(let v=fe;v<=re&&!Oe;v++)for(let A=V;A<=N;A++){const F=e.cells[e.cellKey(A,v)];if(F&&F.value.startsWith("=")){Oe=!0;break}}if(!Oe)for(const v in e.merges){const A=e.merges[v];if(A&&A.startCol<=N&&A.endCol>=V&&A.startRow<=X&&A.endRow>=L){Oe=!0;break}}return{firstRow:fe,lastRow:re,sortStart:Ie,blocked:Oe}}function k(V,N){const z=y(V,N);return!!z&&!z.blocked&&z.sortStart<z.lastRow}function j(V,N,z){var Q,oe;const ue=N??e.selection.value;if(!ue)return;const L=ue.startCol,X=ue.endCol,fe=z??L,re=y(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=[],v=[];for(let d=re.sortStart;d<=re.lastRow;d++){const S=new Array(Se);for(let $=L;$<=X;$++)S[$-L]=e.cells[e.cellKey($,d)]??null;Oe.push(S);const W=e.getCellRaw(fe,d);v.push(pn(W,b(fe,d),e.locale.value))}const A=Ki(v,V,e.locale.value);let F=!1;for(let d=0;d<Ie;d++)if(A[d]!==d){F=!0;break}if(F){o.saveUndo();for(let d=0;d<Ie;d++){const S=Oe[A[d]],W=re.sortStart+d;for(let $=L;$<=X;$++){const _=e.cellKey($,W),H=S[$-L],ne=H?H.value:"",ae=(Q=e.cells[_])==null?void 0:Q.styleId;ne!==""||ae!==void 0?e.cells[_]={value:ne,styleId:ae}:e.delCell(_)}}bl();for(let d=re.sortStart;d<=re.lastRow;d++)for(let S=L;S<=X;S++)e.formulaDeps.markDirty(e.cellKey(S,d));(oe=e.scheduleRender)==null||oe.call(e),M()}}const Z=t.ref(!1),te=t.ref(null);function U(V){const N=e.selection.value;if(!N||!C(N))return!1;const z=B(N);return te.value={order:V,originalRange:N,expandedRange:z},Z.value=!0,!0}function h(V){const N=te.value;if(!N)return;const{order:z,originalRange:ue,expandedRange:L}=N;Z.value=!1,te.value=null,j(z,V?L:ue,ue.startCol),ee.value=z}function le(){Z.value=!1,te.value=null}const P=t.ref(!1),ee=t.ref("asc");function ve(V){P.value=V,V&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,o.fontSizeMenuOpen.value=!1)}function Be(V){U(V)||(ee.value=V,j(V))}function ge(){U(ee.value)||j(ee.value)}function se(V){Object.keys(e.merges).forEach(N=>Reflect.deleteProperty(e.merges,N));for(const N of V)if(!(N.newRange.startCol>N.newRange.endCol||N.newRange.startRow>N.newRange.endRow)&&(e.merges[N.newAnchorKey]={...N.newRange},N.anchorCell)){const z=N.anchorCell.value,ue=N.anchorCell.styleId;z===""&&!ue||(e.cells[N.newAnchorKey]={value:z,styleId:ue||void 0})}}function xe(V,N){const z=N-V+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-=z,Oe-=z,ue.push({newAnchorKey:e.cellKey(re,Ie),newRange:{startCol:re,startRow:Ie,endCol:Se,endRow:Oe}});continue}if(Oe<V){ue.push({newAnchorKey:L,newRange:{startCol:re,startRow:Ie,endCol:Se,endRow:Oe}});continue}if(Ie>=V&&Oe<=N||(Ie>=V&&Ie<=N&&(Ie=V),Oe>=V&&Oe<=N?Oe=V-1:Oe>N&&(Oe-=z),Ie>Oe))continue;const v=re,A=Ie,F=e.cellKey(v,A),oe=L.split(",").map(Number)[1],d=oe>=V&&oe<=N||v!==X.startCol||A!==oe;ue.push({newAnchorKey:F,newRange:{startCol:re,startRow:Ie,endCol:Se,endRow:Oe},anchorCell:d?fe:void 0})}return ue}function Ue(V,N){const z=N-V+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-=z,Se-=z,ue.push({newAnchorKey:e.cellKey(re,Ie),newRange:{startCol:re,startRow:Ie,endCol:Se,endRow:Oe}});continue}if(Se<V){ue.push({newAnchorKey:L,newRange:{startCol:re,startRow:Ie,endCol:Se,endRow:Oe}});continue}if(re>=V&&Se<=N||(re>=V&&re<=N&&(re=V),Se>=V&&Se<=N?Se=V-1:Se>N&&(Se-=z),re>Se))continue;const v=re,A=Ie,F=e.cellKey(v,A),oe=L.split(",").map(Number)[0],d=oe>=V&&oe<=N||v!==oe||A!==X.startRow;ue.push({newAnchorKey:F,newRange:{startCol:re,startRow:Ie,endCol:Se,endRow:Oe},anchorCell:d?fe:void 0})}return ue}function we(V,N){const z=N-V+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<V?ue.push({newAnchorKey:L,newRange:{startCol:fe,startRow:Se,endCol:re,endRow:Ie}}):Se>N?(Se+=z,Ie+=z,ue.push({newAnchorKey:e.cellKey(fe,Se),newRange:{startCol:fe,startRow:Se,endCol:re,endRow:Ie}})):(Ie+=z,ue.push({newAnchorKey:L,newRange:{startCol:fe,startRow:Se,endCol:re,endRow:Ie}}))}return ue}function me(V,N){const z=N-V+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<V?ue.push({newAnchorKey:L,newRange:{startCol:fe,startRow:Se,endCol:re,endRow:Ie}}):fe>N?(fe+=z,re+=z,ue.push({newAnchorKey:e.cellKey(fe,Se),newRange:{startCol:fe,startRow:Se,endCol:re,endRow:Ie}})):(re+=z,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(V){return{id:Le(),name:V,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 m(){const V=G.value[pe.value];V&&(V.cells={...e.cells},V.merges={...e.merges},V.selection=e.selection.value?{...e.selection.value}:null,V.activeCell={...e.activeCell.value},V.scrollX=e.scrollX.value,V.scrollY=e.scrollY.value,V.colWidths=[...e.colWidths.value],V.rowHeights=[...e.rowHeights.value],V.styles=[...e.styles],V.borders=[...e.borders])}function D(V){const N=G.value[V];N&&(Object.keys(e.cells).forEach(z=>e.delCell(z)),Object.assign(e.cells,N.cells),Object.keys(e.merges).forEach(z=>Reflect.deleteProperty(e.merges,z)),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=V)}function I(V){V===pe.value||V<0||V>=G.value.length||(e.cancelEdit(),m(),D(V))}function K(V){return o.saveUndo(),e.cancelEdit(),m(),G.value.push($e(V??`Sheet${G.value.length+1}`)),D(G.value.length-1),G.value.length-1}function E(V){return G.value.length<=1||(o.saveUndo(),e.cancelEdit(),G.value.splice(V,1),D(Math.min(V,G.value.length-1))),pe.value}function s(V,N){G.value[V]&&N.trim()&&(o.saveUndo(),G.value[V].name=N.trim())}function u(V){o.saveUndo(),e.cancelEdit(),m();const N=G.value[V];if(!N)return V;let z=N.name;const ue=z.match(/^(.*?)\s*\((\d+)\)$/);let L=ue?parseInt(ue[2],10)+1:2;ue&&(z=ue[1]);let X=`${z} (${L})`;const fe=new Set(G.value.map(Se=>Se.name));for(;fe.has(X);)L++,X=`${z} (${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(V+1,0,re),D(V+1),V+1}function O(V,N){var X;const z=V+N;if(z<0||z>=G.value.length)return;o.saveUndo();const ue=pe.value,L=G.value.splice(V,1)[0];G.value.splice(z,0,L),ue===V?pe.value=z:V<ue&&z>=ue?pe.value=ue-1:V>ue&&z<=ue&&(pe.value=ue+1),(X=e.scheduleRender)==null||X.call(e)}const ke=t.computed(()=>G.value.length);let Ee="";const p=n;function M(){m();const V=G.value.map(z=>{const ue={};for(const[re,Se]of Object.entries(z.cells))ue[re]={value:Se.value},Se.styleId&&Se.styleId>0&&(ue[re].styleId=Se.styleId);const L={name:z.name,cells:ue};z.styles&&z.styles.length>1&&(L.styles=[...z.styles]),z.borders&&z.borders.length>1&&(L.borders=[...z.borders]),z.merges&&Object.keys(z.merges).length&&(L.merges={...z.merges});const X={};for(let re=0;re<z.colWidths.length;re++)z.colWidths[re]!==100&&(X[re]=z.colWidths[re]);Object.keys(X).length&&(L.colWidths=X);const fe={};for(let re=0;re<z.rowHeights.length;re++){const Se=z.rowHeights[re];Se!=null&&(fe[re]=Se)}return Object.keys(fe).length&&(L.rowHeights=fe),L}),N=JSON.stringify(V);N!==Ee&&(Ee=N,p.value=V,a&&(a.value=N))}e.emitModelData=M;let Me=!1;function je(){Me||(Me=!0,Promise.resolve().then(()=>{Me=!1,M()}))}const at=t.computed(()=>e.props.theme==="dark"?Hn:On),ie=t.computed(()=>zi(at.value,e.props.width,e.props.height,Zt)),Te=t.computed(()=>{const V={};for(const[N,z]of Object.entries(ie.value))N.startsWith("--")&&(V[N]=z);return V}),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,V=>{e.viewSize&&(e.viewSize.w=V.w,e.viewSize.h=V.h)},{deep:!0});const it=48,gt=28,bt=11,Dt=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,Qe.w-it-bt))),Nt=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,Qe.h-gt-bt)));function St(V,N){const z=Math.max(0,Qe.w-it-bt),ue=Math.max(0,Qe.h-gt-bt);e.scrollX.value=Math.max(0,Math.min(V??e.scrollX.value,Math.max(0,e.totalWidth.value-z))),e.scrollY.value=Math.max(0,Math.min(N??e.scrollY.value,Math.max(0,e.totalHeight.value-ue)))}e.clampScroll=St;function ft(){var V;return typeof window>"u"?!1:!((V=window.matchMedia)!=null&&V.call(window,"(hover: none) and (pointer: coarse)").matches)}function Rt(V=!1){t.nextTick(()=>{const N=Je.value;if(N){if(!e.editingCell.value&&!ft()){document.activeElement===N&&N.blur();return}N.focus({preventScroll:!0}),V&&N.select()}})}function xt(){Rt()}function Kt(){var N;const V=e.selection.value;if(V){o.saveUndo();for(let z=V.startRow;z<=V.endRow;z++)e.rowHeights.value[z]=void 0;(N=e.scheduleRender)==null||N.call(e),M()}}function Ut(){var N;const V=e.selection.value;if(V){o.saveUndo();for(let z=V.startCol;z<=V.endCol;z++)e.colWidths.value[z]=100;(N=e.scheduleRender)==null||N.call(e),M()}}return{deleteRows:i,insertRows:r,insertCols:g,deleteCols:c,sortSelectedColumns:j,canSortColumns:k,sortMenuOpen:P,cachedSortOrder:ee,onSortMenuToggle:ve,onSortChange:Be,applyCachedSort:ge,sortConfirmOpen:Z,prepareSortConfirmation:U,confirmSort:h,cancelSortConfirmation:le,sheets:G,activeSheetIndex:pe,saveSheet:m,loadSheet:D,switchSheet:I,addSheet:K,removeSheet:E,renameSheet:s,dupSheet:u,moveSheet:O,sheetCount:ke,mkSheet:$e,emitModelData:M,scheduleOptEmit:je,themeColors:at,outerStyle:ie,toolbarThemeVars:Te,wrapperRef:Fe,canvasRef:ot,editInputRef:Je,formulaBarRef:qe,viewSize:Qe,maxScrollX:Dt,maxScrollY:Nt,clampScroll:St,canFocusHiddenEditor:ft,focusEditInput:Rt,onCanvasFocus:xt,resetRowHeight:Kt,resetColWidth:Ut,modelData:p}}function hn(e){return!!e&&e.width!==void 0&&e.width>0}function dt(e,o,n,l){const a=hn(e),i=hn(o);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return o;const r=e.width??0,g=o.width??0;return r>g?e:g>r?o:e}function Gi(e,o,n,l,a){let i=!1,r=null,g=1;function c(){i||(i=!0,requestAnimationFrame(()=>{i=!1,R()}))}e.scheduleRender=c;const b="#444";function R(){const f=l.canvasRef.value;if(!f)return;const w=l.wrapperRef.value;if(!w||(r=f.getContext("2d"),!r))return;g=window.devicePixelRatio||1;const Y=w.getBoundingClientRect(),q=Y.width,x=Y.height;l.viewSize.w=q,l.viewSize.h=x,f.width=q*g,f.height=x*g,f.style.width=q+"px",f.style.height=x+"px",r.setTransform(g,0,0,g,0,0);const J=e.scrollX.value,Re=e.scrollY.value,De=52,be=24,Ae=l.themeColors.value,et=e.colPositions.value,ct=e.rowPositions.value,Bt=e.colWidths.value,Et=[];for(let de=0;de<e.rowCount;de++)Et[de]=ct[de+1]-ct[de];const _t=Math.max(0,e.hitCol(J));let nl=_t;for(let de=_t;de<e.colCount&&!(De+et[de]-J>=q);de++)nl=de;const Gt=nl,Vt=Math.max(0,e.hitRow(Re));let vl=Vt;for(let de=Vt;de<e.rowCount&&!(be+ct[de]-Re>=x);de++)vl=de;const At=vl;let ol=_t,rl=Vt;for(const de in e.merges){const Ce=e.merges[de];Ce&&(Ce.startRow>At||Ce.endRow<Vt||Ce.startCol>Gt||Ce.endCol<_t||(Ce.startCol<ol&&(ol=Ce.startCol),Ce.startRow<rl&&(rl=Ce.startRow)))}r.fillStyle=Ae.bg,r.fillRect(0,0,q,x),r.fillStyle=Ae.gridBg,r.fillRect(De,be,q-De,x-be),r.save(),r.beginPath(),r.rect(De,be,q-De,x-be),r.clip();const mt=e.selection.value,ml=e.editingCell.value;for(let de=rl;de<=At;de++)for(let Ce=ol;Ce<=Gt;Ce++){const He=e.findMerge(Ce,de);if(He&&!(Ce===He.range.startCol&&de===He.range.startRow))continue;const _e=De+et[Ce]-J,Ge=be+ct[de]-Re;let tt=Bt[Ce],nt=Et[de];if(He&&(tt=et[He.range.endCol+1]-et[Ce],nt=ct[He.range.endRow+1]-ct[de]),_e+tt<De||Ge+nt<be||_e>q||Ge>x)continue;const Yt=e.findHighlight?e.findHighlight(Ce,de):null,Ye=e.resolveStyle(e.cells[e.cellKey(Ce,de)]),Ze=typeof(Ye==null?void 0:Ye.backgroundColor)=="string"?Ye.backgroundColor:"";if(Ze&&(r.fillStyle=Ze,r.fillRect(_e,Ge,tt,nt)),Yt&&(r.fillStyle=Yt==="active"?Ae.findActiveBg:Ae.findMatchBg,r.fillRect(_e,Ge,tt,nt)),e.isSelected(Ce,de)&&(r.fillStyle=Ae.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?r.fillRect(_e,Ge,Bt[Ce],Et[de]):r.fillRect(_e,Ge,tt,nt)),e.activeCell.value.col===Ce&&e.activeCell.value.row===de&&(r.strokeStyle=Ae.activeCellBorder,r.lineWidth=2,r.strokeRect(_e+1,Ge+1,tt-2,nt-2)),Yt==="active"&&(r.strokeStyle=Ae.findActiveBg,r.lineWidth=2,r.strokeRect(_e+1,Ge+1,tt-2,nt-2)),r.strokeStyle=Ae.gridLine,r.lineWidth=.5,r.strokeRect(_e+.25,Ge+.25,tt-.5,nt-.5),!(ml&&ml.col===Ce&&ml.row===de)){const he=e.resolveStyle(e.cells[e.cellKey(Ce,de)]),We=e.getCellValue(Ce,de),Ke=typeof(he==null?void 0:he.numberFormat)=="string"?he.numberFormat:"",ce=We?jt(We,Ke,e.locale.value):"";if(ce){const Ve=e.cellFontSize(Ce,de),Ne=typeof(he==null?void 0:he.fontFamily)=="string"&&he.fontFamily?he.fontFamily:il,Pe=(he==null?void 0:he.fontWeight)==="bold"?"bold":"normal",It=(he==null?void 0:he.fontStyle)==="italic"?"italic":"normal",kc=(he==null?void 0:he.underline)==="underline",Ec=(he==null?void 0:he.strikethrough)==="line-through",Kl=typeof(he==null?void 0:he.color)=="string"?he.color:"",vn=typeof(he==null?void 0:he.textAlign)=="string"?he.textAlign:Jl(We,Ke)?"right":"left",wn=typeof(he==null?void 0:he.verticalAlign)=="string"?he.verticalAlign:"top";r.fillStyle=Kl||Ae.cellText,r.font=`${It} ${Pe} ${Ve}px ${Ne}`,r.textBaseline="alphabetic",r.save(),r.beginPath(),r.rect(_e+5,Ge+1,tt-10,nt-2),r.clip();const kn=(he==null?void 0:he.wrap)==="wrap",wl=tt-10;let Ul=ce;const Sc=!kn&&Qn(Ke),En=ce===Bl||eo(We,Ke);if(En||Sc){if(En){const Qt=Math.max(1,r.measureText("#").width),pl=Math.max(1,Math.floor(wl/Qt));Ul="#".repeat(pl)}else if(e.getWrappedLines(r,ce,1e9,!1).some(zt=>zt&&r.measureText(zt).width>wl)){const zt=Math.max(1,r.measureText("#").width),al=Math.max(1,Math.floor(wl/zt));Ul="#".repeat(al)}}const kl=e.getWrappedLines(r,Ul,wl,kn),{ascent:El,descent:Sl}=e.measureFontMetrics(Ne,Ve,Pe,It),Rl=El+Sl,Rc=kl.length*Rl;let xl;wn==="middle"?xl=Ge+(nt-Rc)/2+El:wn==="bottom"?xl=Ge+nt-e.BASE_CELL_VPAD-Sl-(kl.length-1)*Rl:xl=Ge+e.BASE_CELL_VPAD+El;for(let Qt=0;Qt<kl.length;Qt++){const pl=kl[Qt],zt=xl+Qt*Rl,al=r.measureText(pl);let Xt;if(vn==="center"?Xt=_e+tt/2-al.width/2:vn==="right"?Xt=_e+tt-5-al.width:Xt=_e+5,r.fillText(pl,Xt,zt),kc&&(r.strokeStyle=Kl||Ae.cellText,r.lineWidth=1,r.beginPath(),r.moveTo(Xt,zt+Sl+1),r.lineTo(Xt+al.width,zt+Sl+1),r.stroke()),Ec){r.strokeStyle=Kl||Ae.cellText,r.lineWidth=1;const Sn=zt-El+Rl*.42;r.beginPath(),r.moveTo(Xt,Sn),r.lineTo(Xt+al.width,Sn),r.stroke()}}r.restore()}}}const st=(de,Ce,He)=>{const _e=e.findMerge(de,Ce);return _e?e.getCellBorderSide(e.cells[_e.anchor],He):e.getCellBorderSide(e.cells[e.cellKey(de,Ce)],He)};r.fillStyle=b;for(let de=rl;de<=At;de++)for(let Ce=ol;Ce<=Gt;Ce++){const He=e.findMerge(Ce,de);if(He&&!(Ce===He.range.startCol&&de===He.range.startRow))continue;const _e=De+et[Ce]-J,Ge=be+ct[de]-Re;let tt=Bt[Ce],nt=Et[de];if(He&&(tt=et[He.range.endCol+1]-et[Ce],nt=ct[He.range.endRow+1]-ct[de]),_e+tt<De||Ge+nt<be||_e>q||Ge>x)continue;const Yt=e.cells[e.cellKey(Ce,de)],Ye={top:e.getCellBorderSide(Yt,"top"),right:e.getCellBorderSide(Yt,"right"),bottom:e.getCellBorderSide(Yt,"bottom"),left:e.getCellBorderSide(Yt,"left")};if(He){const Ze=He.range.startRow,he=He.range.endRow,We=He.range.startCol,Ke=He.range.endCol;for(let ce=We;ce<=Ke;ce++){if(e.isSameMergeInternal(ce,Ze-1,ce,Ze))continue;const Ve=st(ce,Ze-1,"bottom"),Ne=dt(Ve,Ye.top);if(Ne&&Ne.width&&Ne.width>0){const Pe=De+et[ce]-J;r.fillStyle=Ne.color||b,r.fillRect(Pe,Ge,Bt[ce],Ne.width)}}for(let ce=We;ce<=Ke;ce++){if(e.isSameMergeInternal(ce,he,ce,he+1))continue;const Ve=st(ce,he+1,"top"),Ne=dt(Ye.bottom,Ve);if(Ne&&Ne.width&&Ne.width>0){const Pe=De+et[ce]-J;r.fillStyle=Ne.color||b,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 Ve=st(We-1,ce,"right"),Ne=dt(Ve,Ye.left);if(Ne&&Ne.width&&Ne.width>0){const Pe=be+ct[ce]-Re;r.fillStyle=Ne.color||b,r.fillRect(_e,Pe,Ne.width,Et[ce])}}for(let ce=Ze;ce<=he;ce++){if(e.isSameMergeInternal(Ke,ce,Ke+1,ce))continue;const Ve=st(Ke+1,ce,"left"),Ne=dt(Ye.right,Ve);if(Ne&&Ne.width&&Ne.width>0){const Pe=be+ct[ce]-Re;r.fillStyle=Ne.color||b,r.fillRect(_e+tt-Ne.width,Pe,Ne.width,Et[ce])}}{const ce=e.isSameMergeInternal(We,Ze-1,We,Ze)?Ye.top:dt(st(We,Ze-1,"bottom"),Ye.top),Ve=e.isSameMergeInternal(We-1,Ze,We,Ze)?Ye.left:dt(st(We-1,Ze,"right"),Ye.left),Ne=(ce==null?void 0:ce.width)??0,Pe=(Ve==null?void 0:Ve.width)??0;Ne>0&&Pe>0&&(r.fillStyle=(ce==null?void 0:ce.color)||(Ve==null?void 0:Ve.color)||b,r.fillRect(_e-Pe,Ge-Ne,Pe,Ne))}{const ce=e.isSameMergeInternal(Ke,Ze-1,Ke,Ze)?Ye.top:dt(st(Ke,Ze-1,"bottom"),Ye.top),Ve=e.isSameMergeInternal(Ke,Ze,Ke+1,Ze)?Ye.right:dt(Ye.right,st(Ke+1,Ze,"left")),Ne=(ce==null?void 0:ce.width)??0,Pe=(Ve==null?void 0:Ve.width)??0;Ne>0&&Pe>0&&(r.fillStyle=(ce==null?void 0:ce.color)||(Ve==null?void 0:Ve.color)||b,r.fillRect(_e+tt,Ge-Ne,Pe,Ne))}{const ce=e.isSameMergeInternal(We,he,We,he+1)?Ye.bottom:dt(Ye.bottom,st(We,he+1,"top")),Ve=e.isSameMergeInternal(We-1,he,We,he)?Ye.left:dt(st(We-1,he,"right"),Ye.left),Ne=(ce==null?void 0:ce.width)??0,Pe=(Ve==null?void 0:Ve.width)??0;Ne>0&&Pe>0&&(r.fillStyle=(ce==null?void 0:ce.color)||(Ve==null?void 0:Ve.color)||b,r.fillRect(_e-Pe,Ge+nt,Pe,Ne))}{const ce=e.isSameMergeInternal(Ke,he,Ke,he+1)?Ye.bottom:dt(Ye.bottom,st(Ke,he+1,"top")),Ve=e.isSameMergeInternal(Ke,he,Ke+1,he)?Ye.right:dt(Ye.right,st(Ke+1,he,"left")),Ne=(ce==null?void 0:ce.width)??0,Pe=(Ve==null?void 0:Ve.width)??0;Ne>0&&Pe>0&&(r.fillStyle=(ce==null?void 0:ce.color)||(Ve==null?void 0:Ve.color)||b,r.fillRect(_e+tt,Ge+nt,Pe,Ne))}}else{const Ze={top:st(Ce,de-1,"bottom"),left:st(Ce-1,de,"right"),bottom:st(Ce,de+1,"top"),right:st(Ce+1,de,"left")},he=dt(Ze.top,Ye.top),We=dt(Ze.left,Ye.left),Ke=dt(Ye.bottom,Ze.bottom),ce=dt(Ye.right,Ze.right),Ve=(he==null?void 0:he.width)??0,Ne=(We==null?void 0:We.width)??0,Pe=(Ke==null?void 0:Ke.width)??0,It=(ce==null?void 0:ce.width)??0;Ve>0&&(r.fillStyle=(he==null?void 0:he.color)||b,r.fillRect(_e,Ge,tt,Ve)),Pe>0&&(r.fillStyle=(Ke==null?void 0:Ke.color)||b,r.fillRect(_e,Ge+nt-Pe,tt,Pe)),Ne>0&&(r.fillStyle=(We==null?void 0:We.color)||b,r.fillRect(_e,Ge,Ne,nt)),It>0&&(r.fillStyle=(ce==null?void 0:ce.color)||b,r.fillRect(_e+tt-It,Ge,It,nt)),Ve>0&&Ne>0&&(r.fillStyle=(he==null?void 0:he.color)||(We==null?void 0:We.color)||b,r.fillRect(_e-Ne,Ge-Ve,Ne,Ve)),Ve>0&&It>0&&(r.fillStyle=(he==null?void 0:he.color)||(ce==null?void 0:ce.color)||b,r.fillRect(_e+tt,Ge-Ve,It,Ve)),Pe>0&&Ne>0&&(r.fillStyle=(Ke==null?void 0:Ke.color)||(We==null?void 0:We.color)||b,r.fillRect(_e-Ne,Ge+nt,Ne,Pe)),Pe>0&&It>0&&(r.fillStyle=(Ke==null?void 0:Ke.color)||(ce==null?void 0:ce.color)||b,r.fillRect(_e+tt,Ge+nt,It,Pe))}}r.restore(),r.fillStyle=Ae.headerBg,r.fillRect(De,0,q-De,be);for(let de=_t;de<=Gt;de++){const Ce=De+et[de]-J,He=Bt[de];Ce+He<De||Ce>q||(mt&&de>=mt.startCol&&de<=mt.endCol&&(r.fillStyle=Ae.selectionBg,r.fillRect(Ce,0,He,be)),r.strokeStyle=Ae.headerBorder,r.lineWidth=.5,r.strokeRect(Ce+.25,.25,He-.5,be-.5),mt&&de>=mt.startCol&&de<=mt.endCol&&(r.strokeStyle=Ae.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ce,be-1),r.lineTo(Ce+He,be-1),r.stroke()),r.fillStyle=Ae.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(Xe(de),Ce+He/2,be/2))}r.strokeStyle=Ae.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(De,be+.5),r.lineTo(q,be+.5),r.stroke(),r.fillStyle=Ae.headerBg,r.fillRect(0,be,De,x-be);for(let de=Vt;de<=At;de++){const Ce=be+ct[de]-Re,He=Et[de];Ce+He<be||Ce>x||(mt&&de>=mt.startRow&&de<=mt.endRow&&(r.fillStyle=Ae.selectionBg,r.fillRect(0,Ce,De,He)),r.strokeStyle=Ae.headerBorder,r.lineWidth=.5,r.strokeRect(.25,Ce+.25,De-.5,He-.5),mt&&de>=mt.startRow&&de<=mt.endRow&&(r.strokeStyle=Ae.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(De-1,Ce),r.lineTo(De-1,Ce+He),r.stroke()),r.fillStyle=Ae.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(de+1),De/2,Ce+He/2+.5))}r.strokeStyle=Ae.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(De+.5,be),r.lineTo(De+.5,x),r.stroke(),r.fillStyle=Ae.headerBg,r.fillRect(0,0,De,be),r.strokeStyle=Ae.headerSep,r.lineWidth=1,r.strokeRect(.5,.5,De-.5,be-.5)}const B=t.computed(()=>Xe(e.activeCell.value.col)+String(e.activeCell.value.row+1)),C=t.ref(""),y=t.ref(!1),k=t.computed(()=>e.editingCell.value?C.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)||"";C.value=Y,h=!1}else!f&&w&&(C.value="",y.value=!1,h=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(C.value="",h=!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),C.value=w,h=!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)),C.value="",h=!1,c(),(q=l.emitModelData)==null||q.call(l)}let U=!1,h=!1;function le(){var J,Re,De,be,Ae,et,ct,Bt,Et;if(U)return;const f=l.formulaBarRef.value,w=!!(f&&typeof document<"u"&&document.activeElement===f);if(!e.editingCell.value&&!w&&!h)return;const Y={...e.activeCell.value},q=e.editingCell.value?e.editingCell.value.col:Y.col,x=e.editingCell.value?e.editingCell.value.row:Y.row;if(!e.editingCell.value){const _t=e.getCellRaw(q,x),nl=C.value!==_t;if(!h)return;U=!0,nl&&((J=e.saveUndo)==null||J.call(e),e.setCellValue(q,x,C.value),c(),(Re=l.emitModelData)==null||Re.call(l)),(De=l.formulaBarRef.value)==null||De.blur(),C.value="",y.value=!1,h=!1,t.nextTick(()=>{U=!1});return}U=!0,h?(e.editValue.value=C.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(be=l.formulaBarRef.value)==null||be.blur(),C.value="",y.value=!1,h=!1,c(),l.focusEditInput(),(Ae=l.emitModelData)==null||Ae.call(l),t.nextTick(()=>{U=!1})):w?(C.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(),C.value="",y.value=!1,h=!1,c(),l.focusEditInput(),(ct=l.emitModelData)==null||ct.call(l),t.nextTick(()=>{U=!1})):(e.commitEdit(),(Bt=l.formulaBarRef.value)==null||Bt.blur(),C.value="",y.value=!1,h=!1,c(),l.focusEditInput(),(Et=l.emitModelData)==null||Et.call(l),t.nextTick(()=>{U=!1}))}function P(){var f;U||(U=!0,e.editingCell.value&&e.cancelEdit(),(f=l.formulaBarRef.value)==null||f.blur(),C.value="",y.value=!1,h=!1,c(),l.focusEditInput(),t.nextTick(()=>{U=!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,x=w.value,J=x.substring(0,Y)+`
|
|
7
|
+
`+x.substring(q),Re=Y+1;C.value=J,y.value||(y.value=!0),t.nextTick(()=>{try{w.setSelectionRange(Re,Re)}catch{}if(y.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 ve(){le()}const Be=t.ref(null),ge=t.ref("");function se(f){Be.value===null&&(l.switchSheet(f),c())}function xe(f){f!==l.activeSheetIndex.value&&(l.saveSheet(),l.loadSheet(f),c()),Be.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 Ue(){Be.value!==null&&(l.renameSheet(Be.value,ge.value),t.nextTick(()=>l.emitModelData())),Be.value=null,ge.value=""}function we(){Be.value=null,ge.value=""}function me(f){f.key==="Enter"?(f.preventDefault(),Ue()):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,x=Y.length*28+8,J=window.innerWidth,Re=window.innerHeight;f+q>J&&(f-=q),w+x>Re&&(w-=x),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 m(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 x=q.getBoundingClientRect();pe.value=x.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:()=>{xe(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 K(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 E(f,w){f.preventDefault();const Y=f.clientX,q=f.clientY,x=e.selection.value;x&&x.startCol===0&&x.endCol===e.colCount-1&&w>=x.startRow&&w<=x.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:()=>M("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,x=e.selection.value;x&&x.startRow===0&&x.endRow===e.rowCount-1&&w>=x.startCol&&w<=x.endCol||(e.selectRange(w,0,w,e.rowCount-1,"col"),c());const J=e.selection.value,Re=!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:Re,children:[{label:T(e.locale.value,"sortAsc"),action:()=>{l.prepareSortConfirmation("asc")||l.sortSelectedColumns("asc")},disabled:Re},{label:T(e.locale.value,"sortDesc"),action:()=>{l.prepareSortConfirmation("desc")||l.sortSelectedColumns("desc")},disabled:Re}]},{label:`${T(e.locale.value,"colWidth")}...`,action:()=>M("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,x=!!(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:x},{label:T(e.locale.value,"avg"),action:n.avgSelected,disabled:x},{label:T(e.locale.value,"count"),action:n.countSelected,disabled:x}]}])}const O=t.ref(null),ke=t.ref(null);let Ee=null;function p(){Ee&&(document.removeEventListener("mousedown",Ee),Ee=null)}function M(f,w,Y){p();const q=e.selection.value;let x="";if(q){const Ae=f==="row"?e.getRowHeight(q.startRow):e.colWidths.value[q.startCol];x=Ae!=null&&Ae>0?String(Math.round(Ae)):""}const J=220,Re=118;let De=w,be=Y;De+J>window.innerWidth&&(De=window.innerWidth-J-8),be+Re>window.innerHeight&&(be=window.innerHeight-Re-8),De<8&&(De=8),be<8&&(be=8),ke.value={type:f,x:De,y:be,value:x,error:""},Ee=()=>{ke.value=null},setTimeout(()=>document.addEventListener("mousedown",Ee,{once:!0}),0),t.nextTick(()=>{const Ae=O.value;Ae&&(Ae.focus(),Ae.select())})}function Me(f){const w=ke.value;if(!w)return;const Y=f.target,q=Y.value,x=q.replace(/[^\d]/g,"");w.value=x,q!==x&&(Y.value=x),w.error=""}function je(f){f.key==="Enter"?(f.preventDefault(),ie()):f.key==="Escape"&&(f.preventDefault(),Te())}function at(){const f=ke.value;if(!f)return;const w=f.value.trim(),Y=Number(w),q=f.type==="row",x=q?24:30,J=q?500:1e3;if(w===""||!Number.isFinite(Y)){Te();return}const Re=Math.max(x,Math.min(J,Math.round(Y)));f.value=String(Re),f.error=""}function ie(){const f=ke.value,w=e.selection.value;if(!f||!w)return;const Y=f.value.trim(),q=Number(Y),x=f.type==="row",J=x?24:30,Re=x?500:1e3;if(Y===""||!Number.isFinite(q)){f.error=T(e.locale.value,"dimNumberError");return}if(q<J||q>Re){f.error=T(e.locale.value,"dimRangeError").replace("{min}",String(J)).replace("{max}",String(Re));return}const De=q;if(o.saveUndo(),x)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(){p(),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,x=e.resolveStyle(e.cells[e.cellKey(Y,q)]),J=e.cellFontSize(Y,q),Re=typeof(x==null?void 0:x.fontFamily)=="string"&&x.fontFamily?x.fontFamily:il,De=(x==null?void 0:x.fontWeight)==="bold"?"bold":"normal",be=(x==null?void 0:x.fontStyle)==="italic"?"italic":"normal",Ae=(x==null?void 0:x.underline)==="underline"?"underline":(x==null?void 0:x.strikethrough)==="line-through"?"line-through":"none",et=(x==null?void 0:x.underline)==="underline"&&(x==null?void 0:x.strikethrough)==="line-through"?"underline line-through":Ae,ct=typeof(x==null?void 0:x.color)=="string"?x.color:void 0,Bt=typeof(x==null?void 0:x.backgroundColor)=="string"?x.backgroundColor:void 0,Et=typeof(x==null?void 0:x.numberFormat)=="string"?x.numberFormat:"",_t=e.editValue.value??e.getCellValue(Y,q),nl=typeof(x==null?void 0:x.textAlign)=="string"?x.textAlign:Jl(_t,Et)?"right":"left",Gt=typeof(x==null?void 0:x.verticalAlign)=="string"?x.verticalAlign:"top",Vt=e.findMerge(Y,q),vl=Vt?e.colPositions.value[Vt.range.endCol+1]-e.colPositions.value[Y]:e.colWidths.value[Y],At=Vt?e.rowPositions.value[Vt.range.endRow+1]-e.rowPositions.value[q]:e.getRowHeight(q),ol=2,{ascent:rl,descent:mt}=e.measureFontMetrics(Re,J,De,be),ml=rl+mt,de=(e.editValue.value?e.editValue.value.split(`
|
|
8
|
+
`).length:1)*ml,Ce=e.BASE_CELL_VPAD-ol;let He=0,_e=0;return Gt==="middle"?(He=Math.floor((At-de)/2),_e=Math.max(0,At-de-He)):Gt==="top"?(He=Ce,_e=Math.max(0,At-de-He)):Gt==="bottom"&&(_e=Ce,He=Math.max(0,At-de-_e)),{left:`${52+e.colPositions.value[Y]-e.scrollX.value}px`,top:`${24+e.rowPositions.value[q]-e.scrollY.value}px`,width:`${vl}px`,height:`${At}px`,fontFamily:Re,fontSize:`${J}px`,lineHeight:1,fontWeight:De,fontStyle:be,textDecoration:et,textAlign:nl,paddingTop:`${He}px`,paddingRight:"3px",paddingBottom:`${_e}px`,paddingLeft:"3px",opacity:f?0:1,pointerEvents:f?"none":"auto",color:f?"transparent":ct,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()),it=t.computed(()=>Math.max(0,qe.value-11*2)),gt=t.computed(()=>Math.max(0,Qe.value-11*2)),bt=t.computed(()=>l.maxScrollX.value<=0?it.value:Math.max(24,ot()/e.totalWidth.value*it.value)),Dt=t.computed(()=>l.maxScrollX.value<=0?0:e.scrollX.value/l.maxScrollX.value*(it.value-bt.value)),Nt=t.computed(()=>l.maxScrollY.value<=0?gt.value:Math.max(24,Je()/e.totalHeight.value*gt.value)),St=t.computed(()=>l.maxScrollY.value<=0?0:e.scrollY.value/l.maxScrollY.value*(gt.value-Nt.value));let ft=null,Rt=0,xt=0;function Kt(f){f.preventDefault(),ft="v",Rt=f.clientY,xt=e.scrollY.value,document.addEventListener("mousemove",V),document.addEventListener("mouseup",N)}function Ut(f){f.preventDefault(),ft="h",Rt=f.clientX,xt=e.scrollX.value,document.addEventListener("mousemove",V),document.addEventListener("mouseup",N)}function V(f){if(ft==="v"){const Y=(f.clientY-Rt)/(gt.value-Nt.value);l.clampScroll(null,xt+Y*l.maxScrollY.value),c()}else if(ft==="h"){const Y=(f.clientX-Rt)/(it.value-bt.value);l.clampScroll(xt+Y*l.maxScrollX.value,null),c()}}function N(){ft=null,document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",N)}function z(f){if(ft)return;const w=f.currentTarget.getBoundingClientRect(),Y=f.clientY-w.top;Y<St.value?l.clampScroll(null,e.scrollY.value-Je()):Y>St.value+Nt.value&&l.clampScroll(null,e.scrollY.value+Je()),c()}function ue(f){if(ft)return;const w=f.currentTarget.getBoundingClientRect(),Y=f.clientX-w.left;Y<Dt.value?l.clampScroll(e.scrollX.value-ot(),null):Y>Dt.value+bt.value&&l.clampScroll(e.scrollX.value+ot(),null),c()}let L=!1,X=0,fe=0,re=!1,Se=!1,Ie=0,Oe=0,v=0,A=0,F=0,Q=0,oe=0,d=0,S=!1,W=!1,$=0,_=0,H="cell",ne=0,ae=-1,ze=-1;function lt(f){if(f.button!==0)return;f.preventDefault(),ye.value=null;const w=qt(f,l.canvasRef.value);if(w.y<24&&w.x>=52){const x=w.x-52+e.scrollX.value,J=e.hitCol(x);if(J>=0&&Math.abs(w.x-(52+e.colPositions.value[J+1]-e.scrollX.value))<=4){o.saveUndo(),re=!0,Ie=J,v=e.colWidths.value[J],A=x,c();return}}if(w.x<52&&w.y>=24){const x=w.y-24+e.scrollY.value,J=e.hitRow(x);if(J>=0&&Math.abs(w.y-(24+e.rowPositions.value[J+1]-e.scrollY.value))<=4){o.saveUndo(),Se=!0,Oe=J,v=e.getRowHeight(J),A=x,c();return}}if(w.x<52||w.y<24){{const x=l.formulaBarRef.value,J=!!(x&&typeof document<"u"&&document.activeElement===x);(e.editingCell.value||J||h)&&le()}if(w.y<24&&w.x>=52){const x=e.hitCol(w.x-52+e.scrollX.value);x>=0&&(e.selectRange(x,0,x,e.rowCount-1,"col"),L=!0,X=x,fe=0)}else if(w.x<52&&w.y>=24){const x=e.hitRow(w.y-24+e.scrollY.value);x>=0&&(e.selectRange(0,x,e.colCount-1,x,"row"),L=!0,X=0,fe=x)}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 x=l.formulaBarRef.value,J=!!(x&&typeof document<"u"&&document.activeElement===x);(e.editingCell.value||J||h)&&le()}if(f.shiftKey&&e.selection.value){const x=e.selection.value;e.selectRange(x.startCol,x.startRow,Y,q)}else e.selectCell(Y,q);L=!0,X=Y,fe=q,l.focusEditInput(),c()}}function ut(f){if(re){const J=qt(f,l.canvasRef.value).x-52+e.scrollX.value-A,Re=v+J;Re>=30&&Re<=1e3?e.colWidths.value[Ie]=Re:Re<30?e.colWidths.value[Ie]=30:e.colWidths.value[Ie]=1e3,c();return}if(Se){const J=qt(f,l.canvasRef.value).y-24+e.scrollY.value-A,Re=v+J;Re>=24&&Re<=500?e.rowHeights.value[Oe]=Re:Re<24?e.rowHeights.value[Oe]=24:e.rowHeights.value[Oe]=500,c();return}if(!L){const x=l.canvasRef.value;if(!x)return;if(o.paintFmt.value){x.style.cursor="copy";return}const J=qt(f,x);if(J.y<24&&J.x>=52){const Re=e.hitCol(J.x-52+e.scrollX.value);if(Re>=0&&Math.abs(J.x-(52+e.colPositions.value[Re+1]-e.scrollX.value))<=4){x.style.cursor="col-resize";return}}if(J.x<52&&J.y>=24){const Re=e.hitRow(J.y-24+e.scrollY.value);if(Re>=0&&Math.abs(J.y-(24+e.rowPositions.value[Re+1]-e.scrollY.value))<=4){x.style.cursor="row-resize";return}}x.style.cursor="cell";return}const w=qt(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 x=e.hitCol(w.x-52+e.scrollX.value);x>=0&&e.selectRange(Math.min(X,x),0,Math.max(X,x),e.rowCount-1,"col")}else if(w.x<52&&w.y>=24){const x=e.hitRow(w.y-24+e.scrollY.value);x>=0&&e.selectRange(0,Math.min(fe,x),e.colCount-1,Math.max(fe,x),"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 rt(f){const w=re||Se;L=!1,re=!1,Se=!1,w&&l.scheduleOptEmit(),o.paintFmt.value&&o.applyPaintFormat()}function vt(){const f=re||Se;L=!1,re=!1,Se=!1,f&&l.scheduleOptEmit()}function Tt(f){f.preventDefault();const w=qt(f,l.canvasRef.value);if(w.x<52&&w.y<24){K(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&&E(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 wt(f){const w=qt(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 x=l.formulaBarRef.value,J=!!(x&&typeof document<"u"&&document.activeElement===x);(e.editingCell.value||J||h)&&le()}e.selectCell(Y,q),e.ensureVisible(Y,q),e.startEdit(),c(),l.focusEditInput()}}function dl(f){l.clampScroll(e.scrollX.value+f.deltaX,e.scrollY.value+f.deltaY),c()}function Pt(f){if(f.touches.length!==1){S=!1;return}const w=f.touches[0],Y=l.canvasRef.value;if(!Y)return;const q=Y.getBoundingClientRect(),x=w.clientX-q.left,J=w.clientY-q.top;x>=52&&J>=24?(f.preventDefault(),S=!0,W=!1,H="cell",F=x,Q=J,oe=e.scrollX.value,d=e.scrollY.value,$=e.hitCol(x-52+e.scrollX.value),_=e.hitRow(J-24+e.scrollY.value)):x>=0&&J>=0&&(x<52||J<24)&&(f.preventDefault(),S=!0,W=!1,F=x,Q=J,oe=e.scrollX.value,d=e.scrollY.value,J<24&&x>=52?(H="col",$=e.hitCol(x-52+e.scrollX.value),_=-1):x<52&&J>=24?(H="row",_=e.hitRow(J-24+e.scrollY.value),$=-1):(H="all",$=-1,_=-1))}function ll(f){if(!S||f.touches.length!==1)return;const w=f.touches[0],Y=l.canvasRef.value;if(!Y)return;const q=Y.getBoundingClientRect(),x=w.clientX-q.left,J=w.clientY-q.top;(Math.abs(x-F)>8||Math.abs(J-Q)>8)&&(W=!0,f.preventDefault(),l.clampScroll(oe+(F-x),d+(Q-J)),c())}function ul(){if(S&&(S=!1,!W))if(H==="cell"&&$>=0&&_>=0){const f=Date.now();$===ae&&_===ze&&f-ne<300?(e.selectCell($,_),e.startEdit(),c(),l.focusEditInput(),ne=0):(e.commitEdit(),e.selectCell($,_),c(),ne=f),ae=$,ze=_,l.focusEditInput()}else H==="col"&&$>=0?(e.commitEdit(),e.selectRange($,0,$,e.rowCount-1,"col"),c()):H==="row"&&_>=0?(e.commitEdit(),e.selectRange(0,_,e.colCount-1,_,"row"),c()):H==="all"&&(e.commitEdit(),e.selectAll(),c())}function Cl(f){return f.isComposing||f.key==="Process"||f.keyCode===229}function yn(f){return f.key.length===1&&!f.ctrlKey&&!f.metaKey&&!f.altKey}function Cn(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 yn(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 zl=!1,Wl=!1;function hc(f){const w=f.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(w),C.value=w,c();return}e.editValue.value=w,C.value=w}function gc(){zl=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),C.value="",c())}function bc(f){zl=!1,Wl=!0,setTimeout(()=>{Wl=!1},0);const w=f.target.value;e.editValue.value=w,C.value=w}function yc(f){if(!e.editingCell.value){if(yn(f)||Cl(f))return;Cn(f);return}if(!(zl||Cl(f))&&!(Wl&&(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,x=w.value,J=x.slice(0,Y)+`
|
|
9
|
+
`+x.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 Cc(f){e.editingCell.value}function vc(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),c())},0)}let kt=null;function fl(){var w;const f=(w=l.wrapperRef.value)==null?void 0:w.getBoundingClientRect();if(f){const Y=Zt(e.props.width),q=Zt(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 wc(){t.onMounted(()=>{const f=Zt(e.props.width),w=Zt(e.props.height);(f==null||w==null)&&(kt=new ResizeObserver(()=>fl()),l.wrapperRef.value&&kt.observe(l.wrapperRef.value)),t.nextTick(()=>{fl(),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:x,styles:J}=un(Y.cells);if(Object.assign(q.cells,x),q.styles=Y.styles??J,Y.borders)q.borders=Y.borders;else{const Re=fn(q.styles);q.styles=Re.styles,q.borders=Re.borders}if(Y.colWidths)for(const[Re,De]of Object.entries(Y.colWidths)){const be=Number(Re);be>=0&&be<e.colCount&&De>=30&&(q.colWidths[be]=De)}if(Y.rowHeights)for(const[Re,De]of Object.entries(Y.rowHeights)){const be=Number(Re);be>=0&&be<e.rowCount&&De>=24&&(q.rowHeights[be]=De)}if(Y.merges)for(const[Re,De]of Object.entries(Y.merges))q.merges[Re]={...De};return q}),l.sheets.value.length>0&&l.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const f=Zt(e.props.width),w=Zt(e.props.height);f!=null&&w!=null?(kt==null||kt.disconnect(),kt=null):!kt&&l.wrapperRef.value&&(kt=new ResizeObserver(()=>fl()),kt.observe(l.wrapperRef.value)),t.nextTick(()=>fl())}),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(x=>{const J=l.mkSheet(x.name),{cells:Re,styles:De}=un(x.cells);if(Object.assign(J.cells,Re),J.styles=x.styles??De,x.borders)J.borders=x.borders;else{const be=fn(J.styles);J.styles=be.styles,J.borders=be.borders}if(x.colWidths)for(const[be,Ae]of Object.entries(x.colWidths)){const et=Number(be);et>=0&&et<e.colCount&&Ae>=30&&(J.colWidths[et]=Ae)}if(x.rowHeights)for(const[be,Ae]of Object.entries(x.rowHeights)){const et=Number(be);et>=0&&et<e.rowCount&&Ae>=24&&(J.rowHeights[et]=Ae)}if(x.merges)for(const[be,Ae]of Object.entries(x.merges))J.merges[be]={...Ae};return J}),l.sheets.value.length>0&&l.loadSheet(0),Y&&(e.selection.value=Y),e.activeCell.value=q,c()},{deep:!0}),t.onBeforeUnmount(()=>{kt==null||kt.disconnect()})}return{scheduleRender:c,render:R,activeCellLabel:B,formulaBarDisplay:k,formulaBarDraft:C,formulaBarExpanded:y,onFormulaBarFocus:j,onFormulaBarInput:Z,onFormulaBarKeydown:ee,onFormulaBarBlur:ve,acceptFormulaBarEdit:le,cancelFormulaBarEdit:P,insertFunctionIntoCell:te,renTab:Be,renTabVal:ge,onTabClick:se,onTabDblClick:xe,commitTabRename:Ue,cclTabRename:we,onTabRenameKd:me,ctxMenu:ye,ctxSubmenuLeft:pe,onCtxItemEnter:m,onTabCtxMenu:D,onTabBarCtx:I,onCornerCtx:K,onRowHdrCtx:E,onColHdrCtx:s,onCellCtx:u,dimInputRef:O,dimPanel:ke,openDimPanel:M,onDimInput:Me,onDimKeydown:je,onDimBlur:at,applyDimPanel:ie,closeDimPanel:Te,editInputStyle:Fe,hScrollbarW:qe,vScrollbarH:Qe,hTrackW:it,vTrackH:gt,hThumbW:bt,hThumbL:Dt,vThumbH:Nt,vThumbT:St,onVStart:Kt,onHStart:Ut,onSbMove:V,onSbUp:N,onVTrk:z,onHTrk:ue,onMouseDown:lt,onMouseMove:ut,onMouseUp:rt,onMouseLeave:vt,onCanvasCtx:Tt,onDblClick:wt,onWheel:dl,onTouchStart:Pt,onTouchMove:ll,onTouchEnd:ul,onKeydown:Cn,onEditInput:hc,onEditCompositionStart:gc,onEditCompositionEnd:bc,onEditKd:yc,onEditPaste:Cc,onEditBlur:vc,applySize:fl,setupLifecycle:wc}}function Yi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function gn(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 Xi(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(Yi(o),"gi"),()=>n):e}function _l(e,o,n,l,a,i,r){const g=[];if(r){for(let c=r.startRow;c<=r.endRow;c++)for(let b=r.startCol;b<=r.endCol;b++){const R=e[n(b,c)];R&&gn(R.value,l,a,i)&&g.push({sheetIndex:o,col:b,row:c})}return g}for(const c in e){const b=e[c];if(b&&gn(b.value,l,a,i)){const R=c.split(","),B=Number(R[0]),C=Number(R[1]);!Number.isNaN(B)&&!Number.isNaN(C)&&g.push({sheetIndex:o,col:B,row:C})}}return g}function Zi(e,o,n,l){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),g=t.ref("sheet"),c=t.ref(!1),b=t.ref(!1),R=t.ref(-1),B=t.ref([]),C=t.ref(""),y=t.ref(0),k=t.ref(""),j=t.computed(()=>{const G=new Set,pe=n.activeSheetIndex.value;for(const m of B.value)m.sheetIndex===pe&&G.add(`${m.col},${m.row}`);return G}),Z=t.computed(()=>{if(R.value<0||R.value>=B.value.length)return null;const G=B.value[R.value];return G.sheetIndex!==n.activeSheetIndex.value?null:`${G.col},${G.row}`});e.findHighlight=(G,pe)=>{const m=`${G},${pe}`;return Z.value===m?"active":j.value.has(m)?"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 m=n.sheets.value[G.sheetIndex];return((I=m==null?void 0:m.cells[pe])==null?void 0:I.value)??""}function U(G,pe){const m=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[m];D.cells[m]={value:String(pe),styleId:I==null?void 0:I.styleId}}}function h(){if(k.value){C.value=k.value;return}if(!i.value){C.value="";return}if(g.value==="selection"&&!e.selection.value){C.value=T(e.locale.value,"findNeedSelection");return}if(B.value.length===0){C.value=T(e.locale.value,"findNoResult");return}C.value=""}function le(){const G=i.value,pe=[];if(G)if(g.value==="workbook")n.sheets.value.forEach((m,D)=>{pe.push(..._l(m.cells,D,e.cellKey,G,c.value,b.value))});else if(g.value==="selection"){const m=e.selection.value;m&&pe.push(..._l(e.cells,n.activeSheetIndex.value,e.cellKey,G,c.value,b.value,m))}else pe.push(..._l(e.cells,n.activeSheetIndex.value,e.cellKey,G,c.value,b.value));B.value=pe,pe.length===0?R.value=-1:R.value>=pe.length?R.value=pe.length-1:R.value<0&&(R.value=0),h()}function P(){if(R.value<0||R.value>=B.value.length)return;const G=B.value[R.value];G.sheetIndex!==n.activeSheetIndex.value&&n.switchSheet(G.sheetIndex),g.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 ve=!1,Be=!1;function ge(G){if(ve){Be=Be||G;return}ve=!0,Be=G,ee(()=>{var pe;ve=!1,le(),Be&&B.value.length>0&&R.value>=0&&P(),Be=!1,(pe=e.scheduleRender)==null||pe.call(e)})}function se(){var G;a.value=!0,y.value++,le(),B.value.length>0&&(R.value=0,P()),(G=e.scheduleRender)==null||G.call(e)}function xe(){se()}function Ue(){var G;a.value=!1,B.value=[],R.value=-1,k.value="",C.value="",(G=e.scheduleRender)==null||G.call(e)}function we(){var G;B.value.length!==0&&(R.value=(R.value+1)%B.value.length,P(),(G=e.scheduleRender)==null||G.call(e))}function me(){var G;B.value.length!==0&&(R.value=(R.value-1+B.value.length)%B.value.length,P(),(G=e.scheduleRender)==null||G.call(e))}function ye(){var I,K;if(R.value<0||R.value>=B.value.length)return;const G=B.value[R.value],pe=te(G),m=Xi(pe,i.value,r.value,c.value);if(m===pe)return;o.saveUndo(),U(G,m);const D=R.value;le(),B.value.length>0?(R.value=Math.min(D,B.value.length-1),we()):R.value=-1,(I=e.emitModelData)==null||I.call(e),(K=e.scheduleRender)==null||K.call(e)}function Le(){var D,I;const G=i.value;if(!G||B.value.length===0)return;o.saveUndo();let pe=0;const m=B.value.slice();for(const K of m){const E=te(K),s=ji(E,G,r.value,c.value);s!==E&&(U(K,s),pe++)}B.value=[],R.value=-1,k.value=T(e.locale.value,"findReplacedAll").replace("{n}",String(pe)),h(),(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&&(k.value="",R.value=0,ge(!0))}),t.watch([g,c,b],()=>{a.value&&(k.value="",R.value=0,ge(!0))}),t.watch(e.cells,()=>{a.value&&ge(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&g.value==="selection"&&(R.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:g,matchCase:c,matchEntireCell:b,currentIndex:R,results:B,message:C,focusToken:y,activeSheetMatches:j,activeMatchKey:Z,openFind:se,openReplace:xe,close:Ue,recompute:le,findNext:we,findPrev:me,replace:ye,replaceAll:Le,setupLifecycle:$e}}const qi={class:"formula-bar__cell-label"},Ji={class:"formula-bar__buttons"},Qi=["title","aria-label"],ec=["rows","value"],tc=["title"],lc={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},nc={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},oc=["value"],rc={key:2,class:"sb-corner"},ac=["onClick","onMouseenter"],ic={class:"context-menu__label"},cc={key:0,class:"context-menu__arrow",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"22869"},sc=["onClick"],dc={class:"dim-panel__title"},uc={class:"dim-panel__body"},fc=["value"],mc={key:0,class:"dim-panel__error"},pc={class:"dim-panel__footer"},bn=pt(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=Hi(o,{rowCount:o.rowCount,colCount:o.colCount,theme:o.theme,locale:o.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:E=>{},mkSheet:E=>({id:"",name:E,cells:{},merges:{},styles:[{}],borders:[{}],selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[]})},r=Li(a,i),g=_i(a,r);$i(r,{borderMenuOpen:g.borderMenuOpen,mergeMenuOpen:g.mergeMenuOpen});const c=Pi(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 b=Gi(a,r,g,c,l);b.setupLifecycle();const R=Zi(a,r,c);R.setupLifecycle();const B=t.reactive(a),C=t.reactive(r),y=t.reactive(g),k=t.reactive(c),j=c.sheets,Z=c.activeSheetIndex,te=c.sortMenuOpen,U=c.cachedSortOrder,h=t.reactive(b),le=t.reactive(R),P=t.computed(()=>{const E=B.selection;return!!E&&E.startCol===E.endCol&&E.startRow===E.endRow}),ee=t.computed(()=>{const E=B.selection;return E?c.canSortColumns(E.startCol,E.endCol):!1}),ve=t.computed(()=>{const E=C.selNumberFormat;if(E!==Mt&&E!==Ot)return E;const s=B.activeCell,u=a.resolveStyle(B.cells[B.cellKey(s.col,s.row)]);return typeof(u==null?void 0:u.numberFormat)=="string"?u.numberFormat:""});function Be(E){r.nfDialogOpen.value=E}const ge=t.ref(!1);function se(){ge.value=!0}function xe(E){ge.value=E}function Ue(E){b.insertFunctionIntoCell(E)}function we(E){r.fontSizeMenuOpen.value=E}function me(E){r.textColorMenuOpen.value=E}function ye(E){r.fillColorMenuOpen.value=E}function Le(E){b.renTabVal.value=E}function $e(){b.ctxMenu.value=null}const G=E=>{c.formulaBarRef.value=E};function pe(){b.formulaBarExpanded.value=!b.formulaBarExpanded.value}const m=E=>{c.wrapperRef.value=E},D=E=>{c.canvasRef.value=E},I=E=>{c.editInputRef.value=E},K=E=>{b.dimInputRef.value=E};return(E,s)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(k.outerStyle)},[t.createVNode(Qr,{locale:B.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":y.borderMenuOpen,"cached-border":y.cachedBorder,"sort-menu-open":t.unref(te),"cached-sort-order":t.unref(U),"can-sort":ee.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":y.mergeMenuOpen,"calc-menu-open":y.calcMenuOpen,"is-single-cell":P.value,"sel-number-format":C.selNumberFormatDisplay,"nf-options":C.nfOptions,"can-increase-decimals":C.canIncreaseDecimals,"can-decrease-decimals":C.canDecreaseDecimals,"theme-vars":k.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=>we(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=>me(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=>y.onBorderChange(u)),onApplyBorder:y.applyCachedBorder,"onUpdate:sortMenuOpen":s[16]||(s[16]=u=>k.onSortMenuToggle(u)),onSortChange:s[17]||(s[17]=u=>k.onSortChange(u)),onApplySort:k.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=>y.onMergeMenuToggle(u)),onMergeChange:s[21]||(s[21]=u=>y.onMergeChange(u)),onApplyMerge:y.onApplyMerge,"onUpdate:calcMenuOpen":s[22]||(s[22]=u=>y.onCalcMenuToggle(u)),onCalcSum:y.onCalcSum,onCalcAvg:y.onCalcAvg,onCalcCount:y.onCalcCount,onFind:s[23]||(s[23]=u=>t.unref(R).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(Ra,{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:B.locale,"theme-vars":k.toolbarThemeVars,"onUpdate:findText":s[24]||(s[24]=u=>t.unref(R).findText.value=u),"onUpdate:replaceText":s[25]||(s[25]=u=>t.unref(R).replaceText.value=u),"onUpdate:scope":s[26]||(s[26]=u=>t.unref(R).scope.value=u),"onUpdate:matchCase":s[27]||(s[27]=u=>t.unref(R).matchCase.value=u),"onUpdate:matchEntireCell":s[28]||(s[28]=u=>t.unref(R).matchEntireCell.value=u),onPrev:s[29]||(s[29]=u=>t.unref(R).findPrev()),onNext:s[30]||(s[30]=u=>t.unref(R).findNext()),onReplace:s[31]||(s[31]=u=>t.unref(R).replace()),onReplaceAll:s[32]||(s[32]=u=>t.unref(R).replaceAll()),onClose:s[33]||(s[33]=u=>t.unref(R).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(Ja,{"model-open":C.nfDialogOpen,locale:B.locale,"current-format":ve.value,"is-custom":C.selNumberFormat===t.unref(Ot),"onUpdate:modelOpen":s[34]||(s[34]=u=>Be(u)),onApply:s[35]||(s[35]=u=>C.applyNumberFormatCode(u))},null,8,["model-open","locale","current-format","is-custom"]),t.createVNode(ii,{"model-open":k.sortConfirmOpen,locale:B.locale,"onUpdate:modelOpen":s[36]||(s[36]=u=>k.sortConfirmOpen=u),onConfirm:s[37]||(s[37]=u=>k.confirmSort(u)),onCancel:s[38]||(s[38]=u=>k.cancelSortConfirmation())},null,8,["model-open","locale"]),t.createVNode(Ni,{"model-open":ge.value,locale:B.locale,"onUpdate:modelOpen":s[39]||(s[39]=u=>xe(u)),onInsert:s[40]||(s[40]=u=>Ue(u))},null,8,["model-open","locale"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":h.formulaBarExpanded}])},[t.createElementVNode("div",qi,t.toDisplayString(h.activeCellLabel),1),t.createElementVNode("div",Ji,[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)=>h.cancelFormulaBarEdit&&h.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)=>h.acceptFormulaBarEdit&&h.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)(B.locale,"insertFunctionTitle"),"aria-label":t.unref(T)(B.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,Qi)]),t.createElementVNode("textarea",{ref:G,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":h.formulaBarExpanded}]),rows:h.formulaBarExpanded?3:1,value:h.formulaBarDisplay,spellcheck:"false",onFocus:s[46]||(s[46]=(...u)=>h.onFormulaBarFocus&&h.onFormulaBarFocus(...u)),onInput:s[47]||(s[47]=(...u)=>h.onFormulaBarInput&&h.onFormulaBarInput(...u)),onKeydown:s[48]||(s[48]=(...u)=>h.onFormulaBarKeydown&&h.onFormulaBarKeydown(...u)),onBlur:s[49]||(s[49]=(...u)=>h.onFormulaBarBlur&&h.onFormulaBarBlur(...u))},null,42,ec),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:h.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:s[50]||(s[50]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(pe,["stop"])},[h.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",nc,[...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",lc,[...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,tc)],2),t.createElementVNode("div",{ref:m,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:D,class:"grid-canvas",tabindex:"0",onMousedown:s[51]||(s[51]=(...u)=>h.onMouseDown&&h.onMouseDown(...u)),onMousemove:s[52]||(s[52]=(...u)=>h.onMouseMove&&h.onMouseMove(...u)),onMouseup:s[53]||(s[53]=(...u)=>h.onMouseUp&&h.onMouseUp(...u)),onMouseleave:s[54]||(s[54]=(...u)=>h.onMouseLeave&&h.onMouseLeave(...u)),onDblclick:s[55]||(s[55]=(...u)=>h.onDblClick&&h.onDblClick(...u)),onWheel:s[56]||(s[56]=t.withModifiers((...u)=>h.onWheel&&h.onWheel(...u),["prevent"])),onFocus:s[57]||(s[57]=(...u)=>k.onCanvasFocus&&k.onCanvasFocus(...u)),onKeydown:s[58]||(s[58]=(...u)=>h.onKeydown&&h.onKeydown(...u)),onContextmenu:s[59]||(s[59]=(...u)=>h.onCanvasCtx&&h.onCanvasCtx(...u)),onTouchstart:s[60]||(s[60]=t.withModifiers((...u)=>h.onTouchStart&&h.onTouchStart(...u),["prevent"])),onTouchmove:s[61]||(s[61]=t.withModifiers((...u)=>h.onTouchMove&&h.onTouchMove(...u),["prevent"])),onTouchend:s[62]||(s[62]=(...u)=>h.onTouchEnd&&h.onTouchEnd(...u))},null,32),t.createElementVNode("textarea",{ref:I,class:"cell-editor",value:B.editValue,style:t.normalizeStyle(h.editInputStyle),onInput:s[63]||(s[63]=(...u)=>h.onEditInput&&h.onEditInput(...u)),onKeydown:s[64]||(s[64]=(...u)=>h.onEditKd&&h.onEditKd(...u)),onCompositionstart:s[65]||(s[65]=(...u)=>h.onEditCompositionStart&&h.onEditCompositionStart(...u)),onCompositionend:s[66]||(s[66]=(...u)=>h.onEditCompositionEnd&&h.onEditCompositionEnd(...u)),onBlur:s[67]||(s[67]=(...u)=>h.onEditBlur&&h.onEditBlur(...u)),onPaste:s[68]||(s[68]=(...u)=>h.onEditPaste&&h.onEditPaste(...u))},null,44,oc),k.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=>{k.clampScroll(null,B.scrollY-50),h.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)=>h.onVTrk&&h.onVTrk(...u))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:h.vThumbT+"px",height:h.vThumbH+"px"}),onMousedown:s[70]||(s[70]=(...u)=>h.onVStart&&h.onVStart(...u))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:s[72]||(s[72]=t.withModifiers(u=>{k.clampScroll(null,B.scrollY+50),h.scheduleRender()},["prevent"]))},[...s[99]||(s[99]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),k.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left: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=>{k.clampScroll(B.scrollX-50,null),h.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)=>h.onHTrk&&h.onHTrk(...u))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:h.hThumbL+"px",width:h.hThumbW+"px"}),onMousedown:s[74]||(s[74]=(...u)=>h.onHStart&&h.onHStart(...u))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:s[76]||(s[76]=t.withModifiers(u=>{k.clampScroll(B.scrollX+50,null),h.scheduleRender()},["prevent"]))},[...s[101]||(s[101]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),k.maxScrollX>0&&k.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",rc)):t.createCommentVNode("",!0)]),t.createVNode(fa,{locale:B.locale,sheets:t.unref(j),"active-sheet-index":t.unref(Z),"ren-tab":h.renTab,"ren-tab-val":h.renTabVal,onTabClick:s[77]||(s[77]=u=>h.onTabClick(u)),onTabDblclick:s[78]||(s[78]=u=>h.onTabDblClick(u)),onTabContextmenu:s[79]||(s[79]=u=>h.onTabCtxMenu(u.ev,u.i)),onTabRenameInput:s[80]||(s[80]=u=>Le(u)),onTabRenameKeydown:s[81]||(s[81]=u=>h.onTabRenameKd(u)),onTabRenameCommit:h.commitTabRename,onTabbarContextmenu:s[82]||(s[82]=u=>h.onTabBarCtx(u)),onDeleteSheet:s[83]||(s[83]=u=>{k.removeSheet(u),h.scheduleRender()}),onAddSheet:s[84]||(s[84]=u=>{k.addSheet(),h.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(()=>[h.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:h.ctxMenu.x+"px",top:h.ctxMenu.y+"px"}),onClick:s[85]||(s[85]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.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=>h.onCtxItemEnter(ke,u)},[t.createElementVNode("span",ic,t.toDisplayString(u.label),1),u.children?(t.openBlock(),t.createElementBlock("svg",cc,[...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":h.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(p=>!ke.disabled&&ke.action&&(ke.action(),$e()),["stop"])},t.toDisplayString(ke.label),11,sc))),128))],2)):t.createCommentVNode("",!0)],42,ac))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[h.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:h.dimPanel.x+"px",top:h.dimPanel.y+"px"}),onMousedown:s[91]||(s[91]=t.withModifiers(()=>{},["stop"])),onClick:s[92]||(s[92]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",dc,t.toDisplayString(h.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",uc,[t.createElementVNode("input",{ref:K,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":h.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:h.dimPanel.value,onInput:s[86]||(s[86]=(...u)=>h.onDimInput&&h.onDimInput(...u)),onKeydown:s[87]||(s[87]=(...u)=>h.onDimKeydown&&h.onDimKeydown(...u)),onBlur:s[88]||(s[88]=(...u)=>h.onDimBlur&&h.onDimBlur(...u))},null,42,fc)]),h.dimPanel.error?(t.openBlock(),t.createElementBlock("div",mc,t.toDisplayString(h.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",pc,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:s[89]||(s[89]=(...u)=>h.applyDimPanel&&h.applyDimPanel(...u))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:s[90]||(s[90]=(...u)=>h.closeDimPanel&&h.closeDimPanel(...u))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-86e52c54"]]);Wt.Spreader=bn,Wt.default=bn,Object.defineProperties(Wt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|