xiaodao-spreader 0.1.4 → 0.1.6

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.
Files changed (26) hide show
  1. package/README.ZH.md +459 -0
  2. package/README.md +409 -44
  3. package/dist/style.css +1 -1
  4. package/dist/types/components/spreader/{dropdown.vue.d.ts → components/dropdown.vue.d.ts} +7 -5
  5. package/dist/types/components/spreader/{borderPicker.vue.d.ts → components/pickers/borderPicker.vue.d.ts} +3 -0
  6. package/dist/types/components/spreader/{colorPicker.vue.d.ts → components/pickers/colorPicker.vue.d.ts} +6 -4
  7. package/dist/types/components/spreader/components/pickers/mergePicker.vue.d.ts +27 -0
  8. package/dist/types/components/spreader/{spreader.vue.d.ts → components/spreadsheet.vue.d.ts} +2 -8
  9. package/dist/types/components/spreader/{tabbar.vue.d.ts → components/tabbar.vue.d.ts} +11 -11
  10. package/dist/types/components/spreader/components/toolbar.vue.d.ts +111 -0
  11. package/dist/types/components/spreader/composables/borders-merge.d.ts +48 -0
  12. package/dist/types/components/spreader/composables/core-state.d.ts +98 -0
  13. package/dist/types/components/spreader/composables/interactions.d.ts +87 -0
  14. package/dist/types/components/spreader/composables/sheets-ops.d.ts +45 -0
  15. package/dist/types/components/spreader/composables/undo-styles.d.ts +86 -0
  16. package/dist/types/components/spreader/{constants.d.ts → core/constants.d.ts} +7 -0
  17. package/dist/types/components/spreader/{types.d.ts → core/types.d.ts} +2 -0
  18. package/dist/types/components/spreader/index.d.ts +8 -0
  19. package/dist/types/index.d.ts +2 -2
  20. package/dist/xiaodao-spreader.es.js +3439 -2617
  21. package/dist/xiaodao-spreader.umd.js +9 -9
  22. package/package.json +2 -1
  23. package/dist/types/components/spreader/toolbar.vue.d.ts +0 -44
  24. /package/dist/types/components/spreader/{formula.d.ts → core/formula.d.ts} +0 -0
  25. /package/dist/types/components/spreader/{theme.d.ts → core/theme.d.ts} +0 -0
  26. /package/dist/types/components/spreader/{utils.d.ts → core/utils.d.ts} +0 -0
