xiaodao-spreader 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ZH.md +3 -2
- package/README.md +3 -2
- package/dist/style.css +1 -1
- package/dist/types/components/spreader/components/pickers/calcPicker.vue.d.ts +29 -0
- package/dist/types/components/spreader/components/toolbar.vue.d.ts +9 -0
- package/dist/types/components/spreader/composables/borders-merge.d.ts +5 -0
- package/dist/types/components/spreader/composables/sheets-ops.d.ts +3 -1
- package/dist/xiaodao-spreader.es.js +2782 -2586
- package/dist/xiaodao-spreader.umd.js +9 -9
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(st,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(st=typeof globalThis<"u"?globalThis:st||self,t(st.XiaoDaoSpreader={},st.Vue))})(this,function(st,t){"use strict";const Rl={"zh-CN":{insert:"插入",delete:"删除",rename:"重命名",moveLeft:"左移",moveRight:"右移",cut:"剪切",copy:"复制",paste:"粘贴",addSheet:"新建工作表",moveSheetLeft:"左移",moveSheetRight:"右移",scrollUp:"向上滚动",scrollDown:"向下滚动",scrollLeft:"向左滚动",scrollRight:"向右滚动",calculate:"计算",sum:"求和",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:"墨绿"},"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",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"}};function G(e,h){var g;return((g=Rl[e])==null?void 0:g[h])??h}const Kt='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',at=10,xl=[{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'}],Sl=[{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}],Ml='<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>',Tl='<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>',Dl='<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>',Hl='<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>',Al='<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>',Il='<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>',Fl=[{value:"left",labelKey:"alignLeft",icon:Ml},{value:"center",labelKey:"alignCenter",icon:Tl},{value:"right",labelKey:"alignRight",icon:Dl}],Nl=[{value:"top",labelKey:"alignTop",icon:Hl},{value:"middle",labelKey:"alignMiddle",icon:Al},{value:"bottom",labelKey:"alignBottom",icon:Il}],sl=[{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>'}],Ll={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"},Ol={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"},Vl=["title"],Wl=["innerHTML"],zl={key:1,class:"sp-dropdown__value"},$l=["disabled"],_l=["onClick"],Gl=["innerHTML"],Kl={class:"sp-dropdown__item-label"},Ul=["disabled"],Pl=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}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:h}){const g=e,n=h,d=t.ref(!1),E=t.ref(0),a=t.ref(null),V=t.ref(null),f=t.ref(null),te=t.ref({top:0,up:!1}),X=t.ref(0),w=t.ref(!1),re=t.computed(()=>g.options.find(ie=>String(ie.value)===String(g.modelValue))),L=t.computed(()=>g.menuWidth),m=t.computed(()=>Math.min(g.visibleCount,g.options.length)),ve=t.computed(()=>g.options.slice(E.value,E.value+m.value)),pe=t.computed(()=>E.value>0),ye=t.computed(()=>E.value+m.value<g.options.length),U=t.computed(()=>g.options.length>m.value);function P(ie){E.value=Math.max(0,Math.min(g.options.length-m.value,E.value+ie))}function he(){d.value=!0,g.modelOpen!==void 0&&n("update:modelOpen",!0);const ie=g.triggerEl??a.value;if(!ie)return;const r=ie.getBoundingClientRect(),y=m.value*22+(U.value?2*15:0)+8,H=window.innerHeight-r.bottom-4<y&&r.top-4>y;g.align==="right"?te.value={right:window.innerWidth-r.right,top:H?r.top-y-4:r.bottom+4,up:H}:te.value={left:r.left,top:H?r.top-y-4:r.bottom+4,up:H};const C=g.options.findIndex(k=>String(k.value)===String(g.modelValue));E.value=C>=0?Math.max(0,Math.min(C-Math.floor(m.value/2),g.options.length-m.value)):0}function F(){d.value=!1,g.modelOpen!==void 0&&n("update:modelOpen",!1)}function j(){d.value?F():he()}function be(ie){n("update:modelValue",ie.value),n("change",ie.value),F()}function we(ie){var y,T;if(!d.value)return;const r=ie.target;(y=a.value)!=null&&y.contains(r)||(T=f.value)!=null&&T.contains(r)||F()}function le(ie){d.value&&(ie.preventDefault(),P(ie.deltaY>0?1:-1))}t.watch(d,ie=>{t.nextTick(()=>{var r,y;ie?(r=V.value)==null||r.addEventListener("wheel",le,{passive:!1}):(y=V.value)==null||y.removeEventListener("wheel",le)})}),t.watch(()=>g.modelOpen,ie=>{ie!==void 0&&ie!==d.value&&(ie?he():F())});function c(ie){d.value&&(X.value=ie.touches[0].clientY,w.value=!0)}function p(ie){if(!d.value||!w.value)return;const r=ie.touches[0].clientY-X.value;Math.abs(r)>5&&(P(r<0?1:-1),X.value=ie.touches[0].clientY)}function Ae(){w.value=!1}function xe(ie){ie.key==="Escape"&&F()}return t.onMounted(()=>{document.addEventListener("mousedown",we),window.addEventListener("resize",F),window.addEventListener("scroll",F,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("mousedown",we),window.removeEventListener("resize",F),window.removeEventListener("scroll",F,!0)}),(ie,r)=>{var y,T;return t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:a,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:j},[(y=re.value)!=null&&y.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:re.value.icon},null,8,Wl)):(t.openBlock(),t.createElementBlock("span",zl,t.toDisplayString(((T=re.value)==null?void 0:T.label)??""),1)),r[2]||(r[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,Vl)),(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:f,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":te.value.up}]),style:t.normalizeStyle({left:te.value.left!==void 0?te.value.left+"px":void 0,right:te.value.right!==void 0?te.value.right+"px":void 0,top:te.value.top+"px",minWidth:L.value!==void 0?typeof L.value=="number"?L.value+"px":L.value:void 0}),onKeydown:xe},[U.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!pe.value}]),disabled:!pe.value,onClick:r[0]||(r[0]=H=>P(-1))},[...r[3]||(r[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,$l)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:V,class:"sp-dropdown__list",onTouchstart:c,onTouchmove:p,onTouchend:Ae},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ve.value,H=>(t.openBlock(),t.createElementBlock("button",{key:String(H.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(H.value)===String(e.modelValue)}]),onClick:C=>be(H)},[H.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:H.icon},null,8,Gl)):t.createCommentVNode("",!0),t.createElementVNode("span",Kl,t.toDisplayString(H.label),1)],10,_l))),128))],544),U.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!ye.value}]),disabled:!ye.value,onClick:r[1]||(r[1]=H=>P(1))},[...r[4]||(r[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,Ul)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),pt=(e,h)=>{const g=e.__vccOpts||e;for(const[n,d]of h)g[n]=d;return g},Ut=pt(Pl,[["__scopeId","data-v-8dc09f5d"]]),Yl=["title","onClick"],dl=pt(t.defineComponent({__name:"colorPicker",props:{modelOpen:{type:Boolean,default:void 0},colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{expose:h,emit:g}){const n=e,d=g,E=[[{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"}]],a=[[{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(()=>n.colorKey==="fill"?a:E);function f(U){return G(n.locale,U)}function te(U){const P=n.currentColor;return!P&&!U?!0:P?P.toLowerCase()===U.toLowerCase():!1}const X=t.ref(!1),w=t.ref(null),re=t.ref(null),L=t.ref({top:0});t.watch(()=>n.modelOpen,U=>{U!==void 0&&U!==X.value&&(U?ve():pe())});function m(U){const P=w.value,he=re.value,F=U.target;P&&P.contains(F)||he&&he.contains(F)||pe()}function ve(){X.value=!0,n.modelOpen!==void 0&&d("update:modelOpen",!0),t.nextTick(()=>{const U=n.triggerEl??w.value;if(U){const P=U.getBoundingClientRect(),he=150,F=120;let j=window.innerWidth-P.right,be=P.bottom+4,we;P.left-F<4&&(j=void 0,we=Math.max(4,P.left)),be+he>window.innerHeight-4&&(be=P.top-he-4),be<4&&(be=4),L.value=j!==void 0?{right:j,top:be}:{left:we,top:be}}document.addEventListener("mousedown",m)})}function pe(){X.value=!1,n.modelOpen!==void 0&&d("update:modelOpen",!1),document.removeEventListener("mousedown",m)}function ye(U){d("update:modelValue",U),d("change",U),pe()}return t.onBeforeUnmount(()=>{document.removeEventListener("mousedown",m)}),h({open:X,openMenu:ve,close:pe}),(U,P)=>(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(()=>[X.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:re,class:"color-picker__menu",style:t.normalizeStyle({left:L.value.left!==void 0?L.value.left+"px":void 0,right:L.value.right!==void 0?L.value.right+"px":void 0,top:L.value.top+"px"}),onMousedown:P[0]||(P[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.value,(he,F)=>(t.openBlock(),t.createElementBlock("div",{key:F,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(he,j=>(t.openBlock(),t.createElementBlock("button",{key:j.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":te(j.value)}]),title:f(j.key),style:t.normalizeStyle({background:j.value||"transparent",border:j.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:be=>ye(j.value)},null,14,Yl))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f00d0dae"]]),Xl=["title","onClick"],jl={viewBox:"0 0 30 30",class:"border-picker__icon"},Zl=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],ql={class:"border-picker__label"},Jl=pt(t.defineComponent({__name:"borderPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:h,emit:g}){const n=e,d=g,E=[{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"}],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}],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"]},f={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function te(U,P){return f[U].includes(P)?"thick":V[U].includes(P)?"solid":"dashed"}const X=t.ref(!1),w=t.ref(null),re=t.ref(null),L=t.ref({top:0});t.watch(()=>n.modelOpen,U=>{U!==void 0&&U!==X.value&&(U?ve():pe())});function m(U){const P=w.value,he=re.value,F=U.target;P&&P.contains(F)||he&&he.contains(F)||pe()}function ve(){X.value=!0,n.modelOpen!==void 0&&d("update:modelOpen",!0),t.nextTick(()=>{const U=n.triggerEl??w.value;if(U){const P=U.getBoundingClientRect(),he=200,F=160;let j=window.innerWidth-P.right,be=P.bottom+4,we;P.left-F<4&&(j=void 0,we=Math.max(4,P.left)),be+he>window.innerHeight-4&&(be=P.top-he-4),be<4&&(be=4),L.value=j!==void 0?{right:j,top:be}:{left:we,top:be}}document.addEventListener("mousedown",m)})}function pe(){X.value=!1,n.modelOpen!==void 0&&d("update:modelOpen",!1),document.removeEventListener("mousedown",m)}function ye(U){d("change",U),pe()}return t.onBeforeUnmount(()=>{document.removeEventListener("mousedown",m)}),h({open:X,openMenu:ve,close:pe}),(U,P)=>(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(()=>[X.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:re,class:"border-picker__menu",style:t.normalizeStyle({left:L.value.left!==void 0?L.value.left+"px":void 0,right:L.value.right!==void 0?L.value.right+"px":void 0,top:L.value.top+"px"}),onMousedown:P[0]||(P[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(E,he=>t.createElementVNode("button",{key:he.key,class:"border-picker__item",title:t.unref(G)(e.locale,he.i18nKey),onClick:F=>ye(he.key)},[(t.openBlock(),t.createElementBlock("svg",jl,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(a,F=>t.createElementVNode("line",{key:F.name,x1:F.x1,y1:F.y1,x2:F.x2,y2:F.y2,stroke:"currentColor","stroke-width":te(he.key,F.name)==="thick"?3:1.5,"stroke-dasharray":te(he.key,F.name)==="dashed"?"0 4":"none","stroke-linecap":te(he.key,F.name)==="dashed"?"round":"square"},null,8,Zl)),64))])),t.createElementVNode("span",ql,t.toDisplayString(t.unref(G)(e.locale,he.i18nKey)),1)],8,Xl)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-3721e5e4"]]),Ql=["title","onClick"],eo=["innerHTML"],to={class:"merge-picker__label"},lo=pt(t.defineComponent({__name:"mergePicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:h,emit:g}){const n=e,d=g,E=t.ref(!1),a=t.ref(null),V=t.ref(null),f=t.ref({top:0});t.watch(()=>n.modelOpen,L=>{L!==void 0&&L!==E.value&&(L?X():w())});function te(L){const m=a.value,ve=V.value,pe=L.target;m&&m.contains(pe)||ve&&ve.contains(pe)||w()}function X(){E.value=!0,n.modelOpen!==void 0&&d("update:modelOpen",!0),t.nextTick(()=>{const L=n.triggerEl??a.value;if(L){const m=L.getBoundingClientRect(),ve=sl.length*30+12,pe=160;let ye=window.innerWidth-m.right,U=m.bottom+4,P;m.left-pe<4&&(ye=void 0,P=Math.max(4,m.left)),U+ve>window.innerHeight-4&&(U=m.top-ve-4),U<4&&(U=4),f.value=ye!==void 0?{right:ye,top:U}:{left:P,top:U}}document.addEventListener("mousedown",te)})}function w(){E.value=!1,n.modelOpen!==void 0&&d("update:modelOpen",!1),document.removeEventListener("mousedown",te)}function re(L){d("change",L),w()}return t.onBeforeUnmount(()=>{document.removeEventListener("mousedown",te)}),h({open:E,openMenu:X,close:w}),(L,m)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:a,class:"merge-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[E.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:V,class:"merge-picker__menu",style:t.normalizeStyle({left:f.value.left!==void 0?f.value.left+"px":void 0,right:f.value.right!==void 0?f.value.right+"px":void 0,top:f.value.top+"px"}),onMousedown:m[0]||(m[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(sl),ve=>(t.openBlock(),t.createElementBlock("button",{key:ve.key,class:"merge-picker__item",title:t.unref(G)(e.locale,ve.labelKey),onClick:pe=>re(ve.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:ve.icon},null,8,eo),t.createElementVNode("span",to,t.toDisplayString(t.unref(G)(e.locale,ve.labelKey)),1)],8,Ql))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-24e4dbe5"]]),oo={class:"tb-item","data-key":"undo"},no=["title","disabled"],ro={class:"tb-item","data-key":"redo"},ao=["title","disabled"],io={class:"tb-item","data-key":"paint"},co=["title","disabled"],so={class:"tb-item","data-key":"clear"},uo=["title","disabled"],fo={class:"tb-item","data-key":"font"},mo={class:"tb-item","data-key":"fontSize"},po={class:"toolbar-font-size"},go=["value","title"],ho=["title"],vo=["title","disabled"],Co=["title","disabled"],bo={class:"tb-item","data-key":"bold"},yo=["title","disabled"],wo={class:"tb-item","data-key":"italic"},ko=["title","disabled"],Eo={class:"tb-item","data-key":"underline"},Bo=["title","disabled"],Ro={class:"tb-item","data-key":"strike"},xo=["title","disabled"],So={class:"tb-item","data-key":"textColor"},Mo={class:"toolbar-split"},To=["title","disabled"],Do={viewBox:"0 0 1024 1024",fill:"currentColor"},Ho=["fill"],Ao=["title","disabled"],Io={class:"tb-item","data-key":"fillColor"},Fo={class:"toolbar-split"},No=["title","disabled"],Lo={viewBox:"0 0 1024 1024",fill:"currentColor"},Oo=["fill"],Vo=["title","disabled"],Wo={class:"tb-item","data-key":"border"},zo={class:"toolbar-split"},$o=["title","disabled"],_o={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},Go=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Ko=["title","disabled"],Uo={class:"tb-item","data-key":"hAlign"},Po={class:"tb-item","data-key":"vAlign"},Yo={class:"tb-item","data-key":"wrap"},Xo=["title"],jo={class:"tb-item","data-key":"merge"},Zo={class:"toolbar-split"},qo=["title","disabled"],Jo=["title","disabled"],Qt=2,Qo=6,en=34,tn=pt(t.defineComponent({__name:"toolbar",props:{locale:{},canUndo:{type:Boolean},canRedo:{type:Boolean},paintFmtActive:{type:Boolean},hasSelection:{type:Boolean},fontFamilyOptions:{},fontSizeOptions:{},selFontFamily:{},selFontSize:{},fontSizeInput:{},fontSizeMenuOpen:{type:Boolean},selFontWeight:{type:Boolean},selFontStyle:{type:Boolean},selUnderline:{type:Boolean},selStrikethrough:{type:Boolean},selTextColor:{},textColorMenuOpen:{type:Boolean},selFillColor:{},fillColorMenuOpen:{type:Boolean},cachedTextColor:{},cachedFillColor:{},borderMenuOpen:{type:Boolean},cachedBorder:{},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},themeVars:{}},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","font-family-change","font-size-change","h-align-change","v-align-change","font-size-input","text-color-change","fill-color-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","border-change","merge-change"],setup(e,{emit:h}){const g=[{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}],n={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 E(B,o){return d[B].includes(o)?"thick":n[B].includes(o)?"solid":"dashed"}const a=["undo","redo","paint","clear","sep1","font","fontSize","sep2","bold","italic","underline","strike","sep3","textColor","fillColor","border","sep4","hAlign","vAlign","wrap","merge"],V=t.ref(null),f=t.ref(null),te=t.ref(null),X=t.ref(null),w=t.ref(null),re=t.ref(null),L=t.ref(null),m=t.ref(null),ve=t.ref(new Set),pe=t.ref(!1),ye=t.ref(!1),U=t.ref(0),P=new Map,he=t.computed(()=>ve.value.size>0);function F(B){return ve.value.has(B)}function j(){for(const B of a){const o=P.get(B);if(o===void 0||o===0)return!0}return!1}function be(){if(!V.value)return;V.value.querySelectorAll(".tb-item").forEach(o=>{const v=o.dataset.key;if(!v)return;const fe=o.offsetWidth;fe>0?P.set(v,fe):P.has(v)||P.set(v,0)})}function we(B,o){if(B.size!==o.size)return!1;for(const v of B)if(!o.has(v))return!1;return!0}let le=0,c=0;function p(){le&&cancelAnimationFrame(le),!(c>60)&&(c++,le=requestAnimationFrame(()=>requestAnimationFrame(Ae)))}function Ae(){if(!V.value)return;const B=V.value.clientWidth-Qo*2;if(B<=0){p();return}c=0,(P.size===0||j())&&be();let o=0;for(const fe of a)o+=(P.get(fe)??0)+Qt;const v=new Set;if(o>B){const fe=B-en-Qt;let Me=0;for(let Se=0;Se<a.length;Se++){const Fe=a[Se],ge=(P.get(Fe)??0)+Qt;if(Me+ge>fe){for(let Le=Se;Le<a.length;Le++)v.add(a[Le]);break}Me+=ge}}we(v,ve.value)||(ve.value=v,U.value++,v.size===0&&(pe.value=!1))}let xe=null;const ie=t.ref(0),r=t.computed(()=>{const B=te.value,o={position:"fixed",top:"0px",right:"0px"};if(!B)return{...C.themeVars,...o};ie.value;const v=B.getBoundingClientRect();return{...C.themeVars,position:"fixed",top:`${v.bottom+4}px`,right:`${window.innerWidth-v.right}px`}});function y(){pe.value&&(ie.value++,t.nextTick(()=>Ae()))}function T(B){var v,fe;if(!pe.value)return;const o=B.target;(v=f.value)!=null&&v.contains(o)||(fe=te.value)!=null&&fe.contains(o)||(ye.value=!0,pe.value=!1,t.nextTick(()=>{ye.value=!1}))}function H(){pe.value=!pe.value}t.onMounted(()=>{p(),V.value&&(xe=new ResizeObserver(()=>{pe.value||p()}),xe.observe(V.value)),document.addEventListener("pointerdown",T,!0),window.addEventListener("resize",y),window.addEventListener("load",p),window.addEventListener("orientationchange",p)}),t.onBeforeUnmount(()=>{le&&cancelAnimationFrame(le),xe==null||xe.disconnect(),document.removeEventListener("pointerdown",T,!0),window.removeEventListener("resize",y),window.removeEventListener("load",p),window.removeEventListener("orientationchange",p)});const C=e,k=h;return(B,o)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:V,class:"toolbar"},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("undo"),to:f.value??void 0},[t.createElementVNode("div",oo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(G)(e.locale,"undo"),disabled:!e.canUndo,onClick:o[0]||(o[0]=v=>k("undo"))},[...o[39]||(o[39]=[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,no)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("redo"),to:f.value??void 0},[t.createElementVNode("div",ro,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(G)(e.locale,"redo"),disabled:!e.canRedo,onClick:o[1]||(o[1]=v=>k("redo"))},[...o[40]||(o[40]=[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,ao)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("paint"),to:f.value??void 0},[t.createElementVNode("div",io,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(G)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:o[2]||(o[2]=v=>k("paint-format"))},[...o[41]||(o[41]=[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,co)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("clear"),to:f.value??void 0},[t.createElementVNode("div",so,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(G)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:o[3]||(o[3]=v=>k("clear-format"))},[...o[42]||(o[42]=[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,uo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("sep1"),to:f.value??void 0},[o[43]||(o[43]=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:!F("font"),to:f.value??void 0},[t.createElementVNode("div",fo,[t.createVNode(Ut,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:F("font")?"100%":110,"menu-width":F("font")?120:void 0,"visible-count":8,title:t.unref(G)(e.locale,"fontFamily"),align:"right",onChange:o[4]||(o[4]=v=>k("font-family-change",v))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("fontSize"),to:f.value??void 0},[t.createElementVNode("div",mo,[t.createElementVNode("div",po,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(G)(e.locale,"fontSize"),onInput:o[5]||(o[5]=v=>k("font-size-input",v.target.value)),onBlur:o[6]||(o[6]=v=>k("font-size-blur")),onKeydown:o[7]||(o[7]=v=>k("font-size-keydown",v))},null,40,go),t.createVNode(Ut,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:F("fontSize")?"100%":56,"menu-width":F("fontSize")?120:56,"visible-count":9,title:t.unref(G)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":m.value,"onUpdate:modelOpen":o[8]||(o[8]=v=>k("update:font-size-menu-open",v)),onChange:o[9]||(o[9]=v=>k("font-size-change",v))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:m,class:"toolbar-font-size__btn",type:"button",title:t.unref(G)(e.locale,"fontSize"),onMousedown:o[10]||(o[10]=t.withModifiers(()=>{},["prevent"])),onClick:o[11]||(o[11]=v=>k("font-size-toggle"))},[...o[44]||(o[44]=[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,ho),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(G)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:o[12]||(o[12]=t.withModifiers(()=>{},["prevent"])),onClick:o[13]||(o[13]=v=>k("font-size-step-down"))},[...o[45]||(o[45]=[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,vo),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(G)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:o[14]||(o[14]=t.withModifiers(()=>{},["prevent"])),onClick:o[15]||(o[15]=v=>k("font-size-step-up"))},[...o[46]||(o[46]=[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,Co)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("sep2"),to:f.value??void 0},[o[47]||(o[47]=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:!F("bold"),to:f.value??void 0},[t.createElementVNode("div",bo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(G)(e.locale,"bold"),disabled:!e.hasSelection,onClick:o[16]||(o[16]=v=>k("bold-toggle"))},[...o[48]||(o[48]=[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,yo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("italic"),to:f.value??void 0},[t.createElementVNode("div",wo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(G)(e.locale,"italic"),disabled:!e.hasSelection,onClick:o[17]||(o[17]=v=>k("italic-toggle"))},[...o[49]||(o[49]=[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,ko)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("underline"),to:f.value??void 0},[t.createElementVNode("div",Eo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(G)(e.locale,"underline"),disabled:!e.hasSelection,onClick:o[18]||(o[18]=v=>k("underline-toggle"))},[...o[50]||(o[50]=[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,Bo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("strike"),to:f.value??void 0},[t.createElementVNode("div",Ro,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(G)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:o[19]||(o[19]=v=>k("strikethrough-toggle"))},[...o[51]||(o[51]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M1013.333333 552.618667A53.333333 53.333333 0 0 0 960 499.2h-381.269333a20.992 20.992 0 0 1-12.032-3.84c-30.805333-21.888-63.232-41.856-94.634667-61.098667-119.466667-73.173333-192-123.733333-192-207.488 0-95.36 94.165333-109.610667 150.314667-109.610666a193.706667 193.706667 0 0 1 131.456 32.597333 113.578667 113.578667 0 0 1 19.072 84.906667v12.8a53.333333 53.333333 0 1 0 106.666666 0v-11.434667a208.512 208.512 0 0 0-49.706666-161.152C595.157333 31.616 527.317333 10.581333 430.549333 10.581333c-156.074667 0-256.981333 84.864-256.981333 216.277334 0 118.314667 80.725333 192.512 170.666667 252.885333a10.666667 10.666667 0 0 1-5.930667 19.541333H64a53.333333 53.333333 0 0 0 0 106.666667h468.352a10.709333 10.709333 0 0 1 6.784 2.474667 185.130667 185.130667 0 0 1 82.432 147.882666c0 139.434667-146.176 150.272-191.018667 150.272-77.397333 0-133.930667-17.28-163.584-50.048a144.810667 144.810667 0 0 1-27.733333-115.2 53.333333 53.333333 0 0 0-106.154667-10.496A245.76 245.76 0 0 0 187.733333 928.128c51.2 56.490667 132.864 85.333333 242.688 85.333333 178.090667 0 297.685333-103.253333 297.685334-256.938666a258.517333 258.517333 0 0 0-36.224-134.272 10.666667 10.666667 0 0 1 9.216-16.085334H960a53.333333 53.333333 0 0 0 53.333333-53.546666z"})])],-1)])],10,xo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("sep3"),to:f.value??void 0},[o[52]||(o[52]=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:!F("textColor"),to:f.value??void 0},[t.createElementVNode("div",So,[t.createElementVNode("div",Mo,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(G)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:o[20]||(o[20]=v=>k("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",Do,[o[53]||(o[53]=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,Ho)]))],8,To),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:X,class:"toolbar-btn toolbar-split__arrow",title:t.unref(G)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:o[21]||(o[21]=v=>k("update:text-color-menu-open",!e.textColorMenuOpen))},[...o[54]||(o[54]=[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,Ao),t.createVNode(dl,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":X.value,"onUpdate:modelOpen":o[22]||(o[22]=v=>k("update:text-color-menu-open",v)),onChange:o[23]||(o[23]=v=>k("text-color-change",v))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("fillColor"),to:f.value??void 0},[t.createElementVNode("div",Io,[t.createElementVNode("div",Fo,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(G)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:o[24]||(o[24]=v=>k("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",Lo,[o[55]||(o[55]=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,Oo)]))],8,No),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:w,class:"toolbar-btn toolbar-split__arrow",title:t.unref(G)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:o[25]||(o[25]=v=>k("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...o[56]||(o[56]=[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,Vo),t.createVNode(dl,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":w.value,"onUpdate:modelOpen":o[26]||(o[26]=v=>k("update:fill-color-menu-open",v)),onChange:o[27]||(o[27]=v=>k("fill-color-change",v))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("border"),to:f.value??void 0},[t.createElementVNode("div",Wo,[t.createElementVNode("div",zo,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(G)(e.locale,"borders"),disabled:!e.hasSelection,onClick:o[28]||(o[28]=v=>k("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",_o,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(g,v=>t.createElementVNode("line",{key:v.name,x1:v.x1,y1:v.y1,x2:v.x2,y2:v.y2,"stroke-width":E(e.cachedBorder,v.name)==="thick"?3:1.5,"stroke-dasharray":E(e.cachedBorder,v.name)==="dashed"?"0 4":"none","stroke-linecap":E(e.cachedBorder,v.name)==="dashed"?"round":"square"},null,8,Go)),64))]))],8,$o),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:re,class:"toolbar-btn toolbar-split__arrow",title:t.unref(G)(e.locale,"borders"),disabled:!e.hasSelection,onClick:o[29]||(o[29]=v=>k("update:border-menu-open",!e.borderMenuOpen))},[...o[57]||(o[57]=[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,Ko),t.createVNode(Jl,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":re.value,"onUpdate:modelOpen":o[30]||(o[30]=v=>k("update:border-menu-open",v)),onChange:o[31]||(o[31]=v=>k("border-change",v))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("sep4"),to:f.value??void 0},[o[58]||(o[58]=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:!F("hAlign"),to:f.value??void 0},[t.createElementVNode("div",Uo,[t.createVNode(Ut,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:F("hAlign")?"100%":44,"menu-width":F("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(G)(e.locale,"hAlign"),onChange:o[32]||(o[32]=v=>k("h-align-change",v))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("vAlign"),to:f.value??void 0},[t.createElementVNode("div",Po,[t.createVNode(Ut,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:F("vAlign")?"100%":44,"menu-width":F("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(G)(e.locale,"vAlign"),onChange:o[33]||(o[33]=v=>k("v-align-change",v))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",Yo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(G)(e.locale,"wrap"),onClick:o[34]||(o[34]=v=>k("wrap-toggle"))},[...o[59]||(o[59]=[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,Xo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!F("merge"),to:f.value??void 0},[t.createElementVNode("div",jo,[t.createElementVNode("div",Zo,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(G)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:o[35]||(o[35]=v=>k("apply-merge"))},[...o[60]||(o[60]=[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,qo),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:L,class:"toolbar-btn toolbar-split__arrow",title:t.unref(G)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:o[36]||(o[36]=v=>k("update:merge-menu-open",!e.mergeMenuOpen))},[...o[61]||(o[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,Jo),t.createVNode(lo,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":L.value,"onUpdate:modelOpen":o[37]||(o[37]=v=>k("update:merge-menu-open",v)),onChange:o[38]||(o[38]=v=>k("merge-change",v))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),he.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:te,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":pe.value}]),type:"button",onClick:H},[...o[62]||(o[62]=[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:f,key:U.value,class:t.normalizeClass(["overflow-menu",{"no-anim":ye.value}]),style:t.normalizeStyle(r.value)},null,6)),[[t.vShow,pe.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-7da07fb8"]]),ln={class:"tab-list"},on=["onClick","onDblclick","onContextmenu"],nn=["value"],rn={key:1,class:"tab-item__name"},an=["title"],cn=pt(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:h}){const g=h;return(n,d)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:d[5]||(d[5]=E=>g("tabbar-contextmenu",E))},[t.createElementVNode("div",ln,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(E,a)=>(t.openBlock(),t.createElementBlock("div",{key:E.id,class:t.normalizeClass(["tab-item",{"tab-item--active":a===e.activeSheetIndex}]),onClick:V=>g("tab-click",a),onDblclick:t.withModifiers(V=>g("tab-dblclick",a),["prevent"]),onContextmenu:V=>g("tab-contextmenu",{ev:V,i:a})},[e.renTab===a?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:d[0]||(d[0]=V=>g("tab-rename-input",V.target.value)),onKeydown:d[1]||(d[1]=V=>g("tab-rename-keydown",V)),onBlur:d[2]||(d[2]=V=>g("tab-rename-commit")),onClick:d[3]||(d[3]=t.withModifiers(()=>{},["stop"]))},null,40,nn)):(t.openBlock(),t.createElementBlock("span",rn,t.toDisplayString(E.name),1))],42,on))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(G)(e.locale,"addSheet"),onClick:d[4]||(d[4]=E=>g("add-sheet"))}," + ",8,an)],32))}}),[["__scopeId","data-v-454e1a12"]]);function Je(e){let h="",g=e;do h=String.fromCharCode(65+g%26)+h,g=Math.floor(g/26)-1;while(g>=0);return h}function el(e){let h=0;for(let g=0;g<e.length;g++)h=h*26+(e.toUpperCase().charCodeAt(g)-64);return h-1}function gt(e){if(e==null)return null;if(typeof e=="number")return e;if(typeof e=="string"){const h=parseFloat(e);return e.endsWith("%")||isNaN(h)?null:h}return null}function tl(e){navigator.clipboard.writeText(e).catch(()=>{const h=document.createElement("textarea");h.value=e,h.style.position="fixed",h.style.opacity="0",document.body.appendChild(h),h.select(),document.execCommand("copy"),document.body.removeChild(h)})}function Bt(e,h){return`${e},${h}`}function Pt(e,h,g){const n=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!n)return null;const d=el(n[1]),E=parseInt(n[2],10)-1;return d<0||d>=h||E<0||E>=g?null:{col:d,row:E}}function ht(e,h){if(!h)return{x:0,y:0};const g=h.getBoundingClientRect();return{x:e.clientX-g.left,y:e.clientY-g.top}}function sn(e,h,g){const n=e.split(":");if(n.length!==2)return null;const d=Pt(n[0],h,g),E=Pt(n[1],h,g);return!d||!E?null:{sc:Math.min(d.col,E.col),sr:Math.min(d.row,E.row),ec:Math.max(d.col,E.col),er:Math.max(d.row,E.row)}}function dn(e,h,g,n,d){const E=g[Bt(e,h)];if(!E)return 0;const a=E.value;if(a.startsWith("="))return ul(Bt(e,h),g,n,d)??0;const V=parseFloat(a);return isNaN(V)?0:V}const Rt=new Map;function ll(){Rt.clear()}function ul(e,h,g,n){return un(e,h,g,n)}function un(e,h,g,n,d){if(Rt.has(e))return NaN;Rt.set(e,NaN);const E=h[e];if(!E)return NaN;const a=E.value;if(!a.startsWith("=")){const te=parseFloat(a),X=isNaN(te)?0:te;return Rt.set(e,X),X}const V=a.slice(1).trim();if(V.toUpperCase().startsWith("SUM(")&&V.endsWith(")")){const te=V.slice(4,-1).trim(),X=sn(te,g,n);if(X){let w=0;for(let re=X.sc;re<=X.ec;re++)for(let L=X.sr;L<=X.er;L++)w+=dn(re,L,h,g,n);return isNaN(w)?NaN:(Rt.set(e,w),w)}return NaN}return NaN}function ol(e,h,g){const n=[],d=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let E;for(;(E=d.exec(e))!==null;){const a=Pt(E[1],h,g);if(a)if(E[2]){const V=Pt(E[2],h,g);if(!V)continue;for(let f=Math.min(a.col,V.col);f<=Math.max(a.col,V.col);f++)for(let te=Math.min(a.row,V.row);te<=Math.max(a.row,V.row);te++)n.push(Bt(f,te))}else n.push(Bt(a.col,a.row))}return n}function fn(e,h,g,n,d){const E=g[Bt(e,h)];if(!E)return"";const a=E.value;if(!a.startsWith("="))return a;const V=ul(Bt(e,h),g,n,d);return isNaN(V)?"#ERROR":String(V)}function mn(e,h,g,n,d,E){return h===0&&g===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(a,V,f,te,X)=>{const w=V?el(f):el(f)+h,re=te?parseInt(X,10)-1:parseInt(X,10)-1+g;let L;w<0?L="A":w>=n?L=E(n-1):L=E(w);let m;return re<0?m="1":re>=d?m=String(d):m=String(re+1),(V||"")+L+(te||"")+m})}class pn{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(h){var n;const g=this.deps.get(h);if(g){for(const d of g)(n=this.rev.get(d))==null||n.delete(h);this.deps.delete(h)}}set(h,g){if(this.clear(h),g.length!==0){this.deps.set(h,g);for(const n of g)this.rev.has(n)||this.rev.set(n,new Set),this.rev.get(n).add(h)}}markDirty(h){const g=[h];for(;g.length>0;){const n=g.pop(),d=this.rev.get(n);if(d)for(const E of d)this.dirty.has(E)||(this.dirty.add(E),g.push(E))}}getDirtyAndClear(){const h=this.dirty;return this.dirty=new Set,h}rebuild(h,g,n){this.deps.clear(),this.rev.clear(),this.dirty.clear(),Rt.clear();for(const[d,E]of Object.entries(h))if(E.value.startsWith("=")){const a=ol(E.value.slice(1),g,n);this.set(d,a)}}}function gn(e,h){const g=t.reactive({rowCount:e.rowCount??h.rowCount,colCount:e.colCount??h.colCount,width:e.width,height:e.height,theme:e.theme??h.theme,locale:e.locale??h.locale});t.watchEffect(()=>{g.rowCount=e.rowCount??h.rowCount,g.colCount=e.colCount??h.colCount,g.width=e.width,g.height=e.height,g.theme=e.theme??h.theme,g.locale=e.locale??h.locale});const n=t.computed(()=>g.locale==="zh-CN"?"zh-CN":"en-US"),d=g.colCount,E=g.rowCount,a=t.reactive({}),V=t.reactive({}),f=new pn,te=t.ref(null),X=t.ref({col:0,row:0}),w=t.ref(null),re=t.ref(""),L=t.ref(new Array(d).fill(100)),m=t.ref(new Array(E).fill(void 0)),ve=t.ref(0),pe=t.ref(0),ye=(24-at)/2,U=new Map;let P=null;function he(R,x,S,Y){const Z=`${Y} ${S} ${x}px ${R}`,ae=U.get(Z);if(ae)return ae;if(!P){if(typeof document>"u")return{ascent:x*.8,descent:x*.2};P=document.createElement("canvas")}const de=P.getContext("2d");if(!de)return{ascent:x*.8,descent:x*.2};de.font=Z;const i=de.measureText("M"),b=i.actualBoundingBoxAscent,W=i.actualBoundingBoxDescent,z=b||x*.8,J=W||x*.2,ee=Math.max(z,x*.5),q=Math.max(J,x*.15),ue={ascent:ee,descent:q};return U.set(Z,ue),ue}let F=(R,x)=>`${R},${x}`,j=()=>null,be=()=>at,we=t.computed(()=>[0]),le=()=>24,c=(R,x,S,Y)=>({startCol:Math.min(R,S),startRow:Math.min(x,Y),endCol:Math.max(R,S),endRow:Math.max(x,Y)});function p(R,x){var i;const S=(i=a[F(R,x)])==null?void 0:i.style,Y=be(R,x),Z=typeof(S==null?void 0:S.fontFamily)=="string"&&S.fontFamily?S.fontFamily:Kt,ae=(S==null?void 0:S.fontWeight)==="bold"?"bold":"normal",de=(S==null?void 0:S.fontStyle)==="italic"?"italic":"normal";return he(Z,Y,ae,de)}function Ae(R,x,S,Y){if(!x)return[""];const Z=x.split(`
|
|
2
|
-
`),
|
|
3
|
-
`)[0]||
|
|
4
|
-
`).length,ut>ae&&(ae=ut)}else if(ee>S){S=ee;const $e=he(ue,ee,Ee,We);$e.ascent>Y&&(Y=$e.ascent),$e.descent>Z&&(Z=$e.descent)}}const i=S,b=ye*2+ae*i;return Math.min(500,Math.max(24,Math.round(b)))}le=T;function H(R){return m.value[R]===void 0}const C=t.computed(()=>{const R=[0];for(let x=0;x<E;x++)R.push(R[x]+le(x));return R}),k=t.computed(()=>ie.value[d]),B=t.computed(()=>C.value[E]);function o(R,x){return`${R},${x}`}F=o;function v(R){Reflect.deleteProperty(a,R)}function fe(R,x){const S=j(R,x);S?(X.value={col:S.range.startCol,row:S.range.startRow},te.value={...S.range}):(X.value={col:R,row:x},te.value={startCol:R,startRow:x,endCol:R,endRow:x})}function Me(R,x,S,Y){const Z=j(R,x);X.value=Z?{col:Z.range.startCol,row:Z.range.startRow}:{col:R,row:x},te.value=c(R,x,S,Y)}function Se(){Me(0,0,d-1,E-1)}function Fe(R,x){const S=te.value;return S?R>=S.startCol&&R<=S.endCol&&x>=S.startRow&&x<=S.endRow:!1}function ge(R,x){for(const S in V){const Y=V[S];if(Y&&R>=Y.startCol&&R<=Y.endCol&&x>=Y.startRow&&x<=Y.endRow)return{range:Y,anchor:S}}return null}j=ge;function Le(R,x){return V[o(R,x)]!==void 0}function D(R,x){const S=j(R,x);if(S&&R===S.range.startCol&&x===S.range.startRow){const Y=ie.value[S.range.endCol+1]-ie.value[R],Z=C.value[S.range.endRow+1]-C.value[x];return{w:Y,h:Z}}return{w:L.value[R],h:le(x)}}function O(R,x,S,Y){let Z=Math.min(R,S),ae=Math.max(R,S),de=Math.min(x,Y),i=Math.max(x,Y),b=!0;for(;b;){b=!1;for(const W in V){const z=V[W];if(!z)continue;z.startCol<=ae&&z.endCol>=Z&&z.startRow<=i&&z.endRow>=de&&(z.startCol<Z&&(Z=z.startCol,b=!0),z.endCol>ae&&(ae=z.endCol,b=!0),z.startRow<de&&(de=z.startRow,b=!0),z.endRow>i&&(i=z.endRow,b=!0))}}return{startCol:Z,startRow:de,endCol:ae,endRow:i}}c=O;let K=()=>{};function oe(R,x){var S;return((S=a[o(R,x)])==null?void 0:S.value)??""}function me(R,x){return ll(),fn(R,x,a,d,E)}function $(R,x,S){var de,i;const Y=o(R,x);if(ll(),S===""||S==null){f.clear(Y);const b=((de=a[Y])==null?void 0:de.style)??null;b?a[Y]={value:"",style:b}:v(Y),f.markDirty(Y);return}const Z=String(S),ae=((i=a[Y])==null?void 0:i.style)??null;a[Y]={value:Z,style:ae},Z.startsWith("=")?f.set(Y,ol(Z.slice(1),d,E)):f.clear(Y),f.markDirty(Y)}function se(R,x,S,Y){for(let Z=R;Z<=x;Z++)for(let ae=S;ae<=Y;ae++){const de=o(Z,ae);f.clear(de),v(de),f.markDirty(de),K(Z,ae)}}let ke=()=>{};function He(R){w.value||(w.value={...X.value},re.value=R??oe(X.value.col,X.value.row))}function Qe(){w.value&&(ke(),$(w.value.col,w.value.row,re.value),w.value=null,re.value="")}function lt(){w.value=null,re.value=""}function Ge(R,x){const S=X.value;let Y=Math.max(0,Math.min(d-1,S.col+R)),Z=Math.max(0,Math.min(E-1,S.row+x));const ae=j(S.col,S.row),de=j(Y,Z);ae&&de&&ae.anchor===de.anchor&&(R>0?Y=ae.range.endCol+1:R<0&&(Y=ae.range.startCol-1),x>0?Z=ae.range.endRow+1:x<0&&(Z=ae.range.startRow-1),Y=Math.max(0,Math.min(d-1,Y)),Z=Math.max(0,Math.min(E-1,Z))),fe(Y,Z)}function je(R,x){const S=Math.max(0,r.w-52-11),Y=Math.max(0,r.h-24-11),Z=ie.value[R],ae=C.value[x],de=j(R,x),i=de?ie.value[de.range.endCol+1]-ie.value[R]:L.value[R],b=de?C.value[de.range.endRow+1]-C.value[x]:le(x);let W=ve.value,z=pe.value;Z<W?W=Z:Z+i>W+S&&(W=Z+i-S),ae<z?z=ae:ae+b>z+Y&&(z=ae+b-Y),y(W,z)}function dt(R){const x=ie.value;if(R<0||R>=x[d])return-1;let S=0,Y=d-1;for(;S<Y;){const Z=S+Y+1>>1;x[Z]<=R?S=Z:Y=Z-1}return S}function Nt(R){const x=C.value;if(R<0||R>=x[E])return-1;let S=0,Y=E-1;for(;S<Y;){const Z=S+Y+1>>1;x[Z]<=R?S=Z:Y=Z-1}return S}const Pe={props:g,locale:n,colCount:d,rowCount:E,cells:a,merges:V,formulaDeps:f,selection:te,activeCell:X,editingCell:w,editValue:re,colWidths:L,rowHeights:m,scrollX:ve,scrollY:pe,BASE_CELL_VPAD:ye,fontMetricsCache:U,fontMetricsCanvas:P,measureFontMetrics:he,_getFontMetricsForCell:p,getWrappedLines:Ae,cellFontSize:xe,colPositions:ie,getRowHeight:T,_isAutoRow:H,rowPositions:C,totalWidth:k,totalHeight:B,selectCell:fe,selectRange:Me,selectAll:Se,isSelected:Fe,cellKey:o,delCell:v,findMerge:ge,_isMergeAnchor:Le,_mergedSpan:D,expandSelectionForMerges:O,getCellRaw:oe,getCellValue:me,setCellValue:$,clearCellsInRange:se,startEdit:He,commitEdit:Qe,cancelEdit:lt,moveActive:Ge,ensureVisible:je,hitCol:dt,hitRow:Nt,viewSize:r};return ke=()=>{var R;return(R=Pe.saveUndo)==null?void 0:R.call(Pe)},K=(R,x)=>{var S;return(S=Pe.syncCellBorders)==null?void 0:S.call(Pe,R,x)},y=(R,x)=>{var S;return(S=Pe.clampScroll)==null?void 0:S.call(Pe,R,x)},Pe}function hn(e,h){const g=t.ref([]),n=t.ref([]);function d(i){const b={};for(const[W,z]of Object.entries(i))b[W]={value:z.value,style:z.style};return b}function E(){return h.saveSheet(),{sheets:h.sheets.value.map(i=>({id:i.id,name:i.name,cells:d(i.cells),merges:i.merges?{...i.merges}:{},selection:i.selection?{...i.selection}:null,activeCell:i.activeCell?{...i.activeCell}:{col:0,row:0},scrollX:i.scrollX,scrollY:i.scrollY,colWidths:[...i.colWidths],rowHeights:[...i.rowHeights]})),activeSheetIndex:h.activeSheetIndex.value}}function a(i){h.sheets.value=i.sheets.map(b=>({...b,cells:d(b.cells)})),h.loadSheet(Math.max(0,Math.min(i.activeSheetIndex,h.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function V(){const i=E(),b=g.value[g.value.length-1];b&&JSON.stringify(b)===JSON.stringify(i)||(g.value.push(i),n.value=[],g.value.length>50&&g.value.shift())}e.saveUndo=V;function f(){var i;g.value.length&&(n.value.push(E()),a(g.value.pop()),(i=e.scheduleRender)==null||i.call(e),t.nextTick(()=>{var b;return(b=e.emitModelData)==null?void 0:b.call(e)}))}function te(){var i;n.value.length&&(g.value.push(E()),a(n.value.pop()),(i=e.scheduleRender)==null||i.call(e),t.nextTick(()=>{var b;return(b=e.emitModelData)==null?void 0:b.call(e)}))}const X=t.computed(()=>g.value.length>0),w=t.computed(()=>n.value.length>0),re=t.computed(()=>!!e.selection.value),L=t.ref(null);function m(){var W;const i=e.selection.value;if(!i)return;const b={};for(let z=i.startCol;z<=i.endCol;z++)for(let J=i.startRow;J<=i.endRow;J++)b[`${z-i.startCol},${J-i.startRow}`]=((W=e.cells[e.cellKey(z,J)])==null?void 0:W.style)??null;L.value={styles:b}}function ve(){var W,z,J,ee;const i=L.value,b=e.selection.value;if(!(!i||!b)){V();for(let q=b.startCol;q<=b.endCol;q++)for(let ue=b.startRow;ue<=b.endRow;ue++){const Ee=e.findMerge(q,ue);if(Ee&&(q!==Ee.range.startCol||ue!==Ee.range.startRow))continue;const We=i.styles[`${q-b.startCol},${ue-b.startRow}`]??null,Ie=e.cellKey(q,ue),$e=((W=e.cells[Ie])==null?void 0:W.value)??"";$e===""&&We===null?e.delCell(Ie):e.cells[Ie]={value:$e,style:We},(z=e.syncCellBorders)==null||z.call(e,q,ue)}L.value=null,(J=e.scheduleRender)==null||J.call(e),(ee=e.emitModelData)==null||ee.call(e)}}function pe(){var b,W,z,J;const i=e.selection.value;if(i){V();for(let ee=i.startCol;ee<=i.endCol;ee++)for(let q=i.startRow;q<=i.endRow;q++){const ue=e.findMerge(ee,q);if(ue&&(ee!==ue.range.startCol||q!==ue.range.startRow))continue;const Ee=e.cellKey(ee,q),We=((b=e.cells[Ee])==null?void 0:b.value)??"";We===""?e.delCell(Ee):e.cells[Ee]={value:We,style:null},(W=e.syncCellBorders)==null||W.call(e,ee,q)}(z=e.scheduleRender)==null||z.call(e),(J=e.emitModelData)==null||J.call(e)}}const ye=t.computed(()=>xl.map(i=>({...i,label:i.value===""?G(e.locale.value,"fontDefault"):i.label}))),U=t.computed(()=>Sl.map(i=>({...i,label:String(i.value)}))),P="\0",he=t.computed(()=>{var z;const i=e.selection.value;if(!i)return"";let b,W=!1;for(let J=i.startCol;J<=i.endCol&&!W;J++)for(let ee=i.startRow;ee<=i.endRow&&!W;ee++){const q=e.findMerge(J,ee);if(q&&(J!==q.range.startCol||ee!==q.range.startRow))continue;const ue=(z=e.cells[e.cellKey(J,ee)])==null?void 0:z.style,Ee=typeof(ue==null?void 0:ue.fontFamily)=="string"?ue.fontFamily:"";b===void 0?b=Ee:Ee!==b&&(W=!0)}return W?P:b??""}),F=t.computed(()=>{const i=e.selection.value;if(!i)return at;let b,W=!1;for(let z=i.startCol;z<=i.endCol&&!W;z++)for(let J=i.startRow;J<=i.endRow&&!W;J++){const ee=e.findMerge(z,J);if(ee&&(z!==ee.range.startCol||J!==ee.range.startRow))continue;const q=e.cellFontSize(z,J);b===void 0?b=q:q!==b&&(W=!0)}return W?0:b??at});function j(i,b){var z,J,ee,q;const W=e.selection.value;if(W){V();for(let ue=W.startCol;ue<=W.endCol;ue++)for(let Ee=W.startRow;Ee<=W.endRow;Ee++){const We=e.findMerge(ue,Ee);if(We&&(ue!==We.range.startCol||Ee!==We.range.startRow))continue;const Ie=e.cellKey(ue,Ee),$e=((z=e.cells[Ie])==null?void 0:z.value)??"",Oe=(J=e.cells[Ie])!=null&&J.style?{...e.cells[Ie].style}:{};b===""||b===null||b===void 0||b===0?Reflect.deleteProperty(Oe,i):Oe[i]=b;const _e=Object.keys(Oe).length?Oe:null;$e===""&&_e===null?e.delCell(Ie):e.cells[Ie]={value:$e,style:_e}}(ee=e.scheduleRender)==null||ee.call(e),(q=e.emitModelData)==null||q.call(e)}}function be(i){j("fontFamily",i===""?"":i)}const we=t.ref(!1),le=t.ref(!1),c=t.ref(!1),p=t.ref(!1),Ae=t.ref(!1);function xe(i){j("fontSize",i),we.value=!1}const ie=t.computed(()=>Fl.map(i=>({label:G(e.locale.value,i.labelKey),value:i.value,icon:i.icon}))),r=t.computed(()=>Nl.map(i=>({label:G(e.locale.value,i.labelKey),value:i.value,icon:i.icon}))),y=t.computed(()=>{var z;const i=e.selection.value;if(!i)return"left";const b=(z=e.cells[e.cellKey(i.startCol,i.startRow)])==null?void 0:z.style,W=typeof(b==null?void 0:b.textAlign)=="string"?b.textAlign:"";return W==="center"||W==="right"?W:"left"}),T=t.computed(()=>{var z;const i=e.selection.value;if(!i)return"top";const b=(z=e.cells[e.cellKey(i.startCol,i.startRow)])==null?void 0:z.style,W=typeof(b==null?void 0:b.verticalAlign)=="string"?b.verticalAlign:"";return W==="middle"||W==="bottom"?W:"top"}),H=t.computed(()=>{var W;const i=e.selection.value;if(!i)return!1;const b=(W=e.cells[e.cellKey(i.startCol,i.startRow)])==null?void 0:W.style;return(b==null?void 0:b.wrap)==="wrap"});function C(i){j("textAlign",i)}function k(i){j("verticalAlign",i)}function B(){if(!e.selection.value)return;const b=H.value;j("wrap",b?void 0:"wrap")}const o=t.ref(""),v=we;t.watch(F,i=>{o.value=i===0?"":String(i)},{immediate:!0});function fe(i){const b=i.replace(/[^\d]/g,"");o.value=b;const W=parseInt(b,10);!isNaN(W)&&W>=5&&W<=72&&W!==F.value&&j("fontSize",W)}function Me(){const i=o.value.trim();if(!i){o.value=F.value===0?"":String(F.value);return}let b=parseInt(i,10);isNaN(b)?b=F.value===0?at:F.value:b=Math.max(5,Math.min(72,b)),o.value=String(b),b!==F.value&&j("fontSize",b)}function Se(i){i.key==="Enter"&&i.target.blur()}function Fe(i){i&&i.preventDefault(),v.value=!v.value,v.value&&(c&&(c.value=!1),le&&(le.value=!1),p.value=!1,Ae.value=!1)}function ge(){const i=F.value===0?at:F.value,b=Math.min(72,i+1);j("fontSize",b),o.value=String(b),v.value=!1}function Le(){const i=F.value===0?at:F.value,b=Math.max(5,i-1);j("fontSize",b),o.value=String(b),v.value=!1}function D(i){var J;const b=e.selection.value;if(!b)return!1;let W,z=!1;for(let ee=b.startCol;ee<=b.endCol&&!z;ee++)for(let q=b.startRow;q<=b.endRow&&!z;q++){const ue=e.findMerge(ee,q);if(ue&&(ee!==ue.range.startCol||q!==ue.range.startRow))continue;const Ee=(J=e.cells[e.cellKey(ee,q)])==null?void 0:J.style,We=!!(Ee!=null&&Ee[i]);W===void 0?W=We:We!==W&&(z=!0)}return!z&&W===!0}const O=t.computed(()=>D("fontWeight")),K=t.computed(()=>D("fontStyle")),oe=t.computed(()=>D("underline")),me=t.computed(()=>D("strikethrough"));function $(){j("fontWeight",O.value?"":"bold")}function se(){j("fontStyle",K.value?"":"italic")}function ke(){j("underline",oe.value?"":"underline")}function He(){j("strikethrough",me.value?"":"line-through")}const Qe=t.ref(""),lt=t.ref(""),Ge=p,je=Ae;function dt(){Ge.value=!Ge.value,je.value=!1,le&&(le.value=!1),c&&(c.value=!1)}function Nt(){je.value=!je.value,Ge.value=!1,le&&(le.value=!1),c&&(c.value=!1)}function Pe(i){le&&(le.value=i),i&&(Ge.value=!1,je.value=!1,c&&(c.value=!1))}function R(i){Qe.value=i,j("color",i===""?"":i)}function x(i){lt.value=i,j("backgroundColor",i===""?"":i)}function S(){j("color",Qe.value===""?"":Qe.value)}function Y(){j("backgroundColor",lt.value===""?"":lt.value)}const Z=t.computed(()=>{var z;const i=e.selection.value;if(!i)return"";let b,W=!1;for(let J=i.startCol;J<=i.endCol&&!W;J++)for(let ee=i.startRow;ee<=i.endRow&&!W;ee++){const q=e.findMerge(J,ee);if(q&&(J!==q.range.startCol||ee!==q.range.startRow))continue;const ue=(z=e.cells[e.cellKey(J,ee)])==null?void 0:z.style,Ee=typeof(ue==null?void 0:ue.color)=="string"?ue.color:"";b===void 0?b=Ee:Ee!==b&&(W=!0)}return W?"":b??""}),ae=t.computed(()=>{var z;const i=e.selection.value;if(!i)return"";let b,W=!1;for(let J=i.startCol;J<=i.endCol&&!W;J++)for(let ee=i.startRow;ee<=i.endRow&&!W;ee++){const q=e.findMerge(J,ee);if(q&&(J!==q.range.startCol||ee!==q.range.startRow))continue;const ue=(z=e.cells[e.cellKey(J,ee)])==null?void 0:z.style,Ee=typeof(ue==null?void 0:ue.backgroundColor)=="string"?ue.backgroundColor:"";b===void 0?b=Ee:Ee!==b&&(W=!0)}return W?"":b??""});return{undoStack:g,redoStack:n,cloneCells:d,takeSnap:E,restoreSnap:a,saveUndo:V,undo:f,redo:te,canUndo:X,canRedo:w,hasSelection:re,paintFmt:L,onPaintFormat:m,applyPaintFormat:ve,clearFormat:pe,fontFamilyOptions:ye,fontSizeOptions:U,FONT_FAMILY_MIXED:P,selFontFamily:he,selFontSize:F,applyStyleToSelection:j,onFontFamilyChange:be,onFontSizeChange:xe,hAlignOptions:ie,vAlignOptions:r,selHAlign:y,selVAlign:T,selWrap:H,onHAlignChange:C,onVAlignChange:k,onWrapToggle:B,fontSizeInput:o,fontSizeMenuOpen:v,onFontSizeInput:fe,onFontSizeBlur:Me,onFontSizeKeydown:Se,toggleFontSizeMenu:Fe,onFontSizeStepUp:ge,onFontSizeStepDown:Le,selFontWeight:O,selFontStyle:K,selUnderline:oe,selStrikethrough:me,toggleFontWeight:$,toggleFontStyle:se,toggleUnderline:ke,toggleStrikethrough:He,cachedTextColor:Qe,cachedFillColor:lt,textColorMenuOpen:Ge,fillColorMenuOpen:je,_toggleTextColorMenu:dt,_toggleFillColorMenu:Nt,onBorderMenuToggle:Pe,onTextColorChange:R,onFillColorChange:x,applyCachedTextColor:S,applyCachedFillColor:Y,selTextColor:Z,selFillColor:ae}}function vn(e,h){h.borderMenuOpen&&(e.borderMenuOpen=h.borderMenuOpen),h.mergeMenuOpen&&(e.mergeMenuOpen=h.mergeMenuOpen),(()=>{const n=e.borderMenuOpen,d=e.mergeMenuOpen;e.onBorderMenuToggle=E=>{n&&(n.value=E),E&&(e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1,d&&(d.value=!1))},e.toggleFontSizeMenu=E=>{E&&E.preventDefault(),e.fontSizeMenuOpen.value=!e.fontSizeMenuOpen.value,e.fontSizeMenuOpen.value&&(d&&(d.value=!1),n&&(n.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,n&&(n.value=!1),d&&(d.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,n&&(n.value=!1),d&&(d.value=!1)}})()}function Cn(e,h){const g=t.ref("none"),n=t.ref(!1),d="#444";function E(r,y,T,H){const C=e.findMerge(y,T),k=C?C.range.endCol:y,B=C?C.range.endRow:T,o=C?C.range.startCol:y,fe=(C?C.range.startRow:T)===H.startRow,Me=B===H.endRow,Se=o===H.startCol,Fe=k===H.endCol,ge={top:0,bottom:0,left:0,right:0};switch(r){case"none":return ge;case"bottom":Me&&(ge.bottom=1);break;case"top":fe&&(ge.top=1);break;case"left":Se&&(ge.left=1);break;case"right":Fe&&(ge.right=1);break;case"all":ge.top=1,ge.bottom=1,ge.left=1,ge.right=1;break;case"outer":fe&&(ge.top=1),Me&&(ge.bottom=1),Se&&(ge.left=1),Fe&&(ge.right=1);break;case"thickOuter":fe&&(ge.top=2),Me&&(ge.bottom=2),Se&&(ge.left=2),Fe&&(ge.right=2);break}return ge}function a(r,y,T,H,C){var ge,Le;if(r<0||y<0||r>=e.colCount||y>=e.rowCount)return;const k=e.findMerge(r,y);if(k&&(T==="Top"&&y!==k.range.startRow||T==="Bottom"&&y!==k.range.endRow||T==="Left"&&r!==k.range.startCol||T==="Right"&&r!==k.range.endCol))return;const B=k?k.anchor:e.cellKey(r,y),o=((ge=e.cells[B])==null?void 0:ge.value)??"",v=(Le=e.cells[B])!=null&&Le.style?{...e.cells[B].style}:{},fe=`border${T}Width`;H===0?C&&Reflect.deleteProperty(v,fe):(v[fe]=H,v.borderColor=d),["Top","Bottom","Left","Right"].some(D=>v[`border${D}Width`]!==void 0)||Reflect.deleteProperty(v,"borderColor");const Fe=Object.keys(v).length?v:null;o===""&&Fe===null?e.delCell(B):e.cells[B]={value:o,style:Fe}}function V(r,y){var fe;const T=e.findMerge(r,y),H=T?T.anchor:e.cellKey(r,y),C=(fe=e.cells[H])==null?void 0:fe.style,k=(C==null?void 0:C.borderTopWidth)||0,B=(C==null?void 0:C.borderBottomWidth)||0,o=(C==null?void 0:C.borderLeftWidth)||0,v=(C==null?void 0:C.borderRightWidth)||0;a(r,y-1,"Bottom",k,!0),a(r,y+1,"Top",B,!0),a(r-1,y,"Right",o,!0),a(r+1,y,"Left",v,!0)}e.syncCellBorders=V;function f(r,y,T,H=!0){var Se,Fe;const C=e.cellKey(r,y),k=((Se=e.cells[C])==null?void 0:Se.value)??"",B=(Fe=e.cells[C])!=null&&Fe.style?{...e.cells[C].style}:{},o=["Top","Bottom","Left","Right"],v=[T.top,T.bottom,T.left,T.right];for(let ge=0;ge<4;ge++){const Le=`border${o[ge]}Width`;v[ge]===0?H&&Reflect.deleteProperty(B,Le):(B[Le]=v[ge],B.borderColor=d)}o.some(ge=>B[`border${ge}Width`]!==void 0)||Reflect.deleteProperty(B,"borderColor");const Me=Object.keys(B).length?B:null;k===""&&Me===null?e.delCell(C):e.cells[C]={value:k,style:Me},V(r,y)}function te(r){var T,H;g.value=r;const y=e.selection.value;if(y){if(h.saveUndo(),r==="none")for(let C=y.startCol;C<=y.endCol;C++)for(let k=y.startRow;k<=y.endRow;k++){const B=e.findMerge(C,k);B&&(C!==B.range.startCol||k!==B.range.startRow)||f(C,k,{top:0,bottom:0,left:0,right:0},!0)}else for(let C=y.startCol;C<=y.endCol;C++)for(let k=y.startRow;k<=y.endRow;k++){const B=e.findMerge(C,k);if(B&&(C!==B.range.startCol||k!==B.range.startRow))continue;const o=E(r,C,k,y);f(C,k,o,!1)}(T=e.scheduleRender)==null||T.call(e),(H=e.emitModelData)==null||H.call(e)}}function X(){te(g.value)}function w(r,y,T){var k,B;const H=e.findMerge(r,y);if(H){const o=(k=e.cells[H.anchor])==null?void 0:k.style;return T==="Top"&&y===H.range.startRow?(o==null?void 0:o.borderTopWidth)||0:T==="Bottom"&&y===H.range.endRow?(o==null?void 0:o.borderBottomWidth)||0:T==="Left"&&r===H.range.startCol?(o==null?void 0:o.borderLeftWidth)||0:T==="Right"&&r===H.range.endCol&&(o==null?void 0:o.borderRightWidth)||0}const C=(B=e.cells[e.cellKey(r,y)])==null?void 0:B.style;return(C==null?void 0:C[`border${T}Width`])||0}const re=t.ref(!1);function L(r){re.value=r,r&&(h.textColorMenuOpen.value=!1,h.fillColorMenuOpen.value=!1,n.value=!1,h.fontSizeMenuOpen.value=!1)}function m(r,y,T,H){const C=[];for(const k in e.merges){const B=e.merges[k];B&&B.startCol<=T&&B.endCol>=r&&B.startRow<=H&&B.endRow>=y&&C.push(k)}for(const k of C)Reflect.deleteProperty(e.merges,k)}function ve(){var C,k,B,o;const r=e.selection.value;if(!r||r.startCol===r.endCol&&r.startRow===r.endRow)return;h.saveUndo(),m(r.startCol,r.startRow,r.endCol,r.endRow);const y=e.cellKey(r.startCol,r.startRow),T=((C=e.cells[y])==null?void 0:C.value)??"";for(let v=r.startCol;v<=r.endCol;v++)for(let fe=r.startRow;fe<=r.endRow;fe++)v===r.startCol&&fe===r.startRow||e.clearCellsInRange(v,v,fe,fe);const H=(k=e.cells[y])!=null&&k.style?{...e.cells[y].style}:{};H.textAlign="center",e.cells[y]={value:T,style:H},e.merges[y]={startCol:r.startCol,startRow:r.startRow,endCol:r.endCol,endRow:r.endRow},e.selectCell(r.startCol,r.startRow),(B=e.scheduleRender)==null||B.call(e),(o=e.emitModelData)==null||o.call(e)}function pe(){var y,T,H;const r=e.selection.value;if(!(!r||r.startCol===r.endCol)){h.saveUndo();for(let C=r.startRow;C<=r.endRow;C++){m(r.startCol,C,r.endCol,C);const k=e.cellKey(r.startCol,C);(y=e.cells[k])==null||y.value;for(let B=r.startCol+1;B<=r.endCol;B++)e.clearCellsInRange(B,B,C,C);e.merges[k]={startCol:r.startCol,startRow:C,endCol:r.endCol,endRow:C}}e.selectRange(r.startCol,r.startRow,r.endCol,r.endRow),(T=e.scheduleRender)==null||T.call(e),(H=e.emitModelData)==null||H.call(e)}}function ye(){var T,H,C;const r=e.selection.value;if(!r||r.startCol===r.endCol&&r.startRow===r.endRow)return;h.saveUndo(),m(r.startCol,r.startRow,r.endCol,r.endRow);const y=e.cellKey(r.startCol,r.startRow);(T=e.cells[y])==null||T.value;for(let k=r.startCol;k<=r.endCol;k++)for(let B=r.startRow;B<=r.endRow;B++)k===r.startCol&&B===r.startRow||e.clearCellsInRange(k,k,B,B);e.merges[y]={startCol:r.startCol,startRow:r.startRow,endCol:r.endCol,endRow:r.endRow},e.selectCell(r.startCol,r.startRow),(H=e.scheduleRender)==null||H.call(e),(C=e.emitModelData)==null||C.call(e)}function U(){var y,T;const r=e.selection.value;r&&(h.saveUndo(),m(r.startCol,r.startRow,r.endCol,r.endRow),(y=e.scheduleRender)==null||y.call(e),(T=e.emitModelData)==null||T.call(e))}function P(){const r=e.selection.value;if(!r)return;const y=e.findMerge(r.startCol,r.startRow);y&&r.startCol===y.range.startCol&&r.startRow===y.range.startRow&&r.endCol===y.range.endCol&&r.endRow===y.range.endRow?U():ve()}function he(r){switch(r){case"mergeCenter":ve();break;case"mergeAcross":pe();break;case"mergeCells":ye();break;case"unmergeCells":U();break}}let F=null,j=[];function be(r,y,T,H){var C;j=[];for(let k=T;k<=H;k++){const B=[];for(let o=r;o<=y;o++){const v=(C=e.cells[e.cellKey(o,k)])==null?void 0:C.style;B.push(v?{...v}:null)}j.push(B)}}function we(r,y,T,H){const C=e.cellKey(r,y);if(ll(),T===""||T==null){e.formulaDeps.clear(C),H?e.cells[C]={value:"",style:{...H}}:e.delCell(C),e.formulaDeps.markDirty(C);return}e.cells[C]={value:T,style:H?{...H}:null},T.startsWith("=")?e.formulaDeps.set(C,ol(T.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(C),e.formulaDeps.markDirty(C)}function le(){const r=e.selection.value;if(!r)return;F={...r},be(r.startCol,r.endCol,r.startRow,r.endRow);const y=[];for(let T=r.startRow;T<=r.endRow;T++){const H=[];for(let C=r.startCol;C<=r.endCol;C++)H.push(e.getCellRaw(C,T));y.push(H.join(" "))}tl(y.join(`
|
|
5
|
-
`))}function
|
|
6
|
-
`))}else if(
|
|
7
|
-
`))}}}async function p(){var k;let r;try{r=await navigator.clipboard.readText()}catch{return}if(!r&&r!=="")return;const y=r.split(/\r?\n/),T=e.activeCell.value,H=F,C=H&&j.length>0;for(let B=0;B<y.length;B++){const o=y[B].split(" ");for(let v=0;v<o.length;v++){const fe=T.col+v,Me=T.row+B;if(fe<e.colCount&&Me<e.rowCount){let Se=o[v];if(Se.startsWith("=")&&H&&(Se=mn(Se,fe-(H.startCol+v),Me-(H.startRow+B),e.colCount,e.rowCount,Je)),C&&B<j.length&&v<(((k=j[B])==null?void 0:k.length)??0)){const Fe=j[B][v]??null;we(fe,Me,Se,Fe),V(fe,Me)}else e.setCellValue(fe,Me,Se)}}}}function Ae(){var r;if(le(),e.selection.value){const y=e.selection.value;e.clearCellsInRange(y.startCol,y.endCol,y.startRow,y.endRow),(r=e.scheduleRender)==null||r.call(e)}}function xe(){var r;if(e.selection.value){const y=e.selection.value;e.clearCellsInRange(y.startCol,y.endCol,y.startRow,y.endRow),(r=e.scheduleRender)==null||r.call(e)}}function ie(){var k,B;const r=e.selection.value;if(!r)return;h.saveUndo();const y=r.startCol,T=r.startRow,H=r.endCol,C=r.endRow;if(T===C)if(H+1<e.colCount){const o=`${Je(y)}${T+1}:${Je(H)}${T+1}`;e.setCellValue(H+1,T,`=SUM(${o})`)}else{const o=`${Je(y)}${T+1}:${Je(H-1)}${T+1}`;e.setCellValue(H,T,`=SUM(${o})`)}else for(let o=y;o<=H;o++)if(C+1<e.rowCount){const v=`${Je(o)}${T+1}:${Je(o)}${C+1}`;e.setCellValue(o,C+1,`=SUM(${v})`)}else{const v=`${Je(o)}${T+1}:${Je(o)}${C}`;e.setCellValue(o,C,`=SUM(${v})`)}(k=e.scheduleRender)==null||k.call(e),(B=e.emitModelData)==null||B.call(e)}return{cachedBorder:g,borderMenuOpen:n,BORDER_COLOR:d,borderTypeToWidths:E,onBorderChange:te,setCellBorderSide:a,syncCellBorders:V,applyBorderToCell:f,applyCachedBorder:X,cellBorderWidth:w,mergeMenuOpen:re,onMergeMenuToggle:L,removeOverlappingMerges:m,mergeAndCenter:ve,mergeAcross:pe,mergeCells:ye,unmergeCells:U,onApplyMerge:P,onMergeChange:he,copySourceRange:null,copySourceStyles:[],captureStyles:be,setCellWithStyle:we,copyToClipboard:le,copyRowCol:c,pasteFromClipboard:p,cutSelected:Ae,clearSelected:xe,sumSelected:ie}}function bn(e,h,g,n){const d={},E=n(h),a=n(g);return E!=null&&(d.width=`${E}px`),a!=null&&(d.height=`${a}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 yn(e,h,g,n){function d(D,O){var oe,me;const K=O-D+1;for(let $=D;$<=O;$++)for(let se=0;se<e.colCount;se++)e.delCell(e.cellKey(se,$));for(let $=D;$<e.rowCount-K;$++){for(let se=0;se<e.colCount;se++){const ke=e.cellKey(se,$+K),He=e.cellKey(se,$);e.cells[ke]?(e.cells[He]=e.cells[ke],e.delCell(ke)):e.delCell(He)}e.rowHeights.value[$]=e.rowHeights.value[$+K]}for(let $=e.rowCount-K;$<e.rowCount;$++){for(let se=0;se<e.colCount;se++)e.delCell(e.cellKey(se,$));e.rowHeights.value[$]=void 0}if(D>0)for(let $=0;$<e.colCount;$++)(oe=e.syncCellBorders)==null||oe.call(e,$,D-1),(me=e.syncCellBorders)==null||me.call(e,$,D)}function E(D,O){const K=O-D+1;if(!(O>=e.rowCount-1)){for(let oe=e.rowCount-1;oe>O;oe--){for(let me=0;me<e.colCount;me++){const $=e.cellKey(me,oe-K),se=e.cellKey(me,oe);e.cells[$]?e.cells[se]=e.cells[$]:e.delCell(se)}e.rowHeights.value[oe]=e.rowHeights.value[oe-K]}for(let oe=O+1;oe<=O+K;oe++){for(let me=0;me<e.colCount;me++)e.delCell(e.cellKey(me,oe));e.rowHeights.value[oe]=void 0}}}function a(D,O){const K=O-D+1;if(!(O>=e.colCount-1)){for(let oe=e.colCount-1;oe>O;oe--){for(let me=0;me<e.rowCount;me++){const $=e.cellKey(oe-K,me),se=e.cellKey(oe,me);e.cells[$]?e.cells[se]=e.cells[$]:e.delCell(se)}e.colWidths.value[oe]=e.colWidths.value[oe-K]}for(let oe=O+1;oe<=O+K;oe++){for(let me=0;me<e.rowCount;me++)e.delCell(e.cellKey(oe,me));e.colWidths.value[oe]=100}}}function V(D,O){var oe,me;const K=O-D+1;for(let $=D;$<=O;$++)for(let se=0;se<e.rowCount;se++)e.delCell(e.cellKey($,se));for(let $=D;$<e.colCount-K;$++){for(let se=0;se<e.rowCount;se++){const ke=e.cellKey($+K,se),He=e.cellKey($,se);e.cells[ke]?(e.cells[He]=e.cells[ke],e.delCell(ke)):e.delCell(He)}e.colWidths.value[$]=e.colWidths.value[$+K]}for(let $=e.colCount-K;$<e.colCount;$++){for(let se=0;se<e.rowCount;se++)e.delCell(e.cellKey($,se));e.colWidths.value[$]=100}if(D>0)for(let $=0;$<e.rowCount;$++)(oe=e.syncCellBorders)==null||oe.call(e,D-1,$),(me=e.syncCellBorders)==null||me.call(e,D,$)}let f=0;function te(){return f++,`s_${f}`}function X(D){return{id:te(),name:D,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 w=t.ref([X("Sheet1")]),re=t.ref(0);function L(){const D=w.value[re.value];D&&(D.cells={...e.cells},D.merges={...e.merges},D.selection=e.selection.value?{...e.selection.value}:null,D.activeCell={...e.activeCell.value},D.scrollX=e.scrollX.value,D.scrollY=e.scrollY.value,D.colWidths=[...e.colWidths.value],D.rowHeights=[...e.rowHeights.value])}function m(D){const O=w.value[D];O&&(Object.keys(e.cells).forEach(K=>e.delCell(K)),Object.assign(e.cells,O.cells),Object.keys(e.merges).forEach(K=>Reflect.deleteProperty(e.merges,K)),O.merges&&Object.assign(e.merges,O.merges),e.selection.value=O.selection?{...O.selection}:null,e.activeCell.value={...O.activeCell},e.scrollX.value=O.scrollX,e.scrollY.value=O.scrollY,e.colWidths.value=[...O.colWidths],e.rowHeights.value=[...O.rowHeights],re.value=D)}function ve(D){D===re.value||D<0||D>=w.value.length||(e.cancelEdit(),L(),m(D))}function pe(D){return h.saveUndo(),e.cancelEdit(),L(),w.value.push(X(D??`Sheet${w.value.length+1}`)),m(w.value.length-1),w.value.length-1}function ye(D){return w.value.length<=1||(h.saveUndo(),e.cancelEdit(),w.value.splice(D,1),m(Math.min(D,w.value.length-1))),re.value}function U(D,O){w.value[D]&&O.trim()&&(h.saveUndo(),w.value[D].name=O.trim())}function P(D){h.saveUndo(),e.cancelEdit(),L();const O=w.value[D];if(!O)return D;let K=O.name;const oe=K.match(/^(.*?)\s*\((\d+)\)$/);let me=oe?parseInt(oe[2],10)+1:2;oe&&(K=oe[1]);let $=`${K} (${me})`;const se=new Set(w.value.map(He=>He.name));for(;se.has($);)me++,$=`${K} (${me})`;const ke={id:te(),name:$,cells:{...O.cells},merges:O.merges?{...O.merges}:{},selection:O.selection?{...O.selection}:null,activeCell:O.activeCell?{...O.activeCell}:{col:0,row:0},scrollX:O.scrollX,scrollY:O.scrollY,colWidths:[...O.colWidths],rowHeights:[...O.rowHeights]};return w.value.splice(D+1,0,ke),m(D+1),D+1}function he(D,O){var $;const K=D+O;if(K<0||K>=w.value.length)return;h.saveUndo();const oe=re.value,me=w.value.splice(D,1)[0];w.value.splice(K,0,me),oe===D?re.value=K:D<oe&&K>=oe?re.value=oe-1:D>oe&&K<=oe&&(re.value=oe+1),($=e.scheduleRender)==null||$.call(e)}const F=t.computed(()=>w.value.length);let j="";const be=g;function we(){L();const D=w.value.map(K=>{const oe={};for(const[ke,He]of Object.entries(K.cells))oe[ke]={value:He.value},He.style&&(oe[ke].style=He.style);const me={name:K.name,cells:oe};K.merges&&Object.keys(K.merges).length&&(me.merges={...K.merges});const $={};for(let ke=0;ke<K.colWidths.length;ke++)K.colWidths[ke]!==100&&($[ke]=K.colWidths[ke]);Object.keys($).length&&(me.colWidths=$);const se={};for(let ke=0;ke<K.rowHeights.length;ke++){const He=K.rowHeights[ke];He!=null&&(se[ke]=He)}return Object.keys(se).length&&(me.rowHeights=se),me}),O=JSON.stringify(D);O!==j&&(j=O,be.value=D)}e.emitModelData=we;let le=!1;function c(){le||(le=!0,Promise.resolve().then(()=>{le=!1,we()}))}const p=t.computed(()=>e.props.theme==="dark"?Ol:Ll),Ae=t.computed(()=>bn(p.value,e.props.width,e.props.height,gt)),xe=t.computed(()=>{const D={};for(const[O,K]of Object.entries(Ae.value))O.startsWith("--")&&(D[O]=K);return D}),ie=t.ref(null),r=t.ref(null),y=t.ref(null),T=t.ref(null),H=t.reactive({w:800,h:600});e.viewSize&&t.watch(H,D=>{e.viewSize&&(e.viewSize.w=D.w,e.viewSize.h=D.h)},{deep:!0});const C=48,k=28,B=11,o=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,H.w-C-B))),v=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,H.h-k-B)));function fe(D,O){const K=Math.max(0,H.w-C-B),oe=Math.max(0,H.h-k-B);e.scrollX.value=Math.max(0,Math.min(D??e.scrollX.value,Math.max(0,e.totalWidth.value-K))),e.scrollY.value=Math.max(0,Math.min(O??e.scrollY.value,Math.max(0,e.totalHeight.value-oe)))}e.clampScroll=fe;function Me(){var D;return typeof window>"u"?!1:!((D=window.matchMedia)!=null&&D.call(window,"(hover: none) and (pointer: coarse)").matches)}function Se(D=!1){t.nextTick(()=>{const O=y.value;if(O){if(!e.editingCell.value&&!Me()){document.activeElement===O&&O.blur();return}O.focus({preventScroll:!0}),D&&O.select()}})}function Fe(){Se()}function ge(){var O;const D=e.selection.value;if(D){h.saveUndo();for(let K=D.startRow;K<=D.endRow;K++)e.rowHeights.value[K]=void 0;(O=e.scheduleRender)==null||O.call(e),we()}}function Le(){var O;const D=e.selection.value;if(D){h.saveUndo();for(let K=D.startCol;K<=D.endCol;K++)e.colWidths.value[K]=100;(O=e.scheduleRender)==null||O.call(e),we()}}return{deleteRows:d,insertRows:E,insertCols:a,deleteCols:V,sheets:w,activeSheetIndex:re,saveSheet:L,loadSheet:m,switchSheet:ve,addSheet:pe,removeSheet:ye,renameSheet:U,dupSheet:P,moveSheet:he,sheetCount:F,mkSheet:X,emitModelData:we,scheduleOptEmit:c,themeColors:p,outerStyle:Ae,toolbarThemeVars:xe,wrapperRef:ie,canvasRef:r,editInputRef:y,formulaBarRef:T,viewSize:H,maxScrollX:o,maxScrollY:v,clampScroll:fe,canFocusHiddenEditor:Me,focusEditInput:Se,onCanvasFocus:Fe,resetRowHeight:ge,resetColWidth:Le,modelData:be}}function wn(e,h,g,n,d){let E=!1,a=null,V=1;function f(){E||(E=!0,requestAnimationFrame(()=>{E=!1,X()}))}e.scheduleRender=f;const te="#444";function X(){var zt,ct,mt,$t,hl,vl,Cl,bl,yl,wl,kl;const l=n.canvasRef.value;if(!l)return;const s=n.wrapperRef.value;if(!s||(a=l.getContext("2d"),!a))return;V=window.devicePixelRatio||1;const M=s.getBoundingClientRect(),A=M.width,u=M.height;n.viewSize.w=A,n.viewSize.h=u,l.width=A*V,l.height=u*V,l.style.width=A+"px",l.style.height=u+"px",a.setTransform(V,0,0,V,0,0);const I=e.scrollX.value,Q=e.scrollY.value,ne=52,ce=24,Be=n.themeColors.value,Ye=e.colPositions.value,Ke=e.rowPositions.value,St=e.colWidths.value,vt=[];for(let N=0;N<e.rowCount;N++)vt[N]=Ke[N+1]-Ke[N];const it=Math.max(0,e.hitCol(I));let Ct=it;for(let N=it;N<e.colCount&&!(ne+Ye[N]-I>=A);N++)Ct=N;const bt=Ct,et=Math.max(0,e.hitRow(Q));let jt=et;for(let N=et;N<e.rowCount&&!(ce+Ke[N]-Q>=u);N++)jt=N;const yt=jt;let wt=it,kt=et;for(const N in e.merges){const _=e.merges[N];_&&(_.startRow>yt||_.endRow<et||_.startCol>bt||_.endCol<it||(_.startCol<wt&&(wt=_.startCol),_.startRow<kt&&(kt=_.startRow)))}a.fillStyle=Be.bg,a.fillRect(0,0,A,u),a.fillStyle=Be.gridBg,a.fillRect(ne,ce,A-ne,u-ce),a.save(),a.beginPath(),a.rect(ne,ce,A-ne,u-ce),a.clip();const Xe=e.selection.value,ft=e.editingCell.value;for(let N=kt;N<=yt;N++)for(let _=wt;_<=bt;_++){const Re=e.findMerge(_,N);if(Re&&!(_===Re.range.startCol&&N===Re.range.startRow))continue;const Te=ne+Ye[_]-I,De=ce+Ke[N]-Q;let Ne=St[_],Ve=vt[N];if(Re&&(Ne=Ye[Re.range.endCol+1]-Ye[_],Ve=Ke[Re.range.endRow+1]-Ke[N]),Te+Ne<ne||De+Ve<ce||Te>A||De>u)continue;const ze=(zt=e.cells[e.cellKey(_,N)])==null?void 0:zt.style,Mt=typeof(ze==null?void 0:ze.backgroundColor)=="string"?ze.backgroundColor:"";if(Mt&&(a.fillStyle=Mt,a.fillRect(Te,De,Ne,Ve)),e.isSelected(_,N)&&(a.fillStyle=Be.selectionBg,a.fillRect(Te,De,Ne,Ve)),e.activeCell.value.col===_&&e.activeCell.value.row===N&&(a.strokeStyle=Be.activeCellBorder,a.lineWidth=2,a.strokeRect(Te+1,De+1,Ne-2,Ve-2)),a.strokeStyle=Be.gridLine,a.lineWidth=.5,a.strokeRect(Te+.25,De+.25,Ne-.5,Ve-.5),!(ft&&ft.col===_&&ft.row===N)){const Tt=e.getCellValue(_,N);if(Tt){const Ce=(ct=e.cells[e.cellKey(_,N)])==null?void 0:ct.style,Ue=e.cellFontSize(_,N),qe=typeof(Ce==null?void 0:Ce.fontFamily)=="string"&&Ce.fontFamily?Ce.fontFamily:Kt,nt=(Ce==null?void 0:Ce.fontWeight)==="bold"?"bold":"normal",tt=(Ce==null?void 0:Ce.fontStyle)==="italic"?"italic":"normal",Dt=(Ce==null?void 0:Ce.underline)==="underline",Yn=(Ce==null?void 0:Ce.strikethrough)==="line-through",cl=typeof(Ce==null?void 0:Ce.color)=="string"?Ce.color:"",El=typeof(Ce==null?void 0:Ce.textAlign)=="string"?Ce.textAlign:"left",Bl=typeof(Ce==null?void 0:Ce.verticalAlign)=="string"?Ce.verticalAlign:"top";a.fillStyle=cl||Be.cellText,a.font=`${tt} ${nt} ${Ue}px ${qe}`,a.textBaseline="alphabetic",a.save(),a.beginPath(),a.rect(Te+5,De+1,Ne-10,Ve-2),a.clip();const Xn=(Ce==null?void 0:Ce.wrap)==="wrap",_t=e.getWrappedLines(a,Tt,Ne-10,Xn);let Ht=0,Et=0;for(const At of _t){const Gt=a.measureText(At),It=Gt.actualBoundingBoxAscent,Ft=Gt.actualBoundingBoxDescent,rt=It||Ue*.8,Jt=Ft||Ue*.2;Ht=Math.max(Ht,rt),Et=Math.max(Et,Jt)}Ht=Math.max(Ht,Ue*.5),Et=Math.max(Et,Ue*.15);const Zt=Ue,jn=_t.length*Zt;let qt;Bl==="middle"?qt=De+(Ve-jn)/2+Ht:Bl==="bottom"?qt=De+Ve-e.BASE_CELL_VPAD-Et-(_t.length-1)*Zt:qt=De+e.BASE_CELL_VPAD+Ht;for(let At=0;At<_t.length;At++){const Gt=_t[At],It=qt+At*Zt,Ft=a.measureText(Gt);let rt;if(El==="center"?rt=Te+Ne/2-Ft.width/2:El==="right"?rt=Te+Ne-5-Ft.width:rt=Te+5,a.fillText(Gt,rt,It),Dt&&(a.strokeStyle=cl||Be.cellText,a.lineWidth=1,a.beginPath(),a.moveTo(rt,It+Et+1),a.lineTo(rt+Ft.width,It+Et+1),a.stroke()),Yn){a.strokeStyle=cl||Be.cellText,a.lineWidth=1;const Jt=It-Zt*.25;a.beginPath(),a.moveTo(rt,Jt),a.lineTo(rt+Ft.width,Jt),a.stroke()}}a.restore()}}}for(let N=kt;N<=yt;N++)for(let _=wt;_<=bt;_++){const Re=e.findMerge(_,N);if(Re&&!(_===Re.range.startCol&&N===Re.range.startRow))continue;const Te=ne+Ye[_]-I,De=ce+Ke[N]-Q;let Ne=St[_],Ve=vt[N];if(Re&&(Ne=Ye[Re.range.endCol+1]-Ye[_],Ve=Ke[Re.range.endRow+1]-Ke[N]),Te+Ne<ne||De+Ve<ce||Te>A||De>u)continue;const ze=(mt=e.cells[e.cellKey(_,N)])==null?void 0:mt.style,Mt=(ze==null?void 0:ze.borderTopWidth)||0,Tt=(ze==null?void 0:ze.borderLeftWidth)||0,Ce=(ze==null?void 0:ze.borderBottomWidth)||0,Ue=(ze==null?void 0:ze.borderRightWidth)||0,qe=Math.max(Mt,g.cellBorderWidth(_,N-1,"Bottom")),nt=Math.max(Tt,g.cellBorderWidth(_-1,N,"Right")),tt=Math.max(Ce,g.cellBorderWidth(_,N+1,"Top")),Dt=Math.max(Ue,g.cellBorderWidth(_+1,N,"Left"));(qe>0||nt>0||tt>0||Dt>0)&&(a.fillStyle=te,qe>0&&a.fillRect(Te,De,Ne,qe),tt>0&&a.fillRect(Te,De+Ve-tt,Ne,tt),nt>0&&a.fillRect(Te,De,nt,Ve),Dt>0&&a.fillRect(Te+Ne-Dt,De,Dt,Ve))}for(let N=kt;N<=yt;N++)for(let _=wt;_<=bt;_++){const Re=e.findMerge(_,N);if(Re&&!(_===Re.range.startCol&&N===Re.range.startRow))continue;const Te=ne+Ye[_]-I,De=ce+Ke[N]-Q;let Ne=St[_],Ve=vt[N];if(Re&&(Ne=Ye[Re.range.endCol+1]-Ye[_],Ve=Ke[Re.range.endRow+1]-Ke[N]),Te+Ne<ne||De+Ve<ce||Te>A||De>u)continue;const ze=((hl=($t=e.cells[e.cellKey(_,N)])==null?void 0:$t.style)==null?void 0:hl.borderTopWidth)||0,Mt=((Cl=(vl=e.cells[e.cellKey(_,N)])==null?void 0:vl.style)==null?void 0:Cl.borderLeftWidth)||0,Tt=((yl=(bl=e.cells[e.cellKey(_,N)])==null?void 0:bl.style)==null?void 0:yl.borderBottomWidth)||0,Ce=((kl=(wl=e.cells[e.cellKey(_,N)])==null?void 0:wl.style)==null?void 0:kl.borderRightWidth)||0,Ue=Math.max(ze,g.cellBorderWidth(_,N-1,"Bottom")),qe=Math.max(Mt,g.cellBorderWidth(_-1,N,"Right")),nt=Math.max(Tt,g.cellBorderWidth(_,N+1,"Top")),tt=Math.max(Ce,g.cellBorderWidth(_+1,N,"Left"));a.fillStyle=te,Ue>0&&qe>0&&a.fillRect(Te-qe,De-Ue,qe,Ue),Ue>0&&tt>0&&a.fillRect(Te+Ne,De-Ue,tt,Ue),nt>0&&qe>0&&a.fillRect(Te-qe,De+Ve,qe,nt),nt>0&&tt>0&&a.fillRect(Te+Ne,De+Ve,tt,nt)}a.restore(),a.fillStyle=Be.headerBg,a.fillRect(ne,0,A-ne,ce);for(let N=it;N<=bt;N++){const _=ne+Ye[N]-I,Re=St[N];_+Re<ne||_>A||(Xe&&N>=Xe.startCol&&N<=Xe.endCol&&(a.fillStyle=Be.selectionBg,a.fillRect(_,0,Re,ce)),a.strokeStyle=Be.headerBorder,a.lineWidth=.5,a.strokeRect(_+.25,.25,Re-.5,ce-.5),Xe&&N>=Xe.startCol&&N<=Xe.endCol&&(a.strokeStyle=Be.activeCellBorder,a.lineWidth=2,a.beginPath(),a.moveTo(_,ce-1),a.lineTo(_+Re,ce-1),a.stroke()),a.fillStyle=Be.headerText,a.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',a.textAlign="center",a.textBaseline="middle",a.fillText(Je(N),_+Re/2,ce/2))}a.strokeStyle=Be.headerSep,a.lineWidth=1,a.beginPath(),a.moveTo(ne,ce+.5),a.lineTo(A,ce+.5),a.stroke(),a.fillStyle=Be.headerBg,a.fillRect(0,ce,ne,u-ce);for(let N=et;N<=yt;N++){const _=ce+Ke[N]-Q,Re=vt[N];_+Re<ce||_>u||(Xe&&N>=Xe.startRow&&N<=Xe.endRow&&(a.fillStyle=Be.selectionBg,a.fillRect(0,_,ne,Re)),a.strokeStyle=Be.headerBorder,a.lineWidth=.5,a.strokeRect(.25,_+.25,ne-.5,Re-.5),Xe&&N>=Xe.startRow&&N<=Xe.endRow&&(a.strokeStyle=Be.activeCellBorder,a.lineWidth=2,a.beginPath(),a.moveTo(ne-1,_),a.lineTo(ne-1,_+Re),a.stroke()),a.fillStyle=Be.headerText,a.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',a.textAlign="center",a.textBaseline="middle",a.fillText(String(N+1),ne/2,_+Re/2+.5))}a.strokeStyle=Be.headerSep,a.lineWidth=1,a.beginPath(),a.moveTo(ne+.5,ce),a.lineTo(ne+.5,u),a.stroke(),a.fillStyle=Be.headerBg,a.fillRect(0,0,ne,ce),a.strokeStyle=Be.headerSep,a.lineWidth=1,a.strokeRect(.5,.5,ne-.5,ce-.5)}const w=t.computed(()=>Je(e.activeCell.value.col)+String(e.activeCell.value.row+1)),re=t.computed(()=>e.editingCell.value?e.editValue.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));function L(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.editValue.value=e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),f())}function m(l){e.editValue.value=l.target.value}function ve(l){var s,M;l.key==="Enter"?(l.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(s=n.formulaBarRef.value)==null||s.blur(),f(),n.focusEditInput()):l.key==="Escape"&&(l.preventDefault(),e.cancelEdit(),(M=n.formulaBarRef.value)==null||M.blur(),f(),n.focusEditInput())}function pe(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),f())},0)}const ye=t.ref(null),U=t.ref("");function P(l){ye.value===null&&(n.switchSheet(l),f())}function he(l){l!==n.activeSheetIndex.value&&(n.saveSheet(),n.loadSheet(l),f()),ye.value=l,U.value=n.sheets.value[l].name,t.nextTick(()=>{const s=document.querySelector(".tab-rename-input");s==null||s.focus(),s==null||s.select()})}function F(){ye.value!==null&&(n.renameSheet(ye.value,U.value),t.nextTick(()=>n.emitModelData())),ye.value=null,U.value=""}function j(){ye.value=null,U.value=""}function be(l){l.key==="Enter"?(l.preventDefault(),F()):l.key==="Escape"&&(l.preventDefault(),j())}const we=t.ref(null);let le=null;function c(){le&&(document.removeEventListener("click",le),le=null)}function p(l,s,M){c();const A=140,u=M.length*28+8,I=window.innerWidth,Q=window.innerHeight;l+A>I&&(l-=A),s+u>Q&&(s-=u),we.value={x:l,y:s,items:M},le=()=>{we.value=null,c()},setTimeout(()=>document.addEventListener("click",le,{once:!0}),0)}const Ae=t.ref(!1);function xe(l,s){if(!s.children){Ae.value=!1;return}const A=l.currentTarget.querySelector(".context-submenu");if(!A){Ae.value=!1;return}const u=A.getBoundingClientRect();Ae.value=u.right>window.innerWidth}function ie(l,s){l.preventDefault(),l.stopPropagation(),p(l.clientX,l.clientY,[{label:G(e.locale.value,"insert"),action:()=>{n.addSheet(),f()}},{label:G(e.locale.value,"copy"),action:()=>{n.dupSheet(s)}},{label:G(e.locale.value,"rename"),action:()=>{he(s)}},{label:G(e.locale.value,"delete"),action:()=>{n.removeSheet(s),f()},disabled:n.sheetCount.value<=1},{label:G(e.locale.value,"moveSheetLeft"),action:()=>{n.moveSheet(s,-1)},disabled:s===0},{label:G(e.locale.value,"moveSheetRight"),action:()=>{n.moveSheet(s,1)},disabled:s===n.sheets.value.length-1}])}function r(l){l.preventDefault(),!(l.target.closest(".tab-item")||l.target.closest(".tab-bar__add-btn"))&&p(l.clientX,l.clientY,[{label:G(e.locale.value,"insert"),action:()=>{n.addSheet(),f()}}])}function y(l){l.preventDefault(),e.selectAll(),f(),p(l.clientX,l.clientY,[{label:G(e.locale.value,"cut"),action:()=>{g.cutSelected(),n.emitModelData()}},{label:G(e.locale.value,"copy"),action:()=>g.copyToClipboard()},{label:G(e.locale.value,"paste"),action:()=>{h.saveUndo(),g.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>n.emitModelData())})}},{label:G(e.locale.value,"delete"),action:()=>{h.saveUndo(),g.clearSelected();for(let s=0;s<e.colCount;s++)e.colWidths.value[s]=100;for(let s=0;s<e.rowCount;s++)e.rowHeights.value[s]=void 0;f(),n.emitModelData()}}])}function T(l,s){l.preventDefault();const M=l.clientX,A=l.clientY,u=e.selection.value;u&&u.startCol===0&&u.endCol===e.colCount-1&&s>=u.startRow&&s<=u.endRow||(e.selectRange(0,s,e.colCount-1,s),f());const I=e.selection.value;p(l.clientX,l.clientY,[{label:G(e.locale.value,"insert"),action:()=>{h.saveUndo(),n.insertRows(I.startRow,I.endRow),f(),n.emitModelData()},disabled:I.endRow>=e.rowCount-1},{label:G(e.locale.value,"cut"),action:()=>{h.saveUndo(),g.copyRowCol();for(let Q=I.startRow;Q<=I.endRow;Q++)for(let ne=0;ne<e.colCount;ne++)e.delCell(e.cellKey(ne,Q));f(),n.emitModelData()}},{label:G(e.locale.value,"copy"),action:()=>g.copyRowCol()},{label:G(e.locale.value,"paste"),action:()=>{h.saveUndo(),g.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>n.emitModelData())})}},{label:G(e.locale.value,"delete"),action:()=>{h.saveUndo(),n.deleteRows(I.startRow,I.endRow),f(),n.emitModelData()}},{label:`${G(e.locale.value,"rowHeight")}...`,action:()=>fe("row",M,A)},{label:G(e.locale.value,"autoRowHeight"),action:()=>n.resetRowHeight()}])}function H(l,s){l.preventDefault();const M=l.clientX,A=l.clientY,u=e.selection.value;u&&u.startRow===0&&u.endRow===e.rowCount-1&&s>=u.startCol&&s<=u.endCol||(e.selectRange(s,0,s,e.rowCount-1),f());const I=e.selection.value;p(l.clientX,l.clientY,[{label:G(e.locale.value,"insert"),action:()=>{h.saveUndo(),n.insertCols(I.startCol,I.endCol),f(),n.emitModelData()},disabled:I.endCol>=e.colCount-1},{label:G(e.locale.value,"cut"),action:()=>{h.saveUndo(),g.copyRowCol();for(let Q=I.startCol;Q<=I.endCol;Q++)for(let ne=0;ne<e.rowCount;ne++)e.delCell(e.cellKey(Q,ne));f(),n.emitModelData()}},{label:G(e.locale.value,"copy"),action:()=>g.copyRowCol()},{label:G(e.locale.value,"paste"),action:()=>{h.saveUndo(),g.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>n.emitModelData())})}},{label:G(e.locale.value,"delete"),action:()=>{h.saveUndo(),n.deleteCols(I.startCol,I.endCol),f(),n.emitModelData()}},{label:`${G(e.locale.value,"colWidth")}...`,action:()=>fe("col",M,A)},{label:G(e.locale.value,"defaultColWidth"),action:()=>n.resetColWidth()}])}function C(l,s,M){l.preventDefault(),e.isSelected(s,M)||(e.selectCell(s,M),f());const A=e.selection.value,u=!!(A&&A.startCol===A.endCol&&A.startRow===A.endRow);p(l.clientX,l.clientY,[{label:G(e.locale.value,"cut"),action:()=>{g.cutSelected(),n.emitModelData()}},{label:G(e.locale.value,"copy"),action:()=>g.copyToClipboard()},{label:G(e.locale.value,"paste"),action:()=>{h.saveUndo(),g.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>n.emitModelData())})}},{label:G(e.locale.value,"delete"),action:()=>{h.saveUndo(),g.clearSelected(),f(),n.emitModelData()}},{label:G(e.locale.value,"calculate"),children:[{label:G(e.locale.value,"sum"),action:g.sumSelected,disabled:u}]}])}const k=t.ref(null),B=t.ref(null);let o=null;function v(){o&&(document.removeEventListener("mousedown",o),o=null)}function fe(l,s,M){v();const A=e.selection.value;let u="";if(A){const Be=l==="row"?e.getRowHeight(A.startRow):e.colWidths.value[A.startCol];u=Be!=null&&Be>0?String(Math.round(Be)):""}const I=220,Q=118;let ne=s,ce=M;ne+I>window.innerWidth&&(ne=window.innerWidth-I-8),ce+Q>window.innerHeight&&(ce=window.innerHeight-Q-8),ne<8&&(ne=8),ce<8&&(ce=8),B.value={type:l,x:ne,y:ce,value:u,error:""},o=()=>{B.value=null},setTimeout(()=>document.addEventListener("mousedown",o,{once:!0}),0),t.nextTick(()=>{const Be=k.value;Be&&(Be.focus(),Be.select())})}function Me(l){const s=B.value;if(!s)return;const M=l.target,A=M.value,u=A.replace(/[^\d]/g,"");s.value=u,A!==u&&(M.value=u),s.error=""}function Se(l){l.key==="Enter"?(l.preventDefault(),ge()):l.key==="Escape"&&(l.preventDefault(),Le())}function Fe(){const l=B.value;if(!l)return;const s=l.value.trim(),M=Number(s),A=l.type==="row",u=A?24:30,I=A?500:1e3;if(s===""||!Number.isFinite(M)){Le();return}const Q=Math.max(u,Math.min(I,Math.round(M)));l.value=String(Q),l.error=""}function ge(){const l=B.value,s=e.selection.value;if(!l||!s)return;const M=l.value.trim(),A=Number(M),u=l.type==="row",I=u?24:30,Q=u?500:1e3;if(M===""||!Number.isFinite(A)){l.error=G(e.locale.value,"dimNumberError");return}if(A<I||A>Q){l.error=G(e.locale.value,"dimRangeError").replace("{min}",String(I)).replace("{max}",String(Q));return}const ne=A;if(h.saveUndo(),u)for(let ce=s.startRow;ce<=s.endRow;ce++)e.rowHeights.value[ce]=ne;else for(let ce=s.startCol;ce<=s.endCol;ce++)e.colWidths.value[ce]=ne;f(),n.emitModelData(),Le()}function Le(){v(),B.value=null}const D=t.computed(()=>{var $t;const l=!e.editingCell.value,s=e.editingCell.value??e.activeCell.value,M=s.col,A=s.row,u=($t=e.cells[e.cellKey(M,A)])==null?void 0:$t.style,I=e.cellFontSize(M,A),Q=typeof(u==null?void 0:u.fontFamily)=="string"&&u.fontFamily?u.fontFamily:Kt,ne=(u==null?void 0:u.fontWeight)==="bold"?"bold":"normal",ce=(u==null?void 0:u.fontStyle)==="italic"?"italic":"normal",Be=(u==null?void 0:u.underline)==="underline"?"underline":(u==null?void 0:u.strikethrough)==="line-through"?"line-through":"none",Ye=(u==null?void 0:u.underline)==="underline"&&(u==null?void 0:u.strikethrough)==="line-through"?"underline line-through":Be,Ke=typeof(u==null?void 0:u.color)=="string"?u.color:void 0,St=typeof(u==null?void 0:u.backgroundColor)=="string"?u.backgroundColor:void 0,vt=typeof(u==null?void 0:u.textAlign)=="string"?u.textAlign:"left",it=typeof(u==null?void 0:u.verticalAlign)=="string"?u.verticalAlign:"top",Ct=e.findMerge(M,A),bt=Ct?e.colPositions.value[Ct.range.endCol+1]-e.colPositions.value[M]:e.colWidths.value[M],et=Ct?e.rowPositions.value[Ct.range.endRow+1]-e.rowPositions.value[A]:e.getRowHeight(A),jt=2,{ascent:yt,descent:wt}=e.measureFontMetrics(Q,I,ne,ce),kt=yt+wt,ft=(e.editValue.value?e.editValue.value.split(`
|
|
8
|
-
`).length:1)*kt,zt=e.BASE_CELL_VPAD-jt;let ct=0,mt=0;return it==="middle"?(ct=Math.floor((et-ft)/2),mt=Math.max(0,et-ft-ct)):it==="top"?(ct=zt,mt=Math.max(0,et-ft-ct)):it==="bottom"&&(mt=zt,ct=Math.max(0,et-ft-mt)),{left:`${52+e.colPositions.value[M]-e.scrollX.value}px`,top:`${24+e.rowPositions.value[A]-e.scrollY.value}px`,width:`${bt}px`,height:`${et}px`,fontFamily:Q,fontSize:`${I}px`,lineHeight:1,fontWeight:ne,fontStyle:ce,textDecoration:Ye,textAlign:vt,paddingTop:`${ct}px`,paddingRight:"3px",paddingBottom:`${mt}px`,paddingLeft:"3px",opacity:l?0:1,pointerEvents:l?"none":"auto",color:l?"transparent":Ke,caretColor:l?"transparent":void 0,borderColor:l?"transparent":void 0,background:l?"transparent":St,boxShadow:l?"none":void 0}});function O(){return Math.max(0,n.viewSize.w-52-11)}function K(){return Math.max(0,n.viewSize.h-24-11)}const oe=t.computed(()=>O()),me=t.computed(()=>K()),$=t.computed(()=>Math.max(0,oe.value-11*2)),se=t.computed(()=>Math.max(0,me.value-11*2)),ke=t.computed(()=>n.maxScrollX.value<=0?$.value:Math.max(24,O()/e.totalWidth.value*$.value)),He=t.computed(()=>n.maxScrollX.value<=0?0:e.scrollX.value/n.maxScrollX.value*($.value-ke.value)),Qe=t.computed(()=>n.maxScrollY.value<=0?se.value:Math.max(24,K()/e.totalHeight.value*se.value)),lt=t.computed(()=>n.maxScrollY.value<=0?0:e.scrollY.value/n.maxScrollY.value*(se.value-Qe.value));let Ge=null,je=0,dt=0;function Nt(l){l.preventDefault(),Ge="v",je=l.clientY,dt=e.scrollY.value,document.addEventListener("mousemove",R),document.addEventListener("mouseup",x)}function Pe(l){l.preventDefault(),Ge="h",je=l.clientX,dt=e.scrollX.value,document.addEventListener("mousemove",R),document.addEventListener("mouseup",x)}function R(l){if(Ge==="v"){const M=(l.clientY-je)/(se.value-Qe.value);n.clampScroll(null,dt+M*n.maxScrollY.value),f()}else if(Ge==="h"){const M=(l.clientX-je)/($.value-ke.value);n.clampScroll(dt+M*n.maxScrollX.value,null),f()}}function x(){Ge=null,document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",x)}function S(l){if(Ge)return;const s=l.currentTarget.getBoundingClientRect(),M=l.clientY-s.top;M<lt.value?n.clampScroll(null,e.scrollY.value-K()):M>lt.value+Qe.value&&n.clampScroll(null,e.scrollY.value+K()),f()}function Y(l){if(Ge)return;const s=l.currentTarget.getBoundingClientRect(),M=l.clientX-s.left;M<He.value?n.clampScroll(e.scrollX.value-O(),null):M>He.value+ke.value&&n.clampScroll(e.scrollX.value+O(),null),f()}let Z=!1,ae=0,de=0,i=!1,b=!1,W=0,z=0,J=0,ee=0,q=0,ue=0,Ee=0,We=0,Ie=!1,$e=!1,Oe=0,_e=0,ot="cell",Lt=0,Yt=-1,Ot=-1;function Xt(l){if(l.button!==0)return;l.preventDefault(),we.value=null;const s=ht(l,n.canvasRef.value);if(s.y<24&&s.x>=52){const u=s.x-52+e.scrollX.value,I=e.hitCol(u);if(I>=0&&Math.abs(s.x-(52+e.colPositions.value[I+1]-e.scrollX.value))<=4){h.saveUndo(),i=!0,W=I,J=e.colWidths.value[I],ee=u,f();return}}if(s.x<52&&s.y>=24){const u=s.y-24+e.scrollY.value,I=e.hitRow(u);if(I>=0&&Math.abs(s.y-(24+e.rowPositions.value[I+1]-e.scrollY.value))<=4){h.saveUndo(),b=!0,z=I,J=e.getRowHeight(I),ee=u,f();return}}if(s.x<52||s.y<24){if(e.commitEdit(),s.y<24&&s.x>=52){const u=e.hitCol(s.x-52+e.scrollX.value);u>=0&&(e.selectRange(u,0,u,e.rowCount-1),Z=!0,ae=u,de=0)}else if(s.x<52&&s.y>=24){const u=e.hitRow(s.y-24+e.scrollY.value);u>=0&&(e.selectRange(0,u,e.colCount-1,u),Z=!0,ae=0,de=u)}else s.x<52&&s.y<24&&e.selectAll();f();return}const M=e.hitCol(s.x-52+e.scrollX.value),A=e.hitRow(s.y-24+e.scrollY.value);if(!(M<0||A<0)){if(e.commitEdit(),l.shiftKey&&e.selection.value){const u=e.selection.value;e.selectRange(u.startCol,u.startRow,M,A)}else e.selectCell(M,A);Z=!0,ae=M,de=A,n.focusEditInput(),f()}}function nl(l){if(i){const I=ht(l,n.canvasRef.value).x-52+e.scrollX.value-ee,Q=J+I;Q>=30&&Q<=1e3?e.colWidths.value[W]=Q:Q<30?e.colWidths.value[W]=30:e.colWidths.value[W]=1e3,f();return}if(b){const I=ht(l,n.canvasRef.value).y-24+e.scrollY.value-ee,Q=J+I;Q>=24&&Q<=500?e.rowHeights.value[z]=Q:Q<24?e.rowHeights.value[z]=24:e.rowHeights.value[z]=500,f();return}if(!Z){const u=n.canvasRef.value;if(!u)return;if(h.paintFmt.value){u.style.cursor="copy";return}const I=ht(l,u);if(I.y<24&&I.x>=52){const Q=e.hitCol(I.x-52+e.scrollX.value);if(Q>=0&&Math.abs(I.x-(52+e.colPositions.value[Q+1]-e.scrollX.value))<=4){u.style.cursor="col-resize";return}}if(I.x<52&&I.y>=24){const Q=e.hitRow(I.y-24+e.scrollY.value);if(Q>=0&&Math.abs(I.y-(24+e.rowPositions.value[Q+1]-e.scrollY.value))<=4){u.style.cursor="row-resize";return}}u.style.cursor="cell";return}const s=ht(l,n.canvasRef.value);if(ae<0||de<0)return;if(s.x<52||s.y<24){if(s.y<24&&s.x>=52){const u=e.hitCol(s.x-52+e.scrollX.value);u>=0&&e.selectRange(Math.min(ae,u),0,Math.max(ae,u),e.rowCount-1)}else if(s.x<52&&s.y>=24){const u=e.hitRow(s.y-24+e.scrollY.value);u>=0&&e.selectRange(0,Math.min(de,u),e.colCount-1,Math.max(de,u))}f();return}const M=e.hitCol(s.x-52+e.scrollX.value),A=e.hitRow(s.y-24+e.scrollY.value);M<0||A<0||(de===0&&ae>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(ae,M),0,Math.max(ae,M),e.rowCount-1):ae===0&&de>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(de,A),e.colCount-1,Math.max(de,A)):e.selectRange(ae,de,M,A),f())}function ut(l){const s=i||b;Z=!1,i=!1,b=!1,s&&n.scheduleOptEmit(),h.paintFmt.value&&h.applyPaintFormat()}function xt(){const l=i||b;Z=!1,i=!1,b=!1,l&&n.scheduleOptEmit()}function Vt(l){l.preventDefault();const s=ht(l,n.canvasRef.value);if(s.x<52&&s.y<24){y(l);return}if(s.y<24&&s.x>=52){const M=e.hitCol(s.x-52+e.scrollX.value);M>=0&&H(l,M);return}if(s.x<52&&s.y>=24){const M=e.hitRow(s.y-24+e.scrollY.value);M>=0&&T(l,M);return}if(s.x>=52&&s.y>=24){const M=e.hitCol(s.x-52+e.scrollX.value),A=e.hitRow(s.y-24+e.scrollY.value);M>=0&&A>=0&&C(l,M,A)}}function ml(l){const s=ht(l,n.canvasRef.value);if(s.x<52||s.y<24)return;const M=e.hitCol(s.x-52+e.scrollX.value),A=e.hitRow(s.y-24+e.scrollY.value);M<0||A<0||(e.selectCell(M,A),e.ensureVisible(M,A),e.startEdit(),f(),n.focusEditInput())}function Ln(l){n.clampScroll(e.scrollX.value+l.deltaX,e.scrollY.value+l.deltaY),f()}function On(l){if(l.touches.length!==1){Ie=!1;return}const s=l.touches[0],M=n.canvasRef.value;if(!M)return;const A=M.getBoundingClientRect(),u=s.clientX-A.left,I=s.clientY-A.top;u>=52&&I>=24?(l.preventDefault(),Ie=!0,$e=!1,ot="cell",q=u,ue=I,Ee=e.scrollX.value,We=e.scrollY.value,Oe=e.hitCol(u-52+e.scrollX.value),_e=e.hitRow(I-24+e.scrollY.value)):u>=0&&I>=0&&(u<52||I<24)&&(l.preventDefault(),Ie=!0,$e=!1,q=u,ue=I,Ee=e.scrollX.value,We=e.scrollY.value,I<24&&u>=52?(ot="col",Oe=e.hitCol(u-52+e.scrollX.value),_e=-1):u<52&&I>=24?(ot="row",_e=e.hitRow(I-24+e.scrollY.value),Oe=-1):(ot="all",Oe=-1,_e=-1))}function Vn(l){if(!Ie||l.touches.length!==1)return;const s=l.touches[0],M=n.canvasRef.value;if(!M)return;const A=M.getBoundingClientRect(),u=s.clientX-A.left,I=s.clientY-A.top;(Math.abs(u-q)>8||Math.abs(I-ue)>8)&&($e=!0,l.preventDefault(),n.clampScroll(Ee+(q-u),We+(ue-I)),f())}function Wn(){if(Ie&&(Ie=!1,!$e))if(ot==="cell"&&Oe>=0&&_e>=0){const l=Date.now();Oe===Yt&&_e===Ot&&l-Lt<300?(e.selectCell(Oe,_e),e.startEdit(),f(),n.focusEditInput(),Lt=0):(e.commitEdit(),e.selectCell(Oe,_e),f(),Lt=l),Yt=Oe,Ot=_e,n.focusEditInput()}else ot==="col"&&Oe>=0?(e.commitEdit(),e.selectRange(Oe,0,Oe,e.rowCount-1),f()):ot==="row"&&_e>=0?(e.commitEdit(),e.selectRange(0,_e,e.colCount-1,_e),f()):ot==="all"&&(e.commitEdit(),e.selectAll(),f())}function rl(l){return l.isComposing||l.key==="Process"||l.keyCode===229}function pl(l){return l.key.length===1&&!l.ctrlKey&&!l.metaKey&&!l.altKey}function gl(l){if(e.editingCell.value)return;const s=l.ctrlKey||l.metaKey,M=l.shiftKey;switch(!0){case(s&&(l.key==="c"||l.key==="C")):l.preventDefault(),g.copyToClipboard();return;case(s&&(l.key==="x"||l.key==="X")):l.preventDefault(),g.cutSelected();return;case(s&&(l.key==="z"||l.key==="Z")):l.preventDefault(),h.undo();return;case(s&&(l.key==="y"||l.key==="Y")):l.preventDefault(),h.redo();return;case(s&&(l.key==="v"||l.key==="V")):l.preventDefault(),h.saveUndo(),g.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>n.emitModelData())});return;case(s&&(l.key==="a"||l.key==="A")):l.preventDefault(),e.selectAll(),f();return;case(s&&l.key==="Home"):l.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),f();return;case(s&&l.key==="End"):l.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),f();return;case l.key==="Home":l.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),f();return;case l.key==="End":l.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),f();return;case l.key==="ArrowUp":l.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case l.key==="ArrowDown":l.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case l.key==="ArrowLeft":l.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case l.key==="ArrowRight":l.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case l.key==="Tab":l.preventDefault(),e.moveActive(M?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case l.key==="Enter":l.preventDefault(),e.moveActive(0,M?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case l.key==="F2":l.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),f(),n.focusEditInput();return;case l.key==="Delete":case l.key==="Backspace":l.preventDefault(),h.saveUndo(),g.clearSelected(),f();return;case l.key==="Escape":l.preventDefault(),e.cancelEdit(),h.paintFmt.value=null,f();return;case pl(l):if(rl(l)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),f(),n.focusEditInput();return}l.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(l.key),f(),t.nextTick(()=>{const A=n.editInputRef.value;A&&(A.focus(),A.setSelectionRange(1,1))});return}}let al=!1,il=!1;function zn(l){const s=l.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(s),f();return}e.editValue.value=s}function $n(){al=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),f())}function _n(l){al=!1,il=!0,setTimeout(()=>{il=!1},0),e.editValue.value=l.target.value}function Gn(l){if(!e.editingCell.value){if(pl(l)||rl(l))return;gl(l);return}if(!(al||rl(l))&&!(il&&(l.key==="Enter"||l.key==="Escape")))if(l.key==="Enter"&&(l.altKey||l.metaKey)){l.preventDefault();const s=n.editInputRef.value;if(!s)return;const M=s.selectionStart??s.value.length,A=s.selectionEnd??s.value.length,u=s.value,I=u.slice(0,M)+`
|
|
9
|
-
`+u.slice(A);e.editValue.value=I,s.value=I,s.selectionStart=s.selectionEnd=M+1,f()}else l.key==="Enter"?(l.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f(),n.focusEditInput()):l.key==="Tab"?(l.preventDefault(),e.commitEdit(),e.moveActive(l.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f(),n.focusEditInput()):l.key==="Escape"&&(l.preventDefault(),e.cancelEdit(),f(),n.focusEditInput())}function Kn(l){e.editingCell.value}function Un(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),f())},0)}let Ze=null;function Wt(){var s;const l=(s=n.wrapperRef.value)==null?void 0:s.getBoundingClientRect();if(l){const M=gt(e.props.width),A=gt(e.props.height);M!=null?n.viewSize.w=M:n.viewSize.w=l.width,A!=null?n.viewSize.h=A:n.viewSize.h=l.height}n.clampScroll(null,null),f()}function Pn(){t.onMounted(()=>{const l=gt(e.props.width),s=gt(e.props.height);(l==null||s==null)&&(Ze=new ResizeObserver(()=>Wt()),n.wrapperRef.value&&Ze.observe(n.wrapperRef.value)),t.nextTick(()=>{Wt(),n.focusEditInput()}),e.selectCell(0,0),n.modelData.value&&n.modelData.value.length>0&&(d.value=JSON.stringify(n.modelData.value),n.sheets.value=n.modelData.value.map(M=>{const A=n.mkSheet(M.name);for(const[u,I]of Object.entries(M.cells))A.cells[u]={value:I.value,style:I.style??null};if(M.colWidths)for(const[u,I]of Object.entries(M.colWidths)){const Q=Number(u);Q>=0&&Q<e.colCount&&I>=30&&(A.colWidths[Q]=I)}if(M.rowHeights)for(const[u,I]of Object.entries(M.rowHeights)){const Q=Number(u);Q>=0&&Q<e.rowCount&&I>=24&&(A.rowHeights[Q]=I)}if(M.merges)for(const[u,I]of Object.entries(M.merges))A.merges[u]={...I};return A}),n.sheets.value.length>0&&n.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const l=gt(e.props.width),s=gt(e.props.height);l!=null&&s!=null?(Ze==null||Ze.disconnect(),Ze=null):!Ze&&n.wrapperRef.value&&(Ze=new ResizeObserver(()=>Wt()),Ze.observe(n.wrapperRef.value)),t.nextTick(()=>Wt())}),t.watch(()=>e.props.theme,()=>f()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>n.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>n.emitModelData()),f()},{deep:!1}),t.watch(n.activeSheetIndex,()=>t.nextTick(()=>n.emitModelData())),t.watch(()=>n.modelData.value,l=>{if(!l||l.length===0)return;const s=JSON.stringify(l);if(s===d.value)return;d.value=s;const M=e.selection.value?{...e.selection.value}:null,A={...e.activeCell.value};n.sheets.value=l.map(u=>{const I=n.mkSheet(u.name);for(const[Q,ne]of Object.entries(u.cells))I.cells[Q]={value:ne.value,style:ne.style??null};if(u.colWidths)for(const[Q,ne]of Object.entries(u.colWidths)){const ce=Number(Q);ce>=0&&ce<e.colCount&&ne>=30&&(I.colWidths[ce]=ne)}if(u.rowHeights)for(const[Q,ne]of Object.entries(u.rowHeights)){const ce=Number(Q);ce>=0&&ce<e.rowCount&&ne>=24&&(I.rowHeights[ce]=ne)}if(u.merges)for(const[Q,ne]of Object.entries(u.merges))I.merges[Q]={...ne};return I}),n.sheets.value.length>0&&n.loadSheet(0),M&&(e.selection.value=M),e.activeCell.value=A,f()},{deep:!0}),t.onBeforeUnmount(()=>{Ze==null||Ze.disconnect()})}return{scheduleRender:f,render:X,activeCellLabel:w,formulaBarDisplay:re,onFormulaBarFocus:L,onFormulaBarInput:m,onFormulaBarKeydown:ve,onFormulaBarBlur:pe,renTab:ye,renTabVal:U,onTabClick:P,onTabDblClick:he,commitTabRename:F,cclTabRename:j,onTabRenameKd:be,ctxMenu:we,ctxSubmenuLeft:Ae,onCtxItemEnter:xe,onTabCtxMenu:ie,onTabBarCtx:r,onCornerCtx:y,onRowHdrCtx:T,onColHdrCtx:H,onCellCtx:C,dimInputRef:k,dimPanel:B,openDimPanel:fe,onDimInput:Me,onDimKeydown:Se,onDimBlur:Fe,applyDimPanel:ge,closeDimPanel:Le,editInputStyle:D,hScrollbarW:oe,vScrollbarH:me,hTrackW:$,vTrackH:se,hThumbW:ke,hThumbL:He,vThumbH:Qe,vThumbT:lt,onVStart:Nt,onHStart:Pe,onSbMove:R,onSbUp:x,onVTrk:S,onHTrk:Y,onMouseDown:Xt,onMouseMove:nl,onMouseUp:ut,onMouseLeave:xt,onCanvasCtx:Vt,onDblClick:ml,onWheel:Ln,onTouchStart:On,onTouchMove:Vn,onTouchEnd:Wn,onKeydown:gl,onEditInput:zn,onEditCompositionStart:$n,onEditCompositionEnd:_n,onEditKd:Gn,onEditPaste:Kn,onEditBlur:Un,applySize:Wt,setupLifecycle:Pn}}const kn={class:"formula-bar"},En={class:"formula-bar__cell-label"},Bn=["value"],Rn=["value"],xn={key:2,class:"sb-corner"},Sn=["onClick","onMouseenter"],Mn={class:"context-menu__label"},Tn={key:0,class:"context-menu__arrow"},Dn=["onClick"],Hn={class:"dim-panel__title"},An={class:"dim-panel__body"},In=["value"],Fn={key:0,class:"dim-panel__error"},Nn={class:"dim-panel__footer"},fl=pt(t.defineComponent({__name:"spreader",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const h=e,g=t.useModel(e,"data"),n={value:""},d=gn(h,{rowCount:h.rowCount,colCount:h.colCount,theme:h.theme,locale:h.locale}),E={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:le=>{},mkSheet:le=>({id:"",name:le,cells:{},merges:{},selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[]})},a=hn(d,E),V=Cn(d,a);vn(a,{borderMenuOpen:V.borderMenuOpen,mergeMenuOpen:V.mergeMenuOpen});const f=yn(d,a,g);E.sheets=f.sheets,E.activeSheetIndex=f.activeSheetIndex,E.saveSheet=f.saveSheet,E.loadSheet=f.loadSheet,E.mkSheet=f.mkSheet;const te=wn(d,a,V,f,n);te.setupLifecycle();const X=t.reactive(d),w=t.reactive(a),re=t.reactive(V),L=t.reactive(f),m=t.reactive(te);function ve(le){a.fontSizeMenuOpen.value=le}function pe(le){a.textColorMenuOpen.value=le}function ye(le){a.fillColorMenuOpen.value=le}function U(le){te.renTabVal.value=le}function P(){te.ctxMenu.value=null}const he=le=>{f.formulaBarRef.value=le},F=le=>{f.wrapperRef.value=le},j=le=>{f.canvasRef.value=le},be=le=>{f.editInputRef.value=le},we=le=>{te.dimInputRef.value=le};return(le,c)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(L.outerStyle)},[t.createVNode(tn,{locale:X.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":re.borderMenuOpen,"cached-border":re.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":re.mergeMenuOpen,"theme-vars":L.toolbarThemeVars,onUndo:c[0]||(c[0]=p=>w.undo()),onRedo:c[1]||(c[1]=p=>w.redo()),onPaintFormat:w.onPaintFormat,onClearFormat:c[2]||(c[2]=p=>w.clearFormat()),onFontFamilyChange:c[3]||(c[3]=p=>w.onFontFamilyChange(p)),onFontSizeInput:c[4]||(c[4]=p=>w.onFontSizeInput(p)),onFontSizeBlur:w.onFontSizeBlur,onFontSizeKeydown:c[5]||(c[5]=p=>w.onFontSizeKeydown(p)),onFontSizeChange:c[6]||(c[6]=p=>w.onFontSizeChange(p)),"onUpdate:fontSizeMenuOpen":c[7]||(c[7]=p=>ve(p)),onFontSizeToggle:c[8]||(c[8]=p=>w.toggleFontSizeMenu()),onFontSizeStepUp:w.onFontSizeStepUp,onFontSizeStepDown:w.onFontSizeStepDown,onBoldToggle:w.toggleFontWeight,onItalicToggle:w.toggleFontStyle,onUnderlineToggle:w.toggleUnderline,onStrikethroughToggle:w.toggleStrikethrough,onTextColorChange:c[9]||(c[9]=p=>w.onTextColorChange(p)),"onUpdate:textColorMenuOpen":c[10]||(c[10]=p=>pe(p)),onFillColorChange:c[11]||(c[11]=p=>w.onFillColorChange(p)),"onUpdate:fillColorMenuOpen":c[12]||(c[12]=p=>ye(p)),onApplyTextColor:w.applyCachedTextColor,onApplyFillColor:w.applyCachedFillColor,"onUpdate:borderMenuOpen":c[13]||(c[13]=p=>w.onBorderMenuToggle(p)),onBorderChange:c[14]||(c[14]=p=>re.onBorderChange(p)),onApplyBorder:re.applyCachedBorder,onHAlignChange:c[15]||(c[15]=p=>w.onHAlignChange(p)),onVAlignChange:c[16]||(c[16]=p=>w.onVAlignChange(p)),onWrapToggle:w.onWrapToggle,"onUpdate:mergeMenuOpen":c[17]||(c[17]=p=>re.onMergeMenuToggle(p)),onMergeChange:c[18]||(c[18]=p=>re.onMergeChange(p)),onApplyMerge:re.onApplyMerge},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","theme-vars","onPaintFormat","onFontSizeBlur","onFontSizeStepUp","onFontSizeStepDown","onBoldToggle","onItalicToggle","onUnderlineToggle","onStrikethroughToggle","onApplyTextColor","onApplyFillColor","onApplyBorder","onWrapToggle","onApplyMerge"]),t.createElementVNode("div",kn,[t.createElementVNode("div",En,t.toDisplayString(m.activeCellLabel),1),t.createElementVNode("input",{ref:he,class:"formula-bar__input",value:m.formulaBarDisplay,onFocus:c[19]||(c[19]=(...p)=>m.onFormulaBarFocus&&m.onFormulaBarFocus(...p)),onInput:c[20]||(c[20]=(...p)=>m.onFormulaBarInput&&m.onFormulaBarInput(...p)),onKeydown:c[21]||(c[21]=(...p)=>m.onFormulaBarKeydown&&m.onFormulaBarKeydown(...p)),onBlur:c[22]||(c[22]=(...p)=>m.onFormulaBarBlur&&m.onFormulaBarBlur(...p))},null,40,Bn)]),t.createElementVNode("div",{ref:F,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:j,class:"grid-canvas",tabindex:"0",onMousedown:c[23]||(c[23]=(...p)=>m.onMouseDown&&m.onMouseDown(...p)),onMousemove:c[24]||(c[24]=(...p)=>m.onMouseMove&&m.onMouseMove(...p)),onMouseup:c[25]||(c[25]=(...p)=>m.onMouseUp&&m.onMouseUp(...p)),onMouseleave:c[26]||(c[26]=(...p)=>m.onMouseLeave&&m.onMouseLeave(...p)),onDblclick:c[27]||(c[27]=(...p)=>m.onDblClick&&m.onDblClick(...p)),onWheel:c[28]||(c[28]=t.withModifiers((...p)=>m.onWheel&&m.onWheel(...p),["prevent"])),onFocus:c[29]||(c[29]=(...p)=>L.onCanvasFocus&&L.onCanvasFocus(...p)),onKeydown:c[30]||(c[30]=(...p)=>m.onKeydown&&m.onKeydown(...p)),onContextmenu:c[31]||(c[31]=(...p)=>m.onCanvasCtx&&m.onCanvasCtx(...p)),onTouchstart:c[32]||(c[32]=t.withModifiers((...p)=>m.onTouchStart&&m.onTouchStart(...p),["prevent"])),onTouchmove:c[33]||(c[33]=t.withModifiers((...p)=>m.onTouchMove&&m.onTouchMove(...p),["prevent"])),onTouchend:c[34]||(c[34]=(...p)=>m.onTouchEnd&&m.onTouchEnd(...p))},null,32),t.createElementVNode("textarea",{ref:be,class:"cell-editor",value:X.editValue,style:t.normalizeStyle(m.editInputStyle),onInput:c[35]||(c[35]=(...p)=>m.onEditInput&&m.onEditInput(...p)),onKeydown:c[36]||(c[36]=(...p)=>m.onEditKd&&m.onEditKd(...p)),onCompositionstart:c[37]||(c[37]=(...p)=>m.onEditCompositionStart&&m.onEditCompositionStart(...p)),onCompositionend:c[38]||(c[38]=(...p)=>m.onEditCompositionEnd&&m.onEditCompositionEnd(...p)),onBlur:c[39]||(c[39]=(...p)=>m.onEditBlur&&m.onEditBlur(...p)),onPaste:c[40]||(c[40]=(...p)=>m.onEditPaste&&m.onEditPaste(...p))},null,44,Rn),L.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[41]||(c[41]=t.withModifiers(p=>{L.clampScroll(null,X.scrollY-50),m.scheduleRender()},["prevent"]))},[...c[64]||(c[64]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:c[43]||(c[43]=(...p)=>m.onVTrk&&m.onVTrk(...p))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:m.vThumbT+"px",height:m.vThumbH+"px"}),onMousedown:c[42]||(c[42]=(...p)=>m.onVStart&&m.onVStart(...p))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:c[44]||(c[44]=t.withModifiers(p=>{L.clampScroll(null,X.scrollY+50),m.scheduleRender()},["prevent"]))},[...c[65]||(c[65]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),L.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[45]||(c[45]=t.withModifiers(p=>{L.clampScroll(X.scrollX-50,null),m.scheduleRender()},["prevent"]))},[...c[66]||(c[66]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:c[47]||(c[47]=(...p)=>m.onHTrk&&m.onHTrk(...p))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:m.hThumbL+"px",width:m.hThumbW+"px"}),onMousedown:c[46]||(c[46]=(...p)=>m.onHStart&&m.onHStart(...p))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:c[48]||(c[48]=t.withModifiers(p=>{L.clampScroll(X.scrollX+50,null),m.scheduleRender()},["prevent"]))},[...c[67]||(c[67]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),L.maxScrollX>0&&L.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",xn)):t.createCommentVNode("",!0)]),t.createVNode(cn,{locale:X.locale,sheets:L.sheets,"active-sheet-index":L.activeSheetIndex,"ren-tab":m.renTab,"ren-tab-val":m.renTabVal,onTabClick:c[49]||(c[49]=p=>m.onTabClick(p)),onTabDblclick:c[50]||(c[50]=p=>m.onTabDblClick(p)),onTabContextmenu:c[51]||(c[51]=p=>m.onTabCtxMenu(p.ev,p.i)),onTabRenameInput:c[52]||(c[52]=p=>U(p)),onTabRenameKeydown:c[53]||(c[53]=p=>m.onTabRenameKd(p)),onTabRenameCommit:m.commitTabRename,onTabbarContextmenu:c[54]||(c[54]=p=>m.onTabBarCtx(p)),onAddSheet:c[55]||(c[55]=p=>{L.addSheet(),m.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(()=>[m.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:m.ctxMenu.x+"px",top:m.ctxMenu.y+"px"}),onClick:c[56]||(c[56]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.ctxMenu.items,(p,Ae)=>(t.openBlock(),t.createElementBlock("div",{key:Ae,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":p.disabled}]),onClick:xe=>!p.disabled&&p.action&&(p.action(),P()),onMouseenter:xe=>m.onCtxItemEnter(xe,p)},[t.createElementVNode("span",Mn,t.toDisplayString(p.label),1),p.children?(t.openBlock(),t.createElementBlock("span",Tn)):t.createCommentVNode("",!0),p.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":m.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.children,(xe,ie)=>(t.openBlock(),t.createElementBlock("div",{key:ie,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":xe.disabled}]),onClick:t.withModifiers(r=>!xe.disabled&&xe.action&&(xe.action(),P()),["stop"])},t.toDisplayString(xe.label),11,Dn))),128))],2)):t.createCommentVNode("",!0)],42,Sn))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[m.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:m.dimPanel.x+"px",top:m.dimPanel.y+"px"}),onMousedown:c[62]||(c[62]=t.withModifiers(()=>{},["stop"])),onClick:c[63]||(c[63]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Hn,t.toDisplayString(m.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",An,[t.createElementVNode("input",{ref:we,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":m.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:m.dimPanel.value,onInput:c[57]||(c[57]=(...p)=>m.onDimInput&&m.onDimInput(...p)),onKeydown:c[58]||(c[58]=(...p)=>m.onDimKeydown&&m.onDimKeydown(...p)),onBlur:c[59]||(c[59]=(...p)=>m.onDimBlur&&m.onDimBlur(...p))},null,42,In),c[68]||(c[68]=t.createElementVNode("span",{class:"dim-panel__unit"},"px",-1))]),m.dimPanel.error?(t.openBlock(),t.createElementBlock("div",Fn,t.toDisplayString(m.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Nn,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:c[60]||(c[60]=(...p)=>m.applyDimPanel&&m.applyDimPanel(...p))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:c[61]||(c[61]=(...p)=>m.closeDimPanel&&m.closeDimPanel(...p))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-ef18f895"]]);st.Spreader=fl,st.default=fl,Object.defineProperties(st,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(st,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(st=typeof globalThis<"u"?globalThis:st||self,t(st.XiaoDaoSpreader={},st.Vue))})(this,function(st,t){"use strict";const xl={"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:"墨绿"},"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"}};function G(e,g){var h;return((h=xl[e])==null?void 0:h[g])??g}const Kt='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',at=10,Ml=[{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'}],Tl=[{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}],Dl='<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>',Hl='<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>',Al='<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>',Nl='<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>',Ol='<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>',Il='<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>',Ll=[{value:"left",labelKey:"alignLeft",icon:Dl},{value:"center",labelKey:"alignCenter",icon:Hl},{value:"right",labelKey:"alignRight",icon:Al}],Fl=[{value:"top",labelKey:"alignTop",icon:Nl},{value:"middle",labelKey:"alignMiddle",icon:Ol},{value:"bottom",labelKey:"alignBottom",icon:Il}],sl=[{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>'}],Vl={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"},Wl={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"},zl=["title"],$l=["innerHTML"],_l={key:1,class:"sp-dropdown__value"},Gl=["disabled"],Kl=["onClick"],Ul=["innerHTML"],Pl={class:"sp-dropdown__item-label"},Yl=["disabled"],Xl=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}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:g}){const h=e,n=g,u=t.ref(!1),w=t.ref(0),a=t.ref(null),O=t.ref(null),f=t.ref(null),X=t.ref({top:0,up:!1}),K=t.ref(0),E=t.ref(!1),L=t.computed(()=>h.options.find(c=>String(c.value)===String(h.modelValue))),N=t.computed(()=>h.menuWidth),_=t.computed(()=>Math.min(h.visibleCount,h.options.length)),ne=t.computed(()=>h.options.slice(w.value,w.value+_.value)),C=t.computed(()=>w.value>0),ge=t.computed(()=>w.value+_.value<h.options.length),U=t.computed(()=>h.options.length>_.value);function j(c){w.value=Math.max(0,Math.min(h.options.length-_.value,w.value+c))}function se(){u.value=!0,h.modelOpen!==void 0&&n("update:modelOpen",!0);const c=h.triggerEl??a.value;if(!c)return;const he=c.getBoundingClientRect(),ve=_.value*22+(U.value?2*15:0)+8,Me=window.innerHeight-he.bottom-4<ve&&he.top-4>ve;h.align==="right"?X.value={right:window.innerWidth-he.right,top:Me?he.top-ve-4:he.bottom+4,up:Me}:X.value={left:he.left,top:Me?he.top-ve-4:he.bottom+4,up:Me};const Te=h.options.findIndex(i=>String(i.value)===String(h.modelValue));w.value=Te>=0?Math.max(0,Math.min(Te-Math.floor(_.value/2),h.options.length-_.value)):0}function q(){u.value=!1,h.modelOpen!==void 0&&n("update:modelOpen",!1)}function A(){u.value?q():se()}function ye(c){n("update:modelValue",c.value),n("change",c.value),q()}function Se(c){var ve,Ae;if(!u.value)return;const he=c.target;(ve=a.value)!=null&&ve.contains(he)||(Ae=f.value)!=null&&Ae.contains(he)||q()}function we(c){u.value&&(c.preventDefault(),j(c.deltaY>0?1:-1))}t.watch(u,c=>{t.nextTick(()=>{var he,ve;c?(he=O.value)==null||he.addEventListener("wheel",we,{passive:!1}):(ve=O.value)==null||ve.removeEventListener("wheel",we)})}),t.watch(()=>h.modelOpen,c=>{c!==void 0&&c!==u.value&&(c?se():q())});function xe(c){u.value&&(K.value=c.touches[0].clientY,E.value=!0)}function Ie(c){if(!u.value||!E.value)return;const he=c.touches[0].clientY-K.value;Math.abs(he)>5&&(j(he<0?1:-1),K.value=c.touches[0].clientY)}function ae(){E.value=!1}function m(c){c.key==="Escape"&&q()}return t.onMounted(()=>{document.addEventListener("pointerdown",Se),window.addEventListener("resize",q),window.addEventListener("scroll",q,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",Se),window.removeEventListener("resize",q),window.removeEventListener("scroll",q,!0)}),(c,he)=>{var ve,Ae;return t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:a,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":u.value}]),title:e.title,onClick:A},[(ve=L.value)!=null&&ve.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:L.value.icon},null,8,$l)):(t.openBlock(),t.createElementBlock("span",_l,t.toDisplayString(((Ae=L.value)==null?void 0:Ae.label)??""),1)),he[2]||(he[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,zl)),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[u.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:f,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":X.value.up}]),style:t.normalizeStyle({left:X.value.left!==void 0?X.value.left+"px":void 0,right:X.value.right!==void 0?X.value.right+"px":void 0,top:X.value.top+"px",minWidth:N.value!==void 0?typeof N.value=="number"?N.value+"px":N.value:void 0}),onKeydown:m},[U.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!C.value}]),disabled:!C.value,onClick:he[0]||(he[0]=Me=>j(-1))},[...he[3]||(he[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,Gl)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:O,class:"sp-dropdown__list",onTouchstart:xe,onTouchmove:Ie,onTouchend:ae},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ne.value,Me=>(t.openBlock(),t.createElementBlock("button",{key:String(Me.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(Me.value)===String(e.modelValue)}]),onClick:Te=>ye(Me)},[Me.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:Me.icon},null,8,Ul)):t.createCommentVNode("",!0),t.createElementVNode("span",Pl,t.toDisplayString(Me.label),1)],10,Kl))),128))],544),U.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!ge.value}]),disabled:!ge.value,onClick:he[1]||(he[1]=Me=>j(1))},[...he[4]||(he[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,Yl)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),dt=(e,g)=>{const h=e.__vccOpts||e;for(const[n,u]of g)h[n]=u;return h},Ut=dt(Xl,[["__scopeId","data-v-67defaed"]]),jl=["title","onClick"],dl=dt(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:g,emit:h}){const n=e,u=h,w=[[{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"}]],a=[[{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"}]],O=t.computed(()=>n.colorKey==="fill"?a:w);function f(U){return G(n.locale,U)}function X(U){const j=n.currentColor;return!j&&!U?!0:j?j.toLowerCase()===U.toLowerCase():!1}const K=t.ref(!1),E=t.ref(null),L=t.ref(null),N=t.ref({top:0});t.watch(()=>n.modelOpen,U=>{U!==void 0&&U!==K.value&&(U?ne():C())});function _(U){const j=E.value,se=L.value,q=U.target;j&&j.contains(q)||se&&se.contains(q)||C()}function ne(){K.value=!0,n.modelOpen!==void 0&&u("update:modelOpen",!0),t.nextTick(()=>{const U=n.triggerEl??E.value;if(U){const j=U.getBoundingClientRect(),se=150,q=120;let A=window.innerWidth-j.right,ye=j.bottom+4,Se;j.left-q<4&&(A=void 0,Se=Math.max(4,j.left)),ye+se>window.innerHeight-4&&(ye=j.top-se-4),ye<4&&(ye=4),N.value=A!==void 0?{right:A,top:ye}:{left:Se,top:ye}}document.addEventListener("pointerdown",_)})}function C(){K.value=!1,n.modelOpen!==void 0&&u("update:modelOpen",!1),document.removeEventListener("pointerdown",_)}function ge(U){u("update:modelValue",U),u("change",U),C()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",_)}),g({open:K,openMenu:ne,close:C}),(U,j)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:E,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[K.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:L,class:"color-picker__menu",style:t.normalizeStyle({left:N.value.left!==void 0?N.value.left+"px":void 0,right:N.value.right!==void 0?N.value.right+"px":void 0,top:N.value.top+"px"}),onMousedown:j[0]||(j[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(O.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,A=>(t.openBlock(),t.createElementBlock("button",{key:A.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":X(A.value)}]),title:f(A.key),style:t.normalizeStyle({background:A.value||"transparent",border:A.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:ye=>ge(A.value)},null,14,jl))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f8fac424"]]),Zl=["title","onClick"],ql={viewBox:"0 0 30 30",class:"border-picker__icon"},Jl=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Ql={class:"border-picker__label"},eo=dt(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:g,emit:h}){const n=e,u=h,w=[{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"}],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}],O={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},f={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function X(U,j){return f[U].includes(j)?"thick":O[U].includes(j)?"solid":"dashed"}const K=t.ref(!1),E=t.ref(null),L=t.ref(null),N=t.ref({top:0});t.watch(()=>n.modelOpen,U=>{U!==void 0&&U!==K.value&&(U?ne():C())});function _(U){const j=E.value,se=L.value,q=U.target;j&&j.contains(q)||se&&se.contains(q)||C()}function ne(){K.value=!0,n.modelOpen!==void 0&&u("update:modelOpen",!0),t.nextTick(()=>{const U=n.triggerEl??E.value;if(U){const j=U.getBoundingClientRect(),se=200,q=160;let A=window.innerWidth-j.right,ye=j.bottom+4,Se;j.left-q<4&&(A=void 0,Se=Math.max(4,j.left)),ye+se>window.innerHeight-4&&(ye=j.top-se-4),ye<4&&(ye=4),N.value=A!==void 0?{right:A,top:ye}:{left:Se,top:ye}}document.addEventListener("pointerdown",_)})}function C(){K.value=!1,n.modelOpen!==void 0&&u("update:modelOpen",!1),document.removeEventListener("pointerdown",_)}function ge(U){u("change",U),C()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",_)}),g({open:K,openMenu:ne,close:C}),(U,j)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:E,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[K.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:L,class:"border-picker__menu",style:t.normalizeStyle({left:N.value.left!==void 0?N.value.left+"px":void 0,right:N.value.right!==void 0?N.value.right+"px":void 0,top:N.value.top+"px"}),onMousedown:j[0]||(j[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(w,se=>t.createElementVNode("button",{key:se.key,class:"border-picker__item",title:t.unref(G)(e.locale,se.i18nKey),onClick:q=>ge(se.key)},[(t.openBlock(),t.createElementBlock("svg",ql,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(a,q=>t.createElementVNode("line",{key:q.name,x1:q.x1,y1:q.y1,x2:q.x2,y2:q.y2,stroke:"currentColor","stroke-width":X(se.key,q.name)==="thick"?3:1.5,"stroke-dasharray":X(se.key,q.name)==="dashed"?"0 4":"none","stroke-linecap":X(se.key,q.name)==="dashed"?"round":"square"},null,8,Jl)),64))])),t.createElementVNode("span",Ql,t.toDisplayString(t.unref(G)(e.locale,se.i18nKey)),1)],8,Zl)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f362abdb"]]),to=["title","onClick"],lo=["innerHTML"],oo={class:"merge-picker__label"},no=dt(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:g,emit:h}){const n=e,u=h,w=t.ref(!1),a=t.ref(null),O=t.ref(null),f=t.ref({top:0});t.watch(()=>n.modelOpen,N=>{N!==void 0&&N!==w.value&&(N?K():E())});function X(N){const _=a.value,ne=O.value,C=N.target;_&&_.contains(C)||ne&&ne.contains(C)||E()}function K(){w.value=!0,n.modelOpen!==void 0&&u("update:modelOpen",!0),t.nextTick(()=>{const N=n.triggerEl??a.value;if(N){const _=N.getBoundingClientRect(),ne=sl.length*30+12,C=160;let ge=window.innerWidth-_.right,U=_.bottom+4,j;_.left-C<4&&(ge=void 0,j=Math.max(4,_.left)),U+ne>window.innerHeight-4&&(U=_.top-ne-4),U<4&&(U=4),f.value=ge!==void 0?{right:ge,top:U}:{left:j,top:U}}document.addEventListener("pointerdown",X)})}function E(){w.value=!1,n.modelOpen!==void 0&&u("update:modelOpen",!1),document.removeEventListener("pointerdown",X)}function L(N){u("change",N),E()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",X)}),g({open:w,openMenu:K,close:E}),(N,_)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:a,class:"merge-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[w.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:O,class:"merge-picker__menu",style:t.normalizeStyle({left:f.value.left!==void 0?f.value.left+"px":void 0,right:f.value.right!==void 0?f.value.right+"px":void 0,top:f.value.top+"px"}),onMousedown:_[0]||(_[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(sl),ne=>(t.openBlock(),t.createElementBlock("button",{key:ne.key,class:"merge-picker__item",title:t.unref(G)(e.locale,ne.labelKey),onClick:C=>L(ne.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:ne.icon},null,8,lo),t.createElementVNode("span",oo,t.toDisplayString(t.unref(G)(e.locale,ne.labelKey)),1)],8,to))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-67c0f9e3"]]),ro=["disabled","title","onClick"],ao={class:"calc-picker__label"},io=dt(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:g,emit:h}){const n=e,u=h,w=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"}],a=t.ref(!1),O=t.ref(null),f=t.ref(null),X=t.ref({top:0});t.watch(()=>n.modelOpen,_=>{_!==void 0&&_!==a.value&&(_?E():L())});function K(_){const ne=O.value,C=f.value,ge=_.target;ne&&ne.contains(ge)||C&&C.contains(ge)||L()}function E(){a.value=!0,n.modelOpen!==void 0&&u("update:modelOpen",!0),t.nextTick(()=>{const _=n.triggerEl??O.value;if(_){const ne=_.getBoundingClientRect(),C=w.length*30+12,ge=160;let U=window.innerWidth-ne.right,j=ne.bottom+4,se;ne.left-ge<4&&(U=void 0,se=Math.max(4,ne.left)),j+C>window.innerHeight-4&&(j=ne.top-C-4),j<4&&(j=4),X.value=U!==void 0?{right:U,top:j}:{left:se,top:j}}document.addEventListener("pointerdown",K)})}function L(){a.value=!1,n.modelOpen!==void 0&&u("update:modelOpen",!1),document.removeEventListener("pointerdown",K)}function N(_){n.disabled||(u("change",_),L())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",K)}),g({open:a,openMenu:E,close:L}),(_,ne)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:O,class:"calc-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:f,class:"calc-picker__menu",style:t.normalizeStyle({left:X.value.left!==void 0?X.value.left+"px":void 0,right:X.value.right!==void 0?X.value.right+"px":void 0,top:X.value.top+"px"}),onMousedown:ne[0]||(ne[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(w,C=>t.createElementVNode("button",{key:C.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(G)(e.locale,C.labelKey),onClick:ge=>N(C.key)},[t.createElementVNode("span",ao,t.toDisplayString(t.unref(G)(e.locale,C.labelKey)),1)],10,ro)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-08615aee"]]),co={class:"tb-item","data-key":"undo"},so=["title","disabled"],uo={class:"tb-item","data-key":"redo"},fo=["title","disabled"],mo={class:"tb-item","data-key":"paint"},po=["title","disabled"],go={class:"tb-item","data-key":"clear"},ho=["title","disabled"],vo={class:"tb-item","data-key":"font"},Co={class:"tb-item","data-key":"fontSize"},bo={class:"toolbar-font-size"},yo=["value","title"],wo=["title"],ko=["title","disabled"],Eo=["title","disabled"],Bo={class:"tb-item","data-key":"bold"},Ro=["title","disabled"],So={class:"tb-item","data-key":"italic"},xo=["title","disabled"],Mo={class:"tb-item","data-key":"underline"},To=["title","disabled"],Do={class:"tb-item","data-key":"strike"},Ho=["title","disabled"],Ao={class:"tb-item","data-key":"textColor"},No={class:"toolbar-split"},Oo=["title","disabled"],Io={viewBox:"0 0 1024 1024",fill:"currentColor"},Lo=["fill"],Fo=["title","disabled"],Vo={class:"tb-item","data-key":"fillColor"},Wo={class:"toolbar-split"},zo=["title","disabled"],$o={viewBox:"0 0 1024 1024",fill:"currentColor"},_o=["fill"],Go=["title","disabled"],Ko={class:"tb-item","data-key":"border"},Uo={class:"toolbar-split"},Po=["title","disabled"],Yo={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},Xo=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],jo=["title","disabled"],Zo={class:"tb-item","data-key":"hAlign"},qo={class:"tb-item","data-key":"vAlign"},Jo={class:"tb-item","data-key":"wrap"},Qo=["title"],en={class:"tb-item","data-key":"merge"},tn={class:"toolbar-split"},ln=["title","disabled"],on=["title","disabled"],nn={class:"tb-item","data-key":"calc"},rn={class:"toolbar-split"},an=["title","disabled"],cn=["title","disabled"],Qt=2,sn=6,dn=34,un=dt(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:{}},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","font-family-change","font-size-change","h-align-change","v-align-change","font-size-input","text-color-change","fill-color-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","calc-sum","calc-avg"],setup(e,{emit:g}){const h=[{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}],n={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 w(b,l){return u[b].includes(l)?"thick":n[b].includes(l)?"solid":"dashed"}const a=["undo","redo","paint","clear","sep1","font","fontSize","sep2","bold","italic","underline","strike","sep3","textColor","fillColor","border","sep4","hAlign","vAlign","wrap","merge","calc"],O=t.ref(null),f=t.ref(null),X=t.ref(null),K=t.ref(null),E=t.ref(null),L=t.ref(null),N=t.ref(null),_=t.ref(null),ne=t.ref(null),C=t.ref(new Set),ge=t.ref(!1),U=t.ref(!1),j=t.ref(0),se=new Map,q=t.computed(()=>C.value.size>0);function A(b){return C.value.has(b)}function ye(){for(const b of a){const l=se.get(b);if(l===void 0||l===0)return!0}return!1}function Se(){if(!O.value)return;O.value.querySelectorAll(".tb-item").forEach(l=>{const r=l.dataset.key;if(!r)return;const F=l.offsetWidth;F>0?se.set(r,F):se.has(r)||se.set(r,0)})}function we(b,l){if(b.size!==l.size)return!1;for(const r of b)if(!l.has(r))return!1;return!0}let xe=0,Ie=0;function ae(){xe&&cancelAnimationFrame(xe),!(Ie>60)&&(Ie++,xe=requestAnimationFrame(()=>requestAnimationFrame(m)))}function m(){if(!O.value)return;const b=O.value.clientWidth-sn*2;if(b<=0){ae();return}Ie=0,(se.size===0||ye())&&Se();let l=0;for(const F of a)l+=(se.get(F)??0)+Qt;const r=new Set;if(l>b){const F=b-dn-Qt;let V=0;for(let $=0;$<a.length;$++){const de=a[$],Ce=(se.get(de)??0)+Qt;if(V+Ce>F){for(let De=$;De<a.length;De++)r.add(a[De]);break}V+=Ce}}we(r,C.value)||(C.value=r,j.value++,r.size===0&&(ge.value=!1))}let c=null;const he=t.ref(0),ve=t.computed(()=>{const b=X.value,l={position:"fixed",top:"0px",right:"0px"};if(!b)return{...i.themeVars,...l};he.value;const r=b.getBoundingClientRect();return{...i.themeVars,position:"fixed",top:`${r.bottom+4}px`,right:`${window.innerWidth-r.right}px`}});function Ae(){ge.value&&(he.value++,t.nextTick(()=>m()))}function Me(b){var r,F;if(!ge.value)return;const l=b.target;(r=f.value)!=null&&r.contains(l)||(F=X.value)!=null&&F.contains(l)||(U.value=!0,ge.value=!1,t.nextTick(()=>{U.value=!1}))}function Te(){ge.value=!ge.value}t.onMounted(()=>{ae(),O.value&&(c=new ResizeObserver(()=>{ge.value||ae()}),c.observe(O.value)),document.addEventListener("pointerdown",Me,!0),window.addEventListener("resize",Ae),window.addEventListener("load",ae),window.addEventListener("orientationchange",ae)}),t.onBeforeUnmount(()=>{xe&&cancelAnimationFrame(xe),c==null||c.disconnect(),document.removeEventListener("pointerdown",Me,!0),window.removeEventListener("resize",Ae),window.removeEventListener("load",ae),window.removeEventListener("orientationchange",ae)});const i=e,v=g;return(b,l)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:O,class:"toolbar"},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("undo"),to:f.value??void 0},[t.createElementVNode("div",co,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(G)(e.locale,"undo"),disabled:!e.canUndo,onClick:l[0]||(l[0]=r=>v("undo"))},[...l[43]||(l[43]=[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,so)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("redo"),to:f.value??void 0},[t.createElementVNode("div",uo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(G)(e.locale,"redo"),disabled:!e.canRedo,onClick:l[1]||(l[1]=r=>v("redo"))},[...l[44]||(l[44]=[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,fo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("paint"),to:f.value??void 0},[t.createElementVNode("div",mo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(G)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:l[2]||(l[2]=r=>v("paint-format"))},[...l[45]||(l[45]=[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,po)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("clear"),to:f.value??void 0},[t.createElementVNode("div",go,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(G)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:l[3]||(l[3]=r=>v("clear-format"))},[...l[46]||(l[46]=[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,ho)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("sep1"),to:f.value??void 0},[l[47]||(l[47]=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:!A("font"),to:f.value??void 0},[t.createElementVNode("div",vo,[t.createVNode(Ut,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:A("font")?"100%":110,"menu-width":A("font")?120:void 0,"visible-count":8,title:t.unref(G)(e.locale,"fontFamily"),align:"right",onChange:l[4]||(l[4]=r=>v("font-family-change",r))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("fontSize"),to:f.value??void 0},[t.createElementVNode("div",Co,[t.createElementVNode("div",bo,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(G)(e.locale,"fontSize"),onInput:l[5]||(l[5]=r=>v("font-size-input",r.target.value)),onBlur:l[6]||(l[6]=r=>v("font-size-blur")),onKeydown:l[7]||(l[7]=r=>v("font-size-keydown",r))},null,40,yo),t.createVNode(Ut,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:A("fontSize")?"100%":56,"menu-width":A("fontSize")?120:56,"visible-count":9,title:t.unref(G)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":ne.value,"onUpdate:modelOpen":l[8]||(l[8]=r=>v("update:font-size-menu-open",r)),onChange:l[9]||(l[9]=r=>v("font-size-change",r))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:ne,class:"toolbar-font-size__btn",type:"button",title:t.unref(G)(e.locale,"fontSize"),onMousedown:l[10]||(l[10]=t.withModifiers(()=>{},["prevent"])),onClick:l[11]||(l[11]=r=>v("font-size-toggle"))},[...l[48]||(l[48]=[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,wo),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(G)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:l[12]||(l[12]=t.withModifiers(()=>{},["prevent"])),onClick:l[13]||(l[13]=r=>v("font-size-step-down"))},[...l[49]||(l[49]=[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,ko),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(G)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:l[14]||(l[14]=t.withModifiers(()=>{},["prevent"])),onClick:l[15]||(l[15]=r=>v("font-size-step-up"))},[...l[50]||(l[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-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,Eo)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("sep2"),to:f.value??void 0},[l[51]||(l[51]=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:!A("bold"),to:f.value??void 0},[t.createElementVNode("div",Bo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(G)(e.locale,"bold"),disabled:!e.hasSelection,onClick:l[16]||(l[16]=r=>v("bold-toggle"))},[...l[52]||(l[52]=[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,Ro)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("italic"),to:f.value??void 0},[t.createElementVNode("div",So,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(G)(e.locale,"italic"),disabled:!e.hasSelection,onClick:l[17]||(l[17]=r=>v("italic-toggle"))},[...l[53]||(l[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:"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,xo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("underline"),to:f.value??void 0},[t.createElementVNode("div",Mo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(G)(e.locale,"underline"),disabled:!e.hasSelection,onClick:l[18]||(l[18]=r=>v("underline-toggle"))},[...l[54]||(l[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 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,To)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("strike"),to:f.value??void 0},[t.createElementVNode("div",Do,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(G)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:l[19]||(l[19]=r=>v("strikethrough-toggle"))},[...l[55]||(l[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:"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,Ho)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("sep3"),to:f.value??void 0},[l[56]||(l[56]=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:!A("textColor"),to:f.value??void 0},[t.createElementVNode("div",Ao,[t.createElementVNode("div",No,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(G)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:l[20]||(l[20]=r=>v("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",Io,[l[57]||(l[57]=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,Lo)]))],8,Oo),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:K,class:"toolbar-btn toolbar-split__arrow",title:t.unref(G)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:l[21]||(l[21]=r=>v("update:text-color-menu-open",!e.textColorMenuOpen))},[...l[58]||(l[58]=[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,Fo),t.createVNode(dl,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":K.value,"onUpdate:modelOpen":l[22]||(l[22]=r=>v("update:text-color-menu-open",r)),onChange:l[23]||(l[23]=r=>v("text-color-change",r))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("fillColor"),to:f.value??void 0},[t.createElementVNode("div",Vo,[t.createElementVNode("div",Wo,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(G)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:l[24]||(l[24]=r=>v("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",$o,[l[59]||(l[59]=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,_o)]))],8,zo),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:E,class:"toolbar-btn toolbar-split__arrow",title:t.unref(G)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:l[25]||(l[25]=r=>v("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...l[60]||(l[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,Go),t.createVNode(dl,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":E.value,"onUpdate:modelOpen":l[26]||(l[26]=r=>v("update:fill-color-menu-open",r)),onChange:l[27]||(l[27]=r=>v("fill-color-change",r))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("border"),to:f.value??void 0},[t.createElementVNode("div",Ko,[t.createElementVNode("div",Uo,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(G)(e.locale,"borders"),disabled:!e.hasSelection,onClick:l[28]||(l[28]=r=>v("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",Yo,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(h,r=>t.createElementVNode("line",{key:r.name,x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,"stroke-width":w(e.cachedBorder,r.name)==="thick"?3:1.5,"stroke-dasharray":w(e.cachedBorder,r.name)==="dashed"?"0 4":"none","stroke-linecap":w(e.cachedBorder,r.name)==="dashed"?"round":"square"},null,8,Xo)),64))]))],8,Po),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:L,class:"toolbar-btn toolbar-split__arrow",title:t.unref(G)(e.locale,"borders"),disabled:!e.hasSelection,onClick:l[29]||(l[29]=r=>v("update:border-menu-open",!e.borderMenuOpen))},[...l[61]||(l[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,jo),t.createVNode(eo,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":L.value,"onUpdate:modelOpen":l[30]||(l[30]=r=>v("update:border-menu-open",r)),onChange:l[31]||(l[31]=r=>v("border-change",r))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("sep4"),to:f.value??void 0},[l[62]||(l[62]=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:!A("hAlign"),to:f.value??void 0},[t.createElementVNode("div",Zo,[t.createVNode(Ut,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:A("hAlign")?"100%":44,"menu-width":A("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(G)(e.locale,"hAlign"),onChange:l[32]||(l[32]=r=>v("h-align-change",r))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("vAlign"),to:f.value??void 0},[t.createElementVNode("div",qo,[t.createVNode(Ut,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:A("vAlign")?"100%":44,"menu-width":A("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(G)(e.locale,"vAlign"),onChange:l[33]||(l[33]=r=>v("v-align-change",r))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",Jo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(G)(e.locale,"wrap"),onClick:l[34]||(l[34]=r=>v("wrap-toggle"))},[...l[63]||(l[63]=[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,Qo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("merge"),to:f.value??void 0},[t.createElementVNode("div",en,[t.createElementVNode("div",tn,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(G)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:l[35]||(l[35]=r=>v("apply-merge"))},[...l[64]||(l[64]=[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,ln),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:N,class:"toolbar-btn toolbar-split__arrow",title:t.unref(G)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:l[36]||(l[36]=r=>v("update:merge-menu-open",!e.mergeMenuOpen))},[...l[65]||(l[65]=[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(no,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":N.value,"onUpdate:modelOpen":l[37]||(l[37]=r=>v("update:merge-menu-open",r)),onChange:l[38]||(l[38]=r=>v("merge-change",r))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!A("calc"),to:f.value??void 0},[t.createElementVNode("div",nn,[t.createElementVNode("div",rn,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(G)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:l[39]||(l[39]=r=>v("calc-sum"))},[...l[66]||(l[66]=[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,an),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:_,class:"toolbar-btn toolbar-split__arrow",title:t.unref(G)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:l[40]||(l[40]=r=>v("update:calc-menu-open",!e.calcMenuOpen))},[...l[67]||(l[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,cn),t.createVNode(io,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":_.value,disabled:e.isSingleCell,"onUpdate:modelOpen":l[41]||(l[41]=r=>v("update:calc-menu-open",r)),onChange:l[42]||(l[42]=r=>v(r==="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:X,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":ge.value}]),type:"button",onClick:Te},[...l[68]||(l[68]=[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:f,key:j.value,class:t.normalizeClass(["overflow-menu",{"no-anim":U.value}]),style:t.normalizeStyle(ve.value)},null,6)),[[t.vShow,ge.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-dc556a27"]]),fn={class:"tab-list"},mn=["onClick","onDblclick","onContextmenu"],pn=["value"],gn={key:1,class:"tab-item__name"},hn=["title"],vn=dt(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:g}){const h=g;return(n,u)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:u[5]||(u[5]=w=>h("tabbar-contextmenu",w))},[t.createElementVNode("div",fn,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(w,a)=>(t.openBlock(),t.createElementBlock("div",{key:w.id,class:t.normalizeClass(["tab-item",{"tab-item--active":a===e.activeSheetIndex}]),onClick:O=>h("tab-click",a),onDblclick:t.withModifiers(O=>h("tab-dblclick",a),["prevent"]),onContextmenu:O=>h("tab-contextmenu",{ev:O,i:a})},[e.renTab===a?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:u[0]||(u[0]=O=>h("tab-rename-input",O.target.value)),onKeydown:u[1]||(u[1]=O=>h("tab-rename-keydown",O)),onBlur:u[2]||(u[2]=O=>h("tab-rename-commit")),onClick:u[3]||(u[3]=t.withModifiers(()=>{},["stop"]))},null,40,pn)):(t.openBlock(),t.createElementBlock("span",gn,t.toDisplayString(w.name),1))],42,mn))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(G)(e.locale,"addSheet"),onClick:u[4]||(u[4]=w=>h("add-sheet"))}," + ",8,hn)],32))}}),[["__scopeId","data-v-454e1a12"]]);function ze(e){let g="",h=e;do g=String.fromCharCode(65+h%26)+g,h=Math.floor(h/26)-1;while(h>=0);return g}function el(e){let g=0;for(let h=0;h<e.length;h++)g=g*26+(e.toUpperCase().charCodeAt(h)-64);return g-1}function gt(e){if(e==null)return null;if(typeof e=="number")return e;if(typeof e=="string"){const g=parseFloat(e);return e.endsWith("%")||isNaN(g)?null:g}return null}function tl(e){navigator.clipboard.writeText(e).catch(()=>{const g=document.createElement("textarea");g.value=e,g.style.position="fixed",g.style.opacity="0",document.body.appendChild(g),g.select(),document.execCommand("copy"),document.body.removeChild(g)})}function Rt(e,g){return`${e},${g}`}function Pt(e,g,h){const n=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!n)return null;const u=el(n[1]),w=parseInt(n[2],10)-1;return u<0||u>=g||w<0||w>=h?null:{col:u,row:w}}function ht(e,g){if(!g)return{x:0,y:0};const h=g.getBoundingClientRect();return{x:e.clientX-h.left,y:e.clientY-h.top}}function ul(e,g,h){const n=e.split(":");if(n.length!==2)return null;const u=Pt(n[0],g,h),w=Pt(n[1],g,h);return!u||!w?null:{sc:Math.min(u.col,w.col),sr:Math.min(u.row,w.row),ec:Math.max(u.col,w.col),er:Math.max(u.row,w.row)}}function fl(e,g,h,n,u){const w=h[Rt(e,g)];if(!w)return 0;const a=w.value;if(a.startsWith("="))return ml(Rt(e,g),h,n,u)??0;const O=parseFloat(a);return isNaN(O)?0:O}const vt=new Map;function ll(){vt.clear()}function ml(e,g,h,n){return Cn(e,g,h,n)}function Cn(e,g,h,n,u){if(vt.has(e))return NaN;vt.set(e,NaN);const w=g[e];if(!w)return NaN;const a=w.value;if(!a.startsWith("=")){const X=parseFloat(a),K=isNaN(X)?0:X;return vt.set(e,K),K}const O=a.slice(1).trim(),f=O.toUpperCase();if(f.startsWith("SUM(")&&O.endsWith(")")){const X=O.slice(4,-1).trim(),K=ul(X,h,n);if(K){let E=0;for(let L=K.sc;L<=K.ec;L++)for(let N=K.sr;N<=K.er;N++)E+=fl(L,N,g,h,n);return isNaN(E)?NaN:(vt.set(e,E),E)}return NaN}if(f.startsWith("AVERAGE(")&&O.endsWith(")")){const X=O.slice(8,-1).trim(),K=ul(X,h,n);if(K){let E=0,L=0;for(let _=K.sc;_<=K.ec;_++)for(let ne=K.sr;ne<=K.er;ne++)E+=fl(_,ne,g,h,n),L++;if(L===0||isNaN(E))return NaN;const N=E/L;return vt.set(e,N),N}return NaN}return NaN}function ol(e,g,h){const n=[],u=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let w;for(;(w=u.exec(e))!==null;){const a=Pt(w[1],g,h);if(a)if(w[2]){const O=Pt(w[2],g,h);if(!O)continue;for(let f=Math.min(a.col,O.col);f<=Math.max(a.col,O.col);f++)for(let X=Math.min(a.row,O.row);X<=Math.max(a.row,O.row);X++)n.push(Rt(f,X))}else n.push(Rt(a.col,a.row))}return n}function bn(e,g,h,n,u){const w=h[Rt(e,g)];if(!w)return"";const a=w.value;if(!a.startsWith("="))return a;const O=ml(Rt(e,g),h,n,u);return isNaN(O)?"#ERROR":String(O)}function yn(e,g,h,n,u,w){return g===0&&h===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(a,O,f,X,K)=>{const E=O?el(f):el(f)+g,L=X?parseInt(K,10)-1:parseInt(K,10)-1+h;let N;E<0?N="A":E>=n?N=w(n-1):N=w(E);let _;return L<0?_="1":L>=u?_=String(u):_=String(L+1),(O||"")+N+(X||"")+_})}class wn{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(g){var n;const h=this.deps.get(g);if(h){for(const u of h)(n=this.rev.get(u))==null||n.delete(g);this.deps.delete(g)}}set(g,h){if(this.clear(g),h.length!==0){this.deps.set(g,h);for(const n of h)this.rev.has(n)||this.rev.set(n,new Set),this.rev.get(n).add(g)}}markDirty(g){const h=[g];for(;h.length>0;){const n=h.pop(),u=this.rev.get(n);if(u)for(const w of u)this.dirty.has(w)||(this.dirty.add(w),h.push(w))}}getDirtyAndClear(){const g=this.dirty;return this.dirty=new Set,g}rebuild(g,h,n){this.deps.clear(),this.rev.clear(),this.dirty.clear(),vt.clear();for(const[u,w]of Object.entries(g))if(w.value.startsWith("=")){const a=ol(w.value.slice(1),h,n);this.set(u,a)}}}function kn(e,g){const h=t.reactive({rowCount:e.rowCount??g.rowCount,colCount:e.colCount??g.colCount,width:e.width,height:e.height,theme:e.theme??g.theme,locale:e.locale??g.locale});t.watchEffect(()=>{h.rowCount=e.rowCount??g.rowCount,h.colCount=e.colCount??g.colCount,h.width=e.width,h.height=e.height,h.theme=e.theme??g.theme,h.locale=e.locale??g.locale});const n=t.computed(()=>h.locale==="zh-CN"?"zh-CN":"en-US"),u=h.colCount,w=h.rowCount,a=t.reactive({}),O=t.reactive({}),f=new wn,X=t.ref(null),K=t.ref({col:0,row:0}),E=t.ref(null),L=t.ref(""),N=t.ref(new Array(u).fill(100)),_=t.ref(new Array(w).fill(void 0)),ne=t.ref(0),C=t.ref(0),ge=(24-at)/2,U=new Map;let j=null;function se(B,R,x,Z){const Q=`${Z} ${x} ${R}px ${B}`,ie=U.get(Q);if(ie)return ie;if(!j){if(typeof document>"u")return{ascent:R*.8,descent:R*.2};j=document.createElement("canvas")}const me=j.getContext("2d");if(!me)return{ascent:R*.8,descent:R*.2};me.font=Q;const s=me.measureText("M"),y=s.actualBoundingBoxAscent,W=s.actualBoundingBoxDescent,z=y||R*.8,te=W||R*.2,oe=Math.max(z,R*.5),ee=Math.max(te,R*.15),pe={ascent:oe,descent:ee};return U.set(Q,pe),pe}let q=(B,R)=>`${B},${R}`,A=()=>null,ye=()=>at,Se=t.computed(()=>[0]),we=()=>24,xe=(B,R,x,Z)=>({startCol:Math.min(B,x),startRow:Math.min(R,Z),endCol:Math.max(B,x),endRow:Math.max(R,Z)});function Ie(B,R){var s;const x=(s=a[q(B,R)])==null?void 0:s.style,Z=ye(B,R),Q=typeof(x==null?void 0:x.fontFamily)=="string"&&x.fontFamily?x.fontFamily:Kt,ie=(x==null?void 0:x.fontWeight)==="bold"?"bold":"normal",me=(x==null?void 0:x.fontStyle)==="italic"?"italic":"normal";return se(Q,Z,ie,me)}function ae(B,R,x,Z){if(!R)return[""];const Q=R.split(`
|
|
2
|
+
`),ie=[];for(const me of Q)if(!Z||x<=0)ie.push(me);else{let s="";for(let y=0;y<me.length;y++){const W=me[y],z=s+W;B.measureText(z).width>x&&s?(ie.push(s),s=W):s=z}ie.push(s)}return ie}function m(B,R){var Z;const x=(Z=a[q(B,R)])==null?void 0:Z.style;return typeof(x==null?void 0:x.fontSize)=="number"&&x.fontSize>0?x.fontSize:at}ye=m;const c=t.computed(()=>{const B=[0];for(let R=0;R<u;R++)B.push(B[R]+N.value[R]);return B});Se=c;const he={w:800,h:600};let ve=()=>{};function Ae(B){var z;const R=_.value[B];if(R!=null&&R>0)return R;let x=at,Z=x*.8,Q=x*.2,ie=1;const me=j?j.getContext("2d"):null;for(let te=0;te<u;te++){const oe=m(te,B),ee=(z=a[q(te,B)])==null?void 0:z.style,pe=typeof(ee==null?void 0:ee.fontFamily)=="string"&&ee.fontFamily?ee.fontFamily:Kt,ke=(ee==null?void 0:ee.fontWeight)==="bold"?"bold":"normal",$e=(ee==null?void 0:ee.fontStyle)==="italic"?"italic":"normal",Le=J(te,B);if(Le&&me){me.font=`${$e} ${ke} ${oe}px ${pe}`;const Ge=Le.split(`
|
|
3
|
+
`)[0]||Le,Ve=me.measureText(Ge),Ke=Ve.actualBoundingBoxAscent,ot=Ve.actualBoundingBoxDescent,Lt=Ke||oe*.8,Yt=ot||oe*.2,Ft=Math.max(Lt,oe*.5),Xt=Math.max(Yt,oe*.15);Ft>Z&&(Z=Ft),Xt>Q&&(Q=Xt),oe>x&&(x=oe);const nl=(ee==null?void 0:ee.wrap)==="wrap";let ft;if(nl){const St=A(te,B);let Vt;St&&te===St.range.startCol&&B===St.range.startRow?Vt=Se.value[St.range.endCol+1]-Se.value[te]:Vt=N.value[te],ft=ae(me,Le,Math.max(0,Vt-10),!0).length,ft>ie&&(ie=ft)}else ft=Le.split(`
|
|
4
|
+
`).length,ft>ie&&(ie=ft)}else if(oe>x){x=oe;const Ge=se(pe,oe,ke,$e);Ge.ascent>Z&&(Z=Ge.ascent),Ge.descent>Q&&(Q=Ge.descent)}}const s=x,y=ge*2+ie*s;return Math.min(500,Math.max(24,Math.round(y)))}we=Ae;function Me(B){return _.value[B]===void 0}const Te=t.computed(()=>{const B=[0];for(let R=0;R<w;R++)B.push(B[R]+we(R));return B}),i=t.computed(()=>c.value[u]),v=t.computed(()=>Te.value[w]);function b(B,R){return`${B},${R}`}q=b;function l(B){Reflect.deleteProperty(a,B)}function r(B,R){const x=A(B,R);x?(K.value={col:x.range.startCol,row:x.range.startRow},X.value={...x.range}):(K.value={col:B,row:R},X.value={startCol:B,startRow:R,endCol:B,endRow:R})}function F(B,R,x,Z){const Q=A(B,R);K.value=Q?{col:Q.range.startCol,row:Q.range.startRow}:{col:B,row:R},X.value=xe(B,R,x,Z)}function V(){F(0,0,u-1,w-1)}function $(B,R){const x=X.value;return x?B>=x.startCol&&B<=x.endCol&&R>=x.startRow&&R<=x.endRow:!1}function de(B,R){for(const x in O){const Z=O[x];if(Z&&B>=Z.startCol&&B<=Z.endCol&&R>=Z.startRow&&R<=Z.endRow)return{range:Z,anchor:x}}return null}A=de;function Ce(B,R){return O[b(B,R)]!==void 0}function De(B,R){const x=A(B,R);if(x&&B===x.range.startCol&&R===x.range.startRow){const Z=c.value[x.range.endCol+1]-c.value[B],Q=Te.value[x.range.endRow+1]-Te.value[R];return{w:Z,h:Q}}return{w:N.value[B],h:we(R)}}function k(B,R,x,Z){let Q=Math.min(B,x),ie=Math.max(B,x),me=Math.min(R,Z),s=Math.max(R,Z),y=!0;for(;y;){y=!1;for(const W in O){const z=O[W];if(!z)continue;z.startCol<=ie&&z.endCol>=Q&&z.startRow<=s&&z.endRow>=me&&(z.startCol<Q&&(Q=z.startCol,y=!0),z.endCol>ie&&(ie=z.endCol,y=!0),z.startRow<me&&(me=z.startRow,y=!0),z.endRow>s&&(s=z.endRow,y=!0))}}return{startCol:Q,startRow:me,endCol:ie,endRow:s}}xe=k;let T=()=>{};function S(B,R){var x;return((x=a[b(B,R)])==null?void 0:x.value)??""}function J(B,R){return ll(),bn(B,R,a,u,w)}function ue(B,R,x){var me,s;const Z=b(B,R);if(ll(),x===""||x==null){f.clear(Z);const y=((me=a[Z])==null?void 0:me.style)??null;y?a[Z]={value:"",style:y}:l(Z),f.markDirty(Z);return}const Q=String(x),ie=((s=a[Z])==null?void 0:s.style)??null;a[Z]={value:Q,style:ie},Q.startsWith("=")?f.set(Z,ol(Q.slice(1),u,w)):f.clear(Z),f.markDirty(Z)}function Y(B,R,x,Z){for(let Q=B;Q<=R;Q++)for(let ie=x;ie<=Z;ie++){const me=b(Q,ie);f.clear(me),l(me),f.markDirty(me),T(Q,ie)}}let fe=()=>{};function Re(B){E.value||(E.value={...K.value},L.value=B??S(K.value.col,K.value.row))}function He(){E.value&&(fe(),ue(E.value.col,E.value.row,L.value),E.value=null,L.value="")}function lt(){E.value=null,L.value=""}function Ue(B,R){const x=K.value;let Z=Math.max(0,Math.min(u-1,x.col+B)),Q=Math.max(0,Math.min(w-1,x.row+R));const ie=A(x.col,x.row),me=A(Z,Q);ie&&me&&ie.anchor===me.anchor&&(B>0?Z=ie.range.endCol+1:B<0&&(Z=ie.range.startCol-1),R>0?Q=ie.range.endRow+1:R<0&&(Q=ie.range.startRow-1),Z=Math.max(0,Math.min(u-1,Z)),Q=Math.max(0,Math.min(w-1,Q))),r(Z,Q)}function qe(B,R){const x=Math.max(0,he.w-52-11),Z=Math.max(0,he.h-24-11),Q=c.value[B],ie=Te.value[R],me=A(B,R),s=me?c.value[me.range.endCol+1]-c.value[B]:N.value[B],y=me?Te.value[me.range.endRow+1]-Te.value[R]:we(R);let W=ne.value,z=C.value;Q<W?W=Q:Q+s>W+x&&(W=Q+s-x),ie<z?z=ie:ie+y>z+Z&&(z=ie+y-Z),ve(W,z)}function ut(B){const R=c.value;if(B<0||B>=R[u])return-1;let x=0,Z=u-1;for(;x<Z;){const Q=x+Z+1>>1;R[Q]<=B?x=Q:Z=Q-1}return x}function It(B){const R=Te.value;if(B<0||B>=R[w])return-1;let x=0,Z=w-1;for(;x<Z;){const Q=x+Z+1>>1;R[Q]<=B?x=Q:Z=Q-1}return x}const Xe={props:h,locale:n,colCount:u,rowCount:w,cells:a,merges:O,formulaDeps:f,selection:X,activeCell:K,editingCell:E,editValue:L,colWidths:N,rowHeights:_,scrollX:ne,scrollY:C,BASE_CELL_VPAD:ge,fontMetricsCache:U,fontMetricsCanvas:j,measureFontMetrics:se,_getFontMetricsForCell:Ie,getWrappedLines:ae,cellFontSize:m,colPositions:c,getRowHeight:Ae,_isAutoRow:Me,rowPositions:Te,totalWidth:i,totalHeight:v,selectCell:r,selectRange:F,selectAll:V,isSelected:$,cellKey:b,delCell:l,findMerge:de,_isMergeAnchor:Ce,_mergedSpan:De,expandSelectionForMerges:k,getCellRaw:S,getCellValue:J,setCellValue:ue,clearCellsInRange:Y,startEdit:Re,commitEdit:He,cancelEdit:lt,moveActive:Ue,ensureVisible:qe,hitCol:ut,hitRow:It,viewSize:he};return fe=()=>{var B;return(B=Xe.saveUndo)==null?void 0:B.call(Xe)},T=(B,R)=>{var x;return(x=Xe.syncCellBorders)==null?void 0:x.call(Xe,B,R)},ve=(B,R)=>{var x;return(x=Xe.clampScroll)==null?void 0:x.call(Xe,B,R)},Xe}function En(e,g){const h=t.ref([]),n=t.ref([]);function u(s){const y={};for(const[W,z]of Object.entries(s))y[W]={value:z.value,style:z.style};return y}function w(){return g.saveSheet(),{sheets:g.sheets.value.map(s=>({id:s.id,name:s.name,cells:u(s.cells),merges:s.merges?{...s.merges}:{},selection:s.selection?{...s.selection}:null,activeCell:s.activeCell?{...s.activeCell}:{col:0,row:0},scrollX:s.scrollX,scrollY:s.scrollY,colWidths:[...s.colWidths],rowHeights:[...s.rowHeights]})),activeSheetIndex:g.activeSheetIndex.value}}function a(s){g.sheets.value=s.sheets.map(y=>({...y,cells:u(y.cells)})),g.loadSheet(Math.max(0,Math.min(s.activeSheetIndex,g.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function O(){const s=w(),y=h.value[h.value.length-1];y&&JSON.stringify(y)===JSON.stringify(s)||(h.value.push(s),n.value=[],h.value.length>50&&h.value.shift())}e.saveUndo=O;function f(){var s;h.value.length&&(n.value.push(w()),a(h.value.pop()),(s=e.scheduleRender)==null||s.call(e),t.nextTick(()=>{var y;return(y=e.emitModelData)==null?void 0:y.call(e)}))}function X(){var s;n.value.length&&(h.value.push(w()),a(n.value.pop()),(s=e.scheduleRender)==null||s.call(e),t.nextTick(()=>{var y;return(y=e.emitModelData)==null?void 0:y.call(e)}))}const K=t.computed(()=>h.value.length>0),E=t.computed(()=>n.value.length>0),L=t.computed(()=>!!e.selection.value),N=t.ref(null);function _(){var W;const s=e.selection.value;if(!s)return;const y={};for(let z=s.startCol;z<=s.endCol;z++)for(let te=s.startRow;te<=s.endRow;te++)y[`${z-s.startCol},${te-s.startRow}`]=((W=e.cells[e.cellKey(z,te)])==null?void 0:W.style)??null;N.value={styles:y}}function ne(){var W,z,te,oe;const s=N.value,y=e.selection.value;if(!(!s||!y)){O();for(let ee=y.startCol;ee<=y.endCol;ee++)for(let pe=y.startRow;pe<=y.endRow;pe++){const ke=e.findMerge(ee,pe);if(ke&&(ee!==ke.range.startCol||pe!==ke.range.startRow))continue;const $e=s.styles[`${ee-y.startCol},${pe-y.startRow}`]??null,Le=e.cellKey(ee,pe),Ge=((W=e.cells[Le])==null?void 0:W.value)??"";Ge===""&&$e===null?e.delCell(Le):e.cells[Le]={value:Ge,style:$e},(z=e.syncCellBorders)==null||z.call(e,ee,pe)}N.value=null,(te=e.scheduleRender)==null||te.call(e),(oe=e.emitModelData)==null||oe.call(e)}}function C(){var y,W,z,te;const s=e.selection.value;if(s){O();for(let oe=s.startCol;oe<=s.endCol;oe++)for(let ee=s.startRow;ee<=s.endRow;ee++){const pe=e.findMerge(oe,ee);if(pe&&(oe!==pe.range.startCol||ee!==pe.range.startRow))continue;const ke=e.cellKey(oe,ee),$e=((y=e.cells[ke])==null?void 0:y.value)??"";$e===""?e.delCell(ke):e.cells[ke]={value:$e,style:null},(W=e.syncCellBorders)==null||W.call(e,oe,ee)}(z=e.scheduleRender)==null||z.call(e),(te=e.emitModelData)==null||te.call(e)}}const ge=t.computed(()=>Ml.map(s=>({...s,label:s.value===""?G(e.locale.value,"fontDefault"):s.label}))),U=t.computed(()=>Tl.map(s=>({...s,label:String(s.value)}))),j="\0",se=t.computed(()=>{var z;const s=e.selection.value;if(!s)return"";let y,W=!1;for(let te=s.startCol;te<=s.endCol&&!W;te++)for(let oe=s.startRow;oe<=s.endRow&&!W;oe++){const ee=e.findMerge(te,oe);if(ee&&(te!==ee.range.startCol||oe!==ee.range.startRow))continue;const pe=(z=e.cells[e.cellKey(te,oe)])==null?void 0:z.style,ke=typeof(pe==null?void 0:pe.fontFamily)=="string"?pe.fontFamily:"";y===void 0?y=ke:ke!==y&&(W=!0)}return W?j:y??""}),q=t.computed(()=>{const s=e.selection.value;if(!s)return at;let y,W=!1;for(let z=s.startCol;z<=s.endCol&&!W;z++)for(let te=s.startRow;te<=s.endRow&&!W;te++){const oe=e.findMerge(z,te);if(oe&&(z!==oe.range.startCol||te!==oe.range.startRow))continue;const ee=e.cellFontSize(z,te);y===void 0?y=ee:ee!==y&&(W=!0)}return W?0:y??at});function A(s,y){var z,te,oe,ee;const W=e.selection.value;if(W){O();for(let pe=W.startCol;pe<=W.endCol;pe++)for(let ke=W.startRow;ke<=W.endRow;ke++){const $e=e.findMerge(pe,ke);if($e&&(pe!==$e.range.startCol||ke!==$e.range.startRow))continue;const Le=e.cellKey(pe,ke),Ge=((z=e.cells[Le])==null?void 0:z.value)??"",Ve=(te=e.cells[Le])!=null&&te.style?{...e.cells[Le].style}:{};y===""||y===null||y===void 0||y===0?Reflect.deleteProperty(Ve,s):Ve[s]=y;const Ke=Object.keys(Ve).length?Ve:null;Ge===""&&Ke===null?e.delCell(Le):e.cells[Le]={value:Ge,style:Ke}}(oe=e.scheduleRender)==null||oe.call(e),(ee=e.emitModelData)==null||ee.call(e)}}function ye(s){A("fontFamily",s===""?"":s)}const Se=t.ref(!1),we=t.ref(!1),xe=t.ref(!1),Ie=t.ref(!1),ae=t.ref(!1);function m(s){A("fontSize",s),Se.value=!1}const c=t.computed(()=>Ll.map(s=>({label:G(e.locale.value,s.labelKey),value:s.value,icon:s.icon}))),he=t.computed(()=>Fl.map(s=>({label:G(e.locale.value,s.labelKey),value:s.value,icon:s.icon}))),ve=t.computed(()=>{var z;const s=e.selection.value;if(!s)return"left";const y=(z=e.cells[e.cellKey(s.startCol,s.startRow)])==null?void 0:z.style,W=typeof(y==null?void 0:y.textAlign)=="string"?y.textAlign:"";return W==="center"||W==="right"?W:"left"}),Ae=t.computed(()=>{var z;const s=e.selection.value;if(!s)return"top";const y=(z=e.cells[e.cellKey(s.startCol,s.startRow)])==null?void 0:z.style,W=typeof(y==null?void 0:y.verticalAlign)=="string"?y.verticalAlign:"";return W==="middle"||W==="bottom"?W:"top"}),Me=t.computed(()=>{var W;const s=e.selection.value;if(!s)return!1;const y=(W=e.cells[e.cellKey(s.startCol,s.startRow)])==null?void 0:W.style;return(y==null?void 0:y.wrap)==="wrap"});function Te(s){A("textAlign",s)}function i(s){A("verticalAlign",s)}function v(){if(!e.selection.value)return;const y=Me.value;A("wrap",y?void 0:"wrap")}const b=t.ref(""),l=Se;t.watch(q,s=>{b.value=s===0?"":String(s)},{immediate:!0});function r(s){const y=s.replace(/[^\d]/g,"");b.value=y;const W=parseInt(y,10);!isNaN(W)&&W>=5&&W<=72&&W!==q.value&&A("fontSize",W)}function F(){const s=b.value.trim();if(!s){b.value=q.value===0?"":String(q.value);return}let y=parseInt(s,10);isNaN(y)?y=q.value===0?at:q.value:y=Math.max(5,Math.min(72,y)),b.value=String(y),y!==q.value&&A("fontSize",y)}function V(s){s.key==="Enter"&&s.target.blur()}function $(s){s&&s.preventDefault(),l.value=!l.value,l.value&&(xe&&(xe.value=!1),we&&(we.value=!1),Ie.value=!1,ae.value=!1)}function de(){const s=q.value===0?at:q.value,y=Math.min(72,s+1);A("fontSize",y),b.value=String(y),l.value=!1}function Ce(){const s=q.value===0?at:q.value,y=Math.max(5,s-1);A("fontSize",y),b.value=String(y),l.value=!1}function De(s){var te;const y=e.selection.value;if(!y)return!1;let W,z=!1;for(let oe=y.startCol;oe<=y.endCol&&!z;oe++)for(let ee=y.startRow;ee<=y.endRow&&!z;ee++){const pe=e.findMerge(oe,ee);if(pe&&(oe!==pe.range.startCol||ee!==pe.range.startRow))continue;const ke=(te=e.cells[e.cellKey(oe,ee)])==null?void 0:te.style,$e=!!(ke!=null&&ke[s]);W===void 0?W=$e:$e!==W&&(z=!0)}return!z&&W===!0}const k=t.computed(()=>De("fontWeight")),T=t.computed(()=>De("fontStyle")),S=t.computed(()=>De("underline")),J=t.computed(()=>De("strikethrough"));function ue(){A("fontWeight",k.value?"":"bold")}function Y(){A("fontStyle",T.value?"":"italic")}function fe(){A("underline",S.value?"":"underline")}function Re(){A("strikethrough",J.value?"":"line-through")}const He=t.ref(""),lt=t.ref(""),Ue=Ie,qe=ae;function ut(){Ue.value=!Ue.value,qe.value=!1,we&&(we.value=!1),xe&&(xe.value=!1)}function It(){qe.value=!qe.value,Ue.value=!1,we&&(we.value=!1),xe&&(xe.value=!1)}function Xe(s){we&&(we.value=s),s&&(Ue.value=!1,qe.value=!1,xe&&(xe.value=!1))}function B(s){He.value=s,A("color",s===""?"":s)}function R(s){lt.value=s,A("backgroundColor",s===""?"":s)}function x(){A("color",He.value===""?"":He.value)}function Z(){A("backgroundColor",lt.value===""?"":lt.value)}const Q=t.computed(()=>{var z;const s=e.selection.value;if(!s)return"";let y,W=!1;for(let te=s.startCol;te<=s.endCol&&!W;te++)for(let oe=s.startRow;oe<=s.endRow&&!W;oe++){const ee=e.findMerge(te,oe);if(ee&&(te!==ee.range.startCol||oe!==ee.range.startRow))continue;const pe=(z=e.cells[e.cellKey(te,oe)])==null?void 0:z.style,ke=typeof(pe==null?void 0:pe.color)=="string"?pe.color:"";y===void 0?y=ke:ke!==y&&(W=!0)}return W?"":y??""}),ie=t.computed(()=>{var z;const s=e.selection.value;if(!s)return"";let y,W=!1;for(let te=s.startCol;te<=s.endCol&&!W;te++)for(let oe=s.startRow;oe<=s.endRow&&!W;oe++){const ee=e.findMerge(te,oe);if(ee&&(te!==ee.range.startCol||oe!==ee.range.startRow))continue;const pe=(z=e.cells[e.cellKey(te,oe)])==null?void 0:z.style,ke=typeof(pe==null?void 0:pe.backgroundColor)=="string"?pe.backgroundColor:"";y===void 0?y=ke:ke!==y&&(W=!0)}return W?"":y??""});return{undoStack:h,redoStack:n,cloneCells:u,takeSnap:w,restoreSnap:a,saveUndo:O,undo:f,redo:X,canUndo:K,canRedo:E,hasSelection:L,paintFmt:N,onPaintFormat:_,applyPaintFormat:ne,clearFormat:C,fontFamilyOptions:ge,fontSizeOptions:U,FONT_FAMILY_MIXED:j,selFontFamily:se,selFontSize:q,applyStyleToSelection:A,onFontFamilyChange:ye,onFontSizeChange:m,hAlignOptions:c,vAlignOptions:he,selHAlign:ve,selVAlign:Ae,selWrap:Me,onHAlignChange:Te,onVAlignChange:i,onWrapToggle:v,fontSizeInput:b,fontSizeMenuOpen:l,onFontSizeInput:r,onFontSizeBlur:F,onFontSizeKeydown:V,toggleFontSizeMenu:$,onFontSizeStepUp:de,onFontSizeStepDown:Ce,selFontWeight:k,selFontStyle:T,selUnderline:S,selStrikethrough:J,toggleFontWeight:ue,toggleFontStyle:Y,toggleUnderline:fe,toggleStrikethrough:Re,cachedTextColor:He,cachedFillColor:lt,textColorMenuOpen:Ue,fillColorMenuOpen:qe,_toggleTextColorMenu:ut,_toggleFillColorMenu:It,onBorderMenuToggle:Xe,onTextColorChange:B,onFillColorChange:R,applyCachedTextColor:x,applyCachedFillColor:Z,selTextColor:Q,selFillColor:ie}}function Bn(e,g){g.borderMenuOpen&&(e.borderMenuOpen=g.borderMenuOpen),g.mergeMenuOpen&&(e.mergeMenuOpen=g.mergeMenuOpen),(()=>{const n=e.borderMenuOpen,u=e.mergeMenuOpen;e.onBorderMenuToggle=w=>{n&&(n.value=w),w&&(e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1,u&&(u.value=!1))},e.toggleFontSizeMenu=w=>{w&&w.preventDefault(),e.fontSizeMenuOpen.value=!e.fontSizeMenuOpen.value,e.fontSizeMenuOpen.value&&(u&&(u.value=!1),n&&(n.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,n&&(n.value=!1),u&&(u.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,n&&(n.value=!1),u&&(u.value=!1)}})()}function Rn(e,g){const h=t.ref("none"),n=t.ref(!1),u="#444";function w(i,v,b,l){const r=e.findMerge(v,b),F=r?r.range.endCol:v,V=r?r.range.endRow:b,$=r?r.range.startCol:v,Ce=(r?r.range.startRow:b)===l.startRow,De=V===l.endRow,k=$===l.startCol,T=F===l.endCol,S={top:0,bottom:0,left:0,right:0};switch(i){case"none":return S;case"bottom":De&&(S.bottom=1);break;case"top":Ce&&(S.top=1);break;case"left":k&&(S.left=1);break;case"right":T&&(S.right=1);break;case"all":S.top=1,S.bottom=1,S.left=1,S.right=1;break;case"outer":Ce&&(S.top=1),De&&(S.bottom=1),k&&(S.left=1),T&&(S.right=1);break;case"thickOuter":Ce&&(S.top=2),De&&(S.bottom=2),k&&(S.left=2),T&&(S.right=2);break}return S}function a(i,v,b,l,r){var S,J;if(i<0||v<0||i>=e.colCount||v>=e.rowCount)return;const F=e.findMerge(i,v);if(F&&(b==="Top"&&v!==F.range.startRow||b==="Bottom"&&v!==F.range.endRow||b==="Left"&&i!==F.range.startCol||b==="Right"&&i!==F.range.endCol))return;const V=F?F.anchor:e.cellKey(i,v),$=((S=e.cells[V])==null?void 0:S.value)??"",de=(J=e.cells[V])!=null&&J.style?{...e.cells[V].style}:{},Ce=`border${b}Width`;l===0?r&&Reflect.deleteProperty(de,Ce):(de[Ce]=l,de.borderColor=u),["Top","Bottom","Left","Right"].some(ue=>de[`border${ue}Width`]!==void 0)||Reflect.deleteProperty(de,"borderColor");const T=Object.keys(de).length?de:null;$===""&&T===null?e.delCell(V):e.cells[V]={value:$,style:T}}function O(i,v){var Ce;const b=e.findMerge(i,v),l=b?b.anchor:e.cellKey(i,v),r=(Ce=e.cells[l])==null?void 0:Ce.style,F=(r==null?void 0:r.borderTopWidth)||0,V=(r==null?void 0:r.borderBottomWidth)||0,$=(r==null?void 0:r.borderLeftWidth)||0,de=(r==null?void 0:r.borderRightWidth)||0;a(i,v-1,"Bottom",F,!0),a(i,v+1,"Top",V,!0),a(i-1,v,"Right",$,!0),a(i+1,v,"Left",de,!0)}e.syncCellBorders=O;function f(i,v,b,l=!0){var k,T;const r=e.cellKey(i,v),F=((k=e.cells[r])==null?void 0:k.value)??"",V=(T=e.cells[r])!=null&&T.style?{...e.cells[r].style}:{},$=["Top","Bottom","Left","Right"],de=[b.top,b.bottom,b.left,b.right];for(let S=0;S<4;S++){const J=`border${$[S]}Width`;de[S]===0?l&&Reflect.deleteProperty(V,J):(V[J]=de[S],V.borderColor=u)}$.some(S=>V[`border${S}Width`]!==void 0)||Reflect.deleteProperty(V,"borderColor");const De=Object.keys(V).length?V:null;F===""&&De===null?e.delCell(r):e.cells[r]={value:F,style:De},O(i,v)}function X(i){var b,l;h.value=i;const v=e.selection.value;if(v){if(g.saveUndo(),i==="none")for(let r=v.startCol;r<=v.endCol;r++)for(let F=v.startRow;F<=v.endRow;F++){const V=e.findMerge(r,F);V&&(r!==V.range.startCol||F!==V.range.startRow)||f(r,F,{top:0,bottom:0,left:0,right:0},!0)}else for(let r=v.startCol;r<=v.endCol;r++)for(let F=v.startRow;F<=v.endRow;F++){const V=e.findMerge(r,F);if(V&&(r!==V.range.startCol||F!==V.range.startRow))continue;const $=w(i,r,F,v);f(r,F,$,!1)}(b=e.scheduleRender)==null||b.call(e),(l=e.emitModelData)==null||l.call(e)}}function K(){X(h.value)}function E(i,v,b){var F,V;const l=e.findMerge(i,v);if(l){const $=(F=e.cells[l.anchor])==null?void 0:F.style;return b==="Top"&&v===l.range.startRow?($==null?void 0:$.borderTopWidth)||0:b==="Bottom"&&v===l.range.endRow?($==null?void 0:$.borderBottomWidth)||0:b==="Left"&&i===l.range.startCol?($==null?void 0:$.borderLeftWidth)||0:b==="Right"&&i===l.range.endCol&&($==null?void 0:$.borderRightWidth)||0}const r=(V=e.cells[e.cellKey(i,v)])==null?void 0:V.style;return(r==null?void 0:r[`border${b}Width`])||0}const L=t.ref(!1);function N(i){L.value=i,i&&(g.textColorMenuOpen.value=!1,g.fillColorMenuOpen.value=!1,n.value=!1,g.fontSizeMenuOpen.value=!1)}function _(i,v,b,l){const r=[];for(const F in e.merges){const V=e.merges[F];V&&V.startCol<=b&&V.endCol>=i&&V.startRow<=l&&V.endRow>=v&&r.push(F)}for(const F of r)Reflect.deleteProperty(e.merges,F)}function ne(){var r,F,V,$;const i=e.selection.value;if(!i||i.startCol===i.endCol&&i.startRow===i.endRow)return;g.saveUndo(),_(i.startCol,i.startRow,i.endCol,i.endRow);const v=e.cellKey(i.startCol,i.startRow),b=((r=e.cells[v])==null?void 0:r.value)??"";for(let de=i.startCol;de<=i.endCol;de++)for(let Ce=i.startRow;Ce<=i.endRow;Ce++)de===i.startCol&&Ce===i.startRow||e.clearCellsInRange(de,de,Ce,Ce);const l=(F=e.cells[v])!=null&&F.style?{...e.cells[v].style}:{};l.textAlign="center",e.cells[v]={value:b,style:l},e.merges[v]={startCol:i.startCol,startRow:i.startRow,endCol:i.endCol,endRow:i.endRow},e.selectCell(i.startCol,i.startRow),(V=e.scheduleRender)==null||V.call(e),($=e.emitModelData)==null||$.call(e)}function C(){var v,b,l;const i=e.selection.value;if(!(!i||i.startCol===i.endCol)){g.saveUndo();for(let r=i.startRow;r<=i.endRow;r++){_(i.startCol,r,i.endCol,r);const F=e.cellKey(i.startCol,r);(v=e.cells[F])==null||v.value;for(let V=i.startCol+1;V<=i.endCol;V++)e.clearCellsInRange(V,V,r,r);e.merges[F]={startCol:i.startCol,startRow:r,endCol:i.endCol,endRow:r}}e.selectRange(i.startCol,i.startRow,i.endCol,i.endRow),(b=e.scheduleRender)==null||b.call(e),(l=e.emitModelData)==null||l.call(e)}}function ge(){var b,l,r;const i=e.selection.value;if(!i||i.startCol===i.endCol&&i.startRow===i.endRow)return;g.saveUndo(),_(i.startCol,i.startRow,i.endCol,i.endRow);const v=e.cellKey(i.startCol,i.startRow);(b=e.cells[v])==null||b.value;for(let F=i.startCol;F<=i.endCol;F++)for(let V=i.startRow;V<=i.endRow;V++)F===i.startCol&&V===i.startRow||e.clearCellsInRange(F,F,V,V);e.merges[v]={startCol:i.startCol,startRow:i.startRow,endCol:i.endCol,endRow:i.endRow},e.selectCell(i.startCol,i.startRow),(l=e.scheduleRender)==null||l.call(e),(r=e.emitModelData)==null||r.call(e)}function U(){var v,b;const i=e.selection.value;i&&(g.saveUndo(),_(i.startCol,i.startRow,i.endCol,i.endRow),(v=e.scheduleRender)==null||v.call(e),(b=e.emitModelData)==null||b.call(e))}function j(){const i=e.selection.value;if(!i)return;const v=e.findMerge(i.startCol,i.startRow);v&&i.startCol===v.range.startCol&&i.startRow===v.range.startRow&&i.endCol===v.range.endCol&&i.endRow===v.range.endRow?U():ne()}function se(i){switch(i){case"mergeCenter":ne();break;case"mergeAcross":C();break;case"mergeCells":ge();break;case"unmergeCells":U();break}}let q=null,A=[];function ye(i,v,b,l){var r;A=[];for(let F=b;F<=l;F++){const V=[];for(let $=i;$<=v;$++){const de=(r=e.cells[e.cellKey($,F)])==null?void 0:r.style;V.push(de?{...de}:null)}A.push(V)}}function Se(i,v,b,l){const r=e.cellKey(i,v);if(ll(),b===""||b==null){e.formulaDeps.clear(r),l?e.cells[r]={value:"",style:{...l}}:e.delCell(r),e.formulaDeps.markDirty(r);return}e.cells[r]={value:b,style:l?{...l}:null},b.startsWith("=")?e.formulaDeps.set(r,ol(b.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(r),e.formulaDeps.markDirty(r)}function we(){const i=e.selection.value;if(!i)return;q={...i},ye(i.startCol,i.endCol,i.startRow,i.endRow);const v=[];for(let b=i.startRow;b<=i.endRow;b++){const l=[];for(let r=i.startCol;r<=i.endCol;r++)l.push(e.getCellRaw(r,b));v.push(l.join(" "))}tl(v.join(`
|
|
5
|
+
`))}function xe(){const i=e.selection.value;if(i){if(i.startCol===0&&i.endCol===e.colCount-1){q={...i},ye(0,e.colCount-1,i.startRow,i.endRow);const v=[];for(let b=i.startRow;b<=i.endRow;b++){const l=[];for(let r=0;r<e.colCount;r++)l.push(e.getCellRaw(r,b));v.push(l.join(" "))}tl(v.join(`
|
|
6
|
+
`))}else if(i.startRow===0&&i.endRow===e.rowCount-1){q={...i},ye(i.startCol,i.endCol,0,e.rowCount-1);const v=[];for(let b=0;b<e.rowCount;b++){const l=[];for(let r=i.startCol;r<=i.endCol;r++)l.push(e.getCellRaw(r,b));v.push(l.join(" "))}tl(v.join(`
|
|
7
|
+
`))}}}async function Ie(){var F;let i;try{i=await navigator.clipboard.readText()}catch{return}if(!i&&i!=="")return;const v=i.split(/\r?\n/),b=e.activeCell.value,l=q,r=l&&A.length>0;for(let V=0;V<v.length;V++){const $=v[V].split(" ");for(let de=0;de<$.length;de++){const Ce=b.col+de,De=b.row+V;if(Ce<e.colCount&&De<e.rowCount){let k=$[de];if(k.startsWith("=")&&l&&(k=yn(k,Ce-(l.startCol+de),De-(l.startRow+V),e.colCount,e.rowCount,ze)),r&&V<A.length&&de<(((F=A[V])==null?void 0:F.length)??0)){const T=A[V][de]??null;Se(Ce,De,k,T),O(Ce,De)}else e.setCellValue(Ce,De,k)}}}}function ae(){var i;if(we(),e.selection.value){const v=e.selection.value;e.clearCellsInRange(v.startCol,v.endCol,v.startRow,v.endRow),(i=e.scheduleRender)==null||i.call(e)}}function m(){var i;if(e.selection.value){const v=e.selection.value;e.clearCellsInRange(v.startCol,v.endCol,v.startRow,v.endRow),(i=e.scheduleRender)==null||i.call(e)}}function c(){var F,V;const i=e.selection.value;if(!i)return;g.saveUndo();const v=i.startCol,b=i.startRow,l=i.endCol,r=i.endRow;if(b===r)if(l+1<e.colCount){const $=`${ze(v)}${b+1}:${ze(l)}${b+1}`;e.setCellValue(l+1,b,`=SUM(${$})`)}else{const $=`${ze(v)}${b+1}:${ze(l-1)}${b+1}`;e.setCellValue(l,b,`=SUM(${$})`)}else for(let $=v;$<=l;$++)if(r+1<e.rowCount){const de=`${ze($)}${b+1}:${ze($)}${r+1}`;e.setCellValue($,r+1,`=SUM(${de})`)}else{const de=`${ze($)}${b+1}:${ze($)}${r}`;e.setCellValue($,r,`=SUM(${de})`)}(F=e.scheduleRender)==null||F.call(e),(V=e.emitModelData)==null||V.call(e)}function he(){var F,V;const i=e.selection.value;if(!i)return;g.saveUndo();const v=i.startCol,b=i.startRow,l=i.endCol,r=i.endRow;if(b===r)if(l+1<e.colCount){const $=`${ze(v)}${b+1}:${ze(l)}${b+1}`;e.setCellValue(l+1,b,`=AVERAGE(${$})`)}else{const $=`${ze(v)}${b+1}:${ze(l-1)}${b+1}`;e.setCellValue(l,b,`=AVERAGE(${$})`)}else for(let $=v;$<=l;$++)if(r+1<e.rowCount){const de=`${ze($)}${b+1}:${ze($)}${r+1}`;e.setCellValue($,r+1,`=AVERAGE(${de})`)}else{const de=`${ze($)}${b+1}:${ze($)}${r}`;e.setCellValue($,r,`=AVERAGE(${de})`)}(F=e.scheduleRender)==null||F.call(e),(V=e.emitModelData)==null||V.call(e)}const ve=t.ref(!1);function Ae(i){ve.value=i,i&&(g.textColorMenuOpen.value=!1,g.fillColorMenuOpen.value=!1,n.value=!1,g.fontSizeMenuOpen.value=!1,L.value=!1)}function Me(){c(),ve.value=!1}function Te(){he(),ve.value=!1}return{cachedBorder:h,borderMenuOpen:n,BORDER_COLOR:u,borderTypeToWidths:w,onBorderChange:X,setCellBorderSide:a,syncCellBorders:O,applyBorderToCell:f,applyCachedBorder:K,cellBorderWidth:E,mergeMenuOpen:L,onMergeMenuToggle:N,removeOverlappingMerges:_,mergeAndCenter:ne,mergeAcross:C,mergeCells:ge,unmergeCells:U,onApplyMerge:j,onMergeChange:se,copySourceRange:null,copySourceStyles:[],captureStyles:ye,setCellWithStyle:Se,copyToClipboard:we,copyRowCol:xe,pasteFromClipboard:Ie,cutSelected:ae,clearSelected:m,sumSelected:c,avgSelected:he,calcMenuOpen:ve,onCalcMenuToggle:Ae,onCalcSum:Me,onCalcAvg:Te}}function Sn(e,g,h,n){const u={},w=n(g),a=n(h);return w!=null&&(u.width=`${w}px`),a!=null&&(u.height=`${a}px`),u["--sp-formula-bar-bg"]=e.formulaBarBg,u["--sp-formula-bar-border"]=e.formulaBarBorder,u["--sp-formula-bar-label-color"]=e.formulaBarLabelText,u["--sp-formula-bar-label-bg"]=e.formulaBarLabelBg,u["--sp-formula-bar-label-border"]=e.formulaBarLabelBorder,u["--sp-formula-bar-input-bg"]=e.formulaBarInputBg,u["--sp-formula-bar-input-border"]=e.formulaBarInputBorder,u["--sp-formula-bar-input-color"]=e.formulaBarInputText,u["--sp-formula-bar-input-focus-border"]=e.formulaBarInputFocusBorder,u["--sp-formula-bar-input-focus-shadow"]=e.formulaBarInputFocusShadow,u["--sp-wrapper-bg"]=e.wrapperBg,u["--sp-cell-editor-border"]=e.cellEditorBorder,u["--sp-cell-editor-color"]=e.cellEditorText,u["--sp-cell-editor-bg"]=e.cellEditorBg,u["--sp-cell-editor-shadow"]=e.cellEditorShadow,u["--sp-tab-bar-bg"]=e.tabBarBg,u["--sp-tab-bar-border"]=e.tabBarBorder,u["--sp-tab-active-bg"]=e.tabActiveBg,u["--sp-tab-active-color"]=e.tabActiveText,u["--sp-tab-active-border"]=e.tabActiveBorder,u["--sp-tab-inactive-bg"]=e.tabInactiveBg,u["--sp-tab-inactive-color"]=e.tabInactiveText,u["--sp-tab-inactive-border"]=e.tabInactiveBorder,u["--sp-tab-hover-bg"]=e.tabHoverBg,u["--sp-tab-add-btn-color"]=e.tabAddBtnColor,u["--sp-tab-add-btn-hover-bg"]=e.tabAddBtnHoverBg,u["--sp-tab-scroll-btn-color"]=e.tabScrollBtnColor,u["--sp-tab-scroll-btn-hover-bg"]=e.tabScrollBtnHoverBg,u["--sp-scroll-thumb"]=e.scrollbarThumb,u["--sp-scroll-thumb-hover"]=e.scrollbarThumbHover,u["--sp-scroll-btn-bg"]=e.scrollBtnBg,u["--sp-scroll-btn-color"]=e.scrollBtnColor,u["--sp-scroll-btn-hover-bg"]=e.scrollBtnHoverBg,u["--sp-scroll-btn-active-bg"]=e.scrollBtnActiveBg,u["--sp-scroll-track-bg"]=e.scrollTrackBg,u["--sp-toolbar-bg"]=e.toolbarBg,u["--sp-toolbar-border"]=e.toolbarBorder,u["--sp-toolbar-btn-color"]=e.toolbarBtnColor,u["--sp-toolbar-btn-hover-bg"]=e.toolbarBtnHoverBg,u["--sp-toolbar-btn-disabled-color"]=e.toolbarBtnDisabledColor,u["--sp-toolbar-btn-active-color"]=e.toolbarBtnActiveColor,u}function xn(e,g,h,n,u){function w(k,T){var J,ue;const S=T-k+1;for(let Y=k;Y<=T;Y++)for(let fe=0;fe<e.colCount;fe++)e.delCell(e.cellKey(fe,Y));for(let Y=k;Y<e.rowCount-S;Y++){for(let fe=0;fe<e.colCount;fe++){const Re=e.cellKey(fe,Y+S),He=e.cellKey(fe,Y);e.cells[Re]?(e.cells[He]=e.cells[Re],e.delCell(Re)):e.delCell(He)}e.rowHeights.value[Y]=e.rowHeights.value[Y+S]}for(let Y=e.rowCount-S;Y<e.rowCount;Y++){for(let fe=0;fe<e.colCount;fe++)e.delCell(e.cellKey(fe,Y));e.rowHeights.value[Y]=void 0}if(k>0)for(let Y=0;Y<e.colCount;Y++)(J=e.syncCellBorders)==null||J.call(e,Y,k-1),(ue=e.syncCellBorders)==null||ue.call(e,Y,k)}function a(k,T){const S=T-k+1;if(!(T>=e.rowCount-1)){for(let J=e.rowCount-1;J>T;J--){for(let ue=0;ue<e.colCount;ue++){const Y=e.cellKey(ue,J-S),fe=e.cellKey(ue,J);e.cells[Y]?e.cells[fe]=e.cells[Y]:e.delCell(fe)}e.rowHeights.value[J]=e.rowHeights.value[J-S]}for(let J=T+1;J<=T+S;J++){for(let ue=0;ue<e.colCount;ue++)e.delCell(e.cellKey(ue,J));e.rowHeights.value[J]=void 0}}}function O(k,T){const S=T-k+1;if(!(T>=e.colCount-1)){for(let J=e.colCount-1;J>T;J--){for(let ue=0;ue<e.rowCount;ue++){const Y=e.cellKey(J-S,ue),fe=e.cellKey(J,ue);e.cells[Y]?e.cells[fe]=e.cells[Y]:e.delCell(fe)}e.colWidths.value[J]=e.colWidths.value[J-S]}for(let J=T+1;J<=T+S;J++){for(let ue=0;ue<e.rowCount;ue++)e.delCell(e.cellKey(J,ue));e.colWidths.value[J]=100}}}function f(k,T){var J,ue;const S=T-k+1;for(let Y=k;Y<=T;Y++)for(let fe=0;fe<e.rowCount;fe++)e.delCell(e.cellKey(Y,fe));for(let Y=k;Y<e.colCount-S;Y++){for(let fe=0;fe<e.rowCount;fe++){const Re=e.cellKey(Y+S,fe),He=e.cellKey(Y,fe);e.cells[Re]?(e.cells[He]=e.cells[Re],e.delCell(Re)):e.delCell(He)}e.colWidths.value[Y]=e.colWidths.value[Y+S]}for(let Y=e.colCount-S;Y<e.colCount;Y++){for(let fe=0;fe<e.rowCount;fe++)e.delCell(e.cellKey(Y,fe));e.colWidths.value[Y]=100}if(k>0)for(let Y=0;Y<e.rowCount;Y++)(J=e.syncCellBorders)==null||J.call(e,k-1,Y),(ue=e.syncCellBorders)==null||ue.call(e,k,Y)}let X=0;function K(){return X++,`s_${X}`}function E(k){return{id:K(),name:k,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 L=t.ref([E("Sheet1")]),N=t.ref(0);function _(){const k=L.value[N.value];k&&(k.cells={...e.cells},k.merges={...e.merges},k.selection=e.selection.value?{...e.selection.value}:null,k.activeCell={...e.activeCell.value},k.scrollX=e.scrollX.value,k.scrollY=e.scrollY.value,k.colWidths=[...e.colWidths.value],k.rowHeights=[...e.rowHeights.value])}function ne(k){const T=L.value[k];T&&(Object.keys(e.cells).forEach(S=>e.delCell(S)),Object.assign(e.cells,T.cells),Object.keys(e.merges).forEach(S=>Reflect.deleteProperty(e.merges,S)),T.merges&&Object.assign(e.merges,T.merges),e.selection.value=T.selection?{...T.selection}:null,e.activeCell.value={...T.activeCell},e.scrollX.value=T.scrollX,e.scrollY.value=T.scrollY,e.colWidths.value=[...T.colWidths],e.rowHeights.value=[...T.rowHeights],N.value=k)}function C(k){k===N.value||k<0||k>=L.value.length||(e.cancelEdit(),_(),ne(k))}function ge(k){return g.saveUndo(),e.cancelEdit(),_(),L.value.push(E(k??`Sheet${L.value.length+1}`)),ne(L.value.length-1),L.value.length-1}function U(k){return L.value.length<=1||(g.saveUndo(),e.cancelEdit(),L.value.splice(k,1),ne(Math.min(k,L.value.length-1))),N.value}function j(k,T){L.value[k]&&T.trim()&&(g.saveUndo(),L.value[k].name=T.trim())}function se(k){g.saveUndo(),e.cancelEdit(),_();const T=L.value[k];if(!T)return k;let S=T.name;const J=S.match(/^(.*?)\s*\((\d+)\)$/);let ue=J?parseInt(J[2],10)+1:2;J&&(S=J[1]);let Y=`${S} (${ue})`;const fe=new Set(L.value.map(He=>He.name));for(;fe.has(Y);)ue++,Y=`${S} (${ue})`;const Re={id:K(),name:Y,cells:{...T.cells},merges:T.merges?{...T.merges}:{},selection:T.selection?{...T.selection}:null,activeCell:T.activeCell?{...T.activeCell}:{col:0,row:0},scrollX:T.scrollX,scrollY:T.scrollY,colWidths:[...T.colWidths],rowHeights:[...T.rowHeights]};return L.value.splice(k+1,0,Re),ne(k+1),k+1}function q(k,T){var Y;const S=k+T;if(S<0||S>=L.value.length)return;g.saveUndo();const J=N.value,ue=L.value.splice(k,1)[0];L.value.splice(S,0,ue),J===k?N.value=S:k<J&&S>=J?N.value=J-1:k>J&&S<=J&&(N.value=J+1),(Y=e.scheduleRender)==null||Y.call(e)}const A=t.computed(()=>L.value.length);let ye="";const Se=h;function we(){_();const k=L.value.map(S=>{const J={};for(const[Re,He]of Object.entries(S.cells))J[Re]={value:He.value},He.style&&(J[Re].style=He.style);const ue={name:S.name,cells:J};S.merges&&Object.keys(S.merges).length&&(ue.merges={...S.merges});const Y={};for(let Re=0;Re<S.colWidths.length;Re++)S.colWidths[Re]!==100&&(Y[Re]=S.colWidths[Re]);Object.keys(Y).length&&(ue.colWidths=Y);const fe={};for(let Re=0;Re<S.rowHeights.length;Re++){const He=S.rowHeights[Re];He!=null&&(fe[Re]=He)}return Object.keys(fe).length&&(ue.rowHeights=fe),ue}),T=JSON.stringify(k);T!==ye&&(ye=T,Se.value=k,u&&(u.value=T))}e.emitModelData=we;let xe=!1;function Ie(){xe||(xe=!0,Promise.resolve().then(()=>{xe=!1,we()}))}const ae=t.computed(()=>e.props.theme==="dark"?Wl:Vl),m=t.computed(()=>Sn(ae.value,e.props.width,e.props.height,gt)),c=t.computed(()=>{const k={};for(const[T,S]of Object.entries(m.value))T.startsWith("--")&&(k[T]=S);return k}),he=t.ref(null),ve=t.ref(null),Ae=t.ref(null),Me=t.ref(null),Te=t.reactive({w:800,h:600});e.viewSize&&t.watch(Te,k=>{e.viewSize&&(e.viewSize.w=k.w,e.viewSize.h=k.h)},{deep:!0});const i=48,v=28,b=11,l=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,Te.w-i-b))),r=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,Te.h-v-b)));function F(k,T){const S=Math.max(0,Te.w-i-b),J=Math.max(0,Te.h-v-b);e.scrollX.value=Math.max(0,Math.min(k??e.scrollX.value,Math.max(0,e.totalWidth.value-S))),e.scrollY.value=Math.max(0,Math.min(T??e.scrollY.value,Math.max(0,e.totalHeight.value-J)))}e.clampScroll=F;function V(){var k;return typeof window>"u"?!1:!((k=window.matchMedia)!=null&&k.call(window,"(hover: none) and (pointer: coarse)").matches)}function $(k=!1){t.nextTick(()=>{const T=Ae.value;if(T){if(!e.editingCell.value&&!V()){document.activeElement===T&&T.blur();return}T.focus({preventScroll:!0}),k&&T.select()}})}function de(){$()}function Ce(){var T;const k=e.selection.value;if(k){g.saveUndo();for(let S=k.startRow;S<=k.endRow;S++)e.rowHeights.value[S]=void 0;(T=e.scheduleRender)==null||T.call(e),we()}}function De(){var T;const k=e.selection.value;if(k){g.saveUndo();for(let S=k.startCol;S<=k.endCol;S++)e.colWidths.value[S]=100;(T=e.scheduleRender)==null||T.call(e),we()}}return{deleteRows:w,insertRows:a,insertCols:O,deleteCols:f,sheets:L,activeSheetIndex:N,saveSheet:_,loadSheet:ne,switchSheet:C,addSheet:ge,removeSheet:U,renameSheet:j,dupSheet:se,moveSheet:q,sheetCount:A,mkSheet:E,emitModelData:we,scheduleOptEmit:Ie,themeColors:ae,outerStyle:m,toolbarThemeVars:c,wrapperRef:he,canvasRef:ve,editInputRef:Ae,formulaBarRef:Me,viewSize:Te,maxScrollX:l,maxScrollY:r,clampScroll:F,canFocusHiddenEditor:V,focusEditInput:$,onCanvasFocus:de,resetRowHeight:Ce,resetColWidth:De,modelData:Se}}function Mn(e,g,h,n,u){let w=!1,a=null,O=1;function f(){w||(w=!0,requestAnimationFrame(()=>{w=!1,K()}))}e.scheduleRender=f;const X="#444";function K(){var zt,ct,pt,$t,Cl,bl,yl,wl,kl,El,Bl;const o=n.canvasRef.value;if(!o)return;const d=n.wrapperRef.value;if(!d||(a=o.getContext("2d"),!a))return;O=window.devicePixelRatio||1;const M=d.getBoundingClientRect(),D=M.width,p=M.height;n.viewSize.w=D,n.viewSize.h=p,o.width=D*O,o.height=p*O,o.style.width=D+"px",o.style.height=p+"px",a.setTransform(O,0,0,O,0,0);const H=e.scrollX.value,le=e.scrollY.value,re=52,ce=24,Ee=n.themeColors.value,je=e.colPositions.value,Pe=e.rowPositions.value,xt=e.colWidths.value,Ct=[];for(let I=0;I<e.rowCount;I++)Ct[I]=Pe[I+1]-Pe[I];const it=Math.max(0,e.hitCol(H));let bt=it;for(let I=it;I<e.colCount&&!(re+je[I]-H>=D);I++)bt=I;const yt=bt,et=Math.max(0,e.hitRow(le));let jt=et;for(let I=et;I<e.rowCount&&!(ce+Pe[I]-le>=p);I++)jt=I;const wt=jt;let kt=it,Et=et;for(const I in e.merges){const P=e.merges[I];P&&(P.startRow>wt||P.endRow<et||P.startCol>yt||P.endCol<it||(P.startCol<kt&&(kt=P.startCol),P.startRow<Et&&(Et=P.startRow)))}a.fillStyle=Ee.bg,a.fillRect(0,0,D,p),a.fillStyle=Ee.gridBg,a.fillRect(re,ce,D-re,p-ce),a.save(),a.beginPath(),a.rect(re,ce,D-re,p-ce),a.clip();const Ze=e.selection.value,mt=e.editingCell.value;for(let I=Et;I<=wt;I++)for(let P=kt;P<=yt;P++){const Be=e.findMerge(P,I);if(Be&&!(P===Be.range.startCol&&I===Be.range.startRow))continue;const Ne=re+je[P]-H,Oe=ce+Pe[I]-le;let Fe=xt[P],We=Ct[I];if(Be&&(Fe=je[Be.range.endCol+1]-je[P],We=Pe[Be.range.endRow+1]-Pe[I]),Ne+Fe<re||Oe+We<ce||Ne>D||Oe>p)continue;const _e=(zt=e.cells[e.cellKey(P,I)])==null?void 0:zt.style,Mt=typeof(_e==null?void 0:_e.backgroundColor)=="string"?_e.backgroundColor:"";if(Mt&&(a.fillStyle=Mt,a.fillRect(Ne,Oe,Fe,We)),e.isSelected(P,I)&&(a.fillStyle=Ee.selectionBg,a.fillRect(Ne,Oe,Fe,We)),e.activeCell.value.col===P&&e.activeCell.value.row===I&&(a.strokeStyle=Ee.activeCellBorder,a.lineWidth=2,a.strokeRect(Ne+1,Oe+1,Fe-2,We-2)),a.strokeStyle=Ee.gridLine,a.lineWidth=.5,a.strokeRect(Ne+.25,Oe+.25,Fe-.5,We-.5),!(mt&&mt.col===P&&mt.row===I)){const Tt=e.getCellValue(P,I);if(Tt){const be=(ct=e.cells[e.cellKey(P,I)])==null?void 0:ct.style,Ye=e.cellFontSize(P,I),Qe=typeof(be==null?void 0:be.fontFamily)=="string"&&be.fontFamily?be.fontFamily:Kt,nt=(be==null?void 0:be.fontWeight)==="bold"?"bold":"normal",tt=(be==null?void 0:be.fontStyle)==="italic"?"italic":"normal",Dt=(be==null?void 0:be.underline)==="underline",er=(be==null?void 0:be.strikethrough)==="line-through",cl=typeof(be==null?void 0:be.color)=="string"?be.color:"",Rl=typeof(be==null?void 0:be.textAlign)=="string"?be.textAlign:"left",Sl=typeof(be==null?void 0:be.verticalAlign)=="string"?be.verticalAlign:"top";a.fillStyle=cl||Ee.cellText,a.font=`${tt} ${nt} ${Ye}px ${Qe}`,a.textBaseline="alphabetic",a.save(),a.beginPath(),a.rect(Ne+5,Oe+1,Fe-10,We-2),a.clip();const tr=(be==null?void 0:be.wrap)==="wrap",_t=e.getWrappedLines(a,Tt,Fe-10,tr);let Ht=0,Bt=0;for(const At of _t){const Gt=a.measureText(At),Nt=Gt.actualBoundingBoxAscent,Ot=Gt.actualBoundingBoxDescent,rt=Nt||Ye*.8,Jt=Ot||Ye*.2;Ht=Math.max(Ht,rt),Bt=Math.max(Bt,Jt)}Ht=Math.max(Ht,Ye*.5),Bt=Math.max(Bt,Ye*.15);const Zt=Ye,lr=_t.length*Zt;let qt;Sl==="middle"?qt=Oe+(We-lr)/2+Ht:Sl==="bottom"?qt=Oe+We-e.BASE_CELL_VPAD-Bt-(_t.length-1)*Zt:qt=Oe+e.BASE_CELL_VPAD+Ht;for(let At=0;At<_t.length;At++){const Gt=_t[At],Nt=qt+At*Zt,Ot=a.measureText(Gt);let rt;if(Rl==="center"?rt=Ne+Fe/2-Ot.width/2:Rl==="right"?rt=Ne+Fe-5-Ot.width:rt=Ne+5,a.fillText(Gt,rt,Nt),Dt&&(a.strokeStyle=cl||Ee.cellText,a.lineWidth=1,a.beginPath(),a.moveTo(rt,Nt+Bt+1),a.lineTo(rt+Ot.width,Nt+Bt+1),a.stroke()),er){a.strokeStyle=cl||Ee.cellText,a.lineWidth=1;const Jt=Nt-Zt*.25;a.beginPath(),a.moveTo(rt,Jt),a.lineTo(rt+Ot.width,Jt),a.stroke()}}a.restore()}}}for(let I=Et;I<=wt;I++)for(let P=kt;P<=yt;P++){const Be=e.findMerge(P,I);if(Be&&!(P===Be.range.startCol&&I===Be.range.startRow))continue;const Ne=re+je[P]-H,Oe=ce+Pe[I]-le;let Fe=xt[P],We=Ct[I];if(Be&&(Fe=je[Be.range.endCol+1]-je[P],We=Pe[Be.range.endRow+1]-Pe[I]),Ne+Fe<re||Oe+We<ce||Ne>D||Oe>p)continue;const _e=(pt=e.cells[e.cellKey(P,I)])==null?void 0:pt.style,Mt=(_e==null?void 0:_e.borderTopWidth)||0,Tt=(_e==null?void 0:_e.borderLeftWidth)||0,be=(_e==null?void 0:_e.borderBottomWidth)||0,Ye=(_e==null?void 0:_e.borderRightWidth)||0,Qe=Math.max(Mt,h.cellBorderWidth(P,I-1,"Bottom")),nt=Math.max(Tt,h.cellBorderWidth(P-1,I,"Right")),tt=Math.max(be,h.cellBorderWidth(P,I+1,"Top")),Dt=Math.max(Ye,h.cellBorderWidth(P+1,I,"Left"));(Qe>0||nt>0||tt>0||Dt>0)&&(a.fillStyle=X,Qe>0&&a.fillRect(Ne,Oe,Fe,Qe),tt>0&&a.fillRect(Ne,Oe+We-tt,Fe,tt),nt>0&&a.fillRect(Ne,Oe,nt,We),Dt>0&&a.fillRect(Ne+Fe-Dt,Oe,Dt,We))}for(let I=Et;I<=wt;I++)for(let P=kt;P<=yt;P++){const Be=e.findMerge(P,I);if(Be&&!(P===Be.range.startCol&&I===Be.range.startRow))continue;const Ne=re+je[P]-H,Oe=ce+Pe[I]-le;let Fe=xt[P],We=Ct[I];if(Be&&(Fe=je[Be.range.endCol+1]-je[P],We=Pe[Be.range.endRow+1]-Pe[I]),Ne+Fe<re||Oe+We<ce||Ne>D||Oe>p)continue;const _e=((Cl=($t=e.cells[e.cellKey(P,I)])==null?void 0:$t.style)==null?void 0:Cl.borderTopWidth)||0,Mt=((yl=(bl=e.cells[e.cellKey(P,I)])==null?void 0:bl.style)==null?void 0:yl.borderLeftWidth)||0,Tt=((kl=(wl=e.cells[e.cellKey(P,I)])==null?void 0:wl.style)==null?void 0:kl.borderBottomWidth)||0,be=((Bl=(El=e.cells[e.cellKey(P,I)])==null?void 0:El.style)==null?void 0:Bl.borderRightWidth)||0,Ye=Math.max(_e,h.cellBorderWidth(P,I-1,"Bottom")),Qe=Math.max(Mt,h.cellBorderWidth(P-1,I,"Right")),nt=Math.max(Tt,h.cellBorderWidth(P,I+1,"Top")),tt=Math.max(be,h.cellBorderWidth(P+1,I,"Left"));a.fillStyle=X,Ye>0&&Qe>0&&a.fillRect(Ne-Qe,Oe-Ye,Qe,Ye),Ye>0&&tt>0&&a.fillRect(Ne+Fe,Oe-Ye,tt,Ye),nt>0&&Qe>0&&a.fillRect(Ne-Qe,Oe+We,Qe,nt),nt>0&&tt>0&&a.fillRect(Ne+Fe,Oe+We,tt,nt)}a.restore(),a.fillStyle=Ee.headerBg,a.fillRect(re,0,D-re,ce);for(let I=it;I<=yt;I++){const P=re+je[I]-H,Be=xt[I];P+Be<re||P>D||(Ze&&I>=Ze.startCol&&I<=Ze.endCol&&(a.fillStyle=Ee.selectionBg,a.fillRect(P,0,Be,ce)),a.strokeStyle=Ee.headerBorder,a.lineWidth=.5,a.strokeRect(P+.25,.25,Be-.5,ce-.5),Ze&&I>=Ze.startCol&&I<=Ze.endCol&&(a.strokeStyle=Ee.activeCellBorder,a.lineWidth=2,a.beginPath(),a.moveTo(P,ce-1),a.lineTo(P+Be,ce-1),a.stroke()),a.fillStyle=Ee.headerText,a.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',a.textAlign="center",a.textBaseline="middle",a.fillText(ze(I),P+Be/2,ce/2))}a.strokeStyle=Ee.headerSep,a.lineWidth=1,a.beginPath(),a.moveTo(re,ce+.5),a.lineTo(D,ce+.5),a.stroke(),a.fillStyle=Ee.headerBg,a.fillRect(0,ce,re,p-ce);for(let I=et;I<=wt;I++){const P=ce+Pe[I]-le,Be=Ct[I];P+Be<ce||P>p||(Ze&&I>=Ze.startRow&&I<=Ze.endRow&&(a.fillStyle=Ee.selectionBg,a.fillRect(0,P,re,Be)),a.strokeStyle=Ee.headerBorder,a.lineWidth=.5,a.strokeRect(.25,P+.25,re-.5,Be-.5),Ze&&I>=Ze.startRow&&I<=Ze.endRow&&(a.strokeStyle=Ee.activeCellBorder,a.lineWidth=2,a.beginPath(),a.moveTo(re-1,P),a.lineTo(re-1,P+Be),a.stroke()),a.fillStyle=Ee.headerText,a.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',a.textAlign="center",a.textBaseline="middle",a.fillText(String(I+1),re/2,P+Be/2+.5))}a.strokeStyle=Ee.headerSep,a.lineWidth=1,a.beginPath(),a.moveTo(re+.5,ce),a.lineTo(re+.5,p),a.stroke(),a.fillStyle=Ee.headerBg,a.fillRect(0,0,re,ce),a.strokeStyle=Ee.headerSep,a.lineWidth=1,a.strokeRect(.5,.5,re-.5,ce-.5)}const E=t.computed(()=>ze(e.activeCell.value.col)+String(e.activeCell.value.row+1)),L=t.computed(()=>e.editingCell.value?e.editValue.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));function N(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.editValue.value=e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),f())}function _(o){e.editValue.value=o.target.value}function ne(o){var d,M;o.key==="Enter"?(o.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(d=n.formulaBarRef.value)==null||d.blur(),f(),n.focusEditInput()):o.key==="Escape"&&(o.preventDefault(),e.cancelEdit(),(M=n.formulaBarRef.value)==null||M.blur(),f(),n.focusEditInput())}function C(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),f())},0)}const ge=t.ref(null),U=t.ref("");function j(o){ge.value===null&&(n.switchSheet(o),f())}function se(o){o!==n.activeSheetIndex.value&&(n.saveSheet(),n.loadSheet(o),f()),ge.value=o,U.value=n.sheets.value[o].name,t.nextTick(()=>{const d=document.querySelector(".tab-rename-input");d==null||d.focus(),d==null||d.select()})}function q(){ge.value!==null&&(n.renameSheet(ge.value,U.value),t.nextTick(()=>n.emitModelData())),ge.value=null,U.value=""}function A(){ge.value=null,U.value=""}function ye(o){o.key==="Enter"?(o.preventDefault(),q()):o.key==="Escape"&&(o.preventDefault(),A())}const Se=t.ref(null);let we=null;function xe(){we&&(document.removeEventListener("click",we),we=null)}function Ie(o,d,M){xe();const D=140,p=M.length*28+8,H=window.innerWidth,le=window.innerHeight;o+D>H&&(o-=D),d+p>le&&(d-=p),Se.value={x:o,y:d,items:M},we=()=>{Se.value=null,xe()},setTimeout(()=>document.addEventListener("click",we,{once:!0}),0)}const ae=t.ref(!1);function m(o,d){if(!d.children){ae.value=!1;return}const D=o.currentTarget.querySelector(".context-submenu");if(!D){ae.value=!1;return}const p=D.getBoundingClientRect();ae.value=p.right>window.innerWidth}function c(o,d){o.preventDefault(),o.stopPropagation(),Ie(o.clientX,o.clientY,[{label:G(e.locale.value,"insert"),action:()=>{n.addSheet(),f()}},{label:G(e.locale.value,"copy"),action:()=>{n.dupSheet(d)}},{label:G(e.locale.value,"rename"),action:()=>{se(d)}},{label:G(e.locale.value,"delete"),action:()=>{n.removeSheet(d),f()},disabled:n.sheetCount.value<=1},{label:G(e.locale.value,"moveSheetLeft"),action:()=>{n.moveSheet(d,-1)},disabled:d===0},{label:G(e.locale.value,"moveSheetRight"),action:()=>{n.moveSheet(d,1)},disabled:d===n.sheets.value.length-1}])}function he(o){o.preventDefault(),!(o.target.closest(".tab-item")||o.target.closest(".tab-bar__add-btn"))&&Ie(o.clientX,o.clientY,[{label:G(e.locale.value,"insert"),action:()=>{n.addSheet(),f()}}])}function ve(o){o.preventDefault(),e.selectAll(),f(),Ie(o.clientX,o.clientY,[{label:G(e.locale.value,"cut"),action:()=>{h.cutSelected(),n.emitModelData()}},{label:G(e.locale.value,"copy"),action:()=>h.copyToClipboard()},{label:G(e.locale.value,"paste"),action:()=>{g.saveUndo(),h.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>n.emitModelData())})}},{label:G(e.locale.value,"delete"),action:()=>{g.saveUndo(),h.clearSelected();for(let d=0;d<e.colCount;d++)e.colWidths.value[d]=100;for(let d=0;d<e.rowCount;d++)e.rowHeights.value[d]=void 0;f(),n.emitModelData()}}])}function Ae(o,d){o.preventDefault();const M=o.clientX,D=o.clientY,p=e.selection.value;p&&p.startCol===0&&p.endCol===e.colCount-1&&d>=p.startRow&&d<=p.endRow||(e.selectRange(0,d,e.colCount-1,d),f());const H=e.selection.value;Ie(o.clientX,o.clientY,[{label:G(e.locale.value,"insert"),action:()=>{g.saveUndo(),n.insertRows(H.startRow,H.endRow),f(),n.emitModelData()},disabled:H.endRow>=e.rowCount-1},{label:G(e.locale.value,"cut"),action:()=>{g.saveUndo(),h.copyRowCol();for(let le=H.startRow;le<=H.endRow;le++)for(let re=0;re<e.colCount;re++)e.delCell(e.cellKey(re,le));f(),n.emitModelData()}},{label:G(e.locale.value,"copy"),action:()=>h.copyRowCol()},{label:G(e.locale.value,"paste"),action:()=>{g.saveUndo(),h.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>n.emitModelData())})}},{label:G(e.locale.value,"delete"),action:()=>{g.saveUndo(),n.deleteRows(H.startRow,H.endRow),f(),n.emitModelData()}},{label:`${G(e.locale.value,"rowHeight")}...`,action:()=>r("row",M,D)},{label:G(e.locale.value,"autoRowHeight"),action:()=>n.resetRowHeight()}])}function Me(o,d){o.preventDefault();const M=o.clientX,D=o.clientY,p=e.selection.value;p&&p.startRow===0&&p.endRow===e.rowCount-1&&d>=p.startCol&&d<=p.endCol||(e.selectRange(d,0,d,e.rowCount-1),f());const H=e.selection.value;Ie(o.clientX,o.clientY,[{label:G(e.locale.value,"insert"),action:()=>{g.saveUndo(),n.insertCols(H.startCol,H.endCol),f(),n.emitModelData()},disabled:H.endCol>=e.colCount-1},{label:G(e.locale.value,"cut"),action:()=>{g.saveUndo(),h.copyRowCol();for(let le=H.startCol;le<=H.endCol;le++)for(let re=0;re<e.rowCount;re++)e.delCell(e.cellKey(le,re));f(),n.emitModelData()}},{label:G(e.locale.value,"copy"),action:()=>h.copyRowCol()},{label:G(e.locale.value,"paste"),action:()=>{g.saveUndo(),h.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>n.emitModelData())})}},{label:G(e.locale.value,"delete"),action:()=>{g.saveUndo(),n.deleteCols(H.startCol,H.endCol),f(),n.emitModelData()}},{label:`${G(e.locale.value,"colWidth")}...`,action:()=>r("col",M,D)},{label:G(e.locale.value,"defaultColWidth"),action:()=>n.resetColWidth()}])}function Te(o,d,M){o.preventDefault(),e.isSelected(d,M)||(e.selectCell(d,M),f());const D=e.selection.value,p=!!(D&&D.startCol===D.endCol&&D.startRow===D.endRow);Ie(o.clientX,o.clientY,[{label:G(e.locale.value,"cut"),action:()=>{h.cutSelected(),n.emitModelData()}},{label:G(e.locale.value,"copy"),action:()=>h.copyToClipboard()},{label:G(e.locale.value,"paste"),action:()=>{g.saveUndo(),h.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>n.emitModelData())})}},{label:G(e.locale.value,"delete"),action:()=>{g.saveUndo(),h.clearSelected(),f(),n.emitModelData()}},{label:G(e.locale.value,"calculate"),children:[{label:G(e.locale.value,"sum"),action:h.sumSelected,disabled:p},{label:G(e.locale.value,"avg"),action:h.avgSelected,disabled:p}]}])}const i=t.ref(null),v=t.ref(null);let b=null;function l(){b&&(document.removeEventListener("mousedown",b),b=null)}function r(o,d,M){l();const D=e.selection.value;let p="";if(D){const Ee=o==="row"?e.getRowHeight(D.startRow):e.colWidths.value[D.startCol];p=Ee!=null&&Ee>0?String(Math.round(Ee)):""}const H=220,le=118;let re=d,ce=M;re+H>window.innerWidth&&(re=window.innerWidth-H-8),ce+le>window.innerHeight&&(ce=window.innerHeight-le-8),re<8&&(re=8),ce<8&&(ce=8),v.value={type:o,x:re,y:ce,value:p,error:""},b=()=>{v.value=null},setTimeout(()=>document.addEventListener("mousedown",b,{once:!0}),0),t.nextTick(()=>{const Ee=i.value;Ee&&(Ee.focus(),Ee.select())})}function F(o){const d=v.value;if(!d)return;const M=o.target,D=M.value,p=D.replace(/[^\d]/g,"");d.value=p,D!==p&&(M.value=p),d.error=""}function V(o){o.key==="Enter"?(o.preventDefault(),de()):o.key==="Escape"&&(o.preventDefault(),Ce())}function $(){const o=v.value;if(!o)return;const d=o.value.trim(),M=Number(d),D=o.type==="row",p=D?24:30,H=D?500:1e3;if(d===""||!Number.isFinite(M)){Ce();return}const le=Math.max(p,Math.min(H,Math.round(M)));o.value=String(le),o.error=""}function de(){const o=v.value,d=e.selection.value;if(!o||!d)return;const M=o.value.trim(),D=Number(M),p=o.type==="row",H=p?24:30,le=p?500:1e3;if(M===""||!Number.isFinite(D)){o.error=G(e.locale.value,"dimNumberError");return}if(D<H||D>le){o.error=G(e.locale.value,"dimRangeError").replace("{min}",String(H)).replace("{max}",String(le));return}const re=D;if(g.saveUndo(),p)for(let ce=d.startRow;ce<=d.endRow;ce++)e.rowHeights.value[ce]=re;else for(let ce=d.startCol;ce<=d.endCol;ce++)e.colWidths.value[ce]=re;f(),n.emitModelData(),Ce()}function Ce(){l(),v.value=null}const De=t.computed(()=>{var $t;const o=!e.editingCell.value,d=e.editingCell.value??e.activeCell.value,M=d.col,D=d.row,p=($t=e.cells[e.cellKey(M,D)])==null?void 0:$t.style,H=e.cellFontSize(M,D),le=typeof(p==null?void 0:p.fontFamily)=="string"&&p.fontFamily?p.fontFamily:Kt,re=(p==null?void 0:p.fontWeight)==="bold"?"bold":"normal",ce=(p==null?void 0:p.fontStyle)==="italic"?"italic":"normal",Ee=(p==null?void 0:p.underline)==="underline"?"underline":(p==null?void 0:p.strikethrough)==="line-through"?"line-through":"none",je=(p==null?void 0:p.underline)==="underline"&&(p==null?void 0:p.strikethrough)==="line-through"?"underline line-through":Ee,Pe=typeof(p==null?void 0:p.color)=="string"?p.color:void 0,xt=typeof(p==null?void 0:p.backgroundColor)=="string"?p.backgroundColor:void 0,Ct=typeof(p==null?void 0:p.textAlign)=="string"?p.textAlign:"left",it=typeof(p==null?void 0:p.verticalAlign)=="string"?p.verticalAlign:"top",bt=e.findMerge(M,D),yt=bt?e.colPositions.value[bt.range.endCol+1]-e.colPositions.value[M]:e.colWidths.value[M],et=bt?e.rowPositions.value[bt.range.endRow+1]-e.rowPositions.value[D]:e.getRowHeight(D),jt=2,{ascent:wt,descent:kt}=e.measureFontMetrics(le,H,re,ce),Et=wt+kt,mt=(e.editValue.value?e.editValue.value.split(`
|
|
8
|
+
`).length:1)*Et,zt=e.BASE_CELL_VPAD-jt;let ct=0,pt=0;return it==="middle"?(ct=Math.floor((et-mt)/2),pt=Math.max(0,et-mt-ct)):it==="top"?(ct=zt,pt=Math.max(0,et-mt-ct)):it==="bottom"&&(pt=zt,ct=Math.max(0,et-mt-pt)),{left:`${52+e.colPositions.value[M]-e.scrollX.value}px`,top:`${24+e.rowPositions.value[D]-e.scrollY.value}px`,width:`${yt}px`,height:`${et}px`,fontFamily:le,fontSize:`${H}px`,lineHeight:1,fontWeight:re,fontStyle:ce,textDecoration:je,textAlign:Ct,paddingTop:`${ct}px`,paddingRight:"3px",paddingBottom:`${pt}px`,paddingLeft:"3px",opacity:o?0:1,pointerEvents:o?"none":"auto",color:o?"transparent":Pe,caretColor:o?"transparent":void 0,borderColor:o?"transparent":void 0,background:o?"transparent":xt,boxShadow:o?"none":void 0}});function k(){return Math.max(0,n.viewSize.w-52-11)}function T(){return Math.max(0,n.viewSize.h-24-11)}const S=t.computed(()=>k()),J=t.computed(()=>T()),ue=t.computed(()=>Math.max(0,S.value-11*2)),Y=t.computed(()=>Math.max(0,J.value-11*2)),fe=t.computed(()=>n.maxScrollX.value<=0?ue.value:Math.max(24,k()/e.totalWidth.value*ue.value)),Re=t.computed(()=>n.maxScrollX.value<=0?0:e.scrollX.value/n.maxScrollX.value*(ue.value-fe.value)),He=t.computed(()=>n.maxScrollY.value<=0?Y.value:Math.max(24,T()/e.totalHeight.value*Y.value)),lt=t.computed(()=>n.maxScrollY.value<=0?0:e.scrollY.value/n.maxScrollY.value*(Y.value-He.value));let Ue=null,qe=0,ut=0;function It(o){o.preventDefault(),Ue="v",qe=o.clientY,ut=e.scrollY.value,document.addEventListener("mousemove",B),document.addEventListener("mouseup",R)}function Xe(o){o.preventDefault(),Ue="h",qe=o.clientX,ut=e.scrollX.value,document.addEventListener("mousemove",B),document.addEventListener("mouseup",R)}function B(o){if(Ue==="v"){const M=(o.clientY-qe)/(Y.value-He.value);n.clampScroll(null,ut+M*n.maxScrollY.value),f()}else if(Ue==="h"){const M=(o.clientX-qe)/(ue.value-fe.value);n.clampScroll(ut+M*n.maxScrollX.value,null),f()}}function R(){Ue=null,document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",R)}function x(o){if(Ue)return;const d=o.currentTarget.getBoundingClientRect(),M=o.clientY-d.top;M<lt.value?n.clampScroll(null,e.scrollY.value-T()):M>lt.value+He.value&&n.clampScroll(null,e.scrollY.value+T()),f()}function Z(o){if(Ue)return;const d=o.currentTarget.getBoundingClientRect(),M=o.clientX-d.left;M<Re.value?n.clampScroll(e.scrollX.value-k(),null):M>Re.value+fe.value&&n.clampScroll(e.scrollX.value+k(),null),f()}let Q=!1,ie=0,me=0,s=!1,y=!1,W=0,z=0,te=0,oe=0,ee=0,pe=0,ke=0,$e=0,Le=!1,Ge=!1,Ve=0,Ke=0,ot="cell",Lt=0,Yt=-1,Ft=-1;function Xt(o){if(o.button!==0)return;o.preventDefault(),Se.value=null;const d=ht(o,n.canvasRef.value);if(d.y<24&&d.x>=52){const p=d.x-52+e.scrollX.value,H=e.hitCol(p);if(H>=0&&Math.abs(d.x-(52+e.colPositions.value[H+1]-e.scrollX.value))<=4){g.saveUndo(),s=!0,W=H,te=e.colWidths.value[H],oe=p,f();return}}if(d.x<52&&d.y>=24){const p=d.y-24+e.scrollY.value,H=e.hitRow(p);if(H>=0&&Math.abs(d.y-(24+e.rowPositions.value[H+1]-e.scrollY.value))<=4){g.saveUndo(),y=!0,z=H,te=e.getRowHeight(H),oe=p,f();return}}if(d.x<52||d.y<24){if(e.commitEdit(),d.y<24&&d.x>=52){const p=e.hitCol(d.x-52+e.scrollX.value);p>=0&&(e.selectRange(p,0,p,e.rowCount-1),Q=!0,ie=p,me=0)}else if(d.x<52&&d.y>=24){const p=e.hitRow(d.y-24+e.scrollY.value);p>=0&&(e.selectRange(0,p,e.colCount-1,p),Q=!0,ie=0,me=p)}else d.x<52&&d.y<24&&e.selectAll();f();return}const M=e.hitCol(d.x-52+e.scrollX.value),D=e.hitRow(d.y-24+e.scrollY.value);if(!(M<0||D<0)){if(e.commitEdit(),o.shiftKey&&e.selection.value){const p=e.selection.value;e.selectRange(p.startCol,p.startRow,M,D)}else e.selectCell(M,D);Q=!0,ie=M,me=D,n.focusEditInput(),f()}}function nl(o){if(s){const H=ht(o,n.canvasRef.value).x-52+e.scrollX.value-oe,le=te+H;le>=30&&le<=1e3?e.colWidths.value[W]=le:le<30?e.colWidths.value[W]=30:e.colWidths.value[W]=1e3,f();return}if(y){const H=ht(o,n.canvasRef.value).y-24+e.scrollY.value-oe,le=te+H;le>=24&&le<=500?e.rowHeights.value[z]=le:le<24?e.rowHeights.value[z]=24:e.rowHeights.value[z]=500,f();return}if(!Q){const p=n.canvasRef.value;if(!p)return;if(g.paintFmt.value){p.style.cursor="copy";return}const H=ht(o,p);if(H.y<24&&H.x>=52){const le=e.hitCol(H.x-52+e.scrollX.value);if(le>=0&&Math.abs(H.x-(52+e.colPositions.value[le+1]-e.scrollX.value))<=4){p.style.cursor="col-resize";return}}if(H.x<52&&H.y>=24){const le=e.hitRow(H.y-24+e.scrollY.value);if(le>=0&&Math.abs(H.y-(24+e.rowPositions.value[le+1]-e.scrollY.value))<=4){p.style.cursor="row-resize";return}}p.style.cursor="cell";return}const d=ht(o,n.canvasRef.value);if(ie<0||me<0)return;if(d.x<52||d.y<24){if(d.y<24&&d.x>=52){const p=e.hitCol(d.x-52+e.scrollX.value);p>=0&&e.selectRange(Math.min(ie,p),0,Math.max(ie,p),e.rowCount-1)}else if(d.x<52&&d.y>=24){const p=e.hitRow(d.y-24+e.scrollY.value);p>=0&&e.selectRange(0,Math.min(me,p),e.colCount-1,Math.max(me,p))}f();return}const M=e.hitCol(d.x-52+e.scrollX.value),D=e.hitRow(d.y-24+e.scrollY.value);M<0||D<0||(me===0&&ie>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(ie,M),0,Math.max(ie,M),e.rowCount-1):ie===0&&me>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(me,D),e.colCount-1,Math.max(me,D)):e.selectRange(ie,me,M,D),f())}function ft(o){const d=s||y;Q=!1,s=!1,y=!1,d&&n.scheduleOptEmit(),g.paintFmt.value&&g.applyPaintFormat()}function St(){const o=s||y;Q=!1,s=!1,y=!1,o&&n.scheduleOptEmit()}function Vt(o){o.preventDefault();const d=ht(o,n.canvasRef.value);if(d.x<52&&d.y<24){ve(o);return}if(d.y<24&&d.x>=52){const M=e.hitCol(d.x-52+e.scrollX.value);M>=0&&Me(o,M);return}if(d.x<52&&d.y>=24){const M=e.hitRow(d.y-24+e.scrollY.value);M>=0&&Ae(o,M);return}if(d.x>=52&&d.y>=24){const M=e.hitCol(d.x-52+e.scrollX.value),D=e.hitRow(d.y-24+e.scrollY.value);M>=0&&D>=0&&Te(o,M,D)}}function gl(o){const d=ht(o,n.canvasRef.value);if(d.x<52||d.y<24)return;const M=e.hitCol(d.x-52+e.scrollX.value),D=e.hitRow(d.y-24+e.scrollY.value);M<0||D<0||(e.selectCell(M,D),e.ensureVisible(M,D),e.startEdit(),f(),n.focusEditInput())}function Gn(o){n.clampScroll(e.scrollX.value+o.deltaX,e.scrollY.value+o.deltaY),f()}function Kn(o){if(o.touches.length!==1){Le=!1;return}const d=o.touches[0],M=n.canvasRef.value;if(!M)return;const D=M.getBoundingClientRect(),p=d.clientX-D.left,H=d.clientY-D.top;p>=52&&H>=24?(o.preventDefault(),Le=!0,Ge=!1,ot="cell",ee=p,pe=H,ke=e.scrollX.value,$e=e.scrollY.value,Ve=e.hitCol(p-52+e.scrollX.value),Ke=e.hitRow(H-24+e.scrollY.value)):p>=0&&H>=0&&(p<52||H<24)&&(o.preventDefault(),Le=!0,Ge=!1,ee=p,pe=H,ke=e.scrollX.value,$e=e.scrollY.value,H<24&&p>=52?(ot="col",Ve=e.hitCol(p-52+e.scrollX.value),Ke=-1):p<52&&H>=24?(ot="row",Ke=e.hitRow(H-24+e.scrollY.value),Ve=-1):(ot="all",Ve=-1,Ke=-1))}function Un(o){if(!Le||o.touches.length!==1)return;const d=o.touches[0],M=n.canvasRef.value;if(!M)return;const D=M.getBoundingClientRect(),p=d.clientX-D.left,H=d.clientY-D.top;(Math.abs(p-ee)>8||Math.abs(H-pe)>8)&&(Ge=!0,o.preventDefault(),n.clampScroll(ke+(ee-p),$e+(pe-H)),f())}function Pn(){if(Le&&(Le=!1,!Ge))if(ot==="cell"&&Ve>=0&&Ke>=0){const o=Date.now();Ve===Yt&&Ke===Ft&&o-Lt<300?(e.selectCell(Ve,Ke),e.startEdit(),f(),n.focusEditInput(),Lt=0):(e.commitEdit(),e.selectCell(Ve,Ke),f(),Lt=o),Yt=Ve,Ft=Ke,n.focusEditInput()}else ot==="col"&&Ve>=0?(e.commitEdit(),e.selectRange(Ve,0,Ve,e.rowCount-1),f()):ot==="row"&&Ke>=0?(e.commitEdit(),e.selectRange(0,Ke,e.colCount-1,Ke),f()):ot==="all"&&(e.commitEdit(),e.selectAll(),f())}function rl(o){return o.isComposing||o.key==="Process"||o.keyCode===229}function hl(o){return o.key.length===1&&!o.ctrlKey&&!o.metaKey&&!o.altKey}function vl(o){if(e.editingCell.value)return;const d=o.ctrlKey||o.metaKey,M=o.shiftKey;switch(!0){case(d&&(o.key==="c"||o.key==="C")):o.preventDefault(),h.copyToClipboard();return;case(d&&(o.key==="x"||o.key==="X")):o.preventDefault(),h.cutSelected();return;case(d&&(o.key==="z"||o.key==="Z")):o.preventDefault(),g.undo();return;case(d&&(o.key==="y"||o.key==="Y")):o.preventDefault(),g.redo();return;case(d&&(o.key==="v"||o.key==="V")):o.preventDefault(),g.saveUndo(),h.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>n.emitModelData())});return;case(d&&(o.key==="a"||o.key==="A")):o.preventDefault(),e.selectAll(),f();return;case(d&&o.key==="Home"):o.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),f();return;case(d&&o.key==="End"):o.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),f();return;case o.key==="Home":o.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),f();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),f();return;case o.key==="ArrowUp":o.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case o.key==="ArrowDown":o.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case o.key==="ArrowLeft":o.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case o.key==="ArrowRight":o.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case o.key==="Tab":o.preventDefault(),e.moveActive(M?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case o.key==="Enter":o.preventDefault(),e.moveActive(0,M?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case o.key==="F2":o.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),f(),n.focusEditInput();return;case o.key==="Delete":case o.key==="Backspace":o.preventDefault(),g.saveUndo(),h.clearSelected(),f();return;case o.key==="Escape":o.preventDefault(),e.cancelEdit(),g.paintFmt.value=null,f();return;case hl(o):if(rl(o)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),f(),n.focusEditInput();return}o.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(o.key),f(),t.nextTick(()=>{const D=n.editInputRef.value;D&&(D.focus(),D.setSelectionRange(1,1))});return}}let al=!1,il=!1;function Yn(o){const d=o.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(d),f();return}e.editValue.value=d}function Xn(){al=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),f())}function jn(o){al=!1,il=!0,setTimeout(()=>{il=!1},0),e.editValue.value=o.target.value}function Zn(o){if(!e.editingCell.value){if(hl(o)||rl(o))return;vl(o);return}if(!(al||rl(o))&&!(il&&(o.key==="Enter"||o.key==="Escape")))if(o.key==="Enter"&&(o.altKey||o.metaKey)){o.preventDefault();const d=n.editInputRef.value;if(!d)return;const M=d.selectionStart??d.value.length,D=d.selectionEnd??d.value.length,p=d.value,H=p.slice(0,M)+`
|
|
9
|
+
`+p.slice(D);e.editValue.value=H,d.value=H,d.selectionStart=d.selectionEnd=M+1,f()}else o.key==="Enter"?(o.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f(),n.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),f(),n.focusEditInput()):o.key==="Escape"&&(o.preventDefault(),e.cancelEdit(),f(),n.focusEditInput())}function qn(o){e.editingCell.value}function Jn(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),f())},0)}let Je=null;function Wt(){var d;const o=(d=n.wrapperRef.value)==null?void 0:d.getBoundingClientRect();if(o){const M=gt(e.props.width),D=gt(e.props.height);M!=null?n.viewSize.w=M:n.viewSize.w=o.width,D!=null?n.viewSize.h=D:n.viewSize.h=o.height}n.clampScroll(null,null),f()}function Qn(){t.onMounted(()=>{const o=gt(e.props.width),d=gt(e.props.height);(o==null||d==null)&&(Je=new ResizeObserver(()=>Wt()),n.wrapperRef.value&&Je.observe(n.wrapperRef.value)),t.nextTick(()=>{Wt(),n.focusEditInput()}),e.selectCell(0,0),n.modelData.value&&n.modelData.value.length>0&&(u.value=JSON.stringify(n.modelData.value),n.sheets.value=n.modelData.value.map(M=>{const D=n.mkSheet(M.name);for(const[p,H]of Object.entries(M.cells))D.cells[p]={value:H.value,style:H.style??null};if(M.colWidths)for(const[p,H]of Object.entries(M.colWidths)){const le=Number(p);le>=0&&le<e.colCount&&H>=30&&(D.colWidths[le]=H)}if(M.rowHeights)for(const[p,H]of Object.entries(M.rowHeights)){const le=Number(p);le>=0&&le<e.rowCount&&H>=24&&(D.rowHeights[le]=H)}if(M.merges)for(const[p,H]of Object.entries(M.merges))D.merges[p]={...H};return D}),n.sheets.value.length>0&&n.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const o=gt(e.props.width),d=gt(e.props.height);o!=null&&d!=null?(Je==null||Je.disconnect(),Je=null):!Je&&n.wrapperRef.value&&(Je=new ResizeObserver(()=>Wt()),Je.observe(n.wrapperRef.value)),t.nextTick(()=>Wt())}),t.watch(()=>e.props.theme,()=>f()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>n.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>n.emitModelData()),f()},{deep:!1}),t.watch(n.activeSheetIndex,()=>t.nextTick(()=>n.emitModelData())),t.watch(()=>n.modelData.value,o=>{if(!o||o.length===0)return;const d=JSON.stringify(o);if(d===u.value)return;u.value=d;const M=e.selection.value?{...e.selection.value}:null,D={...e.activeCell.value};n.sheets.value=o.map(p=>{const H=n.mkSheet(p.name);for(const[le,re]of Object.entries(p.cells))H.cells[le]={value:re.value,style:re.style??null};if(p.colWidths)for(const[le,re]of Object.entries(p.colWidths)){const ce=Number(le);ce>=0&&ce<e.colCount&&re>=30&&(H.colWidths[ce]=re)}if(p.rowHeights)for(const[le,re]of Object.entries(p.rowHeights)){const ce=Number(le);ce>=0&&ce<e.rowCount&&re>=24&&(H.rowHeights[ce]=re)}if(p.merges)for(const[le,re]of Object.entries(p.merges))H.merges[le]={...re};return H}),n.sheets.value.length>0&&n.loadSheet(0),M&&(e.selection.value=M),e.activeCell.value=D,f()},{deep:!0}),t.onBeforeUnmount(()=>{Je==null||Je.disconnect()})}return{scheduleRender:f,render:K,activeCellLabel:E,formulaBarDisplay:L,onFormulaBarFocus:N,onFormulaBarInput:_,onFormulaBarKeydown:ne,onFormulaBarBlur:C,renTab:ge,renTabVal:U,onTabClick:j,onTabDblClick:se,commitTabRename:q,cclTabRename:A,onTabRenameKd:ye,ctxMenu:Se,ctxSubmenuLeft:ae,onCtxItemEnter:m,onTabCtxMenu:c,onTabBarCtx:he,onCornerCtx:ve,onRowHdrCtx:Ae,onColHdrCtx:Me,onCellCtx:Te,dimInputRef:i,dimPanel:v,openDimPanel:r,onDimInput:F,onDimKeydown:V,onDimBlur:$,applyDimPanel:de,closeDimPanel:Ce,editInputStyle:De,hScrollbarW:S,vScrollbarH:J,hTrackW:ue,vTrackH:Y,hThumbW:fe,hThumbL:Re,vThumbH:He,vThumbT:lt,onVStart:It,onHStart:Xe,onSbMove:B,onSbUp:R,onVTrk:x,onHTrk:Z,onMouseDown:Xt,onMouseMove:nl,onMouseUp:ft,onMouseLeave:St,onCanvasCtx:Vt,onDblClick:gl,onWheel:Gn,onTouchStart:Kn,onTouchMove:Un,onTouchEnd:Pn,onKeydown:vl,onEditInput:Yn,onEditCompositionStart:Xn,onEditCompositionEnd:jn,onEditKd:Zn,onEditPaste:qn,onEditBlur:Jn,applySize:Wt,setupLifecycle:Qn}}const Tn={class:"formula-bar"},Dn={class:"formula-bar__cell-label"},Hn=["value"],An=["value"],Nn={key:2,class:"sb-corner"},On=["onClick","onMouseenter"],In={class:"context-menu__label"},Ln={key:0,class:"context-menu__arrow"},Fn=["onClick"],Vn={class:"dim-panel__title"},Wn={class:"dim-panel__body"},zn=["value"],$n={key:0,class:"dim-panel__error"},_n={class:"dim-panel__footer"},pl=dt(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 g=e,h=t.useModel(e,"data"),n={value:""},u=kn(g,{rowCount:g.rowCount,colCount:g.colCount,theme:g.theme,locale:g.locale}),w={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:ae=>{},mkSheet:ae=>({id:"",name:ae,cells:{},merges:{},selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[]})},a=En(u,w),O=Rn(u,a);Bn(a,{borderMenuOpen:O.borderMenuOpen,mergeMenuOpen:O.mergeMenuOpen});const f=xn(u,a,h,void 0,n);w.sheets=f.sheets,w.activeSheetIndex=f.activeSheetIndex,w.saveSheet=f.saveSheet,w.loadSheet=f.loadSheet,w.mkSheet=f.mkSheet;const X=Mn(u,a,O,f,n);X.setupLifecycle();const K=t.reactive(u),E=t.reactive(a),L=t.reactive(O),N=t.reactive(f),_=f.sheets,ne=f.activeSheetIndex,C=t.reactive(X),ge=t.computed(()=>{const ae=K.selection;return!!ae&&ae.startCol===ae.endCol&&ae.startRow===ae.endRow});function U(ae){a.fontSizeMenuOpen.value=ae}function j(ae){a.textColorMenuOpen.value=ae}function se(ae){a.fillColorMenuOpen.value=ae}function q(ae){X.renTabVal.value=ae}function A(){X.ctxMenu.value=null}const ye=ae=>{f.formulaBarRef.value=ae},Se=ae=>{f.wrapperRef.value=ae},we=ae=>{f.canvasRef.value=ae},xe=ae=>{f.editInputRef.value=ae},Ie=ae=>{X.dimInputRef.value=ae};return(ae,m)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(N.outerStyle)},[t.createVNode(un,{locale:K.locale,"can-undo":E.canUndo,"can-redo":E.canRedo,"paint-fmt-active":E.paintFmt!==null,"has-selection":E.hasSelection,"font-family-options":E.fontFamilyOptions,"font-size-options":E.fontSizeOptions,"sel-font-family":E.selFontFamily,"sel-font-size":E.selFontSize,"font-size-input":E.fontSizeInput,"font-size-menu-open":E.fontSizeMenuOpen,"sel-font-weight":E.selFontWeight,"sel-font-style":E.selFontStyle,"sel-underline":E.selUnderline,"sel-strikethrough":E.selStrikethrough,"sel-text-color":E.selTextColor,"text-color-menu-open":E.textColorMenuOpen,"sel-fill-color":E.selFillColor,"fill-color-menu-open":E.fillColorMenuOpen,"cached-text-color":E.cachedTextColor,"cached-fill-color":E.cachedFillColor,"border-menu-open":L.borderMenuOpen,"cached-border":L.cachedBorder,"h-align-options":E.hAlignOptions,"v-align-options":E.vAlignOptions,"sel-h-align":E.selHAlign,"sel-v-align":E.selVAlign,"sel-wrap":E.selWrap,"merge-menu-open":L.mergeMenuOpen,"calc-menu-open":L.calcMenuOpen,"is-single-cell":ge.value,"theme-vars":N.toolbarThemeVars,onUndo:m[0]||(m[0]=c=>E.undo()),onRedo:m[1]||(m[1]=c=>E.redo()),onPaintFormat:E.onPaintFormat,onClearFormat:m[2]||(m[2]=c=>E.clearFormat()),onFontFamilyChange:m[3]||(m[3]=c=>E.onFontFamilyChange(c)),onFontSizeInput:m[4]||(m[4]=c=>E.onFontSizeInput(c)),onFontSizeBlur:E.onFontSizeBlur,onFontSizeKeydown:m[5]||(m[5]=c=>E.onFontSizeKeydown(c)),onFontSizeChange:m[6]||(m[6]=c=>E.onFontSizeChange(c)),"onUpdate:fontSizeMenuOpen":m[7]||(m[7]=c=>U(c)),onFontSizeToggle:m[8]||(m[8]=c=>E.toggleFontSizeMenu()),onFontSizeStepUp:E.onFontSizeStepUp,onFontSizeStepDown:E.onFontSizeStepDown,onBoldToggle:E.toggleFontWeight,onItalicToggle:E.toggleFontStyle,onUnderlineToggle:E.toggleUnderline,onStrikethroughToggle:E.toggleStrikethrough,onTextColorChange:m[9]||(m[9]=c=>E.onTextColorChange(c)),"onUpdate:textColorMenuOpen":m[10]||(m[10]=c=>j(c)),onFillColorChange:m[11]||(m[11]=c=>E.onFillColorChange(c)),"onUpdate:fillColorMenuOpen":m[12]||(m[12]=c=>se(c)),onApplyTextColor:E.applyCachedTextColor,onApplyFillColor:E.applyCachedFillColor,"onUpdate:borderMenuOpen":m[13]||(m[13]=c=>E.onBorderMenuToggle(c)),onBorderChange:m[14]||(m[14]=c=>L.onBorderChange(c)),onApplyBorder:L.applyCachedBorder,onHAlignChange:m[15]||(m[15]=c=>E.onHAlignChange(c)),onVAlignChange:m[16]||(m[16]=c=>E.onVAlignChange(c)),onWrapToggle:E.onWrapToggle,"onUpdate:mergeMenuOpen":m[17]||(m[17]=c=>L.onMergeMenuToggle(c)),onMergeChange:m[18]||(m[18]=c=>L.onMergeChange(c)),onApplyMerge:L.onApplyMerge,"onUpdate:calcMenuOpen":m[19]||(m[19]=c=>L.onCalcMenuToggle(c)),onCalcSum:L.onCalcSum,onCalcAvg:L.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","theme-vars","onPaintFormat","onFontSizeBlur","onFontSizeStepUp","onFontSizeStepDown","onBoldToggle","onItalicToggle","onUnderlineToggle","onStrikethroughToggle","onApplyTextColor","onApplyFillColor","onApplyBorder","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg"]),t.createElementVNode("div",Tn,[t.createElementVNode("div",Dn,t.toDisplayString(C.activeCellLabel),1),t.createElementVNode("input",{ref:ye,class:"formula-bar__input",value:C.formulaBarDisplay,onFocus:m[20]||(m[20]=(...c)=>C.onFormulaBarFocus&&C.onFormulaBarFocus(...c)),onInput:m[21]||(m[21]=(...c)=>C.onFormulaBarInput&&C.onFormulaBarInput(...c)),onKeydown:m[22]||(m[22]=(...c)=>C.onFormulaBarKeydown&&C.onFormulaBarKeydown(...c)),onBlur:m[23]||(m[23]=(...c)=>C.onFormulaBarBlur&&C.onFormulaBarBlur(...c))},null,40,Hn)]),t.createElementVNode("div",{ref:Se,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:we,class:"grid-canvas",tabindex:"0",onMousedown:m[24]||(m[24]=(...c)=>C.onMouseDown&&C.onMouseDown(...c)),onMousemove:m[25]||(m[25]=(...c)=>C.onMouseMove&&C.onMouseMove(...c)),onMouseup:m[26]||(m[26]=(...c)=>C.onMouseUp&&C.onMouseUp(...c)),onMouseleave:m[27]||(m[27]=(...c)=>C.onMouseLeave&&C.onMouseLeave(...c)),onDblclick:m[28]||(m[28]=(...c)=>C.onDblClick&&C.onDblClick(...c)),onWheel:m[29]||(m[29]=t.withModifiers((...c)=>C.onWheel&&C.onWheel(...c),["prevent"])),onFocus:m[30]||(m[30]=(...c)=>N.onCanvasFocus&&N.onCanvasFocus(...c)),onKeydown:m[31]||(m[31]=(...c)=>C.onKeydown&&C.onKeydown(...c)),onContextmenu:m[32]||(m[32]=(...c)=>C.onCanvasCtx&&C.onCanvasCtx(...c)),onTouchstart:m[33]||(m[33]=t.withModifiers((...c)=>C.onTouchStart&&C.onTouchStart(...c),["prevent"])),onTouchmove:m[34]||(m[34]=t.withModifiers((...c)=>C.onTouchMove&&C.onTouchMove(...c),["prevent"])),onTouchend:m[35]||(m[35]=(...c)=>C.onTouchEnd&&C.onTouchEnd(...c))},null,32),t.createElementVNode("textarea",{ref:xe,class:"cell-editor",value:K.editValue,style:t.normalizeStyle(C.editInputStyle),onInput:m[36]||(m[36]=(...c)=>C.onEditInput&&C.onEditInput(...c)),onKeydown:m[37]||(m[37]=(...c)=>C.onEditKd&&C.onEditKd(...c)),onCompositionstart:m[38]||(m[38]=(...c)=>C.onEditCompositionStart&&C.onEditCompositionStart(...c)),onCompositionend:m[39]||(m[39]=(...c)=>C.onEditCompositionEnd&&C.onEditCompositionEnd(...c)),onBlur:m[40]||(m[40]=(...c)=>C.onEditBlur&&C.onEditBlur(...c)),onPaste:m[41]||(m[41]=(...c)=>C.onEditPaste&&C.onEditPaste(...c))},null,44,An),N.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:m[42]||(m[42]=t.withModifiers(c=>{N.clampScroll(null,K.scrollY-50),C.scheduleRender()},["prevent"]))},[...m[65]||(m[65]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:m[44]||(m[44]=(...c)=>C.onVTrk&&C.onVTrk(...c))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:C.vThumbT+"px",height:C.vThumbH+"px"}),onMousedown:m[43]||(m[43]=(...c)=>C.onVStart&&C.onVStart(...c))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:m[45]||(m[45]=t.withModifiers(c=>{N.clampScroll(null,K.scrollY+50),C.scheduleRender()},["prevent"]))},[...m[66]||(m[66]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),N.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:m[46]||(m[46]=t.withModifiers(c=>{N.clampScroll(K.scrollX-50,null),C.scheduleRender()},["prevent"]))},[...m[67]||(m[67]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:m[48]||(m[48]=(...c)=>C.onHTrk&&C.onHTrk(...c))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:C.hThumbL+"px",width:C.hThumbW+"px"}),onMousedown:m[47]||(m[47]=(...c)=>C.onHStart&&C.onHStart(...c))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:m[49]||(m[49]=t.withModifiers(c=>{N.clampScroll(K.scrollX+50,null),C.scheduleRender()},["prevent"]))},[...m[68]||(m[68]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),N.maxScrollX>0&&N.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",Nn)):t.createCommentVNode("",!0)]),t.createVNode(vn,{locale:K.locale,sheets:t.unref(_),"active-sheet-index":t.unref(ne),"ren-tab":C.renTab,"ren-tab-val":C.renTabVal,onTabClick:m[50]||(m[50]=c=>C.onTabClick(c)),onTabDblclick:m[51]||(m[51]=c=>C.onTabDblClick(c)),onTabContextmenu:m[52]||(m[52]=c=>C.onTabCtxMenu(c.ev,c.i)),onTabRenameInput:m[53]||(m[53]=c=>q(c)),onTabRenameKeydown:m[54]||(m[54]=c=>C.onTabRenameKd(c)),onTabRenameCommit:C.commitTabRename,onTabbarContextmenu:m[55]||(m[55]=c=>C.onTabBarCtx(c)),onAddSheet:m[56]||(m[56]=c=>{N.addSheet(),C.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(()=>[C.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:C.ctxMenu.x+"px",top:C.ctxMenu.y+"px"}),onClick:m[57]||(m[57]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(C.ctxMenu.items,(c,he)=>(t.openBlock(),t.createElementBlock("div",{key:he,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":c.disabled}]),onClick:ve=>!c.disabled&&c.action&&(c.action(),A()),onMouseenter:ve=>C.onCtxItemEnter(ve,c)},[t.createElementVNode("span",In,t.toDisplayString(c.label),1),c.children?(t.openBlock(),t.createElementBlock("span",Ln)):t.createCommentVNode("",!0),c.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":C.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.children,(ve,Ae)=>(t.openBlock(),t.createElementBlock("div",{key:Ae,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":ve.disabled}]),onClick:t.withModifiers(Me=>!ve.disabled&&ve.action&&(ve.action(),A()),["stop"])},t.toDisplayString(ve.label),11,Fn))),128))],2)):t.createCommentVNode("",!0)],42,On))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[C.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:C.dimPanel.x+"px",top:C.dimPanel.y+"px"}),onMousedown:m[63]||(m[63]=t.withModifiers(()=>{},["stop"])),onClick:m[64]||(m[64]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Vn,t.toDisplayString(C.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",Wn,[t.createElementVNode("input",{ref:Ie,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":C.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:C.dimPanel.value,onInput:m[58]||(m[58]=(...c)=>C.onDimInput&&C.onDimInput(...c)),onKeydown:m[59]||(m[59]=(...c)=>C.onDimKeydown&&C.onDimKeydown(...c)),onBlur:m[60]||(m[60]=(...c)=>C.onDimBlur&&C.onDimBlur(...c))},null,42,zn),m[69]||(m[69]=t.createElementVNode("span",{class:"dim-panel__unit"},"px",-1))]),C.dimPanel.error?(t.openBlock(),t.createElementBlock("div",$n,t.toDisplayString(C.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",_n,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:m[61]||(m[61]=(...c)=>C.applyDimPanel&&C.applyDimPanel(...c))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:m[62]||(m[62]=(...c)=>C.closeDimPanel&&C.closeDimPanel(...c))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-562e145a"]]);st.Spreader=pl,st.default=pl,Object.defineProperties(st,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|