@kition/kit-sheet-ui 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kition/kit-sheet-ui",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "The editor of Kition's Sheet kit (kit.sheet 0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "The editor of Kition's Sheet kit (kit.sheet 0.1.4), which kition installs and kition gateway serves. Not for installing by hand: kition installs it.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"kit": "sheet",
|
|
15
15
|
"id": "kit.sheet",
|
|
16
16
|
"name": "Sheet",
|
|
17
|
-
"version": "0.1.
|
|
17
|
+
"version": "0.1.4",
|
|
18
18
|
"role": "ui",
|
|
19
19
|
"protocol": "kition-kit/1",
|
|
20
20
|
"extensions": [
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"csv"
|
|
34
34
|
],
|
|
35
35
|
"build": {
|
|
36
|
-
"commit": "
|
|
37
|
-
"sdkCommit": "
|
|
36
|
+
"commit": "180a19750183f8b28883fecb0dbb945558ea0521",
|
|
37
|
+
"sdkCommit": "5717f5cbbae88b285b8c3f2a505eba22b5de9266",
|
|
38
38
|
"tesseraCommit": "bbda88c619d48b09985f52e96f5a11aaba4f8fcd",
|
|
39
39
|
"fontsCommit": "66949b770d1132d26284417368e154e8e5ae1acf"
|
|
40
40
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Third-Party Notices: the Sheet kit package 0.1.
|
|
1
|
+
Third-Party Notices: the Sheet kit package 0.1.4
|
|
2
2
|
|
|
3
3
|
This package includes code from the npm packages and Rust crates below, each under its own
|
|
4
4
|
license. The editor (index.html and assets/) bundles the npm packages; the engine (engine/)
|
|
@@ -95,4 +95,4 @@ ${C.label}`;for(const C of m.querySelectorAll(".kui-ribbon-tab")){const E=n.find
|
|
|
95
95
|
`:o==="t"?" ":o);function HL(n){const i=new Map;for(const o of n.split(`
|
|
96
96
|
`)){if(!o.trim()||o.startsWith("#"))continue;const[,r,u]=o.split(" ");r&&u&&i.set(Oc(r),Oc(u.replace(/\r$/,"")))}return i}function BL(n){const i=new Map;for(const o of n.matchAll(/"((?:[^"\\]|\\.)*)"\s*=>\s*"((?:[^"\\]|\\.)*)"/g))i.set(Oc(o[1]),Oc(o[2]));return i}function Bx(n){const i=n.toLowerCase(),[o,r]=i.split("-"),u=[i];return o==="zh"&&u.push(["tw","hk","mo","hant"].includes(r??"")?"zh-hant":"zh-hans"),o==="sr"&&i.includes("latn")&&u.push("sr-latn"),u.push(o),u}async function _L(n,i){const o=new Map(Object.entries(n).map(([p,y])=>[p.split("/").pop().replace(/\.(tsv|rs)$/,"").toLowerCase(),{path:p,load:y}])),r=Bx(i).find(p=>o.has(p));if(!r||i.toLowerCase().startsWith("en"))return p=>p;const{path:u,load:f}=o.get(r),h=String(await f()),v=u.endsWith(".rs")?BL(h):HL(h);return p=>v.get(p)??p}function FL(n,i,o){var f;const r=Bx(o).concat(o).find(h=>Object.keys(i).some(v=>v.toLowerCase()===h)),u=r?(f=Object.entries(i).find(([h])=>h.toLowerCase()===r))==null?void 0:f[1]:void 0;return!u||o.toLowerCase().startsWith("en")?n:h=>u[h]??n(h)}function UL(){return{kitId:"kit.sheet",base:new URL("./engine/",document.baseURI).href,module:"kition_sheet_kit",documentClass:"SheetDocument",fonts:["DroidSansFallbackFull.ttf","Carlito-Regular.ttf","Carlito-Bold.ttf","Carlito-Italic.ttf","Carlito-BoldItalic.ttf","Caladea-Regular.ttf","Caladea-Bold.ttf","Caladea-Italic.ttf","Caladea-BoldItalic.ttf","Arimo-Variable.ttf","Arimo-Italic-Variable.ttf","Tinos-Regular.ttf","Tinos-Bold.ttf","Tinos-Italic.ttf","Cousine-Regular.ttf","MaShanZheng-Regular.ttf"].map(n=>new URL(`./fonts/${n}`,document.baseURI).href)}}const IL={"fn:SUM":"返回所有参数之和。","fn:SUMIF":"对满足条件的单元格求和。","fn:SUMIFS":"对同时满足多个条件的单元格求和。","fn:SUMPRODUCT":"返回各数组对应元素乘积之和。","fn:AVERAGE":"返回参数的算术平均值。","fn:AVERAGEIF":"返回满足条件的单元格的平均值。","fn:AVERAGEIFS":"返回同时满足多个条件的单元格的平均值。","fn:COUNT":"计算区域中包含数字的单元格个数。","fn:COUNTA":"计算区域中非空单元格的个数。","fn:COUNTBLANK":"计算区域中空单元格的个数。","fn:COUNTIF":"计算区域中满足条件的单元格个数。","fn:COUNTIFS":"计算同时满足多个条件的单元格个数。","fn:MAX":"返回一组数值中的最大值。","fn:MIN":"返回一组数值中的最小值。","fn:MAXIFS":"返回满足条件的单元格中的最大值。","fn:MINIFS":"返回满足条件的单元格中的最小值。","fn:MEDIAN":"返回一组数的中位数。","fn:MODE":"返回一组数据中出现次数最多的值。","fn:LARGE":"返回数据集中第 k 个最大值。","fn:SMALL":"返回数据集中第 k 个最小值。","fn:RANK":"返回某数字在一列数字中的排位。","fn:STDEV":"估算基于样本的标准偏差。","fn:VAR":"估算基于样本的方差。","fn:IF":"判断条件是否成立,成立返回一个值,否则返回另一个值。","fn:IFS":"返回第一个成立的条件对应的值。","fn:IFERROR":"表达式出错时返回指定的值,否则返回表达式的值。","fn:IFNA":"表达式为 #N/A 时返回指定的值。","fn:AND":"所有参数都为 TRUE 时返回 TRUE。","fn:OR":"任一参数为 TRUE 时返回 TRUE。","fn:NOT":"对逻辑值求反。","fn:XOR":"返回所有参数的逻辑异或。","fn:TRUE":"返回逻辑值 TRUE。","fn:FALSE":"返回逻辑值 FALSE。","fn:SWITCH":"将表达式与一组值比较,返回第一个匹配项对应的结果。","fn:VLOOKUP":"在区域首列查找值,并返回同一行中指定列的值。","fn:HLOOKUP":"在区域首行查找值,并返回同一列中指定行的值。","fn:XLOOKUP":"在区域或数组中查找,并返回对应项。","fn:LOOKUP":"在单行或单列中查找值。","fn:INDEX":"返回区域中指定行列交叉处的值或引用。","fn:MATCH":"返回查找值在区域中的相对位置。","fn:XMATCH":"返回某项在数组或区域中的相对位置。","fn:CHOOSE":"根据序号从参数列表中选择一个值。","fn:OFFSET":"以某引用为基准,返回偏移指定行列后的引用。","fn:INDIRECT":"返回由文本字符串指定的引用。","fn:ROW":"返回引用的行号。","fn:COLUMN":"返回引用的列号。","fn:ROWS":"返回引用或数组的行数。","fn:COLUMNS":"返回引用或数组的列数。","fn:FILTER":"按条件筛选区域或数组。","fn:SORT":"对区域或数组排序。","fn:UNIQUE":"返回区域或数组中的唯一值。","fn:SEQUENCE":"生成一个连续数字的数组。","fn:TRANSPOSE":"转置区域或数组的行和列。","fn:ROUND":"按指定位数四舍五入。","fn:ROUNDUP":"向远离零的方向舍入。","fn:ROUNDDOWN":"向零的方向舍入。","fn:INT":"向下取整为最接近的整数。","fn:TRUNC":"截去数字的小数部分。","fn:MOD":"返回两数相除的余数。","fn:ABS":"返回数字的绝对值。","fn:POWER":"返回数字的乘幂。","fn:SQRT":"返回正平方根。","fn:PRODUCT":"返回所有参数的乘积。","fn:RAND":"返回 0 到 1 之间的随机数。","fn:RANDBETWEEN":"返回两个指定数之间的随机整数。","fn:PI":"返回圆周率 π。","fn:CEILING":"向上舍入为最接近的指定基数的倍数。","fn:FLOOR":"向下舍入为最接近的指定基数的倍数。","fn:SUBTOTAL":"返回列表或数据库中的分类汇总。","fn:AGGREGATE":"返回列表或数据库中的聚合值,可忽略隐藏行和错误值。","fn:LEFT":"从文本左边返回指定个数的字符。","fn:RIGHT":"从文本右边返回指定个数的字符。","fn:MID":"从文本指定位置起返回指定个数的字符。","fn:LEN":"返回文本中的字符个数。","fn:LENB":"返回文本中的字节数。","fn:FIND":"返回一个文本在另一个文本中的起始位置(区分大小写)。","fn:SEARCH":"返回一个文本在另一个文本中的起始位置(不区分大小写)。","fn:REPLACE":"替换文本中指定位置的字符。","fn:SUBSTITUTE":"用新文本替换文本中的旧文本。","fn:CONCATENATE":"将多个文本合并为一个。","fn:CONCAT":"将多个区域或文本合并为一个。","fn:TEXTJOIN":"用分隔符合并多个区域或文本。","fn:TEXT":"将数值按指定格式转换为文本。","fn:VALUE":"将表示数字的文本转换为数字。","fn:TRIM":"删除文本中多余的空格。","fn:UPPER":"将文本转换为大写。","fn:LOWER":"将文本转换为小写。","fn:PROPER":"将每个单词的首字母转换为大写。","fn:REPT":"按指定次数重复文本。","fn:EXACT":"比较两个文本是否完全相同。","fn:CHAR":"返回代码对应的字符。","fn:CODE":"返回文本第一个字符的代码。","fn:TODAY":"返回当前日期。","fn:NOW":"返回当前日期和时间。","fn:DATE":"返回指定年、月、日的日期。","fn:YEAR":"返回日期的年份。","fn:MONTH":"返回日期的月份。","fn:DAY":"返回日期是当月的第几天。","fn:HOUR":"返回时间的小时数。","fn:MINUTE":"返回时间的分钟数。","fn:SECOND":"返回时间的秒数。","fn:TIME":"返回指定时、分、秒的时间。","fn:WEEKDAY":"返回日期是星期几。","fn:WEEKNUM":"返回日期是一年中的第几周。","fn:DATEDIF":"计算两个日期之间的天数、月数或年数。","fn:DATEVALUE":"将文本形式的日期转换为序列号。","fn:EDATE":"返回指定月数之前或之后的日期。","fn:EOMONTH":"返回指定月数之前或之后的月末日期。","fn:NETWORKDAYS":"返回两个日期之间的工作日天数。","fn:WORKDAY":"返回指定工作日天数之前或之后的日期。","fn:DAYS":"返回两个日期之间的天数。","fn:ISBLANK":"值为空时返回 TRUE。","fn:ISERROR":"值为任意错误值时返回 TRUE。","fn:ISNUMBER":"值为数字时返回 TRUE。","fn:ISTEXT":"值为文本时返回 TRUE。","fn:ISNA":"值为 #N/A 时返回 TRUE。","fn:PMT":"返回贷款的每期付款额。","fn:PV":"返回投资的现值。","fn:FV":"返回投资的未来值。","fn:NPV":"返回一系列现金流的净现值。","fn:IRR":"返回一系列现金流的内部收益率。","fn:RATE":"返回年金的每期利率。","fn:NPER":"返回投资的期数。","fn:LET":"为计算结果命名,以便在公式中重复使用。","fn:LAMBDA":"创建可重复使用的自定义函数。"},VL={nameBox:"Name Box",formula:"Formula",enterFormula:"Enter",insertFunction:"Insert Function",expandFormulaBar:"Expand Formula Bar",collapseFormulaBar:"Collapse Formula Bar",showGroup:"Show",showGridlines:"Gridlines",showFormulaBar:"Formula Bar",showHeadings:"Headings",freezePanes:"Freeze Panes",unfreezePanes:"Unfreeze Panes",freezeAt:"Freeze to Row {row} and Column {col}",freezeRowsAt:"Freeze to Row {row}",freezeColsAt:"Freeze to Column {col}",freezeTopRow:"Freeze Top Row",freezeFirstColumn:"Freeze First Column",focusCell:"Highlight Rows and Columns",focusCellColors:"Highlight colour",focusCellColor:"Highlight colour {index}",gridlineColor:"Gridline Colour",gridlineAuto:"Automatic",functionSearch:"Search for a function:",functionCategory:"Or select a category:",functionPick:"Select a function:",functionNone:"No function matches","fnCategory:common":"Most Used","fnCategory:all":"All","fnCategory:Financial":"Financial","fnCategory:Logical":"Logical","fnCategory:Text":"Text","fnCategory:DateTime":"Date & Time","fnCategory:Lookup":"Lookup & Reference","fnCategory:MathTrig":"Math & Trig","fnCategory:Statistical":"Statistical","fnCategory:Engineering":"Engineering","fnCategory:Information":"Information","fnCategory:Database":"Database","fnCategory:Compatibility":"Compatibility","fnCategory:Web":"Web","fnCategory:Cube":"Cube",insertAbove:"Insert",insertAboveAfter:"rows above",insertBelow:"Insert",insertBelowAfter:"rows below",insertLeft:"Insert",insertLeftAfter:"columns left",insertRight:"Insert",insertRightAfter:"columns right",insertCellsRight:"Insert Cells, Shift Right",insertCellsDown:"Insert Cells, Shift Down",insertSheetItem:"Insert Sheet",deleteCellsLeft:"Delete Cells, Shift Left",deleteCellsUp:"Delete Cells, Shift Up",deleteRowsItem:"Delete Rows",deleteColsItem:"Delete Columns",deleteSheetItem:"Delete Sheet",gridMenu:"Cell Menu",menuCut:"Cut",menuCopy:"Copy",menuPaste:"Paste",deleteMenu:"Delete",insertMenu:"Insert",clearContents:"Clear Contents",formatCellsItem:"Format Cells…",hideLines:"Hide",unhideLines:"Unhide",rowHeightItem:"Row Height…",columnWidthItem:"Column Width…",addSheet:"New Sheet",renameSheet:"Rename",deleteSheet:"Delete",sheetList:"Sheet List",sheetMenu:"Sheet Menu",sheetLocked:"Protected sheet",sheetHidden:"Hidden",sheetScrollLeft:"Scroll Tabs Left",sheetScrollRight:"Scroll Tabs Right",moveSheet:"Move Sheet",moveSheetLeft:"Move Left",moveSheetRight:"Move Right",copySheet:"Create a Copy",tabColor:"Tab Color",noTabColor:"No Fill",hideSheet:"Hide Sheet",unhideSheet:"Unhide Sheet",hideNeedsTwo:"At least two sheets must show for one to be hidden",insertSheetBefore:"Before This Sheet",insertSheetAfter:"After This Sheet",deleteSheetTitle:"Delete Sheet",deleteSheetConfirm:"Delete “{sheet}”?",deleteSheetOk:"Delete",cancel:"Cancel",ok:"OK",unhideSheetTitle:"Unhide",unhideSheetPrompt:"Unhide sheet:",sheetNameEmpty:"A sheet name can’t be blank!",sheetNameInvalid:"A sheet name can’t contain any of these characters: \\ / : ? * [ ]",sheetNameTaken:"That sheet name already exists!",sheetNameApostrophe:"A sheet name can’t begin or end with an apostrophe",sheetNameReserved:"“History” is a reserved name",statSum:"Sum={value}",statAverage:"Average={value}",statCount:"Count={value}",sheetSelection:"{sheet} · {selection}",sheetOf:"Sheet {index} of {count}",exported:"Exported",exportFailed:"Export failed",templateTitle:"Save as Template",templateName:"Template name",templateNameRequired:"Enter a name for the template",templateSaved:"Template saved",templateFailed:"The template was not saved",commentFailed:"Comment failed",commentThread:"Comment thread ({count})",formatPainter:"Format Painter",formatPainterTip:"Format Painter: click to paint once, double-click to keep painting (Esc stops)",fontBox:"Font",fontSearch:"Search fonts (name, initials or pinyin)",fontRecent:"Recently Used",fontAll:"All Fonts",fontResults:"Search Results ({count})",fontNoResults:"No fonts found",fontMore:"Font list",fontSizeBox:"Font Size",fontSizeList:"Font sizes",fontSizeRange:"Could not set the size: a font size is from 1 to 409 points",boldTip:"Bold ({key}B)",italicTip:"Italic ({key}I)",underlineTip:"Underline ({key}U)",strikeTip:"Strikethrough ({key}5)",fontColorApply:"Font Color",fillColorApply:"Fill Color",colorMenu:"More choices",colorAutomatic:"Automatic",colorNoFill:"No Fill",colorRecent:"Recent Colors",colorMore:"More Colors",colorHex:"Colour (#RRGGBB)",colorApply:"OK",colorBad:"A colour is # and six hexadecimal digits",tableTools:"Table Design",tablePresetStyles:"Preset Styles",tableThemeColor:"Theme Color","tableGroup:light":"Light","tableGroup:medium":"Medium","tableGroup:dark":"Dark","tableGroup:custom":"Custom",tableNewStyle:"New Table Style…",tableConvertToRange:"Convert to Range",tableClearStyle:"Clear Table Style",tableSetAsDefault:"Set As Default",tableIsDefault:"Default table style",tableModifyStyle:"Modify…",tableDeleteStyle:"Delete",tableColumnPrefix:"Column",formatAsTableTitle:"Format As Table",tableDataSource:"Where is the data for your table?",tableOnlyFormat:"Only Format As Table",tableTitleRows:"The number of title rows",tableConvert:"Convert to a table and apply the table style",tableHasHeaders:"My table has headers",tableFilterButtons:"Filter the table",resizeTableTitle:"Resize Table",resizeTableRange:"Select the new data range for your table",newTableStyleTitle:"New Table Style",modifyTableStyleTitle:"Modify Table Style",tableStyleName:"Name",tableStyleNameEmpty:"Enter a name for the table style",tableElement:"Table Element","tablePart:wholeTable":"Whole Table","tablePart:headerRow":"Header Row","tablePart:totalRow":"Total Row","tablePart:firstColumn":"First Column","tablePart:lastColumn":"Last Column","tablePart:firstRowStripe":"First Row Stripe","tablePart:secondRowStripe":"Second Row Stripe","tablePart:firstColumnStripe":"First Column Stripe","tablePart:secondColumnStripe":"Second Column Stripe",tablePartFill:"Fill",tablePartText:"Text color",tablePartBorder:"Border",tablePartLines:"Inside lines",tablePartBold:"Bold",tablePartItalic:"Italic",tableStripeSize:"Stripe size",tableClearPart:"Clear",tablePreview:"Preview",tableSetDefault:"Set as default table style for this document",tableNoColor:"No Color",tableName:"Table Name",formatCellsTitle:"Format Cells","fcTab:number":"Number","fcTab:alignment":"Alignment","fcTab:font":"Font","fcTab:border":"Border","fcTab:fill":"Patterns","fcTab:protection":"Protection",fcCategory:"Category","fcCat:general":"General","fcCat:number":"Number","fcCat:currency":"Currency","fcCat:accounting":"Accounting","fcCat:date":"Date","fcCat:time":"Time","fcCat:percent":"Percentage","fcCat:fraction":"Fraction","fcCat:scientific":"Scientific","fcCat:text":"Text","fcCat:custom":"Custom",fcSample:"Sample",fcDecimals:"Decimal places",fcThousands:"Use 1000 Separator (,)",fcRedNegative:"Negative numbers in red",fcSymbol:"Symbol",fcNoSymbol:"None",fcType:"Type",fcHorizontal:"Horizontal",fcVertical:"Vertical","fcH:General":"General","fcH:Left":"Left","fcH:Center":"Center","fcH:Right":"Right","fcH:Fill":"Fill","fcH:Justify":"Justify","fcH:CenterAcross":"Center Across Selection","fcH:Distributed":"Distributed","fcV:Top":"Top","fcV:Center":"Center","fcV:Bottom":"Bottom","fcV:Justify":"Justify","fcV:Distributed":"Distributed",fcIndent:"Indent",fcRotation:"Orientation (degrees)",fcWrap:"Wrap text",fcShrink:"Shrink to fit",fcMerge:"Merge cells",fcFont:"Font",fcFontStyle:"Font style",fcRegular:"Regular",fcItalic:"Italic",fcBold:"Bold",fcBoldItalic:"Bold Italic",fcSize:"Size",fcUnderline:"Underline","fcU:None":"None","fcU:Single":"Single","fcU:Double":"Double","fcU:SingleAccounting":"Single Accounting","fcU:DoubleAccounting":"Double Accounting",fcColor:"Color",fcStrike:"Strikethrough",fcSuper:"Superscript",fcSub:"Subscript",fcPreviewText:"Kition AaBbCc 表格",fcPresets:"Presets",fcBorderNone:"None",fcBorderOutside:"Outline",fcBorderInside:"Inside",fcBorderEdges:"Border","fcEdge:top":"Top","fcEdge:bottom":"Bottom","fcEdge:left":"Left","fcEdge:right":"Right","fcEdge:insideHorizontal":"Inside horizontal","fcEdge:insideVertical":"Inside vertical","fcEdge:diagonalDown":"Diagonal down","fcEdge:diagonalUp":"Diagonal up",fcLineStyle:"Line style","fcLine:thin":"Thin","fcLine:medium":"Medium","fcLine:thick":"Thick","fcLine:dashed":"Dashed","fcLine:dotted":"Dotted","fcLine:double":"Double","fcLine:hair":"Hair",fcText:"Text",fcNoColor:"No Color",fcLocked:"Locked",fcHidden:"Hidden",fcProtectionNote:"Locking cells or hiding formulas has no effect until you protect the worksheet (Review › Protect Sheet).",symbolRecent:"Recently Used Symbols",symbolCommon:"Common Symbols",symbolMore:"More Symbols…",symbolTitle:"Symbol",symbolTabSymbols:"Symbols",symbolTabSpecial:"Special Characters",symbolSearch:"Type a symbol name and press Enter",symbolFont:"Font:",symbolNormalText:"(normal text)",symbolSubset:"Subset:",symbolSubsetNames:"en",symbolRecentDialog:"Recently used symbols:",symbolCode:"Character code: ",symbolFrom:"from: Unicode (hex)",symbolInsert:"Insert",symbolClose:"Close",specialEmDash:"Em Dash",specialEnDash:"En Dash",specialNbHyphen:"Nonbreaking Hyphen",specialEmSpace:"Em Space",specialEnSpace:"En Space",specialQuarterSpace:"1/4 Em Space",specialNbSpace:"Nonbreaking Space",specialCopyright:"Copyright",specialRegistered:"Registered",specialTrademark:"Trademark",specialSection:"Section",specialParagraph:"Paragraph",specialEllipsis:"Ellipsis",specialSingleOpen:"Single Opening Quote",specialSingleClose:"Single Closing Quote",specialDoubleOpen:"Double Opening Quote",specialDoubleClose:"Double Closing Quote",specialDegree:"Degree",specialCelsius:"Degree Celsius",specialPerMille:"Per Mille",specialPlusMinus:"Plus-Minus",specialTimes:"Multiplication",specialDivide:"Division",specialRoot:"Square Root",specialInfinity:"Infinity",specialAlmostEqual:"Almost Equal",specialNotEqual:"Not Equal",specialLessEqual:"Less Than or Equal",specialGreaterEqual:"Greater Than or Equal",specialEuro:"Euro",specialYuan:"Yuan",specialPound:"Pound",specialNumero:"Numero",pasteSpecialItem:"Paste Special…",clearMenu:"Clear Contents",clearAllItem:"All",clearFormatsItem:"Formats",clearContentsItem:"Contents",clearCommentsItem:"Comments",clearLinksItem:"Hyperlinks",sortMenu:"Sort",sortAscendingItem:"Ascending",sortDescendingItem:"Descending",mergeCellsItem:"Merge Cells",unmergeCellsItem:"Unmerge Cells",insertNoteItem:"Insert Comment",linkItem:"Hyperlink…",mergeTitle:"Merge Cells",mergeConfirm:"Merging keeps only the value of the upper-left cell. Merge anyway?",tablePicturesTitle:"Format as Table",tablePicturesConfirm:"The header row can’t hold pictures. Clear the pictures in it and continue?",moveTitle:"Move Cells",moveReplace:"There's already data here. Do you want to replace it?",filterTitle:"Filter",filterAscending:"Sort A to Z",filterDescending:"Sort Z to A",filterContent:"Filter by Values",filterText:"Text Filters",filterNumber:"Number Filters",filterDate:"Date Filters",filterSearch:"Search",filterAll:"(Select All)",filterAllResults:"(Select All Search Results)",filterBlanks:"(Blanks)",filterNoMatch:"No matches",filterClear:"Clear Filter",filterEmptyText:"(Empty text)",filterEquals:"Equals",filterNotEquals:"Does Not Equal",filterBeginsWith:"Begins With",filterEndsWith:"Ends With",filterContains:"Contains",filterNotContains:"Does Not Contain",filterGreater:"Greater Than",filterGreaterOrEqual:"Greater Than or Equal To",filterLess:"Less Than",filterLessOrEqual:"Less Than or Equal To",filterBetween:"Between",filterTop:"Top 10",filterAboveAverage:"Above Average",filterBelowAverage:"Below Average",filterCustom:"Custom Filter",filterCustomTitle:"Custom AutoFilter",filterShowRows:"Show rows where {column}:",filterAnd:"And",filterOr:"Or",filterTopTitle:"Top 10 AutoFilter",filterLargest:"Top",filterSmallest:"Bottom",filterItems:"Items",filterPercent:"Percent",validationPick:"Pick from the list",validationStopTitle:"Invalid Entry",validationWarningTitle:"Warning",validationInfoTitle:"Information",validationContinue:"Continue?",validationRetry:"Retry",validationYes:"Yes",validationNo:"No",validationTitle:"Data Validation",validationSettings:"Settings",validationInputTab:"Input Message",validationErrorTab:"Error Alert",validationCriteria:"Validation criteria",validationAllow:"Allow:","validationKind-any":"Any value","validationKind-whole":"Whole number","validationKind-decimal":"Decimal","validationKind-list":"List","validationKind-date":"Date","validationKind-time":"Time","validationKind-textLength":"Text length","validationKind-custom":"Custom",validationData:"Data:","validationOp-between":"between","validationOp-notBetween":"not between","validationOp-equal":"equal to","validationOp-notEqual":"not equal to","validationOp-greater":"greater than","validationOp-less":"less than","validationOp-greaterOrEqual":"greater than or equal to","validationOp-lessOrEqual":"less than or equal to",validationMinimum:"Minimum:",validationMaximum:"Maximum:",validationValue:"Value:",validationSource:"Source:",validationFormula:"Formula:",validationIgnoreBlank:"Ignore blank",validationDropdown:"In-cell dropdown",validationShowInput:"Show input message when cell is selected",validationTitleField:"Title:",validationInputMessage:"Input message:",validationShowError:"Show error alert after invalid data is entered",validationStyle:"Style:",validationStyleStop:"Stop",validationStyleWarning:"Warning",validationStyleInfo:"Information",validationErrorMessage:"Error message:",validationClearAll:"Clear All",errorUnavailable:"command `{command}` is not available right now: {reason}",errorInvalidParams:"invalid parameters for `{command}`: {reason}",errorInternal:"internal error in `{command}` (the workbook was kept as it was): {reason}",errorUnknownCommand:"unknown command `{command}`",errorOpenEmpty:"'{name}' is empty (0 bytes): there is no workbook in it.",errorOpenNotSheet:"'{name}' is {what}, not a spreadsheet.",errorOpenEncrypted:"'{name}' is password-protected. Kition Sheet can't open encrypted workbooks yet; remove the password in Excel and try again.",errorOpenLegacy:"'{name}' is not a spreadsheet: it is an Office binary file without a workbook (a Word or PowerPoint 97-2003 file, say).",errorOpenXls:"'{name}' is an Excel 97-2003 (.xls) workbook that can't be read ({reason}). Open it in Excel or WPS and save it as .xlsx.",errorOpenDamaged:"'{name}' is damaged and can't be opened: {reason}",errorOpenImport:"We can't import '{name}': {reason}",errorOpenCant:"We can't open '{name}': {reason}",errorFormula:"There's a problem with this formula: {reason}",errorNotFound:"We couldn't find what you were looking for: {what}",circularTitle:"Circular Reference Warning",circularMessage:"There are one or more circular references where a formula refers to its own cell directly or indirectly. They show 0 and might calculate incorrectly; remove them, or turn on iterative calculation."},qL={nameBox:"名称框",formula:"公式",enterFormula:"输入",insertFunction:"插入函数",expandFormulaBar:"展开编辑栏",collapseFormulaBar:"折叠编辑栏",showGroup:"显示",showGridlines:"显示网格线",showFormulaBar:"显示编辑栏",showHeadings:"显示行号列标",freezePanes:"冻结窗格",unfreezePanes:"取消冻结",freezeAt:"冻结至第{row}行{col}列",freezeRowsAt:"冻结至第{row}行",freezeColsAt:"冻结至第{col}列",freezeTopRow:"冻结首行",freezeFirstColumn:"冻结首列",focusCell:"高亮行列",focusCellColors:"高亮颜色",focusCellColor:"高亮颜色 {index}",gridlineColor:"网格线颜色",gridlineAuto:"自动",functionSearch:"查找函数:",functionCategory:"或选择类别:",functionPick:"选择函数:",functionNone:"没有匹配的函数","fnCategory:common":"常用函数","fnCategory:all":"全部","fnCategory:Financial":"财务","fnCategory:Logical":"逻辑","fnCategory:Text":"文本","fnCategory:DateTime":"日期与时间","fnCategory:Lookup":"查找与引用","fnCategory:MathTrig":"数学与三角函数","fnCategory:Statistical":"统计","fnCategory:Engineering":"工程","fnCategory:Information":"信息","fnCategory:Database":"数据库","fnCategory:Compatibility":"兼容性","fnCategory:Web":"Web","fnCategory:Cube":"多维数据集",...IL,insertAbove:"向上插入",insertAboveAfter:"行",insertBelow:"向下插入",insertBelowAfter:"行",insertLeft:"向左插入",insertLeftAfter:"列",insertRight:"向右插入",insertRightAfter:"列",insertCellsRight:"插入单元格-右移",insertCellsDown:"插入单元格-下移",insertSheetItem:"插入工作表",deleteCellsLeft:"删除单元格-左移",deleteCellsUp:"删除单元格-上移",deleteRowsItem:"删除行",deleteColsItem:"删除列",deleteSheetItem:"删除工作表",gridMenu:"单元格操作",menuCut:"剪切",menuCopy:"复制",menuPaste:"粘贴",deleteMenu:"删除",insertMenu:"插入",clearContents:"清除内容",formatCellsItem:"设置单元格格式…",hideLines:"隐藏",unhideLines:"取消隐藏",rowHeightItem:"行高…",columnWidthItem:"列宽…",addSheet:"新建工作表",renameSheet:"重命名",deleteSheet:"删除",sheetList:"工作表列表",sheetMenu:"工作表操作",sheetLocked:"工作表已保护",sheetHidden:"已隐藏",sheetScrollLeft:"向左滚动标签",sheetScrollRight:"向右滚动标签",moveSheet:"移动工作表",moveSheetLeft:"向左移动",moveSheetRight:"向右移动",copySheet:"创建副本",tabColor:"工作表标签",noTabColor:"无填充",hideSheet:"隐藏工作表",unhideSheet:"取消隐藏",hideNeedsTwo:"至少显示两个工作表时才能隐藏",insertSheetBefore:"在当前工作表前",insertSheetAfter:"在当前工作表后",deleteSheetTitle:"删除工作表",deleteSheetConfirm:"确认要删除“{sheet}”吗?",deleteSheetOk:"确认删除",cancel:"取消",ok:"确定",unhideSheetTitle:"取消隐藏",unhideSheetPrompt:"取消隐藏工作表:",sheetNameEmpty:"工作表名称不能为空!",sheetNameInvalid:"工作表名不能包含无效字符:\\ / : ? * [ ]",sheetNameTaken:"工作表名称已经存在!",sheetNameApostrophe:"工作表名称不能以单引号开头或结尾",sheetNameReserved:"“History”是保留名称",statSum:"求和={value}",statAverage:"平均值={value}",statCount:"计数={value}",sheetSelection:"{sheet} · {selection}",sheetOf:"第 {index} 个工作表,共 {count} 个",exported:"已导出",exportFailed:"导出失败",templateTitle:"保存为模板",templateName:"模板名称",templateNameRequired:"请输入模板名称",templateSaved:"模板保存成功",templateFailed:"模板保存失败",commentFailed:"评论失败",commentThread:"评论 ({count})",formatPainter:"格式刷",formatPainterTip:"格式刷:单击刷一次,双击可连续刷(Esc 结束)",fontBox:"字体",fontSearch:"搜索字体(名称、首字母或全拼)",fontRecent:"最近使用",fontAll:"所有字体",fontResults:"搜索结果({count})",fontNoResults:"暂无搜索结果",fontMore:"字体列表",fontSizeBox:"字号",fontSizeList:"字号列表",fontSizeRange:"设置失败,字号必须在 1-409 磅之间",boldTip:"加粗 ({key}B)",italicTip:"倾斜 ({key}I)",underlineTip:"下划线 ({key}U)",strikeTip:"删除线 ({key}5)",fontColorApply:"字体颜色",fillColorApply:"填充颜色",colorMenu:"更多选项",colorAutomatic:"自动",colorNoFill:"无填充颜色",colorRecent:"最近使用颜色",colorMore:"其他颜色",colorHex:"颜色(#RRGGBB)",colorApply:"确定",colorBad:"颜色是 # 加六位十六进制数",tableTools:"表格工具",tablePresetStyles:"预设样式",tableThemeColor:"主题颜色","tableGroup:light":"浅色系","tableGroup:medium":"中色系","tableGroup:dark":"深色系","tableGroup:custom":"自定义",tableNewStyle:"新建表格样式…",tableConvertToRange:"转换为区域",tableClearStyle:"清除表格样式",tableSetAsDefault:"设为默认值",tableIsDefault:"默认表格样式",tableModifyStyle:"修改…",tableDeleteStyle:"删除",tableColumnPrefix:"列",formatAsTableTitle:"套用表格样式",tableDataSource:"表数据的来源",tableOnlyFormat:"仅套用表格样式",tableTitleRows:"标题行的行数",tableConvert:"转换成表格,并套用表格样式",tableHasHeaders:"表包含标题",tableFilterButtons:"筛选按钮",resizeTableTitle:"调整表格大小",resizeTableRange:"为表选择新的数据区域",newTableStyleTitle:"新建表格样式",modifyTableStyleTitle:"修改表格样式",tableStyleName:"名称",tableStyleNameEmpty:"请输入表格样式的名称",tableElement:"表元素","tablePart:wholeTable":"整个表","tablePart:headerRow":"标题行","tablePart:totalRow":"汇总行","tablePart:firstColumn":"第一列","tablePart:lastColumn":"最后一列","tablePart:firstRowStripe":"第一行条纹","tablePart:secondRowStripe":"第二行条纹","tablePart:firstColumnStripe":"第一列条纹","tablePart:secondColumnStripe":"第二列条纹",tablePartFill:"填充",tablePartText:"字体颜色",tablePartBorder:"边框",tablePartLines:"内部框线",tablePartBold:"加粗",tablePartItalic:"倾斜",tableStripeSize:"条纹尺寸",tableClearPart:"清除",tablePreview:"预览",tableSetDefault:"设为此文档的默认表格样式",tableNoColor:"无颜色",tableName:"表名称",formatCellsTitle:"单元格格式","fcTab:number":"数字","fcTab:alignment":"对齐","fcTab:font":"字体","fcTab:border":"边框","fcTab:fill":"图案","fcTab:protection":"保护",fcCategory:"分类","fcCat:general":"常规","fcCat:number":"数值","fcCat:currency":"货币","fcCat:accounting":"会计专用","fcCat:date":"日期","fcCat:time":"时间","fcCat:percent":"百分比","fcCat:fraction":"分数","fcCat:scientific":"科学记数","fcCat:text":"文本","fcCat:custom":"自定义",fcSample:"示例",fcDecimals:"小数位数",fcThousands:"使用千位分隔符(,)",fcRedNegative:"负数显示为红色",fcSymbol:"货币符号",fcNoSymbol:"无",fcType:"类型",fcHorizontal:"水平对齐",fcVertical:"垂直对齐","fcH:General":"常规","fcH:Left":"靠左","fcH:Center":"居中","fcH:Right":"靠右","fcH:Fill":"填充","fcH:Justify":"两端对齐","fcH:CenterAcross":"跨列居中","fcH:Distributed":"分散对齐","fcV:Top":"靠上","fcV:Center":"居中","fcV:Bottom":"靠下","fcV:Justify":"两端对齐","fcV:Distributed":"分散对齐",fcIndent:"缩进",fcRotation:"方向(度)",fcWrap:"自动换行",fcShrink:"缩小字体填充",fcMerge:"合并单元格",fcFont:"字体",fcFontStyle:"字形",fcRegular:"常规",fcItalic:"倾斜",fcBold:"加粗",fcBoldItalic:"加粗 倾斜",fcSize:"字号",fcUnderline:"下划线","fcU:None":"无","fcU:Single":"单下划线","fcU:Double":"双下划线","fcU:SingleAccounting":"会计用单下划线","fcU:DoubleAccounting":"会计用双下划线",fcColor:"颜色",fcStrike:"删除线",fcSuper:"上标",fcSub:"下标",fcPreviewText:"Kition AaBbCc 表格",fcPresets:"预置",fcBorderNone:"无",fcBorderOutside:"外边框",fcBorderInside:"内部",fcBorderEdges:"边框","fcEdge:top":"上边框","fcEdge:bottom":"下边框","fcEdge:left":"左边框","fcEdge:right":"右边框","fcEdge:insideHorizontal":"内部横线","fcEdge:insideVertical":"内部竖线","fcEdge:diagonalDown":"左斜线","fcEdge:diagonalUp":"右斜线",fcLineStyle:"线条样式","fcLine:thin":"细线","fcLine:medium":"中粗线","fcLine:thick":"粗线","fcLine:dashed":"虚线","fcLine:dotted":"点线","fcLine:double":"双线","fcLine:hair":"极细线",fcText:"文本",fcNoColor:"无颜色",fcLocked:"锁定",fcHidden:"隐藏",fcProtectionNote:"只有保护工作表(审阅 › 保护工作表)后,锁定单元格或隐藏公式才有效。",symbolRecent:"最近使用符号",symbolCommon:"常用符号",symbolMore:"更多符号…",symbolTitle:"符号",symbolTabSymbols:"符号",symbolTabSpecial:"特殊字符",symbolSearch:"输入符号名称,回车搜索",symbolFont:"字体:",symbolNormalText:"(普通文本)",symbolSubset:"子集:",symbolSubsetNames:"zh",symbolRecentDialog:"近期使用过的符号:",symbolCode:"字符代码:",symbolFrom:"来自:Unicode(十六进制)",symbolInsert:"插入",symbolClose:"关闭",specialEmDash:"长划线",specialEnDash:"短划线",specialNbHyphen:"不间断连字符",specialEmSpace:"全角空格",specialEnSpace:"半角空格",specialQuarterSpace:"1/4 全角空格",specialNbSpace:"不间断空格",specialCopyright:"版权所有",specialRegistered:"注册",specialTrademark:"商标",specialSection:"小节",specialParagraph:"段落",specialEllipsis:"省略号",specialSingleOpen:"左单引号",specialSingleClose:"右单引号",specialDoubleOpen:"左双引号",specialDoubleClose:"右双引号",specialDegree:"度",specialCelsius:"摄氏度",specialPerMille:"千分号",specialPlusMinus:"正负号",specialTimes:"乘号",specialDivide:"除号",specialRoot:"根号",specialInfinity:"无穷大",specialAlmostEqual:"约等于",specialNotEqual:"不等于",specialLessEqual:"小于等于",specialGreaterEqual:"大于等于",specialEuro:"欧元",specialYuan:"人民币",specialPound:"英镑",specialNumero:"编号",pasteSpecialItem:"选择性粘贴…",clearMenu:"清除内容",clearAllItem:"全部",clearFormatsItem:"格式",clearContentsItem:"内容",clearCommentsItem:"批注",clearLinksItem:"超链接",sortMenu:"排序",sortAscendingItem:"升序",sortDescendingItem:"降序",mergeCellsItem:"合并单元格",unmergeCellsItem:"取消合并单元格",insertNoteItem:"插入批注",linkItem:"超链接…",mergeTitle:"合并单元格",mergeConfirm:"合并后的单元格将只保留左/上单元格中的值,确定合并吗?",tablePicturesTitle:"套用表格样式",tablePicturesConfirm:"标题行不能包含图片,确定后将清除标题行中的图片,是否继续?",moveTitle:"提示",moveReplace:"是否替换目标单元格内容?",filterTitle:"筛选",filterAscending:"升序",filterDescending:"降序",filterContent:"内容筛选",filterText:"文本筛选",filterNumber:"数字筛选",filterDate:"日期筛选",filterSearch:"搜索",filterAll:"(全选)",filterAllResults:"(全选搜索结果)",filterBlanks:"(空白)",filterNoMatch:"暂无搜索结果",filterClear:"清空条件",filterEmptyText:"(空文本)",filterEquals:"等于",filterNotEquals:"不等于",filterBeginsWith:"开头是",filterEndsWith:"结尾是",filterContains:"包含",filterNotContains:"不包含",filterGreater:"大于",filterGreaterOrEqual:"大于或等于",filterLess:"小于",filterLessOrEqual:"小于或等于",filterBetween:"介于",filterTop:"前十项",filterAboveAverage:"高于平均值",filterBelowAverage:"低于平均值",filterCustom:"自定义筛选",filterCustomTitle:"自定义自动筛选方式",filterShowRows:"显示行:{column}",filterAnd:"与",filterOr:"或",filterTopTitle:"自动筛选前 10 个",filterLargest:"最大",filterSmallest:"最小",filterItems:"项",filterPercent:"百分比",validationPick:"从下拉列表中选择",validationStopTitle:"错误提示",validationWarningTitle:"警告",validationInfoTitle:"信息",validationContinue:"是否继续?",validationRetry:"重试",validationYes:"是",validationNo:"否",validationTitle:"数据验证",validationSettings:"设置",validationInputTab:"输入信息",validationErrorTab:"出错警告",validationCriteria:"有效性条件",validationAllow:"允许:","validationKind-any":"任何值","validationKind-whole":"整数","validationKind-decimal":"小数","validationKind-list":"序列","validationKind-date":"日期","validationKind-time":"时间","validationKind-textLength":"文本长度","validationKind-custom":"自定义",validationData:"数据:","validationOp-between":"介于","validationOp-notBetween":"未介于","validationOp-equal":"等于","validationOp-notEqual":"不等于","validationOp-greater":"大于","validationOp-less":"小于","validationOp-greaterOrEqual":"大于或等于","validationOp-lessOrEqual":"小于或等于",validationMinimum:"最小值:",validationMaximum:"最大值:",validationValue:"数值:",validationSource:"来源:",validationFormula:"公式:",validationIgnoreBlank:"忽略空值",validationDropdown:"提供下拉箭头",validationShowInput:"选定单元格时显示输入信息",validationTitleField:"标题:",validationInputMessage:"输入信息:",validationShowError:"输入无效数据时显示出错警告",validationStyle:"样式:",validationStyleStop:"停止",validationStyleWarning:"警告",validationStyleInfo:"信息",validationErrorMessage:"错误信息:",validationClearAll:"全部清除",errorUnavailable:"命令现在不可用:{reason}",errorInvalidParams:"参数无效:{reason}",errorInternal:"内部错误(工作簿已保持原样):{reason}",errorUnknownCommand:"未知命令:{command}",errorOpenEmpty:"“{name}”是空文件(0 字节),其中没有工作簿。",errorOpenNotSheet:"“{name}”是{what},不是表格文件。",errorOpenEncrypted:"“{name}”已设置密码保护。暂时无法打开加密的工作簿,请先取消密码后再试。",errorOpenLegacy:"“{name}”不是表格文件:它是不含工作簿的 Office 二进制文件(例如 Word 或 PowerPoint 97-2003 文件)。",errorOpenXls:"“{name}”是无法读取的 Excel 97-2003 (.xls) 工作簿({reason})。请在 WPS 或 Excel 中打开并另存为 .xlsx。",errorOpenDamaged:"“{name}”已损坏,无法打开:{reason}",errorOpenImport:"无法导入“{name}”:{reason}",errorOpenCant:"无法打开“{name}”:{reason}",errorFormula:"公式存在错误:{reason}",errorNotFound:"找不到您要查找的内容:{what}","errorKind:a PDF document":"PDF 文档","errorKind:a PNG picture":"PNG 图片","errorKind:a JPEG picture":"JPEG 图片","errorKind:a GIF picture":"GIF 图片","errorKind:a Word document":"Word 文档","errorKind:a PowerPoint presentation":"PowerPoint 演示文稿","errorKind:a ZIP archive":"ZIP 压缩包",circularTitle:"循环引用警告",circularMessage:"存在一个或多个循环引用:公式直接或间接引用了自身所在的单元格。这些单元格显示为 0,可能导致计算不正确;请删除循环引用,或启用迭代计算。"},_x={"en-US":VL,"zh-CN":qL},N0=(n,i,o)=>{const r=`fn:${i}`,u=n(r);return u===r?o:u},$L={"zh-CN":{File:"文件",Export:"导出","New Comment":"新建批注","Export as PDF":"导出为 PDF","Export as CSV":"导出为 CSV","Export as CSV UTF-8":"导出为 CSV UTF-8(带 BOM)","Export as Web Page":"导出为网页","Export as Picture":"输出为图片","Export as Excel Workbook":"另存为 Excel 工作簿",Template:"模板","Save as Template":"保存为模板",Draw:"绘图",Automate:"自动化",Table:"表格","Table Design":"表设计","Chart Design":"图表设计","Switch Row/Column":"切换行/列","Select Data":"选择数据","Add Chart Element":"添加图表元素","Quick Layout":"快速布局","Change Colors":"更改颜色","Move Chart":"移动图表","Chart Layouts":"图表布局","Chart Styles":"图表样式",Location:"位置",Format:"格式",Clipboard:"剪贴板",Font:"字体",Alignment:"对齐方式",Number:"数字",Styles:"样式",Cells:"单元格",Editing:"编辑",Paste:"粘贴","Paste Special":"选择性粘贴",Cut:"剪切",Copy:"复制","Format Painter":"格式刷",Bold:"加粗",Italic:"倾斜",Underline:"下划线","Double Underline":"双下划线",Strikethrough:"删除线","Increase Font Size":"增大字号","Decrease Font Size":"减小字号",Borders:"边框","Fill Color":"填充颜色","Font Color":"字体颜色","No Fill":"无填充",Automatic:"自动","Top Align":"顶端对齐","Middle Align":"垂直居中","Bottom Align":"底端对齐","Align Left":"左对齐",Center:"居中","Align Right":"右对齐","Wrap Text":"自动换行","Decrease Indent":"减少缩进","Increase Indent":"增加缩进",Orientation:"方向","Merge & Center":"合并后居中","Merge Across":"跨越合并","Merge Cells":"合并单元格","Unmerge Cells":"取消合并","Number Format":"数字格式","Accounting Number Format":"会计数字格式","Percent Style":"百分比样式","Comma Style":"千位分隔样式","Increase Decimal":"增加小数位数","Decrease Decimal":"减少小数位数","Conditional Formatting":"条件格式","Data Bars":"数据条","Color Scales":"色阶","Icon Sets":"图标集","Clear Rules":"清除规则","Manage Rules":"管理规则","Format as Table":"套用表格样式",Properties:"属性","Resize Table":"调整表格大小","Remove Duplicates":"删除重复项","Convert to Range":"转换为区域","Table Style Options":"表格样式选项","Header Row":"标题行","Total Row":"汇总行","Banded Rows":"镶边行","First Column":"第一列","Last Column":"最后一列","Banded Columns":"镶边列","Filter Button":"筛选按钮","Table Styles":"表格样式","New Table Style…":"新建表格样式…","Cell Styles":"单元格样式",Insert:"插入",Delete:"删除","Insert Sheet Rows":"插入工作表行","Insert Sheet Columns":"插入工作表列","Insert Cells":"插入单元格","Insert Sheet":"插入工作表","Hide Sheet":"隐藏工作表","Unhide Sheet…":"取消隐藏工作表…","Delete Sheet Rows":"删除工作表行","Delete Sheet Columns":"删除工作表列","Delete Cells":"删除单元格","Delete Sheet":"删除工作表","Row Height":"行高","Column Width":"列宽","AutoFit Row Height":"自动调整行高","AutoFit Column Width":"自动调整列宽","Format Cells":"设置单元格格式",Sum:"求和",Average:"平均值","Count Numbers":"计数",Max:"最大值",Min:"最小值",Fill:"填充",Down:"向下",Right:"向右",Up:"向上",Left:"向左",Series:"序列","Smart fill":"智能填充",Clear:"清除","Clear All":"全部清除","Clear Formats":"清除格式","Clear Contents":"清除内容","Clear Comments":"清除批注","Clear Hyperlinks":"清除超链接","Sort & Filter":"排序和筛选","Sort A to Z":"升序","Sort Z to A":"降序","Custom Sort":"自定义排序",Reapply:"重新应用","Find & Select":"查找和选择",Find:"查找",Replace:"替换","Go To":"转到","Go To Special":"定位条件",Good:"好",Bad:"差",Neutral:"适中",Title:"标题",Total:"汇总","Heading 1":"标题 1","Heading 2":"标题 2",Normal:"常规",General:"常规",Currency:"货币",Accounting:"会计专用","Short Date":"短日期","Long Date":"长日期",Time:"时间",Percentage:"百分比",Fraction:"分数",Scientific:"科学记数",Text:"文本","Bottom Border":"下框线","Top Border":"上框线","Left Border":"左框线","Right Border":"右框线","No Border":"无框线","All Borders":"所有框线","Outside Borders":"外侧框线","Thick Outside Borders":"粗外侧框线","Bottom Double Border":"双底框线","Thick Bottom Border":"粗下框线","Top and Bottom Border":"上下框线","Angle Counterclockwise":"逆时针角度","Angle Clockwise":"顺时针角度","Vertical Text":"竖排文字","Rotate Text Up":"向上旋转文字","Rotate Text Down":"向下旋转文字",Checkbox:"复选框","Cell Controls":"单元格控件",Symbols:"符号",Picture:"图片","Recommended Pivot Tables":"推荐的数据透视表",Tables:"表格","Recommended Charts":"推荐的图表",Charts:"图表","Art text":"艺术字",Links:"链接","Lasso Select":"套索选择",Tools:"工具","Ink to Shape":"墨迹转换为形状",Convert:"转换","Sheet Right-to-Left":"工作表从右向左","Print Gridlines":"打印网格线","Print Headings":"打印行号列标","Sheet Options":"工作表选项","Print Titles":"打印标题",Background:"背景","Page Setup":"页面设置","Scale to Fit":"调整为合适大小",Colors:"颜色",Fonts:"字体",Effects:"效果","Bring Forward":"上移一层","Send Backward":"下移一层","Selection Pane":"选择窗格",Align:"对齐",Rotate:"旋转",Arrange:"排列","Insert Function":"插入函数","Recently Used":"最近使用","Date & Time":"日期和时间","Lookup & Reference":"查找与引用","Math & Trig":"数学和三角函数","More Functions":"其他函数","Function Library":"函数库","Name Manager":"名称管理器","Defined Names":"定义的名称","Formula Auditing":"公式审核","Calculation Options":"计算选项",Calculation:"计算",Advanced:"高级","Text to Columns":"分列",Consolidate:"合并计算","Data Tools":"数据工具","Hide Detail":"隐藏明细数据","Show Detail":"显示明细数据",Outline:"分级显示","From Text/CSV":"从文本/CSV","Get Data":"获取数据","From Table/Range":"来自表格/区域","Import Data":"导入数据","Queries & Connections":"查询和连接","Refresh All":"全部刷新","Goal Seek":"单变量求解","Scenario Manager":"方案管理器","Data Table":"模拟运算表",Forecast:"预测","Delete Comment":"删除批注","Protect Sheet":"保护工作表","Unprotect Sheet":"撤销工作表保护","Protect Workbook":"保护工作簿",Protect:"保护","Workbook Statistics":"工作簿统计信息",Thesaurus:"同义词库",Proofing:"校对","Check Accessibility":"检查辅助功能",Accessibility:"辅助功能","Zoom to Selection":"缩放到选定区域","Page Break Preview":"分页预览","Custom Views":"自定义视图","Workbook Views":"工作簿视图",Split:"拆分","New Window":"新建窗口","Arrange All":"全部重排",Hide:"隐藏",Unhide:"取消隐藏","Switch Windows":"切换窗口",Window:"窗口",Macros:"宏","Record Actions":"录制操作","New Script":"新建脚本","All Scripts":"所有脚本","Scripting Tools":"脚本工具","You can't change part of an array.":"不能更改数组的某一部分。","A checkbox can't be typed in. Clear its contents, then type.":"复选框不可直接编辑,请删除后再插入","A checkbox cell can't hold a link.":"复选框单元格不能插入链接。","A table's header row can't hold pictures.":"标题行不能包含图片。","This value doesn't match the data validation restrictions defined for this cell.":"此值与此单元格定义的数据验证限制不匹配。","A table can't overlap another table.":"表格不能与另一个表格重叠。","A table needs a row besides its header.":"表格除标题行外至少需要一行数据。","A workbook must contain at least one visible worksheet.":"工作簿中至少应含有一张可见的工作表。","Cell must contain a formula.":"单元格必须包含公式。","Cell must contain a value.":"单元格必须包含值。","Column width must be between 0 and 255 characters.":"列宽必须介于 0 到 255 个字符之间。","Enter a valid range on this sheet.":"请输入此工作表上的有效区域。","files larger than 2 GB aren't supported":"不支持大于 2 GB 的文件","Input cell reference is not valid.":"输入单元格引用无效。","Multi-cell array formulas aren't allowed in tables.":"表格中不允许使用多单元格数组公式。","No cells were found.":"未找到单元格。","No dictionary is available on this system (Kition Sheet uses the system word list).":"此系统上没有可用的词典(Kition Sheet 使用系统词表)。","No sheets are hidden.":"没有隐藏的工作表。","Nothing to import.":"没有可导入的内容。","Nothing to paste.":"没有可粘贴的内容。","ODS is supported for data import only. Save as .xlsx or another supported export format.":"ODS 文件只能导入数据。请另存为 .xlsx 或其他支持的格式。","XLSB is supported for data import only. Save as .xlsx or another supported export format.":"XLSB 文件只能导入数据。请另存为 .xlsx 或其他支持的格式。","Excel 97-2003 (.xls) workbooks are opened but not saved. Save as .xlsx or another supported export format.":"Excel 97-2003 (.xls) 工作簿只能打开,不能保存。请另存为 .xlsx 或其他支持的格式。","This .xls workbook is password-protected. Kition Sheet can't open encrypted workbooks yet; remove the password and try again.":"此 .xls 工作簿已设置密码保护。暂时无法打开加密的工作簿,请先取消密码后再试。","Only the characters of a text cell can be formatted.":"只能设置文本单元格中字符的格式。","Pick up a format first.":"请先用格式刷选取格式。","Reference isn't valid.":"引用无效。","Row height must be between 0 and 409 points.":"行高必须介于 0 到 409 磅之间。","Select data for the chart first.":"请先选择图表的数据。","That command cannot be used on overlapping selections.":"该命令不能用于重叠的选定区域。","The cell has no formula.":"该单元格没有公式。","The cell or chart you're trying to change is on a protected sheet.":"您试图更改的单元格或图表位于受保护的工作表中。","The cell you're trying to change is on a protected sheet.":"您试图更改的单元格位于受保护的工作表中。","The cells can't be moved past the edge of the sheet.":"不能将单元格移出工作表的边界。","The consolidated data doesn't fit below and right of the destination.":"合并计算的数据超出了目标位置右下方的范围。","The copied sheet no longer exists.":"复制的工作表已不存在。","The extract range can't overlap the list range.":"复制到的区域不能与列表区域重叠。","The file is empty.":"文件是空的。","The name entered already exists. Enter a unique name.":"输入的名称已存在。请输入唯一的名称。","The name that you entered is not valid.":"输入的名称无效。","The number must be between 1 and 409.":"数字必须介于 1 到 409 之间。","The password you supplied is not correct.":"密码不正确。","The selection is too large to move.":"选定区域太大,无法移动。","The sheet the format was picked up on is gone.":"选取格式的工作表已不存在。","The workbook is protected and cannot be changed.":"工作簿受保护,不能更改。","There are no scenarios on this sheet.":"此工作表上没有方案。","There is no row above the table for its header.":"表格上方没有可用作标题行的行。","There is nothing in the selected rows or columns to format as a table.":"所选行或列中没有可套用表格样式的内容。","There's a problem with this formula.":"公式存在错误。","There's no comment in this cell.":"此单元格中没有批注。","There's no filter here.":"此处没有筛选。","This action won't work on multiple selections.":"不能对多重选定区域使用此命令。","This can't be done with the whole sheet selected.":"选中整张工作表时无法执行此操作。","To do this, all the merged cells need to be the same size.":"此操作要求合并单元格都具有相同大小。","To prevent possible loss of data, Excel cannot shift nonblank cells off of the worksheet.":"为了防止可能的数据丢失,不能将非空单元格移出工作表。","Too many copies of this sheet.":"此工作表的副本太多。","Undo and Redo can't run inside another command.":"撤销和恢复不能在其他命令中运行。","The sheet is too large to export as one picture; export a smaller range.":"工作表太大,无法输出为一张图片;请输出较小的区域。","Data Validation":"数据验证"}},GL=[[/^command `([^`]+)` is not available right now: ([\s\S]*)$/,"errorUnavailable",["command","reason"]],[/^invalid parameters for `([^`]+)`: ([\s\S]*)$/,"errorInvalidParams",["command","reason"]],[/^internal error in `([^`]+)` \(the workbook was kept as it was\): ([\s\S]*)$/,"errorInternal",["command","reason"]],[/^unknown command `([^`]+)`$/,"errorUnknownCommand",["command"]],[/^'([\s\S]+)' is empty \(0 bytes\): there is no workbook in it\.$/,"errorOpenEmpty",["name"]],[/^'([\s\S]+)' is password-protected\. /,"errorOpenEncrypted",["name"]],[/^'([\s\S]+)' is not a spreadsheet: it is an Office binary file/,"errorOpenLegacy",["name"]],[/^'([\s\S]+)' is an Excel 97-2003 \(\.xls\) workbook that can't be read \(([\s\S]*)\)\. /,"errorOpenXls",["name","reason"]],[/^'([\s\S]+)' is damaged and can't be opened: ([\s\S]*)$/,"errorOpenDamaged",["name","reason"]],[/^'([\s\S]+)' is (an? [^,]+), not a spreadsheet\.$/,"errorOpenNotSheet",["name","what"]],[/^We can't import '([\s\S]+)': ([\s\S]*)$/,"errorOpenImport",["name","reason"]],[/^We can't open '([\s\S]+)': ([\s\S]*)$/,"errorOpenCant",["name","reason"]],[/^There's a problem with this formula: ([\s\S]*)$/,"errorFormula",["reason"]],[/^We couldn't find what you were looking for: ([\s\S]*)$/,"errorNotFound",["what"]]];function us(n,i,o,r=0){const u=o instanceof Error?o.message:String(o),f=n(u);if(f!==u||r>3)return f;const h=/^step \d+ \(`[^`]+`\) failed: ([\s\S]*)$/.exec(u);if(h)return us(n,i,h[1],r+1);for(const[v,p,y]of GL){const m=v.exec(u);if(!m)continue;const x={};y.forEach((C,E)=>{const w=m[E+1]??"";x[C]=C==="reason"?us(n,i,w,r+1):C==="what"?PL(i,w):w});const b=i(p,x);return b===p?u:b}return u}function PL(n,i){const o=`errorKind:${i}`,r=n(o);return r===o?i:r}function KL(n){const i=n.inspected;return{sheets:i.sheets??[],tabs:Array.isArray(i.tabs)?i.tabs:[],sheet:i.sheet??"",active:i.active??"A1",selection:i.selection??"A1",stats:i.stats??null,lines:i.lines??{rows:1,cols:1,wholeRows:!1,wholeCols:!1},content:i.content??"",editing:i.editing===!0,editText:i.editText??null,formulaBar:i.formulaBar!==!1,gridlines:i.gridlines!==!1,gridColor:typeof i.gridColor=="string"?i.gridColor:null,headings:i.headings!==!1,focusCell:i.focusCell===!0,focusColor:typeof i.focusColor=="string"?i.focusColor:Fx[0],freeze:Array.isArray(i.freeze)?i.freeze:[0,0],freezePreview:Array.isArray(i.freezePreview)?i.freezePreview:null,freezeShift:Array.isArray(i.freezeShift)?i.freezeShift:[0,0],formatPainter:i.formatPainter==="once"||i.formatPainter==="sticky"?i.formatPainter:null,activeRect:Array.isArray(i.activeRect)?i.activeRect:null,zoom:typeof i.zoom=="number"?i.zoom:100,zoomAsked:typeof i.zoomAsked=="number"?i.zoomAsked:0,formulaText:i.formulaText??"",formulaReferences:i.formulaReferences??[],formulaHint:i.formulaHint??null,editCell:i.editCell??null,style:i.style??{},table:i.table??null,tableInfo:i.tableInfo??null,dialog:i.dialog&&typeof i.dialog=="object"?i.dialog:null,shape:i.shape??null,shapes:Array.isArray(i.shapes)?i.shapes:[],shapeEditing:i.shapeEditing===!0,chart:i.chart??null,escape:i.escape===!0,checkbox:i.checkbox===!0,notice:i.notice&&typeof i.notice=="object"&&typeof i.notice.text=="string"?i.notice:null,validation:i.validation&&typeof i.validation=="object"&&Array.isArray(i.validation.rect)?i.validation:null}}const YL=["file.new","file.open","file.save","file.saveAs","file.close","file.print","file.printPreview","file.saveBytes"],XL=["file.export","file.exportPdf","file.exportCsv","file.exportHtml"],Hn={File:["file.properties"],Insert:["insert.pivotTable","insert.table","insert.sparkline","insert.link","insert.symbol"],Draw:["draw.lasso","draw.inkToShape"],"Page Layout":["pageLayout.theme","pageLayout.margins","pageLayout.orientation","pageLayout.size","pageLayout.printArea","pageLayout.breaks","pageLayout.printTitles","pageLayout.scaleToFit","pageLayout.printGridlines"],Formulas:["formulas.insertFunction","formulas.autoSum","formulas.financial","formulas.logical","formulas.text","formulas.dateTime","formulas.lookupReference","formulas.mathTrig","formulas.nameManager","formulas.calculateNow"],Data:["data.getData","data.refreshAll","data.sortAscending","data.sortDescending","data.sort","data.filter","data.textToColumns","data.removeDuplicates","data.validation","data.group"],Automate:["automate.recordActions","automate.newScript","automate.allScripts"],Review:["review.spelling","review.workbookStatistics","review.checkAccessibility","review.newComment","review.deleteComment","review.newNote","review.protectSheet","review.protectWorkbook"],View:["view.normal","view.pageBreakPreview","view.pageLayout","view.freezePanes","view.gridlines","view.headings","view.zoom","view.zoomToSelection","view.split"],Table:["table.rename","table.resize","table.removeDuplicates","table.convertToRange","table.headerRow","table.totalRow","table.bandedRows","table.style"],"Chart Design":["chart.quickLayout","chart.changeColors","chart.selectData","chart.switchRowColumn","chart.move"]},Fx=["#FBE9C6","#DCEBFF","#DDF3E1","#FCE1E4","#ECE3FA","#E3E6EA","#E8A33D","#3D7FE0","#3FA35B","#D9536A","#8A63D2","#6B7380"],ZL=["#C0C0C0","#808080","#000000","#99CCFF","#3366FF","#CCFFCC","#339966","#FFCC99","#FF6600","#FF99CC","#993366","#CC99FF"];function R0(n){const i=/^([A-Z]+)(\d+)/.exec(n)??["","A","1"],o=i[1];let r=0;for(const u of o)r=r*26+u.charCodeAt(0)-64;return{row:Number(i[2]),col:o,colIndex:r}}function D0(n){let i="";for(let o=n;o>0;o=Math.floor((o-1)/26))i=String.fromCharCode(65+(o-1)%26)+i;return i}const Fn=[{name:"宋体",also:["SimSun","songti","st"],css:'"SimSun", "Songti SC", "STSong", serif'},{name:"黑体",also:["SimHei","heiti","ht"],css:'"SimHei", "Heiti SC", "STHeiti", sans-serif'},{name:"微软雅黑",also:["Microsoft YaHei","weiruanyahei","wryh"],css:'"Microsoft YaHei", "PingFang SC", sans-serif'},{name:"仿宋",also:["FangSong","fangsong","fs"],css:'"FangSong", "STFangsong", serif'},{name:"楷体",also:["KaiTi","kaiti","kt"],css:'"KaiTi", "Kaiti SC", "STKaiti", "Ma Shan Zheng", serif'},{name:"等线",also:["DengXian","dengxian","dx"],css:'"DengXian", "PingFang SC", sans-serif'},{name:"新宋体",also:["NSimSun","xinsongti","xst"],css:'"NSimSun", "Songti SC", serif'},{name:"Calibri",also:[],css:'"Calibri", "Carlito", sans-serif'},{name:"Arial",also:[],css:'"Arial", "Arimo", sans-serif'},{name:"Times New Roman",also:[],css:'"Times New Roman", "Tinos", serif'},{name:"Courier New",also:[],css:'"Courier New", "Cousine", monospace'},{name:"Cambria",also:[],css:'"Cambria", "Caladea", serif'},{name:"Verdana",also:[],css:"Verdana, sans-serif"},{name:"Georgia",also:[],css:"Georgia, serif"},{name:"Helvetica",also:[],css:'Helvetica, "Arimo", sans-serif'},{name:"Tahoma",also:[],css:"Tahoma, sans-serif"},{name:"Consolas",also:[],css:"Consolas, monospace"},{name:"Aptos",also:[],css:"Aptos, sans-serif"}];function WL(n,i){const o=i.trim().toLowerCase();return o?[n.name,...n.also].some(r=>r.toLowerCase().includes(o)):!0}const Ux=[6,8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72],a0=["General","Number","Currency","Accounting","Short Date","Long Date","Time","Percentage","Fraction","Scientific","Text"],Ie=()=>{window.requestAnimationFrame(()=>{var n;return(n=document.querySelector(".kui-text-sink"))==null?void 0:n.focus({preventScroll:!0})})};function QL({text:n,references:i}){let o=0;const r=i.map(u=>{const f=n.slice(o,u.start);o=u.end;const[h,v,p]=u.color;return s.jsxs("span",{children:[f,s.jsx("span",{"data-formula-reference":u.text,style:{color:`rgb(${h}, ${v}, ${p})`},children:n.slice(u.start,u.end)})]},u.start)});return s.jsxs(s.Fragment,{children:[r,n.slice(o)]})}const zg=8,O0=16;function JL(n){return{marks:n.commentAnchors,creates:n.commentAnchors&&n.hasService("comment.create")}}function Ix(n){try{return JSON.parse(n)}catch{return null}}async function eH(n){const i=Ix(await n("editor.commentAnchor",{}));if(!(i!=null&&i.anchor)||!Array.isArray(i.anchor.ids)||i.anchor.ids.length===0)throw new Error("the selection has no anchor");return i.anchor}async function jg(n,i){if(i.length===0)return[];const o=Ix(await n("editor.commentPlaces",{anchors:i.map(u=>({ids:u.ids}))})),r=Array.isArray(o==null?void 0:o.places)?o.places:[];return i.map((u,f)=>r[f]??{found:!1})}function tH(n,i){const o=[];return n.forEach((r,u)=>{const f=i[u];if(r.resolved||!(f!=null&&f.found)||!f.active||!Array.isArray(f.rect))return;const[h,v,p]=f.rect;[h,v,p].every(Number.isFinite)&&o.push({thread:r.id,x:h+p,y:v,count:r.count})}),o}function Ms(n,i,o,r){return{x:(o<i.left?o:o-n.x)*n.zoom,y:(r<i.top?r:r-n.y)*n.zoom}}function aH(n,i,o){const r=Ms(n,i,o.x,o.y),u=o.x>=i.left&&r.x<i.left*n.zoom,f=o.y>=i.top&&r.y<i.top*n.zoom;return u||f||r.x<=0||r.y<0||r.x>n.width||r.y>=n.height?null:{left:r.x-O0,top:r.y}}function nH(n){const i=n==null?void 0:n.data;return typeof(i==null?void 0:i.reason)=="string"?i.reason:null}function Vx({hint:n,pick:i,onPick:o,testId:r}){const{t:u}=ze(),f=n.functions[Math.min(i,n.functions.length-1)],h=n.call;return s.jsxs("div",{className:"sheet-formula-hints","data-testid":r,onPointerDown:v=>v.stopPropagation(),onMouseDown:v=>v.preventDefault(),children:[h&&!n.functions.length?s.jsx("div",{className:"sheet-formula-call","data-testid":`${r}-call`,children:h.bold?s.jsxs(s.Fragment,{children:[h.signature.slice(0,h.bold[0]),s.jsx("b",{children:h.signature.slice(h.bold[0],h.bold[1])}),h.signature.slice(h.bold[1])]}):h.signature}):null,n.functions.length?s.jsxs("div",{className:"sheet-formula-list-row",children:[s.jsx("ul",{className:"sheet-formula-list",role:"listbox","data-testid":`${r}-list`,children:n.functions.map((v,p)=>s.jsx("li",{role:"option","aria-selected":v===f,"data-name":v.name,ref:v===f?y=>y==null?void 0:y.scrollIntoView({block:"nearest"}):void 0,onClick:()=>o(v.name),"data-index":p,children:v.name},v.name))}),f?s.jsxs("div",{className:"sheet-formula-doc",children:[s.jsx("div",{className:"sheet-formula-doc-syntax",children:f.signature}),s.jsx("div",{"data-testid":`${r}-description`,children:N0(u,f.name,f.description)})]}):null]}):null]})}function lH({hint:n,views:i,pins:o,onPick:r}){const u=g.useSyncExternalStore(i.subscribe,i.get);if(!u||!n.at)return null;const f=Ms(u,o,n.at[0],n.at[1]);return f.x<0||f.y<0||f.x>u.width||f.y>u.height?null:s.jsx("div",{className:"sheet-cell-hints",style:{left:f.x,top:f.y+2},children:s.jsx(Vx,{hint:n,pick:n.pick,onPick:r,testId:"sheet-cell-hints"})})}let qx=null;const L0=new Set,H0=n=>{qx=n;for(const i of L0)i(n)},B0=(n={onChoose:()=>{},onCancel:Ie})=>H0(n),iH=["SUM","AVERAGE","IF","COUNT","MAX","MIN","VLOOKUP","SUMIF","COUNTIF","ROUND","IFERROR","TODAY"],rH=["Financial","DateTime","MathTrig","Statistical","Lookup","Database","Text","Logical","Information","Engineering","Compatibility","Web","Cube"];function sH(){const{query:n,t:i}=ze(),[o,r]=g.useState(qx),[u,f]=g.useState([]),[h,v]=g.useState(""),[p,y]=g.useState("common"),[m,x]=g.useState(null),b=g.useRef(null);g.useEffect(()=>(L0.add(r),()=>{L0.delete(r)}),[]),g.useEffect(()=>{o&&(v(""),y("common"),u.length||n("formulas.functions",{}).then(z=>f(Array.isArray(z)?z:[])))},[o]);const C=g.useMemo(()=>{const z=h.trim().toLowerCase();return z?u.filter(L=>L.name.toLowerCase().includes(z)||N0(i,L.name,L.description).toLowerCase().includes(z)):p==="common"?iH.map(L=>u.find(K=>K.name===L)).filter(L=>L!=null):p==="all"?u:u.filter(L=>L.category===p)},[u,p,h,i]);g.useEffect(()=>{x(z=>{var L;return z&&C.some(K=>K.name===z)?z:((L=C[0])==null?void 0:L.name)??null})},[C]);const E=C.find(z=>z.name===m)??null;if(!o)return null;const w=()=>{H0(null),o.onCancel()},T=z=>{z&&(H0(null),o.onChoose(z))},S=z=>{var K,X,re;if(!C.length)return;const L=Math.max(0,Math.min(C.length-1,C.findIndex(ae=>ae.name===m)+z));x(((K=C[L])==null?void 0:K.name)??null),(re=(X=b.current)==null?void 0:X.querySelector(`[data-index="${L}"]`))==null||re.scrollIntoView({block:"nearest"})};return s.jsx(da,{open:!0,onOpenChange:z=>z?void 0:w(),children:s.jsxs(fa,{size:"md",dismissible:!1,"aria-describedby":void 0,onCloseAutoFocus:z=>z.preventDefault(),"data-testid":"sheet-insert-function",children:[s.jsx(ma,{children:s.jsx(pa,{children:i("insertFunction")})}),s.jsx(ha,{children:s.jsxs("div",{className:"sheet-function-dialog",children:[s.jsxs("label",{className:"sheet-function-row",children:[s.jsx("span",{children:i("functionSearch")}),s.jsx("input",{className:"kui-field",value:h,autoFocus:!0,spellCheck:!1,onChange:z=>v(z.target.value),onKeyDown:z=>{z.key==="ArrowDown"||z.key==="ArrowUp"?(z.preventDefault(),S(z.key==="ArrowDown"?1:-1)):z.key==="Enter"&&(z.preventDefault(),T(m))},"data-testid":"sheet-insert-function-search"})]}),s.jsxs("label",{className:"sheet-function-row",children:[s.jsx("span",{children:i("functionCategory")}),s.jsx("select",{className:"kui-field",value:p,disabled:h.trim()!=="",onChange:z=>y(z.target.value),"data-testid":"sheet-insert-function-category",children:["common","all",...rH].map(z=>s.jsx("option",{value:z,children:i(`fnCategory:${z}`)},z))})]}),s.jsx("span",{children:i("functionPick")}),s.jsxs("ul",{ref:b,className:"sheet-function-list",role:"listbox","aria-label":i("functionPick"),"data-testid":"sheet-insert-function-list",children:[C.map((z,L)=>s.jsx("li",{role:"option","aria-selected":z.name===m,"data-name":z.name,"data-index":L,onClick:()=>x(z.name),onDoubleClick:()=>T(z.name),children:z.name},z.name)),!C.length&&u.length?s.jsx("li",{"aria-disabled":"true",children:i("functionNone")}):null]}),s.jsx("div",{className:"sheet-function-about","data-testid":"sheet-insert-function-about",children:E?s.jsxs(s.Fragment,{children:[s.jsx("b",{children:E.signature}),s.jsx("div",{children:N0(i,E.name,E.description)})]}):null})]})}),s.jsxs(va,{className:"sheet-dialog-actions",children:[s.jsx(De,{variant:"primary",disabled:!E,onClick:()=>T(m),"data-testid":"sheet-insert-function-ok",children:i("ok")}),s.jsx(De,{variant:"secondary",onClick:w,"data-testid":"sheet-insert-function-cancel",children:i("cancel")})]})]})})}const oH={b:"bold",i:"italic",u:"underline"},Tg=(n,i)=>Array.from(n.slice(0,i)).length,cH='[data-testid="sheet-formula"]',n0=n=>requestAnimationFrame(()=>{n.selectionEnd===n.value.length&&(n.scrollLeft=n.scrollWidth,n.scrollTop=n.scrollHeight)});function uH({info:n}){const{run:i,t:o}=ze(),r=gn(),u=r||n.checkbox&&!n.editing,[f,h]=g.useState(null),v=g.useRef(null),[p,y]=g.useState(null),m=g.useRef(!1),x=g.useRef(!1),[b,C]=g.useState(!1),E=p??(n.editing?n.editText??"":n.content),w=n.formulaText===E?n.formulaReferences:[],[T,S]=g.useState({left:0,top:0}),[z,L]=g.useState(null),[K,X]=g.useState(0),re=g.useRef(""),ae=(I,P,ue)=>{x.current=!0;const k=`${P}:${ue}:${I}`;k!==re.current&&(re.current=k,i("editor.formula",{text:I,start:P,end:ue}).then(B=>{if(!m.current)return;const W=B?JSON.parse(B):null;L((W==null?void 0:W.hint)??null)}))},de=(I,P,ue)=>{I.value=P,I.setSelectionRange(ue,ue),n0(I),y(P),X(0),ae(P,ue,ue)},ge=(I,P)=>{if(!(z!=null&&z.replace))return;const[ue,k]=z.replace,B=I.value.slice(k);de(I,I.value.slice(0,ue)+P+"("+(B.startsWith("(")?B.slice(1):B),ue+P.length+1)},je=()=>{var I;x.current=!1,re.current="",y(null),L(null),(I=v.current)==null||I.blur(),Ie()},be=I=>{const P=v.current,ue={enter:I};x.current&&p!=null&&P&&Object.assign(ue,{text:p,start:P.selectionStart,end:P.selectionEnd}),je(),i("editor.formula",ue)},Me=()=>{je(),i("editor.formula",{})},Be=(I,P,ue)=>{const k=v.current;k&&(x.current=!0,re.current=`${P}:${ue}:${I}`,k.value=I,k.focus({preventScroll:!0}),k.setSelectionRange(P,ue),n0(k),y(I))},ye=g.useRef({down:!1,grid:!1}),[F,A]=g.useState(0);g.useEffect(()=>{const I=k=>{ye.current={down:!0,grid:k.target instanceof Element&&k.target.closest('[data-testid="sheet-canvas-region"]')!=null}},P=()=>{const{grid:k}=ye.current;ye.current={down:!1,grid:k},k&&A(B=>B+1)},ue=k=>{k.target instanceof HTMLTextAreaElement&&k.target.classList.contains("kui-text-sink")&&(x.current=!1)};return window.addEventListener("pointerdown",I,!0),window.addEventListener("pointerup",P,!0),window.addEventListener("keydown",ue,!0),()=>{window.removeEventListener("pointerdown",I,!0),window.removeEventListener("pointerup",P,!0),window.removeEventListener("keydown",ue,!0)}},[]),g.useEffect(()=>{!F||!x.current||m.current||i("editor.formula",{peek:!0}).then(I=>{const P=I?JSON.parse(I):null;P!=null&&P.editing?P.pointing&&x.current&&!m.current&&!ye.current.down&&Be(P.text??"",P.end,P.end):x.current=!1})},[F]),g.useEffect(()=>{!n.editing&&!m.current&&!ye.current.down&&(x.current=!1)},[n.editing]);const H=async(I,P)=>{var xe,Ce;const[ue,k]=[I.selectionStart??0,I.selectionEnd??0],B=I.value;if(u||ue>=k||B.startsWith("="))return;const W=((xe=n.editCell)==null?void 0:xe.cell)??n.active,ie=((Ce=n.editCell)==null?void 0:Ce.sheet)??n.sheet;(x.current||n.editing)&&(y(null),x.current=!1,await i("editor.formula",{text:B,enter:"stay"})),await i("cell.formatText",{cell:W,sheet:ie,start:Tg(B,ue),end:Tg(B,k),toggle:P}),requestAnimationFrame(()=>{I.focus(),I.setSelectionRange(ue,k)})},le=()=>{const I=v.current;I&&m.current&&p!=null&&ae(p,I.selectionStart??p.length,I.selectionEnd??p.length);const P=x.current||n.editing;B0({onChoose:async ue=>{await i("formulas.insertFunction",{name:ue});const k=await i("editor.formula",{peek:!0}),B=k?JSON.parse(k):null;B!=null&&B.editing&&Be(B.text??"",B.end,B.end)},onCancel:()=>{if(!P)return Ie();i("editor.formula",{peek:!0}).then(ue=>{const k=ue?JSON.parse(ue):null;k!=null&&k.editing?Be(k.text??"",k.start,k.end):Ie()})}})},ve=n.editCell&&n.editCell.sheet!==n.sheet?n.editCell.cell:n.selection===n.active?n.active:n.selection,Z=p!=null||n.editing;return s.jsxs("div",{className:"kui-bar sheet-formula-bar","data-expanded":b,"data-testid":"sheet-formula-bar",children:[s.jsx("input",{className:"kui-field sheet-name-box",value:f??ve,"aria-label":o("nameBox"),spellCheck:!1,onFocus:I=>I.target.select(),onChange:I=>h(I.target.value),onBlur:()=>h(null),onKeyDown:I=>{I.key==="Enter"&&f?(n.editing&&i("editor.formula",{enter:"stay"}),i("edit.goTo",{reference:f.trim()}),h(null),I.currentTarget.blur()):I.key==="Escape"&&(I.preventDefault(),h(null),I.currentTarget.blur())},"data-testid":"sheet-name-box"}),s.jsx(ua,{icon:Jl,label:o("cancel"),disabled:!Z||u,onMouseDown:I=>I.preventDefault(),onClick:Me,"data-testid":"sheet-formula-cancel"}),s.jsx(ua,{icon:xs,label:o("enterFormula"),disabled:!Z||u,onMouseDown:I=>I.preventDefault(),onClick:()=>be("stay"),"data-testid":"sheet-formula-enter"}),s.jsx(ua,{icon:ps,label:o("insertFunction"),disabled:u,onMouseDown:I=>I.preventDefault(),onClick:le,"data-testid":"sheet-formula-fx"}),s.jsxs("div",{className:"sheet-formula-field","data-colored":w.length>0,children:[s.jsx("div",{className:"sheet-formula-colors","aria-hidden":"true",children:s.jsx("span",{style:{transform:`translate(${-T.left}px, ${-T.top}px)`},children:s.jsx(QL,{text:E,references:w})})}),s.jsx("textarea",{ref:v,className:"kui-field sheet-formula",value:E,rows:1,wrap:b?"soft":"off","aria-label":o("formula"),spellCheck:!1,readOnly:u,onMouseDown:I=>{n.checkbox&&!n.editing&&!r&&I.preventDefault()},onFocus:()=>{m.current=!0,!u&&n.editing&&(x.current=!0,y(n.editText??""))},onBlur:()=>{m.current=!1,re.current="",y(null),L(null)},onScroll:I=>S({left:I.currentTarget.scrollLeft,top:I.currentTarget.scrollTop}),onChange:I=>{if(u)return;const P=I.target;y(P.value),X(0),n0(P),ae(P.value,P.selectionStart??P.value.length,P.selectionEnd??P.value.length)},onSelect:I=>{const P=I.currentTarget;x.current&&p!=null&&m.current&&ae(P.value,P.selectionStart??0,P.selectionEnd??0)},onKeyDown:I=>{if(I.nativeEvent.isComposing||I.key==="Process")return;const P=I.metaKey||I.ctrlKey,ue=P&&!I.altKey&&!I.shiftKey?oH[I.key.toLowerCase()]:void 0,k=I.currentTarget,B=(z==null?void 0:z.functions.length)??0;if(ue)I.preventDefault(),H(k,ue);else if(P&&I.shiftKey&&I.key.toLowerCase()==="u")I.preventDefault(),C(W=>!W);else if(u)(I.key==="Escape"||I.key==="Enter")&&(I.preventDefault(),je());else if(I.key==="F4"&&k.value.startsWith("=")){I.preventDefault();const[W,ie]=[k.selectionStart??0,k.selectionEnd??0];i("editor.cycleReference",{text:k.value,start:W,end:ie}).then(xe=>{const Ce=xe?JSON.parse(xe):null;Ce&&Ce.text!==k.value&&de(k,Ce.text,Ce.start)})}else if(B&&(I.key==="ArrowDown"||I.key==="ArrowUp")&&!I.shiftKey)I.preventDefault(),X(W=>Math.max(0,Math.min(B-1,W+(I.key==="ArrowDown"?1:-1))));else if(B&&I.key==="Tab"&&!I.shiftKey){I.preventDefault();const W=z==null?void 0:z.functions[Math.min(K,B-1)];W&&ge(k,W.name)}else if(I.key==="Enter"&&(I.altKey||I.ctrlKey)){I.preventDefault();const[W,ie]=[k.selectionStart??0,k.selectionEnd??0];de(k,k.value.slice(0,W)+`
|
|
97
97
|
`+k.value.slice(ie),W+1)}else I.key==="Enter"&&!P?(I.preventDefault(),be(I.shiftKey?"up":"down")):I.key==="Tab"&&!P?(I.preventDefault(),be(I.shiftKey?"left":"right")):I.key==="Escape"&&(I.preventDefault(),Me())},"data-testid":"sheet-formula"}),z&&p!=null?s.jsx(Vx,{hint:z,pick:K,testId:"sheet-formula-hints",onPick:I=>{const P=document.querySelector(cH);P&&ge(P,I)}}):null]}),s.jsx(ua,{icon:b?TM:Ka,label:o(b?"collapseFormulaBar":"expandFormulaBar"),"aria-expanded":b,onMouseDown:I=>I.preventDefault(),onClick:()=>C(I=>!I),"data-testid":"sheet-formula-expand"})]})}let $x=null;const _0=new Set,zs=n=>{$x=n;for(const i of _0)i(n)},dH=n=>zs({kind:"delete",sheet:n}),jf=n=>zs({kind:"confirm",...n}),fH=(n,i,o)=>zs({kind:"confirm",title:n,message:i,testId:o,onOk:()=>{},alone:!0}),Gx=()=>zs({kind:"unhide"});function hH({info:n}){const{run:i,t:o}=ze(),[r,u]=g.useState($x),[f,h]=g.useState(null);g.useEffect(()=>(_0.add(u),()=>{_0.delete(u)}),[]);const v=n.tabs.filter(m=>m.hidden).map(m=>m.name);g.useEffect(()=>{(r==null?void 0:r.kind)==="unhide"&&h(m=>m&&v.includes(m)?m:v[0]??null)},[r,v.join("\0")]);const p=()=>zs(null),y=m=>{m.preventDefault(),Ie()};if((r==null?void 0:r.kind)==="delete"){const m=()=>{p(),i("home.deleteSheet",{sheet:r.sheet})};return s.jsx(da,{open:!0,onOpenChange:x=>x?void 0:p(),children:s.jsxs(fa,{size:"sm",dismissible:!1,"aria-describedby":void 0,onCloseAutoFocus:y,"data-testid":"sheet-delete-dialog",children:[s.jsx(ma,{children:s.jsx(pa,{children:o("deleteSheetTitle")})}),s.jsx(ha,{children:s.jsx("p",{"data-testid":"sheet-delete-message",children:o("deleteSheetConfirm",{sheet:r.sheet})})}),s.jsxs(va,{className:"sheet-dialog-actions",children:[s.jsx(De,{variant:"primary",onClick:m,"data-testid":"sheet-delete-confirm",children:o("deleteSheetOk")}),s.jsx(De,{variant:"secondary",onClick:p,"data-testid":"sheet-delete-cancel",children:o("cancel")})]})]})})}if((r==null?void 0:r.kind)==="confirm"){const m=()=>{p(),r.onOk()};return s.jsx(da,{open:!0,onOpenChange:x=>x?void 0:p(),children:s.jsxs(fa,{size:"sm",dismissible:!1,"aria-describedby":void 0,onCloseAutoFocus:y,"data-testid":r.testId,children:[s.jsx(ma,{children:s.jsx(pa,{children:r.title})}),s.jsx(ha,{children:s.jsx("p",{"data-testid":`${r.testId}-message`,children:r.message})}),s.jsxs(va,{className:"sheet-dialog-actions",children:[s.jsx(De,{variant:"primary",onClick:m,"data-testid":`${r.testId}-ok`,children:o("ok")}),r.alone?null:s.jsx(De,{variant:"secondary",onClick:p,"data-testid":`${r.testId}-cancel`,children:o("cancel")})]})]})})}if((r==null?void 0:r.kind)==="unhide"){const m=()=>{p(),f&&i("sheet.unhide",{sheet:f})};return s.jsx(da,{open:!0,onOpenChange:x=>x?void 0:p(),children:s.jsxs(fa,{size:"sm",dismissible:!1,"aria-describedby":void 0,onCloseAutoFocus:y,"data-testid":"sheet-unhide-dialog",children:[s.jsx(ma,{children:s.jsx(pa,{children:o("unhideSheetTitle")})}),s.jsxs(ha,{children:[s.jsx("p",{children:o("unhideSheetPrompt")}),s.jsx("div",{className:"sheet-unhide-list",role:"listbox","aria-label":o("unhideSheetPrompt"),children:v.map(x=>s.jsx("button",{type:"button",role:"option",className:"sheet-unhide-option","aria-selected":x===f,onClick:()=>h(x),onDoubleClick:()=>{p(),i("sheet.unhide",{sheet:x})},"data-testid":`sheet-unhide-option-${x}`,children:x},x))})]}),s.jsxs(va,{className:"sheet-dialog-actions",children:[s.jsx(De,{variant:"primary",disabled:!f,onClick:m,"data-testid":"sheet-unhide-ok",children:o("ok")}),s.jsx(De,{variant:"secondary",onClick:p,"data-testid":"sheet-unhide-cancel",children:o("cancel")})]})]})})}return null}const kg=4,sc=12,Ag=28,Ng=160,l0=n=>n.replace(/[A-Z]/g,i=>i.toLowerCase());function mH(n,i,o){const r=n.trim();return r?/[:\\/?*[\]]/.test(r)?"sheetNameInvalid":r.startsWith("'")||r.endsWith("'")?"sheetNameApostrophe":l0(r)==="history"?"sheetNameReserved":o.some(u=>u!==i&&l0(u)===l0(r))?"sheetNameTaken":null:"sheetNameEmpty"}const vH=n=>Math.max(4,[...n].reduce((i,o)=>i+((o.codePointAt(0)??0)>11903?2:1),0))+2;function pH({info:n}){const{run:i,t:o}=ze(),r=gn(),[u,f]=g.useState(null),[h,v]=g.useState(""),[p,y]=g.useState(null),[m,x]=g.useState(null),[b,C]=g.useState(null),E=g.useRef(null),w=g.useRef(new Map),T=g.useRef(null),S=g.useRef(u);S.current=u;const z=g.useRef(!1),L=n.tabs,K=L.filter($=>!$.hidden),X=$=>L.findIndex(te=>te.name===$),re=$=>{$!==n.sheet&&i("sheet.activate",{sheet:$})},ae=g.useRef({visible:K,tabs:L,run:i,activate:re});ae.current={visible:K,tabs:L,run:i,activate:re};const de=g.useRef(null),ge=async($=!1)=>{const te=de.current;if(!te||te!==u)return;const Te=h.trim(),_e=Te===te?null:mH(h,te,L.map(J=>J.name));_e&&(Xt("error",o(_e)),$)||(de.current=null,f(null),$&&Ie(),!_e&&Te!==te&&await i("sheet.rename",{sheet:te,name:Te}))},je=()=>{de.current=null,f(null),Ie()},be=$=>{r||(de.current=$,v($),f($))},Me=async $=>{const te=await i("sheet.move",{sheet:$,to:X($)+1,copy:!0});let Te=null;try{Te=te?JSON.parse(te).name:null}catch{Te=null}typeof Te=="string"&&be(Te)},Be=g.useRef(ge);Be.current=ge;const ye=K.map($=>$.name).join("\0");g.useLayoutEffect(()=>{const $=E.current,te=w.current.get(n.sheet);if(!$||!te)return;const Te=te.offsetLeft,_e=Te+te.offsetWidth;Te<$.scrollLeft?$.scrollLeft=Te:_e>$.scrollLeft+$.clientWidth&&($.scrollLeft=_e-$.clientWidth)},[n.sheet,ye]);const F=g.useCallback(($,te,Te)=>{var O,oe;const _e=(O=E.current)==null?void 0:O.getBoundingClientRect();if(!_e||Te<_e.top-sc||Te>_e.bottom+sc||te<_e.left||te>_e.right)return null;const J=ae.current.visible,he=J.findIndex(fe=>fe.name===$);let Ee=0;for(const fe of J){if(fe.name===$)continue;const N=(oe=w.current.get(fe.name))==null?void 0:oe.getBoundingClientRect();N&&te>N.left+N.width/2&&(Ee+=1)}return he>=0&&Ee>=he?Ee+1:Ee},[]),A=g.useCallback(($,te)=>{const{visible:Te,tabs:_e}=ae.current,J=Te.findIndex(Ee=>Ee.name===$);if(J<0||te===J||te===J+1)return null;const he=_e.filter(Ee=>Ee.name!==$).map(Ee=>Ee.name);return te<Te.length?he.indexOf(Te[te].name):he.indexOf(Te[Te.length-1].name)+1},[]),H=$=>{T.current=$,C($)},le=g.useCallback($=>{const te=T.current;if(!te)return;T.current=null,C(null);const Te=w.current.get(te.sheet);if(Te!=null&&Te.hasPointerCapture(te.pointer)&&Te.releasePointerCapture(te.pointer),z.current=!0,window.setTimeout(()=>{z.current=!1},0),!te.moving){$&&ae.current.activate(te.sheet);return}if(!$||te.slot==null)return;const _e=A(te.sheet,te.slot);_e!=null&&ae.current.run("sheet.move",{sheet:te.sheet,to:_e})},[A]),ve=b!=null;g.useEffect(()=>{if(!ve)return;const $=J=>{var N,G;const he=T.current;if(!he||J.pointerId!==he.pointer)return;if(J.buttons===0){le(!1);return}const Ee=Math.abs(J.clientX-he.startX)>kg||Math.abs(J.clientY-he.startY)>kg,O=(N=w.current.get(he.sheet))==null?void 0:N.getBoundingClientRect(),oe=!O||J.clientX<O.left||J.clientX>O.right,fe=he.moving||he.canDrag&&Ee&&(!he.fromField||oe);fe&&!he.moving&&(S.current===he.sheet&&Be.current(),(G=w.current.get(he.sheet))==null||G.setPointerCapture(he.pointer)),H({...he,x:J.clientX,y:J.clientY,moving:fe,slot:fe?F(he.sheet,J.clientX,J.clientY):null})},te=J=>{T.current&&J.pointerId===T.current.pointer&&le(!0)},Te=()=>le(!1),_e=J=>{var he;J.key!=="Escape"||!((he=T.current)!=null&&he.moving)||(J.preventDefault(),J.stopPropagation(),le(!1))};return window.addEventListener("pointermove",$,!0),window.addEventListener("pointerup",te,!0),window.addEventListener("pointercancel",Te,!0),window.addEventListener("keydown",_e,!0),window.addEventListener("blur",Te),()=>{window.removeEventListener("pointermove",$,!0),window.removeEventListener("pointerup",te,!0),window.removeEventListener("pointercancel",Te,!0),window.removeEventListener("keydown",_e,!0),window.removeEventListener("blur",Te)}},[ve,le,F]);const Z=(b==null?void 0:b.moving)===!0;g.useEffect(()=>{if(!Z)return;const $=window.setInterval(()=>{const te=T.current,Te=E.current;if(!te||!Te)return;const _e=Te.getBoundingClientRect();if(te.y<_e.top-sc||te.y>_e.bottom+sc)return;const J=te.x>_e.right-Ag?12:te.x<_e.left+Ag?-12:0;if(!J)return;const he=Te.scrollLeft;Te.scrollLeft=he+J,Te.scrollLeft!==he&&H({...te,slot:F(te.sheet,te.x,te.y)})},30);return()=>window.clearInterval($)},[Z,F]);const I=($,te)=>{if(te.button!==0)return;const Te=te.target instanceof HTMLInputElement,_e=te.currentTarget.getBoundingClientRect(),J={dx:te.clientX-_e.left,top:_e.top,height:_e.height},he=!r&&K.length>1;H({sheet:$,pointer:te.pointerId,startX:te.clientX,startY:te.clientY,x:te.clientX,y:te.clientY,moving:!1,fromField:Te,canDrag:he,grab:J,slot:null})},P=($,te)=>{x(null),y({sheet:$,at:te})},ue=p!=null||m!=null;g.useEffect(()=>{if(!ue)return;const $=()=>{y(null),x(null)};return window.addEventListener("blur",$),()=>window.removeEventListener("blur",$)},[ue]);const k=g.useRef(null);g.useLayoutEffect(()=>{var Te;const $=(Te=k.current)==null?void 0:Te.getBoundingClientRect().top,te=(_e,J,he)=>{var oe;const Ee=(oe=k.current)==null?void 0:oe.ownerDocument.querySelector(`[data-testid="${_e}"]`);if(!J||$==null||!Ee)return;const O=Math.max(4,$-Ee.offsetHeight-2);J.y!==O&&he({x:J.x,y:O})};te("sheet-menu",(p==null?void 0:p.at)??null,_e=>y(J=>J&&{...J,at:_e})),te("sheet-list",m,x)},[p,m]);let B=null;if(b!=null&&b.moving&&b.slot!=null&&A(b.sheet,b.slot)!=null){const $=K[b.slot],te=K[b.slot-1],Te=$?w.current.get($.name):te?w.current.get(te.name):void 0;Te&&(B=$?Te.offsetLeft-1:Te.offsetLeft+Te.offsetWidth+1)}const W=(b==null?void 0:b.moving)===!0&&b.slot==null,ie=p?L.find($=>$.name===p.sheet)??null:null,xe=ie?X(ie.name):-1,Ce=xe>0,He=xe>=0&&xe<L.length-1;return s.jsxs("div",{ref:k,className:"sheet-tabs","data-testid":"sheet-tabs","data-drop":W?"none":void 0,children:[s.jsx(ua,{icon:UM,label:o("sheetList"),onClick:$=>{const te=$.currentTarget.getBoundingClientRect();y(null),x({x:te.left,y:te.top})},"data-testid":"sheet-list-button"}),s.jsx(ua,{icon:sf,label:o("addSheet"),disabled:r,onClick:()=>void i("home.insertSheet",{before:L.length}),"data-testid":"sheet-add"}),s.jsxs("div",{ref:E,className:"sheet-strip",role:"tablist","data-testid":"sheet-strip",onWheel:$=>{Math.abs($.deltaY)>Math.abs($.deltaX)&&($.currentTarget.scrollLeft+=$.deltaY)},children:[K.map($=>s.jsx(gH,{tab:$,active:$.name===n.sheet,dragging:(b==null?void 0:b.moving)===!0&&b.sheet===$.name,renaming:u===$.name,name:h,readOnly:r,menuLabel:o("sheetMenu"),lockLabel:o("sheetLocked"),refFor:te=>{te?w.current.set($.name,te):w.current.delete($.name)},onName:v,onRename:te=>void ge(te),onCancelRename:je,onPress:te=>I($.name,te),onClick:()=>{z.current||re($.name)},onDoubleClick:()=>be($.name),onContextMenu:te=>{te.preventDefault(),!r&&(re($.name),P($.name,{x:te.clientX,y:te.clientY}))},onMenu:te=>{const Te=te.currentTarget.getBoundingClientRect();P($.name,{x:Te.left,y:Te.top})}},$.name)),B!=null?s.jsx("div",{className:"sheet-drop-mark",style:{left:B},"data-slot":(b==null?void 0:b.slot)??void 0,"data-testid":"sheet-drop-mark"}):null]}),b!=null&&b.moving?s.jsx("div",{className:"sheet-tab sheet-tab-ghost",style:{left:b.x-b.grab.dx,top:b.grab.top,height:b.grab.height},"aria-hidden":"true","data-testid":"sheet-drag-ghost",children:s.jsx("span",{className:"sheet-tab-name",children:b.sheet})}):null,s.jsx(ua,{icon:J0,label:o("sheetScrollLeft"),onClick:()=>{var $;return($=E.current)==null?void 0:$.scrollBy({left:-Ng})},"data-testid":"sheet-scroll-left"}),s.jsx(ua,{icon:Bc,label:o("sheetScrollRight"),onClick:()=>{var $;return($=E.current)==null?void 0:$.scrollBy({left:Ng})},"data-testid":"sheet-scroll-right"}),s.jsx(g0,{at:m,onClose:()=>x(null),label:o("sheetList"),testId:"sheet-list",children:s.jsx("div",{className:"sheet-list",children:L.map($=>s.jsxs("div",{className:"sheet-list-row","data-hidden":$.hidden||void 0,children:[s.jsx("span",{className:"sheet-list-color",style:$.color?{background:$.color}:void 0,"data-color":$.color??void 0,"data-testid":`sheet-list-color-${$.name}`}),s.jsx(we,{label:$.name,shortcut:$.hidden?o("sheetHidden"):null,checked:$.name===n.sheet,disabled:$.hidden,onSelect:()=>re($.name),testId:`sheet-list-item-${$.name}`}),$.hidden?s.jsx("button",{type:"button",className:"sheet-list-unhide",title:o("unhideSheet"),"aria-label":o("unhideSheet"),onClick:te=>{te.stopPropagation(),r||i("sheet.unhide",{sheet:$.name,activate:!1})},"data-testid":`sheet-list-unhide-${$.name}`,children:s.jsx(d0,{size:14,"aria-hidden":"true"})}):null]},$.name))})}),s.jsx(g0,{at:(p==null?void 0:p.at)??null,onClose:()=>y(null),label:o("sheetMenu"),testId:"sheet-menu",children:ie?s.jsxs(s.Fragment,{children:[r?s.jsx(we,{label:o("addSheet"),disabled:!0,onSelect:()=>{},testId:"sheet-menu-insert"}):s.jsxs(bl,{label:o("addSheet"),path:"Sheet Tab/New Sheet",testId:"sheet-menu-insert",children:[s.jsx(we,{label:o("insertSheetBefore"),onSelect:()=>void i("home.insertSheet",{before:xe}),testId:"sheet-menu-insert-before"}),s.jsx(we,{label:o("insertSheetAfter"),onSelect:()=>void i("home.insertSheet",{before:xe+1}),testId:"sheet-menu-insert-after"})]}),s.jsx(we,{label:o("renameSheet"),disabled:r,onSelect:()=>be(ie.name),testId:"sheet-menu-rename"}),r||!Ce&&!He?s.jsx(we,{label:o("moveSheet"),disabled:!0,onSelect:()=>{},testId:"sheet-menu-move"}):s.jsxs(bl,{label:o("moveSheet"),path:"Sheet Tab/Move",testId:"sheet-menu-move",children:[Ce?s.jsx(we,{label:o("moveSheetLeft"),onSelect:()=>void i("sheet.move",{sheet:ie.name,to:xe-1}),testId:"sheet-menu-move-left"}):null,He?s.jsx(we,{label:o("moveSheetRight"),onSelect:()=>void i("sheet.move",{sheet:ie.name,to:xe+1}),testId:"sheet-menu-move-right"}):null]}),s.jsx(we,{label:o("copySheet"),disabled:r,onSelect:()=>void Me(ie.name),testId:"sheet-menu-copy"}),r?s.jsx(we,{label:o("tabColor"),disabled:!0,onSelect:()=>{},testId:"sheet-menu-color"}):s.jsxs(bl,{label:o("tabColor"),path:"Sheet Tab/Tab Color",testId:"sheet-menu-color",children:[s.jsx(we,{label:o("noTabColor"),onSelect:()=>void i("sheet.tabColor",{sheet:ie.name,color:"none"}),testId:"sheet-menu-no-color"}),s.jsx(pn,{onPick:$=>void i("sheet.tabColor",{sheet:ie.name,color:$}),testId:"sheet-menu-colors"})]}),r||K.length>1?s.jsx(we,{label:o("hideSheet"),disabled:r,onSelect:()=>void i("sheet.hide",{sheet:ie.name}),testId:"sheet-menu-hide"}):s.jsx("span",{className:"sheet-menu-hint",title:o("hideNeedsTwo"),"data-testid":"sheet-menu-hide-hint",children:s.jsx(we,{label:o("hideSheet"),disabled:!0,onSelect:()=>{},testId:"sheet-menu-hide"})}),s.jsx(St,{}),s.jsx(we,{label:o("deleteSheet"),disabled:r||L.length<2,onSelect:()=>dH(ie.name),testId:"sheet-menu-delete"})]}):null})]})}function gH(n){const{tab:i,active:o,dragging:r,renaming:u}=n;return s.jsxs("div",{ref:n.refFor,role:"tab",tabIndex:o?0:-1,className:"sheet-tab","aria-selected":o,title:i.name,"data-color":i.color??void 0,"data-dragging":r||void 0,style:i.color?{"--sheet-tab-color":i.color}:void 0,onPointerDown:n.onPress,onClick:n.onClick,onDoubleClick:n.onDoubleClick,onContextMenu:n.onContextMenu,"data-testid":`sheet-tab-${i.name}`,children:[i.protected?s.jsx("span",{className:"sheet-tab-lock",role:"img","aria-label":n.lockLabel,title:n.lockLabel,"data-testid":`sheet-lock-${i.name}`,children:s.jsx(Ic,{size:12,"aria-hidden":"true"})}):null,u?s.jsx("input",{className:"kui-field sheet-tab-rename",autoFocus:!0,maxLength:31,value:n.name,style:{width:`${vH(n.name)}ch`},onFocus:f=>f.currentTarget.select(),onChange:f=>n.onName(f.target.value),onBlur:()=>n.onRename(!1),onClick:f=>f.stopPropagation(),onDoubleClick:f=>f.stopPropagation(),onKeyDown:f=>{f.key==="Enter"&&n.onRename(!0),f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),n.onCancelRename())},"data-testid":"sheet-rename"}):s.jsx("span",{className:"sheet-tab-name",children:i.name}),o?s.jsx("button",{type:"button",className:"sheet-tab-arrow","aria-label":n.menuLabel,title:n.menuLabel,onPointerDown:f=>f.stopPropagation(),onClick:f=>{f.stopPropagation(),n.onMenu(f)},"data-testid":"sheet-menu-arrow",children:s.jsx(Ka,{size:12,"aria-hidden":"true"})}):null]})}const yH=[{key:"filterEquals",op:"="},{key:"filterNotEquals",op:"<>"},{key:"filterBeginsWith",op:"beginsWith"},{key:"filterEndsWith",op:"endsWith"},{key:"filterContains",op:"contains"},{key:"filterNotContains",op:"notContains"}],bH=[{key:"filterEquals",op:"="},{key:"filterNotEquals",op:"<>"},{key:"filterGreater",op:">"},{key:"filterGreaterOrEqual",op:">="},{key:"filterLess",op:"<"},{key:"filterLessOrEqual",op:"<="},{key:"filterBetween",op:">=",op2:"<="}],Rg=["=","<>",">",">=","<","<=","beginsWith","endsWith","contains","notContains"],Dg={"=":"filterEquals","<>":"filterNotEquals",">":"filterGreater",">=":"filterGreaterOrEqual","<":"filterLess","<=":"filterLessOrEqual",beginsWith:"filterBeginsWith",endsWith:"filterEndsWith",contains:"filterContains",notContains:"filterNotContains"};let Px=null;const F0=new Set,Kx=n=>{Px=n;for(const i of F0)i(n)};function MH({views:n,pins:i}){const{run:o,t:r}=ze(),u=g.useSyncExternalStore(n.subscribe,n.get),[f,h]=g.useState(Px),[v,p]=g.useState(null),[y,m]=g.useState(new Set),[x,b]=g.useState(!0),[C,E]=g.useState(""),[w,T]=g.useState(!1),[S,z]=g.useState(null),[L,K]=g.useState(null),X=g.useRef(null);g.useEffect(()=>(F0.add(h),()=>{F0.delete(h)}),[]),g.useEffect(()=>{if(p(null),E(""),T(!1),!f)return;let H=!0;return o("data.filterValues",{cell:f.cell}).then(le=>{var Z;if(!H||!le)return;const ve=JSON.parse(le);p(ve),m(new Set(ve.values.filter(I=>I.checked).map(I=>I.text))),b(((Z=ve.blanks)==null?void 0:Z.checked)??!0)}),()=>{H=!1}},[f,o]),g.useEffect(()=>{if(!f||S||L)return;const H=ve=>{X.current&&ve.target instanceof Node&&!X.current.contains(ve.target)&&ae()},le=ve=>{ve.key==="Escape"&&(ve.stopPropagation(),ae())};return window.addEventListener("pointerdown",H,!0),window.addEventListener("keydown",le,!0),()=>{window.removeEventListener("pointerdown",H,!0),window.removeEventListener("keydown",le,!0)}});const re=g.useMemo(()=>{if(!v)return[];const H=C.trim().toLowerCase();return H?v.values.filter(le=>le.text.toLowerCase().includes(H)):v.values},[v,C]);function ae(){Kx(null),Ie()}const de=async H=>{f&&(ae(),await o("data.filterBy",{cell:f.cell,...H}))},ge=async H=>{v&&(ae(),await o("data.sort",{range:v.range,header:!0,keys:[{column:v.column,order:H}]}))},je=()=>{if(!v)return;const H=C.trim()!=="",le=re.filter(I=>y.has(I.text)).map(I=>I.text),ve=v.blanks!=null&&x&&!H,Z=!H&&le.length===v.values.length&&(v.blanks==null||x);de(Z?{clear:!0}:{values:le,blanks:ve})};if(!f||!u)return null;const be=Ms(u,i,f.cellRect[0],f.cellRect[3]),Me=re.length>0&&re.every(H=>y.has(H.text))&&(C.trim()!==""||(v==null?void 0:v.blanks)==null||x),Be=()=>{const H=new Set(y);for(const le of re)Me?H.delete(le.text):H.add(le.text);m(H),C.trim()||b(!Me)},ye=(v==null?void 0:v.kind)==="number"?r("filterNumber"):(v==null?void 0:v.kind)==="date"?r("filterDate"):r("filterText"),F=(v==null?void 0:v.kind)==="text"?yH:bH,A=H=>H===""?r("filterEmptyText"):H;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{ref:X,className:"sheet-filter-menu",style:{left:Math.max(0,be.x),top:be.y+1},role:"dialog","aria-label":r("filterTitle"),"data-testid":"sheet-filter-menu",onPointerDown:H=>H.stopPropagation(),onKeyDown:H=>{H.key==="Enter"&&!(H.target instanceof HTMLButtonElement)&&je(),H.stopPropagation()},children:[s.jsxs("div",{className:"sheet-filter-sort",children:[s.jsx("button",{type:"button",onClick:()=>void ge("asc"),"data-testid":"sheet-filter-asc",children:r("filterAscending")}),s.jsx("button",{type:"button",onClick:()=>void ge("desc"),"data-testid":"sheet-filter-desc",children:r("filterDescending")})]}),s.jsxs("div",{className:"sheet-filter-tabs",children:[s.jsx("span",{className:"sheet-filter-tab","aria-current":"true",children:r("filterContent")}),s.jsxs("button",{type:"button",className:"sheet-filter-tab","aria-expanded":w,onClick:()=>T(!w),"data-testid":"sheet-filter-conditions",children:[ye," ▾"]})]}),w?s.jsxs("div",{className:"sheet-filter-conditions",role:"menu","data-testid":"sheet-filter-condition-list",children:[F.map(H=>s.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{T(!1),z({op:H.op,value:"",op2:H.op2??"=",value2:"",and:!0})},"data-testid":`sheet-filter-cond-${H.key}`,children:[r(H.key),"…"]},H.key)),(v==null?void 0:v.kind)!=="text"?s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",role:"menuitem",onClick:()=>K({bottom:!1,count:"10",percent:!1}),"data-testid":"sheet-filter-cond-top",children:[r("filterTop"),"…"]}),s.jsx("button",{type:"button",role:"menuitem",onClick:()=>void de({aboveAverage:!0}),"data-testid":"sheet-filter-cond-above",children:r("filterAboveAverage")}),s.jsx("button",{type:"button",role:"menuitem",onClick:()=>void de({aboveAverage:!1}),"data-testid":"sheet-filter-cond-below",children:r("filterBelowAverage")})]}):null,s.jsxs("button",{type:"button",role:"menuitem",onClick:()=>z({op:"=",value:"",op2:"=",value2:"",and:!0}),"data-testid":"sheet-filter-cond-custom",children:[r("filterCustom"),"…"]})]}):null,s.jsx("input",{className:"sheet-filter-search",type:"search",value:C,placeholder:r("filterSearch"),onChange:H=>E(H.target.value),"data-testid":"sheet-filter-search"}),s.jsx("div",{className:"sheet-filter-list",role:"listbox","aria-multiselectable":"true","data-testid":"sheet-filter-list",children:v?s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"sheet-filter-item",children:[s.jsx("input",{type:"checkbox",checked:Me,onChange:Be,"data-testid":"sheet-filter-all"}),C.trim()?r("filterAllResults"):r("filterAll")]}),re.map(H=>s.jsxs("label",{className:"sheet-filter-item",children:[s.jsx("input",{type:"checkbox",checked:y.has(H.text),onChange:()=>{const le=new Set(y);le.has(H.text)?le.delete(H.text):le.add(H.text),m(le)},"data-testid":`sheet-filter-item-${H.text}`}),s.jsx("span",{className:"sheet-filter-text",children:A(H.text)}),s.jsxs("span",{className:"sheet-filter-count",children:["(",H.count,")"]})]},H.text)),v.blanks&&!C.trim()?s.jsxs("label",{className:"sheet-filter-item",children:[s.jsx("input",{type:"checkbox",checked:x,onChange:()=>b(!x),"data-testid":"sheet-filter-blanks"}),s.jsx("span",{className:"sheet-filter-text",children:r("filterBlanks")}),s.jsxs("span",{className:"sheet-filter-count",children:["(",v.blanks.count,")"]})]}):null,!re.length&&C.trim()?s.jsx("div",{className:"sheet-filter-none",children:r("filterNoMatch")}):null]}):null}),s.jsxs("div",{className:"sheet-filter-actions",children:[s.jsx("button",{type:"button",className:"sheet-filter-clear",onClick:()=>void de({clear:!0}),disabled:!(v!=null&&v.criterion),"data-testid":"sheet-filter-clear",children:r("filterClear")}),s.jsx("span",{className:"sheet-filter-spacer"}),s.jsx(De,{variant:"primary",onClick:je,disabled:!v,"data-testid":"sheet-filter-ok",children:r("ok")}),s.jsx(De,{variant:"secondary",onClick:ae,"data-testid":"sheet-filter-cancel",children:r("cancel")})]})]}),S?s.jsx(da,{open:!0,onOpenChange:H=>H?void 0:z(null),children:s.jsxs(fa,{size:"sm",dismissible:!1,"aria-describedby":void 0,"data-testid":"sheet-filter-custom",children:[s.jsx(ma,{children:s.jsx(pa,{children:r("filterCustomTitle")})}),s.jsxs(ha,{children:[s.jsx("p",{className:"sheet-filter-custom-label",children:r("filterShowRows",{column:(v==null?void 0:v.header)||(v==null?void 0:v.column)||""})}),s.jsxs("div",{className:"sheet-filter-custom-row",children:[s.jsx("select",{value:S.op,onChange:H=>z({...S,op:H.target.value}),"data-testid":"sheet-filter-custom-op",children:Rg.map(H=>s.jsx("option",{value:H,children:r(Dg[H]??"filterEquals")},H))}),s.jsx("input",{value:S.value,onChange:H=>z({...S,value:H.target.value}),autoFocus:!0,"data-testid":"sheet-filter-custom-value"})]}),s.jsxs("div",{className:"sheet-filter-custom-join",children:[s.jsxs("label",{children:[s.jsx("input",{type:"radio",checked:S.and,onChange:()=>z({...S,and:!0}),"data-testid":"sheet-filter-custom-and"}),r("filterAnd")]}),s.jsxs("label",{children:[s.jsx("input",{type:"radio",checked:!S.and,onChange:()=>z({...S,and:!1}),"data-testid":"sheet-filter-custom-or"}),r("filterOr")]})]}),s.jsxs("div",{className:"sheet-filter-custom-row",children:[s.jsx("select",{value:S.op2,onChange:H=>z({...S,op2:H.target.value}),"data-testid":"sheet-filter-custom-op2",children:Rg.map(H=>s.jsx("option",{value:H,children:r(Dg[H]??"filterEquals")},H))}),s.jsx("input",{value:S.value2,onChange:H=>z({...S,value2:H.target.value}),"data-testid":"sheet-filter-custom-value2"})]})]}),s.jsxs(va,{className:"sheet-dialog-actions",children:[s.jsx(De,{variant:"primary",disabled:!S.value.trim(),onClick:()=>{const H=S.value2.trim()?{op2:S.op2,value2:S.value2.trim()}:{};z(null),de({custom:{op:S.op,value:S.value.trim(),...H,and:S.and}})},"data-testid":"sheet-filter-custom-ok",children:r("ok")}),s.jsx(De,{variant:"secondary",onClick:()=>z(null),"data-testid":"sheet-filter-custom-cancel",children:r("cancel")})]})]})}):null,L?s.jsx(da,{open:!0,onOpenChange:H=>H?void 0:K(null),children:s.jsxs(fa,{size:"sm",dismissible:!1,"aria-describedby":void 0,"data-testid":"sheet-filter-top",children:[s.jsx(ma,{children:s.jsx(pa,{children:r("filterTopTitle")})}),s.jsx(ha,{children:s.jsxs("div",{className:"sheet-filter-custom-row",children:[s.jsxs("select",{value:L.bottom?"bottom":"top",onChange:H=>K({...L,bottom:H.target.value==="bottom"}),"data-testid":"sheet-filter-top-which",children:[s.jsx("option",{value:"top",children:r("filterLargest")}),s.jsx("option",{value:"bottom",children:r("filterSmallest")})]}),s.jsx("input",{value:L.count,inputMode:"numeric",onChange:H=>K({...L,count:H.target.value.replace(/[^0-9]/g,"")}),"data-testid":"sheet-filter-top-count"}),s.jsxs("select",{value:L.percent?"percent":"items",onChange:H=>K({...L,percent:H.target.value==="percent"}),"data-testid":"sheet-filter-top-unit",children:[s.jsx("option",{value:"items",children:r("filterItems")}),s.jsx("option",{value:"percent",children:r("filterPercent")})]})]})}),s.jsxs(va,{className:"sheet-dialog-actions",children:[s.jsx(De,{variant:"primary",disabled:!Number(L.count),onClick:()=>{K(null),de({top:{count:Math.min(500,Number(L.count)),bottom:L.bottom,percent:L.percent}})},"data-testid":"sheet-filter-top-ok",children:r("ok")}),s.jsx(De,{variant:"secondary",onClick:()=>K(null),"data-testid":"sheet-filter-top-cancel",children:r("cancel")})]})]})}):null]})}const Tf=n=>({value:n,listeners:new Set}),js=(n,i)=>{n.value=i;for(const o of n.listeners)o(i)},kf=n=>{const[i,o]=g.useState(n.value);return g.useEffect(()=>(n.listeners.add(o),()=>{n.listeners.delete(o)}),[n]),i},U0=Tf(null),Yx=Tf(!1),I0=Tf(!1),xH=n=>js(U0,n),Zl=(n=!0)=>js(Yx,n),Og=()=>js(I0,!0);function SH({info:n,views:i,pins:o}){const{run:r,t:u}=ze(),f=g.useSyncExternalStore(i.subscribe,i.get),h=kf(Yx),v=g.useRef(null),p=n.validation;if(g.useEffect(()=>{h&&(!(p!=null&&p.list)||n.editing)&&Zl(!1)},[n.active,n.editing,n.sheet]),g.useEffect(()=>{if(!h)return;const S=L=>{v.current&&L.target instanceof Node&&!v.current.contains(L.target)&&Zl(!1)},z=L=>{L.key==="Escape"&&(L.stopPropagation(),Zl(!1),Ie())};return window.addEventListener("pointerdown",S,!0),window.addEventListener("keydown",z,!0),()=>{window.removeEventListener("pointerdown",S,!0),window.removeEventListener("keydown",z,!0)}},[h]),!p||!f||n.editing||n.shape)return null;const[y,m,x,b]=p.rect,C=Ms(f,o,y,m),E=Ms(f,o,x,b);if(E.x<0||E.y<0||C.x>f.width||C.y>f.height)return null;const w=Math.max(12,E.y-C.y),T=async S=>{Zl(!1),await r("cell.set",{cell:p.cell,input:S}),Ie()};return s.jsxs(s.Fragment,{children:[p.list?s.jsx("button",{type:"button",className:"sheet-validation-arrow",style:{left:E.x+1,top:C.y,height:w},"aria-label":u("validationPick"),"aria-expanded":h,onPointerDown:S=>S.stopPropagation(),onMouseDown:S=>S.preventDefault(),onClick:()=>Zl(!h),"data-testid":"sheet-validation-arrow",children:s.jsx("svg",{width:"8",height:"5",viewBox:"0 0 8 5","aria-hidden":"true",children:s.jsx("path",{d:"M0 0h8L4 5z",fill:"currentColor"})})}):null,h&&p.list?s.jsx("div",{ref:v,className:"sheet-validation-list",role:"listbox",style:{left:C.x,top:E.y+1,minWidth:Math.max(60,E.x-C.x+18)},onPointerDown:S=>S.stopPropagation(),onMouseDown:S=>S.preventDefault(),"data-testid":"sheet-validation-list",children:p.list.map((S,z)=>s.jsx("button",{type:"button",role:"option","aria-selected":n.content===S,onClick:()=>void T(S),"data-testid":`sheet-validation-option-${S}`,children:S},`${z}:${S}`))}):null,p.prompt&&!h?s.jsxs("div",{className:"sheet-validation-prompt",style:{left:E.x+(p.list?20:4),top:E.y+4},role:"tooltip","data-testid":"sheet-validation-prompt",children:[p.prompt.title?s.jsx("strong",{children:p.prompt.title}):null,p.prompt.message?s.jsx("span",{children:p.prompt.message}):null]}):null]})}function wH(){const{run:n,t:i,phrase:o}=ze(),r=kf(U0);if(!r)return null;const u=v=>{js(U0,null),n("editor.validation",{answer:v}).then(()=>Ie())},f=o(r.message),h=r.title||i(r.style==="stop"?"validationStopTitle":r.style==="warning"?"validationWarningTitle":"validationInfoTitle");return s.jsx(da,{open:!0,onOpenChange:v=>v?void 0:u("cancel"),children:s.jsxs(fa,{size:"sm",dismissible:!1,"aria-describedby":void 0,onCloseAutoFocus:v=>v.preventDefault(),"data-testid":"sheet-validation-alert","data-style":r.style,children:[s.jsx(ma,{children:s.jsx(pa,{children:h})}),s.jsxs(ha,{children:[s.jsx("p",{className:`sheet-validation-message sheet-validation-${r.style}`,"data-testid":"sheet-validation-message",children:f}),r.style==="warning"?s.jsx("p",{children:i("validationContinue")}):null]}),s.jsx(va,{className:"sheet-dialog-actions",children:r.style==="stop"?s.jsxs(s.Fragment,{children:[s.jsx(De,{variant:"primary",onClick:()=>u("retry"),"data-testid":"sheet-validation-retry",children:i("validationRetry")}),s.jsx(De,{variant:"secondary",onClick:()=>u("cancel"),"data-testid":"sheet-validation-cancel",children:i("cancel")})]}):r.style==="warning"?s.jsxs(s.Fragment,{children:[s.jsx(De,{variant:"primary",onClick:()=>u("accept"),"data-testid":"sheet-validation-yes",children:i("validationYes")}),s.jsx(De,{variant:"secondary",onClick:()=>u("retry"),"data-testid":"sheet-validation-no",children:i("validationNo")}),s.jsx(De,{variant:"secondary",onClick:()=>u("cancel"),"data-testid":"sheet-validation-cancel",children:i("cancel")})]}):s.jsxs(s.Fragment,{children:[s.jsx(De,{variant:"primary",onClick:()=>u("accept"),"data-testid":"sheet-validation-ok",children:i("ok")}),s.jsx(De,{variant:"secondary",onClick:()=>u("cancel"),"data-testid":"sheet-validation-cancel",children:i("cancel")})]})})]})})}const CH=["any","whole","decimal","list","date","time","textLength","custom"],EH=["between","notBetween","equal","notEqual","greater","less","greaterOrEqual","lessOrEqual"],oc={range:"",type:"any",operator:"between",formula1:"",formula2:null,ignoreBlank:!0,dropdown:!0,showInput:!0,inputTitle:"",inputMessage:"",showError:!0,errorStyle:"stop",errorTitle:"",errorMessage:""};function zH({info:n}){const{run:i,t:o}=ze(),r=kf(I0),[u,f]=g.useState("settings"),[h,v]=g.useState(oc);if(g.useEffect(()=>{var E;r&&(f("settings"),v((E=n.validation)!=null&&E.rule?{...oc,...n.validation.rule}:oc))},[r]),!r)return null;const p=()=>{js(I0,!1),Ie()},y=E=>v({...h,...E}),m=h.operator==="between"||h.operator==="notBetween",x=h.type==="whole"||h.type==="decimal"||h.type==="date"||h.type==="time"||h.type==="textLength",b=async()=>{const E=n.selection;if(p(),h.type==="any"&&!h.inputTitle&&!h.inputMessage){await i("data.validation",{range:E,clear:!0});return}await i("data.validation",{range:E,type:h.type,operator:h.operator,formula1:h.formula1,...x&&m&&h.formula2?{formula2:h.formula2}:{},ignoreBlank:h.ignoreBlank,dropdown:h.dropdown,showInput:h.showInput,inputTitle:h.inputTitle,inputMessage:h.inputMessage,showError:h.showError,errorStyle:h.errorStyle,errorTitle:h.errorTitle,errorMessage:h.errorMessage})},C=(E,w,T,S)=>s.jsxs("label",{className:"sheet-validation-field",children:[s.jsx("span",{children:E}),s.jsx("input",{value:w,onChange:z=>T(z.target.value),"data-testid":S})]});return s.jsx(da,{open:!0,onOpenChange:E=>E?void 0:p(),children:s.jsxs(fa,{size:"md",dismissible:!1,"aria-describedby":void 0,onCloseAutoFocus:E=>E.preventDefault(),"data-testid":"sheet-validation-dialog",children:[s.jsx(ma,{children:s.jsx(pa,{children:o("validationTitle")})}),s.jsxs(ha,{children:[s.jsx("div",{className:"sheet-fc-tabs",role:"tablist",children:["settings","input","error"].map(E=>s.jsx("button",{type:"button",role:"tab","aria-selected":u===E,onClick:()=>f(E),"data-testid":`sheet-validation-tab-${E}`,children:o(E==="settings"?"validationSettings":E==="input"?"validationInputTab":"validationErrorTab")},E))}),u==="settings"?s.jsxs("div",{className:"sheet-validation-pane",children:[s.jsx("p",{className:"sheet-validation-heading",children:o("validationCriteria")}),s.jsxs("label",{className:"sheet-validation-field",children:[s.jsx("span",{children:o("validationAllow")}),s.jsx("select",{value:h.type,onChange:E=>y({type:E.target.value,formula1:"",formula2:null}),"data-testid":"sheet-validation-type",children:CH.map(E=>s.jsx("option",{value:E,children:o(`validationKind-${E}`)},E))})]}),x?s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"sheet-validation-field",children:[s.jsx("span",{children:o("validationData")}),s.jsx("select",{value:h.operator,onChange:E=>y({operator:E.target.value}),"data-testid":"sheet-validation-operator",children:EH.map(E=>s.jsx("option",{value:E,children:o(`validationOp-${E}`)},E))})]}),C(o(m?"validationMinimum":"validationValue"),h.formula1,E=>y({formula1:E}),"sheet-validation-formula1"),m?C(o("validationMaximum"),h.formula2??"",E=>y({formula2:E}),"sheet-validation-formula2"):null]}):null,h.type==="list"?C(o("validationSource"),h.formula1,E=>y({formula1:E}),"sheet-validation-source"):null,h.type==="custom"?C(o("validationFormula"),h.formula1,E=>y({formula1:E}),"sheet-validation-formula"):null,h.type!=="any"?s.jsxs("label",{className:"sheet-validation-check",children:[s.jsx("input",{type:"checkbox",checked:h.ignoreBlank,onChange:E=>y({ignoreBlank:E.target.checked}),"data-testid":"sheet-validation-ignore-blank"}),o("validationIgnoreBlank")]}):null,h.type==="list"?s.jsxs("label",{className:"sheet-validation-check",children:[s.jsx("input",{type:"checkbox",checked:h.dropdown,onChange:E=>y({dropdown:E.target.checked}),"data-testid":"sheet-validation-dropdown"}),o("validationDropdown")]}):null]}):u==="input"?s.jsxs("div",{className:"sheet-validation-pane",children:[s.jsxs("label",{className:"sheet-validation-check",children:[s.jsx("input",{type:"checkbox",checked:h.showInput,onChange:E=>y({showInput:E.target.checked}),"data-testid":"sheet-validation-show-input"}),o("validationShowInput")]}),C(o("validationTitleField"),h.inputTitle,E=>y({inputTitle:E}),"sheet-validation-input-title"),s.jsxs("label",{className:"sheet-validation-field",children:[s.jsx("span",{children:o("validationInputMessage")}),s.jsx("textarea",{value:h.inputMessage,onChange:E=>y({inputMessage:E.target.value}),rows:4,"data-testid":"sheet-validation-input-message"})]})]}):s.jsxs("div",{className:"sheet-validation-pane",children:[s.jsxs("label",{className:"sheet-validation-check",children:[s.jsx("input",{type:"checkbox",checked:h.showError,onChange:E=>y({showError:E.target.checked}),"data-testid":"sheet-validation-show-error"}),o("validationShowError")]}),s.jsxs("label",{className:"sheet-validation-field",children:[s.jsx("span",{children:o("validationStyle")}),s.jsxs("select",{value:h.errorStyle,onChange:E=>y({errorStyle:E.target.value}),"data-testid":"sheet-validation-style",children:[s.jsx("option",{value:"stop",children:o("validationStyleStop")}),s.jsx("option",{value:"warning",children:o("validationStyleWarning")}),s.jsx("option",{value:"information",children:o("validationStyleInfo")})]})]}),C(o("validationTitleField"),h.errorTitle,E=>y({errorTitle:E}),"sheet-validation-error-title"),s.jsxs("label",{className:"sheet-validation-field",children:[s.jsx("span",{children:o("validationErrorMessage")}),s.jsx("textarea",{value:h.errorMessage,onChange:E=>y({errorMessage:E.target.value}),rows:4,"data-testid":"sheet-validation-error-message"})]})]})]}),s.jsxs(va,{className:"sheet-dialog-actions",children:[s.jsx(De,{variant:"secondary",onClick:()=>v({...oc}),"data-testid":"sheet-validation-clear-all",children:o("validationClearAll")}),s.jsx("span",{className:"sheet-filter-spacer"}),s.jsx(De,{variant:"primary",onClick:()=>void b(),disabled:h.type!=="any"&&!h.formula1.trim(),"data-testid":"sheet-validation-ok",children:o("ok")}),s.jsx(De,{variant:"secondary",onClick:p,"data-testid":"sheet-validation-dialog-cancel",children:o("cancel")})]})]})})}let V0=0;const q0=new Set,Lg=()=>{V0+=1;for(const n of q0)n(V0)},i0=n=>n&&typeof n=="object"&&"Rgb"in n?`#${n.Rgb.toString(16).padStart(6,"0").toUpperCase()}`:void 0,jH=["number","alignment","font","border","fill","protection"],TH=["general","number","currency","accounting","date","time","percent","fraction","scientific","text","custom"],yc=["yyyy/m/d",'yyyy"年"m"月"d"日"','yyyy"年"m"月"','m"月"d"日"',"yyyy-mm-dd","m/d/yy","d-mmm-yy","aaaa"],bc=["h:mm:ss","h:mm",'h"时"mm"分"ss"秒"',"h:mm AM/PM","yyyy/m/d h:mm"],Mc=["# ?/?","# ??/??","# ?/2","# ?/4","# ?/10"],kH=["General","0","0.00","#,##0","#,##0.00","0%","0.00%","0.00E+00","@","yyyy/m/d","h:mm:ss","[Red]-0.00"],AH=["¥","$","€","£",""];function NH(n){return!n||n==="General"?"general":n==="@"?"text":n.startsWith("_(")?"accounting":/E\+/.test(n)?"scientific":n.includes("%")?"percent":Mc.includes(n)?"fraction":yc.includes(n)?"date":bc.includes(n)?"time":/^"?[¥$€£]"?#,##0/.test(n)?"currency":/^(#,##)?0(\.0+)?(;\[Red\]-(#,##)?0(\.0+)?)?$/.test(n)?"number":"custom"}const RH=n=>{var i;return((i=/\.(0+)/.exec(n))==null?void 0:i[1].length)??0},pl=n=>n>0?`.${"0".repeat(n)}`:"",DH=["General","Left","Center","Right","Fill","Justify","CenterAcross","Distributed"],OH=["Top","Center","Bottom","Justify","Distributed"],LH=["None","Single","Double","SingleAccounting","DoubleAccounting"],HH=["thin","medium","thick","dashed","dotted","double","hair"],r0=["top","bottom","left","right","insideHorizontal","insideVertical","diagonalDown","diagonalUp"];function BH({info:n}){var Ml,Ts;const{run:i,query:o,t:r}=ze(),[u,f]=g.useState(V0),[h,v]=g.useState(!1),[p,y]=g.useState("number"),[m,x]=g.useState({}),[b,C]=g.useState("general"),[E,w]=g.useState(2),[T,S]=g.useState(!1),[z,L]=g.useState(!1),[K,X]=g.useState("¥"),[re,ae]=g.useState(""),[de,ge]=g.useState("General"),[je,be]=g.useState(""),[Me,Be]=g.useState("General"),[ye,F]=g.useState("Bottom"),[A,H]=g.useState(0),[le,ve]=g.useState(0),[Z,I]=g.useState(!1),[P,ue]=g.useState(!1),[k,B]=g.useState(!1),[W,ie]=g.useState(""),[xe,Ce]=g.useState(!1),[He,$]=g.useState(!1),[te,Te]=g.useState(11),[_e,J]=g.useState("None"),[he,Ee]=g.useState(),[O,oe]=g.useState(!1),[fe,N]=g.useState("Baseline"),[G,me]=g.useState("thin"),[pe,ke]=g.useState("#000000"),[Re,Pe]=g.useState([]),[Ve,Ke]=g.useState({}),[Xe,wt]=g.useState(void 0),[ga,Qt]=g.useState(!0),[Dt,yn]=g.useState(!1);g.useEffect(()=>(q0.add(f),()=>{q0.delete(f)}),[]),g.useEffect(()=>{u!==0&&(v(!0),y("number"),o("cell.get",{cell:n.active}).then(ne=>{var At,na,Nt,xl,Sl,wl,Wa,Qa,Ja,ya,en,Ba,Vn,Cl,qn,bn,_a;const qe=(ne==null?void 0:ne.style)??{};x(qe);const st=qe.num_fmt??"General",Ot=NH(st);C(Ot),w(Ot==="general"?2:RH(st)),S(st.includes("#,##0")),L(st.includes("[Red]")),ae(st),ge(st),Be(((At=qe.align)==null?void 0:At.h)??"General"),F(((na=qe.align)==null?void 0:na.v)??"Bottom"),H(((Nt=qe.align)==null?void 0:Nt.indent)??0),ve(((xl=qe.align)==null?void 0:xl.rotation)===255?0:((Sl=qe.align)==null?void 0:Sl.rotation)??0),I(((wl=qe.align)==null?void 0:wl.wrap)===!0),ue(((Wa=qe.align)==null?void 0:Wa.shrink)===!0),B(!1),ie(((Qa=qe.font)==null?void 0:Qa.name)??""),Ce(((Ja=qe.font)==null?void 0:Ja.bold)===!0),$(((ya=qe.font)==null?void 0:ya.italic)===!0),Te(((en=qe.font)==null?void 0:en.size)??11),J(((Ba=qe.font)==null?void 0:Ba.underline)??"None"),Ee(i0((Vn=qe.font)==null?void 0:Vn.color)),oe(((Cl=qe.font)==null?void 0:Cl.strike)===!0),N(((qn=qe.font)==null?void 0:qn.vert)??"Baseline"),Pe([]),Ke(Object.fromEntries(r0.map(su=>[su,!1]))),wt(void 0),Qt(((bn=qe.protection)==null?void 0:bn.locked)!==!1),yn(((_a=qe.protection)==null?void 0:_a.hidden)===!0)}))},[u]);const Za=g.useMemo(()=>{const ne=T?"#,##0":"0";switch(b){case"general":return"General";case"number":return z?`${ne}${pl(E)};[Red]-${ne}${pl(E)}`:`${ne}${pl(E)}`;case"currency":return`${K?`"${K}"`:""}#,##0${pl(E)}`;case"accounting":return`_(${K?`"${K}"`:""}* #,##0${pl(E)}_);_(${K?`"${K}"`:""}* (#,##0${pl(E)});_(${K?`"${K}"`:""}* "-"??_);_(@_)`;case"percent":return`0${pl(E)}%`;case"scientific":return`0${pl(E)}E+00`;case"text":return"@";case"date":return yc.includes(re)?re:yc[0];case"time":return bc.includes(re)?re:bc[0];case"fraction":return Mc.includes(re)?re:Mc[0];default:return de.trim()||"General"}},[b,de,E,re,z,K,T]);if(g.useEffect(()=>{if(!h)return;const ne=Za.replace(/"/g,'""');o("formulas.evaluate",{formula:`=TEXT(${n.active},"${ne}")`}).then(qe=>be(qe==null?"":String(qe)))},[Za,n.active,o,h]),!h)return null;const ur=()=>{v(!1),Ie()},iu=async()=>{var At,na,Nt,xl,Sl,wl,Wa,Qa,Ja,ya,en,Ba,Vn,Cl,qn,bn,_a;const ne={};Za!==(m.num_fmt??"General")&&(ne.num_fmt=Za);const qe={};Me!==(((At=m.align)==null?void 0:At.h)??"General")&&(qe.h=Me),ye!==(((na=m.align)==null?void 0:na.v)??"Bottom")&&(qe.v=ye),A!==(((Nt=m.align)==null?void 0:Nt.indent)??0)&&(qe.indent=A),le!==(((xl=m.align)==null?void 0:xl.rotation)===255?0:((Sl=m.align)==null?void 0:Sl.rotation)??0)&&(qe.rotation=Math.max(-90,Math.min(90,le))),Z!==(((wl=m.align)==null?void 0:wl.wrap)===!0)&&(qe.wrap=Z),P!==(((Wa=m.align)==null?void 0:Wa.shrink)===!0)&&(qe.shrink=P),Object.keys(qe).length&&(ne.align=qe);const st={};W&&W!==((Qa=m.font)==null?void 0:Qa.name)&&(st.name=W),xe!==(((Ja=m.font)==null?void 0:Ja.bold)===!0)&&(st.bold=xe),He!==(((ya=m.font)==null?void 0:ya.italic)===!0)&&(st.italic=He),te!==(((en=m.font)==null?void 0:en.size)??11)&&(st.size=te),_e!==(((Ba=m.font)==null?void 0:Ba.underline)??"None")&&(st.underline=_e),he!==i0((Vn=m.font)==null?void 0:Vn.color)&&(st.color=he??"auto"),O!==(((Cl=m.font)==null?void 0:Cl.strike)===!0)&&(st.strike=O),fe!==(((qn=m.font)==null?void 0:qn.vert)??"Baseline")&&(st.vert=fe),Object.keys(st).length&&(ne.font=st),Xe!==void 0&&(ne.fill=Xe??"none"),(ga!==(((bn=m.protection)==null?void 0:bn.locked)!==!1)||Dt!==(((_a=m.protection)==null?void 0:_a.hidden)===!0))&&(ne.protection={locked:ga,hidden:Dt});const Ot={};Object.keys(ne).length&&(Ot.style=ne),Re.length&&(Ot.edges=Re),k&&(Ot.merge=!0),ur(),Object.keys(Ot).length&&await i("home.formatCells",Ot)},Ut=ne=>{if(ne==="none"){Pe([{preset:"none",style:G,color:pe}]),Ke(Object.fromEntries(r0.map(st=>[st,!1])));return}Pe(st=>[...st.filter(Ot=>Ot.preset!=="none"),{preset:ne,style:G,color:pe}]);const qe=ne==="outside"?["top","bottom","left","right"]:["insideHorizontal","insideVertical"];Ke(st=>({...st,...Object.fromEntries(qe.map(Ot=>[Ot,!0]))}))},ru=ne=>{const qe=!Ve[ne];Ke(st=>({...st,[ne]:qe})),Pe(st=>[...st,{preset:ne,style:qe?G:"none",color:pe}])},li=s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcDecimals")}),s.jsx("input",{className:"kui-field",type:"number",min:0,max:30,style:{width:56},value:E,onChange:ne=>w(Math.max(0,Math.min(30,Math.round(Number(ne.target.value)||0)))),"data-testid":"fc-decimals"})]}),ii=ne=>s.jsx("ul",{className:"sheet-function-list sheet-fc-list",role:"listbox","aria-label":r("fcType"),"data-testid":"fc-list",children:ne.map(qe=>s.jsx("li",{role:"option","aria-selected":qe===Za,onClick:()=>ae(qe),"data-code":qe,children:qe},qe))});return s.jsx(da,{open:!0,onOpenChange:ne=>ne?void 0:ur(),children:s.jsxs(fa,{size:"md",dismissible:!1,"aria-describedby":void 0,onCloseAutoFocus:ne=>ne.preventDefault(),"data-testid":"sheet-format-cells",children:[s.jsx(ma,{children:s.jsx(pa,{children:r("formatCellsTitle")})}),s.jsxs(ha,{children:[s.jsx("div",{className:"sheet-fc-tabs",role:"tablist",children:jH.map(ne=>s.jsx("button",{type:"button",role:"tab","aria-selected":p===ne,onClick:()=>y(ne),"data-testid":`fc-tab-${ne}`,children:r(`fcTab:${ne}`)},ne))}),s.jsxs("div",{className:"sheet-fc-page",role:"tabpanel","data-testid":`fc-page-${p}`,children:[p==="number"?s.jsxs("div",{className:"sheet-fc-number",children:[s.jsx("ul",{className:"sheet-function-list sheet-fc-categories",role:"listbox","aria-label":r("fcCategory"),"data-testid":"fc-categories",children:TH.map(ne=>s.jsx("li",{role:"option","aria-selected":b===ne,onClick:()=>C(ne),"data-testid":`fc-cat-${ne}`,children:r(`fcCat:${ne}`)},ne))}),s.jsxs("div",{className:"sheet-dialog-form",children:[s.jsxs("div",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcSample")}),s.jsx("output",{className:"sheet-fc-sample","data-testid":"fc-sample",children:je})]}),b==="number"?s.jsxs(s.Fragment,{children:[li,s.jsxs("label",{className:"sheet-dialog-choice",children:[s.jsx("input",{type:"checkbox",checked:T,onChange:ne=>S(ne.target.checked),"data-testid":"fc-thousands"}),r("fcThousands")]}),s.jsxs("label",{className:"sheet-dialog-choice",children:[s.jsx("input",{type:"checkbox",checked:z,onChange:ne=>L(ne.target.checked),"data-testid":"fc-red-negative"}),r("fcRedNegative")]})]}):null,b==="currency"||b==="accounting"?s.jsxs(s.Fragment,{children:[li,s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcSymbol")}),s.jsx("select",{className:"kui-field",value:K,onChange:ne=>X(ne.target.value),"data-testid":"fc-symbol",children:AH.map(ne=>s.jsx("option",{value:ne,children:ne||r("fcNoSymbol")},ne))})]})]}):null,b==="percent"||b==="scientific"?li:null,b==="date"?ii(yc):null,b==="time"?ii(bc):null,b==="fraction"?ii(Mc):null,b==="custom"?s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcType")}),s.jsx("input",{className:"kui-field",value:de,spellCheck:!1,onChange:ne=>ge(ne.target.value),"data-testid":"fc-code"})]}),s.jsx("ul",{className:"sheet-function-list sheet-fc-list",role:"listbox","aria-label":r("fcType"),children:kH.map(ne=>s.jsx("li",{role:"option","aria-selected":ne===de,onClick:()=>ge(ne),children:ne},ne))})]}):null,s.jsx("div",{className:"sheet-fc-note","data-testid":"fc-format",children:Za})]})]}):null,p==="alignment"?s.jsxs("div",{className:"sheet-dialog-form",children:[s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcHorizontal")}),s.jsx("select",{className:"kui-field",value:Me,onChange:ne=>Be(ne.target.value),"data-testid":"fc-h",children:DH.map(ne=>s.jsx("option",{value:ne,children:r(`fcH:${ne}`)},ne))})]}),s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcVertical")}),s.jsx("select",{className:"kui-field",value:ye,onChange:ne=>F(ne.target.value),"data-testid":"fc-v",children:OH.map(ne=>s.jsx("option",{value:ne,children:r(`fcV:${ne}`)},ne))})]}),s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcIndent")}),s.jsx("input",{className:"kui-field",type:"number",min:0,max:15,style:{width:56},value:A,onChange:ne=>H(Math.max(0,Math.min(15,Math.round(Number(ne.target.value)||0)))),"data-testid":"fc-indent"})]}),s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcRotation")}),s.jsx("input",{className:"kui-field",type:"number",min:-90,max:90,style:{width:56},value:le,onChange:ne=>ve(Math.round(Number(ne.target.value)||0)),"data-testid":"fc-rotation"})]}),s.jsxs("label",{className:"sheet-dialog-choice",children:[s.jsx("input",{type:"checkbox",checked:Z,onChange:ne=>I(ne.target.checked),"data-testid":"fc-wrap"}),r("fcWrap")]}),s.jsxs("label",{className:"sheet-dialog-choice",children:[s.jsx("input",{type:"checkbox",checked:P,onChange:ne=>ue(ne.target.checked),"data-testid":"fc-shrink"}),r("fcShrink")]}),s.jsxs("label",{className:"sheet-dialog-choice",children:[s.jsx("input",{type:"checkbox",checked:k,onChange:ne=>B(ne.target.checked),"data-testid":"fc-merge"}),r("fcMerge")]})]}):null,p==="font"?s.jsxs("div",{className:"sheet-dialog-form",children:[s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcFont")}),s.jsx("select",{className:"kui-field",value:W,onChange:ne=>ie(ne.target.value),"data-testid":"fc-font",children:[...W&&!Fn.some(ne=>ne.name===W)?[W]:[],...Fn.map(ne=>ne.name)].map(ne=>s.jsx("option",{value:ne,children:ne},ne))})]}),s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcFontStyle")}),s.jsxs("select",{className:"kui-field",value:`${xe?"b":""}${He?"i":""}`,onChange:ne=>{Ce(ne.target.value.includes("b")),$(ne.target.value.includes("i"))},"data-testid":"fc-font-style",children:[s.jsx("option",{value:"",children:r("fcRegular")}),s.jsx("option",{value:"i",children:r("fcItalic")}),s.jsx("option",{value:"b",children:r("fcBold")}),s.jsx("option",{value:"bi",children:r("fcBoldItalic")})]})]}),s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcSize")}),s.jsx("input",{className:"kui-field",list:"sheet-fc-sizes",style:{width:64},value:te,onChange:ne=>Te(Number(ne.target.value)||te),"data-testid":"fc-size"}),s.jsx("datalist",{id:"sheet-fc-sizes",children:Ux.map(ne=>s.jsx("option",{value:ne},ne))})]}),s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcUnderline")}),s.jsx("select",{className:"kui-field",value:_e,onChange:ne=>J(ne.target.value),"data-testid":"fc-underline",children:LH.map(ne=>s.jsx("option",{value:ne,children:r(`fcU:${ne}`)},ne))})]}),s.jsxs("div",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcColor")}),s.jsx(s0,{value:he,onChange:Ee,none:r("colorAutomatic"),testId:"fc-font-color"})]}),s.jsxs("label",{className:"sheet-dialog-choice",children:[s.jsx("input",{type:"checkbox",checked:O,onChange:ne=>oe(ne.target.checked),"data-testid":"fc-strike"}),r("fcStrike")]}),s.jsxs("label",{className:"sheet-dialog-choice",children:[s.jsx("input",{type:"checkbox",checked:fe==="Superscript",onChange:ne=>N(ne.target.checked?"Superscript":"Baseline"),"data-testid":"fc-super"}),r("fcSuper")]}),s.jsxs("label",{className:"sheet-dialog-choice",children:[s.jsx("input",{type:"checkbox",checked:fe==="Subscript",onChange:ne=>N(ne.target.checked?"Subscript":"Baseline"),"data-testid":"fc-sub"}),r("fcSub")]}),s.jsx("div",{className:"sheet-fc-preview","data-testid":"fc-preview",style:{fontFamily:((Ml=Fn.find(ne=>ne.name===W))==null?void 0:Ml.css)??W,fontWeight:xe?700:400,fontStyle:He?"italic":"normal",fontSize:Math.min(36,te*1.33),color:he??void 0,textDecoration:`${_e!=="None"?"underline":""} ${O?"line-through":""}`.trim()||"none"},children:r("fcPreviewText")})]}):null,p==="border"?s.jsxs("div",{className:"sheet-dialog-form",children:[s.jsxs("div",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcPresets")}),s.jsx("button",{type:"button",className:"kui-ribbon-button",onClick:()=>Ut("none"),"data-testid":"fc-border-none",children:r("fcBorderNone")}),s.jsx("button",{type:"button",className:"kui-ribbon-button",onClick:()=>Ut("outside"),"data-testid":"fc-border-outside",children:r("fcBorderOutside")}),s.jsx("button",{type:"button",className:"kui-ribbon-button",onClick:()=>Ut("inside"),"data-testid":"fc-border-inside",children:r("fcBorderInside")})]}),s.jsxs("div",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcBorderEdges")}),s.jsx("span",{className:"sheet-fc-edges",children:r0.map(ne=>s.jsx("button",{type:"button",className:"kui-ribbon-button","aria-pressed":Ve[ne]===!0,onClick:()=>ru(ne),"data-testid":`fc-edge-${ne}`,children:r(`fcEdge:${ne}`)},ne))})]}),s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcLineStyle")}),s.jsx("select",{className:"kui-field",value:G,onChange:ne=>me(ne.target.value),"data-testid":"fc-line-style",children:HH.map(ne=>s.jsx("option",{value:ne,children:r(`fcLine:${ne}`)},ne))})]}),s.jsxs("div",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcColor")}),s.jsx(s0,{value:pe,onChange:ne=>ke(ne??"#000000"),none:r("colorAutomatic"),testId:"fc-line-color"})]}),s.jsx("div",{className:"sheet-fc-border-preview","data-testid":"fc-border-preview",children:s.jsx("span",{style:{borderTop:Ve.top?`2px solid ${pe}`:void 0,borderBottom:Ve.bottom?`2px solid ${pe}`:void 0,borderLeft:Ve.left?`2px solid ${pe}`:void 0,borderRight:Ve.right?`2px solid ${pe}`:void 0},children:r("fcText")})})]}):null,p==="fill"?s.jsxs("div",{className:"sheet-dialog-form",children:[s.jsx("button",{type:"button",className:"kui-menu-item",onClick:()=>wt(null),"data-testid":"fc-fill-none",children:r("fcNoColor")}),s.jsx(pn,{onPick:ne=>wt(ne.toUpperCase()),testId:"fc-fill-colors"}),s.jsxs("div",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("colorMore")}),s.jsx(s0,{value:Xe??void 0,onChange:ne=>wt(ne??null),none:r("fcNoColor"),testId:"fc-fill-more"})]}),s.jsxs("div",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("fcSample")}),s.jsx("span",{className:"sheet-fc-swatch",style:{background:Xe??(Xe===null?"#FFFFFF":i0((Ts=m.fill)==null?void 0:Ts.fg)??"#FFFFFF")},"data-testid":"fc-fill-sample","data-color":Xe??""})]})]}):null,p==="protection"?s.jsxs("div",{className:"sheet-dialog-form",children:[s.jsxs("label",{className:"sheet-dialog-choice",children:[s.jsx("input",{type:"checkbox",checked:ga,onChange:ne=>Qt(ne.target.checked),"data-testid":"fc-locked"}),r("fcLocked")]}),s.jsxs("label",{className:"sheet-dialog-choice",children:[s.jsx("input",{type:"checkbox",checked:Dt,onChange:ne=>yn(ne.target.checked),"data-testid":"fc-hidden"}),r("fcHidden")]}),s.jsx("p",{className:"sheet-fc-note",children:r("fcProtectionNote")})]}):null]})]}),s.jsxs(va,{className:"sheet-dialog-actions",children:[s.jsx(De,{variant:"secondary",onClick:ur,"data-testid":"fc-cancel",children:r("cancel")}),s.jsx(De,{variant:"primary",onClick:()=>void iu(),"data-testid":"fc-ok",children:r("ok")})]})]})})}function s0({value:n,onChange:i,none:o,testId:r}){const{t:u}=ze(),[f,h]=g.useState(!1),[v,p]=g.useState("");return s.jsxs("span",{className:"sheet-color-field",children:[s.jsxs("button",{type:"button",className:"sheet-color-value","aria-expanded":f,onClick:()=>h(y=>!y),"data-testid":r,"data-color":n??"",children:[s.jsx("span",{style:{background:n??"transparent"},className:n?void 0:"sheet-color-empty"}),n??o]}),f?s.jsxs("span",{className:"sheet-color-pop",children:[s.jsx("button",{type:"button",className:"kui-menu-item",onClick:()=>{i(void 0),h(!1)},"data-testid":`${r}-none`,children:o}),s.jsx(pn,{onPick:y=>{i(y.toUpperCase()),h(!1)},testId:`${r}-colors`}),s.jsxs("span",{className:"sheet-color-more",children:[s.jsx("input",{className:"kui-field",style:{width:84},value:v,placeholder:"#3C5593","aria-label":u("colorHex"),onChange:y=>p(y.target.value),"data-testid":`${r}-hex`}),s.jsx("button",{type:"button",className:"kui-ribbon-button",onClick:()=>{const y=v.trim().startsWith("#")?v.trim():`#${v.trim()}`;if(!/^#[0-9A-F]{6}$/i.test(y)){Xt("error",u("colorBad"));return}i(y.toUpperCase()),p(""),h(!1)},"data-testid":`${r}-hex-ok`,children:u("colorApply")})]})]}):null]})}function Xx({preview:n}){return s.jsx("span",{className:"sheet-table-thumb","aria-hidden":"true",children:n.flatMap((i,o)=>i.map(([r,u,f,h,v,p],y)=>{const m={background:r??"#FFFFFF",borderTopColor:f??"transparent",borderBottomColor:h??"transparent",borderLeftColor:v??"transparent",borderRightColor:p??"transparent"};return s.jsx("span",{style:m,children:s.jsx("i",{style:{background:u??"#404040"}})},`${o}-${y}`)}))})}let Zx=null;const $0=new Set,nu=n=>{Zx=n;for(const i of $0)i(n)},_H=(n,i)=>nu({kind:"format",style:n,range:i}),Hg=n=>nu(n?{kind:"new",replace:n.name,name:n.name,parts:n.parts,isDefault:n.isDefault}:{kind:"new",name:"",parts:{},isDefault:!1}),FH=n=>nu({kind:"resize",range:n}),Bg=n=>`=${n.replace(/([A-Z]+)(\d+)/g,"$$$1$$$2")}`,cc=n=>n.trim().replace(/^=/,"").replace(/\$/g,""),UH=["wholeTable","headerRow","totalRow","firstColumn","lastColumn","firstRowStripe","secondRowStripe","firstColumnStripe","secondColumnStripe"];function IH(n){const i=["wholeTable","firstColumnStripe","secondColumnStripe","firstRowStripe","secondRowStripe","headerRow"];return Array.from({length:5},(o,r)=>Array.from({length:5},(u,f)=>{let h=null,v=null,p=null;for(const y of i){const m=n[y];!m||!(y==="wholeTable"||y==="headerRow"&&r===0||r>0&&y==="firstRowStripe"&&(r-1)%2===0||r>0&&y==="secondRowStripe"&&(r-1)%2===1)||(h=m.fill??h,v=m.color??v,p=m.border??p)}return[h,v,r===0?p:null,r===4?p:null,f===0?p:null,f===4?p:null]}))}function uc({value:n,onChange:i,testId:o,label:r}){const{t:u}=ze(),[f,h]=g.useState(!1),[v,p]=g.useState("");return s.jsxs("span",{className:"sheet-color-field",children:[s.jsxs("button",{type:"button",className:"sheet-color-value","aria-label":r,"aria-expanded":f,onClick:()=>h(y=>!y),"data-testid":o,"data-color":n??"",children:[s.jsx("span",{style:{background:n??"transparent"},className:n?void 0:"sheet-color-empty"}),n??u("tableNoColor")]}),f?s.jsxs("span",{className:"sheet-color-pop","data-testid":`${o}-panel`,children:[s.jsx("button",{type:"button",className:"kui-menu-item",onClick:()=>{i(void 0),h(!1)},"data-testid":`${o}-none`,children:u("tableNoColor")}),s.jsx(pn,{onPick:y=>{i(y.toUpperCase()),h(!1)},testId:`${o}-colors`}),s.jsx("span",{className:"sheet-font-heading",children:u("colorMore")}),s.jsxs("span",{className:"sheet-color-more",children:[s.jsx("input",{type:"color","aria-label":u("colorMore"),value:/^#[0-9A-F]{6}$/i.test(v)?v:n??"#000000",onChange:y=>p(y.target.value.toUpperCase())}),s.jsx("input",{className:"kui-field",style:{width:84},value:v,placeholder:"#3C5593","aria-label":u("colorHex"),onChange:y=>p(y.target.value),"data-testid":`${o}-hex`}),s.jsx("button",{type:"button",className:"kui-ribbon-button",onClick:()=>{const y=v.trim().startsWith("#")?v.trim():`#${v.trim()}`;if(!/^#[0-9A-F]{6}$/i.test(y)){Xt("error",u("colorBad"));return}i(y.toUpperCase()),p(""),h(!1)},"data-testid":`${o}-hex-ok`,children:u("colorApply")})]})]}):null]})}function VH({info:n}){const{run:i,query:o,t:r}=ze(),[u,f]=g.useState(Zx);g.useEffect(()=>($0.add(f),()=>{$0.delete(f)}),[]);const[h,v]=g.useState(""),[p,y]=g.useState("format"),[m,x]=g.useState(1),[b,C]=g.useState(!0),[E,w]=g.useState(!0),[T,S]=g.useState(""),[z,L]=g.useState({}),[K,X]=g.useState("wholeTable"),[re,ae]=g.useState(!1);g.useEffect(()=>{((u==null?void 0:u.kind)==="format"||(u==null?void 0:u.kind)==="resize")&&v(Bg(u.range)),(u==null?void 0:u.kind)==="format"&&(y("format"),x(1),C(!0),w(!0)),(u==null?void 0:u.kind)==="new"&&(S(u.name),L(u.parts),X("wholeTable"),ae(u.isDefault))},[u]);const de=async ye=>{const F=/^(?:.*!)?([A-Z]+\d+)(?::([A-Z]+\d+))?$/.exec(ye);if(!F)return!1;const A=R0(F[1]),H=R0(F[2]??F[1]);for(let le=A.colIndex;le<=Math.min(H.colIndex,A.colIndex+255);le+=1){const ve=await o("cell.get",{cell:`${D0(le)}${A.row}`});if(ve!=null&&ve.picture)return!0}return!1};if(!u)return null;const ge=()=>{nu(null),Ie()},je=ye=>ye.preventDefault();if(u.kind==="format"){const ye=async()=>{const F=p==="format"?{range:cc(h),style:u.style,mode:p,titleRows:m}:{range:cc(h),style:u.style,mode:p,header:b,filter:E,columnPrefix:r("tableColumnPrefix")};if(ge(),p==="table"&&b&&await de(cc(h))){jf({title:r("tablePicturesTitle"),message:r("tablePicturesConfirm"),testId:"sheet-table-pictures",onOk:()=>void i("home.formatAsTable",{...F,clearPictures:!0})});return}await i("home.formatAsTable",F)};return s.jsx(da,{open:!0,onOpenChange:F=>F?void 0:ge(),children:s.jsxs(fa,{size:"sm",dismissible:!1,"aria-describedby":void 0,onCloseAutoFocus:je,"data-testid":"sheet-fat",children:[s.jsx(ma,{children:s.jsx(pa,{children:r("formatAsTableTitle")})}),s.jsx(ha,{children:s.jsxs("div",{className:"sheet-dialog-form",children:[s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("tableDataSource")}),s.jsx("input",{className:"kui-field",value:h,spellCheck:!1,onChange:F=>v(F.target.value),"data-testid":"sheet-fat-range"})]}),s.jsxs("label",{className:"sheet-dialog-choice",children:[s.jsx("input",{type:"radio",name:"sheet-fat-mode",checked:p==="format",onChange:()=>y("format"),"data-testid":"sheet-fat-format"}),r("tableOnlyFormat")]}),s.jsxs("label",{className:"sheet-dialog-row sheet-dialog-indent",children:[s.jsx("span",{children:r("tableTitleRows")}),s.jsx("input",{className:"kui-field",type:"number",min:0,max:9,style:{width:56},disabled:p!=="format",value:m,onChange:F=>x(Math.max(0,Math.min(9,Math.round(Number(F.target.value)||0)))),"data-testid":"sheet-fat-title-rows"})]}),s.jsxs("label",{className:"sheet-dialog-choice",children:[s.jsx("input",{type:"radio",name:"sheet-fat-mode",checked:p==="table",onChange:()=>y("table"),"data-testid":"sheet-fat-table"}),r("tableConvert")]}),s.jsxs("label",{className:"sheet-dialog-choice sheet-dialog-indent",children:[s.jsx("input",{type:"checkbox",disabled:p!=="table",checked:b,onChange:F=>C(F.target.checked),"data-testid":"sheet-fat-header"}),r("tableHasHeaders")]}),s.jsxs("label",{className:"sheet-dialog-choice sheet-dialog-indent",children:[s.jsx("input",{type:"checkbox",disabled:p!=="table",checked:E,onChange:F=>w(F.target.checked),"data-testid":"sheet-fat-filter"}),r("tableFilterButtons")]})]})}),s.jsxs(va,{className:"sheet-dialog-actions",children:[s.jsx(De,{variant:"secondary",onClick:ge,"data-testid":"sheet-fat-cancel",children:r("cancel")}),s.jsx(De,{variant:"primary",onClick:()=>void ye(),"data-testid":"sheet-fat-ok",children:r("ok")})]})]})})}if(u.kind==="resize"){const ye=async()=>{await i("table.resize",{range:cc(h)})!=null?ge():n.tableInfo&&v(Bg(n.tableInfo.range))};return s.jsx(da,{open:!0,onOpenChange:F=>F?void 0:ge(),children:s.jsxs(fa,{size:"sm",dismissible:!1,"aria-describedby":void 0,onCloseAutoFocus:je,"data-testid":"sheet-resize",children:[s.jsx(ma,{children:s.jsx(pa,{children:r("resizeTableTitle")})}),s.jsx(ha,{children:s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("resizeTableRange")}),s.jsx("input",{className:"kui-field",value:h,autoFocus:!0,spellCheck:!1,onChange:F=>v(F.target.value),onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),ye())},"data-testid":"sheet-resize-range"})]})}),s.jsxs(va,{className:"sheet-dialog-actions",children:[s.jsx(De,{variant:"secondary",onClick:ge,"data-testid":"sheet-resize-cancel",children:r("cancel")}),s.jsx(De,{variant:"primary",onClick:()=>void ye(),"data-testid":"sheet-resize-ok",children:r("ok")})]})]})})}const be=z[K]??{},Me=ye=>L(F=>{const A={...F[K]??{},...ye};for(const le of Object.keys(A))(A[le]===void 0||A[le]===!1)&&delete A[le];const H={...F,[K]:A};return Object.keys(A).length||delete H[K],H}),Be=async()=>{if(!T.trim()){Xt("error",r("tableStyleNameEmpty"));return}await i("table.newStyle",{name:T.trim(),elements:z,default:re,...u.replace?{replace:u.replace}:{}})!=null&&ge()};return s.jsx(da,{open:!0,onOpenChange:ye=>ye?void 0:ge(),children:s.jsxs(fa,{size:"lg",dismissible:!1,"aria-describedby":void 0,onCloseAutoFocus:je,"data-testid":"sheet-nts",children:[s.jsx(ma,{children:s.jsx(pa,{children:r(u.replace?"modifyTableStyleTitle":"newTableStyleTitle")})}),s.jsx(ha,{children:s.jsxs("div",{className:"sheet-dialog-form",children:[s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("tableStyleName")}),s.jsx("input",{className:"kui-field",value:T,autoFocus:!0,spellCheck:!1,onChange:ye=>S(ye.target.value),"data-testid":"sheet-nts-name"})]}),s.jsxs("div",{className:"sheet-nts-body",children:[s.jsxs("div",{children:[s.jsx("div",{className:"sheet-font-heading",children:r("tableElement")}),s.jsx("ul",{className:"sheet-function-list sheet-nts-parts",role:"listbox","aria-label":r("tableElement"),children:UH.map(ye=>s.jsx("li",{role:"option","aria-selected":ye===K,"data-set":z[ye]?"true":void 0,onClick:()=>X(ye),"data-testid":`sheet-nts-el-${ye}`,children:r(`tablePart:${ye}`)},ye))})]}),s.jsxs("div",{className:"sheet-nts-format",children:[s.jsxs("div",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("tablePartFill")}),s.jsx(uc,{value:be.fill,onChange:ye=>Me({fill:ye}),label:r("tablePartFill"),testId:"sheet-nts-fill"})]}),s.jsxs("div",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("tablePartText")}),s.jsx(uc,{value:be.color,onChange:ye=>Me({color:ye}),label:r("tablePartText"),testId:"sheet-nts-color"})]}),s.jsxs("div",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("tablePartBorder")}),s.jsx(uc,{value:be.border,onChange:ye=>Me({border:ye}),label:r("tablePartBorder"),testId:"sheet-nts-border"})]}),s.jsxs("div",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("tablePartLines")}),s.jsx(uc,{value:be.lines,onChange:ye=>Me({lines:ye}),label:r("tablePartLines"),testId:"sheet-nts-lines"})]}),s.jsxs("label",{className:"sheet-dialog-choice",children:[s.jsx("input",{type:"checkbox",checked:be.bold===!0,onChange:ye=>Me({bold:ye.target.checked}),"data-testid":"sheet-nts-bold"}),r("tablePartBold")]}),s.jsxs("label",{className:"sheet-dialog-choice",children:[s.jsx("input",{type:"checkbox",checked:be.italic===!0,onChange:ye=>Me({italic:ye.target.checked}),"data-testid":"sheet-nts-italic"}),r("tablePartItalic")]}),K.endsWith("Stripe")?s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:r("tableStripeSize")}),s.jsx("input",{className:"kui-field",type:"number",min:1,max:9,style:{width:56},value:be.size??1,onChange:ye=>Me({size:Math.max(1,Math.min(9,Math.round(Number(ye.target.value)||1)))}),"data-testid":"sheet-nts-size"})]}):null,s.jsx("button",{type:"button",className:"kui-ribbon-button",onClick:()=>L(ye=>Object.fromEntries(Object.entries(ye).filter(([F])=>F!==K))),"data-testid":"sheet-nts-clear-part",children:r("tableClearPart")})]}),s.jsxs("div",{children:[s.jsx("div",{className:"sheet-font-heading",children:r("tablePreview")}),s.jsx("span",{"data-testid":"sheet-nts-preview",children:s.jsx(Xx,{preview:IH(z)})})]})]}),s.jsxs("label",{className:"sheet-dialog-choice",children:[s.jsx("input",{type:"checkbox",checked:re,onChange:ye=>ae(ye.target.checked),"data-testid":"sheet-nts-default"}),r("tableSetDefault")]})]})}),s.jsxs(va,{className:"sheet-dialog-actions",children:[s.jsx(De,{variant:"secondary",onClick:ge,"data-testid":"sheet-nts-cancel",children:r("cancel")}),s.jsx(De,{variant:"primary",onClick:()=>void Be(),"data-testid":"sheet-nts-ok",children:r("ok")})]})]})})}function Wx({info:n,testId:i="sheet-table"}){var E;const{run:o,t:r}=ze(),[u,f]=g.useState(null),[h,v]=g.useState(null),p=fO("table.styles",u==null?{}:{slot:u},((E=n.tableInfo)==null?void 0:E.style)??null);if(!p)return s.jsx("div",{className:"sheet-table-gallery","data-testid":`${i}-gallery`});const y=p.table!=null,m=w=>{v(null),y?o("table.style",{style:w}).finally(Ie):_H(w,p.range??n.selection)},x=(w,T,S)=>{w.preventDefault(),w.stopPropagation(),v({name:T,custom:S})},b=(w,T,S)=>s.jsxs("span",{className:"sheet-table-item","data-default":p.default===w||void 0,children:[s.jsx("button",{type:"button",className:"sheet-table-style",title:w,"aria-label":w,"aria-pressed":p.current===w,onClick:()=>m(w),onContextMenu:z=>x(z,w,S),"data-testid":`${i}-${w}`,children:s.jsx(Xx,{preview:T})}),p.default===w?s.jsx("span",{className:"sheet-table-default",title:r("tableIsDefault"),"data-testid":`${i}-default-mark`,children:"★"}):null,S?s.jsx("button",{type:"button",className:"sheet-table-delete","aria-label":r("tableDeleteStyle"),title:r("tableDeleteStyle"),onClick:z=>{z.stopPropagation(),o("table.deleteStyle",{name:w})},"data-testid":`${i}-delete-${w}`,children:s.jsx(Jl,{size:10,"aria-hidden":"true"})}):null]},w),C=p.custom.find(w=>w.name===(h==null?void 0:h.name));return s.jsxs("div",{className:"sheet-table-gallery","data-testid":`${i}-gallery`,onClick:w=>h&&!w.target.closest(".sheet-table-menu")?v(null):void 0,children:[s.jsxs("div",{className:"sheet-table-scroll",children:[s.jsx("div",{className:"sheet-table-title",children:r("tablePresetStyles")}),s.jsxs("div",{className:"sheet-table-colors",children:[s.jsx("span",{children:r("tableThemeColor")}),s.jsx("span",{className:"sheet-table-swatches",role:"radiogroup","aria-label":r("tableThemeColor"),children:p.colors.map((w,T)=>s.jsx("span",{role:"radio",tabIndex:0,"aria-checked":p.slot===T,className:"sheet-table-swatch",style:{background:w},title:w,onClick:S=>{S.stopPropagation(),f(T)},onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),f(T))},"data-testid":`${i}-color-${T}`,children:p.slot===T?s.jsx(xs,{size:11,"aria-hidden":"true"}):null},T))})]}),p.groups.map(w=>s.jsxs("div",{className:"sheet-table-group","data-testid":`${i}-group-${w.id}`,children:[s.jsx("div",{className:"sheet-font-heading",children:r(`tableGroup:${w.id}`)}),s.jsx("div",{className:"sheet-table-grid",children:w.styles.map(T=>b(T.name,T.preview,!1))})]},w.id)),p.custom.length?s.jsxs("div",{className:"sheet-table-group","data-testid":`${i}-group-custom`,children:[s.jsx("div",{className:"sheet-font-heading",children:r("tableGroup:custom")}),s.jsx("div",{className:"sheet-table-grid",children:p.custom.map(w=>b(w.name,w.preview,!0))})]}):null]}),h?s.jsxs("div",{className:"sheet-table-menu kui-popover",role:"menu","data-testid":`${i}-menu`,children:[s.jsx("button",{type:"button",className:"kui-menu-item",role:"menuitem",onClick:()=>void o("table.setDefaultStyle",{name:h.name}),"data-testid":`${i}-menu-default`,children:r("tableSetAsDefault")}),h.custom&&C?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"kui-menu-item",role:"menuitem",onClick:()=>Hg({name:C.name,parts:C.elements,isDefault:p.default===C.name}),"data-testid":`${i}-menu-modify`,children:r("tableModifyStyle")}),s.jsx("button",{type:"button",className:"kui-menu-item",role:"menuitem",onClick:()=>void o("table.deleteStyle",{name:h.name}),"data-testid":`${i}-menu-delete`,children:r("tableDeleteStyle")})]}):null]}):null,s.jsxs("div",{className:"sheet-table-actions",children:[y?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"kui-menu-item",role:"menuitem",onClick:()=>void o("table.convertToRange",{}).finally(Ie),"data-testid":`${i}-convert`,children:r("tableConvertToRange")}),s.jsx("button",{type:"button",className:"kui-menu-item sheet-danger",role:"menuitem",onClick:()=>void o("table.style",{style:"None"}).finally(Ie),"data-testid":`${i}-clear`,children:r("tableClearStyle")})]}):null,s.jsx("button",{type:"button",className:"kui-menu-item",role:"menuitem",onClick:()=>Hg(),"data-testid":`${i}-new`,children:r("tableNewStyle")})]})]})}function qH({info:n}){const{enabled:i,phrase:o}=ze();return s.jsx(et,{icon:ss,label:o("Format as Table"),size:"large",testId:"sheet-format-table",disabled:!i("home.formatAsTable"),children:s.jsx(Wx,{info:n})})}function $H({info:n}){const{run:i,t:o,phrase:r}=ze(),u=n.tableInfo,[f,h]=g.useState((u==null?void 0:u.name)??"");if(g.useEffect(()=>h((u==null?void 0:u.name)??""),[u==null?void 0:u.name]),!u)return null;const v=(y,m,x,b)=>s.jsxs("label",{className:"sheet-dialog-choice sheet-table-option",children:[s.jsx("input",{type:"checkbox",defaultChecked:u[y]===!0,onChange:C=>void i(m,{on:C.target.checked}).finally(Ie),"data-testid":b},`${String(y)}-${String(u[y])}`),x]}),p=()=>{f.trim()&&f.trim()!==u.name&&i("table.rename",{name:f.trim()}).then(y=>y==null?h(u.name):void 0)};return s.jsxs(s.Fragment,{children:[s.jsxs(nt,{label:r("Properties"),icon:Pc,children:[s.jsxs(Ft,{children:[s.jsxs("label",{className:"sheet-dialog-row",children:[s.jsx("span",{children:o("tableName")}),s.jsx("input",{className:"kui-ribbon-field",style:{width:96},value:f,onChange:y=>h(y.target.value),onBlur:p,onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),p(),Ie())},"data-testid":"sheet-table-name"})]}),s.jsx("button",{type:"button",className:"kui-ribbon-button",onClick:()=>FH(u.range),"data-testid":"sheet-table-resize",children:r("Resize Table")})]}),s.jsxs(Ft,{children:[s.jsx("button",{type:"button",className:"kui-ribbon-button",onClick:()=>void i("table.removeDuplicates",{}),"data-testid":"sheet-table-dedupe",children:r("Remove Duplicates")}),s.jsx("button",{type:"button",className:"kui-ribbon-button",onClick:()=>void i("table.convertToRange",{}).finally(Ie),"data-testid":"sheet-table-to-range",children:r("Convert to Range")})]})]}),s.jsx(nt,{label:r("Table Style Options"),icon:ss,children:s.jsxs("div",{className:"sheet-table-options",children:[v("header","table.headerRow",r("Header Row"),"sheet-table-opt-header"),v("totals","table.totalRow",r("Total Row"),"sheet-table-opt-totals"),v("bandedRows","table.bandedRows",r("Banded Rows"),"sheet-table-opt-banded-rows"),v("firstCol","table.firstColumn",r("First Column"),"sheet-table-opt-first-col"),v("lastCol","table.lastColumn",r("Last Column"),"sheet-table-opt-last-col"),v("bandedCols","table.bandedColumns",r("Banded Columns"),"sheet-table-opt-banded-cols"),v("filter","table.filterButton",r("Filter Button"),"sheet-table-opt-filter")]})}),s.jsx(nt,{label:r("Table Styles"),icon:ss,children:s.jsx(et,{icon:ss,label:r("Table Styles"),size:"large",testId:"sheet-table-design-styles",children:s.jsx(Wx,{info:n,testId:"sheet-table-design"})})})]})}const GH=6,PH=10,Af=n=>ds("sheet",n,i=>Array.isArray(i)&&i.every(o=>typeof o=="string")?i:void 0)??[],Qx=(n,i,o)=>{const r=[i,...Af(n).filter(u=>u!==i)].slice(0,o);return Ji("sheet",n,r),r},KH=[["Carlito","Carlito-Regular.ttf"],["Caladea","Caladea-Regular.ttf"],["Arimo","Arimo-Variable.ttf"],["Tinos","Tinos-Regular.ttf"],["Cousine","Cousine-Regular.ttf"],["Ma Shan Zheng","MaShanZheng-Regular.ttf"]];let _g=!1;function YH(){if(!(_g||typeof FontFace>"u")){_g=!0;for(const[n,i]of KH)new FontFace(n,`url(${new URL(`./fonts/${i}`,document.baseURI).href})`).load().then(r=>document.fonts.add(r)).catch(()=>{})}}function XH({info:n}){const{run:i,enabled:o,t:r}=ze(),f=gn()||n.editing||!o("edit.formatPainter");return s.jsx(tt,{icon:$M,label:r("formatPainter"),title:r("formatPainterTip"),size:"large",pressed:n.formatPainter!=null,disabled:f,onClick:h=>{h.detail>1||i("edit.formatPainter",{}).finally(Ie)},onDoubleClick:()=>void i("edit.formatPainter",{sticky:!0}).finally(Ie),"data-testid":"sheet-format-painter","data-sticky":n.formatPainter==="sticky"||void 0})}function o0({font:n,current:i,onPick:o,testId:r}){const u=n.name===i;return s.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":u,className:"kui-menu-item sheet-font-row",style:{fontFamily:n.css},title:n.also[0]&&/[^\x00-\x7f]/.test(n.name)?`${n.name} (${n.also[0]})`:n.name,onClick:()=>o(n.name),"data-testid":`${r}-${n.name}`,children:[s.jsx("span",{className:"sheet-font-check","aria-hidden":"true",children:u?"✓":""}),s.jsx("span",{children:n.name})]})}function ZH({info:n}){var b;const{run:i,enabled:o,t:r}=ze(),u=gn(),f=((b=n.style.font)==null?void 0:b.name)??"",[h,v]=g.useState(null),p=g.useContext(ja)==="primary",y=u||!o("home.fontName"),m=C=>{const E=C.trim();if(v(null),!E)return;const w=Fn.find(S=>[S.name,...S.also].some(z=>z.toLowerCase()===E.toLowerCase())),T=(w==null?void 0:w.name)??E;Qx("recentFonts",T,GH),i("home.fontName",{name:T}).finally(Ie)},x=C=>{C.stopPropagation(),C.key==="Enter"?(C.preventDefault(),m(C.currentTarget.value)):C.key==="Escape"&&(C.preventDefault(),v(null),Ie())};return s.jsxs("span",{className:"sheet-combo","data-primary":"true",children:[s.jsx("input",{className:"kui-ribbon-field sheet-combo-field",style:{width:p?76:118},value:h??f,placeholder:r("fontBox"),"aria-label":r("fontBox"),disabled:y,onChange:C=>v(C.target.value),onFocus:C=>C.currentTarget.select(),onBlur:()=>v(null),onKeyDown:x,"data-testid":"sheet-font"}),s.jsx(Un,{trigger:({toggle:C,open:E})=>s.jsx("button",{type:"button",className:"kui-ribbon-button sheet-combo-arrow","data-primary":"true","aria-label":r("fontMore"),"aria-expanded":E,"aria-pressed":E,disabled:y,onClick:C,"data-testid":"sheet-font-arrow",children:s.jsx(Ka,{size:12,"aria-hidden":"true"})}),children:s.jsx(WH,{current:f,onPick:m})})]})}function WH({current:n,onPick:i}){const{t:o}=ze(),[r,u]=g.useState(""),f=g.useMemo(()=>Af("recentFonts").map(p=>Fn.find(y=>y.name===p)??{name:p,also:[],css:`"${p}"`}),[]),h=g.useRef(null);g.useEffect(YH,[]),g.useEffect(()=>{var y;const p=(y=h.current)==null?void 0:y.querySelector('[aria-checked="true"]');p==null||p.scrollIntoView({block:"nearest"})},[]);const v=r.trim()?Fn.filter(p=>WL(p,r)):null;return s.jsxs("div",{className:"sheet-font-panel","data-testid":"sheet-font-panel",children:[s.jsx("div",{className:"sheet-font-search",children:s.jsx("input",{className:"kui-ribbon-field",type:"search",value:r,placeholder:o("fontSearch"),"aria-label":o("fontSearch"),onChange:p=>u(p.target.value),onKeyDown:p=>{p.key!=="Escape"&&p.key!=="ArrowDown"&&p.stopPropagation(),p.key==="Enter"&&(v!=null&&v.length)&&(p.preventDefault(),i(v[0].name))},"data-testid":"sheet-font-search"})}),s.jsx("div",{className:"sheet-font-list",ref:h,"data-testid":"sheet-font-list",children:v?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"sheet-font-heading","data-testid":"sheet-font-results",children:o("fontResults",{count:v.length})}),v.length?v.map(p=>s.jsx(o0,{font:p,current:n,onPick:i,testId:"sheet-font-result"},p.name)):s.jsx("div",{className:"sheet-font-empty","data-testid":"sheet-font-empty",children:o("fontNoResults")})]}):s.jsxs(s.Fragment,{children:[f.length?s.jsxs("div",{"data-testid":"sheet-font-recent",children:[s.jsx("div",{className:"sheet-font-heading",children:o("fontRecent")}),f.map(p=>s.jsx(o0,{font:p,current:n,onPick:i,testId:"sheet-font-recent"},p.name))]}):null,s.jsxs("div",{"data-testid":"sheet-font-all",children:[s.jsx("div",{className:"sheet-font-heading",children:o("fontAll")}),Fn.map(p=>s.jsx(o0,{font:p,current:n,onPick:i,testId:"sheet-font-item"},p.name))]})]})})]})}function QH({info:n}){var x;const{run:i,enabled:o,t:r}=ze(),u=gn(),f=((x=n.style.font)==null?void 0:x.size)??11,[h,v]=g.useState(null),p=g.useContext(ja)==="primary",y=u||!o("home.fontSize"),m=b=>{v(null);const C=Number(b.trim());if(!b.trim()||!Number.isFinite(C)||C<1||C>409){Xt("error",r("fontSizeRange")),Ie();return}i("home.fontSize",{size:C}).finally(Ie)};return s.jsxs("span",{className:"sheet-combo","data-primary":"true",children:[s.jsx("input",{className:"kui-ribbon-field sheet-combo-field",style:{width:p?24:36},value:h??String(f),"aria-label":r("fontSizeBox"),inputMode:"decimal",disabled:y,onChange:b=>v(b.target.value),onFocus:b=>b.currentTarget.select(),onBlur:()=>v(null),onKeyDown:b=>{b.stopPropagation(),b.key==="Enter"?(b.preventDefault(),m(b.currentTarget.value)):b.key==="Escape"&&(b.preventDefault(),v(null),Ie())},"data-testid":"sheet-size"}),s.jsx(Un,{trigger:({toggle:b,open:C})=>s.jsx("button",{type:"button",className:"kui-ribbon-button sheet-combo-arrow","data-primary":"true","aria-label":r("fontSizeList"),"aria-expanded":C,"aria-pressed":C,disabled:y,onClick:b,"data-testid":"sheet-size-arrow",children:s.jsx(Ka,{size:12,"aria-hidden":"true"})}),children:s.jsx("div",{className:"sheet-size-list","data-testid":"sheet-size-list",children:Ux.map(b=>s.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":b===f,className:"kui-menu-item sheet-font-row",onClick:()=>void i("home.fontSize",{size:b}).finally(Ie),"data-testid":`sheet-size-item-${b}`,children:[s.jsx("span",{className:"sheet-font-check","aria-hidden":"true",children:b===f?"✓":""}),s.jsx("span",{children:b})]},b))})})]})}const JH=()=>Es()?"⌘":"Ctrl+";function Fg({command:n,none:i,noneLabel:o,icon:r,label:u,store:f,initial:h,testId:v}){const{run:p,enabled:y,t:m}=ze(),x=gn(),[b,C]=g.useState(()=>ds("sheet",f,X=>typeof X=="string"&&/^#[0-9A-F]{6}$/i.test(X)?X:void 0)??h),[E,w]=g.useState(()=>Af(`${f}Recent`)),[T,S]=g.useState(""),z=x||!y(n),L=X=>{p(n,{color:X}).finally(Ie)},K=X=>{const re=X.toUpperCase();C(re),Ji("sheet",f,re),w(Qx(`${f}Recent`,re,PH)),L(re)};return s.jsxs("span",{className:"sheet-split","data-primary":"true",children:[s.jsx(tt,{icon:r,label:u,size:"icon",swatch:b,primary:!0,disabled:z,onClick:()=>L(b),"data-testid":`${v}-apply`,"data-color":b}),s.jsxs(Un,{trigger:({toggle:X,open:re})=>s.jsx("button",{type:"button",className:"kui-ribbon-button sheet-split-arrow","data-primary":"true","aria-label":`${u} — ${m("colorMenu")}`,"aria-expanded":re,"aria-pressed":re,disabled:z,onClick:X,"data-testid":v,children:s.jsx(Ka,{size:11,"aria-hidden":"true"})}),children:[s.jsxs("button",{type:"button",className:"kui-menu-item",role:"menuitem",onClick:()=>void p(n,{color:i}).finally(Ie),"data-testid":`${v}-none`,children:[s.jsx("span",{style:{width:15}}),s.jsx("span",{children:o})]}),s.jsx(pn,{onPick:K,testId:`${v}-colors`}),E.length?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"sheet-font-heading",children:m("colorRecent")}),s.jsx(pn,{colors:E,onPick:K,testId:`${v}-recent`})]}):null,s.jsx("div",{className:"sheet-font-heading",children:m("colorMore")}),s.jsxs("div",{className:"sheet-color-more",children:[s.jsx("input",{type:"color","aria-label":m("colorMore"),value:/^#[0-9A-F]{6}$/i.test(T)?T:b,onChange:X=>S(X.target.value.toUpperCase()),"data-testid":`${v}-picker`}),s.jsx("input",{className:"kui-ribbon-field",style:{width:84},value:T,placeholder:"#3C5593","aria-label":m("colorHex"),onChange:X=>S(X.target.value),onKeyDown:X=>{var re,ae;X.key!=="Escape"&&X.stopPropagation(),X.key==="Enter"&&(X.preventDefault(),(ae=(re=X.currentTarget.parentElement)==null?void 0:re.querySelector("button"))==null||ae.click())},"data-testid":`${v}-hex`}),s.jsx("button",{type:"button",className:"kui-ribbon-button",onClick:()=>{const X=T.trim().startsWith("#")?T.trim():`#${T.trim()}`;if(!/^#[0-9A-F]{6}$/i.test(X)){Xt("error",m("colorBad"));return}S(""),K(X)},"data-testid":`${v}-hex-ok`,children:m("colorApply")})]})]})]})}const Ug=1e3,Ig=100;function dc({before:n,after:i,initial:o,max:r,disabled:u,onRun:f,testId:h}){const[v,p]=g.useState(String(Math.max(1,Math.min(o,r)))),y=g.useRef(null),m=Number(v),x=!u&&Number.isInteger(m)&&m>=1,b=()=>{var C;x&&(f(m),(C=y.current)==null||C.click())};return s.jsxs("div",{className:"kui-menu-item sheet-count-item",role:"menuitem",tabIndex:-1,"aria-disabled":u||void 0,"data-disabled":u||void 0,onClick:C=>{C.target.closest("input, button")||b()},onKeyDown:C=>{C.target===C.currentTarget&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),C.stopPropagation(),b())},"data-testid":h,children:[s.jsx("span",{style:{width:15}}),s.jsx("span",{children:n}),s.jsx("input",{className:"sheet-count-field",inputMode:"numeric",value:v,disabled:u,"aria-label":`${n} ${i}`,onChange:C=>{const E=C.target.value;/^\d*$/.test(E)&&p(E===""?"":String(Math.min(Number(E),r)))},onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),b()),C.key!=="Escape"&&C.stopPropagation()},"data-testid":`${h}-count`}),s.jsx("span",{children:i}),s.jsx("button",{ref:y,type:"button",tabIndex:-1,"aria-hidden":"true",style:{display:"none"}})]})}function lu(n){const{run:i,enabled:o,t:r}=ze(),u=gn(),{lines:f}=n,h=f.wholeRows&&f.wholeCols,v=u||n.editing,p=(y,m)=>{i(y,m).finally(Ie)};return{t:r,lines:f,rowsOff:v||h||!o("home.insertRows"),colsOff:v||h||!o("home.insertColumns"),deleteRowsOff:v||h||!o("home.deleteRows"),deleteColsOff:v||h||!o("home.deleteColumns"),cellsOff:v||h||!o("home.insertCells"),deleteCellsOff:v||h||!o("home.deleteCells"),sheetOff:u||n.editing||!o("home.insertSheet"),insertRows:(y,m)=>p("home.insertRows",m?{count:y,below:m}:{count:y}),insertColumns:(y,m)=>p("home.insertColumns",m?{count:y,right:m}:{count:y}),deleteRows:()=>p("home.deleteRows",{}),deleteColumns:()=>p("home.deleteColumns",{}),insertCells:y=>p("home.insertCells",{shift:y}),deleteCells:y=>p("home.deleteCells",{shift:y}),insertSheet:()=>p("home.insertSheet",{})}}function G0({info:n,testId:i,rows:o=!0,cols:r=!0}){const u=lu(n),{t:f}=u;return s.jsxs(s.Fragment,{children:[o?s.jsxs(s.Fragment,{children:[s.jsx(dc,{before:f("insertAbove"),after:f("insertAboveAfter"),initial:u.lines.rows,max:Ug,disabled:u.rowsOff,onRun:h=>u.insertRows(h,!1),testId:`${i}-rows-above`},`a${u.lines.rows}`),s.jsx(dc,{before:f("insertBelow"),after:f("insertBelowAfter"),initial:u.lines.rows,max:Ug,disabled:u.rowsOff,onRun:h=>u.insertRows(h,!0),testId:`${i}-rows-below`},`b${u.lines.rows}`)]}):null,r?s.jsxs(s.Fragment,{children:[s.jsx(dc,{before:f("insertLeft"),after:f("insertLeftAfter"),initial:u.lines.cols,max:Ig,disabled:u.colsOff,onRun:h=>u.insertColumns(h,!1),testId:`${i}-cols-left`},`l${u.lines.cols}`),s.jsx(dc,{before:f("insertRight"),after:f("insertRightAfter"),initial:u.lines.cols,max:Ig,disabled:u.colsOff,onRun:h=>u.insertColumns(h,!0),testId:`${i}-cols-right`},`r${u.lines.cols}`)]}):null]})}function eB({info:n,testId:i}){const o=lu(n);return s.jsxs(s.Fragment,{children:[s.jsx(G0,{info:n,testId:i}),s.jsx(we,{label:o.t("insertCellsRight"),disabled:o.cellsOff,onSelect:()=>o.insertCells("right"),testId:`${i}-cells-right`}),s.jsx(we,{label:o.t("insertCellsDown"),disabled:o.cellsOff,onSelect:()=>o.insertCells("down"),testId:`${i}-cells-down`}),s.jsx(we,{label:o.t("insertSheetItem"),disabled:o.sheetOff,onSelect:o.insertSheet,testId:`${i}-sheet`})]})}function Jx({info:n,testId:i,sheet:o=!1}){const r=lu(n);return s.jsxs(s.Fragment,{children:[s.jsx(we,{label:r.t("deleteCellsLeft"),disabled:r.deleteCellsOff,onSelect:()=>r.deleteCells("left"),testId:`${i}-cells-left`}),s.jsx(we,{label:r.t("deleteCellsUp"),disabled:r.deleteCellsOff,onSelect:()=>r.deleteCells("up"),testId:`${i}-cells-up`}),s.jsx(we,{label:r.t("deleteRowsItem"),disabled:r.deleteRowsOff,onSelect:r.deleteRows,testId:`${i}-rows`}),s.jsx(we,{label:r.t("deleteColsItem"),disabled:r.deleteColsOff,onSelect:r.deleteColumns,testId:`${i}-cols`}),o?s.jsx(Le,{command:"home.deleteSheet",label:r.t("deleteSheetItem")}):null]})}let P0=()=>{};const tB=n=>P0(n);function aB({info:n,onClipboard:i}){const{t:o,enabled:r,run:u,ask:f}=ze(),[h,v]=g.useState(null);g.useEffect(()=>(P0=v,()=>{P0=()=>{}}),[]),g.useEffect(()=>{if(!h)return;const E=()=>v(null);return window.addEventListener("blur",E),()=>window.removeEventListener("blur",E)},[h]);const p=lu(n),y=()=>{v(null),Ie()},m=s.jsxs(s.Fragment,{children:[s.jsx(we,{label:o("menuCut"),disabled:!r("edit.cut"),onSelect:()=>i("cut"),testId:"sheet-grid-menu-cut"}),s.jsx(we,{label:o("menuCopy"),disabled:!r("edit.copy"),onSelect:()=>i("copy"),testId:"sheet-grid-menu-copy"}),s.jsx(we,{label:o("menuPaste"),disabled:!r("edit.paste"),onSelect:()=>i("paste"),testId:"sheet-grid-menu-paste"}),(h==null?void 0:h.target)==="cell"||(h==null?void 0:h.target)==="all"?s.jsx(we,{label:o("pasteSpecialItem"),disabled:!r("edit.pasteSpecial"),onSelect:()=>f("edit.pasteSpecial"),testId:"sheet-grid-menu-paste-special"}):null,s.jsx(St,{})]}),x=(h==null?void 0:h.target)==="rows",b=(E,w={})=>void u(E,w).finally(Ie),C=()=>{var w;(((w=n.stats)==null?void 0:w.count)??0)>1?jf({title:o("mergeTitle"),message:o("mergeConfirm"),testId:"sheet-merge-confirm",onOk:()=>b("home.mergeCells")}):b("home.mergeCells")};return s.jsxs(g0,{at:(h==null?void 0:h.at)??null,onClose:y,label:o("gridMenu"),testId:"sheet-grid-menu",children:[(h==null?void 0:h.target)==="cell"||(h==null?void 0:h.target)==="all"?s.jsxs(s.Fragment,{children:[m,s.jsx(bl,{label:o("deleteMenu"),path:"Grid/Delete",testId:"sheet-grid-menu-delete",children:s.jsx(Jx,{info:n,testId:"sheet-grid-delete"})}),s.jsxs(bl,{label:o("insertMenu"),path:"Grid/Insert",testId:"sheet-grid-menu-insert",children:[s.jsx(we,{label:o("insertCellsRight"),disabled:p.cellsOff,onSelect:()=>p.insertCells("right"),testId:"sheet-grid-insert-cells-right"}),s.jsx(we,{label:o("insertCellsDown"),disabled:p.cellsOff,onSelect:()=>p.insertCells("down"),testId:"sheet-grid-insert-cells-down"}),s.jsx(G0,{info:n,testId:"sheet-grid-insert"}),s.jsx(St,{}),s.jsx(we,{label:o("insertSheetItem"),disabled:p.sheetOff,onSelect:p.insertSheet,testId:"sheet-grid-insert-sheet"})]}),s.jsx(St,{}),s.jsxs(bl,{label:o("clearMenu"),path:"Grid/Clear",testId:"sheet-grid-menu-clear",children:[s.jsx(we,{label:o("clearAllItem"),disabled:!r("edit.clearAll"),onSelect:()=>b("edit.clearAll"),testId:"sheet-grid-clear-all"}),s.jsx(we,{label:o("clearFormatsItem"),disabled:!r("edit.clearFormats"),onSelect:()=>b("edit.clearFormats"),testId:"sheet-grid-clear-formats"}),s.jsx(we,{label:o("clearContentsItem"),disabled:!r("edit.clearContents"),onSelect:()=>b("edit.clearContents"),testId:"sheet-grid-clear-contents"}),s.jsx(we,{label:o("clearCommentsItem"),disabled:!r("edit.clearComments"),onSelect:()=>b("edit.clearComments"),testId:"sheet-grid-clear-comments"}),s.jsx(we,{label:o("clearLinksItem"),disabled:!r("edit.clearHyperlinks"),onSelect:()=>b("edit.clearHyperlinks"),testId:"sheet-grid-clear-links"})]}),s.jsxs(bl,{label:o("sortMenu"),path:"Grid/Sort",testId:"sheet-grid-menu-sort",children:[s.jsx(we,{label:o("sortAscendingItem"),disabled:!r("data.sortAscending"),onSelect:()=>b("data.sortAscending"),testId:"sheet-grid-sort-ascending"}),s.jsx(we,{label:o("sortDescendingItem"),disabled:!r("data.sortDescending"),onSelect:()=>b("data.sortDescending"),testId:"sheet-grid-sort-descending"})]}),s.jsx(we,{label:o("mergeCellsItem"),disabled:!r("home.mergeCells"),onSelect:C,testId:"sheet-grid-menu-merge"}),s.jsx(we,{label:o("unmergeCellsItem"),disabled:!r("home.unmergeCells"),onSelect:()=>b("home.unmergeCells"),testId:"sheet-grid-menu-unmerge"}),s.jsx(St,{}),s.jsx(we,{label:o("insertNoteItem"),disabled:!r("review.newNote"),onSelect:()=>f("review.newNote"),testId:"sheet-grid-menu-note"}),s.jsx(we,{label:o("linkItem"),disabled:n.checkbox||!r("insert.link"),onSelect:()=>b("insert.link"),testId:"sheet-grid-menu-link"}),s.jsx(Le,{command:"home.formatCells",label:o("formatCellsItem")})]}):null,(h==null?void 0:h.target)==="rows"||(h==null?void 0:h.target)==="cols"?s.jsxs(s.Fragment,{children:[m,s.jsx(we,{label:o("deleteMenu"),disabled:x?p.deleteRowsOff:p.deleteColsOff,onSelect:x?p.deleteRows:p.deleteColumns,testId:"sheet-grid-menu-delete"}),s.jsx(Le,{command:x?"home.hideRows":"home.hideColumns",label:o("hideLines")}),s.jsx(Le,{command:x?"home.unhideRows":"home.unhideColumns",label:o("unhideLines")}),s.jsx(G0,{info:n,testId:"sheet-grid-insert",rows:x,cols:!x}),s.jsx(Le,{command:x?"home.rowHeight":"home.columnWidth",ask:!0,label:o(x?"rowHeightItem":"columnWidthItem")}),s.jsx(St,{}),s.jsx(Le,{command:"edit.clearContents",label:o("clearContents")}),s.jsx(Le,{command:"home.formatCells",label:o("formatCellsItem")})]}):null]})}function eS({info:n,size:i="large"}){const{enabled:o,t:r}=ze(),u=gn();return s.jsx(et,{icon:n3,label:r("freezePanes"),size:i,disabled:u||!o("view.freezeTopRow"),testId:"sheet-freeze",primary:!0,children:s.jsx(nB,{info:n})})}function nB({info:n}){const{run:i,t:o}=ze(),{row:r,colIndex:u}=R0(n.active),f=r-1,h=u-1,v=n.freeze[0]>0||n.freeze[1]>0,p=g.useRef(null),y=(E,w)=>{const T=E||w?`${E},${w}`:null;T!==p.current&&(p.current=T,i("editor.freezePreview",T?{rows:E,cols:w}:{}))},m=g.useRef(i);m.current=i,g.useEffect(()=>()=>{p.current&&m.current("editor.freezePreview",{})},[]);const x=(E,w={})=>{p.current=null,i(E,w).finally(Ie)},b=(E,w,T,S,z,L)=>s.jsx("div",{onPointerEnter:()=>y(w,T),onPointerLeave:()=>p.current!=null&&y(0,0),onFocus:()=>y(w,T),children:s.jsx(we,{label:E,onSelect:()=>x(S,z),testId:L})},L),C=n.active;return s.jsxs(s.Fragment,{children:[v?s.jsxs(s.Fragment,{children:[s.jsx(we,{label:o("unfreezePanes"),onSelect:()=>x("view.unfreezePanes"),testId:"sheet-freeze-off"}),s.jsx(St,{})]}):null,f>0&&h>0?b(o("freezeAt",{row:f,col:D0(h)}),f,h,"view.freezePanes",{cell:C},"sheet-freeze-at"):null,f>0?b(o("freezeRowsAt",{row:f}),f,0,"view.freezeRows",{cell:C},"sheet-freeze-rows"):null,h>0?b(o("freezeColsAt",{col:D0(h)}),0,h,"view.freezeColumns",{cell:C},"sheet-freeze-cols"):null,b(o("freezeTopRow"),1,0,"view.freezeTopRow",{},"sheet-freeze-top-row"),b(o("freezeFirstColumn"),0,1,"view.freezeFirstColumn",{},"sheet-freeze-first-column")]})}function lB({info:n,testId:i}){const{run:o,t:r}=ze();return s.jsx("div",{className:"sheet-focus-palette",role:"group","aria-label":r("focusCellColors"),"data-testid":i,children:Fx.map((u,f)=>{const h=u.toUpperCase()===n.focusColor.toUpperCase();return s.jsx("button",{type:"button",className:"sheet-focus-swatch",style:{background:u},"aria-pressed":h,"data-selected":h||void 0,"aria-label":r("focusCellColor",{index:f+1}),title:u,onClick:()=>void o("view.focusCell",{color:u}).finally(Ie),"data-testid":`${i}-${f}`},u)})})}function tS({info:n,place:i}){const{run:o,t:r}=ze(),u=i==="ribbon",f=u?"sheet-focus":"sheet-status-focus",h=()=>void o("view.focusCell",{on:!n.focusCell}).finally(Ie);return s.jsxs("span",{className:u?"sheet-focus-split":"sheet-focus-status","data-on":n.focusCell||void 0,children:[u?s.jsx(tt,{icon:Sc,label:r("focusCell"),size:"large",pressed:n.focusCell,onClick:h,"data-testid":f,primary:!0}):s.jsx("button",{type:"button",className:"sheet-focus-icon","aria-pressed":n.focusCell,"aria-label":r("focusCell"),title:r("focusCell"),onClick:h,"data-testid":f,children:s.jsx(Sc,{size:14,"aria-hidden":"true"})}),s.jsx(Un,{placement:u?"below":"auto",trigger:({open:v,toggle:p})=>s.jsx("button",{type:"button",className:"sheet-focus-arrow","aria-expanded":v,"aria-label":r("focusCellColors"),title:r("focusCellColors"),onClick:p,"data-testid":`${f}-arrow`,"data-open":v||void 0,children:v?s.jsx(TM,{size:11,"aria-hidden":"true"}):s.jsx(Ka,{size:11,"aria-hidden":"true"})}),children:s.jsx(lB,{info:n,testId:`${f}-colors`})})]})}function iB({info:n}){const{run:i,enabled:o,t:r}=ze(),u=gn();return s.jsxs(et,{icon:fs,label:r("gridlineColor"),swatch:n.gridColor??void 0,disabled:u||!o("view.gridlineColor"),testId:"sheet-gridline-color",children:[s.jsx(we,{label:r("gridlineAuto"),checked:n.gridColor==null,onSelect:()=>void i("view.gridlineColor",{color:"auto"}).finally(Ie),testId:"sheet-gridline-color-auto"}),s.jsx(pn,{colors:ZL,onPick:f=>void i("view.gridlineColor",{color:f}).finally(Ie),testId:"sheet-gridline-colors"})]})}const rB=[["Bottom Border","bottom"],["Top Border","top"],["Left Border","left"],["Right Border","right"],["No Border","none"],["All Borders","all"],["Outside Borders","outside"],["Thick Outside Borders","thickOutside"],["Bottom Double Border","doubleBottom"],["Thick Bottom Border","thickBottom"],["Top and Bottom Border","topBottom"]],sB=["Normal","Good","Bad","Neutral","Title","Heading 1","Heading 2","Total","Accent1"];function oB({info:n,onClipboard:i}){const{run:o,enabled:r,phrase:u,t:f,testId:h}=ze(),{font:v={},align:p={}}=n.style,y=JH(),m=n.style.num_fmt&&!a0.includes(n.style.num_fmt)?[...a0,n.style.num_fmt]:a0;return s.jsxs(s.Fragment,{children:[s.jsxs(nt,{label:u("Clipboard"),icon:xc,children:[s.jsx(XH,{info:n}),s.jsxs(et,{icon:xc,label:u("Paste"),size:"large",testId:`${h}-paste`,primary:!0,children:[s.jsx(we,{label:u("Paste"),disabled:!r("edit.paste"),onSelect:()=>i("paste"),testId:`${h}-paste-text`}),s.jsx(Le,{command:"edit.pasteSpecial",label:u("Paste Special")})]}),s.jsxs(Ft,{children:[s.jsx(tt,{icon:qc,label:u("Cut"),disabled:!r("edit.cut"),onClick:()=>i("cut"),"data-testid":`${h}-cut`}),s.jsx(tt,{icon:_c,label:u("Copy"),disabled:!r("edit.copy"),onClick:()=>i("copy"),"data-testid":`${h}-copy`})]})]}),s.jsx(nt,{label:u("Font"),icon:hp,children:s.jsxs(Ft,{children:[s.jsxs(Xl,{children:[s.jsx(er,{primary:!0,children:s.jsx(ZH,{info:n})}),s.jsx(er,{primary:!0,children:s.jsx(QH,{info:n})}),s.jsx(Et,{command:"home.increaseFontSize",icon:hT,size:"icon",label:u("Increase Font Size"),title:u("Increase Font Size")}),s.jsx(Et,{command:"home.decreaseFontSize",icon:fT,size:"icon",label:u("Decrease Font Size"),title:u("Decrease Font Size")})]}),s.jsxs(Xl,{children:[s.jsx(Et,{command:"home.bold",primary:!0,icon:CM,size:"icon",pressed:v.bold,label:u("Bold"),title:f("boldTip",{key:y})}),s.jsx(Et,{command:"home.italic",primary:!0,icon:lf,size:"icon",pressed:v.italic,label:u("Italic"),title:f("italicTip",{key:y})}),s.jsx(Et,{command:"home.underline",primary:!0,icon:df,size:"icon",pressed:v.underline!=null&&v.underline!=="None",label:u("Underline"),title:f("underlineTip",{key:y})}),s.jsx(Et,{command:"home.strikethrough",icon:i3,size:"icon",pressed:v.strike,label:u("Strikethrough"),title:f("strikeTip",{key:y})}),s.jsx(et,{icon:tf,label:u("Borders"),size:"icon",testId:"sheet-borders",children:rB.map(([x,b])=>s.jsx(Le,{command:"home.borders",params:{preset:b},label:u(x)},b))}),s.jsx(Fg,{primary:!0,command:"home.fillColor",none:"none",noneLabel:f("colorNoFill"),icon:ms,label:u("Fill Color"),store:"fillColor",initial:"#FFFF00",testId:"sheet-fill"}),s.jsx(Fg,{primary:!0,command:"home.fontColor",none:"auto",noneLabel:f("colorAutomatic"),icon:hp,label:u("Font Color"),store:"fontColor",initial:"#FF0000",testId:"sheet-font-color"})]})]})}),s.jsx(nt,{label:u("Alignment"),icon:Ep,children:s.jsxs(Ft,{children:[s.jsxs(Xl,{children:[s.jsx(Et,{command:"home.alignTop",icon:yT,size:"icon",pressed:p.v==="Top",label:u("Top Align"),title:u("Top Align")}),s.jsx(Et,{command:"home.alignMiddle",icon:pT,size:"icon",pressed:p.v==="Center",label:u("Middle Align"),title:u("Middle Align")}),s.jsx(Et,{command:"home.alignBottom",icon:gT,size:"icon",pressed:p.v==="Bottom",label:u("Bottom Align"),title:u("Bottom Align")}),s.jsxs(et,{icon:JM,label:u("Orientation"),size:"icon",children:[s.jsx(Le,{command:"home.orientation",params:{angle:"counterclockwise"},label:u("Angle Counterclockwise")}),s.jsx(Le,{command:"home.orientation",params:{angle:"clockwise"},label:u("Angle Clockwise")}),s.jsx(Le,{command:"home.orientation",params:{angle:"vertical"},label:u("Vertical Text")}),s.jsx(Le,{command:"home.orientation",params:{angle:"up"},label:u("Rotate Text Up")}),s.jsx(Le,{command:"home.orientation",params:{angle:"down"},label:u("Rotate Text Down")})]}),s.jsx(Et,{command:"home.wrapText",icon:fA,pressed:p.wrap,label:u("Wrap Text")})]}),s.jsxs(Xl,{children:[s.jsx(Et,{command:"home.alignLeft",icon:Ep,size:"icon",pressed:p.h==="Left",label:u("Align Left"),title:u("Align Left")}),s.jsx(Et,{command:"home.alignCenter",primary:!0,icon:sA,size:"icon",pressed:p.h==="Center",label:u("Center"),title:u("Center")}),s.jsx(Et,{command:"home.alignRight",icon:oA,size:"icon",pressed:p.h==="Right",label:u("Align Right"),title:u("Align Right")}),s.jsx(Et,{command:"home.decreaseIndent",icon:mk,size:"icon",label:u("Decrease Indent"),title:u("Decrease Indent")}),s.jsx(Et,{command:"home.increaseIndent",icon:vk,size:"icon",label:u("Increase Indent"),title:u("Increase Indent")}),s.jsxs(et,{icon:iA,label:u("Merge & Center"),testId:"sheet-merge",primary:!0,children:[s.jsx(Le,{command:"home.mergeCenter",label:u("Merge & Center")}),s.jsx(Le,{command:"home.mergeAcross",label:u("Merge Across")}),s.jsx(Le,{command:"home.mergeCells",label:u("Merge Cells")}),s.jsx(Le,{command:"home.unmergeCells",label:u("Unmerge Cells")})]})]})]})}),s.jsx(nt,{label:u("Number"),icon:gp,children:s.jsxs(Ft,{children:[s.jsx(Xl,{children:s.jsx(er,{primary:!0,children:s.jsx("select",{className:"kui-ribbon-field",style:{width:104},value:n.style.num_fmt??"General","aria-label":u("Number Format"),onChange:x=>void o("home.numberFormat",{format:x.target.value}),"data-testid":"sheet-number-format",children:m.map(x=>s.jsx("option",{value:x,children:u(x)},x))})})}),s.jsxs(Xl,{children:[s.jsx(Et,{command:"home.accounting",icon:gp,size:"icon",label:u("Accounting Number Format"),title:u("Accounting Number Format")}),s.jsx(Et,{command:"home.percent",icon:Lk,size:"icon",label:u("Percent Style"),title:u("Percent Style")}),s.jsx(Et,{command:"home.comma",icon:zc,size:"icon",label:u("Comma Style"),title:u("Comma Style")}),s.jsx(Et,{command:"home.increaseDecimal",icon:PT,size:"icon",label:u("Increase Decimal"),title:u("Increase Decimal")}),s.jsx(Et,{command:"home.decreaseDecimal",icon:GT,size:"icon",label:u("Decrease Decimal"),title:u("Decrease Decimal")})]})]})}),s.jsxs(nt,{label:u("Styles"),icon:nr,children:[s.jsxs(et,{icon:nr,label:u("Conditional Formatting"),size:"large",testId:"sheet-cf",children:[s.jsx(Le,{command:"home.conditionalFormat",params:{rule:{type:"dataBar"}},label:u("Data Bars")}),s.jsx(Le,{command:"home.conditionalFormat",params:{rule:{type:"colorScale"}},label:u("Color Scales")}),s.jsx(Le,{command:"home.conditionalFormat",params:{rule:{type:"iconSet"}},label:u("Icon Sets")}),s.jsx(St,{}),s.jsx(Le,{command:"home.clearRules",label:u("Clear Rules")}),s.jsx(Le,{command:"home.manageRules",label:u("Manage Rules")})]}),s.jsx(qH,{info:n}),s.jsx(et,{icon:Pc,label:u("Cell Styles"),size:"large",children:sB.map(x=>s.jsx(Le,{command:"home.cellStyle",params:{name:x},label:u(x)},x))})]}),s.jsxs(nt,{label:u("Cells"),icon:zc,children:[s.jsx(et,{icon:Jk,label:u("Insert"),size:"large",testId:"sheet-insert-menu",children:s.jsx(eB,{info:n,testId:"sheet-insert"})}),s.jsx(et,{icon:Qk,label:u("Delete"),size:"large",testId:"sheet-delete-menu",children:s.jsx(Jx,{info:n,testId:"sheet-delete",sheet:!0})}),s.jsxs(et,{icon:eA,label:u("Format"),size:"large",testId:"sheet-format-menu",children:[s.jsx(Le,{command:"home.rowHeight",ask:!0,label:u("Row Height")}),s.jsx(Le,{command:"home.autofitRowHeight",label:u("AutoFit Row Height")}),s.jsx(Le,{command:"home.columnWidth",ask:!0,label:u("Column Width")}),s.jsx(Le,{command:"home.autofitColumnWidth",label:u("AutoFit Column Width")}),s.jsx(St,{}),s.jsx(Le,{command:"sheet.hide",label:u("Hide Sheet")}),s.jsx(we,{label:u("Unhide Sheet…"),disabled:!n.tabs.some(x=>x.hidden),onSelect:Gx,testId:"sheet-format-unhide"}),s.jsx(St,{}),s.jsx(Le,{command:"home.formatCells",label:u("Format Cells")})]})]}),s.jsxs(nt,{label:u("Editing"),icon:jc,children:[s.jsxs(Ft,{children:[s.jsxs(et,{icon:a3,label:u("AutoSum"),testId:"sheet-autosum",primary:!0,children:[s.jsx(Le,{command:"formulas.autoSum",params:{function:"SUM"},label:u("Sum")}),s.jsx(Le,{command:"formulas.autoSum",params:{function:"AVERAGE"},label:u("Average")}),s.jsx(Le,{command:"formulas.autoSum",params:{function:"COUNT"},label:u("Count Numbers")}),s.jsx(Le,{command:"formulas.autoSum",params:{function:"MAX"},label:u("Max")}),s.jsx(Le,{command:"formulas.autoSum",params:{function:"MIN"},label:u("Min")})]}),s.jsxs(et,{icon:SM,label:u("Fill"),children:[s.jsx(Le,{command:"edit.fillDown",label:u("Down")}),s.jsx(Le,{command:"edit.fillRight",label:u("Right")}),s.jsx(Le,{command:"edit.fillUp",label:u("Up")}),s.jsx(Le,{command:"edit.fillLeft",label:u("Left")}),s.jsx(Le,{command:"edit.fillSeries",ask:!0,label:u("Series")}),s.jsx(Le,{command:"edit.smartFill",label:u("Smart fill")})]}),s.jsxs(et,{icon:Fc,label:u("Clear"),children:[s.jsx(Le,{command:"edit.clearAll",label:u("Clear All")}),s.jsx(Le,{command:"edit.clearFormats",label:u("Clear Formats")}),s.jsx(Le,{command:"edit.clearContents",label:u("Clear Contents")}),s.jsx(Le,{command:"edit.clearComments",label:u("Clear Comments")}),s.jsx(Le,{command:"edit.clearHyperlinks",label:u("Clear Hyperlinks")})]})]}),s.jsxs(Ft,{children:[s.jsxs(et,{icon:bT,label:u("Sort & Filter"),testId:"sheet-sort",primary:!0,children:[s.jsx(Le,{command:"data.sortAscending",label:u("Sort A to Z")}),s.jsx(Le,{command:"data.sortDescending",label:u("Sort Z to A")}),s.jsx(Le,{command:"data.sort",ask:!0,label:u("Custom Sort")}),s.jsx(St,{}),s.jsx(Le,{command:"data.filter",label:u("Filter")}),s.jsx(Le,{command:"data.clearFilter",label:u("Clear")}),s.jsx(Le,{command:"data.reapply",label:u("Reapply")})]}),s.jsx(eS,{info:n,size:"small"}),s.jsxs(et,{icon:jc,label:u("Find & Select"),children:[s.jsx(Le,{command:"edit.find",ask:!0,label:u("Find")}),s.jsx(Le,{command:"edit.replace",ask:!0,label:u("Replace")}),s.jsx(Le,{command:"edit.goTo",ask:!0,label:u("Go To")}),s.jsx(Le,{command:"edit.goToSpecial",ask:!0,label:u("Go To Special")})]})]})]})]})}const cB=["view.freezePanes","view.freezeRows","view.freezeColumns","view.freezeTopRow","view.freezeFirstColumn","view.unfreezePanes"];function uB({info:n,formulaBar:i,onFormulaBar:o}){const{run:r,enabled:u,t:f}=ze();return s.jsxs(s.Fragment,{children:[s.jsxs(nt,{id:"sheet:show",label:f("showGroup"),icon:Uc,children:[s.jsxs(Ft,{children:[s.jsx(er,{primary:!0,children:s.jsx("span",{className:"sheet-show-option",children:s.jsx(ar,{label:f("showGridlines"),checked:n.gridlines,disabled:!u("view.gridlines"),onChange:h=>void r("view.gridlines",{on:h}),testId:"sheet-show-gridlines"})})}),s.jsx(er,{primary:!0,children:s.jsx("span",{className:"sheet-show-option",children:s.jsx(ar,{label:f("showFormulaBar"),checked:i,onChange:o,testId:"sheet-show-formula-bar"})})}),s.jsx(er,{children:s.jsx("span",{className:"sheet-show-option",children:s.jsx(ar,{label:f("showHeadings"),checked:n.headings,disabled:!u("view.headings"),onChange:h=>void r("view.headings",{on:h}),testId:"sheet-show-headings"})})})]}),s.jsx(iB,{info:n})]}),s.jsx(nt,{id:"sheet:focus",label:f("focusCell"),icon:Sc,children:s.jsx(tS,{info:n,place:"ribbon"})}),s.jsx(nt,{id:"sheet:freeze",label:f("freezePanes"),icon:n3,children:s.jsx(eS,{info:n})}),s.jsx(Ga,{menu:"View",omit:["Show"],exclude:cB,primary:Hn.View})]})}function dB(n,i){return n==="pdf"?{format:n,sheets:"all"}:n==="xlsx"||n==="xltx"||!i?{format:n}:{format:n,sheet:i}}function fB(n,i,o,r=null,u=null){const f=n.includes("/")?n.slice(0,n.lastIndexOf("/")+1):"",h=i||n.slice(n.lastIndexOf("/")+1),v=K0(u??h.replace(/\.[^.]+$/,""))||"Book",p=r?K0(r):"";return`${f}${p?`${v} - ${p}`:v}.${o}`}const aS=80;function K0(n){return[...n.replace(/[\\/:*?"<>|]/g,"_").trim()].slice(0,aS).join("").trim()}function hB(n){const i=atob(n),o=new Uint8Array(i.length);for(let r=0;r<i.length;r+=1)o[r]=i.charCodeAt(r);return o}function mB(n,i){const o=JSON.parse(n);if(!o||typeof o.data!="string"||o.extension!==i)throw new Error(`the engine answered no ${i.toUpperCase()} file`);return o}async function vB(n,i,o,r,u,f=null,h={}){const v=mB(await n("file.export",{...dB(o,r),...h}),o),{path:p,name:y}=i.init.document,m=(o==="csv"||o==="html"||o==="png")&&u.length>1?r:null;return i.exportFile(fB(p,y,v.extension,m,f),hB(v.data))}function pB({sheet:n,sheets:i}){const{phrase:o,t:r,host:u,session:f}=ze(),[h,v]=g.useState(!1),[p,y]=g.useState(!1);if(!u.permissions.export)return null;const m=async(C,E=null,w={})=>{const T=f.doc;if(!(!T||h)){v(!0);try{const S=await vB((z,L)=>T.execute(z,L),u,C,n,i,E,w);Xt("success",r(C==="xltx"?"templateSaved":"exported"),S)}catch(S){Xt("error",r(C==="xltx"?"templateFailed":"exportFailed"),o(S instanceof Error?S.message:String(S)))}finally{v(!1)}}},x=h||!f.doc,b=u.init.document.name||u.init.document.path.slice(u.init.document.path.lastIndexOf("/")+1);return s.jsxs(s.Fragment,{children:[s.jsxs(nt,{label:o("Export"),icon:f0,children:[s.jsx(tt,{icon:f0,size:"large",label:o("Export as PDF"),disabled:x,onClick:()=>void m("pdf"),"data-testid":"sheet-export-pdf",primary:!0}),s.jsx(tt,{icon:sk,size:"large",label:o("Export as Picture"),disabled:x,onClick:()=>void m("png"),"data-testid":"sheet-export-png",primary:!0}),s.jsx(tt,{icon:Gc,size:"large",label:o("Export as Excel Workbook"),disabled:x,onClick:()=>void m("xlsx"),"data-testid":"sheet-export-xlsx",primary:!0}),s.jsx(tt,{icon:yp,size:"large",label:o("Export as CSV"),disabled:x,onClick:()=>void m("csv"),"data-testid":"sheet-export-csv",primary:!0}),s.jsx(tt,{icon:yp,size:"large",label:o("Export as CSV UTF-8"),disabled:x,onClick:()=>void m("csv",null,{bom:!0}),"data-testid":"sheet-export-csv-bom",primary:!0}),s.jsx(tt,{icon:ik,size:"large",label:o("Export as Web Page"),disabled:x,onClick:()=>void m("html"),"data-testid":"sheet-export-html",primary:!0})]}),s.jsx(nt,{label:o("Template"),icon:m0,children:s.jsx(tt,{icon:m0,size:"large",label:o("Save as Template"),disabled:x,onClick:()=>y(!0),"data-testid":"sheet-save-template",primary:!0})}),p?s.jsx(gB,{initial:b.replace(/\.[^.]+$/,""),onCancel:()=>y(!1),onSave:C=>{y(!1),m("xltx",C)}}):null]})}function gB({initial:n,onCancel:i,onSave:o}){const{t:r}=ze(),[u,f]=g.useState(n),h=g.useRef(null);g.useEffect(()=>{var y,m;(y=h.current)==null||y.focus(),(m=h.current)==null||m.select()},[]);const v=K0(u),p=()=>{v&&o(v)};return s.jsx(da,{open:!0,onOpenChange:y=>y?void 0:i(),children:s.jsxs(fa,{size:"sm",dismissible:!1,"aria-describedby":void 0,onCloseAutoFocus:y=>{y.preventDefault(),Ie()},"data-testid":"sheet-template-dialog",children:[s.jsx(ma,{children:s.jsx(pa,{children:r("templateTitle")})}),s.jsxs(ha,{children:[s.jsxs("label",{className:"sheet-template-field",children:[s.jsx("span",{children:r("templateName")}),s.jsx("input",{ref:h,value:u,maxLength:aS+20,onChange:y=>f(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),p())},"data-testid":"sheet-template-name"})]}),v?null:s.jsx("p",{className:"sheet-template-hint",role:"alert","data-testid":"sheet-template-required",children:r("templateNameRequired")})]}),s.jsxs(va,{className:"sheet-dialog-actions",children:[s.jsx(De,{variant:"primary",disabled:!v,onClick:p,"data-testid":"sheet-template-ok",children:r("ok")}),s.jsx(De,{variant:"secondary",onClick:i,"data-testid":"sheet-template-cancel",children:r("cancel")})]})]})})}function yB(){let n=null;const i=new Set;return{get:()=>n,set:o=>{n=o;for(const r of i)r()},subscribe:o=>(i.add(o),()=>i.delete(o))}}function bB(n,i,o,r,u){const{marks:f,creates:h}=JL(n),[v,p]=g.useState([]),[y,m]=g.useState([]),x=g.useRef(i);x.current=i;const b=g.useCallback((S,z)=>{const L=x.current;return L?L.execute(S,z):Promise.reject(new Error("no workbook is open"))},[]);g.useEffect(()=>f?n.onComments(p):void 0,[n,f]),g.useEffect(()=>{f&&n.locateComments(async S=>x.current?(await jg(b,S)).map(z=>z.found===!0):S.map(()=>!1))},[n,f,b]),g.useEffect(()=>{if(!f||!i)return;let S=!0;return jg(b,v.map(z=>z.anchor)).then(z=>{S&&m(tH(v,z))}).catch(()=>{S&&m([])}),()=>{S=!1}},[f,i,o,r,v,b]);const C=g.useMemo(()=>{if(!y.length)return null;const S=getComputedStyle(document.documentElement).getPropertyValue("--kit-primary").trim()||"#1a8641";return(z,L)=>{z.fillStyle=S,z.strokeStyle="rgba(255, 255, 255, 0.9)",z.lineWidth=1;for(const K of y){const X=L(K.x,K.y);z.beginPath(),z.moveTo(X.x-zg,X.y),z.lineTo(X.x,X.y),z.lineTo(X.x,X.y+zg),z.closePath(),z.fill(),z.stroke()}}},[y]),[E,w]=g.useState(!1),T=g.useCallback(async()=>{if(!E){w(!0);try{const S=await eH(b);await n.service("comment.create",{anchor:S})}catch(S){nH(S)!=="cancelled"&&Xt("error",u,S instanceof Error?S.message:String(S))}finally{w(!1)}}},[E,u,n,b]);return{marks:f,creates:h,markers:y,decorate:C,create:T,busy:E}}function MB({markers:n,views:i,pins:o,onActivate:r,label:u}){const f=g.useSyncExternalStore(i.subscribe,i.get);return!f||!n.length?null:s.jsx(s.Fragment,{children:n.map(h=>{const v=aH(f,o,h);return v?s.jsx("button",{type:"button",className:"sheet-comment-marker",style:{left:v.left,top:v.top,width:O0,height:O0},"aria-label":u(h.count),title:u(h.count),"data-testid":"sheet-comment-marker","data-thread":h.thread,onPointerDown:p=>p.stopPropagation(),onClick:()=>r(h.thread)},h.thread):null})})}function xB({onCreate:n,busy:i}){const{phrase:o,session:r}=ze();return s.jsxs(nt,{label:o("Comments"),icon:Sp,children:[s.jsx(tt,{icon:Sp,size:"large",label:o("New Comment"),disabled:i||!r.doc,onClick:n,"data-testid":"sheet-host-comment",primary:!0}),s.jsx(Ax,{path:"Review/Comments",exclude:["review.newComment"]})]})}const SB=[["+","−","×","÷","±","≡","≠","≈"],["≤","≥","‰","¼","½","α","β","θ"],["℃","°","√","∞","∑","π","Ω","μ"],["←","→","↑","↓","①","②","③","№"],["©","®","™","§","※","□","☑","☒"]],wB=16,CB=[["—","specialEmDash"],["–","specialEnDash"],["‑","specialNbHyphen"],[" ","specialEmSpace"],[" ","specialEnSpace"],[" ","specialQuarterSpace"],[" ","specialNbSpace"],["©","specialCopyright"],["®","specialRegistered"],["™","specialTrademark"],["§","specialSection"],["¶","specialParagraph"],["…","specialEllipsis"],["‘","specialSingleOpen"],["’","specialSingleClose"],["“","specialDoubleOpen"],["”","specialDoubleClose"],["°","specialDegree"],["℃","specialCelsius"],["‰","specialPerMille"],["±","specialPlusMinus"],["×","specialTimes"],["÷","specialDivide"],["√","specialRoot"],["∞","specialInfinity"],["≈","specialAlmostEqual"],["≠","specialNotEqual"],["≤","specialLessEqual"],["≥","specialGreaterEqual"],["€","specialEuro"],["¥","specialYuan"],["£","specialPound"],["№","specialNumero"]],Lc=()=>ds("sheet","recentSymbols",n=>Array.isArray(n)&&n.every(i=>typeof i=="string")?n:void 0)??[],EB=n=>Ji("sheet","recentSymbols",[n,...Lc().filter(i=>i!==n)].slice(0,wB));function nS(n=!0){const{run:i}=ze();return o=>{EB(o);const r=i("insert.symbol",{char:o});return n?r.finally(Ie):r}}function zB(){const{enabled:n,phrase:i}=ze(),o=gn();return s.jsx(nt,{label:i("Symbols"),icon:Ec,children:s.jsx(et,{icon:Ec,label:i("Symbol"),size:"large",primary:!0,testId:"sheet-symbol",disabled:o||!n("insert.symbol"),children:s.jsx(jB,{})})})}function jB(){const{t:n}=ze(),i=nS(),o=g.useMemo(Lc,[]),r=(u,f)=>s.jsx("button",{type:"button",role:"menuitem",className:"sheet-symbol-cell",onClick:()=>void i(u),"data-symbol":u,"data-testid":f,children:u},u);return s.jsxs("div",{className:"sheet-symbol-panel","data-testid":"sheet-symbol-panel",children:[s.jsx("div",{className:"sheet-symbol-heading","data-testid":"sheet-symbol-recent-title",children:n("symbolRecent")}),s.jsx("div",{className:"sheet-symbol-grid sheet-symbol-recent","data-testid":"sheet-symbol-recent",children:o.map(u=>r(u,"sheet-symbol-recent-item"))}),s.jsx("div",{className:"sheet-symbol-heading","data-testid":"sheet-symbol-common-title",children:n("symbolCommon")}),s.jsx("div",{className:"sheet-symbol-grid","data-testid":"sheet-symbol-common",children:SB.flat().map(u=>r(u,"sheet-symbol-item"))}),s.jsx("div",{className:"kui-menu-separator",role:"separator"}),s.jsxs("button",{type:"button",role:"menuitem",className:"kui-menu-item",onClick:()=>TB(),"data-testid":"sheet-symbol-more",children:[s.jsx(Ec,{size:15,"aria-hidden":"true"}),s.jsx("span",{children:n("symbolMore")})]})]})}let Y0=0;const X0=new Set,TB=()=>{Y0+=1;for(const n of X0)n(Y0)};let Vg=null;const kB=()=>(Vg??(Vg=ns(async()=>{const{NAMES:n,SUBSETS:i}=await import("./symbolNames--e2SA9f6.js");return{NAMES:n,SUBSETS:i}},[],import.meta.url).then(({NAMES:n,SUBSETS:i})=>{const o=new Map;for(const u of n.split(`
|
|
98
|
-
`)){const f=u.indexOf(" ");f>0&&o.set(parseInt(u.slice(0,f),16),u.slice(f+1))}const r=i.map(u=>{const f=[];for(let h=u.from;h<=u.to;h+=1)o.has(h)&&f.push(String.fromCodePoint(h));return{id:u.id,zh:u.zh,en:u.en,chars:f}});return{names:o,subsets:r}})),Vg),qg=16,AB=n=>(n.codePointAt(0)??0).toString(16).toUpperCase().padStart(4,"0");function NB(){var F;const{t:n}=ze(),i=nS(!1),[o,r]=g.useState(Y0),[u,f]=g.useState(!1),[h,v]=g.useState("symbols"),[p,y]=g.useState(null),[m,x]=g.useState(""),[b,C]=g.useState("basicLatin"),[E,w]=g.useState(""),[T,S]=g.useState(""),[z,L]=g.useState(null),[K,X]=g.useState([]);g.useEffect(()=>(X0.add(r),()=>{X0.delete(r)}),[]),g.useEffect(()=>{o!==0&&(f(!0),v("symbols"),x(""),C("basicLatin"),w(""),S(""),L(null),X(Lc()),kB().then(y))},[o]);const re=A=>n("symbolSubsetNames")==="zh"?A.zh:A.en,ae=g.useMemo(()=>{var H,le;if(!p)return[];const A=T.trim().toLowerCase();if(A){const ve=[];for(const Z of p.subsets)for(const I of Z.chars)(H=p.names.get(I.codePointAt(0)??0))!=null&&H.toLowerCase().includes(A)&&ve.push(I);return ve}return((le=p.subsets.find(ve=>ve.id===b))==null?void 0:le.chars)??[]},[p,b,T]),de=g.useMemo(()=>{const A=T.trim().toLowerCase();return CB.filter(([H,le])=>{var ve;return!A||n(le).toLowerCase().includes(A)||(((ve=p==null?void 0:p.names.get(H.codePointAt(0)??0))==null?void 0:ve.toLowerCase().includes(A))??!1)})},[T,p,n]);if(!u)return null;const ge=()=>f(!1),je=async A=>{A&&(await i(A),X(Lc()))},be=(F=Fn.find(A=>A.name===m))==null?void 0:F.css,Me=A=>(p==null?void 0:p.names.get(A.codePointAt(0)??0))??"",Be=A=>{A.key!=="Escape"&&A.stopPropagation(),A.key==="Enter"&&(A.preventDefault(),S(E))},ye=(A,H)=>s.jsx("button",{type:"button",role:"gridcell",className:"sheet-symbol-cell","aria-selected":A===z,title:Me(A),style:be?{fontFamily:be}:void 0,onClick:()=>L(A),onDoubleClick:()=>void je(A),"data-symbol":A,"data-testid":H,children:A},`${H}-${A}`);return s.jsx(da,{open:!0,onOpenChange:A=>A?void 0:ge(),children:s.jsxs(fa,{size:"lg",dismissible:!1,"aria-describedby":void 0,onCloseAutoFocus:A=>{A.preventDefault(),Ie()},"data-testid":"sheet-symbol-dialog",children:[s.jsx(ma,{children:s.jsx(pa,{children:n("symbolTitle")})}),s.jsxs(ha,{children:[s.jsx("div",{className:"sheet-fc-tabs",role:"tablist",children:["symbols","special"].map(A=>s.jsx("button",{type:"button",role:"tab","aria-selected":h===A,onClick:()=>v(A),"data-testid":`sheet-symbol-tab-${A}`,children:n(A==="symbols"?"symbolTabSymbols":"symbolTabSpecial")},A))}),s.jsxs("div",{className:"sheet-symbol-controls",children:[s.jsx("input",{className:"kui-field sheet-symbol-search",type:"search",value:E,placeholder:n("symbolSearch"),"aria-label":n("symbolSearch"),onChange:A=>{w(A.target.value),A.target.value||S("")},onKeyDown:Be,"data-testid":"sheet-symbol-search"}),s.jsxs("span",{className:"sheet-dialog-row",children:[s.jsx("span",{children:n("symbolFont")}),s.jsxs("select",{className:"kui-field",value:m,onChange:A=>x(A.target.value),"data-testid":"sheet-symbol-font",children:[s.jsx("option",{value:"",children:n("symbolNormalText")}),Fn.map(A=>s.jsx("option",{value:A.name,children:A.name},A.name))]})]}),s.jsxs("span",{className:"sheet-dialog-row",children:[s.jsx("span",{children:n("symbolSubset")}),s.jsx("select",{className:"kui-field",value:b,disabled:!p||h!=="symbols",onChange:A=>{C(A.target.value),S(""),w("")},"data-testid":"sheet-symbol-subset",children:((p==null?void 0:p.subsets)??[{id:"basicLatin",zh:"基本拉丁字母",en:"Basic Latin"}]).map(A=>s.jsx("option",{value:A.id,children:re(A)},A.id))})]})]}),h==="symbols"?s.jsx("div",{className:"sheet-symbol-dialog-grid",role:"grid",style:{gridTemplateColumns:`repeat(${qg}, 1fr)`},"data-testid":"sheet-symbol-grid",children:ae.map(A=>ye(A,"sheet-symbol-grid-item"))}):s.jsx("div",{className:"sheet-symbol-special",role:"listbox","data-testid":"sheet-symbol-special",children:de.map(([A,H])=>s.jsxs("button",{type:"button",role:"option","aria-selected":A===z,className:"sheet-symbol-special-row",onClick:()=>L(A),onDoubleClick:()=>void je(A),"data-symbol":A,"data-testid":"sheet-symbol-special-item",children:[s.jsx("span",{className:"sheet-symbol-special-char",style:be?{fontFamily:be}:void 0,children:A.trim()?A:"·"}),s.jsx("span",{children:n(H)})]},H))}),s.jsx("div",{className:"sheet-symbol-heading",children:n("symbolRecentDialog")}),s.jsx("div",{className:"sheet-symbol-dialog-grid sheet-symbol-recent",style:{gridTemplateColumns:`repeat(${qg}, 1fr)`},"data-testid":"sheet-symbol-dialog-recent",children:K.map(A=>ye(A,"sheet-symbol-dialog-recent-item"))}),s.jsxs("div",{className:"sheet-symbol-info","data-testid":"sheet-symbol-info",children:[s.jsx("span",{"data-testid":"sheet-symbol-name",children:z?Me(z):""}),s.jsxs("span",{children:[n("symbolCode"),s.jsx("output",{"data-testid":"sheet-symbol-code",children:z?AB(z):""})]}),s.jsx("span",{"data-testid":"sheet-symbol-from",children:n("symbolFrom")})]})]}),s.jsxs(va,{className:"sheet-dialog-actions",children:[s.jsx(De,{variant:"primary",disabled:!z,onClick:()=>void je(z),"data-testid":"sheet-symbol-insert",children:n("symbolInsert")}),s.jsx(De,{variant:"secondary",onClick:ge,"data-testid":"sheet-symbol-close",children:n("symbolClose")})]})]})})}function c0(n){return n.dataset.colorScheme==="dark"?"dark":"light"}function RB(n=document.documentElement){const[i,o]=g.useState(()=>c0(n));return g.useEffect(()=>{if(o(c0(n)),typeof MutationObserver>"u")return;const r=new MutationObserver(()=>o(c0(n)));return r.observe(n,{attributes:!0,attributeFilter:["data-color-scheme"]}),()=>r.disconnect()},[n]),i}const DB=[["file","File"],["home","Home"],["insert","Insert"],["draw","Draw"],["pageLayout","Page Layout"],["formulas","Formulas"],["data","Data"],["review","Review"],["view","View"],["automate","Automate"]];function OB({host:n,phrase:i}){var _e,J,he,Ee;const o=g.useMemo(()=>Ex(_x,n.init.locale),[n]),r=g.useMemo(()=>({...n,failed:O=>n.failed(new Error(us(i,o,O)))}),[n,i,o]),u=g.useMemo(UL,[]),f=wO(r,u,KL),h=g.useMemo(()=>f.failure?{...f,failure:us(i,o,f.failure)}:f,[f,i,o]),v=nO(h,r,o,"sheet",i,void 0,{report:(O,oe)=>Xt("error",O,us(i,o,oe))}),{doc:p,change:y,state:m}=h,x=g.useRef(null),b=(p==null?void 0:p.info.revision)??0,C=g.useRef(b);C.current=b,x.current!==null&&b>x.current&&(x.current=null),g.useEffect(()=>{const O=oe=>{const fe=oe.target,N=fe instanceof HTMLTextAreaElement&&fe.classList.contains("kui-text-sink"),G=fe instanceof HTMLCanvasElement&&fe.closest(".kui-canvas")!=null;(N||G)&&(x.current=C.current)};return document.addEventListener("input",O,!0),document.addEventListener("pointerdown",O,!0),()=>{document.removeEventListener("input",O,!0),document.removeEventListener("pointerdown",O,!0)}},[]);const E=DL(h.tool,p!=null,y,{initial:"select",hostTools:{},escapable:()=>(m==null?void 0:m.escape)===!0||x.current!==null}),w=g.useRef(null),T=g.useRef({x:0,y:0,zoom:1}),[S,z]=g.useState(1),[L,K]=g.useState("home"),X=g.useRef({doc:p,right:0,bottom:0}),re=g.useRef({x:0,y:0,timer:0}),ae=bB(r,p,y,m==null?void 0:m.sheet,o("commentFailed")),de=g.useMemo(yB,[]);g.useEffect(()=>{E.refresh()},[m==null?void 0:m.formulaText,p==null?void 0:p.info.width,p==null?void 0:p.info.height,m==null?void 0:m.focusCell,m==null?void 0:m.focusColor,m==null?void 0:m.freeze.join(),(_e=m==null?void 0:m.freezePreview)==null?void 0:_e.join(),m==null?void 0:m.freezeShift.join(),m==null?void 0:m.formatPainter,E.refresh]);const ge=async O=>{const oe=v.run(O?"edit.cut":"edit.copy",{html:!0}).then(N=>N?JSON.parse(N):{}),fe=oe.then(N=>N.text??"");try{await navigator.clipboard.write([new ClipboardItem({"text/plain":fe.then(N=>new Blob([N],{type:"text/plain"})),"text/html":oe.then(N=>new Blob([N.html??""],{type:"text/html"}))})])}catch{await navigator.clipboard.writeText(await fe)}},je=async()=>{try{const O=await navigator.clipboard.read(),oe=async fe=>{const N=O.find(G=>G.types.includes(fe));return N?(await N.getType(fe)).text():""};return{text:await oe("text/plain"),html:await oe("text/html")}}catch{return{text:await navigator.clipboard.readText(),html:""}}},be=async O=>{const{text:oe,html:fe}=O??await je();await v.run("edit.paste",{...oe?{text:oe}:{},...fe?{html:fe}:{}})},Me=async O=>{try{await(O==="paste"?be():ge(O==="cut"))}catch(oe){Xt("error",o("commandFailed"),oe instanceof Error?oe.message:String(oe))}},Be=g.useRef({editing:!1,paste:be});Be.current={editing:(m==null?void 0:m.editing)===!0,paste:be},g.useEffect(()=>{const O=N=>N instanceof HTMLTextAreaElement&&N.classList.contains("kui-text-sink"),oe=N=>{(N.metaKey||N.ctrlKey)&&!N.shiftKey&&!N.altKey&&N.key.toLowerCase()==="v"&&O(N.target)&&!Be.current.editing&&N.stopPropagation()},fe=N=>{if(!O(N.target)||Be.current.editing||!N.clipboardData)return;N.preventDefault();const G={text:N.clipboardData.getData("text/plain"),html:N.clipboardData.getData("text/html")};Be.current.paste(G).catch(me=>Xt("error",o("commandFailed"),me instanceof Error?me.message:String(me)))};return window.addEventListener("keydown",oe,!0),document.addEventListener("paste",fe,!0),()=>{window.removeEventListener("keydown",oe,!0),document.removeEventListener("paste",fe,!0)}},[o]);const ye=g.useRef(new Map),F=g.useRef(null);g.useEffect(()=>{var N;if(!m)return;const O=F.current;if(F.current={sheet:m.sheet,sheets:m.sheets},!O||O.sheet===m.sheet)return;if(O.sheets.length===m.sheets.length&&!m.sheets.includes(O.sheet)&&O.sheets.indexOf(O.sheet)===m.sheets.indexOf(m.sheet)){const G=ye.current.get(O.sheet);ye.current.delete(O.sheet),G&&ye.current.set(m.sheet,G);return}const fe=ye.current.get(m.sheet)??{x:0,y:0};(N=w.current)==null||N.panTo(fe.x,fe.y)},[m==null?void 0:m.sheet,m==null?void 0:m.sheets]);const A=g.useRef(null);g.useEffect(()=>{var G;if(!m)return;const[O,oe]=m.freezeShift,fe=A.current;if(A.current={sheet:m.sheet,x:O,y:oe},!fe||fe.sheet!==m.sheet||fe.x===O&&fe.y===oe)return;const N=de.get();N&&((G=w.current)==null||G.panTo(Math.max(0,N.x-(O-fe.x)),Math.max(0,N.y-(oe-fe.y))))},[m==null?void 0:m.sheet,m==null?void 0:m.freezeShift.join()]);const H=g.useRef(0);g.useEffect(()=>{var O;!m||m.zoomAsked===H.current||(H.current=m.zoomAsked,(O=w.current)==null||O.zoomTo(m.zoom/100))},[m==null?void 0:m.zoomAsked,m==null?void 0:m.zoom]);const le=()=>ds("sheet","formulaBar",O=>typeof O=="boolean"?O:void 0),ve=g.useRef(null);g.useEffect(()=>{if(!(!p||!m)){if(ve.current!==p){const O=le();if(O!==void 0&&O!==m.formulaBar){v.run("view.formulaBar",{on:O});return}ve.current=p;return}Ji("sheet","formulaBar",m.formulaBar)}},[p,m==null?void 0:m.formulaBar]);const Z=m?ve.current===p?m.formulaBar:le()??m.formulaBar:!1,I=O=>{Ji("sheet","formulaBar",O),v.run("view.formulaBar",{on:O})},P=()=>ds("sheet","focusCell",O=>{const oe=O;return oe&&typeof oe.on=="boolean"&&typeof oe.color=="string"?{on:oe.on,color:oe.color}:void 0}),ue=g.useRef(null);g.useEffect(()=>{if(!(!p||!m)){if(ue.current!==p){ue.current=p;const O=P();O&&(O.on!==m.focusCell||O.color.toUpperCase()!==m.focusColor.toUpperCase())&&v.run("view.focusCell",{on:O.on,color:O.color});return}Ji("sheet","focusCell",{on:m.focusCell,color:m.focusColor})}},[p,m==null?void 0:m.focusCell,m==null?void 0:m.focusColor]);const k=g.useRef(null);g.useEffect(()=>{var Xe;if(!(m!=null&&m.activeRect)||!p)return;const O=k.current;if(k.current={sheet:m.sheet,active:m.active},!O||O.sheet!==m.sheet||O.active===m.active)return;const oe=de.get();if(!oe)return;const[fe,N,G,me]=m.activeRect,{left:pe,top:ke}=p.pinned??{left:0,top:0},Re=oe.width/oe.zoom,Pe=oe.height/oe.zoom;let{x:Ve,y:Ke}=oe;fe>=pe&&(fe-Ve<pe?Ve=fe-pe:G-Ve>Re&&(Ve=Math.min(fe-pe,G-Re))),N>=ke&&(N-Ke<ke?Ke=N-ke:me-Ke>Pe&&(Ke=Math.min(N-ke,me-Pe))),(Ve!==oe.x||Ke!==oe.y)&&((Xe=w.current)==null||Xe.panTo(Math.max(0,Ve),Math.max(0,Ke)))},[m==null?void 0:m.sheet,m==null?void 0:m.active,(J=m==null?void 0:m.activeRect)==null?void 0:J.join()]),g.useEffect(()=>{p&&v.run("editor.wording",{columnPrefix:o("tableColumnPrefix")})},[p]);const B=RB();g.useEffect(()=>{p&&v.run("editor.scheme",{scheme:B}).catch(()=>{})},[p,B]);const W=g.useRef(0),ie=g.useRef({seq:0,text:""});g.useEffect(()=>{var oe;const O=m==null?void 0:m.dialog;if(O){if(O.seq<=W.current){O.seq<W.current&&(W.current=O.seq);return}switch(W.current=O.seq,O.name){case"formatCells":Lg();break;case"insertFunction":B0({onChoose:async fe=>{await v.run("formulas.insertFunction",{name:fe}),Ie()},onCancel:Ie});break;case"unhideSheet":Gx();break;case"moveCells":{const fe=O.params;jf({title:o("moveTitle"),message:o("moveReplace"),testId:"sheet-move-confirm",onOk:()=>void v.run("edit.moveCells",fe).then(Ie)});break}case"filterMenu":Kx(O.params);break;case"validationList":Zl(!0);break;case"validationError":ie.current={seq:((oe=m==null?void 0:m.notice)==null?void 0:oe.seq)??0,text:String(O.params.message??"")},xH(O.params);break;case"dataValidation":Og();break;case"circularReference":fH(o("circularTitle"),o("circularMessage"),"sheet-circular");break;case"open":case"saveAs":case"saveChanges":break;default:v.ask(O.command,O.params)}}},[(he=m==null?void 0:m.dialog)==null?void 0:he.seq]);const xe=g.useRef({seq:0,text:"",at:0});g.useEffect(()=>{const O=m==null?void 0:m.notice;if(!O)return;const oe=xe.current;if(O.seq<=oe.seq){O.seq<oe.seq&&(oe.seq=O.seq);return}const fe=Date.now(),N=ie.current;!(O.text===N.text&&O.seq<=N.seq+1)&&!(O.text===oe.text&&fe-oe.at<800)&&Xt("info",i(O.text)),xe.current={seq:O.seq,text:O.text,at:fe}},[(Ee=m==null?void 0:m.notice)==null?void 0:Ee.seq]);const Ce=async O=>{var Ve;const oe=O.target instanceof HTMLCanvasElement?(Ve=O.target.closest(".kui-canvas"))==null?void 0:Ve.querySelector("canvas"):null,fe=de.get();if(!oe||!fe||!p||r.readOnly)return;O.preventDefault();const N=oe.getBoundingClientRect(),G=(O.clientX-N.left)/fe.zoom,me=(O.clientY-N.top)/fe.zoom,pe=p.pinned,ke={x:O.clientX,y:O.clientY},Re=await v.run("editor.contextMenu",{x:G<pe.left?G:fe.x+G,y:me<pe.top?me:fe.y+me}),Pe=Re?JSON.parse(Re).target:null;(Pe==="cell"||Pe==="rows"||Pe==="cols"||Pe==="all")&&tB({at:ke,target:Pe})},He=O=>{var N,G;const oe=O.metaKey||O.ctrlKey,fe=O.key.toLowerCase();if(oe&&!O.shiftKey&&!O.altKey&&(O.key==="PageDown"||O.key==="PageUp"))return v.run(O.key==="PageDown"?"sheet.next":"sheet.previous",{}),!0;if(oe&&!O.shiftKey&&!O.altKey&&O.key==="5")return v.run("home.strikethrough",{}),!0;if(O.ctrlKey&&!O.metaKey&&!O.altKey&&(O.key===";"||O.key===":"||O.code==="Semicolon")){const me=new Date,pe=O.shiftKey?`${me.getHours()}:${String(me.getMinutes()).padStart(2,"0")}`:`${me.getFullYear()}/${me.getMonth()+1}/${me.getDate()}`;return v.run("editor.insertText",{text:pe}),!0}if(O.altKey&&!oe&&O.key==="ArrowDown"&&((N=m==null?void 0:m.validation)!=null&&N.list)&&!m.editing)return Zl(!0),!0;if(oe&&!O.shiftKey&&!O.altKey&&O.key==="1"&&m&&!m.editing)return Lg(),!0;if(O.key==="F4"&&!oe&&!O.altKey&&(m!=null&&m.editing)&&((G=m.editText)!=null&&G.startsWith("=")))return v.run("editor.cycleReference",{}),!0;if(O.ctrlKey&&!O.metaKey&&!O.altKey&&m&&!m.editing&&!(m.lines.wholeRows&&m.lines.wholeCols)){const me=m.lines.wholeCols;if(O.shiftKey&&(O.key==="="||O.key==="+"))return v.run(me?"home.insertColumns":"home.insertRows",{}),!0;if(!O.shiftKey&&(O.key==="-"||O.key==="_"))return v.run(me?"home.deleteColumns":"home.deleteRows",{}),!0}return oe&&!O.shiftKey&&!O.altKey&&(fe==="c"||fe==="x"||fe==="v")&&!(m!=null&&m.editing)?(Me(fe==="c"?"copy":fe==="x"?"cut":"paste"),!0):!1},$={file:s.jsxs(s.Fragment,{children:[s.jsx(Ga,{menu:"File",exclude:[...YL,...XL],primary:Hn.File}),s.jsx(pB,{sheet:(m==null?void 0:m.sheet)??"",sheets:(m==null?void 0:m.sheets)??[]})]}),home:m?s.jsx(oB,{info:m,onClipboard:O=>void Me(O)}):s.jsx(Ga,{menu:"Home"}),view:m?s.jsx(uB,{info:m,formulaBar:Z,onFormulaBar:I}):s.jsx(Ga,{menu:"View"}),formulas:s.jsxs(s.Fragment,{children:[s.jsx(nt,{label:i("Insert Function"),icon:ps,children:s.jsx(tt,{icon:ps,label:i("Insert Function"),size:"large",primary:!0,disabled:!v.enabled("formulas.insertFunction"),onClick:()=>B0({onChoose:async O=>{await v.run("formulas.insertFunction",{name:O}),Ie()},onCancel:Ie}),"data-testid":"sheet-insert-function-button"})}),s.jsx(Ga,{menu:"Formulas",exclude:["formulas.insertFunction"],primary:Hn.Formulas})]}),insert:s.jsxs(s.Fragment,{children:[s.jsx(zO,{testId:"sheet-drawing",merge:"Insert/Illustrations",exclude:["insert.shape"],primary:["insert.picture","insert.icons"]}),s.jsx(nt,{label:o("chartInsert"),icon:Wl,children:s.jsx(PO,{testId:"sheet-chart",primary:!0})}),s.jsx(Ga,{menu:"Insert",exclude:["insert.chart","insert.textBox","insert.symbol"],omit:["Illustrations"],primary:Hn.Insert}),s.jsx(zB,{})]}),data:s.jsxs(s.Fragment,{children:[s.jsx(Ga,{menu:"Data",exclude:["data.validation"],primary:Hn.Data}),s.jsx(nt,{label:i("Data Validation"),icon:v0,children:s.jsx(tt,{icon:v0,label:i("Data Validation"),size:"large",primary:!0,disabled:!v.enabled("data.validation"),onClick:Og,"data-testid":"sheet-data-validation-button"})})]}),draw:s.jsxs(s.Fragment,{children:[s.jsx(FO,{testId:"sheet-ink"}),s.jsx(Ga,{menu:"Draw",exclude:["draw.select","draw.pen","draw.pencil","draw.highlighter","draw.eraser","draw.state"],primary:Hn.Draw})]})};ae.creates&&($.review=s.jsxs(s.Fragment,{children:[s.jsx(xB,{onCreate:()=>void ae.create(),busy:ae.busy}),s.jsx(Ga,{menu:"Review",omit:["Comments"],primary:Hn.Review})]}));const te=[...DB.map(([O,oe])=>({id:O,label:i(oe),view:O==="file"||O==="review"||O==="view",ribbon:$[O]??s.jsx(Ga,{menu:oe,primary:Hn[oe]})})),...m!=null&&m.table?[{id:"tableDesign",label:o("tableTools"),ribbon:s.jsx($H,{info:m})}]:[],...m!=null&&m.shape?[{id:"shapeFormat",label:o("drawingShapeFormat"),ribbon:s.jsx(LO,{ids:m.shapes.length?m.shapes:[m.shape],testId:"sheet-drawing"})}]:[],...m!=null&&m.chart?[{id:"chartDesign",label:i("Chart Design"),ribbon:s.jsxs(s.Fragment,{children:[s.jsx(YO,{id:m.chart,testId:"sheet-chart",dataEditable:!1,formats:["axes","labelPosition","lineWidth","marker","smooth","trends","combo"]}),s.jsx(Ga,{menu:"Chart Design",exclude:["chart.set","chart.changeType","chart.addElement"],primary:Hn["Chart Design"]})]})}]:[]],Te=te.some(O=>O.id===L)?L:"home";return s.jsx(lO,{editor:v,tools:E,children:s.jsxs(zL,{tabs:te,tab:Te,onTab:K,canvas:w,zoom:S,onKeyDown:He,statusEnd:m?s.jsx(tS,{info:m,place:"status"}):null,status:m?s.jsxs(s.Fragment,{children:[s.jsx("span",{"data-testid":"sheet-status",children:o("sheetSelection",{sheet:m.sheet,selection:m.selection})}),s.jsx(LB,{stats:m.stats,t:o})]}):null,children:[m&&Z?s.jsx(xg,{children:s.jsx(uH,{info:m})}):null,s.jsx("div",{className:"kui-row",onContextMenu:O=>void Ce(O),children:s.jsxs(rO,{canvas:w,viewMemory:T,framed:!1,decorate:ae.decorate,onView:O=>{if(de.set(O),z(O.zoom),F.current&&ye.current.set(F.current.sheet,{x:O.x,y:O.y}),!p)return;X.current.doc!==p&&(X.current={doc:p,right:0,bottom:0});const oe=Math.max(0,O.x)+O.width/O.zoom,fe=Math.max(0,O.y)+O.height/O.zoom;(oe>X.current.right||fe>X.current.bottom)&&(X.current={doc:p,right:Math.max(oe+512,X.current.right),bottom:Math.max(fe+600,X.current.bottom)},v.run("editor.viewport",{right:X.current.right,bottom:X.current.bottom})),window.clearTimeout(re.current.timer);const N={x:Math.max(0,O.x),y:Math.max(0,O.y)};re.current.timer=window.setTimeout(()=>{N.x===re.current.x&&N.y===re.current.y||(re.current={...re.current,...N},v.run("editor.viewport",{right:X.current.right,bottom:X.current.bottom,...N}))},120)},children:[m!=null&&m.formulaHint&&p?s.jsx(lH,{hint:m.formulaHint,views:de,pins:p.pinned,onPick:O=>void v.run("editor.acceptFunction",{name:O})}):null,m&&p?s.jsx(SH,{info:m,views:de,pins:p.pinned}):null,p?s.jsx(MH,{views:de,pins:p.pinned}):null,ae.marks&&p?s.jsx(MB,{markers:ae.markers,views:de,pins:p.pinned,onActivate:r.activateComment,label:O=>o("commentThread",{count:O})}):null]})}),m?s.jsx(xg,{children:s.jsx(pH,{info:m})}):null,m?s.jsx(hH,{info:m}):null,m?s.jsx(aB,{info:m,onClipboard:O=>void Me(O)}):null,s.jsx(sH,{}),s.jsx(wH,{}),m?s.jsx(zH,{info:m}):null,s.jsx(NB,{}),m?s.jsx(BH,{info:m}):null,m?s.jsx(VH,{info:m}):null]})})}function $g(n){return String(Number(n.toPrecision(15)))}function LB({stats:n,t:i}){return!n||n.count<2?null:s.jsxs("span",{className:"sheet-figures","data-testid":"sheet-stats",children:[n.numeric>0?s.jsx("span",{"data-testid":"sheet-stat-sum",children:i("statSum",{value:$g(n.sum)})}):null,n.numeric>0&&n.average!=null?s.jsx("span",{"data-testid":"sheet-stat-average",children:i("statAverage",{value:$g(n.average)})}):null,s.jsx("span",{"data-testid":"sheet-stat-count",children:i("statCount",{value:n.count})})]})}const HB={display:"line",brand:{light:"#1a8641",dark:"#4fd17b"}},Gg={ui:HB};wD({"automate.allScripts":QT,"automate.runScript":YM,"draw.eraser":Fc,"draw.lasso":FM,"home.borders":tf,"home.conditionalFormat":r3,"home.doubleUnderline":df,"home.drawBorder":lr,"home.formatCells":Pc,"home.justify":cA,"home.manageRules":hk,"home.orientation":Vc,"home.unmergeCells":rA});const lS=cC.createRoot(document.getElementById("root")),BB=window.setTimeout(()=>{const n=Ex(_x,navigator.language);lS.render(s.jsx("div",{className:"kui-alone",children:n("noHost")}))},3e3),_B=Object.assign({"./i18n/upstream/ko.rs":()=>ns(()=>import("./ko-Fe7YrdBh.js"),[],import.meta.url).then(n=>n.default),"./i18n/upstream/pt.rs":()=>ns(()=>import("./pt-BK3ToRXt.js"),[],import.meta.url).then(n=>n.default),"./i18n/upstream/ru.rs":()=>ns(()=>import("./ru-Di_jxcA2.js"),[],import.meta.url).then(n=>n.default),"./i18n/upstream/zh.rs":()=>ns(()=>import("./zh-C0AkZS0b.js"),[],import.meta.url).then(n=>n.default)});tD({id:"kit.sheet",version:"0.1.3",capabilities:["ai","replica","comment-anchors"],brand:Gg.ui.brand,display:Gg.ui.display}).then(async n=>{window.clearTimeout(BB);const i=FL(await _L(_B,n.init.locale),$L,n.init.locale);lS.render(s.jsx(OB,{host:n,phrase:i}))});
|
|
98
|
+
`)){const f=u.indexOf(" ");f>0&&o.set(parseInt(u.slice(0,f),16),u.slice(f+1))}const r=i.map(u=>{const f=[];for(let h=u.from;h<=u.to;h+=1)o.has(h)&&f.push(String.fromCodePoint(h));return{id:u.id,zh:u.zh,en:u.en,chars:f}});return{names:o,subsets:r}})),Vg),qg=16,AB=n=>(n.codePointAt(0)??0).toString(16).toUpperCase().padStart(4,"0");function NB(){var F;const{t:n}=ze(),i=nS(!1),[o,r]=g.useState(Y0),[u,f]=g.useState(!1),[h,v]=g.useState("symbols"),[p,y]=g.useState(null),[m,x]=g.useState(""),[b,C]=g.useState("basicLatin"),[E,w]=g.useState(""),[T,S]=g.useState(""),[z,L]=g.useState(null),[K,X]=g.useState([]);g.useEffect(()=>(X0.add(r),()=>{X0.delete(r)}),[]),g.useEffect(()=>{o!==0&&(f(!0),v("symbols"),x(""),C("basicLatin"),w(""),S(""),L(null),X(Lc()),kB().then(y))},[o]);const re=A=>n("symbolSubsetNames")==="zh"?A.zh:A.en,ae=g.useMemo(()=>{var H,le;if(!p)return[];const A=T.trim().toLowerCase();if(A){const ve=[];for(const Z of p.subsets)for(const I of Z.chars)(H=p.names.get(I.codePointAt(0)??0))!=null&&H.toLowerCase().includes(A)&&ve.push(I);return ve}return((le=p.subsets.find(ve=>ve.id===b))==null?void 0:le.chars)??[]},[p,b,T]),de=g.useMemo(()=>{const A=T.trim().toLowerCase();return CB.filter(([H,le])=>{var ve;return!A||n(le).toLowerCase().includes(A)||(((ve=p==null?void 0:p.names.get(H.codePointAt(0)??0))==null?void 0:ve.toLowerCase().includes(A))??!1)})},[T,p,n]);if(!u)return null;const ge=()=>f(!1),je=async A=>{A&&(await i(A),X(Lc()))},be=(F=Fn.find(A=>A.name===m))==null?void 0:F.css,Me=A=>(p==null?void 0:p.names.get(A.codePointAt(0)??0))??"",Be=A=>{A.key!=="Escape"&&A.stopPropagation(),A.key==="Enter"&&(A.preventDefault(),S(E))},ye=(A,H)=>s.jsx("button",{type:"button",role:"gridcell",className:"sheet-symbol-cell","aria-selected":A===z,title:Me(A),style:be?{fontFamily:be}:void 0,onClick:()=>L(A),onDoubleClick:()=>void je(A),"data-symbol":A,"data-testid":H,children:A},`${H}-${A}`);return s.jsx(da,{open:!0,onOpenChange:A=>A?void 0:ge(),children:s.jsxs(fa,{size:"lg",dismissible:!1,"aria-describedby":void 0,onCloseAutoFocus:A=>{A.preventDefault(),Ie()},"data-testid":"sheet-symbol-dialog",children:[s.jsx(ma,{children:s.jsx(pa,{children:n("symbolTitle")})}),s.jsxs(ha,{children:[s.jsx("div",{className:"sheet-fc-tabs",role:"tablist",children:["symbols","special"].map(A=>s.jsx("button",{type:"button",role:"tab","aria-selected":h===A,onClick:()=>v(A),"data-testid":`sheet-symbol-tab-${A}`,children:n(A==="symbols"?"symbolTabSymbols":"symbolTabSpecial")},A))}),s.jsxs("div",{className:"sheet-symbol-controls",children:[s.jsx("input",{className:"kui-field sheet-symbol-search",type:"search",value:E,placeholder:n("symbolSearch"),"aria-label":n("symbolSearch"),onChange:A=>{w(A.target.value),A.target.value||S("")},onKeyDown:Be,"data-testid":"sheet-symbol-search"}),s.jsxs("span",{className:"sheet-dialog-row",children:[s.jsx("span",{children:n("symbolFont")}),s.jsxs("select",{className:"kui-field",value:m,onChange:A=>x(A.target.value),"data-testid":"sheet-symbol-font",children:[s.jsx("option",{value:"",children:n("symbolNormalText")}),Fn.map(A=>s.jsx("option",{value:A.name,children:A.name},A.name))]})]}),s.jsxs("span",{className:"sheet-dialog-row",children:[s.jsx("span",{children:n("symbolSubset")}),s.jsx("select",{className:"kui-field",value:b,disabled:!p||h!=="symbols",onChange:A=>{C(A.target.value),S(""),w("")},"data-testid":"sheet-symbol-subset",children:((p==null?void 0:p.subsets)??[{id:"basicLatin",zh:"基本拉丁字母",en:"Basic Latin"}]).map(A=>s.jsx("option",{value:A.id,children:re(A)},A.id))})]})]}),h==="symbols"?s.jsx("div",{className:"sheet-symbol-dialog-grid",role:"grid",style:{gridTemplateColumns:`repeat(${qg}, 1fr)`},"data-testid":"sheet-symbol-grid",children:ae.map(A=>ye(A,"sheet-symbol-grid-item"))}):s.jsx("div",{className:"sheet-symbol-special",role:"listbox","data-testid":"sheet-symbol-special",children:de.map(([A,H])=>s.jsxs("button",{type:"button",role:"option","aria-selected":A===z,className:"sheet-symbol-special-row",onClick:()=>L(A),onDoubleClick:()=>void je(A),"data-symbol":A,"data-testid":"sheet-symbol-special-item",children:[s.jsx("span",{className:"sheet-symbol-special-char",style:be?{fontFamily:be}:void 0,children:A.trim()?A:"·"}),s.jsx("span",{children:n(H)})]},H))}),s.jsx("div",{className:"sheet-symbol-heading",children:n("symbolRecentDialog")}),s.jsx("div",{className:"sheet-symbol-dialog-grid sheet-symbol-recent",style:{gridTemplateColumns:`repeat(${qg}, 1fr)`},"data-testid":"sheet-symbol-dialog-recent",children:K.map(A=>ye(A,"sheet-symbol-dialog-recent-item"))}),s.jsxs("div",{className:"sheet-symbol-info","data-testid":"sheet-symbol-info",children:[s.jsx("span",{"data-testid":"sheet-symbol-name",children:z?Me(z):""}),s.jsxs("span",{children:[n("symbolCode"),s.jsx("output",{"data-testid":"sheet-symbol-code",children:z?AB(z):""})]}),s.jsx("span",{"data-testid":"sheet-symbol-from",children:n("symbolFrom")})]})]}),s.jsxs(va,{className:"sheet-dialog-actions",children:[s.jsx(De,{variant:"primary",disabled:!z,onClick:()=>void je(z),"data-testid":"sheet-symbol-insert",children:n("symbolInsert")}),s.jsx(De,{variant:"secondary",onClick:ge,"data-testid":"sheet-symbol-close",children:n("symbolClose")})]})]})})}function c0(n){return n.dataset.colorScheme==="dark"?"dark":"light"}function RB(n=document.documentElement){const[i,o]=g.useState(()=>c0(n));return g.useEffect(()=>{if(o(c0(n)),typeof MutationObserver>"u")return;const r=new MutationObserver(()=>o(c0(n)));return r.observe(n,{attributes:!0,attributeFilter:["data-color-scheme"]}),()=>r.disconnect()},[n]),i}const DB=[["file","File"],["home","Home"],["insert","Insert"],["draw","Draw"],["pageLayout","Page Layout"],["formulas","Formulas"],["data","Data"],["review","Review"],["view","View"],["automate","Automate"]];function OB({host:n,phrase:i}){var _e,J,he,Ee;const o=g.useMemo(()=>Ex(_x,n.init.locale),[n]),r=g.useMemo(()=>({...n,failed:O=>n.failed(new Error(us(i,o,O)))}),[n,i,o]),u=g.useMemo(UL,[]),f=wO(r,u,KL),h=g.useMemo(()=>f.failure?{...f,failure:us(i,o,f.failure)}:f,[f,i,o]),v=nO(h,r,o,"sheet",i,void 0,{report:(O,oe)=>Xt("error",O,us(i,o,oe))}),{doc:p,change:y,state:m}=h,x=g.useRef(null),b=(p==null?void 0:p.info.revision)??0,C=g.useRef(b);C.current=b,x.current!==null&&b>x.current&&(x.current=null),g.useEffect(()=>{const O=oe=>{const fe=oe.target,N=fe instanceof HTMLTextAreaElement&&fe.classList.contains("kui-text-sink"),G=fe instanceof HTMLCanvasElement&&fe.closest(".kui-canvas")!=null;(N||G)&&(x.current=C.current)};return document.addEventListener("input",O,!0),document.addEventListener("pointerdown",O,!0),()=>{document.removeEventListener("input",O,!0),document.removeEventListener("pointerdown",O,!0)}},[]);const E=DL(h.tool,p!=null,y,{initial:"select",hostTools:{},escapable:()=>(m==null?void 0:m.escape)===!0||x.current!==null}),w=g.useRef(null),T=g.useRef({x:0,y:0,zoom:1}),[S,z]=g.useState(1),[L,K]=g.useState("home"),X=g.useRef({doc:p,right:0,bottom:0}),re=g.useRef({x:0,y:0,timer:0}),ae=bB(r,p,y,m==null?void 0:m.sheet,o("commentFailed")),de=g.useMemo(yB,[]);g.useEffect(()=>{E.refresh()},[m==null?void 0:m.formulaText,p==null?void 0:p.info.width,p==null?void 0:p.info.height,m==null?void 0:m.focusCell,m==null?void 0:m.focusColor,m==null?void 0:m.freeze.join(),(_e=m==null?void 0:m.freezePreview)==null?void 0:_e.join(),m==null?void 0:m.freezeShift.join(),m==null?void 0:m.formatPainter,E.refresh]);const ge=async O=>{const oe=v.run(O?"edit.cut":"edit.copy",{html:!0}).then(N=>N?JSON.parse(N):{}),fe=oe.then(N=>N.text??"");try{await navigator.clipboard.write([new ClipboardItem({"text/plain":fe.then(N=>new Blob([N],{type:"text/plain"})),"text/html":oe.then(N=>new Blob([N.html??""],{type:"text/html"}))})])}catch{await navigator.clipboard.writeText(await fe)}},je=async()=>{try{const O=await navigator.clipboard.read(),oe=async fe=>{const N=O.find(G=>G.types.includes(fe));return N?(await N.getType(fe)).text():""};return{text:await oe("text/plain"),html:await oe("text/html")}}catch{return{text:await navigator.clipboard.readText(),html:""}}},be=async O=>{const{text:oe,html:fe}=O??await je();await v.run("edit.paste",{...oe?{text:oe}:{},...fe?{html:fe}:{}})},Me=async O=>{try{await(O==="paste"?be():ge(O==="cut"))}catch(oe){Xt("error",o("commandFailed"),oe instanceof Error?oe.message:String(oe))}},Be=g.useRef({editing:!1,paste:be});Be.current={editing:(m==null?void 0:m.editing)===!0,paste:be},g.useEffect(()=>{const O=N=>N instanceof HTMLTextAreaElement&&N.classList.contains("kui-text-sink"),oe=N=>{(N.metaKey||N.ctrlKey)&&!N.shiftKey&&!N.altKey&&N.key.toLowerCase()==="v"&&O(N.target)&&!Be.current.editing&&N.stopPropagation()},fe=N=>{if(!O(N.target)||Be.current.editing||!N.clipboardData)return;N.preventDefault();const G={text:N.clipboardData.getData("text/plain"),html:N.clipboardData.getData("text/html")};Be.current.paste(G).catch(me=>Xt("error",o("commandFailed"),me instanceof Error?me.message:String(me)))};return window.addEventListener("keydown",oe,!0),document.addEventListener("paste",fe,!0),()=>{window.removeEventListener("keydown",oe,!0),document.removeEventListener("paste",fe,!0)}},[o]);const ye=g.useRef(new Map),F=g.useRef(null);g.useEffect(()=>{var N;if(!m)return;const O=F.current;if(F.current={sheet:m.sheet,sheets:m.sheets},!O||O.sheet===m.sheet)return;if(O.sheets.length===m.sheets.length&&!m.sheets.includes(O.sheet)&&O.sheets.indexOf(O.sheet)===m.sheets.indexOf(m.sheet)){const G=ye.current.get(O.sheet);ye.current.delete(O.sheet),G&&ye.current.set(m.sheet,G);return}const fe=ye.current.get(m.sheet)??{x:0,y:0};(N=w.current)==null||N.panTo(fe.x,fe.y)},[m==null?void 0:m.sheet,m==null?void 0:m.sheets]);const A=g.useRef(null);g.useEffect(()=>{var G;if(!m)return;const[O,oe]=m.freezeShift,fe=A.current;if(A.current={sheet:m.sheet,x:O,y:oe},!fe||fe.sheet!==m.sheet||fe.x===O&&fe.y===oe)return;const N=de.get();N&&((G=w.current)==null||G.panTo(Math.max(0,N.x-(O-fe.x)),Math.max(0,N.y-(oe-fe.y))))},[m==null?void 0:m.sheet,m==null?void 0:m.freezeShift.join()]);const H=g.useRef(0);g.useEffect(()=>{var O;!m||m.zoomAsked===H.current||(H.current=m.zoomAsked,(O=w.current)==null||O.zoomTo(m.zoom/100))},[m==null?void 0:m.zoomAsked,m==null?void 0:m.zoom]);const le=()=>ds("sheet","formulaBar",O=>typeof O=="boolean"?O:void 0),ve=g.useRef(null);g.useEffect(()=>{if(!(!p||!m)){if(ve.current!==p){const O=le();if(O!==void 0&&O!==m.formulaBar){v.run("view.formulaBar",{on:O});return}ve.current=p;return}Ji("sheet","formulaBar",m.formulaBar)}},[p,m==null?void 0:m.formulaBar]);const Z=m?ve.current===p?m.formulaBar:le()??m.formulaBar:!1,I=O=>{Ji("sheet","formulaBar",O),v.run("view.formulaBar",{on:O})},P=()=>ds("sheet","focusCell",O=>{const oe=O;return oe&&typeof oe.on=="boolean"&&typeof oe.color=="string"?{on:oe.on,color:oe.color}:void 0}),ue=g.useRef(null);g.useEffect(()=>{if(!(!p||!m)){if(ue.current!==p){ue.current=p;const O=P();O&&(O.on!==m.focusCell||O.color.toUpperCase()!==m.focusColor.toUpperCase())&&v.run("view.focusCell",{on:O.on,color:O.color});return}Ji("sheet","focusCell",{on:m.focusCell,color:m.focusColor})}},[p,m==null?void 0:m.focusCell,m==null?void 0:m.focusColor]);const k=g.useRef(null);g.useEffect(()=>{var Xe;if(!(m!=null&&m.activeRect)||!p)return;const O=k.current;if(k.current={sheet:m.sheet,active:m.active},!O||O.sheet!==m.sheet||O.active===m.active)return;const oe=de.get();if(!oe)return;const[fe,N,G,me]=m.activeRect,{left:pe,top:ke}=p.pinned??{left:0,top:0},Re=oe.width/oe.zoom,Pe=oe.height/oe.zoom;let{x:Ve,y:Ke}=oe;fe>=pe&&(fe-Ve<pe?Ve=fe-pe:G-Ve>Re&&(Ve=Math.min(fe-pe,G-Re))),N>=ke&&(N-Ke<ke?Ke=N-ke:me-Ke>Pe&&(Ke=Math.min(N-ke,me-Pe))),(Ve!==oe.x||Ke!==oe.y)&&((Xe=w.current)==null||Xe.panTo(Math.max(0,Ve),Math.max(0,Ke)))},[m==null?void 0:m.sheet,m==null?void 0:m.active,(J=m==null?void 0:m.activeRect)==null?void 0:J.join()]),g.useEffect(()=>{p&&v.run("editor.wording",{columnPrefix:o("tableColumnPrefix")})},[p]);const B=RB();g.useEffect(()=>{p&&v.run("editor.scheme",{scheme:B}).catch(()=>{})},[p,B]);const W=g.useRef(0),ie=g.useRef({seq:0,text:""});g.useEffect(()=>{var oe;const O=m==null?void 0:m.dialog;if(O){if(O.seq<=W.current){O.seq<W.current&&(W.current=O.seq);return}switch(W.current=O.seq,O.name){case"formatCells":Lg();break;case"insertFunction":B0({onChoose:async fe=>{await v.run("formulas.insertFunction",{name:fe}),Ie()},onCancel:Ie});break;case"unhideSheet":Gx();break;case"moveCells":{const fe=O.params;jf({title:o("moveTitle"),message:o("moveReplace"),testId:"sheet-move-confirm",onOk:()=>void v.run("edit.moveCells",fe).then(Ie)});break}case"filterMenu":Kx(O.params);break;case"validationList":Zl(!0);break;case"validationError":ie.current={seq:((oe=m==null?void 0:m.notice)==null?void 0:oe.seq)??0,text:String(O.params.message??"")},xH(O.params);break;case"dataValidation":Og();break;case"circularReference":fH(o("circularTitle"),o("circularMessage"),"sheet-circular");break;case"open":case"saveAs":case"saveChanges":break;default:v.ask(O.command,O.params)}}},[(he=m==null?void 0:m.dialog)==null?void 0:he.seq]);const xe=g.useRef({seq:0,text:"",at:0});g.useEffect(()=>{const O=m==null?void 0:m.notice;if(!O)return;const oe=xe.current;if(O.seq<=oe.seq){O.seq<oe.seq&&(oe.seq=O.seq);return}const fe=Date.now(),N=ie.current;!(O.text===N.text&&O.seq<=N.seq+1)&&!(O.text===oe.text&&fe-oe.at<800)&&Xt("info",i(O.text)),xe.current={seq:O.seq,text:O.text,at:fe}},[(Ee=m==null?void 0:m.notice)==null?void 0:Ee.seq]);const Ce=async O=>{var Ve;const oe=O.target instanceof HTMLCanvasElement?(Ve=O.target.closest(".kui-canvas"))==null?void 0:Ve.querySelector("canvas"):null,fe=de.get();if(!oe||!fe||!p||r.readOnly)return;O.preventDefault();const N=oe.getBoundingClientRect(),G=(O.clientX-N.left)/fe.zoom,me=(O.clientY-N.top)/fe.zoom,pe=p.pinned,ke={x:O.clientX,y:O.clientY},Re=await v.run("editor.contextMenu",{x:G<pe.left?G:fe.x+G,y:me<pe.top?me:fe.y+me}),Pe=Re?JSON.parse(Re).target:null;(Pe==="cell"||Pe==="rows"||Pe==="cols"||Pe==="all")&&tB({at:ke,target:Pe})},He=O=>{var N,G;const oe=O.metaKey||O.ctrlKey,fe=O.key.toLowerCase();if(oe&&!O.shiftKey&&!O.altKey&&(O.key==="PageDown"||O.key==="PageUp"))return v.run(O.key==="PageDown"?"sheet.next":"sheet.previous",{}),!0;if(oe&&!O.shiftKey&&!O.altKey&&O.key==="5")return v.run("home.strikethrough",{}),!0;if(O.ctrlKey&&!O.metaKey&&!O.altKey&&(O.key===";"||O.key===":"||O.code==="Semicolon")){const me=new Date,pe=O.shiftKey?`${me.getHours()}:${String(me.getMinutes()).padStart(2,"0")}`:`${me.getFullYear()}/${me.getMonth()+1}/${me.getDate()}`;return v.run("editor.insertText",{text:pe}),!0}if(O.altKey&&!oe&&O.key==="ArrowDown"&&((N=m==null?void 0:m.validation)!=null&&N.list)&&!m.editing)return Zl(!0),!0;if(oe&&!O.shiftKey&&!O.altKey&&O.key==="1"&&m&&!m.editing)return Lg(),!0;if(O.key==="F4"&&!oe&&!O.altKey&&(m!=null&&m.editing)&&((G=m.editText)!=null&&G.startsWith("=")))return v.run("editor.cycleReference",{}),!0;if(O.ctrlKey&&!O.metaKey&&!O.altKey&&m&&!m.editing&&!(m.lines.wholeRows&&m.lines.wholeCols)){const me=m.lines.wholeCols;if(O.shiftKey&&(O.key==="="||O.key==="+"))return v.run(me?"home.insertColumns":"home.insertRows",{}),!0;if(!O.shiftKey&&(O.key==="-"||O.key==="_"))return v.run(me?"home.deleteColumns":"home.deleteRows",{}),!0}return oe&&!O.shiftKey&&!O.altKey&&(fe==="c"||fe==="x"||fe==="v")&&!(m!=null&&m.editing)?(Me(fe==="c"?"copy":fe==="x"?"cut":"paste"),!0):!1},$={file:s.jsxs(s.Fragment,{children:[s.jsx(Ga,{menu:"File",exclude:[...YL,...XL],primary:Hn.File}),s.jsx(pB,{sheet:(m==null?void 0:m.sheet)??"",sheets:(m==null?void 0:m.sheets)??[]})]}),home:m?s.jsx(oB,{info:m,onClipboard:O=>void Me(O)}):s.jsx(Ga,{menu:"Home"}),view:m?s.jsx(uB,{info:m,formulaBar:Z,onFormulaBar:I}):s.jsx(Ga,{menu:"View"}),formulas:s.jsxs(s.Fragment,{children:[s.jsx(nt,{label:i("Insert Function"),icon:ps,children:s.jsx(tt,{icon:ps,label:i("Insert Function"),size:"large",primary:!0,disabled:!v.enabled("formulas.insertFunction"),onClick:()=>B0({onChoose:async O=>{await v.run("formulas.insertFunction",{name:O}),Ie()},onCancel:Ie}),"data-testid":"sheet-insert-function-button"})}),s.jsx(Ga,{menu:"Formulas",exclude:["formulas.insertFunction"],primary:Hn.Formulas})]}),insert:s.jsxs(s.Fragment,{children:[s.jsx(zO,{testId:"sheet-drawing",merge:"Insert/Illustrations",exclude:["insert.shape"],primary:["insert.picture","insert.icons"]}),s.jsx(nt,{label:o("chartInsert"),icon:Wl,children:s.jsx(PO,{testId:"sheet-chart",primary:!0})}),s.jsx(Ga,{menu:"Insert",exclude:["insert.chart","insert.textBox","insert.symbol"],omit:["Illustrations"],primary:Hn.Insert}),s.jsx(zB,{})]}),data:s.jsxs(s.Fragment,{children:[s.jsx(Ga,{menu:"Data",exclude:["data.validation"],primary:Hn.Data}),s.jsx(nt,{label:i("Data Validation"),icon:v0,children:s.jsx(tt,{icon:v0,label:i("Data Validation"),size:"large",primary:!0,disabled:!v.enabled("data.validation"),onClick:Og,"data-testid":"sheet-data-validation-button"})})]}),draw:s.jsxs(s.Fragment,{children:[s.jsx(FO,{testId:"sheet-ink"}),s.jsx(Ga,{menu:"Draw",exclude:["draw.select","draw.pen","draw.pencil","draw.highlighter","draw.eraser","draw.state"],primary:Hn.Draw})]})};ae.creates&&($.review=s.jsxs(s.Fragment,{children:[s.jsx(xB,{onCreate:()=>void ae.create(),busy:ae.busy}),s.jsx(Ga,{menu:"Review",omit:["Comments"],primary:Hn.Review})]}));const te=[...DB.map(([O,oe])=>({id:O,label:i(oe),view:O==="file"||O==="review"||O==="view",ribbon:$[O]??s.jsx(Ga,{menu:oe,primary:Hn[oe]})})),...m!=null&&m.table?[{id:"tableDesign",label:o("tableTools"),ribbon:s.jsx($H,{info:m})}]:[],...m!=null&&m.shape?[{id:"shapeFormat",label:o("drawingShapeFormat"),ribbon:s.jsx(LO,{ids:m.shapes.length?m.shapes:[m.shape],testId:"sheet-drawing"})}]:[],...m!=null&&m.chart?[{id:"chartDesign",label:i("Chart Design"),ribbon:s.jsxs(s.Fragment,{children:[s.jsx(YO,{id:m.chart,testId:"sheet-chart",dataEditable:!1,formats:["axes","labelPosition","lineWidth","marker","smooth","trends","combo"]}),s.jsx(Ga,{menu:"Chart Design",exclude:["chart.set","chart.changeType","chart.addElement"],primary:Hn["Chart Design"]})]})}]:[]],Te=te.some(O=>O.id===L)?L:"home";return s.jsx(lO,{editor:v,tools:E,children:s.jsxs(zL,{tabs:te,tab:Te,onTab:K,canvas:w,zoom:S,onKeyDown:He,statusEnd:m?s.jsx(tS,{info:m,place:"status"}):null,status:m?s.jsxs(s.Fragment,{children:[s.jsx("span",{"data-testid":"sheet-status",children:o("sheetSelection",{sheet:m.sheet,selection:m.selection})}),s.jsx(LB,{stats:m.stats,t:o})]}):null,children:[m&&Z?s.jsx(xg,{children:s.jsx(uH,{info:m})}):null,s.jsx("div",{className:"kui-row",onContextMenu:O=>void Ce(O),children:s.jsxs(rO,{canvas:w,viewMemory:T,framed:!1,decorate:ae.decorate,onView:O=>{if(de.set(O),z(O.zoom),F.current&&ye.current.set(F.current.sheet,{x:O.x,y:O.y}),!p)return;X.current.doc!==p&&(X.current={doc:p,right:0,bottom:0});const oe=Math.max(0,O.x)+O.width/O.zoom,fe=Math.max(0,O.y)+O.height/O.zoom;(oe>X.current.right||fe>X.current.bottom)&&(X.current={doc:p,right:Math.max(oe+512,X.current.right),bottom:Math.max(fe+600,X.current.bottom)},v.run("editor.viewport",{right:X.current.right,bottom:X.current.bottom})),window.clearTimeout(re.current.timer);const N={x:Math.max(0,O.x),y:Math.max(0,O.y)};re.current.timer=window.setTimeout(()=>{N.x===re.current.x&&N.y===re.current.y||(re.current={...re.current,...N},v.run("editor.viewport",{right:X.current.right,bottom:X.current.bottom,...N}))},120)},children:[m!=null&&m.formulaHint&&p?s.jsx(lH,{hint:m.formulaHint,views:de,pins:p.pinned,onPick:O=>void v.run("editor.acceptFunction",{name:O})}):null,m&&p?s.jsx(SH,{info:m,views:de,pins:p.pinned}):null,p?s.jsx(MH,{views:de,pins:p.pinned}):null,ae.marks&&p?s.jsx(MB,{markers:ae.markers,views:de,pins:p.pinned,onActivate:r.activateComment,label:O=>o("commentThread",{count:O})}):null]})}),m?s.jsx(xg,{children:s.jsx(pH,{info:m})}):null,m?s.jsx(hH,{info:m}):null,m?s.jsx(aB,{info:m,onClipboard:O=>void Me(O)}):null,s.jsx(sH,{}),s.jsx(wH,{}),m?s.jsx(zH,{info:m}):null,s.jsx(NB,{}),m?s.jsx(BH,{info:m}):null,m?s.jsx(VH,{info:m}):null]})})}function $g(n){return String(Number(n.toPrecision(15)))}function LB({stats:n,t:i}){return!n||n.count<2?null:s.jsxs("span",{className:"sheet-figures","data-testid":"sheet-stats",children:[n.numeric>0?s.jsx("span",{"data-testid":"sheet-stat-sum",children:i("statSum",{value:$g(n.sum)})}):null,n.numeric>0&&n.average!=null?s.jsx("span",{"data-testid":"sheet-stat-average",children:i("statAverage",{value:$g(n.average)})}):null,s.jsx("span",{"data-testid":"sheet-stat-count",children:i("statCount",{value:n.count})})]})}const HB={display:"line",brand:{light:"#1a8641",dark:"#4fd17b"}},Gg={ui:HB};wD({"automate.allScripts":QT,"automate.runScript":YM,"draw.eraser":Fc,"draw.lasso":FM,"home.borders":tf,"home.conditionalFormat":r3,"home.doubleUnderline":df,"home.drawBorder":lr,"home.formatCells":Pc,"home.justify":cA,"home.manageRules":hk,"home.orientation":Vc,"home.unmergeCells":rA});const lS=cC.createRoot(document.getElementById("root")),BB=window.setTimeout(()=>{const n=Ex(_x,navigator.language);lS.render(s.jsx("div",{className:"kui-alone",children:n("noHost")}))},3e3),_B=Object.assign({"./i18n/upstream/ko.rs":()=>ns(()=>import("./ko-Fe7YrdBh.js"),[],import.meta.url).then(n=>n.default),"./i18n/upstream/pt.rs":()=>ns(()=>import("./pt-BK3ToRXt.js"),[],import.meta.url).then(n=>n.default),"./i18n/upstream/ru.rs":()=>ns(()=>import("./ru-Di_jxcA2.js"),[],import.meta.url).then(n=>n.default),"./i18n/upstream/zh.rs":()=>ns(()=>import("./zh-C0AkZS0b.js"),[],import.meta.url).then(n=>n.default)});tD({id:"kit.sheet",version:"0.1.4",capabilities:["ai","replica","comment-anchors"],brand:Gg.ui.brand,display:Gg.ui.display}).then(async n=>{window.clearTimeout(BB);const i=FL(await _L(_B,n.init.locale),$L,n.init.locale);lS.render(s.jsx(OB,{host:n,phrase:i}))});
|
|
Binary file
|
package/sheet-ui/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Sheet</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-16dHlxGR.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="./assets/index-DblcoJ90.js">
|
|
9
9
|
<link rel="stylesheet" crossorigin href="./assets/index-CcQhqOwu.css">
|
|
10
10
|
</head>
|
package/sheet-ui/kit-ui.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"kitId":"kit.sheet","version":"0.1.
|
|
1
|
+
{"kitId":"kit.sheet","version":"0.1.4","commit":"180a19750183f8b28883fecb0dbb945558ea0521","entry":"index.html","protocol":"kition-kit-ui/1","brand":{"light":"#1a8641","dark":"#4fd17b"}}
|