@@ -1,9 +1,9 @@
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"}})});
1
+ (function(ct,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(ct=typeof globalThis<"u"?globalThis:ct||self,t(ct.XiaoDaoSpreader={},ct.Vue))})(this,function(ct,t){"use strict";const El={"zh-CN":{insert:"插入",delete:"删除",rename:"重命名",moveLeft:"左移",moveRight:"右移",cut:"剪切",copy:"复制",paste:"粘贴",addSheet:"新建工作表",moveSheetLeft:"左移",moveSheetRight:"右移",scrollUp:"向上滚动",scrollDown:"向下滚动",scrollLeft:"向左滚动",scrollRight:"向右滚动",calculate:"计算",sum:"求和",undo:"撤销",redo:"重做",paintFormat:"格式刷",clearFormat:"清除格式",fontFamily:"字体",fontSize:"字号",fontSizeIncrease:"增大字号",fontSizeDecrease:"减小字号",bold:"加粗",italic:"斜体",underline:"下划线",strikethrough:"删除线",fontColor:"文字颜色",fillColor:"填充颜色",borders:"边框",hAlign:"水平对齐",vAlign:"垂直对齐",alignLeft:"左端对齐",alignCenter:"居中对齐",alignRight:"右端对齐",alignTop:"顶端对齐",alignMiddle:"垂直居中",alignBottom:"底端对齐",wrap:"自动换行",mergeCells:"合并单元格",mergeCenter:"合并后居中",mergeAcross:"跨越合并",unmergeCells:"取消合并单元格",borderBottom:"下框线",borderTop:"上框线",borderLeft:"左框线",borderRight:"右框线",borderNone:"无框线",borderAll:"所有框线",borderOuter:"外框线",borderThickOuter:"粗外框线",fontDefault:"默认",rowHeight:"行高",colWidth:"列宽",autoRowHeight:"自动行高",defaultColWidth:"默认列宽",ok:"确定",cancel:"取消",dimNumberError:"请输入数字",dimRangeError:"请输入 {min}~{max} 之间的数值",colorAutomatic:"自动",colorNoFill:"无填充",colorWhite:"白色",colorBlack:"黑色",colorLightGray:"浅灰",colorLightBlue:"浅蓝",colorLightOrange:"浅橙",colorLightYellow:"浅黄",colorLightGreen:"浅绿",colorPaleBlue:"淡蓝",colorPaleOrange:"淡橙",colorPaleYellow:"淡黄",colorPaleGreen:"淡绿",colorSilver:"银色",colorSkyBlue:"天蓝",colorCoral:"珊瑚",colorGold:"金色",colorMint:"薄荷",colorGray:"灰色",colorMediumBlue:"中蓝",colorOrange:"橙色",colorAmber:"琥珀",colorMediumGreen:"中绿",colorDarkGray:"深灰",colorRoyalBlue:"宝蓝",colorRed:"红色",colorDarkGold:"深金",colorDarkGreen:"深绿",colorCharcoal:"炭灰",colorDeepBlue:"深蓝",colorDarkRed:"深红",colorOlive:"橄榄",colorForest:"森林",colorSlate:"石板灰",colorNavy:"藏青",colorCrimson:"绯红",colorDarkOlive:"深橄榄",colorDeepForest:"深林",colorDarkSlate:"深石板灰",colorMidnight:"午夜蓝",colorMaroon:"栗色",colorCoffee:"咖啡色",colorEvergreen:"常青",colorDarkNavy:"深藏青",colorDarkMaroon:"深栗",colorDarkCoffee:"深咖",colorInkGreen:"墨绿"},"en-US":{insert:"Insert",delete:"Delete",rename:"Rename",moveLeft:"Move Left",moveRight:"Move Right",cut:"Cut",copy:"Copy",paste:"Paste",addSheet:"Add new sheet",moveSheetLeft:"Move Left",moveSheetRight:"Move Right",scrollUp:"Scroll up",scrollDown:"Scroll down",scrollLeft:"Scroll left",scrollRight:"Scroll right",calculate:"Calculate",sum:"Sum",undo:"Undo",redo:"Redo",paintFormat:"Paint Format",clearFormat:"Clear Format",fontFamily:"Font Family",fontSize:"Font Size",fontSizeIncrease:"Increase Font Size",fontSizeDecrease:"Decrease Font Size",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",fontColor:"Font Color",fillColor:"Fill Color",borders:"Borders",hAlign:"Horizontal Align",vAlign:"Vertical Align",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignTop:"Align Top",alignMiddle:"Align Middle",alignBottom:"Align Bottom",wrap:"Wrap Text",mergeCells:"Merge Cells",mergeCenter:"Merge & Center",mergeAcross:"Merge Across",unmergeCells:"Unmerge Cells",borderBottom:"Bottom Border",borderTop:"Top Border",borderLeft:"Left Border",borderRight:"Right Border",borderNone:"No Border",borderAll:"All Borders",borderOuter:"Outside Borders",borderThickOuter:"Thick Box Border",fontDefault:"Default",rowHeight:"Row Height",colWidth:"Column Width",autoRowHeight:"Auto Row Height",defaultColWidth:"Default Column Width",ok:"OK",cancel:"Cancel",dimNumberError:"Please enter a number",dimRangeError:"Please enter a value between {min} and {max}",colorAutomatic:"Automatic",colorNoFill:"No Fill",colorWhite:"White",colorBlack:"Black",colorLightGray:"Light Gray",colorLightBlue:"Light Blue",colorLightOrange:"Light Orange",colorLightYellow:"Light Yellow",colorLightGreen:"Light Green",colorPaleBlue:"Pale Blue",colorPaleOrange:"Pale Orange",colorPaleYellow:"Pale Yellow",colorPaleGreen:"Pale Green",colorSilver:"Silver",colorSkyBlue:"Sky Blue",colorCoral:"Coral",colorGold:"Gold",colorMint:"Mint",colorGray:"Gray",colorMediumBlue:"Medium Blue",colorOrange:"Orange",colorAmber:"Amber",colorMediumGreen:"Medium Green",colorDarkGray:"Dark Gray",colorRoyalBlue:"Royal Blue",colorRed:"Red",colorDarkGold:"Dark Gold",colorDarkGreen:"Dark Green",colorCharcoal:"Charcoal",colorDeepBlue:"Deep Blue",colorDarkRed:"Dark Red",colorOlive:"Olive",colorForest:"Forest",colorSlate:"Slate",colorNavy:"Navy",colorCrimson:"Crimson",colorDarkOlive:"Dark Olive",colorDeepForest:"Deep Forest",colorDarkSlate:"Dark Slate",colorMidnight:"Midnight",colorMaroon:"Maroon",colorCoffee:"Coffee",colorEvergreen:"Evergreen",colorDarkNavy:"Dark Navy",colorDarkMaroon:"Dark Maroon",colorDarkCoffee:"Dark Coffee",colorInkGreen:"Ink Green"}};function $(e,v){var C;return((C=El[e])==null?void 0:C[v])??v}const $t='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',at=10,Bl=[{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'}],Rl=[{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}],xl='<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>',Sl='<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>',Ml='<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>',Tl='<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>',Dl='<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>',Hl='<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:xl},{value:"center",labelKey:"alignCenter",icon:Sl},{value:"right",labelKey:"alignRight",icon:Ml}],Fl=[{value:"top",labelKey:"alignTop",icon:Tl},{value:"middle",labelKey:"alignMiddle",icon:Dl},{value:"bottom",labelKey:"alignBottom",icon:Hl}],sl=[{key:"mergeCenter",labelKey:"mergeCenter",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M709.952 465.92l88-76.032C801.92 385.984 806.656 384 812.032 384s10.048 1.984 14.08 5.952C830.08 393.92 832 398.656 832 403.968L832 448l32 0C881.664 448 896 462.336 896 480S881.664 512 864 512L832 512l0 44.032c0 5.376-1.92 10.112-5.952 14.08C822.08 574.08 817.344 576 812.032 576s-10.048-1.92-14.08-5.952L709.952 494.08C705.984 490.112 704 485.376 704 480S705.984 469.952 709.952 465.92zM378.048 465.92 290.048 389.952C286.08 385.984 281.344 384 275.968 384s-10.048 1.984-14.08 5.952C257.92 393.92 256 398.656 256 403.968L256 448 224 448C206.336 448 192 462.336 192 480S206.336 512 224 512L256 512l0 44.032c0 5.376 1.92 10.112 5.952 14.08C265.92 574.08 270.656 576 275.968 576s10.048-1.92 14.08-5.952L378.048 494.08C382.016 490.112 384 485.376 384 480S382.016 469.952 378.048 465.92zM448 128 128 128l0 704 320 0 0-128 64 0 0 128c0 35.392-28.608 64-64 64L128 896c-35.392 0-64-28.608-64-64L64 128c0-35.392 28.608-64 64-64l320 0 0 0c35.392 0 64 28.608 64 64l0 128L448 256 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128M722.304 642.304c0 8.512-3.52 16.32-10.496 23.36s-15.424 10.624-25.344 10.624c-5.76 0-10.688-1.088-14.72-3.136-4.096-2.048-7.616-4.928-10.432-8.512s-5.824-9.088-9.024-16.512-5.952-13.952-8.32-19.648l-17.28-46.016L479.36 582.464 462.08 629.568c-6.72 18.304-12.48 30.656-17.344 37.12s-12.544 9.6-23.424 9.6c-9.28 0-17.408-3.456-24.512-10.24s-10.624-14.592-10.624-23.232c0-4.992 0.896-10.176 2.496-15.488S393.024 614.592 396.8 605.056l92.672-238.016C492.096 360.256 495.296 352 499.008 342.464s7.68-17.536 11.904-23.872 9.664-11.456 16.576-15.36c6.784-3.968 15.232-5.888 25.344-5.888 10.176 0 18.752 1.92 25.472 5.888 6.848 3.968 12.352 8.96 16.64 15.104 4.096 6.208 7.744 12.8 10.624 19.904s6.528 16.576 11.008 28.352l94.656 236.48C718.592 621.056 722.304 634.112 722.304 642.304zM606.912 526.784 552.32 375.552 498.624 526.784 606.912 526.784z"/></svg>'},{key:"mergeAcross",labelKey:"mergeAcross",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M832 64c70.4 0 128 57.6 128 128v640c0 70.4-57.6 128-128 128H192c-70.4 0-128-57.6-128-128V192c0-70.4 57.6-128 128-128h640zM448 768H128v64c0 38.4 25.6 64 64 64h256v-128z m448 0H512v128h320c38.4 0 64-25.6 64-64v-64z m0-448H128v384h768V320zM633.6 390.4l96 96c6.4 6.4 6.4 12.8 6.4 19.2 0 6.4-6.4 12.8-6.4 19.2L633.6 633.6c-12.8 12.8-32 12.8-44.8 0-12.8-12.8-12.8-32-6.4-44.8l44.8-44.8H288c-19.2 0-32-12.8-32-32s12.8-32 32-32h339.2l-44.8-44.8c-6.4-12.8-6.4-32 0-44.8 12.8-12.8 38.4-12.8 51.2 0zM448 128H192c-38.4 0-64 25.6-64 64v64h320V128z m384 0H512v128h384V192c0-38.4-25.6-64-64-64z"/></svg>'},{key:"mergeCells",labelKey:"mergeCells",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M512 480c0 5.376-1.984 10.112-5.952 14.08L354.048 634.048C350.08 638.08 345.344 640 339.968 640s-10.048-1.92-14.08-5.952C321.92 630.144 320 625.344 320 620.032L320 512 224 512C206.336 512 192 497.664 192 480S206.336 448 224 448L320 448 320 339.968c0-5.376 1.92-10.048 5.952-14.08C329.92 321.984 334.656 320 339.968 320s10.048 1.984 14.08 5.952L506.048 465.92C510.016 469.952 512 474.624 512 480zM576 480c0 5.376 1.984 10.112 5.952 14.08l152 140.032C737.92 638.08 742.656 640 748.032 640s10.048-1.92 14.08-5.952C766.08 630.144 768 625.344 768 620.032L768 512l96 0C881.664 512 896 497.664 896 480S881.664 448 864 448L768 448 768 339.968c0-5.376-1.92-10.048-5.952-14.08C758.08 321.984 753.344 320 748.032 320s-10.048 1.984-14.08 5.952L581.952 465.92C577.984 469.952 576 474.624 576 480zM448 128l0 128 64 0L512 128c0-35.392-28.672-64-64-64l0 0L128 64C92.672 64 64 92.608 64 128l0 704c0 35.392 28.672 64 64 64l320 0c35.328 0 64-28.608 64-64l0-128L448 704l0 128L128 832 128 128 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128"/></svg>'},{key:"unmergeCells",labelKey:"unmergeCells",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M197.952 465.92l152-140.032C353.92 321.984 358.656 320 364.032 320s10.048 1.984 14.08 5.952C382.08 329.92 384 334.656 384 339.968L384 448l96 0C497.664 448 512 462.336 512 480S497.664 512 480 512L384 512l0 108.032c0 5.376-1.92 10.112-5.952 14.08C374.08 638.08 369.344 640 364.032 640S353.92 638.08 349.952 634.048L197.952 494.08C193.984 490.112 192 485.376 192 480S193.984 469.952 197.952 465.92zM890.048 465.92l-152-140.032C734.08 321.984 729.344 320 723.968 320s-10.048 1.984-14.08 5.952C705.92 329.92 704 334.656 704 339.968L704 448 608 448C590.336 448 576 462.336 576 480S590.336 512 608 512L704 512l0 108.032c0 5.376 1.92 10.112 5.952 14.08C713.92 638.08 718.656 640 723.968 640s10.048-1.92 14.08-5.952l152-140.032C894.016 490.112 896 485.376 896 480S894.016 469.952 890.048 465.92zM448 128l0 128 64 0L512 128c0-35.392-28.608-64-64-64l0 0L128 64C92.608 64 64 92.608 64 128l0 704c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64l0-128L448 704l0 128L128 832 128 128 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128"/></svg>'}],Nl={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"},Il={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"},Ll=["title"],Ol=["innerHTML"],Vl={key:1,class:"sp-dropdown__value"},Wl=["disabled"],zl=["onClick"],$l=["innerHTML"],_l={class:"sp-dropdown__item-label"},Gl=["disabled"],Kl=t.defineComponent({__name:"dropdown",props:{modelValue:{},options:{},width:{default:"auto"},menuWidth:{default:void 0},visibleCount:{default:8},title:{default:""},modelOpen:{type:Boolean,default:void 0},hideTrigger:{type:Boolean,default:!1},align:{default:"left"},triggerEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:v}){const C=e,n=v,u=t.ref(!1),k=t.ref(0),i=t.ref(null),I=t.ref(null),p=t.ref(null),ee=t.ref({top:0,up:!1}),Y=t.ref(0),y=t.ref(!1),ne=t.computed(()=>C.options.find(ce=>String(ce.value)===String(C.modelValue))),A=t.computed(()=>C.menuWidth),m=t.computed(()=>Math.min(C.visibleCount,C.options.length)),ge=t.computed(()=>C.options.slice(k.value,k.value+m.value)),me=t.computed(()=>k.value>0),we=t.computed(()=>k.value+m.value<C.options.length),G=t.computed(()=>C.options.length>m.value);function U(ce){k.value=Math.max(0,Math.min(C.options.length-m.value,k.value+ce))}function pe(){u.value=!0,C.modelOpen!==void 0&&n("update:modelOpen",!0);const ce=C.triggerEl??i.value;if(!ce)return;const r=ce.getBoundingClientRect(),f=m.value*22+(G.value?2*15:0)+8,o=window.innerHeight-r.bottom-4<f&&r.top-4>f;C.align==="right"?ee.value={right:window.innerWidth-r.right,top:o?r.top-f-4:r.bottom+4,up:o}:ee.value={left:r.left,top:o?r.top-f-4:r.bottom+4,up:o};const a=C.options.findIndex(O=>String(O.value)===String(C.modelValue));k.value=a>=0?Math.max(0,Math.min(a-Math.floor(m.value/2),C.options.length-m.value)):0}function T(){u.value=!1,C.modelOpen!==void 0&&n("update:modelOpen",!1)}function P(){u.value?T():pe()}function be(ce){n("update:modelValue",ce.value),n("change",ce.value),T()}function ye(ce){var f,w;if(!u.value)return;const r=ce.target;(f=i.value)!=null&&f.contains(r)||(w=p.value)!=null&&w.contains(r)||T()}function te(ce){u.value&&(ce.preventDefault(),U(ce.deltaY>0?1:-1))}t.watch(u,ce=>{t.nextTick(()=>{var r,f;ce?(r=I.value)==null||r.addEventListener("wheel",te,{passive:!1}):(f=I.value)==null||f.removeEventListener("wheel",te)})}),t.watch(()=>C.modelOpen,ce=>{ce!==void 0&&ce!==u.value&&(ce?pe():T())});function s(ce){u.value&&(Y.value=ce.touches[0].clientY,y.value=!0)}function h(ce){if(!u.value||!y.value)return;const r=ce.touches[0].clientY-Y.value;Math.abs(r)>5&&(U(r<0?1:-1),Y.value=ce.touches[0].clientY)}function He(){y.value=!1}function Se(ce){ce.key==="Escape"&&T()}return t.onMounted(()=>{document.addEventListener("mousedown",ye),window.addEventListener("resize",T),window.addEventListener("scroll",T,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("mousedown",ye),window.removeEventListener("resize",T),window.removeEventListener("scroll",T,!0)}),(ce,r)=>{var f,w;return t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:i,class:"sp-dropdown",style:t.normalizeStyle(typeof e.width=="number"?{width:e.width+"px"}:{width:e.width})},[e.hideTrigger?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__trigger",{"sp-dropdown__trigger--open":u.value}]),title:e.title,onClick:P},[(f=ne.value)!=null&&f.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:ne.value.icon},null,8,Ol)):(t.openBlock(),t.createElementBlock("span",Vl,t.toDisplayString(((w=ne.value)==null?void 0:w.label)??""),1)),r[2]||(r[2]=t.createElementVNode("svg",{class:"sp-dropdown__caret",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1))],10,Ll)),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[u.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:p,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":ee.value.up}]),style:t.normalizeStyle({left:ee.value.left!==void 0?ee.value.left+"px":void 0,right:ee.value.right!==void 0?ee.value.right+"px":void 0,top:ee.value.top+"px",minWidth:A.value!==void 0?typeof A.value=="number"?A.value+"px":A.value:void 0}),onKeydown:Se},[G.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!me.value}]),disabled:!me.value,onClick:r[0]||(r[0]=o=>U(-1))},[...r[3]||(r[3]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 662.613333a32 32 0 0 0 45.226667 0L512 375.893333l286.72 286.72a32 32 0 1 0 45.226667-45.226666l-309.333334-309.333334a32 32 0 0 0-45.226666 0l-309.333334 309.333334a32 32 0 0 0 0 45.226666z"})],-1)])],10,Wl)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:I,class:"sp-dropdown__list",onTouchstart:s,onTouchmove:h,onTouchend:He},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ge.value,o=>(t.openBlock(),t.createElementBlock("button",{key:String(o.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(o.value)===String(e.modelValue)}]),onClick:a=>be(o)},[o.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:o.icon},null,8,$l)):t.createCommentVNode("",!0),t.createElementVNode("span",_l,t.toDisplayString(o.label),1)],10,zl))),128))],544),G.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!we.value}]),disabled:!we.value,onClick:r[1]||(r[1]=o=>U(1))},[...r[4]||(r[4]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],10,Gl)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),ft=(e,v)=>{const C=e.__vccOpts||e;for(const[n,u]of v)C[n]=u;return C},_t=ft(Kl,[["__scopeId","data-v-8dc09f5d"]]),Ul=["title","onClick"],dl=ft(t.defineComponent({__name:"colorPicker",props:{modelOpen:{type:Boolean,default:void 0},colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{expose:v,emit:C}){const n=e,u=C,k=[[{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"}]],i=[[{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"}]],I=t.computed(()=>n.colorKey==="fill"?i:k);function p(G){return $(n.locale,G)}function ee(G){const U=n.currentColor;return!U&&!G?!0:U?U.toLowerCase()===G.toLowerCase():!1}const Y=t.ref(!1),y=t.ref(null),ne=t.ref(null),A=t.ref({top:0});t.watch(()=>n.modelOpen,G=>{G!==void 0&&G!==Y.value&&(G?ge():me())});function m(G){const U=y.value,pe=ne.value,T=G.target;U&&U.contains(T)||pe&&pe.contains(T)||me()}function ge(){Y.value=!0,n.modelOpen!==void 0&&u("update:modelOpen",!0),t.nextTick(()=>{const G=n.triggerEl??y.value;if(G){const U=G.getBoundingClientRect(),pe=150,T=120;let P=window.innerWidth-U.right,be=U.bottom+4,ye;U.left-T<4&&(P=void 0,ye=Math.max(4,U.left)),be+pe>window.innerHeight-4&&(be=U.top-pe-4),be<4&&(be=4),A.value=P!==void 0?{right:P,top:be}:{left:ye,top:be}}document.addEventListener("mousedown",m)})}function me(){Y.value=!1,n.modelOpen!==void 0&&u("update:modelOpen",!1),document.removeEventListener("mousedown",m)}function we(G){u("update:modelValue",G),u("change",G),me()}return t.onBeforeUnmount(()=>{document.removeEventListener("mousedown",m)}),v({open:Y,openMenu:ge,close:me}),(G,U)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:y,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[Y.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:ne,class:"color-picker__menu",style:t.normalizeStyle({left:A.value.left!==void 0?A.value.left+"px":void 0,right:A.value.right!==void 0?A.value.right+"px":void 0,top:A.value.top+"px"}),onMousedown:U[0]||(U[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(I.value,(pe,T)=>(t.openBlock(),t.createElementBlock("div",{key:T,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(pe,P=>(t.openBlock(),t.createElementBlock("button",{key:P.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":ee(P.value)}]),title:p(P.key),style:t.normalizeStyle({background:P.value||"transparent",border:P.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:be=>we(P.value)},null,14,Ul))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f00d0dae"]]),Pl=["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=ft(t.defineComponent({__name:"borderPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:v,emit:C}){const n=e,u=C,k=[{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"}],i=[{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}],I={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"]},p={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function ee(G,U){return p[G].includes(U)?"thick":I[G].includes(U)?"solid":"dashed"}const Y=t.ref(!1),y=t.ref(null),ne=t.ref(null),A=t.ref({top:0});t.watch(()=>n.modelOpen,G=>{G!==void 0&&G!==Y.value&&(G?ge():me())});function m(G){const U=y.value,pe=ne.value,T=G.target;U&&U.contains(T)||pe&&pe.contains(T)||me()}function ge(){Y.value=!0,n.modelOpen!==void 0&&u("update:modelOpen",!0),t.nextTick(()=>{const G=n.triggerEl??y.value;if(G){const U=G.getBoundingClientRect(),pe=200,T=160;let P=window.innerWidth-U.right,be=U.bottom+4,ye;U.left-T<4&&(P=void 0,ye=Math.max(4,U.left)),be+pe>window.innerHeight-4&&(be=U.top-pe-4),be<4&&(be=4),A.value=P!==void 0?{right:P,top:be}:{left:ye,top:be}}document.addEventListener("mousedown",m)})}function me(){Y.value=!1,n.modelOpen!==void 0&&u("update:modelOpen",!1),document.removeEventListener("mousedown",m)}function we(G){u("change",G),me()}return t.onBeforeUnmount(()=>{document.removeEventListener("mousedown",m)}),v({open:Y,openMenu:ge,close:me}),(G,U)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:y,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[Y.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:ne,class:"border-picker__menu",style:t.normalizeStyle({left:A.value.left!==void 0?A.value.left+"px":void 0,right:A.value.right!==void 0?A.value.right+"px":void 0,top:A.value.top+"px"}),onMousedown:U[0]||(U[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(k,pe=>t.createElementVNode("button",{key:pe.key,class:"border-picker__item",title:t.unref($)(e.locale,pe.i18nKey),onClick:T=>we(pe.key)},[(t.openBlock(),t.createElementBlock("svg",Yl,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,T=>t.createElementVNode("line",{key:T.name,x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,stroke:"currentColor","stroke-width":ee(pe.key,T.name)==="thick"?3:1.5,"stroke-dasharray":ee(pe.key,T.name)==="dashed"?"0 4":"none","stroke-linecap":ee(pe.key,T.name)==="dashed"?"round":"square"},null,8,Xl)),64))])),t.createElementVNode("span",jl,t.toDisplayString(t.unref($)(e.locale,pe.i18nKey)),1)],8,Pl)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-3721e5e4"]]),ql=["title","onClick"],Jl=["innerHTML"],Ql={class:"merge-picker__label"},eo=ft(t.defineComponent({__name:"mergePicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:v,emit:C}){const n=e,u=C,k=t.ref(!1),i=t.ref(null),I=t.ref(null),p=t.ref({top:0});t.watch(()=>n.modelOpen,A=>{A!==void 0&&A!==k.value&&(A?Y():y())});function ee(A){const m=i.value,ge=I.value,me=A.target;m&&m.contains(me)||ge&&ge.contains(me)||y()}function Y(){k.value=!0,n.modelOpen!==void 0&&u("update:modelOpen",!0),t.nextTick(()=>{const A=n.triggerEl??i.value;if(A){const m=A.getBoundingClientRect(),ge=sl.length*30+12,me=160;let we=window.innerWidth-m.right,G=m.bottom+4,U;m.left-me<4&&(we=void 0,U=Math.max(4,m.left)),G+ge>window.innerHeight-4&&(G=m.top-ge-4),G<4&&(G=4),p.value=we!==void 0?{right:we,top:G}:{left:U,top:G}}document.addEventListener("mousedown",ee)})}function y(){k.value=!1,n.modelOpen!==void 0&&u("update:modelOpen",!1),document.removeEventListener("mousedown",ee)}function ne(A){u("change",A),y()}return t.onBeforeUnmount(()=>{document.removeEventListener("mousedown",ee)}),v({open:k,openMenu:Y,close:y}),(A,m)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:i,class:"merge-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[k.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:I,class:"merge-picker__menu",style:t.normalizeStyle({left:p.value.left!==void 0?p.value.left+"px":void 0,right:p.value.right!==void 0?p.value.right+"px":void 0,top:p.value.top+"px"}),onMousedown:m[0]||(m[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(sl),ge=>(t.openBlock(),t.createElementBlock("button",{key:ge.key,class:"merge-picker__item",title:t.unref($)(e.locale,ge.labelKey),onClick:me=>ne(ge.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:ge.icon},null,8,Jl),t.createElementVNode("span",Ql,t.toDisplayString(t.unref($)(e.locale,ge.labelKey)),1)],8,ql))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-24e4dbe5"]]),to={class:"tb-item","data-key":"undo"},lo=["title","disabled"],oo={class:"tb-item","data-key":"redo"},no=["title","disabled"],ro={class:"tb-item","data-key":"paint"},ao=["title","disabled"],io={class:"tb-item","data-key":"clear"},co=["title","disabled"],so={class:"tb-item","data-key":"font"},uo={class:"tb-item","data-key":"fontSize"},fo={class:"toolbar-font-size"},mo=["value","title"],po=["title"],go=["title","disabled"],ho=["title","disabled"],vo={class:"tb-item","data-key":"bold"},Co=["title","disabled"],bo={class:"tb-item","data-key":"italic"},yo=["title","disabled"],wo={class:"tb-item","data-key":"underline"},ko=["title","disabled"],Eo={class:"tb-item","data-key":"strike"},Bo=["title","disabled"],Ro={class:"tb-item","data-key":"textColor"},xo={class:"toolbar-split"},So=["title","disabled"],Mo={viewBox:"0 0 1024 1024",fill:"currentColor"},To=["fill"],Do=["title","disabled"],Ho={class:"tb-item","data-key":"fillColor"},Ao={class:"toolbar-split"},Fo=["title","disabled"],No={viewBox:"0 0 1024 1024",fill:"currentColor"},Io=["fill"],Lo=["title","disabled"],Oo={class:"tb-item","data-key":"border"},Vo={class:"toolbar-split"},Wo=["title","disabled"],zo={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},$o=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],_o=["title","disabled"],Go={class:"tb-item","data-key":"hAlign"},Ko={class:"tb-item","data-key":"vAlign"},Uo={class:"tb-item","data-key":"wrap"},Po=["title"],Yo={class:"tb-item","data-key":"merge"},Xo={class:"toolbar-split"},jo=["title","disabled"],Zo=["title","disabled"],Jt=2,qo=6,Jo=34,Qo=ft(t.defineComponent({__name:"toolbar",props:{locale:{},canUndo:{type:Boolean},canRedo:{type:Boolean},paintFmtActive:{type:Boolean},hasSelection:{type:Boolean},fontFamilyOptions:{},fontSizeOptions:{},selFontFamily:{},selFontSize:{},fontSizeInput:{},fontSizeMenuOpen:{type:Boolean},selFontWeight:{type:Boolean},selFontStyle:{type:Boolean},selUnderline:{type:Boolean},selStrikethrough:{type:Boolean},selTextColor:{},textColorMenuOpen:{type:Boolean},selFillColor:{},fillColorMenuOpen:{type:Boolean},cachedTextColor:{},cachedFillColor:{},borderMenuOpen:{type:Boolean},cachedBorder:{},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},themeVars:{}},emits:["undo","redo","paint-format","clear-format","font-size-blur","font-size-toggle","font-size-step-up","font-size-step-down","bold-toggle","italic-toggle","underline-toggle","strikethrough-toggle","apply-text-color","apply-fill-color","apply-border","wrap-toggle","apply-merge","font-family-change","font-size-change","h-align-change","v-align-change","font-size-input","text-color-change","fill-color-change","font-size-keydown","update:font-size-menu-open","update:text-color-menu-open","update:fill-color-menu-open","update:border-menu-open","update:merge-menu-open","border-change","merge-change"],setup(e,{emit:v}){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}],n={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},u={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function k(w,o){return u[w].includes(o)?"thick":n[w].includes(o)?"solid":"dashed"}const i=["undo","redo","paint","clear","sep1","font","fontSize","sep2","bold","italic","underline","strike","sep3","textColor","fillColor","border","sep4","hAlign","vAlign","wrap","merge"],I=t.ref(null),p=t.ref(null),ee=t.ref(null),Y=t.ref(null),y=t.ref(null),ne=t.ref(null),A=t.ref(null),m=t.ref(null),ge=t.ref(new Set),me=t.ref(!1),we=t.ref(!1),G=t.ref(0),U=new Map,pe=t.computed(()=>ge.value.size>0);function T(w){return ge.value.has(w)}function P(){if(!I.value)return;I.value.querySelectorAll(".tb-item").forEach(o=>{const a=o.dataset.key;a&&U.set(a,o.offsetWidth)})}function be(w,o){if(w.size!==o.size)return!1;for(const a of w)if(!o.has(a))return!1;return!0}function ye(){if(!I.value)return;const w=I.value.clientWidth-qo*2;if(w<=0)return;U.size===0&&P();let o=0;for(const O of i)o+=(U.get(O)??0)+Jt;const a=new Set;if(o>w){const O=w-Jo-Jt;let H=0;for(let V=0;V<i.length;V++){const ae=i[V],ve=(U.get(ae)??0)+Jt;if(H+ve>O){for(let xe=V;xe<i.length;xe++)a.add(i[xe]);break}H+=ve}}be(a,ge.value)||(ge.value=a,G.value++,a.size===0&&(me.value=!1))}let te=null;const s=t.ref(0),h=t.computed(()=>{const w=ee.value,o={position:"fixed",top:"0px",right:"0px"};if(!w)return{...r.themeVars,...o};s.value;const a=w.getBoundingClientRect();return{...r.themeVars,position:"fixed",top:`${a.bottom+4}px`,right:`${window.innerWidth-a.right}px`}});function He(){me.value&&(s.value++,t.nextTick(()=>ye()))}function Se(w){var a,O;if(!me.value)return;const o=w.target;(a=p.value)!=null&&a.contains(o)||(O=ee.value)!=null&&O.contains(o)||(we.value=!0,me.value=!1,t.nextTick(()=>{we.value=!1}))}function ce(){me.value=!me.value}t.onMounted(()=>{t.nextTick(()=>{P(),ye()}),I.value&&(te=new ResizeObserver(()=>{me.value||ye()}),te.observe(I.value)),document.addEventListener("mousedown",Se,!0),window.addEventListener("resize",He)}),t.onBeforeUnmount(()=>{te==null||te.disconnect(),document.removeEventListener("mousedown",Se,!0),window.removeEventListener("resize",He)});const r=e,f=v;return(w,o)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:I,class:"toolbar"},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("undo"),to:p.value??void 0},[t.createElementVNode("div",to,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref($)(e.locale,"undo"),disabled:!e.canUndo,onClick:o[0]||(o[0]=a=>f("undo"))},[...o[39]||(o[39]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272"})],-1)])],10,lo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("redo"),to:p.value??void 0},[t.createElementVNode("div",oo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref($)(e.locale,"redo"),disabled:!e.canRedo,onClick:o[1]||(o[1]=a=>f("redo"))},[...o[40]||(o[40]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{transform:"translate(1024, 0) scale(-1, 1)",d:"M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272"})],-1)])],10,no)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("paint"),to:p.value??void 0},[t.createElementVNode("div",ro,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref($)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:o[2]||(o[2]=a=>f("paint-format"))},[...o[41]||(o[41]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M722.285714 438.857143a36.571429 36.571429 0 0 1-36.571428 36.571428h-512a36.571429 36.571429 0 0 1-36.571429-36.571428V164.571429a36.571429 36.571429 0 0 1 36.571429-36.571429h512a36.571429 36.571429 0 0 1 36.571428 36.571429V256h128a36.571429 36.571429 0 0 1 36.571429 36.571429v294.4a36.571429 36.571429 0 0 1-31.890286 36.278857L448 675.766857V859.428571a36.571429 36.571429 0 0 1-32.292571 36.315429l-4.278858 0.256a36.571429 36.571429 0 0 1-36.571428-36.571429v-215.771428a36.571429 36.571429 0 0 1 31.890286-36.278857l406.966857-52.553143V329.142857h-91.428572v109.714286z m-73.142857-237.714286h-438.857143V402.285714h438.857143V201.142857z"})],-1)])],10,ao)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("clear"),to:p.value??void 0},[t.createElementVNode("div",io,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref($)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:o[3]||(o[3]=a=>f("clear-format"))},[...o[42]||(o[42]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M672.748 105.674c-3.666-3.799-8.778-5.949-14.125-5.949-5.341 0-10.459 2.15-14.119 5.949L10.418 754.633c-7.789 8.163-7.789 20.798 0 28.967l123.353 126.213c7.782 7.979 23.113 14.461 34.111 14.461h395.042c12.774-0.742 24.882-5.854 34.162-14.461l416.525-426.362c7.751-8.163 7.751-20.76 0-28.916l-340.92-348.861h0.057zM557.85 832.801c-9.273 8.582-21.343 13.707-34.111 14.461H217.888c-12.781-0.742-24.882-5.867-34.162-14.461l-58.074-59.482c-7.782-8.163-7.782-20.804 0-28.967l232.333-237.87c3.666-3.799 8.778-5.949 14.125-5.949s10.453 2.15 14.119 5.949l231.102 236.551c7.744 8.157 7.744 20.753 0 28.916l-59.539 60.909 0.058-0.057z m0 0"})],-1)])],10,co)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("sep1"),to:p.value??void 0},[o[43]||(o[43]=t.createElementVNode("div",{class:"tb-item","data-key":"sep1"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("font"),to:p.value??void 0},[t.createElementVNode("div",so,[t.createVNode(_t,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:T("font")?"100%":110,"menu-width":T("font")?120:void 0,"visible-count":8,title:t.unref($)(e.locale,"fontFamily"),onChange:o[4]||(o[4]=a=>f("font-family-change",a))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("fontSize"),to:p.value??void 0},[t.createElementVNode("div",uo,[t.createElementVNode("div",fo,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref($)(e.locale,"fontSize"),onInput:o[5]||(o[5]=a=>f("font-size-input",a.target.value)),onBlur:o[6]||(o[6]=a=>f("font-size-blur")),onKeydown:o[7]||(o[7]=a=>f("font-size-keydown",a))},null,40,mo),t.createVNode(_t,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:T("fontSize")?"100%":56,"menu-width":T("fontSize")?120:56,"visible-count":9,title:t.unref($)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,"trigger-el":m.value,"onUpdate:modelOpen":o[8]||(o[8]=a=>f("update:font-size-menu-open",a)),onChange:o[9]||(o[9]=a=>f("font-size-change",a))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:m,class:"toolbar-font-size__btn",type:"button",title:t.unref($)(e.locale,"fontSize"),onMousedown:o[10]||(o[10]=t.withModifiers(()=>{},["prevent"])),onClick:o[11]||(o[11]=a=>f("font-size-toggle"))},[...o[44]||(o[44]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],40,po),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref($)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:o[12]||(o[12]=t.withModifiers(()=>{},["prevent"])),onClick:o[13]||(o[13]=a=>f("font-size-step-down"))},[...o[45]||(o[45]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-177c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h177c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z"})],-1)])],40,go),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref($)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:o[14]||(o[14]=t.withModifiers(()=>{},["prevent"])),onClick:o[15]||(o[15]=a=>f("font-size-step-up"))},[...o[46]||(o[46]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-59v-59c0-16.29-13.21-29.5-29.5-29.5s-29.5 13.21-29.5 29.5v59h-59c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h59v59c0 16.29 13.21 29.5 29.5 29.5s29.5-13.21 29.5-29.5v-59h59c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z"})],-1)])],40,ho)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("sep2"),to:p.value??void 0},[o[47]||(o[47]=t.createElementVNode("div",{class:"tb-item","data-key":"sep2"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("bold"),to:p.value??void 0},[t.createElementVNode("div",vo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref($)(e.locale,"bold"),disabled:!e.hasSelection,onClick:o[16]||(o[16]=a=>f("bold-toggle"))},[...o[48]||(o[48]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M733.610667 467.712A267.562667 267.562667 0 0 0 548.010667 10.581333H183.466667a53.333333 53.333333 0 0 0 0 106.666667h43.221333a10.666667 10.666667 0 0 1 10.666667 10.666667V896a10.666667 10.666667 0 0 1-10.666667 10.666667H183.466667a53.333333 53.333333 0 1 0 0 106.666666h425.088a287.658667 287.658667 0 0 0 125.013333-545.536z m-185.6-350.464a160.512 160.512 0 0 1 0 320.981333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666V128a10.666667 10.666667 0 0 1 10.666667-10.666667z m60.586666 789.333333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666v-340.352a10.666667 10.666667 0 0 1 10.666667-10.666667H608.597333a180.864 180.864 0 0 1 0 361.685333z"})])],-1)])],10,Co)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("italic"),to:p.value??void 0},[t.createElementVNode("div",bo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref($)(e.locale,"italic"),disabled:!e.hasSelection,onClick:o[17]||(o[17]=a=>f("italic-toggle"))},[...o[49]||(o[49]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M960 10.581333h-325.845333a53.333333 53.333333 0 0 0 0 106.666667h46.336a10.666667 10.666667 0 0 1 9.002666 16.384L203.946667 896.725333a21.333333 21.333333 0 0 1-18.005334 9.856H64a53.333333 53.333333 0 0 0 0 106.666667h325.845333a53.333333 53.333333 0 0 0 0-106.666667H343.509333a10.666667 10.666667 0 0 1-9.002666-16.384L820.053333 127.146667a21.333333 21.333333 0 0 1 18.005334-9.898667H960a53.333333 53.333333 0 0 0 0-106.666667z"})])],-1)])],10,yo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("underline"),to:p.value??void 0},[t.createElementVNode("div",wo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref($)(e.locale,"underline"),disabled:!e.hasSelection,onClick:o[18]||(o[18]=a=>f("underline-toggle"))},[...o[50]||(o[50]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M960 906.581333h-896a53.333333 53.333333 0 0 0 0 106.666667h896a53.333333 53.333333 0 0 0 0-106.666667zM84.394667 117.248h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a358.784 358.784 0 0 0 717.568 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667h58.154666a53.333333 53.333333 0 0 0 0-106.666666H695.466667a53.333333 53.333333 0 0 0 0 106.666666h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a252.117333 252.117333 0 0 1-504.234667 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667H328.533333a53.333333 53.333333 0 1 0 0-106.666666H84.394667a53.333333 53.333333 0 0 0 0 106.666666z"})])],-1)])],10,ko)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("strike"),to:p.value??void 0},[t.createElementVNode("div",Eo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref($)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:o[19]||(o[19]=a=>f("strikethrough-toggle"))},[...o[51]||(o[51]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M1013.333333 552.618667A53.333333 53.333333 0 0 0 960 499.2h-381.269333a20.992 20.992 0 0 1-12.032-3.84c-30.805333-21.888-63.232-41.856-94.634667-61.098667-119.466667-73.173333-192-123.733333-192-207.488 0-95.36 94.165333-109.610667 150.314667-109.610666a193.706667 193.706667 0 0 1 131.456 32.597333 113.578667 113.578667 0 0 1 19.072 84.906667v12.8a53.333333 53.333333 0 1 0 106.666666 0v-11.434667a208.512 208.512 0 0 0-49.706666-161.152C595.157333 31.616 527.317333 10.581333 430.549333 10.581333c-156.074667 0-256.981333 84.864-256.981333 216.277334 0 118.314667 80.725333 192.512 170.666667 252.885333a10.666667 10.666667 0 0 1-5.930667 19.541333H64a53.333333 53.333333 0 0 0 0 106.666667h468.352a10.709333 10.709333 0 0 1 6.784 2.474667 185.130667 185.130667 0 0 1 82.432 147.882666c0 139.434667-146.176 150.272-191.018667 150.272-77.397333 0-133.930667-17.28-163.584-50.048a144.810667 144.810667 0 0 1-27.733333-115.2 53.333333 53.333333 0 0 0-106.154667-10.496A245.76 245.76 0 0 0 187.733333 928.128c51.2 56.490667 132.864 85.333333 242.688 85.333333 178.090667 0 297.685333-103.253333 297.685334-256.938666a258.517333 258.517333 0 0 0-36.224-134.272 10.666667 10.666667 0 0 1 9.216-16.085334H960a53.333333 53.333333 0 0 0 53.333333-53.546666z"})])],-1)])],10,Bo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("sep3"),to:p.value??void 0},[o[52]||(o[52]=t.createElementVNode("div",{class:"tb-item","data-key":"sep3"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("textColor"),to:p.value??void 0},[t.createElementVNode("div",Ro,[t.createElementVNode("div",xo,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref($)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:o[20]||(o[20]=a=>f("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",Mo,[o[53]||(o[53]=t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M663.120842 529.946947H364.759579l-84.07579 212.884211a53.894737 53.894737 0 0 1-50.122105 34.169263h-14.551579a34.869895 34.869895 0 0 1-32.498526-47.696842L443.715368 70.063158a53.894737 53.894737 0 0 1 50.122106-34.115369h41.768421a53.894737 53.894737 0 0 1 50.176 34.277053l257.670737 659.078737a34.977684 34.977684 0 0 1-32.552421 47.696842h-14.389895a53.894737 53.894737 0 0 1-50.229895-34.277053l-83.159579-212.776421z m-35.139368-89.788631l-113.340632-289.953684-114.472421 289.953684h227.813053z"})],-1)),t.createElementVNode("path",{d:"M62.895 844.369m53.895 0l790.474 0q53.895 0 53.895 53.895l0 26.947q0 53.895-53.895 53.895l-790.474 0q-53.895 0-53.895-53.895l0-26.947q0-53.895 53.895-53.895z",fill:e.cachedTextColor||"#000000"},null,8,To)]))],8,So),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:Y,class:"toolbar-btn toolbar-split__arrow",title:t.unref($)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:o[21]||(o[21]=a=>f("update:text-color-menu-open",!e.textColorMenuOpen))},[...o[54]||(o[54]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Do),t.createVNode(dl,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":Y.value,"onUpdate:modelOpen":o[22]||(o[22]=a=>f("update:text-color-menu-open",a)),onChange:o[23]||(o[23]=a=>f("text-color-change",a))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("fillColor"),to:p.value??void 0},[t.createElementVNode("div",Ho,[t.createElementVNode("div",Ao,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref($)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:o[24]||(o[24]=a=>f("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",No,[o[55]||(o[55]=t.createElementVNode("path",{d:"M447.018667 37.952l352.298666 352.298667c6.613333 6.613333 6.613333 17.344 0 23.957333L446.101333 767.424a16.938667 16.938667 0 0 1-23.957333 0L121.429333 466.688a16.938667 16.938667 0 0 1 0-23.957333L428.608 135.552 388.992 96a8.469333 8.469333 0 0 1 0-11.989333l46.058667-46.037334a8.469333 8.469333 0 0 1 11.968 0z m346.325333 517.461333l57.514667 60.074667c31.744 33.194667 31.744 86.997333 0 120.192a78.869333 78.869333 0 0 1-115.008 0c-31.765333-33.194667-31.765333-86.997333 0-120.192l57.493333-60.074667zM486.101333 193.066667l-261.12 261.12 20.458667 20.458666 380.16-1.728 70.186667-70.186666-209.706667-209.664z"},null,-1)),t.createElementVNode("path",{d:"M85.333333 853.333333m8.896 0l835.541334 0q8.896 0 8.896 8.896l0 110.208q0 8.896-8.896 8.896l-835.541334 0q-8.896 0-8.896-8.896l0-110.208q0-8.896 8.896-8.896Z",fill:e.cachedFillColor||"currentColor"},null,8,Io)]))],8,Fo),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:y,class:"toolbar-btn toolbar-split__arrow",title:t.unref($)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:o[25]||(o[25]=a=>f("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...o[56]||(o[56]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Lo),t.createVNode(dl,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":y.value,"onUpdate:modelOpen":o[26]||(o[26]=a=>f("update:fill-color-menu-open",a)),onChange:o[27]||(o[27]=a=>f("fill-color-change",a))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("border"),to:p.value??void 0},[t.createElementVNode("div",Oo,[t.createElementVNode("div",Vo,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref($)(e.locale,"borders"),disabled:!e.hasSelection,onClick:o[28]||(o[28]=a=>f("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",zo,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(C,a=>t.createElementVNode("line",{key:a.name,x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2,"stroke-width":k(e.cachedBorder,a.name)==="thick"?3:1.5,"stroke-dasharray":k(e.cachedBorder,a.name)==="dashed"?"0 4":"none","stroke-linecap":k(e.cachedBorder,a.name)==="dashed"?"round":"square"},null,8,$o)),64))]))],8,Wo),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:ne,class:"toolbar-btn toolbar-split__arrow",title:t.unref($)(e.locale,"borders"),disabled:!e.hasSelection,onClick:o[29]||(o[29]=a=>f("update:border-menu-open",!e.borderMenuOpen))},[...o[57]||(o[57]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,_o),t.createVNode(Zl,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":ne.value,"onUpdate:modelOpen":o[30]||(o[30]=a=>f("update:border-menu-open",a)),onChange:o[31]||(o[31]=a=>f("border-change",a))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("sep4"),to:p.value??void 0},[o[58]||(o[58]=t.createElementVNode("div",{class:"tb-item","data-key":"sep4"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("hAlign"),to:p.value??void 0},[t.createElementVNode("div",Go,[t.createVNode(_t,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:T("hAlign")?"100%":44,"menu-width":T("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref($)(e.locale,"hAlign"),onChange:o[32]||(o[32]=a=>f("h-align-change",a))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("vAlign"),to:p.value??void 0},[t.createElementVNode("div",Ko,[t.createVNode(_t,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:T("vAlign")?"100%":44,"menu-width":T("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref($)(e.locale,"vAlign"),onChange:o[33]||(o[33]=a=>f("v-align-change",a))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",Uo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref($)(e.locale,"wrap"),onClick:o[34]||(o[34]=a=>f("wrap-toggle"))},[...o[59]||(o[59]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M896 179.2a38.4 38.4 0 0 0-76.8 0v665.6a38.4 38.4 0 0 0 76.8 0v-665.6zM204.8 281.6A38.4 38.4 0 0 0 204.8 358.4h179.2a38.4 38.4 0 0 0 0-76.8H204.8zM550.4 281.6a38.4 38.4 0 0 0 0 76.8h51.2c35.328 0 64 28.672 64 64v179.2c0 35.328-28.672 64-64 64H246.272l36.864-36.864a38.4 38.4 0 1 0-54.272-54.272l-102.4 102.4a38.4 38.4 0 0 0 0 54.272l102.4 102.4a38.4 38.4 0 0 0 54.272-54.272l-36.864-36.864h355.328a140.8 140.8 0 0 0 140.8-140.8v-179.2a140.8 140.8 0 0 0-140.8-140.8h-51.2z"})],-1)])],10,Po)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:!T("merge"),to:p.value??void 0},[t.createElementVNode("div",Yo,[t.createElementVNode("div",Xo,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref($)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:o[35]||(o[35]=a=>f("apply-merge"))},[...o[60]||(o[60]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M709.952 465.92l88-76.032C801.92 385.984 806.656 384 812.032 384s10.048 1.984 14.08 5.952C830.08 393.92 832 398.656 832 403.968L832 448l32 0C881.664 448 896 462.336 896 480S881.664 512 864 512L832 512l0 44.032c0 5.376-1.92 10.112-5.952 14.08C822.08 574.08 817.344 576 812.032 576s-10.048-1.92-14.08-5.952L709.952 494.08C705.984 490.112 704 485.376 704 480S705.984 469.952 709.952 465.92zM378.048 465.92 290.048 389.952C286.08 385.984 281.344 384 275.968 384s-10.048 1.984-14.08 5.952C257.92 393.92 256 398.656 256 403.968L256 448 224 448C206.336 448 192 462.336 192 480S206.336 512 224 512L256 512l0 44.032c0 5.376 1.92 10.112 5.952 14.08C265.92 574.08 270.656 576 275.968 576s10.048-1.92 14.08-5.952L378.048 494.08C382.016 490.112 384 485.376 384 480S382.016 469.952 378.048 465.92zM448 128 128 128l0 704 320 0 0-128 64 0 0 128c0 35.392-28.608 64-64 64L128 896c-35.392 0-64-28.608-64-64L64 128c0-35.392 28.608-64 64-64l320 0 0 0c35.392 0 64 28.608 64 64l0 128L448 256 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128M722.304 642.304c0 8.512-3.52 16.32-10.496 23.36s-15.424 10.624-25.344 10.624c-5.76 0-10.688-1.088-14.72-3.136-4.096-2.048-7.616-4.928-10.432-8.512s-5.824-9.088-9.024-16.512-5.952-13.952-8.32-19.648l-17.28-46.016L479.36 582.464 462.08 629.568c-6.72 18.304-12.48 30.656-17.344 37.12s-12.544 9.6-23.424 9.6c-9.28 0-17.408-3.456-24.512-10.24s-10.624-14.592-10.624-23.232c0-4.992 0.896-10.176 2.496-15.488S393.024 614.592 396.8 605.056l92.672-238.016C492.096 360.256 495.296 352 499.008 342.464s7.68-17.536 11.904-23.872 9.664-11.456 16.576-15.36c6.784-3.968 15.232-5.888 25.344-5.888 10.176 0 18.752 1.92 25.472 5.888 6.848 3.968 12.352 8.96 16.64 15.104 4.096 6.208 7.744 12.8 10.624 19.904s6.528 16.576 11.008 28.352l94.656 236.48C718.592 621.056 722.304 634.112 722.304 642.304zM606.912 526.784 552.32 375.552 498.624 526.784 606.912 526.784z"})],-1)])],8,jo),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:A,class:"toolbar-btn toolbar-split__arrow",title:t.unref($)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:o[36]||(o[36]=a=>f("update:merge-menu-open",!e.mergeMenuOpen))},[...o[61]||(o[61]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Zo),t.createVNode(eo,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":A.value,"onUpdate:modelOpen":o[37]||(o[37]=a=>f("update:merge-menu-open",a)),onChange:o[38]||(o[38]=a=>f("merge-change",a))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),pe.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:ee,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":me.value}]),type:"button",onClick:ce},[...o[62]||(o[62]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("circle",{cx:"512",cy:"160",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"512",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"864",r:"96"})],-1)])],2)):t.createCommentVNode("",!0)],512),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[t.withDirectives((t.openBlock(),t.createElementBlock("div",{ref_key:"overflowMenuEl",ref:p,key:G.value,class:t.normalizeClass(["overflow-menu",{"no-anim":we.value}]),style:t.normalizeStyle(h.value)},null,6)),[[t.vShow,me.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-c472a142"]]),en={class:"tab-list"},tn=["onClick","onDblclick","onContextmenu"],ln=["value"],on={key:1,class:"tab-item__name"},nn=["title"],rn=ft(t.defineComponent({__name:"tabbar",props:{locale:{},sheets:{},activeSheetIndex:{},renTab:{},renTabVal:{}},emits:["tab-click","tab-dblclick","tab-contextmenu","tab-rename-input","tab-rename-keydown","tab-rename-commit","add-sheet","tabbar-contextmenu"],setup(e,{emit:v}){const C=v;return(n,u)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:u[5]||(u[5]=k=>C("tabbar-contextmenu",k))},[t.createElementVNode("div",en,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(k,i)=>(t.openBlock(),t.createElementBlock("div",{key:k.id,class:t.normalizeClass(["tab-item",{"tab-item--active":i===e.activeSheetIndex}]),onClick:I=>C("tab-click",i),onDblclick:t.withModifiers(I=>C("tab-dblclick",i),["prevent"]),onContextmenu:I=>C("tab-contextmenu",{ev:I,i})},[e.renTab===i?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:u[0]||(u[0]=I=>C("tab-rename-input",I.target.value)),onKeydown:u[1]||(u[1]=I=>C("tab-rename-keydown",I)),onBlur:u[2]||(u[2]=I=>C("tab-rename-commit")),onClick:u[3]||(u[3]=t.withModifiers(()=>{},["stop"]))},null,40,ln)):(t.openBlock(),t.createElementBlock("span",on,t.toDisplayString(k.name),1))],42,tn))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref($)(e.locale,"addSheet"),onClick:u[4]||(u[4]=k=>C("add-sheet"))}," + ",8,nn)],32))}}),[["__scopeId","data-v-454e1a12"]]);function Je(e){let v="",C=e;do v=String.fromCharCode(65+C%26)+v,C=Math.floor(C/26)-1;while(C>=0);return v}function Qt(e){let v=0;for(let C=0;C<e.length;C++)v=v*26+(e.toUpperCase().charCodeAt(C)-64);return v-1}function mt(e){if(e==null)return null;if(typeof e=="number")return e;if(typeof e=="string"){const v=parseFloat(e);return e.endsWith("%")||isNaN(v)?null:v}return null}function el(e){navigator.clipboard.writeText(e).catch(()=>{const v=document.createElement("textarea");v.value=e,v.style.position="fixed",v.style.opacity="0",document.body.appendChild(v),v.select(),document.execCommand("copy"),document.body.removeChild(v)})}function bt(e,v){return`${e},${v}`}function Gt(e,v,C){const n=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!n)return null;const u=Qt(n[1]),k=parseInt(n[2],10)-1;return u<0||u>=v||k<0||k>=C?null:{col:u,row:k}}function pt(e,v){if(!v)return{x:0,y:0};const C=v.getBoundingClientRect();return{x:e.clientX-C.left,y:e.clientY-C.top}}function an(e,v,C){const n=e.split(":");if(n.length!==2)return null;const u=Gt(n[0],v,C),k=Gt(n[1],v,C);return!u||!k?null:{sc:Math.min(u.col,k.col),sr:Math.min(u.row,k.row),ec:Math.max(u.col,k.col),er:Math.max(u.row,k.row)}}function cn(e,v,C,n,u){const k=C[bt(e,v)];if(!k)return 0;const i=k.value;if(i.startsWith("="))return ul(bt(e,v),C,n,u)??0;const I=parseFloat(i);return isNaN(I)?0:I}const yt=new Map;function tl(){yt.clear()}function ul(e,v,C,n){return sn(e,v,C,n)}function sn(e,v,C,n,u){if(yt.has(e))return NaN;yt.set(e,NaN);const k=v[e];if(!k)return NaN;const i=k.value;if(!i.startsWith("=")){const ee=parseFloat(i),Y=isNaN(ee)?0:ee;return yt.set(e,Y),Y}const I=i.slice(1).trim();if(I.toUpperCase().startsWith("SUM(")&&I.endsWith(")")){const ee=I.slice(4,-1).trim(),Y=an(ee,C,n);if(Y){let y=0;for(let ne=Y.sc;ne<=Y.ec;ne++)for(let A=Y.sr;A<=Y.er;A++)y+=cn(ne,A,v,C,n);return isNaN(y)?NaN:(yt.set(e,y),y)}return NaN}return NaN}function ll(e,v,C){const n=[],u=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let k;for(;(k=u.exec(e))!==null;){const i=Gt(k[1],v,C);if(i)if(k[2]){const I=Gt(k[2],v,C);if(!I)continue;for(let p=Math.min(i.col,I.col);p<=Math.max(i.col,I.col);p++)for(let ee=Math.min(i.row,I.row);ee<=Math.max(i.row,I.row);ee++)n.push(bt(p,ee))}else n.push(bt(i.col,i.row))}return n}function dn(e,v,C,n,u){const k=C[bt(e,v)];if(!k)return"";const i=k.value;if(!i.startsWith("="))return i;const I=ul(bt(e,v),C,n,u);return isNaN(I)?"#ERROR":String(I)}function un(e,v,C,n,u,k){return v===0&&C===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(i,I,p,ee,Y)=>{const y=I?Qt(p):Qt(p)+v,ne=ee?parseInt(Y,10)-1:parseInt(Y,10)-1+C;let A;y<0?A="A":y>=n?A=k(n-1):A=k(y);let m;return ne<0?m="1":ne>=u?m=String(u):m=String(ne+1),(I||"")+A+(ee||"")+m})}class fn{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(v){var n;const C=this.deps.get(v);if(C){for(const u of C)(n=this.rev.get(u))==null||n.delete(v);this.deps.delete(v)}}set(v,C){if(this.clear(v),C.length!==0){this.deps.set(v,C);for(const n of C)this.rev.has(n)||this.rev.set(n,new Set),this.rev.get(n).add(v)}}markDirty(v){const C=[v];for(;C.length>0;){const n=C.pop(),u=this.rev.get(n);if(u)for(const k of u)this.dirty.has(k)||(this.dirty.add(k),C.push(k))}}getDirtyAndClear(){const v=this.dirty;return this.dirty=new Set,v}rebuild(v,C,n){this.deps.clear(),this.rev.clear(),this.dirty.clear(),yt.clear();for(const[u,k]of Object.entries(v))if(k.value.startsWith("=")){const i=ll(k.value.slice(1),C,n);this.set(u,i)}}}function mn(e,v){const C={rowCount:e.rowCount??v.rowCount,colCount:e.colCount??v.colCount,width:e.width,height:e.height,theme:e.theme??v.theme,locale:e.locale??v.locale},n=t.computed(()=>C.locale==="zh-CN"?"zh-CN":"en-US"),u=C.colCount,k=C.rowCount,i=t.reactive({}),I=t.reactive({}),p=new fn,ee=t.ref(null),Y=t.ref({col:0,row:0}),y=t.ref(null),ne=t.ref(""),A=t.ref(new Array(u).fill(100)),m=t.ref(new Array(k).fill(void 0)),ge=t.ref(0),me=t.ref(0),we=(24-at)/2,G=new Map;let U=null;function pe(E,B,R,K){const X=`${K} ${R} ${B}px ${E}`,re=G.get(X);if(re)return re;U||(U=document.createElement("canvas"));const de=U.getContext("2d");if(!de)return{ascent:B*.8,descent:B*.2};de.font=X;const c=de.measureText("M"),b=c.actualBoundingBoxAscent,L=c.actualBoundingBoxDescent,W=b||B*.8,j=L||B*.2,Q=Math.max(W,B*.5),Z=Math.max(j,B*.15),ue={ascent:Q,descent:Z};return G.set(X,ue),ue}let T=(E,B)=>`${E},${B}`,P=()=>null,be=()=>at,ye=t.computed(()=>[0]),te=()=>24,s=(E,B,R,K)=>({startCol:Math.min(E,R),startRow:Math.min(B,K),endCol:Math.max(E,R),endRow:Math.max(B,K)});function h(E,B){var c;const R=(c=i[T(E,B)])==null?void 0:c.style,K=be(E,B),X=typeof(R==null?void 0:R.fontFamily)=="string"&&R.fontFamily?R.fontFamily:$t,re=(R==null?void 0:R.fontWeight)==="bold"?"bold":"normal",de=(R==null?void 0:R.fontStyle)==="italic"?"italic":"normal";return pe(X,K,re,de)}function He(E,B,R,K){if(!B)return[""];const X=B.split(`
2
+ `),re=[];for(const de of X)if(!K||R<=0)re.push(de);else{let c="";for(let b=0;b<de.length;b++){const L=de[b],W=c+L;E.measureText(W).width>R&&c?(re.push(c),c=L):c=W}re.push(c)}return re}function Se(E,B){var K;const R=(K=i[T(E,B)])==null?void 0:K.style;return typeof(R==null?void 0:R.fontSize)=="number"&&R.fontSize>0?R.fontSize:at}be=Se;const ce=t.computed(()=>{const E=[0];for(let B=0;B<u;B++)E.push(E[B]+A.value[B]);return E});ye=ce;const r={w:800,h:600};let f=()=>{};function w(E){var W;const B=m.value[E];if(B!=null&&B>0)return B;let R=at,K=R*.8,X=R*.2,re=1;const de=U?U.getContext("2d"):null;for(let j=0;j<u;j++){const Q=Se(j,E),Z=(W=i[T(j,E)])==null?void 0:W.style,ue=typeof(Z==null?void 0:Z.fontFamily)=="string"&&Z.fontFamily?Z.fontFamily:$t,Ee=(Z==null?void 0:Z.fontWeight)==="bold"?"bold":"normal",Ve=(Z==null?void 0:Z.fontStyle)==="italic"?"italic":"normal",Fe=fe(j,E);if(Fe&&de){de.font=`${Ve} ${Ee} ${Q}px ${ue}`;const ze=Fe.split(`
3
+ `)[0]||Fe,Ue=de.measureText(ze),et=Ue.actualBoundingBoxAscent,Ft=Ue.actualBoundingBoxDescent,Kt=et||Q*.8,Ut=Ft||Q*.2,Pt=Math.max(Kt,Q*.5),Yt=Math.max(Ut,Q*.15);Pt>K&&(K=Pt),Yt>X&&(X=Yt),Q>R&&(R=Q);const ol=(Z==null?void 0:Z.wrap)==="wrap";let dt;if(ol){const wt=P(j,E);let Nt;wt&&j===wt.range.startCol&&E===wt.range.startRow?Nt=ye.value[wt.range.endCol+1]-ye.value[j]:Nt=A.value[j],dt=He(de,Fe,Math.max(0,Nt-10),!0).length,dt>re&&(re=dt)}else dt=Fe.split(`
4
+ `).length,dt>re&&(re=dt)}else if(Q>R){R=Q;const ze=pe(ue,Q,Ee,Ve);ze.ascent>K&&(K=ze.ascent),ze.descent>X&&(X=ze.descent)}}const c=R,b=we*2+re*c;return Math.min(500,Math.max(24,Math.round(b)))}te=w;function o(E){return m.value[E]===void 0}const a=t.computed(()=>{const E=[0];for(let B=0;B<k;B++)E.push(E[B]+te(B));return E}),O=t.computed(()=>ce.value[u]),H=t.computed(()=>a.value[k]);function V(E,B){return`${E},${B}`}T=V;function ae(E){Reflect.deleteProperty(i,E)}function ve(E,B){const R=P(E,B);R?(Y.value={col:R.range.startCol,row:R.range.startRow},ee.value={...R.range}):(Y.value={col:E,row:B},ee.value={startCol:E,startRow:B,endCol:E,endRow:B})}function xe(E,B,R,K){const X=P(E,B);Y.value=X?{col:X.range.startCol,row:X.range.startRow}:{col:E,row:B},ee.value=s(E,B,R,K)}function Ae(){xe(0,0,u-1,k-1)}function Le(E,B){const R=ee.value;return R?E>=R.startCol&&E<=R.endCol&&B>=R.startRow&&B<=R.endRow:!1}function he(E,B){for(const R in I){const K=I[R];if(K&&E>=K.startCol&&E<=K.endCol&&B>=K.startRow&&B<=K.endRow)return{range:K,anchor:R}}return null}P=he;function We(E,B){return I[V(E,B)]!==void 0}function S(E,B){const R=P(E,B);if(R&&E===R.range.startCol&&B===R.range.startRow){const K=ce.value[R.range.endCol+1]-ce.value[E],X=a.value[R.range.endRow+1]-a.value[B];return{w:K,h:X}}return{w:A.value[E],h:te(B)}}function F(E,B,R,K){let X=Math.min(E,R),re=Math.max(E,R),de=Math.min(B,K),c=Math.max(B,K),b=!0;for(;b;){b=!1;for(const L in I){const W=I[L];if(!W)continue;W.startCol<=re&&W.endCol>=X&&W.startRow<=c&&W.endRow>=de&&(W.startCol<X&&(X=W.startCol,b=!0),W.endCol>re&&(re=W.endCol,b=!0),W.startRow<de&&(de=W.startRow,b=!0),W.endRow>c&&(c=W.endRow,b=!0))}}return{startCol:X,startRow:de,endCol:re,endRow:c}}s=F;let _=()=>{};function le(E,B){var R;return((R=i[V(E,B)])==null?void 0:R.value)??""}function fe(E,B){return tl(),dn(E,B,i,u,k)}function z(E,B,R){var de,c;const K=V(E,B);if(tl(),R===""||R==null){p.clear(K);const b=((de=i[K])==null?void 0:de.style)??null;b?i[K]={value:"",style:b}:ae(K),p.markDirty(K);return}const X=String(R),re=((c=i[K])==null?void 0:c.style)??null;i[K]={value:X,style:re},X.startsWith("=")?p.set(K,ll(X.slice(1),u,k)):p.clear(K),p.markDirty(K)}function se(E,B,R,K){for(let X=E;X<=B;X++)for(let re=R;re<=K;re++){const de=V(X,re);p.clear(de),ae(de),p.markDirty(de),_(X,re)}}let ke=()=>{};function De(E){y.value||(y.value={...Y.value},ne.value=E??le(Y.value.col,Y.value.row))}function Qe(){y.value&&(ke(),z(y.value.col,y.value.row,ne.value),y.value=null,ne.value="")}function lt(){y.value=null,ne.value=""}function $e(E,B){const R=Y.value;let K=Math.max(0,Math.min(u-1,R.col+E)),X=Math.max(0,Math.min(k-1,R.row+B));const re=P(R.col,R.row),de=P(K,X);re&&de&&re.anchor===de.anchor&&(E>0?K=re.range.endCol+1:E<0&&(K=re.range.startCol-1),B>0?X=re.range.endRow+1:B<0&&(X=re.range.startRow-1),K=Math.max(0,Math.min(u-1,K)),X=Math.max(0,Math.min(k-1,X))),ve(K,X)}function Xe(E,B){const R=Math.max(0,r.w-52-11),K=Math.max(0,r.h-24-11),X=ce.value[E],re=a.value[B],de=P(E,B),c=de?ce.value[de.range.endCol+1]-ce.value[E]:A.value[E],b=de?a.value[de.range.endRow+1]-a.value[B]:te(B);let L=ge.value,W=me.value;X<L?L=X:X+c>L+R&&(L=X+c-R),re<W?W=re:re+b>W+K&&(W=re+b-K),f(L,W)}function st(E){const B=ce.value;if(E<0||E>=B[u])return-1;let R=0,K=u-1;for(;R<K;){const X=R+K+1>>1;B[X]<=E?R=X:K=X-1}return R}function At(E){const B=a.value;if(E<0||E>=B[k])return-1;let R=0,K=k-1;for(;R<K;){const X=R+K+1>>1;B[X]<=E?R=X:K=X-1}return R}const Ke={props:C,locale:n,colCount:u,rowCount:k,cells:i,merges:I,formulaDeps:p,selection:ee,activeCell:Y,editingCell:y,editValue:ne,colWidths:A,rowHeights:m,scrollX:ge,scrollY:me,BASE_CELL_VPAD:we,fontMetricsCache:G,fontMetricsCanvas:U,measureFontMetrics:pe,_getFontMetricsForCell:h,getWrappedLines:He,cellFontSize:Se,colPositions:ce,getRowHeight:w,_isAutoRow:o,rowPositions:a,totalWidth:O,totalHeight:H,selectCell:ve,selectRange:xe,selectAll:Ae,isSelected:Le,cellKey:V,delCell:ae,findMerge:he,_isMergeAnchor:We,_mergedSpan:S,expandSelectionForMerges:F,getCellRaw:le,getCellValue:fe,setCellValue:z,clearCellsInRange:se,startEdit:De,commitEdit:Qe,cancelEdit:lt,moveActive:$e,ensureVisible:Xe,hitCol:st,hitRow:At,viewSize:r};return ke=()=>{var E;return(E=Ke.saveUndo)==null?void 0:E.call(Ke)},_=(E,B)=>{var R;return(R=Ke.syncCellBorders)==null?void 0:R.call(Ke,E,B)},f=(E,B)=>{var R;return(R=Ke.clampScroll)==null?void 0:R.call(Ke,E,B)},Ke}function pn(e,v){const C=t.ref([]),n=t.ref([]);function u(c){const b={};for(const[L,W]of Object.entries(c))b[L]={value:W.value,style:W.style};return b}function k(){return v.saveSheet(),{sheets:v.sheets.value.map(c=>({id:c.id,name:c.name,cells:u(c.cells),merges:c.merges?{...c.merges}:{},selection:c.selection?{...c.selection}:null,activeCell:c.activeCell?{...c.activeCell}:{col:0,row:0},scrollX:c.scrollX,scrollY:c.scrollY,colWidths:[...c.colWidths],rowHeights:[...c.rowHeights]})),activeSheetIndex:v.activeSheetIndex.value}}function i(c){v.sheets.value=c.sheets.map(b=>({...b,cells:u(b.cells)})),v.loadSheet(Math.max(0,Math.min(c.activeSheetIndex,v.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function I(){const c=k(),b=C.value[C.value.length-1];b&&JSON.stringify(b)===JSON.stringify(c)||(C.value.push(c),n.value=[],C.value.length>50&&C.value.shift())}e.saveUndo=I;function p(){var c;C.value.length&&(n.value.push(k()),i(C.value.pop()),(c=e.scheduleRender)==null||c.call(e),t.nextTick(()=>{var b;return(b=e.emitModelData)==null?void 0:b.call(e)}))}function ee(){var c;n.value.length&&(C.value.push(k()),i(n.value.pop()),(c=e.scheduleRender)==null||c.call(e),t.nextTick(()=>{var b;return(b=e.emitModelData)==null?void 0:b.call(e)}))}const Y=t.computed(()=>C.value.length>0),y=t.computed(()=>n.value.length>0),ne=t.computed(()=>!!e.selection.value),A=t.ref(null);function m(){var L;const c=e.selection.value;if(!c)return;const b={};for(let W=c.startCol;W<=c.endCol;W++)for(let j=c.startRow;j<=c.endRow;j++)b[`${W-c.startCol},${j-c.startRow}`]=((L=e.cells[e.cellKey(W,j)])==null?void 0:L.style)??null;A.value={styles:b}}function ge(){var L,W,j,Q;const c=A.value,b=e.selection.value;if(!(!c||!b)){I();for(let Z=b.startCol;Z<=b.endCol;Z++)for(let ue=b.startRow;ue<=b.endRow;ue++){const Ee=e.findMerge(Z,ue);if(Ee&&(Z!==Ee.range.startCol||ue!==Ee.range.startRow))continue;const Ve=c.styles[`${Z-b.startCol},${ue-b.startRow}`]??null,Fe=e.cellKey(Z,ue),ze=((L=e.cells[Fe])==null?void 0:L.value)??"";ze===""&&Ve===null?e.delCell(Fe):e.cells[Fe]={value:ze,style:Ve},(W=e.syncCellBorders)==null||W.call(e,Z,ue)}A.value=null,(j=e.scheduleRender)==null||j.call(e),(Q=e.emitModelData)==null||Q.call(e)}}function me(){var b,L,W,j;const c=e.selection.value;if(c){I();for(let Q=c.startCol;Q<=c.endCol;Q++)for(let Z=c.startRow;Z<=c.endRow;Z++){const ue=e.findMerge(Q,Z);if(ue&&(Q!==ue.range.startCol||Z!==ue.range.startRow))continue;const Ee=e.cellKey(Q,Z),Ve=((b=e.cells[Ee])==null?void 0:b.value)??"";Ve===""?e.delCell(Ee):e.cells[Ee]={value:Ve,style:null},(L=e.syncCellBorders)==null||L.call(e,Q,Z)}(W=e.scheduleRender)==null||W.call(e),(j=e.emitModelData)==null||j.call(e)}}const we=t.computed(()=>Bl.map(c=>({...c,label:c.value===""?$(e.locale.value,"fontDefault"):c.label}))),G=t.computed(()=>Rl.map(c=>({...c,label:String(c.value)}))),U="\0",pe=t.computed(()=>{var W;const c=e.selection.value;if(!c)return"";let b,L=!1;for(let j=c.startCol;j<=c.endCol&&!L;j++)for(let Q=c.startRow;Q<=c.endRow&&!L;Q++){const Z=e.findMerge(j,Q);if(Z&&(j!==Z.range.startCol||Q!==Z.range.startRow))continue;const ue=(W=e.cells[e.cellKey(j,Q)])==null?void 0:W.style,Ee=typeof(ue==null?void 0:ue.fontFamily)=="string"?ue.fontFamily:"";b===void 0?b=Ee:Ee!==b&&(L=!0)}return L?U:b??""}),T=t.computed(()=>{const c=e.selection.value;if(!c)return at;let b,L=!1;for(let W=c.startCol;W<=c.endCol&&!L;W++)for(let j=c.startRow;j<=c.endRow&&!L;j++){const Q=e.findMerge(W,j);if(Q&&(W!==Q.range.startCol||j!==Q.range.startRow))continue;const Z=e.cellFontSize(W,j);b===void 0?b=Z:Z!==b&&(L=!0)}return L?0:b??at});function P(c,b){var W,j,Q,Z;const L=e.selection.value;if(L){I();for(let ue=L.startCol;ue<=L.endCol;ue++)for(let Ee=L.startRow;Ee<=L.endRow;Ee++){const Ve=e.findMerge(ue,Ee);if(Ve&&(ue!==Ve.range.startCol||Ee!==Ve.range.startRow))continue;const Fe=e.cellKey(ue,Ee),ze=((W=e.cells[Fe])==null?void 0:W.value)??"",Ue=(j=e.cells[Fe])!=null&&j.style?{...e.cells[Fe].style}:{};b===""||b===null||b===void 0||b===0?Reflect.deleteProperty(Ue,c):Ue[c]=b;const et=Object.keys(Ue).length?Ue:null;ze===""&&et===null?e.delCell(Fe):e.cells[Fe]={value:ze,style:et}}(Q=e.scheduleRender)==null||Q.call(e),(Z=e.emitModelData)==null||Z.call(e)}}function be(c){P("fontFamily",c===""?"":c)}const ye=t.ref(!1),te=t.ref(!1),s=t.ref(!1),h=t.ref(!1),He=t.ref(!1);function Se(c){P("fontSize",c),ye.value=!1}const ce=t.computed(()=>Al.map(c=>({label:$(e.locale.value,c.labelKey),value:c.value,icon:c.icon}))),r=t.computed(()=>Fl.map(c=>({label:$(e.locale.value,c.labelKey),value:c.value,icon:c.icon}))),f=t.computed(()=>{var W;const c=e.selection.value;if(!c)return"left";const b=(W=e.cells[e.cellKey(c.startCol,c.startRow)])==null?void 0:W.style,L=typeof(b==null?void 0:b.textAlign)=="string"?b.textAlign:"";return L==="center"||L==="right"?L:"left"}),w=t.computed(()=>{var W;const c=e.selection.value;if(!c)return"top";const b=(W=e.cells[e.cellKey(c.startCol,c.startRow)])==null?void 0:W.style,L=typeof(b==null?void 0:b.verticalAlign)=="string"?b.verticalAlign:"";return L==="middle"||L==="bottom"?L:"top"}),o=t.computed(()=>{var L;const c=e.selection.value;if(!c)return!1;const b=(L=e.cells[e.cellKey(c.startCol,c.startRow)])==null?void 0:L.style;return(b==null?void 0:b.wrap)==="wrap"});function a(c){P("textAlign",c)}function O(c){P("verticalAlign",c)}function H(){if(!e.selection.value)return;const b=o.value;P("wrap",b?void 0:"wrap")}const V=t.ref(""),ae=ye;t.watch(T,c=>{V.value=c===0?"":String(c)},{immediate:!0});function ve(c){const b=c.replace(/[^\d]/g,"");V.value=b;const L=parseInt(b,10);!isNaN(L)&&L>=5&&L<=72&&L!==T.value&&P("fontSize",L)}function xe(){const c=V.value.trim();if(!c){V.value=T.value===0?"":String(T.value);return}let b=parseInt(c,10);isNaN(b)?b=T.value===0?at:T.value:b=Math.max(5,Math.min(72,b)),V.value=String(b),b!==T.value&&P("fontSize",b)}function Ae(c){c.key==="Enter"&&c.target.blur()}function Le(c){c&&c.preventDefault(),ae.value=!ae.value,ae.value&&(s&&(s.value=!1),te&&(te.value=!1),h.value=!1,He.value=!1)}function he(){const c=T.value===0?at:T.value,b=Math.min(72,c+1);P("fontSize",b),V.value=String(b),ae.value=!1}function We(){const c=T.value===0?at:T.value,b=Math.max(5,c-1);P("fontSize",b),V.value=String(b),ae.value=!1}function S(c){var j;const b=e.selection.value;if(!b)return!1;let L,W=!1;for(let Q=b.startCol;Q<=b.endCol&&!W;Q++)for(let Z=b.startRow;Z<=b.endRow&&!W;Z++){const ue=e.findMerge(Q,Z);if(ue&&(Q!==ue.range.startCol||Z!==ue.range.startRow))continue;const Ee=(j=e.cells[e.cellKey(Q,Z)])==null?void 0:j.style,Ve=!!(Ee!=null&&Ee[c]);L===void 0?L=Ve:Ve!==L&&(W=!0)}return!W&&L===!0}const F=t.computed(()=>S("fontWeight")),_=t.computed(()=>S("fontStyle")),le=t.computed(()=>S("underline")),fe=t.computed(()=>S("strikethrough"));function z(){P("fontWeight",F.value?"":"bold")}function se(){P("fontStyle",_.value?"":"italic")}function ke(){P("underline",le.value?"":"underline")}function De(){P("strikethrough",fe.value?"":"line-through")}const Qe=t.ref(""),lt=t.ref(""),$e=h,Xe=He;function st(){$e.value=!$e.value,Xe.value=!1,te&&(te.value=!1),s&&(s.value=!1)}function At(){Xe.value=!Xe.value,$e.value=!1,te&&(te.value=!1),s&&(s.value=!1)}function Ke(c){te&&(te.value=c),c&&($e.value=!1,Xe.value=!1,s&&(s.value=!1))}function E(c){Qe.value=c,P("color",c===""?"":c)}function B(c){lt.value=c,P("backgroundColor",c===""?"":c)}function R(){P("color",Qe.value===""?"":Qe.value)}function K(){P("backgroundColor",lt.value===""?"":lt.value)}const X=t.computed(()=>{var W;const c=e.selection.value;if(!c)return"";let b,L=!1;for(let j=c.startCol;j<=c.endCol&&!L;j++)for(let Q=c.startRow;Q<=c.endRow&&!L;Q++){const Z=e.findMerge(j,Q);if(Z&&(j!==Z.range.startCol||Q!==Z.range.startRow))continue;const ue=(W=e.cells[e.cellKey(j,Q)])==null?void 0:W.style,Ee=typeof(ue==null?void 0:ue.color)=="string"?ue.color:"";b===void 0?b=Ee:Ee!==b&&(L=!0)}return L?"":b??""}),re=t.computed(()=>{var W;const c=e.selection.value;if(!c)return"";let b,L=!1;for(let j=c.startCol;j<=c.endCol&&!L;j++)for(let Q=c.startRow;Q<=c.endRow&&!L;Q++){const Z=e.findMerge(j,Q);if(Z&&(j!==Z.range.startCol||Q!==Z.range.startRow))continue;const ue=(W=e.cells[e.cellKey(j,Q)])==null?void 0:W.style,Ee=typeof(ue==null?void 0:ue.backgroundColor)=="string"?ue.backgroundColor:"";b===void 0?b=Ee:Ee!==b&&(L=!0)}return L?"":b??""});return{undoStack:C,redoStack:n,cloneCells:u,takeSnap:k,restoreSnap:i,saveUndo:I,undo:p,redo:ee,canUndo:Y,canRedo:y,hasSelection:ne,paintFmt:A,onPaintFormat:m,applyPaintFormat:ge,clearFormat:me,fontFamilyOptions:we,fontSizeOptions:G,FONT_FAMILY_MIXED:U,selFontFamily:pe,selFontSize:T,applyStyleToSelection:P,onFontFamilyChange:be,onFontSizeChange:Se,hAlignOptions:ce,vAlignOptions:r,selHAlign:f,selVAlign:w,selWrap:o,onHAlignChange:a,onVAlignChange:O,onWrapToggle:H,fontSizeInput:V,fontSizeMenuOpen:ae,onFontSizeInput:ve,onFontSizeBlur:xe,onFontSizeKeydown:Ae,toggleFontSizeMenu:Le,onFontSizeStepUp:he,onFontSizeStepDown:We,selFontWeight:F,selFontStyle:_,selUnderline:le,selStrikethrough:fe,toggleFontWeight:z,toggleFontStyle:se,toggleUnderline:ke,toggleStrikethrough:De,cachedTextColor:Qe,cachedFillColor:lt,textColorMenuOpen:$e,fillColorMenuOpen:Xe,_toggleTextColorMenu:st,_toggleFillColorMenu:At,onBorderMenuToggle:Ke,onTextColorChange:E,onFillColorChange:B,applyCachedTextColor:R,applyCachedFillColor:K,selTextColor:X,selFillColor:re}}function gn(e,v){v.borderMenuOpen&&(e.borderMenuOpen=v.borderMenuOpen),v.mergeMenuOpen&&(e.mergeMenuOpen=v.mergeMenuOpen),(()=>{const n=e.borderMenuOpen,u=e.mergeMenuOpen;e.onBorderMenuToggle=k=>{n&&(n.value=k),k&&(e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1,u&&(u.value=!1))},e.toggleFontSizeMenu=k=>{k&&k.preventDefault(),e.fontSizeMenuOpen.value=!e.fontSizeMenuOpen.value,e.fontSizeMenuOpen.value&&(u&&(u.value=!1),n&&(n.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,n&&(n.value=!1),u&&(u.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,n&&(n.value=!1),u&&(u.value=!1)}})()}function hn(e,v){const C=t.ref("none"),n=t.ref(!1),u="#444";function k(r,f,w,o){const a=e.findMerge(f,w),O=a?a.range.endCol:f,H=a?a.range.endRow:w,V=a?a.range.startCol:f,ve=(a?a.range.startRow:w)===o.startRow,xe=H===o.endRow,Ae=V===o.startCol,Le=O===o.endCol,he={top:0,bottom:0,left:0,right:0};switch(r){case"none":return he;case"bottom":xe&&(he.bottom=1);break;case"top":ve&&(he.top=1);break;case"left":Ae&&(he.left=1);break;case"right":Le&&(he.right=1);break;case"all":he.top=1,he.bottom=1,he.left=1,he.right=1;break;case"outer":ve&&(he.top=1),xe&&(he.bottom=1),Ae&&(he.left=1),Le&&(he.right=1);break;case"thickOuter":ve&&(he.top=2),xe&&(he.bottom=2),Ae&&(he.left=2),Le&&(he.right=2);break}return he}function i(r,f,w,o,a){var he,We;if(r<0||f<0||r>=e.colCount||f>=e.rowCount)return;const O=e.findMerge(r,f);if(O&&(w==="Top"&&f!==O.range.startRow||w==="Bottom"&&f!==O.range.endRow||w==="Left"&&r!==O.range.startCol||w==="Right"&&r!==O.range.endCol))return;const H=O?O.anchor:e.cellKey(r,f),V=((he=e.cells[H])==null?void 0:he.value)??"",ae=(We=e.cells[H])!=null&&We.style?{...e.cells[H].style}:{},ve=`border${w}Width`;o===0?a&&Reflect.deleteProperty(ae,ve):(ae[ve]=o,ae.borderColor=u),["Top","Bottom","Left","Right"].some(S=>ae[`border${S}Width`]!==void 0)||Reflect.deleteProperty(ae,"borderColor");const Le=Object.keys(ae).length?ae:null;V===""&&Le===null?e.delCell(H):e.cells[H]={value:V,style:Le}}function I(r,f){var ve;const w=e.findMerge(r,f),o=w?w.anchor:e.cellKey(r,f),a=(ve=e.cells[o])==null?void 0:ve.style,O=(a==null?void 0:a.borderTopWidth)||0,H=(a==null?void 0:a.borderBottomWidth)||0,V=(a==null?void 0:a.borderLeftWidth)||0,ae=(a==null?void 0:a.borderRightWidth)||0;i(r,f-1,"Bottom",O,!0),i(r,f+1,"Top",H,!0),i(r-1,f,"Right",V,!0),i(r+1,f,"Left",ae,!0)}e.syncCellBorders=I;function p(r,f,w,o=!0){var Ae,Le;const a=e.cellKey(r,f),O=((Ae=e.cells[a])==null?void 0:Ae.value)??"",H=(Le=e.cells[a])!=null&&Le.style?{...e.cells[a].style}:{},V=["Top","Bottom","Left","Right"],ae=[w.top,w.bottom,w.left,w.right];for(let he=0;he<4;he++){const We=`border${V[he]}Width`;ae[he]===0?o&&Reflect.deleteProperty(H,We):(H[We]=ae[he],H.borderColor=u)}V.some(he=>H[`border${he}Width`]!==void 0)||Reflect.deleteProperty(H,"borderColor");const xe=Object.keys(H).length?H:null;O===""&&xe===null?e.delCell(a):e.cells[a]={value:O,style:xe},I(r,f)}function ee(r){var w,o;C.value=r;const f=e.selection.value;if(f){if(v.saveUndo(),r==="none")for(let a=f.startCol;a<=f.endCol;a++)for(let O=f.startRow;O<=f.endRow;O++){const H=e.findMerge(a,O);H&&(a!==H.range.startCol||O!==H.range.startRow)||p(a,O,{top:0,bottom:0,left:0,right:0},!0)}else for(let a=f.startCol;a<=f.endCol;a++)for(let O=f.startRow;O<=f.endRow;O++){const H=e.findMerge(a,O);if(H&&(a!==H.range.startCol||O!==H.range.startRow))continue;const V=k(r,a,O,f);p(a,O,V,!1)}(w=e.scheduleRender)==null||w.call(e),(o=e.emitModelData)==null||o.call(e)}}function Y(){ee(C.value)}function y(r,f,w){var O,H;const o=e.findMerge(r,f);if(o){const V=(O=e.cells[o.anchor])==null?void 0:O.style;return w==="Top"&&f===o.range.startRow?(V==null?void 0:V.borderTopWidth)||0:w==="Bottom"&&f===o.range.endRow?(V==null?void 0:V.borderBottomWidth)||0:w==="Left"&&r===o.range.startCol?(V==null?void 0:V.borderLeftWidth)||0:w==="Right"&&r===o.range.endCol&&(V==null?void 0:V.borderRightWidth)||0}const a=(H=e.cells[e.cellKey(r,f)])==null?void 0:H.style;return(a==null?void 0:a[`border${w}Width`])||0}const ne=t.ref(!1);function A(r){ne.value=r,r&&(v.textColorMenuOpen.value=!1,v.fillColorMenuOpen.value=!1,n.value=!1,v.fontSizeMenuOpen.value=!1)}function m(r,f,w,o){const a=[];for(const O in e.merges){const H=e.merges[O];H&&H.startCol<=w&&H.endCol>=r&&H.startRow<=o&&H.endRow>=f&&a.push(O)}for(const O of a)Reflect.deleteProperty(e.merges,O)}function ge(){var a,O,H,V;const r=e.selection.value;if(!r||r.startCol===r.endCol&&r.startRow===r.endRow)return;v.saveUndo(),m(r.startCol,r.startRow,r.endCol,r.endRow);const f=e.cellKey(r.startCol,r.startRow),w=((a=e.cells[f])==null?void 0:a.value)??"";for(let ae=r.startCol;ae<=r.endCol;ae++)for(let ve=r.startRow;ve<=r.endRow;ve++)ae===r.startCol&&ve===r.startRow||e.clearCellsInRange(ae,ae,ve,ve);const o=(O=e.cells[f])!=null&&O.style?{...e.cells[f].style}:{};o.textAlign="center",e.cells[f]={value:w,style:o},e.merges[f]={startCol:r.startCol,startRow:r.startRow,endCol:r.endCol,endRow:r.endRow},e.selectCell(r.startCol,r.startRow),(H=e.scheduleRender)==null||H.call(e),(V=e.emitModelData)==null||V.call(e)}function me(){var f,w,o;const r=e.selection.value;if(!(!r||r.startCol===r.endCol)){v.saveUndo();for(let a=r.startRow;a<=r.endRow;a++){m(r.startCol,a,r.endCol,a);const O=e.cellKey(r.startCol,a);(f=e.cells[O])==null||f.value;for(let H=r.startCol+1;H<=r.endCol;H++)e.clearCellsInRange(H,H,a,a);e.merges[O]={startCol:r.startCol,startRow:a,endCol:r.endCol,endRow:a}}e.selectRange(r.startCol,r.startRow,r.endCol,r.endRow),(w=e.scheduleRender)==null||w.call(e),(o=e.emitModelData)==null||o.call(e)}}function we(){var w,o,a;const r=e.selection.value;if(!r||r.startCol===r.endCol&&r.startRow===r.endRow)return;v.saveUndo(),m(r.startCol,r.startRow,r.endCol,r.endRow);const f=e.cellKey(r.startCol,r.startRow);(w=e.cells[f])==null||w.value;for(let O=r.startCol;O<=r.endCol;O++)for(let H=r.startRow;H<=r.endRow;H++)O===r.startCol&&H===r.startRow||e.clearCellsInRange(O,O,H,H);e.merges[f]={startCol:r.startCol,startRow:r.startRow,endCol:r.endCol,endRow:r.endRow},e.selectCell(r.startCol,r.startRow),(o=e.scheduleRender)==null||o.call(e),(a=e.emitModelData)==null||a.call(e)}function G(){var f,w;const r=e.selection.value;r&&(v.saveUndo(),m(r.startCol,r.startRow,r.endCol,r.endRow),(f=e.scheduleRender)==null||f.call(e),(w=e.emitModelData)==null||w.call(e))}function U(){const r=e.selection.value;if(!r)return;const f=e.findMerge(r.startCol,r.startRow);f&&r.startCol===f.range.startCol&&r.startRow===f.range.startRow&&r.endCol===f.range.endCol&&r.endRow===f.range.endRow?G():ge()}function pe(r){switch(r){case"mergeCenter":ge();break;case"mergeAcross":me();break;case"mergeCells":we();break;case"unmergeCells":G();break}}let T=null,P=[];function be(r,f,w,o){var a;P=[];for(let O=w;O<=o;O++){const H=[];for(let V=r;V<=f;V++){const ae=(a=e.cells[e.cellKey(V,O)])==null?void 0:a.style;H.push(ae?{...ae}:null)}P.push(H)}}function ye(r,f,w,o){const a=e.cellKey(r,f);if(tl(),w===""||w==null){e.formulaDeps.clear(a),o?e.cells[a]={value:"",style:{...o}}:e.delCell(a),e.formulaDeps.markDirty(a);return}e.cells[a]={value:w,style:o?{...o}:null},w.startsWith("=")?e.formulaDeps.set(a,ll(w.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(a),e.formulaDeps.markDirty(a)}function te(){const r=e.selection.value;if(!r)return;T={...r},be(r.startCol,r.endCol,r.startRow,r.endRow);const f=[];for(let w=r.startRow;w<=r.endRow;w++){const o=[];for(let a=r.startCol;a<=r.endCol;a++)o.push(e.getCellRaw(a,w));f.push(o.join(" "))}el(f.join(`
5
+ `))}function s(){const r=e.selection.value;if(r){if(r.startCol===0&&r.endCol===e.colCount-1){T={...r},be(0,e.colCount-1,r.startRow,r.endRow);const f=[];for(let w=r.startRow;w<=r.endRow;w++){const o=[];for(let a=0;a<e.colCount;a++)o.push(e.getCellRaw(a,w));f.push(o.join(" "))}el(f.join(`
6
+ `))}else if(r.startRow===0&&r.endRow===e.rowCount-1){T={...r},be(r.startCol,r.endCol,0,e.rowCount-1);const f=[];for(let w=0;w<e.rowCount;w++){const o=[];for(let a=r.startCol;a<=r.endCol;a++)o.push(e.getCellRaw(a,w));f.push(o.join(" "))}el(f.join(`
7
+ `))}}}async function h(){var O;let r;try{r=await navigator.clipboard.readText()}catch{return}if(!r&&r!=="")return;const f=r.split(/\r?\n/),w=e.activeCell.value,o=T,a=o&&P.length>0;for(let H=0;H<f.length;H++){const V=f[H].split(" ");for(let ae=0;ae<V.length;ae++){const ve=w.col+ae,xe=w.row+H;if(ve<e.colCount&&xe<e.rowCount){let Ae=V[ae];if(Ae.startsWith("=")&&o&&(Ae=un(Ae,ve-(o.startCol+ae),xe-(o.startRow+H),e.colCount,e.rowCount,Je)),a&&H<P.length&&ae<(((O=P[H])==null?void 0:O.length)??0)){const Le=P[H][ae]??null;ye(ve,xe,Ae,Le),I(ve,xe)}else e.setCellValue(ve,xe,Ae)}}}}function He(){var r;if(te(),e.selection.value){const f=e.selection.value;e.clearCellsInRange(f.startCol,f.endCol,f.startRow,f.endRow),(r=e.scheduleRender)==null||r.call(e)}}function Se(){var r;if(e.selection.value){const f=e.selection.value;e.clearCellsInRange(f.startCol,f.endCol,f.startRow,f.endRow),(r=e.scheduleRender)==null||r.call(e)}}function ce(){var O,H;const r=e.selection.value;if(!r)return;v.saveUndo();const f=r.startCol,w=r.startRow,o=r.endCol,a=r.endRow;if(w===a)if(o+1<e.colCount){const V=`${Je(f)}${w+1}:${Je(o)}${w+1}`;e.setCellValue(o+1,w,`=SUM(${V})`)}else{const V=`${Je(f)}${w+1}:${Je(o-1)}${w+1}`;e.setCellValue(o,w,`=SUM(${V})`)}else for(let V=f;V<=o;V++)if(a+1<e.rowCount){const ae=`${Je(V)}${w+1}:${Je(V)}${a+1}`;e.setCellValue(V,a+1,`=SUM(${ae})`)}else{const ae=`${Je(V)}${w+1}:${Je(V)}${a}`;e.setCellValue(V,a,`=SUM(${ae})`)}(O=e.scheduleRender)==null||O.call(e),(H=e.emitModelData)==null||H.call(e)}return{cachedBorder:C,borderMenuOpen:n,BORDER_COLOR:u,borderTypeToWidths:k,onBorderChange:ee,setCellBorderSide:i,syncCellBorders:I,applyBorderToCell:p,applyCachedBorder:Y,cellBorderWidth:y,mergeMenuOpen:ne,onMergeMenuToggle:A,removeOverlappingMerges:m,mergeAndCenter:ge,mergeAcross:me,mergeCells:we,unmergeCells:G,onApplyMerge:U,onMergeChange:pe,copySourceRange:null,copySourceStyles:[],captureStyles:be,setCellWithStyle:ye,copyToClipboard:te,copyRowCol:s,pasteFromClipboard:h,cutSelected:He,clearSelected:Se,sumSelected:ce}}function vn(e,v,C,n){const u={},k=n(v),i=n(C);return k!=null&&(u.width=`${k}px`),i!=null&&(u.height=`${i}px`),u["--sp-formula-bar-bg"]=e.formulaBarBg,u["--sp-formula-bar-border"]=e.formulaBarBorder,u["--sp-formula-bar-label-color"]=e.formulaBarLabelText,u["--sp-formula-bar-label-bg"]=e.formulaBarLabelBg,u["--sp-formula-bar-label-border"]=e.formulaBarLabelBorder,u["--sp-formula-bar-input-bg"]=e.formulaBarInputBg,u["--sp-formula-bar-input-border"]=e.formulaBarInputBorder,u["--sp-formula-bar-input-color"]=e.formulaBarInputText,u["--sp-formula-bar-input-focus-border"]=e.formulaBarInputFocusBorder,u["--sp-formula-bar-input-focus-shadow"]=e.formulaBarInputFocusShadow,u["--sp-wrapper-bg"]=e.wrapperBg,u["--sp-cell-editor-border"]=e.cellEditorBorder,u["--sp-cell-editor-color"]=e.cellEditorText,u["--sp-cell-editor-bg"]=e.cellEditorBg,u["--sp-cell-editor-shadow"]=e.cellEditorShadow,u["--sp-tab-bar-bg"]=e.tabBarBg,u["--sp-tab-bar-border"]=e.tabBarBorder,u["--sp-tab-active-bg"]=e.tabActiveBg,u["--sp-tab-active-color"]=e.tabActiveText,u["--sp-tab-active-border"]=e.tabActiveBorder,u["--sp-tab-inactive-bg"]=e.tabInactiveBg,u["--sp-tab-inactive-color"]=e.tabInactiveText,u["--sp-tab-inactive-border"]=e.tabInactiveBorder,u["--sp-tab-hover-bg"]=e.tabHoverBg,u["--sp-tab-add-btn-color"]=e.tabAddBtnColor,u["--sp-tab-add-btn-hover-bg"]=e.tabAddBtnHoverBg,u["--sp-tab-scroll-btn-color"]=e.tabScrollBtnColor,u["--sp-tab-scroll-btn-hover-bg"]=e.tabScrollBtnHoverBg,u["--sp-scroll-thumb"]=e.scrollbarThumb,u["--sp-scroll-thumb-hover"]=e.scrollbarThumbHover,u["--sp-scroll-btn-bg"]=e.scrollBtnBg,u["--sp-scroll-btn-color"]=e.scrollBtnColor,u["--sp-scroll-btn-hover-bg"]=e.scrollBtnHoverBg,u["--sp-scroll-btn-active-bg"]=e.scrollBtnActiveBg,u["--sp-scroll-track-bg"]=e.scrollTrackBg,u["--sp-toolbar-bg"]=e.toolbarBg,u["--sp-toolbar-border"]=e.toolbarBorder,u["--sp-toolbar-btn-color"]=e.toolbarBtnColor,u["--sp-toolbar-btn-hover-bg"]=e.toolbarBtnHoverBg,u["--sp-toolbar-btn-disabled-color"]=e.toolbarBtnDisabledColor,u["--sp-toolbar-btn-active-color"]=e.toolbarBtnActiveColor,u}function Cn(e,v,C,n){function u(S,F){var le,fe;const _=F-S+1;for(let z=S;z<=F;z++)for(let se=0;se<e.colCount;se++)e.delCell(e.cellKey(se,z));for(let z=S;z<e.rowCount-_;z++){for(let se=0;se<e.colCount;se++){const ke=e.cellKey(se,z+_),De=e.cellKey(se,z);e.cells[ke]?(e.cells[De]=e.cells[ke],e.delCell(ke)):e.delCell(De)}e.rowHeights.value[z]=e.rowHeights.value[z+_]}for(let z=e.rowCount-_;z<e.rowCount;z++){for(let se=0;se<e.colCount;se++)e.delCell(e.cellKey(se,z));e.rowHeights.value[z]=void 0}if(S>0)for(let z=0;z<e.colCount;z++)(le=e.syncCellBorders)==null||le.call(e,z,S-1),(fe=e.syncCellBorders)==null||fe.call(e,z,S)}function k(S,F){const _=F-S+1;if(!(F>=e.rowCount-1)){for(let le=e.rowCount-1;le>F;le--){for(let fe=0;fe<e.colCount;fe++){const z=e.cellKey(fe,le-_),se=e.cellKey(fe,le);e.cells[z]?e.cells[se]=e.cells[z]:e.delCell(se)}e.rowHeights.value[le]=e.rowHeights.value[le-_]}for(let le=F+1;le<=F+_;le++){for(let fe=0;fe<e.colCount;fe++)e.delCell(e.cellKey(fe,le));e.rowHeights.value[le]=void 0}}}function i(S,F){const _=F-S+1;if(!(F>=e.colCount-1)){for(let le=e.colCount-1;le>F;le--){for(let fe=0;fe<e.rowCount;fe++){const z=e.cellKey(le-_,fe),se=e.cellKey(le,fe);e.cells[z]?e.cells[se]=e.cells[z]:e.delCell(se)}e.colWidths.value[le]=e.colWidths.value[le-_]}for(let le=F+1;le<=F+_;le++){for(let fe=0;fe<e.rowCount;fe++)e.delCell(e.cellKey(le,fe));e.colWidths.value[le]=100}}}function I(S,F){var le,fe;const _=F-S+1;for(let z=S;z<=F;z++)for(let se=0;se<e.rowCount;se++)e.delCell(e.cellKey(z,se));for(let z=S;z<e.colCount-_;z++){for(let se=0;se<e.rowCount;se++){const ke=e.cellKey(z+_,se),De=e.cellKey(z,se);e.cells[ke]?(e.cells[De]=e.cells[ke],e.delCell(ke)):e.delCell(De)}e.colWidths.value[z]=e.colWidths.value[z+_]}for(let z=e.colCount-_;z<e.colCount;z++){for(let se=0;se<e.rowCount;se++)e.delCell(e.cellKey(z,se));e.colWidths.value[z]=100}if(S>0)for(let z=0;z<e.rowCount;z++)(le=e.syncCellBorders)==null||le.call(e,S-1,z),(fe=e.syncCellBorders)==null||fe.call(e,S,z)}let p=0;function ee(){return p++,`s_${p}`}function Y(S){return{id:ee(),name:S,cells:{},merges:{},selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:new Array(e.colCount).fill(100),rowHeights:new Array(e.rowCount).fill(void 0)}}const y=t.ref([Y("Sheet1")]),ne=t.ref(0);function A(){const S=y.value[ne.value];S&&(S.cells={...e.cells},S.merges={...e.merges},S.selection=e.selection.value?{...e.selection.value}:null,S.activeCell={...e.activeCell.value},S.scrollX=e.scrollX.value,S.scrollY=e.scrollY.value,S.colWidths=[...e.colWidths.value],S.rowHeights=[...e.rowHeights.value])}function m(S){const F=y.value[S];F&&(Object.keys(e.cells).forEach(_=>e.delCell(_)),Object.assign(e.cells,F.cells),Object.keys(e.merges).forEach(_=>Reflect.deleteProperty(e.merges,_)),F.merges&&Object.assign(e.merges,F.merges),e.selection.value=F.selection?{...F.selection}:null,e.activeCell.value={...F.activeCell},e.scrollX.value=F.scrollX,e.scrollY.value=F.scrollY,e.colWidths.value=[...F.colWidths],e.rowHeights.value=[...F.rowHeights],ne.value=S)}function ge(S){S===ne.value||S<0||S>=y.value.length||(e.cancelEdit(),A(),m(S))}function me(S){return v.saveUndo(),e.cancelEdit(),A(),y.value.push(Y(S??`Sheet${y.value.length+1}`)),m(y.value.length-1),y.value.length-1}function we(S){return y.value.length<=1||(v.saveUndo(),e.cancelEdit(),y.value.splice(S,1),m(Math.min(S,y.value.length-1))),ne.value}function G(S,F){y.value[S]&&F.trim()&&(v.saveUndo(),y.value[S].name=F.trim())}function U(S){v.saveUndo(),e.cancelEdit(),A();const F=y.value[S];if(!F)return S;let _=F.name;const le=_.match(/^(.*?)\s*\((\d+)\)$/);let fe=le?parseInt(le[2],10)+1:2;le&&(_=le[1]);let z=`${_} (${fe})`;const se=new Set(y.value.map(De=>De.name));for(;se.has(z);)fe++,z=`${_} (${fe})`;const ke={id:ee(),name:z,cells:{...F.cells},merges:F.merges?{...F.merges}:{},selection:F.selection?{...F.selection}:null,activeCell:F.activeCell?{...F.activeCell}:{col:0,row:0},scrollX:F.scrollX,scrollY:F.scrollY,colWidths:[...F.colWidths],rowHeights:[...F.rowHeights]};return y.value.splice(S+1,0,ke),m(S+1),S+1}function pe(S,F){var z;const _=S+F;if(_<0||_>=y.value.length)return;v.saveUndo();const le=ne.value,fe=y.value.splice(S,1)[0];y.value.splice(_,0,fe),le===S?ne.value=_:S<le&&_>=le?ne.value=le-1:S>le&&_<=le&&(ne.value=le+1),(z=e.scheduleRender)==null||z.call(e)}const T=t.computed(()=>y.value.length);let P="";const be=C;function ye(){A();const S=y.value.map(_=>{const le={};for(const[ke,De]of Object.entries(_.cells))le[ke]={value:De.value},De.style&&(le[ke].style=De.style);const fe={name:_.name,cells:le};_.merges&&Object.keys(_.merges).length&&(fe.merges={..._.merges});const z={};for(let ke=0;ke<_.colWidths.length;ke++)_.colWidths[ke]!==100&&(z[ke]=_.colWidths[ke]);Object.keys(z).length&&(fe.colWidths=z);const se={};for(let ke=0;ke<_.rowHeights.length;ke++){const De=_.rowHeights[ke];De!=null&&(se[ke]=De)}return Object.keys(se).length&&(fe.rowHeights=se),fe}),F=JSON.stringify(S);F!==P&&(P=F,be.value=S)}e.emitModelData=ye;let te=!1;function s(){te||(te=!0,Promise.resolve().then(()=>{te=!1,ye()}))}const h=t.computed(()=>e.props.theme==="dark"?Il:Nl),He=t.computed(()=>vn(h.value,e.props.width,e.props.height,mt)),Se=t.computed(()=>{const S={};for(const[F,_]of Object.entries(He.value))F.startsWith("--")&&(S[F]=_);return S}),ce=t.ref(null),r=t.ref(null),f=t.ref(null),w=t.ref(null),o=t.reactive({w:800,h:600});e.viewSize&&t.watch(o,S=>{e.viewSize&&(e.viewSize.w=S.w,e.viewSize.h=S.h)},{deep:!0});const a=48,O=28,H=11,V=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,o.w-a-H))),ae=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,o.h-O-H)));function ve(S,F){const _=Math.max(0,o.w-a-H),le=Math.max(0,o.h-O-H);e.scrollX.value=Math.max(0,Math.min(S??e.scrollX.value,Math.max(0,e.totalWidth.value-_))),e.scrollY.value=Math.max(0,Math.min(F??e.scrollY.value,Math.max(0,e.totalHeight.value-le)))}e.clampScroll=ve;function xe(){var S;return typeof window>"u"?!1:!((S=window.matchMedia)!=null&&S.call(window,"(hover: none) and (pointer: coarse)").matches)}function Ae(S=!1){t.nextTick(()=>{const F=f.value;if(F){if(!e.editingCell.value&&!xe()){document.activeElement===F&&F.blur();return}F.focus({preventScroll:!0}),S&&F.select()}})}function Le(){Ae()}function he(){var F;const S=e.selection.value;if(S){v.saveUndo();for(let _=S.startRow;_<=S.endRow;_++)e.rowHeights.value[_]=void 0;(F=e.scheduleRender)==null||F.call(e),ye()}}function We(){var F;const S=e.selection.value;if(S){v.saveUndo();for(let _=S.startCol;_<=S.endCol;_++)e.colWidths.value[_]=100;(F=e.scheduleRender)==null||F.call(e),ye()}}return{deleteRows:u,insertRows:k,insertCols:i,deleteCols:I,sheets:y,activeSheetIndex:ne,saveSheet:A,loadSheet:m,switchSheet:ge,addSheet:me,removeSheet:we,renameSheet:G,dupSheet:U,moveSheet:pe,sheetCount:T,mkSheet:Y,emitModelData:ye,scheduleOptEmit:s,themeColors:h,outerStyle:He,toolbarThemeVars:Se,wrapperRef:ce,canvasRef:r,editInputRef:f,formulaBarRef:w,viewSize:o,maxScrollX:V,maxScrollY:ae,clampScroll:ve,canFocusHiddenEditor:xe,focusEditInput:Ae,onCanvasFocus:Le,resetRowHeight:he,resetColWidth:We,modelData:be}}function bn(e,v,C,n,u){let k=!1,i=null,I=1;function p(){k||(k=!0,requestAnimationFrame(()=>{k=!1,Y()}))}e.scheduleRender=p;const ee="#444";function Y(){var il,vt,Ot,it,ut,Vt,hl,vl,Cl,bl,yl;const l=n.canvasRef.value;if(!l)return;const d=n.wrapperRef.value;if(!d||(i=l.getContext("2d"),!i))return;I=window.devicePixelRatio||1;const x=d.getBoundingClientRect(),M=x.width,g=x.height;n.viewSize.w=M,n.viewSize.h=g,l.width=M*I,l.height=g*I,l.style.width=M+"px",l.style.height=g+"px",i.setTransform(I,0,0,I,0,0);const D=e.scrollX.value,q=e.scrollY.value,oe=52,ie=24,Be=n.themeColors.value,Ye=e.colPositions.value,_e=e.rowPositions.value,kt=e.colWidths.value,gt=[];for(let N=0;N<e.rowCount;N++)gt[N]=_e[N+1]-_e[N];const ot=Math.max(0,e.hitCol(D));let ht=ot;for(let N=ot;N<e.colCount&&!(oe+Ye[N]-D>=M);N++)ht=N;const Et=ht,Ze=Math.max(0,e.hitRow(q));let Xt=Ze;for(let N=Ze;N<e.rowCount&&!(ie+_e[N]-q>=g);N++)Xt=N;const Bt=Xt;i.fillStyle=Be.bg,i.fillRect(0,0,M,g),i.fillStyle=Be.gridBg,i.fillRect(oe,ie,M-oe,g-ie),i.save(),i.beginPath(),i.rect(oe,ie,M-oe,g-ie),i.clip();const Pe=e.selection.value,Lt=e.editingCell.value;for(let N=Ze;N<=Bt;N++)for(let J=ot;J<=Et;J++){const Re=e.findMerge(J,N);if(Re&&!(J===Re.range.startCol&&N===Re.range.startRow))continue;const Me=oe+Ye[J]-D,Te=ie+_e[N]-q;let Ne=kt[J],Ie=gt[N];if(Re&&(Ne=Ye[Re.range.endCol+1]-Ye[J],Ie=_e[Re.range.endRow+1]-_e[N]),Me+Ne<oe||Te+Ie<ie||Me>M||Te>g)continue;const Oe=(il=e.cells[e.cellKey(J,N)])==null?void 0:il.style,Rt=typeof(Oe==null?void 0:Oe.backgroundColor)=="string"?Oe.backgroundColor:"";if(Rt&&(i.fillStyle=Rt,i.fillRect(Me,Te,Ne,Ie)),e.isSelected(J,N)&&(i.fillStyle=Be.selectionBg,i.fillRect(Me,Te,Ne,Ie)),e.activeCell.value.col===J&&e.activeCell.value.row===N&&(i.strokeStyle=Be.activeCellBorder,i.lineWidth=2,i.strokeRect(Me+1,Te+1,Ne-2,Ie-2)),i.strokeStyle=Be.gridLine,i.lineWidth=.5,i.strokeRect(Me+.25,Te+.25,Ne-.5,Ie-.5),!(Lt&&Lt.col===J&&Lt.row===N)){const xt=e.getCellValue(J,N);if(xt){const Ce=(vt=e.cells[e.cellKey(J,N)])==null?void 0:vt.style,Ge=e.cellFontSize(J,N),qe=typeof(Ce==null?void 0:Ce.fontFamily)=="string"&&Ce.fontFamily?Ce.fontFamily:$t,nt=(Ce==null?void 0:Ce.fontWeight)==="bold"?"bold":"normal",tt=(Ce==null?void 0:Ce.fontStyle)==="italic"?"italic":"normal",St=(Ce==null?void 0:Ce.underline)==="underline",Kn=(Ce==null?void 0:Ce.strikethrough)==="line-through",cl=typeof(Ce==null?void 0:Ce.color)=="string"?Ce.color:"",wl=typeof(Ce==null?void 0:Ce.textAlign)=="string"?Ce.textAlign:"left",kl=typeof(Ce==null?void 0:Ce.verticalAlign)=="string"?Ce.verticalAlign:"top";i.fillStyle=cl||Be.cellText,i.font=`${tt} ${nt} ${Ge}px ${qe}`,i.textBaseline="alphabetic",i.save(),i.beginPath(),i.rect(Me+5,Te+1,Ne-10,Ie-2),i.clip();const Un=(Ce==null?void 0:Ce.wrap)==="wrap",Wt=e.getWrappedLines(i,xt,Ne-10,Un);let Mt=0,Ct=0;for(const Tt of Wt){const zt=i.measureText(Tt),Dt=zt.actualBoundingBoxAscent,Ht=zt.actualBoundingBoxDescent,rt=Dt||Ge*.8,qt=Ht||Ge*.2;Mt=Math.max(Mt,rt),Ct=Math.max(Ct,qt)}Mt=Math.max(Mt,Ge*.5),Ct=Math.max(Ct,Ge*.15);const jt=Ge,Pn=Wt.length*jt;let Zt;kl==="middle"?Zt=Te+(Ie-Pn)/2+Mt:kl==="bottom"?Zt=Te+Ie-e.BASE_CELL_VPAD-Ct-(Wt.length-1)*jt:Zt=Te+e.BASE_CELL_VPAD+Mt;for(let Tt=0;Tt<Wt.length;Tt++){const zt=Wt[Tt],Dt=Zt+Tt*jt,Ht=i.measureText(zt);let rt;if(wl==="center"?rt=Me+Ne/2-Ht.width/2:wl==="right"?rt=Me+Ne-5-Ht.width:rt=Me+5,i.fillText(zt,rt,Dt),St&&(i.strokeStyle=cl||Be.cellText,i.lineWidth=1,i.beginPath(),i.moveTo(rt,Dt+Ct+1),i.lineTo(rt+Ht.width,Dt+Ct+1),i.stroke()),Kn){i.strokeStyle=cl||Be.cellText,i.lineWidth=1;const qt=Dt-jt*.25;i.beginPath(),i.moveTo(rt,qt),i.lineTo(rt+Ht.width,qt),i.stroke()}}i.restore()}}}for(let N=Ze;N<=Bt;N++)for(let J=ot;J<=Et;J++){const Re=e.findMerge(J,N);if(Re&&!(J===Re.range.startCol&&N===Re.range.startRow))continue;const Me=oe+Ye[J]-D,Te=ie+_e[N]-q;let Ne=kt[J],Ie=gt[N];if(Re&&(Ne=Ye[Re.range.endCol+1]-Ye[J],Ie=_e[Re.range.endRow+1]-_e[N]),Me+Ne<oe||Te+Ie<ie||Me>M||Te>g)continue;const Oe=(Ot=e.cells[e.cellKey(J,N)])==null?void 0:Ot.style,Rt=(Oe==null?void 0:Oe.borderTopWidth)||0,xt=(Oe==null?void 0:Oe.borderLeftWidth)||0,Ce=(Oe==null?void 0:Oe.borderBottomWidth)||0,Ge=(Oe==null?void 0:Oe.borderRightWidth)||0,qe=Math.max(Rt,C.cellBorderWidth(J,N-1,"Bottom")),nt=Math.max(xt,C.cellBorderWidth(J-1,N,"Right")),tt=Math.max(Ce,C.cellBorderWidth(J,N+1,"Top")),St=Math.max(Ge,C.cellBorderWidth(J+1,N,"Left"));(qe>0||nt>0||tt>0||St>0)&&(i.fillStyle=ee,qe>0&&i.fillRect(Me,Te,Ne,qe),tt>0&&i.fillRect(Me,Te+Ie-tt,Ne,tt),nt>0&&i.fillRect(Me,Te,nt,Ie),St>0&&i.fillRect(Me+Ne-St,Te,St,Ie))}for(let N=Ze;N<=Bt;N++)for(let J=ot;J<=Et;J++){const Re=e.findMerge(J,N);if(Re&&!(J===Re.range.startCol&&N===Re.range.startRow))continue;const Me=oe+Ye[J]-D,Te=ie+_e[N]-q;let Ne=kt[J],Ie=gt[N];if(Re&&(Ne=Ye[Re.range.endCol+1]-Ye[J],Ie=_e[Re.range.endRow+1]-_e[N]),Me+Ne<oe||Te+Ie<ie||Me>M||Te>g)continue;const Oe=((ut=(it=e.cells[e.cellKey(J,N)])==null?void 0:it.style)==null?void 0:ut.borderTopWidth)||0,Rt=((hl=(Vt=e.cells[e.cellKey(J,N)])==null?void 0:Vt.style)==null?void 0:hl.borderLeftWidth)||0,xt=((Cl=(vl=e.cells[e.cellKey(J,N)])==null?void 0:vl.style)==null?void 0:Cl.borderBottomWidth)||0,Ce=((yl=(bl=e.cells[e.cellKey(J,N)])==null?void 0:bl.style)==null?void 0:yl.borderRightWidth)||0,Ge=Math.max(Oe,C.cellBorderWidth(J,N-1,"Bottom")),qe=Math.max(Rt,C.cellBorderWidth(J-1,N,"Right")),nt=Math.max(xt,C.cellBorderWidth(J,N+1,"Top")),tt=Math.max(Ce,C.cellBorderWidth(J+1,N,"Left"));i.fillStyle=ee,Ge>0&&qe>0&&i.fillRect(Me-qe,Te-Ge,qe,Ge),Ge>0&&tt>0&&i.fillRect(Me+Ne,Te-Ge,tt,Ge),nt>0&&qe>0&&i.fillRect(Me-qe,Te+Ie,qe,nt),nt>0&&tt>0&&i.fillRect(Me+Ne,Te+Ie,tt,nt)}i.restore(),i.fillStyle=Be.headerBg,i.fillRect(oe,0,M-oe,ie);for(let N=ot;N<=Et;N++){const J=oe+Ye[N]-D,Re=kt[N];J+Re<oe||J>M||(Pe&&N>=Pe.startCol&&N<=Pe.endCol&&(i.fillStyle=Be.selectionBg,i.fillRect(J,0,Re,ie)),i.strokeStyle=Be.headerBorder,i.lineWidth=.5,i.strokeRect(J+.25,.25,Re-.5,ie-.5),Pe&&N>=Pe.startCol&&N<=Pe.endCol&&(i.strokeStyle=Be.activeCellBorder,i.lineWidth=2,i.beginPath(),i.moveTo(J,ie-1),i.lineTo(J+Re,ie-1),i.stroke()),i.fillStyle=Be.headerText,i.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',i.textAlign="center",i.textBaseline="middle",i.fillText(Je(N),J+Re/2,ie/2))}i.strokeStyle=Be.headerSep,i.lineWidth=1,i.beginPath(),i.moveTo(oe,ie+.5),i.lineTo(M,ie+.5),i.stroke(),i.fillStyle=Be.headerBg,i.fillRect(0,ie,oe,g-ie);for(let N=Ze;N<=Bt;N++){const J=ie+_e[N]-q,Re=gt[N];J+Re<ie||J>g||(Pe&&N>=Pe.startRow&&N<=Pe.endRow&&(i.fillStyle=Be.selectionBg,i.fillRect(0,J,oe,Re)),i.strokeStyle=Be.headerBorder,i.lineWidth=.5,i.strokeRect(.25,J+.25,oe-.5,Re-.5),Pe&&N>=Pe.startRow&&N<=Pe.endRow&&(i.strokeStyle=Be.activeCellBorder,i.lineWidth=2,i.beginPath(),i.moveTo(oe-1,J),i.lineTo(oe-1,J+Re),i.stroke()),i.fillStyle=Be.headerText,i.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',i.textAlign="center",i.textBaseline="middle",i.fillText(String(N+1),oe/2,J+Re/2+.5))}i.strokeStyle=Be.headerSep,i.lineWidth=1,i.beginPath(),i.moveTo(oe+.5,ie),i.lineTo(oe+.5,g),i.stroke(),i.fillStyle=Be.headerBg,i.fillRect(0,0,oe,ie),i.strokeStyle=Be.headerSep,i.lineWidth=1,i.strokeRect(.5,.5,oe-.5,ie-.5)}const y=t.computed(()=>Je(e.activeCell.value.col)+String(e.activeCell.value.row+1)),ne=t.computed(()=>e.editingCell.value?e.editValue.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));function A(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.editValue.value=e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),p())}function m(l){e.editValue.value=l.target.value}function ge(l){var d,x;l.key==="Enter"?(l.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(d=n.formulaBarRef.value)==null||d.blur(),p(),n.focusEditInput()):l.key==="Escape"&&(l.preventDefault(),e.cancelEdit(),(x=n.formulaBarRef.value)==null||x.blur(),p(),n.focusEditInput())}function me(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),p())},0)}const we=t.ref(null),G=t.ref("");function U(l){we.value===null&&(n.switchSheet(l),p())}function pe(l){l!==n.activeSheetIndex.value&&(n.saveSheet(),n.loadSheet(l),p()),we.value=l,G.value=n.sheets.value[l].name,t.nextTick(()=>{const d=document.querySelector(".tab-rename-input");d==null||d.focus(),d==null||d.select()})}function T(){we.value!==null&&(n.renameSheet(we.value,G.value),t.nextTick(()=>n.emitModelData())),we.value=null,G.value=""}function P(){we.value=null,G.value=""}function be(l){l.key==="Enter"?(l.preventDefault(),T()):l.key==="Escape"&&(l.preventDefault(),P())}const ye=t.ref(null);let te=null;function s(){te&&(document.removeEventListener("click",te),te=null)}function h(l,d,x){s();const M=140,g=x.length*28+8,D=window.innerWidth,q=window.innerHeight;l+M>D&&(l-=M),d+g>q&&(d-=g),ye.value={x:l,y:d,items:x},te=()=>{ye.value=null,s()},setTimeout(()=>document.addEventListener("click",te,{once:!0}),0)}const He=t.ref(!1);function Se(l,d){if(!d.children){He.value=!1;return}const M=l.currentTarget.querySelector(".context-submenu");if(!M){He.value=!1;return}const g=M.getBoundingClientRect();He.value=g.right>window.innerWidth}function ce(l,d){l.preventDefault(),l.stopPropagation(),h(l.clientX,l.clientY,[{label:$(e.locale.value,"insert"),action:()=>{n.addSheet(),p()}},{label:$(e.locale.value,"copy"),action:()=>{n.dupSheet(d)}},{label:$(e.locale.value,"rename"),action:()=>{pe(d)}},{label:$(e.locale.value,"delete"),action:()=>{n.removeSheet(d),p()},disabled:n.sheetCount.value<=1},{label:$(e.locale.value,"moveSheetLeft"),action:()=>{n.moveSheet(d,-1)},disabled:d===0},{label:$(e.locale.value,"moveSheetRight"),action:()=>{n.moveSheet(d,1)},disabled:d===n.sheets.value.length-1}])}function r(l){l.preventDefault(),!(l.target.closest(".tab-item")||l.target.closest(".tab-bar__add-btn"))&&h(l.clientX,l.clientY,[{label:$(e.locale.value,"insert"),action:()=>{n.addSheet(),p()}}])}function f(l){l.preventDefault(),e.selectAll(),p(),h(l.clientX,l.clientY,[{label:$(e.locale.value,"cut"),action:()=>{C.cutSelected(),n.emitModelData()}},{label:$(e.locale.value,"copy"),action:()=>C.copyToClipboard()},{label:$(e.locale.value,"paste"),action:()=>{v.saveUndo(),C.pasteFromClipboard().then(()=>{p(),t.nextTick(()=>n.emitModelData())})}},{label:$(e.locale.value,"delete"),action:()=>{v.saveUndo(),C.clearSelected();for(let d=0;d<e.colCount;d++)e.colWidths.value[d]=100;for(let d=0;d<e.rowCount;d++)e.rowHeights.value[d]=void 0;p(),n.emitModelData()}}])}function w(l,d){l.preventDefault();const x=l.clientX,M=l.clientY,g=e.selection.value;g&&g.startCol===0&&g.endCol===e.colCount-1&&d>=g.startRow&&d<=g.endRow||(e.selectRange(0,d,e.colCount-1,d),p());const D=e.selection.value;h(l.clientX,l.clientY,[{label:$(e.locale.value,"insert"),action:()=>{v.saveUndo(),n.insertRows(D.startRow,D.endRow),p(),n.emitModelData()},disabled:D.endRow>=e.rowCount-1},{label:$(e.locale.value,"cut"),action:()=>{v.saveUndo(),C.copyRowCol();for(let q=D.startRow;q<=D.endRow;q++)for(let oe=0;oe<e.colCount;oe++)e.delCell(e.cellKey(oe,q));p(),n.emitModelData()}},{label:$(e.locale.value,"copy"),action:()=>C.copyRowCol()},{label:$(e.locale.value,"paste"),action:()=>{v.saveUndo(),C.pasteFromClipboard().then(()=>{p(),t.nextTick(()=>n.emitModelData())})}},{label:$(e.locale.value,"delete"),action:()=>{v.saveUndo(),n.deleteRows(D.startRow,D.endRow),p(),n.emitModelData()}},{label:`${$(e.locale.value,"rowHeight")}...`,action:()=>ve("row",x,M)},{label:$(e.locale.value,"autoRowHeight"),action:()=>n.resetRowHeight()}])}function o(l,d){l.preventDefault();const x=l.clientX,M=l.clientY,g=e.selection.value;g&&g.startRow===0&&g.endRow===e.rowCount-1&&d>=g.startCol&&d<=g.endCol||(e.selectRange(d,0,d,e.rowCount-1),p());const D=e.selection.value;h(l.clientX,l.clientY,[{label:$(e.locale.value,"insert"),action:()=>{v.saveUndo(),n.insertCols(D.startCol,D.endCol),p(),n.emitModelData()},disabled:D.endCol>=e.colCount-1},{label:$(e.locale.value,"cut"),action:()=>{v.saveUndo(),C.copyRowCol();for(let q=D.startCol;q<=D.endCol;q++)for(let oe=0;oe<e.rowCount;oe++)e.delCell(e.cellKey(q,oe));p(),n.emitModelData()}},{label:$(e.locale.value,"copy"),action:()=>C.copyRowCol()},{label:$(e.locale.value,"paste"),action:()=>{v.saveUndo(),C.pasteFromClipboard().then(()=>{p(),t.nextTick(()=>n.emitModelData())})}},{label:$(e.locale.value,"delete"),action:()=>{v.saveUndo(),n.deleteCols(D.startCol,D.endCol),p(),n.emitModelData()}},{label:`${$(e.locale.value,"colWidth")}...`,action:()=>ve("col",x,M)},{label:$(e.locale.value,"defaultColWidth"),action:()=>n.resetColWidth()}])}function a(l,d,x){l.preventDefault(),e.isSelected(d,x)||(e.selectCell(d,x),p());const M=e.selection.value,g=!!(M&&M.startCol===M.endCol&&M.startRow===M.endRow);h(l.clientX,l.clientY,[{label:$(e.locale.value,"cut"),action:()=>{C.cutSelected(),n.emitModelData()}},{label:$(e.locale.value,"copy"),action:()=>C.copyToClipboard()},{label:$(e.locale.value,"paste"),action:()=>{v.saveUndo(),C.pasteFromClipboard().then(()=>{p(),t.nextTick(()=>n.emitModelData())})}},{label:$(e.locale.value,"delete"),action:()=>{v.saveUndo(),C.clearSelected(),p(),n.emitModelData()}},{label:$(e.locale.value,"calculate"),children:[{label:$(e.locale.value,"sum"),action:C.sumSelected,disabled:g}]}])}const O=t.ref(null),H=t.ref(null);let V=null;function ae(){V&&(document.removeEventListener("mousedown",V),V=null)}function ve(l,d,x){ae();const M=e.selection.value;let g="";if(M){const Be=l==="row"?e.getRowHeight(M.startRow):e.colWidths.value[M.startCol];g=Be!=null&&Be>0?String(Math.round(Be)):""}const D=220,q=118;let oe=d,ie=x;oe+D>window.innerWidth&&(oe=window.innerWidth-D-8),ie+q>window.innerHeight&&(ie=window.innerHeight-q-8),oe<8&&(oe=8),ie<8&&(ie=8),H.value={type:l,x:oe,y:ie,value:g,error:""},V=()=>{H.value=null},setTimeout(()=>document.addEventListener("mousedown",V,{once:!0}),0),t.nextTick(()=>{const Be=O.value;Be&&(Be.focus(),Be.select())})}function xe(l){const d=H.value;if(!d)return;const x=l.target,M=x.value,g=M.replace(/[^\d]/g,"");d.value=g,M!==g&&(x.value=g),d.error=""}function Ae(l){l.key==="Enter"?(l.preventDefault(),he()):l.key==="Escape"&&(l.preventDefault(),We())}function Le(){const l=H.value;if(!l)return;const d=l.value.trim(),x=Number(d),M=l.type==="row",g=M?24:30,D=M?500:1e3;if(d===""||!Number.isFinite(x)){We();return}const q=Math.max(g,Math.min(D,Math.round(x)));l.value=String(q),l.error=""}function he(){const l=H.value,d=e.selection.value;if(!l||!d)return;const x=l.value.trim(),M=Number(x),g=l.type==="row",D=g?24:30,q=g?500:1e3;if(x===""||!Number.isFinite(M)){l.error=$(e.locale.value,"dimNumberError");return}if(M<D||M>q){l.error=$(e.locale.value,"dimRangeError").replace("{min}",String(D)).replace("{max}",String(q));return}const oe=M;if(v.saveUndo(),g)for(let ie=d.startRow;ie<=d.endRow;ie++)e.rowHeights.value[ie]=oe;else for(let ie=d.startCol;ie<=d.endCol;ie++)e.colWidths.value[ie]=oe;p(),n.emitModelData(),We()}function We(){ae(),H.value=null}const S=t.computed(()=>{var Vt;const l=!e.editingCell.value,d=e.editingCell.value??e.activeCell.value,x=d.col,M=d.row,g=(Vt=e.cells[e.cellKey(x,M)])==null?void 0:Vt.style,D=e.cellFontSize(x,M),q=typeof(g==null?void 0:g.fontFamily)=="string"&&g.fontFamily?g.fontFamily:$t,oe=(g==null?void 0:g.fontWeight)==="bold"?"bold":"normal",ie=(g==null?void 0:g.fontStyle)==="italic"?"italic":"normal",Be=(g==null?void 0:g.underline)==="underline"?"underline":(g==null?void 0:g.strikethrough)==="line-through"?"line-through":"none",Ye=(g==null?void 0:g.underline)==="underline"&&(g==null?void 0:g.strikethrough)==="line-through"?"underline line-through":Be,_e=typeof(g==null?void 0:g.color)=="string"?g.color:void 0,kt=typeof(g==null?void 0:g.backgroundColor)=="string"?g.backgroundColor:void 0,gt=typeof(g==null?void 0:g.textAlign)=="string"?g.textAlign:"left",ot=typeof(g==null?void 0:g.verticalAlign)=="string"?g.verticalAlign:"top",ht=e.findMerge(x,M),Et=ht?e.colPositions.value[ht.range.endCol+1]-e.colPositions.value[x]:e.colWidths.value[x],Ze=ht?e.rowPositions.value[ht.range.endRow+1]-e.rowPositions.value[M]:e.getRowHeight(M),Xt=2,{ascent:Bt,descent:Pe}=e.measureFontMetrics(q,D,oe,ie),Lt=Bt+Pe,vt=(e.editValue.value?e.editValue.value.split(`
8
+ `).length:1)*Lt,Ot=e.BASE_CELL_VPAD-Xt;let it=0,ut=0;return ot==="middle"?(it=Math.floor((Ze-vt)/2),ut=Math.max(0,Ze-vt-it)):ot==="top"?(it=Ot,ut=Math.max(0,Ze-vt-it)):ot==="bottom"&&(ut=Ot,it=Math.max(0,Ze-vt-ut)),{left:`${52+e.colPositions.value[x]-e.scrollX.value}px`,top:`${24+e.rowPositions.value[M]-e.scrollY.value}px`,width:`${Et}px`,height:`${Ze}px`,fontFamily:q,fontSize:`${D}px`,lineHeight:1,fontWeight:oe,fontStyle:ie,textDecoration:Ye,textAlign:gt,paddingTop:`${it}px`,paddingRight:"3px",paddingBottom:`${ut}px`,paddingLeft:"3px",opacity:l?0:1,pointerEvents:l?"none":"auto",color:l?"transparent":_e,caretColor:l?"transparent":void 0,borderColor:l?"transparent":void 0,background:l?"transparent":kt,boxShadow:l?"none":void 0}});function F(){return Math.max(0,n.viewSize.w-52-11)}function _(){return Math.max(0,n.viewSize.h-24-11)}const le=t.computed(()=>F()),fe=t.computed(()=>_()),z=t.computed(()=>Math.max(0,le.value-11*2)),se=t.computed(()=>Math.max(0,fe.value-11*2)),ke=t.computed(()=>n.maxScrollX.value<=0?z.value:Math.max(24,F()/e.totalWidth.value*z.value)),De=t.computed(()=>n.maxScrollX.value<=0?0:e.scrollX.value/n.maxScrollX.value*(z.value-ke.value)),Qe=t.computed(()=>n.maxScrollY.value<=0?se.value:Math.max(24,_()/e.totalHeight.value*se.value)),lt=t.computed(()=>n.maxScrollY.value<=0?0:e.scrollY.value/n.maxScrollY.value*(se.value-Qe.value));let $e=null,Xe=0,st=0;function At(l){l.preventDefault(),$e="v",Xe=l.clientY,st=e.scrollY.value,document.addEventListener("mousemove",E),document.addEventListener("mouseup",B)}function Ke(l){l.preventDefault(),$e="h",Xe=l.clientX,st=e.scrollX.value,document.addEventListener("mousemove",E),document.addEventListener("mouseup",B)}function E(l){if($e==="v"){const x=(l.clientY-Xe)/(se.value-Qe.value);n.clampScroll(null,st+x*n.maxScrollY.value),p()}else if($e==="h"){const x=(l.clientX-Xe)/(z.value-ke.value);n.clampScroll(st+x*n.maxScrollX.value,null),p()}}function B(){$e=null,document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",B)}function R(l){if($e)return;const d=l.currentTarget.getBoundingClientRect(),x=l.clientY-d.top;x<lt.value?n.clampScroll(null,e.scrollY.value-_()):x>lt.value+Qe.value&&n.clampScroll(null,e.scrollY.value+_()),p()}function K(l){if($e)return;const d=l.currentTarget.getBoundingClientRect(),x=l.clientX-d.left;x<De.value?n.clampScroll(e.scrollX.value-F(),null):x>De.value+ke.value&&n.clampScroll(e.scrollX.value+F(),null),p()}let X=!1,re=0,de=0,c=!1,b=!1,L=0,W=0,j=0,Q=0,Z=0,ue=0,Ee=0,Ve=0,Fe=!1,ze=!1,Ue=0,et=0,Ft=0,Kt=-1,Ut=-1;function Pt(l){if(l.button!==0)return;l.preventDefault(),ye.value=null;const d=pt(l,n.canvasRef.value);if(d.y<24&&d.x>=52){const g=d.x-52+e.scrollX.value,D=e.hitCol(g);if(D>=0&&Math.abs(d.x-(52+e.colPositions.value[D+1]-e.scrollX.value))<=4){v.saveUndo(),c=!0,L=D,j=e.colWidths.value[D],Q=g,p();return}}if(d.x<52&&d.y>=24){const g=d.y-24+e.scrollY.value,D=e.hitRow(g);if(D>=0&&Math.abs(d.y-(24+e.rowPositions.value[D+1]-e.scrollY.value))<=4){v.saveUndo(),b=!0,W=D,j=e.getRowHeight(D),Q=g,p();return}}if(d.x<52||d.y<24){if(e.commitEdit(),d.y<24&&d.x>=52){const g=e.hitCol(d.x-52+e.scrollX.value);g>=0&&(e.selectRange(g,0,g,e.rowCount-1),X=!0,re=g,de=0)}else if(d.x<52&&d.y>=24){const g=e.hitRow(d.y-24+e.scrollY.value);g>=0&&(e.selectRange(0,g,e.colCount-1,g),X=!0,re=0,de=g)}else d.x<52&&d.y<24&&e.selectAll();p();return}const x=e.hitCol(d.x-52+e.scrollX.value),M=e.hitRow(d.y-24+e.scrollY.value);if(!(x<0||M<0)){if(e.commitEdit(),l.shiftKey&&e.selection.value){const g=e.selection.value;e.selectRange(g.startCol,g.startRow,x,M)}else e.selectCell(x,M);X=!0,re=x,de=M,n.focusEditInput(),p()}}function Yt(l){if(c){const D=pt(l,n.canvasRef.value).x-52+e.scrollX.value-Q,q=j+D;q>=30&&q<=1e3?e.colWidths.value[L]=q:q<30?e.colWidths.value[L]=30:e.colWidths.value[L]=1e3,p();return}if(b){const D=pt(l,n.canvasRef.value).y-24+e.scrollY.value-Q,q=j+D;q>=24&&q<=500?e.rowHeights.value[W]=q:q<24?e.rowHeights.value[W]=24:e.rowHeights.value[W]=500,p();return}if(!X){const g=n.canvasRef.value;if(!g)return;if(v.paintFmt.value){g.style.cursor="copy";return}const D=pt(l,g);if(D.y<24&&D.x>=52){const q=e.hitCol(D.x-52+e.scrollX.value);if(q>=0&&Math.abs(D.x-(52+e.colPositions.value[q+1]-e.scrollX.value))<=4){g.style.cursor="col-resize";return}}if(D.x<52&&D.y>=24){const q=e.hitRow(D.y-24+e.scrollY.value);if(q>=0&&Math.abs(D.y-(24+e.rowPositions.value[q+1]-e.scrollY.value))<=4){g.style.cursor="row-resize";return}}g.style.cursor="cell";return}const d=pt(l,n.canvasRef.value);if(re<0||de<0)return;if(d.x<52||d.y<24){if(d.y<24&&d.x>=52){const g=e.hitCol(d.x-52+e.scrollX.value);g>=0&&e.selectRange(Math.min(re,g),0,Math.max(re,g),e.rowCount-1)}else if(d.x<52&&d.y>=24){const g=e.hitRow(d.y-24+e.scrollY.value);g>=0&&e.selectRange(0,Math.min(de,g),e.colCount-1,Math.max(de,g))}p();return}const x=e.hitCol(d.x-52+e.scrollX.value),M=e.hitRow(d.y-24+e.scrollY.value);x<0||M<0||(de===0&&re>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(re,x),0,Math.max(re,x),e.rowCount-1):re===0&&de>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(de,M),e.colCount-1,Math.max(de,M)):e.selectRange(re,de,x,M),p())}function ol(l){const d=c||b;X=!1,c=!1,b=!1,d&&n.scheduleOptEmit(),v.paintFmt.value&&v.applyPaintFormat()}function dt(){const l=c||b;X=!1,c=!1,b=!1,l&&n.scheduleOptEmit()}function wt(l){l.preventDefault();const d=pt(l,n.canvasRef.value);if(d.x<52&&d.y<24){f(l);return}if(d.y<24&&d.x>=52){const x=e.hitCol(d.x-52+e.scrollX.value);x>=0&&o(l,x);return}if(d.x<52&&d.y>=24){const x=e.hitRow(d.y-24+e.scrollY.value);x>=0&&w(l,x);return}if(d.x>=52&&d.y>=24){const x=e.hitCol(d.x-52+e.scrollX.value),M=e.hitRow(d.y-24+e.scrollY.value);x>=0&&M>=0&&a(l,x,M)}}function Nt(l){const d=pt(l,n.canvasRef.value);if(d.x<52||d.y<24)return;const x=e.hitCol(d.x-52+e.scrollX.value),M=e.hitRow(d.y-24+e.scrollY.value);x<0||M<0||(e.selectCell(x,M),e.ensureVisible(x,M),e.startEdit(),p(),n.focusEditInput())}function ml(l){n.clampScroll(e.scrollX.value+l.deltaX,e.scrollY.value+l.deltaY),p()}function Nn(l){if(l.touches.length!==1){Fe=!1;return}const d=l.touches[0],x=n.canvasRef.value;if(!x)return;const M=x.getBoundingClientRect(),g=d.clientX-M.left,D=d.clientY-M.top;g>=52&&D>=24&&(l.preventDefault(),Fe=!0,ze=!1,Z=g,ue=D,Ee=e.scrollX.value,Ve=e.scrollY.value,Ue=e.hitCol(g-52+e.scrollX.value),et=e.hitRow(D-24+e.scrollY.value))}function In(l){if(!Fe||l.touches.length!==1)return;const d=l.touches[0],x=n.canvasRef.value;if(!x)return;const M=x.getBoundingClientRect(),g=d.clientX-M.left,D=d.clientY-M.top;(Math.abs(g-Z)>8||Math.abs(D-ue)>8)&&(ze=!0,l.preventDefault(),n.clampScroll(Ee+(Z-g),Ve+(ue-D)),p())}function Ln(){if(Fe&&(Fe=!1,!ze&&Ue>=0&&et>=0)){const l=Date.now();Ue===Kt&&et===Ut&&l-Ft<300?(e.selectCell(Ue,et),e.startEdit(),p(),n.focusEditInput(),Ft=0):(e.commitEdit(),e.selectCell(Ue,et),p(),Ft=l),Kt=Ue,Ut=et,n.focusEditInput()}}function nl(l){return l.isComposing||l.key==="Process"||l.keyCode===229}function pl(l){return l.key.length===1&&!l.ctrlKey&&!l.metaKey&&!l.altKey}function gl(l){if(e.editingCell.value)return;const d=l.ctrlKey||l.metaKey,x=l.shiftKey;switch(!0){case(d&&(l.key==="c"||l.key==="C")):l.preventDefault(),C.copyToClipboard();return;case(d&&(l.key==="x"||l.key==="X")):l.preventDefault(),C.cutSelected();return;case(d&&(l.key==="z"||l.key==="Z")):l.preventDefault(),v.undo();return;case(d&&(l.key==="y"||l.key==="Y")):l.preventDefault(),v.redo();return;case(d&&(l.key==="v"||l.key==="V")):l.preventDefault(),v.saveUndo(),C.pasteFromClipboard().then(()=>{p(),t.nextTick(()=>n.emitModelData())});return;case(d&&(l.key==="a"||l.key==="A")):l.preventDefault(),e.selectAll(),p();return;case(d&&l.key==="Home"):l.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),p();return;case(d&&l.key==="End"):l.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),p();return;case l.key==="Home":l.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),p();return;case l.key==="End":l.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),p();return;case l.key==="ArrowUp":l.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p();return;case l.key==="ArrowDown":l.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p();return;case l.key==="ArrowLeft":l.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p();return;case l.key==="ArrowRight":l.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p();return;case l.key==="Tab":l.preventDefault(),e.moveActive(x?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p();return;case l.key==="Enter":l.preventDefault(),e.moveActive(0,x?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p();return;case l.key==="F2":l.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),p(),n.focusEditInput();return;case l.key==="Delete":case l.key==="Backspace":l.preventDefault(),v.saveUndo(),C.clearSelected(),p();return;case l.key==="Escape":l.preventDefault(),e.cancelEdit(),v.paintFmt.value=null,p();return;case pl(l):if(nl(l)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),p(),n.focusEditInput();return}l.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(l.key),p(),t.nextTick(()=>{const M=n.editInputRef.value;M&&(M.focus(),M.setSelectionRange(1,1))});return}}let rl=!1,al=!1;function On(l){const d=l.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(d),p();return}e.editValue.value=d}function Vn(){rl=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),p())}function Wn(l){rl=!1,al=!0,setTimeout(()=>{al=!1},0),e.editValue.value=l.target.value}function zn(l){if(!e.editingCell.value){if(pl(l)||nl(l))return;gl(l);return}if(!(rl||nl(l))&&!(al&&(l.key==="Enter"||l.key==="Escape")))if(l.key==="Enter"&&(l.altKey||l.metaKey)){l.preventDefault();const d=n.editInputRef.value;if(!d)return;const x=d.selectionStart??d.value.length,M=d.selectionEnd??d.value.length,g=d.value,D=g.slice(0,x)+`
9
+ `+g.slice(M);e.editValue.value=D,d.value=D,d.selectionStart=d.selectionEnd=x+1,p()}else l.key==="Enter"?(l.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p(),n.focusEditInput()):l.key==="Tab"?(l.preventDefault(),e.commitEdit(),e.moveActive(l.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),p(),n.focusEditInput()):l.key==="Escape"&&(l.preventDefault(),e.cancelEdit(),p(),n.focusEditInput())}function $n(l){e.editingCell.value}function _n(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),p())},0)}let je=null;function It(){var d;const l=(d=n.wrapperRef.value)==null?void 0:d.getBoundingClientRect();if(l){const x=mt(e.props.width),M=mt(e.props.height);x!=null?n.viewSize.w=x:n.viewSize.w=l.width,M!=null?n.viewSize.h=M:n.viewSize.h=l.height}n.clampScroll(null,null),p()}function Gn(){t.onMounted(()=>{const l=mt(e.props.width),d=mt(e.props.height);(l==null||d==null)&&(je=new ResizeObserver(()=>It()),n.wrapperRef.value&&je.observe(n.wrapperRef.value)),t.nextTick(()=>{It(),n.focusEditInput()}),e.selectCell(0,0),n.modelData.value&&n.modelData.value.length>0&&(u.value=JSON.stringify(n.modelData.value),n.sheets.value=n.modelData.value.map(x=>{const M=n.mkSheet(x.name);for(const[g,D]of Object.entries(x.cells))M.cells[g]={value:D.value,style:D.style??null};if(x.colWidths)for(const[g,D]of Object.entries(x.colWidths)){const q=Number(g);q>=0&&q<e.colCount&&D>=30&&(M.colWidths[q]=D)}if(x.rowHeights)for(const[g,D]of Object.entries(x.rowHeights)){const q=Number(g);q>=0&&q<e.rowCount&&D>=24&&(M.rowHeights[q]=D)}if(x.merges)for(const[g,D]of Object.entries(x.merges))M.merges[g]={...D};return M}),n.sheets.value.length>0&&n.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const l=mt(e.props.width),d=mt(e.props.height);l!=null&&d!=null?(je==null||je.disconnect(),je=null):!je&&n.wrapperRef.value&&(je=new ResizeObserver(()=>It()),je.observe(n.wrapperRef.value)),t.nextTick(()=>It())}),t.watch(()=>e.props.theme,()=>p()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>n.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>n.emitModelData()),p()},{deep:!1}),t.watch(n.activeSheetIndex,()=>t.nextTick(()=>n.emitModelData())),t.watch(()=>n.modelData.value,l=>{if(!l||l.length===0)return;const d=JSON.stringify(l);if(d===u.value)return;u.value=d;const x=e.selection.value?{...e.selection.value}:null,M={...e.activeCell.value};n.sheets.value=l.map(g=>{const D=n.mkSheet(g.name);for(const[q,oe]of Object.entries(g.cells))D.cells[q]={value:oe.value,style:oe.style??null};if(g.colWidths)for(const[q,oe]of Object.entries(g.colWidths)){const ie=Number(q);ie>=0&&ie<e.colCount&&oe>=30&&(D.colWidths[ie]=oe)}if(g.rowHeights)for(const[q,oe]of Object.entries(g.rowHeights)){const ie=Number(q);ie>=0&&ie<e.rowCount&&oe>=24&&(D.rowHeights[ie]=oe)}if(g.merges)for(const[q,oe]of Object.entries(g.merges))D.merges[q]={...oe};return D}),n.sheets.value.length>0&&n.loadSheet(0),x&&(e.selection.value=x),e.activeCell.value=M,p()},{deep:!0}),t.onBeforeUnmount(()=>{je==null||je.disconnect()})}return{scheduleRender:p,render:Y,activeCellLabel:y,formulaBarDisplay:ne,onFormulaBarFocus:A,onFormulaBarInput:m,onFormulaBarKeydown:ge,onFormulaBarBlur:me,renTab:we,renTabVal:G,onTabClick:U,onTabDblClick:pe,commitTabRename:T,cclTabRename:P,onTabRenameKd:be,ctxMenu:ye,ctxSubmenuLeft:He,onCtxItemEnter:Se,onTabCtxMenu:ce,onTabBarCtx:r,onCornerCtx:f,onRowHdrCtx:w,onColHdrCtx:o,onCellCtx:a,dimInputRef:O,dimPanel:H,openDimPanel:ve,onDimInput:xe,onDimKeydown:Ae,onDimBlur:Le,applyDimPanel:he,closeDimPanel:We,editInputStyle:S,hScrollbarW:le,vScrollbarH:fe,hTrackW:z,vTrackH:se,hThumbW:ke,hThumbL:De,vThumbH:Qe,vThumbT:lt,onVStart:At,onHStart:Ke,onSbMove:E,onSbUp:B,onVTrk:R,onHTrk:K,onMouseDown:Pt,onMouseMove:Yt,onMouseUp:ol,onMouseLeave:dt,onCanvasCtx:wt,onDblClick:Nt,onWheel:ml,onTouchStart:Nn,onTouchMove:In,onTouchEnd:Ln,onKeydown:gl,onEditInput:On,onEditCompositionStart:Vn,onEditCompositionEnd:Wn,onEditKd:zn,onEditPaste:$n,onEditBlur:_n,applySize:It,setupLifecycle:Gn}}const yn={class:"formula-bar"},wn={class:"formula-bar__cell-label"},kn=["value"],En=["value"],Bn={key:2,class:"sb-corner"},Rn=["onClick","onMouseenter"],xn={class:"context-menu__label"},Sn={key:0,class:"context-menu__arrow"},Mn=["onClick"],Tn={class:"dim-panel__title"},Dn={class:"dim-panel__body"},Hn=["value"],An={key:0,class:"dim-panel__error"},Fn={class:"dim-panel__footer"},fl=ft(t.defineComponent({__name:"spreadsheet",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const v=e,C=t.useModel(e,"data"),n={value:""},u=mn(v,{rowCount:v.rowCount,colCount:v.colCount,theme:v.theme,locale:v.locale}),k={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:te=>{},mkSheet:te=>({id:"",name:te,cells:{},merges:{},selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[]})},i=pn(u,k),I=hn(u,i);gn(i,{borderMenuOpen:I.borderMenuOpen,mergeMenuOpen:I.mergeMenuOpen});const p=Cn(u,i,C);k.sheets=p.sheets,k.activeSheetIndex=p.activeSheetIndex,k.saveSheet=p.saveSheet,k.loadSheet=p.loadSheet,k.mkSheet=p.mkSheet;const ee=bn(u,i,I,p,n);ee.setupLifecycle();const Y=t.reactive(u),y=t.reactive(i),ne=t.reactive(I),A=t.reactive(p),m=t.reactive(ee);function ge(te){i.fontSizeMenuOpen.value=te}function me(te){i.textColorMenuOpen.value=te}function we(te){i.fillColorMenuOpen.value=te}function G(te){ee.renTabVal.value=te}function U(){ee.ctxMenu.value=null}const pe=te=>{p.formulaBarRef.value=te},T=te=>{p.wrapperRef.value=te},P=te=>{p.canvasRef.value=te},be=te=>{p.editInputRef.value=te},ye=te=>{ee.dimInputRef.value=te};return(te,s)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(A.outerStyle)},[t.createVNode(Qo,{locale:Y.locale,"can-undo":y.canUndo,"can-redo":y.canRedo,"paint-fmt-active":y.paintFmt!==null,"has-selection":y.hasSelection,"font-family-options":y.fontFamilyOptions,"font-size-options":y.fontSizeOptions,"sel-font-family":y.selFontFamily,"sel-font-size":y.selFontSize,"font-size-input":y.fontSizeInput,"font-size-menu-open":y.fontSizeMenuOpen,"sel-font-weight":y.selFontWeight,"sel-font-style":y.selFontStyle,"sel-underline":y.selUnderline,"sel-strikethrough":y.selStrikethrough,"sel-text-color":y.selTextColor,"text-color-menu-open":y.textColorMenuOpen,"sel-fill-color":y.selFillColor,"fill-color-menu-open":y.fillColorMenuOpen,"cached-text-color":y.cachedTextColor,"cached-fill-color":y.cachedFillColor,"border-menu-open":ne.borderMenuOpen,"cached-border":ne.cachedBorder,"h-align-options":y.hAlignOptions,"v-align-options":y.vAlignOptions,"sel-h-align":y.selHAlign,"sel-v-align":y.selVAlign,"sel-wrap":y.selWrap,"merge-menu-open":ne.mergeMenuOpen,"theme-vars":A.toolbarThemeVars,onUndo:s[0]||(s[0]=h=>y.undo()),onRedo:s[1]||(s[1]=h=>y.redo()),onPaintFormat:y.onPaintFormat,onClearFormat:s[2]||(s[2]=h=>y.clearFormat()),onFontFamilyChange:s[3]||(s[3]=h=>y.onFontFamilyChange(h)),onFontSizeInput:s[4]||(s[4]=h=>y.onFontSizeInput(h)),onFontSizeBlur:y.onFontSizeBlur,onFontSizeKeydown:s[5]||(s[5]=h=>y.onFontSizeKeydown(h)),onFontSizeChange:s[6]||(s[6]=h=>y.onFontSizeChange(h)),"onUpdate:fontSizeMenuOpen":s[7]||(s[7]=h=>ge(h)),onFontSizeToggle:s[8]||(s[8]=h=>y.toggleFontSizeMenu()),onFontSizeStepUp:y.onFontSizeStepUp,onFontSizeStepDown:y.onFontSizeStepDown,onBoldToggle:y.toggleFontWeight,onItalicToggle:y.toggleFontStyle,onUnderlineToggle:y.toggleUnderline,onStrikethroughToggle:y.toggleStrikethrough,onTextColorChange:s[9]||(s[9]=h=>y.onTextColorChange(h)),"onUpdate:textColorMenuOpen":s[10]||(s[10]=h=>me(h)),onFillColorChange:s[11]||(s[11]=h=>y.onFillColorChange(h)),"onUpdate:fillColorMenuOpen":s[12]||(s[12]=h=>we(h)),onApplyTextColor:y.applyCachedTextColor,onApplyFillColor:y.applyCachedFillColor,"onUpdate:borderMenuOpen":s[13]||(s[13]=h=>y.onBorderMenuToggle(h)),onBorderChange:s[14]||(s[14]=h=>ne.onBorderChange(h)),onApplyBorder:ne.applyCachedBorder,onHAlignChange:s[15]||(s[15]=h=>y.onHAlignChange(h)),onVAlignChange:s[16]||(s[16]=h=>y.onVAlignChange(h)),onWrapToggle:y.onWrapToggle,"onUpdate:mergeMenuOpen":s[17]||(s[17]=h=>ne.onMergeMenuToggle(h)),onMergeChange:s[18]||(s[18]=h=>ne.onMergeChange(h)),onApplyMerge:ne.onApplyMerge},null,8,["locale","can-undo","can-redo","paint-fmt-active","has-selection","font-family-options","font-size-options","sel-font-family","sel-font-size","font-size-input","font-size-menu-open","sel-font-weight","sel-font-style","sel-underline","sel-strikethrough","sel-text-color","text-color-menu-open","sel-fill-color","fill-color-menu-open","cached-text-color","cached-fill-color","border-menu-open","cached-border","h-align-options","v-align-options","sel-h-align","sel-v-align","sel-wrap","merge-menu-open","theme-vars","onPaintFormat","onFontSizeBlur","onFontSizeStepUp","onFontSizeStepDown","onBoldToggle","onItalicToggle","onUnderlineToggle","onStrikethroughToggle","onApplyTextColor","onApplyFillColor","onApplyBorder","onWrapToggle","onApplyMerge"]),t.createElementVNode("div",yn,[t.createElementVNode("div",wn,t.toDisplayString(m.activeCellLabel),1),t.createElementVNode("input",{ref:pe,class:"formula-bar__input",value:m.formulaBarDisplay,onFocus:s[19]||(s[19]=(...h)=>m.onFormulaBarFocus&&m.onFormulaBarFocus(...h)),onInput:s[20]||(s[20]=(...h)=>m.onFormulaBarInput&&m.onFormulaBarInput(...h)),onKeydown:s[21]||(s[21]=(...h)=>m.onFormulaBarKeydown&&m.onFormulaBarKeydown(...h)),onBlur:s[22]||(s[22]=(...h)=>m.onFormulaBarBlur&&m.onFormulaBarBlur(...h))},null,40,kn)]),t.createElementVNode("div",{ref:T,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:P,class:"grid-canvas",tabindex:"0",onMousedown:s[23]||(s[23]=(...h)=>m.onMouseDown&&m.onMouseDown(...h)),onMousemove:s[24]||(s[24]=(...h)=>m.onMouseMove&&m.onMouseMove(...h)),onMouseup:s[25]||(s[25]=(...h)=>m.onMouseUp&&m.onMouseUp(...h)),onMouseleave:s[26]||(s[26]=(...h)=>m.onMouseLeave&&m.onMouseLeave(...h)),onDblclick:s[27]||(s[27]=(...h)=>m.onDblClick&&m.onDblClick(...h)),onWheel:s[28]||(s[28]=t.withModifiers((...h)=>m.onWheel&&m.onWheel(...h),["prevent"])),onFocus:s[29]||(s[29]=(...h)=>A.onCanvasFocus&&A.onCanvasFocus(...h)),onKeydown:s[30]||(s[30]=(...h)=>m.onKeydown&&m.onKeydown(...h)),onContextmenu:s[31]||(s[31]=(...h)=>m.onCanvasCtx&&m.onCanvasCtx(...h)),onTouchstart:s[32]||(s[32]=t.withModifiers((...h)=>m.onTouchStart&&m.onTouchStart(...h),["prevent"])),onTouchmove:s[33]||(s[33]=t.withModifiers((...h)=>m.onTouchMove&&m.onTouchMove(...h),["prevent"])),onTouchend:s[34]||(s[34]=(...h)=>m.onTouchEnd&&m.onTouchEnd(...h))},null,32),t.createElementVNode("textarea",{ref:be,class:"cell-editor",value:Y.editValue,style:t.normalizeStyle(m.editInputStyle),onInput:s[35]||(s[35]=(...h)=>m.onEditInput&&m.onEditInput(...h)),onKeydown:s[36]||(s[36]=(...h)=>m.onEditKd&&m.onEditKd(...h)),onCompositionstart:s[37]||(s[37]=(...h)=>m.onEditCompositionStart&&m.onEditCompositionStart(...h)),onCompositionend:s[38]||(s[38]=(...h)=>m.onEditCompositionEnd&&m.onEditCompositionEnd(...h)),onBlur:s[39]||(s[39]=(...h)=>m.onEditBlur&&m.onEditBlur(...h)),onPaste:s[40]||(s[40]=(...h)=>m.onEditPaste&&m.onEditPaste(...h))},null,44,En),A.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:t.unref(24)+"px",height:`calc(100% - ${t.unref(24)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:s[41]||(s[41]=t.withModifiers(h=>{A.clampScroll(null,Y.scrollY-50),m.scheduleRender()},["prevent"]))},[...s[64]||(s[64]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:s[43]||(s[43]=(...h)=>m.onVTrk&&m.onVTrk(...h))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:m.vThumbT+"px",height:m.vThumbH+"px"}),onMousedown:s[42]||(s[42]=(...h)=>m.onVStart&&m.onVStart(...h))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:s[44]||(s[44]=t.withModifiers(h=>{A.clampScroll(null,Y.scrollY+50),m.scheduleRender()},["prevent"]))},[...s[65]||(s[65]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),A.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:t.unref(52)+"px",width:`calc(100% - ${t.unref(52)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:s[45]||(s[45]=t.withModifiers(h=>{A.clampScroll(Y.scrollX-50,null),m.scheduleRender()},["prevent"]))},[...s[66]||(s[66]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:s[47]||(s[47]=(...h)=>m.onHTrk&&m.onHTrk(...h))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:m.hThumbL+"px",width:m.hThumbW+"px"}),onMousedown:s[46]||(s[46]=(...h)=>m.onHStart&&m.onHStart(...h))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:s[48]||(s[48]=t.withModifiers(h=>{A.clampScroll(Y.scrollX+50,null),m.scheduleRender()},["prevent"]))},[...s[67]||(s[67]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),A.maxScrollX>0&&A.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",Bn)):t.createCommentVNode("",!0)]),t.createVNode(rn,{locale:Y.locale,sheets:A.sheets,"active-sheet-index":A.activeSheetIndex,"ren-tab":m.renTab,"ren-tab-val":m.renTabVal,onTabClick:s[49]||(s[49]=h=>m.onTabClick(h)),onTabDblclick:s[50]||(s[50]=h=>m.onTabDblClick(h)),onTabContextmenu:s[51]||(s[51]=h=>m.onTabCtxMenu(h.ev,h.i)),onTabRenameInput:s[52]||(s[52]=h=>G(h)),onTabRenameKeydown:s[53]||(s[53]=h=>m.onTabRenameKd(h)),onTabRenameCommit:m.commitTabRename,onTabbarContextmenu:s[54]||(s[54]=h=>m.onTabBarCtx(h)),onAddSheet:s[55]||(s[55]=h=>{A.addSheet(),m.scheduleRender()})},null,8,["locale","sheets","active-sheet-index","ren-tab","ren-tab-val","onTabRenameCommit"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[m.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:m.ctxMenu.x+"px",top:m.ctxMenu.y+"px"}),onClick:s[56]||(s[56]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.ctxMenu.items,(h,He)=>(t.openBlock(),t.createElementBlock("div",{key:He,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":h.disabled}]),onClick:Se=>!h.disabled&&h.action&&(h.action(),U()),onMouseenter:Se=>m.onCtxItemEnter(Se,h)},[t.createElementVNode("span",xn,t.toDisplayString(h.label),1),h.children?(t.openBlock(),t.createElementBlock("span",Sn)):t.createCommentVNode("",!0),h.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":m.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.children,(Se,ce)=>(t.openBlock(),t.createElementBlock("div",{key:ce,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":Se.disabled}]),onClick:t.withModifiers(r=>!Se.disabled&&Se.action&&(Se.action(),U()),["stop"])},t.toDisplayString(Se.label),11,Mn))),128))],2)):t.createCommentVNode("",!0)],42,Rn))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[m.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:m.dimPanel.x+"px",top:m.dimPanel.y+"px"}),onMousedown:s[62]||(s[62]=t.withModifiers(()=>{},["stop"])),onClick:s[63]||(s[63]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Tn,t.toDisplayString(m.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",Dn,[t.createElementVNode("input",{ref:ye,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":m.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:m.dimPanel.value,onInput:s[57]||(s[57]=(...h)=>m.onDimInput&&m.onDimInput(...h)),onKeydown:s[58]||(s[58]=(...h)=>m.onDimKeydown&&m.onDimKeydown(...h)),onBlur:s[59]||(s[59]=(...h)=>m.onDimBlur&&m.onDimBlur(...h))},null,42,Hn),s[68]||(s[68]=t.createElementVNode("span",{class:"dim-panel__unit"},"px",-1))]),m.dimPanel.error?(t.openBlock(),t.createElementBlock("div",An,t.toDisplayString(m.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Fn,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:s[60]||(s[60]=(...h)=>m.applyDimPanel&&m.applyDimPanel(...h))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:s[61]||(s[61]=(...h)=>m.closeDimPanel&&m.closeDimPanel(...h))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-a5861b41"]]);ct.Spreader=fl,ct.default=fl,Object.defineProperties(ct,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});