xiaodao-spreader 0.1.11 → 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.
- package/README.ZH.md +48 -6
- package/README.md +48 -6
- package/dist/style.css +1 -1
- package/dist/types/components/spreader/components/find-replace-bar.vue.d.ts +25 -0
- package/dist/types/components/spreader/components/pickers/calcPicker.vue.d.ts +1 -1
- package/dist/types/components/spreader/components/toolbar.vue.d.ts +4 -0
- package/dist/types/components/spreader/composables/borders-merge.d.ts +2 -0
- package/dist/types/components/spreader/composables/core-state.d.ts +2 -0
- package/dist/types/components/spreader/composables/find-replace.d.ts +32 -0
- package/dist/types/components/spreader/core/find-replace-core.d.ts +23 -0
- package/dist/types/components/spreader/core/formula.d.ts +13 -4
- package/dist/types/components/spreader/core/types.d.ts +10 -0
- package/dist/xiaodao-spreader.es.js +4366 -3546
- package/dist/xiaodao-spreader.umd.js +9 -9
- package/package.json +3 -2
|
@@ -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 eo={"zh-CN":{insert:"插入",delete:"删除",rename:"重命名",moveLeft:"左移",moveRight:"右移",cut:"剪切",copy:"复制",paste:"粘贴",addSheet:"新建工作表",moveSheetLeft:"左移",moveSheetRight:"右移",scrollUp:"向上滚动",scrollDown:"向下滚动",scrollLeft:"向左滚动",scrollRight:"向右滚动",calculate:"计算",sum:"求和",avg:"平均值",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",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 A(e,n){var a;return((a=eo[e])==null?void 0:a[n])??n}const Ut='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',wt=10,to=[{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'}],lo=[{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}],oo='<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>',no='<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>',ro='<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>',ao='<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>',io='<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>',co='<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>',so=[{value:"left",labelKey:"alignLeft",icon:oo},{value:"center",labelKey:"alignCenter",icon:no},{value:"right",labelKey:"alignRight",icon:ro}],uo=[{value:"top",labelKey:"alignTop",icon:ao},{value:"middle",labelKey:"alignMiddle",icon:io},{value:"bottom",labelKey:"alignBottom",icon:co}],Bl=[{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>'}],fo={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"},mo={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"},Ml="__nf_custom__",tl="",ll="",Ht="@",fl="__NF_INVALID__",xl=2958465,Sl=0;function Pt(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function Dl(e){return e==="zh-CN"?"¥":"$"}function po(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Tl(e){return e.replace(/"([^"]*)"/g,"$1")}function go(e){let n=e,a;const l=n.match(/^\[([^\]]+)\]/);l&&(a=l[1].toLowerCase(),n=n.slice(l[0].length)),n=po(n);const d=/E[+-]/i.test(n),f=n.includes("%"),r=n.search(/[0#?]/);if(r===-1)return{hasDigits:!1,decimals:0,minDecimals:0,minIntDigits:0,thousands:!1,scale:f?100:1,scientific:!1,prefix:n,suffix:"",color:a};let k=-1;for(let Q=n.length-1;Q>=0;Q--){const q=n[Q];if(q==="0"||q==="#"||q==="?"||q==="E"){k=Q;break}}k<0&&(k=r);const C=r>0?n.slice(0,r):"",W=k<n.length-1?n.slice(k+1):"",$=n.slice(r,k+1),w=/[0#?]/.test($),O=$.includes(",");let z=$.replace(/,/g,"");if(d){const Q=z.search(/E/i);Q>=0&&(z=z.slice(0,Q))}const ce=z.indexOf("."),b=ce>=0?z.slice(0,ce):z,Z=ce>=0?z.slice(ce+1):"",I=(Z.match(/[0#?]/g)||[]).length,j=(Z.match(/0/g)||[]).length,se=(b.match(/0/g)||[]).length;return{hasDigits:w,decimals:I,minDecimals:j,minIntDigits:se,thousands:O,scale:f?100:1,scientific:d,prefix:C,suffix:W,color:a}}function ho(e){const n=[];let a=!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 d;for(;(d=l.exec(e))!==null;){const f=d[0];switch(f){case"[h]":a=!0,n.push({type:"hour",len:0});break;case"[mm]":a=!0,n.push({type:"minute",len:2});break;case"[ss]":a=!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:f.startsWith('"')?n.push({type:"literal",text:Tl(f),len:0}):n.push({type:"literal",text:f,len:0})}}return{tokens:n,isDuration:a}}const Nl=new Map;function Co(e){if(/[ydhs]/.test(e)||/AM\/PM/i.test(e)||/\[h\]/i.test(e)){const d=e.split(";")[0]??e,{tokens:f,isDuration:r}=ho(d);return{kind:r?"duration":"date",sections:[],tokens:f,isDuration:r,raw:e}}return{kind:"number",sections:e.split(";").map(d=>go(d)),tokens:[],isDuration:!1,raw:e}}function ol(e){const n=Nl.get(e);if(n)return n;const a=Co(e);return Nl.set(e,a),a}function Hl(e,n,a,l,d){const f=Math.pow(10,n),r=Math.round((e+Number.EPSILON)*f)/f,k=r<0,C=Math.abs(r);let $=new Intl.NumberFormat("en-US",{useGrouping:l,minimumIntegerDigits:d,minimumFractionDigits:n,maximumFractionDigits:n}).format(C);if(a<n&&n>0){const O=$.indexOf(".");if(O>=0){const H=$.substring(0,O);let z=$.substring(O+1);z=z.replace(/0+$/,""),z.length<a&&(z=z+"0".repeat(a-z.length)),$=z?`${H}.${z}`:H}}return`${k?"-":""}${$}`}function Al(e,n){if(e===0)return(n>0?"0."+"0".repeat(n):"0")+"E+00";const a=Math.floor(Math.log10(Math.abs(e))),l=e/Math.pow(10,a),d=Hl(l,n,n,!1,1),f=(a>=0?"+":"-")+String(Math.abs(a)).padStart(2,"0");return`${d}E${f}`}function bo(e,n,a){if(!a.hasDigits)return Tl(a.prefix+a.suffix);const l=a.scale===100?e*100:e,d=a.scientific?Al(l,a.decimals):Hl(l,a.decimals,a.minDecimals,a.thousands,a.minIntDigits);return n+a.prefix+d+a.suffix}function yo(e,n){const a=n.sections;if(a.length===0)return String(e);let l,d,f="";return e>0?(l=a[0],d=e):e<0?a[1]?(l=a[1],d=-e):(l=a[0],d=-e,f="-"):(l=a[2]??a[0],d=0),bo(d,f,l)}function vo(e){return new Date((e-25569)*864e5)}const wo=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],ko=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Fl=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],Eo=["January","February","March","April","May","June","July","August","September","October","November","December"],Ro=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Vl=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function zt(e,n){return String(e).padStart(n,"0")}function Bo(e,n,a,l){const d=e.getUTCFullYear(),f=e.getUTCMonth()+1,r=e.getUTCDate(),k=e.getUTCDay(),C=a==="zh-CN";let W="",$=!1;for(const w of n)switch(w.type){case"literal":W+=w.text??"";break;case"year":W+=w.len>=4?String(d):String(d%100).padStart(2,"0");break;case"month":W+=zt($?e.getUTCMinutes():f,w.len);break;case"monthName":W+=w.len>=4?C?wo[f-1]:Eo[f-1]:C?ko[f-1]:Ro[f-1];break;case"day":W+=zt(r,w.len);break;case"weekday":W+=w.len>=4?C?Fl[k]:Vl[k]:C?Fl[k].slice(2):Vl[k].slice(0,3);break;case"hour":{let O=e.getUTCHours();if(w.len===0){const H=Math.floor(l*86400);O=Math.floor(H/3600)}W+=String(O),$=!0;break}case"minute":W+=zt(e.getUTCMinutes(),w.len);break;case"second":W+=zt(e.getUTCSeconds(),w.len);break;case"ampm":{const O=e.getUTCHours();W+=O<12?C?"上午":"AM":C?"下午":"PM";break}}return W}function Mo(e,n){const a=Math.floor(e*86400),l=Math.floor(a/3600),d=Math.floor(a%3600/60),f=a%60;let r="";for(const k of n)switch(k.type){case"literal":r+=k.text??"";break;case"hour":r+=String(l);break;case"minute":r+=zt(d,k.len||2);break;case"second":r+=zt(f,k.len||2);break;default:r+=""}return r}function xo(e){if(e==="")return e;const n=Number(e);if(!isNaN(n)&&e.trim()!==""){const a=Math.abs(n);return a!==0&&(a>=1e15||a<1e-9)?Al(n,9):e}return e}function ml(e,n,a){if(Pt(n))return xo(e);if(n==null||n===Ht)return e;const l=ol(n);if(l.kind==="date"||l.kind==="duration"){const f=Number(e);if(!isFinite(f))return e;if(l.kind==="date"){if(f<Sl||f>xl)return fl}else if(f<0)return fl;return l.kind==="duration"?Mo(f,l.tokens):Bo(vo(f),l.tokens,a,f)}const d=Number(e);return isNaN(d)?e:yo(d,l)}const So=["general","number","currency","currencyRounded","accounting","financial","percent","scientific","date","time","dateTime","duration","text","custom"];function Ol(e,n){if(n===Ht||n==="@")return!1;if(Pt(n)){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}const a=ol(n);return!!(a.kind==="number"&&Ll(a))}function Ll(e){return e.sections.some(n=>n.hasDigits)}function Do(e){if(e==null||Pt(e)||e===Ht||e==="@")return!1;const n=ol(e);return!!(n.kind==="date"||n.kind==="duration"||n.kind==="number"&&Ll(n))}function To(e,n){if(n==null||Pt(n)||n===Ht||n==="@")return!1;const a=ol(n),l=Number(e);return Number.isFinite(l)?a.kind==="date"?l<Sl||l>xl:a.kind==="duration"?l<0:!1:!1}function No(e,n,a,l){const d=Dl(e),f=l?"#,##0":"0",r=a>0?"."+"0".repeat(a):"",k=f+r;switch(n){case"general":return"";case"text":return Ht;case"custom":return"";case"number":return k;case"percent":return k+"%";case"scientific":return"0."+"0".repeat(a)+"E+00";case"currency":return d+k;case"currencyRounded":return d+(l?"#,##0":"0");case"accounting":return`${d}${k};(${d}${k});${d}"-"`;case"financial":return`${k};[Red](${k})`;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 Ho(e){const n=Dl(e);return[{label:A(e,"nfGeneral"),value:ll},{label:A(e,"nfText"),value:Ht},{label:A(e,"nfNumber"),value:"#,##0.00"},{label:A(e,"nfPercent"),value:"0.00%"},{label:A(e,"nfScientific"),value:"0.00E+00"},{label:A(e,"nfAccounting"),value:`${n}#,##0.00;(${n}#,##0.00);${n}"-"`},{label:A(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:A(e,"nfCurrency"),value:n+"#,##0.00"},{label:A(e,"nfCurrencyRounded"),value:n+"#,##0"},{label:A(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:A(e,"nfTime"),value:"h:mm:ss"},{label:A(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:A(e,"nfDuration"),value:"[h]:mm:ss"},{label:A(e,"nfCustom"),value:Ml}]}const Ao=["title"],Fo=["innerHTML"],Vo={key:1,class:"sp-dropdown__value"},Oo=["disabled"],Lo=["onClick"],Io=["innerHTML"],Wo={class:"sp-dropdown__item-label"},zo=["disabled"],_o=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 a=e,l=n,d=t.ref(!1),f=t.ref(0),r=t.ref(null),k=t.ref(null),C=t.ref(null),W=t.ref({top:0,up:!1}),$=t.ref(0),w=t.ref(!1),O=t.computed(()=>a.options.find(ue=>String(ue.value)===String(a.modelValue))),H=t.computed(()=>a.menuWidth),z=t.computed(()=>Math.min(a.visibleCount,a.options.length)),ce=t.computed(()=>a.options.slice(f.value,f.value+z.value)),b=t.computed(()=>f.value>0),Z=t.computed(()=>f.value+z.value<a.options.length),I=t.computed(()=>a.options.length>z.value);function j(ue){f.value=Math.max(0,Math.min(a.options.length-z.value,f.value+ue))}function se(){d.value=!0,a.modelOpen!==void 0&&l("update:modelOpen",!0);const ue=a.triggerEl??r.value;if(!ue)return;const _=ue.getBoundingClientRect(),c=z.value*22+(I.value?2*15:0)+8,Te=window.innerHeight-_.bottom-4<c&&_.top-4>c;a.align==="right"?W.value={right:window.innerWidth-_.right,top:Te?_.top-c-4:_.bottom+4,up:Te}:W.value={left:_.left,top:Te?_.top-c-4:_.bottom+4,up:Te};const Fe=a.options.findIndex(s=>String(s.value)===String(a.modelValue));f.value=Fe>=0?Math.max(0,Math.min(Fe-Math.floor(z.value/2),a.options.length-z.value)):0}function Q(){d.value=!1,a.modelOpen!==void 0&&l("update:modelOpen",!1)}function q(){d.value?Q():se()}function ee(ue){l("update:modelValue",ue.value),l("change",ue.value),Q()}function he(ue){var c,h;if(!d.value)return;const _=ue.target;(c=r.value)!=null&&c.contains(_)||(h=C.value)!=null&&h.contains(_)||Q()}function ze(ue){d.value&&(ue.preventDefault(),j(ue.deltaY>0?1:-1))}t.watch(d,ue=>{t.nextTick(()=>{var _,c;ue?(_=k.value)==null||_.addEventListener("wheel",ze,{passive:!1}):(c=k.value)==null||c.removeEventListener("wheel",ze)})}),t.watch(()=>a.modelOpen,ue=>{ue!==void 0&&ue!==d.value&&(ue?se():Q())});function _e(ue){d.value&&($.value=ue.touches[0].clientY,w.value=!0)}function Qe(ue){if(!d.value||!w.value)return;const _=ue.touches[0].clientY-$.value;Math.abs(_)>5&&(j(_<0?1:-1),$.value=ue.touches[0].clientY)}function Ge(){w.value=!1}function Ze(ue){ue.key==="Escape"&&Q()}return t.onMounted(()=>{document.addEventListener("pointerdown",he),window.addEventListener("resize",Q),window.addEventListener("scroll",Q,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",he),window.removeEventListener("resize",Q),window.removeEventListener("scroll",Q,!0)}),(ue,_)=>{var c,h;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":d.value}]),title:e.title,onClick:q},[(c=O.value)!=null&&c.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:O.value.icon},null,8,Fo)):(t.openBlock(),t.createElementBlock("span",Vo,t.toDisplayString(((h=O.value)==null?void 0:h.label)??e.fallbackLabel),1)),_[2]||(_[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,Ao)),(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:C,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":W.value.up}]),style:t.normalizeStyle({left:W.value.left!==void 0?W.value.left+"px":void 0,right:W.value.right!==void 0?W.value.right+"px":void 0,top:W.value.top+"px",minWidth:H.value!==void 0?typeof H.value=="number"?H.value+"px":H.value:void 0}),onKeydown:Ze},[I.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!b.value}]),disabled:!b.value,onClick:_[0]||(_[0]=Te=>j(-1))},[..._[3]||(_[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,Oo)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:k,class:"sp-dropdown__list",onTouchstart:_e,onTouchmove:Qe,onTouchend:Ge},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ce.value,Te=>(t.openBlock(),t.createElementBlock("button",{key:String(Te.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(Te.value)===String(e.modelValue)}]),onClick:Fe=>ee(Te)},[Te.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:Te.icon},null,8,Io)):t.createCommentVNode("",!0),t.createElementVNode("span",Wo,t.toDisplayString(Te.label),1)],10,Lo))),128))],544),I.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!Z.value}]),disabled:!Z.value,onClick:_[1]||(_[1]=Te=>j(1))},[..._[4]||(_[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)}}}),kt=(e,n)=>{const a=e.__vccOpts||e;for(const[l,d]of n)a[l]=d;return a},Yt=kt(_o,[["__scopeId","data-v-77df3baf"]]),$o=["title","onClick"],Il=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:n,emit:a}){const l=e,d=a,f=[[{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"}]],k=t.computed(()=>l.colorKey==="fill"?r:f);function C(I){return A(l.locale,I)}function W(I){const j=l.currentColor;return!j&&!I?!0:j?j.toLowerCase()===I.toLowerCase():!1}const $=t.ref(!1),w=t.ref(null),O=t.ref(null),H=t.ref({top:0});t.watch(()=>l.modelOpen,I=>{I!==void 0&&I!==$.value&&(I?ce():b())});function z(I){const j=w.value,se=O.value,Q=I.target;j&&j.contains(Q)||se&&se.contains(Q)||b()}function ce(){$.value=!0,l.modelOpen!==void 0&&d("update:modelOpen",!0),t.nextTick(()=>{const I=l.triggerEl??w.value;if(I){const j=I.getBoundingClientRect(),se=150,Q=120;let q=window.innerWidth-j.right,ee=j.bottom+4,he;j.left-Q<4&&(q=void 0,he=Math.max(4,j.left)),ee+se>window.innerHeight-4&&(ee=j.top-se-4),ee<4&&(ee=4),H.value=q!==void 0?{right:q,top:ee}:{left:he,top:ee}}document.addEventListener("pointerdown",z)})}function b(){$.value=!1,l.modelOpen!==void 0&&d("update:modelOpen",!1),document.removeEventListener("pointerdown",z)}function Z(I){d("update:modelValue",I),d("change",I),b()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",z)}),n({open:$,openMenu:ce,close:b}),(I,j)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:w,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[$.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:O,class:"color-picker__menu",style:t.normalizeStyle({left:H.value.left!==void 0?H.value.left+"px":void 0,right:H.value.right!==void 0?H.value.right+"px":void 0,top:H.value.top+"px"}),onMousedown:j[0]||(j[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,(se,Q)=>(t.openBlock(),t.createElementBlock("div",{key:Q,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(se,q=>(t.openBlock(),t.createElementBlock("button",{key:q.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":W(q.value)}]),title:C(q.key),style:t.normalizeStyle({background:q.value||"transparent",border:q.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:ee=>Z(q.value)},null,14,$o))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f8fac424"]]),Go=["title","onClick"],Ko={viewBox:"0 0 30 30",class:"border-picker__icon"},Uo=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Po={class:"border-picker__label"},Yo=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:n,emit:a}){const l=e,d=a,f=[{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}],k={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 W(I,j){return C[I].includes(j)?"thick":k[I].includes(j)?"solid":"dashed"}const $=t.ref(!1),w=t.ref(null),O=t.ref(null),H=t.ref({top:0});t.watch(()=>l.modelOpen,I=>{I!==void 0&&I!==$.value&&(I?ce():b())});function z(I){const j=w.value,se=O.value,Q=I.target;j&&j.contains(Q)||se&&se.contains(Q)||b()}function ce(){$.value=!0,l.modelOpen!==void 0&&d("update:modelOpen",!0),t.nextTick(()=>{const I=l.triggerEl??w.value;if(I){const j=I.getBoundingClientRect(),se=200,Q=160;let q=window.innerWidth-j.right,ee=j.bottom+4,he;j.left-Q<4&&(q=void 0,he=Math.max(4,j.left)),ee+se>window.innerHeight-4&&(ee=j.top-se-4),ee<4&&(ee=4),H.value=q!==void 0?{right:q,top:ee}:{left:he,top:ee}}document.addEventListener("pointerdown",z)})}function b(){$.value=!1,l.modelOpen!==void 0&&d("update:modelOpen",!1),document.removeEventListener("pointerdown",z)}function Z(I){d("change",I),b()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",z)}),n({open:$,openMenu:ce,close:b}),(I,j)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:w,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[$.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:O,class:"border-picker__menu",style:t.normalizeStyle({left:H.value.left!==void 0?H.value.left+"px":void 0,right:H.value.right!==void 0?H.value.right+"px":void 0,top:H.value.top+"px"}),onMousedown:j[0]||(j[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(f,se=>t.createElementVNode("button",{key:se.key,class:"border-picker__item",title:t.unref(A)(e.locale,se.i18nKey),onClick:Q=>Z(se.key)},[(t.openBlock(),t.createElementBlock("svg",Ko,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,Q=>t.createElementVNode("line",{key:Q.name,x1:Q.x1,y1:Q.y1,x2:Q.x2,y2:Q.y2,stroke:"currentColor","stroke-width":W(se.key,Q.name)==="thick"?3:1.5,"stroke-dasharray":W(se.key,Q.name)==="dashed"?"0 4":"none","stroke-linecap":W(se.key,Q.name)==="dashed"?"round":"square"},null,8,Uo)),64))])),t.createElementVNode("span",Po,t.toDisplayString(t.unref(A)(e.locale,se.i18nKey)),1)],8,Go)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f362abdb"]]),Xo=["title","onClick"],jo=["innerHTML"],Zo={class:"merge-picker__label"},qo=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:n,emit:a}){const l=e,d=a,f=t.ref(!1),r=t.ref(null),k=t.ref(null),C=t.ref({top:0});t.watch(()=>l.modelOpen,H=>{H!==void 0&&H!==f.value&&(H?$():w())});function W(H){const z=r.value,ce=k.value,b=H.target;z&&z.contains(b)||ce&&ce.contains(b)||w()}function $(){f.value=!0,l.modelOpen!==void 0&&d("update:modelOpen",!0),t.nextTick(()=>{const H=l.triggerEl??r.value;if(H){const z=H.getBoundingClientRect(),ce=Bl.length*30+12,b=160;let Z=window.innerWidth-z.right,I=z.bottom+4,j;z.left-b<4&&(Z=void 0,j=Math.max(4,z.left)),I+ce>window.innerHeight-4&&(I=z.top-ce-4),I<4&&(I=4),C.value=Z!==void 0?{right:Z,top:I}:{left:j,top:I}}document.addEventListener("pointerdown",W)})}function w(){f.value=!1,l.modelOpen!==void 0&&d("update:modelOpen",!1),document.removeEventListener("pointerdown",W)}function O(H){d("change",H),w()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",W)}),n({open:f,openMenu:$,close:w}),(H,z)=>(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(()=>[f.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:k,class:"merge-picker__menu",style:t.normalizeStyle({left:C.value.left!==void 0?C.value.left+"px":void 0,right:C.value.right!==void 0?C.value.right+"px":void 0,top:C.value.top+"px"}),onMousedown:z[0]||(z[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Bl),ce=>(t.openBlock(),t.createElementBlock("button",{key:ce.key,class:"merge-picker__item",title:t.unref(A)(e.locale,ce.labelKey),onClick:b=>O(ce.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:ce.icon},null,8,jo),t.createElementVNode("span",Zo,t.toDisplayString(t.unref(A)(e.locale,ce.labelKey)),1)],8,Xo))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-67c0f9e3"]]),Jo=["disabled","title","onClick"],Qo={class:"calc-picker__label"},en=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:n,emit:a}){const l=e,d=a,f=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"}],r=t.ref(!1),k=t.ref(null),C=t.ref(null),W=t.ref({top:0});t.watch(()=>l.modelOpen,z=>{z!==void 0&&z!==r.value&&(z?w():O())});function $(z){const ce=k.value,b=C.value,Z=z.target;ce&&ce.contains(Z)||b&&b.contains(Z)||O()}function w(){r.value=!0,l.modelOpen!==void 0&&d("update:modelOpen",!0),t.nextTick(()=>{const z=l.triggerEl??k.value;if(z){const ce=z.getBoundingClientRect(),b=f.length*30+12,Z=160;let I=window.innerWidth-ce.right,j=ce.bottom+4,se;ce.left-Z<4&&(I=void 0,se=Math.max(4,ce.left)),j+b>window.innerHeight-4&&(j=ce.top-b-4),j<4&&(j=4),W.value=I!==void 0?{right:I,top:j}:{left:se,top:j}}document.addEventListener("pointerdown",$)})}function O(){r.value=!1,l.modelOpen!==void 0&&d("update:modelOpen",!1),document.removeEventListener("pointerdown",$)}function H(z){l.disabled||(d("change",z),O())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",$)}),n({open:r,openMenu:w,close:O}),(z,ce)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:k,class:"calc-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:C,class:"calc-picker__menu",style:t.normalizeStyle({left:W.value.left!==void 0?W.value.left+"px":void 0,right:W.value.right!==void 0?W.value.right+"px":void 0,top:W.value.top+"px"}),onMousedown:ce[0]||(ce[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(f,b=>t.createElementVNode("button",{key:b.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(A)(e.locale,b.labelKey),onClick:Z=>H(b.key)},[t.createElementVNode("span",Qo,t.toDisplayString(t.unref(A)(e.locale,b.labelKey)),1)],10,Jo)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-08615aee"]]),tn={class:"tb-item","data-key":"undo"},ln=["title","disabled"],on={class:"tb-item","data-key":"redo"},nn=["title","disabled"],rn={class:"tb-item","data-key":"paint"},an=["title","disabled"],cn={class:"tb-item","data-key":"clear"},sn=["title","disabled"],dn={class:"tb-item","data-key":"font"},un={class:"tb-item","data-key":"fontSize"},fn={class:"toolbar-font-size"},mn=["value","title"],pn=["title"],gn=["title","disabled"],hn=["title","disabled"],Cn={class:"tb-item","data-key":"bold"},bn=["title","disabled"],yn={class:"tb-item","data-key":"italic"},vn=["title","disabled"],wn={class:"tb-item","data-key":"underline"},kn=["title","disabled"],En={class:"tb-item","data-key":"strike"},Rn=["title","disabled"],Bn={class:"tb-item","data-key":"textColor"},Mn={class:"toolbar-split"},xn=["title","disabled"],Sn={viewBox:"0 0 1024 1024",fill:"currentColor"},Dn=["fill"],Tn=["title","disabled"],Nn={class:"tb-item","data-key":"fillColor"},Hn={class:"toolbar-split"},An=["title","disabled"],Fn={viewBox:"0 0 1024 1024",fill:"currentColor"},Vn=["fill"],On=["title","disabled"],Ln={class:"tb-item","data-key":"border"},In={class:"toolbar-split"},Wn=["title","disabled"],zn={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},_n=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],$n=["title","disabled"],Gn={class:"tb-item","data-key":"hAlign"},Kn={class:"tb-item","data-key":"vAlign"},Un={class:"tb-item","data-key":"wrap"},Pn=["title"],Yn={class:"tb-item","data-key":"merge"},Xn={class:"toolbar-split"},jn=["title","disabled"],Zn=["title","disabled"],qn={class:"tb-item","data-key":"numFmt"},Jn={class:"tb-item","data-key":"calc"},Qn={class:"toolbar-split"},er=["title","disabled"],tr=["title","disabled"],pl=2,lr=6,or=34,nr=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","font-family-change","font-size-change","h-align-change","v-align-change","font-size-input","text-color-change","fill-color-change","number-format-change","font-size-keydown","update:font-size-menu-open","update:text-color-menu-open","update:fill-color-menu-open","update:border-menu-open","update:merge-menu-open","update:calc-menu-open","border-change","merge-change"],setup(e,{emit:n}){const a=[{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"]},d={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function f(D,i){return d[D].includes(i)?"thick":l[D].includes(i)?"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"],k=t.ref(null),C=t.ref(null),W=t.ref(null),$=t.ref(null),w=t.ref(null),O=t.ref(null),H=t.ref(null),z=t.ref(null),ce=t.ref(null),b=t.ref(new Set),Z=t.ref(!1),I=t.ref(!1),j=t.ref(0),se=new Map,Q=t.computed(()=>b.value.size>0);function q(D){return b.value.has(D)}const ee=t.computed(()=>{const D=C.value;return D instanceof HTMLElement?D:void 0});function he(D){return ee.value?!q(D):!0}function ze(){for(const D of r){const i=se.get(D);if(i===void 0||i===0)return!0}return!1}function _e(){if(!k.value)return;k.value.querySelectorAll(".tb-item").forEach(i=>{const g=i.dataset.key;if(!g)return;const ie=i.offsetWidth;ie>0?se.set(g,ie):se.has(g)||se.set(g,0)})}function Qe(D,i){if(D.size!==i.size)return!1;for(const g of D)if(!i.has(g))return!1;return!0}let Ge=0,Ze=0;function ue(){Ge&&cancelAnimationFrame(Ge),!(Ze>60)&&(Ze++,Ge=requestAnimationFrame(()=>requestAnimationFrame(_)))}function _(){if(!k.value)return;const D=k.value.clientWidth-lr*2;if(D<=0){ue();return}Ze=0,(se.size===0||ze())&&_e();let i=0;for(const ie of r)i+=(se.get(ie)??0)+pl;const g=new Set;if(i>D){const ie=D-or-pl;let K=0;for(let ne=0;ne<r.length;ne++){const te=r[ne],xe=(se.get(te)??0)+pl;if(K+xe>ie){for(let Ee=ne;Ee<r.length;Ee++)g.add(r[Ee]);break}K+=xe}}Qe(g,b.value)||(b.value=g,j.value++,g.size===0&&(Z.value=!1))}let c=null;const h=t.ref(0),Te=t.computed(()=>{const D=W.value,i={position:"fixed",top:"0px",right:"0px"};if(!D)return{...x.themeVars,...i};h.value;const g=D.getBoundingClientRect();return{...x.themeVars,position:"fixed",top:`${g.bottom+4}px`,right:`${window.innerWidth-g.right}px`}});function Fe(){Z.value&&(h.value++,t.nextTick(()=>_()))}function s(D){var g,ie;if(!Z.value)return;const i=D.target;(g=C.value)!=null&&g.contains(i)||(ie=W.value)!=null&&ie.contains(i)||(I.value=!0,Z.value=!1,t.nextTick(()=>{I.value=!1}))}function S(){Z.value=!Z.value}t.onMounted(()=>{ue(),k.value&&(c=new ResizeObserver(()=>{Z.value||ue()}),c.observe(k.value)),document.addEventListener("pointerdown",s,!0),window.addEventListener("resize",Fe),window.addEventListener("load",ue),window.addEventListener("orientationchange",ue)}),t.onBeforeUnmount(()=>{Ge&&cancelAnimationFrame(Ge),c==null||c.disconnect(),document.removeEventListener("pointerdown",s,!0),window.removeEventListener("resize",Fe),window.removeEventListener("load",ue),window.removeEventListener("orientationchange",ue)});const x=e,v=n,y=t.computed(()=>x.selNumberFormat===tl?A(x.locale,"nfMixed"):"");return(D,i)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:k,class:"toolbar"},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("undo"),to:ee.value},[t.createElementVNode("div",tn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(A)(e.locale,"undo"),disabled:!e.canUndo,onClick:i[0]||(i[0]=g=>v("undo"))},[...i[44]||(i[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,ln)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("redo"),to:ee.value},[t.createElementVNode("div",on,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(A)(e.locale,"redo"),disabled:!e.canRedo,onClick:i[1]||(i[1]=g=>v("redo"))},[...i[45]||(i[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,nn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("paint"),to:ee.value},[t.createElementVNode("div",rn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(A)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:i[2]||(i[2]=g=>v("paint-format"))},[...i[46]||(i[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,an)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("clear"),to:ee.value},[t.createElementVNode("div",cn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(A)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:i[3]||(i[3]=g=>v("clear-format"))},[...i[47]||(i[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,sn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("sep1"),to:ee.value},[i[48]||(i[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:he("font"),to:ee.value},[t.createElementVNode("div",dn,[t.createVNode(Yt,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:q("font")?"100%":110,"menu-width":q("font")?120:void 0,"visible-count":8,title:t.unref(A)(e.locale,"fontFamily"),align:"right",onChange:i[4]||(i[4]=g=>v("font-family-change",g))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("fontSize"),to:ee.value},[t.createElementVNode("div",un,[t.createElementVNode("div",fn,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(A)(e.locale,"fontSize"),onInput:i[5]||(i[5]=g=>v("font-size-input",g.target.value)),onBlur:i[6]||(i[6]=g=>v("font-size-blur")),onKeydown:i[7]||(i[7]=g=>v("font-size-keydown",g))},null,40,mn),t.createVNode(Yt,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:q("fontSize")?"100%":56,"menu-width":q("fontSize")?120:56,"visible-count":9,title:t.unref(A)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":ce.value,"onUpdate:modelOpen":i[8]||(i[8]=g=>v("update:font-size-menu-open",g)),onChange:i[9]||(i[9]=g=>v("font-size-change",g))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:ce,class:"toolbar-font-size__btn",type:"button",title:t.unref(A)(e.locale,"fontSize"),onMousedown:i[10]||(i[10]=t.withModifiers(()=>{},["prevent"])),onClick:i[11]||(i[11]=g=>v("font-size-toggle"))},[...i[49]||(i[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,pn),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(A)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:i[12]||(i[12]=t.withModifiers(()=>{},["prevent"])),onClick:i[13]||(i[13]=g=>v("font-size-step-down"))},[...i[50]||(i[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,gn),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(A)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:i[14]||(i[14]=t.withModifiers(()=>{},["prevent"])),onClick:i[15]||(i[15]=g=>v("font-size-step-up"))},[...i[51]||(i[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,hn)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("sep2"),to:ee.value},[i[52]||(i[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:he("bold"),to:ee.value},[t.createElementVNode("div",Cn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(A)(e.locale,"bold"),disabled:!e.hasSelection,onClick:i[16]||(i[16]=g=>v("bold-toggle"))},[...i[53]||(i[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:he("italic"),to:ee.value},[t.createElementVNode("div",yn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(A)(e.locale,"italic"),disabled:!e.hasSelection,onClick:i[17]||(i[17]=g=>v("italic-toggle"))},[...i[54]||(i[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,vn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("underline"),to:ee.value},[t.createElementVNode("div",wn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(A)(e.locale,"underline"),disabled:!e.hasSelection,onClick:i[18]||(i[18]=g=>v("underline-toggle"))},[...i[55]||(i[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,kn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("strike"),to:ee.value},[t.createElementVNode("div",En,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(A)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:i[19]||(i[19]=g=>v("strikethrough-toggle"))},[...i[56]||(i[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,Rn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("sep3"),to:ee.value},[i[57]||(i[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:he("textColor"),to:ee.value},[t.createElementVNode("div",Bn,[t.createElementVNode("div",Mn,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(A)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:i[20]||(i[20]=g=>v("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",Sn,[i[58]||(i[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,Dn)]))],8,xn),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:$,class:"toolbar-btn toolbar-split__arrow",title:t.unref(A)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:i[21]||(i[21]=g=>v("update:text-color-menu-open",!e.textColorMenuOpen))},[...i[59]||(i[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,Tn),t.createVNode(Il,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":$.value,"onUpdate:modelOpen":i[22]||(i[22]=g=>v("update:text-color-menu-open",g)),onChange:i[23]||(i[23]=g=>v("text-color-change",g))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("fillColor"),to:ee.value},[t.createElementVNode("div",Nn,[t.createElementVNode("div",Hn,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(A)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:i[24]||(i[24]=g=>v("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",Fn,[i[60]||(i[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,Vn)]))],8,An),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:w,class:"toolbar-btn toolbar-split__arrow",title:t.unref(A)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:i[25]||(i[25]=g=>v("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...i[61]||(i[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,On),t.createVNode(Il,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":w.value,"onUpdate:modelOpen":i[26]||(i[26]=g=>v("update:fill-color-menu-open",g)),onChange:i[27]||(i[27]=g=>v("fill-color-change",g))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("border"),to:ee.value},[t.createElementVNode("div",Ln,[t.createElementVNode("div",In,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(A)(e.locale,"borders"),disabled:!e.hasSelection,onClick:i[28]||(i[28]=g=>v("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",zn,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(a,g=>t.createElementVNode("line",{key:g.name,x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2,"stroke-width":f(e.cachedBorder,g.name)==="thick"?3:1.5,"stroke-dasharray":f(e.cachedBorder,g.name)==="dashed"?"0 4":"none","stroke-linecap":f(e.cachedBorder,g.name)==="dashed"?"round":"square"},null,8,_n)),64))]))],8,Wn),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:O,class:"toolbar-btn toolbar-split__arrow",title:t.unref(A)(e.locale,"borders"),disabled:!e.hasSelection,onClick:i[29]||(i[29]=g=>v("update:border-menu-open",!e.borderMenuOpen))},[...i[62]||(i[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,$n),t.createVNode(Yo,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":O.value,"onUpdate:modelOpen":i[30]||(i[30]=g=>v("update:border-menu-open",g)),onChange:i[31]||(i[31]=g=>v("border-change",g))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("sep4"),to:ee.value},[i[63]||(i[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:he("hAlign"),to:ee.value},[t.createElementVNode("div",Gn,[t.createVNode(Yt,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:q("hAlign")?"100%":44,"menu-width":q("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(A)(e.locale,"hAlign"),onChange:i[32]||(i[32]=g=>v("h-align-change",g))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("vAlign"),to:ee.value},[t.createElementVNode("div",Kn,[t.createVNode(Yt,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:q("vAlign")?"100%":44,"menu-width":q("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(A)(e.locale,"vAlign"),onChange:i[33]||(i[33]=g=>v("v-align-change",g))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",Un,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(A)(e.locale,"wrap"),onClick:i[34]||(i[34]=g=>v("wrap-toggle"))},[...i[64]||(i[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,Pn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("merge"),to:ee.value},[t.createElementVNode("div",Yn,[t.createElementVNode("div",Xn,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(A)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:i[35]||(i[35]=g=>v("apply-merge"))},[...i[65]||(i[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,jn),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:H,class:"toolbar-btn toolbar-split__arrow",title:t.unref(A)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:i[36]||(i[36]=g=>v("update:merge-menu-open",!e.mergeMenuOpen))},[...i[66]||(i[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,Zn),t.createVNode(qo,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":H.value,"onUpdate:modelOpen":i[37]||(i[37]=g=>v("update:merge-menu-open",g)),onChange:i[38]||(i[38]=g=>v("merge-change",g))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("sep6"),to:ee.value},[i[67]||(i[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:he("numFmt"),to:ee.value},[t.createElementVNode("div",qn,[t.createVNode(Yt,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:q("numFmt")?"100%":92,"menu-width":(q("numFmt"),150),"visible-count":8,title:t.unref(A)(e.locale,"numberFormat"),"fallback-label":y.value,align:"right",onChange:i[39]||(i[39]=g=>v("number-format-change",String(g)))},null,8,["model-value","options","width","menu-width","title","fallback-label"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:he("sep7"),to:ee.value},[i[68]||(i[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:he("calc"),to:ee.value},[t.createElementVNode("div",Jn,[t.createElementVNode("div",Qn,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(A)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:i[40]||(i[40]=g=>v("calc-sum"))},[...i[69]||(i[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,er),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:z,class:"toolbar-btn toolbar-split__arrow",title:t.unref(A)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:i[41]||(i[41]=g=>v("update:calc-menu-open",!e.calcMenuOpen))},[...i[70]||(i[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,tr),t.createVNode(en,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":z.value,disabled:e.isSingleCell,"onUpdate:modelOpen":i[42]||(i[42]=g=>v("update:calc-menu-open",g)),onChange:i[43]||(i[43]=g=>v(g==="sum"?"calc-sum":"calc-avg"))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),Q.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:W,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":Z.value}]),type:"button",onClick:S},[...i[71]||(i[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:C,key:j.value,class:t.normalizeClass(["overflow-menu",{"no-anim":I.value}]),style:t.normalizeStyle(Te.value)},null,6)),[[t.vShow,Z.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-a33ba577"]]),rr={class:"tab-list"},ar=["onClick","onDblclick","onContextmenu"],ir=["value"],cr={key:1,class:"tab-item__name"},sr=["title"],dr=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:n}){const a=n;return(l,d)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:d[5]||(d[5]=f=>a("tabbar-contextmenu",f))},[t.createElementVNode("div",rr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(f,r)=>(t.openBlock(),t.createElementBlock("div",{key:f.id,class:t.normalizeClass(["tab-item",{"tab-item--active":r===e.activeSheetIndex}]),onClick:k=>a("tab-click",r),onDblclick:t.withModifiers(k=>a("tab-dblclick",r),["prevent"]),onContextmenu:k=>a("tab-contextmenu",{ev:k,i:r})},[e.renTab===r?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:d[0]||(d[0]=k=>a("tab-rename-input",k.target.value)),onKeydown:d[1]||(d[1]=k=>a("tab-rename-keydown",k)),onBlur:d[2]||(d[2]=k=>a("tab-rename-commit")),onClick:d[3]||(d[3]=t.withModifiers(()=>{},["stop"]))},null,40,ir)):(t.openBlock(),t.createElementBlock("span",cr,t.toDisplayString(f.name),1))],42,ar))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(A)(e.locale,"addSheet"),onClick:d[4]||(d[4]=f=>a("add-sheet"))}," + ",8,sr)],32))}}),[["__scopeId","data-v-454e1a12"]]),ur={class:"nf-dialog__header"},fr={class:"nf-dialog__title"},mr={class:"nf-dialog__body"},pr={class:"nf-field"},gr={class:"nf-field__label"},hr=["value"],Cr={key:0,class:"nf-field"},br={class:"nf-field__label"},yr={key:1,class:"nf-field nf-field--inline"},vr={class:"nf-checkbox"},wr={key:2,class:"nf-field"},kr={class:"nf-field__label"},Er=["value"],Rr={key:3,class:"nf-field"},Br={class:"nf-field__label"},Mr=["value"],xr={key:4,class:"nf-field"},Sr={class:"nf-field__label"},Dr=["value"],Tr={key:5,class:"nf-field"},Nr={class:"nf-field__label"},Hr=["value"],Ar={key:6,class:"nf-field"},Fr={class:"nf-field__label"},Vr=["value"],Or={class:"nf-field"},Lr={class:"nf-field__label"},Ir={class:"nf-dialog__footer"},Wr={class:"nf-preview"},zr={class:"nf-preview__label"},_r={class:"nf-preview__value"},$r={class:"nf-dialog__actions"},Gr=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:n}){const a=e,l=n,d=t.ref(!1),f=t.ref("general"),r=t.ref(2),k=t.ref(!1),C=t.ref("$"),W=t.ref("m/d/yyyy"),$=t.ref("h:mm:ss"),w=t.ref("m/d/yyyy h:mm:ss"),O=t.ref("[h]:mm:ss"),H=t.ref(""),z=t.ref(null),ce=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],b=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],Z=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],I=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],j=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],se=t.computed(()=>a.locale==="zh-CN"?[...b,...Z]:[...Z,...b]),Q=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],q=t.computed(()=>a.locale==="zh-CN"?[...I,...j]:[...j,...I]),ee=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],he={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"},ze=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(f.value)),_e=t.computed(()=>["currency","currencyRounded","accounting"].includes(f.value)),Qe=t.computed(()=>f.value==="date"),Ge=t.computed(()=>f.value==="time"),Ze=t.computed(()=>f.value==="dateTime"),ue=t.computed(()=>f.value==="duration"),_=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(f.value));function c(){if(f.value==="general")return ll;if(f.value==="text")return Ht;if(f.value==="custom")return H.value;if(f.value==="date")return W.value;if(f.value==="time")return $.value;if(f.value==="dateTime")return w.value;if(f.value==="duration")return O.value;const K=Math.max(0,Math.min(30,r.value));return f.value==="currency"||f.value==="currencyRounded"||f.value==="accounting"?h(f.value,K,k.value,C.value):No(a.locale,f.value,K,k.value)}function h(K,ne,te,xe){const Ee=te?"#,##0":"0";if(K==="currencyRounded")return xe+Ee;const Ye=ne>0?"."+"0".repeat(ne):"",et=Ee+Ye;return K==="currency"?xe+et:`${xe}${et};(${xe}${et});${xe}"-"`}function Te(K){if(H.value=K,Pt(K)){f.value="general";return}if(K==="@"){f.value="text";return}if(/\[h\]/i.test(K)&&!/[yd]/i.test(K)){f.value="duration",ee.includes(K)&&(O.value=K);return}const ne=/[yd]/i.test(K),te=/h|s|AM\/PM/i.test(K);if(ne&&te){f.value="dateTime",q.value.includes(K)&&(w.value=K);return}if(ne||/AM\/PM/i.test(K)){te&&!ne?(f.value="time",Q.includes(K)&&($.value=K)):(f.value="date",se.value.includes(K)&&(W.value=K));return}if(K.includes("%")){f.value="percent",r.value=Fe(K);return}if(/E[+-]/i.test(K)){f.value="scientific",r.value=Fe(K);return}const xe=ce.find(Ee=>K.startsWith(Ee.value));if(K.includes("[Red](")){f.value="financial",k.value=K.includes(","),r.value=Fe(K);return}if(xe){K.includes("(")?(f.value="accounting",C.value=xe.value,k.value=K.includes(","),r.value=Fe(K)):/\.\d/.test(K.slice(xe.value.length))?(f.value="currency",C.value=xe.value,k.value=K.includes(","),r.value=Fe(K)):(f.value="currencyRounded",C.value=xe.value,k.value=K.includes(","));return}f.value="number",k.value=K.includes(","),r.value=Fe(K)}function Fe(K){const ne=K.match(/\.([0#?]+)/);return ne?ne[1].length:0}function s(){f.value!=="custom"&&(H.value=c())}function S(){}function x(){W.value=se.value[0],$.value=Q[0],w.value=q.value[0],O.value=ee[0]}function v(){d.value=!0,a.modelOpen!==void 0&&l("update:modelOpen",!0),x(),Te(a.currentFormat??""),t.nextTick(()=>{var K;return(K=z.value)==null?void 0:K.focus()})}function y(){d.value=!1,a.modelOpen!==void 0&&l("update:modelOpen",!1)}function D(){l("apply",H.value),y()}function i(){y()}function g(K){K.key==="Escape"&&y()}t.watch(()=>a.modelOpen,K=>{K&&!d.value?v():!K&&d.value&&y()});const ie=t.computed(()=>ml(a.sampleValue,H.value,a.locale));return(K,ne)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"nf-dialog"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"nf-dialog__mask",onMousedown:i,onKeydown:g},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:ne[9]||(ne[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",ur,[t.createElementVNode("span",fr,t.toDisplayString(t.unref(A)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:y},[...ne[10]||(ne[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",mr,[t.createElementVNode("div",pr,[t.createElementVNode("label",gr,t.toDisplayString(t.unref(A)(e.locale,"nfCategory")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ne[0]||(ne[0]=te=>f.value=te),class:"nf-field__select",onChange:s},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(So),te=>(t.openBlock(),t.createElementBlock("option",{key:te,value:te},t.toDisplayString(t.unref(A)(e.locale,he[te])),9,hr))),128))],544),[[t.vModelSelect,f.value]])]),_.value?(t.openBlock(),t.createElementBlock("div",Cr,[t.createElementVNode("label",br,t.toDisplayString(t.unref(A)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ne[1]||(ne[1]=te=>r.value=te),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:s},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),ze.value?(t.openBlock(),t.createElementBlock("div",yr,[t.createElementVNode("label",vr,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ne[2]||(ne[2]=te=>k.value=te),type:"checkbox",onChange:s},null,544),[[t.vModelCheckbox,k.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(A)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),_e.value?(t.openBlock(),t.createElementBlock("div",wr,[t.createElementVNode("label",kr,t.toDisplayString(t.unref(A)(e.locale,"nfSymbol")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ne[3]||(ne[3]=te=>C.value=te),class:"nf-field__select",onChange:s},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ce,te=>t.createElementVNode("option",{key:te.value,value:te.value},t.toDisplayString(te.label),9,Er)),64))],544),[[t.vModelSelect,C.value]])])):t.createCommentVNode("",!0),Qe.value?(t.openBlock(),t.createElementBlock("div",Rr,[t.createElementVNode("label",Br,t.toDisplayString(t.unref(A)(e.locale,"nfDateFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ne[4]||(ne[4]=te=>W.value=te),class:"nf-field__select",onChange:s},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(se.value,te=>(t.openBlock(),t.createElementBlock("option",{key:te,value:te},t.toDisplayString(te),9,Mr))),128))],544),[[t.vModelSelect,W.value]])])):t.createCommentVNode("",!0),Ge.value?(t.openBlock(),t.createElementBlock("div",xr,[t.createElementVNode("label",Sr,t.toDisplayString(t.unref(A)(e.locale,"nfTimeFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ne[5]||(ne[5]=te=>$.value=te),class:"nf-field__select",onChange:s},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(Q,te=>t.createElementVNode("option",{key:te,value:te},t.toDisplayString(te),9,Dr)),64))],544),[[t.vModelSelect,$.value]])])):t.createCommentVNode("",!0),Ze.value?(t.openBlock(),t.createElementBlock("div",Tr,[t.createElementVNode("label",Nr,t.toDisplayString(t.unref(A)(e.locale,"nfDateTime")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ne[6]||(ne[6]=te=>w.value=te),class:"nf-field__select",onChange:s},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(q.value,te=>(t.openBlock(),t.createElementBlock("option",{key:te,value:te},t.toDisplayString(te),9,Hr))),128))],544),[[t.vModelSelect,w.value]])])):t.createCommentVNode("",!0),ue.value?(t.openBlock(),t.createElementBlock("div",Ar,[t.createElementVNode("label",Fr,t.toDisplayString(t.unref(A)(e.locale,"nfDuration")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ne[7]||(ne[7]=te=>O.value=te),class:"nf-field__select",onChange:s},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ee,te=>t.createElementVNode("option",{key:te,value:te},t.toDisplayString(te),9,Vr)),64))],544),[[t.vModelSelect,O.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",Or,[t.createElementVNode("label",Lr,t.toDisplayString(t.unref(A)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:z,"onUpdate:modelValue":ne[8]||(ne[8]=te=>H.value=te),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:S},null,544),[[t.vModelText,H.value]])])]),t.createElementVNode("div",Ir,[t.createElementVNode("div",Wr,[t.createElementVNode("span",zr,t.toDisplayString(t.unref(A)(e.locale,"nfPreview")),1),t.createElementVNode("span",_r,t.toDisplayString(ie.value||"—"),1)]),t.createElementVNode("div",$r,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:D},t.toDisplayString(t.unref(A)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:y},t.toDisplayString(t.unref(A)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-69cb36b7"]]);function rt(e){let n="",a=e;do n=String.fromCharCode(65+a%26)+n,a=Math.floor(a/26)-1;while(a>=0);return n}function gl(e){let n=0;for(let a=0;a<e.length;a++)n=n*26+(e.toUpperCase().charCodeAt(a)-64);return n-1}function At(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 hl(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 _t(e,n){return`${e},${n}`}function nl(e,n,a){const l=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!l)return null;const d=gl(l[1]),f=parseInt(l[2],10)-1;return d<0||d>=n||f<0||f>=a?null:{col:d,row:f}}function Ft(e,n){if(!n)return{x:0,y:0};const a=n.getBoundingClientRect();return{x:e.clientX-a.left,y:e.clientY-a.top}}function Wl(e,n,a){const l=e.split(":");if(l.length!==2)return null;const d=nl(l[0],n,a),f=nl(l[1],n,a);return!d||!f?null:{sc:Math.min(d.col,f.col),sr:Math.min(d.row,f.row),ec:Math.max(d.col,f.col),er:Math.max(d.row,f.row)}}function zl(e,n,a,l,d){const f=a[_t(e,n)];if(!f)return 0;const r=f.value;if(r.startsWith("="))return _l(_t(e,n),a,l,d)??0;const k=parseFloat(r);return isNaN(k)?0:k}const Vt=new Map;function Cl(){Vt.clear()}function _l(e,n,a,l){return Kr(e,n,a,l)}function Kr(e,n,a,l,d){if(Vt.has(e))return NaN;Vt.set(e,NaN);const f=n[e];if(!f)return NaN;const r=f.value;if(!r.startsWith("=")){const W=parseFloat(r),$=isNaN(W)?0:W;return Vt.set(e,$),$}const k=r.slice(1).trim(),C=k.toUpperCase();if(C.startsWith("SUM(")&&k.endsWith(")")){const W=k.slice(4,-1).trim(),$=Wl(W,a,l);if($){let w=0;for(let O=$.sc;O<=$.ec;O++)for(let H=$.sr;H<=$.er;H++)w+=zl(O,H,n,a,l);return isNaN(w)?NaN:(Vt.set(e,w),w)}return NaN}if(C.startsWith("AVERAGE(")&&k.endsWith(")")){const W=k.slice(8,-1).trim(),$=Wl(W,a,l);if($){let w=0,O=0;for(let z=$.sc;z<=$.ec;z++)for(let ce=$.sr;ce<=$.er;ce++)w+=zl(z,ce,n,a,l),O++;if(O===0||isNaN(w))return NaN;const H=w/O;return Vt.set(e,H),H}return NaN}return NaN}function bl(e,n,a){const l=[],d=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let f;for(;(f=d.exec(e))!==null;){const r=nl(f[1],n,a);if(r)if(f[2]){const k=nl(f[2],n,a);if(!k)continue;for(let C=Math.min(r.col,k.col);C<=Math.max(r.col,k.col);C++)for(let W=Math.min(r.row,k.row);W<=Math.max(r.row,k.row);W++)l.push(_t(C,W))}else l.push(_t(r.col,r.row))}return l}function Ur(e,n,a,l,d){const f=a[_t(e,n)];if(!f)return"";const r=f.value;if(!r.startsWith("="))return r;const k=_l(_t(e,n),a,l,d);return isNaN(k)?"#ERROR":String(k)}function Pr(e,n,a,l,d,f){return n===0&&a===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,k,C,W,$)=>{const w=k?gl(C):gl(C)+n,O=W?parseInt($,10)-1:parseInt($,10)-1+a;let H;w<0?H="A":w>=l?H=f(l-1):H=f(w);let z;return O<0?z="1":O>=d?z=String(d):z=String(O+1),(k||"")+H+(W||"")+z})}class Yr{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(n){var l;const a=this.deps.get(n);if(a){for(const d of a)(l=this.rev.get(d))==null||l.delete(n);this.deps.delete(n)}}set(n,a){if(this.clear(n),a.length!==0){this.deps.set(n,a);for(const l of a)this.rev.has(l)||this.rev.set(l,new Set),this.rev.get(l).add(n)}}markDirty(n){const a=[n];for(;a.length>0;){const l=a.pop(),d=this.rev.get(l);if(d)for(const f of d)this.dirty.has(f)||(this.dirty.add(f),a.push(f))}}getDirtyAndClear(){const n=this.dirty;return this.dirty=new Set,n}rebuild(n,a,l){this.deps.clear(),this.rev.clear(),this.dirty.clear(),Vt.clear();for(const[d,f]of Object.entries(n))if(f.value.startsWith("=")){const r=bl(f.value.slice(1),a,l);this.set(d,r)}}}function Xr(e,n){const a=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(()=>{a.rowCount=e.rowCount??n.rowCount,a.colCount=e.colCount??n.colCount,a.width=e.width,a.height=e.height,a.theme=e.theme??n.theme,a.locale=e.locale??n.locale});const l=t.computed(()=>a.locale==="zh-CN"?"zh-CN":"en-US"),d=a.colCount,f=a.rowCount,r=t.reactive({}),k=t.reactive({}),C=new Yr,W=t.ref(null),$=t.ref("cell"),w=t.ref({col:0,row:0}),O=t.ref(null),H=t.ref(""),z=t.ref(new Array(d).fill(100)),ce=t.ref(new Array(f).fill(void 0)),b=t.ref(0),Z=t.ref(0),I=(24-wt)/2,j=new Map;let se=null;function Q(B,T,F,J){const ae=`${J} ${F} ${T}px ${B}`,ke=j.get(ae);if(ke)return ke;if(!se){if(typeof document>"u")return{ascent:T*.88,descent:T*.28};se=document.createElement("canvas")}const De=se.getContext("2d");if(!De)return{ascent:T*.88,descent:T*.28};De.font=ae;const Ve=De.measureText(" "),Ae=Ve.fontBoundingBoxAscent,Oe=Ve.fontBoundingBoxDescent;if(typeof Ae=="number"&&typeof Oe=="number"&&Ae>0&&Oe>0){const fe={ascent:Ae,descent:Oe};return j.set(ae,fe),fe}const Se=["M","中","y","Ä","0"];let p=0,M=0;for(const fe of Se){const be=De.measureText(fe),we=be.actualBoundingBoxAscent||0,Ne=be.actualBoundingBoxDescent||0;we>p&&(p=we),Ne>M&&(M=Ne)}const G=Math.max(p,T*.88),Ce=Math.max(M,T*.28),pe={ascent:G,descent:Ce};return j.set(ae,pe),pe}let q=(B,T)=>`${B},${T}`,ee=()=>null,he=()=>wt,ze=t.computed(()=>[0]),_e=()=>24,Qe=(B,T,F,J)=>({startCol:Math.min(B,F),startRow:Math.min(T,J),endCol:Math.max(B,F),endRow:Math.max(T,J)});function Ge(B,T){var Ve;const F=(Ve=r[q(B,T)])==null?void 0:Ve.style,J=he(B,T),ae=typeof(F==null?void 0:F.fontFamily)=="string"&&F.fontFamily?F.fontFamily:Ut,ke=(F==null?void 0:F.fontWeight)==="bold"?"bold":"normal",De=(F==null?void 0:F.fontStyle)==="italic"?"italic":"normal";return Q(ae,J,ke,De)}function Ze(B,T,F,J){if(!T)return[""];const ae=T.split(`
|
|
2
|
-
`),ke=[];for(const
|
|
3
|
-
`).length,dt>ae&&(ae=dt)}}const Ve=F+J,Ae=I*2+ae*Ve;return Math.min(500,Math.max(24,Math.round(Ae)))}_e=Te;function Fe(B){return ce.value[B]===void 0}const s=t.computed(()=>{const B=[0];for(let T=0;T<f;T++)B.push(B[T]+_e(T));return B}),S=t.computed(()=>_.value[d]),x=t.computed(()=>s.value[f]);function v(B,T){return`${B},${T}`}q=v;function y(B){Reflect.deleteProperty(r,B)}function D(B,T){$.value="cell";const F=ee(B,T);F?(w.value={col:F.range.startCol,row:F.range.startRow},W.value={...F.range}):(w.value={col:B,row:T},W.value={startCol:B,startRow:T,endCol:B,endRow:T})}function i(B,T,F,J,ae="cell"){const ke=ee(B,T);if(w.value=ke?{col:ke.range.startCol,row:ke.range.startRow}:{col:B,row:T},$.value=ae,ae==="row"||ae==="col"){const De=Math.min(B,F),Ve=Math.max(B,F),Ae=Math.min(T,J),Oe=Math.max(T,J);W.value={startCol:De,startRow:Ae,endCol:Ve,endRow:Oe}}else W.value=Qe(B,T,F,J)}function g(){i(0,0,d-1,f-1,"all")}function ie(B,T){const F=W.value;return F?($.value==="cell"||$.value==="all",B>=F.startCol&&B<=F.endCol&&T>=F.startRow&&T<=F.endRow):!1}function K(B,T){return ie(B,T)}function ne(B,T){for(const F in k){const J=k[F];if(J&&B>=J.startCol&&B<=J.endCol&&T>=J.startRow&&T<=J.endRow)return{range:J,anchor:F}}return null}ee=ne;function te(B,T){return k[v(B,T)]!==void 0}function xe(B,T){const F=ee(B,T);if(F&&B===F.range.startCol&&T===F.range.startRow){const J=_.value[F.range.endCol+1]-_.value[B],ae=s.value[F.range.endRow+1]-s.value[T];return{w:J,h:ae}}return{w:z.value[B],h:_e(T)}}function Ee(B,T,F,J){let ae=Math.min(B,F),ke=Math.max(B,F),De=Math.min(T,J),Ve=Math.max(T,J),Ae=!0;for(;Ae;){Ae=!1;for(const Oe in k){const Se=k[Oe];if(!Se)continue;Se.startCol<=ke&&Se.endCol>=ae&&Se.startRow<=Ve&&Se.endRow>=De&&(Se.startCol<ae&&(ae=Se.startCol,Ae=!0),Se.endCol>ke&&(ke=Se.endCol,Ae=!0),Se.startRow<De&&(De=Se.startRow,Ae=!0),Se.endRow>Ve&&(Ve=Se.endRow,Ae=!0))}}return{startCol:ae,startRow:De,endCol:ke,endRow:Ve}}Qe=Ee;let Ye=()=>{};function et(B,T){var F;return((F=r[v(B,T)])==null?void 0:F.value)??""}function E(B,T){return Cl(),Ur(B,T,r,d,f)}function R(B,T,F){var De,Ve;const J=v(B,T);if(Cl(),F===""||F==null){C.clear(J);const Ae=((De=r[J])==null?void 0:De.style)??null;Ae?r[J]={value:"",style:Ae}:y(J),C.markDirty(J);return}const ae=String(F),ke=((Ve=r[J])==null?void 0:Ve.style)??null;r[J]={value:ae,style:ke},ae.startsWith("=")?C.set(J,bl(ae.slice(1),d,f)):C.clear(J),C.markDirty(J)}function P(B,T,F,J){for(let ae=B;ae<=T;ae++)for(let ke=F;ke<=J;ke++){const De=v(ae,ke);C.clear(De),y(De),C.markDirty(De),Ye(ae,ke)}}let de=()=>{};function le(B){O.value||(O.value={...w.value},B!==void 0?H.value=B:H.value||(H.value=et(w.value.col,w.value.row)))}function re(){O.value&&(de(),R(O.value.col,O.value.row,H.value),O.value=null,H.value="")}function Y(){O.value=null,H.value=""}function U(B,T){const F=w.value;let J=Math.max(0,Math.min(d-1,F.col+B)),ae=Math.max(0,Math.min(f-1,F.row+T));const ke=ee(F.col,F.row),De=ee(J,ae);ke&&De&&ke.anchor===De.anchor&&(B>0?J=ke.range.endCol+1:B<0&&(J=ke.range.startCol-1),T>0?ae=ke.range.endRow+1:T<0&&(ae=ke.range.startRow-1),J=Math.max(0,Math.min(d-1,J)),ae=Math.max(0,Math.min(f-1,ae))),D(J,ae)}function ye(B,T){const F=Math.max(0,c.w-52-11),J=Math.max(0,c.h-24-11),ae=_.value[B],ke=s.value[T],De=ee(B,T),Ve=De?_.value[De.range.endCol+1]-_.value[B]:z.value[B],Ae=De?s.value[De.range.endRow+1]-s.value[T]:_e(T);let Oe=b.value,Se=Z.value;ae<Oe?Oe=ae:ae+Ve>Oe+F&&(Oe=ae+Ve-F),ke<Se?Se=ke:ke+Ae>Se+J&&(Se=ke+Ae-J),h(Oe,Se)}function Re(B){const T=_.value;if(B<0||B>=T[d])return-1;let F=0,J=d-1;for(;F<J;){const ae=F+J+1>>1;T[ae]<=B?F=ae:J=ae-1}return F}function Ke(B){const T=s.value;if(B<0||B>=T[f])return-1;let F=0,J=f-1;for(;F<J;){const ae=F+J+1>>1;T[ae]<=B?F=ae:J=ae-1}return F}const $e={props:a,locale:l,colCount:d,rowCount:f,cells:r,merges:k,formulaDeps:C,selection:W,activeCell:w,editingCell:O,editValue:H,colWidths:z,rowHeights:ce,scrollX:b,scrollY:Z,BASE_CELL_VPAD:I,fontMetricsCache:j,fontMetricsCanvas:se,measureFontMetrics:Q,_getFontMetricsForCell:Ge,getWrappedLines:Ze,cellFontSize:ue,colPositions:_,getRowHeight:Te,_isAutoRow:Fe,rowPositions:s,totalWidth:S,totalHeight:x,selectCell:D,selectRange:i,selectAll:g,isSelected:ie,isCellSelected:K,selectionMode:$,cellKey:v,delCell:y,findMerge:ne,_isMergeAnchor:te,_mergedSpan:xe,expandSelectionForMerges:Ee,getCellRaw:et,getCellValue:E,setCellValue:R,clearCellsInRange:P,startEdit:le,commitEdit:re,cancelEdit:Y,moveActive:U,ensureVisible:ye,hitCol:Re,hitRow:Ke,viewSize:c};return de=()=>{var B;return(B=$e.saveUndo)==null?void 0:B.call($e)},Ye=(B,T)=>{var F;return(F=$e.syncCellBorders)==null?void 0:F.call($e,B,T)},h=(B,T)=>{var F;return(F=$e.clampScroll)==null?void 0:F.call($e,B,T)},$e}function jr(e,n){const a=t.ref([]),l=t.ref([]);function d(p){const M={};for(const[G,Ce]of Object.entries(p))M[G]={value:Ce.value,style:Ce.style};return M}function f(){return n.saveSheet(),{sheets:n.sheets.value.map(p=>({id:p.id,name:p.name,cells:d(p.cells),merges:p.merges?{...p.merges}:{},selection:p.selection?{...p.selection}:null,activeCell:p.activeCell?{...p.activeCell}:{col:0,row:0},scrollX:p.scrollX,scrollY:p.scrollY,colWidths:[...p.colWidths],rowHeights:[...p.rowHeights]})),activeSheetIndex:n.activeSheetIndex.value}}function r(p){n.sheets.value=p.sheets.map(M=>({...M,cells:d(M.cells)})),n.loadSheet(Math.max(0,Math.min(p.activeSheetIndex,n.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function k(){const p=f(),M=a.value[a.value.length-1];M&&JSON.stringify(M)===JSON.stringify(p)||(a.value.push(p),l.value=[],a.value.length>50&&a.value.shift())}e.saveUndo=k;function C(){var p;a.value.length&&(l.value.push(f()),r(a.value.pop()),(p=e.scheduleRender)==null||p.call(e),t.nextTick(()=>{var M;return(M=e.emitModelData)==null?void 0:M.call(e)}))}function W(){var p;l.value.length&&(a.value.push(f()),r(l.value.pop()),(p=e.scheduleRender)==null||p.call(e),t.nextTick(()=>{var M;return(M=e.emitModelData)==null?void 0:M.call(e)}))}const $=t.computed(()=>a.value.length>0),w=t.computed(()=>l.value.length>0),O=t.computed(()=>!!e.selection.value),H=t.ref(null);function z(){var G;const p=e.selection.value;if(!p)return;const M={};for(let Ce=p.startCol;Ce<=p.endCol;Ce++)for(let pe=p.startRow;pe<=p.endRow;pe++)M[`${Ce-p.startCol},${pe-p.startRow}`]=((G=e.cells[e.cellKey(Ce,pe)])==null?void 0:G.style)??null;H.value={styles:M}}function ce(){var G,Ce,pe,fe;const p=H.value,M=e.selection.value;if(!(!p||!M)){k();for(let be=M.startCol;be<=M.endCol;be++)for(let we=M.startRow;we<=M.endRow;we++){const Ne=e.findMerge(be,we);if(Ne&&(be!==Ne.range.startCol||we!==Ne.range.startRow))continue;const tt=p.styles[`${be-M.startCol},${we-M.startRow}`]??null,ct=e.cellKey(be,we),dt=((G=e.cells[ct])==null?void 0:G.value)??"";dt===""&&tt===null?e.delCell(ct):e.cells[ct]={value:dt,style:tt},(Ce=e.syncCellBorders)==null||Ce.call(e,be,we)}H.value=null,(pe=e.scheduleRender)==null||pe.call(e),(fe=e.emitModelData)==null||fe.call(e)}}function b(){var M,G,Ce,pe;const p=e.selection.value;if(p){k();for(let fe=p.startCol;fe<=p.endCol;fe++)for(let be=p.startRow;be<=p.endRow;be++){const we=e.findMerge(fe,be);if(we&&(fe!==we.range.startCol||be!==we.range.startRow))continue;const Ne=e.cellKey(fe,be),tt=((M=e.cells[Ne])==null?void 0:M.value)??"";tt===""?e.delCell(Ne):e.cells[Ne]={value:tt,style:null},(G=e.syncCellBorders)==null||G.call(e,fe,be)}(Ce=e.scheduleRender)==null||Ce.call(e),(pe=e.emitModelData)==null||pe.call(e)}}const Z=t.computed(()=>to.map(p=>({...p,label:p.value===""?A(e.locale.value,"fontDefault"):p.label}))),I=t.computed(()=>lo.map(p=>({...p,label:String(p.value)}))),j="\0",se=t.computed(()=>{var Ce;const p=e.selection.value;if(!p)return"";let M,G=!1;for(let pe=p.startCol;pe<=p.endCol&&!G;pe++)for(let fe=p.startRow;fe<=p.endRow&&!G;fe++){const be=e.findMerge(pe,fe);if(be&&(pe!==be.range.startCol||fe!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(pe,fe)])==null?void 0:Ce.style,Ne=typeof(we==null?void 0:we.fontFamily)=="string"?we.fontFamily:"";M===void 0?M=Ne:Ne!==M&&(G=!0)}return G?j:M??""}),Q=t.computed(()=>{const p=e.selection.value;if(!p)return wt;let M,G=!1;for(let Ce=p.startCol;Ce<=p.endCol&&!G;Ce++)for(let pe=p.startRow;pe<=p.endRow&&!G;pe++){const fe=e.findMerge(Ce,pe);if(fe&&(Ce!==fe.range.startCol||pe!==fe.range.startRow))continue;const be=e.cellFontSize(Ce,pe);M===void 0?M=be:be!==M&&(G=!0)}return G?0:M??wt});function q(p,M){var Ce,pe,fe,be;const G=e.selection.value;if(G){k();for(let we=G.startCol;we<=G.endCol;we++)for(let Ne=G.startRow;Ne<=G.endRow;Ne++){const tt=e.findMerge(we,Ne);if(tt&&(we!==tt.range.startCol||Ne!==tt.range.startRow))continue;const ct=e.cellKey(we,Ne),dt=((Ce=e.cells[ct])==null?void 0:Ce.value)??"",je=(pe=e.cells[ct])!=null&&pe.style?{...e.cells[ct].style}:{};M===""||M===null||M===void 0||M===0?Reflect.deleteProperty(je,p):je[p]=M;const at=Object.keys(je).length?je:null;dt===""&&at===null?e.delCell(ct):e.cells[ct]={value:dt,style:at}}(fe=e.scheduleRender)==null||fe.call(e),(be=e.emitModelData)==null||be.call(e)}}function ee(p){q("fontFamily",p===""?"":p)}const he=t.ref(!1),ze=t.ref(!1),_e=t.ref(!1),Qe=t.ref(!1),Ge=t.ref(!1);function Ze(p){q("fontSize",p),he.value=!1}const ue=t.computed(()=>so.map(p=>({label:A(e.locale.value,p.labelKey),value:p.value,icon:p.icon}))),_=t.computed(()=>uo.map(p=>({label:A(e.locale.value,p.labelKey),value:p.value,icon:p.icon}))),c=t.computed(()=>{var Ce;const p=e.selection.value;if(!p)return"left";const M=(Ce=e.cells[e.cellKey(p.startCol,p.startRow)])==null?void 0:Ce.style,G=typeof(M==null?void 0:M.textAlign)=="string"?M.textAlign:"";return G==="center"||G==="right"?G:"left"}),h=t.computed(()=>{var Ce;const p=e.selection.value;if(!p)return"top";const M=(Ce=e.cells[e.cellKey(p.startCol,p.startRow)])==null?void 0:Ce.style,G=typeof(M==null?void 0:M.verticalAlign)=="string"?M.verticalAlign:"";return G==="middle"||G==="bottom"?G:"top"}),Te=t.computed(()=>{var G;const p=e.selection.value;if(!p)return!1;const M=(G=e.cells[e.cellKey(p.startCol,p.startRow)])==null?void 0:G.style;return(M==null?void 0:M.wrap)==="wrap"});function Fe(p){q("textAlign",p)}function s(p){q("verticalAlign",p)}function S(){if(!e.selection.value)return;const M=Te.value;q("wrap",M?void 0:"wrap")}const x=t.ref(""),v=he;t.watch(Q,p=>{x.value=p===0?"":String(p)},{immediate:!0});function y(p){const M=p.replace(/[^\d]/g,"");x.value=M;const G=parseInt(M,10);!isNaN(G)&&G>=5&&G<=72&&G!==Q.value&&q("fontSize",G)}function D(){const p=x.value.trim();if(!p){x.value=Q.value===0?"":String(Q.value);return}let M=parseInt(p,10);isNaN(M)?M=Q.value===0?wt:Q.value:M=Math.max(5,Math.min(72,M)),x.value=String(M),M!==Q.value&&q("fontSize",M)}function i(p){p.key==="Enter"&&p.target.blur()}function g(p){p&&p.preventDefault(),v.value=!v.value,v.value&&(_e&&(_e.value=!1),ze&&(ze.value=!1),Qe.value=!1,Ge.value=!1)}function ie(){const p=Q.value===0?wt:Q.value,M=Math.min(72,p+1);q("fontSize",M),x.value=String(M),v.value=!1}function K(){const p=Q.value===0?wt:Q.value,M=Math.max(5,p-1);q("fontSize",M),x.value=String(M),v.value=!1}function ne(p){var pe;const M=e.selection.value;if(!M)return!1;let G,Ce=!1;for(let fe=M.startCol;fe<=M.endCol&&!Ce;fe++)for(let be=M.startRow;be<=M.endRow&&!Ce;be++){const we=e.findMerge(fe,be);if(we&&(fe!==we.range.startCol||be!==we.range.startRow))continue;const Ne=(pe=e.cells[e.cellKey(fe,be)])==null?void 0:pe.style,tt=!!(Ne!=null&&Ne[p]);G===void 0?G=tt:tt!==G&&(Ce=!0)}return!Ce&&G===!0}const te=t.computed(()=>ne("fontWeight")),xe=t.computed(()=>ne("fontStyle")),Ee=t.computed(()=>ne("underline")),Ye=t.computed(()=>ne("strikethrough"));function et(){q("fontWeight",te.value?"":"bold")}function E(){q("fontStyle",xe.value?"":"italic")}function R(){q("underline",Ee.value?"":"underline")}function P(){q("strikethrough",Ye.value?"":"line-through")}const de=t.ref(""),le=t.ref(""),re=Qe,Y=Ge;function U(){re.value=!re.value,Y.value=!1,ze&&(ze.value=!1),_e&&(_e.value=!1)}function ye(){Y.value=!Y.value,re.value=!1,ze&&(ze.value=!1),_e&&(_e.value=!1)}function Re(p){ze&&(ze.value=p),p&&(re.value=!1,Y.value=!1,_e&&(_e.value=!1))}function Ke(p){de.value=p,q("color",p===""?"":p)}function $e(p){le.value=p,q("backgroundColor",p===""?"":p)}function B(){q("color",de.value===""?"":de.value)}function T(){q("backgroundColor",le.value===""?"":le.value)}const F=t.computed(()=>{var Ce;const p=e.selection.value;if(!p)return"";let M,G=!1;for(let pe=p.startCol;pe<=p.endCol&&!G;pe++)for(let fe=p.startRow;fe<=p.endRow&&!G;fe++){const be=e.findMerge(pe,fe);if(be&&(pe!==be.range.startCol||fe!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(pe,fe)])==null?void 0:Ce.style,Ne=typeof(we==null?void 0:we.color)=="string"?we.color:"";M===void 0?M=Ne:Ne!==M&&(G=!0)}return G?"":M??""}),J=t.computed(()=>{var Ce;const p=e.selection.value;if(!p)return"";let M,G=!1;for(let pe=p.startCol;pe<=p.endCol&&!G;pe++)for(let fe=p.startRow;fe<=p.endRow&&!G;fe++){const be=e.findMerge(pe,fe);if(be&&(pe!==be.range.startCol||fe!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(pe,fe)])==null?void 0:Ce.style,Ne=typeof(we==null?void 0:we.backgroundColor)=="string"?we.backgroundColor:"";M===void 0?M=Ne:Ne!==M&&(G=!0)}return G?"":M??""}),ae=t.computed(()=>Ho(e.locale.value)),ke=t.ref(!1),De=t.computed(()=>{var Ce;const p=e.selection.value;if(!p)return ll;let M,G=!1;for(let pe=p.startCol;pe<=p.endCol&&!G;pe++)for(let fe=p.startRow;fe<=p.endRow&&!G;fe++){const be=e.findMerge(pe,fe);if(be&&(pe!==be.range.startCol||fe!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(pe,fe)])==null?void 0:Ce.style,Ne=typeof(we==null?void 0:we.numberFormat)=="string"?we.numberFormat:"";M===void 0?M=Ne:Ne!==M&&(G=!0)}return G?tl:M??ll});function Ve(p){q("numberFormat",p)}function Ae(p){if(p===Ml){ke.value=!0;return}Ve(p)}function Oe(){ke.value=!0}return{undoStack:a,redoStack:l,cloneCells:d,takeSnap:f,restoreSnap:r,saveUndo:k,undo:C,redo:W,canUndo:$,canRedo:w,hasSelection:O,paintFmt:H,onPaintFormat:z,applyPaintFormat:ce,clearFormat:b,fontFamilyOptions:Z,fontSizeOptions:I,FONT_FAMILY_MIXED:j,selFontFamily:se,selFontSize:Q,applyStyleToSelection:q,onFontFamilyChange:ee,onFontSizeChange:Ze,hAlignOptions:ue,vAlignOptions:_,selHAlign:c,selVAlign:h,selWrap:Te,onHAlignChange:Fe,onVAlignChange:s,onWrapToggle:S,fontSizeInput:x,fontSizeMenuOpen:v,onFontSizeInput:y,onFontSizeBlur:D,onFontSizeKeydown:i,toggleFontSizeMenu:g,onFontSizeStepUp:ie,onFontSizeStepDown:K,selFontWeight:te,selFontStyle:xe,selUnderline:Ee,selStrikethrough:Ye,toggleFontWeight:et,toggleFontStyle:E,toggleUnderline:R,toggleStrikethrough:P,cachedTextColor:de,cachedFillColor:le,textColorMenuOpen:re,fillColorMenuOpen:Y,_toggleTextColorMenu:U,_toggleFillColorMenu:ye,onBorderMenuToggle:Re,onTextColorChange:Ke,onFillColorChange:$e,applyCachedTextColor:B,applyCachedFillColor:T,selTextColor:F,selFillColor:J,nfOptions:ae,selNumberFormat:De,NF_NUMBER_FORMAT_MIXED:tl,nfDialogOpen:ke,onNumberFormatChange:Ae,openNumberFormatDialog:Oe,applyNumberFormatCode:Ve}}function Zr(e,n){n.borderMenuOpen&&(e.borderMenuOpen=n.borderMenuOpen),n.mergeMenuOpen&&(e.mergeMenuOpen=n.mergeMenuOpen),(()=>{const l=e.borderMenuOpen,d=e.mergeMenuOpen;e.onBorderMenuToggle=f=>{l&&(l.value=f),f&&(e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1,d&&(d.value=!1))},e.toggleFontSizeMenu=f=>{f&&f.preventDefault(),e.fontSizeMenuOpen.value=!e.fontSizeMenuOpen.value,e.fontSizeMenuOpen.value&&(d&&(d.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),d&&(d.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,l&&(l.value=!1),d&&(d.value=!1)}})()}function qr(e,n){const a=t.ref("none"),l=t.ref(!1),d="#444";function f(s,S,x,v){const y=e.findMerge(S,x),D=y?y.range.endCol:S,i=y?y.range.endRow:x,g=y?y.range.startCol:S,K=(y?y.range.startRow:x)===v.startRow,ne=i===v.endRow,te=g===v.startCol,xe=D===v.endCol,Ee={top:0,bottom:0,left:0,right:0};switch(s){case"none":return Ee;case"bottom":ne&&(Ee.bottom=1);break;case"top":K&&(Ee.top=1);break;case"left":te&&(Ee.left=1);break;case"right":xe&&(Ee.right=1);break;case"all":Ee.top=1,Ee.bottom=1,Ee.left=1,Ee.right=1;break;case"outer":K&&(Ee.top=1),ne&&(Ee.bottom=1),te&&(Ee.left=1),xe&&(Ee.right=1);break;case"thickOuter":K&&(Ee.top=2),ne&&(Ee.bottom=2),te&&(Ee.left=2),xe&&(Ee.right=2);break}return Ee}function r(s,S,x,v,y){var Ee,Ye;if(s<0||S<0||s>=e.colCount||S>=e.rowCount)return;const D=e.findMerge(s,S);if(D&&(x==="Top"&&(s!==D.range.startCol||S!==D.range.startRow)||x==="Bottom"&&(s!==D.range.startCol||S!==D.range.endRow)||x==="Left"&&(s!==D.range.startCol||S!==D.range.startRow)||x==="Right"&&(s!==D.range.endCol||S!==D.range.startRow)))return;const i=D?D.anchor:e.cellKey(s,S),g=((Ee=e.cells[i])==null?void 0:Ee.value)??"",ie=(Ye=e.cells[i])!=null&&Ye.style?{...e.cells[i].style}:{},K=`border${x}Width`;v===0?y&&Reflect.deleteProperty(ie,K):(ie[K]=v,ie.borderColor=d),["Top","Bottom","Left","Right"].some(et=>ie[`border${et}Width`]!==void 0)||Reflect.deleteProperty(ie,"borderColor");const xe=Object.keys(ie).length?ie:null;g===""&&xe===null?e.delCell(i):e.cells[i]={value:g,style:xe}}function k(s,S){var K;const x=e.findMerge(s,S),v=x?x.anchor:e.cellKey(s,S),y=(K=e.cells[v])==null?void 0:K.style,D=(y==null?void 0:y.borderTopWidth)||0,i=(y==null?void 0:y.borderBottomWidth)||0,g=(y==null?void 0:y.borderLeftWidth)||0,ie=(y==null?void 0:y.borderRightWidth)||0;if(x){const ne=x.range.startRow,te=x.range.endRow,xe=x.range.startCol,Ee=x.range.endCol;r(xe,ne-1,"Bottom",D,!0),r(xe,te+1,"Top",i,!0),r(xe-1,ne,"Right",g,!0),r(Ee+1,ne,"Left",ie,!0)}else r(s,S-1,"Bottom",D,!0),r(s,S+1,"Top",i,!0),r(s-1,S,"Right",g,!0),r(s+1,S,"Left",ie,!0)}e.syncCellBorders=k;function C(s,S,x,v=!0){var xe,Ee;const y=e.findMerge(s,S),D=y?y.anchor:e.cellKey(s,S),i=((xe=e.cells[D])==null?void 0:xe.value)??"",g=(Ee=e.cells[D])!=null&&Ee.style?{...e.cells[D].style}:{},ie=["Top","Bottom","Left","Right"],K=[x.top,x.bottom,x.left,x.right];for(let Ye=0;Ye<4;Ye++){const et=`border${ie[Ye]}Width`;K[Ye]===0?v&&Reflect.deleteProperty(g,et):(g[et]=K[Ye],g.borderColor=d)}ie.some(Ye=>g[`border${Ye}Width`]!==void 0)||Reflect.deleteProperty(g,"borderColor");const te=Object.keys(g).length?g:null;i===""&&te===null?e.delCell(D):e.cells[D]={value:i,style:te},k(y?y.range.startCol:s,y?y.range.startRow:S)}function W(s){var x,v;a.value=s;const S=e.selection.value;if(S){if(n.saveUndo(),s==="none")for(let y=S.startCol;y<=S.endCol;y++)for(let D=S.startRow;D<=S.endRow;D++){const i=e.findMerge(y,D);i&&(y!==i.range.startCol||D!==i.range.startRow)||C(y,D,{top:0,bottom:0,left:0,right:0},!0)}else for(let y=S.startCol;y<=S.endCol;y++)for(let D=S.startRow;D<=S.endRow;D++){const i=e.findMerge(y,D);if(i&&(y!==i.range.startCol||D!==i.range.startRow))continue;const g=f(s,y,D,S);C(y,D,g,!1)}(x=e.scheduleRender)==null||x.call(e),(v=e.emitModelData)==null||v.call(e)}}function $(){W(a.value)}function w(s,S,x){var D,i;const v=e.findMerge(s,S);if(v){const g=(D=e.cells[v.anchor])==null?void 0:D.style;return x==="Top"&&S===v.range.startRow?(g==null?void 0:g.borderTopWidth)||0:x==="Bottom"&&S===v.range.endRow?(g==null?void 0:g.borderBottomWidth)||0:x==="Left"&&s===v.range.startCol?(g==null?void 0:g.borderLeftWidth)||0:x==="Right"&&s===v.range.endCol&&(g==null?void 0:g.borderRightWidth)||0}const y=(i=e.cells[e.cellKey(s,S)])==null?void 0:i.style;return(y==null?void 0:y[`border${x}Width`])||0}const O=t.ref(!1);function H(s){O.value=s,s&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,l.value=!1,n.fontSizeMenuOpen.value=!1)}function z(s,S,x,v){const y=[];for(const D in e.merges){const i=e.merges[D];i&&i.startCol<=x&&i.endCol>=s&&i.startRow<=v&&i.endRow>=S&&y.push(D)}for(const D of y)Reflect.deleteProperty(e.merges,D)}function ce(){var y,D,i,g;const s=e.selection.value;if(!s||s.startCol===s.endCol&&s.startRow===s.endRow)return;n.saveUndo(),z(s.startCol,s.startRow,s.endCol,s.endRow);const S=e.cellKey(s.startCol,s.startRow),x=((y=e.cells[S])==null?void 0:y.value)??"";for(let ie=s.startCol;ie<=s.endCol;ie++)for(let K=s.startRow;K<=s.endRow;K++)ie===s.startCol&&K===s.startRow||e.clearCellsInRange(ie,ie,K,K);const v=(D=e.cells[S])!=null&&D.style?{...e.cells[S].style}:{};v.textAlign="center",e.cells[S]={value:x,style:v},e.merges[S]={startCol:s.startCol,startRow:s.startRow,endCol:s.endCol,endRow:s.endRow},e.selectCell(s.startCol,s.startRow),(i=e.scheduleRender)==null||i.call(e),(g=e.emitModelData)==null||g.call(e)}function b(){var S,x,v;const s=e.selection.value;if(!(!s||s.startCol===s.endCol)){n.saveUndo();for(let y=s.startRow;y<=s.endRow;y++){z(s.startCol,y,s.endCol,y);const D=e.cellKey(s.startCol,y);(S=e.cells[D])==null||S.value;for(let i=s.startCol+1;i<=s.endCol;i++)e.clearCellsInRange(i,i,y,y);e.merges[D]={startCol:s.startCol,startRow:y,endCol:s.endCol,endRow:y}}e.selectRange(s.startCol,s.startRow,s.endCol,s.endRow),(x=e.scheduleRender)==null||x.call(e),(v=e.emitModelData)==null||v.call(e)}}function Z(){var x,v,y;const s=e.selection.value;if(!s||s.startCol===s.endCol&&s.startRow===s.endRow)return;n.saveUndo(),z(s.startCol,s.startRow,s.endCol,s.endRow);const S=e.cellKey(s.startCol,s.startRow);(x=e.cells[S])==null||x.value;for(let D=s.startCol;D<=s.endCol;D++)for(let i=s.startRow;i<=s.endRow;i++)D===s.startCol&&i===s.startRow||e.clearCellsInRange(D,D,i,i);e.merges[S]={startCol:s.startCol,startRow:s.startRow,endCol:s.endCol,endRow:s.endRow},e.selectCell(s.startCol,s.startRow),(v=e.scheduleRender)==null||v.call(e),(y=e.emitModelData)==null||y.call(e)}function I(){var S,x;const s=e.selection.value;s&&(n.saveUndo(),z(s.startCol,s.startRow,s.endCol,s.endRow),(S=e.scheduleRender)==null||S.call(e),(x=e.emitModelData)==null||x.call(e))}function j(){const s=e.selection.value;if(!s)return;const S=e.findMerge(s.startCol,s.startRow);S&&s.startCol===S.range.startCol&&s.startRow===S.range.startRow&&s.endCol===S.range.endCol&&s.endRow===S.range.endRow?I():ce()}function se(s){switch(s){case"mergeCenter":ce();break;case"mergeAcross":b();break;case"mergeCells":Z();break;case"unmergeCells":I();break}}let Q=null,q=[];function ee(s,S,x,v){var y;q=[];for(let D=x;D<=v;D++){const i=[];for(let g=s;g<=S;g++){const ie=(y=e.cells[e.cellKey(g,D)])==null?void 0:y.style;i.push(ie?{...ie}:null)}q.push(i)}}function he(s,S,x,v){const y=e.cellKey(s,S);if(Cl(),x===""||x==null){e.formulaDeps.clear(y),v?e.cells[y]={value:"",style:{...v}}:e.delCell(y),e.formulaDeps.markDirty(y);return}e.cells[y]={value:x,style:v?{...v}:null},x.startsWith("=")?e.formulaDeps.set(y,bl(x.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(y),e.formulaDeps.markDirty(y)}function ze(){const s=e.selection.value;if(!s)return;Q={...s},ee(s.startCol,s.endCol,s.startRow,s.endRow);const S=[];for(let x=s.startRow;x<=s.endRow;x++){const v=[];for(let y=s.startCol;y<=s.endCol;y++)v.push(e.getCellRaw(y,x));S.push(v.join(" "))}hl(S.join(`
|
|
4
|
-
`))}function
|
|
5
|
-
`))}else if(
|
|
6
|
-
`))}}}async function Qe(){var D;let s;try{s=await navigator.clipboard.readText()}catch{return}if(!s&&s!=="")return;const S=s.split(/\r?\n/),x=e.activeCell.value,v=Q,y=v&&q.length>0;for(let i=0;i<S.length;i++){const g=S[i].split(" ");for(let ie=0;ie<g.length;ie++){const K=x.col+ie,ne=x.row+i;if(K<e.colCount&&ne<e.rowCount){let te=g[ie];if(te.startsWith("=")&&v&&(te=Pr(te,K-(v.startCol+ie),ne-(v.startRow+i),e.colCount,e.rowCount,rt)),y&&i<q.length&&ie<(((D=q[i])==null?void 0:D.length)??0)){const xe=q[i][ie]??null;he(K,ne,te,xe),k(K,ne)}else e.setCellValue(K,ne,te)}}}}function Ge(){var s;if(n.saveUndo(),ze(),e.selection.value){const S=e.selection.value;e.clearCellsInRange(S.startCol,S.endCol,S.startRow,S.endRow),(s=e.scheduleRender)==null||s.call(e)}}function Ze(){var s;if(e.selection.value){const S=e.selection.value;e.clearCellsInRange(S.startCol,S.endCol,S.startRow,S.endRow),(s=e.scheduleRender)==null||s.call(e)}}function ue(){var D,i;const s=e.selection.value;if(!s)return;n.saveUndo();const S=s.startCol,x=s.startRow,v=s.endCol,y=s.endRow;if(x===y)if(v+1<e.colCount){const g=`${rt(S)}${x+1}:${rt(v)}${x+1}`;e.setCellValue(v+1,x,`=SUM(${g})`)}else{const g=`${rt(S)}${x+1}:${rt(v-1)}${x+1}`;e.setCellValue(v,x,`=SUM(${g})`)}else for(let g=S;g<=v;g++)if(y+1<e.rowCount){const ie=`${rt(g)}${x+1}:${rt(g)}${y+1}`;e.setCellValue(g,y+1,`=SUM(${ie})`)}else{const ie=`${rt(g)}${x+1}:${rt(g)}${y}`;e.setCellValue(g,y,`=SUM(${ie})`)}(D=e.scheduleRender)==null||D.call(e),(i=e.emitModelData)==null||i.call(e)}function _(){var D,i;const s=e.selection.value;if(!s)return;n.saveUndo();const S=s.startCol,x=s.startRow,v=s.endCol,y=s.endRow;if(x===y)if(v+1<e.colCount){const g=`${rt(S)}${x+1}:${rt(v)}${x+1}`;e.setCellValue(v+1,x,`=AVERAGE(${g})`)}else{const g=`${rt(S)}${x+1}:${rt(v-1)}${x+1}`;e.setCellValue(v,x,`=AVERAGE(${g})`)}else for(let g=S;g<=v;g++)if(y+1<e.rowCount){const ie=`${rt(g)}${x+1}:${rt(g)}${y+1}`;e.setCellValue(g,y+1,`=AVERAGE(${ie})`)}else{const ie=`${rt(g)}${x+1}:${rt(g)}${y}`;e.setCellValue(g,y,`=AVERAGE(${ie})`)}(D=e.scheduleRender)==null||D.call(e),(i=e.emitModelData)==null||i.call(e)}const c=t.ref(!1);function h(s){c.value=s,s&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,l.value=!1,n.fontSizeMenuOpen.value=!1,O.value=!1)}function Te(){ue(),c.value=!1}function Fe(){_(),c.value=!1}return{cachedBorder:a,borderMenuOpen:l,BORDER_COLOR:d,borderTypeToWidths:f,onBorderChange:W,setCellBorderSide:r,syncCellBorders:k,applyBorderToCell:C,applyCachedBorder:$,cellBorderWidth:w,mergeMenuOpen:O,onMergeMenuToggle:H,removeOverlappingMerges:z,mergeAndCenter:ce,mergeAcross:b,mergeCells:Z,unmergeCells:I,onApplyMerge:j,onMergeChange:se,copySourceRange:null,copySourceStyles:[],captureStyles:ee,setCellWithStyle:he,copyToClipboard:ze,copyRowCol:_e,pasteFromClipboard:Qe,cutSelected:Ge,clearSelected:Ze,sumSelected:ue,avgSelected:_,calcMenuOpen:c,onCalcMenuToggle:h,onCalcSum:Te,onCalcAvg:Fe}}function Jr(e,n,a,l){const d={},f=l(n),r=l(a);return f!=null&&(d.width=`${f}px`),r!=null&&(d.height=`${r}px`),d["--sp-formula-bar-bg"]=e.formulaBarBg,d["--sp-formula-bar-border"]=e.formulaBarBorder,d["--sp-formula-bar-label-color"]=e.formulaBarLabelText,d["--sp-formula-bar-label-bg"]=e.formulaBarLabelBg,d["--sp-formula-bar-label-border"]=e.formulaBarLabelBorder,d["--sp-formula-bar-input-bg"]=e.formulaBarInputBg,d["--sp-formula-bar-input-border"]=e.formulaBarInputBorder,d["--sp-formula-bar-input-color"]=e.formulaBarInputText,d["--sp-formula-bar-input-focus-border"]=e.formulaBarInputFocusBorder,d["--sp-formula-bar-input-focus-shadow"]=e.formulaBarInputFocusShadow,d["--sp-wrapper-bg"]=e.wrapperBg,d["--sp-cell-editor-border"]=e.cellEditorBorder,d["--sp-cell-editor-color"]=e.cellEditorText,d["--sp-cell-editor-bg"]=e.cellEditorBg,d["--sp-cell-editor-shadow"]=e.cellEditorShadow,d["--sp-tab-bar-bg"]=e.tabBarBg,d["--sp-tab-bar-border"]=e.tabBarBorder,d["--sp-tab-active-bg"]=e.tabActiveBg,d["--sp-tab-active-color"]=e.tabActiveText,d["--sp-tab-active-border"]=e.tabActiveBorder,d["--sp-tab-inactive-bg"]=e.tabInactiveBg,d["--sp-tab-inactive-color"]=e.tabInactiveText,d["--sp-tab-inactive-border"]=e.tabInactiveBorder,d["--sp-tab-hover-bg"]=e.tabHoverBg,d["--sp-tab-add-btn-color"]=e.tabAddBtnColor,d["--sp-tab-add-btn-hover-bg"]=e.tabAddBtnHoverBg,d["--sp-tab-scroll-btn-color"]=e.tabScrollBtnColor,d["--sp-tab-scroll-btn-hover-bg"]=e.tabScrollBtnHoverBg,d["--sp-scroll-thumb"]=e.scrollbarThumb,d["--sp-scroll-thumb-hover"]=e.scrollbarThumbHover,d["--sp-scroll-btn-bg"]=e.scrollBtnBg,d["--sp-scroll-btn-color"]=e.scrollBtnColor,d["--sp-scroll-btn-hover-bg"]=e.scrollBtnHoverBg,d["--sp-scroll-btn-active-bg"]=e.scrollBtnActiveBg,d["--sp-scroll-track-bg"]=e.scrollTrackBg,d["--sp-toolbar-bg"]=e.toolbarBg,d["--sp-toolbar-border"]=e.toolbarBorder,d["--sp-toolbar-btn-color"]=e.toolbarBtnColor,d["--sp-toolbar-btn-hover-bg"]=e.toolbarBtnHoverBg,d["--sp-toolbar-btn-disabled-color"]=e.toolbarBtnDisabledColor,d["--sp-toolbar-btn-active-color"]=e.toolbarBtnActiveColor,d}function Qr(e,n,a,l,d){function f(E,R){var le,re;const P=R-E+1,de=$(E,R);for(let Y=E;Y<=R;Y++)for(let U=0;U<e.colCount;U++)e.delCell(e.cellKey(U,Y));for(let Y=E;Y<e.rowCount-P;Y++){for(let U=0;U<e.colCount;U++){const ye=e.cellKey(U,Y+P),Re=e.cellKey(U,Y);e.cells[ye]?(e.cells[Re]=e.cells[ye],e.delCell(ye)):e.delCell(Re)}e.rowHeights.value[Y]=e.rowHeights.value[Y+P]}for(let Y=e.rowCount-P;Y<e.rowCount;Y++){for(let U=0;U<e.colCount;U++)e.delCell(e.cellKey(U,Y));e.rowHeights.value[Y]=void 0}if(W(de),E>0)for(let Y=0;Y<e.colCount;Y++)(le=e.syncCellBorders)==null||le.call(e,Y,E-1),(re=e.syncCellBorders)==null||re.call(e,Y,E)}function r(E,R){const P=R-E+1;if(R>=e.rowCount-1)return;const de=O(E,R);for(let le=e.rowCount-1;le>R;le--){for(let re=0;re<e.colCount;re++){const Y=e.cellKey(re,le-P),U=e.cellKey(re,le);e.cells[Y]?e.cells[U]=e.cells[Y]:e.delCell(U)}e.rowHeights.value[le]=e.rowHeights.value[le-P]}for(let le=R+1;le<=R+P;le++){for(let re=0;re<e.colCount;re++)e.delCell(e.cellKey(re,le));e.rowHeights.value[le]=void 0}W(de)}function k(E,R){const P=R-E+1;if(R>=e.colCount-1)return;const de=H(E,R);for(let le=e.colCount-1;le>R;le--){for(let re=0;re<e.rowCount;re++){const Y=e.cellKey(le-P,re),U=e.cellKey(le,re);e.cells[Y]?e.cells[U]=e.cells[Y]:e.delCell(U)}e.colWidths.value[le]=e.colWidths.value[le-P]}for(let le=R+1;le<=R+P;le++){for(let re=0;re<e.rowCount;re++)e.delCell(e.cellKey(le,re));e.colWidths.value[le]=100}W(de)}function C(E,R){var le,re;const P=R-E+1,de=w(E,R);for(let Y=E;Y<=R;Y++)for(let U=0;U<e.rowCount;U++)e.delCell(e.cellKey(Y,U));for(let Y=E;Y<e.colCount-P;Y++){for(let U=0;U<e.rowCount;U++){const ye=e.cellKey(Y+P,U),Re=e.cellKey(Y,U);e.cells[ye]?(e.cells[Re]=e.cells[ye],e.delCell(ye)):e.delCell(Re)}e.colWidths.value[Y]=e.colWidths.value[Y+P]}for(let Y=e.colCount-P;Y<e.colCount;Y++){for(let U=0;U<e.rowCount;U++)e.delCell(e.cellKey(Y,U));e.colWidths.value[Y]=100}if(W(de),E>0)for(let Y=0;Y<e.rowCount;Y++)(le=e.syncCellBorders)==null||le.call(e,E-1,Y),(re=e.syncCellBorders)==null||re.call(e,E,Y)}function W(E){Object.keys(e.merges).forEach(R=>Reflect.deleteProperty(e.merges,R));for(const R of E)if(!(R.newRange.startCol>R.newRange.endCol||R.newRange.startRow>R.newRange.endRow)&&(e.merges[R.newAnchorKey]={...R.newRange},R.anchorCell)){const P=R.anchorCell.value,de=R.anchorCell.style;P===""&&(!de||Object.keys(de).length===0)||(e.cells[R.newAnchorKey]={value:P,style:de&&Object.keys(de).length?{...de}:null})}}function $(E,R){const P=R-E+1,de=[];for(const le in e.merges){const re=e.merges[le];if(!re)continue;const Y=e.cells[le]?{value:e.cells[le].value,style:e.cells[le].style?{...e.cells[le].style}:null}:{value:"",style:null},{startCol:U,endCol:ye}=re;let{startRow:Re,endRow:Ke}=re;if(Re>R){Re-=P,Ke-=P,de.push({newAnchorKey:e.cellKey(U,Re),newRange:{startCol:U,startRow:Re,endCol:ye,endRow:Ke}});continue}if(Ke<E){de.push({newAnchorKey:le,newRange:{startCol:U,startRow:Re,endCol:ye,endRow:Ke}});continue}if(Re>=E&&Ke<=R||(Re>=E&&Re<=R&&(Re=E),Ke>=E&&Ke<=R?Ke=E-1:Ke>R&&(Ke-=P),Re>Ke))continue;const $e=U,B=Re,T=e.cellKey($e,B),J=le.split(",").map(Number)[1],ae=J>=E&&J<=R||$e!==re.startCol||B!==J;de.push({newAnchorKey:T,newRange:{startCol:U,startRow:Re,endCol:ye,endRow:Ke},anchorCell:ae?Y:void 0})}return de}function w(E,R){const P=R-E+1,de=[];for(const le in e.merges){const re=e.merges[le];if(!re)continue;const Y=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:ye}=re;const{startRow:Re,endRow:Ke}=re;if(U>R){U-=P,ye-=P,de.push({newAnchorKey:e.cellKey(U,Re),newRange:{startCol:U,startRow:Re,endCol:ye,endRow:Ke}});continue}if(ye<E){de.push({newAnchorKey:le,newRange:{startCol:U,startRow:Re,endCol:ye,endRow:Ke}});continue}if(U>=E&&ye<=R||(U>=E&&U<=R&&(U=E),ye>=E&&ye<=R?ye=E-1:ye>R&&(ye-=P),U>ye))continue;const $e=U,B=Re,T=e.cellKey($e,B),J=le.split(",").map(Number)[0],ae=J>=E&&J<=R||$e!==J||B!==re.startRow;de.push({newAnchorKey:T,newRange:{startCol:U,startRow:Re,endCol:ye,endRow:Ke},anchorCell:ae?Y:void 0})}return de}function O(E,R){const P=R-E+1,de=[];for(const le in e.merges){const re=e.merges[le];if(!re)continue;const{startCol:Y,endCol:U}=re;let{startRow:ye,endRow:Re}=re;Re<E?de.push({newAnchorKey:le,newRange:{startCol:Y,startRow:ye,endCol:U,endRow:Re}}):ye>R?(ye+=P,Re+=P,de.push({newAnchorKey:e.cellKey(Y,ye),newRange:{startCol:Y,startRow:ye,endCol:U,endRow:Re}})):(Re+=P,de.push({newAnchorKey:le,newRange:{startCol:Y,startRow:ye,endCol:U,endRow:Re}}))}return de}function H(E,R){const P=R-E+1,de=[];for(const le in e.merges){const re=e.merges[le];if(!re)continue;let{startCol:Y,endCol:U}=re;const{startRow:ye,endRow:Re}=re;U<E?de.push({newAnchorKey:le,newRange:{startCol:Y,startRow:ye,endCol:U,endRow:Re}}):Y>R?(Y+=P,U+=P,de.push({newAnchorKey:e.cellKey(Y,ye),newRange:{startCol:Y,startRow:ye,endCol:U,endRow:Re}})):(U+=P,de.push({newAnchorKey:le,newRange:{startCol:Y,startRow:ye,endCol:U,endRow:Re}}))}return de}let z=0;function ce(){return z++,`s_${z}`}function b(E){return{id:ce(),name:E,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 Z=t.ref([b("Sheet1")]),I=t.ref(0);function j(){const E=Z.value[I.value];E&&(E.cells={...e.cells},E.merges={...e.merges},E.selection=e.selection.value?{...e.selection.value}:null,E.activeCell={...e.activeCell.value},E.scrollX=e.scrollX.value,E.scrollY=e.scrollY.value,E.colWidths=[...e.colWidths.value],E.rowHeights=[...e.rowHeights.value])}function se(E){const R=Z.value[E];R&&(Object.keys(e.cells).forEach(P=>e.delCell(P)),Object.assign(e.cells,R.cells),Object.keys(e.merges).forEach(P=>Reflect.deleteProperty(e.merges,P)),R.merges&&Object.assign(e.merges,R.merges),e.selection.value=R.selection?{...R.selection}:null,e.activeCell.value={...R.activeCell},e.scrollX.value=R.scrollX,e.scrollY.value=R.scrollY,e.colWidths.value=[...R.colWidths],e.rowHeights.value=[...R.rowHeights],I.value=E)}function Q(E){E===I.value||E<0||E>=Z.value.length||(e.cancelEdit(),j(),se(E))}function q(E){return n.saveUndo(),e.cancelEdit(),j(),Z.value.push(b(E??`Sheet${Z.value.length+1}`)),se(Z.value.length-1),Z.value.length-1}function ee(E){return Z.value.length<=1||(n.saveUndo(),e.cancelEdit(),Z.value.splice(E,1),se(Math.min(E,Z.value.length-1))),I.value}function he(E,R){Z.value[E]&&R.trim()&&(n.saveUndo(),Z.value[E].name=R.trim())}function ze(E){n.saveUndo(),e.cancelEdit(),j();const R=Z.value[E];if(!R)return E;let P=R.name;const de=P.match(/^(.*?)\s*\((\d+)\)$/);let le=de?parseInt(de[2],10)+1:2;de&&(P=de[1]);let re=`${P} (${le})`;const Y=new Set(Z.value.map(ye=>ye.name));for(;Y.has(re);)le++,re=`${P} (${le})`;const U={id:ce(),name:re,cells:{...R.cells},merges:R.merges?{...R.merges}:{},selection:R.selection?{...R.selection}:null,activeCell:R.activeCell?{...R.activeCell}:{col:0,row:0},scrollX:R.scrollX,scrollY:R.scrollY,colWidths:[...R.colWidths],rowHeights:[...R.rowHeights]};return Z.value.splice(E+1,0,U),se(E+1),E+1}function _e(E,R){var re;const P=E+R;if(P<0||P>=Z.value.length)return;n.saveUndo();const de=I.value,le=Z.value.splice(E,1)[0];Z.value.splice(P,0,le),de===E?I.value=P:E<de&&P>=de?I.value=de-1:E>de&&P<=de&&(I.value=de+1),(re=e.scheduleRender)==null||re.call(e)}const Qe=t.computed(()=>Z.value.length);let Ge="";const Ze=a;function ue(){j();const E=Z.value.map(P=>{const de={};for(const[U,ye]of Object.entries(P.cells))de[U]={value:ye.value},ye.style&&(de[U].style=ye.style);const le={name:P.name,cells:de};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 Y={};for(let U=0;U<P.rowHeights.length;U++){const ye=P.rowHeights[U];ye!=null&&(Y[U]=ye)}return Object.keys(Y).length&&(le.rowHeights=Y),le}),R=JSON.stringify(E);R!==Ge&&(Ge=R,Ze.value=E,d&&(d.value=R))}e.emitModelData=ue;let _=!1;function c(){_||(_=!0,Promise.resolve().then(()=>{_=!1,ue()}))}const h=t.computed(()=>e.props.theme==="dark"?mo:fo),Te=t.computed(()=>Jr(h.value,e.props.width,e.props.height,At)),Fe=t.computed(()=>{const E={};for(const[R,P]of Object.entries(Te.value))R.startsWith("--")&&(E[R]=P);return E}),s=t.ref(null),S=t.ref(null),x=t.ref(null),v=t.ref(null),y=t.reactive({w:800,h:600});e.viewSize&&t.watch(y,E=>{e.viewSize&&(e.viewSize.w=E.w,e.viewSize.h=E.h)},{deep:!0});const D=48,i=28,g=11,ie=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,y.w-D-g))),K=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,y.h-i-g)));function ne(E,R){const P=Math.max(0,y.w-D-g),de=Math.max(0,y.h-i-g);e.scrollX.value=Math.max(0,Math.min(E??e.scrollX.value,Math.max(0,e.totalWidth.value-P))),e.scrollY.value=Math.max(0,Math.min(R??e.scrollY.value,Math.max(0,e.totalHeight.value-de)))}e.clampScroll=ne;function te(){var E;return typeof window>"u"?!1:!((E=window.matchMedia)!=null&&E.call(window,"(hover: none) and (pointer: coarse)").matches)}function xe(E=!1){t.nextTick(()=>{const R=x.value;if(R){if(!e.editingCell.value&&!te()){document.activeElement===R&&R.blur();return}R.focus({preventScroll:!0}),E&&R.select()}})}function Ee(){xe()}function Ye(){var R;const E=e.selection.value;if(E){n.saveUndo();for(let P=E.startRow;P<=E.endRow;P++)e.rowHeights.value[P]=void 0;(R=e.scheduleRender)==null||R.call(e),ue()}}function et(){var R;const E=e.selection.value;if(E){n.saveUndo();for(let P=E.startCol;P<=E.endCol;P++)e.colWidths.value[P]=100;(R=e.scheduleRender)==null||R.call(e),ue()}}return{deleteRows:f,insertRows:r,insertCols:k,deleteCols:C,sheets:Z,activeSheetIndex:I,saveSheet:j,loadSheet:se,switchSheet:Q,addSheet:q,removeSheet:ee,renameSheet:he,dupSheet:ze,moveSheet:_e,sheetCount:Qe,mkSheet:b,emitModelData:ue,scheduleOptEmit:c,themeColors:h,outerStyle:Te,toolbarThemeVars:Fe,wrapperRef:s,canvasRef:S,editInputRef:x,formulaBarRef:v,viewSize:y,maxScrollX:ie,maxScrollY:K,clampScroll:ne,canFocusHiddenEditor:te,focusEditInput:xe,onCanvasFocus:Ee,resetRowHeight:Ye,resetColWidth:et,modelData:Ze}}function ea(e,n,a,l,d){let f=!1,r=null,k=1;function C(){f||(f=!0,requestAnimationFrame(()=>{f=!1,$()}))}e.scheduleRender=C;const W="#444";function $(){var El,It,Zt,Mt,Tt,qt,Yl,Xl,jl,Zl,ql;const o=l.canvasRef.value;if(!o)return;const u=l.wrapperRef.value;if(!u||(r=o.getContext("2d"),!r))return;k=window.devicePixelRatio||1;const V=u.getBoundingClientRect(),L=V.width,m=V.height;l.viewSize.w=L,l.viewSize.h=m,o.width=L*k,o.height=m*k,o.style.width=L+"px",o.style.height=m+"px",r.setTransform(k,0,0,k,0,0);const N=e.scrollX.value,me=e.scrollY.value,ve=52,ge=24,He=l.themeColors.value,st=e.colPositions.value,lt=e.rowPositions.value,ht=e.colWidths.value,mt=[];for(let X=0;X<e.rowCount;X++)mt[X]=lt[X+1]-lt[X];const Rt=Math.max(0,e.hitCol(N));let $t=Rt;for(let X=Rt;X<e.colCount&&!(ve+st[X]-N>=L);X++)$t=X;const Bt=$t,vt=Math.max(0,e.hitRow(me));let rl=vt;for(let X=vt;X<e.rowCount&&!(ge+lt[X]-me>=m);X++)rl=X;const bt=rl;let Ot=Rt,Lt=vt;for(const X in e.merges){const oe=e.merges[X];oe&&(oe.startRow>bt||oe.endRow<vt||oe.startCol>Bt||oe.endCol<Rt||(oe.startCol<Ot&&(Ot=oe.startCol),oe.startRow<Lt&&(Lt=oe.startRow)))}r.fillStyle=He.bg,r.fillRect(0,0,L,m),r.fillStyle=He.gridBg,r.fillRect(ve,ge,L-ve,m-ge),r.save(),r.beginPath(),r.rect(ve,ge,L-ve,m-ge),r.clip();const ft=e.selection.value,jt=e.editingCell.value;for(let X=Lt;X<=bt;X++)for(let oe=Ot;oe<=Bt;oe++){const Me=e.findMerge(oe,X);if(Me&&!(oe===Me.range.startCol&&X===Me.range.startRow))continue;const Le=ve+st[oe]-N,Ie=ge+lt[X]-me;let Ue=ht[oe],Xe=mt[X];if(Me&&(Ue=st[Me.range.endCol+1]-st[oe],Xe=lt[Me.range.endRow+1]-lt[X]),Le+Ue<ve||Ie+Xe<ge||Le>L||Ie>m)continue;const qe=(El=e.cells[e.cellKey(oe,X)])==null?void 0:El.style,xt=typeof(qe==null?void 0:qe.backgroundColor)=="string"?qe.backgroundColor:"";if(xt&&(r.fillStyle=xt,r.fillRect(Le,Ie,Ue,Xe)),e.isSelected(oe,X)&&(r.fillStyle=He.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?r.fillRect(Le,Ie,ht[oe],mt[X]):r.fillRect(Le,Ie,Ue,Xe)),e.activeCell.value.col===oe&&e.activeCell.value.row===X&&(r.strokeStyle=He.activeCellBorder,r.lineWidth=2,r.strokeRect(Le+1,Ie+1,Ue-2,Xe-2)),r.strokeStyle=He.gridLine,r.lineWidth=.5,r.strokeRect(Le+.25,Ie+.25,Ue-.5,Xe-.5),!(jt&&jt.col===oe&&jt.row===X)){const Be=(It=e.cells[e.cellKey(oe,X)])==null?void 0:It.style,yt=e.getCellValue(oe,X),it=typeof(Be==null?void 0:Be.numberFormat)=="string"?Be.numberFormat:"",Pe=yt?ml(yt,it,e.locale.value):"";if(Pe){const ot=e.cellFontSize(oe,X),Je=typeof(Be==null?void 0:Be.fontFamily)=="string"&&Be.fontFamily?Be.fontFamily:Ut,ut=(Be==null?void 0:Be.fontWeight)==="bold"?"bold":"normal",We=(Be==null?void 0:Be.fontStyle)==="italic"?"italic":"normal",pt=(Be==null?void 0:Be.underline)==="underline",Ct=(Be==null?void 0:Be.strikethrough)==="line-through",nt=typeof(Be==null?void 0:Be.color)=="string"?Be.color:"",Gt=typeof(Be==null?void 0:Be.textAlign)=="string"?Be.textAlign:Ol(yt,it)?"right":"left",Jt=typeof(Be==null?void 0:Be.verticalAlign)=="string"?Be.verticalAlign:"top";r.fillStyle=nt||He.cellText,r.font=`${We} ${ut} ${ot}px ${Je}`,r.textBaseline="alphabetic",r.save(),r.beginPath(),r.rect(Le+5,Ie+1,Ue-10,Xe-2),r.clip();const Qt=(Be==null?void 0:Be.wrap)==="wrap",al=Ue-10;let Rl=Pe;const Va=!Qt&&Do(it),Jl=Pe===fl||To(yt,it);if(Jl||Va){if(Jl){const Wt=Math.max(1,r.measureText("#").width),el=Math.max(1,Math.floor(al/Wt));Rl="#".repeat(el)}else if(e.getWrappedLines(r,Pe,1e9,!1).some(St=>St&&r.measureText(St).width>al)){const St=Math.max(1,r.measureText("#").width),Kt=Math.max(1,Math.floor(al/St));Rl="#".repeat(Kt)}}const il=e.getWrappedLines(r,Rl,al,Qt),{ascent:cl,descent:sl}=e.measureFontMetrics(Je,ot,ut,We),dl=cl+sl,Oa=il.length*dl;let ul;Jt==="middle"?ul=Ie+(Xe-Oa)/2+cl:Jt==="bottom"?ul=Ie+Xe-e.BASE_CELL_VPAD-sl-(il.length-1)*dl:ul=Ie+e.BASE_CELL_VPAD+cl;for(let Wt=0;Wt<il.length;Wt++){const el=il[Wt],St=ul+Wt*dl,Kt=r.measureText(el);let Nt;if(Gt==="center"?Nt=Le+Ue/2-Kt.width/2:Gt==="right"?Nt=Le+Ue-5-Kt.width:Nt=Le+5,r.fillText(el,Nt,St),pt&&(r.strokeStyle=nt||He.cellText,r.lineWidth=1,r.beginPath(),r.moveTo(Nt,St+sl+1),r.lineTo(Nt+Kt.width,St+sl+1),r.stroke()),Ct){r.strokeStyle=nt||He.cellText,r.lineWidth=1;const Ql=St-cl+dl*.42;r.beginPath(),r.moveTo(Nt,Ql),r.lineTo(Nt+Kt.width,Ql),r.stroke()}}r.restore()}}}for(let X=Lt;X<=bt;X++)for(let oe=Ot;oe<=Bt;oe++){const Me=e.findMerge(oe,X);if(Me&&!(oe===Me.range.startCol&&X===Me.range.startRow))continue;const Le=ve+st[oe]-N,Ie=ge+lt[X]-me;let Ue=ht[oe],Xe=mt[X];if(Me&&(Ue=st[Me.range.endCol+1]-st[oe],Xe=lt[Me.range.endRow+1]-lt[X]),Le+Ue<ve||Ie+Xe<ge||Le>L||Ie>m)continue;const qe=(Zt=e.cells[e.cellKey(oe,X)])==null?void 0:Zt.style,xt=(qe==null?void 0:qe.borderTopWidth)||0,Be=(qe==null?void 0:qe.borderLeftWidth)||0,yt=(qe==null?void 0:qe.borderBottomWidth)||0,it=(qe==null?void 0:qe.borderRightWidth)||0;if(r.fillStyle=W,Me){const Pe=Me.range.startRow,ot=Me.range.endRow,Je=Me.range.startCol,ut=Me.range.endCol;for(let We=Je;We<=ut;We++){const pt=ve+st[We]-N,Ct=ht[We],nt=Math.max(xt,a.cellBorderWidth(We,Pe-1,"Bottom"));nt>0&&r.fillRect(pt,Ie,Ct,nt)}for(let We=Je;We<=ut;We++){const pt=ve+st[We]-N,Ct=ht[We],nt=Math.max(yt,a.cellBorderWidth(We,ot+1,"Top"));nt>0&&r.fillRect(pt,Ie+Xe-nt,Ct,nt)}for(let We=Pe;We<=ot;We++){const pt=ge+lt[We]-me,Ct=mt[We],nt=Math.max(Be,a.cellBorderWidth(Je-1,We,"Right"));nt>0&&r.fillRect(Le,pt,nt,Ct)}for(let We=Pe;We<=ot;We++){const pt=ge+lt[We]-me,Ct=mt[We],nt=Math.max(it,a.cellBorderWidth(ut+1,We,"Left"));nt>0&&r.fillRect(Le+Ue-nt,pt,nt,Ct)}}else{const Pe=Math.max(xt,a.cellBorderWidth(oe,X-1,"Bottom")),ot=Math.max(Be,a.cellBorderWidth(oe-1,X,"Right")),Je=Math.max(yt,a.cellBorderWidth(oe,X+1,"Top")),ut=Math.max(it,a.cellBorderWidth(oe+1,X,"Left"));(Pe>0||ot>0||Je>0||ut>0)&&(Pe>0&&r.fillRect(Le,Ie,Ue,Pe),Je>0&&r.fillRect(Le,Ie+Xe-Je,Ue,Je),ot>0&&r.fillRect(Le,Ie,ot,Xe),ut>0&&r.fillRect(Le+Ue-ut,Ie,ut,Xe))}}for(let X=Lt;X<=bt;X++)for(let oe=Ot;oe<=Bt;oe++){const Me=e.findMerge(oe,X);if(Me&&!(oe===Me.range.startCol&&X===Me.range.startRow))continue;const Le=ve+st[oe]-N,Ie=ge+lt[X]-me;let Ue=ht[oe],Xe=mt[X];if(Me&&(Ue=st[Me.range.endCol+1]-st[oe],Xe=lt[Me.range.endRow+1]-lt[X]),Le+Ue<ve||Ie+Xe<ge||Le>L||Ie>m)continue;const qe=((Tt=(Mt=e.cells[e.cellKey(oe,X)])==null?void 0:Mt.style)==null?void 0:Tt.borderTopWidth)||0,xt=((Yl=(qt=e.cells[e.cellKey(oe,X)])==null?void 0:qt.style)==null?void 0:Yl.borderLeftWidth)||0,Be=((jl=(Xl=e.cells[e.cellKey(oe,X)])==null?void 0:Xl.style)==null?void 0:jl.borderBottomWidth)||0,yt=((ql=(Zl=e.cells[e.cellKey(oe,X)])==null?void 0:Zl.style)==null?void 0:ql.borderRightWidth)||0;if(r.fillStyle=W,Me){const it=Me.range.startRow,Pe=Me.range.endRow,ot=Me.range.startCol,Je=Me.range.endCol,ut=Math.max(qe,a.cellBorderWidth(ot,it-1,"Bottom")),We=Math.max(xt,a.cellBorderWidth(ot-1,it,"Right"));ut>0&&We>0&&r.fillRect(Le-We,Ie-ut,We,ut);const pt=Math.max(qe,a.cellBorderWidth(Je,it-1,"Bottom")),Ct=Math.max(yt,a.cellBorderWidth(Je+1,it,"Left"));pt>0&&Ct>0&&r.fillRect(Le+Ue,Ie-pt,Ct,pt);const nt=Math.max(Be,a.cellBorderWidth(ot,Pe+1,"Top")),Gt=Math.max(xt,a.cellBorderWidth(ot-1,Pe,"Right"));nt>0&&Gt>0&&r.fillRect(Le-Gt,Ie+Xe,Gt,nt);const Jt=Math.max(Be,a.cellBorderWidth(Je,Pe+1,"Top")),Qt=Math.max(yt,a.cellBorderWidth(Je+1,Pe,"Left"));Jt>0&&Qt>0&&r.fillRect(Le+Ue,Ie+Xe,Qt,Jt)}else{const it=Math.max(qe,a.cellBorderWidth(oe,X-1,"Bottom")),Pe=Math.max(xt,a.cellBorderWidth(oe-1,X,"Right")),ot=Math.max(Be,a.cellBorderWidth(oe,X+1,"Top")),Je=Math.max(yt,a.cellBorderWidth(oe+1,X,"Left"));it>0&&Pe>0&&r.fillRect(Le-Pe,Ie-it,Pe,it),it>0&&Je>0&&r.fillRect(Le+Ue,Ie-it,Je,it),ot>0&&Pe>0&&r.fillRect(Le-Pe,Ie+Xe,Pe,ot),ot>0&&Je>0&&r.fillRect(Le+Ue,Ie+Xe,Je,ot)}}r.restore(),r.fillStyle=He.headerBg,r.fillRect(ve,0,L-ve,ge);for(let X=Rt;X<=Bt;X++){const oe=ve+st[X]-N,Me=ht[X];oe+Me<ve||oe>L||(ft&&X>=ft.startCol&&X<=ft.endCol&&(r.fillStyle=He.selectionBg,r.fillRect(oe,0,Me,ge)),r.strokeStyle=He.headerBorder,r.lineWidth=.5,r.strokeRect(oe+.25,.25,Me-.5,ge-.5),ft&&X>=ft.startCol&&X<=ft.endCol&&(r.strokeStyle=He.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(oe,ge-1),r.lineTo(oe+Me,ge-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(rt(X),oe+Me/2,ge/2))}r.strokeStyle=He.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(ve,ge+.5),r.lineTo(L,ge+.5),r.stroke(),r.fillStyle=He.headerBg,r.fillRect(0,ge,ve,m-ge);for(let X=vt;X<=bt;X++){const oe=ge+lt[X]-me,Me=mt[X];oe+Me<ge||oe>m||(ft&&X>=ft.startRow&&X<=ft.endRow&&(r.fillStyle=He.selectionBg,r.fillRect(0,oe,ve,Me)),r.strokeStyle=He.headerBorder,r.lineWidth=.5,r.strokeRect(.25,oe+.25,ve-.5,Me-.5),ft&&X>=ft.startRow&&X<=ft.endRow&&(r.strokeStyle=He.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(ve-1,oe),r.lineTo(ve-1,oe+Me),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(X+1),ve/2,oe+Me/2+.5))}r.strokeStyle=He.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(ve+.5,ge),r.lineTo(ve+.5,m),r.stroke(),r.fillStyle=He.headerBg,r.fillRect(0,0,ve,ge),r.strokeStyle=He.headerSep,r.lineWidth=1,r.strokeRect(.5,.5,ve-.5,ge-.5)}const w=t.computed(()=>rt(e.activeCell.value.col)+String(e.activeCell.value.row+1)),O=t.ref(""),H=t.ref(!1),z=t.computed(()=>e.editingCell.value?O.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(o,u)=>{if(o&&!u){const V=e.editValue.value||e.getCellRaw(o.col,o.row)||"";O.value=V,I=!1}else!o&&u&&(O.value="",H.value=!1,I=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(O.value="",I=!1)});function ce(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),C())}function b(o){const u=o.target.value;O.value=u,I=!0,e.editingCell.value||e.startEdit()}let Z=!1,I=!1;function j(){var N,me,ve,ge,He,st,lt,ht,mt;if(Z)return;const o=l.formulaBarRef.value,u=!!(o&&typeof document<"u"&&document.activeElement===o);if(!e.editingCell.value&&!u&&!I)return;const V={...e.activeCell.value},L=e.editingCell.value?e.editingCell.value.col:V.col,m=e.editingCell.value?e.editingCell.value.row:V.row;if(!e.editingCell.value){const Rt=e.getCellRaw(L,m),$t=O.value!==Rt;if(!I)return;Z=!0,$t&&((N=e.saveUndo)==null||N.call(e),e.setCellValue(L,m,O.value),C(),(me=l.emitModelData)==null||me.call(l)),(ve=l.formulaBarRef.value)==null||ve.blur(),O.value="",H.value=!1,I=!1,t.nextTick(()=>{Z=!1});return}Z=!0,I?(e.editValue.value=O.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(ge=l.formulaBarRef.value)==null||ge.blur(),O.value="",H.value=!1,I=!1,C(),l.focusEditInput(),(He=l.emitModelData)==null||He.call(l),t.nextTick(()=>{Z=!1})):u?(O.value=e.editValue.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(st=l.formulaBarRef.value)==null||st.blur(),O.value="",H.value=!1,I=!1,C(),l.focusEditInput(),(lt=l.emitModelData)==null||lt.call(l),t.nextTick(()=>{Z=!1})):(e.commitEdit(),(ht=l.formulaBarRef.value)==null||ht.blur(),O.value="",H.value=!1,I=!1,C(),l.focusEditInput(),(mt=l.emitModelData)==null||mt.call(l),t.nextTick(()=>{Z=!1}))}function se(){var o;Z||(Z=!0,e.editingCell.value&&e.cancelEdit(),(o=l.formulaBarRef.value)==null||o.blur(),O.value="",H.value=!1,I=!1,C(),l.focusEditInput(),t.nextTick(()=>{Z=!1}))}function Q(o){if(!o.isComposing){if(o.key==="Enter"&&(o.altKey||o.metaKey)&&!o.ctrlKey){o.preventDefault(),o.stopPropagation();const u=o.target;if(!u)return;e.editingCell.value||e.startEdit();const V=u.selectionStart??u.value.length,L=u.selectionEnd??u.value.length,m=u.value,N=m.substring(0,V)+`
|
|
7
|
-
`+
|
|
8
|
-
`).length:1)*jt,Zt=e.BASE_CELL_VPAD-Ot;let Mt=0,Tt=0;return Bt==="middle"?(Mt=Math.floor((bt-It)/2),Tt=Math.max(0,bt-It-Mt)):Bt==="top"?(Mt=Zt,Tt=Math.max(0,bt-It-Mt)):Bt==="bottom"&&(Tt=Zt,Mt=Math.max(0,bt-It-Tt)),{left:`${52+e.colPositions.value[V]-e.scrollX.value}px`,top:`${24+e.rowPositions.value[L]-e.scrollY.value}px`,width:`${rl}px`,height:`${bt}px`,fontFamily:me,fontSize:`${N}px`,lineHeight:1,fontWeight:ve,fontStyle:ge,textDecoration:st,textAlign:$t,paddingTop:`${Mt}px`,paddingRight:"3px",paddingBottom:`${Tt}px`,paddingLeft:"3px",opacity:o?0:1,pointerEvents:o?"none":"auto",color:o?"transparent":lt,caretColor:o?"transparent":void 0,borderColor:o?"transparent":void 0,background:o?"transparent":ht,boxShadow:o?"none":void 0}});function R(){return Math.max(0,l.viewSize.w-52-11)}function P(){return Math.max(0,l.viewSize.h-24-11)}const de=t.computed(()=>R()),le=t.computed(()=>P()),re=t.computed(()=>Math.max(0,de.value-11*2)),Y=t.computed(()=>Math.max(0,le.value-11*2)),U=t.computed(()=>l.maxScrollX.value<=0?re.value:Math.max(24,R()/e.totalWidth.value*re.value)),ye=t.computed(()=>l.maxScrollX.value<=0?0:e.scrollX.value/l.maxScrollX.value*(re.value-U.value)),Re=t.computed(()=>l.maxScrollY.value<=0?Y.value:Math.max(24,P()/e.totalHeight.value*Y.value)),Ke=t.computed(()=>l.maxScrollY.value<=0?0:e.scrollY.value/l.maxScrollY.value*(Y.value-Re.value));let $e=null,B=0,T=0;function F(o){o.preventDefault(),$e="v",B=o.clientY,T=e.scrollY.value,document.addEventListener("mousemove",ae),document.addEventListener("mouseup",ke)}function J(o){o.preventDefault(),$e="h",B=o.clientX,T=e.scrollX.value,document.addEventListener("mousemove",ae),document.addEventListener("mouseup",ke)}function ae(o){if($e==="v"){const V=(o.clientY-B)/(Y.value-Re.value);l.clampScroll(null,T+V*l.maxScrollY.value),C()}else if($e==="h"){const V=(o.clientX-B)/(re.value-U.value);l.clampScroll(T+V*l.maxScrollX.value,null),C()}}function ke(){$e=null,document.removeEventListener("mousemove",ae),document.removeEventListener("mouseup",ke)}function De(o){if($e)return;const u=o.currentTarget.getBoundingClientRect(),V=o.clientY-u.top;V<Ke.value?l.clampScroll(null,e.scrollY.value-P()):V>Ke.value+Re.value&&l.clampScroll(null,e.scrollY.value+P()),C()}function Ve(o){if($e)return;const u=o.currentTarget.getBoundingClientRect(),V=o.clientX-u.left;V<ye.value?l.clampScroll(e.scrollX.value-R(),null):V>ye.value+U.value&&l.clampScroll(e.scrollX.value+R(),null),C()}let Ae=!1,Oe=0,Se=0,p=!1,M=!1,G=0,Ce=0,pe=0,fe=0,be=0,we=0,Ne=0,tt=0,ct=!1,dt=!1,je=0,at=0,Et="cell",yl=0,Gl=-1,Kl=-1;function ba(o){if(o.button!==0)return;o.preventDefault(),ue.value=null;const u=Ft(o,l.canvasRef.value);if(u.y<24&&u.x>=52){const m=u.x-52+e.scrollX.value,N=e.hitCol(m);if(N>=0&&Math.abs(u.x-(52+e.colPositions.value[N+1]-e.scrollX.value))<=4){n.saveUndo(),p=!0,G=N,pe=e.colWidths.value[N],fe=m,C();return}}if(u.x<52&&u.y>=24){const m=u.y-24+e.scrollY.value,N=e.hitRow(m);if(N>=0&&Math.abs(u.y-(24+e.rowPositions.value[N+1]-e.scrollY.value))<=4){n.saveUndo(),M=!0,Ce=N,pe=e.getRowHeight(N),fe=m,C();return}}if(u.x<52||u.y<24){{const m=l.formulaBarRef.value,N=!!(m&&typeof document<"u"&&document.activeElement===m);(e.editingCell.value||N||I)&&j()}if(u.y<24&&u.x>=52){const m=e.hitCol(u.x-52+e.scrollX.value);m>=0&&(e.selectRange(m,0,m,e.rowCount-1,"col"),Ae=!0,Oe=m,Se=0)}else if(u.x<52&&u.y>=24){const m=e.hitRow(u.y-24+e.scrollY.value);m>=0&&(e.selectRange(0,m,e.colCount-1,m,"row"),Ae=!0,Oe=0,Se=m)}else u.x<52&&u.y<24&&e.selectAll();C();return}const V=e.hitCol(u.x-52+e.scrollX.value),L=e.hitRow(u.y-24+e.scrollY.value);if(!(V<0||L<0)){{const m=l.formulaBarRef.value,N=!!(m&&typeof document<"u"&&document.activeElement===m);(e.editingCell.value||N||I)&&j()}if(o.shiftKey&&e.selection.value){const m=e.selection.value;e.selectRange(m.startCol,m.startRow,V,L)}else e.selectCell(V,L);Ae=!0,Oe=V,Se=L,l.focusEditInput(),C()}}function ya(o){if(p){const N=Ft(o,l.canvasRef.value).x-52+e.scrollX.value-fe,me=pe+N;me>=30&&me<=1e3?e.colWidths.value[G]=me:me<30?e.colWidths.value[G]=30:e.colWidths.value[G]=1e3,C();return}if(M){const N=Ft(o,l.canvasRef.value).y-24+e.scrollY.value-fe,me=pe+N;me>=24&&me<=500?e.rowHeights.value[Ce]=me:me<24?e.rowHeights.value[Ce]=24:e.rowHeights.value[Ce]=500,C();return}if(!Ae){const m=l.canvasRef.value;if(!m)return;if(n.paintFmt.value){m.style.cursor="copy";return}const N=Ft(o,m);if(N.y<24&&N.x>=52){const me=e.hitCol(N.x-52+e.scrollX.value);if(me>=0&&Math.abs(N.x-(52+e.colPositions.value[me+1]-e.scrollX.value))<=4){m.style.cursor="col-resize";return}}if(N.x<52&&N.y>=24){const me=e.hitRow(N.y-24+e.scrollY.value);if(me>=0&&Math.abs(N.y-(24+e.rowPositions.value[me+1]-e.scrollY.value))<=4){m.style.cursor="row-resize";return}}m.style.cursor="cell";return}const u=Ft(o,l.canvasRef.value);if(Oe<0||Se<0)return;if(u.x<52||u.y<24){if(u.y<24&&u.x>=52){const m=e.hitCol(u.x-52+e.scrollX.value);m>=0&&e.selectRange(Math.min(Oe,m),0,Math.max(Oe,m),e.rowCount-1,"col")}else if(u.x<52&&u.y>=24){const m=e.hitRow(u.y-24+e.scrollY.value);m>=0&&e.selectRange(0,Math.min(Se,m),e.colCount-1,Math.max(Se,m),"row")}C();return}const V=e.hitCol(u.x-52+e.scrollX.value),L=e.hitRow(u.y-24+e.scrollY.value);V<0||L<0||(Se===0&&Oe>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(Oe,V),0,Math.max(Oe,V),e.rowCount-1,"col"):Oe===0&&Se>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(Se,L),e.colCount-1,Math.max(Se,L),"row"):e.selectRange(Oe,Se,V,L),C())}function va(o){const u=p||M;Ae=!1,p=!1,M=!1,u&&l.scheduleOptEmit(),n.paintFmt.value&&n.applyPaintFormat()}function wa(){const o=p||M;Ae=!1,p=!1,M=!1,o&&l.scheduleOptEmit()}function ka(o){o.preventDefault();const u=Ft(o,l.canvasRef.value);if(u.x<52&&u.y<24){x(o);return}if(u.y<24&&u.x>=52){const V=e.hitCol(u.x-52+e.scrollX.value);V>=0&&y(o,V);return}if(u.x<52&&u.y>=24){const V=e.hitRow(u.y-24+e.scrollY.value);V>=0&&v(o,V);return}if(u.x>=52&&u.y>=24){const V=e.hitCol(u.x-52+e.scrollX.value),L=e.hitRow(u.y-24+e.scrollY.value);V>=0&&L>=0&&D(o,V,L)}}function Ea(o){const u=Ft(o,l.canvasRef.value);if(u.x<52||u.y<24)return;const V=e.hitCol(u.x-52+e.scrollX.value),L=e.hitRow(u.y-24+e.scrollY.value);if(!(V<0||L<0)){{const m=l.formulaBarRef.value,N=!!(m&&typeof document<"u"&&document.activeElement===m);(e.editingCell.value||N||I)&&j()}e.selectCell(V,L),e.ensureVisible(V,L),e.startEdit(),C(),l.focusEditInput()}}function Ra(o){l.clampScroll(e.scrollX.value+o.deltaX,e.scrollY.value+o.deltaY),C()}function Ba(o){if(o.touches.length!==1){ct=!1;return}const u=o.touches[0],V=l.canvasRef.value;if(!V)return;const L=V.getBoundingClientRect(),m=u.clientX-L.left,N=u.clientY-L.top;m>=52&&N>=24?(o.preventDefault(),ct=!0,dt=!1,Et="cell",be=m,we=N,Ne=e.scrollX.value,tt=e.scrollY.value,je=e.hitCol(m-52+e.scrollX.value),at=e.hitRow(N-24+e.scrollY.value)):m>=0&&N>=0&&(m<52||N<24)&&(o.preventDefault(),ct=!0,dt=!1,be=m,we=N,Ne=e.scrollX.value,tt=e.scrollY.value,N<24&&m>=52?(Et="col",je=e.hitCol(m-52+e.scrollX.value),at=-1):m<52&&N>=24?(Et="row",at=e.hitRow(N-24+e.scrollY.value),je=-1):(Et="all",je=-1,at=-1))}function Ma(o){if(!ct||o.touches.length!==1)return;const u=o.touches[0],V=l.canvasRef.value;if(!V)return;const L=V.getBoundingClientRect(),m=u.clientX-L.left,N=u.clientY-L.top;(Math.abs(m-be)>8||Math.abs(N-we)>8)&&(dt=!0,o.preventDefault(),l.clampScroll(Ne+(be-m),tt+(we-N)),C())}function xa(){if(ct&&(ct=!1,!dt))if(Et==="cell"&&je>=0&&at>=0){const o=Date.now();je===Gl&&at===Kl&&o-yl<300?(e.selectCell(je,at),e.startEdit(),C(),l.focusEditInput(),yl=0):(e.commitEdit(),e.selectCell(je,at),C(),yl=o),Gl=je,Kl=at,l.focusEditInput()}else Et==="col"&&je>=0?(e.commitEdit(),e.selectRange(je,0,je,e.rowCount-1,"col"),C()):Et==="row"&&at>=0?(e.commitEdit(),e.selectRange(0,at,e.colCount-1,at,"row"),C()):Et==="all"&&(e.commitEdit(),e.selectAll(),C())}function vl(o){return o.isComposing||o.key==="Process"||o.keyCode===229}function Ul(o){return o.key.length===1&&!o.ctrlKey&&!o.metaKey&&!o.altKey}function Pl(o){if(e.editingCell.value)return;const u=o.ctrlKey||o.metaKey,V=o.shiftKey;switch(!0){case(u&&(o.key==="c"||o.key==="C")):o.preventDefault(),a.copyToClipboard();return;case(u&&(o.key==="x"||o.key==="X")):o.preventDefault(),a.cutSelected();return;case(u&&(o.key==="z"||o.key==="Z")):o.preventDefault(),n.undo();return;case(u&&(o.key==="y"||o.key==="Y")):o.preventDefault(),n.redo();return;case(u&&(o.key==="v"||o.key==="V")):o.preventDefault(),n.saveUndo(),a.pasteFromClipboard().then(()=>{C(),t.nextTick(()=>l.emitModelData())});return;case(u&&(o.key==="a"||o.key==="A")):o.preventDefault(),e.selectAll(),C();return;case(u&&o.key==="Home"):o.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),C();return;case(u&&o.key==="End"):o.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),C();return;case o.key==="Home":o.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),C();return;case o.key==="End":o.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),C();return;case o.key==="ArrowUp":o.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),C();return;case o.key==="ArrowDown":o.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),C();return;case o.key==="ArrowLeft":o.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),C();return;case o.key==="ArrowRight":o.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),C();return;case o.key==="Tab":o.preventDefault(),e.moveActive(V?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),C();return;case o.key==="Enter":o.preventDefault(),e.moveActive(0,V?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),C();return;case o.key==="F2":o.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),C(),l.focusEditInput();return;case o.key==="Delete":case o.key==="Backspace":o.preventDefault(),n.saveUndo(),a.clearSelected(),C();return;case o.key==="Escape":o.preventDefault(),e.cancelEdit(),n.paintFmt.value=null,C();return;case Ul(o):if(vl(o)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),C(),l.focusEditInput();return}o.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(o.key),C(),t.nextTick(()=>{const L=l.editInputRef.value;L&&(L.focus(),L.setSelectionRange(1,1))});return}}let wl=!1,kl=!1;function Sa(o){const u=o.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(u),O.value=u,C();return}e.editValue.value=u,O.value=u}function Da(){wl=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),O.value="",C())}function Ta(o){wl=!1,kl=!0,setTimeout(()=>{kl=!1},0);const u=o.target.value;e.editValue.value=u,O.value=u}function Na(o){if(!e.editingCell.value){if(Ul(o)||vl(o))return;Pl(o);return}if(!(wl||vl(o))&&!(kl&&(o.key==="Enter"||o.key==="Escape")))if(o.key==="Enter"&&(o.altKey||o.metaKey)){o.preventDefault();const u=l.editInputRef.value;if(!u)return;const V=u.selectionStart??u.value.length,L=u.selectionEnd??u.value.length,m=u.value,N=m.slice(0,V)+`
|
|
9
|
-
`+m.slice(L);e.editValue.value=N,u.value=N,u.selectionStart=u.selectionEnd=V+1,C()}else o.key==="Enter"?(o.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),C(),l.focusEditInput()):o.key==="Tab"?(o.preventDefault(),e.commitEdit(),e.moveActive(o.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),C(),l.focusEditInput()):o.key==="Escape"&&(o.preventDefault(),e.cancelEdit(),C(),l.focusEditInput())}function Ha(o){e.editingCell.value}function Aa(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),C())},0)}let gt=null;function Xt(){var u;const o=(u=l.wrapperRef.value)==null?void 0:u.getBoundingClientRect();if(o){const V=At(e.props.width),L=At(e.props.height);V!=null?l.viewSize.w=V:l.viewSize.w=o.width,L!=null?l.viewSize.h=L:l.viewSize.h=o.height}l.clampScroll(null,null),C()}function Fa(){t.onMounted(()=>{const o=At(e.props.width),u=At(e.props.height);(o==null||u==null)&&(gt=new ResizeObserver(()=>Xt()),l.wrapperRef.value&>.observe(l.wrapperRef.value)),t.nextTick(()=>{Xt(),l.focusEditInput()}),e.selectCell(0,0),l.modelData.value&&l.modelData.value.length>0&&(d.value=JSON.stringify(l.modelData.value),l.sheets.value=l.modelData.value.map(V=>{const L=l.mkSheet(V.name);for(const[m,N]of Object.entries(V.cells))L.cells[m]={value:N.value,style:N.style??null};if(V.colWidths)for(const[m,N]of Object.entries(V.colWidths)){const me=Number(m);me>=0&&me<e.colCount&&N>=30&&(L.colWidths[me]=N)}if(V.rowHeights)for(const[m,N]of Object.entries(V.rowHeights)){const me=Number(m);me>=0&&me<e.rowCount&&N>=24&&(L.rowHeights[me]=N)}if(V.merges)for(const[m,N]of Object.entries(V.merges))L.merges[m]={...N};return L}),l.sheets.value.length>0&&l.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const o=At(e.props.width),u=At(e.props.height);o!=null&&u!=null?(gt==null||gt.disconnect(),gt=null):!gt&&l.wrapperRef.value&&(gt=new ResizeObserver(()=>Xt()),gt.observe(l.wrapperRef.value)),t.nextTick(()=>Xt())}),t.watch(()=>e.props.theme,()=>C()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>l.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>l.emitModelData()),C()},{deep:!1}),t.watch(l.activeSheetIndex,()=>t.nextTick(()=>l.emitModelData())),t.watch(()=>l.modelData.value,o=>{if(!o||o.length===0)return;const u=JSON.stringify(o);if(u===d.value)return;d.value=u;const V=e.selection.value?{...e.selection.value}:null,L={...e.activeCell.value};l.sheets.value=o.map(m=>{const N=l.mkSheet(m.name);for(const[me,ve]of Object.entries(m.cells))N.cells[me]={value:ve.value,style:ve.style??null};if(m.colWidths)for(const[me,ve]of Object.entries(m.colWidths)){const ge=Number(me);ge>=0&&ge<e.colCount&&ve>=30&&(N.colWidths[ge]=ve)}if(m.rowHeights)for(const[me,ve]of Object.entries(m.rowHeights)){const ge=Number(me);ge>=0&&ge<e.rowCount&&ve>=24&&(N.rowHeights[ge]=ve)}if(m.merges)for(const[me,ve]of Object.entries(m.merges))N.merges[me]={...ve};return N}),l.sheets.value.length>0&&l.loadSheet(0),V&&(e.selection.value=V),e.activeCell.value=L,C()},{deep:!0}),t.onBeforeUnmount(()=>{gt==null||gt.disconnect()})}return{scheduleRender:C,render:$,activeCellLabel:w,formulaBarDisplay:z,formulaBarDraft:O,formulaBarExpanded:H,onFormulaBarFocus:ce,onFormulaBarInput:b,onFormulaBarKeydown:Q,onFormulaBarBlur:q,acceptFormulaBarEdit:j,cancelFormulaBarEdit:se,renTab:ee,renTabVal:he,onTabClick:ze,onTabDblClick:_e,commitTabRename:Qe,cclTabRename:Ge,onTabRenameKd:Ze,ctxMenu:ue,ctxSubmenuLeft:Te,onCtxItemEnter:Fe,onTabCtxMenu:s,onTabBarCtx:S,onCornerCtx:x,onRowHdrCtx:v,onColHdrCtx:y,onCellCtx:D,dimInputRef:i,dimPanel:g,openDimPanel:ne,onDimInput:te,onDimKeydown:xe,onDimBlur:Ee,applyDimPanel:Ye,closeDimPanel:et,editInputStyle:E,hScrollbarW:de,vScrollbarH:le,hTrackW:re,vTrackH:Y,hThumbW:U,hThumbL:ye,vThumbH:Re,vThumbT:Ke,onVStart:F,onHStart:J,onSbMove:ae,onSbUp:ke,onVTrk:De,onHTrk:Ve,onMouseDown:ba,onMouseMove:ya,onMouseUp:va,onMouseLeave:wa,onCanvasCtx:ka,onDblClick:Ea,onWheel:Ra,onTouchStart:Ba,onTouchMove:Ma,onTouchEnd:xa,onKeydown:Pl,onEditInput:Sa,onEditCompositionStart:Da,onEditCompositionEnd:Ta,onEditKd:Na,onEditPaste:Ha,onEditBlur:Aa,applySize:Xt,setupLifecycle:Fa}}const ta={class:"formula-bar__cell-label"},la={class:"formula-bar__buttons"},oa=["rows","value"],na=["title"],ra={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},aa={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},ia=["value"],ca={key:2,class:"sb-corner"},sa=["onClick","onMouseenter"],da={class:"context-menu__label"},ua={key:0,class:"context-menu__arrow"},fa=["onClick"],ma={class:"dim-panel__title"},pa={class:"dim-panel__body"},ga=["value"],ha={key:0,class:"dim-panel__error"},Ca={class:"dim-panel__footer"},$l=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 n=e,a=t.useModel(e,"data"),l={value:""},d=Xr(n,{rowCount:n.rowCount,colCount:n.colCount,theme:n.theme,locale:n.locale}),f={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:_=>{},mkSheet:_=>({id:"",name:_,cells:{},merges:{},selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[]})},r=jr(d,f),k=qr(d,r);Zr(r,{borderMenuOpen:k.borderMenuOpen,mergeMenuOpen:k.mergeMenuOpen});const C=Qr(d,r,a,void 0,l);f.sheets=C.sheets,f.activeSheetIndex=C.activeSheetIndex,f.saveSheet=C.saveSheet,f.loadSheet=C.loadSheet,f.mkSheet=C.mkSheet;const W=ea(d,r,k,C,l);W.setupLifecycle();const $=t.reactive(d),w=t.reactive(r),O=t.reactive(k),H=t.reactive(C),z=C.sheets,ce=C.activeSheetIndex,b=t.reactive(W),Z=t.computed(()=>{const _=$.selection;return!!_&&_.startCol===_.endCol&&_.startRow===_.endRow}),I=t.computed(()=>{var Te;const _=w.selNumberFormat;if(_!==tl)return _;const c=$.activeCell,h=(Te=$.cells[$.cellKey(c.col,c.row)])==null?void 0:Te.style;return typeof(h==null?void 0:h.numberFormat)=="string"?h.numberFormat:""});function j(_){r.nfDialogOpen.value=_}function se(_){r.fontSizeMenuOpen.value=_}function Q(_){r.textColorMenuOpen.value=_}function q(_){r.fillColorMenuOpen.value=_}function ee(_){W.renTabVal.value=_}function he(){W.ctxMenu.value=null}const ze=_=>{C.formulaBarRef.value=_};function _e(){W.formulaBarExpanded.value=!W.formulaBarExpanded.value}const Qe=_=>{C.wrapperRef.value=_},Ge=_=>{C.canvasRef.value=_},Ze=_=>{C.editInputRef.value=_},ue=_=>{W.dimInputRef.value=_};return(_,c)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(H.outerStyle)},[t.createVNode(nr,{locale:$.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":O.borderMenuOpen,"cached-border":O.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":O.mergeMenuOpen,"calc-menu-open":O.calcMenuOpen,"is-single-cell":Z.value,"sel-number-format":w.selNumberFormat,"nf-options":w.nfOptions,"theme-vars":H.toolbarThemeVars,onUndo:c[0]||(c[0]=h=>w.undo()),onRedo:c[1]||(c[1]=h=>w.redo()),onPaintFormat:w.onPaintFormat,onClearFormat:c[2]||(c[2]=h=>w.clearFormat()),onNumberFormatChange:c[3]||(c[3]=h=>w.onNumberFormatChange(h)),onFontFamilyChange:c[4]||(c[4]=h=>w.onFontFamilyChange(h)),onFontSizeInput:c[5]||(c[5]=h=>w.onFontSizeInput(h)),onFontSizeBlur:w.onFontSizeBlur,onFontSizeKeydown:c[6]||(c[6]=h=>w.onFontSizeKeydown(h)),onFontSizeChange:c[7]||(c[7]=h=>w.onFontSizeChange(h)),"onUpdate:fontSizeMenuOpen":c[8]||(c[8]=h=>se(h)),onFontSizeToggle:c[9]||(c[9]=h=>w.toggleFontSizeMenu()),onFontSizeStepUp:w.onFontSizeStepUp,onFontSizeStepDown:w.onFontSizeStepDown,onBoldToggle:w.toggleFontWeight,onItalicToggle:w.toggleFontStyle,onUnderlineToggle:w.toggleUnderline,onStrikethroughToggle:w.toggleStrikethrough,onTextColorChange:c[10]||(c[10]=h=>w.onTextColorChange(h)),"onUpdate:textColorMenuOpen":c[11]||(c[11]=h=>Q(h)),onFillColorChange:c[12]||(c[12]=h=>w.onFillColorChange(h)),"onUpdate:fillColorMenuOpen":c[13]||(c[13]=h=>q(h)),onApplyTextColor:w.applyCachedTextColor,onApplyFillColor:w.applyCachedFillColor,"onUpdate:borderMenuOpen":c[14]||(c[14]=h=>w.onBorderMenuToggle(h)),onBorderChange:c[15]||(c[15]=h=>O.onBorderChange(h)),onApplyBorder:O.applyCachedBorder,onHAlignChange:c[16]||(c[16]=h=>w.onHAlignChange(h)),onVAlignChange:c[17]||(c[17]=h=>w.onVAlignChange(h)),onWrapToggle:w.onWrapToggle,"onUpdate:mergeMenuOpen":c[18]||(c[18]=h=>O.onMergeMenuToggle(h)),onMergeChange:c[19]||(c[19]=h=>O.onMergeChange(h)),onApplyMerge:O.onApplyMerge,"onUpdate:calcMenuOpen":c[20]||(c[20]=h=>O.onCalcMenuToggle(h)),onCalcSum:O.onCalcSum,onCalcAvg:O.onCalcAvg},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"]),t.createVNode(Gr,{"model-open":w.nfDialogOpen,locale:$.locale,"current-format":I.value,"onUpdate:modelOpen":c[21]||(c[21]=h=>j(h)),onApply:c[22]||(c[22]=h=>w.applyNumberFormatCode(h))},null,8,["model-open","locale","current-format"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":b.formulaBarExpanded}])},[t.createElementVNode("div",ta,t.toDisplayString(b.activeCellLabel),1),t.createElementVNode("div",la,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:c[23]||(c[23]=t.withModifiers(()=>{},["prevent"])),onClick:c[24]||(c[24]=t.withModifiers((...h)=>b.cancelFormulaBarEdit&&b.cancelFormulaBarEdit(...h),["stop"]))},[...c[73]||(c[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:c[25]||(c[25]=t.withModifiers(()=>{},["prevent"])),onClick:c[26]||(c[26]=t.withModifiers((...h)=>b.acceptFormulaBarEdit&&b.acceptFormulaBarEdit(...h),["stop"]))},[...c[74]||(c[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:ze,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":b.formulaBarExpanded}]),rows:b.formulaBarExpanded?3:1,value:b.formulaBarDisplay,spellcheck:"false",onFocus:c[27]||(c[27]=(...h)=>b.onFormulaBarFocus&&b.onFormulaBarFocus(...h)),onInput:c[28]||(c[28]=(...h)=>b.onFormulaBarInput&&b.onFormulaBarInput(...h)),onKeydown:c[29]||(c[29]=(...h)=>b.onFormulaBarKeydown&&b.onFormulaBarKeydown(...h)),onBlur:c[30]||(c[30]=(...h)=>b.onFormulaBarBlur&&b.onFormulaBarBlur(...h))},null,42,oa),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:b.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:c[31]||(c[31]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(_e,["stop"])},[b.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",aa,[...c[76]||(c[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",ra,[...c[75]||(c[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,na)],2),t.createElementVNode("div",{ref:Qe,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:Ge,class:"grid-canvas",tabindex:"0",onMousedown:c[32]||(c[32]=(...h)=>b.onMouseDown&&b.onMouseDown(...h)),onMousemove:c[33]||(c[33]=(...h)=>b.onMouseMove&&b.onMouseMove(...h)),onMouseup:c[34]||(c[34]=(...h)=>b.onMouseUp&&b.onMouseUp(...h)),onMouseleave:c[35]||(c[35]=(...h)=>b.onMouseLeave&&b.onMouseLeave(...h)),onDblclick:c[36]||(c[36]=(...h)=>b.onDblClick&&b.onDblClick(...h)),onWheel:c[37]||(c[37]=t.withModifiers((...h)=>b.onWheel&&b.onWheel(...h),["prevent"])),onFocus:c[38]||(c[38]=(...h)=>H.onCanvasFocus&&H.onCanvasFocus(...h)),onKeydown:c[39]||(c[39]=(...h)=>b.onKeydown&&b.onKeydown(...h)),onContextmenu:c[40]||(c[40]=(...h)=>b.onCanvasCtx&&b.onCanvasCtx(...h)),onTouchstart:c[41]||(c[41]=t.withModifiers((...h)=>b.onTouchStart&&b.onTouchStart(...h),["prevent"])),onTouchmove:c[42]||(c[42]=t.withModifiers((...h)=>b.onTouchMove&&b.onTouchMove(...h),["prevent"])),onTouchend:c[43]||(c[43]=(...h)=>b.onTouchEnd&&b.onTouchEnd(...h))},null,32),t.createElementVNode("textarea",{ref:Ze,class:"cell-editor",value:$.editValue,style:t.normalizeStyle(b.editInputStyle),onInput:c[44]||(c[44]=(...h)=>b.onEditInput&&b.onEditInput(...h)),onKeydown:c[45]||(c[45]=(...h)=>b.onEditKd&&b.onEditKd(...h)),onCompositionstart:c[46]||(c[46]=(...h)=>b.onEditCompositionStart&&b.onEditCompositionStart(...h)),onCompositionend:c[47]||(c[47]=(...h)=>b.onEditCompositionEnd&&b.onEditCompositionEnd(...h)),onBlur:c[48]||(c[48]=(...h)=>b.onEditBlur&&b.onEditBlur(...h)),onPaste:c[49]||(c[49]=(...h)=>b.onEditPaste&&b.onEditPaste(...h))},null,44,ia),H.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:c[50]||(c[50]=t.withModifiers(h=>{H.clampScroll(null,$.scrollY-50),b.scheduleRender()},["prevent"]))},[...c[77]||(c[77]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:c[52]||(c[52]=(...h)=>b.onVTrk&&b.onVTrk(...h))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:b.vThumbT+"px",height:b.vThumbH+"px"}),onMousedown:c[51]||(c[51]=(...h)=>b.onVStart&&b.onVStart(...h))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:c[53]||(c[53]=t.withModifiers(h=>{H.clampScroll(null,$.scrollY+50),b.scheduleRender()},["prevent"]))},[...c[78]||(c[78]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),H.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:c[54]||(c[54]=t.withModifiers(h=>{H.clampScroll($.scrollX-50,null),b.scheduleRender()},["prevent"]))},[...c[79]||(c[79]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:c[56]||(c[56]=(...h)=>b.onHTrk&&b.onHTrk(...h))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:b.hThumbL+"px",width:b.hThumbW+"px"}),onMousedown:c[55]||(c[55]=(...h)=>b.onHStart&&b.onHStart(...h))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:c[57]||(c[57]=t.withModifiers(h=>{H.clampScroll($.scrollX+50,null),b.scheduleRender()},["prevent"]))},[...c[80]||(c[80]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),H.maxScrollX>0&&H.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",ca)):t.createCommentVNode("",!0)]),t.createVNode(dr,{locale:$.locale,sheets:t.unref(z),"active-sheet-index":t.unref(ce),"ren-tab":b.renTab,"ren-tab-val":b.renTabVal,onTabClick:c[58]||(c[58]=h=>b.onTabClick(h)),onTabDblclick:c[59]||(c[59]=h=>b.onTabDblClick(h)),onTabContextmenu:c[60]||(c[60]=h=>b.onTabCtxMenu(h.ev,h.i)),onTabRenameInput:c[61]||(c[61]=h=>ee(h)),onTabRenameKeydown:c[62]||(c[62]=h=>b.onTabRenameKd(h)),onTabRenameCommit:b.commitTabRename,onTabbarContextmenu:c[63]||(c[63]=h=>b.onTabBarCtx(h)),onAddSheet:c[64]||(c[64]=h=>{H.addSheet(),b.scheduleRender()})},null,8,["locale","sheets","active-sheet-index","ren-tab","ren-tab-val","onTabRenameCommit"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[b.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:b.ctxMenu.x+"px",top:b.ctxMenu.y+"px"}),onClick:c[65]||(c[65]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.ctxMenu.items,(h,Te)=>(t.openBlock(),t.createElementBlock("div",{key:Te,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":h.disabled}]),onClick:Fe=>!h.disabled&&h.action&&(h.action(),he()),onMouseenter:Fe=>b.onCtxItemEnter(Fe,h)},[t.createElementVNode("span",da,t.toDisplayString(h.label),1),h.children?(t.openBlock(),t.createElementBlock("span",ua)):t.createCommentVNode("",!0),h.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":b.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.children,(Fe,s)=>(t.openBlock(),t.createElementBlock("div",{key:s,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":Fe.disabled}]),onClick:t.withModifiers(S=>!Fe.disabled&&Fe.action&&(Fe.action(),he()),["stop"])},t.toDisplayString(Fe.label),11,fa))),128))],2)):t.createCommentVNode("",!0)],42,sa))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[b.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:b.dimPanel.x+"px",top:b.dimPanel.y+"px"}),onMousedown:c[71]||(c[71]=t.withModifiers(()=>{},["stop"])),onClick:c[72]||(c[72]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",ma,t.toDisplayString(b.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",pa,[t.createElementVNode("input",{ref:ue,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":b.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:b.dimPanel.value,onInput:c[66]||(c[66]=(...h)=>b.onDimInput&&b.onDimInput(...h)),onKeydown:c[67]||(c[67]=(...h)=>b.onDimKeydown&&b.onDimKeydown(...h)),onBlur:c[68]||(c[68]=(...h)=>b.onDimBlur&&b.onDimBlur(...h))},null,42,ga),c[81]||(c[81]=t.createElementVNode("span",{class:"dim-panel__unit"},"px",-1))]),b.dimPanel.error?(t.openBlock(),t.createElementBlock("div",ha,t.toDisplayString(b.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Ca,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:c[69]||(c[69]=(...h)=>b.applyDimPanel&&b.applyDimPanel(...h))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:c[70]||(c[70]=(...h)=>b.closeDimPanel&&b.closeDimPanel(...h))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-6321c060"]]);Dt.Spreader=$l,Dt.default=$l,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===""&<===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&>.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"}})});
|