xiaodao-spreader 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,9 @@
1
- (function(De,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(De=typeof globalThis<"u"?globalThis:De||self,e(De.XiaoDaoSpreader={},De.Vue))})(this,function(De,e){"use strict";const fl={"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:"边框",borderBottom:"下框线",borderTop:"上框线",borderLeft:"左框线",borderRight:"右框线",borderNone:"无框线",borderAll:"所有框线",borderOuter:"外框线",borderThickOuter:"粗外框线",fontDefault:"默认",rowHeight:"行高",colWidth:"列宽",defaultRowHeight:"默认行高",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",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",defaultRowHeight:"Default 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 B(a,h){var c;return((c=fl[a])==null?void 0:c[h])??h}const vo='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',Fe=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'}],pl=[{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}],bl={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"},hl={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"],gl={class:"sp-dropdown__value"},yl=["disabled"],kl=["onClick"],El=["disabled"],wl=e.defineComponent({__name:"dropdown",props:{modelValue:{},options:{},width:{default:"auto"},visibleCount:{default:8},title:{default:""},modelOpen:{type:Boolean,default:void 0},hideTrigger:{type:Boolean,default:!1}},emits:["update:modelValue","change","update:modelOpen"],setup(a,{emit:h}){const c=a,m=h,s=e.ref(!1),C=e.ref(0),D=e.ref(null),v=e.ref(null),F=e.ref(null),E=e.ref({left:0,top:0,up:!1}),g=e.ref(0),H=e.ref(!1),L=e.computed(()=>c.options.find(p=>String(p.value)===String(c.modelValue))),M=e.computed(()=>Math.min(c.visibleCount,c.options.length)),W=e.computed(()=>c.options.slice(C.value,C.value+M.value)),x=e.computed(()=>C.value>0),R=e.computed(()=>C.value+M.value<c.options.length);function A(p){C.value=Math.max(0,Math.min(c.options.length-M.value,C.value+p))}function G(){s.value=!0,c.modelOpen!==void 0&&m("update:modelOpen",!0);const p=D.value;if(!p)return;const w=p.getBoundingClientRect(),I=M.value*26+2*15+8,ze=window.innerHeight-w.bottom-4<I&&w.top-4>I;E.value={left:w.left,top:ze?w.top-I-4:w.bottom+4,up:ze};const ie=c.options.findIndex(Te=>String(Te.value)===String(c.modelValue));C.value=ie>=0?Math.max(0,Math.min(ie-Math.floor(M.value/2),c.options.length-M.value)):0}function z(){s.value=!1,c.modelOpen!==void 0&&m("update:modelOpen",!1)}function J(){s.value?z():G()}function j(p){m("update:modelValue",p.value),m("change",p.value),z()}function Q(p){var I,Y;if(!s.value)return;const w=p.target;(I=D.value)!=null&&I.contains(w)||(Y=F.value)!=null&&Y.contains(w)||z()}function ke(p){s.value&&(p.preventDefault(),A(p.deltaY>0?1:-1))}e.watch(s,p=>{e.nextTick(()=>{var w,I;p?(w=v.value)==null||w.addEventListener("wheel",ke,{passive:!1}):(I=v.value)==null||I.removeEventListener("wheel",ke)})}),e.watch(()=>c.modelOpen,p=>{p!==void 0&&p!==s.value&&(p?G():z())});function Ve(p){s.value&&(g.value=p.touches[0].clientY,H.value=!0)}function N(p){if(!s.value||!H.value)return;const w=p.touches[0].clientY-g.value;Math.abs(w)>5&&(A(w<0?1:-1),g.value=p.touches[0].clientY)}function V(){H.value=!1}function d(p){p.key==="Escape"&&z()}return e.onMounted(()=>{document.addEventListener("mousedown",Q),window.addEventListener("resize",z),window.addEventListener("scroll",z,!0)}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",Q),window.removeEventListener("resize",z),window.removeEventListener("scroll",z,!0)}),(p,w)=>{var I;return e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:D,class:"sp-dropdown",style:e.normalizeStyle(typeof a.width=="number"?{width:a.width+"px"}:{width:a.width})},[a.hideTrigger?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:e.normalizeClass(["sp-dropdown__trigger",{"sp-dropdown__trigger--open":s.value}]),title:a.title,onClick:J},[e.createElementVNode("span",gl,e.toDisplayString(((I=L.value)==null?void 0:I.label)??""),1),w[2]||(w[2]=e.createElementVNode("svg",{class:"sp-dropdown__caret",viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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)),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"menu-pop"},{default:e.withCtx(()=>[s.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"menuRef",ref:F,class:e.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":E.value.up}]),style:e.normalizeStyle({left:E.value.left+"px",top:E.value.top+"px",width:typeof a.width=="number"?a.width+"px":a.width}),onKeydown:d},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!x.value}]),disabled:!x.value,onClick:w[0]||(w[0]=Y=>A(-1))},[...w[3]||(w[3]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,yl),e.createElementVNode("div",{ref_key:"listRef",ref:v,class:"sp-dropdown__list",onTouchstart:Ve,onTouchmove:N,onTouchend:V},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(W.value,Y=>(e.openBlock(),e.createElementBlock("button",{key:String(Y.value),type:"button",class:e.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(Y.value)===String(a.modelValue)}]),onClick:ze=>j(Y)},e.toDisplayString(Y.label),11,kl))),128))],544),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!R.value}]),disabled:!R.value,onClick:w[1]||(w[1]=Y=>A(1))},[...w[4]||(w[4]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,El)],38)):e.createCommentVNode("",!0)]),_:1})]))],4)}}}),Ye=(a,h)=>{const c=a.__vccOpts||a;for(const[m,s]of h)c[m]=s;return c},go=Ye(wl,[["__scopeId","data-v-47e5c681"]]),Bl=["title","onClick"],yo=Ye(e.defineComponent({__name:"colorPicker",props:{modelOpen:{type:Boolean,default:void 0},colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"}},emits:["update:modelValue","change","update:modelOpen"],setup(a,{expose:h,emit:c}){const m=a,s=c,C=[[{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"}]],D=[[{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=e.computed(()=>m.colorKey==="fill"?D:C);function F(A){return B(m.locale,A)}function E(A){const G=m.currentColor;return!G&&!A?!0:G?G.toLowerCase()===A.toLowerCase():!1}const g=e.ref(!1),H=e.ref(null),L=e.ref(null);e.watch(()=>m.modelOpen,A=>{A!==void 0&&A!==g.value&&(A?W():x())});function M(A){const G=H.value;G&&!G.contains(A.target)&&x()}function W(){g.value=!0,m.modelOpen!==void 0&&s("update:modelOpen",!0),e.nextTick(()=>{document.addEventListener("mousedown",M)})}function x(){g.value=!1,m.modelOpen!==void 0&&s("update:modelOpen",!1),document.removeEventListener("mousedown",M)}function R(A){s("update:modelValue",A),s("change",A),x()}return e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",M)}),h({open:g,openMenu:W,close:x}),(A,G)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:H,class:"color-picker"},[e.createVNode(e.Transition,{name:"menu-pop"},{default:e.withCtx(()=>[g.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"menuRef",ref:L,class:"color-picker__menu",onMousedown:G[0]||(G[0]=e.withModifiers(()=>{},["stop"]))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,(z,J)=>(e.openBlock(),e.createElementBlock("div",{key:J,class:"color-picker__row"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z,j=>(e.openBlock(),e.createElementBlock("button",{key:j.value,class:e.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":E(j.value)}]),title:F(j.key),style:e.normalizeStyle({background:j.value||"transparent",border:j.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:Q=>R(j.value)},null,14,Bl))),128))]))),128))],544)):e.createCommentVNode("",!0)]),_:1})],512))}}),[["__scopeId","data-v-c262a5e5"]]),Cl=["title","onClick"],xl={viewBox:"0 0 30 30",class:"border-picker__icon"},Sl=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Dl={class:"border-picker__label"},Tl=Ye(e.defineComponent({__name:"borderPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"}},emits:["update:modelOpen","change"],setup(a,{expose:h,emit:c}){const m=a,s=c,C=[{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"}],D=[{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 E(R,A){return F[R].includes(A)?"thick":v[R].includes(A)?"solid":"dashed"}const g=e.ref(!1),H=e.ref(null);e.watch(()=>m.modelOpen,R=>{R!==void 0&&R!==g.value&&(R?M():W())});function L(R){const A=H.value;A&&!A.contains(R.target)&&W()}function M(){g.value=!0,m.modelOpen!==void 0&&s("update:modelOpen",!0),e.nextTick(()=>{document.addEventListener("mousedown",L)})}function W(){g.value=!1,m.modelOpen!==void 0&&s("update:modelOpen",!1),document.removeEventListener("mousedown",L)}function x(R){s("change",R),W()}return e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",L)}),h({open:g,openMenu:M,close:W}),(R,A)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:H,class:"border-picker"},[e.createVNode(e.Transition,{name:"menu-pop"},{default:e.withCtx(()=>[g.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"border-picker__menu",onMousedown:A[0]||(A[0]=e.withModifiers(()=>{},["stop"]))},[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(C,G=>e.createElementVNode("button",{key:G.key,class:"border-picker__item",title:e.unref(B)(a.locale,G.i18nKey),onClick:z=>x(G.key)},[(e.openBlock(),e.createElementBlock("svg",xl,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(D,z=>e.createElementVNode("line",{key:z.name,x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,stroke:"currentColor","stroke-width":E(G.key,z.name)==="thick"?3:1.5,"stroke-dasharray":E(G.key,z.name)==="dashed"?"0 4":"none","stroke-linecap":E(G.key,z.name)==="dashed"?"round":"square"},null,8,Sl)),64))])),e.createElementVNode("span",Dl,e.toDisplayString(e.unref(B)(a.locale,G.i18nKey)),1)],8,Cl)),64))],32)):e.createCommentVNode("",!0)]),_:1})],512))}}),[["__scopeId","data-v-c9b0ba80"]]),Hl={class:"tb-item","data-key":"undo"},Rl=["title","disabled"],Ml={class:"tb-item","data-key":"redo"},Nl=["title","disabled"],Fl={class:"tb-item","data-key":"paint"},Il=["title","disabled"],Al={class:"tb-item","data-key":"clear"},Vl=["title","disabled"],zl={class:"tb-item","data-key":"font"},Ol={class:"tb-item","data-key":"fontSize"},Ll={class:"toolbar-font-size"},Wl=["value","title"],$l=["title"],_l=["title","disabled"],Gl=["title","disabled"],Pl={class:"tb-item","data-key":"bold"},Ul=["title","disabled"],Yl={class:"tb-item","data-key":"italic"},Kl=["title","disabled"],Xl={class:"tb-item","data-key":"underline"},jl=["title","disabled"],Zl={class:"tb-item","data-key":"strike"},ql=["title","disabled"],Jl={class:"tb-item","data-key":"textColor"},Ql={class:"toolbar-split"},en=["title","disabled"],tn={viewBox:"0 0 1024 1024",fill:"currentColor"},on=["fill"],ln=["title","disabled"],nn={class:"tb-item","data-key":"fillColor"},rn={class:"toolbar-split"},an=["title","disabled"],sn={viewBox:"0 0 1024 1024",fill:"currentColor"},cn=["fill"],dn=["title","disabled"],un={class:"tb-item","data-key":"border"},fn={class:"toolbar-split"},mn=["title","disabled"],pn={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},bn=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],hn=["title","disabled"],Ot=2,vn=6,gn=34,yn=Ye(e.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:{}},emits:["undo","redo","paint-format","clear-format","font-family-change","font-size-input","font-size-blur","font-size-keydown","font-size-change","update:font-size-menu-open","font-size-toggle","font-size-step-up","font-size-step-down","bold-toggle","italic-toggle","underline-toggle","strikethrough-toggle","text-color-change","update:text-color-menu-open","fill-color-change","update:fill-color-menu-open","apply-text-color","apply-fill-color","update:border-menu-open","border-change","apply-border"],setup(a,{emit:h}){const c=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],m={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},s={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function C(V,d){return s[V].includes(d)?"thick":m[V].includes(d)?"solid":"dashed"}const D=["undo","redo","paint","clear","sep1","font","fontSize","sep2","bold","italic","underline","strike","sep3","textColor","fillColor","border"],v=e.ref(null),F=e.ref(null),E=e.ref(null),g=e.ref(new Set),H=e.ref(!1),L=e.ref(!1),M=new Map,W=e.computed(()=>g.value.size>0);function x(V){return g.value.has(V)}function R(){if(!v.value)return;v.value.querySelectorAll(".tb-item").forEach(d=>{const p=d.dataset.key;p&&M.set(p,d.offsetWidth)})}function A(V,d){if(V.size!==d.size)return!1;for(const p of V)if(!d.has(p))return!1;return!0}function G(){if(!v.value)return;const V=v.value.clientWidth-vn*2;if(V<=0)return;M.size===0&&R();let d=0;for(const w of D)d+=(M.get(w)??0)+Ot;const p=new Set;if(d>V){const w=V-gn-Ot;let I=0;for(let Y=0;Y<D.length;Y++){const ze=D[Y],ie=(M.get(ze)??0)+Ot;if(I+ie>w){for(let Te=Y;Te<D.length;Te++)p.add(D[Te]);break}I+=ie}}A(p,g.value)||(g.value=p,p.size===0&&(H.value=!1))}let z=null;const J=e.ref(0),j=e.computed(()=>{const V=E.value;if(!V)return{position:"fixed",top:"0px",right:"0px"};J.value;const d=V.getBoundingClientRect();return{position:"fixed",top:`${d.bottom+4}px`,right:`${window.innerWidth-d.right}px`}});function Q(){H.value&&(J.value++,e.nextTick(()=>G()))}function ke(V){var p,w;if(!H.value)return;const d=V.target;(p=F.value)!=null&&p.contains(d)||(w=E.value)!=null&&w.contains(d)||(L.value=!0,H.value=!1,e.nextTick(()=>{L.value=!1}))}function Ve(){H.value=!H.value}e.onMounted(()=>{e.nextTick(()=>{R(),G()}),v.value&&(z=new ResizeObserver(()=>{H.value||G()}),z.observe(v.value)),document.addEventListener("mousedown",ke,!0),window.addEventListener("resize",Q)}),e.onBeforeUnmount(()=>{z==null||z.disconnect(),document.removeEventListener("mousedown",ke,!0),window.removeEventListener("resize",Q)});const N=h;return(V,d)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{ref_key:"rootEl",ref:v,class:"toolbar"},[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("undo"),to:F.value??void 0},[e.createElementVNode("div",Hl,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!a.canUndo}]),title:e.unref(B)(a.locale,"undo"),disabled:!a.canUndo,onClick:d[0]||(d[0]=p=>N("undo"))},[...d[32]||(d[32]=[e.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,Rl)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("redo"),to:F.value??void 0},[e.createElementVNode("div",Ml,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!a.canRedo}]),title:e.unref(B)(a.locale,"redo"),disabled:!a.canRedo,onClick:d[1]||(d[1]=p=>N("redo"))},[...d[33]||(d[33]=[e.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,Nl)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("paint"),to:F.value??void 0},[e.createElementVNode("div",Fl,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--active":a.paintFmtActive}]),title:e.unref(B)(a.locale,"paintFormat"),disabled:!a.hasSelection,onClick:d[2]||(d[2]=p=>N("paint-format"))},[...d[34]||(d[34]=[e.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,Il)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("clear"),to:F.value??void 0},[e.createElementVNode("div",Al,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!a.hasSelection}]),title:e.unref(B)(a.locale,"clearFormat"),disabled:!a.hasSelection,onClick:d[3]||(d[3]=p=>N("clear-format"))},[...d[35]||(d[35]=[e.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,Vl)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("sep1"),to:F.value??void 0},[d[36]||(d[36]=e.createElementVNode("div",{class:"tb-item","data-key":"sep1"},[e.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("font"),to:F.value??void 0},[e.createElementVNode("div",zl,[e.createVNode(go,{class:"toolbar-font","model-value":a.selFontFamily,options:a.fontFamilyOptions,width:110,"visible-count":8,title:e.unref(B)(a.locale,"fontFamily"),onChange:d[4]||(d[4]=p=>N("font-family-change",p))},null,8,["model-value","options","title"])])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("fontSize"),to:F.value??void 0},[e.createElementVNode("div",Ol,[e.createElementVNode("div",Ll,[e.createElementVNode("input",{class:"toolbar-font-size__input",type:"text",value:a.fontSizeInput,title:e.unref(B)(a.locale,"fontSize"),onInput:d[5]||(d[5]=p=>N("font-size-input",p.target.value)),onBlur:d[6]||(d[6]=p=>N("font-size-blur")),onKeydown:d[7]||(d[7]=p=>N("font-size-keydown",p))},null,40,Wl),e.createVNode(go,{class:"toolbar-font-size__dropdown","model-value":a.selFontSize,options:a.fontSizeOptions,width:56,"visible-count":9,title:e.unref(B)(a.locale,"fontSize"),"hide-trigger":!0,"model-open":a.fontSizeMenuOpen,"onUpdate:modelOpen":d[8]||(d[8]=p=>N("update:font-size-menu-open",p)),onChange:d[9]||(d[9]=p=>N("font-size-change",p))},null,8,["model-value","options","title","model-open"]),e.createElementVNode("button",{class:"toolbar-font-size__btn",type:"button",title:e.unref(B)(a.locale,"fontSize"),onMousedown:d[10]||(d[10]=e.withModifiers(()=>{},["prevent"])),onClick:d[11]||(d[11]=p=>N("font-size-toggle"))},[...d[37]||(d[37]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,$l),e.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:e.unref(B)(a.locale,"fontSizeDecrease"),disabled:!a.hasSelection,onMousedown:d[12]||(d[12]=e.withModifiers(()=>{},["prevent"])),onClick:d[13]||(d[13]=p=>N("font-size-step-down"))},[...d[38]||(d[38]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,_l),e.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:e.unref(B)(a.locale,"fontSizeIncrease"),disabled:!a.hasSelection,onMousedown:d[14]||(d[14]=e.withModifiers(()=>{},["prevent"])),onClick:d[15]||(d[15]=p=>N("font-size-step-up"))},[...d[39]||(d[39]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,Gl)])])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("sep2"),to:F.value??void 0},[d[40]||(d[40]=e.createElementVNode("div",{class:"tb-item","data-key":"sep2"},[e.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("bold"),to:F.value??void 0},[e.createElementVNode("div",Pl,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--active":a.selFontWeight}]),title:e.unref(B)(a.locale,"bold"),disabled:!a.hasSelection,onClick:d[16]||(d[16]=p=>N("bold-toggle"))},[...d[41]||(d[41]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[e.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,Ul)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("italic"),to:F.value??void 0},[e.createElementVNode("div",Yl,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--active":a.selFontStyle}]),title:e.unref(B)(a.locale,"italic"),disabled:!a.hasSelection,onClick:d[17]||(d[17]=p=>N("italic-toggle"))},[...d[42]||(d[42]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[e.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,Kl)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("underline"),to:F.value??void 0},[e.createElementVNode("div",Xl,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--active":a.selUnderline}]),title:e.unref(B)(a.locale,"underline"),disabled:!a.hasSelection,onClick:d[18]||(d[18]=p=>N("underline-toggle"))},[...d[43]||(d[43]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[e.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,jl)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("strike"),to:F.value??void 0},[e.createElementVNode("div",Zl,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--active":a.selStrikethrough}]),title:e.unref(B)(a.locale,"strikethrough"),disabled:!a.hasSelection,onClick:d[19]||(d[19]=p=>N("strikethrough-toggle"))},[...d[44]||(d[44]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[e.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,ql)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("sep3"),to:F.value??void 0},[d[45]||(d[45]=e.createElementVNode("div",{class:"tb-item","data-key":"sep3"},[e.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("textColor"),to:F.value??void 0},[e.createElementVNode("div",Jl,[e.createElementVNode("div",Ql,[e.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.unref(B)(a.locale,"fontColor"),disabled:!a.hasSelection,onClick:d[20]||(d[20]=p=>N("apply-text-color"))},[(e.openBlock(),e.createElementBlock("svg",tn,[d[46]||(d[46]=e.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[e.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)),e.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:a.cachedTextColor||"#000000"},null,8,on)]))],8,en),e.createElementVNode("button",{class:"toolbar-btn toolbar-split__arrow",title:e.unref(B)(a.locale,"fontColor"),disabled:!a.hasSelection,onClick:d[21]||(d[21]=p=>N("update:text-color-menu-open",!a.textColorMenuOpen))},[...d[47]||(d[47]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,ln),e.createVNode(yo,{"model-open":a.textColorMenuOpen,"color-key":"text","current-color":a.selTextColor,locale:a.locale,"onUpdate:modelOpen":d[22]||(d[22]=p=>N("update:text-color-menu-open",p)),onChange:d[23]||(d[23]=p=>N("text-color-change",p))},null,8,["model-open","current-color","locale"])])])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("fillColor"),to:F.value??void 0},[e.createElementVNode("div",nn,[e.createElementVNode("div",rn,[e.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.unref(B)(a.locale,"fillColor"),disabled:!a.hasSelection,onClick:d[24]||(d[24]=p=>N("apply-fill-color"))},[(e.openBlock(),e.createElementBlock("svg",sn,[d[48]||(d[48]=e.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)),e.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:a.cachedFillColor||"currentColor"},null,8,cn)]))],8,an),e.createElementVNode("button",{class:"toolbar-btn toolbar-split__arrow",title:e.unref(B)(a.locale,"fillColor"),disabled:!a.hasSelection,onClick:d[25]||(d[25]=p=>N("update:fill-color-menu-open",!a.fillColorMenuOpen))},[...d[49]||(d[49]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,dn),e.createVNode(yo,{"model-open":a.fillColorMenuOpen,"color-key":"fill","current-color":a.selFillColor,locale:a.locale,"onUpdate:modelOpen":d[26]||(d[26]=p=>N("update:fill-color-menu-open",p)),onChange:d[27]||(d[27]=p=>N("fill-color-change",p))},null,8,["model-open","current-color","locale"])])])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!x("border"),to:F.value??void 0},[e.createElementVNode("div",un,[e.createElementVNode("div",fn,[e.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.unref(B)(a.locale,"borders"),disabled:!a.hasSelection,onClick:d[28]||(d[28]=p=>N("apply-border"))},[(e.openBlock(),e.createElementBlock("svg",pn,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(c,p=>e.createElementVNode("line",{key:p.name,x1:p.x1,y1:p.y1,x2:p.x2,y2:p.y2,"stroke-width":C(a.cachedBorder,p.name)==="thick"?3:1.5,"stroke-dasharray":C(a.cachedBorder,p.name)==="dashed"?"0 4":"none","stroke-linecap":C(a.cachedBorder,p.name)==="dashed"?"round":"square"},null,8,bn)),64))]))],8,mn),e.createElementVNode("button",{class:"toolbar-btn toolbar-split__arrow",title:e.unref(B)(a.locale,"borders"),disabled:!a.hasSelection,onClick:d[29]||(d[29]=p=>N("update:border-menu-open",!a.borderMenuOpen))},[...d[50]||(d[50]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,hn),e.createVNode(Tl,{"model-open":a.borderMenuOpen,locale:a.locale,"current-border":a.cachedBorder,"onUpdate:modelOpen":d[30]||(d[30]=p=>N("update:border-menu-open",p)),onChange:d[31]||(d[31]=p=>N("border-change",p))},null,8,["model-open","locale","current-border"])])])],8,["disabled","to"])),W.value?(e.openBlock(),e.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:E,class:e.normalizeClass(["toolbar-more",{"toolbar-more--active":H.value}]),type:"button",onClick:Ve},[...d[51]||(d[51]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.createElementVNode("circle",{cx:"512",cy:"160",r:"96"}),e.createElementVNode("circle",{cx:"512",cy:"512",r:"96"}),e.createElementVNode("circle",{cx:"512",cy:"864",r:"96"})],-1)])],2)):e.createCommentVNode("",!0)],512),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"menu-pop"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"overflowMenuEl",ref:F,class:e.normalizeClass(["overflow-menu",{"no-anim":L.value}]),style:e.normalizeStyle(j.value)},null,6),[[e.vShow,H.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-69401a37"]]),kn={class:"tab-list"},En=["onClick","onDblclick","onContextmenu"],wn=["value"],Bn={key:1,class:"tab-item__name"},Cn=["title"],xn=Ye(e.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","tabbar-contextmenu","add-sheet"],setup(a,{emit:h}){const c=h;return(m,s)=>(e.openBlock(),e.createElementBlock("div",{class:"tab-bar",onContextmenu:s[5]||(s[5]=C=>c("tabbar-contextmenu",C))},[e.createElementVNode("div",kn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.sheets,(C,D)=>(e.openBlock(),e.createElementBlock("div",{key:C.id,class:e.normalizeClass(["tab-item",{"tab-item--active":D===a.activeSheetIndex}]),onClick:v=>c("tab-click",D),onDblclick:e.withModifiers(v=>c("tab-dblclick",D),["prevent"]),onContextmenu:v=>c("tab-contextmenu",{ev:v,i:D})},[a.renTab===D?(e.openBlock(),e.createElementBlock("input",{key:0,class:"tab-rename-input",value:a.renTabVal,onInput:s[0]||(s[0]=v=>c("tab-rename-input",v.target.value)),onKeydown:s[1]||(s[1]=v=>c("tab-rename-keydown",v)),onBlur:s[2]||(s[2]=v=>c("tab-rename-commit")),onClick:s[3]||(s[3]=e.withModifiers(()=>{},["stop"]))},null,40,wn)):(e.openBlock(),e.createElementBlock("span",Bn,e.toDisplayString(C.name),1))],42,En))),128))]),e.createElementVNode("button",{class:"tab-bar__add-btn",title:e.unref(B)(a.locale,"addSheet"),onClick:s[4]||(s[4]=C=>c("add-sheet"))}," + ",8,Cn)],32))}}),[["__scopeId","data-v-49f54625"]]);function ue(a){let h="",c=a;do h=String.fromCharCode(65+c%26)+h,c=Math.floor(c/26)-1;while(c>=0);return h}function Lt(a){let h=0;for(let c=0;c<a.length;c++)h=h*26+(a.toUpperCase().charCodeAt(c)-64);return h-1}function Ie(a){if(a==null)return null;if(typeof a=="number")return a;if(typeof a=="string"){const h=parseFloat(a);return a.endsWith("%")||isNaN(h)?null:h}return null}function Wt(a){navigator.clipboard.writeText(a).catch(()=>{const h=document.createElement("textarea");h.value=a,h.style.position="fixed",h.style.opacity="0",document.body.appendChild(h),h.select(),document.execCommand("copy"),document.body.removeChild(h)})}function Ke(a,h){return`${a},${h}`}function pt(a,h,c){const m=a.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!m)return null;const s=Lt(m[1]),C=parseInt(m[2],10)-1;return s<0||s>=h||C<0||C>=c?null:{col:s,row:C}}function Ae(a,h){if(!h)return{x:0,y:0};const c=h.getBoundingClientRect();return{x:a.clientX-c.left,y:a.clientY-c.top}}function Sn(a,h,c){const m=a.split(":");if(m.length!==2)return null;const s=pt(m[0],h,c),C=pt(m[1],h,c);return!s||!C?null:{sc:Math.min(s.col,C.col),sr:Math.min(s.row,C.row),ec:Math.max(s.col,C.col),er:Math.max(s.row,C.row)}}function Dn(a,h,c,m,s){const C=c[Ke(a,h)];if(!C)return 0;const D=C.value;if(D.startsWith("="))return Eo(Ke(a,h),c,m,s)??0;const v=parseFloat(D);return isNaN(v)?0:v}const Xe=new Map;function ko(){Xe.clear()}function Eo(a,h,c,m){return Tn(a,h,c,m)}function Tn(a,h,c,m,s){if(Xe.has(a))return NaN;Xe.set(a,NaN);const C=h[a];if(!C)return NaN;const D=C.value;if(!D.startsWith("=")){const E=parseFloat(D),g=isNaN(E)?0:E;return Xe.set(a,g),g}const v=D.slice(1).trim();if(v.toUpperCase().startsWith("SUM(")&&v.endsWith(")")){const E=v.slice(4,-1).trim(),g=Sn(E,c,m);if(g){let H=0;for(let L=g.sc;L<=g.ec;L++)for(let M=g.sr;M<=g.er;M++)H+=Dn(L,M,h,c,m);return isNaN(H)?NaN:(Xe.set(a,H),H)}return NaN}return NaN}function wo(a,h,c){const m=[],s=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let C;for(;(C=s.exec(a))!==null;){const D=pt(C[1],h,c);if(D)if(C[2]){const v=pt(C[2],h,c);if(!v)continue;for(let F=Math.min(D.col,v.col);F<=Math.max(D.col,v.col);F++)for(let E=Math.min(D.row,v.row);E<=Math.max(D.row,v.row);E++)m.push(Ke(F,E))}else m.push(Ke(D.col,D.row))}return m}function Hn(a,h,c,m,s){const C=c[Ke(a,h)];if(!C)return"";const D=C.value;if(!D.startsWith("="))return D;const v=Eo(Ke(a,h),c,m,s);return isNaN(v)?"#ERROR":String(v)}function Rn(a,h,c,m,s,C){return h===0&&c===0?a:a.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(D,v,F,E,g)=>{const H=v?Lt(F):Lt(F)+h,L=E?parseInt(g,10)-1:parseInt(g,10)-1+c;let M;H<0?M="A":H>=m?M=C(m-1):M=C(H);let W;return L<0?W="1":L>=s?W=String(s):W=String(L+1),(v||"")+M+(E||"")+W})}class Mn{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(h){var m;const c=this.deps.get(h);if(c){for(const s of c)(m=this.rev.get(s))==null||m.delete(h);this.deps.delete(h)}}set(h,c){if(this.clear(h),c.length!==0){this.deps.set(h,c);for(const m of c)this.rev.has(m)||this.rev.set(m,new Set),this.rev.get(m).add(h)}}markDirty(h){const c=[h];for(;c.length>0;){const m=c.pop(),s=this.rev.get(m);if(s)for(const C of s)this.dirty.has(C)||(this.dirty.add(C),c.push(C))}}getDirtyAndClear(){const h=this.dirty;return this.dirty=new Set,h}rebuild(h,c,m){this.deps.clear(),this.rev.clear(),this.dirty.clear(),Xe.clear();for(const[s,C]of Object.entries(h))if(C.value.startsWith("=")){const D=wo(C.value.slice(1),c,m);this.set(s,D)}}}function Nn(a,h,c,m){const s={},C=m(h),D=m(c);return C!=null&&(s.width=`${C}px`),D!=null&&(s.height=`${D}px`),s["--sp-formula-bar-bg"]=a.formulaBarBg,s["--sp-formula-bar-border"]=a.formulaBarBorder,s["--sp-formula-bar-label-color"]=a.formulaBarLabelText,s["--sp-formula-bar-label-bg"]=a.formulaBarLabelBg,s["--sp-formula-bar-label-border"]=a.formulaBarLabelBorder,s["--sp-formula-bar-input-bg"]=a.formulaBarInputBg,s["--sp-formula-bar-input-border"]=a.formulaBarInputBorder,s["--sp-formula-bar-input-color"]=a.formulaBarInputText,s["--sp-formula-bar-input-focus-border"]=a.formulaBarInputFocusBorder,s["--sp-formula-bar-input-focus-shadow"]=a.formulaBarInputFocusShadow,s["--sp-wrapper-bg"]=a.wrapperBg,s["--sp-cell-editor-border"]=a.cellEditorBorder,s["--sp-cell-editor-color"]=a.cellEditorText,s["--sp-cell-editor-bg"]=a.cellEditorBg,s["--sp-cell-editor-shadow"]=a.cellEditorShadow,s["--sp-tab-bar-bg"]=a.tabBarBg,s["--sp-tab-bar-border"]=a.tabBarBorder,s["--sp-tab-active-bg"]=a.tabActiveBg,s["--sp-tab-active-color"]=a.tabActiveText,s["--sp-tab-active-border"]=a.tabActiveBorder,s["--sp-tab-inactive-bg"]=a.tabInactiveBg,s["--sp-tab-inactive-color"]=a.tabInactiveText,s["--sp-tab-inactive-border"]=a.tabInactiveBorder,s["--sp-tab-hover-bg"]=a.tabHoverBg,s["--sp-tab-add-btn-color"]=a.tabAddBtnColor,s["--sp-tab-add-btn-hover-bg"]=a.tabAddBtnHoverBg,s["--sp-tab-scroll-btn-color"]=a.tabScrollBtnColor,s["--sp-tab-scroll-btn-hover-bg"]=a.tabScrollBtnHoverBg,s["--sp-scroll-thumb"]=a.scrollbarThumb,s["--sp-scroll-thumb-hover"]=a.scrollbarThumbHover,s["--sp-scroll-btn-bg"]=a.scrollBtnBg,s["--sp-scroll-btn-color"]=a.scrollBtnColor,s["--sp-scroll-btn-hover-bg"]=a.scrollBtnHoverBg,s["--sp-scroll-btn-active-bg"]=a.scrollBtnActiveBg,s["--sp-scroll-track-bg"]=a.scrollTrackBg,s["--sp-toolbar-bg"]=a.toolbarBg,s["--sp-toolbar-border"]=a.toolbarBorder,s["--sp-toolbar-btn-color"]=a.toolbarBtnColor,s["--sp-toolbar-btn-hover-bg"]=a.toolbarBtnHoverBg,s["--sp-toolbar-btn-disabled-color"]=a.toolbarBtnDisabledColor,s["--sp-toolbar-btn-active-color"]=a.toolbarBtnActiveColor,s}const Fn={class:"formula-bar"},In={class:"formula-bar__cell-label"},An=["value"],Vn=["value"],zn=["title"],On=["title"],Ln=["title"],Wn=["title"],$n={key:2,class:"sb-corner"},_n=["onClick","onMouseenter"],Gn={class:"context-menu__label"},Pn={key:0,class:"context-menu__arrow"},Un=["onClick"],Yn={class:"dim-panel__title"},Kn={class:"dim-panel__body"},Xn=["value"],jn={key:0,class:"dim-panel__error"},Zn={class:"dim-panel__footer"},qn="\0",Bo="#444",Co=Ye(e.defineComponent({__name:"spreader",props:e.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(a){const h=a,c=e.computed(()=>h.locale==="zh-CN"?"zh-CN":"en-US"),m=h.colCount,s=h.rowCount,C=e.useModel(a,"data");let D="";const v=e.reactive({}),F=new Mn,E=e.ref(null),g=e.ref({col:0,row:0}),H=e.ref(null),L=e.ref(""),M=e.ref(new Array(m).fill(100)),W=e.ref(new Array(s).fill(void 0)),x=e.ref(0),R=e.ref(0),A=(()=>{if(typeof window>"u")return 1;const t=window.devicePixelRatio||1;return t>1?Math.min(1.5,1+(t-1)*.25):1})();function G(t,o){var r;const l=(r=v[w(t,o)])==null?void 0:r.style;return typeof(l==null?void 0:l.fontSize)=="number"&&l.fontSize>0?l.fontSize:Fe}function z(t){return Math.round(t*A)}const J=e.computed(()=>{const t=[0];for(let o=0;o<m;o++)t.push(t[o]+M.value[o]);return t});function j(t){const o=W.value[t];if(o!=null&&o>0)return o;let l=Fe;for(let n=0;n<m;n++){const i=G(n,t);i>l&&(l=i)}const r=z(l);return Math.max(24,Math.round(r*1.2+8))}const Q=e.computed(()=>{const t=[0];for(let o=0;o<s;o++)t.push(t[o]+j(o));return t}),ke=e.computed(()=>J.value[m]),Ve=e.computed(()=>Q.value[s]);function N(t,o){g.value={col:t,row:o},E.value={startCol:t,startRow:o,endCol:t,endRow:o}}function V(t,o,l,r){g.value={col:t,row:o},E.value={startCol:Math.min(t,l),startRow:Math.min(o,r),endCol:Math.max(t,l),endRow:Math.max(o,r)}}function d(){V(0,0,m-1,s-1)}function p(t,o){const l=E.value;return l?t>=l.startCol&&t<=l.endCol&&o>=l.startRow&&o<=l.endRow:!1}function w(t,o){return`${t},${o}`}function I(t){Reflect.deleteProperty(v,t)}function Y(t,o){var l;return((l=v[w(t,o)])==null?void 0:l.value)??""}function ze(t,o){return ko(),Hn(t,o,v,m,s)}function ie(t,o,l){var u;const r=w(t,o);if(ko(),l===""||l==null){F.clear(r),I(r),F.markDirty(r);return}const n=String(l),i=((u=v[r])==null?void 0:u.style)??null;v[r]={value:n,style:i},n.startsWith("=")?F.set(r,wo(n.slice(1),m,s)):F.clear(r),F.markDirty(r)}function Te(t,o,l,r){for(let n=t;n<=o;n++)for(let i=l;i<=r;i++){const u=w(n,i);F.clear(u),I(u),F.markDirty(u)}}function He(t){H.value||(H.value={...g.value},L.value=t??Y(g.value.col,g.value.row))}function Re(){H.value&&($(),ie(H.value.col,H.value.row,L.value),H.value=null,L.value="")}function Oe(){H.value=null,L.value=""}function Ee(t,o){N(Math.max(0,Math.min(m-1,g.value.col+t)),Math.max(0,Math.min(s-1,g.value.row+o)))}function X(t,o){const l=Math.max(0,Z.w-52-11),r=Math.max(0,Z.h-24-11),n=J.value[t],i=Q.value[o],u=M.value[t],b=j(o);let k=x.value,T=R.value;n<k?k=n:n+u>k+l&&(k=n+u-l),i<T?T=i:i+b>T+r&&(T=i+b-r),ee(k,T)}function fe(t){const o=J.value;if(t<0||t>=o[m])return-1;let l=0,r=m-1;for(;l<r;){const n=l+r+1>>1;o[n]<=t?l=n:r=n-1}return l}function me(t){const o=Q.value;if(t<0||t>=o[s])return-1;let l=0,r=s-1;for(;l<r;){const n=l+r+1>>1;o[n]<=t?l=n:r=n-1}return l}const we=e.ref([]),at=e.ref([]);function xo(t){const o={};for(const[l,r]of Object.entries(t))o[l]={value:r.value,style:r.style};return o}function $t(){return je(),{sheets:_.value.map(t=>({id:t.id,name:t.name,cells:xo(t.cells),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]})),activeSheetIndex:ne.value}}function So(t){_.value=t.sheets.map(o=>({...o,cells:xo(o.cells)})),Ne(Math.max(0,Math.min(t.activeSheetIndex,_.value.length-1))),F.rebuild(v,m,s)}function $(){const t=$t(),o=we.value[we.value.length-1];o&&JSON.stringify(o)===JSON.stringify(t)||(we.value.push(t),at.value=[],we.value.length>50&&we.value.shift())}function Do(){we.value.length&&(at.value.push($t()),So(we.value.pop()),y(),e.nextTick(P))}function To(){at.value.length&&(we.value.push($t()),So(at.value.pop()),y(),e.nextTick(P))}const Jn=e.computed(()=>we.value.length>0),Qn=e.computed(()=>at.value.length>0),er=e.computed(()=>!!E.value),Le=e.ref(null);function tr(){var l;const t=E.value;if(!t)return;const o={};for(let r=t.startCol;r<=t.endCol;r++)for(let n=t.startRow;n<=t.endRow;n++)o[`${r-t.startCol},${n-t.startRow}`]=((l=v[w(r,n)])==null?void 0:l.style)??null;Le.value={styles:o}}function or(){var l;const t=Le.value,o=E.value;if(!(!t||!o)){$();for(let r=o.startCol;r<=o.endCol;r++)for(let n=o.startRow;n<=o.endRow;n++){const i=t.styles[`${r-o.startCol},${n-o.startRow}`]??null,u=w(r,n),b=((l=v[u])==null?void 0:l.value)??"";b===""&&i===null?I(u):v[u]={value:b,style:i}}Le.value=null,y(),P()}}function lr(){var o;const t=E.value;if(t){$();for(let l=t.startCol;l<=t.endCol;l++)for(let r=t.startRow;r<=t.endRow;r++){const n=w(l,r),i=((o=v[n])==null?void 0:o.value)??"";i===""?I(n):v[n]={value:i,style:null}}y(),P()}}const nr=e.computed(()=>ml.map(t=>({...t,label:t.value===""?B(c.value,"fontDefault"):t.label}))),rr=e.computed(()=>pl.map(t=>({...t,label:String(t.value)}))),ar=e.computed(()=>{var r;const t=E.value;if(!t)return"";let o,l=!1;for(let n=t.startCol;n<=t.endCol&&!l;n++)for(let i=t.startRow;i<=t.endRow&&!l;i++){const u=(r=v[w(n,i)])==null?void 0:r.style,b=typeof(u==null?void 0:u.fontFamily)=="string"?u.fontFamily:"";o===void 0?o=b:b!==o&&(l=!0)}return l?qn:o??""}),Be=e.computed(()=>{const t=E.value;if(!t)return Fe;let o,l=!1;for(let r=t.startCol;r<=t.endCol&&!l;r++)for(let n=t.startRow;n<=t.endRow&&!l;n++){const i=G(r,n);o===void 0?o=i:i!==o&&(l=!0)}return l?0:o??Fe});function le(t,o){var r,n;const l=E.value;if(l){$();for(let i=l.startCol;i<=l.endCol;i++)for(let u=l.startRow;u<=l.endRow;u++){const b=w(i,u),k=((r=v[b])==null?void 0:r.value)??"",T=(n=v[b])!=null&&n.style?{...v[b].style}:{};o===""||o===null||o===void 0||o===0?delete T[t]:T[t]=o;const ve=Object.keys(T).length?T:null;k===""&&ve===null?I(b):v[b]={value:k,style:ve}}y(),P()}}function ir(t){le("fontFamily",t===""?"":t)}function sr(t){le("fontSize",t),We.value=!1}const Me=e.ref(""),We=e.ref(!1);e.watch(Be,t=>{Me.value=t===0?"":String(t)},{immediate:!0});function cr(t){const o=t.target;Me.value=o.value.replace(/[^\d]/g,"")}function dr(){const t=Me.value.trim();if(!t){Me.value=Be.value===0?"":String(Be.value);return}let o=parseInt(t,10);isNaN(o)&&(o=Fe),o=Math.max(5,Math.min(72,o)),Me.value=String(o),o!==Be.value&&le("fontSize",o)}function ur(t){t.key==="Enter"&&t.target.blur()}function fr(t){We.value=!We.value}function mr(){const t=Be.value===0?Fe:Be.value,o=Math.min(72,t+1);le("fontSize",o),Me.value=String(o),We.value=!1}function pr(){const t=Be.value===0?Fe:Be.value,o=Math.max(5,t-1);le("fontSize",o),Me.value=String(o),We.value=!1}function bt(t){var n;const o=E.value;if(!o)return!1;let l,r=!1;for(let i=o.startCol;i<=o.endCol&&!r;i++)for(let u=o.startRow;u<=o.endRow&&!r;u++){const b=(n=v[w(i,u)])==null?void 0:n.style,k=!!(b!=null&&b[t]);l===void 0?l=k:k!==l&&(r=!0)}return!r&&l===!0}const Ho=e.computed(()=>bt("fontWeight")),Ro=e.computed(()=>bt("fontStyle")),Mo=e.computed(()=>bt("underline")),No=e.computed(()=>bt("strikethrough"));function br(){le("fontWeight",Ho.value?"":"bold")}function hr(){le("fontStyle",Ro.value?"":"italic")}function vr(){le("underline",Mo.value?"":"underline")}function gr(){le("strikethrough",No.value?"":"line-through")}const ht=e.ref(""),vt=e.ref(""),_t=e.ref(!1),Gt=e.ref(!1);function yr(t){Fo.value=t,t&&(_t.value=!1,Gt.value=!1)}function kr(t){ht.value=t,le("color",t===""?"":t)}function Er(t){vt.value=t,le("backgroundColor",t===""?"":t)}function wr(){le("color",ht.value===""?"":ht.value)}function Br(){le("backgroundColor",vt.value===""?"":vt.value)}const Cr=e.computed(()=>{var r;const t=E.value;if(!t)return"";let o,l=!1;for(let n=t.startCol;n<=t.endCol&&!l;n++)for(let i=t.startRow;i<=t.endRow&&!l;i++){const u=(r=v[w(n,i)])==null?void 0:r.style,b=typeof(u==null?void 0:u.color)=="string"?u.color:"";o===void 0?o=b:b!==o&&(l=!0)}return l?"":o??""}),xr=e.computed(()=>{var r;const t=E.value;if(!t)return"";let o,l=!1;for(let n=t.startCol;n<=t.endCol&&!l;n++)for(let i=t.startRow;i<=t.endRow&&!l;i++){const u=(r=v[w(n,i)])==null?void 0:r.style,b=typeof(u==null?void 0:u.backgroundColor)=="string"?u.backgroundColor:"";o===void 0?o=b:b!==o&&(l=!0)}return l?"":o??""}),Pt=e.ref("none"),Fo=e.ref(!1);function Sr(t,o,l,r){const n=l===r.startRow,i=l===r.endRow,u=o===r.startCol,b=o===r.endCol,k={top:0,bottom:0,left:0,right:0};switch(t){case"none":return k;case"bottom":i&&(k.bottom=1);break;case"top":n&&(k.top=1);break;case"left":u&&(k.left=1);break;case"right":b&&(k.right=1);break;case"all":k.top=1,k.bottom=1,k.left=1,k.right=1;break;case"outer":n&&(k.top=1),i&&(k.bottom=1),u&&(k.left=1),b&&(k.right=1);break;case"thickOuter":n&&(k.top=2),i&&(k.bottom=2),u&&(k.left=2),b&&(k.right=2);break}return k}function Io(t){Pt.value=t;const o=E.value;if(o){if($(),t==="none")for(let l=o.startCol;l<=o.endCol;l++)for(let r=o.startRow;r<=o.endRow;r++)Ao(l,r,{top:0,bottom:0,left:0,right:0},!0);else for(let l=o.startCol;l<=o.endCol;l++)for(let r=o.startRow;r<=o.endRow;r++){const n=Sr(t,l,r,o);Ao(l,r,n,!1)}y(),P()}}function Ao(t,o,l,r=!0){var ge,Pe;const n=w(t,o),i=((ge=v[n])==null?void 0:ge.value)??"",u=(Pe=v[n])!=null&&Pe.style?{...v[n].style}:{},b=["Top","Bottom","Left","Right"],k=[l.top,l.bottom,l.left,l.right];for(let te=0;te<4;te++){const Ue=`border${b[te]}Width`;k[te]===0?r&&delete u[Ue]:(u[Ue]=k[te],u.borderColor=Bo)}b.some(te=>u[`border${te}Width`]!==void 0)||delete u.borderColor;const ve=Object.keys(u).length?u:null;i===""&&ve===null?I(n):v[n]={value:i,style:ve}}function Dr(){Io(Pt.value)}function Vo(t,o,l){var n;const r=(n=v[w(t,o)])==null?void 0:n.style;return(r==null?void 0:r[`border${l}Width`])||0}let zo=null;function gt(){const t=E.value;if(!t)return;zo={...t};const o=[];for(let l=t.startRow;l<=t.endRow;l++){const r=[];for(let n=t.startCol;n<=t.endCol;n++)r.push(Y(n,l));o.push(r.join(" "))}Wt(o.join(`
2
- `))}function yt(){const t=E.value;if(t){if(t.startCol===0&&t.endCol===m-1){const o=[];for(let l=t.startRow;l<=t.endRow;l++){const r=[];for(let n=0;n<m;n++)r.push(Y(n,l));o.push(r.join(" "))}Wt(o.join(`
3
- `))}else if(t.startRow===0&&t.endRow===s-1){const o=[];for(let l=0;l<s;l++){const r=[];for(let n=t.startCol;n<=t.endCol;n++)r.push(Y(n,l));o.push(r.join(" "))}Wt(o.join(`
4
- `))}}}async function it(){let t="";try{t=await navigator.clipboard.readText()}catch{return}if(!t&&t!=="")return;const o=t.split(/\r?\n/),l=g.value,r=zo;for(let n=0;n<o.length;n++){const i=o[n].split(" ");for(let u=0;u<i.length;u++){const b=l.col+u,k=l.row+n;if(b<m&&k<s){let T=i[u];T.startsWith("=")&&r&&(T=Rn(T,b-(r.startCol+u),k-(r.startRow+n),m,s,ue)),ie(b,k,T)}}}}function Ut(){if(gt(),E.value){const t=E.value;Te(t.startCol,t.endCol,t.startRow,t.endRow),y()}}function Yt(){if(E.value){const t=E.value;Te(t.startCol,t.endCol,t.startRow,t.endRow),y()}}function Tr(){const t=E.value;if(!t)return;$();const o=t.startCol,l=t.startRow,r=t.endCol,n=t.endRow;if(l===n)if(r+1<m){const i=`${ue(o)}${l+1}:${ue(r)}${l+1}`;ie(r+1,l,`=SUM(${i})`)}else{const i=`${ue(o)}${l+1}:${ue(r-1)}${l+1}`;ie(r,l,`=SUM(${i})`)}else for(let i=o;i<=r;i++)if(n+1<s){const u=`${ue(i)}${l+1}:${ue(i)}${n+1}`;ie(i,n+1,`=SUM(${u})`)}else{const u=`${ue(i)}${l+1}:${ue(i)}${n}`;ie(i,n,`=SUM(${u})`)}y(),P()}function Hr(t,o){const l=o-t+1;for(let r=t;r<=o;r++)for(let n=0;n<m;n++)I(w(n,r));for(let r=t;r<s-l;r++){for(let n=0;n<m;n++){const i=w(n,r+l),u=w(n,r);v[i]?(v[u]=v[i],I(i)):I(u)}W.value[r]=W.value[r+l]}for(let r=s-l;r<s;r++){for(let n=0;n<m;n++)I(w(n,r));W.value[r]=void 0}}function Rr(t,o){const l=o-t+1;if(!(o>=s-1)){for(let r=s-1;r>o;r--){for(let n=0;n<m;n++){const i=w(n,r-l),u=w(n,r);v[i]?v[u]=v[i]:I(u)}W.value[r]=W.value[r-l]}for(let r=o+1;r<=o+l;r++){for(let n=0;n<m;n++)I(w(n,r));W.value[r]=void 0}}}function Mr(t,o){const l=o-t+1;if(!(o>=m-1)){for(let r=m-1;r>o;r--){for(let n=0;n<s;n++){const i=w(r-l,n),u=w(r,n);v[i]?v[u]=v[i]:I(u)}M.value[r]=M.value[r-l]}for(let r=o+1;r<=o+l;r++){for(let n=0;n<s;n++)I(w(r,n));M.value[r]=100}}}function Nr(t,o){const l=o-t+1;for(let r=t;r<=o;r++)for(let n=0;n<s;n++)I(w(r,n));for(let r=t;r<m-l;r++){for(let n=0;n<s;n++){const i=w(r+l,n),u=w(r,n);v[i]?(v[u]=v[i],I(i)):I(u)}M.value[r]=M.value[r+l]}for(let r=m-l;r<m;r++){for(let n=0;n<s;n++)I(w(r,n));M.value[r]=100}}let Oo=0;function Lo(){return Oo++,`s_${Oo}`}function kt(t){return{id:Lo(),name:t,cells:{},selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:new Array(m).fill(100),rowHeights:new Array(s).fill(void 0)}}const _=e.ref([kt("Sheet1")]),ne=e.ref(0);function je(){const t=_.value[ne.value];t&&(t.cells={...v},t.selection=E.value?{...E.value}:null,t.activeCell={...g.value},t.scrollX=x.value,t.scrollY=R.value,t.colWidths=[...M.value],t.rowHeights=[...W.value])}function Ne(t){const o=_.value[t];o&&(Object.keys(v).forEach(l=>I(l)),Object.assign(v,o.cells),E.value=o.selection?{...o.selection}:null,g.value={...o.activeCell},x.value=o.scrollX,R.value=o.scrollY,M.value=[...o.colWidths],W.value=[...o.rowHeights],ne.value=t)}function Fr(t){t===ne.value||t<0||t>=_.value.length||(Oe(),je(),Ne(t))}function Kt(t){return $(),Oe(),je(),_.value.push(kt(`Sheet${_.value.length+1}`)),Ne(_.value.length-1),_.value.length-1}function Ir(t){return _.value.length<=1||($(),Oe(),_.value.splice(t,1),Ne(Math.min(t,_.value.length-1))),ne.value}function Ar(t,o){_.value[t]&&o.trim()&&($(),_.value[t].name=o.trim())}function Vr(t){$(),Oe(),je();const o=_.value[t];if(!o)return t;let l=o.name;const r=l.match(/^(.*?)\s*\((\d+)\)$/);let n=r?parseInt(r[2],10)+1:2;r&&(l=r[1]);let i=`${l} (${n})`;const u=new Set(_.value.map(k=>k.name));for(;u.has(i);)n++,i=`${l} (${n})`;const b={id:Lo(),name:i,cells:{...o.cells},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 _.value.splice(t+1,0,b),Ne(t+1),t+1}function Wo(t,o){const l=t+o;if(l<0||l>=_.value.length)return;$();const r=ne.value,n=_.value.splice(t,1)[0];_.value.splice(l,0,n),r===t?ne.value=l:t<r&&l>=r?ne.value=r-1:t>r&&l<=r&&(ne.value=r+1),y()}const zr=e.computed(()=>_.value.length);function P(){je();const t=_.value.map(l=>{const r={};for(const[b,k]of Object.entries(l.cells))r[b]={value:k.value},k.style&&(r[b].style=k.style);const n={name:l.name,cells:r},i={};for(let b=0;b<l.colWidths.length;b++)l.colWidths[b]!==100&&(i[b]=l.colWidths[b]);Object.keys(i).length&&(n.colWidths=i);const u={};for(let b=0;b<l.rowHeights.length;b++){const k=l.rowHeights[b];k!=null&&(u[b]=k)}return Object.keys(u).length&&(n.rowHeights=u),n}),o=JSON.stringify(t);o!==D&&(D=o,C.value=t)}let Xt=!1;function $o(){Xt||(Xt=!0,Promise.resolve().then(()=>{Xt=!1,P()}))}const _o=e.computed(()=>h.theme==="dark"?hl:bl),Or=e.computed(()=>Nn(_o.value,h.width,h.height,Ie)),$e=e.ref(null),pe=e.ref(null),jt=e.ref(null),Zt=e.ref(null),Z=e.reactive({w:800,h:600}),Ze=e.computed(()=>Math.max(0,ke.value-Math.max(0,Z.w-52-11))),qe=e.computed(()=>Math.max(0,Ve.value-Math.max(0,Z.h-24-11)));function ee(t,o){const l=Math.max(0,Z.w-52-11),r=Math.max(0,Z.h-24-11);x.value=Math.max(0,Math.min(t??x.value,Math.max(0,ke.value-l))),R.value=Math.max(0,Math.min(o??R.value,Math.max(0,Ve.value-r)))}function Lr(){var t;return typeof window>"u"?!1:!((t=window.matchMedia)!=null&&t.call(window,"(hover: none) and (pointer: coarse)").matches)}function re(t=!1){e.nextTick(()=>{const o=jt.value;if(o){if(!H.value&&!Lr()){document.activeElement===o&&o.blur();return}o.focus({preventScroll:!0}),t&&o.select()}})}function Wr(){re()}let qt=!1,f=null,st=1;function y(){qt||(qt=!0,requestAnimationFrame(()=>{qt=!1,$r()}))}function $r(){var al,il,sl;const t=pe.value;if(!t)return;const o=$e.value;if(!o||(f=t.getContext("2d"),!f))return;st=window.devicePixelRatio||1;const l=o.getBoundingClientRect(),r=l.width,n=l.height;Z.w=r,Z.h=n,t.width=r*st,t.height=n*st,t.style.width=r+"px",t.style.height=n+"px",f.setTransform(st,0,0,st,0,0);const i=x.value,u=R.value,b=52,k=24,T=_o.value,ve=J.value,ge=Q.value,Pe=M.value,te=[];for(let S=0;S<s;S++)te[S]=ge[S+1]-ge[S];const Ue=Math.max(0,fe(i));let nl=Ue;for(let S=Ue;S<m&&!(b+ve[S]-i>=r);S++)nl=S;const mo=nl,Rt=Math.max(0,me(u));let rl=Rt;for(let S=Rt;S<s&&!(k+ge[S]-u>=n);S++)rl=S;const po=rl;f.fillStyle=T.bg,f.fillRect(0,0,r,n),f.fillStyle=T.gridBg,f.fillRect(b,k,r-b,n-k),f.save(),f.beginPath(),f.rect(b+.5,k+.5,r-b-1,n-k-1),f.clip();const ce=E.value,bo=H.value;for(let S=Rt;S<=po;S++)for(let O=Ue;O<=mo;O++){const U=b+ve[O]-i,oe=k+ge[S]-u,xe=Pe[O],ye=te[S];if(U+xe<b||oe+ye<k||U>r||oe>n)continue;p(O,S)&&(f.fillStyle=T.selectionBg,f.fillRect(U,oe,xe,ye)),g.value.col===O&&g.value.row===S&&(f.strokeStyle=T.activeCellBorder,f.lineWidth=2,f.strokeRect(U+1,oe+1,xe-2,ye-2)),f.strokeStyle=T.gridLine,f.lineWidth=.5,f.strokeRect(U+.25,oe+.25,xe-.5,ye-.5);const Mt=(al=v[w(O,S)])==null?void 0:al.style,cl=typeof(Mt==null?void 0:Mt.backgroundColor)=="string"?Mt.backgroundColor:"";if(cl&&(f.fillStyle=cl,f.fillRect(U,oe,xe,ye)),!(bo&&bo.col===O&&bo.row===S)){const q=ze(O,S);if(q){const K=(il=v[w(O,S)])==null?void 0:il.style,dl=z(G(O,S)),Na=typeof(K==null?void 0:K.fontFamily)=="string"&&K.fontFamily?K.fontFamily:vo,Fa=(K==null?void 0:K.fontWeight)==="bold"?"bold":"normal",Ia=(K==null?void 0:K.fontStyle)==="italic"?"italic":"normal",Aa=(K==null?void 0:K.underline)==="underline",Va=(K==null?void 0:K.strikethrough)==="line-through",ho=typeof(K==null?void 0:K.color)=="string"?K.color:"";f.fillStyle=ho||T.cellText,f.font=`${Ia} ${Fa} ${dl}px ${Na}`,f.textBaseline="alphabetic",f.save(),f.beginPath(),f.rect(U+5,oe+1,xe-10,ye-2),f.clip();const Se=f.measureText(q),za=(Se.actualBoundingBoxAscent-Se.actualBoundingBoxDescent)/2,ft=U+5,Vt=oe+ye/2+za;if(f.fillText(q,ft,Vt),Aa){const mt=Se.actualBoundingBoxLeft??0,zt=Se.actualBoundingBoxDescent??0;f.strokeStyle=ho||T.cellText,f.lineWidth=1,f.beginPath(),f.moveTo(ft+mt,Vt+zt+1),f.lineTo(ft+mt+Se.width,Vt+zt+1),f.stroke()}if(Va){const mt=Se.actualBoundingBoxLeft??0,zt=Se.actualBoundingBoxDescent??0,Oa=Se.actualBoundingBoxAscent??dl;f.strokeStyle=ho||T.cellText,f.lineWidth=1;const ul=Vt-(Oa-zt)*.25;f.beginPath(),f.moveTo(ft+mt,ul),f.lineTo(ft+mt+Se.width,ul),f.stroke()}f.restore()}}const de=(sl=v[w(O,S)])==null?void 0:sl.style,Ra=(de==null?void 0:de.borderTopWidth)||0,Ma=(de==null?void 0:de.borderLeftWidth)||0,Nt=(de==null?void 0:de.borderBottomWidth)||0,Ft=(de==null?void 0:de.borderRightWidth)||0,It=Math.max(Ra,Vo(O,S-1,"Bottom")),At=Math.max(Ma,Vo(O-1,S,"Right"));if(It>0||At>0||Nt>0||Ft>0){if(f.strokeStyle=Bo,It>0){f.lineWidth=It,f.beginPath();const q=oe+It/2-.5;f.moveTo(U,q),f.lineTo(U+xe,q),f.stroke()}if(At>0){f.lineWidth=At,f.beginPath();const q=U+At/2-.5;f.moveTo(q,oe),f.lineTo(q,oe+ye),f.stroke()}if(S===po&&Nt>0){f.lineWidth=Nt,f.beginPath();const q=oe+ye-Nt/2+.5;f.moveTo(U,q),f.lineTo(U+xe,q),f.stroke()}if(O===mo&&Ft>0){f.lineWidth=Ft,f.beginPath();const q=U+xe-Ft/2+.5;f.moveTo(q,oe),f.lineTo(q,oe+ye),f.stroke()}}}f.restore(),f.fillStyle=T.headerBg,f.fillRect(b,0,r-b,k);for(let S=Ue;S<=mo;S++){const O=b+ve[S]-i,U=Pe[S];O+U<b||O>r||(ce&&S>=ce.startCol&&S<=ce.endCol&&(f.fillStyle=T.selectionBg,f.fillRect(O,0,U,k)),f.strokeStyle=T.headerBorder,f.lineWidth=.5,f.strokeRect(O+.25,.25,U-.5,k-.5),ce&&S>=ce.startCol&&S<=ce.endCol&&(f.strokeStyle=T.activeCellBorder,f.lineWidth=2,f.beginPath(),f.moveTo(O,k-1),f.lineTo(O+U,k-1),f.stroke()),f.fillStyle=T.headerText,f.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',f.textAlign="center",f.textBaseline="middle",f.fillText(ue(S),O+U/2,k/2))}f.strokeStyle=T.headerSep,f.lineWidth=1,f.beginPath(),f.moveTo(b,k+.5),f.lineTo(r,k+.5),f.stroke(),f.fillStyle=T.headerBg,f.fillRect(0,k,b,n-k);for(let S=Rt;S<=po;S++){const O=k+ge[S]-u,U=te[S];O+U<k||O>n||(ce&&S>=ce.startRow&&S<=ce.endRow&&(f.fillStyle=T.selectionBg,f.fillRect(0,O,b,U)),f.strokeStyle=T.headerBorder,f.lineWidth=.5,f.strokeRect(.25,O+.25,b-.5,U-.5),ce&&S>=ce.startRow&&S<=ce.endRow&&(f.strokeStyle=T.activeCellBorder,f.lineWidth=2,f.beginPath(),f.moveTo(b-1,O),f.lineTo(b-1,O+U),f.stroke()),f.fillStyle=T.headerText,f.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',f.textAlign="center",f.textBaseline="middle",f.fillText(String(S+1),b/2,O+U/2+.5))}f.strokeStyle=T.headerSep,f.lineWidth=1,f.beginPath(),f.moveTo(b+.5,k),f.lineTo(b+.5,n),f.stroke(),f.fillStyle=T.headerBg,f.fillRect(0,0,b,k),f.strokeStyle=T.headerSep,f.lineWidth=1,f.strokeRect(.5,.5,b-.5,k-.5)}const _r=e.computed(()=>ue(g.value.col)+String(g.value.row+1)),Gr=e.computed(()=>H.value?L.value:Y(g.value.col,g.value.row));function Pr(){H.value||(X(g.value.col,g.value.row),L.value=Y(g.value.col,g.value.row),He(),y())}function Ur(t){L.value=t.target.value}function Yr(t){var o,l;t.key==="Enter"?(t.preventDefault(),Re(),Ee(0,1),X(g.value.col,g.value.row),(o=Zt.value)==null||o.blur(),y(),re()):t.key==="Escape"&&(t.preventDefault(),Oe(),(l=Zt.value)==null||l.blur(),y(),re())}function Kr(){setTimeout(()=>{H.value&&(Re(),y())},0)}const _e=e.ref(null),Je=e.ref("");function Xr(t){_e.value===null&&(Fr(t),y())}function Go(t){t!==ne.value&&(je(),Ne(t),y()),_e.value=t,Je.value=_.value[t].name,e.nextTick(()=>{const o=document.querySelector(".tab-rename-input");o==null||o.focus(),o==null||o.select()})}function Po(){_e.value!==null&&(Ar(_e.value,Je.value),e.nextTick(P)),_e.value=null,Je.value=""}function jr(){_e.value=null,Je.value=""}function Zr(t){t.key==="Enter"?(t.preventDefault(),Po()):t.key==="Escape"&&(t.preventDefault(),jr())}const Ce=e.ref(null);let ct=null;function Uo(){ct&&(document.removeEventListener("click",ct),ct=null)}function Qe(t,o,l){Uo();const r=140,n=l.length*28+8,i=window.innerWidth,u=window.innerHeight;t+r>i&&(t-=r),o+n>u&&(o-=n),Ce.value={x:t,y:o,items:l},ct=()=>{Ce.value=null,Uo()},setTimeout(()=>document.addEventListener("click",ct,{once:!0}),0)}const Et=e.ref(!1);function qr(t,o){if(!o.children){Et.value=!1;return}const r=t.currentTarget.querySelector(".context-submenu");if(!r){Et.value=!1;return}const n=r.getBoundingClientRect();Et.value=n.right>window.innerWidth}function Jr(t,o){t.preventDefault(),t.stopPropagation(),Qe(t.clientX,t.clientY,[{label:B(c.value,"insert"),action:()=>{Kt(),y()}},{label:B(c.value,"copy"),action:()=>{Vr(o)}},{label:B(c.value,"rename"),action:()=>{Go(o)}},{label:B(c.value,"delete"),action:()=>{Ir(o),y()},disabled:zr.value<=1},{label:B(c.value,"moveSheetLeft"),action:()=>{Wo(o,-1)},disabled:o===0},{label:B(c.value,"moveSheetRight"),action:()=>{Wo(o,1)},disabled:o===_.value.length-1}])}function Qr(t){t.preventDefault(),!(t.target.closest(".tab-item")||t.target.closest(".tab-bar__add-btn"))&&Qe(t.clientX,t.clientY,[{label:B(c.value,"insert"),action:()=>{Kt(),y()}}])}function ea(t){t.preventDefault(),d(),y(),Qe(t.clientX,t.clientY,[{label:B(c.value,"cut"),action:()=>{Ut(),P()}},{label:B(c.value,"copy"),action:()=>gt()},{label:B(c.value,"paste"),action:()=>{$(),it().then(()=>{y(),e.nextTick(P)})}},{label:B(c.value,"delete"),action:()=>{$(),Yt();for(let o=0;o<m;o++)M.value[o]=100;for(let o=0;o<s;o++)W.value[o]=void 0;y(),P()}}])}function ta(t,o){t.preventDefault();const l=t.clientX,r=t.clientY,n=E.value;n&&n.startCol===0&&n.endCol===m-1&&o>=n.startRow&&o<=n.endRow||(V(0,o,m-1,o),y());const i=E.value;Qe(t.clientX,t.clientY,[{label:B(c.value,"insert"),action:()=>{$(),Rr(i.startRow,i.endRow),y(),P()},disabled:i.endRow>=s-1},{label:B(c.value,"cut"),action:()=>{$(),yt();for(let u=i.startRow;u<=i.endRow;u++)for(let b=0;b<m;b++)I(w(b,u));y(),P()}},{label:B(c.value,"copy"),action:()=>yt()},{label:B(c.value,"paste"),action:()=>{$(),it().then(()=>{y(),e.nextTick(P)})}},{label:B(c.value,"delete"),action:()=>{$(),Hr(i.startRow,i.endRow),y(),P()}},{label:`${B(c.value,"rowHeight")}...`,action:()=>Xo("row",l,r)},{label:B(c.value,"defaultRowHeight"),action:()=>aa()}])}function oa(t,o){t.preventDefault();const l=t.clientX,r=t.clientY,n=E.value;n&&n.startRow===0&&n.endRow===s-1&&o>=n.startCol&&o<=n.endCol||(V(o,0,o,s-1),y());const i=E.value;Qe(t.clientX,t.clientY,[{label:B(c.value,"insert"),action:()=>{$(),Mr(i.startCol,i.endCol),y(),P()},disabled:i.endCol>=m-1},{label:B(c.value,"cut"),action:()=>{$(),yt();for(let u=i.startCol;u<=i.endCol;u++)for(let b=0;b<s;b++)I(w(u,b));y(),P()}},{label:B(c.value,"copy"),action:()=>yt()},{label:B(c.value,"paste"),action:()=>{$(),it().then(()=>{y(),e.nextTick(P)})}},{label:B(c.value,"delete"),action:()=>{$(),Nr(i.startCol,i.endCol),y(),P()}},{label:`${B(c.value,"colWidth")}...`,action:()=>Xo("col",l,r)},{label:B(c.value,"defaultColWidth"),action:()=>ia()}])}function la(t,o,l){t.preventDefault(),p(o,l)||(N(o,l),y());const r=E.value,n=!!(r&&r.startCol===r.endCol&&r.startRow===r.endRow);Qe(t.clientX,t.clientY,[{label:B(c.value,"cut"),action:()=>{Ut(),P()}},{label:B(c.value,"copy"),action:()=>gt()},{label:B(c.value,"paste"),action:()=>{$(),it().then(()=>{y(),e.nextTick(P)})}},{label:B(c.value,"delete"),action:()=>{$(),Yt(),y(),P()}},{label:B(c.value,"calculate"),children:[{label:B(c.value,"sum"),action:Tr,disabled:n}]}])}const Yo=e.ref(null),ae=e.ref(null);let dt=null;function Ko(){dt&&(document.removeEventListener("mousedown",dt),dt=null)}function Xo(t,o,l){Ko();const r=E.value;let n="";if(r){const T=t==="row"?j(r.startRow):M.value[r.startCol];n=T!=null&&T>0?String(Math.round(T)):""}const i=220,u=118;let b=o,k=l;b+i>window.innerWidth&&(b=window.innerWidth-i-8),k+u>window.innerHeight&&(k=window.innerHeight-u-8),b<8&&(b=8),k<8&&(k=8),ae.value={type:t,x:b,y:k,value:n,error:""},dt=()=>{ae.value=null},setTimeout(()=>document.addEventListener("mousedown",dt,{once:!0}),0),e.nextTick(()=>{const T=Yo.value;T&&(T.focus(),T.select())})}function na(t){const o=ae.value;if(!o)return;const l=t.target,r=l.value,n=r.replace(/[^\d]/g,"");o.value=n,r!==n&&(l.value=n),o.error=""}function ra(t){t.key==="Enter"?(t.preventDefault(),jo()):t.key==="Escape"&&Jt()}function jo(){const t=ae.value,o=E.value;if(!t||!o)return;const l=t.value.trim(),r=Number(l),n=t.type==="row",i=n?24:30,u=n?500:1e3;if(l===""||!Number.isFinite(r)){t.error=B(c.value,"dimNumberError");return}if(r<i||r>u){t.error=B(c.value,"dimRangeError").replace("{min}",String(i)).replace("{max}",String(u));return}const b=r;if($(),n)for(let k=o.startRow;k<=o.endRow;k++)W.value[k]=b;else for(let k=o.startCol;k<=o.endCol;k++)M.value[k]=b;y(),P(),Jt()}function Jt(){Ko(),ae.value=null}function aa(){const t=E.value;if(t){$();for(let o=t.startRow;o<=t.endRow;o++)W.value[o]=void 0;y(),P()}}function ia(){const t=E.value;if(t){$();for(let o=t.startCol;o<=t.endCol;o++)M.value[o]=100;y(),P()}}const sa=e.computed(()=>{var te;const t=!H.value,o=H.value??g.value,l=o.col,r=o.row,n=(te=v[w(l,r)])==null?void 0:te.style,i=z(G(l,r)),u=typeof(n==null?void 0:n.fontFamily)=="string"&&n.fontFamily?n.fontFamily:vo,b=(n==null?void 0:n.fontWeight)==="bold"?"bold":"normal",k=(n==null?void 0:n.fontStyle)==="italic"?"italic":"normal",T=(n==null?void 0:n.underline)==="underline"?"underline":(n==null?void 0:n.strikethrough)==="line-through"?"line-through":"none",ve=(n==null?void 0:n.underline)==="underline"&&(n==null?void 0:n.strikethrough)==="line-through"?"underline line-through":T,ge=typeof(n==null?void 0:n.color)=="string"?n.color:void 0,Pe=typeof(n==null?void 0:n.backgroundColor)=="string"?n.backgroundColor:void 0;return{left:`${52+J.value[l]-x.value}px`,top:`${24+Q.value[r]-R.value}px`,width:`${M.value[l]}px`,height:`${j(r)}px`,fontFamily:u,fontSize:`${i}px`,fontWeight:b,fontStyle:k,textDecoration:ve,opacity:t?0:1,pointerEvents:t?"none":"auto",color:t?"transparent":ge,caretColor:t?"transparent":void 0,borderColor:t?"transparent":void 0,background:t?"transparent":Pe,boxShadow:t?"none":void 0}}),ca=e.computed(()=>Math.max(0,Z.w-52-11)),da=e.computed(()=>Math.max(0,Z.h-24-11)),wt=e.computed(()=>Math.max(0,ca.value-11*2)),Bt=e.computed(()=>Math.max(0,da.value-11*2));function Qt(){return Math.max(0,Z.w-52-11)}function eo(){return Math.max(0,Z.h-24-11)}const Ct=e.computed(()=>Ze.value<=0?wt.value:Math.max(24,Qt()/ke.value*wt.value)),to=e.computed(()=>Ze.value<=0?0:x.value/Ze.value*(wt.value-Ct.value)),xt=e.computed(()=>qe.value<=0?Bt.value:Math.max(24,eo()/Ve.value*Bt.value)),oo=e.computed(()=>qe.value<=0?0:R.value/qe.value*(Bt.value-xt.value));let Ge=null,St=0,Dt=0;function ua(t){t.preventDefault(),Ge="v",St=t.clientY,Dt=R.value,document.addEventListener("mousemove",lo),document.addEventListener("mouseup",no)}function fa(t){t.preventDefault(),Ge="h",St=t.clientX,Dt=x.value,document.addEventListener("mousemove",lo),document.addEventListener("mouseup",no)}function lo(t){if(Ge==="v"){const l=(t.clientY-St)/(Bt.value-xt.value);ee(null,Dt+l*qe.value),y()}else if(Ge==="h"){const l=(t.clientX-St)/(wt.value-Ct.value);ee(Dt+l*Ze.value,null),y()}}function no(){Ge=null,document.removeEventListener("mousemove",lo),document.removeEventListener("mouseup",no)}function ma(t){if(Ge)return;const o=t.currentTarget.getBoundingClientRect(),l=t.clientY-o.top;l<oo.value?ee(null,R.value-eo()):l>oo.value+xt.value&&ee(null,R.value+eo()),y()}function pa(t){if(Ge)return;const o=t.currentTarget.getBoundingClientRect(),l=t.clientX-o.left;l<to.value?ee(x.value-Qt(),null):l>to.value+Ct.value&&ee(x.value+Qt(),null),y()}let et=!1,be=0,he=0,tt=!1,ot=!1,Zo=0,qo=0,lt=0,Tt=0,ro=0,ao=0,Jo=0,Qo=0,ut=!1,io=!1,nt=0,rt=0,so=0,el=-1,tl=-1;function ba(t){if(t.button!==0)return;t.preventDefault(),Ce.value=null;const o=Ae(t,pe.value);if(o.y<24&&o.x>=52){const n=o.x-52+x.value,i=fe(n);if(i>=0&&Math.abs(o.x-(52+J.value[i+1]-x.value))<=4){$(),tt=!0,Zo=i,lt=M.value[i],Tt=n,y();return}}if(o.x<52&&o.y>=24){const n=o.y-24+R.value,i=me(n);if(i>=0&&Math.abs(o.y-(24+Q.value[i+1]-R.value))<=4){$(),ot=!0,qo=i,lt=j(i),Tt=n,y();return}}if(o.x<52||o.y<24){if(Re(),o.y<24&&o.x>=52){const n=fe(o.x-52+x.value);n>=0&&(V(n,0,n,s-1),et=!0,be=n,he=0)}else if(o.x<52&&o.y>=24){const n=me(o.y-24+R.value);n>=0&&(V(0,n,m-1,n),et=!0,be=0,he=n)}else o.x<52&&o.y<24&&d();y();return}const l=fe(o.x-52+x.value),r=me(o.y-24+R.value);if(!(l<0||r<0)){if(Re(),t.shiftKey&&E.value){const n=E.value;V(n.startCol,n.startRow,l,r)}else N(l,r);et=!0,be=l,he=r,re(),y()}}function ha(t){if(tt){const i=Ae(t,pe.value).x-52+x.value-Tt;lt+i>=30&&(M.value[Zo]=lt+i),y();return}if(ot){const i=Ae(t,pe.value).y-24+R.value-Tt;lt+i>=24&&(W.value[qo]=lt+i),y();return}if(!et){const n=pe.value;if(!n)return;if(Le.value){n.style.cursor="copy";return}const i=Ae(t,n);if(i.y<24&&i.x>=52){const u=fe(i.x-52+x.value);if(u>=0&&Math.abs(i.x-(52+J.value[u+1]-x.value))<=4){n.style.cursor="col-resize";return}}if(i.x<52&&i.y>=24){const u=me(i.y-24+R.value);if(u>=0&&Math.abs(i.y-(24+Q.value[u+1]-R.value))<=4){n.style.cursor="row-resize";return}}n.style.cursor="cell";return}const o=Ae(t,pe.value);if(be<0||he<0)return;if(o.x<52||o.y<24){if(o.y<24&&o.x>=52){const n=fe(o.x-52+x.value);n>=0&&V(Math.min(be,n),0,Math.max(be,n),s-1)}else if(o.x<52&&o.y>=24){const n=me(o.y-24+R.value);n>=0&&V(0,Math.min(he,n),m-1,Math.max(he,n))}y();return}const l=fe(o.x-52+x.value),r=me(o.y-24+R.value);l<0||r<0||(he===0&&be>=0&&E.value&&E.value.startRow===0&&E.value.endRow===s-1?V(Math.min(be,l),0,Math.max(be,l),s-1):be===0&&he>=0&&E.value&&E.value.startCol===0&&E.value.endCol===m-1?V(0,Math.min(he,r),m-1,Math.max(he,r)):V(be,he,l,r),y())}function va(t){const o=tt||ot;et=!1,tt=!1,ot=!1,o&&$o(),Le.value&&or()}function ga(){const t=tt||ot;et=!1,tt=!1,ot=!1,t&&$o()}function ya(t){t.preventDefault();const o=Ae(t,pe.value);if(o.x<52&&o.y<24){ea(t);return}if(o.y<24&&o.x>=52){const l=fe(o.x-52+x.value);l>=0&&oa(t,l);return}if(o.x<52&&o.y>=24){const l=me(o.y-24+R.value);l>=0&&ta(t,l);return}if(o.x>=52&&o.y>=24){const l=fe(o.x-52+x.value),r=me(o.y-24+R.value);l>=0&&r>=0&&la(t,l,r)}}function ka(t){const o=Ae(t,pe.value);if(o.x<52||o.y<24)return;const l=fe(o.x-52+x.value),r=me(o.y-24+R.value);l<0||r<0||(N(l,r),X(l,r),He(),y(),re())}function Ea(t){ee(x.value+t.deltaX,R.value+t.deltaY),y()}function wa(t){if(t.touches.length!==1){ut=!1;return}const o=t.touches[0],l=pe.value;if(!l)return;const r=l.getBoundingClientRect(),n=o.clientX-r.left,i=o.clientY-r.top;n>=52&&i>=24&&(t.preventDefault(),ut=!0,io=!1,ro=n,ao=i,Jo=x.value,Qo=R.value,nt=fe(n-52+x.value),rt=me(i-24+R.value))}function Ba(t){if(!ut||t.touches.length!==1)return;const o=t.touches[0],l=pe.value;if(!l)return;const r=l.getBoundingClientRect(),n=o.clientX-r.left,i=o.clientY-r.top;(Math.abs(n-ro)>8||Math.abs(i-ao)>8)&&(io=!0,t.preventDefault(),ee(Jo+(ro-n),Qo+(ao-i)),y())}function Ca(){if(ut&&(ut=!1,!io&&nt>=0&&rt>=0)){const t=Date.now();nt===el&&rt===tl&&t-so<300?(N(nt,rt),He(),y(),re(),so=0):(Re(),N(nt,rt),y(),so=t),el=nt,tl=rt,re()}}function co(t){return t.isComposing||t.key==="Process"||t.keyCode===229}function ol(t){return t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey}function ll(t){if(H.value)return;const o=t.ctrlKey||t.metaKey,l=t.shiftKey;switch(!0){case(o&&(t.key==="c"||t.key==="C")):t.preventDefault(),gt();return;case(o&&(t.key==="x"||t.key==="X")):t.preventDefault(),Ut();return;case(o&&(t.key==="z"||t.key==="Z")):t.preventDefault(),Do();return;case(o&&(t.key==="y"||t.key==="Y")):t.preventDefault(),To();return;case(o&&(t.key==="v"||t.key==="V")):t.preventDefault(),$(),it().then(()=>{y(),e.nextTick(P)});return;case(o&&(t.key==="a"||t.key==="A")):t.preventDefault(),d(),y();return;case(o&&t.key==="Home"):t.preventDefault(),N(0,0),X(0,0),y();return;case(o&&t.key==="End"):t.preventDefault(),N(m-1,s-1),X(m-1,s-1),y();return;case t.key==="Home":t.preventDefault(),N(0,g.value.row),X(0,g.value.row),y();return;case t.key==="End":t.preventDefault(),N(m-1,g.value.row),X(m-1,g.value.row),y();return;case t.key==="ArrowUp":t.preventDefault(),Ee(0,-1),X(g.value.col,g.value.row),y();return;case t.key==="ArrowDown":t.preventDefault(),Ee(0,1),X(g.value.col,g.value.row),y();return;case t.key==="ArrowLeft":t.preventDefault(),Ee(-1,0),X(g.value.col,g.value.row),y();return;case t.key==="ArrowRight":t.preventDefault(),Ee(1,0),X(g.value.col,g.value.row),y();return;case t.key==="Tab":t.preventDefault(),Ee(l?-1:1,0),X(g.value.col,g.value.row),y();return;case t.key==="Enter":t.preventDefault(),Ee(0,l?-1:1),X(g.value.col,g.value.row),y();return;case t.key==="F2":t.preventDefault(),X(g.value.col,g.value.row),He(),y(),re();return;case t.key==="Delete":case t.key==="Backspace":t.preventDefault(),$(),Yt(),y();return;case t.key==="Escape":t.preventDefault(),Oe(),Le.value=null,y();return;case ol(t):if(co(t)){X(g.value.col,g.value.row),He(""),y(),re();return}t.preventDefault(),X(g.value.col,g.value.row),He(t.key),y(),e.nextTick(()=>{const r=jt.value;r&&(r.focus(),r.setSelectionRange(1,1))});return}}let uo=!1,fo=!1;function xa(t){const o=t.target.value;if(!H.value){X(g.value.col,g.value.row),He(o),y();return}L.value=o}function Sa(){uo=!0,H.value||(X(g.value.col,g.value.row),He(""),y())}function Da(t){uo=!1,fo=!0,setTimeout(()=>{fo=!1},0),L.value=t.target.value}function Ta(t){if(!H.value){if(ol(t)||co(t))return;ll(t);return}uo||co(t)||fo&&(t.key==="Enter"||t.key==="Escape")||(t.key==="Enter"?(t.preventDefault(),Re(),Ee(0,1),X(g.value.col,g.value.row),y(),re()):t.key==="Tab"?(t.preventDefault(),Re(),Ee(t.shiftKey?-1:1,0),X(g.value.col,g.value.row),y(),re()):t.key==="Escape"&&(t.preventDefault(),Oe(),y(),re()))}function Ha(){setTimeout(()=>{H.value&&(Re(),y())},0)}function Ht(){var o;const t=(o=$e.value)==null?void 0:o.getBoundingClientRect();if(t){const l=Ie(h.width),r=Ie(h.height);l!=null?Z.w=l:Z.w=t.width,r!=null?Z.h=r:Z.h=t.height}ee(null,null),y()}let se=null;return e.onMounted(()=>{const t=Ie(h.width),o=Ie(h.height);(t==null||o==null)&&(se=new ResizeObserver(()=>Ht()),$e.value&&se.observe($e.value)),e.nextTick(()=>{Ht(),re()}),N(0,0),C.value&&C.value.length>0&&(D=JSON.stringify(C.value),_.value=C.value.map(l=>{const r=kt(l.name);for(const[n,i]of Object.entries(l.cells))r.cells[n]={value:i.value,style:i.style??null};if(l.colWidths)for(const[n,i]of Object.entries(l.colWidths)){const u=Number(n);u>=0&&u<m&&i>=30&&(r.colWidths[u]=i)}if(l.rowHeights)for(const[n,i]of Object.entries(l.rowHeights)){const u=Number(n);u>=0&&u<s&&i>=24&&(r.rowHeights[u]=i)}return r}),_.value.length>0&&Ne(0))}),e.watch(()=>[h.width,h.height],()=>{const t=Ie(h.width),o=Ie(h.height);t!=null&&o!=null?(se==null||se.disconnect(),se=null):!se&&$e.value&&(se=new ResizeObserver(()=>Ht()),se.observe($e.value)),e.nextTick(()=>Ht())}),e.watch(()=>h.theme,()=>y()),e.watch(()=>({...v}),()=>e.nextTick(P),{deep:!1}),e.watch(ne,()=>e.nextTick(P)),e.watch(()=>C.value,t=>{if(!t||t.length===0)return;const o=JSON.stringify(t);o!==D&&(D=o,_.value=t.map(l=>{const r=kt(l.name);for(const[n,i]of Object.entries(l.cells))r.cells[n]={value:i.value,style:i.style??null};if(l.colWidths)for(const[n,i]of Object.entries(l.colWidths)){const u=Number(n);u>=0&&u<m&&i>=30&&(r.colWidths[u]=i)}if(l.rowHeights)for(const[n,i]of Object.entries(l.rowHeights)){const u=Number(n);u>=0&&u<s&&i>=24&&(r.rowHeights[u]=i)}return r}),_.value.length>0&&Ne(0),y())},{deep:!0}),e.onBeforeUnmount(()=>{se==null||se.disconnect()}),(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:"spreadsheet-outer",style:e.normalizeStyle(Or.value)},[e.createVNode(yn,{locale:c.value,"can-undo":Jn.value,"can-redo":Qn.value,"paint-fmt-active":Le.value!==null,"has-selection":er.value,"font-family-options":nr.value,"font-size-options":rr.value,"sel-font-family":ar.value,"sel-font-size":Be.value,"font-size-input":Me.value,"font-size-menu-open":We.value,"sel-font-weight":Ho.value,"sel-font-style":Ro.value,"sel-underline":Mo.value,"sel-strikethrough":No.value,"sel-text-color":Cr.value,"text-color-menu-open":_t.value,"sel-fill-color":xr.value,"fill-color-menu-open":Gt.value,"cached-text-color":ht.value,"cached-fill-color":vt.value,"border-menu-open":Fo.value,"cached-border":Pt.value,onUndo:o[0]||(o[0]=l=>Do()),onRedo:o[1]||(o[1]=l=>To()),onPaintFormat:tr,onClearFormat:o[2]||(o[2]=l=>lr()),onFontFamilyChange:o[3]||(o[3]=l=>ir(l)),onFontSizeInput:o[4]||(o[4]=l=>cr(l)),onFontSizeBlur:dr,onFontSizeKeydown:o[5]||(o[5]=l=>ur(l)),onFontSizeChange:o[6]||(o[6]=l=>sr(l)),"onUpdate:fontSizeMenuOpen":o[7]||(o[7]=l=>We.value=l),onFontSizeToggle:o[8]||(o[8]=l=>fr()),onFontSizeStepUp:mr,onFontSizeStepDown:pr,onBoldToggle:br,onItalicToggle:hr,onUnderlineToggle:vr,onStrikethroughToggle:gr,onTextColorChange:o[9]||(o[9]=l=>kr(l)),"onUpdate:textColorMenuOpen":o[10]||(o[10]=l=>_t.value=l),onFillColorChange:o[11]||(o[11]=l=>Er(l)),"onUpdate:fillColorMenuOpen":o[12]||(o[12]=l=>Gt.value=l),onApplyTextColor:wr,onApplyFillColor:Br,"onUpdate:borderMenuOpen":o[13]||(o[13]=l=>yr(l)),onBorderChange:o[14]||(o[14]=l=>Io(l)),onApplyBorder:Dr},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"]),e.createElementVNode("div",Fn,[e.createElementVNode("div",In,e.toDisplayString(_r.value),1),e.createElementVNode("input",{ref_key:"formulaBarRef",ref:Zt,class:"formula-bar__input",value:Gr.value,onFocus:Pr,onInput:Ur,onKeydown:Yr,onBlur:Kr},null,40,An)]),e.createElementVNode("div",{ref_key:"wrapperRef",ref:$e,class:"spreadsheet-wrapper"},[e.createElementVNode("canvas",{ref_key:"canvasRef",ref:pe,class:"grid-canvas",tabindex:"0",onMousedown:ba,onMousemove:ha,onMouseup:va,onMouseleave:ga,onDblclick:ka,onWheel:e.withModifiers(Ea,["prevent"]),onFocus:Wr,onKeydown:ll,onContextmenu:ya,onTouchstart:e.withModifiers(wa,["prevent"]),onTouchmove:e.withModifiers(Ba,["prevent"]),onTouchend:Ca},null,544),e.createElementVNode("input",{ref_key:"editInputRef",ref:jt,class:"cell-editor",value:L.value,style:e.normalizeStyle(sa.value),onInput:xa,onKeydown:Ta,onCompositionstart:Sa,onCompositionend:Da,onBlur:Ha},null,44,Vn),qe.value>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:"v-scrollbar",style:e.normalizeStyle({top:e.unref(24)+"px",height:`calc(100% - ${e.unref(24)+e.unref(11)}px)`})},[e.createElementVNode("button",{class:"sb-btn sb-btn--up",title:e.unref(B)(c.value,"scrollUp"),onMousedown:o[15]||(o[15]=e.withModifiers(l=>{ee(null,R.value-50),y()},["prevent"]))},[...o[29]||(o[29]=[e.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],40,zn),e.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:ma},[e.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:e.normalizeStyle({top:oo.value+"px",height:xt.value+"px"}),onMousedown:ua},null,36)],32),e.createElementVNode("button",{class:"sb-btn sb-btn--down",title:e.unref(B)(c.value,"scrollDown"),onMousedown:o[16]||(o[16]=e.withModifiers(l=>{ee(null,R.value+50),y()},["prevent"]))},[...o[30]||(o[30]=[e.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],40,On)],4)):e.createCommentVNode("",!0),Ze.value>0?(e.openBlock(),e.createElementBlock("div",{key:1,class:"h-scrollbar",style:e.normalizeStyle({left:e.unref(52)+"px",width:`calc(100% - ${e.unref(52)+e.unref(11)}px)`})},[e.createElementVNode("button",{class:"sb-btn sb-btn--left",title:e.unref(B)(c.value,"scrollLeft"),onMousedown:o[17]||(o[17]=e.withModifiers(l=>{ee(x.value-50,null),y()},["prevent"]))},[...o[31]||(o[31]=[e.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],40,Ln),e.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:pa},[e.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:e.normalizeStyle({left:to.value+"px",width:Ct.value+"px"}),onMousedown:fa},null,36)],32),e.createElementVNode("button",{class:"sb-btn sb-btn--right",title:e.unref(B)(c.value,"scrollRight"),onMousedown:o[18]||(o[18]=e.withModifiers(l=>{ee(x.value+50,null),y()},["prevent"]))},[...o[32]||(o[32]=[e.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],40,Wn)],4)):e.createCommentVNode("",!0),Ze.value>0&&qe.value>0?(e.openBlock(),e.createElementBlock("div",$n)):e.createCommentVNode("",!0)],512),e.createVNode(xn,{locale:c.value,sheets:_.value,"active-sheet-index":ne.value,"ren-tab":_e.value,"ren-tab-val":Je.value,onTabClick:o[19]||(o[19]=l=>Xr(l)),onTabDblclick:o[20]||(o[20]=l=>Go(l)),onTabContextmenu:o[21]||(o[21]=l=>Jr(l.ev,l.i)),onTabRenameInput:o[22]||(o[22]=l=>Je.value=l),onTabRenameKeydown:o[23]||(o[23]=l=>Zr(l)),onTabRenameCommit:Po,onTabbarContextmenu:o[24]||(o[24]=l=>Qr(l)),onAddSheet:o[25]||(o[25]=l=>{Kt(),y()})},null,8,["locale","sheets","active-sheet-index","ren-tab","ren-tab-val"]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"menu-pop"},{default:e.withCtx(()=>[Ce.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"context-menu",style:e.normalizeStyle({left:Ce.value.x+"px",top:Ce.value.y+"px"}),onClick:o[26]||(o[26]=e.withModifiers(()=>{},["stop"]))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ce.value.items,(l,r)=>(e.openBlock(),e.createElementBlock("div",{key:r,class:e.normalizeClass(["context-menu__item",{"context-menu__item--disabled":l.disabled}]),onClick:n=>!l.disabled&&l.action&&(l.action(),Ce.value=null),onMouseenter:n=>qr(n,l)},[e.createElementVNode("span",Gn,e.toDisplayString(l.label),1),l.children?(e.openBlock(),e.createElementBlock("span",Pn)):e.createCommentVNode("",!0),l.children?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["context-submenu",{"context-submenu--left":Et.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.children,(n,i)=>(e.openBlock(),e.createElementBlock("div",{key:i,class:e.normalizeClass(["context-menu__item",{"context-menu__item--disabled":n.disabled}]),onClick:e.withModifiers(u=>!n.disabled&&n.action&&(n.action(),Ce.value=null),["stop"])},e.toDisplayString(n.label),11,Un))),128))],2)):e.createCommentVNode("",!0)],42,_n))),128))],4)):e.createCommentVNode("",!0)]),_:1})])),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"menu-pop"},{default:e.withCtx(()=>[ae.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"dim-panel",style:e.normalizeStyle({left:ae.value.x+"px",top:ae.value.y+"px"}),onMousedown:o[27]||(o[27]=e.withModifiers(()=>{},["stop"])),onClick:o[28]||(o[28]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",Yn,e.toDisplayString(ae.value.type==="row"?e.unref(B)(c.value,"rowHeight"):e.unref(B)(c.value,"colWidth")),1),e.createElementVNode("div",Kn,[e.createElementVNode("input",{ref_key:"dimInputRef",ref:Yo,class:e.normalizeClass(["dim-panel__input",{"dim-panel__input--error":ae.value.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:ae.value.value,onInput:na,onKeydown:ra},null,42,Xn),o[33]||(o[33]=e.createElementVNode("span",{class:"dim-panel__unit"},"px",-1))]),ae.value.error?(e.openBlock(),e.createElementBlock("div",jn,e.toDisplayString(ae.value.error),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Zn,[e.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:jo},e.toDisplayString(e.unref(B)(c.value,"ok")),1),e.createElementVNode("button",{class:"dim-panel__btn",onClick:Jt},e.toDisplayString(e.unref(B)(c.value,"cancel")),1)])],36)):e.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-59bd8e5f"]]);De.Spreader=Co,De.default=Co,Object.defineProperties(De,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(Le,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(Le=typeof globalThis<"u"?globalThis:Le||self,e(Le.XiaoDaoSpreader={},Le.Vue))})(this,function(Le,e){"use strict";const Bl={"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:"自动换行",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",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 w(r,v){var u;return((u=Bl[r])==null?void 0:u[v])??v}const ro='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',_e=10,Cl=[{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'}],xl=[{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}],Tl='<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>',Dl='<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>',Hl='<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>',Sl='<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>',Rl='<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>',Ml='<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>',Al=[{value:"left",labelKey:"alignLeft",icon:Tl},{value:"center",labelKey:"alignCenter",icon:Dl},{value:"right",labelKey:"alignRight",icon:Hl}],Nl=[{value:"top",labelKey:"alignTop",icon:Sl},{value:"middle",labelKey:"alignMiddle",icon:Rl},{value:"bottom",labelKey:"alignBottom",icon:Ml}],Il={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"},Fl={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"],Ol=["innerHTML"],Ll={key:1,class:"sp-dropdown__value"},_l=["disabled"],Wl=["onClick"],zl=["innerHTML"],$l={class:"sp-dropdown__item-label"},Gl=["disabled"],Pl=e.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"}},emits:["update:modelValue","change","update:modelOpen"],setup(r,{emit:v}){const u=r,p=v,s=e.ref(!1),B=e.ref(0),H=e.ref(null),b=e.ref(null),A=e.ref(null),E=e.ref({top:0,up:!1}),y=e.ref(0),S=e.ref(!1),V=e.computed(()=>u.options.find(O=>String(O.value)===String(u.modelValue))),M=e.computed(()=>u.menuWidth),I=e.computed(()=>Math.min(u.visibleCount,u.options.length)),C=e.computed(()=>u.options.slice(B.value,B.value+I.value)),R=e.computed(()=>B.value>0),_=e.computed(()=>B.value+I.value<u.options.length),Y=e.computed(()=>u.options.length>I.value);function X(O){B.value=Math.max(0,Math.min(u.options.length-I.value,B.value+O))}function Re(){s.value=!0,u.modelOpen!==void 0&&p("update:modelOpen",!0);const O=H.value;if(!O)return;const F=O.getBoundingClientRect(),D=I.value*22+(Y.value?2*15:0)+8,Z=window.innerHeight-F.bottom-4<D&&F.top-4>D;u.align==="right"?E.value={right:window.innerWidth-F.right,top:Z?F.top-D-4:F.bottom+4,up:Z}:E.value={left:F.left,top:Z?F.top-D-4:F.bottom+4,up:Z};const rt=u.options.findIndex(We=>String(We.value)===String(u.modelValue));B.value=rt>=0?Math.max(0,Math.min(rt-Math.floor(I.value/2),u.options.length-I.value)):0}function q(){s.value=!1,u.modelOpen!==void 0&&p("update:modelOpen",!1)}function Me(){s.value?q():Re()}function pe(O){p("update:modelValue",O.value),p("change",O.value),q()}function Ae(O){var D,$;if(!s.value)return;const F=O.target;(D=H.value)!=null&&D.contains(F)||($=A.value)!=null&&$.contains(F)||q()}function N(O){s.value&&(O.preventDefault(),X(O.deltaY>0?1:-1))}e.watch(s,O=>{e.nextTick(()=>{var F,D;O?(F=b.value)==null||F.addEventListener("wheel",N,{passive:!1}):(D=b.value)==null||D.removeEventListener("wheel",N)})}),e.watch(()=>u.modelOpen,O=>{O!==void 0&&O!==s.value&&(O?Re():q())});function j(O){s.value&&(y.value=O.touches[0].clientY,S.value=!0)}function d(O){if(!s.value||!S.value)return;const F=O.touches[0].clientY-y.value;Math.abs(F)>5&&(X(F<0?1:-1),y.value=O.touches[0].clientY)}function k(){S.value=!1}function J(O){O.key==="Escape"&&q()}return e.onMounted(()=>{document.addEventListener("mousedown",Ae),window.addEventListener("resize",q),window.addEventListener("scroll",q,!0)}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",Ae),window.removeEventListener("resize",q),window.removeEventListener("scroll",q,!0)}),(O,F)=>{var D,$;return e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:H,class:"sp-dropdown",style:e.normalizeStyle(typeof r.width=="number"?{width:r.width+"px"}:{width:r.width})},[r.hideTrigger?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:e.normalizeClass(["sp-dropdown__trigger",{"sp-dropdown__trigger--open":s.value}]),title:r.title,onClick:Me},[(D=V.value)!=null&&D.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:V.value.icon},null,8,Ol)):(e.openBlock(),e.createElementBlock("span",Ll,e.toDisplayString((($=V.value)==null?void 0:$.label)??""),1)),F[2]||(F[2]=e.createElementVNode("svg",{class:"sp-dropdown__caret",viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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)),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"menu-pop"},{default:e.withCtx(()=>[s.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"menuRef",ref:A,class:e.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":E.value.up}]),style:e.normalizeStyle({left:E.value.left!==void 0?E.value.left+"px":void 0,right:E.value.right!==void 0?E.value.right+"px":void 0,top:E.value.top+"px",minWidth:M.value!==void 0?typeof M.value=="number"?M.value+"px":M.value:void 0}),onKeydown:J},[Y.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:e.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!R.value}]),disabled:!R.value,onClick:F[0]||(F[0]=Z=>X(-1))},[...F[3]||(F[3]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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)):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"listRef",ref:b,class:"sp-dropdown__list",onTouchstart:j,onTouchmove:d,onTouchend:k},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,Z=>(e.openBlock(),e.createElementBlock("button",{key:String(Z.value),type:"button",class:e.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(Z.value)===String(r.modelValue)}]),onClick:rt=>pe(Z)},[Z.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:Z.icon},null,8,zl)):e.createCommentVNode("",!0),e.createElementVNode("span",$l,e.toDisplayString(Z.label),1)],10,Wl))),128))],544),Y.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!_.value}]),disabled:!_.value,onClick:F[1]||(F[1]=Z=>X(1))},[...F[4]||(F[4]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,Gl)):e.createCommentVNode("",!0)],38)):e.createCommentVNode("",!0)]),_:1})]))],4)}}}),lt=(r,v)=>{const u=r.__vccOpts||r;for(const[p,s]of v)u[p]=s;return u},Rt=lt(Pl,[["__scopeId","data-v-0fc61adc"]]),Ul=["title","onClick"],Fo=lt(e.defineComponent({__name:"colorPicker",props:{modelOpen:{type:Boolean,default:void 0},colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"}},emits:["update:modelValue","change","update:modelOpen"],setup(r,{expose:v,emit:u}){const p=r,s=u,B=[[{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"}]],H=[[{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"}]],b=e.computed(()=>p.colorKey==="fill"?H:B);function A(_){return w(p.locale,_)}function E(_){const Y=p.currentColor;return!Y&&!_?!0:Y?Y.toLowerCase()===_.toLowerCase():!1}const y=e.ref(!1),S=e.ref(null),V=e.ref(null);e.watch(()=>p.modelOpen,_=>{_!==void 0&&_!==y.value&&(_?I():C())});function M(_){const Y=S.value;Y&&!Y.contains(_.target)&&C()}function I(){y.value=!0,p.modelOpen!==void 0&&s("update:modelOpen",!0),e.nextTick(()=>{document.addEventListener("mousedown",M)})}function C(){y.value=!1,p.modelOpen!==void 0&&s("update:modelOpen",!1),document.removeEventListener("mousedown",M)}function R(_){s("update:modelValue",_),s("change",_),C()}return e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",M)}),v({open:y,openMenu:I,close:C}),(_,Y)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:S,class:"color-picker"},[e.createVNode(e.Transition,{name:"menu-pop"},{default:e.withCtx(()=>[y.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"menuRef",ref:V,class:"color-picker__menu",onMousedown:Y[0]||(Y[0]=e.withModifiers(()=>{},["stop"]))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(X,Re)=>(e.openBlock(),e.createElementBlock("div",{key:Re,class:"color-picker__row"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(X,q=>(e.openBlock(),e.createElementBlock("button",{key:q.value,class:e.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":E(q.value)}]),title:A(q.key),style:e.normalizeStyle({background:q.value||"transparent",border:q.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:Me=>R(q.value)},null,14,Ul))),128))]))),128))],544)):e.createCommentVNode("",!0)]),_:1})],512))}}),[["__scopeId","data-v-c262a5e5"]]),Kl=["title","onClick"],Yl={viewBox:"0 0 30 30",class:"border-picker__icon"},Xl=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],jl={class:"border-picker__label"},Zl=lt(e.defineComponent({__name:"borderPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"}},emits:["update:modelOpen","change"],setup(r,{expose:v,emit:u}){const p=r,s=u,B=[{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"}],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}],b={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},A={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function E(R,_){return A[R].includes(_)?"thick":b[R].includes(_)?"solid":"dashed"}const y=e.ref(!1),S=e.ref(null);e.watch(()=>p.modelOpen,R=>{R!==void 0&&R!==y.value&&(R?M():I())});function V(R){const _=S.value;_&&!_.contains(R.target)&&I()}function M(){y.value=!0,p.modelOpen!==void 0&&s("update:modelOpen",!0),e.nextTick(()=>{document.addEventListener("mousedown",V)})}function I(){y.value=!1,p.modelOpen!==void 0&&s("update:modelOpen",!1),document.removeEventListener("mousedown",V)}function C(R){s("change",R),I()}return e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",V)}),v({open:y,openMenu:M,close:I}),(R,_)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:S,class:"border-picker"},[e.createVNode(e.Transition,{name:"menu-pop"},{default:e.withCtx(()=>[y.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"border-picker__menu",onMousedown:_[0]||(_[0]=e.withModifiers(()=>{},["stop"]))},[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(B,Y=>e.createElementVNode("button",{key:Y.key,class:"border-picker__item",title:e.unref(w)(r.locale,Y.i18nKey),onClick:X=>C(Y.key)},[(e.openBlock(),e.createElementBlock("svg",Yl,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(H,X=>e.createElementVNode("line",{key:X.name,x1:X.x1,y1:X.y1,x2:X.x2,y2:X.y2,stroke:"currentColor","stroke-width":E(Y.key,X.name)==="thick"?3:1.5,"stroke-dasharray":E(Y.key,X.name)==="dashed"?"0 4":"none","stroke-linecap":E(Y.key,X.name)==="dashed"?"round":"square"},null,8,Xl)),64))])),e.createElementVNode("span",jl,e.toDisplayString(e.unref(w)(r.locale,Y.i18nKey)),1)],8,Kl)),64))],32)):e.createCommentVNode("",!0)]),_:1})],512))}}),[["__scopeId","data-v-c9b0ba80"]]),ql={class:"tb-item","data-key":"undo"},Jl=["title","disabled"],Ql={class:"tb-item","data-key":"redo"},en=["title","disabled"],tn={class:"tb-item","data-key":"paint"},on=["title","disabled"],ln={class:"tb-item","data-key":"clear"},nn=["title","disabled"],an={class:"tb-item","data-key":"font"},rn={class:"tb-item","data-key":"fontSize"},sn={class:"toolbar-font-size"},cn=["value","title"],dn=["title"],un=["title","disabled"],fn=["title","disabled"],mn={class:"tb-item","data-key":"bold"},pn=["title","disabled"],hn={class:"tb-item","data-key":"italic"},bn=["title","disabled"],vn={class:"tb-item","data-key":"underline"},gn=["title","disabled"],yn={class:"tb-item","data-key":"strike"},kn=["title","disabled"],En={class:"tb-item","data-key":"textColor"},wn={class:"toolbar-split"},Bn=["title","disabled"],Cn={viewBox:"0 0 1024 1024",fill:"currentColor"},xn=["fill"],Tn=["title","disabled"],Dn={class:"tb-item","data-key":"fillColor"},Hn={class:"toolbar-split"},Sn=["title","disabled"],Rn={viewBox:"0 0 1024 1024",fill:"currentColor"},Mn=["fill"],An=["title","disabled"],Nn={class:"tb-item","data-key":"border"},In={class:"toolbar-split"},Fn=["title","disabled"],Vn={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},On=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Ln=["title","disabled"],_n={class:"tb-item","data-key":"hAlign"},Wn={class:"tb-item","data-key":"vAlign"},zn={class:"tb-item","data-key":"wrap"},$n=["title"],io=2,Gn=6,Pn=34,Un=lt(e.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:{}},emits:["undo","redo","paint-format","clear-format","font-family-change","font-size-input","font-size-blur","font-size-keydown","font-size-change","update:font-size-menu-open","font-size-toggle","font-size-step-up","font-size-step-down","bold-toggle","italic-toggle","underline-toggle","strikethrough-toggle","text-color-change","update:text-color-menu-open","fill-color-change","update:fill-color-menu-open","apply-text-color","apply-fill-color","update:border-menu-open","border-change","apply-border","h-align-change","v-align-change","wrap-toggle"],setup(r,{emit:v}){const u=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],p={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},s={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function B(j,d){return s[j].includes(d)?"thick":p[j].includes(d)?"solid":"dashed"}const H=["undo","redo","paint","clear","sep1","font","fontSize","sep2","bold","italic","underline","strike","sep3","textColor","fillColor","border","sep4","hAlign","vAlign","wrap"],b=e.ref(null),A=e.ref(null),E=e.ref(null),y=e.ref(new Set),S=e.ref(!1),V=e.ref(!1),M=new Map,I=e.computed(()=>y.value.size>0);function C(j){return y.value.has(j)}function R(){if(!b.value)return;b.value.querySelectorAll(".tb-item").forEach(d=>{const k=d.dataset.key;k&&M.set(k,d.offsetWidth)})}function _(j,d){if(j.size!==d.size)return!1;for(const k of j)if(!d.has(k))return!1;return!0}function Y(){if(!b.value)return;const j=b.value.clientWidth-Gn*2;if(j<=0)return;M.size===0&&R();let d=0;for(const J of H)d+=(M.get(J)??0)+io;const k=new Set;if(d>j){const J=j-Pn-io;let O=0;for(let F=0;F<H.length;F++){const D=H[F],$=(M.get(D)??0)+io;if(O+$>J){for(let Z=F;Z<H.length;Z++)k.add(H[Z]);break}O+=$}}_(k,y.value)||(y.value=k,k.size===0&&(S.value=!1))}let X=null;const Re=e.ref(0),q=e.computed(()=>{const j=E.value;if(!j)return{position:"fixed",top:"0px",right:"0px"};Re.value;const d=j.getBoundingClientRect();return{position:"fixed",top:`${d.bottom+4}px`,right:`${window.innerWidth-d.right}px`}});function Me(){S.value&&(Re.value++,e.nextTick(()=>Y()))}function pe(j){var k,J;if(!S.value)return;const d=j.target;(k=A.value)!=null&&k.contains(d)||(J=E.value)!=null&&J.contains(d)||(V.value=!0,S.value=!1,e.nextTick(()=>{V.value=!1}))}function Ae(){S.value=!S.value}e.onMounted(()=>{e.nextTick(()=>{R(),Y()}),b.value&&(X=new ResizeObserver(()=>{S.value||Y()}),X.observe(b.value)),document.addEventListener("mousedown",pe,!0),window.addEventListener("resize",Me)}),e.onBeforeUnmount(()=>{X==null||X.disconnect(),document.removeEventListener("mousedown",pe,!0),window.removeEventListener("resize",Me)});const N=v;return(j,d)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{ref_key:"rootEl",ref:b,class:"toolbar"},[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("undo"),to:A.value??void 0},[e.createElementVNode("div",ql,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!r.canUndo}]),title:e.unref(w)(r.locale,"undo"),disabled:!r.canUndo,onClick:d[0]||(d[0]=k=>N("undo"))},[...d[35]||(d[35]=[e.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,Jl)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("redo"),to:A.value??void 0},[e.createElementVNode("div",Ql,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!r.canRedo}]),title:e.unref(w)(r.locale,"redo"),disabled:!r.canRedo,onClick:d[1]||(d[1]=k=>N("redo"))},[...d[36]||(d[36]=[e.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,en)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("paint"),to:A.value??void 0},[e.createElementVNode("div",tn,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--active":r.paintFmtActive}]),title:e.unref(w)(r.locale,"paintFormat"),disabled:!r.hasSelection,onClick:d[2]||(d[2]=k=>N("paint-format"))},[...d[37]||(d[37]=[e.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,on)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("clear"),to:A.value??void 0},[e.createElementVNode("div",ln,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!r.hasSelection}]),title:e.unref(w)(r.locale,"clearFormat"),disabled:!r.hasSelection,onClick:d[3]||(d[3]=k=>N("clear-format"))},[...d[38]||(d[38]=[e.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,nn)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("sep1"),to:A.value??void 0},[d[39]||(d[39]=e.createElementVNode("div",{class:"tb-item","data-key":"sep1"},[e.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("font"),to:A.value??void 0},[e.createElementVNode("div",an,[e.createVNode(Rt,{class:"toolbar-font","model-value":r.selFontFamily,options:r.fontFamilyOptions,width:110,"visible-count":8,title:e.unref(w)(r.locale,"fontFamily"),onChange:d[4]||(d[4]=k=>N("font-family-change",k))},null,8,["model-value","options","title"])])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("fontSize"),to:A.value??void 0},[e.createElementVNode("div",rn,[e.createElementVNode("div",sn,[e.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:r.fontSizeInput,title:e.unref(w)(r.locale,"fontSize"),onInput:d[5]||(d[5]=k=>N("font-size-input",k.target.value)),onBlur:d[6]||(d[6]=k=>N("font-size-blur")),onKeydown:d[7]||(d[7]=k=>N("font-size-keydown",k))},null,40,cn),e.createVNode(Rt,{class:"toolbar-font-size__dropdown","model-value":r.selFontSize,options:r.fontSizeOptions,width:56,"menu-width":56,"visible-count":9,title:e.unref(w)(r.locale,"fontSize"),"hide-trigger":!0,"model-open":r.fontSizeMenuOpen,"onUpdate:modelOpen":d[8]||(d[8]=k=>N("update:font-size-menu-open",k)),onChange:d[9]||(d[9]=k=>N("font-size-change",k))},null,8,["model-value","options","title","model-open"]),e.createElementVNode("button",{class:"toolbar-font-size__btn",type:"button",title:e.unref(w)(r.locale,"fontSize"),onMousedown:d[10]||(d[10]=e.withModifiers(()=>{},["prevent"])),onClick:d[11]||(d[11]=k=>N("font-size-toggle"))},[...d[40]||(d[40]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,dn),e.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:e.unref(w)(r.locale,"fontSizeDecrease"),disabled:!r.hasSelection,onMousedown:d[12]||(d[12]=e.withModifiers(()=>{},["prevent"])),onClick:d[13]||(d[13]=k=>N("font-size-step-down"))},[...d[41]||(d[41]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,un),e.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:e.unref(w)(r.locale,"fontSizeIncrease"),disabled:!r.hasSelection,onMousedown:d[14]||(d[14]=e.withModifiers(()=>{},["prevent"])),onClick:d[15]||(d[15]=k=>N("font-size-step-up"))},[...d[42]||(d[42]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,fn)])])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("sep2"),to:A.value??void 0},[d[43]||(d[43]=e.createElementVNode("div",{class:"tb-item","data-key":"sep2"},[e.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("bold"),to:A.value??void 0},[e.createElementVNode("div",mn,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--active":r.selFontWeight}]),title:e.unref(w)(r.locale,"bold"),disabled:!r.hasSelection,onClick:d[16]||(d[16]=k=>N("bold-toggle"))},[...d[44]||(d[44]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[e.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,pn)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("italic"),to:A.value??void 0},[e.createElementVNode("div",hn,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--active":r.selFontStyle}]),title:e.unref(w)(r.locale,"italic"),disabled:!r.hasSelection,onClick:d[17]||(d[17]=k=>N("italic-toggle"))},[...d[45]||(d[45]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[e.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,bn)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("underline"),to:A.value??void 0},[e.createElementVNode("div",vn,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--active":r.selUnderline}]),title:e.unref(w)(r.locale,"underline"),disabled:!r.hasSelection,onClick:d[18]||(d[18]=k=>N("underline-toggle"))},[...d[46]||(d[46]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[e.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,gn)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("strike"),to:A.value??void 0},[e.createElementVNode("div",yn,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--active":r.selStrikethrough}]),title:e.unref(w)(r.locale,"strikethrough"),disabled:!r.hasSelection,onClick:d[19]||(d[19]=k=>N("strikethrough-toggle"))},[...d[47]||(d[47]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[e.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,kn)])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("sep3"),to:A.value??void 0},[d[48]||(d[48]=e.createElementVNode("div",{class:"tb-item","data-key":"sep3"},[e.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("textColor"),to:A.value??void 0},[e.createElementVNode("div",En,[e.createElementVNode("div",wn,[e.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.unref(w)(r.locale,"fontColor"),disabled:!r.hasSelection,onClick:d[20]||(d[20]=k=>N("apply-text-color"))},[(e.openBlock(),e.createElementBlock("svg",Cn,[d[49]||(d[49]=e.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[e.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)),e.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:r.cachedTextColor||"#000000"},null,8,xn)]))],8,Bn),e.createElementVNode("button",{class:"toolbar-btn toolbar-split__arrow",title:e.unref(w)(r.locale,"fontColor"),disabled:!r.hasSelection,onClick:d[21]||(d[21]=k=>N("update:text-color-menu-open",!r.textColorMenuOpen))},[...d[50]||(d[50]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Tn),e.createVNode(Fo,{"model-open":r.textColorMenuOpen,"color-key":"text","current-color":r.selTextColor,locale:r.locale,"onUpdate:modelOpen":d[22]||(d[22]=k=>N("update:text-color-menu-open",k)),onChange:d[23]||(d[23]=k=>N("text-color-change",k))},null,8,["model-open","current-color","locale"])])])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("fillColor"),to:A.value??void 0},[e.createElementVNode("div",Dn,[e.createElementVNode("div",Hn,[e.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.unref(w)(r.locale,"fillColor"),disabled:!r.hasSelection,onClick:d[24]||(d[24]=k=>N("apply-fill-color"))},[(e.openBlock(),e.createElementBlock("svg",Rn,[d[51]||(d[51]=e.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)),e.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:r.cachedFillColor||"currentColor"},null,8,Mn)]))],8,Sn),e.createElementVNode("button",{class:"toolbar-btn toolbar-split__arrow",title:e.unref(w)(r.locale,"fillColor"),disabled:!r.hasSelection,onClick:d[25]||(d[25]=k=>N("update:fill-color-menu-open",!r.fillColorMenuOpen))},[...d[52]||(d[52]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,An),e.createVNode(Fo,{"model-open":r.fillColorMenuOpen,"color-key":"fill","current-color":r.selFillColor,locale:r.locale,"onUpdate:modelOpen":d[26]||(d[26]=k=>N("update:fill-color-menu-open",k)),onChange:d[27]||(d[27]=k=>N("fill-color-change",k))},null,8,["model-open","current-color","locale"])])])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("border"),to:A.value??void 0},[e.createElementVNode("div",Nn,[e.createElementVNode("div",In,[e.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.unref(w)(r.locale,"borders"),disabled:!r.hasSelection,onClick:d[28]||(d[28]=k=>N("apply-border"))},[(e.openBlock(),e.createElementBlock("svg",Vn,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(u,k=>e.createElementVNode("line",{key:k.name,x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,"stroke-width":B(r.cachedBorder,k.name)==="thick"?3:1.5,"stroke-dasharray":B(r.cachedBorder,k.name)==="dashed"?"0 4":"none","stroke-linecap":B(r.cachedBorder,k.name)==="dashed"?"round":"square"},null,8,On)),64))]))],8,Fn),e.createElementVNode("button",{class:"toolbar-btn toolbar-split__arrow",title:e.unref(w)(r.locale,"borders"),disabled:!r.hasSelection,onClick:d[29]||(d[29]=k=>N("update:border-menu-open",!r.borderMenuOpen))},[...d[53]||(d[53]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Ln),e.createVNode(Zl,{"model-open":r.borderMenuOpen,locale:r.locale,"current-border":r.cachedBorder,"onUpdate:modelOpen":d[30]||(d[30]=k=>N("update:border-menu-open",k)),onChange:d[31]||(d[31]=k=>N("border-change",k))},null,8,["model-open","locale","current-border"])])])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("sep4"),to:A.value??void 0},[d[54]||(d[54]=e.createElementVNode("div",{class:"tb-item","data-key":"sep4"},[e.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("hAlign"),to:A.value??void 0},[e.createElementVNode("div",_n,[e.createVNode(Rt,{class:"toolbar-align","model-value":r.selHAlign,options:r.hAlignOptions,width:44,"visible-count":3,align:"right",title:e.unref(w)(r.locale,"hAlign"),onChange:d[32]||(d[32]=k=>N("h-align-change",k))},null,8,["model-value","options","title"])])],8,["disabled","to"])),(e.openBlock(),e.createBlock(e.Teleport,{disabled:!C("vAlign"),to:A.value??void 0},[e.createElementVNode("div",Wn,[e.createVNode(Rt,{class:"toolbar-align","model-value":r.selVAlign,options:r.vAlignOptions,width:44,"visible-count":3,align:"right",title:e.unref(w)(r.locale,"vAlign"),onChange:d[33]||(d[33]=k=>N("v-align-change",k))},null,8,["model-value","options","title"])]),e.createElementVNode("div",zn,[e.createElementVNode("button",{class:e.normalizeClass(["toolbar-btn",{"toolbar-btn--active":r.selWrap}]),type:"button",title:e.unref(w)(r.locale,"wrap"),onClick:d[34]||(d[34]=k=>N("wrap-toggle"))},[...d[55]||(d[55]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.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,$n)])],8,["disabled","to"])),I.value?(e.openBlock(),e.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:E,class:e.normalizeClass(["toolbar-more",{"toolbar-more--active":S.value}]),type:"button",onClick:Ae},[...d[56]||(d[56]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[e.createElementVNode("circle",{cx:"512",cy:"160",r:"96"}),e.createElementVNode("circle",{cx:"512",cy:"512",r:"96"}),e.createElementVNode("circle",{cx:"512",cy:"864",r:"96"})],-1)])],2)):e.createCommentVNode("",!0)],512),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"menu-pop"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"overflowMenuEl",ref:A,class:e.normalizeClass(["overflow-menu",{"no-anim":V.value}]),style:e.normalizeStyle(q.value)},null,6),[[e.vShow,S.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-1bf472fc"]]),Kn={class:"tab-list"},Yn=["onClick","onDblclick","onContextmenu"],Xn=["value"],jn={key:1,class:"tab-item__name"},Zn=["title"],qn=lt(e.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","tabbar-contextmenu","add-sheet"],setup(r,{emit:v}){const u=v;return(p,s)=>(e.openBlock(),e.createElementBlock("div",{class:"tab-bar",onContextmenu:s[5]||(s[5]=B=>u("tabbar-contextmenu",B))},[e.createElementVNode("div",Kn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.sheets,(B,H)=>(e.openBlock(),e.createElementBlock("div",{key:B.id,class:e.normalizeClass(["tab-item",{"tab-item--active":H===r.activeSheetIndex}]),onClick:b=>u("tab-click",H),onDblclick:e.withModifiers(b=>u("tab-dblclick",H),["prevent"]),onContextmenu:b=>u("tab-contextmenu",{ev:b,i:H})},[r.renTab===H?(e.openBlock(),e.createElementBlock("input",{key:0,class:"tab-rename-input",value:r.renTabVal,onInput:s[0]||(s[0]=b=>u("tab-rename-input",b.target.value)),onKeydown:s[1]||(s[1]=b=>u("tab-rename-keydown",b)),onBlur:s[2]||(s[2]=b=>u("tab-rename-commit")),onClick:s[3]||(s[3]=e.withModifiers(()=>{},["stop"]))},null,40,Xn)):(e.openBlock(),e.createElementBlock("span",jn,e.toDisplayString(B.name),1))],42,Yn))),128))]),e.createElementVNode("button",{class:"tab-bar__add-btn",title:e.unref(w)(r.locale,"addSheet"),onClick:s[4]||(s[4]=B=>u("add-sheet"))}," + ",8,Zn)],32))}}),[["__scopeId","data-v-49f54625"]]);function ye(r){let v="",u=r;do v=String.fromCharCode(65+u%26)+v,u=Math.floor(u/26)-1;while(u>=0);return v}function so(r){let v=0;for(let u=0;u<r.length;u++)v=v*26+(r.toUpperCase().charCodeAt(u)-64);return v-1}function Ye(r){if(r==null)return null;if(typeof r=="number")return r;if(typeof r=="string"){const v=parseFloat(r);return r.endsWith("%")||isNaN(v)?null:v}return null}function co(r){navigator.clipboard.writeText(r).catch(()=>{const v=document.createElement("textarea");v.value=r,v.style.position="fixed",v.style.opacity="0",document.body.appendChild(v),v.select(),document.execCommand("copy"),document.body.removeChild(v)})}function nt(r,v){return`${r},${v}`}function Mt(r,v,u){const p=r.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!p)return null;const s=so(p[1]),B=parseInt(p[2],10)-1;return s<0||s>=v||B<0||B>=u?null:{col:s,row:B}}function Xe(r,v){if(!v)return{x:0,y:0};const u=v.getBoundingClientRect();return{x:r.clientX-u.left,y:r.clientY-u.top}}function Jn(r,v,u){const p=r.split(":");if(p.length!==2)return null;const s=Mt(p[0],v,u),B=Mt(p[1],v,u);return!s||!B?null:{sc:Math.min(s.col,B.col),sr:Math.min(s.row,B.row),ec:Math.max(s.col,B.col),er:Math.max(s.row,B.row)}}function Qn(r,v,u,p,s){const B=u[nt(r,v)];if(!B)return 0;const H=B.value;if(H.startsWith("="))return Oo(nt(r,v),u,p,s)??0;const b=parseFloat(H);return isNaN(b)?0:b}const at=new Map;function Vo(){at.clear()}function Oo(r,v,u,p){return ea(r,v,u,p)}function ea(r,v,u,p,s){if(at.has(r))return NaN;at.set(r,NaN);const B=v[r];if(!B)return NaN;const H=B.value;if(!H.startsWith("=")){const E=parseFloat(H),y=isNaN(E)?0:E;return at.set(r,y),y}const b=H.slice(1).trim();if(b.toUpperCase().startsWith("SUM(")&&b.endsWith(")")){const E=b.slice(4,-1).trim(),y=Jn(E,u,p);if(y){let S=0;for(let V=y.sc;V<=y.ec;V++)for(let M=y.sr;M<=y.er;M++)S+=Qn(V,M,v,u,p);return isNaN(S)?NaN:(at.set(r,S),S)}return NaN}return NaN}function Lo(r,v,u){const p=[],s=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let B;for(;(B=s.exec(r))!==null;){const H=Mt(B[1],v,u);if(H)if(B[2]){const b=Mt(B[2],v,u);if(!b)continue;for(let A=Math.min(H.col,b.col);A<=Math.max(H.col,b.col);A++)for(let E=Math.min(H.row,b.row);E<=Math.max(H.row,b.row);E++)p.push(nt(A,E))}else p.push(nt(H.col,H.row))}return p}function ta(r,v,u,p,s){const B=u[nt(r,v)];if(!B)return"";const H=B.value;if(!H.startsWith("="))return H;const b=Oo(nt(r,v),u,p,s);return isNaN(b)?"#ERROR":String(b)}function oa(r,v,u,p,s,B){return v===0&&u===0?r:r.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(H,b,A,E,y)=>{const S=b?so(A):so(A)+v,V=E?parseInt(y,10)-1:parseInt(y,10)-1+u;let M;S<0?M="A":S>=p?M=B(p-1):M=B(S);let I;return V<0?I="1":V>=s?I=String(s):I=String(V+1),(b||"")+M+(E||"")+I})}class la{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(v){var p;const u=this.deps.get(v);if(u){for(const s of u)(p=this.rev.get(s))==null||p.delete(v);this.deps.delete(v)}}set(v,u){if(this.clear(v),u.length!==0){this.deps.set(v,u);for(const p of u)this.rev.has(p)||this.rev.set(p,new Set),this.rev.get(p).add(v)}}markDirty(v){const u=[v];for(;u.length>0;){const p=u.pop(),s=this.rev.get(p);if(s)for(const B of s)this.dirty.has(B)||(this.dirty.add(B),u.push(B))}}getDirtyAndClear(){const v=this.dirty;return this.dirty=new Set,v}rebuild(v,u,p){this.deps.clear(),this.rev.clear(),this.dirty.clear(),at.clear();for(const[s,B]of Object.entries(v))if(B.value.startsWith("=")){const H=Lo(B.value.slice(1),u,p);this.set(s,H)}}}function na(r,v,u,p){const s={},B=p(v),H=p(u);return B!=null&&(s.width=`${B}px`),H!=null&&(s.height=`${H}px`),s["--sp-formula-bar-bg"]=r.formulaBarBg,s["--sp-formula-bar-border"]=r.formulaBarBorder,s["--sp-formula-bar-label-color"]=r.formulaBarLabelText,s["--sp-formula-bar-label-bg"]=r.formulaBarLabelBg,s["--sp-formula-bar-label-border"]=r.formulaBarLabelBorder,s["--sp-formula-bar-input-bg"]=r.formulaBarInputBg,s["--sp-formula-bar-input-border"]=r.formulaBarInputBorder,s["--sp-formula-bar-input-color"]=r.formulaBarInputText,s["--sp-formula-bar-input-focus-border"]=r.formulaBarInputFocusBorder,s["--sp-formula-bar-input-focus-shadow"]=r.formulaBarInputFocusShadow,s["--sp-wrapper-bg"]=r.wrapperBg,s["--sp-cell-editor-border"]=r.cellEditorBorder,s["--sp-cell-editor-color"]=r.cellEditorText,s["--sp-cell-editor-bg"]=r.cellEditorBg,s["--sp-cell-editor-shadow"]=r.cellEditorShadow,s["--sp-tab-bar-bg"]=r.tabBarBg,s["--sp-tab-bar-border"]=r.tabBarBorder,s["--sp-tab-active-bg"]=r.tabActiveBg,s["--sp-tab-active-color"]=r.tabActiveText,s["--sp-tab-active-border"]=r.tabActiveBorder,s["--sp-tab-inactive-bg"]=r.tabInactiveBg,s["--sp-tab-inactive-color"]=r.tabInactiveText,s["--sp-tab-inactive-border"]=r.tabInactiveBorder,s["--sp-tab-hover-bg"]=r.tabHoverBg,s["--sp-tab-add-btn-color"]=r.tabAddBtnColor,s["--sp-tab-add-btn-hover-bg"]=r.tabAddBtnHoverBg,s["--sp-tab-scroll-btn-color"]=r.tabScrollBtnColor,s["--sp-tab-scroll-btn-hover-bg"]=r.tabScrollBtnHoverBg,s["--sp-scroll-thumb"]=r.scrollbarThumb,s["--sp-scroll-thumb-hover"]=r.scrollbarThumbHover,s["--sp-scroll-btn-bg"]=r.scrollBtnBg,s["--sp-scroll-btn-color"]=r.scrollBtnColor,s["--sp-scroll-btn-hover-bg"]=r.scrollBtnHoverBg,s["--sp-scroll-btn-active-bg"]=r.scrollBtnActiveBg,s["--sp-scroll-track-bg"]=r.scrollTrackBg,s["--sp-toolbar-bg"]=r.toolbarBg,s["--sp-toolbar-border"]=r.toolbarBorder,s["--sp-toolbar-btn-color"]=r.toolbarBtnColor,s["--sp-toolbar-btn-hover-bg"]=r.toolbarBtnHoverBg,s["--sp-toolbar-btn-disabled-color"]=r.toolbarBtnDisabledColor,s["--sp-toolbar-btn-active-color"]=r.toolbarBtnActiveColor,s}const aa={class:"formula-bar"},ra={class:"formula-bar__cell-label"},ia=["value"],sa=["value"],ca=["title"],da=["title"],ua=["title"],fa=["title"],ma={key:2,class:"sb-corner"},pa=["onClick","onMouseenter"],ha={class:"context-menu__label"},ba={key:0,class:"context-menu__arrow"},va=["onClick"],ga={class:"dim-panel__title"},ya={class:"dim-panel__body"},ka=["value"],Ea={key:0,class:"dim-panel__error"},wa={class:"dim-panel__footer"},Ba="\0",_o="#444",Wo=lt(e.defineComponent({__name:"spreader",props:e.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(r){const v=r,u=e.computed(()=>v.locale==="zh-CN"?"zh-CN":"en-US"),p=v.colCount,s=v.rowCount,B=e.useModel(r,"data");let H="";const b=e.reactive({}),A=new la,E=e.ref(null),y=e.ref({col:0,row:0}),S=e.ref(null),V=e.ref(""),M=e.ref(new Array(p).fill(100)),I=e.ref(new Array(s).fill(void 0)),C=e.ref(0),R=e.ref(0),_=(24-_e)/2,Y=new Map;let X=null;function Re(t,o,l,a){const n=`${a} ${l} ${o}px ${t}`,i=Y.get(n);if(i)return i;X||(X=document.createElement("canvas"));const c=X.getContext("2d");if(!c)return{ascent:o*.8,descent:o*.2};c.font=n;const m=c.measureText("M"),h=m.actualBoundingBoxAscent,T=m.actualBoundingBoxDescent,oe=h||o*.8,ee=T||o*.2,te=Math.max(oe,o*.5),U=Math.max(ee,o*.15),ae={ascent:te,descent:U};return Y.set(n,ae),ae}function q(t,o,l,a){if(!o)return[""];const n=o.split(`
2
+ `),i=[];for(const c of n)if(!a||l<=0)i.push(c);else{let m="";for(let h=0;h<c.length;h++){const T=c[h],oe=m+T;t.measureText(oe).width>l&&m?(i.push(m),m=T):m=oe}i.push(m)}return i}function Me(t,o){var a;const l=(a=b[D(t,o)])==null?void 0:a.style;return typeof(l==null?void 0:l.fontSize)=="number"&&l.fontSize>0?l.fontSize:_e}const pe=e.computed(()=>{const t=[0];for(let o=0;o<p;o++)t.push(t[o]+M.value[o]);return t});function Ae(t){var oe;const o=I.value[t];if(o!=null&&o>0)return o;let l=_e,a=l*.8,n=l*.2,i=1;const c=X?X.getContext("2d"):null;for(let ee=0;ee<p;ee++){const te=Me(ee,t),U=(oe=b[D(ee,t)])==null?void 0:oe.style,ae=typeof(U==null?void 0:U.fontFamily)=="string"&&U.fontFamily?U.fontFamily:ro,xe=(U==null?void 0:U.fontWeight)==="bold"?"bold":"normal",Ue=(U==null?void 0:U.fontStyle)==="italic"?"italic":"normal",ve=rt(ee,t);if(ve&&c){c.font=`${Ue} ${xe} ${te}px ${ae}`;const Te=ve.split(`
3
+ `)[0]||ve,Ke=c.measureText(Te),ie=Ke.actualBoundingBoxAscent,Ne=Ke.actualBoundingBoxDescent,tt=ie||te*.8,De=Ne||te*.2,He=Math.max(tt,te*.5),x=Math.max(De,te*.15);He>a&&(a=He),x>n&&(n=x),te>l&&(l=te);const W=(U==null?void 0:U.wrap)==="wrap";let L;if(W){const le=M.value[ee];L=q(c,ve,Math.max(0,le-10),!0).length,L>i&&(i=L)}else L=ve.split(`
4
+ `).length,L>i&&(i=L)}else if(te>l){l=te;const Te=Re(ae,te,xe,Ue);Te.ascent>a&&(a=Te.ascent),Te.descent>n&&(n=Te.descent)}}const m=l,h=_*2+i*m;return Math.min(500,Math.max(24,Math.round(h)))}const N=e.computed(()=>{const t=[0];for(let o=0;o<s;o++)t.push(t[o]+Ae(o));return t}),j=e.computed(()=>pe.value[p]),d=e.computed(()=>N.value[s]);function k(t,o){y.value={col:t,row:o},E.value={startCol:t,startRow:o,endCol:t,endRow:o}}function J(t,o,l,a){y.value={col:t,row:o},E.value={startCol:Math.min(t,l),startRow:Math.min(o,a),endCol:Math.max(t,l),endRow:Math.max(o,a)}}function O(){J(0,0,p-1,s-1)}function F(t,o){const l=E.value;return l?t>=l.startCol&&t<=l.endCol&&o>=l.startRow&&o<=l.endRow:!1}function D(t,o){return`${t},${o}`}function $(t){Reflect.deleteProperty(b,t)}function Z(t,o){var l;return((l=b[D(t,o)])==null?void 0:l.value)??""}function rt(t,o){return Vo(),ta(t,o,b,p,s)}function We(t,o,l){var c;const a=D(t,o);if(Vo(),l===""||l==null){A.clear(a),$(a),A.markDirty(a);return}const n=String(l),i=((c=b[a])==null?void 0:c.style)??null;b[a]={value:n,style:i},n.startsWith("=")?A.set(a,Lo(n.slice(1),p,s)):A.clear(a),A.markDirty(a)}function zo(t,o,l,a){for(let n=t;n<=o;n++)for(let i=l;i<=a;i++){const c=D(n,i);A.clear(c),$(c),A.markDirty(c)}}function ze(t){S.value||(S.value={...y.value},V.value=t??Z(y.value.col,y.value.row))}function $e(){S.value&&(G(),We(S.value.col,S.value.row,V.value),S.value=null,V.value="")}function je(){S.value=null,V.value=""}function Fe(t,o){k(Math.max(0,Math.min(p-1,y.value.col+t)),Math.max(0,Math.min(s-1,y.value.row+o)))}function Q(t,o){const l=Math.max(0,re.w-52-11),a=Math.max(0,re.h-24-11),n=pe.value[t],i=N.value[o],c=M.value[t],m=Ae(o);let h=C.value,T=R.value;n<h?h=n:n+c>h+l&&(h=n+c-l),i<T?T=i:i+m>T+a&&(T=i+m-a),se(h,T)}function ke(t){const o=pe.value;if(t<0||t>=o[p])return-1;let l=0,a=p-1;for(;l<a;){const n=l+a+1>>1;o[n]<=t?l=n:a=n-1}return l}function Ee(t){const o=N.value;if(t<0||t>=o[s])return-1;let l=0,a=s-1;for(;l<a;){const n=l+a+1>>1;o[n]<=t?l=n:a=n-1}return l}const Ve=e.ref([]),wt=e.ref([]);function $o(t){const o={};for(const[l,a]of Object.entries(t))o[l]={value:a.value,style:a.style};return o}function uo(){return it(),{sheets:P.value.map(t=>({id:t.id,name:t.name,cells:$o(t.cells),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]})),activeSheetIndex:ue.value}}function Go(t){P.value=t.sheets.map(o=>({...o,cells:$o(o.cells)})),Pe(Math.max(0,Math.min(t.activeSheetIndex,P.value.length-1))),A.rebuild(b,p,s)}function G(){const t=uo(),o=Ve.value[Ve.value.length-1];o&&JSON.stringify(o)===JSON.stringify(t)||(Ve.value.push(t),wt.value=[],Ve.value.length>50&&Ve.value.shift())}function Po(){Ve.value.length&&(wt.value.push(uo()),Go(Ve.value.pop()),g(),e.nextTick(K))}function Uo(){wt.value.length&&(Ve.value.push(uo()),Go(wt.value.pop()),g(),e.nextTick(K))}const Ca=e.computed(()=>Ve.value.length>0),xa=e.computed(()=>wt.value.length>0),Ta=e.computed(()=>!!E.value),Ze=e.ref(null);function Da(){var l;const t=E.value;if(!t)return;const o={};for(let a=t.startCol;a<=t.endCol;a++)for(let n=t.startRow;n<=t.endRow;n++)o[`${a-t.startCol},${n-t.startRow}`]=((l=b[D(a,n)])==null?void 0:l.style)??null;Ze.value={styles:o}}function Ha(){var l;const t=Ze.value,o=E.value;if(!(!t||!o)){G();for(let a=o.startCol;a<=o.endCol;a++)for(let n=o.startRow;n<=o.endRow;n++){const i=t.styles[`${a-o.startCol},${n-o.startRow}`]??null,c=D(a,n),m=((l=b[c])==null?void 0:l.value)??"";m===""&&i===null?$(c):b[c]={value:m,style:i}}Ze.value=null,g(),K()}}function Sa(){var o;const t=E.value;if(t){G();for(let l=t.startCol;l<=t.endCol;l++)for(let a=t.startRow;a<=t.endRow;a++){const n=D(l,a),i=((o=b[n])==null?void 0:o.value)??"";i===""?$(n):b[n]={value:i,style:null}}g(),K()}}const Ra=e.computed(()=>Cl.map(t=>({...t,label:t.value===""?w(u.value,"fontDefault"):t.label}))),Ma=e.computed(()=>xl.map(t=>({...t,label:String(t.value)}))),Aa=e.computed(()=>{var a;const t=E.value;if(!t)return"";let o,l=!1;for(let n=t.startCol;n<=t.endCol&&!l;n++)for(let i=t.startRow;i<=t.endRow&&!l;i++){const c=(a=b[D(n,i)])==null?void 0:a.style,m=typeof(c==null?void 0:c.fontFamily)=="string"?c.fontFamily:"";o===void 0?o=m:m!==o&&(l=!0)}return l?Ba:o??""}),he=e.computed(()=>{const t=E.value;if(!t)return _e;let o,l=!1;for(let a=t.startCol;a<=t.endCol&&!l;a++)for(let n=t.startRow;n<=t.endRow&&!l;n++){const i=Me(a,n);o===void 0?o=i:i!==o&&(l=!0)}return l?0:o??_e});function ne(t,o){var a,n;const l=E.value;if(l){G();for(let i=l.startCol;i<=l.endCol;i++)for(let c=l.startRow;c<=l.endRow;c++){const m=D(i,c),h=((a=b[m])==null?void 0:a.value)??"",T=(n=b[m])!=null&&n.style?{...b[m].style}:{};o===""||o===null||o===void 0||o===0?delete T[t]:T[t]=o;const oe=Object.keys(T).length?T:null;h===""&&oe===null?$(m):b[m]={value:h,style:oe}}g(),K()}}function Na(t){ne("fontFamily",t===""?"":t)}function Ia(t){ne("fontSize",t),qe.value=!1}const Fa=e.computed(()=>Al.map(t=>({label:w(u.value,t.labelKey),value:t.value,icon:t.icon}))),Va=e.computed(()=>Nl.map(t=>({label:w(u.value,t.labelKey),value:t.value,icon:t.icon}))),Oa=e.computed(()=>{var a;const t=E.value;if(!t)return"left";const o=(a=b[D(t.startCol,t.startRow)])==null?void 0:a.style,l=typeof(o==null?void 0:o.textAlign)=="string"?o.textAlign:"";return l==="center"||l==="right"?l:"left"}),La=e.computed(()=>{var a;const t=E.value;if(!t)return"top";const o=(a=b[D(t.startCol,t.startRow)])==null?void 0:a.style,l=typeof(o==null?void 0:o.verticalAlign)=="string"?o.verticalAlign:"";return l==="middle"||l==="bottom"?l:"top"}),Ko=e.computed(()=>{var l;const t=E.value;if(!t)return!1;const o=(l=b[D(t.startCol,t.startRow)])==null?void 0:l.style;return(o==null?void 0:o.wrap)==="wrap"});function _a(t){ne("textAlign",t)}function Wa(t){ne("verticalAlign",t)}function za(){if(!E.value)return;const o=Ko.value;ne("wrap",o?void 0:"wrap")}const Ge=e.ref(""),qe=e.ref(!1);e.watch(he,t=>{Ge.value=t===0?"":String(t)},{immediate:!0});function $a(t){const o=t.replace(/[^\d]/g,"");Ge.value=o;const l=parseInt(o,10);!isNaN(l)&&l>=5&&l<=72&&l!==he.value&&ne("fontSize",l)}function Ga(){const t=Ge.value.trim();if(!t){Ge.value=he.value===0?"":String(he.value);return}let o=parseInt(t,10);isNaN(o)?o=he.value===0?_e:he.value:o=Math.max(5,Math.min(72,o)),Ge.value=String(o),o!==he.value&&ne("fontSize",o)}function Pa(t){t.key==="Enter"&&t.target.blur()}function Ua(t){qe.value=!qe.value}function Ka(){const t=he.value===0?_e:he.value,o=Math.min(72,t+1);ne("fontSize",o),Ge.value=String(o),qe.value=!1}function Ya(){const t=he.value===0?_e:he.value,o=Math.max(5,t-1);ne("fontSize",o),Ge.value=String(o),qe.value=!1}function At(t){var n;const o=E.value;if(!o)return!1;let l,a=!1;for(let i=o.startCol;i<=o.endCol&&!a;i++)for(let c=o.startRow;c<=o.endRow&&!a;c++){const m=(n=b[D(i,c)])==null?void 0:n.style,h=!!(m!=null&&m[t]);l===void 0?l=h:h!==l&&(a=!0)}return!a&&l===!0}const Yo=e.computed(()=>At("fontWeight")),Xo=e.computed(()=>At("fontStyle")),jo=e.computed(()=>At("underline")),Zo=e.computed(()=>At("strikethrough"));function Xa(){ne("fontWeight",Yo.value?"":"bold")}function ja(){ne("fontStyle",Xo.value?"":"italic")}function Za(){ne("underline",jo.value?"":"underline")}function qa(){ne("strikethrough",Zo.value?"":"line-through")}const Nt=e.ref(""),It=e.ref(""),fo=e.ref(!1),mo=e.ref(!1);function Ja(t){qo.value=t,t&&(fo.value=!1,mo.value=!1)}function Qa(t){Nt.value=t,ne("color",t===""?"":t)}function er(t){It.value=t,ne("backgroundColor",t===""?"":t)}function tr(){ne("color",Nt.value===""?"":Nt.value)}function or(){ne("backgroundColor",It.value===""?"":It.value)}const lr=e.computed(()=>{var a;const t=E.value;if(!t)return"";let o,l=!1;for(let n=t.startCol;n<=t.endCol&&!l;n++)for(let i=t.startRow;i<=t.endRow&&!l;i++){const c=(a=b[D(n,i)])==null?void 0:a.style,m=typeof(c==null?void 0:c.color)=="string"?c.color:"";o===void 0?o=m:m!==o&&(l=!0)}return l?"":o??""}),nr=e.computed(()=>{var a;const t=E.value;if(!t)return"";let o,l=!1;for(let n=t.startCol;n<=t.endCol&&!l;n++)for(let i=t.startRow;i<=t.endRow&&!l;i++){const c=(a=b[D(n,i)])==null?void 0:a.style,m=typeof(c==null?void 0:c.backgroundColor)=="string"?c.backgroundColor:"";o===void 0?o=m:m!==o&&(l=!0)}return l?"":o??""}),po=e.ref("none"),qo=e.ref(!1);function ar(t,o,l,a){const n=l===a.startRow,i=l===a.endRow,c=o===a.startCol,m=o===a.endCol,h={top:0,bottom:0,left:0,right:0};switch(t){case"none":return h;case"bottom":i&&(h.bottom=1);break;case"top":n&&(h.top=1);break;case"left":c&&(h.left=1);break;case"right":m&&(h.right=1);break;case"all":h.top=1,h.bottom=1,h.left=1,h.right=1;break;case"outer":n&&(h.top=1),i&&(h.bottom=1),c&&(h.left=1),m&&(h.right=1);break;case"thickOuter":n&&(h.top=2),i&&(h.bottom=2),c&&(h.left=2),m&&(h.right=2);break}return h}function Jo(t){po.value=t;const o=E.value;if(o){if(G(),t==="none")for(let l=o.startCol;l<=o.endCol;l++)for(let a=o.startRow;a<=o.endRow;a++)Qo(l,a,{top:0,bottom:0,left:0,right:0},!0);else for(let l=o.startCol;l<=o.endCol;l++)for(let a=o.startRow;a<=o.endRow;a++){const n=ar(t,l,a,o);Qo(l,a,n,!1)}g(),K()}}function Qo(t,o,l,a=!0){var ee,te;const n=D(t,o),i=((ee=b[n])==null?void 0:ee.value)??"",c=(te=b[n])!=null&&te.style?{...b[n].style}:{},m=["Top","Bottom","Left","Right"],h=[l.top,l.bottom,l.left,l.right];for(let U=0;U<4;U++){const ae=`border${m[U]}Width`;h[U]===0?a&&delete c[ae]:(c[ae]=h[U],c.borderColor=_o)}m.some(U=>c[`border${U}Width`]!==void 0)||delete c.borderColor;const oe=Object.keys(c).length?c:null;i===""&&oe===null?$(n):b[n]={value:i,style:oe}}function rr(){Jo(po.value)}function el(t,o,l){var n;const a=(n=b[D(t,o)])==null?void 0:n.style;return(a==null?void 0:a[`border${l}Width`])||0}let tl=null;function Ft(){const t=E.value;if(!t)return;tl={...t};const o=[];for(let l=t.startRow;l<=t.endRow;l++){const a=[];for(let n=t.startCol;n<=t.endCol;n++)a.push(Z(n,l));o.push(a.join(" "))}co(o.join(`
5
+ `))}function Vt(){const t=E.value;if(t){if(t.startCol===0&&t.endCol===p-1){const o=[];for(let l=t.startRow;l<=t.endRow;l++){const a=[];for(let n=0;n<p;n++)a.push(Z(n,l));o.push(a.join(" "))}co(o.join(`
6
+ `))}else if(t.startRow===0&&t.endRow===s-1){const o=[];for(let l=0;l<s;l++){const a=[];for(let n=t.startCol;n<=t.endCol;n++)a.push(Z(n,l));o.push(a.join(" "))}co(o.join(`
7
+ `))}}}async function Bt(){let t="";try{t=await navigator.clipboard.readText()}catch{return}if(!t&&t!=="")return;const o=t.split(/\r?\n/),l=y.value,a=tl;for(let n=0;n<o.length;n++){const i=o[n].split(" ");for(let c=0;c<i.length;c++){const m=l.col+c,h=l.row+n;if(m<p&&h<s){let T=i[c];T.startsWith("=")&&a&&(T=oa(T,m-(a.startCol+c),h-(a.startRow+n),p,s,ye)),We(m,h,T)}}}}function ho(){if(Ft(),E.value){const t=E.value;zo(t.startCol,t.endCol,t.startRow,t.endRow),g()}}function bo(){if(E.value){const t=E.value;zo(t.startCol,t.endCol,t.startRow,t.endRow),g()}}function ir(){const t=E.value;if(!t)return;G();const o=t.startCol,l=t.startRow,a=t.endCol,n=t.endRow;if(l===n)if(a+1<p){const i=`${ye(o)}${l+1}:${ye(a)}${l+1}`;We(a+1,l,`=SUM(${i})`)}else{const i=`${ye(o)}${l+1}:${ye(a-1)}${l+1}`;We(a,l,`=SUM(${i})`)}else for(let i=o;i<=a;i++)if(n+1<s){const c=`${ye(i)}${l+1}:${ye(i)}${n+1}`;We(i,n+1,`=SUM(${c})`)}else{const c=`${ye(i)}${l+1}:${ye(i)}${n}`;We(i,n,`=SUM(${c})`)}g(),K()}function sr(t,o){const l=o-t+1;for(let a=t;a<=o;a++)for(let n=0;n<p;n++)$(D(n,a));for(let a=t;a<s-l;a++){for(let n=0;n<p;n++){const i=D(n,a+l),c=D(n,a);b[i]?(b[c]=b[i],$(i)):$(c)}I.value[a]=I.value[a+l]}for(let a=s-l;a<s;a++){for(let n=0;n<p;n++)$(D(n,a));I.value[a]=void 0}}function cr(t,o){const l=o-t+1;if(!(o>=s-1)){for(let a=s-1;a>o;a--){for(let n=0;n<p;n++){const i=D(n,a-l),c=D(n,a);b[i]?b[c]=b[i]:$(c)}I.value[a]=I.value[a-l]}for(let a=o+1;a<=o+l;a++){for(let n=0;n<p;n++)$(D(n,a));I.value[a]=void 0}}}function dr(t,o){const l=o-t+1;if(!(o>=p-1)){for(let a=p-1;a>o;a--){for(let n=0;n<s;n++){const i=D(a-l,n),c=D(a,n);b[i]?b[c]=b[i]:$(c)}M.value[a]=M.value[a-l]}for(let a=o+1;a<=o+l;a++){for(let n=0;n<s;n++)$(D(a,n));M.value[a]=100}}}function ur(t,o){const l=o-t+1;for(let a=t;a<=o;a++)for(let n=0;n<s;n++)$(D(a,n));for(let a=t;a<p-l;a++){for(let n=0;n<s;n++){const i=D(a+l,n),c=D(a,n);b[i]?(b[c]=b[i],$(i)):$(c)}M.value[a]=M.value[a+l]}for(let a=p-l;a<p;a++){for(let n=0;n<s;n++)$(D(a,n));M.value[a]=100}}let ol=0;function ll(){return ol++,`s_${ol}`}function Ot(t){return{id:ll(),name:t,cells:{},selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:new Array(p).fill(100),rowHeights:new Array(s).fill(void 0)}}const P=e.ref([Ot("Sheet1")]),ue=e.ref(0);function it(){const t=P.value[ue.value];t&&(t.cells={...b},t.selection=E.value?{...E.value}:null,t.activeCell={...y.value},t.scrollX=C.value,t.scrollY=R.value,t.colWidths=[...M.value],t.rowHeights=[...I.value])}function Pe(t){const o=P.value[t];o&&(Object.keys(b).forEach(l=>$(l)),Object.assign(b,o.cells),E.value=o.selection?{...o.selection}:null,y.value={...o.activeCell},C.value=o.scrollX,R.value=o.scrollY,M.value=[...o.colWidths],I.value=[...o.rowHeights],ue.value=t)}function fr(t){t===ue.value||t<0||t>=P.value.length||(je(),it(),Pe(t))}function vo(t){return G(),je(),it(),P.value.push(Ot(`Sheet${P.value.length+1}`)),Pe(P.value.length-1),P.value.length-1}function mr(t){return P.value.length<=1||(G(),je(),P.value.splice(t,1),Pe(Math.min(t,P.value.length-1))),ue.value}function pr(t,o){P.value[t]&&o.trim()&&(G(),P.value[t].name=o.trim())}function hr(t){G(),je(),it();const o=P.value[t];if(!o)return t;let l=o.name;const a=l.match(/^(.*?)\s*\((\d+)\)$/);let n=a?parseInt(a[2],10)+1:2;a&&(l=a[1]);let i=`${l} (${n})`;const c=new Set(P.value.map(h=>h.name));for(;c.has(i);)n++,i=`${l} (${n})`;const m={id:ll(),name:i,cells:{...o.cells},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 P.value.splice(t+1,0,m),Pe(t+1),t+1}function nl(t,o){const l=t+o;if(l<0||l>=P.value.length)return;G();const a=ue.value,n=P.value.splice(t,1)[0];P.value.splice(l,0,n),a===t?ue.value=l:t<a&&l>=a?ue.value=a-1:t>a&&l<=a&&(ue.value=a+1),g()}const br=e.computed(()=>P.value.length);function K(){it();const t=P.value.map(l=>{const a={};for(const[m,h]of Object.entries(l.cells))a[m]={value:h.value},h.style&&(a[m].style=h.style);const n={name:l.name,cells:a},i={};for(let m=0;m<l.colWidths.length;m++)l.colWidths[m]!==100&&(i[m]=l.colWidths[m]);Object.keys(i).length&&(n.colWidths=i);const c={};for(let m=0;m<l.rowHeights.length;m++){const h=l.rowHeights[m];h!=null&&(c[m]=h)}return Object.keys(c).length&&(n.rowHeights=c),n}),o=JSON.stringify(t);o!==H&&(H=o,B.value=t)}let go=!1;function al(){go||(go=!0,Promise.resolve().then(()=>{go=!1,K()}))}const rl=e.computed(()=>v.theme==="dark"?Fl:Il),vr=e.computed(()=>na(rl.value,v.width,v.height,Ye)),Je=e.ref(null),we=e.ref(null),Lt=e.ref(null),yo=e.ref(null),re=e.reactive({w:800,h:600}),st=e.computed(()=>Math.max(0,j.value-Math.max(0,re.w-52-11))),ct=e.computed(()=>Math.max(0,d.value-Math.max(0,re.h-24-11)));function se(t,o){const l=Math.max(0,re.w-52-11),a=Math.max(0,re.h-24-11);C.value=Math.max(0,Math.min(t??C.value,Math.max(0,j.value-l))),R.value=Math.max(0,Math.min(o??R.value,Math.max(0,d.value-a)))}function gr(){var t;return typeof window>"u"?!1:!((t=window.matchMedia)!=null&&t.call(window,"(hover: none) and (pointer: coarse)").matches)}function fe(t=!1){e.nextTick(()=>{const o=Lt.value;if(o){if(!S.value&&!gr()){document.activeElement===o&&o.blur();return}o.focus({preventScroll:!0}),t&&o.select()}})}function yr(){fe()}let ko=!1,f=null,Ct=1;function g(){ko||(ko=!0,requestAnimationFrame(()=>{ko=!1,kr()}))}function kr(){var tt,De,He;const t=we.value;if(!t)return;const o=Je.value;if(!o||(f=t.getContext("2d"),!f))return;Ct=window.devicePixelRatio||1;const l=o.getBoundingClientRect(),a=l.width,n=l.height;re.w=a,re.h=n,t.width=a*Ct,t.height=n*Ct,t.style.width=a+"px",t.style.height=n+"px",f.setTransform(Ct,0,0,Ct,0,0);const i=C.value,c=R.value,m=52,h=24,T=rl.value,oe=pe.value,ee=N.value,te=M.value,U=[];for(let x=0;x<s;x++)U[x]=ee[x+1]-ee[x];const ae=Math.max(0,ke(i));let xe=ae;for(let x=ae;x<p&&!(m+oe[x]-i>=a);x++)xe=x;const Ue=xe,ve=Math.max(0,Ee(c));let Te=ve;for(let x=ve;x<s&&!(h+ee[x]-c>=n);x++)Te=x;const Ke=Te;f.fillStyle=T.bg,f.fillRect(0,0,a,n),f.fillStyle=T.gridBg,f.fillRect(m,h,a-m,n-h),f.save(),f.beginPath(),f.rect(m+.5,h+.5,a-m-1,n-h-1),f.clip();const ie=E.value,Ne=S.value;for(let x=ve;x<=Ke;x++)for(let W=ae;W<=Ue;W++){const L=m+oe[W]-i,le=h+ee[x]-c,me=te[W],Se=U[x];if(L+me<m||le+Se<h||L>a||le>n)continue;F(W,x)&&(f.fillStyle=T.selectionBg,f.fillRect(L,le,me,Se)),y.value.col===W&&y.value.row===x&&(f.strokeStyle=T.activeCellBorder,f.lineWidth=2,f.strokeRect(L+1,le+1,me-2,Se-2)),f.strokeStyle=T.gridLine,f.lineWidth=.5,f.strokeRect(L+.25,le+.25,me-.5,Se-.5);const Jt=(tt=b[D(W,x)])==null?void 0:tt.style,kl=typeof(Jt==null?void 0:Jt.backgroundColor)=="string"?Jt.backgroundColor:"";if(kl&&(f.fillStyle=kl,f.fillRect(L,le,me,Se)),!(Ne&&Ne.col===W&&Ne.row===x)){const de=rt(W,x);if(de){const z=(De=b[D(W,x)])==null?void 0:De.style,vt=Me(W,x),mi=typeof(z==null?void 0:z.fontFamily)=="string"&&z.fontFamily?z.fontFamily:ro,pi=(z==null?void 0:z.fontWeight)==="bold"?"bold":"normal",hi=(z==null?void 0:z.fontStyle)==="italic"?"italic":"normal",bi=(z==null?void 0:z.underline)==="underline",vi=(z==null?void 0:z.strikethrough)==="line-through",Io=typeof(z==null?void 0:z.color)=="string"?z.color:"",El=typeof(z==null?void 0:z.textAlign)=="string"?z.textAlign:"left",wl=typeof(z==null?void 0:z.verticalAlign)=="string"?z.verticalAlign:"top";f.fillStyle=Io||T.cellText,f.font=`${hi} ${pi} ${vt}px ${mi}`,f.textBaseline="alphabetic",f.save(),f.beginPath(),f.rect(L+5,le+1,me-10,Se-2),f.clip();const gi=(z==null?void 0:z.wrap)==="wrap",Ht=q(f,de,me-10,gi);let gt=0,ot=0;for(const yt of Ht){const St=f.measureText(yt),kt=St.actualBoundingBoxAscent,Et=St.actualBoundingBoxDescent,Ie=kt||vt*.8,ao=Et||vt*.2;gt=Math.max(gt,Ie),ot=Math.max(ot,ao)}gt=Math.max(gt,vt*.5),ot=Math.max(ot,vt*.15);const lo=vt,yi=Ht.length*lo;let no;wl==="middle"?no=le+(Se-yi)/2+gt:wl==="bottom"?no=le+Se-_-ot-(Ht.length-1)*lo:no=le+_+gt;for(let yt=0;yt<Ht.length;yt++){const St=Ht[yt],kt=no+yt*lo,Et=f.measureText(St);let Ie;if(El==="center"?Ie=L+me/2-Et.width/2:El==="right"?Ie=L+me-5-Et.width:Ie=L+5,f.fillText(St,Ie,kt),bi&&(f.strokeStyle=Io||T.cellText,f.lineWidth=1,f.beginPath(),f.moveTo(Ie,kt+ot+1),f.lineTo(Ie+Et.width,kt+ot+1),f.stroke()),vi){f.strokeStyle=Io||T.cellText,f.lineWidth=1;const ao=kt-lo*.25;f.beginPath(),f.moveTo(Ie,ao),f.lineTo(Ie+Et.width,ao),f.stroke()}}f.restore()}}const ge=(He=b[D(W,x)])==null?void 0:He.style,ui=(ge==null?void 0:ge.borderTopWidth)||0,fi=(ge==null?void 0:ge.borderLeftWidth)||0,Qt=(ge==null?void 0:ge.borderBottomWidth)||0,eo=(ge==null?void 0:ge.borderRightWidth)||0,to=Math.max(ui,el(W,x-1,"Bottom")),oo=Math.max(fi,el(W-1,x,"Right"));if(to>0||oo>0||Qt>0||eo>0){if(f.strokeStyle=_o,to>0){f.lineWidth=to,f.beginPath();const de=le+to/2-.5;f.moveTo(L,de),f.lineTo(L+me,de),f.stroke()}if(oo>0){f.lineWidth=oo,f.beginPath();const de=L+oo/2-.5;f.moveTo(de,le),f.lineTo(de,le+Se),f.stroke()}if(x===Ke&&Qt>0){f.lineWidth=Qt,f.beginPath();const de=le+Se-Qt/2+.5;f.moveTo(L,de),f.lineTo(L+me,de),f.stroke()}if(W===Ue&&eo>0){f.lineWidth=eo,f.beginPath();const de=L+me-eo/2+.5;f.moveTo(de,le),f.lineTo(de,le+Se),f.stroke()}}}f.restore(),f.fillStyle=T.headerBg,f.fillRect(m,0,a-m,h);for(let x=ae;x<=Ue;x++){const W=m+oe[x]-i,L=te[x];W+L<m||W>a||(ie&&x>=ie.startCol&&x<=ie.endCol&&(f.fillStyle=T.selectionBg,f.fillRect(W,0,L,h)),f.strokeStyle=T.headerBorder,f.lineWidth=.5,f.strokeRect(W+.25,.25,L-.5,h-.5),ie&&x>=ie.startCol&&x<=ie.endCol&&(f.strokeStyle=T.activeCellBorder,f.lineWidth=2,f.beginPath(),f.moveTo(W,h-1),f.lineTo(W+L,h-1),f.stroke()),f.fillStyle=T.headerText,f.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',f.textAlign="center",f.textBaseline="middle",f.fillText(ye(x),W+L/2,h/2))}f.strokeStyle=T.headerSep,f.lineWidth=1,f.beginPath(),f.moveTo(m,h+.5),f.lineTo(a,h+.5),f.stroke(),f.fillStyle=T.headerBg,f.fillRect(0,h,m,n-h);for(let x=ve;x<=Ke;x++){const W=h+ee[x]-c,L=U[x];W+L<h||W>n||(ie&&x>=ie.startRow&&x<=ie.endRow&&(f.fillStyle=T.selectionBg,f.fillRect(0,W,m,L)),f.strokeStyle=T.headerBorder,f.lineWidth=.5,f.strokeRect(.25,W+.25,m-.5,L-.5),ie&&x>=ie.startRow&&x<=ie.endRow&&(f.strokeStyle=T.activeCellBorder,f.lineWidth=2,f.beginPath(),f.moveTo(m-1,W),f.lineTo(m-1,W+L),f.stroke()),f.fillStyle=T.headerText,f.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',f.textAlign="center",f.textBaseline="middle",f.fillText(String(x+1),m/2,W+L/2+.5))}f.strokeStyle=T.headerSep,f.lineWidth=1,f.beginPath(),f.moveTo(m+.5,h),f.lineTo(m+.5,n),f.stroke(),f.fillStyle=T.headerBg,f.fillRect(0,0,m,h),f.strokeStyle=T.headerSep,f.lineWidth=1,f.strokeRect(.5,.5,m-.5,h-.5)}const Er=e.computed(()=>ye(y.value.col)+String(y.value.row+1)),wr=e.computed(()=>S.value?V.value:Z(y.value.col,y.value.row));function Br(){S.value||(Q(y.value.col,y.value.row),V.value=Z(y.value.col,y.value.row),ze(),g())}function Cr(t){V.value=t.target.value}function xr(t){var o,l;t.key==="Enter"?(t.preventDefault(),$e(),Fe(0,1),Q(y.value.col,y.value.row),(o=yo.value)==null||o.blur(),g(),fe()):t.key==="Escape"&&(t.preventDefault(),je(),(l=yo.value)==null||l.blur(),g(),fe())}function Tr(){setTimeout(()=>{S.value&&($e(),g())},0)}const Qe=e.ref(null),dt=e.ref("");function Dr(t){Qe.value===null&&(fr(t),g())}function il(t){t!==ue.value&&(it(),Pe(t),g()),Qe.value=t,dt.value=P.value[t].name,e.nextTick(()=>{const o=document.querySelector(".tab-rename-input");o==null||o.focus(),o==null||o.select()})}function sl(){Qe.value!==null&&(pr(Qe.value,dt.value),e.nextTick(K)),Qe.value=null,dt.value=""}function Hr(){Qe.value=null,dt.value=""}function Sr(t){t.key==="Enter"?(t.preventDefault(),sl()):t.key==="Escape"&&(t.preventDefault(),Hr())}const Oe=e.ref(null);let xt=null;function cl(){xt&&(document.removeEventListener("click",xt),xt=null)}function ut(t,o,l){cl();const a=140,n=l.length*28+8,i=window.innerWidth,c=window.innerHeight;t+a>i&&(t-=a),o+n>c&&(o-=n),Oe.value={x:t,y:o,items:l},xt=()=>{Oe.value=null,cl()},setTimeout(()=>document.addEventListener("click",xt,{once:!0}),0)}const _t=e.ref(!1);function Rr(t,o){if(!o.children){_t.value=!1;return}const a=t.currentTarget.querySelector(".context-submenu");if(!a){_t.value=!1;return}const n=a.getBoundingClientRect();_t.value=n.right>window.innerWidth}function Mr(t,o){t.preventDefault(),t.stopPropagation(),ut(t.clientX,t.clientY,[{label:w(u.value,"insert"),action:()=>{vo(),g()}},{label:w(u.value,"copy"),action:()=>{hr(o)}},{label:w(u.value,"rename"),action:()=>{il(o)}},{label:w(u.value,"delete"),action:()=>{mr(o),g()},disabled:br.value<=1},{label:w(u.value,"moveSheetLeft"),action:()=>{nl(o,-1)},disabled:o===0},{label:w(u.value,"moveSheetRight"),action:()=>{nl(o,1)},disabled:o===P.value.length-1}])}function Ar(t){t.preventDefault(),!(t.target.closest(".tab-item")||t.target.closest(".tab-bar__add-btn"))&&ut(t.clientX,t.clientY,[{label:w(u.value,"insert"),action:()=>{vo(),g()}}])}function Nr(t){t.preventDefault(),O(),g(),ut(t.clientX,t.clientY,[{label:w(u.value,"cut"),action:()=>{ho(),K()}},{label:w(u.value,"copy"),action:()=>Ft()},{label:w(u.value,"paste"),action:()=>{G(),Bt().then(()=>{g(),e.nextTick(K)})}},{label:w(u.value,"delete"),action:()=>{G(),bo();for(let o=0;o<p;o++)M.value[o]=100;for(let o=0;o<s;o++)I.value[o]=void 0;g(),K()}}])}function Ir(t,o){t.preventDefault();const l=t.clientX,a=t.clientY,n=E.value;n&&n.startCol===0&&n.endCol===p-1&&o>=n.startRow&&o<=n.endRow||(J(0,o,p-1,o),g());const i=E.value;ut(t.clientX,t.clientY,[{label:w(u.value,"insert"),action:()=>{G(),cr(i.startRow,i.endRow),g(),K()},disabled:i.endRow>=s-1},{label:w(u.value,"cut"),action:()=>{G(),Vt();for(let c=i.startRow;c<=i.endRow;c++)for(let m=0;m<p;m++)$(D(m,c));g(),K()}},{label:w(u.value,"copy"),action:()=>Vt()},{label:w(u.value,"paste"),action:()=>{G(),Bt().then(()=>{g(),e.nextTick(K)})}},{label:w(u.value,"delete"),action:()=>{G(),sr(i.startRow,i.endRow),g(),K()}},{label:`${w(u.value,"rowHeight")}...`,action:()=>fl("row",l,a)},{label:w(u.value,"autoRowHeight"),action:()=>Wr()}])}function Fr(t,o){t.preventDefault();const l=t.clientX,a=t.clientY,n=E.value;n&&n.startRow===0&&n.endRow===s-1&&o>=n.startCol&&o<=n.endCol||(J(o,0,o,s-1),g());const i=E.value;ut(t.clientX,t.clientY,[{label:w(u.value,"insert"),action:()=>{G(),dr(i.startCol,i.endCol),g(),K()},disabled:i.endCol>=p-1},{label:w(u.value,"cut"),action:()=>{G(),Vt();for(let c=i.startCol;c<=i.endCol;c++)for(let m=0;m<s;m++)$(D(c,m));g(),K()}},{label:w(u.value,"copy"),action:()=>Vt()},{label:w(u.value,"paste"),action:()=>{G(),Bt().then(()=>{g(),e.nextTick(K)})}},{label:w(u.value,"delete"),action:()=>{G(),ur(i.startCol,i.endCol),g(),K()}},{label:`${w(u.value,"colWidth")}...`,action:()=>fl("col",l,a)},{label:w(u.value,"defaultColWidth"),action:()=>zr()}])}function Vr(t,o,l){t.preventDefault(),F(o,l)||(k(o,l),g());const a=E.value,n=!!(a&&a.startCol===a.endCol&&a.startRow===a.endRow);ut(t.clientX,t.clientY,[{label:w(u.value,"cut"),action:()=>{ho(),K()}},{label:w(u.value,"copy"),action:()=>Ft()},{label:w(u.value,"paste"),action:()=>{G(),Bt().then(()=>{g(),e.nextTick(K)})}},{label:w(u.value,"delete"),action:()=>{G(),bo(),g(),K()}},{label:w(u.value,"calculate"),children:[{label:w(u.value,"sum"),action:ir,disabled:n}]}])}const dl=e.ref(null),ce=e.ref(null);let Tt=null;function ul(){Tt&&(document.removeEventListener("mousedown",Tt),Tt=null)}function fl(t,o,l){ul();const a=E.value;let n="";if(a){const T=t==="row"?Ae(a.startRow):M.value[a.startCol];n=T!=null&&T>0?String(Math.round(T)):""}const i=220,c=118;let m=o,h=l;m+i>window.innerWidth&&(m=window.innerWidth-i-8),h+c>window.innerHeight&&(h=window.innerHeight-c-8),m<8&&(m=8),h<8&&(h=8),ce.value={type:t,x:m,y:h,value:n,error:""},Tt=()=>{ce.value=null},setTimeout(()=>document.addEventListener("mousedown",Tt,{once:!0}),0),e.nextTick(()=>{const T=dl.value;T&&(T.focus(),T.select())})}function Or(t){const o=ce.value;if(!o)return;const l=t.target,a=l.value,n=a.replace(/[^\d]/g,"");o.value=n,a!==n&&(l.value=n),o.error=""}function Lr(t){t.key==="Enter"?(t.preventDefault(),ml()):t.key==="Escape"&&Wt()}function _r(){const t=ce.value;if(!t)return;const o=t.value.trim(),l=Number(o),a=t.type==="row",n=a?24:30,i=a?500:1e3;if(o===""||!Number.isFinite(l)){Wt();return}const c=Math.max(n,Math.min(i,Math.round(l)));t.value=String(c),t.error=""}function ml(){const t=ce.value,o=E.value;if(!t||!o)return;const l=t.value.trim(),a=Number(l),n=t.type==="row",i=n?24:30,c=n?500:1e3;if(l===""||!Number.isFinite(a)){t.error=w(u.value,"dimNumberError");return}if(a<i||a>c){t.error=w(u.value,"dimRangeError").replace("{min}",String(i)).replace("{max}",String(c));return}const m=a;if(G(),n)for(let h=o.startRow;h<=o.endRow;h++)I.value[h]=m;else for(let h=o.startCol;h<=o.endCol;h++)M.value[h]=m;g(),K(),Wt()}function Wt(){ul(),ce.value=null}function Wr(){const t=E.value;if(t){G();for(let o=t.startRow;o<=t.endRow;o++)I.value[o]=void 0;g(),K()}}function zr(){const t=E.value;if(t){G();for(let o=t.startCol;o<=t.endCol;o++)M.value[o]=100;g(),K()}}const $r=e.computed(()=>{var x;const t=!S.value,o=S.value??y.value,l=o.col,a=o.row,n=(x=b[D(l,a)])==null?void 0:x.style,i=Me(l,a),c=typeof(n==null?void 0:n.fontFamily)=="string"&&n.fontFamily?n.fontFamily:ro,m=(n==null?void 0:n.fontWeight)==="bold"?"bold":"normal",h=(n==null?void 0:n.fontStyle)==="italic"?"italic":"normal",T=(n==null?void 0:n.underline)==="underline"?"underline":(n==null?void 0:n.strikethrough)==="line-through"?"line-through":"none",oe=(n==null?void 0:n.underline)==="underline"&&(n==null?void 0:n.strikethrough)==="line-through"?"underline line-through":T,ee=typeof(n==null?void 0:n.color)=="string"?n.color:void 0,te=typeof(n==null?void 0:n.backgroundColor)=="string"?n.backgroundColor:void 0,U=typeof(n==null?void 0:n.textAlign)=="string"?n.textAlign:"left",ae=typeof(n==null?void 0:n.verticalAlign)=="string"?n.verticalAlign:"top",xe=Ae(a),Ue=2,{ascent:ve,descent:Te}=Re(c,i,m,h),Ke=ve+Te,Ne=(V.value?V.value.split(`
8
+ `).length:1)*Ke,tt=_-Ue;let De=0,He=0;return ae==="middle"?(De=Math.floor((xe-Ne)/2),He=Math.max(0,xe-Ne-De)):ae==="top"?(De=tt,He=Math.max(0,xe-Ne-De)):ae==="bottom"&&(He=tt,De=Math.max(0,xe-Ne-He)),{left:`${52+pe.value[l]-C.value}px`,top:`${24+N.value[a]-R.value}px`,width:`${M.value[l]}px`,height:`${xe}px`,fontFamily:c,fontSize:`${i}px`,lineHeight:1,fontWeight:m,fontStyle:h,textDecoration:oe,textAlign:U,paddingTop:`${De}px`,paddingRight:"3px",paddingBottom:`${He}px`,paddingLeft:"3px",opacity:t?0:1,pointerEvents:t?"none":"auto",color:t?"transparent":ee,caretColor:t?"transparent":void 0,borderColor:t?"transparent":void 0,background:t?"transparent":te,boxShadow:t?"none":void 0}}),Gr=e.computed(()=>Math.max(0,re.w-52-11)),Pr=e.computed(()=>Math.max(0,re.h-24-11)),zt=e.computed(()=>Math.max(0,Gr.value-11*2)),$t=e.computed(()=>Math.max(0,Pr.value-11*2));function Eo(){return Math.max(0,re.w-52-11)}function wo(){return Math.max(0,re.h-24-11)}const Gt=e.computed(()=>st.value<=0?zt.value:Math.max(24,Eo()/j.value*zt.value)),Bo=e.computed(()=>st.value<=0?0:C.value/st.value*(zt.value-Gt.value)),Pt=e.computed(()=>ct.value<=0?$t.value:Math.max(24,wo()/d.value*$t.value)),Co=e.computed(()=>ct.value<=0?0:R.value/ct.value*($t.value-Pt.value));let et=null,Ut=0,Kt=0;function Ur(t){t.preventDefault(),et="v",Ut=t.clientY,Kt=R.value,document.addEventListener("mousemove",xo),document.addEventListener("mouseup",To)}function Kr(t){t.preventDefault(),et="h",Ut=t.clientX,Kt=C.value,document.addEventListener("mousemove",xo),document.addEventListener("mouseup",To)}function xo(t){if(et==="v"){const l=(t.clientY-Ut)/($t.value-Pt.value);se(null,Kt+l*ct.value),g()}else if(et==="h"){const l=(t.clientX-Ut)/(zt.value-Gt.value);se(Kt+l*st.value,null),g()}}function To(){et=null,document.removeEventListener("mousemove",xo),document.removeEventListener("mouseup",To)}function Yr(t){if(et)return;const o=t.currentTarget.getBoundingClientRect(),l=t.clientY-o.top;l<Co.value?se(null,R.value-wo()):l>Co.value+Pt.value&&se(null,R.value+wo()),g()}function Xr(t){if(et)return;const o=t.currentTarget.getBoundingClientRect(),l=t.clientX-o.left;l<Bo.value?se(C.value-Eo(),null):l>Bo.value+Gt.value&&se(C.value+Eo(),null),g()}let ft=!1,Be=0,Ce=0,mt=!1,pt=!1,Yt=0,Xt=0,jt=0,Zt=0,Do=0,Ho=0,pl=0,hl=0,Dt=!1,So=!1,ht=0,bt=0,Ro=0,bl=-1,vl=-1;function jr(t){if(t.button!==0)return;t.preventDefault(),Oe.value=null;const o=Xe(t,we.value);if(o.y<24&&o.x>=52){const n=o.x-52+C.value,i=ke(n);if(i>=0&&Math.abs(o.x-(52+pe.value[i+1]-C.value))<=4){G(),mt=!0,Yt=i,jt=M.value[i],Zt=n,g();return}}if(o.x<52&&o.y>=24){const n=o.y-24+R.value,i=Ee(n);if(i>=0&&Math.abs(o.y-(24+N.value[i+1]-R.value))<=4){G(),pt=!0,Xt=i,jt=Ae(i),Zt=n,g();return}}if(o.x<52||o.y<24){if($e(),o.y<24&&o.x>=52){const n=ke(o.x-52+C.value);n>=0&&(J(n,0,n,s-1),ft=!0,Be=n,Ce=0)}else if(o.x<52&&o.y>=24){const n=Ee(o.y-24+R.value);n>=0&&(J(0,n,p-1,n),ft=!0,Be=0,Ce=n)}else o.x<52&&o.y<24&&O();g();return}const l=ke(o.x-52+C.value),a=Ee(o.y-24+R.value);if(!(l<0||a<0)){if($e(),t.shiftKey&&E.value){const n=E.value;J(n.startCol,n.startRow,l,a)}else k(l,a);ft=!0,Be=l,Ce=a,fe(),g()}}function Zr(t){if(mt){const i=Xe(t,we.value).x-52+C.value-Zt,c=jt+i;c>=30&&c<=1e3?M.value[Yt]=c:c<30?M.value[Yt]=30:M.value[Yt]=1e3,g();return}if(pt){const i=Xe(t,we.value).y-24+R.value-Zt,c=jt+i;c>=24&&c<=500?I.value[Xt]=c:c<24?I.value[Xt]=24:I.value[Xt]=500,g();return}if(!ft){const n=we.value;if(!n)return;if(Ze.value){n.style.cursor="copy";return}const i=Xe(t,n);if(i.y<24&&i.x>=52){const c=ke(i.x-52+C.value);if(c>=0&&Math.abs(i.x-(52+pe.value[c+1]-C.value))<=4){n.style.cursor="col-resize";return}}if(i.x<52&&i.y>=24){const c=Ee(i.y-24+R.value);if(c>=0&&Math.abs(i.y-(24+N.value[c+1]-R.value))<=4){n.style.cursor="row-resize";return}}n.style.cursor="cell";return}const o=Xe(t,we.value);if(Be<0||Ce<0)return;if(o.x<52||o.y<24){if(o.y<24&&o.x>=52){const n=ke(o.x-52+C.value);n>=0&&J(Math.min(Be,n),0,Math.max(Be,n),s-1)}else if(o.x<52&&o.y>=24){const n=Ee(o.y-24+R.value);n>=0&&J(0,Math.min(Ce,n),p-1,Math.max(Ce,n))}g();return}const l=ke(o.x-52+C.value),a=Ee(o.y-24+R.value);l<0||a<0||(Ce===0&&Be>=0&&E.value&&E.value.startRow===0&&E.value.endRow===s-1?J(Math.min(Be,l),0,Math.max(Be,l),s-1):Be===0&&Ce>=0&&E.value&&E.value.startCol===0&&E.value.endCol===p-1?J(0,Math.min(Ce,a),p-1,Math.max(Ce,a)):J(Be,Ce,l,a),g())}function qr(t){const o=mt||pt;ft=!1,mt=!1,pt=!1,o&&al(),Ze.value&&Ha()}function Jr(){const t=mt||pt;ft=!1,mt=!1,pt=!1,t&&al()}function Qr(t){t.preventDefault();const o=Xe(t,we.value);if(o.x<52&&o.y<24){Nr(t);return}if(o.y<24&&o.x>=52){const l=ke(o.x-52+C.value);l>=0&&Fr(t,l);return}if(o.x<52&&o.y>=24){const l=Ee(o.y-24+R.value);l>=0&&Ir(t,l);return}if(o.x>=52&&o.y>=24){const l=ke(o.x-52+C.value),a=Ee(o.y-24+R.value);l>=0&&a>=0&&Vr(t,l,a)}}function ei(t){const o=Xe(t,we.value);if(o.x<52||o.y<24)return;const l=ke(o.x-52+C.value),a=Ee(o.y-24+R.value);l<0||a<0||(k(l,a),Q(l,a),ze(),g(),fe())}function ti(t){se(C.value+t.deltaX,R.value+t.deltaY),g()}function oi(t){if(t.touches.length!==1){Dt=!1;return}const o=t.touches[0],l=we.value;if(!l)return;const a=l.getBoundingClientRect(),n=o.clientX-a.left,i=o.clientY-a.top;n>=52&&i>=24&&(t.preventDefault(),Dt=!0,So=!1,Do=n,Ho=i,pl=C.value,hl=R.value,ht=ke(n-52+C.value),bt=Ee(i-24+R.value))}function li(t){if(!Dt||t.touches.length!==1)return;const o=t.touches[0],l=we.value;if(!l)return;const a=l.getBoundingClientRect(),n=o.clientX-a.left,i=o.clientY-a.top;(Math.abs(n-Do)>8||Math.abs(i-Ho)>8)&&(So=!0,t.preventDefault(),se(pl+(Do-n),hl+(Ho-i)),g())}function ni(){if(Dt&&(Dt=!1,!So&&ht>=0&&bt>=0)){const t=Date.now();ht===bl&&bt===vl&&t-Ro<300?(k(ht,bt),ze(),g(),fe(),Ro=0):($e(),k(ht,bt),g(),Ro=t),bl=ht,vl=bt,fe()}}function Mo(t){return t.isComposing||t.key==="Process"||t.keyCode===229}function gl(t){return t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey}function yl(t){if(S.value)return;const o=t.ctrlKey||t.metaKey,l=t.shiftKey;switch(!0){case(o&&(t.key==="c"||t.key==="C")):t.preventDefault(),Ft();return;case(o&&(t.key==="x"||t.key==="X")):t.preventDefault(),ho();return;case(o&&(t.key==="z"||t.key==="Z")):t.preventDefault(),Po();return;case(o&&(t.key==="y"||t.key==="Y")):t.preventDefault(),Uo();return;case(o&&(t.key==="v"||t.key==="V")):t.preventDefault(),G(),Bt().then(()=>{g(),e.nextTick(K)});return;case(o&&(t.key==="a"||t.key==="A")):t.preventDefault(),O(),g();return;case(o&&t.key==="Home"):t.preventDefault(),k(0,0),Q(0,0),g();return;case(o&&t.key==="End"):t.preventDefault(),k(p-1,s-1),Q(p-1,s-1),g();return;case t.key==="Home":t.preventDefault(),k(0,y.value.row),Q(0,y.value.row),g();return;case t.key==="End":t.preventDefault(),k(p-1,y.value.row),Q(p-1,y.value.row),g();return;case t.key==="ArrowUp":t.preventDefault(),Fe(0,-1),Q(y.value.col,y.value.row),g();return;case t.key==="ArrowDown":t.preventDefault(),Fe(0,1),Q(y.value.col,y.value.row),g();return;case t.key==="ArrowLeft":t.preventDefault(),Fe(-1,0),Q(y.value.col,y.value.row),g();return;case t.key==="ArrowRight":t.preventDefault(),Fe(1,0),Q(y.value.col,y.value.row),g();return;case t.key==="Tab":t.preventDefault(),Fe(l?-1:1,0),Q(y.value.col,y.value.row),g();return;case t.key==="Enter":t.preventDefault(),Fe(0,l?-1:1),Q(y.value.col,y.value.row),g();return;case t.key==="F2":t.preventDefault(),Q(y.value.col,y.value.row),ze(),g(),fe();return;case t.key==="Delete":case t.key==="Backspace":t.preventDefault(),G(),bo(),g();return;case t.key==="Escape":t.preventDefault(),je(),Ze.value=null,g();return;case gl(t):if(Mo(t)){Q(y.value.col,y.value.row),ze(""),g(),fe();return}t.preventDefault(),Q(y.value.col,y.value.row),ze(t.key),g(),e.nextTick(()=>{const a=Lt.value;a&&(a.focus(),a.setSelectionRange(1,1))});return}}let Ao=!1,No=!1;function ai(t){const o=t.target.value;if(!S.value){Q(y.value.col,y.value.row),ze(o),g();return}V.value=o}function ri(){Ao=!0,S.value||(Q(y.value.col,y.value.row),ze(""),g())}function ii(t){Ao=!1,No=!0,setTimeout(()=>{No=!1},0),V.value=t.target.value}function si(t){if(!S.value){if(gl(t)||Mo(t))return;yl(t);return}if(!(Ao||Mo(t))&&!(No&&(t.key==="Enter"||t.key==="Escape")))if(t.key==="Enter"&&(t.altKey||t.metaKey)){t.preventDefault();const o=Lt.value;if(!o)return;const l=o.selectionStart??o.value.length,a=o.selectionEnd??o.value.length,n=o.value,i=n.slice(0,l)+`
9
+ `+n.slice(a);V.value=i,o.value=i,o.selectionStart=o.selectionEnd=l+1,g()}else t.key==="Enter"?(t.preventDefault(),$e(),Fe(0,1),Q(y.value.col,y.value.row),g(),fe()):t.key==="Tab"?(t.preventDefault(),$e(),Fe(t.shiftKey?-1:1,0),Q(y.value.col,y.value.row),g(),fe()):t.key==="Escape"&&(t.preventDefault(),je(),g(),fe())}function ci(t){S.value}function di(){setTimeout(()=>{S.value&&($e(),g())},0)}function qt(){var o;const t=(o=Je.value)==null?void 0:o.getBoundingClientRect();if(t){const l=Ye(v.width),a=Ye(v.height);l!=null?re.w=l:re.w=t.width,a!=null?re.h=a:re.h=t.height}se(null,null),g()}let be=null;return e.onMounted(()=>{const t=Ye(v.width),o=Ye(v.height);(t==null||o==null)&&(be=new ResizeObserver(()=>qt()),Je.value&&be.observe(Je.value)),e.nextTick(()=>{qt(),fe()}),k(0,0),B.value&&B.value.length>0&&(H=JSON.stringify(B.value),P.value=B.value.map(l=>{const a=Ot(l.name);for(const[n,i]of Object.entries(l.cells))a.cells[n]={value:i.value,style:i.style??null};if(l.colWidths)for(const[n,i]of Object.entries(l.colWidths)){const c=Number(n);c>=0&&c<p&&i>=30&&(a.colWidths[c]=i)}if(l.rowHeights)for(const[n,i]of Object.entries(l.rowHeights)){const c=Number(n);c>=0&&c<s&&i>=24&&(a.rowHeights[c]=i)}return a}),P.value.length>0&&Pe(0))}),e.watch(()=>[v.width,v.height],()=>{const t=Ye(v.width),o=Ye(v.height);t!=null&&o!=null?(be==null||be.disconnect(),be=null):!be&&Je.value&&(be=new ResizeObserver(()=>qt()),be.observe(Je.value)),e.nextTick(()=>qt())}),e.watch(()=>v.theme,()=>g()),e.watch(()=>({...b}),()=>e.nextTick(K),{deep:!1}),e.watch(ue,()=>e.nextTick(K)),e.watch(()=>B.value,t=>{if(!t||t.length===0)return;const o=JSON.stringify(t);o!==H&&(H=o,P.value=t.map(l=>{const a=Ot(l.name);for(const[n,i]of Object.entries(l.cells))a.cells[n]={value:i.value,style:i.style??null};if(l.colWidths)for(const[n,i]of Object.entries(l.colWidths)){const c=Number(n);c>=0&&c<p&&i>=30&&(a.colWidths[c]=i)}if(l.rowHeights)for(const[n,i]of Object.entries(l.rowHeights)){const c=Number(n);c>=0&&c<s&&i>=24&&(a.rowHeights[c]=i)}return a}),P.value.length>0&&Pe(0),g())},{deep:!0}),e.onBeforeUnmount(()=>{be==null||be.disconnect()}),(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:"spreadsheet-outer",style:e.normalizeStyle(vr.value)},[e.createVNode(Un,{locale:u.value,"can-undo":Ca.value,"can-redo":xa.value,"paint-fmt-active":Ze.value!==null,"has-selection":Ta.value,"font-family-options":Ra.value,"font-size-options":Ma.value,"sel-font-family":Aa.value,"sel-font-size":he.value,"font-size-input":Ge.value,"font-size-menu-open":qe.value,"sel-font-weight":Yo.value,"sel-font-style":Xo.value,"sel-underline":jo.value,"sel-strikethrough":Zo.value,"sel-text-color":lr.value,"text-color-menu-open":fo.value,"sel-fill-color":nr.value,"fill-color-menu-open":mo.value,"cached-text-color":Nt.value,"cached-fill-color":It.value,"border-menu-open":qo.value,"cached-border":po.value,"h-align-options":Fa.value,"v-align-options":Va.value,"sel-h-align":Oa.value,"sel-v-align":La.value,"sel-wrap":Ko.value,onUndo:o[0]||(o[0]=l=>Po()),onRedo:o[1]||(o[1]=l=>Uo()),onPaintFormat:Da,onClearFormat:o[2]||(o[2]=l=>Sa()),onFontFamilyChange:o[3]||(o[3]=l=>Na(l)),onFontSizeInput:o[4]||(o[4]=l=>$a(l)),onFontSizeBlur:Ga,onFontSizeKeydown:o[5]||(o[5]=l=>Pa(l)),onFontSizeChange:o[6]||(o[6]=l=>Ia(l)),"onUpdate:fontSizeMenuOpen":o[7]||(o[7]=l=>qe.value=l),onFontSizeToggle:o[8]||(o[8]=l=>Ua()),onFontSizeStepUp:Ka,onFontSizeStepDown:Ya,onBoldToggle:Xa,onItalicToggle:ja,onUnderlineToggle:Za,onStrikethroughToggle:qa,onTextColorChange:o[9]||(o[9]=l=>Qa(l)),"onUpdate:textColorMenuOpen":o[10]||(o[10]=l=>fo.value=l),onFillColorChange:o[11]||(o[11]=l=>er(l)),"onUpdate:fillColorMenuOpen":o[12]||(o[12]=l=>mo.value=l),onApplyTextColor:tr,onApplyFillColor:or,"onUpdate:borderMenuOpen":o[13]||(o[13]=l=>Ja(l)),onBorderChange:o[14]||(o[14]=l=>Jo(l)),onApplyBorder:rr,onHAlignChange:o[15]||(o[15]=l=>_a(l)),onVAlignChange:o[16]||(o[16]=l=>Wa(l)),onWrapToggle:za},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"]),e.createElementVNode("div",aa,[e.createElementVNode("div",ra,e.toDisplayString(Er.value),1),e.createElementVNode("input",{ref_key:"formulaBarRef",ref:yo,class:"formula-bar__input",value:wr.value,onFocus:Br,onInput:Cr,onKeydown:xr,onBlur:Tr},null,40,ia)]),e.createElementVNode("div",{ref_key:"wrapperRef",ref:Je,class:"spreadsheet-wrapper"},[e.createElementVNode("canvas",{ref_key:"canvasRef",ref:we,class:"grid-canvas",tabindex:"0",onMousedown:jr,onMousemove:Zr,onMouseup:qr,onMouseleave:Jr,onDblclick:ei,onWheel:e.withModifiers(ti,["prevent"]),onFocus:yr,onKeydown:yl,onContextmenu:Qr,onTouchstart:e.withModifiers(oi,["prevent"]),onTouchmove:e.withModifiers(li,["prevent"]),onTouchend:ni},null,544),e.createElementVNode("textarea",{ref_key:"editInputRef",ref:Lt,class:"cell-editor",value:V.value,style:e.normalizeStyle($r.value),onInput:ai,onKeydown:si,onCompositionstart:ri,onCompositionend:ii,onBlur:di,onPaste:ci},null,44,sa),ct.value>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:"v-scrollbar",style:e.normalizeStyle({top:e.unref(24)+"px",height:`calc(100% - ${e.unref(24)+e.unref(11)}px)`})},[e.createElementVNode("button",{class:"sb-btn sb-btn--up",title:e.unref(w)(u.value,"scrollUp"),onMousedown:o[17]||(o[17]=e.withModifiers(l=>{se(null,R.value-50),g()},["prevent"]))},[...o[31]||(o[31]=[e.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],40,ca),e.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:Yr},[e.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:e.normalizeStyle({top:Co.value+"px",height:Pt.value+"px"}),onMousedown:Ur},null,36)],32),e.createElementVNode("button",{class:"sb-btn sb-btn--down",title:e.unref(w)(u.value,"scrollDown"),onMousedown:o[18]||(o[18]=e.withModifiers(l=>{se(null,R.value+50),g()},["prevent"]))},[...o[32]||(o[32]=[e.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],40,da)],4)):e.createCommentVNode("",!0),st.value>0?(e.openBlock(),e.createElementBlock("div",{key:1,class:"h-scrollbar",style:e.normalizeStyle({left:e.unref(52)+"px",width:`calc(100% - ${e.unref(52)+e.unref(11)}px)`})},[e.createElementVNode("button",{class:"sb-btn sb-btn--left",title:e.unref(w)(u.value,"scrollLeft"),onMousedown:o[19]||(o[19]=e.withModifiers(l=>{se(C.value-50,null),g()},["prevent"]))},[...o[33]||(o[33]=[e.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],40,ua),e.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:Xr},[e.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:e.normalizeStyle({left:Bo.value+"px",width:Gt.value+"px"}),onMousedown:Kr},null,36)],32),e.createElementVNode("button",{class:"sb-btn sb-btn--right",title:e.unref(w)(u.value,"scrollRight"),onMousedown:o[20]||(o[20]=e.withModifiers(l=>{se(C.value+50,null),g()},["prevent"]))},[...o[34]||(o[34]=[e.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],40,fa)],4)):e.createCommentVNode("",!0),st.value>0&&ct.value>0?(e.openBlock(),e.createElementBlock("div",ma)):e.createCommentVNode("",!0)],512),e.createVNode(qn,{locale:u.value,sheets:P.value,"active-sheet-index":ue.value,"ren-tab":Qe.value,"ren-tab-val":dt.value,onTabClick:o[21]||(o[21]=l=>Dr(l)),onTabDblclick:o[22]||(o[22]=l=>il(l)),onTabContextmenu:o[23]||(o[23]=l=>Mr(l.ev,l.i)),onTabRenameInput:o[24]||(o[24]=l=>dt.value=l),onTabRenameKeydown:o[25]||(o[25]=l=>Sr(l)),onTabRenameCommit:sl,onTabbarContextmenu:o[26]||(o[26]=l=>Ar(l)),onAddSheet:o[27]||(o[27]=l=>{vo(),g()})},null,8,["locale","sheets","active-sheet-index","ren-tab","ren-tab-val"]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"menu-pop"},{default:e.withCtx(()=>[Oe.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"context-menu",style:e.normalizeStyle({left:Oe.value.x+"px",top:Oe.value.y+"px"}),onClick:o[28]||(o[28]=e.withModifiers(()=>{},["stop"]))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Oe.value.items,(l,a)=>(e.openBlock(),e.createElementBlock("div",{key:a,class:e.normalizeClass(["context-menu__item",{"context-menu__item--disabled":l.disabled}]),onClick:n=>!l.disabled&&l.action&&(l.action(),Oe.value=null),onMouseenter:n=>Rr(n,l)},[e.createElementVNode("span",ha,e.toDisplayString(l.label),1),l.children?(e.openBlock(),e.createElementBlock("span",ba)):e.createCommentVNode("",!0),l.children?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["context-submenu",{"context-submenu--left":_t.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.children,(n,i)=>(e.openBlock(),e.createElementBlock("div",{key:i,class:e.normalizeClass(["context-menu__item",{"context-menu__item--disabled":n.disabled}]),onClick:e.withModifiers(c=>!n.disabled&&n.action&&(n.action(),Oe.value=null),["stop"])},e.toDisplayString(n.label),11,va))),128))],2)):e.createCommentVNode("",!0)],42,pa))),128))],4)):e.createCommentVNode("",!0)]),_:1})])),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"menu-pop"},{default:e.withCtx(()=>[ce.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"dim-panel",style:e.normalizeStyle({left:ce.value.x+"px",top:ce.value.y+"px"}),onMousedown:o[29]||(o[29]=e.withModifiers(()=>{},["stop"])),onClick:o[30]||(o[30]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",ga,e.toDisplayString(ce.value.type==="row"?e.unref(w)(u.value,"rowHeight"):e.unref(w)(u.value,"colWidth")),1),e.createElementVNode("div",ya,[e.createElementVNode("input",{ref_key:"dimInputRef",ref:dl,class:e.normalizeClass(["dim-panel__input",{"dim-panel__input--error":ce.value.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:ce.value.value,onInput:Or,onKeydown:Lr,onBlur:_r},null,42,ka),o[35]||(o[35]=e.createElementVNode("span",{class:"dim-panel__unit"},"px",-1))]),ce.value.error?(e.openBlock(),e.createElementBlock("div",Ea,e.toDisplayString(ce.value.error),1)):e.createCommentVNode("",!0),e.createElementVNode("div",wa,[e.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:ml},e.toDisplayString(e.unref(w)(u.value,"ok")),1),e.createElementVNode("button",{class:"dim-panel__btn",onClick:Wt},e.toDisplayString(e.unref(w)(u.value,"cancel")),1)])],36)):e.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-c6748ebf"]]);Le.Spreader=Wo,Le.default=Wo,Object.defineProperties(Le,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});