xiaodao-spreader 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- (function(Dt,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(Dt=typeof globalThis<"u"?globalThis:Dt||self,t(Dt.XiaoDaoSpreader={},Dt.Vue))})(this,function(Dt,t){"use strict";const io={"zh-CN":{insert:"插入",delete:"删除",rename:"重命名",moveLeft:"左移",moveRight:"右移",cut:"剪切",copy:"复制",paste:"粘贴",addSheet:"新建工作表",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:"混合",nfDialogTitle:"设置单元格格式",nfCategory:"分类",nfCatGeneral:"常规",nfCatNumber:"数值",nfCatCurrency:"货币",nfCatAccounting:"会计专用",nfCatFinancial:"财务",nfCatPercent:"百分比",nfCatScientific:"科学计数",nfCatDate:"日期",nfCatTime:"时间",nfCatText:"文本",nfCatCurrencyRounded:"货币取整",nfCatDateTime:"日期和时间",nfCatDuration:"持续时间",nfCatCustom:"自定义",nfDecimals:"小数位数",nfThousands:"使用千位分隔符",nfSymbol:"货币符号",nfDateFormat:"日期格式",nfTimeFormat:"时间格式",nfCustomCode:"自定义格式代码",nfPreview:"预览",nfPreviewSample:"示例"},"en-US":{insert:"Insert",delete:"Delete",rename:"Rename",moveLeft:"Move Left",moveRight:"Move Right",cut:"Cut",copy:"Copy",paste:"Paste",addSheet:"Add new sheet",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",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"}};function V(e,r){var o;return((o=io[e])==null?void 0:o[r])??r}const Pt='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',wt=10,co=[{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'}],so=[{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}],uo='<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>',fo='<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>',mo='<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>',po='<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>',go='<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>',ho='<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>',Co=[{value:"left",labelKey:"alignLeft",icon:uo},{value:"center",labelKey:"alignCenter",icon:fo},{value:"right",labelKey:"alignRight",icon:mo}],yo=[{value:"top",labelKey:"alignTop",icon:po},{value:"middle",labelKey:"alignMiddle",icon:go},{value:"bottom",labelKey:"alignBottom",icon:ho}],Dl=[{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>'}],bo={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"},vo={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"},Nl="__nf_custom__",nl="",rl="",Ht="@",gl="__NF_INVALID__",Al=2958465,Hl=0;function Yt(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function Fl(e){return e==="zh-CN"?"¥":"$"}function wo(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Vl(e){return e.replace(/"([^"]*)"/g,"$1")}function ko(e){let r=e,o;const l=r.match(/^\[([^\]]+)\]/);l&&(o=l[1].toLowerCase(),r=r.slice(l[0].length)),r=wo(r);const c=/E[+-]/i.test(r),s=r.includes("%"),n=r.search(/[0#?]/);if(n===-1)return{hasDigits:!1,decimals:0,minDecimals:0,minIntDigits:0,thousands:!1,scale:s?100:1,scientific:!1,prefix:r,suffix:"",color:o};let v=-1;for(let ee=r.length-1;ee>=0;ee--){const J=r[ee];if(J==="0"||J==="#"||J==="?"||J==="E"){v=ee;break}}v<0&&(v=n);const d=n>0?r.slice(0,n):"",S=v<r.length-1?r.slice(v+1):"",K=r.slice(n,v+1),k=/[0#?]/.test(K),A=K.includes(",");let x=K.replace(/,/g,"");if(c){const ee=x.search(/E/i);ee>=0&&(x=x.slice(0,ee))}const ne=x.indexOf("."),y=ne>=0?x.slice(0,ne):x,q=ne>=0?x.slice(ne+1):"",O=(q.match(/[0#?]/g)||[]).length,Z=(q.match(/0/g)||[]).length,ie=(y.match(/0/g)||[]).length;return{hasDigits:k,decimals:O,minDecimals:Z,minIntDigits:ie,thousands:A,scale:s?100:1,scientific:c,prefix:d,suffix:S,color:o}}function Eo(e){const r=[];let o=!1;const l=/\[h\]|\[mm\]|\[ss\]|yyyy|yy|y|mmmm|mmm|mm|m|dddd|ddd|dd|d|hh|h|ss|s|AM\/PM|am\/pm|"[^"]*"|\/|-|:|\s+|[^\s]/g;let c;for(;(c=l.exec(e))!==null;){const s=c[0];switch(s){case"[h]":o=!0,r.push({type:"hour",len:0});break;case"[mm]":o=!0,r.push({type:"minute",len:2});break;case"[ss]":o=!0,r.push({type:"second",len:2});break;case"yyyy":r.push({type:"year",len:4});break;case"yy":case"y":r.push({type:"year",len:2});break;case"mmmm":r.push({type:"monthName",len:4});break;case"mmm":r.push({type:"monthName",len:3});break;case"mm":r.push({type:"month",len:2});break;case"m":r.push({type:"month",len:1});break;case"dddd":r.push({type:"weekday",len:4});break;case"ddd":r.push({type:"weekday",len:3});break;case"dd":r.push({type:"day",len:2});break;case"d":r.push({type:"day",len:1});break;case"hh":r.push({type:"hour",len:2});break;case"h":r.push({type:"hour",len:1});break;case"ss":r.push({type:"second",len:2});break;case"s":r.push({type:"second",len:1});break;case"AM/PM":case"am/pm":r.push({type:"ampm",len:2});break;default:s.startsWith('"')?r.push({type:"literal",text:Vl(s),len:0}):r.push({type:"literal",text:s,len:0})}}return{tokens:r,isDuration:o}}const Ol=new Map;function Ro(e){if(/[ydhs]/.test(e)||/AM\/PM/i.test(e)||/\[h\]/i.test(e)){const c=e.split(";")[0]??e,{tokens:s,isDuration:n}=Eo(c);return{kind:n?"duration":"date",sections:[],tokens:s,isDuration:n,raw:e}}return{kind:"number",sections:e.split(";").map(c=>ko(c)),tokens:[],isDuration:!1,raw:e}}function al(e){const r=Ol.get(e);if(r)return r;const o=Ro(e);return Ol.set(e,o),o}function Ll(e,r,o,l,c){const s=Math.pow(10,r),n=Math.round((e+Number.EPSILON)*s)/s,v=n<0,d=Math.abs(n);let K=new Intl.NumberFormat("en-US",{useGrouping:l,minimumIntegerDigits:c,minimumFractionDigits:r,maximumFractionDigits:r}).format(d);if(o<r&&r>0){const A=K.indexOf(".");if(A>=0){const E=K.substring(0,A);let x=K.substring(A+1);x=x.replace(/0+$/,""),x.length<o&&(x=x+"0".repeat(o-x.length)),K=x?`${E}.${x}`:E}}return`${v?"-":""}${K}`}function Il(e,r){if(e===0)return(r>0?"0."+"0".repeat(r):"0")+"E+00";const o=Math.floor(Math.log10(Math.abs(e))),l=e/Math.pow(10,o),c=Ll(l,r,r,!1,1),s=(o>=0?"+":"-")+String(Math.abs(o)).padStart(2,"0");return`${c}E${s}`}function Bo(e,r,o){if(!o.hasDigits)return Vl(o.prefix+o.suffix);const l=o.scale===100?e*100:e,c=o.scientific?Il(l,o.decimals):Ll(l,o.decimals,o.minDecimals,o.thousands,o.minIntDigits);return r+o.prefix+c+o.suffix}function Mo(e,r){const o=r.sections;if(o.length===0)return String(e);let l,c,s="";return e>0?(l=o[0],c=e):e<0?o[1]?(l=o[1],c=-e):(l=o[0],c=-e,s="-"):(l=o[2]??o[0],c=0),Bo(c,s,l)}function xo(e){return new Date((e-25569)*864e5)}const So=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],To=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],$l=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],Do=["January","February","March","April","May","June","July","August","September","October","November","December"],No=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Wl=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function zt(e,r){return String(e).padStart(r,"0")}function Ao(e,r,o,l){const c=e.getUTCFullYear(),s=e.getUTCMonth()+1,n=e.getUTCDate(),v=e.getUTCDay(),d=o==="zh-CN";let S="",K=!1;for(const k of r)switch(k.type){case"literal":S+=k.text??"";break;case"year":S+=k.len>=4?String(c):String(c%100).padStart(2,"0");break;case"month":S+=zt(K?e.getUTCMinutes():s,k.len);break;case"monthName":S+=k.len>=4?d?So[s-1]:Do[s-1]:d?To[s-1]:No[s-1];break;case"day":S+=zt(n,k.len);break;case"weekday":S+=k.len>=4?d?$l[v]:Wl[v]:d?$l[v].slice(2):Wl[v].slice(0,3);break;case"hour":{let A=e.getUTCHours();if(k.len===0){const E=Math.floor(l*86400);A=Math.floor(E/3600)}S+=String(A),K=!0;break}case"minute":S+=zt(e.getUTCMinutes(),k.len);break;case"second":S+=zt(e.getUTCSeconds(),k.len);break;case"ampm":{const A=e.getUTCHours();S+=A<12?d?"上午":"AM":d?"下午":"PM";break}}return S}function Ho(e,r){const o=Math.floor(e*86400),l=Math.floor(o/3600),c=Math.floor(o%3600/60),s=o%60;let n="";for(const v of r)switch(v.type){case"literal":n+=v.text??"";break;case"hour":n+=String(l);break;case"minute":n+=zt(c,v.len||2);break;case"second":n+=zt(s,v.len||2);break;default:n+=""}return n}function Fo(e){if(e==="")return e;const r=Number(e);if(!isNaN(r)&&e.trim()!==""){const o=Math.abs(r);return o!==0&&(o>=1e15||o<1e-9)?Il(r,9):e}return e}function hl(e,r,o){if(Yt(r))return Fo(e);if(r==null||r===Ht)return e;const l=al(r);if(l.kind==="date"||l.kind==="duration"){const s=Number(e);if(!isFinite(s))return e;if(l.kind==="date"){if(s<Hl||s>Al)return gl}else if(s<0)return gl;return l.kind==="duration"?Ho(s,l.tokens):Ao(xo(s),l.tokens,o,s)}const c=Number(e);return isNaN(c)?e:Mo(c,l)}const Vo=["general","number","currency","currencyRounded","accounting","financial","percent","scientific","date","time","dateTime","duration","text","custom"];function zl(e,r){if(r===Ht||r==="@")return!1;if(Yt(r)){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}const o=al(r);return!!(o.kind==="number"&&_l(o))}function _l(e){return e.sections.some(r=>r.hasDigits)}function Oo(e){if(e==null||Yt(e)||e===Ht||e==="@")return!1;const r=al(e);return!!(r.kind==="date"||r.kind==="duration"||r.kind==="number"&&_l(r))}function Lo(e,r){if(r==null||Yt(r)||r===Ht||r==="@")return!1;const o=al(r),l=Number(e);return Number.isFinite(l)?o.kind==="date"?l<Hl||l>Al:o.kind==="duration"?l<0:!1:!1}function Io(e,r,o,l){const c=Fl(e),s=l?"#,##0":"0",n=o>0?"."+"0".repeat(o):"",v=s+n;switch(r){case"general":return"";case"text":return Ht;case"custom":return"";case"number":return v;case"percent":return v+"%";case"scientific":return"0."+"0".repeat(o)+"E+00";case"currency":return c+v;case"currencyRounded":return c+(l?"#,##0":"0");case"accounting":return`${c}${v};(${c}${v});${c}"-"`;case"financial":return`${v};[Red](${v})`;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 $o(e){const r=Fl(e);return[{label:V(e,"nfGeneral"),value:rl},{label:V(e,"nfText"),value:Ht},{label:V(e,"nfNumber"),value:"#,##0.00"},{label:V(e,"nfPercent"),value:"0.00%"},{label:V(e,"nfScientific"),value:"0.00E+00"},{label:V(e,"nfAccounting"),value:`${r}#,##0.00;(${r}#,##0.00);${r}"-"`},{label:V(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:V(e,"nfCurrency"),value:r+"#,##0.00"},{label:V(e,"nfCurrencyRounded"),value:r+"#,##0"},{label:V(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:V(e,"nfTime"),value:"h:mm:ss"},{label:V(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:V(e,"nfDuration"),value:"[h]:mm:ss"},{label:V(e,"nfCustom"),value:Nl}]}const Wo=["title"],zo=["innerHTML"],_o={key:1,class:"sp-dropdown__value"},Go=["disabled"],Ko=["onClick"],Uo=["innerHTML"],Po={class:"sp-dropdown__item-label"},Yo=["disabled"],Xo=t.defineComponent({__name:"dropdown",props:{modelValue:{},options:{},width:{default:"auto"},menuWidth:{default:void 0},visibleCount:{default:8},title:{default:""},modelOpen:{type:Boolean,default:void 0},hideTrigger:{type:Boolean,default:!1},align:{default:"left"},triggerEl:{default:null},fallbackLabel:{default:""}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:r}){const o=e,l=r,c=t.ref(!1),s=t.ref(0),n=t.ref(null),v=t.ref(null),d=t.ref(null),S=t.ref({top:0,up:!1}),K=t.ref(0),k=t.ref(!1),A=t.computed(()=>o.options.find(se=>String(se.value)===String(o.modelValue))),E=t.computed(()=>o.menuWidth),x=t.computed(()=>Math.min(o.visibleCount,o.options.length)),ne=t.computed(()=>o.options.slice(s.value,s.value+x.value)),y=t.computed(()=>s.value>0),q=t.computed(()=>s.value+x.value<o.options.length),O=t.computed(()=>o.options.length>x.value);function Z(se){s.value=Math.max(0,Math.min(o.options.length-x.value,s.value+se))}function ie(){c.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0);const se=o.triggerEl??n.value;if(!se)return;const z=se.getBoundingClientRect(),u=x.value*22+(O.value?2*15:0)+8,Se=window.innerHeight-z.bottom-4<u&&z.top-4>u;o.align==="right"?S.value={right:window.innerWidth-z.right,top:Se?z.top-u-4:z.bottom+4,up:Se}:S.value={left:z.left,top:Se?z.top-u-4:z.bottom+4,up:Se};const He=o.options.findIndex(Fe=>String(Fe.value)===String(o.modelValue));s.value=He>=0?Math.max(0,Math.min(He-Math.floor(x.value/2),o.options.length-x.value)):0}function ee(){c.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function J(){c.value?ee():ie()}function te(se){l("update:modelValue",se.value),l("change",se.value),ee()}function pe(se){var u,h;if(!c.value)return;const z=se.target;(u=n.value)!=null&&u.contains(z)||(h=d.value)!=null&&h.contains(z)||ee()}function We(se){c.value&&(se.preventDefault(),Z(se.deltaY>0?1:-1))}t.watch(c,se=>{t.nextTick(()=>{var z,u;se?(z=v.value)==null||z.addEventListener("wheel",We,{passive:!1}):(u=v.value)==null||u.removeEventListener("wheel",We)})}),t.watch(()=>o.modelOpen,se=>{se!==void 0&&se!==c.value&&(se?ie():ee())});function ze(se){c.value&&(K.value=se.touches[0].clientY,k.value=!0)}function et(se){if(!c.value||!k.value)return;const z=se.touches[0].clientY-K.value;Math.abs(z)>5&&(Z(z<0?1:-1),K.value=se.touches[0].clientY)}function Ue(){k.value=!1}function qe(se){se.key==="Escape"&&ee()}return t.onMounted(()=>{document.addEventListener("pointerdown",pe),window.addEventListener("resize",ee),window.addEventListener("scroll",ee,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",pe),window.removeEventListener("resize",ee),window.removeEventListener("scroll",ee,!0)}),(se,z)=>{var u,h;return t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:n,class:"sp-dropdown",style:t.normalizeStyle(typeof e.width=="number"?{width:e.width+"px"}:{width:e.width})},[e.hideTrigger?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__trigger",{"sp-dropdown__trigger--open":c.value}]),title:e.title,onClick:J},[(u=A.value)!=null&&u.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:A.value.icon},null,8,zo)):(t.openBlock(),t.createElementBlock("span",_o,t.toDisplayString(((h=A.value)==null?void 0:h.label)??e.fallbackLabel),1)),z[2]||(z[2]=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,Wo)),(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:d,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":S.value.up}]),style:t.normalizeStyle({left:S.value.left!==void 0?S.value.left+"px":void 0,right:S.value.right!==void 0?S.value.right+"px":void 0,top:S.value.top+"px",minWidth:E.value!==void 0?typeof E.value=="number"?E.value+"px":E.value:void 0}),onKeydown:qe},[O.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!y.value}]),disabled:!y.value,onClick:z[0]||(z[0]=Se=>Z(-1))},[...z[3]||(z[3]=[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,Go)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:v,class:"sp-dropdown__list",onTouchstart:ze,onTouchmove:et,onTouchend:Ue},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ne.value,Se=>(t.openBlock(),t.createElementBlock("button",{key:String(Se.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(Se.value)===String(e.modelValue)}]),onClick:He=>te(Se)},[Se.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:Se.icon},null,8,Uo)):t.createCommentVNode("",!0),t.createElementVNode("span",Po,t.toDisplayString(Se.label),1)],10,Ko))),128))],544),O.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!q.value}]),disabled:!q.value,onClick:z[1]||(z[1]=Se=>Z(1))},[...z[4]||(z[4]=[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)}}}),kt=(e,r)=>{const o=e.__vccOpts||e;for(const[l,c]of r)o[l]=c;return o},Xt=kt(Xo,[["__scopeId","data-v-77df3baf"]]),jo=["title","onClick"],Gl=kt(t.defineComponent({__name:"colorPicker",props:{modelOpen:{type:Boolean,default:void 0},colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{expose:r,emit:o}){const l=e,c=o,s=[[{key:"colorAutomatic",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorSlate",value:"#595959"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorBlack",value:"#000000"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],n=[[{key:"colorNoFill",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorWhite",value:"#FFFFFF"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorSlate",value:"#595959"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],v=t.computed(()=>l.colorKey==="fill"?n:s);function d(O){return V(l.locale,O)}function S(O){const Z=l.currentColor;return!Z&&!O?!0:Z?Z.toLowerCase()===O.toLowerCase():!1}const K=t.ref(!1),k=t.ref(null),A=t.ref(null),E=t.ref({top:0});t.watch(()=>l.modelOpen,O=>{O!==void 0&&O!==K.value&&(O?ne():y())});function x(O){const Z=k.value,ie=A.value,ee=O.target;Z&&Z.contains(ee)||ie&&ie.contains(ee)||y()}function ne(){K.value=!0,l.modelOpen!==void 0&&c("update:modelOpen",!0),t.nextTick(()=>{const O=l.triggerEl??k.value;if(O){const Z=O.getBoundingClientRect(),ie=150,ee=120;let J=window.innerWidth-Z.right,te=Z.bottom+4,pe;Z.left-ee<4&&(J=void 0,pe=Math.max(4,Z.left)),te+ie>window.innerHeight-4&&(te=Z.top-ie-4),te<4&&(te=4),E.value=J!==void 0?{right:J,top:te}:{left:pe,top:te}}document.addEventListener("pointerdown",x)})}function y(){K.value=!1,l.modelOpen!==void 0&&c("update:modelOpen",!1),document.removeEventListener("pointerdown",x)}function q(O){c("update:modelValue",O),c("change",O),y()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",x)}),r({open:K,openMenu:ne,close:y}),(O,Z)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:k,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[K.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:A,class:"color-picker__menu",style:t.normalizeStyle({left:E.value.left!==void 0?E.value.left+"px":void 0,right:E.value.right!==void 0?E.value.right+"px":void 0,top:E.value.top+"px"}),onMousedown:Z[0]||(Z[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(v.value,(ie,ee)=>(t.openBlock(),t.createElementBlock("div",{key:ee,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ie,J=>(t.openBlock(),t.createElementBlock("button",{key:J.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":S(J.value)}]),title:d(J.key),style:t.normalizeStyle({background:J.value||"transparent",border:J.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:te=>q(J.value)},null,14,jo))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f8fac424"]]),Zo=["title","onClick"],qo={viewBox:"0 0 30 30",class:"border-picker__icon"},Jo=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Qo={class:"border-picker__label"},en=kt(t.defineComponent({__name:"borderPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:r,emit:o}){const l=e,c=o,s=[{key:"bottom",i18nKey:"borderBottom"},{key:"top",i18nKey:"borderTop"},{key:"left",i18nKey:"borderLeft"},{key:"right",i18nKey:"borderRight"},{key:"none",i18nKey:"borderNone"},{key:"all",i18nKey:"borderAll"},{key:"outer",i18nKey:"borderOuter"},{key:"thickOuter",i18nKey:"borderThickOuter"}],n=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],v={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"]},d={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function S(O,Z){return d[O].includes(Z)?"thick":v[O].includes(Z)?"solid":"dashed"}const K=t.ref(!1),k=t.ref(null),A=t.ref(null),E=t.ref({top:0});t.watch(()=>l.modelOpen,O=>{O!==void 0&&O!==K.value&&(O?ne():y())});function x(O){const Z=k.value,ie=A.value,ee=O.target;Z&&Z.contains(ee)||ie&&ie.contains(ee)||y()}function ne(){K.value=!0,l.modelOpen!==void 0&&c("update:modelOpen",!0),t.nextTick(()=>{const O=l.triggerEl??k.value;if(O){const Z=O.getBoundingClientRect(),ie=200,ee=160;let J=window.innerWidth-Z.right,te=Z.bottom+4,pe;Z.left-ee<4&&(J=void 0,pe=Math.max(4,Z.left)),te+ie>window.innerHeight-4&&(te=Z.top-ie-4),te<4&&(te=4),E.value=J!==void 0?{right:J,top:te}:{left:pe,top:te}}document.addEventListener("pointerdown",x)})}function y(){K.value=!1,l.modelOpen!==void 0&&c("update:modelOpen",!1),document.removeEventListener("pointerdown",x)}function q(O){c("change",O),y()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",x)}),r({open:K,openMenu:ne,close:y}),(O,Z)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:k,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[K.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:A,class:"border-picker__menu",style:t.normalizeStyle({left:E.value.left!==void 0?E.value.left+"px":void 0,right:E.value.right!==void 0?E.value.right+"px":void 0,top:E.value.top+"px"}),onMousedown:Z[0]||(Z[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(s,ie=>t.createElementVNode("button",{key:ie.key,class:"border-picker__item",title:t.unref(V)(e.locale,ie.i18nKey),onClick:ee=>q(ie.key)},[(t.openBlock(),t.createElementBlock("svg",qo,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(n,ee=>t.createElementVNode("line",{key:ee.name,x1:ee.x1,y1:ee.y1,x2:ee.x2,y2:ee.y2,stroke:"currentColor","stroke-width":S(ie.key,ee.name)==="thick"?3:1.5,"stroke-dasharray":S(ie.key,ee.name)==="dashed"?"0 4":"none","stroke-linecap":S(ie.key,ee.name)==="dashed"?"round":"square"},null,8,Jo)),64))])),t.createElementVNode("span",Qo,t.toDisplayString(t.unref(V)(e.locale,ie.i18nKey)),1)],8,Zo)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f362abdb"]]),tn=["title","onClick"],ln=["innerHTML"],on={class:"merge-picker__label"},nn=kt(t.defineComponent({__name:"mergePicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:r,emit:o}){const l=e,c=o,s=t.ref(!1),n=t.ref(null),v=t.ref(null),d=t.ref({top:0});t.watch(()=>l.modelOpen,E=>{E!==void 0&&E!==s.value&&(E?K():k())});function S(E){const x=n.value,ne=v.value,y=E.target;x&&x.contains(y)||ne&&ne.contains(y)||k()}function K(){s.value=!0,l.modelOpen!==void 0&&c("update:modelOpen",!0),t.nextTick(()=>{const E=l.triggerEl??n.value;if(E){const x=E.getBoundingClientRect(),ne=Dl.length*30+12,y=160;let q=window.innerWidth-x.right,O=x.bottom+4,Z;x.left-y<4&&(q=void 0,Z=Math.max(4,x.left)),O+ne>window.innerHeight-4&&(O=x.top-ne-4),O<4&&(O=4),d.value=q!==void 0?{right:q,top:O}:{left:Z,top:O}}document.addEventListener("pointerdown",S)})}function k(){s.value=!1,l.modelOpen!==void 0&&c("update:modelOpen",!1),document.removeEventListener("pointerdown",S)}function A(E){c("change",E),k()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",S)}),r({open:s,openMenu:K,close:k}),(E,x)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:n,class:"merge-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[s.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:v,class:"merge-picker__menu",style:t.normalizeStyle({left:d.value.left!==void 0?d.value.left+"px":void 0,right:d.value.right!==void 0?d.value.right+"px":void 0,top:d.value.top+"px"}),onMousedown:x[0]||(x[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Dl),ne=>(t.openBlock(),t.createElementBlock("button",{key:ne.key,class:"merge-picker__item",title:t.unref(V)(e.locale,ne.labelKey),onClick:y=>A(ne.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:ne.icon},null,8,ln),t.createElementVNode("span",on,t.toDisplayString(t.unref(V)(e.locale,ne.labelKey)),1)],8,tn))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-67c0f9e3"]]),rn=["disabled","title","onClick"],an={class:"calc-picker__label"},cn=kt(t.defineComponent({__name:"calcPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},disabled:{type:Boolean,default:!1}},emits:["update:modelOpen","change"],setup(e,{expose:r,emit:o}){const l=e,c=o,s=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],n=t.ref(!1),v=t.ref(null),d=t.ref(null),S=t.ref({top:0});t.watch(()=>l.modelOpen,x=>{x!==void 0&&x!==n.value&&(x?k():A())});function K(x){const ne=v.value,y=d.value,q=x.target;ne&&ne.contains(q)||y&&y.contains(q)||A()}function k(){n.value=!0,l.modelOpen!==void 0&&c("update:modelOpen",!0),t.nextTick(()=>{const x=l.triggerEl??v.value;if(x){const ne=x.getBoundingClientRect(),y=s.length*30+12,q=160;let O=window.innerWidth-ne.right,Z=ne.bottom+4,ie;ne.left-q<4&&(O=void 0,ie=Math.max(4,ne.left)),Z+y>window.innerHeight-4&&(Z=ne.top-y-4),Z<4&&(Z=4),S.value=O!==void 0?{right:O,top:Z}:{left:ie,top:Z}}document.addEventListener("pointerdown",K)})}function A(){n.value=!1,l.modelOpen!==void 0&&c("update:modelOpen",!1),document.removeEventListener("pointerdown",K)}function E(x){l.disabled||(c("change",x),A())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",K)}),r({open:n,openMenu:k,close:A}),(x,ne)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:v,class:"calc-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[n.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:d,class:"calc-picker__menu",style:t.normalizeStyle({left:S.value.left!==void 0?S.value.left+"px":void 0,right:S.value.right!==void 0?S.value.right+"px":void 0,top:S.value.top+"px"}),onMousedown:ne[0]||(ne[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(s,y=>t.createElementVNode("button",{key:y.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(V)(e.locale,y.labelKey),onClick:q=>E(y.key)},[t.createElementVNode("span",an,t.toDisplayString(t.unref(V)(e.locale,y.labelKey)),1)],10,rn)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-9029e58c"]]),sn={class:"tb-item","data-key":"undo"},dn=["title","disabled"],un={class:"tb-item","data-key":"redo"},fn=["title","disabled"],mn={class:"tb-item","data-key":"paint"},pn=["title","disabled"],gn={class:"tb-item","data-key":"clear"},hn=["title","disabled"],Cn={class:"tb-item","data-key":"font"},yn={class:"tb-item","data-key":"fontSize"},bn={class:"toolbar-font-size"},vn=["value","title"],wn=["title"],kn=["title","disabled"],En=["title","disabled"],Rn={class:"tb-item","data-key":"bold"},Bn=["title","disabled"],Mn={class:"tb-item","data-key":"italic"},xn=["title","disabled"],Sn={class:"tb-item","data-key":"underline"},Tn=["title","disabled"],Dn={class:"tb-item","data-key":"strike"},Nn=["title","disabled"],An={class:"tb-item","data-key":"textColor"},Hn={class:"toolbar-split"},Fn=["title","disabled"],Vn={viewBox:"0 0 1024 1024",fill:"currentColor"},On=["fill"],Ln=["title","disabled"],In={class:"tb-item","data-key":"fillColor"},$n={class:"toolbar-split"},Wn=["title","disabled"],zn={viewBox:"0 0 1024 1024",fill:"currentColor"},_n=["fill"],Gn=["title","disabled"],Kn={class:"tb-item","data-key":"border"},Un={class:"toolbar-split"},Pn=["title","disabled"],Yn={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},Xn=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],jn=["title","disabled"],Zn={class:"tb-item","data-key":"hAlign"},qn={class:"tb-item","data-key":"vAlign"},Jn={class:"tb-item","data-key":"wrap"},Qn=["title"],er={class:"tb-item","data-key":"merge"},tr={class:"toolbar-split"},lr=["title","disabled"],or=["title","disabled"],nr={class:"tb-item","data-key":"numFmt"},rr={class:"tb-item","data-key":"calc"},ar={class:"toolbar-split"},ir=["title","disabled"],cr=["title","disabled"],Cl=2,sr=6,dr=34,ur=kt(t.defineComponent({__name:"toolbar",props:{locale:{},canUndo:{type:Boolean},canRedo:{type:Boolean},paintFmtActive:{type:Boolean},hasSelection:{type:Boolean},fontFamilyOptions:{},fontSizeOptions:{},selFontFamily:{},selFontSize:{},fontSizeInput:{},fontSizeMenuOpen:{type:Boolean},selFontWeight:{type:Boolean},selFontStyle:{type:Boolean},selUnderline:{type:Boolean},selStrikethrough:{type:Boolean},selTextColor:{},textColorMenuOpen:{type:Boolean},selFillColor:{},fillColorMenuOpen:{type:Boolean},cachedTextColor:{},cachedFillColor:{},borderMenuOpen:{type:Boolean},cachedBorder:{},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},calcMenuOpen:{type:Boolean},isSingleCell:{type:Boolean},themeVars:{},selNumberFormat:{},nfOptions:{}},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","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:r}){const o=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],l={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},c={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function s(T,a){return c[T].includes(a)?"thick":l[T].includes(a)?"solid":"dashed"}const n=["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"],v=t.ref(null),d=t.ref(null),S=t.ref(null),K=t.ref(null),k=t.ref(null),A=t.ref(null),E=t.ref(null),x=t.ref(null),ne=t.ref(null),y=t.ref(new Set),q=t.ref(!1),O=t.ref(!1),Z=t.ref(0),ie=new Map,ee=t.computed(()=>y.value.size>0);function J(T){return y.value.has(T)}const te=t.computed(()=>{const T=d.value;return T instanceof HTMLElement?T:void 0});function pe(T){return te.value?!J(T):!0}function We(){for(const T of n){const a=ie.get(T);if(a===void 0||a===0)return!0}return!1}function ze(){if(!v.value)return;v.value.querySelectorAll(".tb-item").forEach(a=>{const p=a.dataset.key;if(!p)return;const _=a.offsetWidth;_>0?ie.set(p,_):ie.has(p)||ie.set(p,0)})}function et(T,a){if(T.size!==a.size)return!1;for(const p of T)if(!a.has(p))return!1;return!0}let Ue=0,qe=0;function se(){Ue&&cancelAnimationFrame(Ue),!(qe>60)&&(qe++,Ue=requestAnimationFrame(()=>requestAnimationFrame(z)))}function z(){if(!v.value)return;const T=v.value.clientWidth-sr*2;if(T<=0){se();return}qe=0,(ie.size===0||We())&&ze();let a=0;for(const _ of n)a+=(ie.get(_)??0)+Cl;const p=new Set;if(a>T){const _=T-dr-Cl;let w=0;for(let W=0;W<n.length;W++){const Y=n[W],Be=(ie.get(Y)??0)+Cl;if(w+Be>_){for(let De=W;De<n.length;De++)p.add(n[De]);break}w+=Be}}et(p,y.value)||(y.value=p,Z.value++,p.size===0&&(q.value=!1))}let u=null;const h=t.ref(0),Se=t.computed(()=>{const T=S.value,a={position:"fixed",top:"0px",right:"0px"};if(!T)return{...f.themeVars,...a};h.value;const p=T.getBoundingClientRect();return{...f.themeVars,position:"fixed",top:`${p.bottom+4}px`,right:`${window.innerWidth-p.right}px`}});function He(){q.value&&(h.value++,t.nextTick(()=>z()))}function Fe(T){var p,_;if(!q.value)return;const a=T.target;(p=d.value)!=null&&p.contains(a)||(_=S.value)!=null&&_.contains(a)||(O.value=!0,q.value=!1,t.nextTick(()=>{O.value=!1}))}function ut(){q.value=!q.value}t.onMounted(()=>{se(),v.value&&(u=new ResizeObserver(()=>{q.value||se()}),u.observe(v.value)),document.addEventListener("pointerdown",Fe,!0),window.addEventListener("resize",He),window.addEventListener("load",se),window.addEventListener("orientationchange",se)}),t.onBeforeUnmount(()=>{Ue&&cancelAnimationFrame(Ue),u==null||u.disconnect(),document.removeEventListener("pointerdown",Fe,!0),window.removeEventListener("resize",He),window.removeEventListener("load",se),window.removeEventListener("orientationchange",se)});const f=e,b=r,M=t.computed(()=>f.selNumberFormat===nl?V(f.locale,"nfMixed"):"");return(T,a)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:v,class:"toolbar"},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("undo"),to:te.value},[t.createElementVNode("div",sn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(V)(e.locale,"undo"),disabled:!e.canUndo,onClick:a[0]||(a[0]=p=>b("undo"))},[...a[44]||(a[44]=[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,dn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("redo"),to:te.value},[t.createElementVNode("div",un,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(V)(e.locale,"redo"),disabled:!e.canRedo,onClick:a[1]||(a[1]=p=>b("redo"))},[...a[45]||(a[45]=[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,fn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("paint"),to:te.value},[t.createElementVNode("div",mn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(V)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:a[2]||(a[2]=p=>b("paint-format"))},[...a[46]||(a[46]=[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,pn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("clear"),to:te.value},[t.createElementVNode("div",gn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(V)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:a[3]||(a[3]=p=>b("clear-format"))},[...a[47]||(a[47]=[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,hn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep1"),to:te.value},[a[48]||(a[48]=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:te.value},[t.createElementVNode("div",Cn,[t.createVNode(Xt,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:J("font")?"100%":110,"menu-width":J("font")?120:void 0,"visible-count":8,title:t.unref(V)(e.locale,"fontFamily"),align:"right",onChange:a[4]||(a[4]=p=>b("font-family-change",p))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("fontSize"),to:te.value},[t.createElementVNode("div",yn,[t.createElementVNode("div",bn,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(V)(e.locale,"fontSize"),onInput:a[5]||(a[5]=p=>b("font-size-input",p.target.value)),onBlur:a[6]||(a[6]=p=>b("font-size-blur")),onKeydown:a[7]||(a[7]=p=>b("font-size-keydown",p))},null,40,vn),t.createVNode(Xt,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:J("fontSize")?"100%":56,"menu-width":J("fontSize")?120:56,"visible-count":9,title:t.unref(V)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":ne.value,"onUpdate:modelOpen":a[8]||(a[8]=p=>b("update:font-size-menu-open",p)),onChange:a[9]||(a[9]=p=>b("font-size-change",p))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:ne,class:"toolbar-font-size__btn",type:"button",title:t.unref(V)(e.locale,"fontSize"),onMousedown:a[10]||(a[10]=t.withModifiers(()=>{},["prevent"])),onClick:a[11]||(a[11]=p=>b("font-size-toggle"))},[...a[49]||(a[49]=[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,wn),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(V)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:a[12]||(a[12]=t.withModifiers(()=>{},["prevent"])),onClick:a[13]||(a[13]=p=>b("font-size-step-down"))},[...a[50]||(a[50]=[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,kn),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(V)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:a[14]||(a[14]=t.withModifiers(()=>{},["prevent"])),onClick:a[15]||(a[15]=p=>b("font-size-step-up"))},[...a[51]||(a[51]=[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,En)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep2"),to:te.value},[a[52]||(a[52]=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:te.value},[t.createElementVNode("div",Rn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(V)(e.locale,"bold"),disabled:!e.hasSelection,onClick:a[16]||(a[16]=p=>b("bold-toggle"))},[...a[53]||(a[53]=[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,Bn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("italic"),to:te.value},[t.createElementVNode("div",Mn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(V)(e.locale,"italic"),disabled:!e.hasSelection,onClick:a[17]||(a[17]=p=>b("italic-toggle"))},[...a[54]||(a[54]=[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,xn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("underline"),to:te.value},[t.createElementVNode("div",Sn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(V)(e.locale,"underline"),disabled:!e.hasSelection,onClick:a[18]||(a[18]=p=>b("underline-toggle"))},[...a[55]||(a[55]=[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,Tn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("strike"),to:te.value},[t.createElementVNode("div",Dn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(V)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:a[19]||(a[19]=p=>b("strikethrough-toggle"))},[...a[56]||(a[56]=[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,Nn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep3"),to:te.value},[a[57]||(a[57]=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:te.value},[t.createElementVNode("div",An,[t.createElementVNode("div",Hn,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(V)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:a[20]||(a[20]=p=>b("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",Vn,[a[58]||(a[58]=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,On)]))],8,Fn),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:K,class:"toolbar-btn toolbar-split__arrow",title:t.unref(V)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:a[21]||(a[21]=p=>b("update:text-color-menu-open",!e.textColorMenuOpen))},[...a[59]||(a[59]=[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,Ln),t.createVNode(Gl,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":K.value,"onUpdate:modelOpen":a[22]||(a[22]=p=>b("update:text-color-menu-open",p)),onChange:a[23]||(a[23]=p=>b("text-color-change",p))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("fillColor"),to:te.value},[t.createElementVNode("div",In,[t.createElementVNode("div",$n,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(V)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:a[24]||(a[24]=p=>b("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",zn,[a[60]||(a[60]=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,_n)]))],8,Wn),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:k,class:"toolbar-btn toolbar-split__arrow",title:t.unref(V)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:a[25]||(a[25]=p=>b("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...a[61]||(a[61]=[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,Gn),t.createVNode(Gl,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":k.value,"onUpdate:modelOpen":a[26]||(a[26]=p=>b("update:fill-color-menu-open",p)),onChange:a[27]||(a[27]=p=>b("fill-color-change",p))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("border"),to:te.value},[t.createElementVNode("div",Kn,[t.createElementVNode("div",Un,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(V)(e.locale,"borders"),disabled:!e.hasSelection,onClick:a[28]||(a[28]=p=>b("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",Yn,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(o,p=>t.createElementVNode("line",{key:p.name,x1:p.x1,y1:p.y1,x2:p.x2,y2:p.y2,"stroke-width":s(e.cachedBorder,p.name)==="thick"?3:1.5,"stroke-dasharray":s(e.cachedBorder,p.name)==="dashed"?"0 4":"none","stroke-linecap":s(e.cachedBorder,p.name)==="dashed"?"round":"square"},null,8,Xn)),64))]))],8,Pn),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:A,class:"toolbar-btn toolbar-split__arrow",title:t.unref(V)(e.locale,"borders"),disabled:!e.hasSelection,onClick:a[29]||(a[29]=p=>b("update:border-menu-open",!e.borderMenuOpen))},[...a[62]||(a[62]=[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,jn),t.createVNode(en,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":A.value,"onUpdate:modelOpen":a[30]||(a[30]=p=>b("update:border-menu-open",p)),onChange:a[31]||(a[31]=p=>b("border-change",p))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep4"),to:te.value},[a[63]||(a[63]=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:te.value},[t.createElementVNode("div",Zn,[t.createVNode(Xt,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:J("hAlign")?"100%":44,"menu-width":J("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(V)(e.locale,"hAlign"),onChange:a[32]||(a[32]=p=>b("h-align-change",p))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("vAlign"),to:te.value},[t.createElementVNode("div",qn,[t.createVNode(Xt,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:J("vAlign")?"100%":44,"menu-width":J("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(V)(e.locale,"vAlign"),onChange:a[33]||(a[33]=p=>b("v-align-change",p))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",Jn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(V)(e.locale,"wrap"),onClick:a[34]||(a[34]=p=>b("wrap-toggle"))},[...a[64]||(a[64]=[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,Qn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("merge"),to:te.value},[t.createElementVNode("div",er,[t.createElementVNode("div",tr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(V)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:a[35]||(a[35]=p=>b("apply-merge"))},[...a[65]||(a[65]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M709.952 465.92l88-76.032C801.92 385.984 806.656 384 812.032 384s10.048 1.984 14.08 5.952C830.08 393.92 832 398.656 832 403.968L832 448l32 0C881.664 448 896 462.336 896 480S881.664 512 864 512L832 512l0 44.032c0 5.376-1.92 10.112-5.952 14.08C822.08 574.08 817.344 576 812.032 576s-10.048-1.92-14.08-5.952L709.952 494.08C705.984 490.112 704 485.376 704 480S705.984 469.952 709.952 465.92zM378.048 465.92 290.048 389.952C286.08 385.984 281.344 384 275.968 384s-10.048 1.984-14.08 5.952C257.92 393.92 256 398.656 256 403.968L256 448 224 448C206.336 448 192 462.336 192 480S206.336 512 224 512L256 512l0 44.032c0 5.376 1.92 10.112 5.952 14.08C265.92 574.08 270.656 576 275.968 576s10.048-1.92 14.08-5.952L378.048 494.08C382.016 490.112 384 485.376 384 480S382.016 469.952 378.048 465.92zM448 128 128 128l0 704 320 0 0-128 64 0 0 128c0 35.392-28.608 64-64 64L128 896c-35.392 0-64-28.608-64-64L64 128c0-35.392 28.608-64 64-64l320 0 0 0c35.392 0 64 28.608 64 64l0 128L448 256 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128M722.304 642.304c0 8.512-3.52 16.32-10.496 23.36s-15.424 10.624-25.344 10.624c-5.76 0-10.688-1.088-14.72-3.136-4.096-2.048-7.616-4.928-10.432-8.512s-5.824-9.088-9.024-16.512-5.952-13.952-8.32-19.648l-17.28-46.016L479.36 582.464 462.08 629.568c-6.72 18.304-12.48 30.656-17.344 37.12s-12.544 9.6-23.424 9.6c-9.28 0-17.408-3.456-24.512-10.24s-10.624-14.592-10.624-23.232c0-4.992 0.896-10.176 2.496-15.488S393.024 614.592 396.8 605.056l92.672-238.016C492.096 360.256 495.296 352 499.008 342.464s7.68-17.536 11.904-23.872 9.664-11.456 16.576-15.36c6.784-3.968 15.232-5.888 25.344-5.888 10.176 0 18.752 1.92 25.472 5.888 6.848 3.968 12.352 8.96 16.64 15.104 4.096 6.208 7.744 12.8 10.624 19.904s6.528 16.576 11.008 28.352l94.656 236.48C718.592 621.056 722.304 634.112 722.304 642.304zM606.912 526.784 552.32 375.552 498.624 526.784 606.912 526.784z"})],-1)])],8,lr),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:E,class:"toolbar-btn toolbar-split__arrow",title:t.unref(V)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:a[36]||(a[36]=p=>b("update:merge-menu-open",!e.mergeMenuOpen))},[...a[66]||(a[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,or),t.createVNode(nn,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":E.value,"onUpdate:modelOpen":a[37]||(a[37]=p=>b("update:merge-menu-open",p)),onChange:a[38]||(a[38]=p=>b("merge-change",p))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep6"),to:te.value},[a[67]||(a[67]=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:te.value},[t.createElementVNode("div",nr,[t.createVNode(Xt,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:J("numFmt")?"100%":92,"menu-width":(J("numFmt"),150),"visible-count":8,title:t.unref(V)(e.locale,"numberFormat"),"fallback-label":M.value,align:"right",onChange:a[39]||(a[39]=p=>b("number-format-change",String(p)))},null,8,["model-value","options","width","menu-width","title","fallback-label"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep7"),to:te.value},[a[68]||(a[68]=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:te.value},[t.createElementVNode("div",rr,[t.createElementVNode("div",ar,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(V)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:a[40]||(a[40]=p=>b("calc-sum"))},[...a[69]||(a[69]=[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,ir),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:x,class:"toolbar-btn toolbar-split__arrow",title:t.unref(V)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:a[41]||(a[41]=p=>b("update:calc-menu-open",!e.calcMenuOpen))},[...a[70]||(a[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(cn,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":x.value,disabled:e.isSingleCell,"onUpdate:modelOpen":a[42]||(a[42]=p=>b("update:calc-menu-open",p)),onChange:a[43]||(a[43]=p=>b(`calc-${p}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),ee.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:S,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":q.value}]),type:"button",onClick:ut},[...a[71]||(a[71]=[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)],512),(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:d,key:Z.value,class:t.normalizeClass(["overflow-menu",{"no-anim":O.value}]),style:t.normalizeStyle(Se.value)},null,6)),[[t.vShow,q.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-7328a54c"]]),fr={class:"tab-list"},mr=["onClick","onDblclick","onContextmenu"],pr=["value"],gr={key:1,class:"tab-item__name"},hr=["title"],Cr=kt(t.defineComponent({__name:"tabbar",props:{locale:{},sheets:{},activeSheetIndex:{},renTab:{},renTabVal:{}},emits:["tab-click","tab-dblclick","tab-contextmenu","tab-rename-input","tab-rename-keydown","tab-rename-commit","add-sheet","tabbar-contextmenu"],setup(e,{emit:r}){const o=r;return(l,c)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:c[5]||(c[5]=s=>o("tabbar-contextmenu",s))},[t.createElementVNode("div",fr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(s,n)=>(t.openBlock(),t.createElementBlock("div",{key:s.id,class:t.normalizeClass(["tab-item",{"tab-item--active":n===e.activeSheetIndex}]),onClick:v=>o("tab-click",n),onDblclick:t.withModifiers(v=>o("tab-dblclick",n),["prevent"]),onContextmenu:v=>o("tab-contextmenu",{ev:v,i:n})},[e.renTab===n?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:c[0]||(c[0]=v=>o("tab-rename-input",v.target.value)),onKeydown:c[1]||(c[1]=v=>o("tab-rename-keydown",v)),onBlur:c[2]||(c[2]=v=>o("tab-rename-commit")),onClick:c[3]||(c[3]=t.withModifiers(()=>{},["stop"]))},null,40,pr)):(t.openBlock(),t.createElementBlock("span",gr,t.toDisplayString(s.name),1))],42,mr))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(V)(e.locale,"addSheet"),onClick:c[4]||(c[4]=s=>o("add-sheet"))}," + ",8,hr)],32))}}),[["__scopeId","data-v-454e1a12"]]),yr={class:"nf-dialog__header"},br={class:"nf-dialog__title"},vr={class:"nf-dialog__body"},wr={class:"nf-field"},kr={class:"nf-field__label"},Er=["value"],Rr={key:0,class:"nf-field"},Br={class:"nf-field__label"},Mr={key:1,class:"nf-field nf-field--inline"},xr={class:"nf-checkbox"},Sr={key:2,class:"nf-field"},Tr={class:"nf-field__label"},Dr=["value"],Nr={key:3,class:"nf-field"},Ar={class:"nf-field__label"},Hr=["value"],Fr={key:4,class:"nf-field"},Vr={class:"nf-field__label"},Or=["value"],Lr={key:5,class:"nf-field"},Ir={class:"nf-field__label"},$r=["value"],Wr={key:6,class:"nf-field"},zr={class:"nf-field__label"},_r=["value"],Gr={class:"nf-field"},Kr={class:"nf-field__label"},Ur={class:"nf-dialog__footer"},Pr={class:"nf-preview"},Yr={class:"nf-preview__label"},Xr={class:"nf-preview__value"},jr={class:"nf-dialog__actions"},Zr=kt(t.defineComponent({__name:"numberFormatDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"},currentFormat:{default:""},sampleValue:{default:"1234.5"}},emits:["update:modelOpen","apply"],setup(e,{emit:r}){const o=e,l=r,c=t.ref(!1),s=t.ref("general"),n=t.ref(2),v=t.ref(!1),d=t.ref("$"),S=t.ref("m/d/yyyy"),K=t.ref("h:mm:ss"),k=t.ref("m/d/yyyy h:mm:ss"),A=t.ref("[h]:mm:ss"),E=t.ref(""),x=t.ref(null),ne=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],y=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],q=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],O=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],Z=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],ie=t.computed(()=>o.locale==="zh-CN"?[...y,...q]:[...q,...y]),ee=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],J=t.computed(()=>o.locale==="zh-CN"?[...O,...Z]:[...Z,...O]),te=["[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"},We=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(s.value)),ze=t.computed(()=>["currency","currencyRounded","accounting"].includes(s.value)),et=t.computed(()=>s.value==="date"),Ue=t.computed(()=>s.value==="time"),qe=t.computed(()=>s.value==="dateTime"),se=t.computed(()=>s.value==="duration"),z=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(s.value));function u(){if(s.value==="general")return rl;if(s.value==="text")return Ht;if(s.value==="custom")return E.value;if(s.value==="date")return S.value;if(s.value==="time")return K.value;if(s.value==="dateTime")return k.value;if(s.value==="duration")return A.value;const w=Math.max(0,Math.min(30,n.value));return s.value==="currency"||s.value==="currencyRounded"||s.value==="accounting"?h(s.value,w,v.value,d.value):Io(o.locale,s.value,w,v.value)}function h(w,W,Y,Be){const De=Y?"#,##0":"0";if(w==="currencyRounded")return Be+De;const _e=W>0?"."+"0".repeat(W):"",Ee=De+_e;return w==="currency"?Be+Ee:`${Be}${Ee};(${Be}${Ee});${Be}"-"`}function Se(w){if(E.value=w,Yt(w)){s.value="general";return}if(w==="@"){s.value="text";return}if(/\[h\]/i.test(w)&&!/[yd]/i.test(w)){s.value="duration",te.includes(w)&&(A.value=w);return}const W=/[yd]/i.test(w),Y=/h|s|AM\/PM/i.test(w);if(W&&Y){s.value="dateTime",J.value.includes(w)&&(k.value=w);return}if(W||/AM\/PM/i.test(w)){Y&&!W?(s.value="time",ee.includes(w)&&(K.value=w)):(s.value="date",ie.value.includes(w)&&(S.value=w));return}if(w.includes("%")){s.value="percent",n.value=He(w);return}if(/E[+-]/i.test(w)){s.value="scientific",n.value=He(w);return}const Be=ne.find(De=>w.startsWith(De.value));if(w.includes("[Red](")){s.value="financial",v.value=w.includes(","),n.value=He(w);return}if(Be){w.includes("(")?(s.value="accounting",d.value=Be.value,v.value=w.includes(","),n.value=He(w)):/\.\d/.test(w.slice(Be.value.length))?(s.value="currency",d.value=Be.value,v.value=w.includes(","),n.value=He(w)):(s.value="currencyRounded",d.value=Be.value,v.value=w.includes(","));return}s.value="number",v.value=w.includes(","),n.value=He(w)}function He(w){const W=w.match(/\.([0#?]+)/);return W?W[1].length:0}function Fe(){s.value!=="custom"&&(E.value=u())}function ut(){}function f(){S.value=ie.value[0],K.value=ee[0],k.value=J.value[0],A.value=te[0]}function b(){c.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0),f(),Se(o.currentFormat??""),t.nextTick(()=>{var w;return(w=x.value)==null?void 0:w.focus()})}function M(){c.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function T(){l("apply",E.value),M()}function a(){M()}function p(w){w.key==="Escape"&&M()}t.watch(()=>o.modelOpen,w=>{w&&!c.value?b():!w&&c.value&&M()});const _=t.computed(()=>hl(o.sampleValue,E.value,o.locale));return(w,W)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"nf-dialog"},{default:t.withCtx(()=>[c.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"nf-dialog__mask",onMousedown:a,onKeydown:p},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:W[9]||(W[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",yr,[t.createElementVNode("span",br,t.toDisplayString(t.unref(V)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:M},[...W[10]||(W[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",vr,[t.createElementVNode("div",wr,[t.createElementVNode("label",kr,t.toDisplayString(t.unref(V)(e.locale,"nfCategory")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[0]||(W[0]=Y=>s.value=Y),class:"nf-field__select",onChange:Fe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Vo),Y=>(t.openBlock(),t.createElementBlock("option",{key:Y,value:Y},t.toDisplayString(t.unref(V)(e.locale,pe[Y])),9,Er))),128))],544),[[t.vModelSelect,s.value]])]),z.value?(t.openBlock(),t.createElementBlock("div",Rr,[t.createElementVNode("label",Br,t.toDisplayString(t.unref(V)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":W[1]||(W[1]=Y=>n.value=Y),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:Fe},null,544),[[t.vModelText,n.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),We.value?(t.openBlock(),t.createElementBlock("div",Mr,[t.createElementVNode("label",xr,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":W[2]||(W[2]=Y=>v.value=Y),type:"checkbox",onChange:Fe},null,544),[[t.vModelCheckbox,v.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(V)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),ze.value?(t.openBlock(),t.createElementBlock("div",Sr,[t.createElementVNode("label",Tr,t.toDisplayString(t.unref(V)(e.locale,"nfSymbol")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[3]||(W[3]=Y=>d.value=Y),class:"nf-field__select",onChange:Fe},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ne,Y=>t.createElementVNode("option",{key:Y.value,value:Y.value},t.toDisplayString(Y.label),9,Dr)),64))],544),[[t.vModelSelect,d.value]])])):t.createCommentVNode("",!0),et.value?(t.openBlock(),t.createElementBlock("div",Nr,[t.createElementVNode("label",Ar,t.toDisplayString(t.unref(V)(e.locale,"nfDateFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[4]||(W[4]=Y=>S.value=Y),class:"nf-field__select",onChange:Fe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ie.value,Y=>(t.openBlock(),t.createElementBlock("option",{key:Y,value:Y},t.toDisplayString(Y),9,Hr))),128))],544),[[t.vModelSelect,S.value]])])):t.createCommentVNode("",!0),Ue.value?(t.openBlock(),t.createElementBlock("div",Fr,[t.createElementVNode("label",Vr,t.toDisplayString(t.unref(V)(e.locale,"nfTimeFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[5]||(W[5]=Y=>K.value=Y),class:"nf-field__select",onChange:Fe},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ee,Y=>t.createElementVNode("option",{key:Y,value:Y},t.toDisplayString(Y),9,Or)),64))],544),[[t.vModelSelect,K.value]])])):t.createCommentVNode("",!0),qe.value?(t.openBlock(),t.createElementBlock("div",Lr,[t.createElementVNode("label",Ir,t.toDisplayString(t.unref(V)(e.locale,"nfDateTime")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[6]||(W[6]=Y=>k.value=Y),class:"nf-field__select",onChange:Fe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(J.value,Y=>(t.openBlock(),t.createElementBlock("option",{key:Y,value:Y},t.toDisplayString(Y),9,$r))),128))],544),[[t.vModelSelect,k.value]])])):t.createCommentVNode("",!0),se.value?(t.openBlock(),t.createElementBlock("div",Wr,[t.createElementVNode("label",zr,t.toDisplayString(t.unref(V)(e.locale,"nfDuration")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[7]||(W[7]=Y=>A.value=Y),class:"nf-field__select",onChange:Fe},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(te,Y=>t.createElementVNode("option",{key:Y,value:Y},t.toDisplayString(Y),9,_r)),64))],544),[[t.vModelSelect,A.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",Gr,[t.createElementVNode("label",Kr,t.toDisplayString(t.unref(V)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:x,"onUpdate:modelValue":W[8]||(W[8]=Y=>E.value=Y),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:ut},null,544),[[t.vModelText,E.value]])])]),t.createElementVNode("div",Ur,[t.createElementVNode("div",Pr,[t.createElementVNode("span",Yr,t.toDisplayString(t.unref(V)(e.locale,"nfPreview")),1),t.createElementVNode("span",Xr,t.toDisplayString(_.value||"—"),1)]),t.createElementVNode("div",jr,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:T},t.toDisplayString(t.unref(V)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:M},t.toDisplayString(t.unref(V)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-69cb36b7"]]);function Ge(e){let r="",o=e;do r=String.fromCharCode(65+o%26)+r,o=Math.floor(o/26)-1;while(o>=0);return r}function yl(e){let r=0;for(let o=0;o<e.length;o++)r=r*26+(e.toUpperCase().charCodeAt(o)-64);return r-1}function Ft(e){if(e==null)return null;if(typeof e=="number")return e;if(typeof e=="string"){const r=parseFloat(e);return e.endsWith("%")||isNaN(r)?null:r}return null}function bl(e){navigator.clipboard.writeText(e).catch(()=>{const r=document.createElement("textarea");r.value=e,r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r)})}function _t(e,r){return`${e},${r}`}function jt(e,r,o){const l=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!l)return null;const c=yl(l[1]),s=parseInt(l[2],10)-1;return c<0||c>=r||s<0||s>=o?null:{col:c,row:s}}function Vt(e,r){if(!r)return{x:0,y:0};const o=r.getBoundingClientRect();return{x:e.clientX-o.left,y:e.clientY-o.top}}function Kl(e,r,o){const l=e.split(":");if(l.length!==2)return null;const c=jt(l[0],r,o),s=jt(l[1],r,o);return!c||!s?null:{sc:Math.min(c.col,s.col),sr:Math.min(c.row,s.row),ec:Math.max(c.col,s.col),er:Math.max(c.row,s.row)}}function Ul(e){const r=e.trim();if(r==="")return"";const o=Number(r);return!isNaN(o)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(r)?o:e}function Ot(e,r,o,l,c){const s=o[_t(e,r)];if(!s)return"";const n=s.value;return n.startsWith("=")?Pl(_t(e,r),o,l,c):Ul(n)}function qr(e,r,o,l,c){const s=Ot(e,r,o,l,c);if(s===null)return 0;if(typeof s=="number")return s;const n=parseFloat(String(s));return isNaN(n)?0:n}const Zt=new Map,il=new Set;function vl(){Zt.clear(),il.clear()}function Pl(e,r,o,l){return Jr(e,r,o,l,0)}function Jr(e,r,o,l,c){if(il.has(e))return null;if(Zt.has(e))return Zt.get(e);il.add(e);const s=r[e];let n;if(!s)n=null;else{const v=s.value;if(!v.startsWith("="))n=Ul(v);else{const d=v.slice(1).trim(),S=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(d);n=S?Xl(S[1].toUpperCase(),S[2],r,o,l,c+1):null}}return il.delete(e),Zt.set(e,n),n}function Yl(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function Qr(e,r){return typeof e=="number"&&typeof r=="number"?e===r:String(e??"")===String(r??"")}function ea(e,r,o){let l;if(typeof e=="number"&&typeof r=="number")l=e<r?-1:e>r?1:0;else{const c=String(e??""),s=String(r??"");l=c<s?-1:c>s?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 ta(e,r,o,l,c){const s=e.trim();let n=null,v=-1,d=null,S=0;for(let k=0;k<s.length;k++){const A=s[k];if(d){A===d&&(s[k+1]===d?k++:d=null);continue}if(A==='"'||A==="'"){d=A;continue}if(A==="("&&S++,A===")"&&S--,S===0&&(A==="<"||A===">"||A==="=")){let E=null;const x=s.slice(k,k+2);x==="<="||x===">="||x==="<>"?E=x:E=A,n=E,v=k,E.length===2&&k++;break}}if(n&&v>=0){const k=s.slice(0,v).trim(),A=s.slice(v+n.length).trim(),E=Et(k,r,o,l,c),x=Et(A,r,o,l,c);return ea(E,x,n)}const K=Et(s,r,o,l,c);return Yl(K)}function wl(e){const r=[];let o=0,l=null,c="";for(let s=0;s<e.length;s++){const n=e[s];if(l){c+=n,n===l&&(e[s+1]===l?(s++,c+=l):l=null);continue}if(n==='"'||n==="'"){l=n,c+=n;continue}if(n==="("&&o++,n===")"&&o--,n===","&&o===0){r.push(c),c="";continue}c+=n}return r.push(c),r}function Et(e,r,o,l,c){if(c>20)return null;const s=e.trim();if(s==="")return null;const n=s.toUpperCase();if(n==="TRUE")return 1;if(n==="FALSE")return 0;const v=la(s);if(v.length===0)return null;let d=0;const S=()=>{let E=K();for(;d<v.length;){const x=v[d];if(x.type==="op"&&(x.val==="+"||x.val==="-"))d++,E=kl(E,K(),x.val);else break}return E},K=()=>{let E=k();for(;d<v.length;){const x=v[d];if(x.type==="op"&&(x.val==="*"||x.val==="/"))d++,E=kl(E,k(),x.val);else break}return E},k=()=>{const E=v[d];return E&&E.type==="op"&&E.val==="-"?(d++,kl(0,k(),"-")):E&&E.type==="op"&&E.val==="+"?(d++,k()):A()},A=()=>{const E=v[d];if(!E)return null;if(E.type==="num")return d++,Number(E.val);if(E.type==="str")return d++,E.val;if(E.type==="lp"){d++;const x=S();return v[d]&&v[d].type==="rp"&&d++,x}if(E.type==="ref"){d++;const x=jt(E.val,o,l);return x?Ot(x.col,x.row,r,o,l):null}if(E.type==="func"){const x=E.val.toUpperCase();if(d++,v[d]&&v[d].type==="lp"){const ne=v[d];let y=0,q=null,O=d;for(;O<v.length;O++)if(v[O].type==="lp")y++;else if(v[O].type==="rp"&&(y--,y===0)){q=v[O];break}if(q){const Z=s.slice(ne.start+1,q.start);return d=O+1,Xl(x,Z,r,o,l,c+1)}}return null}return d++,null};return S()}function la(e){const r=[];let o=0;for(;o<e.length;){const l=e[o];if(/\s/.test(l)){o++;continue}if(l==='"'||l==="'"){const c=l,s=o;o++;let n="";for(;o<e.length;){if(e[o]===c){if(e[o+1]===c){n+=c,o+=2;continue}o++;break}n+=e[o],o++}r.push({type:"str",val:n,start:s});continue}if(/[0-9]/.test(l)||l==="."){const c=o;let s="";for(l==="."&&(s+=".",o++);o<e.length&&/[0-9]/.test(e[o]);)s+=e[o],o++;if(e[o]===".")for(s+=".",o++;o<e.length&&/[0-9]/.test(e[o]);)s+=e[o],o++;if(e[o]==="e"||e[o]==="E")for(s+=e[o],o++,(e[o]==="+"||e[o]==="-")&&(s+=e[o],o++);o<e.length&&/[0-9]/.test(e[o]);)s+=e[o],o++;r.push({type:"num",val:s,start:c});continue}if(/[A-Za-z_]/.test(l)){const c=o;let s="";for(;o<e.length&&/[A-Za-z0-9_]/.test(e[o]);)s+=e[o],o++;e[o]==="("?r.push({type:"func",val:s,start:c}):r.push({type:"ref",val:s,start:c});continue}if(l==="("){r.push({type:"lp",val:l,start:o}),o++;continue}if(l===")"){r.push({type:"rp",val:l,start:o}),o++;continue}if(l===","){r.push({type:"comma",val:l,start:o}),o++;continue}if(l==="+"||l==="-"||l==="*"||l==="/"){r.push({type:"op",val:l,start:o}),o++;continue}o++}return r}function kl(e,r,o){if(typeof e!="number"||typeof r!="number")return null;switch(o){case"+":return e+r;case"-":return e-r;case"*":return e*r;case"/":return r===0?null:e/r}return null}function Xl(e,r,o,l,c,s){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const n=Kl(r.trim(),l,c);if(!n)return null;if(e==="COUNT"){let d=0;for(let S=n.sc;S<=n.ec;S++)for(let K=n.sr;K<=n.er;K++)typeof Ot(S,K,o,l,c)=="number"&&d++;return d}let v=0;for(let d=n.sc;d<=n.ec;d++)for(let S=n.sr;S<=n.er;S++)v+=qr(d,S,o,l,c);if(isNaN(v))return null;if(e==="AVERAGE"){const d=(n.ec-n.sc+1)*(n.er-n.sr+1);return d===0?null:v/d}return v}case"IF":{const n=wl(r);if(n.length<3)return null;const v=ta(n[0],o,l,c,s);return Et(v?n[1]:n[2],o,l,c,s)}case"VLOOKUP":{const n=wl(r);if(n.length<3)return null;const v=Et(n[0],o,l,c,s),d=Kl(n[1].trim(),l,c);if(!d)return null;const S=Et(n[2],o,l,c,s),K=typeof S=="number"?S:parseFloat(String(S));if(isNaN(K))return null;const k=d.sc+(K-1);if(k<d.sc||k>d.ec)return null;if(n.length>=4?Yl(Et(n[3],o,l,c,s)):!1){let E=-1,x=-1/0;for(let ne=d.sr;ne<=d.er;ne++){const y=Ot(d.sc,ne,o,l,c);typeof y=="number"&&typeof v=="number"&&y<=v&&y>x&&(x=y,E=ne)}return E>=0?Ot(k,E,o,l,c):null}for(let E=d.sr;E<=d.er;E++){const x=Ot(d.sc,E,o,l,c);if(Qr(x,v))return Ot(k,E,o,l,c)}return null}case"CONCATENATE":{const n=wl(r);let v="";for(const d of n){const S=Et(d,o,l,c,s);v+=S===null?"":typeof S=="number"?String(S):S}return v}default:return null}}function El(e,r,o){const l=[],c=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let s;for(;(s=c.exec(e))!==null;){const n=jt(s[1],r,o);if(n)if(s[2]){const v=jt(s[2],r,o);if(!v)continue;for(let d=Math.min(n.col,v.col);d<=Math.max(n.col,v.col);d++)for(let S=Math.min(n.row,v.row);S<=Math.max(n.row,v.row);S++)l.push(_t(d,S))}else l.push(_t(n.col,n.row))}return l}function oa(e,r,o,l,c){const s=o[_t(e,r)];if(!s)return"";const n=s.value;if(!n.startsWith("="))return n;const v=Pl(_t(e,r),o,l,c);return v===null?"#ERROR":String(v)}function na(e,r,o,l,c,s){return r===0&&o===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(n,v,d,S,K)=>{const k=v?yl(d):yl(d)+r,A=S?parseInt(K,10)-1:parseInt(K,10)-1+o;let E;k<0?E="A":k>=l?E=s(l-1):E=s(k);let x;return A<0?x="1":A>=c?x=String(c):x=String(A+1),(v||"")+E+(S||"")+x})}class ra{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(r){var l;const o=this.deps.get(r);if(o){for(const c of o)(l=this.rev.get(c))==null||l.delete(r);this.deps.delete(r)}}set(r,o){if(this.clear(r),o.length!==0){this.deps.set(r,o);for(const l of o)this.rev.has(l)||this.rev.set(l,new Set),this.rev.get(l).add(r)}}markDirty(r){const o=[r];for(;o.length>0;){const l=o.pop(),c=this.rev.get(l);if(c)for(const s of c)this.dirty.has(s)||(this.dirty.add(s),o.push(s))}}getDirtyAndClear(){const r=this.dirty;return this.dirty=new Set,r}rebuild(r,o,l){this.deps.clear(),this.rev.clear(),this.dirty.clear(),Zt.clear();for(const[c,s]of Object.entries(r))if(s.value.startsWith("=")){const n=El(s.value.slice(1),o,l);this.set(c,n)}}}function aa(e,r){const o=t.reactive({rowCount:e.rowCount??r.rowCount,colCount:e.colCount??r.colCount,width:e.width,height:e.height,theme:e.theme??r.theme,locale:e.locale??r.locale});t.watchEffect(()=>{o.rowCount=e.rowCount??r.rowCount,o.colCount=e.colCount??r.colCount,o.width=e.width,o.height=e.height,o.theme=e.theme??r.theme,o.locale=e.locale??r.locale});const l=t.computed(()=>o.locale==="zh-CN"?"zh-CN":"en-US"),c=o.colCount,s=o.rowCount,n=t.reactive({}),v=t.reactive({}),d=new ra,S=t.ref(null),K=t.ref("cell"),k=t.ref({col:0,row:0}),A=t.ref(null),E=t.ref(""),x=t.ref(new Array(c).fill(100)),ne=t.ref(new Array(s).fill(void 0)),y=t.ref(0),q=t.ref(0),O=(24-wt)/2,Z=new Map;let ie=null;function ee(D,H,L,Q){const ae=`${Q} ${L} ${H}px ${D}`,ve=Z.get(ae);if(ve)return ve;if(!ie){if(typeof document>"u")return{ascent:H*.88,descent:H*.28};ie=document.createElement("canvas")}const xe=ie.getContext("2d");if(!xe)return{ascent:H*.88,descent:H*.28};xe.font=ae;const Ve=xe.measureText(" "),Ae=Ve.fontBoundingBoxAscent,Oe=Ve.fontBoundingBoxDescent;if(typeof Ae=="number"&&typeof Oe=="number"&&Ae>0&&Oe>0){const de={ascent:Ae,descent:Oe};return Z.set(ae,de),de}const Me=["M","中","y","Ä","0"];let C=0,N=0;for(const de of Me){const he=xe.measureText(de),be=he.actualBoundingBoxAscent||0,Te=he.actualBoundingBoxDescent||0;be>C&&(C=be),Te>N&&(N=Te)}const G=Math.max(C,H*.88),ge=Math.max(N,H*.28),fe={ascent:G,descent:ge};return Z.set(ae,fe),fe}let J=(D,H)=>`${D},${H}`,te=()=>null,pe=()=>wt,We=t.computed(()=>[0]),ze=()=>24,et=(D,H,L,Q)=>({startCol:Math.min(D,L),startRow:Math.min(H,Q),endCol:Math.max(D,L),endRow:Math.max(H,Q)});function Ue(D,H){var Ve;const L=(Ve=n[J(D,H)])==null?void 0:Ve.style,Q=pe(D,H),ae=typeof(L==null?void 0:L.fontFamily)=="string"&&L.fontFamily?L.fontFamily:Pt,ve=(L==null?void 0:L.fontWeight)==="bold"?"bold":"normal",xe=(L==null?void 0:L.fontStyle)==="italic"?"italic":"normal";return ee(ae,Q,ve,xe)}function qe(D,H,L,Q){if(!H)return[""];const ae=H.split(`
2
- `),ve=[];for(const xe of ae)if(!Q||L<=0)ve.push(xe);else{let Ve="";for(let Ae=0;Ae<xe.length;Ae++){const Oe=xe[Ae],Me=Ve+Oe;D.measureText(Me).width>L&&Ve?(ve.push(Ve),Ve=Oe):Ve=Me}ve.push(Ve)}return ve}function se(D,H){var Q;const L=(Q=n[J(D,H)])==null?void 0:Q.style;return typeof(L==null?void 0:L.fontSize)=="number"&&L.fontSize>0?L.fontSize:wt}pe=se;const z=t.computed(()=>{const D=[0];for(let H=0;H<c;H++)D.push(D[H]+x.value[H]);return D});We=z;const u={w:800,h:600};let h=()=>{};function Se(D){var Me;const H=ne.value[D];if(H!=null&&H>0)return H;let L,Q,ae=1;const ve=ie?ie.getContext("2d"):null,xe=ee(Pt,wt,"normal","normal");L=xe.ascent,Q=xe.descent;for(let C=0;C<c;C++){const N=se(C,D),G=(Me=n[J(C,D)])==null?void 0:Me.style,ge=typeof(G==null?void 0:G.fontFamily)=="string"&&G.fontFamily?G.fontFamily:Pt,fe=(G==null?void 0:G.fontWeight)==="bold"?"bold":"normal",de=(G==null?void 0:G.fontStyle)==="italic"?"italic":"normal",he=ee(ge,N,fe,de);he.ascent>L&&(L=he.ascent),he.descent>Q&&(Q=he.descent);const be=typeof(G==null?void 0:G.numberFormat)=="string"?G.numberFormat:"",Te=R(C,D),tt=hl(Te,be,l.value);if(tt){const it=(G==null?void 0:G.wrap)==="wrap";let st;if(it&&ve){ve.font=`${de} ${fe} ${N}px ${ge}`;const Ze=te(C,D);let rt;Ze&&C===Ze.range.startCol&&D===Ze.range.startRow?rt=We.value[Ze.range.endCol+1]-We.value[C]:rt=x.value[C],st=qe(ve,tt,Math.max(0,rt-10),!0).length,st>ae&&(ae=st)}else st=tt.split(`
3
- `).length,st>ae&&(ae=st)}}const Ve=L+Q,Ae=O*2+ae*Ve;return Math.min(500,Math.max(24,Math.round(Ae)))}ze=Se;function He(D){return ne.value[D]===void 0}const Fe=t.computed(()=>{const D=[0];for(let H=0;H<s;H++)D.push(D[H]+ze(H));return D}),ut=t.computed(()=>z.value[c]),f=t.computed(()=>Fe.value[s]);function b(D,H){return`${D},${H}`}J=b;function M(D){Reflect.deleteProperty(n,D)}function T(D,H){K.value="cell";const L=te(D,H);L?(k.value={col:L.range.startCol,row:L.range.startRow},S.value={...L.range}):(k.value={col:D,row:H},S.value={startCol:D,startRow:H,endCol:D,endRow:H})}function a(D,H,L,Q,ae="cell"){const ve=te(D,H);if(k.value=ve?{col:ve.range.startCol,row:ve.range.startRow}:{col:D,row:H},K.value=ae,ae==="row"||ae==="col"){const xe=Math.min(D,L),Ve=Math.max(D,L),Ae=Math.min(H,Q),Oe=Math.max(H,Q);S.value={startCol:xe,startRow:Ae,endCol:Ve,endRow:Oe}}else S.value=et(D,H,L,Q)}function p(){a(0,0,c-1,s-1,"all")}function _(D,H){const L=S.value;return L?(K.value==="cell"||K.value==="all",D>=L.startCol&&D<=L.endCol&&H>=L.startRow&&H<=L.endRow):!1}function w(D,H){return _(D,H)}function W(D,H){for(const L in v){const Q=v[L];if(Q&&D>=Q.startCol&&D<=Q.endCol&&H>=Q.startRow&&H<=Q.endRow)return{range:Q,anchor:L}}return null}te=W;function Y(D,H){return v[b(D,H)]!==void 0}function Be(D,H){const L=te(D,H);if(L&&D===L.range.startCol&&H===L.range.startRow){const Q=z.value[L.range.endCol+1]-z.value[D],ae=Fe.value[L.range.endRow+1]-Fe.value[H];return{w:Q,h:ae}}return{w:x.value[D],h:ze(H)}}function De(D,H,L,Q){let ae=Math.min(D,L),ve=Math.max(D,L),xe=Math.min(H,Q),Ve=Math.max(H,Q),Ae=!0;for(;Ae;){Ae=!1;for(const Oe in v){const Me=v[Oe];if(!Me)continue;Me.startCol<=ve&&Me.endCol>=ae&&Me.startRow<=Ve&&Me.endRow>=xe&&(Me.startCol<ae&&(ae=Me.startCol,Ae=!0),Me.endCol>ve&&(ve=Me.endCol,Ae=!0),Me.startRow<xe&&(xe=Me.startRow,Ae=!0),Me.endRow>Ve&&(Ve=Me.endRow,Ae=!0))}}return{startCol:ae,startRow:xe,endCol:ve,endRow:Ve}}et=De;let _e=()=>{};function Ee(D,H){var L;return((L=n[b(D,H)])==null?void 0:L.value)??""}function R(D,H){return vl(),oa(D,H,n,c,s)}function B(D,H,L){var xe,Ve;const Q=b(D,H);if(vl(),L===""||L==null){d.clear(Q);const Ae=((xe=n[Q])==null?void 0:xe.style)??null;Ae?n[Q]={value:"",style:Ae}:M(Q),d.markDirty(Q);return}const ae=String(L),ve=((Ve=n[Q])==null?void 0:Ve.style)??null;n[Q]={value:ae,style:ve},ae.startsWith("=")?d.set(Q,El(ae.slice(1),c,s)):d.clear(Q),d.markDirty(Q)}function P(D,H,L,Q){for(let ae=D;ae<=H;ae++)for(let ve=L;ve<=Q;ve++){const xe=b(ae,ve);d.clear(xe),M(xe),d.markDirty(xe),_e(ae,ve)}}let ce=()=>{};function le(D){A.value||(A.value={...k.value},D!==void 0?E.value=D:E.value||(E.value=Ee(k.value.col,k.value.row)))}function re(){A.value&&(ce(),B(A.value.col,A.value.row,E.value),A.value=null,E.value="")}function X(){A.value=null,E.value=""}function U(D,H){const L=k.value;let Q=Math.max(0,Math.min(c-1,L.col+D)),ae=Math.max(0,Math.min(s-1,L.row+H));const ve=te(L.col,L.row),xe=te(Q,ae);ve&&xe&&ve.anchor===xe.anchor&&(D>0?Q=ve.range.endCol+1:D<0&&(Q=ve.range.startCol-1),H>0?ae=ve.range.endRow+1:H<0&&(ae=ve.range.startRow-1),Q=Math.max(0,Math.min(c-1,Q)),ae=Math.max(0,Math.min(s-1,ae))),T(Q,ae)}function Ce(D,H){const L=Math.max(0,u.w-52-11),Q=Math.max(0,u.h-24-11),ae=z.value[D],ve=Fe.value[H],xe=te(D,H),Ve=xe?z.value[xe.range.endCol+1]-z.value[D]:x.value[D],Ae=xe?Fe.value[xe.range.endRow+1]-Fe.value[H]:ze(H);let Oe=y.value,Me=q.value;ae<Oe?Oe=ae:ae+Ve>Oe+L&&(Oe=ae+Ve-L),ve<Me?Me=ve:ve+Ae>Me+Q&&(Me=ve+Ae-Q),h(Oe,Me)}function we(D){const H=z.value;if(D<0||D>=H[c])return-1;let L=0,Q=c-1;for(;L<Q;){const ae=L+Q+1>>1;H[ae]<=D?L=ae:Q=ae-1}return L}function Pe(D){const H=Fe.value;if(D<0||D>=H[s])return-1;let L=0,Q=s-1;for(;L<Q;){const ae=L+Q+1>>1;H[ae]<=D?L=ae:Q=ae-1}return L}const Ke={props:o,locale:l,colCount:c,rowCount:s,cells:n,merges:v,formulaDeps:d,selection:S,activeCell:k,editingCell:A,editValue:E,colWidths:x,rowHeights:ne,scrollX:y,scrollY:q,BASE_CELL_VPAD:O,fontMetricsCache:Z,fontMetricsCanvas:ie,measureFontMetrics:ee,_getFontMetricsForCell:Ue,getWrappedLines:qe,cellFontSize:se,colPositions:z,getRowHeight:Se,_isAutoRow:He,rowPositions:Fe,totalWidth:ut,totalHeight:f,selectCell:T,selectRange:a,selectAll:p,isSelected:_,isCellSelected:w,selectionMode:K,cellKey:b,delCell:M,findMerge:W,_isMergeAnchor:Y,_mergedSpan:Be,expandSelectionForMerges:De,getCellRaw:Ee,getCellValue:R,setCellValue:B,clearCellsInRange:P,startEdit:le,commitEdit:re,cancelEdit:X,moveActive:U,ensureVisible:Ce,hitCol:we,hitRow:Pe,viewSize:u};return ce=()=>{var D;return(D=Ke.saveUndo)==null?void 0:D.call(Ke)},_e=(D,H)=>{var L;return(L=Ke.syncCellBorders)==null?void 0:L.call(Ke,D,H)},h=(D,H)=>{var L;return(L=Ke.clampScroll)==null?void 0:L.call(Ke,D,H)},Ke}function ia(e,r){const o=t.ref([]),l=t.ref([]);function c(C){const N={};for(const[G,ge]of Object.entries(C))N[G]={value:ge.value,style:ge.style};return N}function s(){return r.saveSheet(),{sheets:r.sheets.value.map(C=>({id:C.id,name:C.name,cells:c(C.cells),merges:C.merges?{...C.merges}:{},selection:C.selection?{...C.selection}:null,activeCell:C.activeCell?{...C.activeCell}:{col:0,row:0},scrollX:C.scrollX,scrollY:C.scrollY,colWidths:[...C.colWidths],rowHeights:[...C.rowHeights]})),activeSheetIndex:r.activeSheetIndex.value}}function n(C){r.sheets.value=C.sheets.map(N=>({...N,cells:c(N.cells)})),r.loadSheet(Math.max(0,Math.min(C.activeSheetIndex,r.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function v(){const C=s(),N=o.value[o.value.length-1];N&&JSON.stringify(N)===JSON.stringify(C)||(o.value.push(C),l.value=[],o.value.length>50&&o.value.shift())}e.saveUndo=v;function d(){var C;o.value.length&&(l.value.push(s()),n(o.value.pop()),(C=e.scheduleRender)==null||C.call(e),t.nextTick(()=>{var N;return(N=e.emitModelData)==null?void 0:N.call(e)}))}function S(){var C;l.value.length&&(o.value.push(s()),n(l.value.pop()),(C=e.scheduleRender)==null||C.call(e),t.nextTick(()=>{var N;return(N=e.emitModelData)==null?void 0:N.call(e)}))}const K=t.computed(()=>o.value.length>0),k=t.computed(()=>l.value.length>0),A=t.computed(()=>!!e.selection.value),E=t.ref(null);function x(){var G;const C=e.selection.value;if(!C)return;const N={};for(let ge=C.startCol;ge<=C.endCol;ge++)for(let fe=C.startRow;fe<=C.endRow;fe++)N[`${ge-C.startCol},${fe-C.startRow}`]=((G=e.cells[e.cellKey(ge,fe)])==null?void 0:G.style)??null;E.value={styles:N}}function ne(){var G,ge,fe,de;const C=E.value,N=e.selection.value;if(!(!C||!N)){v();for(let he=N.startCol;he<=N.endCol;he++)for(let be=N.startRow;be<=N.endRow;be++){const Te=e.findMerge(he,be);if(Te&&(he!==Te.range.startCol||be!==Te.range.startRow))continue;const tt=C.styles[`${he-N.startCol},${be-N.startRow}`]??null,it=e.cellKey(he,be),st=((G=e.cells[it])==null?void 0:G.value)??"";st===""&&tt===null?e.delCell(it):e.cells[it]={value:st,style:tt},(ge=e.syncCellBorders)==null||ge.call(e,he,be)}E.value=null,(fe=e.scheduleRender)==null||fe.call(e),(de=e.emitModelData)==null||de.call(e)}}function y(){var N,G,ge,fe;const C=e.selection.value;if(C){v();for(let de=C.startCol;de<=C.endCol;de++)for(let he=C.startRow;he<=C.endRow;he++){const be=e.findMerge(de,he);if(be&&(de!==be.range.startCol||he!==be.range.startRow))continue;const Te=e.cellKey(de,he),tt=((N=e.cells[Te])==null?void 0:N.value)??"";tt===""?e.delCell(Te):e.cells[Te]={value:tt,style:null},(G=e.syncCellBorders)==null||G.call(e,de,he)}(ge=e.scheduleRender)==null||ge.call(e),(fe=e.emitModelData)==null||fe.call(e)}}const q=t.computed(()=>co.map(C=>({...C,label:C.value===""?V(e.locale.value,"fontDefault"):C.label}))),O=t.computed(()=>so.map(C=>({...C,label:String(C.value)}))),Z="\0",ie=t.computed(()=>{var ge;const C=e.selection.value;if(!C)return"";let N,G=!1;for(let fe=C.startCol;fe<=C.endCol&&!G;fe++)for(let de=C.startRow;de<=C.endRow&&!G;de++){const he=e.findMerge(fe,de);if(he&&(fe!==he.range.startCol||de!==he.range.startRow))continue;const be=(ge=e.cells[e.cellKey(fe,de)])==null?void 0:ge.style,Te=typeof(be==null?void 0:be.fontFamily)=="string"?be.fontFamily:"";N===void 0?N=Te:Te!==N&&(G=!0)}return G?Z:N??""}),ee=t.computed(()=>{const C=e.selection.value;if(!C)return wt;let N,G=!1;for(let ge=C.startCol;ge<=C.endCol&&!G;ge++)for(let fe=C.startRow;fe<=C.endRow&&!G;fe++){const de=e.findMerge(ge,fe);if(de&&(ge!==de.range.startCol||fe!==de.range.startRow))continue;const he=e.cellFontSize(ge,fe);N===void 0?N=he:he!==N&&(G=!0)}return G?0:N??wt});function J(C,N){var ge,fe,de,he;const G=e.selection.value;if(G){v();for(let be=G.startCol;be<=G.endCol;be++)for(let Te=G.startRow;Te<=G.endRow;Te++){const tt=e.findMerge(be,Te);if(tt&&(be!==tt.range.startCol||Te!==tt.range.startRow))continue;const it=e.cellKey(be,Te),st=((ge=e.cells[it])==null?void 0:ge.value)??"",Ze=(fe=e.cells[it])!=null&&fe.style?{...e.cells[it].style}:{};N===""||N===null||N===void 0||N===0?Reflect.deleteProperty(Ze,C):Ze[C]=N;const rt=Object.keys(Ze).length?Ze:null;st===""&&rt===null?e.delCell(it):e.cells[it]={value:st,style:rt}}(de=e.scheduleRender)==null||de.call(e),(he=e.emitModelData)==null||he.call(e)}}function te(C){J("fontFamily",C===""?"":C)}const pe=t.ref(!1),We=t.ref(!1),ze=t.ref(!1),et=t.ref(!1),Ue=t.ref(!1);function qe(C){J("fontSize",C),pe.value=!1}const se=t.computed(()=>Co.map(C=>({label:V(e.locale.value,C.labelKey),value:C.value,icon:C.icon}))),z=t.computed(()=>yo.map(C=>({label:V(e.locale.value,C.labelKey),value:C.value,icon:C.icon}))),u=t.computed(()=>{var ge;const C=e.selection.value;if(!C)return"left";const N=(ge=e.cells[e.cellKey(C.startCol,C.startRow)])==null?void 0:ge.style,G=typeof(N==null?void 0:N.textAlign)=="string"?N.textAlign:"";return G==="center"||G==="right"?G:"left"}),h=t.computed(()=>{var ge;const C=e.selection.value;if(!C)return"top";const N=(ge=e.cells[e.cellKey(C.startCol,C.startRow)])==null?void 0:ge.style,G=typeof(N==null?void 0:N.verticalAlign)=="string"?N.verticalAlign:"";return G==="middle"||G==="bottom"?G:"top"}),Se=t.computed(()=>{var G;const C=e.selection.value;if(!C)return!1;const N=(G=e.cells[e.cellKey(C.startCol,C.startRow)])==null?void 0:G.style;return(N==null?void 0:N.wrap)==="wrap"});function He(C){J("textAlign",C)}function Fe(C){J("verticalAlign",C)}function ut(){if(!e.selection.value)return;const N=Se.value;J("wrap",N?void 0:"wrap")}const f=t.ref(""),b=pe;t.watch(ee,C=>{f.value=C===0?"":String(C)},{immediate:!0});function M(C){const N=C.replace(/[^\d]/g,"");f.value=N;const G=parseInt(N,10);!isNaN(G)&&G>=5&&G<=72&&G!==ee.value&&J("fontSize",G)}function T(){const C=f.value.trim();if(!C){f.value=ee.value===0?"":String(ee.value);return}let N=parseInt(C,10);isNaN(N)?N=ee.value===0?wt:ee.value:N=Math.max(5,Math.min(72,N)),f.value=String(N),N!==ee.value&&J("fontSize",N)}function a(C){C.key==="Enter"&&C.target.blur()}function p(C){C&&C.preventDefault(),b.value=!b.value,b.value&&(ze&&(ze.value=!1),We&&(We.value=!1),et.value=!1,Ue.value=!1)}function _(){const C=ee.value===0?wt:ee.value,N=Math.min(72,C+1);J("fontSize",N),f.value=String(N),b.value=!1}function w(){const C=ee.value===0?wt:ee.value,N=Math.max(5,C-1);J("fontSize",N),f.value=String(N),b.value=!1}function W(C){var fe;const N=e.selection.value;if(!N)return!1;let G,ge=!1;for(let de=N.startCol;de<=N.endCol&&!ge;de++)for(let he=N.startRow;he<=N.endRow&&!ge;he++){const be=e.findMerge(de,he);if(be&&(de!==be.range.startCol||he!==be.range.startRow))continue;const Te=(fe=e.cells[e.cellKey(de,he)])==null?void 0:fe.style,tt=!!(Te!=null&&Te[C]);G===void 0?G=tt:tt!==G&&(ge=!0)}return!ge&&G===!0}const Y=t.computed(()=>W("fontWeight")),Be=t.computed(()=>W("fontStyle")),De=t.computed(()=>W("underline")),_e=t.computed(()=>W("strikethrough"));function Ee(){J("fontWeight",Y.value?"":"bold")}function R(){J("fontStyle",Be.value?"":"italic")}function B(){J("underline",De.value?"":"underline")}function P(){J("strikethrough",_e.value?"":"line-through")}const ce=t.ref(""),le=t.ref(""),re=et,X=Ue;function U(){re.value=!re.value,X.value=!1,We&&(We.value=!1),ze&&(ze.value=!1)}function Ce(){X.value=!X.value,re.value=!1,We&&(We.value=!1),ze&&(ze.value=!1)}function we(C){We&&(We.value=C),C&&(re.value=!1,X.value=!1,ze&&(ze.value=!1))}function Pe(C){ce.value=C,J("color",C===""?"":C)}function Ke(C){le.value=C,J("backgroundColor",C===""?"":C)}function D(){J("color",ce.value===""?"":ce.value)}function H(){J("backgroundColor",le.value===""?"":le.value)}const L=t.computed(()=>{var ge;const C=e.selection.value;if(!C)return"";let N,G=!1;for(let fe=C.startCol;fe<=C.endCol&&!G;fe++)for(let de=C.startRow;de<=C.endRow&&!G;de++){const he=e.findMerge(fe,de);if(he&&(fe!==he.range.startCol||de!==he.range.startRow))continue;const be=(ge=e.cells[e.cellKey(fe,de)])==null?void 0:ge.style,Te=typeof(be==null?void 0:be.color)=="string"?be.color:"";N===void 0?N=Te:Te!==N&&(G=!0)}return G?"":N??""}),Q=t.computed(()=>{var ge;const C=e.selection.value;if(!C)return"";let N,G=!1;for(let fe=C.startCol;fe<=C.endCol&&!G;fe++)for(let de=C.startRow;de<=C.endRow&&!G;de++){const he=e.findMerge(fe,de);if(he&&(fe!==he.range.startCol||de!==he.range.startRow))continue;const be=(ge=e.cells[e.cellKey(fe,de)])==null?void 0:ge.style,Te=typeof(be==null?void 0:be.backgroundColor)=="string"?be.backgroundColor:"";N===void 0?N=Te:Te!==N&&(G=!0)}return G?"":N??""}),ae=t.computed(()=>$o(e.locale.value)),ve=t.ref(!1),xe=t.computed(()=>{var ge;const C=e.selection.value;if(!C)return rl;let N,G=!1;for(let fe=C.startCol;fe<=C.endCol&&!G;fe++)for(let de=C.startRow;de<=C.endRow&&!G;de++){const he=e.findMerge(fe,de);if(he&&(fe!==he.range.startCol||de!==he.range.startRow))continue;const be=(ge=e.cells[e.cellKey(fe,de)])==null?void 0:ge.style,Te=typeof(be==null?void 0:be.numberFormat)=="string"?be.numberFormat:"";N===void 0?N=Te:Te!==N&&(G=!0)}return G?nl:N??rl});function Ve(C){J("numberFormat",C)}function Ae(C){if(C===Nl){ve.value=!0;return}Ve(C)}function Oe(){ve.value=!0}return{undoStack:o,redoStack:l,cloneCells:c,takeSnap:s,restoreSnap:n,saveUndo:v,undo:d,redo:S,canUndo:K,canRedo:k,hasSelection:A,paintFmt:E,onPaintFormat:x,applyPaintFormat:ne,clearFormat:y,fontFamilyOptions:q,fontSizeOptions:O,FONT_FAMILY_MIXED:Z,selFontFamily:ie,selFontSize:ee,applyStyleToSelection:J,onFontFamilyChange:te,onFontSizeChange:qe,hAlignOptions:se,vAlignOptions:z,selHAlign:u,selVAlign:h,selWrap:Se,onHAlignChange:He,onVAlignChange:Fe,onWrapToggle:ut,fontSizeInput:f,fontSizeMenuOpen:b,onFontSizeInput:M,onFontSizeBlur:T,onFontSizeKeydown:a,toggleFontSizeMenu:p,onFontSizeStepUp:_,onFontSizeStepDown:w,selFontWeight:Y,selFontStyle:Be,selUnderline:De,selStrikethrough:_e,toggleFontWeight:Ee,toggleFontStyle:R,toggleUnderline:B,toggleStrikethrough:P,cachedTextColor:ce,cachedFillColor:le,textColorMenuOpen:re,fillColorMenuOpen:X,_toggleTextColorMenu:U,_toggleFillColorMenu:Ce,onBorderMenuToggle:we,onTextColorChange:Pe,onFillColorChange:Ke,applyCachedTextColor:D,applyCachedFillColor:H,selTextColor:L,selFillColor:Q,nfOptions:ae,selNumberFormat:xe,NF_NUMBER_FORMAT_MIXED:nl,nfDialogOpen:ve,onNumberFormatChange:Ae,openNumberFormatDialog:Oe,applyNumberFormatCode:Ve}}function ca(e,r){r.borderMenuOpen&&(e.borderMenuOpen=r.borderMenuOpen),r.mergeMenuOpen&&(e.mergeMenuOpen=r.mergeMenuOpen),(()=>{const l=e.borderMenuOpen,c=e.mergeMenuOpen;e.onBorderMenuToggle=s=>{l&&(l.value=s),s&&(e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1,c&&(c.value=!1))},e.toggleFontSizeMenu=s=>{s&&s.preventDefault(),e.fontSizeMenuOpen.value=!e.fontSizeMenuOpen.value,e.fontSizeMenuOpen.value&&(c&&(c.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),c&&(c.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,l&&(l.value=!1),c&&(c.value=!1)}})()}function sa(e,r){const o=t.ref("none"),l=t.ref(!1),c="#444";function s(f,b,M,T){const a=e.findMerge(b,M),p=a?a.range.endCol:b,_=a?a.range.endRow:M,w=a?a.range.startCol:b,Y=(a?a.range.startRow:M)===T.startRow,Be=_===T.endRow,De=w===T.startCol,_e=p===T.endCol,Ee={top:0,bottom:0,left:0,right:0};switch(f){case"none":return Ee;case"bottom":Be&&(Ee.bottom=1);break;case"top":Y&&(Ee.top=1);break;case"left":De&&(Ee.left=1);break;case"right":_e&&(Ee.right=1);break;case"all":Ee.top=1,Ee.bottom=1,Ee.left=1,Ee.right=1;break;case"outer":Y&&(Ee.top=1),Be&&(Ee.bottom=1),De&&(Ee.left=1),_e&&(Ee.right=1);break;case"thickOuter":Y&&(Ee.top=2),Be&&(Ee.bottom=2),De&&(Ee.left=2),_e&&(Ee.right=2);break}return Ee}function n(f,b,M,T,a){var Ee,R;if(f<0||b<0||f>=e.colCount||b>=e.rowCount)return;const p=e.findMerge(f,b);if(p&&(M==="Top"&&(f!==p.range.startCol||b!==p.range.startRow)||M==="Bottom"&&(f!==p.range.startCol||b!==p.range.endRow)||M==="Left"&&(f!==p.range.startCol||b!==p.range.startRow)||M==="Right"&&(f!==p.range.endCol||b!==p.range.startRow)))return;const _=p?p.anchor:e.cellKey(f,b),w=((Ee=e.cells[_])==null?void 0:Ee.value)??"",W=(R=e.cells[_])!=null&&R.style?{...e.cells[_].style}:{},Y=`border${M}Width`;T===0?a&&Reflect.deleteProperty(W,Y):(W[Y]=T,W.borderColor=c),["Top","Bottom","Left","Right"].some(B=>W[`border${B}Width`]!==void 0)||Reflect.deleteProperty(W,"borderColor");const _e=Object.keys(W).length?W:null;w===""&&_e===null?e.delCell(_):e.cells[_]={value:w,style:_e}}function v(f,b){var Y;const M=e.findMerge(f,b),T=M?M.anchor:e.cellKey(f,b),a=(Y=e.cells[T])==null?void 0:Y.style,p=(a==null?void 0:a.borderTopWidth)||0,_=(a==null?void 0:a.borderBottomWidth)||0,w=(a==null?void 0:a.borderLeftWidth)||0,W=(a==null?void 0:a.borderRightWidth)||0;if(M){const Be=M.range.startRow,De=M.range.endRow,_e=M.range.startCol,Ee=M.range.endCol;n(_e,Be-1,"Bottom",p,!0),n(_e,De+1,"Top",_,!0),n(_e-1,Be,"Right",w,!0),n(Ee+1,Be,"Left",W,!0)}else n(f,b-1,"Bottom",p,!0),n(f,b+1,"Top",_,!0),n(f-1,b,"Right",w,!0),n(f+1,b,"Left",W,!0)}e.syncCellBorders=v;function d(f,b,M,T=!0){var _e,Ee;const a=e.findMerge(f,b),p=a?a.anchor:e.cellKey(f,b),_=((_e=e.cells[p])==null?void 0:_e.value)??"",w=(Ee=e.cells[p])!=null&&Ee.style?{...e.cells[p].style}:{},W=["Top","Bottom","Left","Right"],Y=[M.top,M.bottom,M.left,M.right];for(let R=0;R<4;R++){const B=`border${W[R]}Width`;Y[R]===0?T&&Reflect.deleteProperty(w,B):(w[B]=Y[R],w.borderColor=c)}W.some(R=>w[`border${R}Width`]!==void 0)||Reflect.deleteProperty(w,"borderColor");const De=Object.keys(w).length?w:null;_===""&&De===null?e.delCell(p):e.cells[p]={value:_,style:De},v(a?a.range.startCol:f,a?a.range.startRow:b)}function S(f){var M,T;o.value=f;const b=e.selection.value;if(b){if(r.saveUndo(),f==="none")for(let a=b.startCol;a<=b.endCol;a++)for(let p=b.startRow;p<=b.endRow;p++){const _=e.findMerge(a,p);_&&(a!==_.range.startCol||p!==_.range.startRow)||d(a,p,{top:0,bottom:0,left:0,right:0},!0)}else for(let a=b.startCol;a<=b.endCol;a++)for(let p=b.startRow;p<=b.endRow;p++){const _=e.findMerge(a,p);if(_&&(a!==_.range.startCol||p!==_.range.startRow))continue;const w=s(f,a,p,b);d(a,p,w,!1)}(M=e.scheduleRender)==null||M.call(e),(T=e.emitModelData)==null||T.call(e)}}function K(){S(o.value)}function k(f,b,M){var p,_;const T=e.findMerge(f,b);if(T){const w=(p=e.cells[T.anchor])==null?void 0:p.style;return M==="Top"&&b===T.range.startRow?(w==null?void 0:w.borderTopWidth)||0:M==="Bottom"&&b===T.range.endRow?(w==null?void 0:w.borderBottomWidth)||0:M==="Left"&&f===T.range.startCol?(w==null?void 0:w.borderLeftWidth)||0:M==="Right"&&f===T.range.endCol&&(w==null?void 0:w.borderRightWidth)||0}const a=(_=e.cells[e.cellKey(f,b)])==null?void 0:_.style;return(a==null?void 0:a[`border${M}Width`])||0}const A=t.ref(!1);function E(f){A.value=f,f&&(r.textColorMenuOpen.value=!1,r.fillColorMenuOpen.value=!1,l.value=!1,r.fontSizeMenuOpen.value=!1)}function x(f,b,M,T){const a=[];for(const p in e.merges){const _=e.merges[p];_&&_.startCol<=M&&_.endCol>=f&&_.startRow<=T&&_.endRow>=b&&a.push(p)}for(const p of a)Reflect.deleteProperty(e.merges,p)}function ne(){var a,p,_,w;const f=e.selection.value;if(!f||f.startCol===f.endCol&&f.startRow===f.endRow)return;r.saveUndo(),x(f.startCol,f.startRow,f.endCol,f.endRow);const b=e.cellKey(f.startCol,f.startRow),M=((a=e.cells[b])==null?void 0:a.value)??"";for(let W=f.startCol;W<=f.endCol;W++)for(let Y=f.startRow;Y<=f.endRow;Y++)W===f.startCol&&Y===f.startRow||e.clearCellsInRange(W,W,Y,Y);const T=(p=e.cells[b])!=null&&p.style?{...e.cells[b].style}:{};T.textAlign="center",e.cells[b]={value:M,style:T},e.merges[b]={startCol:f.startCol,startRow:f.startRow,endCol:f.endCol,endRow:f.endRow},e.selectCell(f.startCol,f.startRow),(_=e.scheduleRender)==null||_.call(e),(w=e.emitModelData)==null||w.call(e)}function y(){var b,M,T;const f=e.selection.value;if(!(!f||f.startCol===f.endCol)){r.saveUndo();for(let a=f.startRow;a<=f.endRow;a++){x(f.startCol,a,f.endCol,a);const p=e.cellKey(f.startCol,a);(b=e.cells[p])==null||b.value;for(let _=f.startCol+1;_<=f.endCol;_++)e.clearCellsInRange(_,_,a,a);e.merges[p]={startCol:f.startCol,startRow:a,endCol:f.endCol,endRow:a}}e.selectRange(f.startCol,f.startRow,f.endCol,f.endRow),(M=e.scheduleRender)==null||M.call(e),(T=e.emitModelData)==null||T.call(e)}}function q(){var M,T,a;const f=e.selection.value;if(!f||f.startCol===f.endCol&&f.startRow===f.endRow)return;r.saveUndo(),x(f.startCol,f.startRow,f.endCol,f.endRow);const b=e.cellKey(f.startCol,f.startRow);(M=e.cells[b])==null||M.value;for(let p=f.startCol;p<=f.endCol;p++)for(let _=f.startRow;_<=f.endRow;_++)p===f.startCol&&_===f.startRow||e.clearCellsInRange(p,p,_,_);e.merges[b]={startCol:f.startCol,startRow:f.startRow,endCol:f.endCol,endRow:f.endRow},e.selectCell(f.startCol,f.startRow),(T=e.scheduleRender)==null||T.call(e),(a=e.emitModelData)==null||a.call(e)}function O(){var b,M;const f=e.selection.value;f&&(r.saveUndo(),x(f.startCol,f.startRow,f.endCol,f.endRow),(b=e.scheduleRender)==null||b.call(e),(M=e.emitModelData)==null||M.call(e))}function Z(){const f=e.selection.value;if(!f)return;const b=e.findMerge(f.startCol,f.startRow);b&&f.startCol===b.range.startCol&&f.startRow===b.range.startRow&&f.endCol===b.range.endCol&&f.endRow===b.range.endRow?O():ne()}function ie(f){switch(f){case"mergeCenter":ne();break;case"mergeAcross":y();break;case"mergeCells":q();break;case"unmergeCells":O();break}}let ee=null,J=[];function te(f,b,M,T){var a;J=[];for(let p=M;p<=T;p++){const _=[];for(let w=f;w<=b;w++){const W=(a=e.cells[e.cellKey(w,p)])==null?void 0:a.style;_.push(W?{...W}:null)}J.push(_)}}function pe(f,b,M,T){const a=e.cellKey(f,b);if(vl(),M===""||M==null){e.formulaDeps.clear(a),T?e.cells[a]={value:"",style:{...T}}:e.delCell(a),e.formulaDeps.markDirty(a);return}e.cells[a]={value:M,style:T?{...T}:null},M.startsWith("=")?e.formulaDeps.set(a,El(M.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(a),e.formulaDeps.markDirty(a)}function We(){const f=e.selection.value;if(!f)return;ee={...f},te(f.startCol,f.endCol,f.startRow,f.endRow);const b=[];for(let M=f.startRow;M<=f.endRow;M++){const T=[];for(let a=f.startCol;a<=f.endCol;a++)T.push(e.getCellRaw(a,M));b.push(T.join(" "))}bl(b.join(`
4
- `))}function ze(){const f=e.selection.value;if(f){if(f.startCol===0&&f.endCol===e.colCount-1){ee={...f},te(0,e.colCount-1,f.startRow,f.endRow);const b=[];for(let M=f.startRow;M<=f.endRow;M++){const T=[];for(let a=0;a<e.colCount;a++)T.push(e.getCellRaw(a,M));b.push(T.join(" "))}bl(b.join(`
5
- `))}else if(f.startRow===0&&f.endRow===e.rowCount-1){ee={...f},te(f.startCol,f.endCol,0,e.rowCount-1);const b=[];for(let M=0;M<e.rowCount;M++){const T=[];for(let a=f.startCol;a<=f.endCol;a++)T.push(e.getCellRaw(a,M));b.push(T.join(" "))}bl(b.join(`
6
- `))}}}async function et(){var p;let f;try{f=await navigator.clipboard.readText()}catch{return}if(!f&&f!=="")return;const b=f.split(/\r?\n/),M=e.activeCell.value,T=ee,a=T&&J.length>0;for(let _=0;_<b.length;_++){const w=b[_].split(" ");for(let W=0;W<w.length;W++){const Y=M.col+W,Be=M.row+_;if(Y<e.colCount&&Be<e.rowCount){let De=w[W];if(De.startsWith("=")&&T&&(De=na(De,Y-(T.startCol+W),Be-(T.startRow+_),e.colCount,e.rowCount,Ge)),a&&_<J.length&&W<(((p=J[_])==null?void 0:p.length)??0)){const _e=J[_][W]??null;pe(Y,Be,De,_e),v(Y,Be)}else e.setCellValue(Y,Be,De)}}}}function Ue(){var f;if(r.saveUndo(),We(),e.selection.value){const b=e.selection.value;e.clearCellsInRange(b.startCol,b.endCol,b.startRow,b.endRow),(f=e.scheduleRender)==null||f.call(e)}}function qe(){var f;if(e.selection.value){const b=e.selection.value;e.clearCellsInRange(b.startCol,b.endCol,b.startRow,b.endRow),(f=e.scheduleRender)==null||f.call(e)}}function se(){var p,_;const f=e.selection.value;if(!f)return;r.saveUndo();const b=f.startCol,M=f.startRow,T=f.endCol,a=f.endRow;if(M===a)if(T+1<e.colCount){const w=`${Ge(b)}${M+1}:${Ge(T)}${M+1}`;e.setCellValue(T+1,M,`=SUM(${w})`)}else{const w=`${Ge(b)}${M+1}:${Ge(T-1)}${M+1}`;e.setCellValue(T,M,`=SUM(${w})`)}else for(let w=b;w<=T;w++)if(a+1<e.rowCount){const W=`${Ge(w)}${M+1}:${Ge(w)}${a+1}`;e.setCellValue(w,a+1,`=SUM(${W})`)}else{const W=`${Ge(w)}${M+1}:${Ge(w)}${a}`;e.setCellValue(w,a,`=SUM(${W})`)}(p=e.scheduleRender)==null||p.call(e),(_=e.emitModelData)==null||_.call(e)}function z(){var p,_;const f=e.selection.value;if(!f)return;r.saveUndo();const b=f.startCol,M=f.startRow,T=f.endCol,a=f.endRow;if(M===a)if(T+1<e.colCount){const w=`${Ge(b)}${M+1}:${Ge(T)}${M+1}`;e.setCellValue(T+1,M,`=AVERAGE(${w})`)}else{const w=`${Ge(b)}${M+1}:${Ge(T-1)}${M+1}`;e.setCellValue(T,M,`=AVERAGE(${w})`)}else for(let w=b;w<=T;w++)if(a+1<e.rowCount){const W=`${Ge(w)}${M+1}:${Ge(w)}${a+1}`;e.setCellValue(w,a+1,`=AVERAGE(${W})`)}else{const W=`${Ge(w)}${M+1}:${Ge(w)}${a}`;e.setCellValue(w,a,`=AVERAGE(${W})`)}(p=e.scheduleRender)==null||p.call(e),(_=e.emitModelData)==null||_.call(e)}function u(){var p,_;const f=e.selection.value;if(!f)return;r.saveUndo();const b=f.startCol,M=f.startRow,T=f.endCol,a=f.endRow;if(M===a)if(T+1<e.colCount){const w=`${Ge(b)}${M+1}:${Ge(T)}${M+1}`;e.setCellValue(T+1,M,`=COUNT(${w})`)}else{const w=`${Ge(b)}${M+1}:${Ge(T-1)}${M+1}`;e.setCellValue(T,M,`=COUNT(${w})`)}else for(let w=b;w<=T;w++)if(a+1<e.rowCount){const W=`${Ge(w)}${M+1}:${Ge(w)}${a+1}`;e.setCellValue(w,a+1,`=COUNT(${W})`)}else{const W=`${Ge(w)}${M+1}:${Ge(w)}${a}`;e.setCellValue(w,a,`=COUNT(${W})`)}(p=e.scheduleRender)==null||p.call(e),(_=e.emitModelData)==null||_.call(e)}const h=t.ref(!1);function Se(f){h.value=f,f&&(r.textColorMenuOpen.value=!1,r.fillColorMenuOpen.value=!1,l.value=!1,r.fontSizeMenuOpen.value=!1,A.value=!1)}function He(){se(),h.value=!1}function Fe(){z(),h.value=!1}function ut(){u(),h.value=!1}return{cachedBorder:o,borderMenuOpen:l,BORDER_COLOR:c,borderTypeToWidths:s,onBorderChange:S,setCellBorderSide:n,syncCellBorders:v,applyBorderToCell:d,applyCachedBorder:K,cellBorderWidth:k,mergeMenuOpen:A,onMergeMenuToggle:E,removeOverlappingMerges:x,mergeAndCenter:ne,mergeAcross:y,mergeCells:q,unmergeCells:O,onApplyMerge:Z,onMergeChange:ie,copySourceRange:null,copySourceStyles:[],captureStyles:te,setCellWithStyle:pe,copyToClipboard:We,copyRowCol:ze,pasteFromClipboard:et,cutSelected:Ue,clearSelected:qe,sumSelected:se,avgSelected:z,countSelected:u,calcMenuOpen:h,onCalcMenuToggle:Se,onCalcSum:He,onCalcAvg:Fe,onCalcCount:ut}}function da(e,r,o,l){const c={},s=l(r),n=l(o);return s!=null&&(c.width=`${s}px`),n!=null&&(c.height=`${n}px`),c["--sp-formula-bar-bg"]=e.formulaBarBg,c["--sp-formula-bar-border"]=e.formulaBarBorder,c["--sp-formula-bar-label-color"]=e.formulaBarLabelText,c["--sp-formula-bar-label-bg"]=e.formulaBarLabelBg,c["--sp-formula-bar-label-border"]=e.formulaBarLabelBorder,c["--sp-formula-bar-input-bg"]=e.formulaBarInputBg,c["--sp-formula-bar-input-border"]=e.formulaBarInputBorder,c["--sp-formula-bar-input-color"]=e.formulaBarInputText,c["--sp-formula-bar-input-focus-border"]=e.formulaBarInputFocusBorder,c["--sp-formula-bar-input-focus-shadow"]=e.formulaBarInputFocusShadow,c["--sp-wrapper-bg"]=e.wrapperBg,c["--sp-cell-editor-border"]=e.cellEditorBorder,c["--sp-cell-editor-color"]=e.cellEditorText,c["--sp-cell-editor-bg"]=e.cellEditorBg,c["--sp-cell-editor-shadow"]=e.cellEditorShadow,c["--sp-tab-bar-bg"]=e.tabBarBg,c["--sp-tab-bar-border"]=e.tabBarBorder,c["--sp-tab-active-bg"]=e.tabActiveBg,c["--sp-tab-active-color"]=e.tabActiveText,c["--sp-tab-active-border"]=e.tabActiveBorder,c["--sp-tab-inactive-bg"]=e.tabInactiveBg,c["--sp-tab-inactive-color"]=e.tabInactiveText,c["--sp-tab-inactive-border"]=e.tabInactiveBorder,c["--sp-tab-hover-bg"]=e.tabHoverBg,c["--sp-tab-add-btn-color"]=e.tabAddBtnColor,c["--sp-tab-add-btn-hover-bg"]=e.tabAddBtnHoverBg,c["--sp-tab-scroll-btn-color"]=e.tabScrollBtnColor,c["--sp-tab-scroll-btn-hover-bg"]=e.tabScrollBtnHoverBg,c["--sp-scroll-thumb"]=e.scrollbarThumb,c["--sp-scroll-thumb-hover"]=e.scrollbarThumbHover,c["--sp-scroll-btn-bg"]=e.scrollBtnBg,c["--sp-scroll-btn-color"]=e.scrollBtnColor,c["--sp-scroll-btn-hover-bg"]=e.scrollBtnHoverBg,c["--sp-scroll-btn-active-bg"]=e.scrollBtnActiveBg,c["--sp-scroll-track-bg"]=e.scrollTrackBg,c["--sp-toolbar-bg"]=e.toolbarBg,c["--sp-toolbar-border"]=e.toolbarBorder,c["--sp-toolbar-btn-color"]=e.toolbarBtnColor,c["--sp-toolbar-btn-hover-bg"]=e.toolbarBtnHoverBg,c["--sp-toolbar-btn-disabled-color"]=e.toolbarBtnDisabledColor,c["--sp-toolbar-btn-active-color"]=e.toolbarBtnActiveColor,c}function ua(e,r,o,l,c){function s(R,B){var le,re;const P=B-R+1,ce=K(R,B);for(let X=R;X<=B;X++)for(let U=0;U<e.colCount;U++)e.delCell(e.cellKey(U,X));for(let X=R;X<e.rowCount-P;X++){for(let U=0;U<e.colCount;U++){const Ce=e.cellKey(U,X+P),we=e.cellKey(U,X);e.cells[Ce]?(e.cells[we]=e.cells[Ce],e.delCell(Ce)):e.delCell(we)}e.rowHeights.value[X]=e.rowHeights.value[X+P]}for(let X=e.rowCount-P;X<e.rowCount;X++){for(let U=0;U<e.colCount;U++)e.delCell(e.cellKey(U,X));e.rowHeights.value[X]=void 0}if(S(ce),R>0)for(let X=0;X<e.colCount;X++)(le=e.syncCellBorders)==null||le.call(e,X,R-1),(re=e.syncCellBorders)==null||re.call(e,X,R)}function n(R,B){const P=B-R+1;if(B>=e.rowCount-1)return;const ce=A(R,B);for(let le=e.rowCount-1;le>B;le--){for(let re=0;re<e.colCount;re++){const X=e.cellKey(re,le-P),U=e.cellKey(re,le);e.cells[X]?e.cells[U]=e.cells[X]:e.delCell(U)}e.rowHeights.value[le]=e.rowHeights.value[le-P]}for(let le=B+1;le<=B+P;le++){for(let re=0;re<e.colCount;re++)e.delCell(e.cellKey(re,le));e.rowHeights.value[le]=void 0}S(ce)}function v(R,B){const P=B-R+1;if(B>=e.colCount-1)return;const ce=E(R,B);for(let le=e.colCount-1;le>B;le--){for(let re=0;re<e.rowCount;re++){const X=e.cellKey(le-P,re),U=e.cellKey(le,re);e.cells[X]?e.cells[U]=e.cells[X]:e.delCell(U)}e.colWidths.value[le]=e.colWidths.value[le-P]}for(let le=B+1;le<=B+P;le++){for(let re=0;re<e.rowCount;re++)e.delCell(e.cellKey(le,re));e.colWidths.value[le]=100}S(ce)}function d(R,B){var le,re;const P=B-R+1,ce=k(R,B);for(let X=R;X<=B;X++)for(let U=0;U<e.rowCount;U++)e.delCell(e.cellKey(X,U));for(let X=R;X<e.colCount-P;X++){for(let U=0;U<e.rowCount;U++){const Ce=e.cellKey(X+P,U),we=e.cellKey(X,U);e.cells[Ce]?(e.cells[we]=e.cells[Ce],e.delCell(Ce)):e.delCell(we)}e.colWidths.value[X]=e.colWidths.value[X+P]}for(let X=e.colCount-P;X<e.colCount;X++){for(let U=0;U<e.rowCount;U++)e.delCell(e.cellKey(X,U));e.colWidths.value[X]=100}if(S(ce),R>0)for(let X=0;X<e.rowCount;X++)(le=e.syncCellBorders)==null||le.call(e,R-1,X),(re=e.syncCellBorders)==null||re.call(e,R,X)}function S(R){Object.keys(e.merges).forEach(B=>Reflect.deleteProperty(e.merges,B));for(const B of R)if(!(B.newRange.startCol>B.newRange.endCol||B.newRange.startRow>B.newRange.endRow)&&(e.merges[B.newAnchorKey]={...B.newRange},B.anchorCell)){const P=B.anchorCell.value,ce=B.anchorCell.style;P===""&&(!ce||Object.keys(ce).length===0)||(e.cells[B.newAnchorKey]={value:P,style:ce&&Object.keys(ce).length?{...ce}:null})}}function K(R,B){const P=B-R+1,ce=[];for(const le in e.merges){const re=e.merges[le];if(!re)continue;const X=e.cells[le]?{value:e.cells[le].value,style:e.cells[le].style?{...e.cells[le].style}:null}:{value:"",style:null},{startCol:U,endCol:Ce}=re;let{startRow:we,endRow:Pe}=re;if(we>B){we-=P,Pe-=P,ce.push({newAnchorKey:e.cellKey(U,we),newRange:{startCol:U,startRow:we,endCol:Ce,endRow:Pe}});continue}if(Pe<R){ce.push({newAnchorKey:le,newRange:{startCol:U,startRow:we,endCol:Ce,endRow:Pe}});continue}if(we>=R&&Pe<=B||(we>=R&&we<=B&&(we=R),Pe>=R&&Pe<=B?Pe=R-1:Pe>B&&(Pe-=P),we>Pe))continue;const Ke=U,D=we,H=e.cellKey(Ke,D),Q=le.split(",").map(Number)[1],ae=Q>=R&&Q<=B||Ke!==re.startCol||D!==Q;ce.push({newAnchorKey:H,newRange:{startCol:U,startRow:we,endCol:Ce,endRow:Pe},anchorCell:ae?X:void 0})}return ce}function k(R,B){const P=B-R+1,ce=[];for(const le in e.merges){const re=e.merges[le];if(!re)continue;const X=e.cells[le]?{value:e.cells[le].value,style:e.cells[le].style?{...e.cells[le].style}:null}:{value:"",style:null};let{startCol:U,endCol:Ce}=re;const{startRow:we,endRow:Pe}=re;if(U>B){U-=P,Ce-=P,ce.push({newAnchorKey:e.cellKey(U,we),newRange:{startCol:U,startRow:we,endCol:Ce,endRow:Pe}});continue}if(Ce<R){ce.push({newAnchorKey:le,newRange:{startCol:U,startRow:we,endCol:Ce,endRow:Pe}});continue}if(U>=R&&Ce<=B||(U>=R&&U<=B&&(U=R),Ce>=R&&Ce<=B?Ce=R-1:Ce>B&&(Ce-=P),U>Ce))continue;const Ke=U,D=we,H=e.cellKey(Ke,D),Q=le.split(",").map(Number)[0],ae=Q>=R&&Q<=B||Ke!==Q||D!==re.startRow;ce.push({newAnchorKey:H,newRange:{startCol:U,startRow:we,endCol:Ce,endRow:Pe},anchorCell:ae?X:void 0})}return ce}function A(R,B){const P=B-R+1,ce=[];for(const le in e.merges){const re=e.merges[le];if(!re)continue;const{startCol:X,endCol:U}=re;let{startRow:Ce,endRow:we}=re;we<R?ce.push({newAnchorKey:le,newRange:{startCol:X,startRow:Ce,endCol:U,endRow:we}}):Ce>B?(Ce+=P,we+=P,ce.push({newAnchorKey:e.cellKey(X,Ce),newRange:{startCol:X,startRow:Ce,endCol:U,endRow:we}})):(we+=P,ce.push({newAnchorKey:le,newRange:{startCol:X,startRow:Ce,endCol:U,endRow:we}}))}return ce}function E(R,B){const P=B-R+1,ce=[];for(const le in e.merges){const re=e.merges[le];if(!re)continue;let{startCol:X,endCol:U}=re;const{startRow:Ce,endRow:we}=re;U<R?ce.push({newAnchorKey:le,newRange:{startCol:X,startRow:Ce,endCol:U,endRow:we}}):X>B?(X+=P,U+=P,ce.push({newAnchorKey:e.cellKey(X,Ce),newRange:{startCol:X,startRow:Ce,endCol:U,endRow:we}})):(U+=P,ce.push({newAnchorKey:le,newRange:{startCol:X,startRow:Ce,endCol:U,endRow:we}}))}return ce}let x=0;function ne(){return x++,`s_${x}`}function y(R){return{id:ne(),name:R,cells:{},merges:{},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 q=t.ref([y("Sheet1")]),O=t.ref(0);function Z(){const R=q.value[O.value];R&&(R.cells={...e.cells},R.merges={...e.merges},R.selection=e.selection.value?{...e.selection.value}:null,R.activeCell={...e.activeCell.value},R.scrollX=e.scrollX.value,R.scrollY=e.scrollY.value,R.colWidths=[...e.colWidths.value],R.rowHeights=[...e.rowHeights.value])}function ie(R){const B=q.value[R];B&&(Object.keys(e.cells).forEach(P=>e.delCell(P)),Object.assign(e.cells,B.cells),Object.keys(e.merges).forEach(P=>Reflect.deleteProperty(e.merges,P)),B.merges&&Object.assign(e.merges,B.merges),e.selection.value=B.selection?{...B.selection}:null,e.activeCell.value={...B.activeCell},e.scrollX.value=B.scrollX,e.scrollY.value=B.scrollY,e.colWidths.value=[...B.colWidths],e.rowHeights.value=[...B.rowHeights],O.value=R)}function ee(R){R===O.value||R<0||R>=q.value.length||(e.cancelEdit(),Z(),ie(R))}function J(R){return r.saveUndo(),e.cancelEdit(),Z(),q.value.push(y(R??`Sheet${q.value.length+1}`)),ie(q.value.length-1),q.value.length-1}function te(R){return q.value.length<=1||(r.saveUndo(),e.cancelEdit(),q.value.splice(R,1),ie(Math.min(R,q.value.length-1))),O.value}function pe(R,B){q.value[R]&&B.trim()&&(r.saveUndo(),q.value[R].name=B.trim())}function We(R){r.saveUndo(),e.cancelEdit(),Z();const B=q.value[R];if(!B)return R;let P=B.name;const ce=P.match(/^(.*?)\s*\((\d+)\)$/);let le=ce?parseInt(ce[2],10)+1:2;ce&&(P=ce[1]);let re=`${P} (${le})`;const X=new Set(q.value.map(Ce=>Ce.name));for(;X.has(re);)le++,re=`${P} (${le})`;const U={id:ne(),name:re,cells:{...B.cells},merges:B.merges?{...B.merges}:{},selection:B.selection?{...B.selection}:null,activeCell:B.activeCell?{...B.activeCell}:{col:0,row:0},scrollX:B.scrollX,scrollY:B.scrollY,colWidths:[...B.colWidths],rowHeights:[...B.rowHeights]};return q.value.splice(R+1,0,U),ie(R+1),R+1}function ze(R,B){var re;const P=R+B;if(P<0||P>=q.value.length)return;r.saveUndo();const ce=O.value,le=q.value.splice(R,1)[0];q.value.splice(P,0,le),ce===R?O.value=P:R<ce&&P>=ce?O.value=ce-1:R>ce&&P<=ce&&(O.value=ce+1),(re=e.scheduleRender)==null||re.call(e)}const et=t.computed(()=>q.value.length);let Ue="";const qe=o;function se(){Z();const R=q.value.map(P=>{const ce={};for(const[U,Ce]of Object.entries(P.cells))ce[U]={value:Ce.value},Ce.style&&(ce[U].style=Ce.style);const le={name:P.name,cells:ce};P.merges&&Object.keys(P.merges).length&&(le.merges={...P.merges});const re={};for(let U=0;U<P.colWidths.length;U++)P.colWidths[U]!==100&&(re[U]=P.colWidths[U]);Object.keys(re).length&&(le.colWidths=re);const X={};for(let U=0;U<P.rowHeights.length;U++){const Ce=P.rowHeights[U];Ce!=null&&(X[U]=Ce)}return Object.keys(X).length&&(le.rowHeights=X),le}),B=JSON.stringify(R);B!==Ue&&(Ue=B,qe.value=R,c&&(c.value=B))}e.emitModelData=se;let z=!1;function u(){z||(z=!0,Promise.resolve().then(()=>{z=!1,se()}))}const h=t.computed(()=>e.props.theme==="dark"?vo:bo),Se=t.computed(()=>da(h.value,e.props.width,e.props.height,Ft)),He=t.computed(()=>{const R={};for(const[B,P]of Object.entries(Se.value))B.startsWith("--")&&(R[B]=P);return R}),Fe=t.ref(null),ut=t.ref(null),f=t.ref(null),b=t.ref(null),M=t.reactive({w:800,h:600});e.viewSize&&t.watch(M,R=>{e.viewSize&&(e.viewSize.w=R.w,e.viewSize.h=R.h)},{deep:!0});const T=48,a=28,p=11,_=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,M.w-T-p))),w=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,M.h-a-p)));function W(R,B){const P=Math.max(0,M.w-T-p),ce=Math.max(0,M.h-a-p);e.scrollX.value=Math.max(0,Math.min(R??e.scrollX.value,Math.max(0,e.totalWidth.value-P))),e.scrollY.value=Math.max(0,Math.min(B??e.scrollY.value,Math.max(0,e.totalHeight.value-ce)))}e.clampScroll=W;function Y(){var R;return typeof window>"u"?!1:!((R=window.matchMedia)!=null&&R.call(window,"(hover: none) and (pointer: coarse)").matches)}function Be(R=!1){t.nextTick(()=>{const B=f.value;if(B){if(!e.editingCell.value&&!Y()){document.activeElement===B&&B.blur();return}B.focus({preventScroll:!0}),R&&B.select()}})}function De(){Be()}function _e(){var B;const R=e.selection.value;if(R){r.saveUndo();for(let P=R.startRow;P<=R.endRow;P++)e.rowHeights.value[P]=void 0;(B=e.scheduleRender)==null||B.call(e),se()}}function Ee(){var B;const R=e.selection.value;if(R){r.saveUndo();for(let P=R.startCol;P<=R.endCol;P++)e.colWidths.value[P]=100;(B=e.scheduleRender)==null||B.call(e),se()}}return{deleteRows:s,insertRows:n,insertCols:v,deleteCols:d,sheets:q,activeSheetIndex:O,saveSheet:Z,loadSheet:ie,switchSheet:ee,addSheet:J,removeSheet:te,renameSheet:pe,dupSheet:We,moveSheet:ze,sheetCount:et,mkSheet:y,emitModelData:se,scheduleOptEmit:u,themeColors:h,outerStyle:Se,toolbarThemeVars:He,wrapperRef:Fe,canvasRef:ut,editInputRef:f,formulaBarRef:b,viewSize:M,maxScrollX:_,maxScrollY:w,clampScroll:W,canFocusHiddenEditor:Y,focusEditInput:Be,onCanvasFocus:De,resetRowHeight:_e,resetColWidth:Ee,modelData:qe}}function fa(e,r,o,l,c){let s=!1,n=null,v=1;function d(){s||(s=!0,requestAnimationFrame(()=>{s=!1,K()}))}e.scheduleRender=d;const S="#444";function K(){var Sl,$t,Qt,xt,Nt,el,eo,to,lo,oo,no;const i=l.canvasRef.value;if(!i)return;const m=l.wrapperRef.value;if(!m||(n=i.getContext("2d"),!n))return;v=window.devicePixelRatio||1;const I=m.getBoundingClientRect(),$=I.width,g=I.height;l.viewSize.w=$,l.viewSize.h=g,i.width=$*v,i.height=g*v,i.style.width=$+"px",i.style.height=g+"px",n.setTransform(v,0,0,v,0,0);const F=e.scrollX.value,ue=e.scrollY.value,ye=52,me=24,Ne=l.themeColors.value,ct=e.colPositions.value,lt=e.rowPositions.value,ht=e.colWidths.value,mt=[];for(let j=0;j<e.rowCount;j++)mt[j]=lt[j+1]-lt[j];const Bt=Math.max(0,e.hitCol(F));let Gt=Bt;for(let j=Bt;j<e.colCount&&!(ye+ct[j]-F>=$);j++)Gt=j;const Mt=Gt,vt=Math.max(0,e.hitRow(ue));let cl=vt;for(let j=vt;j<e.rowCount&&!(me+lt[j]-ue>=g);j++)cl=j;const yt=cl;let Lt=Bt,It=vt;for(const j in e.merges){const oe=e.merges[j];oe&&(oe.startRow>yt||oe.endRow<vt||oe.startCol>Mt||oe.endCol<Bt||(oe.startCol<Lt&&(Lt=oe.startCol),oe.startRow<It&&(It=oe.startRow)))}n.fillStyle=Ne.bg,n.fillRect(0,0,$,g),n.fillStyle=Ne.gridBg,n.fillRect(ye,me,$-ye,g-me),n.save(),n.beginPath(),n.rect(ye,me,$-ye,g-me),n.clip();const ft=e.selection.value,Jt=e.editingCell.value;for(let j=It;j<=yt;j++)for(let oe=Lt;oe<=Mt;oe++){const Re=e.findMerge(oe,j);if(Re&&!(oe===Re.range.startCol&&j===Re.range.startRow))continue;const Le=ye+ct[oe]-F,Ie=me+lt[j]-ue;let Ye=ht[oe],je=mt[j];if(Re&&(Ye=ct[Re.range.endCol+1]-ct[oe],je=lt[Re.range.endRow+1]-lt[j]),Le+Ye<ye||Ie+je<me||Le>$||Ie>g)continue;const Je=(Sl=e.cells[e.cellKey(oe,j)])==null?void 0:Sl.style,St=typeof(Je==null?void 0:Je.backgroundColor)=="string"?Je.backgroundColor:"";if(St&&(n.fillStyle=St,n.fillRect(Le,Ie,Ye,je)),e.isSelected(oe,j)&&(n.fillStyle=Ne.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?n.fillRect(Le,Ie,ht[oe],mt[j]):n.fillRect(Le,Ie,Ye,je)),e.activeCell.value.col===oe&&e.activeCell.value.row===j&&(n.strokeStyle=Ne.activeCellBorder,n.lineWidth=2,n.strokeRect(Le+1,Ie+1,Ye-2,je-2)),n.strokeStyle=Ne.gridLine,n.lineWidth=.5,n.strokeRect(Le+.25,Ie+.25,Ye-.5,je-.5),!(Jt&&Jt.col===oe&&Jt.row===j)){const ke=($t=e.cells[e.cellKey(oe,j)])==null?void 0:$t.style,bt=e.getCellValue(oe,j),at=typeof(ke==null?void 0:ke.numberFormat)=="string"?ke.numberFormat:"",Xe=bt?hl(bt,at,e.locale.value):"";if(Xe){const ot=e.cellFontSize(oe,j),Qe=typeof(ke==null?void 0:ke.fontFamily)=="string"&&ke.fontFamily?ke.fontFamily:Pt,dt=(ke==null?void 0:ke.fontWeight)==="bold"?"bold":"normal",$e=(ke==null?void 0:ke.fontStyle)==="italic"?"italic":"normal",pt=(ke==null?void 0:ke.underline)==="underline",Ct=(ke==null?void 0:ke.strikethrough)==="line-through",nt=typeof(ke==null?void 0:ke.color)=="string"?ke.color:"",Kt=typeof(ke==null?void 0:ke.textAlign)=="string"?ke.textAlign:zl(bt,at)?"right":"left",tl=typeof(ke==null?void 0:ke.verticalAlign)=="string"?ke.verticalAlign:"top";n.fillStyle=nt||Ne.cellText,n.font=`${$e} ${dt} ${ot}px ${Qe}`,n.textBaseline="alphabetic",n.save(),n.beginPath(),n.rect(Le+5,Ie+1,Ye-10,je-2),n.clip();const ll=(ke==null?void 0:ke.wrap)==="wrap",sl=Ye-10;let Tl=Xe;const Ya=!ll&&Oo(at),ro=Xe===gl||Lo(bt,at);if(ro||Ya){if(ro){const Wt=Math.max(1,n.measureText("#").width),ol=Math.max(1,Math.floor(sl/Wt));Tl="#".repeat(ol)}else if(e.getWrappedLines(n,Xe,1e9,!1).some(Tt=>Tt&&n.measureText(Tt).width>sl)){const Tt=Math.max(1,n.measureText("#").width),Ut=Math.max(1,Math.floor(sl/Tt));Tl="#".repeat(Ut)}}const dl=e.getWrappedLines(n,Tl,sl,ll),{ascent:ul,descent:fl}=e.measureFontMetrics(Qe,ot,dt,$e),ml=ul+fl,Xa=dl.length*ml;let pl;tl==="middle"?pl=Ie+(je-Xa)/2+ul:tl==="bottom"?pl=Ie+je-e.BASE_CELL_VPAD-fl-(dl.length-1)*ml:pl=Ie+e.BASE_CELL_VPAD+ul;for(let Wt=0;Wt<dl.length;Wt++){const ol=dl[Wt],Tt=pl+Wt*ml,Ut=n.measureText(ol);let At;if(Kt==="center"?At=Le+Ye/2-Ut.width/2:Kt==="right"?At=Le+Ye-5-Ut.width:At=Le+5,n.fillText(ol,At,Tt),pt&&(n.strokeStyle=nt||Ne.cellText,n.lineWidth=1,n.beginPath(),n.moveTo(At,Tt+fl+1),n.lineTo(At+Ut.width,Tt+fl+1),n.stroke()),Ct){n.strokeStyle=nt||Ne.cellText,n.lineWidth=1;const ao=Tt-ul+ml*.42;n.beginPath(),n.moveTo(At,ao),n.lineTo(At+Ut.width,ao),n.stroke()}}n.restore()}}}for(let j=It;j<=yt;j++)for(let oe=Lt;oe<=Mt;oe++){const Re=e.findMerge(oe,j);if(Re&&!(oe===Re.range.startCol&&j===Re.range.startRow))continue;const Le=ye+ct[oe]-F,Ie=me+lt[j]-ue;let Ye=ht[oe],je=mt[j];if(Re&&(Ye=ct[Re.range.endCol+1]-ct[oe],je=lt[Re.range.endRow+1]-lt[j]),Le+Ye<ye||Ie+je<me||Le>$||Ie>g)continue;const Je=(Qt=e.cells[e.cellKey(oe,j)])==null?void 0:Qt.style,St=(Je==null?void 0:Je.borderTopWidth)||0,ke=(Je==null?void 0:Je.borderLeftWidth)||0,bt=(Je==null?void 0:Je.borderBottomWidth)||0,at=(Je==null?void 0:Je.borderRightWidth)||0;if(n.fillStyle=S,Re){const Xe=Re.range.startRow,ot=Re.range.endRow,Qe=Re.range.startCol,dt=Re.range.endCol;for(let $e=Qe;$e<=dt;$e++){const pt=ye+ct[$e]-F,Ct=ht[$e],nt=Math.max(St,o.cellBorderWidth($e,Xe-1,"Bottom"));nt>0&&n.fillRect(pt,Ie,Ct,nt)}for(let $e=Qe;$e<=dt;$e++){const pt=ye+ct[$e]-F,Ct=ht[$e],nt=Math.max(bt,o.cellBorderWidth($e,ot+1,"Top"));nt>0&&n.fillRect(pt,Ie+je-nt,Ct,nt)}for(let $e=Xe;$e<=ot;$e++){const pt=me+lt[$e]-ue,Ct=mt[$e],nt=Math.max(ke,o.cellBorderWidth(Qe-1,$e,"Right"));nt>0&&n.fillRect(Le,pt,nt,Ct)}for(let $e=Xe;$e<=ot;$e++){const pt=me+lt[$e]-ue,Ct=mt[$e],nt=Math.max(at,o.cellBorderWidth(dt+1,$e,"Left"));nt>0&&n.fillRect(Le+Ye-nt,pt,nt,Ct)}}else{const Xe=Math.max(St,o.cellBorderWidth(oe,j-1,"Bottom")),ot=Math.max(ke,o.cellBorderWidth(oe-1,j,"Right")),Qe=Math.max(bt,o.cellBorderWidth(oe,j+1,"Top")),dt=Math.max(at,o.cellBorderWidth(oe+1,j,"Left"));(Xe>0||ot>0||Qe>0||dt>0)&&(Xe>0&&n.fillRect(Le,Ie,Ye,Xe),Qe>0&&n.fillRect(Le,Ie+je-Qe,Ye,Qe),ot>0&&n.fillRect(Le,Ie,ot,je),dt>0&&n.fillRect(Le+Ye-dt,Ie,dt,je))}}for(let j=It;j<=yt;j++)for(let oe=Lt;oe<=Mt;oe++){const Re=e.findMerge(oe,j);if(Re&&!(oe===Re.range.startCol&&j===Re.range.startRow))continue;const Le=ye+ct[oe]-F,Ie=me+lt[j]-ue;let Ye=ht[oe],je=mt[j];if(Re&&(Ye=ct[Re.range.endCol+1]-ct[oe],je=lt[Re.range.endRow+1]-lt[j]),Le+Ye<ye||Ie+je<me||Le>$||Ie>g)continue;const Je=((Nt=(xt=e.cells[e.cellKey(oe,j)])==null?void 0:xt.style)==null?void 0:Nt.borderTopWidth)||0,St=((eo=(el=e.cells[e.cellKey(oe,j)])==null?void 0:el.style)==null?void 0:eo.borderLeftWidth)||0,ke=((lo=(to=e.cells[e.cellKey(oe,j)])==null?void 0:to.style)==null?void 0:lo.borderBottomWidth)||0,bt=((no=(oo=e.cells[e.cellKey(oe,j)])==null?void 0:oo.style)==null?void 0:no.borderRightWidth)||0;if(n.fillStyle=S,Re){const at=Re.range.startRow,Xe=Re.range.endRow,ot=Re.range.startCol,Qe=Re.range.endCol,dt=Math.max(Je,o.cellBorderWidth(ot,at-1,"Bottom")),$e=Math.max(St,o.cellBorderWidth(ot-1,at,"Right"));dt>0&&$e>0&&n.fillRect(Le-$e,Ie-dt,$e,dt);const pt=Math.max(Je,o.cellBorderWidth(Qe,at-1,"Bottom")),Ct=Math.max(bt,o.cellBorderWidth(Qe+1,at,"Left"));pt>0&&Ct>0&&n.fillRect(Le+Ye,Ie-pt,Ct,pt);const nt=Math.max(ke,o.cellBorderWidth(ot,Xe+1,"Top")),Kt=Math.max(St,o.cellBorderWidth(ot-1,Xe,"Right"));nt>0&&Kt>0&&n.fillRect(Le-Kt,Ie+je,Kt,nt);const tl=Math.max(ke,o.cellBorderWidth(Qe,Xe+1,"Top")),ll=Math.max(bt,o.cellBorderWidth(Qe+1,Xe,"Left"));tl>0&&ll>0&&n.fillRect(Le+Ye,Ie+je,ll,tl)}else{const at=Math.max(Je,o.cellBorderWidth(oe,j-1,"Bottom")),Xe=Math.max(St,o.cellBorderWidth(oe-1,j,"Right")),ot=Math.max(ke,o.cellBorderWidth(oe,j+1,"Top")),Qe=Math.max(bt,o.cellBorderWidth(oe+1,j,"Left"));at>0&&Xe>0&&n.fillRect(Le-Xe,Ie-at,Xe,at),at>0&&Qe>0&&n.fillRect(Le+Ye,Ie-at,Qe,at),ot>0&&Xe>0&&n.fillRect(Le-Xe,Ie+je,Xe,ot),ot>0&&Qe>0&&n.fillRect(Le+Ye,Ie+je,Qe,ot)}}n.restore(),n.fillStyle=Ne.headerBg,n.fillRect(ye,0,$-ye,me);for(let j=Bt;j<=Mt;j++){const oe=ye+ct[j]-F,Re=ht[j];oe+Re<ye||oe>$||(ft&&j>=ft.startCol&&j<=ft.endCol&&(n.fillStyle=Ne.selectionBg,n.fillRect(oe,0,Re,me)),n.strokeStyle=Ne.headerBorder,n.lineWidth=.5,n.strokeRect(oe+.25,.25,Re-.5,me-.5),ft&&j>=ft.startCol&&j<=ft.endCol&&(n.strokeStyle=Ne.activeCellBorder,n.lineWidth=2,n.beginPath(),n.moveTo(oe,me-1),n.lineTo(oe+Re,me-1),n.stroke()),n.fillStyle=Ne.headerText,n.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',n.textAlign="center",n.textBaseline="middle",n.fillText(Ge(j),oe+Re/2,me/2))}n.strokeStyle=Ne.headerSep,n.lineWidth=1,n.beginPath(),n.moveTo(ye,me+.5),n.lineTo($,me+.5),n.stroke(),n.fillStyle=Ne.headerBg,n.fillRect(0,me,ye,g-me);for(let j=vt;j<=yt;j++){const oe=me+lt[j]-ue,Re=mt[j];oe+Re<me||oe>g||(ft&&j>=ft.startRow&&j<=ft.endRow&&(n.fillStyle=Ne.selectionBg,n.fillRect(0,oe,ye,Re)),n.strokeStyle=Ne.headerBorder,n.lineWidth=.5,n.strokeRect(.25,oe+.25,ye-.5,Re-.5),ft&&j>=ft.startRow&&j<=ft.endRow&&(n.strokeStyle=Ne.activeCellBorder,n.lineWidth=2,n.beginPath(),n.moveTo(ye-1,oe),n.lineTo(ye-1,oe+Re),n.stroke()),n.fillStyle=Ne.headerText,n.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',n.textAlign="center",n.textBaseline="middle",n.fillText(String(j+1),ye/2,oe+Re/2+.5))}n.strokeStyle=Ne.headerSep,n.lineWidth=1,n.beginPath(),n.moveTo(ye+.5,me),n.lineTo(ye+.5,g),n.stroke(),n.fillStyle=Ne.headerBg,n.fillRect(0,0,ye,me),n.strokeStyle=Ne.headerSep,n.lineWidth=1,n.strokeRect(.5,.5,ye-.5,me-.5)}const k=t.computed(()=>Ge(e.activeCell.value.col)+String(e.activeCell.value.row+1)),A=t.ref(""),E=t.ref(!1),x=t.computed(()=>e.editingCell.value?A.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(i,m)=>{if(i&&!m){const I=e.editValue.value||e.getCellRaw(i.col,i.row)||"";A.value=I,O=!1}else!i&&m&&(A.value="",E.value=!1,O=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(A.value="",O=!1)});function ne(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),d())}function y(i){const m=i.target.value;A.value=m,O=!0,e.editingCell.value||e.startEdit()}let q=!1,O=!1;function Z(){var F,ue,ye,me,Ne,ct,lt,ht,mt;if(q)return;const i=l.formulaBarRef.value,m=!!(i&&typeof document<"u"&&document.activeElement===i);if(!e.editingCell.value&&!m&&!O)return;const I={...e.activeCell.value},$=e.editingCell.value?e.editingCell.value.col:I.col,g=e.editingCell.value?e.editingCell.value.row:I.row;if(!e.editingCell.value){const Bt=e.getCellRaw($,g),Gt=A.value!==Bt;if(!O)return;q=!0,Gt&&((F=e.saveUndo)==null||F.call(e),e.setCellValue($,g,A.value),d(),(ue=l.emitModelData)==null||ue.call(l)),(ye=l.formulaBarRef.value)==null||ye.blur(),A.value="",E.value=!1,O=!1,t.nextTick(()=>{q=!1});return}q=!0,O?(e.editValue.value=A.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(me=l.formulaBarRef.value)==null||me.blur(),A.value="",E.value=!1,O=!1,d(),l.focusEditInput(),(Ne=l.emitModelData)==null||Ne.call(l),t.nextTick(()=>{q=!1})):m?(A.value=e.editValue.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(ct=l.formulaBarRef.value)==null||ct.blur(),A.value="",E.value=!1,O=!1,d(),l.focusEditInput(),(lt=l.emitModelData)==null||lt.call(l),t.nextTick(()=>{q=!1})):(e.commitEdit(),(ht=l.formulaBarRef.value)==null||ht.blur(),A.value="",E.value=!1,O=!1,d(),l.focusEditInput(),(mt=l.emitModelData)==null||mt.call(l),t.nextTick(()=>{q=!1}))}function ie(){var i;q||(q=!0,e.editingCell.value&&e.cancelEdit(),(i=l.formulaBarRef.value)==null||i.blur(),A.value="",E.value=!1,O=!1,d(),l.focusEditInput(),t.nextTick(()=>{q=!1}))}function ee(i){if(!i.isComposing){if(i.key==="Enter"&&(i.altKey||i.metaKey)&&!i.ctrlKey){i.preventDefault(),i.stopPropagation();const m=i.target;if(!m)return;e.editingCell.value||e.startEdit();const I=m.selectionStart??m.value.length,$=m.selectionEnd??m.value.length,g=m.value,F=g.substring(0,I)+`
7
- `+g.substring($),ue=I+1;A.value=F,E.value||(E.value=!0),t.nextTick(()=>{try{m.setSelectionRange(ue,ue)}catch{}if(E.value)try{m.scrollTop=m.scrollHeight}catch{}try{m.focus({preventScroll:!0})}catch{}});return}i.key==="Enter"?(i.preventDefault(),Z()):i.key==="Escape"&&(i.preventDefault(),ie())}}function J(){Z()}const te=t.ref(null),pe=t.ref("");function We(i){te.value===null&&(l.switchSheet(i),d())}function ze(i){i!==l.activeSheetIndex.value&&(l.saveSheet(),l.loadSheet(i),d()),te.value=i,pe.value=l.sheets.value[i].name,t.nextTick(()=>{const m=document.querySelector(".tab-rename-input");m==null||m.focus(),m==null||m.select()})}function et(){te.value!==null&&(l.renameSheet(te.value,pe.value),t.nextTick(()=>l.emitModelData())),te.value=null,pe.value=""}function Ue(){te.value=null,pe.value=""}function qe(i){i.key==="Enter"?(i.preventDefault(),et()):i.key==="Escape"&&(i.preventDefault(),Ue())}const se=t.ref(null);let z=null;function u(){z&&(document.removeEventListener("click",z),z=null)}function h(i,m,I){u();const $=140,g=I.length*28+8,F=window.innerWidth,ue=window.innerHeight;i+$>F&&(i-=$),m+g>ue&&(m-=g),se.value={x:i,y:m,items:I},z=()=>{se.value=null,u()},setTimeout(()=>document.addEventListener("click",z,{once:!0}),0)}const Se=t.ref(!1);function He(i,m){if(!m.children){Se.value=!1;return}const $=i.currentTarget.querySelector(".context-submenu");if(!$){Se.value=!1;return}const g=$.getBoundingClientRect();Se.value=g.right>window.innerWidth}function Fe(i,m){i.preventDefault(),i.stopPropagation(),h(i.clientX,i.clientY,[{label:V(e.locale.value,"insert"),action:()=>{l.addSheet(),d()}},{label:V(e.locale.value,"copy"),action:()=>{l.dupSheet(m)}},{label:V(e.locale.value,"rename"),action:()=>{ze(m)}},{label:V(e.locale.value,"delete"),action:()=>{l.removeSheet(m),d()},disabled:l.sheetCount.value<=1},{label:V(e.locale.value,"moveSheetLeft"),action:()=>{l.moveSheet(m,-1)},disabled:m===0},{label:V(e.locale.value,"moveSheetRight"),action:()=>{l.moveSheet(m,1)},disabled:m===l.sheets.value.length-1}])}function ut(i){i.preventDefault(),!(i.target.closest(".tab-item")||i.target.closest(".tab-bar__add-btn"))&&h(i.clientX,i.clientY,[{label:V(e.locale.value,"insert"),action:()=>{l.addSheet(),d()}}])}function f(i){i.preventDefault(),e.selectAll(),d(),h(i.clientX,i.clientY,[{label:V(e.locale.value,"cut"),action:()=>{o.cutSelected(),l.emitModelData()}},{label:V(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:V(e.locale.value,"paste"),action:()=>{r.saveUndo(),o.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>l.emitModelData())})}},{label:V(e.locale.value,"delete"),action:()=>{r.saveUndo(),o.clearSelected();for(let m=0;m<e.colCount;m++)e.colWidths.value[m]=100;for(let m=0;m<e.rowCount;m++)e.rowHeights.value[m]=void 0;d(),l.emitModelData()}}])}function b(i,m){i.preventDefault();const I=i.clientX,$=i.clientY,g=e.selection.value;g&&g.startCol===0&&g.endCol===e.colCount-1&&m>=g.startRow&&m<=g.endRow||(e.selectRange(0,m,e.colCount-1,m,"row"),d());const F=e.selection.value;h(i.clientX,i.clientY,[{label:V(e.locale.value,"insert"),action:()=>{r.saveUndo(),l.insertRows(F.startRow,F.endRow),d(),l.emitModelData()},disabled:F.endRow>=e.rowCount-1},{label:V(e.locale.value,"cut"),action:()=>{r.saveUndo(),o.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,F.startRow,F.endRow),d(),l.emitModelData()}},{label:V(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:V(e.locale.value,"paste"),action:()=>{r.saveUndo(),o.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>l.emitModelData())})}},{label:V(e.locale.value,"delete"),action:()=>{r.saveUndo(),l.deleteRows(F.startRow,F.endRow),d(),l.emitModelData()}},{label:`${V(e.locale.value,"rowHeight")}...`,action:()=>W("row",I,$)},{label:V(e.locale.value,"autoRowHeight"),action:()=>l.resetRowHeight()}])}function M(i,m){i.preventDefault();const I=i.clientX,$=i.clientY,g=e.selection.value;g&&g.startRow===0&&g.endRow===e.rowCount-1&&m>=g.startCol&&m<=g.endCol||(e.selectRange(m,0,m,e.rowCount-1,"col"),d());const F=e.selection.value;h(i.clientX,i.clientY,[{label:V(e.locale.value,"insert"),action:()=>{r.saveUndo(),l.insertCols(F.startCol,F.endCol),d(),l.emitModelData()},disabled:F.endCol>=e.colCount-1},{label:V(e.locale.value,"cut"),action:()=>{r.saveUndo(),o.copyRowCol(),e.clearCellsInRange(F.startCol,F.endCol,0,e.rowCount-1),d(),l.emitModelData()}},{label:V(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:V(e.locale.value,"paste"),action:()=>{r.saveUndo(),o.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>l.emitModelData())})}},{label:V(e.locale.value,"delete"),action:()=>{r.saveUndo(),l.deleteCols(F.startCol,F.endCol),d(),l.emitModelData()}},{label:`${V(e.locale.value,"colWidth")}...`,action:()=>W("col",I,$)},{label:V(e.locale.value,"defaultColWidth"),action:()=>l.resetColWidth()}])}function T(i,m,I){i.preventDefault(),e.isSelected(m,I)||(e.selectCell(m,I),d());const $=e.selection.value,g=!!($&&$.startCol===$.endCol&&$.startRow===$.endRow);h(i.clientX,i.clientY,[{label:V(e.locale.value,"cut"),action:()=>{o.cutSelected(),l.emitModelData()}},{label:V(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:V(e.locale.value,"paste"),action:()=>{r.saveUndo(),o.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>l.emitModelData())})}},{label:V(e.locale.value,"delete"),action:()=>{r.saveUndo(),o.clearSelected(),d(),l.emitModelData()}},{label:V(e.locale.value,"calculate"),children:[{label:V(e.locale.value,"sum"),action:o.sumSelected,disabled:g},{label:V(e.locale.value,"avg"),action:o.avgSelected,disabled:g},{label:V(e.locale.value,"count"),action:o.countSelected,disabled:g}]}])}const a=t.ref(null),p=t.ref(null);let _=null;function w(){_&&(document.removeEventListener("mousedown",_),_=null)}function W(i,m,I){w();const $=e.selection.value;let g="";if($){const Ne=i==="row"?e.getRowHeight($.startRow):e.colWidths.value[$.startCol];g=Ne!=null&&Ne>0?String(Math.round(Ne)):""}const F=220,ue=118;let ye=m,me=I;ye+F>window.innerWidth&&(ye=window.innerWidth-F-8),me+ue>window.innerHeight&&(me=window.innerHeight-ue-8),ye<8&&(ye=8),me<8&&(me=8),p.value={type:i,x:ye,y:me,value:g,error:""},_=()=>{p.value=null},setTimeout(()=>document.addEventListener("mousedown",_,{once:!0}),0),t.nextTick(()=>{const Ne=a.value;Ne&&(Ne.focus(),Ne.select())})}function Y(i){const m=p.value;if(!m)return;const I=i.target,$=I.value,g=$.replace(/[^\d]/g,"");m.value=g,$!==g&&(I.value=g),m.error=""}function Be(i){i.key==="Enter"?(i.preventDefault(),_e()):i.key==="Escape"&&(i.preventDefault(),Ee())}function De(){const i=p.value;if(!i)return;const m=i.value.trim(),I=Number(m),$=i.type==="row",g=$?24:30,F=$?500:1e3;if(m===""||!Number.isFinite(I)){Ee();return}const ue=Math.max(g,Math.min(F,Math.round(I)));i.value=String(ue),i.error=""}function _e(){const i=p.value,m=e.selection.value;if(!i||!m)return;const I=i.value.trim(),$=Number(I),g=i.type==="row",F=g?24:30,ue=g?500:1e3;if(I===""||!Number.isFinite($)){i.error=V(e.locale.value,"dimNumberError");return}if($<F||$>ue){i.error=V(e.locale.value,"dimRangeError").replace("{min}",String(F)).replace("{max}",String(ue));return}const ye=$;if(r.saveUndo(),g)for(let me=m.startRow;me<=m.endRow;me++)e.rowHeights.value[me]=ye;else for(let me=m.startCol;me<=m.endCol;me++)e.colWidths.value[me]=ye;d(),l.emitModelData(),Ee()}function Ee(){w(),p.value=null}const R=t.computed(()=>{var el;const i=!e.editingCell.value,m=e.editingCell.value??e.activeCell.value,I=m.col,$=m.row,g=(el=e.cells[e.cellKey(I,$)])==null?void 0:el.style,F=e.cellFontSize(I,$),ue=typeof(g==null?void 0:g.fontFamily)=="string"&&g.fontFamily?g.fontFamily:Pt,ye=(g==null?void 0:g.fontWeight)==="bold"?"bold":"normal",me=(g==null?void 0:g.fontStyle)==="italic"?"italic":"normal",Ne=(g==null?void 0:g.underline)==="underline"?"underline":(g==null?void 0:g.strikethrough)==="line-through"?"line-through":"none",ct=(g==null?void 0:g.underline)==="underline"&&(g==null?void 0:g.strikethrough)==="line-through"?"underline line-through":Ne,lt=typeof(g==null?void 0:g.color)=="string"?g.color:void 0,ht=typeof(g==null?void 0:g.backgroundColor)=="string"?g.backgroundColor:void 0,mt=typeof(g==null?void 0:g.numberFormat)=="string"?g.numberFormat:"",Bt=e.editValue.value??e.getCellValue(I,$),Gt=typeof(g==null?void 0:g.textAlign)=="string"?g.textAlign:zl(Bt,mt)?"right":"left",Mt=typeof(g==null?void 0:g.verticalAlign)=="string"?g.verticalAlign:"top",vt=e.findMerge(I,$),cl=vt?e.colPositions.value[vt.range.endCol+1]-e.colPositions.value[I]:e.colWidths.value[I],yt=vt?e.rowPositions.value[vt.range.endRow+1]-e.rowPositions.value[$]:e.getRowHeight($),Lt=2,{ascent:It,descent:ft}=e.measureFontMetrics(ue,F,ye,me),Jt=It+ft,$t=(e.editValue.value?e.editValue.value.split(`
8
- `).length:1)*Jt,Qt=e.BASE_CELL_VPAD-Lt;let xt=0,Nt=0;return Mt==="middle"?(xt=Math.floor((yt-$t)/2),Nt=Math.max(0,yt-$t-xt)):Mt==="top"?(xt=Qt,Nt=Math.max(0,yt-$t-xt)):Mt==="bottom"&&(Nt=Qt,xt=Math.max(0,yt-$t-Nt)),{left:`${52+e.colPositions.value[I]-e.scrollX.value}px`,top:`${24+e.rowPositions.value[$]-e.scrollY.value}px`,width:`${cl}px`,height:`${yt}px`,fontFamily:ue,fontSize:`${F}px`,lineHeight:1,fontWeight:ye,fontStyle:me,textDecoration:ct,textAlign:Gt,paddingTop:`${xt}px`,paddingRight:"3px",paddingBottom:`${Nt}px`,paddingLeft:"3px",opacity:i?0:1,pointerEvents:i?"none":"auto",color:i?"transparent":lt,caretColor:i?"transparent":void 0,borderColor:i?"transparent":void 0,background:i?"transparent":ht,boxShadow:i?"none":void 0}});function B(){return Math.max(0,l.viewSize.w-52-11)}function P(){return Math.max(0,l.viewSize.h-24-11)}const ce=t.computed(()=>B()),le=t.computed(()=>P()),re=t.computed(()=>Math.max(0,ce.value-11*2)),X=t.computed(()=>Math.max(0,le.value-11*2)),U=t.computed(()=>l.maxScrollX.value<=0?re.value:Math.max(24,B()/e.totalWidth.value*re.value)),Ce=t.computed(()=>l.maxScrollX.value<=0?0:e.scrollX.value/l.maxScrollX.value*(re.value-U.value)),we=t.computed(()=>l.maxScrollY.value<=0?X.value:Math.max(24,P()/e.totalHeight.value*X.value)),Pe=t.computed(()=>l.maxScrollY.value<=0?0:e.scrollY.value/l.maxScrollY.value*(X.value-we.value));let Ke=null,D=0,H=0;function L(i){i.preventDefault(),Ke="v",D=i.clientY,H=e.scrollY.value,document.addEventListener("mousemove",ae),document.addEventListener("mouseup",ve)}function Q(i){i.preventDefault(),Ke="h",D=i.clientX,H=e.scrollX.value,document.addEventListener("mousemove",ae),document.addEventListener("mouseup",ve)}function ae(i){if(Ke==="v"){const I=(i.clientY-D)/(X.value-we.value);l.clampScroll(null,H+I*l.maxScrollY.value),d()}else if(Ke==="h"){const I=(i.clientX-D)/(re.value-U.value);l.clampScroll(H+I*l.maxScrollX.value,null),d()}}function ve(){Ke=null,document.removeEventListener("mousemove",ae),document.removeEventListener("mouseup",ve)}function xe(i){if(Ke)return;const m=i.currentTarget.getBoundingClientRect(),I=i.clientY-m.top;I<Pe.value?l.clampScroll(null,e.scrollY.value-P()):I>Pe.value+we.value&&l.clampScroll(null,e.scrollY.value+P()),d()}function Ve(i){if(Ke)return;const m=i.currentTarget.getBoundingClientRect(),I=i.clientX-m.left;I<Ce.value?l.clampScroll(e.scrollX.value-B(),null):I>Ce.value+U.value&&l.clampScroll(e.scrollX.value+B(),null),d()}let Ae=!1,Oe=0,Me=0,C=!1,N=!1,G=0,ge=0,fe=0,de=0,he=0,be=0,Te=0,tt=0,it=!1,st=!1,Ze=0,rt=0,Rt="cell",Rl=0,Zl=-1,ql=-1;function Da(i){if(i.button!==0)return;i.preventDefault(),se.value=null;const m=Vt(i,l.canvasRef.value);if(m.y<24&&m.x>=52){const g=m.x-52+e.scrollX.value,F=e.hitCol(g);if(F>=0&&Math.abs(m.x-(52+e.colPositions.value[F+1]-e.scrollX.value))<=4){r.saveUndo(),C=!0,G=F,fe=e.colWidths.value[F],de=g,d();return}}if(m.x<52&&m.y>=24){const g=m.y-24+e.scrollY.value,F=e.hitRow(g);if(F>=0&&Math.abs(m.y-(24+e.rowPositions.value[F+1]-e.scrollY.value))<=4){r.saveUndo(),N=!0,ge=F,fe=e.getRowHeight(F),de=g,d();return}}if(m.x<52||m.y<24){{const g=l.formulaBarRef.value,F=!!(g&&typeof document<"u"&&document.activeElement===g);(e.editingCell.value||F||O)&&Z()}if(m.y<24&&m.x>=52){const g=e.hitCol(m.x-52+e.scrollX.value);g>=0&&(e.selectRange(g,0,g,e.rowCount-1,"col"),Ae=!0,Oe=g,Me=0)}else if(m.x<52&&m.y>=24){const g=e.hitRow(m.y-24+e.scrollY.value);g>=0&&(e.selectRange(0,g,e.colCount-1,g,"row"),Ae=!0,Oe=0,Me=g)}else m.x<52&&m.y<24&&e.selectAll();d();return}const I=e.hitCol(m.x-52+e.scrollX.value),$=e.hitRow(m.y-24+e.scrollY.value);if(!(I<0||$<0)){{const g=l.formulaBarRef.value,F=!!(g&&typeof document<"u"&&document.activeElement===g);(e.editingCell.value||F||O)&&Z()}if(i.shiftKey&&e.selection.value){const g=e.selection.value;e.selectRange(g.startCol,g.startRow,I,$)}else e.selectCell(I,$);Ae=!0,Oe=I,Me=$,l.focusEditInput(),d()}}function Na(i){if(C){const F=Vt(i,l.canvasRef.value).x-52+e.scrollX.value-de,ue=fe+F;ue>=30&&ue<=1e3?e.colWidths.value[G]=ue:ue<30?e.colWidths.value[G]=30:e.colWidths.value[G]=1e3,d();return}if(N){const F=Vt(i,l.canvasRef.value).y-24+e.scrollY.value-de,ue=fe+F;ue>=24&&ue<=500?e.rowHeights.value[ge]=ue:ue<24?e.rowHeights.value[ge]=24:e.rowHeights.value[ge]=500,d();return}if(!Ae){const g=l.canvasRef.value;if(!g)return;if(r.paintFmt.value){g.style.cursor="copy";return}const F=Vt(i,g);if(F.y<24&&F.x>=52){const ue=e.hitCol(F.x-52+e.scrollX.value);if(ue>=0&&Math.abs(F.x-(52+e.colPositions.value[ue+1]-e.scrollX.value))<=4){g.style.cursor="col-resize";return}}if(F.x<52&&F.y>=24){const ue=e.hitRow(F.y-24+e.scrollY.value);if(ue>=0&&Math.abs(F.y-(24+e.rowPositions.value[ue+1]-e.scrollY.value))<=4){g.style.cursor="row-resize";return}}g.style.cursor="cell";return}const m=Vt(i,l.canvasRef.value);if(Oe<0||Me<0)return;if(m.x<52||m.y<24){if(m.y<24&&m.x>=52){const g=e.hitCol(m.x-52+e.scrollX.value);g>=0&&e.selectRange(Math.min(Oe,g),0,Math.max(Oe,g),e.rowCount-1,"col")}else if(m.x<52&&m.y>=24){const g=e.hitRow(m.y-24+e.scrollY.value);g>=0&&e.selectRange(0,Math.min(Me,g),e.colCount-1,Math.max(Me,g),"row")}d();return}const I=e.hitCol(m.x-52+e.scrollX.value),$=e.hitRow(m.y-24+e.scrollY.value);I<0||$<0||(Me===0&&Oe>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(Oe,I),0,Math.max(Oe,I),e.rowCount-1,"col"):Oe===0&&Me>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(Me,$),e.colCount-1,Math.max(Me,$),"row"):e.selectRange(Oe,Me,I,$),d())}function Aa(i){const m=C||N;Ae=!1,C=!1,N=!1,m&&l.scheduleOptEmit(),r.paintFmt.value&&r.applyPaintFormat()}function Ha(){const i=C||N;Ae=!1,C=!1,N=!1,i&&l.scheduleOptEmit()}function Fa(i){i.preventDefault();const m=Vt(i,l.canvasRef.value);if(m.x<52&&m.y<24){f(i);return}if(m.y<24&&m.x>=52){const I=e.hitCol(m.x-52+e.scrollX.value);I>=0&&M(i,I);return}if(m.x<52&&m.y>=24){const I=e.hitRow(m.y-24+e.scrollY.value);I>=0&&b(i,I);return}if(m.x>=52&&m.y>=24){const I=e.hitCol(m.x-52+e.scrollX.value),$=e.hitRow(m.y-24+e.scrollY.value);I>=0&&$>=0&&T(i,I,$)}}function Va(i){const m=Vt(i,l.canvasRef.value);if(m.x<52||m.y<24)return;const I=e.hitCol(m.x-52+e.scrollX.value),$=e.hitRow(m.y-24+e.scrollY.value);if(!(I<0||$<0)){{const g=l.formulaBarRef.value,F=!!(g&&typeof document<"u"&&document.activeElement===g);(e.editingCell.value||F||O)&&Z()}e.selectCell(I,$),e.ensureVisible(I,$),e.startEdit(),d(),l.focusEditInput()}}function Oa(i){l.clampScroll(e.scrollX.value+i.deltaX,e.scrollY.value+i.deltaY),d()}function La(i){if(i.touches.length!==1){it=!1;return}const m=i.touches[0],I=l.canvasRef.value;if(!I)return;const $=I.getBoundingClientRect(),g=m.clientX-$.left,F=m.clientY-$.top;g>=52&&F>=24?(i.preventDefault(),it=!0,st=!1,Rt="cell",he=g,be=F,Te=e.scrollX.value,tt=e.scrollY.value,Ze=e.hitCol(g-52+e.scrollX.value),rt=e.hitRow(F-24+e.scrollY.value)):g>=0&&F>=0&&(g<52||F<24)&&(i.preventDefault(),it=!0,st=!1,he=g,be=F,Te=e.scrollX.value,tt=e.scrollY.value,F<24&&g>=52?(Rt="col",Ze=e.hitCol(g-52+e.scrollX.value),rt=-1):g<52&&F>=24?(Rt="row",rt=e.hitRow(F-24+e.scrollY.value),Ze=-1):(Rt="all",Ze=-1,rt=-1))}function Ia(i){if(!it||i.touches.length!==1)return;const m=i.touches[0],I=l.canvasRef.value;if(!I)return;const $=I.getBoundingClientRect(),g=m.clientX-$.left,F=m.clientY-$.top;(Math.abs(g-he)>8||Math.abs(F-be)>8)&&(st=!0,i.preventDefault(),l.clampScroll(Te+(he-g),tt+(be-F)),d())}function $a(){if(it&&(it=!1,!st))if(Rt==="cell"&&Ze>=0&&rt>=0){const i=Date.now();Ze===Zl&&rt===ql&&i-Rl<300?(e.selectCell(Ze,rt),e.startEdit(),d(),l.focusEditInput(),Rl=0):(e.commitEdit(),e.selectCell(Ze,rt),d(),Rl=i),Zl=Ze,ql=rt,l.focusEditInput()}else Rt==="col"&&Ze>=0?(e.commitEdit(),e.selectRange(Ze,0,Ze,e.rowCount-1,"col"),d()):Rt==="row"&&rt>=0?(e.commitEdit(),e.selectRange(0,rt,e.colCount-1,rt,"row"),d()):Rt==="all"&&(e.commitEdit(),e.selectAll(),d())}function Bl(i){return i.isComposing||i.key==="Process"||i.keyCode===229}function Jl(i){return i.key.length===1&&!i.ctrlKey&&!i.metaKey&&!i.altKey}function Ql(i){if(e.editingCell.value)return;const m=i.ctrlKey||i.metaKey,I=i.shiftKey;switch(!0){case(m&&(i.key==="c"||i.key==="C")):i.preventDefault(),o.copyToClipboard();return;case(m&&(i.key==="x"||i.key==="X")):i.preventDefault(),o.cutSelected();return;case(m&&(i.key==="z"||i.key==="Z")):i.preventDefault(),r.undo();return;case(m&&(i.key==="y"||i.key==="Y")):i.preventDefault(),r.redo();return;case(m&&(i.key==="v"||i.key==="V")):i.preventDefault(),r.saveUndo(),o.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>l.emitModelData())});return;case(m&&(i.key==="a"||i.key==="A")):i.preventDefault(),e.selectAll(),d();return;case(m&&i.key==="Home"):i.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),d();return;case(m&&i.key==="End"):i.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),d();return;case i.key==="Home":i.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),d();return;case i.key==="End":i.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),d();return;case i.key==="ArrowUp":i.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case i.key==="ArrowDown":i.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case i.key==="ArrowLeft":i.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case i.key==="ArrowRight":i.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case i.key==="Tab":i.preventDefault(),e.moveActive(I?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case i.key==="Enter":i.preventDefault(),e.moveActive(0,I?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case i.key==="F2":i.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),d(),l.focusEditInput();return;case i.key==="Delete":case i.key==="Backspace":i.preventDefault(),r.saveUndo(),o.clearSelected(),d();return;case i.key==="Escape":i.preventDefault(),e.cancelEdit(),r.paintFmt.value=null,d();return;case Jl(i):if(Bl(i)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),d(),l.focusEditInput();return}i.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(i.key),d(),t.nextTick(()=>{const $=l.editInputRef.value;$&&($.focus(),$.setSelectionRange(1,1))});return}}let Ml=!1,xl=!1;function Wa(i){const m=i.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(m),A.value=m,d();return}e.editValue.value=m,A.value=m}function za(){Ml=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),A.value="",d())}function _a(i){Ml=!1,xl=!0,setTimeout(()=>{xl=!1},0);const m=i.target.value;e.editValue.value=m,A.value=m}function Ga(i){if(!e.editingCell.value){if(Jl(i)||Bl(i))return;Ql(i);return}if(!(Ml||Bl(i))&&!(xl&&(i.key==="Enter"||i.key==="Escape")))if(i.key==="Enter"&&(i.altKey||i.metaKey)){i.preventDefault();const m=l.editInputRef.value;if(!m)return;const I=m.selectionStart??m.value.length,$=m.selectionEnd??m.value.length,g=m.value,F=g.slice(0,I)+`
9
- `+g.slice($);e.editValue.value=F,m.value=F,m.selectionStart=m.selectionEnd=I+1,d()}else i.key==="Enter"?(i.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d(),l.focusEditInput()):i.key==="Tab"?(i.preventDefault(),e.commitEdit(),e.moveActive(i.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d(),l.focusEditInput()):i.key==="Escape"&&(i.preventDefault(),e.cancelEdit(),d(),l.focusEditInput())}function Ka(i){e.editingCell.value}function Ua(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),d())},0)}let gt=null;function qt(){var m;const i=(m=l.wrapperRef.value)==null?void 0:m.getBoundingClientRect();if(i){const I=Ft(e.props.width),$=Ft(e.props.height);I!=null?l.viewSize.w=I:l.viewSize.w=i.width,$!=null?l.viewSize.h=$:l.viewSize.h=i.height}l.clampScroll(null,null),d()}function Pa(){t.onMounted(()=>{const i=Ft(e.props.width),m=Ft(e.props.height);(i==null||m==null)&&(gt=new ResizeObserver(()=>qt()),l.wrapperRef.value&&gt.observe(l.wrapperRef.value)),t.nextTick(()=>{qt(),l.focusEditInput()}),e.selectCell(0,0),l.modelData.value&&l.modelData.value.length>0&&(c.value=JSON.stringify(l.modelData.value),l.sheets.value=l.modelData.value.map(I=>{const $=l.mkSheet(I.name);for(const[g,F]of Object.entries(I.cells))$.cells[g]={value:F.value,style:F.style??null};if(I.colWidths)for(const[g,F]of Object.entries(I.colWidths)){const ue=Number(g);ue>=0&&ue<e.colCount&&F>=30&&($.colWidths[ue]=F)}if(I.rowHeights)for(const[g,F]of Object.entries(I.rowHeights)){const ue=Number(g);ue>=0&&ue<e.rowCount&&F>=24&&($.rowHeights[ue]=F)}if(I.merges)for(const[g,F]of Object.entries(I.merges))$.merges[g]={...F};return $}),l.sheets.value.length>0&&l.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const i=Ft(e.props.width),m=Ft(e.props.height);i!=null&&m!=null?(gt==null||gt.disconnect(),gt=null):!gt&&l.wrapperRef.value&&(gt=new ResizeObserver(()=>qt()),gt.observe(l.wrapperRef.value)),t.nextTick(()=>qt())}),t.watch(()=>e.props.theme,()=>d()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>l.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>l.emitModelData()),d()},{deep:!1}),t.watch(l.activeSheetIndex,()=>t.nextTick(()=>l.emitModelData())),t.watch(()=>l.modelData.value,i=>{if(!i||i.length===0)return;const m=JSON.stringify(i);if(m===c.value)return;c.value=m;const I=e.selection.value?{...e.selection.value}:null,$={...e.activeCell.value};l.sheets.value=i.map(g=>{const F=l.mkSheet(g.name);for(const[ue,ye]of Object.entries(g.cells))F.cells[ue]={value:ye.value,style:ye.style??null};if(g.colWidths)for(const[ue,ye]of Object.entries(g.colWidths)){const me=Number(ue);me>=0&&me<e.colCount&&ye>=30&&(F.colWidths[me]=ye)}if(g.rowHeights)for(const[ue,ye]of Object.entries(g.rowHeights)){const me=Number(ue);me>=0&&me<e.rowCount&&ye>=24&&(F.rowHeights[me]=ye)}if(g.merges)for(const[ue,ye]of Object.entries(g.merges))F.merges[ue]={...ye};return F}),l.sheets.value.length>0&&l.loadSheet(0),I&&(e.selection.value=I),e.activeCell.value=$,d()},{deep:!0}),t.onBeforeUnmount(()=>{gt==null||gt.disconnect()})}return{scheduleRender:d,render:K,activeCellLabel:k,formulaBarDisplay:x,formulaBarDraft:A,formulaBarExpanded:E,onFormulaBarFocus:ne,onFormulaBarInput:y,onFormulaBarKeydown:ee,onFormulaBarBlur:J,acceptFormulaBarEdit:Z,cancelFormulaBarEdit:ie,renTab:te,renTabVal:pe,onTabClick:We,onTabDblClick:ze,commitTabRename:et,cclTabRename:Ue,onTabRenameKd:qe,ctxMenu:se,ctxSubmenuLeft:Se,onCtxItemEnter:He,onTabCtxMenu:Fe,onTabBarCtx:ut,onCornerCtx:f,onRowHdrCtx:b,onColHdrCtx:M,onCellCtx:T,dimInputRef:a,dimPanel:p,openDimPanel:W,onDimInput:Y,onDimKeydown:Be,onDimBlur:De,applyDimPanel:_e,closeDimPanel:Ee,editInputStyle:R,hScrollbarW:ce,vScrollbarH:le,hTrackW:re,vTrackH:X,hThumbW:U,hThumbL:Ce,vThumbH:we,vThumbT:Pe,onVStart:L,onHStart:Q,onSbMove:ae,onSbUp:ve,onVTrk:xe,onHTrk:Ve,onMouseDown:Da,onMouseMove:Na,onMouseUp:Aa,onMouseLeave:Ha,onCanvasCtx:Fa,onDblClick:Va,onWheel:Oa,onTouchStart:La,onTouchMove:Ia,onTouchEnd:$a,onKeydown:Ql,onEditInput:Wa,onEditCompositionStart:za,onEditCompositionEnd:_a,onEditKd:Ga,onEditPaste:Ka,onEditBlur:Ua,applySize:qt,setupLifecycle:Pa}}const ma={class:"formula-bar__cell-label"},pa={class:"formula-bar__buttons"},ga=["rows","value"],ha=["title"],Ca={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},ya={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},ba=["value"],va={key:2,class:"sb-corner"},wa=["onClick","onMouseenter"],ka={class:"context-menu__label"},Ea={key:0,class:"context-menu__arrow"},Ra=["onClick"],Ba={class:"dim-panel__title"},Ma={class:"dim-panel__body"},xa=["value"],Sa={key:0,class:"dim-panel__error"},Ta={class:"dim-panel__footer"},jl=kt(t.defineComponent({__name:"spreader",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const r=e,o=t.useModel(e,"data"),l={value:""},c=aa(r,{rowCount:r.rowCount,colCount:r.colCount,theme:r.theme,locale:r.locale}),s={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:z=>{},mkSheet:z=>({id:"",name:z,cells:{},merges:{},selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[]})},n=ia(c,s),v=sa(c,n);ca(n,{borderMenuOpen:v.borderMenuOpen,mergeMenuOpen:v.mergeMenuOpen});const d=ua(c,n,o,void 0,l);s.sheets=d.sheets,s.activeSheetIndex=d.activeSheetIndex,s.saveSheet=d.saveSheet,s.loadSheet=d.loadSheet,s.mkSheet=d.mkSheet;const S=fa(c,n,v,d,l);S.setupLifecycle();const K=t.reactive(c),k=t.reactive(n),A=t.reactive(v),E=t.reactive(d),x=d.sheets,ne=d.activeSheetIndex,y=t.reactive(S),q=t.computed(()=>{const z=K.selection;return!!z&&z.startCol===z.endCol&&z.startRow===z.endRow}),O=t.computed(()=>{var Se;const z=k.selNumberFormat;if(z!==nl)return z;const u=K.activeCell,h=(Se=K.cells[K.cellKey(u.col,u.row)])==null?void 0:Se.style;return typeof(h==null?void 0:h.numberFormat)=="string"?h.numberFormat:""});function Z(z){n.nfDialogOpen.value=z}function ie(z){n.fontSizeMenuOpen.value=z}function ee(z){n.textColorMenuOpen.value=z}function J(z){n.fillColorMenuOpen.value=z}function te(z){S.renTabVal.value=z}function pe(){S.ctxMenu.value=null}const We=z=>{d.formulaBarRef.value=z};function ze(){S.formulaBarExpanded.value=!S.formulaBarExpanded.value}const et=z=>{d.wrapperRef.value=z},Ue=z=>{d.canvasRef.value=z},qe=z=>{d.editInputRef.value=z},se=z=>{S.dimInputRef.value=z};return(z,u)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(E.outerStyle)},[t.createVNode(ur,{locale:K.locale,"can-undo":k.canUndo,"can-redo":k.canRedo,"paint-fmt-active":k.paintFmt!==null,"has-selection":k.hasSelection,"font-family-options":k.fontFamilyOptions,"font-size-options":k.fontSizeOptions,"sel-font-family":k.selFontFamily,"sel-font-size":k.selFontSize,"font-size-input":k.fontSizeInput,"font-size-menu-open":k.fontSizeMenuOpen,"sel-font-weight":k.selFontWeight,"sel-font-style":k.selFontStyle,"sel-underline":k.selUnderline,"sel-strikethrough":k.selStrikethrough,"sel-text-color":k.selTextColor,"text-color-menu-open":k.textColorMenuOpen,"sel-fill-color":k.selFillColor,"fill-color-menu-open":k.fillColorMenuOpen,"cached-text-color":k.cachedTextColor,"cached-fill-color":k.cachedFillColor,"border-menu-open":A.borderMenuOpen,"cached-border":A.cachedBorder,"h-align-options":k.hAlignOptions,"v-align-options":k.vAlignOptions,"sel-h-align":k.selHAlign,"sel-v-align":k.selVAlign,"sel-wrap":k.selWrap,"merge-menu-open":A.mergeMenuOpen,"calc-menu-open":A.calcMenuOpen,"is-single-cell":q.value,"sel-number-format":k.selNumberFormat,"nf-options":k.nfOptions,"theme-vars":E.toolbarThemeVars,onUndo:u[0]||(u[0]=h=>k.undo()),onRedo:u[1]||(u[1]=h=>k.redo()),onPaintFormat:k.onPaintFormat,onClearFormat:u[2]||(u[2]=h=>k.clearFormat()),onNumberFormatChange:u[3]||(u[3]=h=>k.onNumberFormatChange(h)),onFontFamilyChange:u[4]||(u[4]=h=>k.onFontFamilyChange(h)),onFontSizeInput:u[5]||(u[5]=h=>k.onFontSizeInput(h)),onFontSizeBlur:k.onFontSizeBlur,onFontSizeKeydown:u[6]||(u[6]=h=>k.onFontSizeKeydown(h)),onFontSizeChange:u[7]||(u[7]=h=>k.onFontSizeChange(h)),"onUpdate:fontSizeMenuOpen":u[8]||(u[8]=h=>ie(h)),onFontSizeToggle:u[9]||(u[9]=h=>k.toggleFontSizeMenu()),onFontSizeStepUp:k.onFontSizeStepUp,onFontSizeStepDown:k.onFontSizeStepDown,onBoldToggle:k.toggleFontWeight,onItalicToggle:k.toggleFontStyle,onUnderlineToggle:k.toggleUnderline,onStrikethroughToggle:k.toggleStrikethrough,onTextColorChange:u[10]||(u[10]=h=>k.onTextColorChange(h)),"onUpdate:textColorMenuOpen":u[11]||(u[11]=h=>ee(h)),onFillColorChange:u[12]||(u[12]=h=>k.onFillColorChange(h)),"onUpdate:fillColorMenuOpen":u[13]||(u[13]=h=>J(h)),onApplyTextColor:k.applyCachedTextColor,onApplyFillColor:k.applyCachedFillColor,"onUpdate:borderMenuOpen":u[14]||(u[14]=h=>k.onBorderMenuToggle(h)),onBorderChange:u[15]||(u[15]=h=>A.onBorderChange(h)),onApplyBorder:A.applyCachedBorder,onHAlignChange:u[16]||(u[16]=h=>k.onHAlignChange(h)),onVAlignChange:u[17]||(u[17]=h=>k.onVAlignChange(h)),onWrapToggle:k.onWrapToggle,"onUpdate:mergeMenuOpen":u[18]||(u[18]=h=>A.onMergeMenuToggle(h)),onMergeChange:u[19]||(u[19]=h=>A.onMergeChange(h)),onApplyMerge:A.onApplyMerge,"onUpdate:calcMenuOpen":u[20]||(u[20]=h=>A.onCalcMenuToggle(h)),onCalcSum:A.onCalcSum,onCalcAvg:A.onCalcAvg,onCalcCount:A.onCalcCount},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","theme-vars","onPaintFormat","onFontSizeBlur","onFontSizeStepUp","onFontSizeStepDown","onBoldToggle","onItalicToggle","onUnderlineToggle","onStrikethroughToggle","onApplyTextColor","onApplyFillColor","onApplyBorder","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg","onCalcCount"]),t.createVNode(Zr,{"model-open":k.nfDialogOpen,locale:K.locale,"current-format":O.value,"onUpdate:modelOpen":u[21]||(u[21]=h=>Z(h)),onApply:u[22]||(u[22]=h=>k.applyNumberFormatCode(h))},null,8,["model-open","locale","current-format"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":y.formulaBarExpanded}])},[t.createElementVNode("div",ma,t.toDisplayString(y.activeCellLabel),1),t.createElementVNode("div",pa,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:u[23]||(u[23]=t.withModifiers(()=>{},["prevent"])),onClick:u[24]||(u[24]=t.withModifiers((...h)=>y.cancelFormulaBarEdit&&y.cancelFormulaBarEdit(...h),["stop"]))},[...u[73]||(u[73]=[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:u[25]||(u[25]=t.withModifiers(()=>{},["prevent"])),onClick:u[26]||(u[26]=t.withModifiers((...h)=>y.acceptFormulaBarEdit&&y.acceptFormulaBarEdit(...h),["stop"]))},[...u[74]||(u[74]=[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:We,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":y.formulaBarExpanded}]),rows:y.formulaBarExpanded?3:1,value:y.formulaBarDisplay,spellcheck:"false",onFocus:u[27]||(u[27]=(...h)=>y.onFormulaBarFocus&&y.onFormulaBarFocus(...h)),onInput:u[28]||(u[28]=(...h)=>y.onFormulaBarInput&&y.onFormulaBarInput(...h)),onKeydown:u[29]||(u[29]=(...h)=>y.onFormulaBarKeydown&&y.onFormulaBarKeydown(...h)),onBlur:u[30]||(u[30]=(...h)=>y.onFormulaBarBlur&&y.onFormulaBarBlur(...h))},null,42,ga),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:y.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:u[31]||(u[31]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(ze,["stop"])},[y.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",ya,[...u[76]||(u[76]=[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",Ca,[...u[75]||(u[75]=[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,ha)],2),t.createElementVNode("div",{ref:et,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:Ue,class:"grid-canvas",tabindex:"0",onMousedown:u[32]||(u[32]=(...h)=>y.onMouseDown&&y.onMouseDown(...h)),onMousemove:u[33]||(u[33]=(...h)=>y.onMouseMove&&y.onMouseMove(...h)),onMouseup:u[34]||(u[34]=(...h)=>y.onMouseUp&&y.onMouseUp(...h)),onMouseleave:u[35]||(u[35]=(...h)=>y.onMouseLeave&&y.onMouseLeave(...h)),onDblclick:u[36]||(u[36]=(...h)=>y.onDblClick&&y.onDblClick(...h)),onWheel:u[37]||(u[37]=t.withModifiers((...h)=>y.onWheel&&y.onWheel(...h),["prevent"])),onFocus:u[38]||(u[38]=(...h)=>E.onCanvasFocus&&E.onCanvasFocus(...h)),onKeydown:u[39]||(u[39]=(...h)=>y.onKeydown&&y.onKeydown(...h)),onContextmenu:u[40]||(u[40]=(...h)=>y.onCanvasCtx&&y.onCanvasCtx(...h)),onTouchstart:u[41]||(u[41]=t.withModifiers((...h)=>y.onTouchStart&&y.onTouchStart(...h),["prevent"])),onTouchmove:u[42]||(u[42]=t.withModifiers((...h)=>y.onTouchMove&&y.onTouchMove(...h),["prevent"])),onTouchend:u[43]||(u[43]=(...h)=>y.onTouchEnd&&y.onTouchEnd(...h))},null,32),t.createElementVNode("textarea",{ref:qe,class:"cell-editor",value:K.editValue,style:t.normalizeStyle(y.editInputStyle),onInput:u[44]||(u[44]=(...h)=>y.onEditInput&&y.onEditInput(...h)),onKeydown:u[45]||(u[45]=(...h)=>y.onEditKd&&y.onEditKd(...h)),onCompositionstart:u[46]||(u[46]=(...h)=>y.onEditCompositionStart&&y.onEditCompositionStart(...h)),onCompositionend:u[47]||(u[47]=(...h)=>y.onEditCompositionEnd&&y.onEditCompositionEnd(...h)),onBlur:u[48]||(u[48]=(...h)=>y.onEditBlur&&y.onEditBlur(...h)),onPaste:u[49]||(u[49]=(...h)=>y.onEditPaste&&y.onEditPaste(...h))},null,44,ba),E.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:t.unref(24)+"px",height:`calc(100% - ${t.unref(24)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:u[50]||(u[50]=t.withModifiers(h=>{E.clampScroll(null,K.scrollY-50),y.scheduleRender()},["prevent"]))},[...u[77]||(u[77]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:u[52]||(u[52]=(...h)=>y.onVTrk&&y.onVTrk(...h))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:y.vThumbT+"px",height:y.vThumbH+"px"}),onMousedown:u[51]||(u[51]=(...h)=>y.onVStart&&y.onVStart(...h))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:u[53]||(u[53]=t.withModifiers(h=>{E.clampScroll(null,K.scrollY+50),y.scheduleRender()},["prevent"]))},[...u[78]||(u[78]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),E.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:t.unref(52)+"px",width:`calc(100% - ${t.unref(52)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:u[54]||(u[54]=t.withModifiers(h=>{E.clampScroll(K.scrollX-50,null),y.scheduleRender()},["prevent"]))},[...u[79]||(u[79]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:u[56]||(u[56]=(...h)=>y.onHTrk&&y.onHTrk(...h))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:y.hThumbL+"px",width:y.hThumbW+"px"}),onMousedown:u[55]||(u[55]=(...h)=>y.onHStart&&y.onHStart(...h))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:u[57]||(u[57]=t.withModifiers(h=>{E.clampScroll(K.scrollX+50,null),y.scheduleRender()},["prevent"]))},[...u[80]||(u[80]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),E.maxScrollX>0&&E.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",va)):t.createCommentVNode("",!0)]),t.createVNode(Cr,{locale:K.locale,sheets:t.unref(x),"active-sheet-index":t.unref(ne),"ren-tab":y.renTab,"ren-tab-val":y.renTabVal,onTabClick:u[58]||(u[58]=h=>y.onTabClick(h)),onTabDblclick:u[59]||(u[59]=h=>y.onTabDblClick(h)),onTabContextmenu:u[60]||(u[60]=h=>y.onTabCtxMenu(h.ev,h.i)),onTabRenameInput:u[61]||(u[61]=h=>te(h)),onTabRenameKeydown:u[62]||(u[62]=h=>y.onTabRenameKd(h)),onTabRenameCommit:y.commitTabRename,onTabbarContextmenu:u[63]||(u[63]=h=>y.onTabBarCtx(h)),onAddSheet:u[64]||(u[64]=h=>{E.addSheet(),y.scheduleRender()})},null,8,["locale","sheets","active-sheet-index","ren-tab","ren-tab-val","onTabRenameCommit"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[y.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:y.ctxMenu.x+"px",top:y.ctxMenu.y+"px"}),onClick:u[65]||(u[65]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.ctxMenu.items,(h,Se)=>(t.openBlock(),t.createElementBlock("div",{key:Se,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":h.disabled}]),onClick:He=>!h.disabled&&h.action&&(h.action(),pe()),onMouseenter:He=>y.onCtxItemEnter(He,h)},[t.createElementVNode("span",ka,t.toDisplayString(h.label),1),h.children?(t.openBlock(),t.createElementBlock("span",Ea)):t.createCommentVNode("",!0),h.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":y.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.children,(He,Fe)=>(t.openBlock(),t.createElementBlock("div",{key:Fe,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":He.disabled}]),onClick:t.withModifiers(ut=>!He.disabled&&He.action&&(He.action(),pe()),["stop"])},t.toDisplayString(He.label),11,Ra))),128))],2)):t.createCommentVNode("",!0)],42,wa))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[y.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:y.dimPanel.x+"px",top:y.dimPanel.y+"px"}),onMousedown:u[71]||(u[71]=t.withModifiers(()=>{},["stop"])),onClick:u[72]||(u[72]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Ba,t.toDisplayString(y.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",Ma,[t.createElementVNode("input",{ref:se,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":y.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:y.dimPanel.value,onInput:u[66]||(u[66]=(...h)=>y.onDimInput&&y.onDimInput(...h)),onKeydown:u[67]||(u[67]=(...h)=>y.onDimKeydown&&y.onDimKeydown(...h)),onBlur:u[68]||(u[68]=(...h)=>y.onDimBlur&&y.onDimBlur(...h))},null,42,xa),u[81]||(u[81]=t.createElementVNode("span",{class:"dim-panel__unit"},"px",-1))]),y.dimPanel.error?(t.openBlock(),t.createElementBlock("div",Sa,t.toDisplayString(y.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Ta,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:u[69]||(u[69]=(...h)=>y.applyDimPanel&&y.applyDimPanel(...h))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:u[70]||(u[70]=(...h)=>y.closeDimPanel&&y.closeDimPanel(...h))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-a54563ff"]]);Dt.Spreader=jl,Dt.default=jl,Object.defineProperties(Dt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(Dt,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(Dt=typeof globalThis<"u"?globalThis:Dt||self,t(Dt.XiaoDaoSpreader={},Dt.Vue))})(this,function(Dt,t){"use strict";const uo={"zh-CN":{insert:"插入",delete:"删除",rename:"重命名",moveLeft:"左移",moveRight:"右移",cut:"剪切",copy:"复制",paste:"粘贴",addSheet:"新建工作表",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:"混合",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",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",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 N(e,n){var o;return((o=uo[e])==null?void 0:o[n])??n}const Pt='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',kt=10,fo=[{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'}],mo=[{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}],po='<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>',go='<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>',ho='<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>',Co='<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>',bo='<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>',yo='<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>',vo=[{value:"left",labelKey:"alignLeft",icon:po},{value:"center",labelKey:"alignCenter",icon:go},{value:"right",labelKey:"alignRight",icon:ho}],wo=[{value:"top",labelKey:"alignTop",icon:Co},{value:"middle",labelKey:"alignMiddle",icon:bo},{value:"bottom",labelKey:"alignBottom",icon:yo}],Nl=[{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>'}],ko={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)"},Eo={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)"},Al="__nf_custom__",nl="",rl="",Ht="@",gl="__NF_INVALID__",Hl=2958465,Vl=0;function Yt(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function Fl(e){return e==="zh-CN"?"¥":"$"}function Ro(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Ol(e){return e.replace(/"([^"]*)"/g,"$1")}function Bo(e){let n=e,o;const l=n.match(/^\[([^\]]+)\]/);l&&(o=l[1].toLowerCase(),n=n.slice(l[0].length)),n=Ro(n);const c=/E[+-]/i.test(n),d=n.includes("%"),r=n.search(/[0#?]/);if(r===-1)return{hasDigits:!1,decimals:0,minDecimals:0,minIntDigits:0,thousands:!1,scale:d?100:1,scientific:!1,prefix:n,suffix:"",color:o};let v=-1;for(let Z=n.length-1;Z>=0;Z--){const J=n[Z];if(J==="0"||J==="#"||J==="?"||J==="E"){v=Z;break}}v<0&&(v=r);const u=r>0?n.slice(0,r):"",k=v<n.length-1?n.slice(v+1):"",x=n.slice(r,v+1),S=/[0#?]/.test(x),w=x.includes(",");let B=x.replace(/,/g,"");if(c){const Z=B.search(/E/i);Z>=0&&(B=B.slice(0,Z))}const le=B.indexOf("."),ne=le>=0?B.slice(0,le):B,p=le>=0?B.slice(le+1):"",V=(p.match(/[0#?]/g)||[]).length,P=(p.match(/0/g)||[]).length,oe=(ne.match(/0/g)||[]).length;return{hasDigits:S,decimals:V,minDecimals:P,minIntDigits:oe,thousands:w,scale:d?100:1,scientific:c,prefix:u,suffix:k,color:o}}function xo(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 c;for(;(c=l.exec(e))!==null;){const d=c[0];switch(d){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:d.startsWith('"')?n.push({type:"literal",text:Ol(d),len:0}):n.push({type:"literal",text:d,len:0})}}return{tokens:n,isDuration:o}}const Ll=new Map;function Mo(e){if(/[ydhs]/.test(e)||/AM\/PM/i.test(e)||/\[h\]/i.test(e)){const c=e.split(";")[0]??e,{tokens:d,isDuration:r}=xo(c);return{kind:r?"duration":"date",sections:[],tokens:d,isDuration:r,raw:e}}return{kind:"number",sections:e.split(";").map(c=>Bo(c)),tokens:[],isDuration:!1,raw:e}}function al(e){const n=Ll.get(e);if(n)return n;const o=Mo(e);return Ll.set(e,o),o}function Il(e,n,o,l,c){const d=Math.pow(10,n),r=Math.round((e+Number.EPSILON)*d)/d,v=r<0,u=Math.abs(r);let x=new Intl.NumberFormat("en-US",{useGrouping:l,minimumIntegerDigits:c,minimumFractionDigits:n,maximumFractionDigits:n}).format(u);if(o<n&&n>0){const w=x.indexOf(".");if(w>=0){const R=x.substring(0,w);let B=x.substring(w+1);B=B.replace(/0+$/,""),B.length<o&&(B=B+"0".repeat(o-B.length)),x=B?`${R}.${B}`:R}}return`${v?"-":""}${x}`}function $l(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),c=Il(l,n,n,!1,1),d=(o>=0?"+":"-")+String(Math.abs(o)).padStart(2,"0");return`${c}E${d}`}function So(e,n,o){if(!o.hasDigits)return Ol(o.prefix+o.suffix);const l=o.scale===100?e*100:e,c=o.scientific?$l(l,o.decimals):Il(l,o.decimals,o.minDecimals,o.thousands,o.minIntDigits);return n+o.prefix+c+o.suffix}function To(e,n){const o=n.sections;if(o.length===0)return String(e);let l,c,d="";return e>0?(l=o[0],c=e):e<0?o[1]?(l=o[1],c=-e):(l=o[0],c=-e,d="-"):(l=o[2]??o[0],c=0),So(c,d,l)}function Do(e){return new Date((e-25569)*864e5)}const No=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Ao=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],zl=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],Ho=["January","February","March","April","May","June","July","August","September","October","November","December"],Vo=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Wl=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function _t(e,n){return String(e).padStart(n,"0")}function Fo(e,n,o,l){const c=e.getUTCFullYear(),d=e.getUTCMonth()+1,r=e.getUTCDate(),v=e.getUTCDay(),u=o==="zh-CN";let k="",x=!1;for(const S of n)switch(S.type){case"literal":k+=S.text??"";break;case"year":k+=S.len>=4?String(c):String(c%100).padStart(2,"0");break;case"month":k+=_t(x?e.getUTCMinutes():d,S.len);break;case"monthName":k+=S.len>=4?u?No[d-1]:Ho[d-1]:u?Ao[d-1]:Vo[d-1];break;case"day":k+=_t(r,S.len);break;case"weekday":k+=S.len>=4?u?zl[v]:Wl[v]:u?zl[v].slice(2):Wl[v].slice(0,3);break;case"hour":{let w=e.getUTCHours();if(S.len===0){const R=Math.floor(l*86400);w=Math.floor(R/3600)}k+=String(w),x=!0;break}case"minute":k+=_t(e.getUTCMinutes(),S.len);break;case"second":k+=_t(e.getUTCSeconds(),S.len);break;case"ampm":{const w=e.getUTCHours();k+=w<12?u?"上午":"AM":u?"下午":"PM";break}}return k}function Oo(e,n){const o=Math.floor(e*86400),l=Math.floor(o/3600),c=Math.floor(o%3600/60),d=o%60;let r="";for(const v of n)switch(v.type){case"literal":r+=v.text??"";break;case"hour":r+=String(l);break;case"minute":r+=_t(c,v.len||2);break;case"second":r+=_t(d,v.len||2);break;default:r+=""}return r}function Lo(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)?$l(n,9):e}return e}function hl(e,n,o){if(Yt(n))return Lo(e);if(n==null||n===Ht)return e;const l=al(n);if(l.kind==="date"||l.kind==="duration"){const d=Number(e);if(!isFinite(d))return e;if(l.kind==="date"){if(d<Vl||d>Hl)return gl}else if(d<0)return gl;return l.kind==="duration"?Oo(d,l.tokens):Fo(Do(d),l.tokens,o,d)}const c=Number(e);return isNaN(c)?e:To(c,l)}const Io=["general","number","currency","currencyRounded","accounting","financial","percent","scientific","date","time","dateTime","duration","text","custom"];function _l(e,n){if(n===Ht||n==="@")return!1;if(Yt(n)){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}const o=al(n);return!!(o.kind==="number"&&Kl(o))}function Kl(e){return e.sections.some(n=>n.hasDigits)}function $o(e){if(e==null||Yt(e)||e===Ht||e==="@")return!1;const n=al(e);return!!(n.kind==="date"||n.kind==="duration"||n.kind==="number"&&Kl(n))}function zo(e,n){if(n==null||Yt(n)||n===Ht||n==="@")return!1;const o=al(n),l=Number(e);return Number.isFinite(l)?o.kind==="date"?l<Vl||l>Hl:o.kind==="duration"?l<0:!1:!1}function Wo(e,n,o,l){const c=Fl(e),d=l?"#,##0":"0",r=o>0?"."+"0".repeat(o):"",v=d+r;switch(n){case"general":return"";case"text":return Ht;case"custom":return"";case"number":return v;case"percent":return v+"%";case"scientific":return"0."+"0".repeat(o)+"E+00";case"currency":return c+v;case"currencyRounded":return c+(l?"#,##0":"0");case"accounting":return`${c}${v};(${c}${v});${c}"-"`;case"financial":return`${v};[Red](${v})`;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 _o(e){const n=Fl(e);return[{label:N(e,"nfGeneral"),value:rl},{label:N(e,"nfText"),value:Ht},{label:N(e,"nfNumber"),value:"#,##0.00"},{label:N(e,"nfPercent"),value:"0.00%"},{label:N(e,"nfScientific"),value:"0.00E+00"},{label:N(e,"nfAccounting"),value:`${n}#,##0.00;(${n}#,##0.00);${n}"-"`},{label:N(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:N(e,"nfCurrency"),value:n+"#,##0.00"},{label:N(e,"nfCurrencyRounded"),value:n+"#,##0"},{label:N(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:N(e,"nfTime"),value:"h:mm:ss"},{label:N(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:N(e,"nfDuration"),value:"[h]:mm:ss"},{label:N(e,"nfCustom"),value:Al}]}const Ko=["title"],Uo=["innerHTML"],Go={key:1,class:"sp-dropdown__value"},Po=["disabled"],Yo=["onClick"],Xo=["innerHTML"],jo={class:"sp-dropdown__item-label"},Zo=["disabled"],qo=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,c=t.ref(!1),d=t.ref(0),r=t.ref(null),v=t.ref(null),u=t.ref(null),k=t.ref({top:0,up:!1}),x=t.ref(0),S=t.ref(!1),w=t.computed(()=>o.options.find(se=>String(se.value)===String(o.modelValue))),R=t.computed(()=>o.menuWidth),B=t.computed(()=>Math.min(o.visibleCount,o.options.length)),le=t.computed(()=>o.options.slice(d.value,d.value+B.value)),ne=t.computed(()=>d.value>0),p=t.computed(()=>d.value+B.value<o.options.length),V=t.computed(()=>o.options.length>B.value);function P(se){d.value=Math.max(0,Math.min(o.options.length-B.value,d.value+se))}function oe(){c.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0);const se=o.triggerEl??r.value;if(!se)return;const de=se.getBoundingClientRect(),Te=B.value*22+(V.value?2*15:0)+8,i=window.innerHeight-de.bottom-4<Te&&de.top-4>Te;o.align==="right"?k.value={right:window.innerWidth-de.right,top:i?de.top-Te-4:de.bottom+4,up:i}:k.value={left:de.left,top:i?de.top-Te-4:de.bottom+4,up:i};const m=o.options.findIndex(fe=>String(fe.value)===String(o.modelValue));d.value=m>=0?Math.max(0,Math.min(m-Math.floor(B.value/2),o.options.length-B.value)):0}function Z(){c.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function J(){c.value?Z():oe()}function q(se){l("update:modelValue",se.value),l("change",se.value),Z()}function ue(se){var Te,re;if(!c.value)return;const de=se.target;(Te=r.value)!=null&&Te.contains(de)||(re=u.value)!=null&&re.contains(de)||Z()}function Fe(se){c.value&&(se.preventDefault(),P(se.deltaY>0?1:-1))}t.watch(c,se=>{t.nextTick(()=>{var de,Te;se?(de=v.value)==null||de.addEventListener("wheel",Fe,{passive:!1}):(Te=v.value)==null||Te.removeEventListener("wheel",Fe)})}),t.watch(()=>o.modelOpen,se=>{se!==void 0&&se!==c.value&&(se?oe():Z())});function Oe(se){c.value&&(x.value=se.touches[0].clientY,S.value=!0)}function Je(se){if(!c.value||!S.value)return;const de=se.touches[0].clientY-x.value;Math.abs(de)>5&&(P(de<0?1:-1),x.value=se.touches[0].clientY)}function Ge(){S.value=!1}function je(se){se.key==="Escape"&&Z()}return t.onMounted(()=>{document.addEventListener("pointerdown",ue),window.addEventListener("resize",Z),window.addEventListener("scroll",Z,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",ue),window.removeEventListener("resize",Z),window.removeEventListener("scroll",Z,!0)}),(se,de)=>{var Te,re;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":c.value}]),title:e.title,onClick:J},[(Te=w.value)!=null&&Te.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:w.value.icon},null,8,Uo)):(t.openBlock(),t.createElementBlock("span",Go,t.toDisplayString(((re=w.value)==null?void 0:re.label)??e.fallbackLabel),1)),de[2]||(de[2]=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,Ko)),(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:u,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":k.value.up}]),style:t.normalizeStyle({left:k.value.left!==void 0?k.value.left+"px":void 0,right:k.value.right!==void 0?k.value.right+"px":void 0,top:k.value.top+"px",minWidth:R.value!==void 0?typeof R.value=="number"?R.value+"px":R.value:void 0}),onKeydown:je},[V.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!ne.value}]),disabled:!ne.value,onClick:de[0]||(de[0]=i=>P(-1))},[...de[3]||(de[3]=[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,Po)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:v,class:"sp-dropdown__list",onTouchstart:Oe,onTouchmove:Je,onTouchend:Ge},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(le.value,i=>(t.openBlock(),t.createElementBlock("button",{key:String(i.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(i.value)===String(e.modelValue)}]),onClick:m=>q(i)},[i.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:i.icon},null,8,Xo)):t.createCommentVNode("",!0),t.createElementVNode("span",jo,t.toDisplayString(i.label),1)],10,Yo))),128))],544),V.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!p.value}]),disabled:!p.value,onClick:de[1]||(de[1]=i=>P(1))},[...de[4]||(de[4]=[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,Zo)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),vt=(e,n)=>{const o=e.__vccOpts||e;for(const[l,c]of n)o[l]=c;return o},Xt=vt(qo,[["__scopeId","data-v-77df3baf"]]),Jo=["title","onClick"],Ul=vt(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,c=o,d=[[{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"}]],v=t.computed(()=>l.colorKey==="fill"?r:d);function u(V){return N(l.locale,V)}function k(V){const P=l.currentColor;return!P&&!V?!0:P?P.toLowerCase()===V.toLowerCase():!1}const x=t.ref(!1),S=t.ref(null),w=t.ref(null),R=t.ref({top:0});t.watch(()=>l.modelOpen,V=>{V!==void 0&&V!==x.value&&(V?le():ne())});function B(V){const P=S.value,oe=w.value,Z=V.target;P&&P.contains(Z)||oe&&oe.contains(Z)||ne()}function le(){x.value=!0,l.modelOpen!==void 0&&c("update:modelOpen",!0),t.nextTick(()=>{const V=l.triggerEl??S.value;if(V){const P=V.getBoundingClientRect(),oe=150,Z=120;let J=window.innerWidth-P.right,q=P.bottom+4,ue;P.left-Z<4&&(J=void 0,ue=Math.max(4,P.left)),q+oe>window.innerHeight-4&&(q=P.top-oe-4),q<4&&(q=4),R.value=J!==void 0?{right:J,top:q}:{left:ue,top:q}}document.addEventListener("pointerdown",B)})}function ne(){x.value=!1,l.modelOpen!==void 0&&c("update:modelOpen",!1),document.removeEventListener("pointerdown",B)}function p(V){c("update:modelValue",V),c("change",V),ne()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",B)}),n({open:x,openMenu:le,close:ne}),(V,P)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:S,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[x.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:w,class:"color-picker__menu",style:t.normalizeStyle({left:R.value.left!==void 0?R.value.left+"px":void 0,right:R.value.right!==void 0?R.value.right+"px":void 0,top:R.value.top+"px"}),onMousedown:P[0]||(P[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(v.value,(oe,Z)=>(t.openBlock(),t.createElementBlock("div",{key:Z,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe,J=>(t.openBlock(),t.createElementBlock("button",{key:J.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":k(J.value)}]),title:u(J.key),style:t.normalizeStyle({background:J.value||"transparent",border:J.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:q=>p(J.value)},null,14,Jo))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f8fac424"]]),Qo=["title","onClick"],en={viewBox:"0 0 30 30",class:"border-picker__icon"},tn=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],ln={class:"border-picker__label"},on=vt(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,c=o,d=[{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}],v={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},u={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function k(V,P){return u[V].includes(P)?"thick":v[V].includes(P)?"solid":"dashed"}const x=t.ref(!1),S=t.ref(null),w=t.ref(null),R=t.ref({top:0});t.watch(()=>l.modelOpen,V=>{V!==void 0&&V!==x.value&&(V?le():ne())});function B(V){const P=S.value,oe=w.value,Z=V.target;P&&P.contains(Z)||oe&&oe.contains(Z)||ne()}function le(){x.value=!0,l.modelOpen!==void 0&&c("update:modelOpen",!0),t.nextTick(()=>{const V=l.triggerEl??S.value;if(V){const P=V.getBoundingClientRect(),oe=200,Z=160;let J=window.innerWidth-P.right,q=P.bottom+4,ue;P.left-Z<4&&(J=void 0,ue=Math.max(4,P.left)),q+oe>window.innerHeight-4&&(q=P.top-oe-4),q<4&&(q=4),R.value=J!==void 0?{right:J,top:q}:{left:ue,top:q}}document.addEventListener("pointerdown",B)})}function ne(){x.value=!1,l.modelOpen!==void 0&&c("update:modelOpen",!1),document.removeEventListener("pointerdown",B)}function p(V){c("change",V),ne()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",B)}),n({open:x,openMenu:le,close:ne}),(V,P)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:S,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[x.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:w,class:"border-picker__menu",style:t.normalizeStyle({left:R.value.left!==void 0?R.value.left+"px":void 0,right:R.value.right!==void 0?R.value.right+"px":void 0,top:R.value.top+"px"}),onMousedown:P[0]||(P[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,oe=>t.createElementVNode("button",{key:oe.key,class:"border-picker__item",title:t.unref(N)(e.locale,oe.i18nKey),onClick:Z=>p(oe.key)},[(t.openBlock(),t.createElementBlock("svg",en,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,Z=>t.createElementVNode("line",{key:Z.name,x1:Z.x1,y1:Z.y1,x2:Z.x2,y2:Z.y2,stroke:"currentColor","stroke-width":k(oe.key,Z.name)==="thick"?3:1.5,"stroke-dasharray":k(oe.key,Z.name)==="dashed"?"0 4":"none","stroke-linecap":k(oe.key,Z.name)==="dashed"?"round":"square"},null,8,tn)),64))])),t.createElementVNode("span",ln,t.toDisplayString(t.unref(N)(e.locale,oe.i18nKey)),1)],8,Qo)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f362abdb"]]),nn=["title","onClick"],rn=["innerHTML"],an={class:"merge-picker__label"},cn=vt(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,c=o,d=t.ref(!1),r=t.ref(null),v=t.ref(null),u=t.ref({top:0});t.watch(()=>l.modelOpen,R=>{R!==void 0&&R!==d.value&&(R?x():S())});function k(R){const B=r.value,le=v.value,ne=R.target;B&&B.contains(ne)||le&&le.contains(ne)||S()}function x(){d.value=!0,l.modelOpen!==void 0&&c("update:modelOpen",!0),t.nextTick(()=>{const R=l.triggerEl??r.value;if(R){const B=R.getBoundingClientRect(),le=Nl.length*30+12,ne=160;let p=window.innerWidth-B.right,V=B.bottom+4,P;B.left-ne<4&&(p=void 0,P=Math.max(4,B.left)),V+le>window.innerHeight-4&&(V=B.top-le-4),V<4&&(V=4),u.value=p!==void 0?{right:p,top:V}:{left:P,top:V}}document.addEventListener("pointerdown",k)})}function S(){d.value=!1,l.modelOpen!==void 0&&c("update:modelOpen",!1),document.removeEventListener("pointerdown",k)}function w(R){c("change",R),S()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",k)}),n({open:d,openMenu:x,close:S}),(R,B)=>(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(()=>[d.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:v,class:"merge-picker__menu",style:t.normalizeStyle({left:u.value.left!==void 0?u.value.left+"px":void 0,right:u.value.right!==void 0?u.value.right+"px":void 0,top:u.value.top+"px"}),onMousedown:B[0]||(B[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Nl),le=>(t.openBlock(),t.createElementBlock("button",{key:le.key,class:"merge-picker__item",title:t.unref(N)(e.locale,le.labelKey),onClick:ne=>w(le.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:le.icon},null,8,rn),t.createElementVNode("span",an,t.toDisplayString(t.unref(N)(e.locale,le.labelKey)),1)],8,nn))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-67c0f9e3"]]),sn=["disabled","title","onClick"],dn={class:"calc-picker__label"},un=vt(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,c=o,d=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),v=t.ref(null),u=t.ref(null),k=t.ref({top:0});t.watch(()=>l.modelOpen,B=>{B!==void 0&&B!==r.value&&(B?S():w())});function x(B){const le=v.value,ne=u.value,p=B.target;le&&le.contains(p)||ne&&ne.contains(p)||w()}function S(){r.value=!0,l.modelOpen!==void 0&&c("update:modelOpen",!0),t.nextTick(()=>{const B=l.triggerEl??v.value;if(B){const le=B.getBoundingClientRect(),ne=d.length*30+12,p=160;let V=window.innerWidth-le.right,P=le.bottom+4,oe;le.left-p<4&&(V=void 0,oe=Math.max(4,le.left)),P+ne>window.innerHeight-4&&(P=le.top-ne-4),P<4&&(P=4),k.value=V!==void 0?{right:V,top:P}:{left:oe,top:P}}document.addEventListener("pointerdown",x)})}function w(){r.value=!1,l.modelOpen!==void 0&&c("update:modelOpen",!1),document.removeEventListener("pointerdown",x)}function R(B){l.disabled||(c("change",B),w())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",x)}),n({open:r,openMenu:S,close:w}),(B,le)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:v,class:"calc-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:u,class:"calc-picker__menu",style:t.normalizeStyle({left:k.value.left!==void 0?k.value.left+"px":void 0,right:k.value.right!==void 0?k.value.right+"px":void 0,top:k.value.top+"px"}),onMousedown:le[0]||(le[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,ne=>t.createElementVNode("button",{key:ne.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(N)(e.locale,ne.labelKey),onClick:p=>R(ne.key)},[t.createElementVNode("span",dn,t.toDisplayString(t.unref(N)(e.locale,ne.labelKey)),1)],10,sn)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-9029e58c"]]),fn={class:"tb-item","data-key":"undo"},mn=["title","disabled"],pn={class:"tb-item","data-key":"redo"},gn=["title","disabled"],hn={class:"tb-item","data-key":"paint"},Cn=["title","disabled"],bn={class:"tb-item","data-key":"clear"},yn=["title","disabled"],vn={class:"tb-item","data-key":"font"},wn={class:"tb-item","data-key":"fontSize"},kn={class:"toolbar-font-size"},En=["value","title"],Rn=["title"],Bn=["title","disabled"],xn=["title","disabled"],Mn={class:"tb-item","data-key":"bold"},Sn=["title","disabled"],Tn={class:"tb-item","data-key":"italic"},Dn=["title","disabled"],Nn={class:"tb-item","data-key":"underline"},An=["title","disabled"],Hn={class:"tb-item","data-key":"strike"},Vn=["title","disabled"],Fn={class:"tb-item","data-key":"textColor"},On={class:"toolbar-split"},Ln=["title","disabled"],In={viewBox:"0 0 1024 1024",fill:"currentColor"},$n=["fill"],zn=["title","disabled"],Wn={class:"tb-item","data-key":"fillColor"},_n={class:"toolbar-split"},Kn=["title","disabled"],Un={viewBox:"0 0 1024 1024",fill:"currentColor"},Gn=["fill"],Pn=["title","disabled"],Yn={class:"tb-item","data-key":"border"},Xn={class:"toolbar-split"},jn=["title","disabled"],Zn={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},qn=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Jn=["title","disabled"],Qn={class:"tb-item","data-key":"hAlign"},er={class:"tb-item","data-key":"vAlign"},tr={class:"tb-item","data-key":"wrap"},lr=["title"],or={class:"tb-item","data-key":"merge"},nr={class:"toolbar-split"},rr=["title","disabled"],ar=["title","disabled"],ir={class:"tb-item","data-key":"numFmt"},cr={class:"tb-item","data-key":"calc"},sr={class:"toolbar-split"},dr=["title","disabled"],ur=["title","disabled"],fr={class:"tb-item","data-key":"find"},mr=["title"],Cl=2,pr=6,gr=34,hr=vt(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:{}},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","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","find","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"]},c={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function d(A,a){return c[A].includes(a)?"thick":l[A].includes(a)?"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"],v=t.ref(null),u=t.ref(null),k=t.ref(null),x=t.ref(null),S=t.ref(null),w=t.ref(null),R=t.ref(null),B=t.ref(null),le=t.ref(null),ne=t.ref(new Set),p=t.ref(!1),V=t.ref(!1),P=t.ref(0),oe=new Map,Z=t.computed(()=>ne.value.size>0);function J(A){return ne.value.has(A)}const q=t.computed(()=>{const A=u.value;return A instanceof HTMLElement?A:void 0});function ue(A){return q.value?!J(A):!0}function Fe(){for(const A of r){const a=oe.get(A);if(a===void 0||a===0)return!0}return!1}function Oe(){if(!v.value)return;v.value.querySelectorAll(".tb-item").forEach(a=>{const h=a.dataset.key;if(!h)return;const _=a.offsetWidth;_>0?oe.set(h,_):oe.has(h)||oe.set(h,0)})}function Je(A,a){if(A.size!==a.size)return!1;for(const h of A)if(!a.has(h))return!1;return!0}let Ge=0,je=0;function se(){Ge&&cancelAnimationFrame(Ge),!(je>60)&&(je++,Ge=requestAnimationFrame(()=>requestAnimationFrame(de)))}function de(){if(!v.value)return;const A=v.value.clientWidth-pr*2;if(A<=0){se();return}je=0,(oe.size===0||Fe())&&Oe();let a=0;for(const _ of r)a+=(oe.get(_)??0)+Cl;const h=new Set;if(a>A){const _=A-gr-Cl;let E=0;for(let W=0;W<r.length;W++){const Y=r[W],Me=(oe.get(Y)??0)+Cl;if(E+Me>_){for(let Ve=W;Ve<r.length;Ve++)h.add(r[Ve]);break}E+=Me}}Je(h,ne.value)||(ne.value=h,P.value++,h.size===0&&(p.value=!1))}let Te=null;const re=t.ref(0),i=t.computed(()=>{const A=k.value,a={position:"fixed",top:"0px",right:"0px"};if(!A)return{...f.themeVars,...a};re.value;const h=A.getBoundingClientRect();return{...f.themeVars,position:"fixed",top:`${h.bottom+4}px`,right:`${window.innerWidth-h.right}px`}});function m(){p.value&&(re.value++,t.nextTick(()=>de()))}function fe(A){var h,_;if(!p.value)return;const a=A.target;(h=u.value)!=null&&h.contains(a)||(_=k.value)!=null&&_.contains(a)||(V.value=!0,p.value=!1,t.nextTick(()=>{V.value=!1}))}function De(){p.value=!p.value}t.onMounted(()=>{se(),v.value&&(Te=new ResizeObserver(()=>{p.value||se()}),Te.observe(v.value)),document.addEventListener("pointerdown",fe,!0),window.addEventListener("resize",m),window.addEventListener("load",se),window.addEventListener("orientationchange",se)}),t.onBeforeUnmount(()=>{Ge&&cancelAnimationFrame(Ge),Te==null||Te.disconnect(),document.removeEventListener("pointerdown",fe,!0),window.removeEventListener("resize",m),window.removeEventListener("load",se),window.removeEventListener("orientationchange",se)});const f=e,y=n,T=t.computed(()=>f.selNumberFormat===nl?N(f.locale,"nfMixed"):"");return(A,a)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:v,class:"toolbar"},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("undo"),to:q.value},[t.createElementVNode("div",fn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(N)(e.locale,"undo"),disabled:!e.canUndo,onClick:a[0]||(a[0]=h=>y("undo"))},[...a[45]||(a[45]=[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,mn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("redo"),to:q.value},[t.createElementVNode("div",pn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(N)(e.locale,"redo"),disabled:!e.canRedo,onClick:a[1]||(a[1]=h=>y("redo"))},[...a[46]||(a[46]=[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,gn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("paint"),to:q.value},[t.createElementVNode("div",hn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(N)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:a[2]||(a[2]=h=>y("paint-format"))},[...a[47]||(a[47]=[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,Cn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("clear"),to:q.value},[t.createElementVNode("div",bn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(N)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:a[3]||(a[3]=h=>y("clear-format"))},[...a[48]||(a[48]=[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,yn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep1"),to:q.value},[a[49]||(a[49]=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:ue("font"),to:q.value},[t.createElementVNode("div",vn,[t.createVNode(Xt,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:J("font")?"100%":110,"menu-width":J("font")?120:void 0,"visible-count":8,title:t.unref(N)(e.locale,"fontFamily"),align:"right",onChange:a[4]||(a[4]=h=>y("font-family-change",h))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("fontSize"),to:q.value},[t.createElementVNode("div",wn,[t.createElementVNode("div",kn,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(N)(e.locale,"fontSize"),onInput:a[5]||(a[5]=h=>y("font-size-input",h.target.value)),onBlur:a[6]||(a[6]=h=>y("font-size-blur")),onKeydown:a[7]||(a[7]=h=>y("font-size-keydown",h))},null,40,En),t.createVNode(Xt,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:J("fontSize")?"100%":56,"menu-width":J("fontSize")?120:56,"visible-count":9,title:t.unref(N)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":le.value,"onUpdate:modelOpen":a[8]||(a[8]=h=>y("update:font-size-menu-open",h)),onChange:a[9]||(a[9]=h=>y("font-size-change",h))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:le,class:"toolbar-font-size__btn",type:"button",title:t.unref(N)(e.locale,"fontSize"),onMousedown:a[10]||(a[10]=t.withModifiers(()=>{},["prevent"])),onClick:a[11]||(a[11]=h=>y("font-size-toggle"))},[...a[50]||(a[50]=[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,Rn),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(N)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:a[12]||(a[12]=t.withModifiers(()=>{},["prevent"])),onClick:a[13]||(a[13]=h=>y("font-size-step-down"))},[...a[51]||(a[51]=[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,Bn),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(N)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:a[14]||(a[14]=t.withModifiers(()=>{},["prevent"])),onClick:a[15]||(a[15]=h=>y("font-size-step-up"))},[...a[52]||(a[52]=[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,xn)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep2"),to:q.value},[a[53]||(a[53]=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:ue("bold"),to:q.value},[t.createElementVNode("div",Mn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(N)(e.locale,"bold"),disabled:!e.hasSelection,onClick:a[16]||(a[16]=h=>y("bold-toggle"))},[...a[54]||(a[54]=[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,Sn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("italic"),to:q.value},[t.createElementVNode("div",Tn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(N)(e.locale,"italic"),disabled:!e.hasSelection,onClick:a[17]||(a[17]=h=>y("italic-toggle"))},[...a[55]||(a[55]=[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,Dn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("underline"),to:q.value},[t.createElementVNode("div",Nn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(N)(e.locale,"underline"),disabled:!e.hasSelection,onClick:a[18]||(a[18]=h=>y("underline-toggle"))},[...a[56]||(a[56]=[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,An)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("strike"),to:q.value},[t.createElementVNode("div",Hn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(N)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:a[19]||(a[19]=h=>y("strikethrough-toggle"))},[...a[57]||(a[57]=[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,Vn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep3"),to:q.value},[a[58]||(a[58]=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:ue("textColor"),to:q.value},[t.createElementVNode("div",Fn,[t.createElementVNode("div",On,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(N)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:a[20]||(a[20]=h=>y("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",In,[a[59]||(a[59]=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,$n)]))],8,Ln),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:x,class:"toolbar-btn toolbar-split__arrow",title:t.unref(N)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:a[21]||(a[21]=h=>y("update:text-color-menu-open",!e.textColorMenuOpen))},[...a[60]||(a[60]=[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,zn),t.createVNode(Ul,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":x.value,"onUpdate:modelOpen":a[22]||(a[22]=h=>y("update:text-color-menu-open",h)),onChange:a[23]||(a[23]=h=>y("text-color-change",h))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("fillColor"),to:q.value},[t.createElementVNode("div",Wn,[t.createElementVNode("div",_n,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(N)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:a[24]||(a[24]=h=>y("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",Un,[a[61]||(a[61]=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,Gn)]))],8,Kn),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:S,class:"toolbar-btn toolbar-split__arrow",title:t.unref(N)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:a[25]||(a[25]=h=>y("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...a[62]||(a[62]=[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,Pn),t.createVNode(Ul,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":S.value,"onUpdate:modelOpen":a[26]||(a[26]=h=>y("update:fill-color-menu-open",h)),onChange:a[27]||(a[27]=h=>y("fill-color-change",h))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("border"),to:q.value},[t.createElementVNode("div",Yn,[t.createElementVNode("div",Xn,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(N)(e.locale,"borders"),disabled:!e.hasSelection,onClick:a[28]||(a[28]=h=>y("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",Zn,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(o,h=>t.createElementVNode("line",{key:h.name,x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,"stroke-width":d(e.cachedBorder,h.name)==="thick"?3:1.5,"stroke-dasharray":d(e.cachedBorder,h.name)==="dashed"?"0 4":"none","stroke-linecap":d(e.cachedBorder,h.name)==="dashed"?"round":"square"},null,8,qn)),64))]))],8,jn),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:w,class:"toolbar-btn toolbar-split__arrow",title:t.unref(N)(e.locale,"borders"),disabled:!e.hasSelection,onClick:a[29]||(a[29]=h=>y("update:border-menu-open",!e.borderMenuOpen))},[...a[63]||(a[63]=[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,Jn),t.createVNode(on,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":w.value,"onUpdate:modelOpen":a[30]||(a[30]=h=>y("update:border-menu-open",h)),onChange:a[31]||(a[31]=h=>y("border-change",h))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep4"),to:q.value},[a[64]||(a[64]=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:ue("hAlign"),to:q.value},[t.createElementVNode("div",Qn,[t.createVNode(Xt,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:J("hAlign")?"100%":44,"menu-width":J("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(N)(e.locale,"hAlign"),onChange:a[32]||(a[32]=h=>y("h-align-change",h))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("vAlign"),to:q.value},[t.createElementVNode("div",er,[t.createVNode(Xt,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:J("vAlign")?"100%":44,"menu-width":J("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(N)(e.locale,"vAlign"),onChange:a[33]||(a[33]=h=>y("v-align-change",h))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",tr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(N)(e.locale,"wrap"),onClick:a[34]||(a[34]=h=>y("wrap-toggle"))},[...a[65]||(a[65]=[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,lr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("merge"),to:q.value},[t.createElementVNode("div",or,[t.createElementVNode("div",nr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(N)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:a[35]||(a[35]=h=>y("apply-merge"))},[...a[66]||(a[66]=[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,rr),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:R,class:"toolbar-btn toolbar-split__arrow",title:t.unref(N)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:a[36]||(a[36]=h=>y("update:merge-menu-open",!e.mergeMenuOpen))},[...a[67]||(a[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,ar),t.createVNode(cn,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":R.value,"onUpdate:modelOpen":a[37]||(a[37]=h=>y("update:merge-menu-open",h)),onChange:a[38]||(a[38]=h=>y("merge-change",h))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep6"),to:q.value},[a[68]||(a[68]=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:ue("numFmt"),to:q.value},[t.createElementVNode("div",ir,[t.createVNode(Xt,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:J("numFmt")?"100%":92,"menu-width":(J("numFmt"),150),"visible-count":8,title:t.unref(N)(e.locale,"numberFormat"),"fallback-label":T.value,align:"right",onChange:a[39]||(a[39]=h=>y("number-format-change",String(h)))},null,8,["model-value","options","width","menu-width","title","fallback-label"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep7"),to:q.value},[a[69]||(a[69]=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:ue("calc"),to:q.value},[t.createElementVNode("div",cr,[t.createElementVNode("div",sr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(N)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:a[40]||(a[40]=h=>y("calc-sum"))},[...a[70]||(a[70]=[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,dr),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:B,class:"toolbar-btn toolbar-split__arrow",title:t.unref(N)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:a[41]||(a[41]=h=>y("update:calc-menu-open",!e.calcMenuOpen))},[...a[71]||(a[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,ur),t.createVNode(un,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":B.value,disabled:e.isSingleCell,"onUpdate:modelOpen":a[42]||(a[42]=h=>y("update:calc-menu-open",h)),onChange:a[43]||(a[43]=h=>y(`calc-${h}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("find"),to:q.value},[t.createElementVNode("div",fr,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(N)(e.locale,"find"),onClick:a[44]||(a[44]=h=>y("find"))},[...a[72]||(a[72]=[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,mr)])],8,["disabled","to"])),Z.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:k,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":p.value}]),type:"button",onClick:De},[...a[73]||(a[73]=[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)],512),(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:u,key:P.value,class:t.normalizeClass(["overflow-menu",{"no-anim":V.value}]),style:t.normalizeStyle(i.value)},null,6)),[[t.vShow,p.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-a36c59af"]]),Cr={class:"tab-list"},br=["onClick","onDblclick","onContextmenu"],yr=["value"],vr={key:1,class:"tab-item__name"},wr=["title"],kr=vt(t.defineComponent({__name:"tabbar",props:{locale:{},sheets:{},activeSheetIndex:{},renTab:{},renTabVal:{}},emits:["tab-click","tab-dblclick","tab-contextmenu","tab-rename-input","tab-rename-keydown","tab-rename-commit","add-sheet","tabbar-contextmenu"],setup(e,{emit:n}){const o=n;return(l,c)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:c[5]||(c[5]=d=>o("tabbar-contextmenu",d))},[t.createElementVNode("div",Cr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(d,r)=>(t.openBlock(),t.createElementBlock("div",{key:d.id,class:t.normalizeClass(["tab-item",{"tab-item--active":r===e.activeSheetIndex}]),onClick:v=>o("tab-click",r),onDblclick:t.withModifiers(v=>o("tab-dblclick",r),["prevent"]),onContextmenu:v=>o("tab-contextmenu",{ev:v,i:r})},[e.renTab===r?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:c[0]||(c[0]=v=>o("tab-rename-input",v.target.value)),onKeydown:c[1]||(c[1]=v=>o("tab-rename-keydown",v)),onBlur:c[2]||(c[2]=v=>o("tab-rename-commit")),onClick:c[3]||(c[3]=t.withModifiers(()=>{},["stop"]))},null,40,yr)):(t.openBlock(),t.createElementBlock("span",vr,t.toDisplayString(d.name),1))],42,br))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(N)(e.locale,"addSheet"),onClick:c[4]||(c[4]=d=>o("add-sheet"))}," + ",8,wr)],32))}}),[["__scopeId","data-v-454e1a12"]]),Er=["placeholder","value"],Rr=["placeholder","value"],Br=["value","title"],xr={value:"sheet"},Mr={value:"workbook"},Sr={value:"selection"},Tr={class:"find-bar__chk"},Dr=["checked"],Nr={class:"find-bar__chk"},Ar=["checked"],Hr={class:"find-bar__count"},Vr=["title","disabled"],Fr=["title","disabled"],Or=["disabled"],Lr=["disabled"],Ir=["title"],$r=vt(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,c=t.ref(null),d=t.computed(()=>o.total>0?`${o.currentIndex+1}/${o.total}`:o.message||"");t.watch(()=>o.focusToken,()=>{t.nextTick(()=>{var u;return(u=c.value)==null?void 0:u.focus()})});function r(u){u.key==="Enter"?(u.preventDefault(),u.shiftKey?l("prev"):l("next")):u.key==="Escape"&&(u.preventDefault(),l("close"))}function v(u){l("update:scope",u.target.value)}return(u,k)=>e.open?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("input",{ref_key:"findInputRef",ref:c,class:"find-bar__input",placeholder:t.unref(N)(e.locale,"findPlaceholder"),value:e.findText,onInput:k[0]||(k[0]=x=>l("update:findText",x.target.value)),onKeydown:r},null,40,Er),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(N)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:k[1]||(k[1]=x=>l("update:replaceText",x.target.value)),onKeydown:r},null,40,Rr),t.createElementVNode("select",{class:"find-bar__select",value:e.scope,title:t.unref(N)(e.locale,"findScope"),onChange:v},[t.createElementVNode("option",xr,t.toDisplayString(t.unref(N)(e.locale,"scopeSheet")),1),t.createElementVNode("option",Mr,t.toDisplayString(t.unref(N)(e.locale,"scopeWorkbook")),1),t.createElementVNode("option",Sr,t.toDisplayString(t.unref(N)(e.locale,"scopeSelection")),1)],40,Br),t.createElementVNode("label",Tr,[t.createElementVNode("input",{type:"checkbox",checked:e.matchCase,onChange:k[2]||(k[2]=x=>l("update:matchCase",x.target.checked))},null,40,Dr),t.createTextVNode(t.toDisplayString(t.unref(N)(e.locale,"matchCase")),1)]),t.createElementVNode("label",Nr,[t.createElementVNode("input",{type:"checkbox",checked:e.matchEntireCell,onChange:k[3]||(k[3]=x=>l("update:matchEntireCell",x.target.checked))},null,40,Ar),t.createTextVNode(t.toDisplayString(t.unref(N)(e.locale,"matchEntireCell")),1)]),t.createElementVNode("span",Hr,t.toDisplayString(d.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(N)(e.locale,"findPrev"),disabled:e.total===0,onClick:k[4]||(k[4]=x=>l("prev"))},[...k[9]||(k[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,Vr),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(N)(e.locale,"findNext"),disabled:e.total===0,onClick:k[5]||(k[5]=x=>l("next"))},[...k[10]||(k[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,Fr),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:k[6]||(k[6]=x=>l("replace"))},t.toDisplayString(t.unref(N)(e.locale,"replace")),9,Or),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:k[7]||(k[7]=x=>l("replace-all"))},t.toDisplayString(t.unref(N)(e.locale,"replaceAll")),9,Lr),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(N)(e.locale,"findClose"),onClick:k[8]||(k[8]=x=>l("close"))},[...k[11]||(k[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,Ir)],4)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0d187de9"]]),zr={class:"nf-dialog__header"},Wr={class:"nf-dialog__title"},_r={class:"nf-dialog__body"},Kr={class:"nf-field"},Ur={class:"nf-field__label"},Gr=["value"],Pr={key:0,class:"nf-field"},Yr={class:"nf-field__label"},Xr={key:1,class:"nf-field nf-field--inline"},jr={class:"nf-checkbox"},Zr={key:2,class:"nf-field"},qr={class:"nf-field__label"},Jr=["value"],Qr={key:3,class:"nf-field"},ea={class:"nf-field__label"},ta=["value"],la={key:4,class:"nf-field"},oa={class:"nf-field__label"},na=["value"],ra={key:5,class:"nf-field"},aa={class:"nf-field__label"},ia=["value"],ca={key:6,class:"nf-field"},sa={class:"nf-field__label"},da=["value"],ua={class:"nf-field"},fa={class:"nf-field__label"},ma={class:"nf-dialog__footer"},pa={class:"nf-preview"},ga={class:"nf-preview__label"},ha={class:"nf-preview__value"},Ca={class:"nf-dialog__actions"},ba=vt(t.defineComponent({__name:"numberFormatDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"},currentFormat:{default:""},sampleValue:{default:"1234.5"}},emits:["update:modelOpen","apply"],setup(e,{emit:n}){const o=e,l=n,c=t.ref(!1),d=t.ref("general"),r=t.ref(2),v=t.ref(!1),u=t.ref("$"),k=t.ref("m/d/yyyy"),x=t.ref("h:mm:ss"),S=t.ref("m/d/yyyy h:mm:ss"),w=t.ref("[h]:mm:ss"),R=t.ref(""),B=t.ref(null),le=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],ne=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],p=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],V=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],P=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],oe=t.computed(()=>o.locale==="zh-CN"?[...ne,...p]:[...p,...ne]),Z=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],J=t.computed(()=>o.locale==="zh-CN"?[...V,...P]:[...P,...V]),q=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],ue={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"},Fe=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(d.value)),Oe=t.computed(()=>["currency","currencyRounded","accounting"].includes(d.value)),Je=t.computed(()=>d.value==="date"),Ge=t.computed(()=>d.value==="time"),je=t.computed(()=>d.value==="dateTime"),se=t.computed(()=>d.value==="duration"),de=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(d.value));function Te(){if(d.value==="general")return rl;if(d.value==="text")return Ht;if(d.value==="custom")return R.value;if(d.value==="date")return k.value;if(d.value==="time")return x.value;if(d.value==="dateTime")return S.value;if(d.value==="duration")return w.value;const E=Math.max(0,Math.min(30,r.value));return d.value==="currency"||d.value==="currencyRounded"||d.value==="accounting"?re(d.value,E,v.value,u.value):Wo(o.locale,d.value,E,v.value)}function re(E,W,Y,Me){const Ve=Y?"#,##0":"0";if(E==="currencyRounded")return Me+Ve;const Ke=W>0?"."+"0".repeat(W):"",Be=Ve+Ke;return E==="currency"?Me+Be:`${Me}${Be};(${Me}${Be});${Me}"-"`}function i(E){if(R.value=E,Yt(E)){d.value="general";return}if(E==="@"){d.value="text";return}if(/\[h\]/i.test(E)&&!/[yd]/i.test(E)){d.value="duration",q.includes(E)&&(w.value=E);return}const W=/[yd]/i.test(E),Y=/h|s|AM\/PM/i.test(E);if(W&&Y){d.value="dateTime",J.value.includes(E)&&(S.value=E);return}if(W||/AM\/PM/i.test(E)){Y&&!W?(d.value="time",Z.includes(E)&&(x.value=E)):(d.value="date",oe.value.includes(E)&&(k.value=E));return}if(E.includes("%")){d.value="percent",r.value=m(E);return}if(/E[+-]/i.test(E)){d.value="scientific",r.value=m(E);return}const Me=le.find(Ve=>E.startsWith(Ve.value));if(E.includes("[Red](")){d.value="financial",v.value=E.includes(","),r.value=m(E);return}if(Me){E.includes("(")?(d.value="accounting",u.value=Me.value,v.value=E.includes(","),r.value=m(E)):/\.\d/.test(E.slice(Me.value.length))?(d.value="currency",u.value=Me.value,v.value=E.includes(","),r.value=m(E)):(d.value="currencyRounded",u.value=Me.value,v.value=E.includes(","));return}d.value="number",v.value=E.includes(","),r.value=m(E)}function m(E){const W=E.match(/\.([0#?]+)/);return W?W[1].length:0}function fe(){d.value!=="custom"&&(R.value=Te())}function De(){}function f(){k.value=oe.value[0],x.value=Z[0],S.value=J.value[0],w.value=q[0]}function y(){c.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0),f(),i(o.currentFormat??""),t.nextTick(()=>{var E;return(E=B.value)==null?void 0:E.focus()})}function T(){c.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function A(){l("apply",R.value),T()}function a(){T()}function h(E){E.key==="Escape"&&T()}t.watch(()=>o.modelOpen,E=>{E&&!c.value?y():!E&&c.value&&T()});const _=t.computed(()=>hl(o.sampleValue,R.value,o.locale));return(E,W)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"nf-dialog"},{default:t.withCtx(()=>[c.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"nf-dialog__mask",onMousedown:a,onKeydown:h},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:W[9]||(W[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",zr,[t.createElementVNode("span",Wr,t.toDisplayString(t.unref(N)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:T},[...W[10]||(W[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",_r,[t.createElementVNode("div",Kr,[t.createElementVNode("label",Ur,t.toDisplayString(t.unref(N)(e.locale,"nfCategory")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[0]||(W[0]=Y=>d.value=Y),class:"nf-field__select",onChange:fe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Io),Y=>(t.openBlock(),t.createElementBlock("option",{key:Y,value:Y},t.toDisplayString(t.unref(N)(e.locale,ue[Y])),9,Gr))),128))],544),[[t.vModelSelect,d.value]])]),de.value?(t.openBlock(),t.createElementBlock("div",Pr,[t.createElementVNode("label",Yr,t.toDisplayString(t.unref(N)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":W[1]||(W[1]=Y=>r.value=Y),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:fe},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),Fe.value?(t.openBlock(),t.createElementBlock("div",Xr,[t.createElementVNode("label",jr,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":W[2]||(W[2]=Y=>v.value=Y),type:"checkbox",onChange:fe},null,544),[[t.vModelCheckbox,v.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(N)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),Oe.value?(t.openBlock(),t.createElementBlock("div",Zr,[t.createElementVNode("label",qr,t.toDisplayString(t.unref(N)(e.locale,"nfSymbol")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[3]||(W[3]=Y=>u.value=Y),class:"nf-field__select",onChange:fe},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(le,Y=>t.createElementVNode("option",{key:Y.value,value:Y.value},t.toDisplayString(Y.label),9,Jr)),64))],544),[[t.vModelSelect,u.value]])])):t.createCommentVNode("",!0),Je.value?(t.openBlock(),t.createElementBlock("div",Qr,[t.createElementVNode("label",ea,t.toDisplayString(t.unref(N)(e.locale,"nfDateFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[4]||(W[4]=Y=>k.value=Y),class:"nf-field__select",onChange:fe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe.value,Y=>(t.openBlock(),t.createElementBlock("option",{key:Y,value:Y},t.toDisplayString(Y),9,ta))),128))],544),[[t.vModelSelect,k.value]])])):t.createCommentVNode("",!0),Ge.value?(t.openBlock(),t.createElementBlock("div",la,[t.createElementVNode("label",oa,t.toDisplayString(t.unref(N)(e.locale,"nfTimeFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[5]||(W[5]=Y=>x.value=Y),class:"nf-field__select",onChange:fe},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(Z,Y=>t.createElementVNode("option",{key:Y,value:Y},t.toDisplayString(Y),9,na)),64))],544),[[t.vModelSelect,x.value]])])):t.createCommentVNode("",!0),je.value?(t.openBlock(),t.createElementBlock("div",ra,[t.createElementVNode("label",aa,t.toDisplayString(t.unref(N)(e.locale,"nfDateTime")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[6]||(W[6]=Y=>S.value=Y),class:"nf-field__select",onChange:fe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(J.value,Y=>(t.openBlock(),t.createElementBlock("option",{key:Y,value:Y},t.toDisplayString(Y),9,ia))),128))],544),[[t.vModelSelect,S.value]])])):t.createCommentVNode("",!0),se.value?(t.openBlock(),t.createElementBlock("div",ca,[t.createElementVNode("label",sa,t.toDisplayString(t.unref(N)(e.locale,"nfDuration")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[7]||(W[7]=Y=>w.value=Y),class:"nf-field__select",onChange:fe},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(q,Y=>t.createElementVNode("option",{key:Y,value:Y},t.toDisplayString(Y),9,da)),64))],544),[[t.vModelSelect,w.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",ua,[t.createElementVNode("label",fa,t.toDisplayString(t.unref(N)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:B,"onUpdate:modelValue":W[8]||(W[8]=Y=>R.value=Y),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:De},null,544),[[t.vModelText,R.value]])])]),t.createElementVNode("div",ma,[t.createElementVNode("div",pa,[t.createElementVNode("span",ga,t.toDisplayString(t.unref(N)(e.locale,"nfPreview")),1),t.createElementVNode("span",ha,t.toDisplayString(_.value||"—"),1)]),t.createElementVNode("div",Ca,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:A},t.toDisplayString(t.unref(N)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:T},t.toDisplayString(t.unref(N)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-69cb36b7"]]);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 bl(e){let n=0;for(let o=0;o<e.length;o++)n=n*26+(e.toUpperCase().charCodeAt(o)-64);return n-1}function Vt(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 yl(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 Kt(e,n){return`${e},${n}`}function jt(e,n,o){const l=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!l)return null;const c=bl(l[1]),d=parseInt(l[2],10)-1;return c<0||c>=n||d<0||d>=o?null:{col:c,row:d}}function Ft(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 Gl(e,n,o){const l=e.split(":");if(l.length!==2)return null;const c=jt(l[0],n,o),d=jt(l[1],n,o);return!c||!d?null:{sc:Math.min(c.col,d.col),sr:Math.min(c.row,d.row),ec:Math.max(c.col,d.col),er:Math.max(c.row,d.row)}}function Pl(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 Ot(e,n,o,l,c){const d=o[Kt(e,n)];if(!d)return"";const r=d.value;return r.startsWith("=")?Yl(Kt(e,n),o,l,c):Pl(r)}function ya(e,n,o,l,c){const d=Ot(e,n,o,l,c);if(d===null)return 0;if(typeof d=="number")return d;const r=parseFloat(String(d));return isNaN(r)?0:r}const Zt=new Map,il=new Set;function vl(){Zt.clear(),il.clear()}function Yl(e,n,o,l){return va(e,n,o,l,0)}function va(e,n,o,l,c){if(il.has(e))return null;if(Zt.has(e))return Zt.get(e);il.add(e);const d=n[e];let r;if(!d)r=null;else{const v=d.value;if(!v.startsWith("="))r=Pl(v);else{const u=v.slice(1).trim(),k=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(u);r=k?jl(k[1].toUpperCase(),k[2],n,o,l,c+1):null}}return il.delete(e),Zt.set(e,r),r}function Xl(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function wa(e,n){return typeof e=="number"&&typeof n=="number"?e===n:String(e??"")===String(n??"")}function ka(e,n,o){let l;if(typeof e=="number"&&typeof n=="number")l=e<n?-1:e>n?1:0;else{const c=String(e??""),d=String(n??"");l=c<d?-1:c>d?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 Ea(e,n,o,l,c){const d=e.trim();let r=null,v=-1,u=null,k=0;for(let S=0;S<d.length;S++){const w=d[S];if(u){w===u&&(d[S+1]===u?S++:u=null);continue}if(w==='"'||w==="'"){u=w;continue}if(w==="("&&k++,w===")"&&k--,k===0&&(w==="<"||w===">"||w==="=")){let R=null;const B=d.slice(S,S+2);B==="<="||B===">="||B==="<>"?R=B:R=w,r=R,v=S,R.length===2&&S++;break}}if(r&&v>=0){const S=d.slice(0,v).trim(),w=d.slice(v+r.length).trim(),R=Et(S,n,o,l,c),B=Et(w,n,o,l,c);return ka(R,B,r)}const x=Et(d,n,o,l,c);return Xl(x)}function wl(e){const n=[];let o=0,l=null,c="";for(let d=0;d<e.length;d++){const r=e[d];if(l){c+=r,r===l&&(e[d+1]===l?(d++,c+=l):l=null);continue}if(r==='"'||r==="'"){l=r,c+=r;continue}if(r==="("&&o++,r===")"&&o--,r===","&&o===0){n.push(c),c="";continue}c+=r}return n.push(c),n}function Et(e,n,o,l,c){if(c>20)return null;const d=e.trim();if(d==="")return null;const r=d.toUpperCase();if(r==="TRUE")return 1;if(r==="FALSE")return 0;const v=Ra(d);if(v.length===0)return null;let u=0;const k=()=>{let R=x();for(;u<v.length;){const B=v[u];if(B.type==="op"&&(B.val==="+"||B.val==="-"))u++,R=kl(R,x(),B.val);else break}return R},x=()=>{let R=S();for(;u<v.length;){const B=v[u];if(B.type==="op"&&(B.val==="*"||B.val==="/"))u++,R=kl(R,S(),B.val);else break}return R},S=()=>{const R=v[u];return R&&R.type==="op"&&R.val==="-"?(u++,kl(0,S(),"-")):R&&R.type==="op"&&R.val==="+"?(u++,S()):w()},w=()=>{const R=v[u];if(!R)return null;if(R.type==="num")return u++,Number(R.val);if(R.type==="str")return u++,R.val;if(R.type==="lp"){u++;const B=k();return v[u]&&v[u].type==="rp"&&u++,B}if(R.type==="ref"){u++;const B=jt(R.val,o,l);return B?Ot(B.col,B.row,n,o,l):null}if(R.type==="func"){const B=R.val.toUpperCase();if(u++,v[u]&&v[u].type==="lp"){const le=v[u];let ne=0,p=null,V=u;for(;V<v.length;V++)if(v[V].type==="lp")ne++;else if(v[V].type==="rp"&&(ne--,ne===0)){p=v[V];break}if(p){const P=d.slice(le.start+1,p.start);return u=V+1,jl(B,P,n,o,l,c+1)}}return null}return u++,null};return k()}function Ra(e){const n=[];let o=0;for(;o<e.length;){const l=e[o];if(/\s/.test(l)){o++;continue}if(l==='"'||l==="'"){const c=l,d=o;o++;let r="";for(;o<e.length;){if(e[o]===c){if(e[o+1]===c){r+=c,o+=2;continue}o++;break}r+=e[o],o++}n.push({type:"str",val:r,start:d});continue}if(/[0-9]/.test(l)||l==="."){const c=o;let d="";for(l==="."&&(d+=".",o++);o<e.length&&/[0-9]/.test(e[o]);)d+=e[o],o++;if(e[o]===".")for(d+=".",o++;o<e.length&&/[0-9]/.test(e[o]);)d+=e[o],o++;if(e[o]==="e"||e[o]==="E")for(d+=e[o],o++,(e[o]==="+"||e[o]==="-")&&(d+=e[o],o++);o<e.length&&/[0-9]/.test(e[o]);)d+=e[o],o++;n.push({type:"num",val:d,start:c});continue}if(/[A-Za-z_]/.test(l)){const c=o;let d="";for(;o<e.length&&/[A-Za-z0-9_]/.test(e[o]);)d+=e[o],o++;e[o]==="("?n.push({type:"func",val:d,start:c}):n.push({type:"ref",val:d,start:c});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 kl(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 jl(e,n,o,l,c,d){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=Gl(n.trim(),l,c);if(!r)return null;if(e==="COUNT"){let u=0;for(let k=r.sc;k<=r.ec;k++)for(let x=r.sr;x<=r.er;x++)typeof Ot(k,x,o,l,c)=="number"&&u++;return u}let v=0;for(let u=r.sc;u<=r.ec;u++)for(let k=r.sr;k<=r.er;k++)v+=ya(u,k,o,l,c);if(isNaN(v))return null;if(e==="AVERAGE"){const u=(r.ec-r.sc+1)*(r.er-r.sr+1);return u===0?null:v/u}return v}case"IF":{const r=wl(n);if(r.length<3)return null;const v=Ea(r[0],o,l,c,d);return Et(v?r[1]:r[2],o,l,c,d)}case"VLOOKUP":{const r=wl(n);if(r.length<3)return null;const v=Et(r[0],o,l,c,d),u=Gl(r[1].trim(),l,c);if(!u)return null;const k=Et(r[2],o,l,c,d),x=typeof k=="number"?k:parseFloat(String(k));if(isNaN(x))return null;const S=u.sc+(x-1);if(S<u.sc||S>u.ec)return null;if(r.length>=4?Xl(Et(r[3],o,l,c,d)):!1){let R=-1,B=-1/0;for(let le=u.sr;le<=u.er;le++){const ne=Ot(u.sc,le,o,l,c);typeof ne=="number"&&typeof v=="number"&&ne<=v&&ne>B&&(B=ne,R=le)}return R>=0?Ot(S,R,o,l,c):null}for(let R=u.sr;R<=u.er;R++){const B=Ot(u.sc,R,o,l,c);if(wa(B,v))return Ot(S,R,o,l,c)}return null}case"CONCATENATE":{const r=wl(n);let v="";for(const u of r){const k=Et(u,o,l,c,d);v+=k===null?"":typeof k=="number"?String(k):k}return v}default:return null}}function El(e,n,o){const l=[],c=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let d;for(;(d=c.exec(e))!==null;){const r=jt(d[1],n,o);if(r)if(d[2]){const v=jt(d[2],n,o);if(!v)continue;for(let u=Math.min(r.col,v.col);u<=Math.max(r.col,v.col);u++)for(let k=Math.min(r.row,v.row);k<=Math.max(r.row,v.row);k++)l.push(Kt(u,k))}else l.push(Kt(r.col,r.row))}return l}function Ba(e,n,o,l,c){const d=o[Kt(e,n)];if(!d)return"";const r=d.value;if(!r.startsWith("="))return r;const v=Yl(Kt(e,n),o,l,c);return v===null?"#ERROR":String(v)}function xa(e,n,o,l,c,d){return n===0&&o===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,v,u,k,x)=>{const S=v?bl(u):bl(u)+n,w=k?parseInt(x,10)-1:parseInt(x,10)-1+o;let R;S<0?R="A":S>=l?R=d(l-1):R=d(S);let B;return w<0?B="1":w>=c?B=String(c):B=String(w+1),(v||"")+R+(k||"")+B})}class Ma{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 c of o)(l=this.rev.get(c))==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(),c=this.rev.get(l);if(c)for(const d of c)this.dirty.has(d)||(this.dirty.add(d),o.push(d))}}getDirtyAndClear(){const n=this.dirty;return this.dirty=new Set,n}rebuild(n,o,l){this.deps.clear(),this.rev.clear(),this.dirty.clear(),Zt.clear();for(const[c,d]of Object.entries(n))if(d.value.startsWith("=")){const r=El(d.value.slice(1),o,l);this.set(c,r)}}}function Sa(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"),c=o.colCount,d=o.rowCount,r=t.reactive({}),v=t.reactive({}),u=new Ma,k=t.ref(null),x=t.ref("cell"),S=t.ref({col:0,row:0}),w=t.ref(null),R=t.ref(""),B=t.ref(new Array(c).fill(100)),le=t.ref(new Array(d).fill(void 0)),ne=t.ref(0),p=t.ref(0),V=(24-kt)/2,P=new Map;let oe=null;function Z(H,O,I,Q){const ie=`${Q} ${I} ${O}px ${H}`,ke=P.get(ie);if(ke)return ke;if(!oe){if(typeof document>"u")return{ascent:O*.88,descent:O*.28};oe=document.createElement("canvas")}const Ne=oe.getContext("2d");if(!Ne)return{ascent:O*.88,descent:O*.28};Ne.font=ie;const ze=Ne.measureText(" "),Le=ze.fontBoundingBoxAscent,We=ze.fontBoundingBoxDescent;if(typeof Le=="number"&&typeof We=="number"&&Le>0&&We>0){const me={ascent:Le,descent:We};return P.set(ie,me),me}const Se=["M","中","y","Ä","0"];let b=0,F=0;for(const me of Se){const be=Ne.measureText(me),we=be.actualBoundingBoxAscent||0,Ae=be.actualBoundingBoxDescent||0;we>b&&(b=we),Ae>F&&(F=Ae)}const K=Math.max(b,O*.88),Ce=Math.max(F,O*.28),ge={ascent:K,descent:Ce};return P.set(ie,ge),ge}let J=(H,O)=>`${H},${O}`,q=()=>null,ue=()=>kt,Fe=t.computed(()=>[0]),Oe=()=>24,Je=(H,O,I,Q)=>({startCol:Math.min(H,I),startRow:Math.min(O,Q),endCol:Math.max(H,I),endRow:Math.max(O,Q)});function Ge(H,O){var ze;const I=(ze=r[J(H,O)])==null?void 0:ze.style,Q=ue(H,O),ie=typeof(I==null?void 0:I.fontFamily)=="string"&&I.fontFamily?I.fontFamily:Pt,ke=(I==null?void 0:I.fontWeight)==="bold"?"bold":"normal",Ne=(I==null?void 0:I.fontStyle)==="italic"?"italic":"normal";return Z(ie,Q,ke,Ne)}function je(H,O,I,Q){if(!O)return[""];const ie=O.split(`
2
+ `),ke=[];for(const Ne of ie)if(!Q||I<=0)ke.push(Ne);else{let ze="";for(let Le=0;Le<Ne.length;Le++){const We=Ne[Le],Se=ze+We;H.measureText(Se).width>I&&ze?(ke.push(ze),ze=We):ze=Se}ke.push(ze)}return ke}function se(H,O){var Q;const I=(Q=r[J(H,O)])==null?void 0:Q.style;return typeof(I==null?void 0:I.fontSize)=="number"&&I.fontSize>0?I.fontSize:kt}ue=se;const de=t.computed(()=>{const H=[0];for(let O=0;O<c;O++)H.push(H[O]+B.value[O]);return H});Fe=de;const Te={w:800,h:600};let re=()=>{};function i(H){var Se;const O=le.value[H];if(O!=null&&O>0)return O;let I,Q,ie=1;const ke=oe?oe.getContext("2d"):null,Ne=Z(Pt,kt,"normal","normal");I=Ne.ascent,Q=Ne.descent;for(let b=0;b<c;b++){const F=se(b,H),K=(Se=r[J(b,H)])==null?void 0:Se.style,Ce=typeof(K==null?void 0:K.fontFamily)=="string"&&K.fontFamily?K.fontFamily:Pt,ge=(K==null?void 0:K.fontWeight)==="bold"?"bold":"normal",me=(K==null?void 0:K.fontStyle)==="italic"?"italic":"normal",be=Z(Ce,F,ge,me);be.ascent>I&&(I=be.ascent),be.descent>Q&&(Q=be.descent);const we=typeof(K==null?void 0:K.numberFormat)=="string"?K.numberFormat:"",Ae=M(b,H),lt=hl(Ae,we,l.value);if(lt){const it=(K==null?void 0:K.wrap)==="wrap";let dt;if(it&&ke){ke.font=`${me} ${ge} ${F}px ${Ce}`;const Qe=q(b,H);let rt;Qe&&b===Qe.range.startCol&&H===Qe.range.startRow?rt=Fe.value[Qe.range.endCol+1]-Fe.value[b]:rt=B.value[b],dt=je(ke,lt,Math.max(0,rt-10),!0).length,dt>ie&&(ie=dt)}else dt=lt.split(`
3
+ `).length,dt>ie&&(ie=dt)}}const ze=I+Q,Le=V*2+ie*ze;return Math.min(500,Math.max(24,Math.round(Le)))}Oe=i;function m(H){return le.value[H]===void 0}const fe=t.computed(()=>{const H=[0];for(let O=0;O<d;O++)H.push(H[O]+Oe(O));return H}),De=t.computed(()=>de.value[c]),f=t.computed(()=>fe.value[d]);function y(H,O){return`${H},${O}`}J=y;function T(H){Reflect.deleteProperty(r,H)}function A(H,O){x.value="cell";const I=q(H,O);I?(S.value={col:I.range.startCol,row:I.range.startRow},k.value={...I.range}):(S.value={col:H,row:O},k.value={startCol:H,startRow:O,endCol:H,endRow:O})}function a(H,O,I,Q,ie="cell"){const ke=q(H,O);if(S.value=ke?{col:ke.range.startCol,row:ke.range.startRow}:{col:H,row:O},x.value=ie,ie==="row"||ie==="col"){const Ne=Math.min(H,I),ze=Math.max(H,I),Le=Math.min(O,Q),We=Math.max(O,Q);k.value={startCol:Ne,startRow:Le,endCol:ze,endRow:We}}else k.value=Je(H,O,I,Q)}function h(){a(0,0,c-1,d-1,"all")}function _(H,O){const I=k.value;return I?(x.value==="cell"||x.value==="all",H>=I.startCol&&H<=I.endCol&&O>=I.startRow&&O<=I.endRow):!1}function E(H,O){return _(H,O)}function W(H,O){for(const I in v){const Q=v[I];if(Q&&H>=Q.startCol&&H<=Q.endCol&&O>=Q.startRow&&O<=Q.endRow)return{range:Q,anchor:I}}return null}q=W;function Y(H,O){return v[y(H,O)]!==void 0}function Me(H,O){const I=q(H,O);if(I&&H===I.range.startCol&&O===I.range.startRow){const Q=de.value[I.range.endCol+1]-de.value[H],ie=fe.value[I.range.endRow+1]-fe.value[O];return{w:Q,h:ie}}return{w:B.value[H],h:Oe(O)}}function Ve(H,O,I,Q){let ie=Math.min(H,I),ke=Math.max(H,I),Ne=Math.min(O,Q),ze=Math.max(O,Q),Le=!0;for(;Le;){Le=!1;for(const We in v){const Se=v[We];if(!Se)continue;Se.startCol<=ke&&Se.endCol>=ie&&Se.startRow<=ze&&Se.endRow>=Ne&&(Se.startCol<ie&&(ie=Se.startCol,Le=!0),Se.endCol>ke&&(ke=Se.endCol,Le=!0),Se.startRow<Ne&&(Ne=Se.startRow,Le=!0),Se.endRow>ze&&(ze=Se.endRow,Le=!0))}}return{startCol:ie,startRow:Ne,endCol:ke,endRow:ze}}Je=Ve;let Ke=()=>{};function Be(H,O){var I;return((I=r[y(H,O)])==null?void 0:I.value)??""}function M(H,O){return vl(),Ba(H,O,r,c,d)}function D(H,O,I){var Ne,ze;const Q=y(H,O);if(vl(),I===""||I==null){u.clear(Q);const Le=((Ne=r[Q])==null?void 0:Ne.style)??null;Le?r[Q]={value:"",style:Le}:T(Q),u.markDirty(Q);return}const ie=String(I),ke=((ze=r[Q])==null?void 0:ze.style)??null;r[Q]={value:ie,style:ke},ie.startsWith("=")?u.set(Q,El(ie.slice(1),c,d)):u.clear(Q),u.markDirty(Q)}function G(H,O,I,Q){for(let ie=H;ie<=O;ie++)for(let ke=I;ke<=Q;ke++){const Ne=y(ie,ke);u.clear(Ne),T(Ne),u.markDirty(Ne),Ke(ie,ke)}}let ce=()=>{};function ee(H){w.value||(w.value={...S.value},H!==void 0?R.value=H:R.value||(R.value=Be(S.value.col,S.value.row)))}function ae(){w.value&&(ce(),D(w.value.col,w.value.row,R.value),w.value=null,R.value="")}function X(){w.value=null,R.value=""}function U(H,O){const I=S.value;let Q=Math.max(0,Math.min(c-1,I.col+H)),ie=Math.max(0,Math.min(d-1,I.row+O));const ke=q(I.col,I.row),Ne=q(Q,ie);ke&&Ne&&ke.anchor===Ne.anchor&&(H>0?Q=ke.range.endCol+1:H<0&&(Q=ke.range.startCol-1),O>0?ie=ke.range.endRow+1:O<0&&(ie=ke.range.startRow-1),Q=Math.max(0,Math.min(c-1,Q)),ie=Math.max(0,Math.min(d-1,ie))),A(Q,ie)}function ye(H,O){const I=Math.max(0,Te.w-52-11),Q=Math.max(0,Te.h-24-11),ie=de.value[H],ke=fe.value[O],Ne=q(H,O),ze=Ne?de.value[Ne.range.endCol+1]-de.value[H]:B.value[H],Le=Ne?fe.value[Ne.range.endRow+1]-fe.value[O]:Oe(O);let We=ne.value,Se=p.value;ie<We?We=ie:ie+ze>We+I&&(We=ie+ze-I),ke<Se?Se=ke:ke+Le>Se+Q&&(Se=ke+Le-Q),re(We,Se)}function Ee(H){const O=de.value;if(H<0||H>=O[c])return-1;let I=0,Q=c-1;for(;I<Q;){const ie=I+Q+1>>1;O[ie]<=H?I=ie:Q=ie-1}return I}function Ze(H){const O=fe.value;if(H<0||H>=O[d])return-1;let I=0,Q=d-1;for(;I<Q;){const ie=I+Q+1>>1;O[ie]<=H?I=ie:Q=ie-1}return I}const Pe={props:o,locale:l,colCount:c,rowCount:d,cells:r,merges:v,formulaDeps:u,selection:k,activeCell:S,editingCell:w,editValue:R,colWidths:B,rowHeights:le,scrollX:ne,scrollY:p,BASE_CELL_VPAD:V,fontMetricsCache:P,fontMetricsCanvas:oe,measureFontMetrics:Z,_getFontMetricsForCell:Ge,getWrappedLines:je,cellFontSize:se,colPositions:de,getRowHeight:i,_isAutoRow:m,rowPositions:fe,totalWidth:De,totalHeight:f,selectCell:A,selectRange:a,selectAll:h,isSelected:_,isCellSelected:E,selectionMode:x,cellKey:y,delCell:T,findMerge:W,_isMergeAnchor:Y,_mergedSpan:Me,expandSelectionForMerges:Ve,getCellRaw:Be,getCellValue:M,setCellValue:D,clearCellsInRange:G,startEdit:ee,commitEdit:ae,cancelEdit:X,moveActive:U,ensureVisible:ye,hitCol:Ee,hitRow:Ze,viewSize:Te,findHighlight:(H,O)=>null};return ce=()=>{var H;return(H=Pe.saveUndo)==null?void 0:H.call(Pe)},Ke=(H,O)=>{var I;return(I=Pe.syncCellBorders)==null?void 0:I.call(Pe,H,O)},re=(H,O)=>{var I;return(I=Pe.clampScroll)==null?void 0:I.call(Pe,H,O)},Pe}function Ta(e,n){const o=t.ref([]),l=t.ref([]);function c(b){const F={};for(const[K,Ce]of Object.entries(b))F[K]={value:Ce.value,style:Ce.style};return F}function d(){return n.saveSheet(),{sheets:n.sheets.value.map(b=>({id:b.id,name:b.name,cells:c(b.cells),merges:b.merges?{...b.merges}:{},selection:b.selection?{...b.selection}:null,activeCell:b.activeCell?{...b.activeCell}:{col:0,row:0},scrollX:b.scrollX,scrollY:b.scrollY,colWidths:[...b.colWidths],rowHeights:[...b.rowHeights]})),activeSheetIndex:n.activeSheetIndex.value}}function r(b){n.sheets.value=b.sheets.map(F=>({...F,cells:c(F.cells)})),n.loadSheet(Math.max(0,Math.min(b.activeSheetIndex,n.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function v(){const b=d(),F=o.value[o.value.length-1];F&&JSON.stringify(F)===JSON.stringify(b)||(o.value.push(b),l.value=[],o.value.length>50&&o.value.shift())}e.saveUndo=v;function u(){var b;o.value.length&&(l.value.push(d()),r(o.value.pop()),(b=e.scheduleRender)==null||b.call(e),t.nextTick(()=>{var F;return(F=e.emitModelData)==null?void 0:F.call(e)}))}function k(){var b;l.value.length&&(o.value.push(d()),r(l.value.pop()),(b=e.scheduleRender)==null||b.call(e),t.nextTick(()=>{var F;return(F=e.emitModelData)==null?void 0:F.call(e)}))}const x=t.computed(()=>o.value.length>0),S=t.computed(()=>l.value.length>0),w=t.computed(()=>!!e.selection.value),R=t.ref(null);function B(){var K;const b=e.selection.value;if(!b)return;const F={};for(let Ce=b.startCol;Ce<=b.endCol;Ce++)for(let ge=b.startRow;ge<=b.endRow;ge++)F[`${Ce-b.startCol},${ge-b.startRow}`]=((K=e.cells[e.cellKey(Ce,ge)])==null?void 0:K.style)??null;R.value={styles:F}}function le(){var K,Ce,ge,me;const b=R.value,F=e.selection.value;if(!(!b||!F)){v();for(let be=F.startCol;be<=F.endCol;be++)for(let we=F.startRow;we<=F.endRow;we++){const Ae=e.findMerge(be,we);if(Ae&&(be!==Ae.range.startCol||we!==Ae.range.startRow))continue;const lt=b.styles[`${be-F.startCol},${we-F.startRow}`]??null,it=e.cellKey(be,we),dt=((K=e.cells[it])==null?void 0:K.value)??"";dt===""&&lt===null?e.delCell(it):e.cells[it]={value:dt,style:lt},(Ce=e.syncCellBorders)==null||Ce.call(e,be,we)}R.value=null,(ge=e.scheduleRender)==null||ge.call(e),(me=e.emitModelData)==null||me.call(e)}}function ne(){var F,K,Ce,ge;const b=e.selection.value;if(b){v();for(let me=b.startCol;me<=b.endCol;me++)for(let be=b.startRow;be<=b.endRow;be++){const we=e.findMerge(me,be);if(we&&(me!==we.range.startCol||be!==we.range.startRow))continue;const Ae=e.cellKey(me,be),lt=((F=e.cells[Ae])==null?void 0:F.value)??"";lt===""?e.delCell(Ae):e.cells[Ae]={value:lt,style:null},(K=e.syncCellBorders)==null||K.call(e,me,be)}(Ce=e.scheduleRender)==null||Ce.call(e),(ge=e.emitModelData)==null||ge.call(e)}}const p=t.computed(()=>fo.map(b=>({...b,label:b.value===""?N(e.locale.value,"fontDefault"):b.label}))),V=t.computed(()=>mo.map(b=>({...b,label:String(b.value)}))),P="\0",oe=t.computed(()=>{var Ce;const b=e.selection.value;if(!b)return"";let F,K=!1;for(let ge=b.startCol;ge<=b.endCol&&!K;ge++)for(let me=b.startRow;me<=b.endRow&&!K;me++){const be=e.findMerge(ge,me);if(be&&(ge!==be.range.startCol||me!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(ge,me)])==null?void 0:Ce.style,Ae=typeof(we==null?void 0:we.fontFamily)=="string"?we.fontFamily:"";F===void 0?F=Ae:Ae!==F&&(K=!0)}return K?P:F??""}),Z=t.computed(()=>{const b=e.selection.value;if(!b)return kt;let F,K=!1;for(let Ce=b.startCol;Ce<=b.endCol&&!K;Ce++)for(let ge=b.startRow;ge<=b.endRow&&!K;ge++){const me=e.findMerge(Ce,ge);if(me&&(Ce!==me.range.startCol||ge!==me.range.startRow))continue;const be=e.cellFontSize(Ce,ge);F===void 0?F=be:be!==F&&(K=!0)}return K?0:F??kt});function J(b,F){var Ce,ge,me,be;const K=e.selection.value;if(K){v();for(let we=K.startCol;we<=K.endCol;we++)for(let Ae=K.startRow;Ae<=K.endRow;Ae++){const lt=e.findMerge(we,Ae);if(lt&&(we!==lt.range.startCol||Ae!==lt.range.startRow))continue;const it=e.cellKey(we,Ae),dt=((Ce=e.cells[it])==null?void 0:Ce.value)??"",Qe=(ge=e.cells[it])!=null&&ge.style?{...e.cells[it].style}:{};F===""||F===null||F===void 0||F===0?Reflect.deleteProperty(Qe,b):Qe[b]=F;const rt=Object.keys(Qe).length?Qe:null;dt===""&&rt===null?e.delCell(it):e.cells[it]={value:dt,style:rt}}(me=e.scheduleRender)==null||me.call(e),(be=e.emitModelData)==null||be.call(e)}}function q(b){J("fontFamily",b===""?"":b)}const ue=t.ref(!1),Fe=t.ref(!1),Oe=t.ref(!1),Je=t.ref(!1),Ge=t.ref(!1);function je(b){J("fontSize",b),ue.value=!1}const se=t.computed(()=>vo.map(b=>({label:N(e.locale.value,b.labelKey),value:b.value,icon:b.icon}))),de=t.computed(()=>wo.map(b=>({label:N(e.locale.value,b.labelKey),value:b.value,icon:b.icon}))),Te=t.computed(()=>{var Ce;const b=e.selection.value;if(!b)return"left";const F=(Ce=e.cells[e.cellKey(b.startCol,b.startRow)])==null?void 0:Ce.style,K=typeof(F==null?void 0:F.textAlign)=="string"?F.textAlign:"";return K==="center"||K==="right"?K:"left"}),re=t.computed(()=>{var Ce;const b=e.selection.value;if(!b)return"top";const F=(Ce=e.cells[e.cellKey(b.startCol,b.startRow)])==null?void 0:Ce.style,K=typeof(F==null?void 0:F.verticalAlign)=="string"?F.verticalAlign:"";return K==="middle"||K==="bottom"?K:"top"}),i=t.computed(()=>{var K;const b=e.selection.value;if(!b)return!1;const F=(K=e.cells[e.cellKey(b.startCol,b.startRow)])==null?void 0:K.style;return(F==null?void 0:F.wrap)==="wrap"});function m(b){J("textAlign",b)}function fe(b){J("verticalAlign",b)}function De(){if(!e.selection.value)return;const F=i.value;J("wrap",F?void 0:"wrap")}const f=t.ref(""),y=ue;t.watch(Z,b=>{f.value=b===0?"":String(b)},{immediate:!0});function T(b){const F=b.replace(/[^\d]/g,"");f.value=F;const K=parseInt(F,10);!isNaN(K)&&K>=5&&K<=72&&K!==Z.value&&J("fontSize",K)}function A(){const b=f.value.trim();if(!b){f.value=Z.value===0?"":String(Z.value);return}let F=parseInt(b,10);isNaN(F)?F=Z.value===0?kt:Z.value:F=Math.max(5,Math.min(72,F)),f.value=String(F),F!==Z.value&&J("fontSize",F)}function a(b){b.key==="Enter"&&b.target.blur()}function h(b){b&&b.preventDefault(),y.value=!y.value,y.value&&(Oe&&(Oe.value=!1),Fe&&(Fe.value=!1),Je.value=!1,Ge.value=!1)}function _(){const b=Z.value===0?kt:Z.value,F=Math.min(72,b+1);J("fontSize",F),f.value=String(F),y.value=!1}function E(){const b=Z.value===0?kt:Z.value,F=Math.max(5,b-1);J("fontSize",F),f.value=String(F),y.value=!1}function W(b){var ge;const F=e.selection.value;if(!F)return!1;let K,Ce=!1;for(let me=F.startCol;me<=F.endCol&&!Ce;me++)for(let be=F.startRow;be<=F.endRow&&!Ce;be++){const we=e.findMerge(me,be);if(we&&(me!==we.range.startCol||be!==we.range.startRow))continue;const Ae=(ge=e.cells[e.cellKey(me,be)])==null?void 0:ge.style,lt=!!(Ae!=null&&Ae[b]);K===void 0?K=lt:lt!==K&&(Ce=!0)}return!Ce&&K===!0}const Y=t.computed(()=>W("fontWeight")),Me=t.computed(()=>W("fontStyle")),Ve=t.computed(()=>W("underline")),Ke=t.computed(()=>W("strikethrough"));function Be(){J("fontWeight",Y.value?"":"bold")}function M(){J("fontStyle",Me.value?"":"italic")}function D(){J("underline",Ve.value?"":"underline")}function G(){J("strikethrough",Ke.value?"":"line-through")}const ce=t.ref(""),ee=t.ref(""),ae=Je,X=Ge;function U(){ae.value=!ae.value,X.value=!1,Fe&&(Fe.value=!1),Oe&&(Oe.value=!1)}function ye(){X.value=!X.value,ae.value=!1,Fe&&(Fe.value=!1),Oe&&(Oe.value=!1)}function Ee(b){Fe&&(Fe.value=b),b&&(ae.value=!1,X.value=!1,Oe&&(Oe.value=!1))}function Ze(b){ce.value=b,J("color",b===""?"":b)}function Pe(b){ee.value=b,J("backgroundColor",b===""?"":b)}function H(){J("color",ce.value===""?"":ce.value)}function O(){J("backgroundColor",ee.value===""?"":ee.value)}const I=t.computed(()=>{var Ce;const b=e.selection.value;if(!b)return"";let F,K=!1;for(let ge=b.startCol;ge<=b.endCol&&!K;ge++)for(let me=b.startRow;me<=b.endRow&&!K;me++){const be=e.findMerge(ge,me);if(be&&(ge!==be.range.startCol||me!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(ge,me)])==null?void 0:Ce.style,Ae=typeof(we==null?void 0:we.color)=="string"?we.color:"";F===void 0?F=Ae:Ae!==F&&(K=!0)}return K?"":F??""}),Q=t.computed(()=>{var Ce;const b=e.selection.value;if(!b)return"";let F,K=!1;for(let ge=b.startCol;ge<=b.endCol&&!K;ge++)for(let me=b.startRow;me<=b.endRow&&!K;me++){const be=e.findMerge(ge,me);if(be&&(ge!==be.range.startCol||me!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(ge,me)])==null?void 0:Ce.style,Ae=typeof(we==null?void 0:we.backgroundColor)=="string"?we.backgroundColor:"";F===void 0?F=Ae:Ae!==F&&(K=!0)}return K?"":F??""}),ie=t.computed(()=>_o(e.locale.value)),ke=t.ref(!1),Ne=t.computed(()=>{var Ce;const b=e.selection.value;if(!b)return rl;let F,K=!1;for(let ge=b.startCol;ge<=b.endCol&&!K;ge++)for(let me=b.startRow;me<=b.endRow&&!K;me++){const be=e.findMerge(ge,me);if(be&&(ge!==be.range.startCol||me!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(ge,me)])==null?void 0:Ce.style,Ae=typeof(we==null?void 0:we.numberFormat)=="string"?we.numberFormat:"";F===void 0?F=Ae:Ae!==F&&(K=!0)}return K?nl:F??rl});function ze(b){J("numberFormat",b)}function Le(b){if(b===Al){ke.value=!0;return}ze(b)}function We(){ke.value=!0}return{undoStack:o,redoStack:l,cloneCells:c,takeSnap:d,restoreSnap:r,saveUndo:v,undo:u,redo:k,canUndo:x,canRedo:S,hasSelection:w,paintFmt:R,onPaintFormat:B,applyPaintFormat:le,clearFormat:ne,fontFamilyOptions:p,fontSizeOptions:V,FONT_FAMILY_MIXED:P,selFontFamily:oe,selFontSize:Z,applyStyleToSelection:J,onFontFamilyChange:q,onFontSizeChange:je,hAlignOptions:se,vAlignOptions:de,selHAlign:Te,selVAlign:re,selWrap:i,onHAlignChange:m,onVAlignChange:fe,onWrapToggle:De,fontSizeInput:f,fontSizeMenuOpen:y,onFontSizeInput:T,onFontSizeBlur:A,onFontSizeKeydown:a,toggleFontSizeMenu:h,onFontSizeStepUp:_,onFontSizeStepDown:E,selFontWeight:Y,selFontStyle:Me,selUnderline:Ve,selStrikethrough:Ke,toggleFontWeight:Be,toggleFontStyle:M,toggleUnderline:D,toggleStrikethrough:G,cachedTextColor:ce,cachedFillColor:ee,textColorMenuOpen:ae,fillColorMenuOpen:X,_toggleTextColorMenu:U,_toggleFillColorMenu:ye,onBorderMenuToggle:Ee,onTextColorChange:Ze,onFillColorChange:Pe,applyCachedTextColor:H,applyCachedFillColor:O,selTextColor:I,selFillColor:Q,nfOptions:ie,selNumberFormat:Ne,NF_NUMBER_FORMAT_MIXED:nl,nfDialogOpen:ke,onNumberFormatChange:Le,openNumberFormatDialog:We,applyNumberFormatCode:ze}}function Da(e,n){n.borderMenuOpen&&(e.borderMenuOpen=n.borderMenuOpen),n.mergeMenuOpen&&(e.mergeMenuOpen=n.mergeMenuOpen),(()=>{const l=e.borderMenuOpen,c=e.mergeMenuOpen;e.onBorderMenuToggle=d=>{l&&(l.value=d),d&&(e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1,c&&(c.value=!1))},e.toggleFontSizeMenu=d=>{d&&d.preventDefault(),e.fontSizeMenuOpen.value=!e.fontSizeMenuOpen.value,e.fontSizeMenuOpen.value&&(c&&(c.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),c&&(c.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,l&&(l.value=!1),c&&(c.value=!1)}})()}function Na(e,n){const o=t.ref("none"),l=t.ref(!1),c="#444";function d(f,y,T,A){const a=e.findMerge(y,T),h=a?a.range.endCol:y,_=a?a.range.endRow:T,E=a?a.range.startCol:y,Y=(a?a.range.startRow:T)===A.startRow,Me=_===A.endRow,Ve=E===A.startCol,Ke=h===A.endCol,Be={top:0,bottom:0,left:0,right:0};switch(f){case"none":return Be;case"bottom":Me&&(Be.bottom=1);break;case"top":Y&&(Be.top=1);break;case"left":Ve&&(Be.left=1);break;case"right":Ke&&(Be.right=1);break;case"all":Be.top=1,Be.bottom=1,Be.left=1,Be.right=1;break;case"outer":Y&&(Be.top=1),Me&&(Be.bottom=1),Ve&&(Be.left=1),Ke&&(Be.right=1);break;case"thickOuter":Y&&(Be.top=2),Me&&(Be.bottom=2),Ve&&(Be.left=2),Ke&&(Be.right=2);break}return Be}function r(f,y,T,A,a){var Be,M;if(f<0||y<0||f>=e.colCount||y>=e.rowCount)return;const h=e.findMerge(f,y);if(h&&(T==="Top"&&(f!==h.range.startCol||y!==h.range.startRow)||T==="Bottom"&&(f!==h.range.startCol||y!==h.range.endRow)||T==="Left"&&(f!==h.range.startCol||y!==h.range.startRow)||T==="Right"&&(f!==h.range.endCol||y!==h.range.startRow)))return;const _=h?h.anchor:e.cellKey(f,y),E=((Be=e.cells[_])==null?void 0:Be.value)??"",W=(M=e.cells[_])!=null&&M.style?{...e.cells[_].style}:{},Y=`border${T}Width`;A===0?a&&Reflect.deleteProperty(W,Y):(W[Y]=A,W.borderColor=c),["Top","Bottom","Left","Right"].some(D=>W[`border${D}Width`]!==void 0)||Reflect.deleteProperty(W,"borderColor");const Ke=Object.keys(W).length?W:null;E===""&&Ke===null?e.delCell(_):e.cells[_]={value:E,style:Ke}}function v(f,y){var Y;const T=e.findMerge(f,y),A=T?T.anchor:e.cellKey(f,y),a=(Y=e.cells[A])==null?void 0:Y.style,h=(a==null?void 0:a.borderTopWidth)||0,_=(a==null?void 0:a.borderBottomWidth)||0,E=(a==null?void 0:a.borderLeftWidth)||0,W=(a==null?void 0:a.borderRightWidth)||0;if(T){const Me=T.range.startRow,Ve=T.range.endRow,Ke=T.range.startCol,Be=T.range.endCol;r(Ke,Me-1,"Bottom",h,!0),r(Ke,Ve+1,"Top",_,!0),r(Ke-1,Me,"Right",E,!0),r(Be+1,Me,"Left",W,!0)}else r(f,y-1,"Bottom",h,!0),r(f,y+1,"Top",_,!0),r(f-1,y,"Right",E,!0),r(f+1,y,"Left",W,!0)}e.syncCellBorders=v;function u(f,y,T,A=!0){var Ke,Be;const a=e.findMerge(f,y),h=a?a.anchor:e.cellKey(f,y),_=((Ke=e.cells[h])==null?void 0:Ke.value)??"",E=(Be=e.cells[h])!=null&&Be.style?{...e.cells[h].style}:{},W=["Top","Bottom","Left","Right"],Y=[T.top,T.bottom,T.left,T.right];for(let M=0;M<4;M++){const D=`border${W[M]}Width`;Y[M]===0?A&&Reflect.deleteProperty(E,D):(E[D]=Y[M],E.borderColor=c)}W.some(M=>E[`border${M}Width`]!==void 0)||Reflect.deleteProperty(E,"borderColor");const Ve=Object.keys(E).length?E:null;_===""&&Ve===null?e.delCell(h):e.cells[h]={value:_,style:Ve},v(a?a.range.startCol:f,a?a.range.startRow:y)}function k(f){var T,A;o.value=f;const y=e.selection.value;if(y){if(n.saveUndo(),f==="none")for(let a=y.startCol;a<=y.endCol;a++)for(let h=y.startRow;h<=y.endRow;h++){const _=e.findMerge(a,h);_&&(a!==_.range.startCol||h!==_.range.startRow)||u(a,h,{top:0,bottom:0,left:0,right:0},!0)}else for(let a=y.startCol;a<=y.endCol;a++)for(let h=y.startRow;h<=y.endRow;h++){const _=e.findMerge(a,h);if(_&&(a!==_.range.startCol||h!==_.range.startRow))continue;const E=d(f,a,h,y);u(a,h,E,!1)}(T=e.scheduleRender)==null||T.call(e),(A=e.emitModelData)==null||A.call(e)}}function x(){k(o.value)}function S(f,y,T){var h,_;const A=e.findMerge(f,y);if(A){const E=(h=e.cells[A.anchor])==null?void 0:h.style;return T==="Top"&&y===A.range.startRow?(E==null?void 0:E.borderTopWidth)||0:T==="Bottom"&&y===A.range.endRow?(E==null?void 0:E.borderBottomWidth)||0:T==="Left"&&f===A.range.startCol?(E==null?void 0:E.borderLeftWidth)||0:T==="Right"&&f===A.range.endCol&&(E==null?void 0:E.borderRightWidth)||0}const a=(_=e.cells[e.cellKey(f,y)])==null?void 0:_.style;return(a==null?void 0:a[`border${T}Width`])||0}const w=t.ref(!1);function R(f){w.value=f,f&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,l.value=!1,n.fontSizeMenuOpen.value=!1)}function B(f,y,T,A){const a=[];for(const h in e.merges){const _=e.merges[h];_&&_.startCol<=T&&_.endCol>=f&&_.startRow<=A&&_.endRow>=y&&a.push(h)}for(const h of a)Reflect.deleteProperty(e.merges,h)}function le(){var a,h,_,E;const f=e.selection.value;if(!f||f.startCol===f.endCol&&f.startRow===f.endRow)return;n.saveUndo(),B(f.startCol,f.startRow,f.endCol,f.endRow);const y=e.cellKey(f.startCol,f.startRow),T=((a=e.cells[y])==null?void 0:a.value)??"";for(let W=f.startCol;W<=f.endCol;W++)for(let Y=f.startRow;Y<=f.endRow;Y++)W===f.startCol&&Y===f.startRow||e.clearCellsInRange(W,W,Y,Y);const A=(h=e.cells[y])!=null&&h.style?{...e.cells[y].style}:{};A.textAlign="center",e.cells[y]={value:T,style:A},e.merges[y]={startCol:f.startCol,startRow:f.startRow,endCol:f.endCol,endRow:f.endRow},e.selectCell(f.startCol,f.startRow),(_=e.scheduleRender)==null||_.call(e),(E=e.emitModelData)==null||E.call(e)}function ne(){var y,T,A;const f=e.selection.value;if(!(!f||f.startCol===f.endCol)){n.saveUndo();for(let a=f.startRow;a<=f.endRow;a++){B(f.startCol,a,f.endCol,a);const h=e.cellKey(f.startCol,a);(y=e.cells[h])==null||y.value;for(let _=f.startCol+1;_<=f.endCol;_++)e.clearCellsInRange(_,_,a,a);e.merges[h]={startCol:f.startCol,startRow:a,endCol:f.endCol,endRow:a}}e.selectRange(f.startCol,f.startRow,f.endCol,f.endRow),(T=e.scheduleRender)==null||T.call(e),(A=e.emitModelData)==null||A.call(e)}}function p(){var T,A,a;const f=e.selection.value;if(!f||f.startCol===f.endCol&&f.startRow===f.endRow)return;n.saveUndo(),B(f.startCol,f.startRow,f.endCol,f.endRow);const y=e.cellKey(f.startCol,f.startRow);(T=e.cells[y])==null||T.value;for(let h=f.startCol;h<=f.endCol;h++)for(let _=f.startRow;_<=f.endRow;_++)h===f.startCol&&_===f.startRow||e.clearCellsInRange(h,h,_,_);e.merges[y]={startCol:f.startCol,startRow:f.startRow,endCol:f.endCol,endRow:f.endRow},e.selectCell(f.startCol,f.startRow),(A=e.scheduleRender)==null||A.call(e),(a=e.emitModelData)==null||a.call(e)}function V(){var y,T;const f=e.selection.value;f&&(n.saveUndo(),B(f.startCol,f.startRow,f.endCol,f.endRow),(y=e.scheduleRender)==null||y.call(e),(T=e.emitModelData)==null||T.call(e))}function P(){const f=e.selection.value;if(!f)return;const y=e.findMerge(f.startCol,f.startRow);y&&f.startCol===y.range.startCol&&f.startRow===y.range.startRow&&f.endCol===y.range.endCol&&f.endRow===y.range.endRow?V():le()}function oe(f){switch(f){case"mergeCenter":le();break;case"mergeAcross":ne();break;case"mergeCells":p();break;case"unmergeCells":V();break}}let Z=null,J=[];function q(f,y,T,A){var a;J=[];for(let h=T;h<=A;h++){const _=[];for(let E=f;E<=y;E++){const W=(a=e.cells[e.cellKey(E,h)])==null?void 0:a.style;_.push(W?{...W}:null)}J.push(_)}}function ue(f,y,T,A){const a=e.cellKey(f,y);if(vl(),T===""||T==null){e.formulaDeps.clear(a),A?e.cells[a]={value:"",style:{...A}}:e.delCell(a),e.formulaDeps.markDirty(a);return}e.cells[a]={value:T,style:A?{...A}:null},T.startsWith("=")?e.formulaDeps.set(a,El(T.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(a),e.formulaDeps.markDirty(a)}function Fe(){const f=e.selection.value;if(!f)return;Z={...f},q(f.startCol,f.endCol,f.startRow,f.endRow);const y=[];for(let T=f.startRow;T<=f.endRow;T++){const A=[];for(let a=f.startCol;a<=f.endCol;a++)A.push(e.getCellRaw(a,T));y.push(A.join(" "))}yl(y.join(`
4
+ `))}function Oe(){const f=e.selection.value;if(f){if(f.startCol===0&&f.endCol===e.colCount-1){Z={...f},q(0,e.colCount-1,f.startRow,f.endRow);const y=[];for(let T=f.startRow;T<=f.endRow;T++){const A=[];for(let a=0;a<e.colCount;a++)A.push(e.getCellRaw(a,T));y.push(A.join(" "))}yl(y.join(`
5
+ `))}else if(f.startRow===0&&f.endRow===e.rowCount-1){Z={...f},q(f.startCol,f.endCol,0,e.rowCount-1);const y=[];for(let T=0;T<e.rowCount;T++){const A=[];for(let a=f.startCol;a<=f.endCol;a++)A.push(e.getCellRaw(a,T));y.push(A.join(" "))}yl(y.join(`
6
+ `))}}}async function Je(){var h;let f;try{f=await navigator.clipboard.readText()}catch{return}if(!f&&f!=="")return;const y=f.split(/\r?\n/),T=e.activeCell.value,A=Z,a=A&&J.length>0;for(let _=0;_<y.length;_++){const E=y[_].split(" ");for(let W=0;W<E.length;W++){const Y=T.col+W,Me=T.row+_;if(Y<e.colCount&&Me<e.rowCount){let Ve=E[W];if(Ve.startsWith("=")&&A&&(Ve=xa(Ve,Y-(A.startCol+W),Me-(A.startRow+_),e.colCount,e.rowCount,Ue)),a&&_<J.length&&W<(((h=J[_])==null?void 0:h.length)??0)){const Ke=J[_][W]??null;ue(Y,Me,Ve,Ke),v(Y,Me)}else e.setCellValue(Y,Me,Ve)}}}}function Ge(){var f;if(n.saveUndo(),Fe(),e.selection.value){const y=e.selection.value;e.clearCellsInRange(y.startCol,y.endCol,y.startRow,y.endRow),(f=e.scheduleRender)==null||f.call(e)}}function je(){var f;if(e.selection.value){const y=e.selection.value;e.clearCellsInRange(y.startCol,y.endCol,y.startRow,y.endRow),(f=e.scheduleRender)==null||f.call(e)}}function se(){var h,_;const f=e.selection.value;if(!f)return;n.saveUndo();const y=f.startCol,T=f.startRow,A=f.endCol,a=f.endRow;if(T===a)if(A+1<e.colCount){const E=`${Ue(y)}${T+1}:${Ue(A)}${T+1}`;e.setCellValue(A+1,T,`=SUM(${E})`)}else{const E=`${Ue(y)}${T+1}:${Ue(A-1)}${T+1}`;e.setCellValue(A,T,`=SUM(${E})`)}else for(let E=y;E<=A;E++)if(a+1<e.rowCount){const W=`${Ue(E)}${T+1}:${Ue(E)}${a+1}`;e.setCellValue(E,a+1,`=SUM(${W})`)}else{const W=`${Ue(E)}${T+1}:${Ue(E)}${a}`;e.setCellValue(E,a,`=SUM(${W})`)}(h=e.scheduleRender)==null||h.call(e),(_=e.emitModelData)==null||_.call(e)}function de(){var h,_;const f=e.selection.value;if(!f)return;n.saveUndo();const y=f.startCol,T=f.startRow,A=f.endCol,a=f.endRow;if(T===a)if(A+1<e.colCount){const E=`${Ue(y)}${T+1}:${Ue(A)}${T+1}`;e.setCellValue(A+1,T,`=AVERAGE(${E})`)}else{const E=`${Ue(y)}${T+1}:${Ue(A-1)}${T+1}`;e.setCellValue(A,T,`=AVERAGE(${E})`)}else for(let E=y;E<=A;E++)if(a+1<e.rowCount){const W=`${Ue(E)}${T+1}:${Ue(E)}${a+1}`;e.setCellValue(E,a+1,`=AVERAGE(${W})`)}else{const W=`${Ue(E)}${T+1}:${Ue(E)}${a}`;e.setCellValue(E,a,`=AVERAGE(${W})`)}(h=e.scheduleRender)==null||h.call(e),(_=e.emitModelData)==null||_.call(e)}function Te(){var h,_;const f=e.selection.value;if(!f)return;n.saveUndo();const y=f.startCol,T=f.startRow,A=f.endCol,a=f.endRow;if(T===a)if(A+1<e.colCount){const E=`${Ue(y)}${T+1}:${Ue(A)}${T+1}`;e.setCellValue(A+1,T,`=COUNT(${E})`)}else{const E=`${Ue(y)}${T+1}:${Ue(A-1)}${T+1}`;e.setCellValue(A,T,`=COUNT(${E})`)}else for(let E=y;E<=A;E++)if(a+1<e.rowCount){const W=`${Ue(E)}${T+1}:${Ue(E)}${a+1}`;e.setCellValue(E,a+1,`=COUNT(${W})`)}else{const W=`${Ue(E)}${T+1}:${Ue(E)}${a}`;e.setCellValue(E,a,`=COUNT(${W})`)}(h=e.scheduleRender)==null||h.call(e),(_=e.emitModelData)==null||_.call(e)}const re=t.ref(!1);function i(f){re.value=f,f&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,l.value=!1,n.fontSizeMenuOpen.value=!1,w.value=!1)}function m(){se(),re.value=!1}function fe(){de(),re.value=!1}function De(){Te(),re.value=!1}return{cachedBorder:o,borderMenuOpen:l,BORDER_COLOR:c,borderTypeToWidths:d,onBorderChange:k,setCellBorderSide:r,syncCellBorders:v,applyBorderToCell:u,applyCachedBorder:x,cellBorderWidth:S,mergeMenuOpen:w,onMergeMenuToggle:R,removeOverlappingMerges:B,mergeAndCenter:le,mergeAcross:ne,mergeCells:p,unmergeCells:V,onApplyMerge:P,onMergeChange:oe,copySourceRange:null,copySourceStyles:[],captureStyles:q,setCellWithStyle:ue,copyToClipboard:Fe,copyRowCol:Oe,pasteFromClipboard:Je,cutSelected:Ge,clearSelected:je,sumSelected:se,avgSelected:de,countSelected:Te,calcMenuOpen:re,onCalcMenuToggle:i,onCalcSum:m,onCalcAvg:fe,onCalcCount:De}}function Aa(e,n,o,l){const c={},d=l(n),r=l(o);return d!=null&&(c.width=`${d}px`),r!=null&&(c.height=`${r}px`),c["--sp-formula-bar-bg"]=e.formulaBarBg,c["--sp-formula-bar-border"]=e.formulaBarBorder,c["--sp-formula-bar-label-color"]=e.formulaBarLabelText,c["--sp-formula-bar-label-bg"]=e.formulaBarLabelBg,c["--sp-formula-bar-label-border"]=e.formulaBarLabelBorder,c["--sp-formula-bar-input-bg"]=e.formulaBarInputBg,c["--sp-formula-bar-input-border"]=e.formulaBarInputBorder,c["--sp-formula-bar-input-color"]=e.formulaBarInputText,c["--sp-formula-bar-input-focus-border"]=e.formulaBarInputFocusBorder,c["--sp-formula-bar-input-focus-shadow"]=e.formulaBarInputFocusShadow,c["--sp-wrapper-bg"]=e.wrapperBg,c["--sp-cell-editor-border"]=e.cellEditorBorder,c["--sp-cell-editor-color"]=e.cellEditorText,c["--sp-cell-editor-bg"]=e.cellEditorBg,c["--sp-cell-editor-shadow"]=e.cellEditorShadow,c["--sp-tab-bar-bg"]=e.tabBarBg,c["--sp-tab-bar-border"]=e.tabBarBorder,c["--sp-tab-active-bg"]=e.tabActiveBg,c["--sp-tab-active-color"]=e.tabActiveText,c["--sp-tab-active-border"]=e.tabActiveBorder,c["--sp-tab-inactive-bg"]=e.tabInactiveBg,c["--sp-tab-inactive-color"]=e.tabInactiveText,c["--sp-tab-inactive-border"]=e.tabInactiveBorder,c["--sp-tab-hover-bg"]=e.tabHoverBg,c["--sp-tab-add-btn-color"]=e.tabAddBtnColor,c["--sp-tab-add-btn-hover-bg"]=e.tabAddBtnHoverBg,c["--sp-tab-scroll-btn-color"]=e.tabScrollBtnColor,c["--sp-tab-scroll-btn-hover-bg"]=e.tabScrollBtnHoverBg,c["--sp-scroll-thumb"]=e.scrollbarThumb,c["--sp-scroll-thumb-hover"]=e.scrollbarThumbHover,c["--sp-scroll-btn-bg"]=e.scrollBtnBg,c["--sp-scroll-btn-color"]=e.scrollBtnColor,c["--sp-scroll-btn-hover-bg"]=e.scrollBtnHoverBg,c["--sp-scroll-btn-active-bg"]=e.scrollBtnActiveBg,c["--sp-scroll-track-bg"]=e.scrollTrackBg,c["--sp-toolbar-bg"]=e.toolbarBg,c["--sp-toolbar-border"]=e.toolbarBorder,c["--sp-toolbar-btn-color"]=e.toolbarBtnColor,c["--sp-toolbar-btn-hover-bg"]=e.toolbarBtnHoverBg,c["--sp-toolbar-btn-disabled-color"]=e.toolbarBtnDisabledColor,c["--sp-toolbar-btn-active-color"]=e.toolbarBtnActiveColor,c}function Ha(e,n,o,l,c){function d(M,D){var ee,ae;const G=D-M+1,ce=x(M,D);for(let X=M;X<=D;X++)for(let U=0;U<e.colCount;U++)e.delCell(e.cellKey(U,X));for(let X=M;X<e.rowCount-G;X++){for(let U=0;U<e.colCount;U++){const ye=e.cellKey(U,X+G),Ee=e.cellKey(U,X);e.cells[ye]?(e.cells[Ee]=e.cells[ye],e.delCell(ye)):e.delCell(Ee)}e.rowHeights.value[X]=e.rowHeights.value[X+G]}for(let X=e.rowCount-G;X<e.rowCount;X++){for(let U=0;U<e.colCount;U++)e.delCell(e.cellKey(U,X));e.rowHeights.value[X]=void 0}if(k(ce),M>0)for(let X=0;X<e.colCount;X++)(ee=e.syncCellBorders)==null||ee.call(e,X,M-1),(ae=e.syncCellBorders)==null||ae.call(e,X,M)}function r(M,D){const G=D-M+1;if(D>=e.rowCount-1)return;const ce=w(M,D);for(let ee=e.rowCount-1;ee>D;ee--){for(let ae=0;ae<e.colCount;ae++){const X=e.cellKey(ae,ee-G),U=e.cellKey(ae,ee);e.cells[X]?e.cells[U]=e.cells[X]:e.delCell(U)}e.rowHeights.value[ee]=e.rowHeights.value[ee-G]}for(let ee=D+1;ee<=D+G;ee++){for(let ae=0;ae<e.colCount;ae++)e.delCell(e.cellKey(ae,ee));e.rowHeights.value[ee]=void 0}k(ce)}function v(M,D){const G=D-M+1;if(D>=e.colCount-1)return;const ce=R(M,D);for(let ee=e.colCount-1;ee>D;ee--){for(let ae=0;ae<e.rowCount;ae++){const X=e.cellKey(ee-G,ae),U=e.cellKey(ee,ae);e.cells[X]?e.cells[U]=e.cells[X]:e.delCell(U)}e.colWidths.value[ee]=e.colWidths.value[ee-G]}for(let ee=D+1;ee<=D+G;ee++){for(let ae=0;ae<e.rowCount;ae++)e.delCell(e.cellKey(ee,ae));e.colWidths.value[ee]=100}k(ce)}function u(M,D){var ee,ae;const G=D-M+1,ce=S(M,D);for(let X=M;X<=D;X++)for(let U=0;U<e.rowCount;U++)e.delCell(e.cellKey(X,U));for(let X=M;X<e.colCount-G;X++){for(let U=0;U<e.rowCount;U++){const ye=e.cellKey(X+G,U),Ee=e.cellKey(X,U);e.cells[ye]?(e.cells[Ee]=e.cells[ye],e.delCell(ye)):e.delCell(Ee)}e.colWidths.value[X]=e.colWidths.value[X+G]}for(let X=e.colCount-G;X<e.colCount;X++){for(let U=0;U<e.rowCount;U++)e.delCell(e.cellKey(X,U));e.colWidths.value[X]=100}if(k(ce),M>0)for(let X=0;X<e.rowCount;X++)(ee=e.syncCellBorders)==null||ee.call(e,M-1,X),(ae=e.syncCellBorders)==null||ae.call(e,M,X)}function k(M){Object.keys(e.merges).forEach(D=>Reflect.deleteProperty(e.merges,D));for(const D of M)if(!(D.newRange.startCol>D.newRange.endCol||D.newRange.startRow>D.newRange.endRow)&&(e.merges[D.newAnchorKey]={...D.newRange},D.anchorCell)){const G=D.anchorCell.value,ce=D.anchorCell.style;G===""&&(!ce||Object.keys(ce).length===0)||(e.cells[D.newAnchorKey]={value:G,style:ce&&Object.keys(ce).length?{...ce}:null})}}function x(M,D){const G=D-M+1,ce=[];for(const ee in e.merges){const ae=e.merges[ee];if(!ae)continue;const X=e.cells[ee]?{value:e.cells[ee].value,style:e.cells[ee].style?{...e.cells[ee].style}:null}:{value:"",style:null},{startCol:U,endCol:ye}=ae;let{startRow:Ee,endRow:Ze}=ae;if(Ee>D){Ee-=G,Ze-=G,ce.push({newAnchorKey:e.cellKey(U,Ee),newRange:{startCol:U,startRow:Ee,endCol:ye,endRow:Ze}});continue}if(Ze<M){ce.push({newAnchorKey:ee,newRange:{startCol:U,startRow:Ee,endCol:ye,endRow:Ze}});continue}if(Ee>=M&&Ze<=D||(Ee>=M&&Ee<=D&&(Ee=M),Ze>=M&&Ze<=D?Ze=M-1:Ze>D&&(Ze-=G),Ee>Ze))continue;const Pe=U,H=Ee,O=e.cellKey(Pe,H),Q=ee.split(",").map(Number)[1],ie=Q>=M&&Q<=D||Pe!==ae.startCol||H!==Q;ce.push({newAnchorKey:O,newRange:{startCol:U,startRow:Ee,endCol:ye,endRow:Ze},anchorCell:ie?X:void 0})}return ce}function S(M,D){const G=D-M+1,ce=[];for(const ee in e.merges){const ae=e.merges[ee];if(!ae)continue;const X=e.cells[ee]?{value:e.cells[ee].value,style:e.cells[ee].style?{...e.cells[ee].style}:null}:{value:"",style:null};let{startCol:U,endCol:ye}=ae;const{startRow:Ee,endRow:Ze}=ae;if(U>D){U-=G,ye-=G,ce.push({newAnchorKey:e.cellKey(U,Ee),newRange:{startCol:U,startRow:Ee,endCol:ye,endRow:Ze}});continue}if(ye<M){ce.push({newAnchorKey:ee,newRange:{startCol:U,startRow:Ee,endCol:ye,endRow:Ze}});continue}if(U>=M&&ye<=D||(U>=M&&U<=D&&(U=M),ye>=M&&ye<=D?ye=M-1:ye>D&&(ye-=G),U>ye))continue;const Pe=U,H=Ee,O=e.cellKey(Pe,H),Q=ee.split(",").map(Number)[0],ie=Q>=M&&Q<=D||Pe!==Q||H!==ae.startRow;ce.push({newAnchorKey:O,newRange:{startCol:U,startRow:Ee,endCol:ye,endRow:Ze},anchorCell:ie?X:void 0})}return ce}function w(M,D){const G=D-M+1,ce=[];for(const ee in e.merges){const ae=e.merges[ee];if(!ae)continue;const{startCol:X,endCol:U}=ae;let{startRow:ye,endRow:Ee}=ae;Ee<M?ce.push({newAnchorKey:ee,newRange:{startCol:X,startRow:ye,endCol:U,endRow:Ee}}):ye>D?(ye+=G,Ee+=G,ce.push({newAnchorKey:e.cellKey(X,ye),newRange:{startCol:X,startRow:ye,endCol:U,endRow:Ee}})):(Ee+=G,ce.push({newAnchorKey:ee,newRange:{startCol:X,startRow:ye,endCol:U,endRow:Ee}}))}return ce}function R(M,D){const G=D-M+1,ce=[];for(const ee in e.merges){const ae=e.merges[ee];if(!ae)continue;let{startCol:X,endCol:U}=ae;const{startRow:ye,endRow:Ee}=ae;U<M?ce.push({newAnchorKey:ee,newRange:{startCol:X,startRow:ye,endCol:U,endRow:Ee}}):X>D?(X+=G,U+=G,ce.push({newAnchorKey:e.cellKey(X,ye),newRange:{startCol:X,startRow:ye,endCol:U,endRow:Ee}})):(U+=G,ce.push({newAnchorKey:ee,newRange:{startCol:X,startRow:ye,endCol:U,endRow:Ee}}))}return ce}let B=0;function le(){return B++,`s_${B}`}function ne(M){return{id:le(),name:M,cells:{},merges:{},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 p=t.ref([ne("Sheet1")]),V=t.ref(0);function P(){const M=p.value[V.value];M&&(M.cells={...e.cells},M.merges={...e.merges},M.selection=e.selection.value?{...e.selection.value}:null,M.activeCell={...e.activeCell.value},M.scrollX=e.scrollX.value,M.scrollY=e.scrollY.value,M.colWidths=[...e.colWidths.value],M.rowHeights=[...e.rowHeights.value])}function oe(M){const D=p.value[M];D&&(Object.keys(e.cells).forEach(G=>e.delCell(G)),Object.assign(e.cells,D.cells),Object.keys(e.merges).forEach(G=>Reflect.deleteProperty(e.merges,G)),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],V.value=M)}function Z(M){M===V.value||M<0||M>=p.value.length||(e.cancelEdit(),P(),oe(M))}function J(M){return n.saveUndo(),e.cancelEdit(),P(),p.value.push(ne(M??`Sheet${p.value.length+1}`)),oe(p.value.length-1),p.value.length-1}function q(M){return p.value.length<=1||(n.saveUndo(),e.cancelEdit(),p.value.splice(M,1),oe(Math.min(M,p.value.length-1))),V.value}function ue(M,D){p.value[M]&&D.trim()&&(n.saveUndo(),p.value[M].name=D.trim())}function Fe(M){n.saveUndo(),e.cancelEdit(),P();const D=p.value[M];if(!D)return M;let G=D.name;const ce=G.match(/^(.*?)\s*\((\d+)\)$/);let ee=ce?parseInt(ce[2],10)+1:2;ce&&(G=ce[1]);let ae=`${G} (${ee})`;const X=new Set(p.value.map(ye=>ye.name));for(;X.has(ae);)ee++,ae=`${G} (${ee})`;const U={id:le(),name:ae,cells:{...D.cells},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]};return p.value.splice(M+1,0,U),oe(M+1),M+1}function Oe(M,D){var ae;const G=M+D;if(G<0||G>=p.value.length)return;n.saveUndo();const ce=V.value,ee=p.value.splice(M,1)[0];p.value.splice(G,0,ee),ce===M?V.value=G:M<ce&&G>=ce?V.value=ce-1:M>ce&&G<=ce&&(V.value=ce+1),(ae=e.scheduleRender)==null||ae.call(e)}const Je=t.computed(()=>p.value.length);let Ge="";const je=o;function se(){P();const M=p.value.map(G=>{const ce={};for(const[U,ye]of Object.entries(G.cells))ce[U]={value:ye.value},ye.style&&(ce[U].style=ye.style);const ee={name:G.name,cells:ce};G.merges&&Object.keys(G.merges).length&&(ee.merges={...G.merges});const ae={};for(let U=0;U<G.colWidths.length;U++)G.colWidths[U]!==100&&(ae[U]=G.colWidths[U]);Object.keys(ae).length&&(ee.colWidths=ae);const X={};for(let U=0;U<G.rowHeights.length;U++){const ye=G.rowHeights[U];ye!=null&&(X[U]=ye)}return Object.keys(X).length&&(ee.rowHeights=X),ee}),D=JSON.stringify(M);D!==Ge&&(Ge=D,je.value=M,c&&(c.value=D))}e.emitModelData=se;let de=!1;function Te(){de||(de=!0,Promise.resolve().then(()=>{de=!1,se()}))}const re=t.computed(()=>e.props.theme==="dark"?Eo:ko),i=t.computed(()=>Aa(re.value,e.props.width,e.props.height,Vt)),m=t.computed(()=>{const M={};for(const[D,G]of Object.entries(i.value))D.startsWith("--")&&(M[D]=G);return M}),fe=t.ref(null),De=t.ref(null),f=t.ref(null),y=t.ref(null),T=t.reactive({w:800,h:600});e.viewSize&&t.watch(T,M=>{e.viewSize&&(e.viewSize.w=M.w,e.viewSize.h=M.h)},{deep:!0});const A=48,a=28,h=11,_=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,T.w-A-h))),E=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,T.h-a-h)));function W(M,D){const G=Math.max(0,T.w-A-h),ce=Math.max(0,T.h-a-h);e.scrollX.value=Math.max(0,Math.min(M??e.scrollX.value,Math.max(0,e.totalWidth.value-G))),e.scrollY.value=Math.max(0,Math.min(D??e.scrollY.value,Math.max(0,e.totalHeight.value-ce)))}e.clampScroll=W;function Y(){var M;return typeof window>"u"?!1:!((M=window.matchMedia)!=null&&M.call(window,"(hover: none) and (pointer: coarse)").matches)}function Me(M=!1){t.nextTick(()=>{const D=f.value;if(D){if(!e.editingCell.value&&!Y()){document.activeElement===D&&D.blur();return}D.focus({preventScroll:!0}),M&&D.select()}})}function Ve(){Me()}function Ke(){var D;const M=e.selection.value;if(M){n.saveUndo();for(let G=M.startRow;G<=M.endRow;G++)e.rowHeights.value[G]=void 0;(D=e.scheduleRender)==null||D.call(e),se()}}function Be(){var D;const M=e.selection.value;if(M){n.saveUndo();for(let G=M.startCol;G<=M.endCol;G++)e.colWidths.value[G]=100;(D=e.scheduleRender)==null||D.call(e),se()}}return{deleteRows:d,insertRows:r,insertCols:v,deleteCols:u,sheets:p,activeSheetIndex:V,saveSheet:P,loadSheet:oe,switchSheet:Z,addSheet:J,removeSheet:q,renameSheet:ue,dupSheet:Fe,moveSheet:Oe,sheetCount:Je,mkSheet:ne,emitModelData:se,scheduleOptEmit:Te,themeColors:re,outerStyle:i,toolbarThemeVars:m,wrapperRef:fe,canvasRef:De,editInputRef:f,formulaBarRef:y,viewSize:T,maxScrollX:_,maxScrollY:E,clampScroll:W,canFocusHiddenEditor:Y,focusEditInput:Me,onCanvasFocus:Ve,resetRowHeight:Ke,resetColWidth:Be,modelData:je}}function Va(e,n,o,l,c){let d=!1,r=null,v=1;function u(){d||(d=!0,requestAnimationFrame(()=>{d=!1,x()}))}e.scheduleRender=u;const k="#444";function x(){var Tl,$t,Qt,Mt,Nt,el,lo,oo,no,ro,ao;const s=l.canvasRef.value;if(!s)return;const g=l.wrapperRef.value;if(!g||(r=s.getContext("2d"),!r))return;v=window.devicePixelRatio||1;const $=g.getBoundingClientRect(),z=$.width,C=$.height;l.viewSize.w=z,l.viewSize.h=C,s.width=z*v,s.height=C*v,s.style.width=z+"px",s.style.height=C+"px",r.setTransform(v,0,0,v,0,0);const L=e.scrollX.value,pe=e.scrollY.value,ve=52,he=24,He=l.themeColors.value,ct=e.colPositions.value,ot=e.rowPositions.value,ht=e.colWidths.value,pt=[];for(let j=0;j<e.rowCount;j++)pt[j]=ot[j+1]-ot[j];const Bt=Math.max(0,e.hitCol(L));let Ut=Bt;for(let j=Bt;j<e.colCount&&!(ve+ct[j]-L>=z);j++)Ut=j;const xt=Ut,wt=Math.max(0,e.hitRow(pe));let cl=wt;for(let j=wt;j<e.rowCount&&!(he+ot[j]-pe>=C);j++)cl=j;const bt=cl;let Lt=Bt,It=wt;for(const j in e.merges){const te=e.merges[j];te&&(te.startRow>bt||te.endRow<wt||te.startCol>xt||te.endCol<Bt||(te.startCol<Lt&&(Lt=te.startCol),te.startRow<It&&(It=te.startRow)))}r.fillStyle=He.bg,r.fillRect(0,0,z,C),r.fillStyle=He.gridBg,r.fillRect(ve,he,z-ve,C-he),r.save(),r.beginPath(),r.rect(ve,he,z-ve,C-he),r.clip();const ft=e.selection.value,Jt=e.editingCell.value;for(let j=It;j<=bt;j++)for(let te=Lt;te<=xt;te++){const xe=e.findMerge(te,j);if(xe&&!(te===xe.range.startCol&&j===xe.range.startRow))continue;const Ie=ve+ct[te]-L,$e=he+ot[j]-pe;let Ye=ht[te],Xe=pt[j];if(xe&&(Ye=ct[xe.range.endCol+1]-ct[te],Xe=ot[xe.range.endRow+1]-ot[j]),Ie+Ye<ve||$e+Xe<he||Ie>z||$e>C)continue;const nt=e.findHighlight?e.findHighlight(te,j):null,yt=(Tl=e.cells[e.cellKey(te,j)])==null?void 0:Tl.style,St=typeof(yt==null?void 0:yt.backgroundColor)=="string"?yt.backgroundColor:"";if(St&&(r.fillStyle=St,r.fillRect(Ie,$e,Ye,Xe)),nt&&(r.fillStyle=nt==="active"?He.findActiveBg:He.findMatchBg,r.fillRect(Ie,$e,Ye,Xe)),e.isSelected(te,j)&&(r.fillStyle=He.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?r.fillRect(Ie,$e,ht[te],pt[j]):r.fillRect(Ie,$e,Ye,Xe)),e.activeCell.value.col===te&&e.activeCell.value.row===j&&(r.strokeStyle=He.activeCellBorder,r.lineWidth=2,r.strokeRect(Ie+1,$e+1,Ye-2,Xe-2)),nt==="active"&&(r.strokeStyle=He.findActiveBg,r.lineWidth=2,r.strokeRect(Ie+1,$e+1,Ye-2,Xe-2)),r.strokeStyle=He.gridLine,r.lineWidth=.5,r.strokeRect(Ie+.25,$e+.25,Ye-.5,Xe-.5),!(Jt&&Jt.col===te&&Jt.row===j)){const Re=($t=e.cells[e.cellKey(te,j)])==null?void 0:$t.style,at=e.getCellValue(te,j),qe=typeof(Re==null?void 0:Re.numberFormat)=="string"?Re.numberFormat:"",et=at?hl(at,qe,e.locale.value):"";if(et){const tt=e.cellFontSize(te,j),ut=typeof(Re==null?void 0:Re.fontFamily)=="string"&&Re.fontFamily?Re.fontFamily:Pt,_e=(Re==null?void 0:Re.fontWeight)==="bold"?"bold":"normal",mt=(Re==null?void 0:Re.fontStyle)==="italic"?"italic":"normal",Ct=(Re==null?void 0:Re.underline)==="underline",st=(Re==null?void 0:Re.strikethrough)==="line-through",zt=typeof(Re==null?void 0:Re.color)=="string"?Re.color:"",tl=typeof(Re==null?void 0:Re.textAlign)=="string"?Re.textAlign:_l(at,qe)?"right":"left",ll=typeof(Re==null?void 0:Re.verticalAlign)=="string"?Re.verticalAlign:"top";r.fillStyle=zt||He.cellText,r.font=`${mt} ${_e} ${tt}px ${ut}`,r.textBaseline="alphabetic",r.save(),r.beginPath(),r.rect(Ie+5,$e+1,Ye-10,Xe-2),r.clip();const io=(Re==null?void 0:Re.wrap)==="wrap",sl=Ye-10;let Dl=et;const yi=!io&&$o(qe),co=et===gl||zo(at,qe);if(co||yi){if(co){const Wt=Math.max(1,r.measureText("#").width),ol=Math.max(1,Math.floor(sl/Wt));Dl="#".repeat(ol)}else if(e.getWrappedLines(r,et,1e9,!1).some(Tt=>Tt&&r.measureText(Tt).width>sl)){const Tt=Math.max(1,r.measureText("#").width),Gt=Math.max(1,Math.floor(sl/Tt));Dl="#".repeat(Gt)}}const dl=e.getWrappedLines(r,Dl,sl,io),{ascent:ul,descent:fl}=e.measureFontMetrics(ut,tt,_e,mt),ml=ul+fl,vi=dl.length*ml;let pl;ll==="middle"?pl=$e+(Xe-vi)/2+ul:ll==="bottom"?pl=$e+Xe-e.BASE_CELL_VPAD-fl-(dl.length-1)*ml:pl=$e+e.BASE_CELL_VPAD+ul;for(let Wt=0;Wt<dl.length;Wt++){const ol=dl[Wt],Tt=pl+Wt*ml,Gt=r.measureText(ol);let At;if(tl==="center"?At=Ie+Ye/2-Gt.width/2:tl==="right"?At=Ie+Ye-5-Gt.width:At=Ie+5,r.fillText(ol,At,Tt),Ct&&(r.strokeStyle=zt||He.cellText,r.lineWidth=1,r.beginPath(),r.moveTo(At,Tt+fl+1),r.lineTo(At+Gt.width,Tt+fl+1),r.stroke()),st){r.strokeStyle=zt||He.cellText,r.lineWidth=1;const so=Tt-ul+ml*.42;r.beginPath(),r.moveTo(At,so),r.lineTo(At+Gt.width,so),r.stroke()}}r.restore()}}}for(let j=It;j<=bt;j++)for(let te=Lt;te<=xt;te++){const xe=e.findMerge(te,j);if(xe&&!(te===xe.range.startCol&&j===xe.range.startRow))continue;const Ie=ve+ct[te]-L,$e=he+ot[j]-pe;let Ye=ht[te],Xe=pt[j];if(xe&&(Ye=ct[xe.range.endCol+1]-ct[te],Xe=ot[xe.range.endRow+1]-ot[j]),Ie+Ye<ve||$e+Xe<he||Ie>z||$e>C)continue;const nt=(Qt=e.cells[e.cellKey(te,j)])==null?void 0:Qt.style,yt=(nt==null?void 0:nt.borderTopWidth)||0,St=(nt==null?void 0:nt.borderLeftWidth)||0,Re=(nt==null?void 0:nt.borderBottomWidth)||0,at=(nt==null?void 0:nt.borderRightWidth)||0;if(r.fillStyle=k,xe){const qe=xe.range.startRow,et=xe.range.endRow,tt=xe.range.startCol,ut=xe.range.endCol;for(let _e=tt;_e<=ut;_e++){const mt=ve+ct[_e]-L,Ct=ht[_e],st=Math.max(yt,o.cellBorderWidth(_e,qe-1,"Bottom"));st>0&&r.fillRect(mt,$e,Ct,st)}for(let _e=tt;_e<=ut;_e++){const mt=ve+ct[_e]-L,Ct=ht[_e],st=Math.max(Re,o.cellBorderWidth(_e,et+1,"Top"));st>0&&r.fillRect(mt,$e+Xe-st,Ct,st)}for(let _e=qe;_e<=et;_e++){const mt=he+ot[_e]-pe,Ct=pt[_e],st=Math.max(St,o.cellBorderWidth(tt-1,_e,"Right"));st>0&&r.fillRect(Ie,mt,st,Ct)}for(let _e=qe;_e<=et;_e++){const mt=he+ot[_e]-pe,Ct=pt[_e],st=Math.max(at,o.cellBorderWidth(ut+1,_e,"Left"));st>0&&r.fillRect(Ie+Ye-st,mt,st,Ct)}}else{const qe=Math.max(yt,o.cellBorderWidth(te,j-1,"Bottom")),et=Math.max(St,o.cellBorderWidth(te-1,j,"Right")),tt=Math.max(Re,o.cellBorderWidth(te,j+1,"Top")),ut=Math.max(at,o.cellBorderWidth(te+1,j,"Left"));(qe>0||et>0||tt>0||ut>0)&&(qe>0&&r.fillRect(Ie,$e,Ye,qe),tt>0&&r.fillRect(Ie,$e+Xe-tt,Ye,tt),et>0&&r.fillRect(Ie,$e,et,Xe),ut>0&&r.fillRect(Ie+Ye-ut,$e,ut,Xe))}}for(let j=It;j<=bt;j++)for(let te=Lt;te<=xt;te++){const xe=e.findMerge(te,j);if(xe&&!(te===xe.range.startCol&&j===xe.range.startRow))continue;const Ie=ve+ct[te]-L,$e=he+ot[j]-pe;let Ye=ht[te],Xe=pt[j];if(xe&&(Ye=ct[xe.range.endCol+1]-ct[te],Xe=ot[xe.range.endRow+1]-ot[j]),Ie+Ye<ve||$e+Xe<he||Ie>z||$e>C)continue;const nt=((Nt=(Mt=e.cells[e.cellKey(te,j)])==null?void 0:Mt.style)==null?void 0:Nt.borderTopWidth)||0,yt=((lo=(el=e.cells[e.cellKey(te,j)])==null?void 0:el.style)==null?void 0:lo.borderLeftWidth)||0,St=((no=(oo=e.cells[e.cellKey(te,j)])==null?void 0:oo.style)==null?void 0:no.borderBottomWidth)||0,Re=((ao=(ro=e.cells[e.cellKey(te,j)])==null?void 0:ro.style)==null?void 0:ao.borderRightWidth)||0;if(r.fillStyle=k,xe){const at=xe.range.startRow,qe=xe.range.endRow,et=xe.range.startCol,tt=xe.range.endCol,ut=Math.max(nt,o.cellBorderWidth(et,at-1,"Bottom")),_e=Math.max(yt,o.cellBorderWidth(et-1,at,"Right"));ut>0&&_e>0&&r.fillRect(Ie-_e,$e-ut,_e,ut);const mt=Math.max(nt,o.cellBorderWidth(tt,at-1,"Bottom")),Ct=Math.max(Re,o.cellBorderWidth(tt+1,at,"Left"));mt>0&&Ct>0&&r.fillRect(Ie+Ye,$e-mt,Ct,mt);const st=Math.max(St,o.cellBorderWidth(et,qe+1,"Top")),zt=Math.max(yt,o.cellBorderWidth(et-1,qe,"Right"));st>0&&zt>0&&r.fillRect(Ie-zt,$e+Xe,zt,st);const tl=Math.max(St,o.cellBorderWidth(tt,qe+1,"Top")),ll=Math.max(Re,o.cellBorderWidth(tt+1,qe,"Left"));tl>0&&ll>0&&r.fillRect(Ie+Ye,$e+Xe,ll,tl)}else{const at=Math.max(nt,o.cellBorderWidth(te,j-1,"Bottom")),qe=Math.max(yt,o.cellBorderWidth(te-1,j,"Right")),et=Math.max(St,o.cellBorderWidth(te,j+1,"Top")),tt=Math.max(Re,o.cellBorderWidth(te+1,j,"Left"));at>0&&qe>0&&r.fillRect(Ie-qe,$e-at,qe,at),at>0&&tt>0&&r.fillRect(Ie+Ye,$e-at,tt,at),et>0&&qe>0&&r.fillRect(Ie-qe,$e+Xe,qe,et),et>0&&tt>0&&r.fillRect(Ie+Ye,$e+Xe,tt,et)}}r.restore(),r.fillStyle=He.headerBg,r.fillRect(ve,0,z-ve,he);for(let j=Bt;j<=xt;j++){const te=ve+ct[j]-L,xe=ht[j];te+xe<ve||te>z||(ft&&j>=ft.startCol&&j<=ft.endCol&&(r.fillStyle=He.selectionBg,r.fillRect(te,0,xe,he)),r.strokeStyle=He.headerBorder,r.lineWidth=.5,r.strokeRect(te+.25,.25,xe-.5,he-.5),ft&&j>=ft.startCol&&j<=ft.endCol&&(r.strokeStyle=He.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(te,he-1),r.lineTo(te+xe,he-1),r.stroke()),r.fillStyle=He.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(Ue(j),te+xe/2,he/2))}r.strokeStyle=He.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(ve,he+.5),r.lineTo(z,he+.5),r.stroke(),r.fillStyle=He.headerBg,r.fillRect(0,he,ve,C-he);for(let j=wt;j<=bt;j++){const te=he+ot[j]-pe,xe=pt[j];te+xe<he||te>C||(ft&&j>=ft.startRow&&j<=ft.endRow&&(r.fillStyle=He.selectionBg,r.fillRect(0,te,ve,xe)),r.strokeStyle=He.headerBorder,r.lineWidth=.5,r.strokeRect(.25,te+.25,ve-.5,xe-.5),ft&&j>=ft.startRow&&j<=ft.endRow&&(r.strokeStyle=He.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(ve-1,te),r.lineTo(ve-1,te+xe),r.stroke()),r.fillStyle=He.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(j+1),ve/2,te+xe/2+.5))}r.strokeStyle=He.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(ve+.5,he),r.lineTo(ve+.5,C),r.stroke(),r.fillStyle=He.headerBg,r.fillRect(0,0,ve,he),r.strokeStyle=He.headerSep,r.lineWidth=1,r.strokeRect(.5,.5,ve-.5,he-.5)}const S=t.computed(()=>Ue(e.activeCell.value.col)+String(e.activeCell.value.row+1)),w=t.ref(""),R=t.ref(!1),B=t.computed(()=>e.editingCell.value?w.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(s,g)=>{if(s&&!g){const $=e.editValue.value||e.getCellRaw(s.col,s.row)||"";w.value=$,V=!1}else!s&&g&&(w.value="",R.value=!1,V=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(w.value="",V=!1)});function le(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),u())}function ne(s){const g=s.target.value;w.value=g,V=!0,e.editingCell.value||e.startEdit()}let p=!1,V=!1;function P(){var L,pe,ve,he,He,ct,ot,ht,pt;if(p)return;const s=l.formulaBarRef.value,g=!!(s&&typeof document<"u"&&document.activeElement===s);if(!e.editingCell.value&&!g&&!V)return;const $={...e.activeCell.value},z=e.editingCell.value?e.editingCell.value.col:$.col,C=e.editingCell.value?e.editingCell.value.row:$.row;if(!e.editingCell.value){const Bt=e.getCellRaw(z,C),Ut=w.value!==Bt;if(!V)return;p=!0,Ut&&((L=e.saveUndo)==null||L.call(e),e.setCellValue(z,C,w.value),u(),(pe=l.emitModelData)==null||pe.call(l)),(ve=l.formulaBarRef.value)==null||ve.blur(),w.value="",R.value=!1,V=!1,t.nextTick(()=>{p=!1});return}p=!0,V?(e.editValue.value=w.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(he=l.formulaBarRef.value)==null||he.blur(),w.value="",R.value=!1,V=!1,u(),l.focusEditInput(),(He=l.emitModelData)==null||He.call(l),t.nextTick(()=>{p=!1})):g?(w.value=e.editValue.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(ct=l.formulaBarRef.value)==null||ct.blur(),w.value="",R.value=!1,V=!1,u(),l.focusEditInput(),(ot=l.emitModelData)==null||ot.call(l),t.nextTick(()=>{p=!1})):(e.commitEdit(),(ht=l.formulaBarRef.value)==null||ht.blur(),w.value="",R.value=!1,V=!1,u(),l.focusEditInput(),(pt=l.emitModelData)==null||pt.call(l),t.nextTick(()=>{p=!1}))}function oe(){var s;p||(p=!0,e.editingCell.value&&e.cancelEdit(),(s=l.formulaBarRef.value)==null||s.blur(),w.value="",R.value=!1,V=!1,u(),l.focusEditInput(),t.nextTick(()=>{p=!1}))}function Z(s){if(!s.isComposing){if(s.key==="Enter"&&(s.altKey||s.metaKey)&&!s.ctrlKey){s.preventDefault(),s.stopPropagation();const g=s.target;if(!g)return;e.editingCell.value||e.startEdit();const $=g.selectionStart??g.value.length,z=g.selectionEnd??g.value.length,C=g.value,L=C.substring(0,$)+`
7
+ `+C.substring(z),pe=$+1;w.value=L,R.value||(R.value=!0),t.nextTick(()=>{try{g.setSelectionRange(pe,pe)}catch{}if(R.value)try{g.scrollTop=g.scrollHeight}catch{}try{g.focus({preventScroll:!0})}catch{}});return}s.key==="Enter"?(s.preventDefault(),P()):s.key==="Escape"&&(s.preventDefault(),oe())}}function J(){P()}const q=t.ref(null),ue=t.ref("");function Fe(s){q.value===null&&(l.switchSheet(s),u())}function Oe(s){s!==l.activeSheetIndex.value&&(l.saveSheet(),l.loadSheet(s),u()),q.value=s,ue.value=l.sheets.value[s].name,t.nextTick(()=>{const g=document.querySelector(".tab-rename-input");g==null||g.focus(),g==null||g.select()})}function Je(){q.value!==null&&(l.renameSheet(q.value,ue.value),t.nextTick(()=>l.emitModelData())),q.value=null,ue.value=""}function Ge(){q.value=null,ue.value=""}function je(s){s.key==="Enter"?(s.preventDefault(),Je()):s.key==="Escape"&&(s.preventDefault(),Ge())}const se=t.ref(null);let de=null;function Te(){de&&(document.removeEventListener("click",de),de=null)}function re(s,g,$){Te();const z=140,C=$.length*28+8,L=window.innerWidth,pe=window.innerHeight;s+z>L&&(s-=z),g+C>pe&&(g-=C),se.value={x:s,y:g,items:$},de=()=>{se.value=null,Te()},setTimeout(()=>document.addEventListener("click",de,{once:!0}),0)}const i=t.ref(!1);function m(s,g){if(!g.children){i.value=!1;return}const z=s.currentTarget.querySelector(".context-submenu");if(!z){i.value=!1;return}const C=z.getBoundingClientRect();i.value=C.right>window.innerWidth}function fe(s,g){s.preventDefault(),s.stopPropagation(),re(s.clientX,s.clientY,[{label:N(e.locale.value,"insert"),action:()=>{l.addSheet(),u()}},{label:N(e.locale.value,"copy"),action:()=>{l.dupSheet(g)}},{label:N(e.locale.value,"rename"),action:()=>{Oe(g)}},{label:N(e.locale.value,"delete"),action:()=>{l.removeSheet(g),u()},disabled:l.sheetCount.value<=1},{label:N(e.locale.value,"moveSheetLeft"),action:()=>{l.moveSheet(g,-1)},disabled:g===0},{label:N(e.locale.value,"moveSheetRight"),action:()=>{l.moveSheet(g,1)},disabled:g===l.sheets.value.length-1}])}function De(s){s.preventDefault(),!(s.target.closest(".tab-item")||s.target.closest(".tab-bar__add-btn"))&&re(s.clientX,s.clientY,[{label:N(e.locale.value,"insert"),action:()=>{l.addSheet(),u()}}])}function f(s){s.preventDefault(),e.selectAll(),u(),re(s.clientX,s.clientY,[{label:N(e.locale.value,"cut"),action:()=>{o.cutSelected(),l.emitModelData()}},{label:N(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:N(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>l.emitModelData())})}},{label:N(e.locale.value,"delete"),action:()=>{n.saveUndo(),o.clearSelected();for(let g=0;g<e.colCount;g++)e.colWidths.value[g]=100;for(let g=0;g<e.rowCount;g++)e.rowHeights.value[g]=void 0;u(),l.emitModelData()}}])}function y(s,g){s.preventDefault();const $=s.clientX,z=s.clientY,C=e.selection.value;C&&C.startCol===0&&C.endCol===e.colCount-1&&g>=C.startRow&&g<=C.endRow||(e.selectRange(0,g,e.colCount-1,g,"row"),u());const L=e.selection.value;re(s.clientX,s.clientY,[{label:N(e.locale.value,"insert"),action:()=>{n.saveUndo(),l.insertRows(L.startRow,L.endRow),u(),l.emitModelData()},disabled:L.endRow>=e.rowCount-1},{label:N(e.locale.value,"cut"),action:()=>{n.saveUndo(),o.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,L.startRow,L.endRow),u(),l.emitModelData()}},{label:N(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:N(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>l.emitModelData())})}},{label:N(e.locale.value,"delete"),action:()=>{n.saveUndo(),l.deleteRows(L.startRow,L.endRow),u(),l.emitModelData()}},{label:`${N(e.locale.value,"rowHeight")}...`,action:()=>W("row",$,z)},{label:N(e.locale.value,"autoRowHeight"),action:()=>l.resetRowHeight()}])}function T(s,g){s.preventDefault();const $=s.clientX,z=s.clientY,C=e.selection.value;C&&C.startRow===0&&C.endRow===e.rowCount-1&&g>=C.startCol&&g<=C.endCol||(e.selectRange(g,0,g,e.rowCount-1,"col"),u());const L=e.selection.value;re(s.clientX,s.clientY,[{label:N(e.locale.value,"insert"),action:()=>{n.saveUndo(),l.insertCols(L.startCol,L.endCol),u(),l.emitModelData()},disabled:L.endCol>=e.colCount-1},{label:N(e.locale.value,"cut"),action:()=>{n.saveUndo(),o.copyRowCol(),e.clearCellsInRange(L.startCol,L.endCol,0,e.rowCount-1),u(),l.emitModelData()}},{label:N(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:N(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>l.emitModelData())})}},{label:N(e.locale.value,"delete"),action:()=>{n.saveUndo(),l.deleteCols(L.startCol,L.endCol),u(),l.emitModelData()}},{label:`${N(e.locale.value,"colWidth")}...`,action:()=>W("col",$,z)},{label:N(e.locale.value,"defaultColWidth"),action:()=>l.resetColWidth()}])}function A(s,g,$){s.preventDefault(),e.isSelected(g,$)||(e.selectCell(g,$),u());const z=e.selection.value,C=!!(z&&z.startCol===z.endCol&&z.startRow===z.endRow);re(s.clientX,s.clientY,[{label:N(e.locale.value,"cut"),action:()=>{o.cutSelected(),l.emitModelData()}},{label:N(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:N(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>l.emitModelData())})}},{label:N(e.locale.value,"delete"),action:()=>{n.saveUndo(),o.clearSelected(),u(),l.emitModelData()}},{label:N(e.locale.value,"calculate"),children:[{label:N(e.locale.value,"sum"),action:o.sumSelected,disabled:C},{label:N(e.locale.value,"avg"),action:o.avgSelected,disabled:C},{label:N(e.locale.value,"count"),action:o.countSelected,disabled:C}]}])}const a=t.ref(null),h=t.ref(null);let _=null;function E(){_&&(document.removeEventListener("mousedown",_),_=null)}function W(s,g,$){E();const z=e.selection.value;let C="";if(z){const He=s==="row"?e.getRowHeight(z.startRow):e.colWidths.value[z.startCol];C=He!=null&&He>0?String(Math.round(He)):""}const L=220,pe=118;let ve=g,he=$;ve+L>window.innerWidth&&(ve=window.innerWidth-L-8),he+pe>window.innerHeight&&(he=window.innerHeight-pe-8),ve<8&&(ve=8),he<8&&(he=8),h.value={type:s,x:ve,y:he,value:C,error:""},_=()=>{h.value=null},setTimeout(()=>document.addEventListener("mousedown",_,{once:!0}),0),t.nextTick(()=>{const He=a.value;He&&(He.focus(),He.select())})}function Y(s){const g=h.value;if(!g)return;const $=s.target,z=$.value,C=z.replace(/[^\d]/g,"");g.value=C,z!==C&&($.value=C),g.error=""}function Me(s){s.key==="Enter"?(s.preventDefault(),Ke()):s.key==="Escape"&&(s.preventDefault(),Be())}function Ve(){const s=h.value;if(!s)return;const g=s.value.trim(),$=Number(g),z=s.type==="row",C=z?24:30,L=z?500:1e3;if(g===""||!Number.isFinite($)){Be();return}const pe=Math.max(C,Math.min(L,Math.round($)));s.value=String(pe),s.error=""}function Ke(){const s=h.value,g=e.selection.value;if(!s||!g)return;const $=s.value.trim(),z=Number($),C=s.type==="row",L=C?24:30,pe=C?500:1e3;if($===""||!Number.isFinite(z)){s.error=N(e.locale.value,"dimNumberError");return}if(z<L||z>pe){s.error=N(e.locale.value,"dimRangeError").replace("{min}",String(L)).replace("{max}",String(pe));return}const ve=z;if(n.saveUndo(),C)for(let he=g.startRow;he<=g.endRow;he++)e.rowHeights.value[he]=ve;else for(let he=g.startCol;he<=g.endCol;he++)e.colWidths.value[he]=ve;u(),l.emitModelData(),Be()}function Be(){E(),h.value=null}const M=t.computed(()=>{var el;const s=!e.editingCell.value,g=e.editingCell.value??e.activeCell.value,$=g.col,z=g.row,C=(el=e.cells[e.cellKey($,z)])==null?void 0:el.style,L=e.cellFontSize($,z),pe=typeof(C==null?void 0:C.fontFamily)=="string"&&C.fontFamily?C.fontFamily:Pt,ve=(C==null?void 0:C.fontWeight)==="bold"?"bold":"normal",he=(C==null?void 0:C.fontStyle)==="italic"?"italic":"normal",He=(C==null?void 0:C.underline)==="underline"?"underline":(C==null?void 0:C.strikethrough)==="line-through"?"line-through":"none",ct=(C==null?void 0:C.underline)==="underline"&&(C==null?void 0:C.strikethrough)==="line-through"?"underline line-through":He,ot=typeof(C==null?void 0:C.color)=="string"?C.color:void 0,ht=typeof(C==null?void 0:C.backgroundColor)=="string"?C.backgroundColor:void 0,pt=typeof(C==null?void 0:C.numberFormat)=="string"?C.numberFormat:"",Bt=e.editValue.value??e.getCellValue($,z),Ut=typeof(C==null?void 0:C.textAlign)=="string"?C.textAlign:_l(Bt,pt)?"right":"left",xt=typeof(C==null?void 0:C.verticalAlign)=="string"?C.verticalAlign:"top",wt=e.findMerge($,z),cl=wt?e.colPositions.value[wt.range.endCol+1]-e.colPositions.value[$]:e.colWidths.value[$],bt=wt?e.rowPositions.value[wt.range.endRow+1]-e.rowPositions.value[z]:e.getRowHeight(z),Lt=2,{ascent:It,descent:ft}=e.measureFontMetrics(pe,L,ve,he),Jt=It+ft,$t=(e.editValue.value?e.editValue.value.split(`
8
+ `).length:1)*Jt,Qt=e.BASE_CELL_VPAD-Lt;let Mt=0,Nt=0;return xt==="middle"?(Mt=Math.floor((bt-$t)/2),Nt=Math.max(0,bt-$t-Mt)):xt==="top"?(Mt=Qt,Nt=Math.max(0,bt-$t-Mt)):xt==="bottom"&&(Nt=Qt,Mt=Math.max(0,bt-$t-Nt)),{left:`${52+e.colPositions.value[$]-e.scrollX.value}px`,top:`${24+e.rowPositions.value[z]-e.scrollY.value}px`,width:`${cl}px`,height:`${bt}px`,fontFamily:pe,fontSize:`${L}px`,lineHeight:1,fontWeight:ve,fontStyle:he,textDecoration:ct,textAlign:Ut,paddingTop:`${Mt}px`,paddingRight:"3px",paddingBottom:`${Nt}px`,paddingLeft:"3px",opacity:s?0:1,pointerEvents:s?"none":"auto",color:s?"transparent":ot,caretColor:s?"transparent":void 0,borderColor:s?"transparent":void 0,background:s?"transparent":ht,boxShadow:s?"none":void 0}});function D(){return Math.max(0,l.viewSize.w-52-11)}function G(){return Math.max(0,l.viewSize.h-24-11)}const ce=t.computed(()=>D()),ee=t.computed(()=>G()),ae=t.computed(()=>Math.max(0,ce.value-11*2)),X=t.computed(()=>Math.max(0,ee.value-11*2)),U=t.computed(()=>l.maxScrollX.value<=0?ae.value:Math.max(24,D()/e.totalWidth.value*ae.value)),ye=t.computed(()=>l.maxScrollX.value<=0?0:e.scrollX.value/l.maxScrollX.value*(ae.value-U.value)),Ee=t.computed(()=>l.maxScrollY.value<=0?X.value:Math.max(24,G()/e.totalHeight.value*X.value)),Ze=t.computed(()=>l.maxScrollY.value<=0?0:e.scrollY.value/l.maxScrollY.value*(X.value-Ee.value));let Pe=null,H=0,O=0;function I(s){s.preventDefault(),Pe="v",H=s.clientY,O=e.scrollY.value,document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ke)}function Q(s){s.preventDefault(),Pe="h",H=s.clientX,O=e.scrollX.value,document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ke)}function ie(s){if(Pe==="v"){const $=(s.clientY-H)/(X.value-Ee.value);l.clampScroll(null,O+$*l.maxScrollY.value),u()}else if(Pe==="h"){const $=(s.clientX-H)/(ae.value-U.value);l.clampScroll(O+$*l.maxScrollX.value,null),u()}}function ke(){Pe=null,document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ke)}function Ne(s){if(Pe)return;const g=s.currentTarget.getBoundingClientRect(),$=s.clientY-g.top;$<Ze.value?l.clampScroll(null,e.scrollY.value-G()):$>Ze.value+Ee.value&&l.clampScroll(null,e.scrollY.value+G()),u()}function ze(s){if(Pe)return;const g=s.currentTarget.getBoundingClientRect(),$=s.clientX-g.left;$<ye.value?l.clampScroll(e.scrollX.value-D(),null):$>ye.value+U.value&&l.clampScroll(e.scrollX.value+D(),null),u()}let Le=!1,We=0,Se=0,b=!1,F=!1,K=0,Ce=0,ge=0,me=0,be=0,we=0,Ae=0,lt=0,it=!1,dt=!1,Qe=0,rt=0,Rt="cell",Bl=0,Jl=-1,Ql=-1;function li(s){if(s.button!==0)return;s.preventDefault(),se.value=null;const g=Ft(s,l.canvasRef.value);if(g.y<24&&g.x>=52){const C=g.x-52+e.scrollX.value,L=e.hitCol(C);if(L>=0&&Math.abs(g.x-(52+e.colPositions.value[L+1]-e.scrollX.value))<=4){n.saveUndo(),b=!0,K=L,ge=e.colWidths.value[L],me=C,u();return}}if(g.x<52&&g.y>=24){const C=g.y-24+e.scrollY.value,L=e.hitRow(C);if(L>=0&&Math.abs(g.y-(24+e.rowPositions.value[L+1]-e.scrollY.value))<=4){n.saveUndo(),F=!0,Ce=L,ge=e.getRowHeight(L),me=C,u();return}}if(g.x<52||g.y<24){{const C=l.formulaBarRef.value,L=!!(C&&typeof document<"u"&&document.activeElement===C);(e.editingCell.value||L||V)&&P()}if(g.y<24&&g.x>=52){const C=e.hitCol(g.x-52+e.scrollX.value);C>=0&&(e.selectRange(C,0,C,e.rowCount-1,"col"),Le=!0,We=C,Se=0)}else if(g.x<52&&g.y>=24){const C=e.hitRow(g.y-24+e.scrollY.value);C>=0&&(e.selectRange(0,C,e.colCount-1,C,"row"),Le=!0,We=0,Se=C)}else g.x<52&&g.y<24&&e.selectAll();u();return}const $=e.hitCol(g.x-52+e.scrollX.value),z=e.hitRow(g.y-24+e.scrollY.value);if(!($<0||z<0)){{const C=l.formulaBarRef.value,L=!!(C&&typeof document<"u"&&document.activeElement===C);(e.editingCell.value||L||V)&&P()}if(s.shiftKey&&e.selection.value){const C=e.selection.value;e.selectRange(C.startCol,C.startRow,$,z)}else e.selectCell($,z);Le=!0,We=$,Se=z,l.focusEditInput(),u()}}function oi(s){if(b){const L=Ft(s,l.canvasRef.value).x-52+e.scrollX.value-me,pe=ge+L;pe>=30&&pe<=1e3?e.colWidths.value[K]=pe:pe<30?e.colWidths.value[K]=30:e.colWidths.value[K]=1e3,u();return}if(F){const L=Ft(s,l.canvasRef.value).y-24+e.scrollY.value-me,pe=ge+L;pe>=24&&pe<=500?e.rowHeights.value[Ce]=pe:pe<24?e.rowHeights.value[Ce]=24:e.rowHeights.value[Ce]=500,u();return}if(!Le){const C=l.canvasRef.value;if(!C)return;if(n.paintFmt.value){C.style.cursor="copy";return}const L=Ft(s,C);if(L.y<24&&L.x>=52){const pe=e.hitCol(L.x-52+e.scrollX.value);if(pe>=0&&Math.abs(L.x-(52+e.colPositions.value[pe+1]-e.scrollX.value))<=4){C.style.cursor="col-resize";return}}if(L.x<52&&L.y>=24){const pe=e.hitRow(L.y-24+e.scrollY.value);if(pe>=0&&Math.abs(L.y-(24+e.rowPositions.value[pe+1]-e.scrollY.value))<=4){C.style.cursor="row-resize";return}}C.style.cursor="cell";return}const g=Ft(s,l.canvasRef.value);if(We<0||Se<0)return;if(g.x<52||g.y<24){if(g.y<24&&g.x>=52){const C=e.hitCol(g.x-52+e.scrollX.value);C>=0&&e.selectRange(Math.min(We,C),0,Math.max(We,C),e.rowCount-1,"col")}else if(g.x<52&&g.y>=24){const C=e.hitRow(g.y-24+e.scrollY.value);C>=0&&e.selectRange(0,Math.min(Se,C),e.colCount-1,Math.max(Se,C),"row")}u();return}const $=e.hitCol(g.x-52+e.scrollX.value),z=e.hitRow(g.y-24+e.scrollY.value);$<0||z<0||(Se===0&&We>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(We,$),0,Math.max(We,$),e.rowCount-1,"col"):We===0&&Se>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(Se,z),e.colCount-1,Math.max(Se,z),"row"):e.selectRange(We,Se,$,z),u())}function ni(s){const g=b||F;Le=!1,b=!1,F=!1,g&&l.scheduleOptEmit(),n.paintFmt.value&&n.applyPaintFormat()}function ri(){const s=b||F;Le=!1,b=!1,F=!1,s&&l.scheduleOptEmit()}function ai(s){s.preventDefault();const g=Ft(s,l.canvasRef.value);if(g.x<52&&g.y<24){f(s);return}if(g.y<24&&g.x>=52){const $=e.hitCol(g.x-52+e.scrollX.value);$>=0&&T(s,$);return}if(g.x<52&&g.y>=24){const $=e.hitRow(g.y-24+e.scrollY.value);$>=0&&y(s,$);return}if(g.x>=52&&g.y>=24){const $=e.hitCol(g.x-52+e.scrollX.value),z=e.hitRow(g.y-24+e.scrollY.value);$>=0&&z>=0&&A(s,$,z)}}function ii(s){const g=Ft(s,l.canvasRef.value);if(g.x<52||g.y<24)return;const $=e.hitCol(g.x-52+e.scrollX.value),z=e.hitRow(g.y-24+e.scrollY.value);if(!($<0||z<0)){{const C=l.formulaBarRef.value,L=!!(C&&typeof document<"u"&&document.activeElement===C);(e.editingCell.value||L||V)&&P()}e.selectCell($,z),e.ensureVisible($,z),e.startEdit(),u(),l.focusEditInput()}}function ci(s){l.clampScroll(e.scrollX.value+s.deltaX,e.scrollY.value+s.deltaY),u()}function si(s){if(s.touches.length!==1){it=!1;return}const g=s.touches[0],$=l.canvasRef.value;if(!$)return;const z=$.getBoundingClientRect(),C=g.clientX-z.left,L=g.clientY-z.top;C>=52&&L>=24?(s.preventDefault(),it=!0,dt=!1,Rt="cell",be=C,we=L,Ae=e.scrollX.value,lt=e.scrollY.value,Qe=e.hitCol(C-52+e.scrollX.value),rt=e.hitRow(L-24+e.scrollY.value)):C>=0&&L>=0&&(C<52||L<24)&&(s.preventDefault(),it=!0,dt=!1,be=C,we=L,Ae=e.scrollX.value,lt=e.scrollY.value,L<24&&C>=52?(Rt="col",Qe=e.hitCol(C-52+e.scrollX.value),rt=-1):C<52&&L>=24?(Rt="row",rt=e.hitRow(L-24+e.scrollY.value),Qe=-1):(Rt="all",Qe=-1,rt=-1))}function di(s){if(!it||s.touches.length!==1)return;const g=s.touches[0],$=l.canvasRef.value;if(!$)return;const z=$.getBoundingClientRect(),C=g.clientX-z.left,L=g.clientY-z.top;(Math.abs(C-be)>8||Math.abs(L-we)>8)&&(dt=!0,s.preventDefault(),l.clampScroll(Ae+(be-C),lt+(we-L)),u())}function ui(){if(it&&(it=!1,!dt))if(Rt==="cell"&&Qe>=0&&rt>=0){const s=Date.now();Qe===Jl&&rt===Ql&&s-Bl<300?(e.selectCell(Qe,rt),e.startEdit(),u(),l.focusEditInput(),Bl=0):(e.commitEdit(),e.selectCell(Qe,rt),u(),Bl=s),Jl=Qe,Ql=rt,l.focusEditInput()}else Rt==="col"&&Qe>=0?(e.commitEdit(),e.selectRange(Qe,0,Qe,e.rowCount-1,"col"),u()):Rt==="row"&&rt>=0?(e.commitEdit(),e.selectRange(0,rt,e.colCount-1,rt,"row"),u()):Rt==="all"&&(e.commitEdit(),e.selectAll(),u())}function xl(s){return s.isComposing||s.key==="Process"||s.keyCode===229}function eo(s){return s.key.length===1&&!s.ctrlKey&&!s.metaKey&&!s.altKey}function to(s){if(e.editingCell.value)return;const g=s.ctrlKey||s.metaKey,$=s.shiftKey;switch(!0){case(g&&(s.key==="c"||s.key==="C")):s.preventDefault(),o.copyToClipboard();return;case(g&&(s.key==="x"||s.key==="X")):s.preventDefault(),o.cutSelected();return;case(g&&(s.key==="z"||s.key==="Z")):s.preventDefault(),n.undo();return;case(g&&(s.key==="y"||s.key==="Y")):s.preventDefault(),n.redo();return;case(g&&(s.key==="v"||s.key==="V")):s.preventDefault(),n.saveUndo(),o.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>l.emitModelData())});return;case(g&&(s.key==="a"||s.key==="A")):s.preventDefault(),e.selectAll(),u();return;case(g&&s.key==="Home"):s.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),u();return;case(g&&s.key==="End"):s.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),u();return;case s.key==="Home":s.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),u();return;case s.key==="End":s.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),u();return;case s.key==="ArrowUp":s.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="ArrowDown":s.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="ArrowLeft":s.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="ArrowRight":s.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="Tab":s.preventDefault(),e.moveActive($?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="Enter":s.preventDefault(),e.moveActive(0,$?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="F2":s.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),u(),l.focusEditInput();return;case s.key==="Delete":case s.key==="Backspace":s.preventDefault(),n.saveUndo(),o.clearSelected(),u();return;case s.key==="Escape":s.preventDefault(),e.cancelEdit(),n.paintFmt.value=null,u();return;case eo(s):if(xl(s)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),u(),l.focusEditInput();return}s.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(s.key),u(),t.nextTick(()=>{const z=l.editInputRef.value;z&&(z.focus(),z.setSelectionRange(1,1))});return}}let Ml=!1,Sl=!1;function fi(s){const g=s.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(g),w.value=g,u();return}e.editValue.value=g,w.value=g}function mi(){Ml=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),w.value="",u())}function pi(s){Ml=!1,Sl=!0,setTimeout(()=>{Sl=!1},0);const g=s.target.value;e.editValue.value=g,w.value=g}function gi(s){if(!e.editingCell.value){if(eo(s)||xl(s))return;to(s);return}if(!(Ml||xl(s))&&!(Sl&&(s.key==="Enter"||s.key==="Escape")))if(s.key==="Enter"&&(s.altKey||s.metaKey)){s.preventDefault();const g=l.editInputRef.value;if(!g)return;const $=g.selectionStart??g.value.length,z=g.selectionEnd??g.value.length,C=g.value,L=C.slice(0,$)+`
9
+ `+C.slice(z);e.editValue.value=L,g.value=L,g.selectionStart=g.selectionEnd=$+1,u()}else s.key==="Enter"?(s.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u(),l.focusEditInput()):s.key==="Tab"?(s.preventDefault(),e.commitEdit(),e.moveActive(s.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u(),l.focusEditInput()):s.key==="Escape"&&(s.preventDefault(),e.cancelEdit(),u(),l.focusEditInput())}function hi(s){e.editingCell.value}function Ci(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),u())},0)}let gt=null;function qt(){var g;const s=(g=l.wrapperRef.value)==null?void 0:g.getBoundingClientRect();if(s){const $=Vt(e.props.width),z=Vt(e.props.height);$!=null?l.viewSize.w=$:l.viewSize.w=s.width,z!=null?l.viewSize.h=z:l.viewSize.h=s.height}l.clampScroll(null,null),u()}function bi(){t.onMounted(()=>{const s=Vt(e.props.width),g=Vt(e.props.height);(s==null||g==null)&&(gt=new ResizeObserver(()=>qt()),l.wrapperRef.value&&gt.observe(l.wrapperRef.value)),t.nextTick(()=>{qt(),l.focusEditInput()}),e.selectCell(0,0),l.modelData.value&&l.modelData.value.length>0&&(c.value=JSON.stringify(l.modelData.value),l.sheets.value=l.modelData.value.map($=>{const z=l.mkSheet($.name);for(const[C,L]of Object.entries($.cells))z.cells[C]={value:L.value,style:L.style??null};if($.colWidths)for(const[C,L]of Object.entries($.colWidths)){const pe=Number(C);pe>=0&&pe<e.colCount&&L>=30&&(z.colWidths[pe]=L)}if($.rowHeights)for(const[C,L]of Object.entries($.rowHeights)){const pe=Number(C);pe>=0&&pe<e.rowCount&&L>=24&&(z.rowHeights[pe]=L)}if($.merges)for(const[C,L]of Object.entries($.merges))z.merges[C]={...L};return z}),l.sheets.value.length>0&&l.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const s=Vt(e.props.width),g=Vt(e.props.height);s!=null&&g!=null?(gt==null||gt.disconnect(),gt=null):!gt&&l.wrapperRef.value&&(gt=new ResizeObserver(()=>qt()),gt.observe(l.wrapperRef.value)),t.nextTick(()=>qt())}),t.watch(()=>e.props.theme,()=>u()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>l.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>l.emitModelData()),u()},{deep:!1}),t.watch(l.activeSheetIndex,()=>t.nextTick(()=>l.emitModelData())),t.watch(()=>l.modelData.value,s=>{if(!s||s.length===0)return;const g=JSON.stringify(s);if(g===c.value)return;c.value=g;const $=e.selection.value?{...e.selection.value}:null,z={...e.activeCell.value};l.sheets.value=s.map(C=>{const L=l.mkSheet(C.name);for(const[pe,ve]of Object.entries(C.cells))L.cells[pe]={value:ve.value,style:ve.style??null};if(C.colWidths)for(const[pe,ve]of Object.entries(C.colWidths)){const he=Number(pe);he>=0&&he<e.colCount&&ve>=30&&(L.colWidths[he]=ve)}if(C.rowHeights)for(const[pe,ve]of Object.entries(C.rowHeights)){const he=Number(pe);he>=0&&he<e.rowCount&&ve>=24&&(L.rowHeights[he]=ve)}if(C.merges)for(const[pe,ve]of Object.entries(C.merges))L.merges[pe]={...ve};return L}),l.sheets.value.length>0&&l.loadSheet(0),$&&(e.selection.value=$),e.activeCell.value=z,u()},{deep:!0}),t.onBeforeUnmount(()=>{gt==null||gt.disconnect()})}return{scheduleRender:u,render:x,activeCellLabel:S,formulaBarDisplay:B,formulaBarDraft:w,formulaBarExpanded:R,onFormulaBarFocus:le,onFormulaBarInput:ne,onFormulaBarKeydown:Z,onFormulaBarBlur:J,acceptFormulaBarEdit:P,cancelFormulaBarEdit:oe,renTab:q,renTabVal:ue,onTabClick:Fe,onTabDblClick:Oe,commitTabRename:Je,cclTabRename:Ge,onTabRenameKd:je,ctxMenu:se,ctxSubmenuLeft:i,onCtxItemEnter:m,onTabCtxMenu:fe,onTabBarCtx:De,onCornerCtx:f,onRowHdrCtx:y,onColHdrCtx:T,onCellCtx:A,dimInputRef:a,dimPanel:h,openDimPanel:W,onDimInput:Y,onDimKeydown:Me,onDimBlur:Ve,applyDimPanel:Ke,closeDimPanel:Be,editInputStyle:M,hScrollbarW:ce,vScrollbarH:ee,hTrackW:ae,vTrackH:X,hThumbW:U,hThumbL:ye,vThumbH:Ee,vThumbT:Ze,onVStart:I,onHStart:Q,onSbMove:ie,onSbUp:ke,onVTrk:Ne,onHTrk:ze,onMouseDown:li,onMouseMove:oi,onMouseUp:ni,onMouseLeave:ri,onCanvasCtx:ai,onDblClick:ii,onWheel:ci,onTouchStart:si,onTouchMove:di,onTouchEnd:ui,onKeydown:to,onEditInput:fi,onEditCompositionStart:mi,onEditCompositionEnd:pi,onEditKd:gi,onEditPaste:hi,onEditBlur:Ci,applySize:qt,setupLifecycle:bi}}function Fa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Zl(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 Oa(e,n,o,l){if(!n)return e;if(l){const d=e.indexOf(n);return d<0?e:e.slice(0,d)+o+e.slice(d+n.length)}const c=e.toLowerCase().indexOf(n.toLowerCase());return c<0?e:e.slice(0,c)+o+e.slice(c+n.length)}function La(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(Fa(n),"gi"),()=>o):e}function Rl(e,n,o,l,c,d,r){const v=[];if(r){for(let u=r.startRow;u<=r.endRow;u++)for(let k=r.startCol;k<=r.endCol;k++){const x=e[o(k,u)];x&&Zl(x.value,l,c,d)&&v.push({sheetIndex:n,col:k,row:u})}return v}for(const u in e){const k=e[u];if(k&&Zl(k.value,l,c,d)){const x=u.split(","),S=Number(x[0]),w=Number(x[1]);!Number.isNaN(S)&&!Number.isNaN(w)&&v.push({sheetIndex:n,col:S,row:w})}}return v}function Ia(e,n,o,l){const c=t.ref(!1),d=t.ref(""),r=t.ref(""),v=t.ref("sheet"),u=t.ref(!1),k=t.ref(!1),x=t.ref(-1),S=t.ref([]),w=t.ref(""),R=t.ref(0),B=t.ref(""),le=t.computed(()=>{const i=new Set,m=o.activeSheetIndex.value;for(const fe of S.value)fe.sheetIndex===m&&i.add(`${fe.col},${fe.row}`);return i}),ne=t.computed(()=>{if(x.value<0||x.value>=S.value.length)return null;const i=S.value[x.value];return i.sheetIndex!==o.activeSheetIndex.value?null:`${i.col},${i.row}`});e.findHighlight=(i,m)=>{const fe=`${i},${m}`;return ne.value===fe?"active":le.value.has(fe)?"match":null};function p(i){var De,f;const m=e.cellKey(i.col,i.row);if(i.sheetIndex===o.activeSheetIndex.value)return((De=e.cells[m])==null?void 0:De.value)??"";const fe=o.sheets.value[i.sheetIndex];return((f=fe==null?void 0:fe.cells[m])==null?void 0:f.value)??""}function V(i,m){const fe=e.cellKey(i.col,i.row);if(i.sheetIndex===o.activeSheetIndex.value)e.setCellValue(i.col,i.row,m);else{const De=o.sheets.value[i.sheetIndex];if(!De)return;const f=De.cells[fe];De.cells[fe]={value:String(m),style:(f==null?void 0:f.style)??null}}}function P(){if(B.value){w.value=B.value;return}if(!d.value){w.value="";return}if(v.value==="selection"&&!e.selection.value){w.value=N(e.locale.value,"findNeedSelection");return}if(S.value.length===0){w.value=N(e.locale.value,"findNoResult");return}w.value=""}function oe(){const i=d.value,m=[];if(i)if(v.value==="workbook")o.sheets.value.forEach((fe,De)=>{m.push(...Rl(fe.cells,De,e.cellKey,i,u.value,k.value))});else if(v.value==="selection"){const fe=e.selection.value;fe&&m.push(...Rl(e.cells,o.activeSheetIndex.value,e.cellKey,i,u.value,k.value,fe))}else m.push(...Rl(e.cells,o.activeSheetIndex.value,e.cellKey,i,u.value,k.value));S.value=m,m.length===0?x.value=-1:x.value>=m.length?x.value=m.length-1:x.value<0&&(x.value=0),P()}function Z(){if(x.value<0||x.value>=S.value.length)return;const i=S.value[x.value];i.sheetIndex!==o.activeSheetIndex.value&&o.switchSheet(i.sheetIndex),v.value==="selection"?e.activeCell.value={col:i.col,row:i.row}:e.selectCell(i.col,i.row),e.ensureVisible(i.col,i.row)}const J=typeof requestAnimationFrame=="function"?requestAnimationFrame:i=>setTimeout(i,16);let q=!1,ue=!1;function Fe(i){if(q){ue=ue||i;return}q=!0,ue=i,J(()=>{var m;q=!1,oe(),ue&&S.value.length>0&&x.value>=0&&Z(),ue=!1,(m=e.scheduleRender)==null||m.call(e)})}function Oe(){var i;c.value=!0,R.value++,oe(),S.value.length>0&&(x.value=0,Z()),(i=e.scheduleRender)==null||i.call(e)}function Je(){Oe()}function Ge(){var i;c.value=!1,S.value=[],x.value=-1,B.value="",w.value="",(i=e.scheduleRender)==null||i.call(e)}function je(){var i;S.value.length!==0&&(x.value=(x.value+1)%S.value.length,Z(),(i=e.scheduleRender)==null||i.call(e))}function se(){var i;S.value.length!==0&&(x.value=(x.value-1+S.value.length)%S.value.length,Z(),(i=e.scheduleRender)==null||i.call(e))}function de(){var f,y;if(x.value<0||x.value>=S.value.length)return;const i=S.value[x.value],m=p(i),fe=Oa(m,d.value,r.value,u.value);if(fe===m)return;n.saveUndo(),V(i,fe);const De=x.value;oe(),S.value.length>0?(x.value=Math.min(De,S.value.length-1),je()):x.value=-1,(f=e.emitModelData)==null||f.call(e),(y=e.scheduleRender)==null||y.call(e)}function Te(){var De,f;const i=d.value;if(!i||S.value.length===0)return;n.saveUndo();let m=0;const fe=S.value.slice();for(const y of fe){const T=p(y),A=La(T,i,r.value,u.value);A!==T&&(V(y,A),m++)}S.value=[],x.value=-1,B.value=N(e.locale.value,"findReplacedAll").replace("{n}",String(m)),P(),(De=e.emitModelData)==null||De.call(e),(f=e.scheduleRender)==null||f.call(e)}function re(){const i=m=>{if(!(m.ctrlKey||m.metaKey))return;const De=m.key.toLowerCase();(De==="f"||De==="h")&&(m.preventDefault(),Oe())};window.addEventListener("keydown",i),t.onBeforeUnmount(()=>window.removeEventListener("keydown",i))}return t.watch(d,()=>{c.value&&(B.value="",x.value=0,Fe(!0))}),t.watch([v,u,k],()=>{c.value&&(B.value="",x.value=0,Fe(!0))}),t.watch(e.cells,()=>{c.value&&Fe(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{c.value&&v.value==="selection"&&(x.value=0,Fe(!0))}),t.watch([()=>n.undoStack.value.length,()=>n.redoStack.value.length],()=>{c.value&&Fe(!1)}),{open:c,findText:d,replaceText:r,scope:v,matchCase:u,matchEntireCell:k,currentIndex:x,results:S,message:w,focusToken:R,activeSheetMatches:le,activeMatchKey:ne,openFind:Oe,openReplace:Je,close:Ge,recompute:oe,findNext:je,findPrev:se,replace:de,replaceAll:Te,setupLifecycle:re}}const $a={class:"formula-bar__cell-label"},za={class:"formula-bar__buttons"},Wa=["rows","value"],_a=["title"],Ka={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Ua={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Ga=["value"],Pa={key:2,class:"sb-corner"},Ya=["onClick","onMouseenter"],Xa={class:"context-menu__label"},ja={key:0,class:"context-menu__arrow"},Za=["onClick"],qa={class:"dim-panel__title"},Ja={class:"dim-panel__body"},Qa=["value"],ei={key:0,class:"dim-panel__error"},ti={class:"dim-panel__footer"},ql=vt(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:""},c=Sa(n,{rowCount:n.rowCount,colCount:n.colCount,theme:n.theme,locale:n.locale}),d={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:re=>{},mkSheet:re=>({id:"",name:re,cells:{},merges:{},selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[]})},r=Ta(c,d),v=Na(c,r);Da(r,{borderMenuOpen:v.borderMenuOpen,mergeMenuOpen:v.mergeMenuOpen});const u=Ha(c,r,o,void 0,l);d.sheets=u.sheets,d.activeSheetIndex=u.activeSheetIndex,d.saveSheet=u.saveSheet,d.loadSheet=u.loadSheet,d.mkSheet=u.mkSheet;const k=Va(c,r,v,u,l);k.setupLifecycle();const x=Ia(c,r,u);x.setupLifecycle();const S=t.reactive(c),w=t.reactive(r),R=t.reactive(v),B=t.reactive(u),le=u.sheets,ne=u.activeSheetIndex,p=t.reactive(k),V=t.reactive(x),P=t.computed(()=>{const re=S.selection;return!!re&&re.startCol===re.endCol&&re.startRow===re.endRow}),oe=t.computed(()=>{var fe;const re=w.selNumberFormat;if(re!==nl)return re;const i=S.activeCell,m=(fe=S.cells[S.cellKey(i.col,i.row)])==null?void 0:fe.style;return typeof(m==null?void 0:m.numberFormat)=="string"?m.numberFormat:""});function Z(re){r.nfDialogOpen.value=re}function J(re){r.fontSizeMenuOpen.value=re}function q(re){r.textColorMenuOpen.value=re}function ue(re){r.fillColorMenuOpen.value=re}function Fe(re){k.renTabVal.value=re}function Oe(){k.ctxMenu.value=null}const Je=re=>{u.formulaBarRef.value=re};function Ge(){k.formulaBarExpanded.value=!k.formulaBarExpanded.value}const je=re=>{u.wrapperRef.value=re},se=re=>{u.canvasRef.value=re},de=re=>{u.editInputRef.value=re},Te=re=>{k.dimInputRef.value=re};return(re,i)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(B.outerStyle)},[t.createVNode(hr,{locale:S.locale,"can-undo":w.canUndo,"can-redo":w.canRedo,"paint-fmt-active":w.paintFmt!==null,"has-selection":w.hasSelection,"font-family-options":w.fontFamilyOptions,"font-size-options":w.fontSizeOptions,"sel-font-family":w.selFontFamily,"sel-font-size":w.selFontSize,"font-size-input":w.fontSizeInput,"font-size-menu-open":w.fontSizeMenuOpen,"sel-font-weight":w.selFontWeight,"sel-font-style":w.selFontStyle,"sel-underline":w.selUnderline,"sel-strikethrough":w.selStrikethrough,"sel-text-color":w.selTextColor,"text-color-menu-open":w.textColorMenuOpen,"sel-fill-color":w.selFillColor,"fill-color-menu-open":w.fillColorMenuOpen,"cached-text-color":w.cachedTextColor,"cached-fill-color":w.cachedFillColor,"border-menu-open":R.borderMenuOpen,"cached-border":R.cachedBorder,"h-align-options":w.hAlignOptions,"v-align-options":w.vAlignOptions,"sel-h-align":w.selHAlign,"sel-v-align":w.selVAlign,"sel-wrap":w.selWrap,"merge-menu-open":R.mergeMenuOpen,"calc-menu-open":R.calcMenuOpen,"is-single-cell":P.value,"sel-number-format":w.selNumberFormat,"nf-options":w.nfOptions,"theme-vars":B.toolbarThemeVars,onUndo:i[0]||(i[0]=m=>w.undo()),onRedo:i[1]||(i[1]=m=>w.redo()),onPaintFormat:w.onPaintFormat,onClearFormat:i[2]||(i[2]=m=>w.clearFormat()),onNumberFormatChange:i[3]||(i[3]=m=>w.onNumberFormatChange(m)),onFontFamilyChange:i[4]||(i[4]=m=>w.onFontFamilyChange(m)),onFontSizeInput:i[5]||(i[5]=m=>w.onFontSizeInput(m)),onFontSizeBlur:w.onFontSizeBlur,onFontSizeKeydown:i[6]||(i[6]=m=>w.onFontSizeKeydown(m)),onFontSizeChange:i[7]||(i[7]=m=>w.onFontSizeChange(m)),"onUpdate:fontSizeMenuOpen":i[8]||(i[8]=m=>J(m)),onFontSizeToggle:i[9]||(i[9]=m=>w.toggleFontSizeMenu()),onFontSizeStepUp:w.onFontSizeStepUp,onFontSizeStepDown:w.onFontSizeStepDown,onBoldToggle:w.toggleFontWeight,onItalicToggle:w.toggleFontStyle,onUnderlineToggle:w.toggleUnderline,onStrikethroughToggle:w.toggleStrikethrough,onTextColorChange:i[10]||(i[10]=m=>w.onTextColorChange(m)),"onUpdate:textColorMenuOpen":i[11]||(i[11]=m=>q(m)),onFillColorChange:i[12]||(i[12]=m=>w.onFillColorChange(m)),"onUpdate:fillColorMenuOpen":i[13]||(i[13]=m=>ue(m)),onApplyTextColor:w.applyCachedTextColor,onApplyFillColor:w.applyCachedFillColor,"onUpdate:borderMenuOpen":i[14]||(i[14]=m=>w.onBorderMenuToggle(m)),onBorderChange:i[15]||(i[15]=m=>R.onBorderChange(m)),onApplyBorder:R.applyCachedBorder,onHAlignChange:i[16]||(i[16]=m=>w.onHAlignChange(m)),onVAlignChange:i[17]||(i[17]=m=>w.onVAlignChange(m)),onWrapToggle:w.onWrapToggle,"onUpdate:mergeMenuOpen":i[18]||(i[18]=m=>R.onMergeMenuToggle(m)),onMergeChange:i[19]||(i[19]=m=>R.onMergeChange(m)),onApplyMerge:R.onApplyMerge,"onUpdate:calcMenuOpen":i[20]||(i[20]=m=>R.onCalcMenuToggle(m)),onCalcSum:R.onCalcSum,onCalcAvg:R.onCalcAvg,onCalcCount:R.onCalcCount,onFind:i[21]||(i[21]=m=>t.unref(x).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","theme-vars","onPaintFormat","onFontSizeBlur","onFontSizeStepUp","onFontSizeStepDown","onBoldToggle","onItalicToggle","onUnderlineToggle","onStrikethroughToggle","onApplyTextColor","onApplyFillColor","onApplyBorder","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg","onCalcCount"]),t.createVNode($r,{open:V.open,"find-text":V.findText,"replace-text":V.replaceText,scope:V.scope,"match-case":V.matchCase,"match-entire-cell":V.matchEntireCell,"current-index":V.currentIndex,total:V.results.length,message:V.message,"focus-token":V.focusToken,locale:S.locale,"theme-vars":B.toolbarThemeVars,"onUpdate:findText":i[22]||(i[22]=m=>t.unref(x).findText.value=m),"onUpdate:replaceText":i[23]||(i[23]=m=>t.unref(x).replaceText.value=m),"onUpdate:scope":i[24]||(i[24]=m=>t.unref(x).scope.value=m),"onUpdate:matchCase":i[25]||(i[25]=m=>t.unref(x).matchCase.value=m),"onUpdate:matchEntireCell":i[26]||(i[26]=m=>t.unref(x).matchEntireCell.value=m),onPrev:i[27]||(i[27]=m=>t.unref(x).findPrev()),onNext:i[28]||(i[28]=m=>t.unref(x).findNext()),onReplace:i[29]||(i[29]=m=>t.unref(x).replace()),onReplaceAll:i[30]||(i[30]=m=>t.unref(x).replaceAll()),onClose:i[31]||(i[31]=m=>t.unref(x).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(ba,{"model-open":w.nfDialogOpen,locale:S.locale,"current-format":oe.value,"onUpdate:modelOpen":i[32]||(i[32]=m=>Z(m)),onApply:i[33]||(i[33]=m=>w.applyNumberFormatCode(m))},null,8,["model-open","locale","current-format"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":p.formulaBarExpanded}])},[t.createElementVNode("div",$a,t.toDisplayString(p.activeCellLabel),1),t.createElementVNode("div",za,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:i[34]||(i[34]=t.withModifiers(()=>{},["prevent"])),onClick:i[35]||(i[35]=t.withModifiers((...m)=>p.cancelFormulaBarEdit&&p.cancelFormulaBarEdit(...m),["stop"]))},[...i[84]||(i[84]=[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:i[36]||(i[36]=t.withModifiers(()=>{},["prevent"])),onClick:i[37]||(i[37]=t.withModifiers((...m)=>p.acceptFormulaBarEdit&&p.acceptFormulaBarEdit(...m),["stop"]))},[...i[85]||(i[85]=[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:Je,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":p.formulaBarExpanded}]),rows:p.formulaBarExpanded?3:1,value:p.formulaBarDisplay,spellcheck:"false",onFocus:i[38]||(i[38]=(...m)=>p.onFormulaBarFocus&&p.onFormulaBarFocus(...m)),onInput:i[39]||(i[39]=(...m)=>p.onFormulaBarInput&&p.onFormulaBarInput(...m)),onKeydown:i[40]||(i[40]=(...m)=>p.onFormulaBarKeydown&&p.onFormulaBarKeydown(...m)),onBlur:i[41]||(i[41]=(...m)=>p.onFormulaBarBlur&&p.onFormulaBarBlur(...m))},null,42,Wa),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:p.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:i[42]||(i[42]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(Ge,["stop"])},[p.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",Ua,[...i[87]||(i[87]=[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",Ka,[...i[86]||(i[86]=[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,_a)],2),t.createElementVNode("div",{ref:je,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:se,class:"grid-canvas",tabindex:"0",onMousedown:i[43]||(i[43]=(...m)=>p.onMouseDown&&p.onMouseDown(...m)),onMousemove:i[44]||(i[44]=(...m)=>p.onMouseMove&&p.onMouseMove(...m)),onMouseup:i[45]||(i[45]=(...m)=>p.onMouseUp&&p.onMouseUp(...m)),onMouseleave:i[46]||(i[46]=(...m)=>p.onMouseLeave&&p.onMouseLeave(...m)),onDblclick:i[47]||(i[47]=(...m)=>p.onDblClick&&p.onDblClick(...m)),onWheel:i[48]||(i[48]=t.withModifiers((...m)=>p.onWheel&&p.onWheel(...m),["prevent"])),onFocus:i[49]||(i[49]=(...m)=>B.onCanvasFocus&&B.onCanvasFocus(...m)),onKeydown:i[50]||(i[50]=(...m)=>p.onKeydown&&p.onKeydown(...m)),onContextmenu:i[51]||(i[51]=(...m)=>p.onCanvasCtx&&p.onCanvasCtx(...m)),onTouchstart:i[52]||(i[52]=t.withModifiers((...m)=>p.onTouchStart&&p.onTouchStart(...m),["prevent"])),onTouchmove:i[53]||(i[53]=t.withModifiers((...m)=>p.onTouchMove&&p.onTouchMove(...m),["prevent"])),onTouchend:i[54]||(i[54]=(...m)=>p.onTouchEnd&&p.onTouchEnd(...m))},null,32),t.createElementVNode("textarea",{ref:de,class:"cell-editor",value:S.editValue,style:t.normalizeStyle(p.editInputStyle),onInput:i[55]||(i[55]=(...m)=>p.onEditInput&&p.onEditInput(...m)),onKeydown:i[56]||(i[56]=(...m)=>p.onEditKd&&p.onEditKd(...m)),onCompositionstart:i[57]||(i[57]=(...m)=>p.onEditCompositionStart&&p.onEditCompositionStart(...m)),onCompositionend:i[58]||(i[58]=(...m)=>p.onEditCompositionEnd&&p.onEditCompositionEnd(...m)),onBlur:i[59]||(i[59]=(...m)=>p.onEditBlur&&p.onEditBlur(...m)),onPaste:i[60]||(i[60]=(...m)=>p.onEditPaste&&p.onEditPaste(...m))},null,44,Ga),B.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:i[61]||(i[61]=t.withModifiers(m=>{B.clampScroll(null,S.scrollY-50),p.scheduleRender()},["prevent"]))},[...i[88]||(i[88]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:i[63]||(i[63]=(...m)=>p.onVTrk&&p.onVTrk(...m))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:p.vThumbT+"px",height:p.vThumbH+"px"}),onMousedown:i[62]||(i[62]=(...m)=>p.onVStart&&p.onVStart(...m))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:i[64]||(i[64]=t.withModifiers(m=>{B.clampScroll(null,S.scrollY+50),p.scheduleRender()},["prevent"]))},[...i[89]||(i[89]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),B.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:i[65]||(i[65]=t.withModifiers(m=>{B.clampScroll(S.scrollX-50,null),p.scheduleRender()},["prevent"]))},[...i[90]||(i[90]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:i[67]||(i[67]=(...m)=>p.onHTrk&&p.onHTrk(...m))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:p.hThumbL+"px",width:p.hThumbW+"px"}),onMousedown:i[66]||(i[66]=(...m)=>p.onHStart&&p.onHStart(...m))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:i[68]||(i[68]=t.withModifiers(m=>{B.clampScroll(S.scrollX+50,null),p.scheduleRender()},["prevent"]))},[...i[91]||(i[91]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),B.maxScrollX>0&&B.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",Pa)):t.createCommentVNode("",!0)]),t.createVNode(kr,{locale:S.locale,sheets:t.unref(le),"active-sheet-index":t.unref(ne),"ren-tab":p.renTab,"ren-tab-val":p.renTabVal,onTabClick:i[69]||(i[69]=m=>p.onTabClick(m)),onTabDblclick:i[70]||(i[70]=m=>p.onTabDblClick(m)),onTabContextmenu:i[71]||(i[71]=m=>p.onTabCtxMenu(m.ev,m.i)),onTabRenameInput:i[72]||(i[72]=m=>Fe(m)),onTabRenameKeydown:i[73]||(i[73]=m=>p.onTabRenameKd(m)),onTabRenameCommit:p.commitTabRename,onTabbarContextmenu:i[74]||(i[74]=m=>p.onTabBarCtx(m)),onAddSheet:i[75]||(i[75]=m=>{B.addSheet(),p.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(()=>[p.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:p.ctxMenu.x+"px",top:p.ctxMenu.y+"px"}),onClick:i[76]||(i[76]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.ctxMenu.items,(m,fe)=>(t.openBlock(),t.createElementBlock("div",{key:fe,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":m.disabled}]),onClick:De=>!m.disabled&&m.action&&(m.action(),Oe()),onMouseenter:De=>p.onCtxItemEnter(De,m)},[t.createElementVNode("span",Xa,t.toDisplayString(m.label),1),m.children?(t.openBlock(),t.createElementBlock("span",ja)):t.createCommentVNode("",!0),m.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":p.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.children,(De,f)=>(t.openBlock(),t.createElementBlock("div",{key:f,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":De.disabled}]),onClick:t.withModifiers(y=>!De.disabled&&De.action&&(De.action(),Oe()),["stop"])},t.toDisplayString(De.label),11,Za))),128))],2)):t.createCommentVNode("",!0)],42,Ya))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[p.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:p.dimPanel.x+"px",top:p.dimPanel.y+"px"}),onMousedown:i[82]||(i[82]=t.withModifiers(()=>{},["stop"])),onClick:i[83]||(i[83]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",qa,t.toDisplayString(p.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",Ja,[t.createElementVNode("input",{ref:Te,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":p.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:p.dimPanel.value,onInput:i[77]||(i[77]=(...m)=>p.onDimInput&&p.onDimInput(...m)),onKeydown:i[78]||(i[78]=(...m)=>p.onDimKeydown&&p.onDimKeydown(...m)),onBlur:i[79]||(i[79]=(...m)=>p.onDimBlur&&p.onDimBlur(...m))},null,42,Qa),i[92]||(i[92]=t.createElementVNode("span",{class:"dim-panel__unit"},"px",-1))]),p.dimPanel.error?(t.openBlock(),t.createElementBlock("div",ei,t.toDisplayString(p.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",ti,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:i[80]||(i[80]=(...m)=>p.applyDimPanel&&p.applyDimPanel(...m))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:i[81]||(i[81]=(...m)=>p.closeDimPanel&&p.closeDimPanel(...m))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-daa631b0"]]);Dt.Spreader=ql,Dt.default=ql,Object.defineProperties(Dt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});