@ex-grid/sheet 0.0.0-stage → 0.2.0-rc.1

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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/create-sheet.ts", "../src/must.ts", "../src/sheet-moment.ts", "../src/sheet-clipboard.ts", "../src/sheet-copy.ts", "../src/sheet-columns.ts", "../src/sheet-row.ts", "../src/sheet-history.ts", "../src/sheet-find.ts", "../src/sheet-find-panel.ts", "../src/sheet-source.ts", "../src/sheet-summary.ts", "../src/name-box-text.ts", "../src/sheet-edges.ts", "../src/sheet-words.ts", "../src/sheet-word-tables.ts", "../src/sheet-chrome-slots.ts", "../src/dom-attributes.ts", "../src/sheet-tabs.ts", "../src/shipped-stylesheet.ts", "../src/sheet-toolbar-slot.ts", "../src/sheet-toolbar.ts", "../src/sheet-choices.ts", "../src/cell-colour.ts", "../src/number-format-codes.ts", "../src/culture-facts.ts", "../src/sheet-tab-keys.ts", "../src/sheet-format-keys.ts", "../src/sheet-context-commands.ts", "../src/sheet-structure-keys.ts", "../src/sheet-widening.ts", "../src/format-cells-draft.ts", "../src/format-cells-offer.ts", "../src/format-cells-panel.ts", "../src/sheet-formula-aids.ts", "../src/pointing-scope.ts", "../src/toolbar-choice-keys.ts"],
4
+ "sourcesContent": ["// ExSheet drawn into an element (ADR-0370, section 1): one ExGrid as the Sheet's Consumer (ADR-0046), and the\n// Sheet's notice beneath it, its live region. The Sheet holds and computes; the grid paints, selects, navigates and\n// reports. Each intent the grid raises becomes one engine step on the one undo stack (ADR-0048), and each change\n// the engine reports hands the grid a new instance for the rows it names and nothing else (ADR-0003).\n//\n// What is deliberately not wired: the grid's sort and filter, since a Sheet's rows are places (ADR-0046); the\n// header click selects the column instead (ADR-0050 item 1), and the column menu is hidden, as Excel's Headings\n// carry none (ADR-0050 item 12).\n\nimport {\n createGrid, formulaBarHeight, gridCellMetrics, GridPresentationDefaults, type CellTextMetrics, gridChromeSlotNames, refusedCells, summaryFigureOrder, replacedCells, type CellPosition, type GridChrome, type GridDirection,\n type GridClearIntent, type GridCopyAnswer, type GridCopyRequest, type GridColumn, type GridColumnWidthChange, type GridDensity, type GridEditIntent, type GridFindPattern, type GridHandle, type GridOptions,\n type GridReplaceRequest, type GridReplaceResult, type GridFindRequest, type GridFindResult, type GridFindPanelSlotContext, type GridFindAllList, type FindOutcome, type FindPanelRefusedCell, type GridDeclaredKeyPress, findOutcomeText,\n type GridFillIntent, type GridOverwriteNotice, type GridPasteIntent, type GridRefusal, type GridSelection, type GridViewRead, type EditDiscardReason, type SelectionRange,\n type ViewportSize, type GridCommand, type GridContextMenuContext, type GridEditorReference, type ReferenceKeyColour, type GridPointArrow, type GridPointState, type EditorCompletion,\n type SelectionSummary, type SummaryFigure, builtInCommandLabel, reloadNoticeLabelIds,\n} from '@ex-grid/core';\nimport {\n BorderChange, BorderLine, CellAddress, CellFill, CellFormatChange, CellRange, Culture, Entry, NumberFormat, FormulaSyntaxError, RepeatedKeyError, SheetEdit, SheetRefusedError, SheetSize, Value, Workbook,\n Sheet, SheetRefusal, WorkbookDocument, referenceText, type LinkedTable, type CellColour, type SheetDay, type CellFormat, type FillDirection, type HorizontalAlignment, type SheetChange, type SheetDocument, type SheetRefusalReason, type WorkbookChange, type WorkbookStep,\n} from '@ex-grid/sheet-engine';\nimport { elementAt, unreachable } from './must';\nimport { browserTimeZone, checkTimeZone, dayOf, momentIn, sameDay, untilTheDayIsReadAgainMs, untilTheMinuteTurnsMs } from './sheet-moment';\nimport { exactNumberFor, isTooNarrowToShow, refusedIn, typedFor } from './sheet-clipboard';\nimport { rangeOf, sheetCopyAnswer, type SheetOwnCopy } from './sheet-copy';\nimport { appearanceLookup, charactersOfColumn, SheetColumns, sheetCellPaint } from './sheet-columns';\nimport { SheetHistory, type SheetOperationStepped } from './sheet-history';\nimport { SheetRow, shownTextOf } from './sheet-row';\nimport { planSheetReplace, planWorkbookReplace, positionsOf, sheetCellMatches, sheetFindStep, sheetFindStepWorkbook, SheetWorkbookMatches } from './sheet-find';\nimport { sheetFindPanelSlot, type SheetFindWithin } from './sheet-find-panel';\nimport { SheetSource } from './sheet-source';\nimport { readNameBoxPlace } from './name-box-text';\nimport { SheetEdges } from './sheet-edges';\nimport { SheetWords, type SheetLabel, type SheetTabCommand, type SheetToolbarBorder, type SheetToolbarCommand } from './sheet-words';\nimport { SheetTabs } from './sheet-tabs';\nimport { stylesheetName, stylesheetStamp } from './shipped-stylesheet';\nimport { SheetToolbar, type SheetToolbarIcon, type SheetToolbarItem, type SheetToolbarPaint } from './sheet-toolbar';\nimport type { SheetToolbarContent, SheetToolbarItemSlot } from './sheet-toolbar-slot';\nimport { mountedSlot, type SheetFormatCellsSlot, type SheetFormatCellsSlotContext, type SheetTabAddSlot, type SheetTabSlot } from './sheet-chrome-slots';\nimport { SheetChoicesPanel, type SheetToolbarChoice } from './sheet-choices';\nimport { automaticColour, colourFromRgb, paintOf } from './cell-colour';\nimport {\n defaultCodeOf, recogniseNumberFormat,\n} from './number-format-codes';\nimport { sheetTabKeys, sheetTabStepOf } from './sheet-tab-keys';\nimport { sheetFormatChangeFor, sheetFormatKeyOf, sheetFormatKeysDeclared, type SheetFormatKey } from './sheet-format-keys';\nimport { sheetContextCommands, sheetCommandWord } from './sheet-context-commands';\nimport { sheetStructureEditFor, sheetStructureKeyOf, sheetStructureKeysDeclared, type SheetStructureKey } from './sheet-structure-keys';\nimport { widensAsAHomeTabButtonDoes, widensAsAKeyDoes, widensAsFormatCellsOkDoes } from './sheet-widening';\nimport { FormatCellsDraft } from './format-cells-draft';\nimport { formatCellsOffer, isDisabledCategory, type FormatCellsTab, type NumberFormatCategory } from './format-cells-offer';\nimport { FormatCellsPanel } from './format-cells-panel';\nimport { linkedColumnsOf, sameLinkedColumns, sheetCompletion, sheetCycleReference, sheetMoveReference, sheetPointAt, sheetReferences, sheetReferenceTextOn } from './sheet-formula-aids';\nimport { PointingScope, type LinkedColumnColour, type PointingSheet } from './pointing-scope';\nimport type { PointingRefusal } from './pointing-refusal';\n\n/**\n * A Consumer's own action on the Sheet Toolbar (ADR-0100), a Toolbar Item like ExSheet's: it stands in a row of its own\n * or among the formatting items, and while an edit is open it cannot be pressed. It carries a KeyTip only where one is\n * given.\n */\nexport interface SheetToolbarButton {\n /** Its name: the text it shows, its accessible name and its tooltip. */\n readonly text: string;\n /** What pressing it does. A press from the keys gives the keyboard back to the Sheet first, so what the press opens\n * may take it. */\n readonly onPress: () => void;\n /** Its KeyTip letters among its row's items. */\n readonly keyTip?: string | undefined;\n /** Why it cannot be pressed now, shown in its tooltip; `undefined` where it can. */\n readonly disabledReason?: string | undefined;\n /** Its own content, such as an icon, drawn in place of its text, which still names it. Hand the same function on\n * every update: a new one draws the content again. */\n readonly content?: SheetToolbarContent | undefined;\n}\n\n/** One element of a Toolbar Row: one of ExSheet's own items, named by its command and carrying Excel's KeyTip; a\n * separator between groups; or the Consumer's own button. */\nexport type SheetToolbarEntry = SheetToolbarCommand | 'separator' | SheetToolbarButton;\n\n/** A Toolbar Row of the Consumer's (ADR-0100): one band of the Sheet Toolbar, as tall as the Formula Bar. */\nexport interface SheetToolbarRowOptions {\n /** The row's accessible name. */\n readonly label: string;\n /** The row's KeyTip letters, as a ribbon tab's; a row without one is reached by Tab and the arrows only. */\n readonly keyTip?: string | undefined;\n /** What the row holds, in order. */\n readonly items: readonly SheetToolbarEntry[];\n}\n\n/**\n * The Sheet's Chrome slots (ADR-0390), the C# `ISheetChrome`'s, each a mount function the Sheet calls with the slot's\n * element and what the slot is handed. A slot not given is drawn by the built-in Chrome. As `ISheetChrome` extends\n * `IGridChrome`, the grid's own slots are among them, and the Sheet hands those to its grid: the Cell Editor, the\n * Formula Bar's fields, the completion list, the find panel, the Context Menu, a cell's message and the Selection\n * Summary. The column menu and the filter panel are taken too, and never shown, since a Sheet's columns have no menu.\n */\nexport interface SheetChrome extends GridChrome<unknown> {\n /** Each Toolbar Item of the Sheet Toolbar (ADR-0100): a mount that answers `undefined` leaves the item to the\n * built-in Chrome, as the C# Chrome's `ToolbarItem` answering null does. */\n readonly toolbarItem?: SheetToolbarItemSlot;\n /** Format Cells' contents (ADR-0071), in the grid's popover frame. */\n readonly formatCells?: SheetFormatCellsSlot;\n /** Each Sheet Tab's face (ADR-0331 \u00A74). */\n readonly sheetTab?: SheetTabSlot;\n /** The face of the button that adds a Sheet (ADR-0331 \u00A74). */\n readonly sheetTabAdd?: SheetTabAddSlot;\n}\n\n/** The Sheet's own slots, beside the grid's. */\nconst sheetSlotNames: readonly string[] = ['toolbarItem', 'formatCells', 'sheetTab', 'sheetTabAdd'];\n\n/** How many rows and columns every Sheet holds (ADR-0460), each from 1 to Excel's 1,048,576 rows and 16,384 columns. */\nexport interface SheetSizeOptions {\n /** How many rows, from 1 to 1,048,576; Excel's 1,048,576 unless given, so `{ columns: 10 }` narrows only the\n * columns. */\n readonly rows?: number;\n /** How many columns, from 1 to 16,384 (`A` to `XFD`); Excel's 16,384 unless given, so `{ rows: 10 }` shortens only\n * the rows. */\n readonly columns?: number;\n}\n\n/** What a Sheet is drawn with. */\nexport interface SheetOptions {\n /** The Workbook or Sheet to open; a new Workbook of one empty Sheet unless given. A new document object opens\n * it in place of what is shown, with nothing to undo, and `undefined` given in place of one opens an empty Sheet\n * in `locale`; one `onWorkbookChanged` handed out, handed back as a controlled component's state is, is the\n * Sheet's own and changes nothing. */\n readonly document?: SheetDocument | WorkbookDocument | undefined;\n /** The culture of a Sheet started empty: how typed constants are read and Values shown (ADR-0048). A document\n * carries its own. The browser's language unless given; one the engine holds no data for is refused by name. */\n readonly locale?: string;\n /** Shows the Formula Bar and its Name Box above the columns (ADR-0051); shown unless `false`. */\n readonly showFormulaBar?: boolean;\n /** How many leading columns are pinned \u2014 the Sheet's frozen panes, columns only (ADR-0046). */\n readonly pinnedColumnCount?: number;\n /** Shows the Row Headings, the row numbers, beside the rows (ADR-0050); shown unless `false`. The Sheet still\n * addresses `A1` without them. */\n readonly showRowHeadings?: boolean;\n /** Shows the Column Headings, the column letters, above the rows (ADR-0050); shown unless `false`. The Sheet\n * still addresses `A1` without them. */\n readonly showColumnHeadings?: boolean;\n /** Shows the Sheet Tabs at the Sheet's foot, one per Sheet of the Workbook, as Excel does (ADR-0331); shown unless\n * `false`. Their band, as tall as the Formula Bar, comes off `viewportHeight`. */\n readonly showSheetTabs?: boolean;\n /** Shows the Sheet Toolbar above the Formula Bar (ADR-0100): Excel's Home tab formatting commands, acting on this\n * Sheet's Selection. Off unless `true`. Its band, a row as tall as the Formula Bar, comes off `viewportHeight`. */\n readonly showToolbar?: boolean;\n /**\n * The Sheet Toolbar's rows, top to bottom (ADR-0100). `'default'` is ExSheet's own row, Excel's Home tab's commands,\n * whose KeyTip is H; a row of the Consumer's holds ExSheet's items by their commands, separators and the Consumer's\n * own buttons, in the order given. Without it the toolbar is the default row alone. Every row is as tall as the\n * Formula Bar and comes off `viewportHeight`; what a row holds is fitted to it and clipped. KeyTips that would be\n * taken for one another at one level, two rows' or two items' of one row, are refused.\n */\n readonly toolbar?: readonly (SheetToolbarRowOptions | 'default')[] | undefined;\n /**\n * Hears the other value of `showToolbar` when the user asks to hide or show the Sheet Toolbar with Ctrl+F1, Excel's\n * key for the ribbon (ADR-0100). The Sheet holds nothing: whether the toolbar is shown is View State, the\n * Consumer's, so handing the value back as `showToolbar` is what lets the key work. Without it, Ctrl+F1 is not\n * claimed and stays the browser's.\n */\n readonly onShowToolbarChanged?: (shown: boolean) => void;\n /** The parts of the Sheet a Chrome of the Consumer's, or a Wrapper's, draws in place of the built-in ones (ADR-0390). */\n readonly chrome?: SheetChrome;\n /** ExSheet's Japanese words in place of its English (ADR-0370, section 10), chosen in one line, never by the\n * locale. */\n readonly japanese?: boolean;\n /** The Consumer's word for any id, which wins over ExSheet's own (ADR-0370, section 10). */\n readonly label?: SheetLabel;\n /**\n * The Consumer's word for each of the grid's own ids, its commands and its refusals (ADR-0036, ADR-0203), handed to\n * the Sheet's grid as its `commandLabel`: `undefined` keeps the grid's English, and the empty string silences the\n * announcement of a refusal. The Sheet's own ids are worded through `label`.\n */\n readonly commandLabel?: (id: string) => string | undefined;\n /** Shows the Selection Summary under the Sheet, as Excel's status bar does (ADR-0130); shown unless `false`.\n * `onSelectionSummaryChanged` still hears it while hidden. */\n readonly showSelectionSummary?: boolean;\n /** The Selection Summary's figures, Excel's Average, Count and Sum unless given (ADR-0130). The Sheet holds the\n * choice made in the figures menu from then on, and tells it through `onSummaryFiguresChanged`; figures handed here\n * that differ from the ones given before replace it. */\n readonly summaryFigures?: readonly SummaryFigure[];\n /** Hears the figures the user chose in the figures menu, a right-click on the summary (ADR-0130). The Sheet already\n * shows them. */\n readonly onSummaryFiguresChanged?: (figures: readonly SummaryFigure[]) => void;\n /** Hears the Selection Summary as it now stands (ADR-0130), for an application that shows the figures elsewhere. */\n readonly onSelectionSummaryChanged?: (summary: SelectionSummary) => void;\n /**\n * Offers copy with headers in the Context Menu and by Ctrl+Shift+C, which copies the Values with the column letters\n * as the first row (ADR-0048, ADR-0005). Off unless `true`: a Sheet's column letters are addresses, not headers, and\n * Excel has no such command (ADR-0050 item 13), so the key is left to the page.\n */\n readonly allowCopyWithHeaders?: boolean;\n /**\n * Hears that one of Excel's formatting keys was pressed while an edit is open (ADR-0071): the key changed nothing,\n * and the Sheet's notice says why. In that state Excel formats the selected characters, and a Cell Format is per\n * cell. The key is still claimed, so the browser's own meaning does not run either: Ctrl+U opens no page source.\n */\n readonly onFormatKeyRefused?: (refusal: SheetRefusal) => void;\n /** The grid's density (ADR-0028); a Wrapper's, then `compact`, unless given. Column widths in characters follow it. */\n readonly density?: GridDensity;\n /**\n * A Wrapper's widths and Density (ADR-0030), as the grid takes them: the cells are painted in the Wrapper's font, so\n * the Sheet's columns are measured in its characters, and the Sheet decides what fits by them (ADR-0016, ADR-0071).\n */\n readonly presentationDefaults?: GridPresentationDefaults;\n /** The height of a row in pixels (ADR-0013). */\n readonly rowHeight?: number;\n /**\n * How many rows and columns every Sheet holds (ADR-0460): `{ rows: 10, columns: 10 }` draws `A1:J10` and nothing\n * past it, and `{ rows: 10 }` holds ten rows of Excel's 16,384 columns. Excel's 1,048,576 \u00D7 16,384 unless given.\n * Every move stops at the edge, and a paste, a fill or an insertion that would put an Entry past it is refused by\n * name, never cut; a spilled array that would pass it is `#SPILL!`. A Reference past it still reads the empty cell\n * it names, so a Formula means what it means in Excel. A document with an Entry past it is refused when it is\n * opened, and a smaller size handed in later that would leave one outside, or while a cell is being edited, is\n * refused, the Sheet keeping the size it had; a smaller size taken empties the undo stack, whose steps could put an\n * Entry back past it. The size is the screen's, not the document's: it is not saved.\n */\n readonly sheetSize?: SheetSizeOptions;\n /** The grid's width: pixels, or `stretch` to fill the element's box. */\n readonly viewportWidth?: ViewportSize;\n /** The grid's height: pixels, or `stretch` to fill the element's box. */\n readonly viewportHeight?: ViewportSize;\n /** Hears the Workbook as it stands after each operation: an edit, an undo, a redo, a width. */\n readonly onWorkbookChanged?: (document: WorkbookDocument) => void;\n /**\n * Hears a Sheet added, deleted, renamed, moved or copied \u2014 by a command, by the user, or by an undo or redo of\n * one \u2014 after `onWorkbookChanged`, with the Sheets' names before and after (ADR-0331 \u00A76). Showing another Sheet\n * changes no Sheet, and is not heard; neither is a new document opened.\n */\n readonly onSheetsChanged?: (change: SheetsChange) => void;\n /**\n * Hears whether there is a step to undo and one to redo, each time either changes: as the operation that changed it\n * ends, before `onWorkbookChanged` hears its document, and when a document opened empties the undo stack (ADR-0048). This is\n * where an application greys out its own Undo and Redo, as `canUndo` and `canRedo` read the same at any time.\n */\n readonly onHistoryChanged?: (history: SheetHistoryState) => void;\n /**\n * Hears whether an edit is open, each time that changes: `true` when a cell or the Formula Bar is typed in, or\n * opened with F2 or a double click, `false` when the edit is committed, cancelled or discarded (ADR-0048). While\n * one is open the commands that change the Sheet are refused, so this is where an application greys out its own\n * buttons for them, as Excel greys out its ribbon.\n */\n readonly onEditingChanged?: (open: boolean) => void;\n /**\n * Hears each Linked Table column the Formula being edited reads, and the colour its References wear in the\n * editor (ADR-0057, ADR-0049): each column once, in order of first appearance, under the table's and the\n * column's names as the Consumer declared them. Told once whenever that list changes and never when it does\n * not, and with an empty list when the edit ends. A table or column not declared names nothing and is not\n * told. The Sheet does not know where, or whether, the table is on screen, and outlines none of it itself: the\n * Consumer hands each entry to the grid that shows the table as one of its `outlinedColumns`, the grid column\n * that shows `column` with the same `colour`, and only it can vouch that that grid shows the rows the Formula\n * reads.\n */\n readonly onLinkedColumnColoursChanged?: (columns: readonly LinkedColumnColour[]) => void;\n /**\n * The Pointing Scope this Sheet belongs to (ADR-0058), or none. While this Sheet holds the keyboard, has an edit\n * open and is in Point, its caret standing where a Reference can go or what Point wrote there still standing, the\n * grids registered in the Scope are pointed at: a press on a cell writes\n * `XLOOKUP(\"R-4471\", Positions[Id], Positions[PV])`, reading the cell by its row's key, where Point writes, and a\n * press on a column header `Positions[PV]`, in the table's column names as this Sheet declares them. A further press, on a registered grid or on this Sheet, replaces what this Point\n * wrote. A press that stands for anything else writes nothing, and is told through `onPointingRefused`. When the\n * keyboard leaves this Sheet, no grid is pointed at, and the edit stands.\n *\n * After such a press F4 changes nothing, and the arrow keys point inside the grid pressed: \u2191 and \u2193 one row further\n * in its current order, \u2190 and \u2192 to the next column its table has, rewriting what this Point wrote, and the grid\n * scrolls the cell into view. After a press on a column header, \u2193 points at the column's first row, and \u2190 and \u2192 at\n * the next column its table has, as a column; \u2191 moves nothing. The Scope also outlines, in the grids registered\n * for their table, the Linked Table columns the Formula edited here reads, and dashes the cell or column a press\n * wrote for until Point over what it wrote ends.\n */\n readonly pointingScope?: PointingScope | undefined;\n /**\n * Hears that a press on a grid of `pointingScope`, or an arrow key after one, wrote nothing into the Formula being\n * edited, and why (ADR-0058): more than one cell or column, a Header Group, a column the table does not have, a\n * table declared without a key, a blank key, a row not yet arrived. A drag that reached another cell took back\n * what its press wrote. The Formula's text is as it was before the press or the key. The Sheet shows nothing of\n * it itself: show the refusal's `message` where the page tells its user things.\n */\n readonly onPointingRefused?: (refusal: PointingRefusal) => void;\n /** Hears the grid's Selection each time it changes, as ExGrid reports it (ADR-0011/0014): what a status line\n * counts. The formatting commands do not wait for it: they act on the Selection the grid holds when they run. */\n readonly onSelectionChanged?: (selection: GridSelection) => void;\n /**\n * A fixed Sheet Seed (ADR-0180): what `RAND()` and `RANDBETWEEN` draw from, with the Sheet, the cell, the call's\n * place in its Formula and the count of changes since the document was opened \u2014 for a sheet that must show the\n * same draws whenever it is opened, such as a simulation someone else reviews. The draws still change at each\n * change of the Workbook, and never on the clock. Unless given, the Sheet chooses a seed whenever it opens a\n * document, so a reopened sheet draws again, as Excel's reopened workbook does. An unsigned 64-bit integer; the\n * seed is not recorded in the document.\n */\n readonly seed?: bigint;\n /**\n * A fixed Sheet Day: what `TODAY()` answers whatever the clock says (ADR-0121), for a report that must show the same\n * day whenever it is opened. It goes before `timeZone`. Unless given, the day is the clock's in the zone, read again\n * at midnight there, and at least once an hour.\n */\n readonly today?: SheetDay | undefined;\n /**\n * The IANA time zone whose day `TODAY()` and whose time of day `NOW()` answer (ADR-0121, ADR-0124), such as head\n * office's for a site that keeps one business day for every user. The browser's zone unless given, as Excel takes the\n * day on the user's own device; one the browser does not know is refused by name. A fixed `today` goes before it for\n * `TODAY()`, not for `NOW()`, which moves on as each minute turns.\n */\n readonly timeZone?: string | undefined;\n}\n\n/** Whether there is a step to undo and one to redo, as `onHistoryChanged` hears it. */\nexport interface SheetHistoryState {\n /** Whether there is a step to undo. */\n readonly canUndo: boolean;\n /** Whether there is an undone step to redo. */\n readonly canRedo: boolean;\n}\n\n/** The Sheets' names before and after a change to the Sheets (ADR-0331 \u00A76), in the Workbook's order. */\nexport interface SheetsChange {\n /** The names as they were. */\n readonly before: readonly string[];\n /** The names as they are now. */\n readonly after: readonly string[];\n /** The name of the Sheet shown after the change. */\n readonly shown: string;\n}\n\n/**\n * The Focus cell's Cell Format, as `SheetHandle.readFocusFormat` read it: a change is made from it away from the Sheet,\n * and set with `SheetHandle.setCellFormatFrom`, which knows what it was read against (ADR-0100).\n */\nexport interface FocusFormatReading {\n /** The Focus cell's Cell Format as it showed. */\n readonly format: CellFormat;\n}\n\n/**\n * The turn of work the Sheet runs in its Input Order, handed to that work (ADR-0240 section 6). A file opened or saved\n * through it is opened or saved at once, inside the turn, as `open` and `save` do in their own place: for a Framework\n * Adapter whose Consumer's handler runs in another runtime while the turn is held, as a Toolbar button's press holds\n * it, where `open` and `save` would wait for the turn they belong to. The inputs made meanwhile wait behind both. Once\n * the turn's work has ended, each throws.\n */\nexport interface SheetTurn {\n /** Opens a file at once, inside this turn, as `SheetHandle.open` does in its place. */\n open(read: (signal: AbortSignal) => PromiseLike<WorkbookDocument>): Promise<boolean>;\n /** Saves the Workbook at once, inside this turn, as `SheetHandle.save` does in its place. */\n save(write: (workbook: Workbook) => void | PromiseLike<void>): Promise<void>;\n}\n\n/** A Sheet drawn into an element, handed back by {@link createSheet}. */\nexport interface SheetHandle {\n /** The Workbook the Sheet edits. Change it only through the Sheet, or what is shown falls behind it. */\n readonly workbook: Workbook;\n /** Takes the options again, whole. */\n update(options: SheetOptions): void;\n /** Whether there is a step to undo. */\n readonly canUndo: boolean;\n /** Whether there is an undone step to redo. */\n readonly canRedo: boolean;\n /**\n * Whether an edit is open in the grid, from the moment a cell or the Formula Bar is typed in until the edit is\n * committed, cancelled or discarded (ADR-0048). While it is, `do`, `undo`, `redo`, `setCellFormat` and\n * `openFormatCells` are refused with a `SheetRefusedError`; `cellFormatAt` is a read, and answers.\n */\n readonly isEditing: boolean;\n /**\n * A Consumer command: does `edit` as one operation on the user's undo stack (ADR-0048), and raises\n * `onWorkbookChanged`. It names no Sheet, so it is taken only while the Workbook holds one; with several it is\n * refused, and the Sheet is named with the other form (ADR-0331 \u00A76). It does the edit exactly as it is written, and\n * widens no column.\n *\n * @throws SheetRefusedError The Sheet refuses the edit, an edit is open, or the Workbook holds several Sheets;\n * nothing changed.\n * @throws FormulaSyntaxError A typed Formula cannot be read; nothing changed.\n */\n do(edit: SheetEdit): void;\n /**\n * A Consumer command: does `edit` on the Sheet named `sheet`, shown or not, as one operation on the user's undo\n * stack (ADR-0048, ADR-0331 \u00A76). A Sheet operation \u2014 `insertSheet`, `rename`, `moveSheet`, `copySheet`,\n * `deleteSheet` \u2014 acts on that Sheet and raises `onSheetsChanged`; the Sheet shown stays shown unless it is the one\n * deleted, and then the Sheet that takes its place is.\n *\n * @throws RangeError No Sheet of the Workbook is named `sheet`; nothing changed.\n * @throws SheetRefusedError The Sheet refuses the edit, or an edit is open; nothing changed.\n * @throws FormulaSyntaxError A typed Formula cannot be read; nothing changed.\n */\n do(sheet: string, edit: SheetEdit): void;\n /**\n * Sets the parts of a Cell Format that `change` names on the Selection the grid holds now, as one operation on the\n * undo stack (ADR-0071, ADR-0048): every part it does not name stays as each cell has it. A Selection of whole\n * columns or rows sets it on the columns or rows, and the change's Borders are relative to each range. It widens\n * as the formatting keys do: a Number Format, underline or strikethrough widens each column whose numbers it no\n * longer fits and the user has not sized, in the same operation. Answers false when nothing is selected.\n *\n * @throws RangeError The change sets no part of a Cell Format.\n * @throws SheetRefusedError An edit is open; nothing changed.\n */\n setCellFormat(change: CellFormatChange): boolean;\n /**\n * Sets on the Selection a change made from the Focus cell's Cell Format as it shows now, as a toggle key reads it\n * (ADR-0071, ADR-0100): Bold on over a Focus cell that is not bold, off over one that is. It widens as Excel's Home\n * tab buttons do: as the formatting keys do, and for a Font colour too. Otherwise it acts, refuses and answers as\n * `setCellFormat`; false when nothing is selected, and then `changeOf` is not called.\n *\n * @throws RangeError The change it makes sets no part of a Cell Format.\n * @throws SheetRefusedError An edit is open; nothing changed.\n */\n setCellFormatFromFocus(changeOf: (focus: CellFormat) => CellFormatChange): boolean;\n /**\n * The Focus cell's Cell Format as it shows now, read for a change made from it away from the Sheet, over a round\n * trip, and set with `setCellFormatFrom` (ADR-0100); undefined when nothing is selected. It is read for a change,\n * so it is refused while an edit is open, before the change is made.\n *\n * @throws SheetRefusedError An edit is open.\n */\n readFocusFormat(): FocusFormatReading | undefined;\n /**\n * Sets `change`, made from `reading`, on the Selection, as `setCellFormatFromFocus` sets the change it makes: only\n * while the Selection, the Sheet shown and the Focus cell's Cell Format are what `reading` was read from.\n * Otherwise the change would be set on cells it was not made for, or undo what it was made to do, so it is refused,\n * and the notice says so (ADR-0100, decided 2026-10-28). A reading is taken by its set, whatever comes of it.\n *\n * @throws TypeError `reading` was not read from this Sheet, or was set already.\n * @throws RangeError The change sets no part of a Cell Format.\n * @throws SheetRefusedError An edit is open; the Selection or the Sheet shown moved (`selectionMoved`); the Focus\n * cell's Cell Format changed (`focusFormatChanged`). Nothing changed.\n */\n setCellFormatFrom(reading: FocusFormatReading, change: CellFormatChange): boolean;\n /**\n * Opens Format Cells over the Selection the grid holds now, from the Consumer's own button (ADR-0071): on the Focus\n * cell's Cell Format, and on the tab shown last. OK sets the parts the user touched as one undo step; Cancel or\n * Escape sets nothing. Opening it again while it stands opens it afresh. Answers false when nothing is selected.\n *\n * @throws SheetRefusedError An edit is open; nothing opened.\n */\n openFormatCells(): boolean;\n /**\n * The Cell Format of the cell at `address` as it shows (ADR-0071): each part the cell's own, else its row's, else\n * its column's, else the default. It names no Sheet, so it is read only while the Workbook holds one; with several,\n * name the Sheet with the other form (ADR-0331 \u00A76).\n *\n * @throws SheetRefusedError The Workbook holds several Sheets.\n */\n cellFormatAt(address: CellAddress): CellFormat;\n /**\n * The Cell Format of the cell at `address` on the Sheet named `sheet`, shown or not, as it shows.\n *\n * @throws RangeError No Sheet of the Workbook is named `sheet`.\n */\n cellFormatAt(sheet: string, address: CellAddress): CellFormat;\n /** Undoes the latest operation; false when there is none, which the notice says. */\n undo(): boolean;\n /** Redoes the latest operation undone; false when there is none, which the notice says. */\n redo(): boolean;\n /**\n * Declares a Linked Table Formulas read by name, as `ExSheet.DeclareLinkedTableAsync` does (ADR-0049): its readers\n * show `#GETTING_DATA` until a snapshot is pushed. The declaration is recorded in the document, so\n * `onWorkbookChanged` hears it when it changes what was declared; declaring the same table again changes nothing.\n * It is the Consumer's data, not a user's operation, so it is no step on the undo stack. `key` names the column, or\n * the columns, a row is read by.\n */\n declareLinkedTable(name: string, columns: readonly string[], key?: string | readonly string[]): void;\n /**\n * Replaces a Linked Table's rows with a whole snapshot, in one step, as `ExSheet.PushLinkedTableAsync` does\n * (ADR-0049): only the Formulas that read it, and what depends on them, recalculate, and only the rows whose\n * Values changed repaint. The document never holds a table's rows, so `onWorkbookChanged` hears nothing, and\n * nothing goes on the undo stack. A snapshot of a keyed table in which a key repeats is refused with the engine's\n * `RepeatedKeyError`, after the table's readers show `#GETTING_DATA` again.\n */\n pushLinkedTable(name: string, rows: Iterable<readonly (Value | undefined)[]>): void;\n /**\n * Replaces the Workbook with the Workbook Document `read` answers, taken at this call's place in the Input Order\n * (ADR-0330 \u00A710), as `ExSheet.OpenAsync` does: the inputs made before it are taken against the Workbook they were\n * made on, and those made after it wait until the document arrives and are then taken against the new one, or\n * refused aloud when what they were taken against no longer holds (ADR-0142). Call it from the handler that hears\n * the user's choice of a file, with the read still to do, such as\n * `signal => openXlsxWorkbook(file, 'en-US', { signal }).then(read => read.document)` from `@ex-grid/sheet-xlsx`.\n *\n * In its turn, an edit still open refuses it by name, as a save is refused, and nothing is read: what is being typed\n * would be thrown away. From this call until the opening ends the Sheet's grid names it in its Settled Stamp, and a\n * plain Escape typed in the grid while it is placed aborts `read`'s signal: the Workbook stays as it was, and the\n * notice says so; an opening cancelled before its turn ends cancelled. While the read is under way the notice says\n * so, and the grid is busy and painted as a paste under way is. A read that fails leaves the Workbook as it was too,\n * says so with the failure's message, and the failure is this method's. When the document arrives it replaces the\n * whole Workbook, as a new `document` does (ADR-0048): the undo stack is cleared, the Linked Tables declared are gone\n * with the Workbook that held them, and `onWorkbookChanged` is raised with the Workbook opened. An Escape that comes\n * once it has landed changes nothing, and the Sheet says it came too late; one that finds the opening over otherwise\n * says there was nothing to cancel.\n *\n * Only the grid's inputs wait behind it. A method the Consumer calls meanwhile is not an input and is not held:\n * what it changes is replaced when the file lands. Once the Sheet is destroyed the signal is aborted, and nothing\n * lands.\n *\n * @param read - Reads the document, looking at the signal as it goes; a read that sees it aborted rejects with the\n * signal's reason.\n * @returns True once the document opened; false when Escape cancelled the read, or the Sheet was destroyed first.\n * @throws SheetRefusedError An edit is open in the opening's turn; nothing was read.\n * @throws Error Whatever `read` failed with, such as `XlsxOpenError`, or the engine's refusal of the document;\n * nothing opened. Or whatever `onWorkbookChanged` or `onSheetsChanged` failed with, once the file opened.\n */\n open(read: (signal: AbortSignal) => PromiseLike<WorkbookDocument>): Promise<boolean>;\n /**\n * Saves the Workbook at this call's place in the Input Order (ADR-0330 \u00A710), as `ExSheet.SaveAsync` does: `write` is\n * handed the Workbook as the inputs made before the call left it \u2014 every Sheet with its Values, its Cell Formats and\n * widths, and the rows each Linked Table holds \u2014 such as `workbook => saveXlsxWorkbook(workbook)` from\n * `@ex-grid/sheet-xlsx`. The Workbook is lent for that call only: read it before the call's first `await`, as\n * `saveXlsxWorkbook` does, and never change it. The inputs made after the save are taken once `write` has returned,\n * not once its promise settles, so a slow write holds nobody up.\n *\n * @returns A promise that settles once `write`'s has.\n * @throws SheetRefusedError An edit is open: the file would quietly lack what is being typed. The Sheet says so, and\n * nothing was written.\n * @throws Error Whatever `write` failed with, such as `XlsxSaveError`.\n */\n save(write: (workbook: Workbook) => void | PromiseLike<void>): Promise<void>;\n /** Hands the keyboard to the Sheet's grid: to the field an open edit is typed in, else to where the grid takes keys\n * (ADR-0080), as the grid's own `focus` does. A Consumer's control beside the Sheet gives the keyboard back with\n * this. Throws once the Sheet is destroyed, as `holdSettled` and `inOrder` do. */\n focus(): void;\n /**\n * Holds the Settled Mark of the Sheet's grid (ADR-0220) until the function it answers is called, as the grid's own\n * `holdSettled` does: for a Framework Adapter whose Chrome's contents arrive after their slot, a round trip later on\n * a circuit (ADR-0410 section 5), so that nothing reads the part before it stands. Each hold is let go once.\n */\n holdSettled(): () => void;\n /**\n * Runs `handling` in its place in the Input Order of the Sheet's grid (ADR-0240 section 6), as the grid's own\n * `inOrder` does: after every input made so far, and before any made after it, which wait until the promise it\n * answers settles. A Sheet destroyed before its turn runs nothing; one already destroyed throws. `handling` is handed\n * its turn, through which a file is opened or saved as part of it, as the grid's turn places work.\n */\n inOrder(handling: (turn: SheetTurn) => void | PromiseLike<void>): Promise<void>;\n /**\n * Says `sentence` in the Sheet's notice, where the Sheet says its own refusals (ADR-0100): for a Framework Adapter\n * whose Consumer's Toolbar button ran a command a round trip later that was refused, as the C# toolbar says one.\n * Throws once the Sheet is destroyed, as `inOrder` does.\n */\n tell(sentence: string): void;\n /** Stops the Sheet and empties its element. */\n destroy(): void;\n}\n\n// Whether `day` is a calendar day the engine takes as a Sheet Day (ADR-0121).\nfunction isSheetDay(day: unknown): day is SheetDay {\n if (typeof day !== 'object' || day === null) return false;\n const { year, month, day: date }: { readonly year?: unknown; readonly month?: unknown; readonly day?: unknown } = day;\n if (typeof year !== 'number' || typeof month !== 'number' || typeof date !== 'number') return false;\n if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(date) || year < 1900 || year > 9999) return false;\n const read = new Date(Date.UTC(year, month - 1, date));\n return read.getUTCFullYear() === year && read.getUTCMonth() === month - 1 && read.getUTCDate() === date;\n}\n\n// Whether two lists name the same figures, in any order: the summary shows them in Excel's order whatever the order\n// given (ADR-0130).\nfunction sameFigures(a: readonly SummaryFigure[] | undefined, b: readonly SummaryFigure[] | undefined): boolean {\n if (a === b) return true;\n if (a === undefined || b === undefined) return false;\n const held = new Set(a);\n return held.size === new Set(b).size && b.every(figure => held.has(figure));\n}\n\n// Excel's key for the ribbon, which hides and shows the Sheet Toolbar (ADR-0100).\nconst toolbarToggleKey = 'Control+F1';\n\n// The largest seed: a seed is an unsigned 64-bit integer, as the engine and C#'s ulong hold it (ADR-0180).\nconst maxSeed = (1n << 64n) - 1n;\n\n// Whether `error` is the reason an aborted signal rejects with: the work ended cancelled (ADR-0240 section 12).\nfunction cancelledBy(signal: AbortSignal, error: unknown): boolean {\n return signal.aborted && error === signal.reason;\n}\n\n// What a failure says, in the notice that says nothing opened.\nfunction messageOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\n// A seed drawn from the browser's generator, as the C# Sheet draws one from Random.Shared (ADR-0180).\nfunction chooseSeed(): bigint {\n return elementAt(crypto.getRandomValues(new BigUint64Array(1)), 0);\n}\n\n/** Draws a Sheet into `element`, which it owns from now on. */\nexport function createSheet(element: HTMLElement, options: SheetOptions = {}): SheetHandle {\n const view = new SheetView(element, options);\n return Object.freeze({\n get workbook() { return view.workbook; },\n get canUndo() { return view.canUndo; },\n get canRedo() { return view.canRedo; },\n get isEditing() { return view.isEditing; },\n update: (next: SheetOptions) => { view.update(next); },\n do: (sheetOrEdit: string | SheetEdit, edit?: SheetEdit) => { view.do(sheetOrEdit, edit); },\n setCellFormat: (change: CellFormatChange) => view.setCellFormat(change),\n setCellFormatFromFocus: (changeOf: (focus: CellFormat) => CellFormatChange) => view.setCellFormatFromFocus(changeOf),\n readFocusFormat: () => view.readFocusFormat(),\n setCellFormatFrom: (reading: FocusFormatReading, change: CellFormatChange) => view.setCellFormatFrom(reading, change),\n openFormatCells: () => view.openFormatCells(),\n cellFormatAt: (sheetOrAddress: string | CellAddress, address?: CellAddress) => view.cellFormatAt(sheetOrAddress, address),\n undo: () => view.undo(),\n redo: () => view.redo(),\n declareLinkedTable: (name: string, columns: readonly string[], key?: string | readonly string[]) => { view.declareLinkedTable(name, columns, key); },\n pushLinkedTable: (name: string, rows: Iterable<readonly (Value | undefined)[]>) => { view.pushLinkedTable(name, rows); },\n open: (read: (signal: AbortSignal) => PromiseLike<WorkbookDocument>) => view.open(read),\n save: (write: (workbook: Workbook) => void | PromiseLike<void>) => view.save(write),\n focus: () => { view.focus(); },\n holdSettled: () => view.holdSettled(),\n inOrder: (handling: (turn: SheetTurn) => void | PromiseLike<void>) => view.inOrder(handling),\n tell: (sentence: string) => { view.tellFromAdapter(sentence); },\n destroy: () => { view.destroy(); },\n });\n}\n\nclass SheetView {\n readonly #element: HTMLElement;\n readonly #gridElement: HTMLElement;\n // ExSheet's stylesheet's notice (ADR-0123, ERR-11), last in the root, as the Razor component drew it: shown by a stylesheet of another version,\n // hidden by its own, with no script. The Sheet's grid draws ExGrid's, and the Chrome's beside it.\n readonly #stylesheetNotice: HTMLElement;\n readonly #toolbar: SheetToolbar;\n readonly #tabs: SheetTabs;\n readonly #notice: HTMLElement;\n readonly #history = new SheetHistory();\n // The undo stack as `onHistoryChanged` was last raised with: empty, as the Sheet is made.\n #historyRaised: SheetHistoryState = Object.freeze({ canUndo: false, canRedo: false });\n #options: SheetOptions;\n #words: SheetWords;\n #workbook: Workbook;\n #document: SheetDocument | WorkbookDocument | undefined;\n readonly #source: SheetSource;\n #columns: SheetColumns;\n #reading = 0;\n #appearance: ReturnType<typeof appearanceLookup>;\n #grid: GridHandle<SheetRow> | undefined;\n // Whether the notice stands through the move that completes the gesture that told it (a commit's Enter).\n #noticeOutlivesMove = false;\n // The Selection the grid last reported, and whether an edit is open there.\n #selection: GridSelection | undefined;\n #editing = false;\n #linkedColumnsTold: readonly LinkedColumnColour[] = [];\n // The figures chosen in the summary's menu, which stand until the Consumer hands other figures (ADR-0130).\n #summaryChoice: readonly SummaryFigure[] | undefined;\n // The Pointing Scope this Sheet joined (ADR-0058), where the grid last said its edit stands with respect to Point,\n // whether DOM focus is inside the Sheet as the browser last said, and whether the Scope last heard it points.\n #joinedScope: PointingScope | undefined;\n #pointState: GridPointState = 'none';\n #holdsKeyboard = false;\n #scopeHeardPoints = false;\n // The copy last put on the clipboard, whose Entries a paste of exactly it carries (ADR-0048), and the sentence a\n // copy of the Sheet's own was last refused with (ADR-0049).\n #ownCopy: SheetOwnCopy | undefined;\n #copyRefusal: string | undefined;\n // Format Cells while it stands in the grid's popover, and the Sheet, the Selection and the ranges it was opened\n // over; and the tab it last showed, which the next opening shows again (ADR-0071). The grid closing the popover\n // itself, by Escape or a press elsewhere, tells the Sheet nothing: the record stands, its frame gone, until the\n // next opening or move drops it, and nothing reads it as open meanwhile, as only the frame's OK sets anything.\n #formatCells: {\n readonly panel: FormatCellsPanel | SlottedFormatCells; readonly draft: FormatCellsDraft; readonly sheet: Sheet; readonly selection: GridSelection;\n readonly ranges: readonly CellRange[];\n } | undefined;\n #formatCellsTab: FormatCellsTab = 'number';\n // What each colour control's face sets: the colour chosen last from its list, red for the Font and yellow for the\n // Fill until one is, as Excel's start (ADR-0100). Taking the colour away is not kept.\n #faceFontColour: CellColour = colourFromRgb(0xFF0000);\n #faceFill: CellColour = colourFromRgb(0xFFFF00);\n // The Borders preset the face sets: the one chosen last, Bottom Border until one is.\n #faceBorder: SheetToolbarBorder = 'bottom';\n // The Selection a toolbar list a Chrome draws stands over: one moved from it ends the list.\n #chromeListsOver: GridSelection | undefined;\n // What each Focus format reading was read against: the Sheet shown and the Selection (ADR-0100).\n readonly #readings = new WeakMap<FocusFormatReading, { readonly sheet: Sheet; readonly selection: GridSelection }>();\n // The grid's slots made from the chrome last given.\n #gridChromeOf: { readonly given: SheetChrome | undefined; readonly made: GridChrome<SheetRow> } | undefined;\n // A Toolbar Item's list while it stands in the grid's popover frame, and the Selection it was opened over.\n #choices: { readonly panel: SheetChoicesPanel; readonly selection: GridSelection; readonly keyTipRow: number | undefined } | undefined;\n // The Alt key went down alone where the toolbar's keys are heard, and its release has not been heard: the release\n // starts the KeyTips, unless another key went down first, a chord, which is not a KeyTip.\n #altAlone = false;\n // The category the Number Format menu shows, read once for each Number Format and culture the Focus cell has.\n #shownCategory: { readonly format: NumberFormat; readonly culture: Culture; readonly category: NumberFormatCategory } | undefined;\n // A resize of several whole columns, reported a column at a time: its first step, and the columns still to\n // come, which join that step on the undo stack (FN-12c, ADR-0048).\n #resizing: { readonly first: WorkbookStep; readonly pending: Set<number> } | undefined;\n // Where Ctrl+arrow stops on the Sheet shown: its filled cells, indexed on the first Ctrl+arrow and kept in step\n // with every change after (ADR-0050, item 2).\n #edges: SheetEdges | undefined;\n #destroyed = false;\n // Each Sheet's view as it was left: its Selection and scroll offsets, given back when its tab is selected\n // again (ADR-0331 \u00A71). A Sheet not yet shown has none, and opens on A1.\n #views = new WeakMap<Sheet, GridViewRead>();\n // The style properties the Sheet set on its element (#frame), each with the value the Consumer had given it.\n readonly #framed = new Map<string, { readonly value: string; readonly priority: string }>();\n // The documents this Sheet handed out: one handed back as `document`, as a controlled component's state comes\n // back, is the Sheet's own state, and is not opened again over its undo stack.\n readonly #raised = new WeakSet<object>();\n // The seed chosen when the document was opened, which draws while no `seed` is given (ADR-0180).\n #chosenSeed: bigint;\n // Whether the Workbook shown was opened from a file since the Consumer last handed a document (ADR-0330 \u00A710).\n #fileOpened = false;\n // The Sheets' names as the Consumer last heard them, so a change says what it was taken from (ADR-0331 \u00A76): at\n // open, the document's own.\n #sheetNames: readonly string[] = [];\n // The day read again at midnight in the zone, and NOW moved on as the minute turns (ADR-0121, ADR-0124).\n #dayTimer: ReturnType<typeof setTimeout> | undefined;\n #minuteTimer: ReturnType<typeof setTimeout> | undefined;\n // The browser's zone, read once, as the C# Sheet is told it once at attach (ADR-0122).\n readonly #browserZone = browserTimeZone();\n\n constructor(element: HTMLElement, options: SheetOptions) {\n this.#element = element;\n this.#options = SheetView.#checked(options);\n this.#words = new SheetWords({ japanese: this.#options.japanese, label: this.#options.label });\n this.#commandLabel = SheetView.#commandLabelOf(this.#words, this.#options.commandLabel);\n this.#document = this.#options.document;\n this.#chosenSeed = chooseSeed();\n this.#workbook = this.#open(this.#options);\n this.#source = new SheetSource(this.#workbook.shown, () => this.#words, this.#findStepOf);\n this.#columns = new SheetColumns(SheetView.#metricsOf(this.#options), error => this.#words.formulaUnreadable(error));\n this.#columns.read(this.#workbook.shown);\n this.#appearance = appearanceLookup(this.#reading);\n // Everything a refusal could come from is asked before the element is touched, so a refused Sheet leaves it as\n // it was.\n const gridOptions = this.#gridOptions();\n\n element.classList.add('ex-sheet');\n element.setAttribute('data-ex-input-root', '');\n this.#stylesheetNotice = document.createElement('div');\n this.#stylesheetNotice.setAttribute('data-ex-notice', 'stylesheet');\n this.#stylesheetNotice.setAttribute('data-ex-stylesheet', stylesheetName);\n this.#stylesheetNotice.setAttribute('data-ex-stamp', stylesheetStamp);\n this.#stylesheetNotice.style.display = 'none';\n this.#wordStylesheetNotice();\n this.#gridElement = document.createElement('div');\n this.#notice = document.createElement('div');\n this.#notice.className = 'ex-sheet-notice';\n this.#notice.setAttribute('role', 'status');\n this.#tabs = new SheetTabs(document, {\n pressed: this.#onTabPressed, added: this.#onTabAdded, listKey: this.#onTabListKey,\n renameAsked: sheet => { this.#beginRename(sheet, false); },\n renameInput: text => {\n if (text === this.#renameText) return;\n this.#renameText = text;\n this.#tabs.markRenameRefused(false);\n },\n renameKey: key => {\n if (key === 'Enter') this.#commitRename(this.#renameFromTab ? 'tab' : 'grid');\n else this.#endRename(this.#renameFromTab ? 'tab' : 'grid');\n },\n renameLeft: session => {\n if (session !== this.#renameSession || this.#tabs.renaming === undefined) return;\n if (!this.#commitRename('nowhere')) this.#endRename('nowhere');\n },\n menuAsked: sheet => { this.#openTabMenu(sheet, false); },\n menuKey: this.#onTabMenuKey,\n menuCommand: command => { this.#tabCommand(command); },\n menuLeft: session => {\n if (session !== this.#menuSession || this.#menuSheet === undefined) return;\n this.#menuSheet = undefined;\n this.#tabs.closeMenu();\n },\n dropped: (sheet, target) => { this.#moveByDrag(sheet, target); },\n });\n this.#toolbar = new SheetToolbar(document, {\n giveBack: () => { this.#grid?.focus(); },\n // A choice of a list the Chrome draws, made as the built-in list's is.\n chosen: choice => {\n if (this.#editing) this.#tell(this.#words.toolbarWhileEditing);\n else choice.choose();\n this.#paintToolbar();\n },\n opening: () => { this.#chromeListsOver = this.#grid?.readView().selection; },\n });\n element.replaceChildren(this.#gridElement, this.#notice, this.#stylesheetNotice);\n element.addEventListener('focusout', this.#onSheetFocusOut);\n element.addEventListener('pointerdown', this.#forgetAlt, { capture: true });\n element.addEventListener('wheel', this.#forgetAlt, { capture: true, passive: true });\n element.addEventListener('focusin', this.#onKeyboardIn);\n element.addEventListener('focusout', this.#onKeyboardOut);\n this.#holdsKeyboard = element.contains(element.ownerDocument.activeElement);\n this.#grid = createGrid(this.#gridElement, gridOptions);\n // Excel's keys for the Sheet Tabs, heard on the Sheet before its grid hears them, wherever in it the keyboard\n // is, so the browser does not move among its own tabs (ADR-0331 \u00A74). Listened to once the grid is, so a key the\n // grid holds behind a commit or an opening is heard here in its turn, not before it (ADR-0240).\n element.addEventListener('keydown', this.#onSheetKey, { capture: true });\n element.addEventListener('keyup', this.#onSheetKeyUp, { capture: true });\n this.#bindPointingScope();\n this.#paintFrame();\n this.#armTheDay();\n this.#armTheMinute();\n }\n\n get workbook(): Workbook { return this.#workbook; }\n\n get canUndo(): boolean { return this.#history.canUndo; }\n\n get canRedo(): boolean { return this.#history.canRedo; }\n\n get isEditing(): boolean { return this.#editing; }\n\n update(options: SheetOptions): void {\n this.#alive();\n const next = SheetView.#checked(options);\n // A height too short for the bands is refused before anything changes, so the Sheet keeps the options it had.\n this.#gridHeight(next);\n // Judged by the culture the Sheet holds, so a locale naming that culture again changes nothing; with a document,\n // the document's culture is the one, as the option says.\n // A file opened since is a document of its own, whose culture the file's opening declared (ADR-0330 \u00A710).\n if (next.document === undefined && this.#document === undefined && !this.#fileOpened\n && Culture.of(next.locale ?? navigator.language) !== this.#source.sheet.culture) {\n throw new Error(\"A Sheet's culture is recorded in its document, so it is not changed on a live Sheet: Entries typed would not be read again (ADR-0048).\");\n }\n // Another Sheet Size gives every Sheet of the Workbook held the new edge, refused before anything changes when it\n // would leave an Entry outside (ADR-0460). A document opened in this update opens at the size it names.\n const size = sheetSizeOf(next);\n const reopening = next.document !== this.#document && !(next.document !== undefined && this.#raised.has(next.document));\n const before = this.#workbook.size;\n const shrinks = size.rows < before.rows || size.columns < before.columns;\n // An edit open may stand on a cell past a smaller edge, so a smaller size waits for it, as a command does.\n if (!reopening && shrinks) this.#refuseWhileEditing();\n const resized = reopening || size.equals(before) ? undefined : this.#workbook.resize(size);\n // Measured again only where the widths are others: defaults made again with the same widths change nothing.\n const metrics = SheetView.#metricsOf(next);\n if (!metrics.equals(SheetView.#metricsOf(this.#options))) {\n this.#columns = new SheetColumns(metrics, error => this.#words.formulaUnreadable(error));\n this.#columns.read(this.#source.sheet);\n }\n const wordsMoved = next.label !== this.#options.label || next.japanese !== this.#options.japanese;\n if (wordsMoved) this.#words = new SheetWords({ japanese: next.japanese, label: next.label });\n if (wordsMoved || next.commandLabel !== this.#options.commandLabel) {\n this.#commandLabel = SheetView.#commandLabelOf(this.#words, next.commandLabel);\n this.#wordStylesheetNotice();\n }\n const seedBefore = this.#options.seed;\n const previous = this.#options;\n this.#options = next;\n // Other figures handed over replace the choice made in the menu; the same figures again leave it standing.\n if (!sameFigures(next.summaryFigures, previous.summaryFigures)) this.#summaryChoice = undefined;\n // A document this Sheet raised, handed back, is its own state: nothing is opened again.\n if (next.document !== undefined && this.#raised.has(next.document)) this.#document = next.document;\n if (next.document !== this.#document) {\n this.#document = next.document;\n this.#chosenSeed = chooseSeed();\n this.#replaceWorkbook(this.#open(next), false);\n return;\n }\n if (resized !== undefined) {\n // A step undone or redone after a smaller size could put an Entry back past its edge, so the undo stack\n // goes with the larger size, as it goes with a document opened.\n if (shrinks) {\n this.#history.clear();\n this.#raiseHistory();\n }\n // The rows and columns are drawn again to the new edge, from A1: a view kept from before may lie past it.\n this.#views = new WeakMap();\n this.#showSheet(this.#workbook.shown);\n this.#changed([resized], false, false);\n }\n // A new seed, or none, which goes back to the one chosen at opening, draws again at the same count of changes:\n // no change of the Sheet's, so neither the document nor the notice hears it.\n if (next.seed !== seedBefore) this.#changed([this.#workbook.setSeed(next.seed ?? this.#chosenSeed)], false, false);\n // A new fixed day or zone sets the day at once, and NOW reads the new zone.\n if (!sameDay(next.today, previous.today) || next.timeZone !== previous.timeZone) {\n this.#changed([this.#workbook.setToday(this.#resolveDay(next)), this.#workbook.recalculateVolatile()], false, false);\n this.#armTheDay();\n this.#armTheMinute();\n }\n this.#grid?.update(this.#gridOptions());\n // A summary declined over a refused cell says why in the words that stand.\n if (wordsMoved) this.#grid?.refreshSummary();\n this.#bindPointingScope();\n this.#paintFrame();\n }\n\n do(sheetOrEdit: string | SheetEdit, edit?: SheetEdit): void {\n this.#alive();\n if (typeof sheetOrEdit !== 'string') {\n this.#refuseUnnamedSheet();\n this.#refuseWhileEditing();\n this.#perform(sheetOrEdit);\n return;\n }\n if (edit === undefined) throw new TypeError('A command that names its Sheet names its edit too.');\n const target = this.#named(sheetOrEdit);\n this.#refuseWhileEditing();\n this.#perform(edit, undefined, undefined, target);\n }\n\n setCellFormat(change: CellFormatChange): boolean {\n this.#alive();\n if (change.isEmpty) throw new RangeError('The change sets no part of a Cell Format.');\n this.#refuseWhileEditing();\n // The Selection as the grid holds it now, which a Selection notice still on its way may not have said yet.\n const selection = this.#grid?.readView().selection;\n if (selection === undefined || selection.isEmpty) return false;\n const cells = selection.ranges.map(rangeOf);\n this.#perform(SheetEdit.setCellFormat(cells, change), undefined, widensAsAKeyDoes(change) ? cells : undefined);\n return true;\n }\n\n setCellFormatFromFocus(changeOf: (focus: CellFormat) => CellFormatChange): boolean {\n if (typeof changeOf !== 'function') throw new TypeError('setCellFormatFromFocus takes the change as a function of the Focus cell\\'s Cell Format.');\n this.#alive();\n this.#refuseWhileEditing();\n return this.#formatFromFocus(changeOf, widensAsAHomeTabButtonDoes);\n }\n\n readFocusFormat(): FocusFormatReading | undefined {\n this.#alive();\n // Read for a change, which an open edit refuses: refused here, before the change is made from it.\n this.#refuseWhileEditing();\n // The Selection as the grid holds it now, which a Selection notice still on its way may not have said yet.\n const selection = this.#grid?.readView().selection;\n const focus = selection?.focus;\n if (selection === undefined || focus === undefined) return undefined;\n const sheet = this.#source.sheet;\n const reading: FocusFormatReading = Object.freeze({ format: sheet.getCellFormat(new CellAddress(focus.row, focus.column)) });\n this.#readings.set(reading, { sheet, selection });\n return reading;\n }\n\n setCellFormatFrom(reading: FocusFormatReading, change: CellFormatChange): boolean {\n this.#alive();\n const against = this.#readings.get(reading);\n if (against === undefined) throw new TypeError('setCellFormatFrom takes a reading this Sheet\\'s readFocusFormat made, once.');\n // A reading is taken by its set, whatever comes of it: set again, it would be a change made from a state the\n // user may have left and come back to.\n this.#readings.delete(reading);\n if (change.isEmpty) throw new RangeError('The change sets no part of a Cell Format.');\n this.#refuseWhileEditing();\n // What the change was made from, which must still stand: set on another Selection, or over a format that has\n // changed since, it would be a plausible change to cells, or in a direction, it was not made for (ADR-0100).\n // Cells moved under a Selection that stands, their Focus format unchanged, take the change a call made now would\n // make.\n const selection = this.#grid?.readView().selection;\n const focus = selection?.focus;\n if (selection === undefined || focus === undefined || this.#source.sheet !== against.sheet || !selection.equals(against.selection)) {\n this.#refuseAndTell('selectionMoved', this.#words.selectionMoved);\n }\n if (!against.sheet.getCellFormat(new CellAddress(focus.row, focus.column)).equals(reading.format)) {\n this.#refuseAndTell('focusFormatChanged', this.#words.focusFormatChanged);\n }\n const cells = selection.ranges.map(rangeOf);\n this.#perform(SheetEdit.setCellFormat(cells, change), undefined, widensAsAHomeTabButtonDoes(change) ? cells : undefined);\n return true;\n }\n\n // A refusal of a change made away from the Sheet, said in the notice too: the user moved what it was made from, and\n // sees it come to nothing.\n #refuseAndTell(reason: SheetRefusalReason, sentence: string): never {\n // The move it names may be heard after it, and that Selection notice must not take the sentence away.\n this.#tell(sentence, { outlivesMove: true });\n throw new SheetRefusedError(new SheetRefusal(reason, sentence));\n }\n\n openFormatCells(): boolean {\n this.#alive();\n this.#refuseWhileEditing();\n this.#openFormatCells();\n return this.#formatCells !== undefined;\n }\n\n cellFormatAt(sheetOrAddress: string | CellAddress, address?: CellAddress): CellFormat {\n this.#alive();\n if (typeof sheetOrAddress !== 'string') {\n this.#refuseUnnamedSheet();\n return this.#source.sheet.getCellFormat(sheetOrAddress);\n }\n if (address === undefined) throw new TypeError('A read that names its Sheet names its cell too.');\n return this.#named(sheetOrAddress).getCellFormat(address);\n }\n\n #named(sheet: string): Sheet {\n const found = this.#workbook.find(sheet);\n if (found === undefined) throw new RangeError(`No Sheet of the Workbook is named '${sheet}'.`);\n return found;\n }\n\n // A command or an address that names no Sheet, refused while the Workbook holds several: taken against the Sheet\n // shown, its outcome would depend on whether a press on a tab came before it (ADR-0331 \u00A76).\n #refuseUnnamedSheet(): void {\n const count = this.#workbook.sheets.length;\n if (count > 1) throw new SheetRefusedError(new SheetRefusal('sheetNotNamed', this.#words.sheetNotNamed(count)));\n }\n\n undo(): boolean {\n this.#alive();\n this.#refuseWhileEditing();\n const stepped = this.#history.undo();\n if (stepped === undefined) {\n this.#tell(this.#words.nothingToUndo);\n return false;\n }\n this.#stepped(stepped);\n return true;\n }\n\n redo(): boolean {\n this.#alive();\n this.#refuseWhileEditing();\n const stepped = this.#history.redo();\n if (stepped === undefined) {\n this.#tell(this.#words.nothingToRedo);\n return false;\n }\n this.#stepped(stepped);\n return true;\n }\n\n declareLinkedTable(name: string, columns: readonly string[], key: string | readonly string[] = []): void {\n this.#alive();\n // The engine counts a declaration that declares or replaces a table, and no other: only such a one is\n // recorded in the document, so only it raises one.\n const before = this.#workbook.changes;\n const change = this.#workbook.declareLinkedTable(name, columns, key);\n const declared = before !== this.#workbook.changes;\n this.#changed([change], declared, false);\n if (declared) {\n this.#referencesIn = this.#referencesOnSheetShown();\n this.#grid?.update(this.#gridOptions());\n }\n }\n\n pushLinkedTable(name: string, rows: Iterable<readonly (Value | undefined)[]>): void {\n this.#alive();\n let change: WorkbookChange;\n try {\n change = this.#workbook.pushLinkedTable(name, rows);\n } catch (error) {\n if (!(error instanceof RepeatedKeyError)) throw error;\n // The table went back to waiting: its readers show #GETTING_DATA, on every Sheet, and then the Consumer\n // hears why (ADR-0049). The refusal names what it changed on the Workbook's first Sheet; another Sheet shown\n // has every row of its Window read again, as the C# Sheet's are.\n const first = this.#source.sheet === this.#workbook.sheets[0];\n this.#sheetChanged(first ? [error.change] : [], false);\n if (!first) {\n this.#source.renewWindow();\n this.#grid?.refreshSummary();\n }\n this.#paintToolbar();\n throw error;\n }\n this.#changed([change], false, false);\n }\n\n // A step taken under an open editor would change the cells, or the Sheet, it commits to: refused, as the C#\n // Sheet's is (ADR-0048).\n #refuseWhileEditing(): void {\n if (this.#editing) throw new SheetRefusedError(new SheetRefusal('editIsOpen', this.#words.editIsOpen));\n }\n\n // ---- Opening and saving a file in the Input Order (ADR-0330 \u00A710) -----------------------------------------\n //\n // The Consumer chooses the file and delivers the written one (ADR-0330 \u00A72): the Sheet references no file format, and\n // takes a Workbook Document still being read, or lends the Workbook to a writer, each at its own place in the order.\n\n // Async, so a Sheet destroyed is a rejection, as every refusal of an opening is.\n async open(read: (signal: AbortSignal) => PromiseLike<WorkbookDocument>): Promise<boolean> {\n this.#alive();\n const grid = this.#grid;\n if (grid === undefined) throw new Error('This Sheet was destroyed.');\n return await this.#openIn(read, (opening, tooLate) => grid.cancellableInOrder(opening, tooLate));\n }\n\n // Opens in the place `place` puts the opening: the Sheet's order, or a turn under way (ADR-0240 section 6).\n async #openIn(read: (signal: AbortSignal) => PromiseLike<WorkbookDocument>,\n place: (opening: (signal: AbortSignal) => Promise<void>, tooLate: (landed: boolean) => void) => Promise<boolean>): Promise<boolean> {\n if (typeof read !== 'function') throw new TypeError('open takes the read as a function of an AbortSignal (ADR-0330 \u00A710).');\n // What a handler of the Consumer's throws once the file has landed is that handler's, held until the opening has\n // ended as landed: it never reads as a cancel, nor as a failure of the opening.\n let afterLanding: { readonly error: unknown } | undefined;\n const opening = async (signal: AbortSignal): Promise<void> => {\n await this.#opening(read, signal);\n try {\n this.#raiseDocument();\n // oxlint-disable-next-line ex-grid/no-catch -- held, and rethrown once the opening has ended as landed\n } catch (error) {\n afterLanding = { error };\n }\n };\n const landed = await place(opening, this.#openingCameTooLate);\n if (afterLanding !== undefined) throw afterLanding.error;\n return landed;\n }\n\n // An Escape that came too late, said in its own turn.\n readonly #openingCameTooLate = (landed: boolean): void => {\n if (this.#destroyed) return;\n this.#tell(landed ? this.#words.openingAlreadyLanded : this.#words.openingNothingToCancel, { outlivesMove: true });\n };\n\n // The opening, in its turn: refused while an edit is open; else said, read, and landed, or left as it was and thrown.\n async #opening(read: (signal: AbortSignal) => PromiseLike<WorkbookDocument>, signal: AbortSignal): Promise<void> {\n // The grid runs it, so the Sheet still stands here. An Escape that came while the opening waited for its turn has cancelled it already: it ends cancelled, whatever\n // its turn finds.\n if (signal.aborted) {\n this.#tell(this.#words.openingCancelled, { outlivesMove: true });\n throw signal.reason;\n }\n this.#refuseFileWhileEditing(this.#words.openWhileEditing);\n this.#tell(this.#words.opening, { outlivesMove: true });\n let document: unknown;\n try {\n document = await read(signal);\n if (!(document instanceof WorkbookDocument)) throw new TypeError('The read answered no Workbook Document (ADR-0330 \u00A710).');\n // The point past which an Escape finds the file opened.\n signal.throwIfAborted();\n } catch (error) {\n if (!this.#destroyed) {\n this.#tell(cancelledBy(signal, error) ? this.#words.openingCancelled : this.#words.openingRefused(messageOf(error)), { outlivesMove: true });\n }\n throw error;\n }\n // The Sheet still stands here: destroying it destroys the grid, which aborts the signal looked at above.\n let opened: Workbook;\n // A seed of its own, as a new document gets one, and the names the Consumer has heard, which a change to the\n // Sheets is said against once it lands (ADR-0180, ADR-0331 \u00A76).\n const seed = chooseSeed();\n const heard = this.#sheetNames;\n try {\n // Read before anything is replaced: a document the engine refuses leaves the Workbook as it was.\n opened = this.#open(this.#options, document, seed);\n } catch (error) {\n this.#sheetNames = heard;\n this.#tell(this.#words.openingRefused(messageOf(error)), { outlivesMove: true });\n throw error;\n }\n this.#sheetNames = heard;\n this.#chosenSeed = seed;\n // The inputs held behind the opening are taken after it, on the Workbook opened.\n this.#replaceWorkbook(opened, true);\n this.#tell(this.#words.opened, { outlivesMove: true });\n }\n\n // Whether the undo stack holds a step to undo and one to redo, raised when either moved since it was last raised.\n #raiseHistory(): void {\n const { canUndo, canRedo } = this.#history;\n if (canUndo === this.#historyRaised.canUndo && canRedo === this.#historyRaised.canRedo) return;\n this.#historyRaised = Object.freeze({ canUndo, canRedo });\n this.#options.onHistoryChanged?.(this.#historyRaised);\n }\n\n // A Workbook opened replaces the one shown, from a new document or a file (ADR-0048, ADR-0330 \u00A710): its undo stack\n // and its views go with it, under a new Row Sequence Version, which drops the Selection and refuses what was aimed\n // at the old cells (ADR-0011, ADR-0142).\n #replaceWorkbook(opened: Workbook, fromFile: boolean): void {\n this.#dropWorkbookFindAll();\n this.#fileOpened = fromFile;\n this.#workbook = opened;\n this.#history.clear();\n this.#raiseHistory();\n this.#showSheet(opened.shown);\n this.#armTheDay();\n this.#armTheMinute();\n }\n\n // Async, so a Sheet destroyed is a rejection, as every refusal of a save is.\n async save(write: (workbook: Workbook) => void | PromiseLike<void>): Promise<void> {\n this.#alive();\n const grid = this.#grid;\n if (grid === undefined) throw new Error('This Sheet was destroyed.');\n await this.#saveIn(write, saving => grid.inOrder(saving));\n }\n\n // Saves in the place `place` puts the save: the Sheet's order, or a turn under way (ADR-0240 section 6).\n async #saveIn(write: (workbook: Workbook) => void | PromiseLike<void>, place: (saving: () => void) => Promise<void>): Promise<void> {\n if (typeof write !== 'function') throw new TypeError('save takes the write as a function of the Workbook (ADR-0330 \u00A710).');\n const written: { writing?: PromiseLike<void> } = {};\n await place(() => {\n this.#refuseFileWhileEditing(this.#words.saveWhileEditing);\n written.writing = Promise.resolve(write(this.#workbook));\n });\n // A save whose turn never came \u2014 the Sheet destroyed while inputs before it were held \u2014 wrote nothing, and says so.\n if (written.writing === undefined) throw new Error('This Sheet was destroyed before the save\\'s turn: nothing was written.');\n await written.writing;\n }\n\n focus(): void {\n this.#liveGrid().focus();\n }\n\n holdSettled(): () => void {\n return this.#liveGrid().holdSettled();\n }\n\n inOrder(handling: (turn: SheetTurn) => void | PromiseLike<void>): Promise<void> {\n if (typeof handling !== 'function') throw new TypeError('inOrder takes the work as a function (ADR-0240 section 6).');\n return this.#liveGrid().inOrder(turn => handling({\n // Async, so a Sheet destroyed, or a turn ended, is a rejection, as the Sheet's own open and save answer.\n open: async read => {\n this.#alive();\n return await this.#openIn(read, (opening, tooLate) => turn.cancellableInOrder(opening, tooLate));\n },\n save: async write => {\n this.#alive();\n await this.#saveIn(write, saving => turn.inOrder(saving));\n },\n }));\n }\n\n tellFromAdapter(sentence: string): void {\n if (typeof sentence !== 'string') throw new TypeError('tell takes the sentence to say.');\n this.#alive();\n this.#tell(sentence);\n }\n\n // The Sheet's grid, while the Sheet stands.\n #liveGrid(): GridHandle<SheetRow> {\n this.#alive();\n const grid = this.#grid;\n if (grid === undefined) throw new Error('Internal: a Sheet that stands has no grid.');\n return grid;\n }\n\n // A file opened or saved while an edit is open is refused by name, and said (ADR-0330 \u00A710, ADR-0048).\n #refuseFileWhileEditing(sentence: string): void {\n if (!this.#editing) return;\n this.#tell(sentence);\n throw new SheetRefusedError(new SheetRefusal('editIsOpen', sentence));\n }\n\n destroy(): void {\n if (this.#destroyed) return;\n this.#destroyed = true;\n clearTimeout(this.#dayTimer);\n clearTimeout(this.#minuteTimer);\n // Let go of first, so nothing the grid tells as it goes reads it again.\n const grid = this.#grid;\n this.#grid = undefined;\n grid?.destroy();\n // A Chrome's toolbar contents and tab faces go with the Sheet.\n this.#toolbar.dispose();\n this.#tabs.dispose();\n // A destroyed Sheet points at nothing.\n this.#joinedScope?.leave(this.#pointingSheet);\n this.#joinedScope = undefined;\n this.#element.removeEventListener('focusin', this.#onKeyboardIn);\n this.#element.removeEventListener('focusout', this.#onKeyboardOut);\n this.#element.removeEventListener('keydown', this.#onSheetKey, { capture: true });\n this.#element.removeEventListener('keyup', this.#onSheetKeyUp, { capture: true });\n this.#element.removeEventListener('focusout', this.#onSheetFocusOut);\n this.#element.removeEventListener('pointerdown', this.#forgetAlt, { capture: true });\n this.#element.removeEventListener('wheel', this.#forgetAlt, { capture: true });\n this.#element.replaceChildren();\n this.#element.classList.remove('ex-sheet');\n this.#element.removeAttribute('data-ex-input-root');\n this.#frame({});\n }\n\n // ---- The grid ---------------------------------------------------------------------------------------------\n\n #gridOptions(): GridOptions<SheetRow> {\n const { rowHeight, viewportWidth, density, presentationDefaults } = this.#options;\n const viewportHeight = this.#gridHeight(this.#options);\n return {\n columns: this.#columns.all,\n source: this.#source,\n ...(density === undefined ? {} : { density }),\n ...(presentationDefaults === undefined ? {} : { presentationDefaults }),\n ...(rowHeight === undefined ? {} : { rowHeight }),\n ...(viewportWidth === undefined ? {} : { viewportWidth }),\n ...(viewportHeight === undefined ? {} : { viewportHeight }),\n ...sheetCellPaint,\n cellAppearance: this.#appearance,\n headerClickSelects: true,\n ...(this.#options.pinnedColumnCount === undefined ? {} : { pinnedColumnCount: this.#options.pinnedColumnCount }),\n ...(this.#options.showRowHeadings === false ? {} : { rowHeadings: rowLabel }),\n hideHeader: this.#options.showColumnHeadings === false,\n showFormulaBar: this.#options.showFormulaBar !== false,\n nameBoxLabel,\n nameBoxSizeLabel,\n onNameBoxEntered: this.#onNameBoxEntered,\n dataEdge: this.#dataEdge,\n hideColumnMenu: true,\n hideCopyWithHeaders: this.#options.allowCopyWithHeaders !== true,\n declaredKeys: sheetDeclaredKeys,\n onDeclaredKey: this.#onDeclaredKey,\n contextCommands: this.#contextCommands,\n commandLabel: this.#commandLabel,\n // The Selection Summary is the Sheet Source's (ADR-0130); the Sheet holds the figures chosen in its menu.\n ...(this.#options.showSelectionSummary === undefined ? {} : { showSelectionSummary: this.#options.showSelectionSummary }),\n ...this.#summaryFiguresShown(),\n ...(this.#options.onSelectionSummaryChanged === undefined ? {} : { onSelectionSummaryChanged: this.#options.onSelectionSummaryChanged }),\n onSummaryFiguresChanged: this.#onSummaryFiguresChanged,\n // Find matches the text a cell is shown with, by the Sheet's rule; the column letters are addresses,\n // not content, and Excel's Find never stops on them (ADR-0332 \u00A74, ADR-0333 \u00A72).\n findMatch: sheetFindMatch,\n findsHeaders: false,\n onReplace: this.#onReplace,\n pasteMaySpill: true,\n onEdit: this.#onEdit,\n copyAnswer: this.#copyAnswer,\n onPaste: this.#onPaste,\n showFillHandle: true,\n onFill: this.#onFill,\n onClear: this.#onClear,\n onUndo: this.#onUndo,\n onRedo: this.#onRedo,\n onColumnWidthChanged: this.#onColumnWidthChanged,\n onSelectionChanged: this.#onSelectionChanged,\n onEditingChanged: this.#onEditingChanged,\n // The References in the Formula being edited are coloured and outlined (ADR-0057): on the Sheet the\n // Formula is typed on, all of them; on another shown to point at its cells, those naming it (ADR-0331 \u00A75).\n referencesIn: this.#referencesIn,\n onReferenceKeyColoursChanged: this.#onKeyColoursChanged,\n // An outline dragged by its edge or a corner square rewrites its Reference in its own form (ADR-0480).\n moveReference: this.#moveReference,\n // Point: the arrows and a press write a Reference where one can go, and F4 cycles its forms (ADR-0051).\n pointAt: sheetPointAt,\n referenceText: this.#referenceText,\n cycleReference: sheetCycleReference,\n onPointStateChanged: this.#onPointStateChanged,\n onPointArrowFromOutside: this.#onPointArrow,\n // Completion and the argument hint, beneath the surface typed in (ADR-0051, ADR-0058).\n completeEditorText: this.#completeEditorText,\n onRefused: this.#onRefused,\n onEditDiscarded: this.#onEditDiscarded,\n onOverwriteNotice: this.#onOverwriteNotice,\n ...this.#gridChrome(),\n };\n }\n\n // The figures the summary shows: those chosen in its menu, else the Consumer's, else the grid's own.\n #summaryFiguresShown(): { readonly summaryFigures?: readonly SummaryFigure[] } {\n const figures = this.#summaryChoice ?? this.#options.summaryFigures;\n return figures === undefined ? {} : { summaryFigures: figures };\n }\n\n // A choice made in the summary's menu: the Sheet holds it and shows it, then tells the Consumer (ADR-0130).\n readonly #onSummaryFiguresChanged = (figures: readonly SummaryFigure[]): void => {\n this.#summaryChoice = Object.freeze([...figures]);\n this.#grid?.update(this.#gridOptions());\n this.#options.onSummaryFiguresChanged?.(this.#summaryChoice);\n };\n\n // The grid's slots of the Sheet's chrome, handed to its grid as they were given: the same object while the chrome\n // is, so the grid keeps the parts it has drawn (ADR-0390).\n // The find panel is the Sheet's own, with Within (ADR-0332 \u00A75), where the chrome draws none: a Chrome's panel is\n // the grid's, and searches the Sheet shown.\n #gridChrome(): { readonly chrome: GridChrome<SheetRow> } {\n const chrome = this.#options.chrome;\n if (this.#gridChromeOf === undefined || this.#gridChromeOf.given !== chrome) {\n const slots: Record<string, unknown> = { findPanel: this.#findPanel };\n for (const name of gridChromeSlotNames) {\n const slot = chrome?.[name];\n if (slot !== undefined) slots[name] = slot;\n }\n // The stylesheets the Chrome brings, whose notices the grid renders beside ExGrid's own (ADR-0123, ERR-11).\n if (chrome?.stylesheets !== undefined) slots['stylesheets'] = chrome.stylesheets;\n // The grid's slots, each checked a function by #checked.\n this.#gridChromeOf = { given: chrome, made: slots };\n }\n return { chrome: this.#gridChromeOf.made };\n }\n\n readonly #onEdit = (intent: GridEditIntent<SheetRow>): void => {\n const column = CellAddress.tryParseColumn(intent.column);\n if (column === undefined) throw new Error(`Internal: '${intent.column}' is not one of the Sheet's columns.`);\n // A Formula committed while another Sheet is shown lands on the Sheet it was typed on (ADR-0331 \u00A75).\n if (intent.row.sheet !== this.#source.sheet) {\n if (!this.#workbook.sheets.includes(intent.row.sheet)) {\n intent.refuse(this.#words.editSheetGone);\n return;\n }\n // Shown, and told, before the commit, which may yet be refused.\n this.#showSheet(intent.row.sheet);\n this.#raiseDocument();\n }\n const address = new CellAddress(intent.row.index, column);\n try {\n this.#perform(SheetEdit.enter(address, intent.value), undefined, [new CellRange(address)]);\n } catch (error) { // oxlint-disable-line ex-grid/no-catch -- the engine's refusal and an unreadable Formula are answers told to the user; anything else is rethrown\n // Refused, so the grid holds the edit with the reason, or a Replace names the cell, rather than taking a\n // write that did not happen as made. The column's verdict rejects an unreadable Formula before the intent\n // is raised (ADR-0034); this is the net under it.\n if (error instanceof FormulaSyntaxError) {\n intent.refuse(this.#words.formulaUnreadable(error));\n return;\n }\n if (error instanceof SheetRefusedError) {\n intent.refuse(this.#words.refused(error.refusal));\n return;\n }\n throw error;\n }\n };\n\n // A copy (ADR-0050 item 9, ADR-0048): the engine copies the range, so the clipboard carries the Values exactly as\n // the engine gives them however far the range runs beyond the Window, and a copy reaching #GETTING_DATA is\n // refused in the engine's words (ADR-0049). The Entries of a one-range copy are kept, so that a paste of exactly\n // this block back into the Sheet carries them.\n readonly #copyAnswer = (request: GridCopyRequest): GridCopyAnswer => {\n const { answer, own } = sheetCopyAnswer(this.#source.sheet, request, refusal => this.#words.refused(refusal));\n if (answer.kind === 'refuse') {\n // The clipboard still holds the last copy, so the Entries kept for it still stand.\n this.#copyRefusal = answer.sentence;\n return answer;\n }\n this.#ownCopy = own;\n return answer;\n };\n\n readonly #onPaste = (intent: GridPasteIntent): void => {\n // Rows are places, so the order moves only when another Sheet is shown (ADR-0046); an intent written\n // under any other version names positions that mean something else, and is dropped (ADR-0011).\n if (intent.rowSequenceVersion !== this.#source.snapshot().rowSequenceVersion) {\n intent.refuse();\n return;\n }\n const sheet = this.#source.sheet;\n // Ctrl+D and Ctrl+R (ADR-0035): the range the grid read, its Entries copied with relative References\n // shifted, never a series (ADR-0050 item 5).\n if (intent.fillSource !== undefined) {\n const target = rangeOf(firstTarget(intent));\n const direction: FillDirection = firstTarget(intent).topRow > intent.fillSource.topRow + intent.fillSource.rowCount - 1 ? 'down' : 'right';\n this.#performChecked(intent, SheetEdit.fillCopy(rangeOf(intent.fillSource), target, direction));\n return;\n }\n // Ctrl+Enter (ADR-0050 item 5): text typed into every cell of the Selection, read as entered in the cell\n // the grid names, a Formula's relative References shifted by each cell's offset.\n if (intent.enteredAt !== undefined) {\n const at = intent.enteredAt;\n this.#performRefusing(intent, () => SheetEdit.enterInto(intent.plan.targets.map(rangeOf), new CellAddress(at.row, at.column), intent.valueFor(at)));\n return;\n }\n // This Sheet's own copy pasted back (ADR-0048): its Entries, formats and alignment, relative References\n // shifted by the distance pasted, over each target range the grid approved, as one step on the undo stack.\n const own = this.#ownCopy;\n if (own?.isPastedAs(intent.values, intent.origins) === true) {\n this.#performRefusing(intent, () => SheetEdit.paste(own.block, intent.plan.targets.map(rangeOf)), intent.plan.targets.map(rangeOf));\n return;\n }\n // A Sheet's copy holding a refused cell, marked in its table: refused whole, rather than turn the refusal into\n // an Error Value a Formula can catch (ADR-0047, 2026-10-12).\n const refusedFrom = firstRefusedIn(intent);\n if (refusedFrom !== undefined) {\n intent.refuse();\n this.#tell(this.#words.pasteRefusedFormula(refusedFrom));\n return;\n }\n const typed: [CellAddress, string][] = [];\n const exact: [CellAddress, Entry | undefined][] = [];\n for (const range of intent.plan.targets) {\n for (let row = range.topRow; row < range.topRow + range.rowCount; row++) {\n for (let column = range.leftColumn; column < range.leftColumn + range.columnCount; column++) {\n const at = { row, column };\n const field = intent.valueFor(at);\n const origin = intent.originFor(at);\n const address = new CellAddress(row, column);\n const number = exactNumberFor(field, origin);\n if (number !== undefined) {\n exact.push([address, Entry.fromValue(Value.fromNumber(number))]);\n continue;\n }\n if (isTooNarrowToShow(field, origin)) {\n intent.refuse();\n this.#tell(this.#words.pasteTooNarrowToShow(field, address));\n return;\n }\n const text = typedFor(field, origin, sheet.culture);\n if (text === undefined) {\n intent.refuse();\n this.#tell(this.#words.pasteReadsDifferently(field, sheet.culture));\n return;\n }\n typed.push([address, text]);\n }\n }\n }\n // The typed fields and the exact numbers are one engine edit: one step on the undo stack (ADR-0048). Its\n // undo selects the ranges pasted over (ADR-0331 \u00A73).\n this.#performRefusing(intent, () => SheetEdit.pasteFields(typed, exact), intent.plan.targets.map(rangeOf));\n };\n\n // A Fill Intent (ADR-0050, item 5), filled as Excel fills by the engine: copies with relative References shifted,\n // a linear series from two or more numbers, dates by day, as one step on the undo stack. Any other pattern is\n // refused before anything is written: the grid is told, so the Selection stays on the source, and the user is\n // told why.\n readonly #onFill = (intent: GridFillIntent): void => {\n if (intent.rowSequenceVersion !== this.#source.snapshot().rowSequenceVersion) {\n intent.refuse();\n return;\n }\n this.#performChecked(intent, SheetEdit.fill(rangeOf(intent.source), rangeOf(intent.target), intent.direction));\n };\n\n readonly #onClear = (intent: GridClearIntent): void => {\n if (intent.rowSequenceVersion !== this.#source.snapshot().rowSequenceVersion) return;\n // Only the cells that hold an Entry are named, so a Delete over whole columns costs what they hold, not a\n // million cells each (ADR-0054); formats stay, as Excel's Delete leaves them.\n const cleared: [CellAddress, undefined][] = [];\n for (const address of this.#source.sheet.entryAddresses) {\n if (intent.targets.some(target => contains(target, address))) cleared.push([address, undefined]);\n }\n if (cleared.length === 0) return;\n try {\n this.#perform(SheetEdit.setEntries(cleared), intent.targets.map(rangeOf));\n } catch (error) { // oxlint-disable-line ex-grid/no-catch -- the engine's refusal and an unreadable Formula are answers told to the user; anything else is rethrown\n if (!(error instanceof SheetRefusedError)) throw error;\n this.#tell(this.#words.refused(error.refusal));\n }\n };\n\n /**\n * The grid's Replace Request (ADR-0332 \u00A73): Replace All over the Sheet shown, inside the Selection when more than\n * one cell is selected, matched on each cell's Entry. All or nothing: a replaced Formula the engine cannot read\n * refuses it all, naming every such cell. Otherwise one step on the undo stack, as typing the replaced Entries\n * would be, which widens the columns a number no longer fits, and the count.\n */\n readonly #onReplace = (request: GridReplaceRequest): GridReplaceResult => {\n this.#findMoved();\n const version = this.#source.snapshot().rowSequenceVersion;\n // A Sheet's rows are places, so a request on another version names nothing here (ADR-0046): answered under the\n // version shown, which the grid refuses as the order having moved, and nothing is written.\n if (request.rowSequenceVersion !== version) return replacedCells(0, version);\n const sheet = this.#source.sheet;\n const positions = positionsOf(request.columns);\n const plan = planSheetReplace(sheet, request, request.replacement, positions, request.scope, (address, text) => {\n const verdict = new SheetRow(sheet, address.row).judge(text, error => this.#words.formulaUnreadable(error));\n return verdict.kind === 'reject' ? verdict.message : undefined;\n });\n const cellAt = (address: CellAddress, position: number, message: string): { readonly row: number; readonly column: string; readonly message: string } =>\n ({ row: address.row, column: request.columns[position] ?? unreachableColumn(position), message });\n if (plan.refused.length > 0) return refusedCells(plan.refused.map(cell => cellAt(cell.address, cell.position, cell.reason)), version);\n if (plan.writes.length === 0) return replacedCells(0, version);\n const written = plan.writes.map(write => new CellRange(write.address));\n try {\n this.#perform(SheetEdit.enterMany(plan.writes.map(write => [write.address, write.text] as const)), undefined, written);\n } catch (error) { // oxlint-disable-line ex-grid/no-catch -- the engine's refusal and an unreadable Formula are answers told to the user; anything else is rethrown\n const message = error instanceof FormulaSyntaxError ? this.#words.formulaUnreadable(error)\n : error instanceof SheetRefusedError ? this.#words.refused(error.refusal) : undefined;\n if (message === undefined) throw error;\n return refusedCells(plan.writes.map(write => cellAt(write.address, positions.get(write.address.column) ?? unreachableColumn(write.address.column), message)), version);\n }\n return replacedCells(plan.writes.length, version);\n };\n\n readonly #onUndo = (): void => { this.undo(); };\n\n readonly #onRedo = (): void => { this.redo(); };\n\n readonly #onColumnWidthChanged = (change: GridColumnWidthChange): void => {\n const column = CellAddress.tryParseColumn(change.column);\n if (column === undefined) throw new Error(`Internal: '${change.column}' is not one of the Sheet's columns.`);\n const characters = charactersOfColumn(change.widthPx, this.#columns.metrics);\n if (characters === undefined) return;\n // The width is recorded as the user's, so an entry never widens the column again (ADR-0046).\n const sheet = this.#source.sheet;\n const step = this.#workbook.do(sheet.name, SheetEdit.setColumnWidth(CellRange.wholeColumns(column, column), characters));\n const resizing = this.#resizing;\n if (resizing !== undefined && resizing.pending.delete(column) && this.#history.tryExtend(resizing.first, step)) {\n if (resizing.pending.size === 0) this.#resizing = undefined;\n } else {\n this.#history.record([step], sheet);\n // The whole columns the grid resizes with this one, from the Selection it chose them by (FN-12c).\n const resized = this.#selection === undefined ? [] : this.#selection.wholeColumns(this.#extent);\n this.#resizing = resized.includes(column) && resized.length > 1 ? { first: step, pending: new Set(resized.filter(c => c !== column)) } : undefined;\n }\n this.#changed([step.change]);\n };\n\n // What was typed into the Name Box, read as a place: a range of the Sheet shown, or of the Sheet named before it,\n // which is shown with the place selected (ADR-0051; ADR-0331 \u00A75).\n readonly #onNameBoxEntered = (typed: string): void => {\n const place = readNameBoxPlace(typed);\n const sheet = place === undefined ? undefined : place.sheet === undefined ? this.#source.sheet : this.#workbook.find(place.sheet);\n if (place === undefined || sheet === undefined) {\n this.#tell(this.#words.addressUnreadable(typed));\n return;\n }\n // Whole columns and whole rows are the Sheet Size's; a place past it is refused by name (ADR-0460).\n const range = this.#workbook.size.fit(place.range);\n if (range === undefined) {\n this.#tell(this.#words.addressPastEdge(typed.trim(), this.#workbook.size.lastCell));\n return;\n }\n this.#clearNotice();\n if (sheet !== this.#source.sheet) {\n this.#showSheet(sheet);\n this.#raiseDocument();\n }\n this.#select(range);\n };\n\n // The grid's extent: the Sheet Size's rows and columns (ADR-0460).\n get #extent(): { readonly rowCount: number; readonly columnCount: number } {\n const { rows, columns } = this.#workbook.size;\n return { rowCount: rows, columnCount: columns };\n }\n\n readonly #dataEdge = (from: CellPosition, direction: GridDirection): CellPosition => {\n const sheet = this.#source.sheet;\n this.#edges ??= SheetEdges.of(sheet);\n const at = this.#edges.find(new CellAddress(from.row, from.column), direction, this.#workbook.size);\n return { row: at.row, column: at.column };\n };\n\n // Places the Selection on `range`, its Focus on the first cell, against the rows shown now (ADR-0050, item 4).\n #select(range: CellRange): void {\n const first = range.first;\n this.#grid?.placeSelection(\n { topRow: first.row, leftColumn: first.column, rowCount: range.rowCount, columnCount: range.columnCount },\n { row: first.row, column: first.column }, this.#source.snapshot().rowSequenceVersion);\n }\n\n readonly #onSelectionChanged = (selection: GridSelection): void => {\n if (this.#destroyed) return;\n this.#followSelection(selection);\n // Heard last, so a Consumer that reads or formats from here finds the Sheet already following the move.\n this.#options.onSelectionChanged?.(selection);\n };\n\n #followSelection(selection: GridSelection): void {\n // A Chrome's toolbar list reads the Selection it opened over, as the built-in one does: a Selection moved\n // since ends it. The notice of the Selection it opened over, given after the grid's paint, is no move.\n if (this.#chromeListsOver?.equals(selection) === false) {\n this.#chromeListsOver = selection;\n this.#toolbar.endLists();\n }\n const before = this.#selection?.focus;\n this.#selection = selection;\n // The Toolbar shows the Focus cell's state: a Selection grown or shrunk around the same Focus changes none of it.\n const focus = selection.focus;\n if (before === undefined || focus === undefined || before.row !== focus.row || before.column !== focus.column) this.#paintToolbar();\n // Format Cells shows the Selection it opened over and sets what OK names on it: a Selection moved under it,\n // by the Name Box or a Consumer, ends it. The notice of the Selection it opened over, which the grid gives after\n // its paint, is no move.\n if (this.#formatCells?.selection.equals(selection) === false) this.#endFormatCells();\n if (this.#choices?.selection.equals(selection) === false) this.#endChoices();\n // A Selection the grid dropped, as another Sheet is shown, is no move of the user's: the notice stands.\n if (selection.isEmpty) return;\n // The user moved on: what the notice said is behind them, unless it was told by the gesture that moved.\n if (this.#noticeOutlivesMove) {\n this.#noticeOutlivesMove = false;\n return;\n }\n this.#clearNotice();\n }\n\n readonly #onRefused = (refusal: GridRefusal): void => {\n switch (refusal.kind) {\n case 'paste': this.#tell(this.#words.pasteRefused(refusal.reason, this.#workbook.size.lastCell), { saidByGrid: true }); return;\n // A refusal of the Sheet's own is in the engine's words, which the grid relayed from the copy answer.\n case 'copy': {\n const own = this.#copyRefusal;\n this.#copyRefusal = undefined;\n this.#tell(refusal.reason === 'refusedByConsumer' && own !== undefined ? own : this.#words.copyRefused(refusal.reason), { saidByGrid: true });\n return;\n }\n case 'commit':\n this.#tell(this.#words.commitRefused(new CellAddress(refusal.cell.row, refusal.cell.column).toString(), refusal.reason), { saidByGrid: true });\n return;\n case 'placement': this.#tell(this.#words.placementRefused(refusal.reason), { saidByGrid: true }); return;\n // The find panel says its own outcomes (ADR-0332 \u00A75); a Sheet has no Action Column (ADR-0037) and no Mark\n // Column (ADR-0043) to refuse.\n case 'find':\n case 'action':\n case 'mark': return;\n default: unreachable(refusal);\n }\n };\n\n // The grid tells only a change, so each call is one the Consumer hears. An edit the destroyed grid discards is not\n // told: the Sheet is gone, and a handler that asked it anything would be refused.\n readonly #onEditingChanged = (open: boolean): void => {\n this.#editing = open;\n if (this.#destroyed) return;\n // An edit ended while another Sheet than its own is shown, cancelled or discarded, shows its own again, where\n // its cell is (ADR-0331 \u00A75). A commit has shown it already (#onEdit).\n if (!open) this.#returnToEditHome();\n this.#paintToolbar();\n this.#options.onEditingChanged?.(open);\n };\n\n // Made again when the declared tables change, a Reference to a column being coloured only once its table is\n // declared, and with each Sheet shown: the grid asks again of a new function (ADR-0057, ADR-0331 \u00A75).\n #referencesIn = this.#referencesOnSheetShown();\n\n #referencesOnSheetShown(): (text: string) => readonly GridEditorReference[] {\n return text => sheetReferences(this.#source.sheet, text, this.#editHome);\n }\n\n // The Reference Point writes: bare on the Sheet the Formula is typed on, named with its Sheet on another (ADR-0331 \u00A75).\n readonly #referenceText = (range: SelectionRange): string => sheetReferenceTextOn(range, this.#source.sheet, this.#editHome);\n\n // A dragged Reference rewritten to name other cells of the Sheet shown, written as it was (ADR-0480).\n readonly #moveReference = (reference: string, range: SelectionRange): string => sheetMoveReference(this.#source.sheet, reference, range);\n\n // The Sheet the open edit was opened on, once another Sheet has been shown while it is typed (ADR-0331 \u00A75): its\n // Formula is committed there, and the edit's end shows it again.\n #editHome: Sheet | undefined;\n // The Linked Tables offered are the Workbook's, whichever of its Sheets is shown while the Formula is typed.\n readonly #completeEditorText = (text: string, caret: number): EditorCompletion | undefined => sheetCompletion(this.#source.sheet, text, caret);\n\n // The colours the grid gave the keys of the Formula being edited, as the Linked Table columns they name\n // (ADR-0057): told to the Consumer when they differ from what it was last told.\n readonly #onKeyColoursChanged = (keys: readonly ReferenceKeyColour[]): void => {\n const columns = linkedColumnsOf(this.#source.sheet, keys);\n if (sameLinkedColumns(columns, this.#linkedColumnsTold)) return;\n this.#linkedColumnsTold = columns;\n this.#joinedScope?.outlineLinkedColumns(this.#pointingSheet, columns);\n this.#options.onLinkedColumnColoursChanged?.(columns);\n };\n\n // ---- The Pointing Scope (ADR-0058) -------------------------------------------------------------------------\n\n // What the Scope asks of this Sheet: its declared tables, and its edit to write into. The TS grid keeps a press\n // on another grid in its place among this Sheet's keys by the browser's own event order, so no root is named.\n readonly #pointingSheet: PointingSheet = pointingSheet(() => this.#source.sheet.linkedTables, {\n writePointedText: async text => this.#grid !== undefined && this.#grid.writePointedText(text),\n takeBackPointedText: async () => this.#grid !== undefined && this.#grid.takeBackPointedText(),\n tellPointingRefused: async refusal => { this.#options.onPointingRefused?.(refusal); },\n });\n\n // Joins the Scope given, leaving one no longer given.\n #bindPointingScope(): void {\n const scope = this.#options.pointingScope;\n if (scope === this.#joinedScope) return;\n this.#joinedScope?.leave(this.#pointingSheet);\n this.#scopeHeardPoints = false;\n this.#joinedScope = scope;\n if (scope === undefined) return;\n scope.join(this.#pointingSheet);\n // The columns an edit already open reads are outlined in the new Scope's grids.\n scope.outlineLinkedColumns(this.#pointingSheet, this.#linkedColumnsTold);\n this.#tellScopeWhetherPointing();\n }\n\n // Tells the Scope whether this Sheet points, when that changed: it holds the keyboard and its edit is in Point.\n #tellScopeWhetherPointing(): void {\n const scope = this.#joinedScope;\n if (scope === undefined) return;\n const points = this.#holdsKeyboard && this.#pointState !== 'none';\n if (points === this.#scopeHeardPoints) return;\n this.#scopeHeardPoints = points;\n scope.points(this.#pointingSheet, points);\n }\n\n readonly #onPointStateChanged = (state: GridPointState): void => {\n this.#pointState = state;\n if (this.#destroyed) return;\n this.#tellScopeWhetherPointing();\n // Whether or not this Sheet holds the keyboard: the dashes go once Point over what a press wrote has ended.\n this.#joinedScope?.pointStateChanged(this.#pointingSheet, state);\n };\n\n // The arrows point inside the grid the press landed on (ADR-0058, \"The keyboard\").\n readonly #onPointArrow = (arrow: GridPointArrow): void => {\n void this.#joinedScope?.pointArrow(this.#pointingSheet, arrow);\n };\n\n // The keyboard coming into the Sheet, or leaving it: a move inside it, the grid's root to the editor as `=`\n // opens it, leaves it inside.\n readonly #onKeyboardIn = (): void => {\n this.#holdsKeyboard = true;\n this.#tellScopeWhetherPointing();\n };\n\n readonly #onKeyboardOut = (event: FocusEvent): void => {\n const to = event.relatedTarget;\n this.#holdsKeyboard = to instanceof Node && this.#element.contains(to);\n this.#tellScopeWhetherPointing();\n };\n\n readonly #onEditDiscarded = (reason: EditDiscardReason): void => {\n // A discard at the commit is the commit gesture's, and stands through the move that completes it.\n this.#tell(this.#words.editDiscarded(reason), { outlivesMove: reason === 'rowLeftTheWindow' || reason === 'columnNoLongerEditable' });\n };\n\n readonly #onOverwriteNotice = (notice: GridOverwriteNotice): void => {\n const address = new CellAddress(notice.cell.row, notice.cell.column).toString();\n this.#tell(this.#words.overwritten(address, notice.seenText, notice.replacedText), { outlivesMove: true });\n };\n\n // ---- The Sheet Tabs (ADR-0331 \u00A74) ------------------------------------------------------------------------\n\n // A band of the Sheet's own, a Toolbar Row or the tabs: the Formula Bar's height, so they read as bands of one\n // frame, as the C# Sheet draws them.\n get #bandRowPx(): number {\n return SheetView.#bandRowPxOf(this.#options);\n }\n\n static #bandRowPxOf(options: SheetOptions): number {\n return formulaBarHeight(SheetView.#densityOf(options), options.rowHeight);\n }\n\n // The grid's Density as it resolves it (ADR-0028, ADR-0030): the Sheet's, a Wrapper's, then compact. The band's\n // height reads it; the widths are the grid's own resolution (#metricsOf).\n static #densityOf(options: SheetOptions): GridDensity {\n // oxlint-disable-next-line ex-grid/no-stand-in-default -- ADR-0028: an untouched grid is compact, as createGrid's is\n return options.density ?? options.presentationDefaults?.density ?? 'compact';\n }\n\n // The Cell Metrics the grid paints with, as it resolves them: its Density's, or a Wrapper's widths at it (ADR-0030).\n static #metricsOf(options: SheetOptions): CellTextMetrics {\n const { density, presentationDefaults } = options;\n return gridCellMetrics({ ...(density === undefined ? {} : { density }), ...(presentationDefaults === undefined ? {} : { presentationDefaults }) });\n }\n\n get #tabsHeightPx(): number {\n return SheetView.#tabsHeightOf(this.#options);\n }\n\n static #tabsHeightOf(options: SheetOptions): number {\n return options.showSheetTabs === false ? 0 : SheetView.#bandRowPxOf(options);\n }\n\n // The Sheet's box, its toolbar and its tabs. With neither band the element lays out as if they were not there.\n // With either, it holds the grid and its bands: at the declared width, or under a stretched height as a column as\n // tall as its parent, in which the grid takes what the bands leave.\n #paintFrame(): void {\n const tabs = this.#options.showSheetTabs !== false;\n const toolbar = this.#options.showToolbar === true;\n if (!tabs && this.#tabs.area.isConnected) {\n // The faces a Chrome drew go with the band, and are drawn again when it is shown.\n this.#tabs.dispose();\n this.#tabs.area.remove();\n }\n if (!toolbar && this.#toolbar.band.isConnected) {\n // A band taken away takes its KeyTips and an item's list with it, and while it holds the keyboard hands it\n // back first, so the next key is not the page's.\n this.#toolbar.dropKeyTips();\n this.#endChoices();\n const holds = this.#toolbar.holdsKeyboard;\n this.#toolbar.band.remove();\n if (holds) this.#grid?.focus();\n }\n if (!tabs && !toolbar) {\n this.#frame({});\n return;\n }\n const { viewportWidth, viewportHeight } = this.#options;\n const width = typeof viewportWidth === 'number' ? { width: `${String(viewportWidth)}px` } : { 'min-width': '0' };\n this.#frame(viewportHeight === 'stretch'\n ? { display: 'flex', 'flex-direction': 'column', height: '100%', flex: '1 1 auto', 'min-height': '0', ...width }\n : { display: 'block', ...width });\n if (toolbar) {\n if (!this.#toolbar.band.isConnected) this.#gridElement.before(this.#toolbar.band);\n this.#paintToolbar();\n }\n if (tabs) {\n if (!this.#tabs.area.isConnected) this.#gridElement.after(this.#tabs.area);\n this.#forgetTabGesturesGone();\n this.#tabs.paint({\n sheets: this.#workbook.sheets, shown: this.#source.sheet, heightPx: this.#tabsHeightPx,\n listName: this.#words.sheetTabsName, addName: this.#words.newSheetName,\n tabFace: this.#options.chrome?.sheetTab, addFace: this.#options.chrome?.sheetTabAdd,\n });\n }\n }\n\n // The properties of the element's style the Sheet sets, and only those: one it stops setting gets back the value\n // the Consumer had given it, so what the Consumer set there stays theirs.\n #frame(properties: Readonly<Record<string, string>>): void {\n const style = this.#element.style;\n for (const [name, given] of this.#framed) {\n if (name in properties) continue;\n this.#framed.delete(name);\n if (given.value === '') style.removeProperty(name);\n else style.setProperty(name, given.value, given.priority);\n }\n for (const [name, value] of Object.entries(properties)) {\n if (!this.#framed.has(name)) this.#framed.set(name, { value: style.getPropertyValue(name), priority: style.getPropertyPriority(name) });\n if (style.getPropertyValue(name) !== value) style.setProperty(name, value);\n }\n }\n\n // The grid's height under `options`: the Sheet's, less its bands. A Sheet too short to hold them is refused by name.\n #gridHeight(options: SheetOptions): ViewportSize | undefined {\n const height = options.viewportHeight;\n if (typeof height !== 'number') return height;\n const tabs = SheetView.#tabsHeightOf(options);\n const toolbar = options.showToolbar === true ? SheetToolbar.heightPx(toolbarRowsOf(options).length, SheetView.#bandRowPxOf(options)) : 0;\n if (height <= tabs + toolbar) {\n const bands = [\n ...(toolbar > 0 ? [`its Sheet Toolbar's ${String(toolbar)}px band (ADR-0100)`] : []),\n ...(tabs > 0 ? [`its Sheet Tabs' ${String(tabs)}px band (ADR-0331)`] : []),\n ];\n throw new RangeError(`A Sheet of ${String(height)}px cannot hold ${bands.join(', ')} and a grid.`);\n }\n return height - tabs - toolbar;\n }\n\n // ---- The Sheet Toolbar (ADR-0100) ------------------------------------------------------------------------\n\n #paintToolbar(): void {\n if (this.#options.showToolbar !== true) return;\n // What a list a Chrome draws stands over from here, whether the band's keys or a press opens it.\n this.#chromeListsOver = this.#grid?.readView().selection;\n const rows = this.#toolbarRows();\n this.#toolbar.paint({ name: this.#words.toolbarName, rowHeightPx: this.#bandRowPx, rows, itemSlot: this.#options.chrome?.toolbarItem });\n }\n\n // The rows the options give, the default one Excel's Home tab's commands in its order (ADR-0100), each item's state\n // the Focus cell's as the grid holds it now. While an edit is open every item is unavailable, the Consumer's\n // included, and says why.\n #toolbarRows(): SheetToolbarPaint['rows'] {\n const focus = this.#grid?.readView().selection.focus;\n const format = focus === undefined ? undefined : this.#source.sheet.getCellFormat(new CellAddress(focus.row, focus.column));\n const words = this.#words;\n const item = (key: SheetToolbarCommand, icon: SheetToolbarIcon | undefined, act: ((focused: CellFormat) => CellFormatChange) | 'formatCells' | undefined,\n { pressed, shortcut, disabledReason, list, text, swatch }: {\n readonly pressed?: boolean; readonly shortcut?: string; readonly disabledReason?: string;\n // A split control's list, or a menu's, which has no `act`.\n readonly list?: () => readonly SheetToolbarChoice[]; readonly text?: string; readonly swatch?: CellColour;\n } = {}): SheetToolbarItem => {\n const name = words.toolbarItem(key);\n const kind = list === undefined ? (pressed === undefined ? 'button' : 'toggle') : (act === undefined ? 'menu' : 'split');\n return {\n key, kind, name, icon, pressed: pressed === true, text, content: undefined,\n tooltip: shortcut === undefined ? name : words.toolbarItemWithShortcut(name, shortcut),\n swatch: swatch === undefined ? undefined : paintOf(swatch),\n moreName: kind === 'split' ? words.toolbarMore(name) : undefined,\n // An open edit is the reason over any other, as the C# Sheet's.\n disabledReason: this.#editing ? words.toolbarWhileEditing : disabledReason,\n press: act === undefined ? undefined : () => { this.#toolbarPressed(act); },\n open: list === undefined ? undefined : (keyTipRow: number | undefined) => { this.#openChoices(name, list(), keyTipRow); },\n list,\n keyTip: toolbarKeyTips[key],\n };\n };\n const key = (kind: SheetFormatKey) => (focused: CellFormat): CellFormatChange => sheetFormatChangeFor(kind, focused, this.#source.sheet.culture);\n const culture = this.#source.sheet.culture;\n const shown = format === undefined ? 'general' : this.#categoryOf(format.numberFormat, culture);\n const fontColour = this.#faceFontColour;\n const fill = this.#faceFill;\n const border = this.#faceBorder;\n const commands: Readonly<Record<SheetToolbarCommand, SheetToolbarItem>> = {\n bold: item('bold', 'bold', key('bold'), { pressed: format?.font.bold === true, shortcut: 'Ctrl+B' }),\n italic: item('italic', 'italic', key('italic'), { pressed: format?.font.italic === true, shortcut: 'Ctrl+I' }),\n underline: item('underline', 'underline', key('underline'), { pressed: format?.font.underline === true, shortcut: 'Ctrl+U' }),\n strikethrough: item('strikethrough', 'strikethrough', key('strikethrough'), { pressed: format?.font.strikethrough === true, shortcut: 'Ctrl+5' }),\n fontColour: item('fontColour', 'fontColour', () => new CellFormatChange({ fontColour }), {\n swatch: fontColour,\n list: () => this.#colourChoices(words.toolbarAutomatic,\n format === undefined || format.font.colour.isAutomatic ? undefined : format.font.colour,\n chosen => {\n // Taking the colour away is not kept: the face goes on setting the last colour chosen.\n if (!chosen.isAutomatic) this.#faceFontColour = chosen;\n return new CellFormatChange({ fontColour: chosen });\n }),\n }),\n fill: item('fill', 'fill', () => new CellFormatChange({ fill: CellFill.solid(fill) }), {\n swatch: fill,\n list: () => this.#colourChoices(words.toolbarNoFill, format?.fill.colour, chosen => {\n if (chosen.isAutomatic) return new CellFormatChange({ fill: CellFill.none });\n this.#faceFill = chosen;\n return new CellFormatChange({ fill: CellFill.solid(chosen) });\n }),\n }),\n borders: item('borders', 'borders', () => new CellFormatChange({ borders: borderPresets[border] }), {\n list: () => toolbarBorders.map(preset => this.#choice(words.toolbarBorder(preset), () => {\n this.#faceBorder = preset;\n this.#formatFromFocus(() => new CellFormatChange({ borders: borderPresets[preset] }), widensAsAHomeTabButtonDoes);\n })),\n }),\n alignLeft: item('alignLeft', 'alignLeft', align('left'), { pressed: format?.alignment === 'left' }),\n alignCenter: item('alignCenter', 'alignCenter', align('center'), { pressed: format?.alignment === 'center' }),\n alignRight: item('alignRight', 'alignRight', align('right'), { pressed: format?.alignment === 'right' }),\n numberFormat: item('numberFormat', undefined, undefined, {\n text: words.categoryName(shown),\n list: () => this.#numberFormatChoices(shown),\n }),\n percent: item('percent', 'percent', key('percent'), { shortcut: 'Ctrl+Shift+%' }),\n // Excel's Comma Style pads with `*`, as Accounting does, which ExSheet does not read: shown, and disabled\n // with the reason, rather than set as something else under Excel's name.\n comma: item('comma', 'comma', undefined, { disabledReason: words.commaStyleUnread }),\n formatCells: item('formatCells', 'formatCells', 'formatCells', { shortcut: 'Ctrl+1' }),\n };\n return toolbarRowsOf(this.#options).map((row, r) => {\n const { label, keyTip, items }: SheetToolbarRowOptions = row === 'default' ? { label: words.toolbarHomeRow, keyTip: 'H', items: defaultToolbarRow } : row;\n return {\n label,\n keyTip: keyTip?.toUpperCase(),\n // Each item's key is its place, so the item the keyboard is on stays named while the rows stay as they are.\n items: items.map((entry, i): SheetToolbarItem | 'separator' => {\n if (entry === 'separator') return entry;\n if (typeof entry === 'string') return { ...commands[entry], key: `${String(r)}-${entry}` };\n return this.#consumerItem(entry, `${String(r)}-${String(i)}`);\n }),\n };\n });\n }\n\n // A Consumer's own button (ADR-0100): pressed as ExSheet's items are, and unavailable while an edit is open.\n #consumerItem(button: SheetToolbarButton, key: string): SheetToolbarItem {\n return {\n key, kind: 'button', name: button.text, tooltip: button.text, icon: undefined,\n text: button.content === undefined ? button.text : undefined, content: button.content, swatch: undefined,\n moreName: undefined, pressed: false,\n disabledReason: this.#editing ? this.#words.toolbarWhileEditing : button.disabledReason,\n // An edit opened since the last pass refuses the press, as ExSheet's own items do, whatever that pass showed.\n press: () => {\n if (this.#editing) this.#tell(this.#words.toolbarWhileEditing);\n else button.onPress();\n },\n open: undefined,\n list: undefined,\n keyTip: button.keyTip?.toUpperCase(),\n };\n }\n\n #categoryOf(format: NumberFormat, culture: Culture): NumberFormatCategory {\n const known = this.#shownCategory;\n if (known?.format === format && known.culture === culture) return known.category;\n const category = recogniseNumberFormat(format, culture).category;\n this.#shownCategory = { format, culture, category };\n return category;\n }\n\n // A choice of a Toolbar Item's list that sets a format, as the item's face does.\n #choice(label: string, choose: () => void, { swatch, selected = false, disabledReason, opensPopover = false }: {\n readonly swatch?: CellColour; readonly selected?: boolean; readonly disabledReason?: string; readonly opensPopover?: boolean;\n } = {}): SheetToolbarChoice {\n return { label, swatch: swatch === undefined ? undefined : paintOf(swatch), selected, disabledReason, opensPopover, choose };\n }\n\n // A colour control's list: the choice that takes the colour away, then the Office theme's colours and the ten\n // standard ones, as Format Cells offers them, the Focus cell's own marked (`undefined` where it has none). Each\n // sets through the Home tab buttons' widening.\n #colourChoices(takenAway: string, focus: CellColour | undefined, changeOf: (chosen: CellColour) => CellFormatChange): SheetToolbarChoice[] {\n const set = (chosen: CellColour) => (): void => { this.#formatFromFocus(() => changeOf(chosen), widensAsAHomeTabButtonDoes); };\n const swatches = [...formatCellsOffer.themeColours.flat(), ...formatCellsOffer.standardColours];\n return [\n // Automatic, which the Fill's change reads as No Fill.\n this.#choice(takenAway, set(automaticColour()), { selected: focus === undefined }),\n ...swatches.map(swatch => this.#choice(this.#words.swatchName(swatch), set(swatch.colour), {\n swatch: swatch.colour, selected: focus?.equals(swatch.colour) === true,\n })),\n ];\n }\n\n // The Number Format list: Excel's categories in Excel's order, each setting what Format Cells' Number tab sets when\n // the category is chosen with its defaults. Accounting and Fraction are shown disabled with Format Cells' reasons,\n // Special is not on Excel's ribbon list, and More Number Formats\u2026 opens Format Cells.\n #numberFormatChoices(shown: NumberFormatCategory): SheetToolbarChoice[] {\n const culture = this.#source.sheet.culture;\n const choices: SheetToolbarChoice[] = [];\n for (const { category } of formatCellsOffer.categories) {\n if (category === 'special') continue;\n if (category === 'custom') {\n choices.push(this.#choice(this.#words.toolbarMoreNumberFormats, () => { this.#openFormatCells(); }, { opensPopover: true }));\n continue;\n }\n const label = this.#words.categoryName(category);\n if (isDisabledCategory(category)) {\n choices.push(this.#choice(label, () => { throw new Error(`Internal: ${category} cannot be chosen, and the list makes no choice it shows disabled.`); },\n { disabledReason: this.#words.categoryDisabled(category) }));\n continue;\n }\n const numberFormat = NumberFormat.parse(defaultCodeOf(category, culture));\n choices.push(this.#choice(label, () => {\n this.#formatFromFocus(() => new CellFormatChange({ numberFormat }), widensAsAHomeTabButtonDoes);\n }, { selected: category === shown }));\n }\n return choices;\n }\n\n // A Toolbar Item's list, in the grid's popover frame (ADR-0100, ADR-0050 item 16), the keyboard on the choice the\n // Focus cell has. A choice closes the frame, which gives the keyboard back to the grid, and is then made; one that\n // opens a popover in the list's place is made first, so what it opens takes the frame, and the list is closed\n // after it only where nothing took its place. The list reads the Selection and the Sheet it was opened over: a\n // Selection moved, another Sheet shown or an operation run ends it, as each ends Format Cells. An edit open at the\n // opening shows nothing, and the notice says why.\n #openChoices(title: string, choices: readonly SheetToolbarChoice[], keyTipRow: number | undefined): void {\n const grid = this.#grid;\n const selection = grid?.readView().selection;\n if (grid === undefined || selection === undefined) return;\n if (this.#editing) {\n this.#tell(this.#words.toolbarWhileEditing);\n return;\n }\n const panel: SheetChoicesPanel = new SheetChoicesPanel(this.#element.ownerDocument, title, choices, {\n chosen: choice => {\n if (this.#choices?.panel !== panel) return;\n if (!choice.opensPopover) this.#endChoices();\n else this.#choices = undefined;\n if (this.#editing) this.#tell(this.#words.toolbarWhileEditing);\n else choice.choose();\n if (this.#gridElement.contains(panel.element)) grid.closePopover();\n // The face sets what was chosen last, though the choice changed nothing.\n this.#paintToolbar();\n },\n });\n this.#endFormatCells();\n this.#endChoices();\n this.#clearNotice();\n if (!grid.openPopover(() => panel.element, title)) return;\n this.#choices = { panel, selection, keyTipRow };\n panel.takeKeyboard();\n }\n\n // Ends a Toolbar Item's list where it stands: the grid's popover closes and gives the keyboard back. One the grid\n // already closed, by Escape or a press elsewhere, has left its frame, and only the record goes.\n #endChoices(): void {\n // A list a Chrome draws ends with it.\n this.#toolbar.endLists();\n const standing = this.#choices;\n if (standing === undefined) return;\n this.#choices = undefined;\n if (this.#gridElement.contains(standing.panel.element)) this.#grid?.closePopover();\n }\n\n // A Toolbar Item pressed: its change of the Focus cell's format on the Selection, widening as Excel's Home tab\n // buttons do, or Format Cells\u2026 opened. An edit open at the press, whatever the last pass showed, changes nothing,\n // and the notice says why.\n #toolbarPressed(act: ((focused: CellFormat) => CellFormatChange) | 'formatCells'): void {\n if (this.#editing) {\n this.#tell(this.#words.toolbarWhileEditing);\n return;\n }\n if (act === 'formatCells') this.#openFormatCells();\n else this.#formatFromFocus(act, widensAsAHomeTabButtonDoes);\n }\n\n // A press on a tab shows its Sheet; the keyboard stays in the grid, where the next key acts on it. A name being\n // edited on another tab is committed first, and a menu closes.\n readonly #onTabPressed = (sheet: Sheet): void => {\n if (!this.#workbook.sheets.includes(sheet) || this.#refusedSwitch(true)) return;\n if (this.#tabs.renaming === sheet) return;\n this.#leaveTabGestures('grid');\n this.#sayLeftOrClear();\n if (sheet !== this.#source.sheet) {\n this.#showSheet(sheet);\n this.#raiseDocument();\n }\n // Pressed while the keyboard is on the tab list, it moves with the selection, as the list's keys move it.\n if (this.#tabs.holdsKeyboard) this.#tabs.focus(sheet);\n };\n\n // + adds a Sheet after the one shown, as Excel's button does.\n readonly #onTabAdded = (): void => { this.#addSheet(false); };\n\n // The keys on the tab list, where Tab put the keyboard: \u2190 and \u2192 select the tab before or after, Home and End the\n // first and the last, the keyboard staying on the tab selected; Escape or Enter gives it back to the grid.\n readonly #onTabListKey = (event: KeyboardEvent): boolean => {\n // Shift+F10 and the menu key open the tab's menu, the keyboard coming back to the tab when it closes; taken\n // on the key, so the browser raises no context menu of its own after it.\n if ((event.key === 'F10' && event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey) || (event.key === 'ContextMenu' && !event.shiftKey)) {\n this.#openTabMenu(this.#source.sheet, true);\n return true;\n }\n if (event.ctrlKey || event.altKey || event.metaKey || event.shiftKey) return false;\n const sheets = this.#workbook.sheets;\n const at = sheets.indexOf(this.#source.sheet);\n switch (event.key) {\n case 'ArrowLeft':\n case 'ArrowRight':\n case 'Home':\n case 'End': {\n if (this.#refusedSwitch()) return true;\n const to = event.key === 'Home' ? 0 : event.key === 'End' ? sheets.length - 1 : at + (event.key === 'ArrowLeft' ? -1 : 1);\n const sheet = sheets[to];\n if (sheet === undefined) return true;\n this.#clearNotice();\n if (sheet !== this.#source.sheet) {\n this.#showSheet(sheet);\n this.#raiseDocument();\n }\n this.#tabs.focus(sheet);\n return true;\n }\n case 'Escape':\n case 'Enter':\n this.#grid?.focus();\n return true;\n default:\n return false;\n }\n };\n\n // Ctrl+PageUp and Ctrl+PageDown show the Sheet before or after the one shown, never past the first or the last;\n // Shift+F11 adds a Sheet before it. Claimed from the browser wherever in the Sheet the keyboard is.\n readonly #onSheetKey = (event: KeyboardEvent): void => {\n const grid = this.#grid;\n if (event.isComposing || grid === undefined) return;\n if (this.#toolbarKey(event)) return;\n const key = grid.keyName(event);\n const step = sheetTabStepOf(key);\n if (step === undefined && key !== sheetTabKeys.insert) {\n this.#onCellKey(event, key);\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n if (step === undefined) {\n this.#addSheet(true);\n return;\n }\n if (this.#refusedSwitch(true)) return;\n const sheets = this.#workbook.sheets;\n const sheet = sheets[sheets.indexOf(this.#source.sheet) + step];\n if (sheet === undefined) return;\n this.#clearNotice();\n const onTabs = this.#tabs.holdsKeyboard;\n this.#showSheet(sheet);\n this.#raiseDocument();\n if (onTabs) this.#tabs.focus(sheet);\n };\n\n // The Sheet Toolbar's keys (ADR-0100), while it is shown: the Alt key alone and F10 start the KeyTips where the grid\n // takes keys; while an edit is open they start nothing, and the browser's menu does not open from them either, which\n // would take the keyboard from the edit (ADR-0450's run, 2026-11-02: Chrome's did). Escape in a list a KeyTip opened\n // goes back to its row's KeyTips, as Excel's does (R2 (b)). Answers whether the key was one of them.\n #toolbarKey(event: KeyboardEvent): boolean {\n if (this.#options.showToolbar !== true) return false;\n const target = event.target;\n // While the KeyTips stand every key typed on the band is theirs, a key the Sheet would claim among them.\n if (this.#toolbar.showsKeyTips && target === this.#toolbar.band) return true;\n const choices = this.#choices;\n const keyTipRow = choices?.keyTipRow;\n if (event.key === 'Escape' && keyTipRow !== undefined && target instanceof Node && choices?.panel.element.contains(target) === true) {\n event.preventDefault();\n event.stopPropagation();\n this.#endChoices();\n this.#toolbar.backToKeyTips(keyTipRow);\n return true;\n }\n const plain = !event.ctrlKey && !event.metaKey && !event.shiftKey;\n if (event.key === 'Alt') {\n this.#altAlone = plain && this.#takesGridKeys(target);\n return this.#altAlone;\n }\n // Any other key between an Alt's press and its release: that Alt is not alone.\n this.#altAlone = false;\n if (event.key !== 'F10' || !plain || event.altKey || !this.#takesGridKeys(target)) return false;\n if (this.#editing) {\n event.preventDefault();\n return true;\n }\n if (!this.#toolbar.startKeyTips()) return false;\n event.preventDefault();\n event.stopPropagation();\n return true;\n }\n\n // The Alt key's release, when it went down alone, starts the KeyTips; its default, which would take the keyboard to\n // the browser's menu, is the KeyTips' too. While an edit is open it starts nothing, and its default is still held.\n readonly #onSheetKeyUp = (event: KeyboardEvent): void => {\n if (event.key !== 'Alt' || !this.#altAlone) return;\n this.#altAlone = false;\n if (this.#options.showToolbar !== true || !this.#takesGridKeys(event.target)) return;\n if (this.#editing || this.#toolbar.startKeyTips()) event.preventDefault();\n };\n\n // The keyboard leaving where it was between an Alt's press and its release, as Alt+Tab takes it from the page: no\n // release comes, and a later one is not that Alt's.\n readonly #onSheetFocusOut = (): void => { this.#altAlone = false; };\n\n // A press or a wheel between an Alt's press and its release, as Alt+click and Alt+wheel are: that Alt is not alone.\n readonly #forgetAlt = (): void => { this.#altAlone = false; };\n\n // Where the Sheet's own keys are heard: in the grid, outside a panel it opened and the Name Box, whose fields keep\n // their own keys, as the C# Sheet's declared keys are.\n #takesGridKeys(target: EventTarget | null): boolean {\n return target instanceof Element && this.#gridElement.contains(target) && target.closest('.ex-popover, .ex-name-box') === null;\n }\n\n // Excel's formatting keys and its insert and delete keys on the Sheet Toolbar's band (ADR-0071, \"Keys\"; ADR-0100),\n // whose tooltips name them. Where the grid takes keys they are its declared keys, taken by the grid in their place\n // in the Input Order and heard by #onDeclaredKey (ADR-0050 item 14); the Name Box and a panel the grid opened keep\n // their own. Ctrl+1 waits on Format Cells.\n #onCellKey(event: KeyboardEvent, key: string): void {\n if (key === toolbarToggleKey) {\n this.#toolbarToggleKey(event);\n return;\n }\n const format = sheetFormatKeyOf(key);\n const structure = format === undefined ? sheetStructureKeyOf(key) : undefined;\n if (format === undefined && structure === undefined) return;\n const target = event.target;\n // Ctrl+1 inside Format Cells opens nothing more, and is not the browser's, whose Ctrl+1 leaves the page.\n if (format === 'formatCells' && target instanceof Element && target.closest('.ex-format-cells, .ex-format-cells-slot') !== null) {\n event.preventDefault();\n return;\n }\n // The band leaves Ctrl's keys to the Sheet.\n if (target !== this.#toolbar.band) return;\n event.preventDefault();\n event.stopPropagation();\n if (format !== undefined) this.#formatKey(format);\n else if (structure !== undefined) this.#structureKey(structure);\n }\n\n // A formatting key or an insert or delete key, taken by the grid where it holds the keyboard, on the Selection it\n // held at the key (ADR-0050 item 14).\n readonly #onDeclaredKey = (press: GridDeclaredKeyPress): void => {\n const format = sheetFormatKeyOf(press.key);\n if (format !== undefined) {\n this.#formatKey(format);\n return;\n }\n const structure = sheetStructureKeyOf(press.key);\n if (structure === undefined) throw new Error(`Internal: '${press.key}' is not one of the keys the Sheet declares.`);\n this.#structureKey(structure);\n };\n\n // Ctrl+F1, claimed only where the Consumer hears it: the toolbar's other state is told, and the Consumer shows it.\n #toolbarToggleKey(event: KeyboardEvent): void {\n const changed = this.#options.onShowToolbarChanged;\n const target = event.target;\n if (changed === undefined || (target !== this.#toolbar.band && !this.#takesGridKeys(target))) return;\n event.preventDefault();\n event.stopPropagation();\n changed(this.#options.showToolbar !== true);\n }\n\n // A formatting key sets its change on every range of the Selection as one step, its toggle's direction the Focus\n // cell's (case 17), widening the columns a number no longer fits where the key widens (ADR-0071). While an edit\n // is open it changes nothing, and the notice says why.\n #formatKey(kind: SheetFormatKey): void {\n if (this.#editing) {\n const refusal = new SheetRefusal('editIsOpen', this.#words.formatKeyWhileEditing);\n this.#tell(refusal.message);\n this.#options.onFormatKeyRefused?.(refusal);\n return;\n }\n // Ctrl+1 opens Format Cells and sets nothing itself (ADR-0071, case 22).\n if (kind === 'formatCells') {\n this.#openFormatCells();\n return;\n }\n this.#formatFromFocus(focus => sheetFormatChangeFor(kind, focus, this.#source.sheet.culture), widensAsAKeyDoes);\n }\n\n // The change `changeOf` makes of the Focus cell's format, set on every range of the Selection as one step, widening\n // the columns a number no longer fits where `widens` says the gesture does (ADR-0071, ADR-0100); false over no\n // Selection, where `changeOf` is not asked.\n #formatFromFocus(changeOf: (focus: CellFormat) => CellFormatChange, widens: (change: CellFormatChange) => boolean): boolean {\n const selection = this.#grid?.readView().selection;\n const focus = selection?.focus;\n if (selection === undefined || focus === undefined) return false;\n const change = changeOf(this.#source.sheet.getCellFormat(new CellAddress(focus.row, focus.column)));\n if (change.isEmpty) throw new RangeError('The change sets no part of a Cell Format.');\n const cells = selection.ranges.map(rangeOf);\n this.#perform(SheetEdit.setCellFormat(cells, change), undefined, widens(change) ? cells : undefined);\n return true;\n }\n\n // Format Cells over the Selection the grid holds, in the grid's popover frame (ADR-0071, ADR-0050 item 16), opening\n // on the Focus cell's Cell Format and on the tab it last showed. Opened while it stands, it opens afresh.\n #openFormatCells(): void {\n const grid = this.#grid;\n const selection = grid?.readView().selection;\n const focus = selection?.focus;\n if (grid === undefined || selection === undefined || focus === undefined) return;\n const ranges = selection.ranges.map(rangeOf);\n const draft = FormatCellsDraft.open(this.#source.sheet, new CellAddress(focus.row, focus.column), ranges);\n const callbacks = {\n ok: () => this.#formatCellsOk(panel),\n cancel: () => { if (this.#formatCells?.panel === panel) this.#endFormatCells(); },\n tabShown: (tab: FormatCellsTab) => { this.#formatCellsTab = tab; },\n };\n const mount = this.#options.chrome?.formatCells;\n const panel: FormatCellsPanel | SlottedFormatCells = mount === undefined\n ? new FormatCellsPanel(this.#element.ownerDocument, draft, this.#words, this.#formatCellsTab, callbacks)\n : new SlottedFormatCells(this.#element.ownerDocument, mount);\n this.#endFormatCells();\n this.#clearNotice();\n const sheet = this.#source.sheet;\n const tab = this.#formatCellsTab;\n const words = this.#words;\n const opened = grid.openPopover(context => {\n if (panel instanceof SlottedFormatCells) {\n panel.mount(Object.freeze({\n draft, tab, tabShown: callbacks.tabShown, ok: callbacks.ok, cancel: callbacks.cancel, words,\n takeKeyboard: (control: HTMLElement) => { if (panel.live) this.#grid?.handKeyboardTo(control, { preventScroll: true }); },\n innerPopupChanged: (open: boolean) => { if (panel.live) context.innerPopupChanged(open); },\n }));\n }\n return panel.element;\n }, words.formatCellsTitle, panel instanceof SlottedFormatCells ? () => { panel.dispose(); } : undefined);\n if (opened) this.#formatCells = { panel, draft, sheet, selection, ranges };\n }\n\n // Format Cells' OK (ADR-0071, SH-45): the parts the user touched, set on the ranges it was opened over as one undo\n // step, widening the columns whose numbers no longer fit where a Number Format or any part of the Font is among\n // them; with nothing touched nothing is set and no step recorded. A draft holding a refusal sets nothing and\n // stays open, for the panel to show why. It is taken against the Sheet it was opened over: shown another, which\n // ends it, an OK that still arrives sets nothing (the spine's sixth rule).\n #formatCellsOk(panel: FormatCellsPanel | SlottedFormatCells): boolean {\n const standing = this.#formatCells;\n if (standing?.panel !== panel) return true;\n if (standing.draft.refusal !== undefined) return false;\n const change = standing.draft.change;\n this.#endFormatCells();\n if (change.isEmpty || standing.sheet !== this.#source.sheet) return true;\n if (this.#editing) {\n this.#tell(this.#words.formatKeyWhileEditing);\n return true;\n }\n this.#perform(SheetEdit.setCellFormat(standing.ranges, change), undefined, widensAsFormatCellsOkDoes(change) ? standing.ranges : undefined);\n return true;\n }\n\n // Ends Format Cells where it stands: the grid's popover closes and gives the keyboard back. One the grid already\n // closed, by Escape or a press elsewhere, has left its frame, and only the record goes.\n #endFormatCells(): void {\n const standing = this.#formatCells;\n if (standing === undefined) return;\n this.#formatCells = undefined;\n // Its frame is in the grid's element, attached to the page or not, until the grid closes it.\n if (this.#gridElement.contains(standing.panel.element)) this.#grid?.closePopover();\n }\n\n // ---- Find Within (ADR-0332 \u00A75, ADR-0331 \u00A78) -------------------------------------------------------------------\n\n // Where the panel searches, as it last chose: kept across a close and a reopen, as the grid keeps the text.\n #findWithin: SheetFindWithin = 'sheet';\n // The panel a Find All over the Workbook was listed in, while its list may stand (ADR-0470 \u00A77).\n #workbookFindAll: GridFindPanelSlotContext | undefined;\n // Every answer that changes what the panel says moves this on: a step asked, the grid's Replace Request, a choice\n // of Within. The Sheet's own Replace All's outcome is said while nothing has moved it since, and the panel has not\n // been mounted again.\n #findEvents = 0;\n #ownFind: { readonly outcome: FindOutcome; readonly events: number } | undefined;\n readonly #findListeners = new Set<() => void>();\n\n #findMoved(): void {\n this.#findEvents += 1;\n if (this.#ownFind === undefined) return;\n this.#ownFind = undefined;\n this.#tellFind();\n }\n\n #tellFind(): void {\n // A listener may stop hearing as it hears.\n for (const listener of Array.from(this.#findListeners)) listener();\n }\n\n #sayOwnFind(outcome: FindOutcome): void {\n this.#ownFind = { outcome, events: this.#findEvents };\n this.#tellFind();\n }\n\n // The find panel's contents, made once with the Sheet, so the grid sees no change of Chrome.\n readonly #findPanel = sheetFindPanelSlot({\n within: () => this.#findWithin,\n // A choice of Within is a click taken in its place in the Input Order (ADR-0240): a step numbered before it\n // searches where the panel searched then, one numbered after it where it searches now.\n chooseWithin: (within, context) => {\n this.#findWithin = within;\n this.#findMoved();\n context.dropFindAll();\n this.#workbookFindAll = undefined;\n },\n // Over the Sheet, the grid's list; over the Workbook, the Sheet's own, which the grid draws (ADR-0470 \u00A77).\n findAll: context => {\n if (this.#findWithin === 'workbook') context.listFindAll(() => this.#listWorkbook(context));\n else context.findAll();\n },\n // Over the Sheet, the grid's Replace Request; over the Workbook, the Sheet's own.\n replaceAll: context => {\n if (this.#findWithin === 'workbook') {\n // Its writes may move what matches, as the grid's Replace All drops its list (ADR-0470 \u00A76).\n this.#dropWorkbookFindAll();\n this.#replaceAllInWorkbook(context);\n }\n else context.replaceAll();\n },\n outcome: context => {\n const own = this.#ownFind;\n return own !== undefined && own.events === this.#findEvents ? findOutcomeText(own.outcome, context.label) : context.view().outcome;\n },\n subscribe: listener => {\n this.#findListeners.add(listener);\n return () => { this.#findListeners.delete(listener); };\n },\n mounted: () => { this.#ownFind = undefined; },\n });\n\n /**\n * One Find step (ADR-0055, ADR-0332 \u00A75), over the Sheet shown or over the Workbook. A match on the Sheet the step\n * was asked of is the answer. A match on another Sheet shows that Sheet with the cell selected and taken as the\n * current match, handed to the grid under the Sheet's rows, and the step is given up: its answer could name only a\n * place among the rows it was asked about. While an edit is open no other Sheet is shown, and the notice says why.\n */\n readonly #findStepOf = (sheet: Sheet, request: GridFindRequest): Promise<GridFindResult> => {\n this.#findMoved();\n // A step asked of the Sheet shown before the last one searches that Sheet alone: the Workbook is walked from\n // the Sheet shown.\n if (this.#findWithin === 'sheet' || sheet !== this.#source.sheet) return Promise.resolve(sheetFindStep(sheet, request));\n const found = sheetFindStepWorkbook(this.#workbook.sheets, sheet, request);\n if (found === undefined) return Promise.resolve({ found: false });\n const column = request.columns[found.position];\n if (column === undefined) throw new Error(`Internal: no column stands at ${String(found.position)} of the request.`);\n if (found.sheet === sheet) return Promise.resolve({ found: true, row: found.row, column });\n if (this.#refusedSwitch()) return Promise.reject(new DOMException('The match is on another Sheet, which is not shown while an edit is open.', 'AbortError'));\n // Shown in the step's own turn, after the grid has taken the step as out, so the answer it gives up is this one.\n return Promise.resolve().then(() => {\n if (this.#destroyed) throw new DOMException('The Sheet was destroyed.', 'AbortError');\n this.#clearNotice();\n this.#showSheet(found.sheet, { row: found.row, column: found.position });\n this.#raiseDocument();\n throw new DOMException('The match is on another Sheet, now shown with it selected.', 'AbortError');\n });\n };\n\n /**\n * Find All over the Workbook (ADR-0470 \u00A77), asked in the press's turn: every Sheet's matches, in tab order, each line\n * named by its Sheet and address (`Sheet2!B12`) and showing its cell's text, for the grid to draw. The Sheet holds\n * the cells, so it drops the list at any change to the Workbook.\n */\n #listWorkbook(context: GridFindPanelSlotContext): GridFindAllList {\n const view = context.view();\n const matches = new SheetWorkbookMatches(this.#workbook.sheets, { text: view.text, matchCase: view.matchCase, wholeCell: view.wholeCell });\n this.#workbookFindAll = context;\n return {\n count: matches.count,\n line: index => {\n const { sheet, address } = matches.at(index);\n return { where: referenceText(new CellRange(address), sheet.name), text: shownTextOf(sheet, address) };\n },\n choose: index => this.#chooseWorkbookMatch(matches.at(index)),\n };\n }\n\n // A line of the Workbook's list chosen (ADR-0470 \u00A74): a match on the Sheet shown is placed as a step's answer is;\n // one on another Sheet shows that Sheet with the cell selected, as a step over the Workbook does. While an edit is\n // open nothing moves, and the notice says why. Answers whether the Focus moved, so the list marks the line only then.\n #chooseWorkbookMatch({ sheet, address }: { readonly sheet: Sheet; readonly address: CellAddress }): boolean {\n if (this.#destroyed) return false;\n if (this.#editing) {\n this.#tell(this.#words.editIsOpen);\n return false;\n }\n const cell = { row: address.row, column: address.column };\n if (sheet === this.#source.sheet) {\n const grid = this.#grid;\n if (grid === undefined) throw new Error('Internal: the Workbook\\'s Find All list was chosen from with no grid drawn.');\n return grid.placeMatch(cell, this.#source.snapshot().rowSequenceVersion);\n }\n this.#clearNotice();\n this.#showSheet(sheet, cell);\n this.#raiseDocument();\n return true;\n }\n\n // The Workbook's Find All list goes: the cells it was read from changed.\n #dropWorkbookFindAll(): void {\n const context = this.#workbookFindAll;\n this.#workbookFindAll = undefined;\n context?.dropFindAll();\n }\n\n /**\n * Replace All over the Workbook (ADR-0332 \u00A75), from the panel's button in its place in the Input Order: every\n * cell of every Sheet whose Entry matches, all or nothing, as one step on the undo stack, which shows the Sheet it\n * was done from \u2014 refused whole when any replaced Formula cannot be read, naming each such cell by its Sheet \u2014\n * and the count said. With nothing matched, the panel says no match.\n */\n #replaceAllInWorkbook(context: GridFindPanelSlotContext): void {\n this.#findMoved();\n const view = context.view();\n if (!view.replaceShown || view.replaceWaiting || view.text === '') return;\n if (this.#editing) {\n this.#tell(this.#words.editIsOpen);\n return;\n }\n const pattern: GridFindPattern = { text: view.text, matchCase: view.matchCase, wholeCell: view.wholeCell };\n const plan = planWorkbookReplace(this.#workbook.sheets, pattern, view.replaceText, (sheet, address, text) => {\n const verdict = new SheetRow(sheet, address.row).judge(text, error => this.#words.formulaUnreadable(error));\n return verdict.kind === 'reject' ? verdict.message : undefined;\n });\n if (plan.refused.length > 0) {\n this.#sayOwnFind({ kind: 'replaceRefused', cells: plan.refused.map(cell => refusedCellOf(cell, cell.reason)) });\n return;\n }\n if (plan.writes.length === 0) {\n this.#sayOwnFind({ kind: 'notFound' });\n return;\n }\n this.#clearNotice();\n const from = this.#source.sheet;\n const bySheet = new Map<Sheet, CellAddress[]>();\n for (const write of plan.writes) {\n const cells = bySheet.get(write.sheet);\n if (cells === undefined) bySheet.set(write.sheet, [write.address]);\n else cells.push(write.address);\n }\n const steps: WorkbookStep[] = [];\n try {\n // One engine step across the Sheets (one change, ADR-0180).\n steps.push(this.#workbook.doAll([...bySheet.keys()].map(sheet => [sheet.name,\n SheetEdit.enterMany(plan.writes.filter(write => write.sheet === sheet).map(write => [write.address, write.text] as const))] as const)));\n } catch (error) { // oxlint-disable-line ex-grid/no-catch -- the engine's refusal and an unreadable Formula are answers told to the user; anything else is rethrown\n const message = error instanceof FormulaSyntaxError ? this.#words.formulaUnreadable(error)\n : error instanceof SheetRefusedError ? this.#words.refused(error.refusal) : undefined;\n if (message === undefined) throw error;\n this.#tell(message);\n this.#sayOwnFind({ kind: 'replaceRefused', cells: plan.writes.map(write => refusedCellOf(write, message)) });\n return;\n }\n // The widths a typed number widens its column to, as typing it would (ADR-0047), in the same undo step.\n this.#resizing = undefined;\n for (const [sheet, addresses] of bySheet) {\n for (const [column, characters] of this.#columns.widenedBy(sheet, addresses.map(address => new CellRange(address)))) {\n steps.push(this.#workbook.do(sheet.name, SheetEdit.setAutomaticColumnWidth(CellRange.wholeColumns(column, column), characters)));\n }\n }\n this.#history.record(steps, from);\n this.#changed(steps.map(step => step.change));\n this.#sayOwnFind({ kind: 'replaced', count: plan.writes.length });\n }\n\n // ---- The Context Menu (ADR-0036) ----------------------------------------------------------------------------\n\n // The grid's commandLabel: the Consumer's word for an id first, the empty string that silences a refusal among\n // them, then the Sheet's word for one of its own ids, and otherwise none, so the grid words the rest. A new\n // function only when the words or the Consumer's commandLabel change, so the grid words its menu again then and\n // only then.\n #commandLabel: (id: string) => string | undefined;\n\n // The stylesheet's notice says the Consumer's words where its commandLabel has some, as the grid's does.\n #wordStylesheetNotice(): void {\n const id = reloadNoticeLabelIds.stylesheet;\n const words = this.#commandLabel(id) ?? builtInCommandLabel(id);\n if (this.#stylesheetNotice.textContent !== words) this.#stylesheetNotice.textContent = words;\n }\n\n static #commandLabelOf(words: SheetWords, consumer: ((id: string) => string | undefined) | undefined): (id: string) => string | undefined {\n if (consumer === undefined) return id => sheetCommandWord(words, id);\n return id => {\n const given: unknown = consumer(id);\n if (given !== undefined && typeof given !== 'string') throw new TypeError(`commandLabel answers a word or undefined, not ${typeof given} (ADR-0036).`);\n return given ?? sheetCommandWord(words, id);\n };\n }\n\n // Inserting and deleting the rows or columns the Selection spans, and Format Cells (ADR-0071), after the grid's\n // clipboard commands, as C#'s ContextCommandsFor adds them.\n readonly #contextCommands = (context: GridContextMenuContext<SheetRow>): readonly GridCommand[] => sheetContextCommands(context.selection, {\n structure: edit => { this.#structureCommand(edit); },\n formatCells: () => { this.#formatCellsByUser(); },\n });\n\n // A structural command from the menu: one step on the undo stack; refused while an edit is open, or by the\n // engine, it changes nothing and the notice says why (ADR-0048).\n #structureCommand(edit: SheetEdit): void {\n if (this.#editing) {\n this.#tell(this.#words.editIsOpen);\n return;\n }\n try {\n this.#perform(edit);\n } catch (error) { // oxlint-disable-line ex-grid/no-catch -- the engine's refusal is an answer told to the user; anything else is rethrown\n if (!(error instanceof SheetRefusedError)) throw error;\n this.#tell(this.#words.refused(error.refusal));\n }\n }\n\n // Format Cells chosen by the user, from the menu: refused while an edit is open, and said (ADR-0071).\n #formatCellsByUser(): void {\n if (this.#editing) {\n this.#tell(this.#words.editIsOpen);\n return;\n }\n this.#openFormatCells();\n }\n\n // Ctrl+Plus and Ctrl+Minus: over whole rows they insert or delete those rows, over whole columns those columns,\n // each one step; over any other Selection, and while an edit is open, nothing changes and the notice says why\n // (ADR-0050 item 14).\n #structureKey(kind: SheetStructureKey): void {\n const insert = kind === 'insert';\n if (this.#editing) {\n this.#tell(this.#words.structureKeyWhileEditing(insert));\n return;\n }\n const selection = this.#grid?.readView().selection;\n if (selection === undefined || selection.isEmpty) return;\n const edit = sheetStructureEditFor(kind, selection, this.#extent);\n if (edit === undefined) {\n this.#tell(this.#words.structureKeyNeedsWholeRowsOrColumns(insert));\n return;\n }\n try {\n this.#perform(edit);\n } catch (error) { // oxlint-disable-line ex-grid/no-catch -- the engine's refusal is an answer told to the user; anything else is rethrown\n if (!(error instanceof SheetRefusedError)) throw error;\n this.#tell(this.#words.refused(error.refusal));\n }\n }\n\n // While an edit is open another Sheet is shown only to point at its cells: with `pointing`, while the edit's text is\n // a Formula, as Excel shows one (ADR-0331 \u00A75), noting the Sheet the edit is typed on. Otherwise it is not, and the\n // notice says why. The text is read from the grid, as the key or press being answered left it. Whether it refused.\n #refusedSwitch(pointing = false): boolean {\n const text = this.#grid?.readEditText();\n if (text === undefined && !this.#editing) return false;\n if (pointing && text?.startsWith('=') === true) {\n this.#editHome ??= this.#source.sheet;\n return false;\n }\n this.#tell(this.#words.sheetSwitchWhileEditing);\n return true;\n }\n\n // The edit has ended: where another Sheet than the one it was typed on is shown, that one is shown again, where its\n // cell is (ADR-0331 \u00A75).\n #returnToEditHome(): void {\n const home = this.#editHome;\n if (home === undefined) return;\n this.#editHome = undefined;\n if (home !== this.#source.sheet && this.#workbook.sheets.includes(home)) {\n this.#showSheet(home);\n this.#raiseDocument();\n } else {\n // The References on the Sheet shown are all its own again.\n this.#referencesIn = this.#referencesOnSheetShown();\n this.#grid?.update(this.#gridOptions());\n }\n }\n\n // A new, empty Sheet beside the one shown, named as Excel names it, and shown, as Excel shows the Sheet it adds:\n // one step on the undo stack, whose undo shows the Sheet it was added from (ADR-0331 \u00A73).\n #addSheet(before: boolean): void {\n if (this.#refusedSheetOperation()) return;\n // A name being edited is committed first, the keyboard going back to the grid as the field goes; the keyboard\n // on a tab itself stays on the tab list.\n const onTabs = this.#tabs.holdsKeyboard && this.#tabs.renaming === undefined && !this.#tabs.menuOpen;\n this.#leaveTabGestures('grid');\n const from = this.#source.sheet;\n this.#resizing = undefined;\n const step = this.#workbook.do(from.name, SheetEdit.insertSheet(undefined, before));\n this.#history.record([step], from);\n this.#showSheet(step.sheet);\n this.#raiseDocument();\n // The tabs moved to make room lose the keyboard: one on the list goes to the new Sheet's tab, selected now.\n if (onTabs) this.#tabs.focus(step.sheet);\n this.#say(this.#words.sheetAdded(step.sheet.name), { outlivesMove: true });\n }\n\n // ---- What the tabs do besides showing a Sheet (ADR-0331 \u00A74; exsheet-workbook ticket 06) ---------------------\n //\n // A double click edits a tab's name in place, the tab's menu \u2014 a secondary press, Shift+F10 or the menu key \u2014\n // deletes, moves left or right, copies and renames, and a drag moves a tab. Each is one step on the one undo stack\n // (ADR-0331 \u00A73), said in the notice. While an edit is open none is done, and the notice says why. Each is answered\n // within the input that made it, so a key typed straight after it acts where it left the Sheet and the keyboard.\n\n // The name typed on its tab, the edit's session, whether it was begun from the keyboard on the tab list (Enter and\n // Escape give the keyboard back to the tab, where it came from), and whether it is ending.\n #renameText = '';\n #renameSession = 0;\n #renameFromTab = false;\n #renameEnding = false;\n // The tab's menu: the Sheet it acts on, the command the keyboard is on, whether the keyboard came from that\n // Sheet's tab, and the menu's session.\n #menuSheet: Sheet | undefined;\n #menuActive: SheetTabCommand = 'rename';\n #menuFromTab = false;\n #menuSession = 0;\n // What ending a gesture on the tabs said \u2014 a name committed, or refused and kept \u2014 when the operation that ended\n // it says something of its own: both are said, the first not lost under the second.\n #saidOnLeaving: string | undefined;\n // What committing or refusing the name last said, so leaving the edit keeps only what the edit itself said.\n #renameSaid: string | undefined;\n\n // Any open edit refuses a Sheet operation, and the notice says why.\n #refusedSheetOperation(): boolean {\n if (!this.#editing) return false;\n this.#tell(this.#words.sheetOperationWhileEditing);\n return true;\n }\n\n // Where the keyboard goes as a gesture on the tabs ends: nowhere, where the input that ends it hands it on itself;\n // the grid; or the tab it came from.\n #keyboardTo(to: 'nowhere' | 'grid' | 'tab', sheet: Sheet): void {\n if (to === 'grid') this.#grid?.focus();\n else if (to === 'tab' && this.#workbook.sheets.includes(sheet)) this.#tabs.focus(sheet);\n else if (to === 'tab') this.#grid?.focus();\n }\n\n // A name being edited is committed \u2014 or, refused, kept as it was \u2014 and a menu closes, before another gesture on the\n // tabs. What the edit's end said is kept, and said with what the operation says next.\n #leaveTabGestures(keyboard: 'nowhere' | 'grid'): void {\n this.#saidOnLeaving = undefined;\n if (this.#tabs.renaming !== undefined) {\n this.#renameSaid = undefined;\n if (!this.#commitRename(keyboard)) this.#endRename(keyboard);\n this.#saidOnLeaving = this.#renameSaid;\n }\n if (this.#menuSheet !== undefined) this.#closeTabMenu(keyboard);\n }\n\n // Says `sentence` after what ending a gesture on the tabs said, if it said anything.\n #say(sentence: string, options?: { readonly outlivesMove?: boolean }): void {\n const said = this.#saidOnLeaving;\n this.#saidOnLeaving = undefined;\n this.#tell(said === undefined ? sentence : `${said} ${sentence}`, options);\n }\n\n // For an operation that says nothing of its own: what ending a gesture on the tabs said stands, else the notice is\n // cleared.\n #sayLeftOrClear(): void {\n const said = this.#saidOnLeaving;\n this.#saidOnLeaving = undefined;\n if (said === undefined) this.#clearNotice();\n else this.#tell(said);\n }\n\n // Edits `sheet`'s name on its tab, its whole name selected and the keyboard on the field, so the keys typed straight\n // after it are the field's.\n #beginRename(sheet: Sheet, fromTab: boolean): void {\n if (this.#refusedSheetOperation() || !this.#workbook.sheets.includes(sheet) || this.#tabs.renaming === sheet) return;\n this.#leaveTabGestures('nowhere');\n if (sheet !== this.#source.sheet) {\n this.#sayLeftOrClear();\n this.#showSheet(sheet);\n this.#raiseDocument();\n }\n this.#renameText = sheet.name;\n this.#renameFromTab = fromTab;\n this.#renameSession = this.#tabs.beginRename(sheet, sheet.name, this.#words.sheetNameField);\n }\n\n // Commits the name typed: one step, every Formula naming the Sheet rewritten (ADR-0331 \u00A74). A name Excel's rules\n // refuse is refused by name, and the field stays, holding the keyboard. Answers whether the edit ended.\n #commitRename(keyboard: 'nowhere' | 'grid' | 'tab'): boolean {\n const sheet = this.#tabs.renaming;\n if (sheet === undefined || this.#renameEnding) return true;\n const name = this.#renameText;\n if (!this.#workbook.sheets.includes(sheet) || name === sheet.name) {\n this.#endRename(keyboard);\n return true;\n }\n const reason = Sheet.whyNotAName(name);\n if (reason !== undefined) {\n this.#refuseRename(reason);\n return false;\n }\n const from = sheet.name;\n let step: WorkbookStep;\n try {\n step = this.#workbook.do(from, SheetEdit.rename(name));\n } catch (error) { // oxlint-disable-line ex-grid/no-catch -- the engine's refusal is an answer told to the user; anything else is rethrown\n if (!(error instanceof SheetRefusedError)) throw error;\n this.#refuseRename(error.refusal.message);\n return false;\n }\n this.#history.record([step], sheet);\n this.#endRename(keyboard);\n // A rename changes the Sheets: #changed draws the tabs again and raises the document, once.\n this.#changed([step.change]);\n this.#renameSaid = this.#words.sheetRenamed(from, sheet.name);\n this.#tell(this.#renameSaid);\n return true;\n }\n\n #refuseRename(reason: string): void {\n this.#tabs.markRenameRefused(true);\n this.#renameSaid = this.#words.sheetNotRenamed(reason);\n this.#tell(this.#renameSaid);\n }\n\n // Ends the name's edit, the keyboard going `keyboard` while the field still holds it, and the tab drawn again.\n #endRename(keyboard: 'nowhere' | 'grid' | 'tab'): void {\n const sheet = this.#tabs.renaming;\n if (sheet === undefined || this.#renameEnding) return;\n this.#renameEnding = true;\n // The edit is over before the keyboard moves, so the field's losing it ends nothing again.\n this.#renameSession = -1;\n // To the grid while the field still holds it; to the tab once it is drawn again in the field's place.\n if (keyboard === 'grid') this.#keyboardTo('grid', sheet);\n this.#tabs.endRename();\n this.#renameEnding = false;\n this.#renameFromTab = false;\n if (keyboard === 'tab') this.#keyboardTo('tab', sheet);\n }\n\n // Opens `sheet`'s menu, showing the Sheet, with the keyboard on its first command that can be done. A menu already\n // open for the Sheet stays as it is.\n #openTabMenu(sheet: Sheet, fromTab: boolean): void {\n if (this.#menuSheet === sheet || this.#refusedSheetOperation() || !this.#workbook.sheets.includes(sheet)) return;\n this.#leaveTabGestures('nowhere');\n if (sheet !== this.#source.sheet) {\n this.#sayLeftOrClear();\n this.#showSheet(sheet);\n this.#raiseDocument();\n }\n this.#menuSheet = sheet;\n this.#menuFromTab = fromTab;\n const first = tabCommandOrder.find(command => this.#tabCommandRefusal(command, sheet) === undefined);\n if (first === undefined) throw new Error('Internal: Rename can always be done on a Sheet of the Workbook.');\n this.#menuActive = first;\n this.#menuSession = this.#paintTabMenu(sheet);\n }\n\n // The menu's commands as they stand: which can be done on its Sheet, and which the keyboard is on.\n #paintTabMenu(sheet: Sheet): number {\n return this.#tabs.showMenu({\n name: this.#words.sheetMenuName(sheet.name),\n active: this.#menuActive,\n items: tabCommandOrder.map(command => ({\n command, label: this.#words.tabCommand(command), disabledReason: this.#tabCommandRefusal(command, sheet),\n })),\n });\n }\n\n // Why `command` cannot be done on `sheet` in the Workbook as it stands now, or `undefined` where it can.\n #tabCommandRefusal(command: SheetTabCommand, sheet: Sheet): string | undefined {\n const sheets = this.#workbook.sheets;\n const at = sheets.indexOf(sheet);\n if (at < 0) return this.#words.sheetGone;\n if (command === 'delete' && sheets.length === 1) return this.#words.onlySheet;\n if (command === 'moveLeft' && at === 0) return this.#words.firstSheet;\n if (command === 'moveRight' && at === sheets.length - 1) return this.#words.lastSheet;\n return undefined;\n }\n\n // The menu's keys: \u2191 and \u2193 move among the commands that can be done, round from the last to the first, Home and End\n // to the first and the last, Enter or Space does the command, and Escape, Tab, the menu key or Shift+F10 closes the\n // menu, the keyboard going back to the tab it came from, or to the grid.\n readonly #onTabMenuKey = (event: KeyboardEvent): boolean => {\n const sheet = this.#menuSheet;\n if (sheet === undefined) return false;\n const enabled = tabCommandOrder.filter(command => this.#tabCommandRefusal(command, sheet) === undefined);\n const back = this.#menuFromTab ? 'tab' : 'grid';\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp': {\n const at = enabled.indexOf(this.#menuActive);\n const step = event.key === 'ArrowDown' ? 1 : -1;\n this.#menuActive = elementAt(enabled, ((((at < 0 ? 0 : at + step) % enabled.length) + enabled.length) % enabled.length));\n this.#paintTabMenu(sheet);\n return true;\n }\n case 'Home':\n case 'End':\n this.#menuActive = elementAt(enabled, event.key === 'Home' ? 0 : enabled.length - 1);\n this.#paintTabMenu(sheet);\n return true;\n case 'Enter':\n case ' ':\n this.#tabCommand(this.#menuActive);\n return true;\n case 'Escape':\n case 'Tab':\n case 'ContextMenu':\n this.#closeTabMenu(back);\n return true;\n case 'F10':\n if (!event.shiftKey) return false;\n this.#closeTabMenu(back);\n return true;\n default:\n return false;\n }\n };\n\n // Closes the menu, handing the keyboard on first, while the menu still holds it.\n #closeTabMenu(keyboard: 'nowhere' | 'grid' | 'tab'): void {\n const sheet = this.#menuSheet;\n if (sheet === undefined) return;\n this.#menuSheet = undefined;\n this.#menuSession = -1;\n if (keyboard !== 'nowhere') this.#keyboardTo(keyboard, sheet);\n this.#tabs.closeMenu();\n }\n\n // The command on the menu's Sheet: each one step, said in the notice, the keyboard going back to the grid \u2014 but for\n // Rename, which hands it to the name's field. A command that cannot be done does nothing, and the menu stays.\n #tabCommand(command: SheetTabCommand): void {\n const sheet = this.#menuSheet;\n if (sheet === undefined || this.#tabCommandRefusal(command, sheet) !== undefined) return;\n if (command === 'rename') {\n this.#beginRename(sheet, this.#menuFromTab);\n return;\n }\n this.#closeTabMenu('grid');\n if (this.#refusedSheetOperation()) return;\n const name = sheet.name;\n switch (command) {\n case 'delete':\n if (this.#sheetOperation(sheet, SheetEdit.deleteSheet()) === undefined) return;\n this.#tell(this.#words.sheetDeleted(name));\n return;\n case 'moveLeft':\n case 'moveRight': {\n const to = this.#workbook.sheets.indexOf(sheet) + (command === 'moveLeft' ? -1 : 1);\n if (this.#sheetOperation(sheet, SheetEdit.moveSheet(to)) === undefined) return;\n this.#tell(this.#words.sheetMoved(name, to + 1, this.#workbook.sheets.length));\n return;\n }\n case 'copy': {\n const copied = this.#sheetOperation(sheet, SheetEdit.copySheet(), step => step.sheet);\n if (copied === undefined) return;\n this.#tell(this.#words.sheetCopied(name, copied.sheet.name));\n return;\n }\n }\n }\n\n // `edit` done on `sheet` as one step on the undo stack, showing `show`'s Sheet when asked, else the Sheet shown\n // where it stands \u2014 the next, where the shown one was deleted. A refusal is said. Answers the step, or none.\n #sheetOperation(sheet: Sheet, edit: SheetEdit, show?: (step: WorkbookStep) => Sheet): WorkbookStep | undefined {\n if (!this.#workbook.sheets.includes(sheet)) return undefined;\n this.#resizing = undefined;\n let step: WorkbookStep;\n try {\n step = this.#workbook.do(sheet.name, edit);\n } catch (error) { // oxlint-disable-line ex-grid/no-catch -- the engine's refusal is an answer told to the user; anything else is rethrown\n if (!(error instanceof SheetRefusedError)) throw error;\n this.#tell(this.#words.refused(error.refusal));\n return undefined;\n }\n this.#history.record([step], sheet);\n const shown = show?.(step);\n const target = shown !== undefined && this.#workbook.sheets.includes(shown) ? shown : this.#workbook.shown;\n if (target === this.#source.sheet) {\n // A change to the Sheets: #changed draws the tabs again and raises the document, once.\n this.#changed([step.change]);\n return step;\n }\n this.#showSheet(target);\n this.#raiseDocument();\n this.#paintFrame();\n return step;\n }\n\n // A tab dragged onto another, or past the last: it moves to that place, and its Sheet is shown.\n #moveByDrag(sheet: Sheet, target: Sheet | undefined): void {\n const sheets = this.#workbook.sheets;\n if (this.#refusedSheetOperation() || !sheets.includes(sheet) || (target !== undefined && !sheets.includes(target))) return;\n this.#leaveTabGestures('grid');\n const to = target === undefined ? sheets.length - 1 : sheets.indexOf(target);\n if (to === sheets.indexOf(sheet)) {\n this.#sayLeftOrClear();\n if (sheet !== this.#source.sheet) {\n this.#showSheet(sheet);\n this.#raiseDocument();\n }\n return;\n }\n const name = sheet.name;\n // A move refused says why, after what ending a name's edit said, if it said anything.\n if (this.#sheetOperation(sheet, SheetEdit.moveSheet(to), () => sheet) === undefined) {\n const refused = this.#notice.textContent;\n this.#say(refused);\n return;\n }\n this.#say(this.#words.sheetMoved(name, to + 1, this.#workbook.sheets.length));\n }\n\n // The Sheets have changed \u2014 by a gesture, a Consumer's command, an undo or a redo: a name being edited on a tab\n // whose Sheet is gone ends, and so does its menu, the keyboard they held going back to the grid; a menu still standing is\n // drawn again, so what it offers follows the Sheets as they stand.\n #forgetTabGesturesGone(): void {\n const sheets = this.#workbook.sheets;\n const renaming = this.#tabs.renaming;\n // The keyboard goes to the grid only from the field or the menu that held it: one elsewhere on the page stays.\n const keyboard = this.#tabs.gestureHoldsKeyboard ? 'grid' : 'nowhere';\n if (renaming !== undefined && !sheets.includes(renaming)) this.#endRename(keyboard);\n const menuSheet = this.#menuSheet;\n if (menuSheet === undefined) return;\n if (!sheets.includes(menuSheet)) {\n this.#closeTabMenu(keyboard);\n return;\n }\n if (this.#tabCommandRefusal(this.#menuActive, menuSheet) !== undefined) {\n const first = tabCommandOrder.find(command => this.#tabCommandRefusal(command, menuSheet) === undefined);\n if (first !== undefined) this.#menuActive = first;\n }\n this.#paintTabMenu(menuSheet);\n }\n\n // ---- Operations ------------------------------------------------------------------------------------------\n\n /** `edit` on `sheet`, the Sheet shown unless named, as one operation on the undo stack; its undo selects `selects`\n * where given. The columns a number entered over `widenOver` no longer fits are widened in the same operation, so\n * one undo puts back both (ADR-0048; ADR-0071, case 17). */\n #perform(edit: SheetEdit, selects?: readonly CellRange[], widenOver?: readonly CellRange[], sheet: Sheet = this.#source.sheet): void {\n this.#resizing = undefined;\n const steps: WorkbookStep[] = [this.#workbook.do(sheet.name, edit)];\n if (widenOver !== undefined) {\n for (const [column, characters] of this.#columns.widenedBy(sheet, widenOver)) {\n steps.push(this.#workbook.do(sheet.name, SheetEdit.setAutomaticColumnWidth(CellRange.wholeColumns(column, column), characters)));\n }\n }\n this.#history.record(steps, sheet, selects);\n this.#changed(steps.map(step => step.change));\n }\n\n /** `edit` checked before anything is written: a refusal is told to the grid, which leaves the Selection where\n * it was, and to the user (ADR-0050 item 5). */\n #performChecked(intent: GridPasteIntent | GridFillIntent, edit: SheetEdit): void {\n const refusal = this.#workbook.check(this.#source.sheet.name, edit);\n if (refusal !== undefined) {\n intent.refuse();\n this.#tell(this.#words.refused(refusal));\n return;\n }\n this.#perform(edit);\n }\n\n /** The edit `make` builds, done; one the engine refuses, or a Formula it cannot read, is told to the grid\n * and to the user, and nothing is written. */\n #performRefusing(intent: GridPasteIntent, make: () => SheetEdit, selects?: readonly CellRange[]): void {\n try {\n this.#perform(make(), selects);\n } catch (error) { // oxlint-disable-line ex-grid/no-catch -- the engine's refusal and an unreadable Formula are answers told to the user; anything else is rethrown\n if (error instanceof FormulaSyntaxError) {\n intent.refuse();\n this.#tell(this.#words.formulaUnreadable(error));\n return;\n }\n if (error instanceof SheetRefusedError) {\n intent.refuse();\n this.#tell(this.#words.refused(error.refusal));\n return;\n }\n throw error;\n }\n }\n\n /** An undo or a redo: the Sheet it names is shown, and what it changed is painted (ADR-0331 \u00A73). */\n #stepped(stepped: SheetOperationStepped): void {\n const target = stepped.operation.shownAfter(this.#workbook);\n if (target === this.#source.sheet) {\n this.#changed(stepped.changes);\n } else {\n this.#showSheet(target);\n this.#raiseDocument();\n }\n // Excel selects what the step changed (ADR-0048), on the Sheet it changed it on.\n const selects = target === stepped.operation.from ? stepped.operation.selects() : undefined;\n if (selects !== undefined) this.#select(selects);\n }\n\n /**\n * What one operation changed across the Workbook: the Sheet shown paints what it changed there, and the document is\n * raised unless `raiseDocument` is false. A user's own operation ends Format Cells and clears the notice; a\n * Consumer's programmatic change (`byUser` false: a Linked Table's declaration or snapshot) leaves both standing, as\n * the C# Sheet's does, since it changes Values and no format Format Cells read.\n */\n #changed(changes: readonly WorkbookChange[], raiseDocument = true, byUser = true): void {\n this.#dropWorkbookFindAll();\n // Format Cells read the cells it was opened over: an operation under it, an undo or a Toolbar press, ends it,\n // so its OK never sets a draft read from formats or places that no longer stand (the spine's sixth rule).\n if (byUser) {\n this.#endFormatCells();\n this.#endChoices();\n }\n const sheet = this.#source.sheet;\n if (changes.some(change => change.changesSheets) && !this.#workbook.sheets.includes(sheet)) {\n this.#showSheet(this.#workbook.shown);\n if (raiseDocument) this.#raiseDocument();\n return;\n }\n this.#sheetChanged(changes.map(change => change.for(sheet)), byUser);\n if (changes.some(change => change.changesSheets)) this.#paintFrame();\n else this.#paintToolbar();\n if (raiseDocument) this.#raiseDocument();\n }\n\n #sheetChanged(changes: readonly SheetChange[], byUser = true): void {\n if (byUser) this.#clearNotice();\n const edges = this.#edges;\n if (edges !== undefined) for (const change of changes) edges.update(this.#source.sheet, change);\n let options = false;\n // A whole row's or column's Cell Format reaches cells that hold nothing, which the engine names no row of:\n // every painted row is read again, and the grid repaints those whose look changed (ADR-0071).\n if (changes.some(change => change.reformatsUnnamedRows)) {\n this.#appearance = appearanceLookup(++this.#reading);\n options = true;\n }\n // The widths the Sheet records follow the change, its undo and redo included (ADR-0046).\n const widths = [...new Set(changes.flatMap(change => change.columns))];\n if (widths.length > 0 && this.#columns.read(this.#source.sheet, widths)) options = true;\n if (options) this.#grid?.update(this.#gridOptions());\n this.#source.changed(changes);\n // A change may reach cells under the Selection that the Window does not hold, a recalculation or a whole\n // column's format among them: the Selection Summary is asked again (ADR-0130).\n this.#grid?.refreshSummary();\n }\n\n // `match`, where given, is a Find step's match on `sheet` (ADR-0332 \u00A75): selected and taken as the current match in\n // place of the view the Sheet was left with.\n #showSheet(sheet: Sheet, match?: CellPosition): void {\n // Format Cells read the Sheet it was opened over: another shown, or this one opened again, ends it, and so does\n // a Toolbar Item's list.\n this.#endFormatCells();\n this.#endChoices();\n const grid = this.#grid;\n const leaving = this.#source.sheet;\n if (grid !== undefined && leaving !== sheet) this.#views.set(leaving, grid.readView());\n // The Workbook records the Sheet shown: its document reopens on it, and its volatile functions recalculate\n // there (ADR-0331).\n this.#workbook.shown = sheet;\n this.#resizing = undefined;\n this.#edges = undefined;\n this.#columns.read(sheet);\n this.#appearance = appearanceLookup(++this.#reading);\n this.#source.show(sheet);\n this.#referencesIn = this.#referencesOnSheetShown();\n // The view it was left with comes with its rows, under the version they are shown with; a Sheet shown for the\n // first time opens on A1, scrolled to it, as Excel's does. Either is rows of their own, so an edit open stays\n // with the Sheet it was typed on (ADR-0331 \u00A75).\n const view = this.#views.get(sheet);\n const version = this.#source.snapshot().rowSequenceVersion;\n if (grid !== undefined) {\n if (view !== undefined) grid.showViewWith(view, version);\n else grid.showNewView(version, { range: { topRow: 0, leftColumn: 0, rowCount: 1, columnCount: 1 }, focus: { row: 0, column: 0 } });\n }\n grid?.update(this.#gridOptions());\n this.#paintFrame();\n if (match !== undefined) grid?.placeMatch(match, version);\n }\n\n // The undo stack where it moved, then the document, then a change to the Sheets where the names moved. The stack goes\n // first so a Consumer that renders its own Undo when it hears the document, as a Blazor one does, reads it as it stands. The names are taken as heard before either\n // handler runs, so one that throws or acts on the Sheet again leaves the next change said against these.\n #raiseDocument(): void {\n this.#raiseHistory();\n const before = this.#sheetNames;\n const after = this.#workbook.sheets.map(sheet => sheet.name);\n const sheetsChanged = after.length !== before.length || after.some((name, at) => name !== before[at]);\n this.#sheetNames = after;\n const change: SheetsChange = { before, after, shown: this.#workbook.shown.name };\n const { onWorkbookChanged } = this.#options;\n if (onWorkbookChanged !== undefined) {\n const raised = this.#workbook.toDocument();\n this.#raised.add(raised);\n onWorkbookChanged(raised);\n }\n if (sheetsChanged) this.#options.onSheetsChanged?.(change);\n }\n\n // A document opened, with its seed: the Consumer's, or the one just chosen, at a count of 0 changes (ADR-0180). Its\n // Sheets' names are the ones the Consumer has heard.\n #open(options: SheetOptions, document = options.document, chosenSeed = this.#chosenSeed): Workbook {\n const size = sheetSizeOf(options);\n const workbook = document === undefined ? new Workbook(Culture.of(options.locale ?? navigator.language), undefined, size) : Workbook.open(document, size);\n workbook.setSeed(options.seed ?? chosenSeed, 0);\n // The day and the clock, before any row is read: every Sheet reads them, one added later too. NOW reads the zone\n // the options name when the engine asks, once per recalculation.\n workbook.nowSource = () => {\n const zone = this.#zoneOf(this.#options);\n return zone === undefined ? undefined : momentIn(zone, new Date());\n };\n workbook.setToday(this.#resolveDay(options));\n // The document's NOW was computed before the clock was given, and waits until it is read again.\n workbook.recalculateVolatile();\n this.#sheetNames = workbook.sheets.map(sheet => sheet.name);\n return workbook;\n }\n\n // ---- The Sheet Day and NOW (ADR-0121, ADR-0124) ---------------------------------------------------------\n\n // The zone the options name, else the browser's; none where the browser does not say it (ADR-0121).\n #zoneOf(options: SheetOptions): string | undefined {\n return options.timeZone ?? this.#browserZone;\n }\n\n // The fixed day, else the day in the zone now; none while no zone is known, when TODAY() waits.\n #resolveDay(options: SheetOptions): SheetDay | undefined {\n if (options.today !== undefined) return options.today;\n const zone = this.#zoneOf(options);\n return zone === undefined ? undefined : dayOf(momentIn(zone, new Date()));\n }\n\n // Reads the day again when it can have changed: at the next midnight in the zone, and at most an hour after this\n // reading. With a fixed day, nothing is armed.\n #armTheDay(): void {\n clearTimeout(this.#dayTimer);\n this.#dayTimer = undefined;\n const zone = this.#zoneOf(this.#options);\n if (this.#options.today !== undefined || zone === undefined) return;\n const due = untilTheDayIsReadAgainMs(momentIn(zone, new Date()));\n this.#dayTimer = setTimeout(() => {\n this.#dayTimer = undefined;\n if (this.#destroyed) return;\n const change = this.#workbook.setToday(this.#resolveDay(this.#options));\n this.#armTheDay();\n this.#changedByTheClock(change);\n }, due);\n }\n\n // Moves NOW on as the minute turns: the volatile Formulas are recalculated, and nothing at all where there are none.\n #armTheMinute(): void {\n clearTimeout(this.#minuteTimer);\n this.#minuteTimer = setTimeout(() => {\n this.#minuteTimer = undefined;\n if (this.#destroyed) return;\n this.#armTheMinute();\n if (this.#workbook.hasVolatileFormulas) this.#changedByTheClock(this.#workbook.recalculateVolatile());\n }, untilTheMinuteTurnsMs(Date.now()));\n }\n\n // What the clock moved, painted only where it reached a row of the Sheet shown: a RAND or an OFFSET recalculated by\n // the minute changes nothing there, and the Sheet is left as it stands.\n #changedByTheClock(change: WorkbookChange): void {\n const shown = change.for(this.#source.sheet);\n if (shown.rows.length > 0 || shown.recalculated.length > 0) this.#changed([change], false, false);\n }\n\n // ---- The notice ------------------------------------------------------------------------------------------\n\n /** Says `sentence` in the notice. One the grid has already said in its own live region is shown but not said\n * again (ADR-0203). */\n #tell(sentence: string, { outlivesMove = false, saidByGrid = false }: { readonly outlivesMove?: boolean; readonly saidByGrid?: boolean } = {}): void {\n this.#noticeOutlivesMove = outlivesMove;\n if (saidByGrid) {\n const span = document.createElement('span');\n span.setAttribute('aria-hidden', 'true');\n span.textContent = sentence;\n this.#notice.replaceChildren(span);\n return;\n }\n this.#notice.textContent = sentence;\n }\n\n #clearNotice(): void {\n this.#noticeOutlivesMove = false;\n this.#notice.replaceChildren();\n }\n\n #alive(): void {\n if (this.#destroyed) throw new Error('This Sheet was destroyed.');\n }\n\n static #checked(options: SheetOptions): SheetOptions {\n // Checked as an untyped caller may hand them, where they arrive (CONVENTIONS.md).\n const given: unknown = options;\n if (typeof given !== 'object' || given === null) throw new TypeError(\"A Sheet's options are an object.\");\n const { locale, seed }: { readonly locale?: unknown; readonly seed?: unknown } = options;\n if (locale !== undefined && typeof locale !== 'string') throw new TypeError(\"A Sheet's locale is a language tag, such as 'en-US'.\");\n // Refused here, before anything changes, where the engine would refuse it only once the Sheet had taken it.\n if (seed !== undefined && (typeof seed !== 'bigint' || seed < 0n || seed > maxSeed)) {\n throw new RangeError(`${typeof seed === 'bigint' ? seed.toString() : typeof seed} is not a seed: a seed is a bigint from 0 to 2^64 - 1.`);\n }\n const { timeZone, today }: { readonly timeZone?: unknown; readonly today?: unknown } = options;\n if (timeZone !== undefined) {\n if (typeof timeZone !== 'string') throw new TypeError(\"A Sheet's time zone is an IANA name, such as 'Asia/Tokyo'.\");\n checkTimeZone(timeZone);\n }\n if (today !== undefined && !isSheetDay(today)) throw new RangeError(\"A Sheet Day is a calendar day from 1900 to 9999: { year, month, day }.\");\n // The day is taken as it is now: one the Consumer changes in place afterwards is a new day only when handed over again.\n const taken = today === undefined ? options : { ...options, today: { year: today.year, month: today.month, day: today.day } };\n checkToolbar(options.toolbar);\n // Refused here by name, as the engine's size refuses one (ADR-0460).\n sheetSizeOf(options);\n const figures: unknown = options.summaryFigures;\n if (figures !== undefined && (!Array.isArray(figures) || figures.some((figure: unknown) => !summaryFigureOrder.some(known => known === figure)))) {\n throw new TypeError(`summaryFigures is a list of the figures ${summaryFigureOrder.join(', ')} (ADR-0130).`);\n }\n const defaults: unknown = options.presentationDefaults;\n if (defaults !== undefined && !(defaults instanceof GridPresentationDefaults)) {\n throw new TypeError('presentationDefaults is a GridPresentationDefaults, as a Wrapper makes one (ADR-0030).');\n }\n const chrome: unknown = options.chrome;\n if (chrome !== undefined) {\n if (typeof chrome !== 'object' || chrome === null) throw new TypeError(\"A Sheet's chrome is an object of Chrome slots, each a mount function (ADR-0390).\");\n const names: readonly string[] = [...sheetSlotNames, ...gridChromeSlotNames];\n for (const [name, slot] of Object.entries(chrome)) {\n // The stylesheets the Chrome brings are the grid's to check, as it renders their notices (ADR-0123).\n if (name === 'stylesheets') continue;\n if (!names.includes(name)) throw new TypeError(`A Sheet's chrome has no slot '${name}': its slots are ${names.join(', ')} (ADR-0390).`);\n if (slot !== undefined && typeof slot !== 'function') throw new TypeError(`chrome.${name} is a mount function (ADR-0390).`);\n }\n }\n const handlers: readonly (readonly [string, unknown])[] = [\n ['onWorkbookChanged', options.onWorkbookChanged], ['onSheetsChanged', options.onSheetsChanged], ['onHistoryChanged', options.onHistoryChanged],\n ['onEditingChanged', options.onEditingChanged], ['onSelectionChanged', options.onSelectionChanged],\n ['onShowToolbarChanged', options.onShowToolbarChanged], ['onLinkedColumnColoursChanged', options.onLinkedColumnColoursChanged],\n ['onPointingRefused', options.onPointingRefused], ['onSummaryFiguresChanged', options.onSummaryFiguresChanged],\n ['onSelectionSummaryChanged', options.onSelectionSummaryChanged], ['onFormatKeyRefused', options.onFormatKeyRefused],\n ['commandLabel', options.commandLabel],\n ];\n const scope: unknown = options.pointingScope;\n if (scope !== undefined && !(scope instanceof PointingScope)) throw new TypeError('pointingScope is a PointingScope (ADR-0058).');\n for (const [name, handler] of handlers) {\n if (handler !== undefined && typeof handler !== 'function') throw new TypeError(`${name} is a function.`);\n }\n return taken;\n }\n}\n\n// A Sheet as its Pointing Scope reads it (ADR-0058): its declared tables, read as they stand when asked.\nfunction pointingSheet(\n linkedTables: () => readonly LinkedTable[], edit: Pick<PointingSheet, 'writePointedText' | 'takeBackPointedText' | 'tellPointingRefused'>,\n): PointingSheet {\n return {\n get linkedTables() { return linkedTables(); },\n rootId: undefined,\n writePointedText: edit.writePointedText,\n takeBackPointedText: edit.takeBackPointedText,\n tellPointingRefused: edit.tellPointingRefused,\n };\n}\n\n// The Match Mark's rule (ADR-0332 \u00A74): the one a step finds by, so a mark is never a match no step reaches.\nconst sheetFindMatch = (row: SheetRow, column: GridColumn<SheetRow>, pattern: GridFindPattern): boolean => {\n const at = CellAddress.tryParseColumn(column.name);\n if (at === undefined) throw new Error(`Internal: '${column.name}' is not one of the Sheet's columns.`);\n return sheetCellMatches(row.sheet, new CellAddress(row.index, at), pattern, row.at(at)?.text);\n};\n\n/** A cell a Replace All over the Workbook could not write, as the find panel names it: by its Sheet and column. */\nfunction refusedCellOf(cell: { readonly sheet: Sheet; readonly address: CellAddress }, reason: string): FindPanelRefusedCell {\n return { rowNumber: cell.address.row + 1, column: sheetQualifier(cell.sheet) + CellAddress.columnName(cell.address.column), reason };\n}\n\n/** The commands of a Sheet Tab's menu, in its order (ADR-0331 \u00A74). */\nconst tabCommandOrder: readonly SheetTabCommand[] = ['rename', 'delete', 'moveLeft', 'moveRight', 'copy'];\n\n/** The keys the Sheet declares to its grid: Excel's formatting keys and its insert and delete keys (ADR-0050 item 14). */\nconst sheetDeclaredKeys: readonly string[] = Object.freeze([...sheetFormatKeysDeclared(), ...sheetStructureKeysDeclared()]);\n\n/** How a Reference names `sheet` before its cell, quoted where its name needs it: `Sheet2!`, `'Q1 Sales'!`. */\nfunction sheetQualifier(sheet: Sheet): string {\n const a1 = referenceText(new CellRange(new CellAddress(0, 0)), sheet.name);\n return a1.slice(0, a1.length - 'A1'.length);\n}\n\nfunction unreachableColumn(position: number): never {\n throw new Error(`Internal: no column of the request stands at ${String(position)}.`);\n}\n\n// Each Toolbar Item's KeyTip, Excel's Home tab's where Excel has one (ADR-0100; a reading until a Windows run reads them\n// all). Strikethrough has none in Excel, and ExSheet's own is 4. Excel reaches Format Cells\u2026 through the Cells group's\n// Format menu, O, then E: ExSheet has no such menu, so its letters are both, O narrowing to it and E running it.\nconst toolbarKeyTips: Readonly<Record<SheetToolbarCommand, string>> = {\n bold: '1', italic: '2', underline: '3', strikethrough: '4', fontColour: 'FC', fill: 'H', borders: 'B',\n alignLeft: 'AL', alignCenter: 'AC', alignRight: 'AR', numberFormat: 'N', percent: 'P', comma: 'K', formatCells: 'OE',\n};\n\n// Excel's Borders presets, in its list's order, each relative to every selected range as Format Cells' are (ADR-0100).\nconst toolbarBorders: readonly SheetToolbarBorder[] = ['bottom', 'top', 'left', 'right', 'none', 'all', 'outside', 'thickOutside'];\nconst thinLine = new BorderLine('thin');\nconst borderPresets: Readonly<Record<SheetToolbarBorder, BorderChange>> = {\n bottom: new BorderChange({ bottom: thinLine }),\n top: new BorderChange({ top: thinLine }),\n left: new BorderChange({ left: thinLine }),\n right: new BorderChange({ right: thinLine }),\n none: BorderChange.none,\n all: new BorderChange({ top: thinLine, bottom: thinLine, left: thinLine, right: thinLine, insideHorizontal: thinLine, insideVertical: thinLine }),\n outside: BorderChange.outline(thinLine),\n thickOutside: BorderChange.outline(new BorderLine('thick')),\n};\n\n// An alignment item's change: the alignment, or General where the Focus cell has it, as Excel's buttons do (ADR-0100).\nconst align = (alignment: HorizontalAlignment) => (focused: CellFormat): CellFormatChange =>\n new CellFormatChange({ alignment: focused.alignment === alignment ? 'general' : alignment });\n\n// The default row: Excel's Home tab's commands in its order (ADR-0100).\nconst defaultToolbarRow: readonly (SheetToolbarCommand | 'separator')[] = [\n 'bold', 'italic', 'underline', 'strikethrough', 'separator', 'fontColour', 'fill', 'separator', 'borders', 'separator',\n 'alignLeft', 'alignCenter', 'alignRight', 'separator', 'numberFormat', 'percent', 'comma', 'separator', 'formatCells',\n];\n\n// The Toolbar's rows as the options give them. The grid's height is laid out from their count without drawing them.\nconst toolbarRowsOf = (options: SheetOptions): readonly (SheetToolbarRowOptions | 'default')[] => options.toolbar ?? ['default'];\n\n// The Toolbar's rows as an untyped caller may hand them (CONVENTIONS.md): refused by what is wrong, before anything changes.\nfunction checkToolbar(given: unknown): void {\n if (given === undefined) return;\n if (!Array.isArray(given) || given.length === 0) throw new TypeError(\"A Sheet Toolbar's rows are a list of one row or more; a toolbar of none is not shown: leave showToolbar off.\");\n const rows: readonly unknown[] = given;\n if (rows.filter(row => row === 'default').length > 1) throw new RangeError(\"ExSheet's default row stands once on a toolbar (ADR-0100).\");\n for (const row of rows) {\n if (row === 'default') continue;\n if (typeof row !== 'object' || row === null) throw new TypeError(\"A Toolbar Row is 'default' or { label, keyTip?, items }.\");\n const { label, keyTip, items }: { readonly label?: unknown; readonly keyTip?: unknown; readonly items?: unknown } = row;\n if (typeof label !== 'string' || label === '') throw new TypeError(\"A Toolbar Row's label, its accessible name, is a string that is not empty.\");\n checkKeyTip(keyTip, `the Toolbar Row '${label}'`);\n // A row of nothing would take a band off the Sheet's height and show nothing in it.\n if (!Array.isArray(items) || items.length === 0) throw new TypeError(`The items of the Toolbar Row '${label}' are a list of one item or more.`);\n const entries: readonly unknown[] = items;\n for (const entry of entries) {\n if (entry === 'separator') continue;\n if (typeof entry === 'string') {\n if (!Object.hasOwn(toolbarKeyTips, entry)) throw new RangeError(`'${entry}' is not one of ExSheet's toolbar commands: ${Object.keys(toolbarKeyTips).join(', ')}.`);\n continue;\n }\n if (typeof entry !== 'object' || entry === null) throw new TypeError(\"A Toolbar Row's item is one of ExSheet's commands, 'separator', or a button { text, onPress, keyTip?, disabledReason?, content? }.\");\n const { text, onPress, keyTip: letters, disabledReason, content }: {\n readonly text?: unknown; readonly onPress?: unknown; readonly keyTip?: unknown; readonly disabledReason?: unknown; readonly content?: unknown;\n } = entry;\n if (typeof text !== 'string' || text === '') throw new TypeError(\"A toolbar button's text, its name, is a string that is not empty.\");\n if (typeof onPress !== 'function') throw new TypeError(`The toolbar button '${text}' has an onPress, which is a function.`);\n checkKeyTip(letters, `the button '${text}'`);\n if (disabledReason !== undefined && typeof disabledReason !== 'string') throw new TypeError(`The disabledReason of the toolbar button '${text}' is a string, or undefined where it can be pressed.`);\n if (content !== undefined && typeof content !== 'function') throw new TypeError(`The content of the toolbar button '${text}' is a function that mounts it into the element it is handed.`);\n }\n }\n refuseCollidingKeyTips(given);\n}\n\n// The KeyTips of one level, refused where one begins another.\nfunction refuseCollidingAtOneLevel(tips: readonly { readonly letters: string; readonly name: string }[]): void {\n tips.forEach((tip, i) => {\n for (const other of tips.slice(0, i)) {\n if (tip.letters.startsWith(other.letters) || other.letters.startsWith(tip.letters)) {\n throw new RangeError(`The KeyTips '${other.letters}' of ${other.name} and '${tip.letters}' of ${tip.name} collide at one level: typed, one would be taken for the other. Give one of them other letters (ADR-0100).`);\n }\n }\n });\n}\n\n// KeyTip letters are typed: letters or digits, one or more, read without case.\nfunction checkKeyTip(letters: unknown, name: string): void {\n if (letters !== undefined && (typeof letters !== 'string' || !/^[\\p{L}\\p{N}]+$/u.test(letters))) {\n throw new TypeError(`The KeyTip of ${name} is letters or digits that can be typed, such as 'R'.`);\n }\n}\n\n// The KeyTip letters of a toolbar's rows, and of each row's items, which may not be taken for one another at one level\n// (ADR-0100): one that begins another would be typed as it. Refused by name.\nfunction refuseCollidingKeyTips(rows: readonly (SheetToolbarRowOptions | 'default')[]): void {\n refuseCollidingAtOneLevel(rows.flatMap(row => {\n if (row === 'default') return [{ letters: 'H', name: \"ExSheet's default row\" }];\n return row.keyTip === undefined ? [] : [{ letters: row.keyTip.toUpperCase(), name: `the Toolbar Row '${row.label}'` }];\n }));\n for (const row of rows) {\n if (row === 'default') continue;\n refuseCollidingAtOneLevel(row.items.flatMap(item => {\n if (item === 'separator') return [];\n if (typeof item === 'string') return [{ letters: toolbarKeyTips[item], name: `the item '${item}'` }];\n return item.keyTip === undefined ? [] : [{ letters: item.keyTip.toUpperCase(), name: `the button '${item.text}'` }];\n }));\n }\n}\n\n// The Name Box names the Focus as A1 does (ADR-0051).\n// The Sheet Size the options give, Excel's unless one is given (ADR-0460).\nfunction sheetSizeOf(options: SheetOptions): SheetSize {\n const given: unknown = options.sheetSize;\n if (given === undefined) return SheetSize.excel;\n if (typeof given !== 'object' || given === null) throw new TypeError(\"A Sheet's sheetSize is { rows, columns } (ADR-0460).\");\n const keys = Object.keys(given);\n if (keys.length === 0 || keys.some(key => key !== 'rows' && key !== 'columns'))\n throw new TypeError(`A Sheet's sheetSize is { rows, columns }, one of them or both; it was given ${keys.length === 0 ? '{}' : `{ ${keys.join(', ')} }`} (ADR-0460).`);\n const { rows, columns }: { readonly rows?: unknown; readonly columns?: unknown } = given;\n return new SheetSize(countOf(rows, 'rows', SheetSize.excel.rows), countOf(columns, 'columns', SheetSize.excel.columns));\n}\n\n/** A count of a `sheetSize`, Excel's when it is not given; one given as anything but a number is refused by name. */\nfunction countOf(given: unknown, name: 'rows' | 'columns', excel: number): number {\n if (given === undefined) return excel;\n if (typeof given !== 'number') throw new TypeError(`A Sheet's sheetSize.${name} is a number (ADR-0460).`);\n return given;\n}\n\nconst nameBoxLabel = (focus: CellPosition): string => new CellAddress(focus.row, focus.column).toString();\n// The size of a range a drag selects, in the Name Box, as Excel's shows it while the button is down (ADR-0052).\nconst nameBoxSizeLabel = (range: SelectionRange): string =>\n `${String(range.rowCount)}R x ${String(range.columnCount)}C`;\n\n// A Row Heading is Excel's row number, which is the position plus one in every culture (ADR-0050, ADR-0048).\nconst rowLabel = (row: number): string => String(row + 1);\n\n/** The cell the first pasted field ExSheet marked refused was copied from, in the order of the copied block, or\n * `undefined` for a paste that holds none. */\nfunction firstRefusedIn(intent: GridPasteIntent): CellAddress | undefined {\n const source = intent.plan.source;\n for (const range of intent.plan.targets) {\n // Every field of the block lands in each target range, from its top-left (ADR-0014).\n for (let row = 0; row < Math.min(source.rows, range.rowCount); row++) {\n for (let column = 0; column < Math.min(source.columns, range.columnCount); column++) {\n const from = refusedIn(intent.markFor({ row: range.topRow + row, column: range.leftColumn + column }));\n if (from !== undefined) return from;\n }\n }\n }\n return undefined;\n}\n\nfunction firstTarget(intent: GridPasteIntent): SelectionRange {\n const [first] = intent.plan.targets;\n if (first === undefined) throw new Error('Internal: a paste names at least one target.');\n return first;\n}\n\nfunction contains(range: SelectionRange, address: CellAddress): boolean {\n return address.row >= range.topRow && address.row < range.topRow + range.rowCount\n && address.column >= range.leftColumn && address.column < range.leftColumn + range.columnCount;\n}\n\n// Format Cells drawn by a Chrome (ADR-0390): the slot it stands in, in the grid's popover frame, and its contents,\n// taken away however the frame closes. Its calls reach nothing once they are.\nclass SlottedFormatCells {\n readonly element: HTMLElement;\n readonly #mount: SheetFormatCellsSlot;\n #cleanup: (() => void) | undefined;\n #live = false;\n\n constructor(doc: Document, mount: SheetFormatCellsSlot) {\n this.#mount = mount;\n this.element = doc.createElement('div');\n // A class of its own, by which Ctrl+1 inside it opens nothing more: not the built-in Format Cells', whose layout\n // is the built-in contents'.\n this.element.className = 'ex-format-cells-slot';\n }\n\n get live(): boolean {\n return this.#live;\n }\n\n mount(context: SheetFormatCellsSlotContext): void {\n this.#live = true;\n this.#cleanup = mountedSlot('formatCells', () => this.#mount(this.element, context));\n }\n\n dispose(): void {\n if (!this.#live) return;\n this.#live = false;\n const cleanup = this.#cleanup;\n this.#cleanup = undefined;\n cleanup?.();\n }\n}\n", "// What the package knows is there, as core/src/must.ts says it for the Script Core: a miss is a defect in\n// the package, said by throwing where a `!` would read on with `undefined` (CONVENTIONS.md, \"No quiet\n// fallback\"). The packages share no code, so each carries its own.\n\n/** The element at `index`, which the caller knows is there. A miss throws: it is a defect, never an answer. */\nexport function elementAt<T extends object | string | number | boolean | bigint | null>(list: ArrayLike<T>, index: number): T {\n const value = list[index];\n if (value === undefined) {\n throw new Error(`Internal: index ${index} is outside a list of ${list.length}.`);\n }\n return value;\n}\n\n/** The value, which the caller knows is there. `undefined` throws, naming what was missing. */\nexport function defined<T>(value: T | undefined, what: string): T {\n if (value === undefined) {\n throw new Error(`Internal: ${what} is missing.`);\n }\n return value;\n}\n\n/** The end of a switch that has taken every member of a union; a value from outside it throws here. */\nexport function unreachable(value: never): never {\n throw new Error(`Internal: ${String(value)} is not a value this switch takes.`);\n}\n", "// The moment a Sheet reads in a time zone (ADR-0121, ADR-0124): the date TODAY answers and the date and time of day\n// NOW answers, as the browser's Intl reads them in the zone named. The engine is given both as data and reads no clock\n// itself; the Sheet reads them here.\n\nimport type { SheetDay, SheetMoment } from '@ex-grid/sheet-engine';\n\n/** The longest a reading of the day stands: a clock change, a daylight-saving shift or a sleeping device makes a day\n * late by at most this (ADR-0121). */\nexport const longestDayReadingMs = 60 * 60 * 1000;\n\nconst readers = new Map<string, Intl.DateTimeFormat>();\n\n/** The zone named, as Intl knows it; a name Intl does not know is refused by name, never read as another zone. */\nexport function checkTimeZone(zone: string): void {\n readerOf(zone);\n}\n\n/** The time zone the browser runs in, or `undefined` for a browser that does not say it (ADR-0121): then no day and\n * no time of day are known, and `TODAY()` and `NOW()` wait, never answered in a zone guessed. */\nexport function browserTimeZone(): string | undefined {\n const zone: unknown = new Intl.DateTimeFormat().resolvedOptions().timeZone;\n return typeof zone === 'string' && zone !== '' ? zone : undefined;\n}\n\n/** The date and time of day at `at` in `zone`. */\nexport function momentIn(zone: string, at: Date): SheetMoment {\n const parts = new Map(readerOf(zone).formatToParts(at).map(part => [part.type, part.value]));\n const part = (type: Intl.DateTimeFormatPartTypes): number => {\n const value = parts.get(type);\n if (value === undefined) throw new Error(`Internal: Intl gave no ${type} for ${at.toISOString()} in ${zone}.`);\n return Number(value);\n };\n return {\n year: part('year'), month: part('month'), day: part('day'),\n hour: part('hour'), minute: part('minute'), second: part('second'), millisecond: at.getUTCMilliseconds(),\n };\n}\n\n/** The day of `moment`. */\nexport function dayOf(moment: SheetMoment): SheetDay {\n return { year: moment.year, month: moment.month, day: moment.day };\n}\n\n/** Whether two days, or two absences of one, are the same. */\nexport function sameDay(a: SheetDay | undefined, b: SheetDay | undefined): boolean {\n return a === b || (a !== undefined && b !== undefined && a.year === b.year && a.month === b.month && a.day === b.day);\n}\n\n/** How long until the day is read again: the next midnight in the zone, at most {@link longestDayReadingMs} away, and\n * at least a second. */\nexport function untilTheDayIsReadAgainMs(moment: SheetMoment): number {\n const pastMidnight = ((moment.hour * 60 + moment.minute) * 60 + moment.second) * 1000 + moment.millisecond;\n return Math.max(1000, Math.min(longestDayReadingMs, 24 * 60 * 60 * 1000 - pastMidnight));\n}\n\n/** How long until the minute turns. */\nexport function untilTheMinuteTurnsMs(at: number): number {\n return 60_000 - (at % 60_000);\n}\n\nfunction readerOf(zone: string): Intl.DateTimeFormat {\n let reader = readers.get(zone);\n if (reader === undefined) {\n // Throws a RangeError for a zone Intl does not know.\n reader = new Intl.DateTimeFormat('en-US', {\n timeZone: zone, year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric', hourCycle: 'h23',\n });\n readers.set(zone, reader);\n }\n return reader;\n}\n", "// How a pasted field is written into a Sheet (ADR-0048, ADR-0050 item 10): an invariant number exactly, a run of\n// `#` in shown text refused by name, and anything else typed under the Sheet's culture, or refused where an\n// invariant date would read back as another value.\n\nimport type { PasteFieldOrigin } from '@ex-grid/core';\nimport { CellAddress, Entry, type Culture } from '@ex-grid/sheet-engine';\n\nconst isoDate = /^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}(:[0-9]{2})?)?$/u;\n\n/**\n * The number an invariant pasted field is: Excel's `x:num`, or ExGrid's and ExSheet's own unformatted HTML,\n * holding a finite number. It is pasted as that exact double, every digit it holds, not typed, which would cut\n * it to the fifteen significant digits a typed number keeps, and so reads the same under every culture.\n * Undefined for any other field, which {@link typedFor} types.\n */\nexport function exactNumberFor(field: string, origin: PasteFieldOrigin): number | undefined {\n if (origin !== 'invariant' || field.trim() === '') return undefined;\n const number = Number(field);\n return Number.isFinite(number) && /^[+-]?(\\d+\\.?\\d*|\\.\\d+)([eE][+-]?\\d+)?$/u.test(field.trim()) ? number : undefined;\n}\n\n/**\n * Whether a pasted field is a run of `#` in shown text: Excel showing a value too wide for its column, with the\n * value itself missing from the clipboard. Such a paste is refused by name, not taken as the text `########`\n * (ADR-0048). An invariant field holds the Value itself, so a run of `#` there is text.\n */\nexport function isTooNarrowToShow(field: string, origin: PasteFieldOrigin): boolean {\n return origin === 'shownText' && field.length > 0 && /^#+$/u.test(field);\n}\n\n/**\n * What a pasted field that is not an exact number is typed as under `culture`. Shown text is typed as it is. An\n * invariant field is its value as it is: an ISO date as the date; `TRUE` and `FALSE` as booleans; anything else\n * as text or an Error Value. Undefined when an invariant date would not read back under the culture as a date:\n * the paste is refused rather than write a different value.\n */\nexport function typedFor(field: string, origin: PasteFieldOrigin, culture: Culture): string | undefined {\n if (origin !== 'invariant') return field;\n const upper = field.toUpperCase();\n if (upper === 'TRUE' || upper === 'FALSE') return field;\n if (isoDate.test(field)) {\n // The engine reads a year-first date, and a time after a space, in every culture.\n const typed = field.replace('T', ' ');\n return Entry.parse(typed, culture)?.constant?.kind === 'number' ? typed : undefined;\n }\n return field;\n}\n\nconst refusedMarkPrefix = 'exsheet-refused:';\n\n/** ExSheet's mark on a refused cell of its clipboard table: the cell it was copied from, so that a paste's refusal\n * can name it (ADR-0047, 2026-10-12). The C# Sheet writes the same mark. */\nexport function refusedMarkFor(copiedFrom: CellAddress): string {\n return refusedMarkPrefix + copiedFrom.toString();\n}\n\n/** The cell a pasted field was copied from when ExSheet marked it refused, or `undefined` for any other field. */\nexport function refusedIn(mark: string | undefined): CellAddress | undefined {\n return mark?.startsWith(refusedMarkPrefix) === true ? CellAddress.tryParse(mark.slice(refusedMarkPrefix.length)) : undefined;\n}\n", "// ExSheet's answer to a copy (ADR-0050 item 9, ADR-0048, ADR-0049), the counterpart of C#'s SheetClipboard.Answer: the\n// engine's copy of the range, written exactly as the engine gives it, or the engine's refusal in the Sheet's words;\n// and the copy it last wrote, so that a paste of exactly that copy back into the Sheet carries its Entries.\n\nimport {\n assembleCopy, invariantMarker, markAttribute, parseClipboard, type CopyPlan, type GridCopyAnswer, type GridCopyRequest,\n type PasteFieldOrigin, type SelectionRange,\n} from '@ex-grid/core';\nimport { CellAddress, CellRange, type Sheet, type SheetBlock, type SheetRefusal } from '@ex-grid/sheet-engine';\nimport { defined } from './must';\nimport { refusedMarkFor } from './sheet-clipboard';\n\n/**\n * The copy ExSheet last put on the clipboard: the Entries it copied, and what was written. A later paste read from a\n * table marked as the Sheet marks its own, every field invariant, whose fields equal the ones the grid's paste parse\n * reads back from what was written, field for field, is taken to be this copy, and its Entries are pasted. A browser\n * clipboard names no owner, so equal content in the Sheet's own markup is the strongest evidence a page has; text\n * from another program reads as shown text, and is never taken for it.\n */\nexport class SheetOwnCopy {\n readonly block: SheetBlock;\n readonly #text: string;\n readonly #html: string;\n // Read back on the first paste that could be this copy, not at the copy, which may never be pasted.\n #fields: readonly (readonly string[])[] | undefined;\n\n constructor(block: SheetBlock, text: string, html: string) {\n this.block = block;\n this.#text = text;\n this.#html = html;\n }\n\n /** Whether a paste of `pasted`, read as `origins` say, is this copy, field for field. */\n isPastedAs(pasted: readonly (readonly string[])[], origins: readonly (readonly PasteFieldOrigin[])[]): boolean {\n if (!origins.every(row => row.every(origin => origin === 'invariant'))) return false;\n this.#fields ??= parseClipboard(this.#html, this.#text);\n const fields = this.#fields;\n if (fields === undefined) throw new Error(\"Internal: the engine's copy of a range read back as nothing.\");\n return pasted.length === fields.length\n && pasted.every((row, r) => row.length === fields[r]?.length && row.every((field, c) => field === fields[r]?.[c]));\n }\n}\n\n/**\n * The answer to `request`, and the copy to recognise on a later paste, or `undefined` where this copy carries no\n * Entries.\n * - A copy reaching a `#GETTING_DATA` cell is refused with the engine's sentence (ADR-0049).\n * - One range is the engine's copy: the Values as shown for `text/plain`, the unformatted Values for `text/html` in\n * Excel's markup, its table marked as the grid marks its own so that a paste reads its fields as invariant (ADR-0050\n * item 10). Its Entries are kept for a paste back into this Sheet.\n * - Several ranges combined into one block, or a copy with the headers, carry the same Values cell by cell, and no\n * Entries: a block of several ranges was never one place its References were relative to.\n * - Either way, a refused cell is written as it shows, and its cell of the table carries ExSheet's mark, which another\n * program ignores: a paste into a Sheet that reads it is refused by name, never typed as an Error Value a Formula\n * could catch (ADR-0047, 2026-10-12).\n */\nexport function sheetCopyAnswer(sheet: Sheet, request: GridCopyRequest, refused: (refusal: SheetRefusal) => string): {\n readonly answer: GridCopyAnswer; readonly own: SheetOwnCopy | undefined;\n} {\n const { plan } = request;\n const copies = [];\n for (const segment of plan.segments) {\n const copy = sheet.copy(rangeOf(segment));\n if (copy.refusal !== undefined) return { answer: { kind: 'refuse', sentence: refused(copy.refusal) }, own: undefined };\n copies.push(copy);\n }\n const [only] = copies;\n const [segment] = plan.segments;\n if (copies.length === 1 && only !== undefined && segment !== undefined && !request.withHeaders) {\n const range = rangeOf(segment);\n const width = range.columnCount;\n const text = defined(only.text, 'the copy\\'s text');\n // The engine writes its table's cells row by row over the range.\n const html = markRefused(sheet, markedInvariant(defined(only.html, 'the copy\\'s table')), range.rowCount * width,\n i => new CellAddress(range.first.row + Math.floor(i / width), range.first.column + (i % width)));\n return { answer: { kind: 'write', text, html }, own: new SheetOwnCopy(defined(only.block, 'the copy\\'s Entries'), text, html) };\n }\n return { answer: assembled(sheet, plan, request.withHeaders), own: undefined };\n}\n\n// The Values of several ranges, cell by cell, in the grid's own assembly; the cells in the order the table writes\n// them, header cells apart, so that the refused ones are marked.\nfunction assembled(sheet: Sheet, plan: CopyPlan, withHeaders: boolean): GridCopyAnswer {\n const written: CellAddress[] = [];\n const { text, html } = assembleCopy(plan, {\n displayAt: (row, column) => copiedText(sheet, new CellAddress(row, column)),\n rawAt: (row, column) => {\n const address = new CellAddress(row, column);\n written.push(address);\n const value = sheet.getValue(address);\n return value === undefined ? '' : value.toString();\n },\n ...(withHeaders ? { headerAt: (column: number) => CellAddress.columnName(column) } : {}),\n });\n return { kind: 'write', text, html: markRefused(sheet, html, written.length, i => defined(written[i], 'a written cell')) };\n}\n\n// A cell's text as the engine's copy writes it: as the cell shows it at no particular width, and a Value its format\n// cannot show as the Value itself, never `####` (ADR-0016).\nfunction copiedText(sheet: Sheet, address: CellAddress): string {\n const display = sheet.getDisplay(address);\n if (!display.cannotShow) return display.text;\n const value = sheet.getValue(address);\n return value === undefined ? '' : value.toString();\n}\n\n// `html` with ExSheet's mark on the `<td>` of every refused cell: `cellAt` names the table's `count` cells in the\n// order it writes them. Every cell of the table is a `<td` and every other `<` in it is escaped, so the n-th `<td` is\n// the n-th cell; a table that holds another count is a defect said by name, never a mark on the wrong cell.\nfunction markRefused(sheet: Sheet, html: string, count: number, cellAt: (index: number) => CellAddress): string {\n const parts: string[] = [];\n // `from` is where the text not yet taken starts; the search goes on past each cell's `<td`.\n let from = 0;\n let cell = 0;\n for (let at = html.indexOf('<td'); at >= 0; at = html.indexOf('<td', at + '<td'.length)) {\n if (cell >= count) throw new Error('The Sheet\\'s copy holds more cells than it was written from, so ExSheet cannot mark its refused cells.');\n const open = at + '<td'.length;\n const address = cellAt(cell);\n if (sheet.getValue(address)?.isRefused === true) {\n parts.push(html.slice(from, open), ` ${markAttribute}=\"${refusedMarkFor(address)}\"`);\n from = open;\n }\n cell++;\n }\n if (cell !== count) throw new Error('The Sheet\\'s copy holds fewer cells than it was written from, so ExSheet cannot mark its refused cells.');\n parts.push(html.slice(from));\n return parts.join('');\n}\n\nconst engineTableOpen = '<table ';\n\n// The engine's table, marked as the grid marks its own unformatted HTML, so the grid's paste parse reads every field\n// of it as invariant.\nfunction markedInvariant(html: string): string {\n if (!html.startsWith(engineTableOpen)) {\n throw new Error(\"The engine's copy no longer opens with <table and its attributes, so ExSheet cannot mark it as invariant; a paste would read its numbers as shown text.\");\n }\n return `${engineTableOpen}${invariantMarker} ${html.slice(engineTableOpen.length)}`;\n}\n\n/** The engine's range for a range of the grid's. */\nexport function rangeOf(range: SelectionRange): CellRange {\n return new CellRange(\n new CellAddress(range.topRow, range.leftColumn),\n new CellAddress(range.topRow + range.rowCount - 1, range.leftColumn + range.columnCount - 1));\n}\n", "// The Sheet's columns A \u2026 XFD as ExGrid takes them (ADR-0046): Text columns whose cells declare their own kind,\n// alignment, painted text and appearance (ADR-0050), never queryable, since a Sheet's rows are places and sorting\n// them would move what the References name. Their widths are the Sheet's, in Excel's characters, converted to\n// the grid's pixels as the painted text converts them (ADR-0047, third round).\n\nimport type { CellAlign, CellAppearance, CellTextMeasure, ColumnType, GridColumn } from '@ex-grid/core';\nimport { CellAddress, Sheet, type CellRange } from '@ex-grid/sheet-engine';\nimport { charactersIn, type FormulaUnreadableWords, type SheetCellText, type SheetRow } from './sheet-row';\n\n/** The narrowest a drag makes a column, as the grid's own default is, unless the Sheet's is narrower. */\nconst defaultMinWidthPx = 40;\n\n/** A column's width in pixels from its width in characters (ADR-0047, third round). */\nexport function pxOf(characters: number, metrics: CellTextMeasure): number {\n return Math.round((characters * metrics.digitWidthPx + 2 * metrics.cellHorizontalPaddingPx) * 1e6) / 1e6;\n}\n\n/** A column's width in characters from its width in pixels, at most the Sheet's widest; `undefined` for a\n * width that holds no character, which the Sheet does not record (a hidden column is not supported). */\nexport function charactersOfColumn(columnWidthPx: number, metrics: CellTextMeasure): number | undefined {\n const characters = charactersIn(metrics.contentWidthPx(columnWidthPx), metrics);\n return characters > 0 ? Math.min(characters, Sheet.maxColumnWidth) : undefined;\n}\n\n// Each column's index, recorded as the column is made, so a cell's declarations never parse its name again.\nconst indices = new WeakMap<GridColumn<SheetRow>, number>();\n\n/** The column's index on the Sheet from its name. */\nexport function indexOf(column: GridColumn<SheetRow>): number {\n const recorded = indices.get(column);\n if (recorded !== undefined) return recorded;\n const index = CellAddress.tryParseColumn(column.name);\n if (index === undefined) throw new RangeError(`'${column.name}' is not one of the Sheet's columns.`);\n return index;\n}\n\nconst formatText = (value: unknown): string => {\n // The grid formats only what a column's `value` answered, which is a cell's text or a blank.\n if (typeof value !== 'object' || value === null || !('text' in value) || typeof value.text !== 'string') {\n throw new TypeError('A Sheet column formats only the text of one of its cells.');\n }\n return value.text;\n};\n\n/** The per-cell declarations the grid asks of a Sheet's rows, one instance each, so they are the same functions\n * on every update (ADR-0003). */\nexport const sheetCellPaint = Object.freeze({\n cellType: (row: SheetRow, column: GridColumn<SheetRow>): ColumnType => (row.at(indexOf(column))?.isNumber === true ? 'number' : 'text'),\n cellAlign: (row: SheetRow, column: GridColumn<SheetRow>): CellAlign => {\n const shown = row.at(indexOf(column));\n return shown === undefined ? 'auto' : shown.align;\n },\n paintedText: (row: SheetRow, column: GridColumn<SheetRow>, contentWidthPx: number, metrics: CellTextMeasure): string | undefined =>\n row.paintedAt(indexOf(column), contentWidthPx, metrics),\n editorText: (row: SheetRow, column: GridColumn<SheetRow>): string | undefined => row.entryTextAt(indexOf(column)),\n editorAppearance: (row: SheetRow, column: GridColumn<SheetRow>): CellAppearance => row.editorAppearanceAt(indexOf(column)),\n // A cell an array spills into holds no Entry: the bar shows its Anchor's Formula, dimmed (ADR-0125).\n formulaBarBorrowedText: (row: SheetRow, column: GridColumn<SheetRow>): string | undefined => row.spilledFormulaAt(indexOf(column)),\n});\n\n/** The appearance lookup for one reading of the Sheet's formatting: a new function, so every row is asked again,\n * when a change reaches cells the engine names no row of (ADR-0071). */\nexport function appearanceLookup(reading: number): (row: SheetRow, column: GridColumn<SheetRow>) => CellAppearance {\n return (row, column) => row.appearanceAt(indexOf(column), reading);\n}\n\n/**\n * The Sheet's columns, each as wide as the Sheet records it. A column object is kept while its width is the\n * same, so an update after an edit hands the grid the same columns.\n */\nexport class SheetColumns {\n readonly #metrics: CellTextMeasure;\n readonly #unreadable: FormulaUnreadableWords;\n readonly #defaultWidthPx: number;\n // Each column's object at its width: kept while the width holds, replaced when it moves.\n readonly #byIndex = new Map<number, GridColumn<SheetRow>>();\n #columns: readonly GridColumn<SheetRow>[] = [];\n #sheet: Sheet | undefined;\n\n /** @param metrics The Cell Metrics the grid paints with: its density's, or a Wrapper's widths at it (ADR-0030). */\n constructor(metrics: CellTextMeasure, unreadable: FormulaUnreadableWords) {\n this.#metrics = metrics;\n this.#unreadable = unreadable;\n // Excel's default column: 8.43 of the grid's digits and the cell's padding on both sides, in whole pixels.\n this.#defaultWidthPx = Math.ceil(pxOf(Sheet.defaultColumnWidth, this.#metrics));\n }\n\n /** The metrics the columns are sized by. */\n get metrics(): CellTextMeasure { return this.#metrics; }\n\n /** The columns as the Sheet now records their widths. */\n get all(): readonly GridColumn<SheetRow>[] { return this.#columns; }\n\n /** Reads every column's width from `sheet`, or only `changed` where it is the Sheet read last; answers\n * whether any column changed. */\n read(sheet: Sheet, changed?: readonly number[]): boolean {\n // `A` to `XFD`, or as many as the Sheet Size holds (ADR-0460).\n const count = sheet.workbook.size.columns;\n if (sheet !== this.#sheet || changed === undefined || this.#columns.length !== count) {\n this.#sheet = sheet;\n this.#columns = Array.from({ length: count }, (_, index) => this.#column(index, this.#widthPx(sheet, index)));\n return true;\n }\n const columns = [...this.#columns];\n let moved = false;\n for (const index of changed) {\n if (index >= count) continue;\n const column = this.#column(index, this.#widthPx(sheet, index));\n if (column !== columns[index]) {\n columns[index] = column;\n moved = true;\n }\n }\n if (moved) this.#columns = columns;\n return moved;\n }\n\n /** The column's width in pixels as last read. */\n widthPxOf(index: number): number {\n const column = this.#columns[index];\n if (column === undefined) throw new RangeError(`Internal: no column ${String(index)} has been read.`);\n const { width } = column;\n if (typeof width !== 'object' || !('px' in width)) throw new Error(`Internal: column ${column.name} is not Fixed.`);\n return width.px;\n }\n\n /**\n * The columns a number widens, as Excel's do (ADR-0047, second round; SH-20): for each cell of `cells` that\n * holds an Entry, in a column the user has not sized, the width its text takes at the width the engine fits it\n * to on entry, where that is wider than the column. Answered in characters, widest per column, by column.\n */\n widenedBy(sheet: Sheet, cells: readonly CellRange[]): readonly (readonly [number, number])[] {\n const needed = new Map<number, number>();\n for (const range of cells) {\n for (const address of sheet.entryAddressesIn(range)) {\n const { column } = address;\n if (sheet.getColumnWidth(column)?.isSetByUser === true) continue;\n const characters = sheet.getWidthOnEntry(address);\n if (characters === undefined) continue;\n const shown = sheet.getDisplay(address, characters);\n const charged = sheet.getFont(address).bold ? this.#metrics.bold : this.#metrics;\n // The column the text takes: its width and the cell's padding on both sides.\n const px = Math.ceil(charged.textWidthPx(shown.text) + 2 * charged.cellHorizontalPaddingPx);\n const widest = needed.get(column);\n if (px > this.widthPxOf(column) && (widest === undefined || px > widest)) needed.set(column, px);\n }\n }\n const widths: (readonly [number, number])[] = [];\n for (const [column, px] of [...needed].toSorted(([a], [b]) => a - b)) {\n const width = charactersOfColumn(px, this.#metrics);\n if (width !== undefined) widths.push([column, width]);\n }\n return widths;\n }\n\n #widthPx(sheet: Sheet, index: number): number {\n const recorded = sheet.getColumnWidth(index);\n return recorded === undefined ? this.#defaultWidthPx : pxOf(recorded.width, this.#metrics);\n }\n\n #column(index: number, widthPx: number): GridColumn<SheetRow> {\n const kept = this.#byIndex.get(index);\n if (kept?.width !== undefined && typeof kept.width === 'object' && 'px' in kept.width && kept.width.px === widthPx) return kept;\n const name = CellAddress.columnName(index);\n const unreadable = this.#unreadable;\n const column: GridColumn<SheetRow> = Object.freeze({\n name,\n header: name,\n type: 'text',\n queryable: false,\n editable: true,\n headerAlign: 'center',\n width: Object.freeze({ px: widthPx, minPx: Math.min(defaultMinWidthPx, widthPx) }),\n value: (row: SheetRow): SheetCellText | undefined => row.at(index),\n format: formatText,\n validate: (row: SheetRow, typed: string) => row.judge(typed, unreadable),\n });\n this.#byIndex.set(index, column);\n indices.set(column, index);\n return column;\n }\n}\n", "// One row of a Sheet as ExGrid is handed it: a position, not a thing (ADR-0046). Row 5 stays row 5 whatever is\n// put into it, so the grid's Row Sequence Version never moves; what changes is the instance. The Sheet hands the\n// grid a new instance for every row a change to the Sheet names, and the same instance for every other row, so\n// the others are not painted again (ADR-0003, SH-4).\n//\n// A row reads its cells from the Sheet the first time the grid asks for each one and keeps the answer. That is\n// safe because an instance is retired the moment the Sheet reports a change on its row: while it is current,\n// what it would read has not changed since it was made.\n\nimport type { CellAlign, CellAppearance, CellBorder, CellTextMeasure, EditVerdict } from '@ex-grid/core';\nimport {\n CellAddress, Entry, FormulaSyntaxError, numberFormatColourRgb, Sheet,\n type BorderLine, type CellColour, type CellDisplay, type HorizontalAlignment, type NumberFormatColour, type Value,\n} from '@ex-grid/sheet-engine';\nimport { unreachable } from './must';\n\n/**\n * What a number shows when it cannot be shown in its format at any width: a run of `#` no column is wide enough\n * for, which ExGrid's rule for a number that does not fit turns into the `####` that fills the cell (ADR-0016).\n */\nexport const unshowable = '#'.repeat(256);\n\n/**\n * What one cell hands ExGrid as its value: the engine's formatted text, whether it is a number, the unformatted\n * Value as the engine writes it for its own copy, its alignment, and the colour its Number Format paints it in.\n */\nexport interface SheetCellText {\n readonly text: string;\n /** The Value unformatted, which the grid's own copy writes in its table, as `raw` is. */\n toString(): string;\n readonly isNumber: boolean;\n readonly raw: string;\n readonly align: CellAlign;\n readonly colour: NumberFormatColour | undefined;\n}\n\n/**\n * The cell's alignment as the grid takes it (ADR-0050, item 7): a user's own setting as it is; General as `auto`,\n * so the cell's kind decides, except where the engine resolves General to the centre, which is Excel's place for\n * booleans and Error Values and one no kind gives.\n */\nfunction alignOf(display: CellDisplay, setting: HorizontalAlignment): CellAlign {\n switch (setting) {\n case 'left': return 'left';\n case 'center': return 'center';\n case 'right': return 'right';\n case 'general': return display.alignment === 'center' ? 'center' : 'auto';\n default: return unreachable(setting);\n }\n}\n\n/** The cell's text from the engine's display, Value and alignment setting, or undefined for a blank cell. A\n * `####` keeps its section's colour, as Excel's does (ADR-0071). */\nfunction cellTextOf(display: CellDisplay, value: Value | undefined, setting: HorizontalAlignment): SheetCellText | undefined {\n const raw = value === undefined ? '' : value.toString();\n const align = alignOf(display, setting);\n const toString = (): string => raw;\n if (display.cannotShow) return Object.freeze({ text: unshowable, isNumber: true, raw, align, colour: display.colour, toString });\n if (display.text === '') return undefined;\n return Object.freeze({ text: display.text, isNumber: display.isNumber, raw, align, colour: display.colour, toString });\n}\n\n/** The text the cell at `address` is shown with, a `####` included, or `''` for a blank cell: what Find searches\n * (ADR-0055), the engine's display, never the width-fitted text a column paints. */\nexport function shownTextOf(sheet: Sheet, address: CellAddress): string {\n return cellTextOf(sheet.getDisplay(address), sheet.getValue(address), sheet.getAlignment(address))?.text ?? ''; // oxlint-disable-line ex-grid/no-stand-in-default -- a blank cell shows no text, which matches nothing\n}\n\n/** A content width in pixels as Excel's column width: how many of the grid's digits fit in it. */\nexport function charactersIn(contentWidthPx: number, metrics: CellTextMeasure): number {\n return contentWidthPx <= 0 || metrics.digitWidthPx <= 0 ? 0 : contentWidthPx / metrics.digitWidthPx;\n}\n\n/** The words a refused Formula is rejected with in the editor (ADR-0034). */\nexport type FormulaUnreadableWords = (error: FormulaSyntaxError) => string;\n\n/** One row of a Sheet. */\nexport class SheetRow {\n readonly #sheet: Sheet;\n readonly #index: number;\n readonly #cells = new Map<number, SheetCellText | undefined>();\n readonly #painted = new Map<number, { readonly widthPx: number; readonly metrics: CellTextMeasure; readonly text: string | undefined }>();\n #appearances = new Map<number, CellAppearance>();\n #appearancesRead = -1;\n\n constructor(sheet: Sheet, index: number) {\n this.#sheet = sheet;\n this.#index = index;\n }\n\n /** The Sheet the row is of: an edit committed while another Sheet is shown lands on it (ADR-0331 \u00A75). */\n get sheet(): Sheet { return this.#sheet; }\n\n /** The row's position on the Sheet, from 0 (row `1` is 0). */\n get index(): number { return this.#index; }\n\n /** What the cell in `column` shows, or undefined for a blank cell. */\n at(column: number): SheetCellText | undefined {\n if (this.#cells.has(column)) return this.#cells.get(column);\n const address = new CellAddress(this.#index, column);\n const text = cellTextOf(this.#sheet.getDisplay(address), this.#sheet.getValue(address), this.#sheet.getAlignment(address));\n this.#cells.set(column, text);\n return text;\n }\n\n /**\n * What the cell paints in a column whose content is `contentWidthPx` wide (ADR-0047, third round; ADR-0050 item\n * 11; ticket 91): for a number in General, the widest text the engine fits to a width in characters that\n * `metrics` charge no wider than the content, so `=1/3` reads `0.333333` in a default column; or the run of `#`\n * that becomes `####` where not even the shortest form fits. Undefined where the cell paints its value's own text.\n */\n paintedAt(column: number, contentWidthPx: number, metrics: CellTextMeasure): string | undefined {\n const shown = this.at(column);\n if (shown?.isNumber !== true || shown.text === unshowable) return undefined;\n const cached = this.#painted.get(column);\n if (cached?.widthPx === contentWidthPx && cached.metrics === metrics) return cached.text;\n const address = new CellAddress(this.#index, column);\n let painted: string | undefined;\n if (this.#sheet.getNumberFormat(address).isGeneral) {\n const text = this.#fittedGeneral(address, contentWidthPx, metrics);\n painted = text === shown.text ? undefined : text;\n }\n this.#painted.set(column, { widthPx: contentWidthPx, metrics, text: painted });\n return painted;\n }\n\n // The widest text the engine writes for a General number at a width in characters that `metrics` charge no\n // wider than the content, each glyph at its own width (ADR-0016; ticket 91). The search starts one character\n // past the digits that fit: General's text holds at most one glyph narrower than a digit.\n #fittedGeneral(address: CellAddress, contentWidthPx: number, metrics: CellTextMeasure): string {\n const digits = Math.min(Sheet.maxColumnWidth, Math.max(0, charactersIn(contentWidthPx, metrics)));\n // The engine counts whole characters; a width that is 8 may arrive as 7.9999999.\n for (let characters = Math.floor(digits + 1e-9) + 1; characters > 0; characters--) {\n const display = this.#sheet.getDisplay(address, characters);\n if (!display.cannotShow && metrics.textWidthPx(display.text) <= contentWidthPx) return display.text;\n }\n return unshowable;\n }\n\n /**\n * The cell's Font, Fill and Borders as the core paints them (ADR-0050 item 15, ADR-0071), for one `reading` of\n * the Sheet's formatting. Within a reading the answer is kept: a change the engine names retires the row, and\n * a change that reaches rows the engine does not name starts a new reading.\n */\n appearanceAt(column: number, reading: number): CellAppearance {\n if (this.#appearancesRead !== reading) {\n this.#appearances = new Map();\n this.#appearancesRead = reading;\n }\n const cached = this.#appearances.get(column);\n if (cached !== undefined) return cached;\n const appearance = appearanceOf(this.#sheet, new CellAddress(this.#index, column), this.at(column)?.colour);\n this.#appearances.set(column, appearance);\n return appearance;\n }\n\n /** The cell's Font and Fill as the Cell Editor takes them: the Font's own colour, never a Number Format's\n * (ticket 88). */\n editorAppearanceAt(column: number): CellAppearance {\n return appearanceOf(this.#sheet, new CellAddress(this.#index, column), undefined);\n }\n\n /** The cell's Entry as the Cell Editor opens on it (ADR-0051). */\n entryTextAt(column: number): string {\n return this.#sheet.getEntryText(new CellAddress(this.#index, column));\n }\n\n /** For a cell an array spills into, its Anchor's Formula, which the Formula Bar shows dimmed (ADR-0125). */\n spilledFormulaAt(column: number): string | undefined {\n const anchor = this.#sheet.spilledFrom(new CellAddress(this.#index, column));\n return anchor === undefined ? undefined : this.#sheet.getEntryText(anchor);\n }\n\n /**\n * The verdict on a commit into this row (ADR-0034): a Formula the engine cannot read is rejected with the\n * engine's reason, and the editor holds the text so it can be corrected. Text with a leading `+` or `-` is read\n * as the engine reads it, since Excel may read it as a Formula. Anything else is a constant, which always reads.\n */\n judge(typed: string, unreadable: FormulaUnreadableWords): EditVerdict {\n const first = typed.charAt(0);\n if (first !== '=' && first !== '+' && first !== '-') return { kind: 'accept' };\n try {\n Entry.parse(typed, this.#sheet.culture);\n } catch (error) { // oxlint-disable-line ex-grid/no-catch -- an unreadable Formula is the verdict's answer (ADR-0034); anything else is rethrown\n if (error instanceof FormulaSyntaxError) return { kind: 'reject', message: unreadable(error) };\n throw error;\n }\n return { kind: 'accept' };\n }\n}\n\n/**\n * The appearance of the cell at `address`: its Font, Fill and Borders as the Sheet shows them, with the colour of\n * the Number Format's section that shows its Value, where it names one, in place of the Font's colour (the\n * eleventh Windows run, case 2). Each side is the edge as shown from both cells, so the core is never left to\n * draw one cell's record of it alone.\n */\nexport function appearanceOf(sheet: Sheet, address: CellAddress, numberFormatColour: NumberFormatColour | undefined): CellAppearance {\n const font = sheet.getFont(address);\n const fill = sheet.getFill(address).colour;\n const borders = sheet.getBorders(address);\n const fontColour = numberFormatColour === undefined ? rgbOf(font.colour) : numberFormatColourRgb(numberFormatColour);\n const fillRgb = fill === undefined ? undefined : rgbOf(fill);\n return Object.freeze({\n ...(fontColour === undefined ? {} : { fontColour }),\n ...(font.bold ? { bold: true } : {}),\n ...(font.italic ? { italic: true } : {}),\n ...(font.underline ? { underline: true } : {}),\n ...(font.strikethrough ? { strikethrough: true } : {}),\n ...(fillRgb === undefined ? {} : { fill: fillRgb }),\n ...sideOf('top', borders.top),\n ...sideOf('right', borders.right),\n ...sideOf('bottom', borders.bottom),\n ...sideOf('left', borders.left),\n });\n}\n\n/** A recorded colour as the core paints it; undefined for Automatic. */\nfunction rgbOf(colour: CellColour): number | undefined {\n return colour.isAutomatic ? undefined : colour.rgb;\n}\n\n/** A Border side as the core draws it: Automatic is Excel's black. */\nfunction sideOf(side: 'top' | 'right' | 'bottom' | 'left', line: BorderLine): Partial<Record<typeof side, CellBorder>> {\n if (line.isNone) return {};\n return { [side]: { style: line.style, colour: line.colour.isAutomatic ? 0x00_00_00 : line.colour.rgb } };\n}\n", "// The Sheet's one undo stack (ADR-0048, ADR-0331 \u00A73): each operation the user makes is one entry, however many\n// engine steps it took, and an undo or a redo of it says which Sheet to show and which range to select.\n\nimport { CellAddress, CellRange, type Sheet, type Workbook, type WorkbookChange, type WorkbookStep } from '@ex-grid/sheet-engine';\nimport { elementAt } from './must';\n\n/** One operation on the stack: its engine steps in the order done, the Sheet it was done from, and the ranges an\n * undo or a redo of it selects. */\nexport class SheetOperation {\n readonly steps: readonly WorkbookStep[];\n readonly from: Sheet;\n readonly ranges: readonly CellRange[];\n\n constructor(steps: readonly WorkbookStep[], from: Sheet, ranges: readonly CellRange[]) {\n this.steps = steps;\n this.from = from;\n this.ranges = ranges;\n }\n\n /** The Sheet to show once the operation is undone or redone: its own, else the one it was done from, else the\n * Workbook's. */\n shownAfter(workbook: Workbook): Sheet {\n const sheet = elementAt(this.steps, 0).sheet;\n if (workbook.sheets.includes(sheet)) return sheet;\n return workbook.sheets.includes(this.from) ? this.from : workbook.shown;\n }\n\n /** The range an undo or a redo selects, as Excel's does: the one range, or the range that holds them all\n * where they tile it without overlapping, else the first. Undefined for an operation on the Sheets. */\n selects(): CellRange | undefined {\n const [first] = this.ranges;\n if (first === undefined) return undefined;\n const distinct = this.ranges.filter((range, i) => this.ranges.findIndex(other => other.equals(range)) === i);\n if (distinct.length === 1) return first;\n const top = Math.min(...distinct.map(r => r.first.row));\n const left = Math.min(...distinct.map(r => r.first.column));\n const bottom = Math.max(...distinct.map(r => r.last.row));\n const right = Math.max(...distinct.map(r => r.last.column));\n for (let i = 0; i < distinct.length; i++) {\n for (let j = i + 1; j < distinct.length; j++) {\n if (overlap(elementAt(distinct, i), elementAt(distinct, j))) return first;\n }\n }\n const cells = distinct.reduce((sum, r) => sum + r.cellCount, 0);\n return cells === (bottom - top + 1) * (right - left + 1)\n ? new CellRange(new CellAddress(top, left), new CellAddress(bottom, right))\n : first;\n }\n}\n\n/** An operation undone or redone, and what each of its steps changed. */\nexport interface SheetOperationStepped {\n readonly operation: SheetOperation;\n readonly changes: readonly WorkbookChange[];\n}\n\n/** The undo stack. */\nexport class SheetHistory {\n readonly #done: SheetOperation[] = [];\n readonly #undone: SheetOperation[] = [];\n\n get canUndo(): boolean { return this.#done.length > 0; }\n\n get canRedo(): boolean { return this.#undone.length > 0; }\n\n /** Records an operation of one or more steps; `ranges` in place of the first step's, where given. */\n record(steps: readonly WorkbookStep[], from: Sheet, ranges?: readonly CellRange[]): void {\n const [first] = steps;\n if (first === undefined) throw new RangeError('An operation is at least one step.');\n this.#done.push(new SheetOperation([...steps], from, ranges ?? first.ranges));\n this.#undone.length = 0;\n }\n\n /** Adds `step` to the latest operation where it began with `first` and nothing was undone since: the columns\n * of one resize are one operation. */\n tryExtend(first: WorkbookStep, step: WorkbookStep): boolean {\n const latest = this.#done.at(-1);\n if (latest === undefined || this.#undone.length > 0 || latest.steps[0] !== first) return false;\n this.#done[this.#done.length - 1] = new SheetOperation([...latest.steps, step], latest.from, [...latest.ranges, ...step.ranges]);\n return true;\n }\n\n undo(): SheetOperationStepped | undefined {\n const operation = this.#done.pop();\n if (operation === undefined) return undefined;\n const changes = operation.steps.toReversed().map(step => step.undo());\n this.#undone.push(operation);\n return { operation, changes };\n }\n\n redo(): SheetOperationStepped | undefined {\n const operation = this.#undone.pop();\n if (operation === undefined) return undefined;\n const changes = operation.steps.map(step => step.redo());\n this.#done.push(operation);\n return { operation, changes };\n }\n\n clear(): void {\n this.#done.length = 0;\n this.#undone.length = 0;\n }\n}\n\nfunction overlap(a: CellRange, b: CellRange): boolean {\n return a.first.row <= b.last.row && b.first.row <= a.last.row && a.first.column <= b.last.column && b.first.column <= a.last.column;\n}\n", "// ExSheet's answer to a Find step (ADR-0055) and its Replace plan (ADR-0332 \u00A72), the counterpart of C#'s SheetFind.\n// A step searches the Sheet's cells, every row of them, by the text each is shown with, a Formula's Value as shown,\n// never its Entry. It follows the core's reference step clause for clause: by rows, across a row in the order of the\n// request's columns, from the cell after the Focus (before it, backward), wrapping, inside the scope when there is\n// one. It walks only the cells that hold an Entry, since a blank shows no text a search could match, so a Sheet of a\n// million rows is searched in the time its occupied cells take. `sheetCellMatches` is the one rule a step and the\n// Match Mark judge a cell by (ADR-0332 \u00A74), so the mark never shows a match a step does not reach.\n\nimport {\n findAllPage, findMatches, replacedEntry, type GridFindAllPage, type GridFindAllRequest, type GridFindPattern, type GridFindRequest, type GridFindResult,\n type SelectionRange,\n} from '@ex-grid/core';\nimport { CellAddress, Sheet } from '@ex-grid/sheet-engine';\nimport { shownTextOf } from './sheet-row';\n\n/** One step over `sheet`, or not found. */\nexport function sheetFindStep(sheet: Sheet, request: GridFindRequest): GridFindResult {\n if (request.text === '' || request.columns.length === 0) return { found: false };\n const positions = positionsOf(request.columns);\n const columnCount = request.columns.length;\n const total = Sheet.rowCount * columnCount;\n const from = request.from;\n // The ordinal of the cell `from` names, in row-major order of the request's columns: the walk starts one step\n // past it and ends on it, as the reference's does.\n const start = from !== undefined && from.row >= 0 && from.row < Sheet.rowCount && from.column >= 0 && from.column < columnCount\n ? (from.row * columnCount) + from.column\n : request.backward ? 0 : total - 1;\n let best = Number.POSITIVE_INFINITY;\n let found: GridFindResult = { found: false };\n for (const address of sheet.entryAddresses) {\n const position = positions.get(address.column);\n if (position === undefined) continue;\n if (request.scope !== undefined && !inScope(request.scope, address.row, position)) continue;\n const ordinal = (address.row * columnCount) + position;\n // How many steps the walk takes to reach this cell: 1 for the cell after `from`, and the most, the whole\n // Sheet, for `from`'s own cell, which is considered last.\n const walked = (((request.backward ? start - ordinal : ordinal - start) % total) + total) % total;\n const distance = walked === 0 ? total : walked;\n if (distance >= best || !sheetCellMatches(sheet, address, request)) continue;\n best = distance;\n found = { found: true, row: address.row, column: columnName(request.columns, position) };\n }\n return found;\n}\n\n/**\n * One page of a Find All over `sheet` (ADR-0470 \u00A72, \u00A77), answered under `rowSequenceVersion`: every cell a step over\n * it would stop on, in the order a forward walk from A1 meets them, by rows and across a row in the request's column\n * order, inside the scope when there is one. Like a step it walks only the cells that hold an Entry, and the page\n * reads each one's text as it is shown now.\n */\nexport function sheetFindAll(sheet: Sheet, request: GridFindAllRequest, rowSequenceVersion: number): GridFindAllPage {\n const { start, count } = request;\n if (!Number.isInteger(start) || start < 0) throw new RangeError(`A Find All page starts at an entry at or after 0, not ${String(start)}.`);\n if (!Number.isInteger(count) || count < 1) throw new RangeError(`A Find All page asks for 1 entry or more, not ${String(count)}.`);\n const positions = positionsOf(request.columns);\n const columnCount = request.columns.length;\n const ordinals: number[] = [];\n if (request.text !== '') {\n for (const address of sheet.entryAddresses) {\n const position = positions.get(address.column);\n if (position === undefined) continue;\n if (request.scope !== undefined && !inScope(request.scope, address.row, position)) continue;\n if (sheetCellMatches(sheet, address, request)) ordinals.push((address.row * columnCount) + position);\n }\n }\n // By rows and across a row in the request's order, which need not be the Sheet's own order of its columns.\n ordinals.sort((a, b) => a - b);\n const matches = ordinals.slice(start, start + count).map(ordinal => {\n const row = Math.floor(ordinal / columnCount);\n const position = ordinal % columnCount;\n const column = columnName(request.columns, position);\n const sheetColumn = CellAddress.tryParseColumn(column);\n if (sheetColumn === undefined) throw new Error(`Internal: '${column}' names no Sheet column.`);\n return { row, column, text: shownTextOf(sheet, new CellAddress(row, sheetColumn)) };\n });\n return findAllPage(ordinals.length, matches, rowSequenceVersion);\n}\n\n/**\n * Every cell of every Sheet of `sheets` that matches `pattern` (ADR-0470 \u00A77), Excel's Find All Within: Workbook: in tab\n * order from the first Sheet, each Sheet by rows and across a row from column A. Held as each match's Sheet and the\n * cell's ordinal in row-major order, so millions of matches hold no object each; the Selection is no scope here, as it\n * is none for a step over the Workbook.\n */\nexport class SheetWorkbookMatches {\n readonly #sheets: readonly Sheet[];\n readonly #sheetOf: readonly number[];\n readonly #ordinals: readonly number[];\n\n constructor(sheets: readonly Sheet[], pattern: GridFindPattern) {\n const sheetOf: number[] = [];\n const ordinals: number[] = [];\n if (pattern.text !== '') {\n sheets.forEach((sheet, index) => {\n const found: number[] = [];\n for (const address of sheet.entryAddresses) {\n if (sheetCellMatches(sheet, address, pattern)) found.push((address.row * Sheet.columnCount) + address.column);\n }\n found.sort((a, b) => a - b);\n for (const ordinal of found) {\n sheetOf.push(index);\n ordinals.push(ordinal);\n }\n });\n }\n this.#sheets = sheets;\n this.#sheetOf = sheetOf;\n this.#ordinals = ordinals;\n }\n\n /** How many cells match. */\n get count(): number {\n return this.#ordinals.length;\n }\n\n /** Match `index`: its Sheet and its cell. */\n at(index: number): { readonly sheet: Sheet; readonly address: CellAddress } {\n const sheetIndex = this.#sheetOf[index];\n const ordinal = this.#ordinals[index];\n const sheet = sheetIndex === undefined ? undefined : this.#sheets[sheetIndex];\n if (sheet === undefined || ordinal === undefined) throw new RangeError(`The Workbook's Find All holds ${String(this.count)} matches, not one at ${String(index)}.`);\n return { sheet, address: new CellAddress(Math.floor(ordinal / Sheet.columnCount), ordinal % Sheet.columnCount) };\n }\n}\n\n/** Where a step over the Workbook found its match: the Sheet, the row and the column's place among the request's\n * columns. */\nexport interface SheetWorkbookMatch {\n readonly sheet: Sheet;\n readonly row: number;\n readonly position: number;\n}\n\n/**\n * One step over every Sheet of `sheets` (ADR-0331 \u00A78, ADR-0332 \u00A75), as Excel's Within: Workbook steps, C#'s\n * StepWorkbook: from the cell after the Focus to the end of `shown` (before it to its start, backward), then each\n * other Sheet whole in tab order (the reverse, backward), wrapping past the last, and then `shown` again up to the\n * Focus, which is considered last. Each Sheet is walked by rows across the request's columns, as a step over one is.\n * The Selection is no scope here. Answers `undefined` when nothing matches anywhere.\n */\nexport function sheetFindStepWorkbook(sheets: readonly Sheet[], shown: Sheet, request: GridFindRequest): SheetWorkbookMatch | undefined {\n if (request.text === '' || request.columns.length === 0) return undefined;\n const positions = positionsOf(request.columns);\n const columnCount = request.columns.length;\n const total = Sheet.rowCount * columnCount;\n const { backward, from } = request;\n const start = from !== undefined && from.row >= 0 && from.row < Sheet.rowCount && from.column >= 0 && from.column < columnCount\n ? (from.row * columnCount) + from.column\n : backward ? total : -1;\n const nearest = (sheet: Sheet, admit: (ordinal: number) => boolean): SheetWorkbookMatch | undefined => {\n let best = backward ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;\n let found: SheetWorkbookMatch | undefined;\n for (const address of sheet.entryAddresses) {\n const position = positions.get(address.column);\n if (position === undefined) continue;\n const ordinal = (address.row * columnCount) + position;\n if ((backward ? ordinal <= best : ordinal >= best) || !admit(ordinal) || !sheetCellMatches(sheet, address, request)) continue;\n best = ordinal;\n found = { sheet, row: address.row, position };\n }\n return found;\n };\n // The Sheet shown, past the Focus.\n const here = nearest(shown, ordinal => backward ? ordinal < start : ordinal > start);\n if (here !== undefined) return here;\n // Every other Sheet whole, in tab order from the one shown, wrapping.\n const at = sheets.indexOf(shown);\n if (at < 0) throw new Error('Internal: the Sheet shown is not one of the Workbook\\'s.');\n for (let k = 1; k < sheets.length; k++) {\n const sheet = sheets[(((at + (backward ? -k : k)) % sheets.length) + sheets.length) % sheets.length];\n if (sheet === undefined) throw new Error('Internal: a Sheet index fell outside the Workbook.');\n const there = nearest(sheet, () => true);\n if (there !== undefined) return there;\n }\n // The Sheet shown again, up to the Focus, which is considered last.\n return nearest(shown, ordinal => backward ? ordinal >= start : ordinal <= start);\n}\n\n/** Whether the cell at `address` matches `pattern` as a step finds it: a cell that holds an Entry, whose shown text\n * matches by the core's rule. The Match Mark judges the painted cells by it (ADR-0332 \u00A74), handing the text the row\n * already holds as `shown`. */\nexport function sheetCellMatches(sheet: Sheet, address: CellAddress, pattern: GridFindPattern, shown?: string): boolean {\n return sheet.getEntry(address) !== undefined && findMatches(shown ?? shownTextOf(sheet, address), pattern);\n}\n\n/** One cell a Replace All writes: its address and the text it is entered with. */\nexport interface SheetReplaceWrite {\n readonly address: CellAddress;\n readonly text: string;\n}\n\n/** One cell a Replace All cannot write, and why; `position` is its column's place among the request's columns. */\nexport interface SheetReplaceRefusal {\n readonly address: CellAddress;\n readonly position: number;\n readonly reason: string;\n}\n\n/** What a Replace All writes, or the cells that refuse it all. */\nexport interface SheetReplacePlan {\n readonly writes: readonly SheetReplaceWrite[];\n readonly refused: readonly SheetReplaceRefusal[];\n}\n\n/**\n * What a Replace All writes over `sheet` (ADR-0332 \u00A72): every cell whose Entry, the text the Cell Editor opens with,\n * matches `pattern`, with the match replaced, by rows; inside `scope` and the columns `positions` names. A replaced\n * text that is a Formula the engine cannot read is refused with the reason `judge` gives, as a typed one is: then\n * nothing may be written, and every such cell is named.\n */\nexport function planSheetReplace(\n sheet: Sheet, pattern: GridFindPattern, replacement: string, positions: ReadonlyMap<number, number>,\n scope: readonly SelectionRange[] | undefined, judge: (address: CellAddress, text: string) => string | undefined,\n): SheetReplacePlan {\n const writes: SheetReplaceWrite[] = [];\n const refused: SheetReplaceRefusal[] = [];\n if (pattern.text === '') return { writes, refused };\n // In row-major order, as the engine gives them.\n for (const address of sheet.entryAddresses) {\n const position = positions.get(address.column);\n if (position === undefined) continue;\n if (scope !== undefined && !inScope(scope, address.row, position)) continue;\n const text = replacedEntry(sheet.getEntryText(address), pattern, replacement);\n if (text === undefined) continue;\n const reason = judge(address, text);\n if (reason === undefined) writes.push({ address, text });\n else refused.push({ address, position, reason });\n }\n return { writes, refused };\n}\n\n/** One cell a Replace All over the Workbook writes, or refuses, on the Sheet it lies on. */\nexport interface SheetWorkbookReplaceCell {\n readonly sheet: Sheet;\n readonly address: CellAddress;\n readonly text: string;\n}\n\n/** What a Replace All over the Workbook writes, or the cells that refuse it all, with the reason each gives. */\nexport interface SheetWorkbookReplacePlan {\n readonly writes: readonly SheetWorkbookReplaceCell[];\n readonly refused: readonly (SheetWorkbookReplaceCell & { readonly reason: string })[];\n}\n\n/**\n * What a Replace All over every Sheet of `sheets` writes (ADR-0332 \u00A75), C#'s PlanReplace over the Workbook: every\n * cell of every column whose Entry matches `pattern`, with the match replaced, in the order of the Sheets and then\n * by rows. A replaced text that is a Formula the engine cannot read is refused with the reason `judge` gives: then\n * nothing may be written, and every such cell is named.\n */\nexport function planWorkbookReplace(\n sheets: readonly Sheet[], pattern: GridFindPattern, replacement: string, judge: (sheet: Sheet, address: CellAddress, text: string) => string | undefined,\n): SheetWorkbookReplacePlan {\n const writes: SheetWorkbookReplaceCell[] = [];\n const refused: (SheetWorkbookReplaceCell & { readonly reason: string })[] = [];\n if (pattern.text === '') return { writes, refused };\n for (const sheet of sheets) {\n // In row-major order, as the engine gives them.\n for (const address of sheet.entryAddresses) {\n const text = replacedEntry(sheet.getEntryText(address), pattern, replacement);\n if (text === undefined) continue;\n const reason = judge(sheet, address, text);\n if (reason === undefined) writes.push({ sheet, address, text });\n else refused.push({ sheet, address, text, reason });\n }\n }\n return { writes, refused };\n}\n\n/** Where each Sheet column stands among `columns`; a column they do not name is not searched. */\nexport function positionsOf(columns: readonly string[]): ReadonlyMap<number, number> {\n const positions = new Map<number, number>();\n columns.forEach((name, i) => {\n const column = CellAddress.tryParseColumn(name);\n if (column !== undefined) positions.set(column, i);\n });\n return positions;\n}\n\nfunction columnName(columns: readonly string[], position: number): string {\n const name = columns[position];\n if (name === undefined) throw new Error(`Internal: no column stands at ${String(position)} of the request.`);\n return name;\n}\n\nfunction inScope(scope: readonly SelectionRange[], row: number, column: number): boolean {\n return scope.some(range => row >= range.topRow && row < range.topRow + range.rowCount\n && column >= range.leftColumn && column < range.leftColumn + range.columnCount);\n}\n", "// ExSheet's find panel (ADR-0332 \u00A75), C#'s SheetFindPanel: the grid's built-in panel, drawn by the Sheet through the\n// grid's own find panel slot, with Within added \u2014 the Sheet shown, the default, or the Workbook. Its DOM and classes\n// are the grid's built-in panel's, so ex-grid.css and layer 3 read it as they read the grid's, and the C# panel's for\n// Within. The panel decides nothing: a step, a Replace and a Replace All over the Sheet are the grid's, and over the\n// Workbook the Sheet's own; what Within is stands with the Sheet, across a close and a reopen, as the grid keeps the\n// text.\n\nimport { findPanelLabelIds, type GridChromeSlot, type GridFindPanelSlotContext } from '@ex-grid/core';\n\n/** Where the Sheet's find panel searches (ADR-0332 \u00A75): the Sheet shown, or every Sheet of the Workbook. */\nexport type SheetFindWithin = 'sheet' | 'workbook';\n\n/** The ids of the words the Sheet's find panel adds to the grid's, as C#'s SheetFindLabelIds spells them: a\n * Consumer's `commandLabel` answers them as it answers the grid's. */\nexport const sheetFindLabelIds = Object.freeze({\n /** The label of the Within choice. */\n within: 'exsheet.find-within',\n /** Within: the Sheet shown. */\n withinSheet: 'exsheet.find-within-sheet',\n /** Within: the Workbook. */\n withinWorkbook: 'exsheet.find-within-workbook',\n} as const);\n\n/** What the Sheet does for its find panel. */\nexport interface SheetFindPanelHost {\n /** Where the panel searches now. */\n readonly within: () => SheetFindWithin;\n /** A choice of Within, made in the panel: a Find All list standing goes with it (ADR-0470 \u00A75). */\n readonly chooseWithin: (within: SheetFindWithin, context: GridFindPanelSlotContext) => void;\n /** Find All pressed (ADR-0470 \u00A77): the grid's over the Sheet, the Sheet's own list over the Workbook. */\n readonly findAll: (context: GridFindPanelSlotContext) => void;\n /** Replace All pressed: the grid's over the Sheet, the Sheet's own over the Workbook. */\n readonly replaceAll: (context: GridFindPanelSlotContext) => void;\n /** What the outcome line says now: the Sheet's own Replace All's outcome while it stands, else the grid's. */\n readonly outcome: (context: GridFindPanelSlotContext) => string;\n /** Hears each change to what the Sheet's own outcome is; answers the function that stops it. */\n readonly subscribe: (listener: () => void) => () => void;\n /** The panel is mounted for a request for its field: an outcome of the Sheet's own said before it is gone. */\n readonly mounted: () => void;\n}\n\n/** The panels drawn so far, so each one's two radios are a group of their own. */\nlet panels = 0;\n\n/** The find panel slot that draws ExSheet's panel for `host`. */\nexport function sheetFindPanelSlot(host: SheetFindPanelHost): GridChromeSlot<GridFindPanelSlotContext> {\n return (slot, context) => {\n host.mounted();\n const doc = slot.ownerDocument;\n const label = context.label;\n const body = doc.createElement('div');\n body.className = 'ex-popover-find-body';\n const textField = (type: string, className: string, id: string, value: string, changed: (text: string) => void): HTMLInputElement => {\n const field = doc.createElement('input');\n field.type = type;\n field.className = className;\n field.setAttribute('aria-label', label(id));\n field.value = value;\n field.addEventListener('input', () => { changed(field.value); });\n return field;\n };\n const button = (className: string, id: string, press: () => void): HTMLButtonElement => {\n const element = doc.createElement('button');\n element.type = 'button';\n element.className = className;\n element.setAttribute('data-ex-claims', 'click');\n element.textContent = label(id);\n element.addEventListener('click', press);\n return element;\n };\n // An option's tick is a click claimed on the checkbox alone, taken in its place in the Input Order (ADR-0240):\n // a click on its words reaches the checkbox as a second click, which is the one taken.\n const option = (className: string, id: string, checked: boolean, set: (on: boolean) => void): { readonly label: HTMLLabelElement; readonly box: HTMLInputElement } => {\n const box = doc.createElement('input');\n box.type = 'checkbox';\n box.className = className;\n box.checked = checked;\n box.setAttribute('data-ex-claims', 'click');\n box.addEventListener('change', () => { set(box.checked); });\n const element = doc.createElement('label');\n element.append(box, label(id));\n return { label: element, box };\n };\n // A radio's choice is its click: a label's click, an arrow key in the group and a press all reach the radio as\n // one, claimed on the radio alone and taken in its place in the Input Order (ADR-0240), so a step numbered\n // before it searches where the panel searched then.\n panels += 1;\n const group = `ex-sheet-find-within-${String(panels)}`;\n const radio = (className: string, id: string, within: SheetFindWithin): HTMLLabelElement => {\n const input = doc.createElement('input');\n input.type = 'radio';\n input.name = group;\n input.className = className;\n input.checked = host.within() === within;\n input.setAttribute('data-ex-claims', 'click');\n input.addEventListener('change', () => { if (input.checked) host.chooseWithin(within, context); });\n const element = doc.createElement('label');\n element.append(input, label(id));\n return element;\n };\n\n let view = context.view();\n const field = textField('search', 'ex-find-field', findPanelLabelIds.field, view.text, context.setText);\n const matchCase = option('ex-find-match-case', findPanelLabelIds.matchCase, view.matchCase, context.setMatchCase);\n const wholeCell = option('ex-find-whole-cell', findPanelLabelIds.wholeCell, view.wholeCell, context.setWholeCell);\n const within = doc.createElement('fieldset');\n within.className = 'ex-sheet-find-within';\n const legend = doc.createElement('legend');\n legend.textContent = label(sheetFindLabelIds.within);\n within.append(legend,\n radio('ex-sheet-find-within-sheet', sheetFindLabelIds.withinSheet, 'sheet'),\n radio('ex-sheet-find-within-workbook', sheetFindLabelIds.withinWorkbook, 'workbook'));\n const steps = doc.createElement('div');\n steps.className = 'ex-popover-actions';\n // Find All (ADR-0470 \u00A71), before the two steps as in the grid's built-in panel, while the grid offers it.\n const findAll = button('ex-find-all-button', findPanelLabelIds.findAll, () => { host.findAll(context); });\n steps.append(findAll, button('ex-find-previous', findPanelLabelIds.previous, context.previous), button('ex-find-next', findPanelLabelIds.next, context.next));\n const outcome = doc.createElement('div');\n outcome.className = 'ex-find-outcome';\n outcome.setAttribute('role', 'status');\n body.append(field, matchCase.label, wholeCell.label, within, steps, outcome);\n\n // Replace (ADR-0332 \u00A72): the replacement and the two writes, shown while the panel offers Replace. Enter in its\n // field is still \"find next\", as in Excel's dialog.\n let replace: { readonly field: HTMLInputElement; readonly actions: HTMLElement; readonly buttons: readonly HTMLButtonElement[] } | undefined;\n const paint = (): void => {\n view = context.view();\n if (findAll.hidden === view.findAllShown) findAll.hidden = !view.findAllShown;\n if (matchCase.box.checked !== view.matchCase) matchCase.box.checked = view.matchCase;\n if (wholeCell.box.checked !== view.wholeCell) wholeCell.box.checked = view.wholeCell;\n if (view.replaceShown && replace === undefined) {\n const replaceField = textField('text', 'ex-find-replace-field', findPanelLabelIds.replaceField, view.replaceText, context.setReplaceText);\n const actions = doc.createElement('div');\n actions.className = 'ex-popover-actions';\n const buttons = [\n button('ex-find-replace', findPanelLabelIds.replace, context.replace),\n button('ex-find-replace-all', findPanelLabelIds.replaceAll, () => { host.replaceAll(context); }),\n ];\n actions.append(...buttons);\n outcome.before(replaceField, actions);\n replace = { field: replaceField, actions, buttons };\n } else if (!view.replaceShown && replace !== undefined) {\n replace.field.remove();\n replace.actions.remove();\n replace = undefined;\n }\n for (const element of replace?.buttons ?? []) element.disabled = view.replaceWaiting; // oxlint-disable-line ex-grid/no-stand-in-default -- a panel without Replace has no button to wait\n const said = host.outcome(context);\n if (outcome.textContent !== said) outcome.textContent = said;\n };\n paint();\n slot.append(body);\n const stopView = context.subscribe(paint);\n const stopOwn = host.subscribe(paint);\n // Each mount answers a request for the field: it takes the keyboard, and the core selects its text where the\n // request asks for that (FD-1).\n context.takeFocus(field, { preventScroll: true });\n return () => {\n stopView();\n stopOwn();\n body.remove();\n };\n };\n}\n", "// The Grid Source a Sheet is to ExGrid (ADR-0046, ADR-0350 section 16): 1,048,576 rows, or the Sheet Size's (ADR-0460), that are places, of which\n// it holds a Window of row instances around what the grid shows. It neither sorts nor filters: a Sheet's rows are\n// places, and its columns are not queryable. Its Row Sequence Version moves only when another Sheet is shown,\n// since that is the only time a position comes to mean another row (ADR-0011).\n\nimport {\n GridSummaryCells, type DistinctValues, type GridFilter, type GridFindAllPage, type GridFindAllRequest, type GridFindRequest, type GridFindResult, type GridSource, type GridSourceState,\n type GridSummaryRequest, type GridSummaryResult, type QueryColumn, type RowRange, type SortSpec,\n} from '@ex-grid/core';\nimport { Sheet, type SheetChange } from '@ex-grid/sheet-engine';\nimport { sheetFindAll, sheetFindStep } from './sheet-find';\nimport { SheetRow } from './sheet-row';\nimport { sheetSummaryDeclined, walkSheetSummary } from './sheet-summary';\nimport type { SheetWords } from './sheet-words';\n\n/** A Grid Source over the Sheet shown. */\nexport class SheetSource implements GridSource<SheetRow> {\n readonly #listeners = new Set<() => void>();\n #sheet: Sheet;\n #version = 0;\n // The Sheet shown under the version before, which a grid that has not yet taken the newer rows still paints.\n #before: { readonly version: number; readonly sheet: Sheet } | undefined;\n #state: GridSourceState<SheetRow>;\n\n // The Sheet's words as they stand, which say why a Selection Summary is declined over a refused cell.\n readonly #words: () => SheetWords;\n // One step's answer over the Sheet the step was asked of: the Sheet's own walk unless one is given, as a Sheet\n // searching Within the Workbook gives (ADR-0332 \u00A75).\n readonly #step: (sheet: Sheet, request: GridFindRequest) => Promise<GridFindResult>;\n\n constructor(sheet: Sheet, words: () => SheetWords,\n step: (sheet: Sheet, request: GridFindRequest) => Promise<GridFindResult> = (over, request) => Promise.resolve(sheetFindStep(over, request))) {\n this.#sheet = sheet;\n this.#words = words;\n this.#step = step;\n this.#state = this.#stateOf([], 0, 0);\n }\n\n /** The Sheet the rows are of. */\n get sheet(): Sheet { return this.#sheet; }\n\n subscribe(listener: () => void): () => void {\n this.#listeners.add(listener);\n return () => { this.#listeners.delete(listener); };\n }\n\n snapshot(): GridSourceState<SheetRow> {\n return this.#state;\n }\n\n setColumns(_columns: readonly QueryColumn<SheetRow>[]): void {\n // The columns name no Sort and no Filter here; their widths and declarations are the grid's.\n }\n\n setSorts(sorts: readonly SortSpec[]): void {\n if (sorts.length > 0) throw new Error(\"A Sheet's rows are places, and are not sorted (ADR-0046).\");\n }\n\n setFilter(filter: GridFilter | undefined): void {\n if (filter !== undefined) throw new Error(\"A Sheet's rows are places, and are not filtered (ADR-0046).\");\n }\n\n needRange(range: RowRange): Promise<void> {\n const { window, windowStart } = this.#state;\n if (range.start >= windowStart && range.start + range.count <= windowStart + window.length) return Promise.resolve();\n // A screen above and below what the grid shows, so a short scroll is answered from the rows in hand.\n const start = Math.max(0, range.start - range.count);\n const end = Math.min(this.#rowCount, range.start + 2 * range.count);\n const rows = Array.from({ length: Math.max(0, end - start) }, (_, i) => this.#rowAt(start + i));\n this.#state = this.#stateOf(rows, start, this.#version);\n // Heard after the grid's paint that asked, never inside it.\n return Promise.resolve().then(() => { this.#publish(); });\n }\n\n rows(range: RowRange, signal: AbortSignal): Promise<readonly SheetRow[]> {\n signal.throwIfAborted();\n const end = Math.min(this.#rowCount, range.start + range.count);\n return Promise.resolve(Array.from({ length: Math.max(0, end - range.start) }, (_, i) => this.#rowAt(range.start + i)));\n }\n\n // The row at `index`: the Window's instance where the Window holds it, so a row read twice is one instance\n // (ADR-0003), else a new one.\n #rowAt(index: number): SheetRow {\n const { window, windowStart } = this.#state;\n const at = index - windowStart;\n const kept = at >= 0 && at < window.length ? window[at] : undefined;\n return kept ?? new SheetRow(this.#sheet, index);\n }\n\n /** One Find step over the Sheet its Row Sequence Version names (ADR-0055): the one shown, or the one before it,\n * which a grid that has not yet taken the newer rows still paints, and whose answer it discards by the version\n * once it has. A step asked under an older version is given up, never answered \"not found\" about cells nobody\n * searched. */\n find(request: GridFindRequest, signal: AbortSignal): Promise<GridFindResult> {\n signal.throwIfAborted();\n const before = this.#before;\n const sheet = request.rowSequenceVersion === this.#version ? this.#sheet\n : request.rowSequenceVersion === before?.version ? before.sheet : undefined;\n if (sheet === undefined) return Promise.reject(new DOMException('The step was asked of a Sheet shown before the last one.', 'AbortError'));\n return this.#step(sheet, request);\n }\n\n /** A page of a Find All over the Sheet its Row Sequence Version names (ADR-0470 \u00A77), as a step is answered: the\n * one shown, or the one before it. Asked under an older version, the list named rows of a Sheet no longer shown:\n * given up, never answered about cells nobody searched. Within the Workbook, the Sheet lists the matches itself. */\n findAll(request: GridFindAllRequest, signal: AbortSignal): Promise<GridFindAllPage> {\n signal.throwIfAborted();\n const before = this.#before;\n const sheet = request.rowSequenceVersion === this.#version ? this.#sheet\n : request.rowSequenceVersion === before?.version ? before.sheet : undefined;\n if (sheet === undefined) return Promise.reject(new DOMException('The Find All was asked of a Sheet shown before the last one.', 'AbortError'));\n return Promise.resolve(sheetFindAll(sheet, request, request.rowSequenceVersion));\n }\n\n /** A Selection Summary over the Sheet its Row Sequence Version names (ADR-0130), as C#'s `SheetSummary` answers\n * one: the Values of the selected cells in Excel's doubles, the figures that read numbers written in the Focus\n * cell's Number Format, or the summary declined over the first refused cell. Asked under an older version, the\n * selection named rows of a Sheet no longer shown: given up, never answered about cells nobody read. */\n summarize(request: GridSummaryRequest, signal: AbortSignal): Promise<GridSummaryResult> {\n signal.throwIfAborted();\n const before = this.#before;\n const sheet = request.rowSequenceVersion === this.#version ? this.#sheet\n : request.rowSequenceVersion === before?.version ? before.sheet : undefined;\n if (sheet === undefined) return Promise.reject(new DOMException('The summary was asked of a Sheet shown before the last one.', 'AbortError'));\n const cells = new GridSummaryCells();\n const read = walkSheetSummary(sheet, request, cells);\n if (read.kind === 'refused') return Promise.resolve(sheetSummaryDeclined(read, this.#words()));\n // Average, Min, Max and Sum are shown in the Focus cell's Number Format, as Excel's status bar shows them in\n // the active cell's; the counts are whole numbers (read in the Windows run of 2026-10-11).\n const { focus } = read;\n return Promise.resolve(cells.answer(request.figures, focus === undefined ? undefined : figure => sheet.formatAs(focus, figure)));\n }\n\n distinctValues(_column: string, _signal: AbortSignal): Promise<DistinctValues> {\n return Promise.reject(new Error(\"A Sheet's columns are not queryable, so they offer no values to filter by (ADR-0046).\"));\n }\n\n /** Shows another Sheet, or the same Sheet read whole: every position names a row of it now, so the Row\n * Sequence Version moves (ADR-0011). */\n show(sheet: Sheet): void {\n this.#before = { version: this.#version, sheet: this.#sheet };\n this.#sheet = sheet;\n this.#version++;\n const { window, windowStart } = this.#state;\n // A Sheet Size made smaller leaves no row past it in the Window (ADR-0460).\n const rows = window.slice(0, Math.max(0, this.#rowCount - windowStart)).map((_, i) => new SheetRow(sheet, windowStart + i));\n this.#state = this.#stateOf(rows, windowStart, this.#version);\n this.#publish();\n }\n\n /** Takes what the Sheet shown changed: a new instance for every row the changes name, the same instance for\n * every other row, so only the changed rows are painted again (ADR-0003, SH-4). Answers whether any row in\n * the Window was renewed. */\n changed(changes: readonly SheetChange[]): boolean {\n const { window, windowStart } = this.#state;\n let rows: SheetRow[] | undefined;\n for (const change of changes) {\n for (const row of change.rows) {\n const at = row - windowStart;\n if (at < 0 || at >= window.length) continue;\n rows ??= [...window];\n rows[at] = new SheetRow(this.#sheet, row);\n }\n }\n if (rows === undefined) return false;\n this.#state = this.#stateOf(rows, windowStart, this.#version);\n this.#publish();\n return true;\n }\n\n /** Renews every row in the Window, so each is read again: a change the engine names no row of, such as a Linked\n * Table gone back to waiting on another Sheet's account (ADR-0049). */\n renewWindow(): void {\n const { window, windowStart } = this.#state;\n if (window.length === 0) return;\n this.#state = this.#stateOf(window.map((_, i) => new SheetRow(this.#sheet, windowStart + i)), windowStart, this.#version);\n this.#publish();\n }\n\n #publish(): void {\n // A listener may stop hearing as it hears.\n for (const listener of Array.from(this.#listeners)) listener();\n }\n\n // The rows the Sheet holds: Excel's, or the Workbook's size (ADR-0460).\n get #rowCount(): number {\n return this.#sheet.workbook.size.rows;\n }\n\n #stateOf(window: readonly SheetRow[], windowStart: number, version: number): GridSourceState<SheetRow> {\n return Object.freeze({\n window: Object.freeze(window),\n windowStart,\n totalCount: this.#rowCount,\n loading: false,\n rowSequenceVersion: version,\n sorts: Object.freeze([]),\n filter: undefined,\n });\n }\n}\n", "// ExSheet's answer to a Selection Summary (ADR-0130), the counterpart of C#'s SheetSummary: the Values of the\n// selected cells \u2014 a Formula's result, never its Entry, and every cell an array spills into. A number is in every\n// figure; text and a Boolean are counted and are never a number; an Error Value is counted, is never a number,\n// and leaves only Count and Numerical Count, as Excel's status bar does; a blank cell is in none. A date is a\n// number here, as it is in the Sheet and in Excel: a Sheet date is a serial number shown with a date format\n// (ADR-0047). It walks only the cells that hold a Value, so a whole column of a million rows is summarised in the\n// time its occupied cells take.\n//\n// A refused cell among them (`Value.isRefused`, a Refused Formula's `#VALUE!` or `#NAME?`) declines the whole\n// summary, its reason in ExSheet's words in place of the figures (2026-10-13, decided with the user: no numeric\n// figure stands over a refused cell, and the line says why). A partial summary is never shown (ADR-0130), so\n// Count goes with the rest.\n//\n// The Sheet Source's `summarize` folds the cells straight into the family's one definition of the figures,\n// `GridSummaryCells`, as they are walked.\n\nimport type { GridSummaryRequest, GridSummaryResult } from '@ex-grid/core';\nimport { CellAddress, type Sheet } from '@ex-grid/sheet-engine';\nimport type { SheetWords } from './sheet-words';\n\n/**\n * The selected cells of a Sheet as a Selection Summary reads them: the first refused cell in reading order and\n * what it shows, or the cells sorted by what they are, with the Focus cell whose Number Format the figures are\n * shown in (Excel's status bar shows them in the active cell's, read in the Windows run of 2026-10-11).\n */\nexport type SheetSummaryCells =\n | { readonly kind: 'refused'; readonly at: CellAddress; readonly shown: string }\n | {\n readonly kind: 'cells';\n /** Each number, a date's serial number among them, in Excel's double. */\n readonly numbers: readonly number[];\n /** How many cells hold an Error Value. */\n readonly errors: number;\n /** How many cells hold text or a Boolean. */\n readonly others: number;\n /** The Focus cell on the Sheet, or `undefined` where the request has none. */\n readonly focus: CellAddress | undefined;\n };\n\n/** What a walk of the selected cells folds each cell into: a number, an Error Value, or text or a Boolean. */\nexport interface SheetSummarySink {\n addNumber(value: number): void;\n addError(): void;\n addOther(): void;\n}\n\n/**\n * Walks the cells a request names over a Sheet (ADR-0130), folding each into `sink`, and answers the first refused\n * cell in reading order and what it shows, or the Focus cell whose Number Format the figures are shown in (Excel's\n * status bar shows them in the active cell's, read in the Windows run of 2026-10-11). Over a refused cell what the\n * sink holds is no summary.\n */\nexport function walkSheetSummary(sheet: Sheet, request: GridSummaryRequest, sink: SheetSummarySink):\n | { readonly kind: 'refused'; readonly at: CellAddress; readonly shown: string }\n | { readonly kind: 'cells'; readonly focus: CellAddress | undefined } {\n // Where each sheet column stands in the request's order; a column it does not name is not summarised.\n const positions = new Map<number, number>();\n request.columns.forEach((name, position) => {\n const column = CellAddress.tryParseColumn(name);\n if (column !== undefined) positions.set(column, position);\n });\n let firstRefused: CellAddress | undefined;\n for (const address of sheet.valueAddresses) {\n const position = positions.get(address.column);\n if (position === undefined || !inRanges(request, address.row, position)) continue;\n const value = sheet.getValue(address);\n if (value === undefined) continue;\n if (value.isRefused) {\n if (firstRefused === undefined || address.compareTo(firstRefused) < 0) firstRefused = address;\n continue;\n }\n switch (value.kind) {\n case 'number': sink.addNumber(value.number); break;\n case 'error': sink.addError(); break;\n case 'text':\n case 'boolean':\n sink.addOther();\n break;\n default: throw new Error(`Internal: a Value of kind ${String(value.kind)}.`);\n }\n }\n if (firstRefused !== undefined) {\n const shown = sheet.getValue(firstRefused);\n if (shown === undefined) throw new Error('Internal: a refused cell holds no Value.');\n return Object.freeze({ kind: 'refused', at: firstRefused, shown: shown.toString() });\n }\n const focus = request.focus;\n const focusName = focus === undefined ? undefined : request.columns[focus.column];\n const focusColumn = focusName === undefined ? undefined : CellAddress.tryParseColumn(focusName);\n return Object.freeze({ kind: 'cells', focus: focus === undefined || focusColumn === undefined ? undefined : new CellAddress(focus.row, focusColumn) });\n}\n\n/** The cells a request names over a Sheet, as a Selection Summary reads them (ADR-0130). */\nexport function sheetSummaryCells(sheet: Sheet, request: GridSummaryRequest): SheetSummaryCells {\n const numbers: number[] = [];\n let errors = 0;\n let others = 0;\n const walked = walkSheetSummary(sheet, request, {\n addNumber: number => { numbers.push(number); },\n addError: () => { errors++; },\n addOther: () => { others++; },\n });\n if (walked.kind === 'refused') return walked;\n return Object.freeze({ kind: 'cells', numbers: Object.freeze(numbers), errors, others, focus: walked.focus });\n}\n\n/** The Selection Summary declined over a refused cell, with the reason in the Sheet's words (2026-10-13,\n * decided with the user). */\nexport function sheetSummaryDeclined(refused: { readonly at: CellAddress; readonly shown: string }, words: SheetWords): GridSummaryResult {\n return Object.freeze({ kind: 'declined', reason: words.summaryRefused(refused.at, refused.shown) });\n}\n\n// A cell covered by two ranges is one address, visited once.\nfunction inRanges(request: GridSummaryRequest, row: number, column: number): boolean {\n return request.ranges.some(range => row >= range.topRow && row < range.topRow + range.rowCount\n && column >= range.leftColumn && column < range.leftColumn + range.columnCount);\n}\n", "// What a user types into the Name Box, read as a place on the Sheet (ADR-0051), the counterpart of C#'s\n// NameBoxText: a cell (`D200`), a range (`A1:C3`), whole columns (`B:D`) or whole rows (`5:9`), in either case,\n// with or without `$` markers, as Excel's Name Box takes them. Anything else is not an address, and nothing\n// moves. A Sheet's name may come before the address, as a Reference qualifies one (`Sheet2!B5`,\n// `'Q1 Sales'!A1:C3`), and the Name Box then goes to that Sheet (ADR-0331 \u00A75).\n\nimport { CellAddress, CellRange, columnCount, rowCount } from '@ex-grid/sheet-engine';\n\n/** A place the Name Box reads: a range, and the name of the Sheet it is on when one was typed before it. */\nexport interface NameBoxPlace {\n /** The Sheet's name as typed, a quoted one unquoted; `undefined` when none was typed, and the range is then\n * on the Sheet shown. */\n readonly sheet: string | undefined;\n /** The range. */\n readonly range: CellRange;\n}\n\n/**\n * Reads what was typed as a range, with the name of the Sheet it is on when one is typed before it; `undefined`\n * when it is not a place. A name in quotes doubles a quote inside it, as a Reference writes one.\n */\nexport function readNameBoxPlace(typed: string): NameBoxPlace | undefined {\n let text = typed.trim();\n let sheet: string | undefined;\n if (text.startsWith('\\'')) {\n let name = '';\n let i = 1;\n for (;;) {\n if (i >= text.length) return undefined;\n if (text[i] === '\\'') {\n if (text[i + 1] === '\\'') {\n name += '\\'';\n i += 2;\n continue;\n }\n break;\n }\n name += text.charAt(i);\n i++;\n }\n if (name.length === 0 || text[i + 1] !== '!') return undefined;\n sheet = name;\n text = text.slice(i + 2);\n } else {\n const bang = text.lastIndexOf('!');\n if (bang === 0) return undefined;\n if (bang > 0) {\n sheet = text.slice(0, bang);\n text = text.slice(bang + 1);\n }\n }\n const range = readNameBoxRange(text);\n return range === undefined ? undefined : Object.freeze({ sheet, range });\n}\n\n/** Reads what was typed as a range of the Sheet, or `undefined` when it is not one. */\nexport function readNameBoxRange(typed: string): CellRange | undefined {\n const text = typed.trim().replaceAll('$', '');\n if (text.length === 0) return undefined;\n const range = CellRange.tryParse(text);\n if (range !== undefined) return range;\n const colon = text.indexOf(':');\n if (colon <= 0 || colon === text.length - 1) return undefined;\n const a = text.slice(0, colon);\n const b = text.slice(colon + 1);\n const firstColumn = CellAddress.tryParseColumn(a);\n const lastColumn = CellAddress.tryParseColumn(b);\n if (firstColumn !== undefined && lastColumn !== undefined) {\n return new CellRange(new CellAddress(0, firstColumn), new CellAddress(rowCount - 1, lastColumn));\n }\n const firstRow = rowOf(a);\n const lastRow = rowOf(b);\n if (firstRow !== undefined && lastRow !== undefined) {\n return new CellRange(new CellAddress(firstRow, 0), new CellAddress(lastRow, columnCount - 1));\n }\n return undefined;\n}\n\nfunction rowOf(text: string): number | undefined {\n if (!/^[1-9][0-9]*$/u.test(text)) return undefined;\n const number = Number(text);\n return number > rowCount ? undefined : number - 1;\n}\n", "// Where Ctrl+arrow stops on a Sheet (ADR-0050, item 2), answered as Excel answers it from the Sheet's blanks,\n// the counterpart of C#'s SheetEdges. A cell is filled when it holds an Entry \u2014 a Formula whose Value is empty\n// text is filled, as in Excel \u2014 and blank otherwise; formatting alone does not fill a cell.\n//\n// - From a filled cell whose neighbour in that direction is filled: to the last filled cell of that block.\n// - Otherwise \u2014 from a blank cell, or from the last cell of a block: to the next filled cell along the line, or\n// to the Sheet's edge when there is none.\n// - At the Sheet's edge: nowhere.\n//\n// The filled cells are indexed per column and per row, each line's positions kept sorted, and kept in step with\n// every change the Sheet reports, so an answer never walks the blanks between two blocks.\n\nimport type { GridDirection } from '@ex-grid/core';\nimport { CellAddress, SheetSize, type Sheet, type SheetChange } from '@ex-grid/sheet-engine';\nimport { elementAt, unreachable } from './must';\n\n/** The first index of a sorted list whose value is at least `value`; the list's length when none is. */\nfunction lowerBound(sorted: readonly number[], value: number): number {\n let low = 0;\n let high = sorted.length;\n while (low < high) {\n const middle = (low + high) >>> 1;\n if (elementAt(sorted, middle) < value) low = middle + 1;\n else high = middle;\n }\n return low;\n}\n\nfunction holds(sorted: readonly number[], value: number): boolean {\n const at = lowerBound(sorted, value);\n return at < sorted.length && sorted[at] === value;\n}\n\n/** The index of a Sheet's filled cells, which answers where Ctrl+arrow stops (ADR-0050, item 2). */\nexport class SheetEdges {\n readonly #rowsByColumn = new Map<number, number[]>();\n readonly #columnsByRow = new Map<number, number[]>();\n\n /** The index of every filled cell of the Sheet. */\n static of(sheet: Sheet): SheetEdges {\n const edges = new SheetEdges();\n for (const address of sheet.entryAddresses) edges.#set(address, true);\n return edges;\n }\n\n /**\n * Brings the index up to date after a change the Sheet reported. Every cell that became filled or blank is\n * among the change's Value changes: a blank cell has no Value and a filled one has one.\n */\n update(sheet: Sheet, change: SheetChange): void {\n for (const address of change.valueChanges) this.#set(address, sheet.getEntry(address) !== undefined);\n }\n\n /** The cell Ctrl+arrow reaches from `from` in the direction, on a Sheet of `size`, whose edge it stops at (ADR-0460). */\n find(from: CellAddress, direction: GridDirection, size: SheetSize = SheetSize.excel): CellAddress {\n switch (direction) {\n case 'up': return new CellAddress(along(this.#rowsByColumn.get(from.column), from.row, -1, size.rows - 1), from.column);\n case 'down': return new CellAddress(along(this.#rowsByColumn.get(from.column), from.row, 1, size.rows - 1), from.column);\n case 'left': return new CellAddress(from.row, along(this.#columnsByRow.get(from.row), from.column, -1, size.columns - 1));\n case 'right': return new CellAddress(from.row, along(this.#columnsByRow.get(from.row), from.column, 1, size.columns - 1));\n default: return unreachable(direction);\n }\n }\n\n #set(address: CellAddress, filled: boolean): void {\n mark(this.#rowsByColumn, address.column, address.row, filled);\n mark(this.#columnsByRow, address.row, address.column, filled);\n }\n}\n\nfunction along(filled: readonly number[] | undefined, at: number, step: -1 | 1, last: number): number {\n let next = at + step;\n if (next < 0 || next > last) return at;\n if (filled === undefined || filled.length === 0) return step > 0 ? last : 0;\n if (holds(filled, at) && holds(filled, next)) {\n while (next + step >= 0 && next + step <= last && holds(filled, next + step)) next += step;\n return next;\n }\n // The first filled cell past this one.\n if (step > 0) {\n const beyond = lowerBound(filled, next);\n return beyond < filled.length ? elementAt(filled, beyond) : last;\n }\n const before = lowerBound(filled, next + 1) - 1;\n return before >= 0 ? elementAt(filled, before) : 0;\n}\n\nfunction mark(index: Map<number, number[]>, line: number, position: number, filled: boolean): void {\n const positions = index.get(line);\n if (filled) {\n if (positions === undefined) {\n index.set(line, [position]);\n return;\n }\n const at = lowerBound(positions, position);\n if (positions[at] !== position) positions.splice(at, 0, position);\n return;\n }\n if (positions === undefined) return;\n const at = lowerBound(positions, position);\n if (positions[at] !== position) return;\n positions.splice(at, 1);\n if (positions.length === 0) index.delete(line);\n}\n", "// The sentences and names ExSheet shows, in one place (ADR-0035: ExGrid writes no sentences of its own, and\n// ExSheet, as its Consumer, is where they come from). Every word has an id and built-in English, and a\n// Consumer replaces any of them through a label function that answers a word for an id, or `undefined` to\n// keep ExSheet's; ExSheet's Japanese is chosen in one line, `sheetWords({ japanese: true })` (ADR-0370, section\n// 10; ADR-0036 and ADR-0203 for ExGrid; ADR-0060 for ExPivot's). The words never follow the locale on their own.\n// An id is the C# member's name in camelCase, with the case after a dot where one member says several things.\n//\n// A sentence with arguments is a function of them here, and a template by its id: {0}, {1} and {2} stand for\n// its arguments in the order the function takes them, so a language that orders them otherwise moves them.\n\nimport type { CommitRefusalReason, CopyRefusalReason, EditDiscardReason, PasteRefusalReason, PlacementRefusalReason } from '@ex-grid/core';\nimport { SheetSize, type BorderLineStyle, type CellAddress, type Culture, type FormulaSyntaxError, type HorizontalAlignment, type SheetRefusal } from '@ex-grid/sheet-engine';\nimport type {\n BorderEdge, BorderPreset, ColourTarget, DisabledNumberFormatCategory, FontStyle, FormatCellsTab, NumberFormatCategory,\n PaletteSwatch, StandardColourName, ThemeColourName,\n} from './format-cells-offer';\nimport { defined, unreachable } from './must';\nimport type { PointingRefusalReason } from './pointing-refusal';\nimport { englishSheetWordTable, japaneseSheetWordTable } from './sheet-word-tables';\n\n/** Where a refused press on a grid of a Pointing Scope is worded otherwise than by its reason alone: a drag\n * that took back what its press wrote, and a column the grid no longer shows (ADR-0058). */\nexport type PointingRefusalWordCase = PointingRefusalReason | 'severalCellsTakenBack' | 'severalColumnsTakenBack' | 'columnNotHeld';\n\n/** Why Format Cells' OK cannot set what it shows, by name (ADR-0071), worded by {@link SheetWords.formatCellsRefusal}. */\nexport type FormatCellsRefusal =\n | { readonly kind: 'noNumberFormatCode' }\n | { readonly kind: 'numberFormatNotRead'; readonly code: string; readonly reason: string }\n | { readonly kind: 'notAColour'; readonly target: ColourTarget; readonly text: string };\n\n/**\n * A label of Format Cells' own under the built-in Chrome (ADR-0071): its legends, fields and buttons, worded by\n * {@link SheetWords.formatCellsLabel}.\n */\nexport type FormatCellsLabel =\n | 'tabs' | 'category' | 'generalHint' | 'textHint' | 'decimalPlaces' | 'thousandsSeparator' | 'negativeNumbers'\n | 'type' | 'codes' | 'horizontal' | 'fontStyle' | 'underline' | 'underlineNone' | 'underlineSingle'\n | 'strikethrough' | 'normalFont' | 'colour' | 'lineStyle' | 'presets' | 'border' | 'preview' | 'backgroundColour'\n | 'automatic' | 'noColour' | 'moreColours' | 'ok' | 'cancel';\n\n/** The words the Sheet's find panel adds to the grid's (ADR-0332 \u00A75): the Within choice and its two answers. */\nexport type SheetFindWithinWord = 'within' | 'withinSheet' | 'withinWorkbook';\n\n/** One of the commands of a Sheet Tab's menu (ADR-0331 \u00A74), in the order the menu offers them. */\nexport type SheetTabCommand = 'rename' | 'delete' | 'moveLeft' | 'moveRight' | 'copy';\n\n/** One of ExSheet's own Context Menu commands (ADR-0036). */\nexport type SheetContextCommand = 'insertRows' | 'deleteRows' | 'insertColumns' | 'deleteColumns' | 'formatCells';\n\n/** A command of the Sheet Toolbar's default row (ADR-0100), in Excel's Home tab order. */\nexport type SheetToolbarCommand =\n | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'fontColour' | 'fill' | 'borders' | 'alignLeft' | 'alignCenter'\n | 'alignRight' | 'numberFormat' | 'percent' | 'comma' | 'formatCells';\n\n/** A preset of the Sheet Toolbar's Borders list (ADR-0100), in Excel's order. */\nexport type SheetToolbarBorder = 'bottom' | 'top' | 'left' | 'right' | 'none' | 'all' | 'outside' | 'thickOutside';\n\n/**\n * The id of every word ExSheet shows: stable, so a Consumer's label function can answer it. An id with a\n * reason or a name in it takes the reason or the name as the union beside it spells it.\n */\nexport type SheetWordId =\n | 'formulaUnreadable' | 'addressUnreadable' | 'addressPastEdge' | 'sheetNotNamed' | 'editIsOpen' | 'selectionMoved' | 'focusFormatChanged'\n | 'saveWhileEditing' | 'opening' | 'openWhileEditing' | 'opened'\n | 'openingCancelled' | 'openingRefused' | 'openingAlreadyLanded'\n | 'openingNothingToCancel' | 'editDiscardedByOpening' | 'formatKeyWhileEditing'\n | 'structureKeyWhileEditing.insert' | 'structureKeyWhileEditing.delete'\n | 'structureKeyNeedsWholeRowsOrColumns.insert' | 'structureKeyNeedsWholeRowsOrColumns.delete'\n | 'toolbarName' | 'toolbarWhileEditing' | 'toolbar.row.home' | 'toolbar.withShortcut' | `toolbar.item.${SheetToolbarCommand}` | 'toolbar.more' | 'toolbar.automatic' | 'toolbar.noFill'\n | `toolbar.border.${SheetToolbarBorder}` | 'toolbar.moreNumberFormats' | 'sheetTabsName' | 'editSheetGone'\n | 'sheetSwitchWhileEditing' | 'sheetOperationWhileEditing' | 'sheetAdded'\n | 'sheetRenamed' | 'sheetDeleted' | 'sheetMoved' | 'sheetCopied'\n | 'sheetNotRenamed' | 'newSheetName' | 'sheetNameField' | 'sheetMenuName' | `tabCommand.${SheetTabCommand}`\n | 'onlySheet' | 'sheetGone' | 'sheetNotChanged' | 'firstSheet'\n | 'lastSheet' | 'commaStyleUnread' | 'editDiscardedByNewDocument'\n | `editDiscarded.${EditDiscardReason}`\n | 'pasteReadsDifferently' | 'pasteRefusedFormula' | 'summaryRefused'\n | 'pasteTooNarrowToShow'\n | `pasteRefused.${PasteRefusalReason}`\n | `commitRefused.${CommitRefusalReason}`\n | `placementRefused.${PlacementRefusalReason}`\n | 'overwritten'\n | `copyRefused.${CopyRefusalReason}`\n | `pointingRefused.${PointingRefusalWordCase}`\n | 'pointingExtendedByKey' | 'nothingToUndo' | 'nothingToRedo'\n | `command.${SheetContextCommand}` | `find.${SheetFindWithinWord}` | 'formatCellsTitle'\n | `formatCells.tab.${FormatCellsTab}`\n | `formatCells.category.${NumberFormatCategory}`\n | `formatCells.disabled.${DisabledNumberFormatCategory}`\n | 'formatCells.noNumberFormatCode' | 'formatCells.numberFormatNotRead'\n | 'formatCells.notAColour'\n | `formatCells.alignment.${HorizontalAlignment}`\n | `formatCells.fontStyle.${FontStyle}`\n | `formatCells.edge.${BorderEdge}`\n | `formatCells.preset.${BorderPreset}`\n | `formatCells.lineStyle.${BorderLineStyle}`\n | `formatCells.colour.${ThemeColourName | StandardColourName}`\n | 'formatCells.colourDarker' | 'formatCells.colourLighter' | 'formatCells.colourStep'\n | `formatCells.label.${FormatCellsLabel}` | 'formatCells.symbol';\n\n/**\n * A Consumer's word for an id, or `undefined` to keep ExSheet's own (its Japanese where that was chosen, else\n * its English). `english` is the id's English as a template: where it has `{0}` (and `{1}`, `{2}`), the word\n * answered is a template too, its arguments put in where it names them, so a language that orders them\n * otherwise moves them.\n */\nexport type SheetLabel = (id: SheetWordId, english: string) => string | undefined;\n\n/** How a Sheet's words are chosen (ADR-0370, section 10): ExSheet's English, or its Japanese in one line, and\n * the Consumer's label over either. */\nexport interface SheetWordsChoice {\n /** ExSheet's Japanese in place of its English: Excel Japanese edition's words where Excel shows the same\n * thing (`\u30BB\u30EB\u306E\u66F8\u5F0F\u8A2D\u5B9A`, `\u8868\u793A\u5F62\u5F0F`, `\u30E6\u30FC\u30B6\u30FC\u5B9A\u7FA9`), and the family's own elsewhere. Never chosen by the\n * locale or the browser's language. */\n readonly japanese?: boolean | undefined;\n /** The Consumer's word for any id, which wins over ExSheet's. */\n readonly label?: SheetLabel | undefined;\n}\n\n/** Every id ExSheet has a word for: what a Consumer replaces to give ExSheet another language. */\nexport function sheetWordIdList(): readonly SheetWordId[] {\n // The table's keys are the union's members, which the table's type holds it to.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- Object.keys widens a Record's keys to string\n return Object.freeze(Object.keys(englishSheetWordTable) as SheetWordId[]);\n}\n\n/** Puts the arguments into a template: `{n}` is the n-th argument. A template that names an argument the\n * sentence does not have is refused, rather than shown with the placeholder standing in it. */\nfunction fill(id: SheetWordId, template: string, args: readonly string[]): string {\n return template.replaceAll(/\\{(\\d+)\\}/gu, (placeholder, index: string) => {\n const arg = args[Number(index)];\n if (arg === undefined) {\n throw new RangeError(`The word for '${id}' names ${placeholder}, and the sentence has ${args.length} argument(s).`);\n }\n return arg;\n });\n}\n\n/** A Sheet's words, chosen once: ExSheet's English, or its Japanese, with the Consumer's label over either\n * (ADR-0370, section 10). */\nexport function sheetWords(choice: SheetWordsChoice = {}): SheetWords {\n return new SheetWords(choice);\n}\n\n/**\n * The words ExSheet shows, each through the Consumer's label function, else ExSheet's own (ADR-0370,\n * section 10). Its members are named as the C# package's SheetWords names them: a sentence that says something\n * of the moment is a function of what it names, and its arguments are put into the template its id answers.\n */\nexport class SheetWords {\n readonly #label: SheetLabel | undefined;\n readonly #own: Readonly<Record<SheetWordId, string>>;\n\n /** The words as `choice` chooses them; none is ExSheet's English throughout. */\n constructor(choice: SheetWordsChoice = {}) {\n const { japanese, label } = choice;\n if (label !== undefined && typeof label !== 'function') {\n throw new TypeError('A Sheet\\'s label is a function of a word\\'s id and its English, answering its words or undefined.');\n }\n if (japanese !== undefined && typeof japanese !== 'boolean') throw new TypeError('japanese is true or false.');\n this.#label = label;\n this.#own = japanese === true ? japaneseSheetWordTable : englishSheetWordTable;\n }\n\n /** The word for an id: the label's, else ExSheet's own. A template is returned as it is. */\n word(id: SheetWordId): string {\n const words: unknown = this.#label?.(id, englishSheetWordTable[id]);\n if (words === undefined) return this.#own[id];\n if (typeof words !== 'string') {\n throw new TypeError(`The label answered ${typeof words} for '${id}': it answers a word, or undefined for ExSheet's own.`);\n }\n return words;\n }\n\n #say(id: SheetWordId, ...args: readonly string[]): string {\n return fill(id, this.word(id), args);\n }\n\n /** A Formula the engine could not read, with where and why: `This Formula cannot be read at character 4: \u2026`. */\n formulaUnreadable(error: FormulaSyntaxError): string {\n return this.#say('formulaUnreadable', String(error.position + 1), error.reason);\n }\n\n /** What was typed into the Name Box is not a place on the Sheet (ADR-0051). */\n addressUnreadable(typed: string): string {\n return this.#say('addressUnreadable', typed);\n }\n\n /** What was typed into the Name Box is a place past the Sheet Size, whose last cell is `edge` (ADR-0460). */\n addressPastEdge(typed: string, edge: CellAddress): string {\n return this.#say('addressPastEdge', typed, edge.toString());\n }\n\n /** A refusal of the engine's, in its own words: the engine's refusals carry no id yet. */\n refused(refusal: SheetRefusal): string {\n return refusal.message;\n }\n\n /** A command over a Workbook of several Sheets that names none (ADR-0331 \u00A76): taken against the Sheet\n * shown, its outcome would depend on whether a press on a tab reached the instance first. */\n sheetNotNamed(sheets: number): string {\n return this.#say('sheetNotNamed', String(sheets));\n }\n\n /** A change refused while a cell is being edited. */\n get editIsOpen(): string {\n return this.word('editIsOpen');\n }\n\n /** A change made from the Focus cell's format away from the Sheet, refused because the Selection moved before it\n * was set (ADR-0100). */\n get selectionMoved(): string {\n return this.word('selectionMoved');\n }\n\n /** Such a change, refused because the Focus cell's format changed before it was set (ADR-0100). */\n get focusFormatChanged(): string {\n return this.word('focusFormatChanged');\n }\n\n /** A save refused while a cell is being edited (ADR-0330 \u00A710): it would quietly lack what is being typed. */\n get saveWhileEditing(): string {\n return this.word('saveWhileEditing');\n }\n\n /** An opening under way, said once as it starts (ADR-0330 \u00A710, ADR-0240 \u00A712). */\n get opening(): string {\n return this.word('opening');\n }\n\n /** An opening refused while a cell is being edited (ADR-0330 \u00A710, ADR-0048). */\n get openWhileEditing(): string {\n return this.word('openWhileEditing');\n }\n\n /** A file opened. */\n get opened(): string {\n return this.word('opened');\n }\n\n /** An opening cancelled. */\n get openingCancelled(): string {\n return this.word('openingCancelled');\n }\n\n /** An opening refused, with the reason the file was refused for. */\n openingRefused(reason: string): string {\n return this.#say('openingRefused', reason);\n }\n\n /** The Escape that found the opening landed (ADR-0240 \u00A712). */\n get openingAlreadyLanded(): string {\n return this.word('openingAlreadyLanded');\n }\n\n /** An Escape that found the opening over, refused or cancelled already: said, never swallowed (ADR-0240 \u00A712). */\n get openingNothingToCancel(): string {\n return this.word('openingNothingToCancel');\n }\n\n /** What was typed, thrown away by a file opened during the edit. */\n get editDiscardedByOpening(): string {\n return this.word('editDiscardedByOpening');\n }\n\n /** A formatting key while an edit is open (ADR-0071): Excel formats the selected characters there, and a\n * Cell Format is per cell. */\n get formatKeyWhileEditing(): string {\n return this.word('formatKeyWhileEditing');\n }\n\n /** An insert or delete key while an edit is open (ADR-0050 item 14, 2026-10-02). */\n structureKeyWhileEditing(insert: boolean): string {\n return this.word(insert ? 'structureKeyWhileEditing.insert' : 'structureKeyWhileEditing.delete');\n }\n\n /** An insert or delete key over a Selection of neither whole rows nor whole columns (ADR-0050 item 14,\n * 2026-10-02): Excel shifts cells there, and ExSheet shifts none. */\n structureKeyNeedsWholeRowsOrColumns(insert: boolean): string {\n return this.word(insert ? 'structureKeyNeedsWholeRowsOrColumns.insert' : 'structureKeyNeedsWholeRowsOrColumns.delete');\n }\n\n /** The Sheet Toolbar's accessible name (ADR-0100). */\n get toolbarName(): string {\n return this.word('toolbarName');\n }\n\n /** The Sheet Toolbar's default row, Excel's Home tab (ADR-0100). */\n get toolbarHomeRow(): string {\n return this.word('toolbar.row.home');\n }\n\n /** A Toolbar Item's name (ADR-0100): `Bold`. */\n toolbarItem(command: SheetToolbarCommand): string {\n return this.word(`toolbar.item.${command}`);\n }\n\n /** A Toolbar Item's tooltip, its name with its key (ADR-0100): `Bold (Ctrl+B)`. */\n toolbarItemWithShortcut(name: string, shortcut: string): string {\n return this.#say('toolbar.withShortcut', name, shortcut);\n }\n\n /** A split control's arrow, which opens its list: `Borders, more`. */\n toolbarMore(name: string): string {\n return this.#say('toolbar.more', name);\n }\n\n /** The Font Colour list's first choice, which takes the colour away: Excel's Automatic. */\n get toolbarAutomatic(): string {\n return this.word('toolbar.automatic');\n }\n\n /** The Fill Colour list's first choice, which takes the fill away: Excel's No Fill. */\n get toolbarNoFill(): string {\n return this.word('toolbar.noFill');\n }\n\n /** A preset of the Borders list: `Bottom Border`. */\n toolbarBorder(preset: SheetToolbarBorder): string {\n return this.word(`toolbar.border.${preset}`);\n }\n\n /** The Number Format list's last choice, which opens Format Cells: Excel's More Number Formats\u2026. */\n get toolbarMoreNumberFormats(): string {\n return this.word('toolbar.moreNumberFormats');\n }\n\n /** Why the Sheet Toolbar's items cannot be pressed while an edit is open (ADR-0100). */\n get toolbarWhileEditing(): string {\n return this.word('toolbarWhileEditing');\n }\n\n /** The Sheet Tabs' accessible name (ADR-0331). */\n get sheetTabsName(): string {\n return this.word('sheetTabsName');\n }\n\n /** An edit whose Sheet left the Workbook before it was committed. */\n get editSheetGone(): string {\n return this.word('editSheetGone');\n }\n\n /** Another Sheet not shown while a constant is being edited; a Formula shows one to point at its cells\n * (ADR-0331 \u00A75). */\n get sheetSwitchWhileEditing(): string {\n return this.word('sheetSwitchWhileEditing');\n }\n\n /** A Sheet Tab operation refused while an edit is open (ADR-0331 \u00A74). */\n get sheetOperationWhileEditing(): string {\n return this.word('sheetOperationWhileEditing');\n }\n\n /** A Sheet added, said in the Sheet's live region (ADR-0331 \u00A74). */\n sheetAdded(name: string): string {\n return this.#say('sheetAdded', name);\n }\n\n /** A Sheet renamed. */\n sheetRenamed(from: string, to: string): string {\n return this.#say('sheetRenamed', from, to);\n }\n\n /** A Sheet deleted, and how to give it back. */\n sheetDeleted(name: string): string {\n return this.#say('sheetDeleted', name);\n }\n\n /** A Sheet moved to `position`, from 1, of `count` Sheets. */\n sheetMoved(name: string, position: number, count: number): string {\n return this.#say('sheetMoved', name, String(position), String(count));\n }\n\n /** A Sheet copied, and the copy's name. */\n sheetCopied(name: string, copy: string): string {\n return this.#say('sheetCopied', name, copy);\n }\n\n /** A rename refused, with the reason. */\n sheetNotRenamed(reason: string): string {\n return this.#say('sheetNotRenamed', reason);\n }\n\n /** The name a Sheet added is offered under, before it is numbered. */\n get newSheetName(): string {\n return this.word('newSheetName');\n }\n\n /** The accessible name of the field a Sheet is renamed in. */\n get sheetNameField(): string {\n return this.word('sheetNameField');\n }\n\n /** The accessible name of a Sheet Tab's menu. */\n sheetMenuName(sheet: string): string {\n return this.#say('sheetMenuName', sheet);\n }\n\n /** Why the only Sheet cannot be deleted. */\n get onlySheet(): string {\n return this.word('onlySheet');\n }\n\n /** A Sheet that left the Workbook. */\n get sheetGone(): string {\n return this.word('sheetGone');\n }\n\n /** A Sheet Tab operation refused, with the reason. */\n sheetNotChanged(reason: string): string {\n return this.#say('sheetNotChanged', reason);\n }\n\n /** Why the first Sheet does not move before itself. */\n get firstSheet(): string {\n return this.word('firstSheet');\n }\n\n /** Why the last Sheet does not move after itself. */\n get lastSheet(): string {\n return this.word('lastSheet');\n }\n\n /** Why the Sheet Toolbar has no Comma Style (ADR-0100): it pads with `*`, as Accounting does. */\n get commaStyleUnread(): string {\n return this.word('commaStyleUnread');\n }\n\n /** What was typed, thrown away by another Sheet Document opened during the edit. */\n get editDiscardedByNewDocument(): string {\n return this.word('editDiscardedByNewDocument');\n }\n\n /** What was typed, thrown away by the grid, and why (ADR-0142). */\n editDiscarded(reason: EditDiscardReason): string {\n return this.word(`editDiscarded.${reason}`);\n }\n\n /** A pasted field that came as an invariant value and would read differently typed under the Sheet's\n * culture, which the sentence names. */\n pasteReadsDifferently(field: string, culture: Culture): string {\n return this.#say('pasteReadsDifferently', field, culture.name);\n }\n\n /**\n * A paste of a Sheet's copy that holds a cell ExSheet refused, other than this Sheet's own copy of one range\n * (ADR-0047; 2026-10-12, decided with the user: a refusal is never caught, anywhere): pasted as a value, the\n * refusal would become an Error Value a Formula can catch. `refused` is the cell it was copied from.\n */\n pasteRefusedFormula(refused: CellAddress): string {\n return this.#say('pasteRefusedFormula', refused.toString());\n }\n\n /**\n * Why the Selection Summary shows no figure over a refused cell (2026-10-13, decided with the user): the\n * first refused cell in reading order, and what it shows, `#VALUE!` or `#NAME?`.\n */\n summaryRefused(refused: CellAddress, shown: string): string {\n return this.#say('summaryRefused', refused.toString(), shown);\n }\n\n /** A pasted field that is how its source shows a value too wide for its column (`####`). */\n pasteTooNarrowToShow(field: string, at: CellAddress): string {\n return this.#say('pasteTooNarrowToShow', field, at.toString());\n }\n\n /** A paste, a fill or an entry the grid refused, in the Sheet's terms; `edge` is the Sheet's last cell, which a\n * block refused for running past it names: `XFD1048576` unless a Sheet Size is smaller (ADR-0460). */\n pasteRefused(reason: PasteRefusalReason, edge: CellAddress = SheetSize.excel.lastCell): string {\n return this.#say(`pasteRefused.${reason}`, edge.toString());\n }\n\n /** A commit refused because the row it was opened on can no longer be found (ADR-0142, LV-20): the editor\n * stands with the typing, and only Escape leaves it. */\n commitRefused(address: string, reason: CommitRefusalReason): string {\n return this.#say(`commitRefused.${reason}`, address);\n }\n\n /** A selection the Consumer asked the grid to place, refused because the rows or columns it was taken\n * against have moved since (ADR-0005): the Selection stands where it was. */\n placementRefused(reason: PlacementRefusalReason): string {\n return this.word(`placementRefused.${reason}`);\n }\n\n /** A commit that landed over a cell changed while it was being edited (ADR-0142, LV-11): what it showed when\n * editing began, and just before. */\n overwritten(address: string, seen: string, replaced: string): string {\n return this.#say('overwritten', address, seen, replaced);\n }\n\n /** A copy the grid refused, in the Sheet's terms. */\n copyRefused(reason: CopyRefusalReason): string {\n return this.word(`copyRefused.${reason}`);\n }\n\n /** What the Context Menu calls one of ExSheet's own commands (ADR-0036). */\n command(command: SheetContextCommand): string {\n return this.word(`command.${command}`);\n }\n\n /** What a Sheet Tab's menu calls one of its commands (ADR-0331 \u00A74). */\n tabCommand(command: SheetTabCommand): string {\n return this.word(`tabCommand.${command}`);\n }\n\n /** What the find panel calls Within and its two choices (ADR-0332 \u00A75). */\n findWithin(word: SheetFindWithinWord): string {\n return this.word(`find.${word}`);\n }\n\n /** Format Cells' title. */\n get formatCellsTitle(): string {\n return this.word('formatCellsTitle');\n }\n\n /**\n * What a press on a grid of a Pointing Scope, or an arrow key after one, that wrote nothing tells (ADR-0058):\n * the table, the column where one is named, and whether a drag took back what its press wrote.\n */\n pointingRefused(reason: PointingRefusalReason, table: string, column: string | undefined, tookBack: boolean): string {\n switch (reason) {\n case 'severalCells':\n return this.#say(tookBack ? 'pointingRefused.severalCellsTakenBack' : 'pointingRefused.severalCells', table);\n case 'severalColumns':\n return this.#say(tookBack ? 'pointingRefused.severalColumnsTakenBack' : 'pointingRefused.severalColumns', table);\n case 'columnNotInTable':\n return this.#say('pointingRefused.columnNotInTable', table, defined(column, 'the column a press on a column the table does not have names'));\n case 'cellNotHeld':\n return column === undefined\n ? this.#say('pointingRefused.cellNotHeld', table)\n : this.#say('pointingRefused.columnNotHeld', table, column);\n case 'headerGroup':\n case 'noKey':\n case 'blankKey':\n case 'keyIsAnError':\n case 'rowNotArrived':\n case 'tableNotDeclared':\n case 'notPointing':\n case 'dataEdge':\n return this.#say(`pointingRefused.${reason}`, table);\n default:\n return unreachable(reason);\n }\n }\n\n /** What Shift and an arrow key tell after a press on a grid of a Pointing Scope (ADR-0058): refused as a\n * range is. */\n pointingExtendedByKey(table: string): string {\n return this.#say('pointingExtendedByKey', table);\n }\n\n /** Ctrl+Z with nothing to undo. */\n get nothingToUndo(): string {\n return this.word('nothingToUndo');\n }\n\n /** Ctrl+Y with nothing to redo. */\n get nothingToRedo(): string {\n return this.word('nothingToRedo');\n }\n\n /** A Format Cells tab's name. */\n tabName(tab: FormatCellsTab): string {\n return this.word(`formatCells.tab.${tab}`);\n }\n\n /** A Number Format category's name. */\n categoryName(category: NumberFormatCategory): string {\n return this.word(`formatCells.category.${category}`);\n }\n\n /** Why a category is shown disabled (ADR-0071). */\n categoryDisabled(category: DisabledNumberFormatCategory): string {\n return this.word(`formatCells.disabled.${category}`);\n }\n\n /** A horizontal alignment's name, as the Alignment tab lists it. */\n alignmentName(alignment: HorizontalAlignment): string {\n return this.word(`formatCells.alignment.${alignment}`);\n }\n\n /** A font style's name, as the Font tab lists it. */\n fontStyleName(style: FontStyle): string {\n return this.word(`formatCells.fontStyle.${style}`);\n }\n\n /** An edge's name, as the Border tab's buttons are named. */\n edgeName(edge: BorderEdge): string {\n return this.word(`formatCells.edge.${edge}`);\n }\n\n /** A preset's name, as the Border tab lists it. */\n presetName(preset: BorderPreset): string {\n return this.word(`formatCells.preset.${preset}`);\n }\n\n /** A line style's name. */\n lineStyleName(style: BorderLineStyle): string {\n return this.word(`formatCells.lineStyle.${style}`);\n }\n\n /** A palette colour's name, as Excel's tooltip gives it: `Dark Blue, Text 2, Lighter 90%`. */\n swatchName(swatch: PaletteSwatch): string {\n const name = this.word(`formatCells.colour.${swatch.name}`);\n if (swatch.step === undefined) return name;\n const step = this.#say(\n swatch.step.shade === 'darker' ? 'formatCells.colourDarker' : 'formatCells.colourLighter',\n String(swatch.step.percent));\n return this.#say('formatCells.colourStep', name, step);\n }\n\n /** A label of Format Cells' own under the built-in Chrome: a legend, a field or a button (ADR-0071). */\n formatCellsLabel(label: FormatCellsLabel): string {\n return this.word(`formatCells.label.${label}`);\n }\n\n /** The Currency category's symbol, as the Number tab shows it: `Symbol: $`. */\n currencySymbolShown(symbol: string): string {\n return this.#say('formatCells.symbol', symbol);\n }\n\n /** Why Format Cells' OK cannot set what it shows (ADR-0071). */\n formatCellsRefusal(refusal: FormatCellsRefusal): string {\n switch (refusal.kind) {\n case 'noNumberFormatCode':\n return this.word('formatCells.noNumberFormatCode');\n case 'numberFormatNotRead':\n return this.#say('formatCells.numberFormatNotRead', refusal.code, refusal.reason);\n case 'notAColour':\n return this.#say('formatCells.notAColour', refusal.text.trim());\n default:\n return unreachable(refusal);\n }\n }\n\n /** ExSheet's English, through no label. */\n static readonly english: SheetWords = new SheetWords();\n\n /** ExSheet's English for the Selection Summary's refusal, a template: `{0}` the cell, `{1}` what it shows. */\n static readonly summaryRefusedEnglish: string = englishSheetWordTable.summaryRefused;\n}\n\n", "// The words ExSheet shows, by id (ADR-0370, section 10): its English, transcribed from the C# package's\n// SheetWords, SheetCommandIds and FormatCellsOffer, and its Japanese. A word with {0} (and {1}, {2}) is a\n// template, its arguments put in by SheetWords.\n//\n// The Japanese is Excel's Japanese edition's where Excel shows the same thing \u2014 Format Cells' tabs, categories,\n// alignments, font styles, presets and standard colours (\u30BB\u30EB\u306E\u66F8\u5F0F\u8A2D\u5B9A, \u8868\u793A\u5F62\u5F0F, \u30E6\u30FC\u30B6\u30FC\u5B9A\u7FA9, \u5916\u67A0, \u6FC3\u3044\u8D64),\n// and the tints of a theme colour as Excel's tooltip names them (\u767D + \u57FA\u672C\u8272 80%) \u2014 and the family's own\n// elsewhere. Excel's names for the 2023 Office theme's colour columns in Japanese, and for its line styles,\n// which its Border tab shows only as pictures, are not read from a Japanese Excel: they are the family's own.\n\nimport type { SheetWordId } from './sheet-words';\n\nconst editOpenThenTryAgain = 'Press Enter to commit the edit or Escape to cancel it, then try again.';\nconst japaneseEditOpenThenTryAgain = 'Enter \u30AD\u30FC\u3067\u7DE8\u96C6\u3092\u78BA\u5B9A\u3059\u308B\u304B Esc \u30AD\u30FC\u3067\u53D6\u308A\u6D88\u3057\u3066\u304B\u3089\u3001\u3082\u3046\u4E00\u5EA6\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002';\n\n/** ExSheet's English, for every id: the C# package's words, character for character. */\nexport const englishSheetWordTable: Readonly<Record<SheetWordId, string>> = Object.freeze({\n 'formulaUnreadable': \"This Formula cannot be read at character {0}: {1}\",\n 'addressUnreadable':\n \"'{0}' is not a cell address. Type an address such as D200, a range such as A1:C3, a column such as B:B or a row such as 5:5.\",\n 'addressPastEdge': \"'{0}' lies past the Sheet's edge ({1}).\",\n 'sheetNotNamed':\n \"Nothing was changed: the Workbook holds {0} Sheets, and the command names none. Name the Sheet it acts on.\",\n 'editIsOpen': `Nothing was changed: a cell is being edited. ${editOpenThenTryAgain}`,\n 'selectionMoved':\n \"Nothing was changed: the selection moved while the change was being made from its active cell. Try again on the selection as it is now.\",\n 'focusFormatChanged':\n \"Nothing was changed: the active cell's format changed while the change was being made from it. Try again on the format as it is now.\",\n 'saveWhileEditing':\n \"Nothing was saved: a cell is being edited. Press Enter to commit the edit or Escape to cancel it, then save again.\",\n 'opening': \"Opening a file. Press Escape in the Sheet to cancel.\",\n 'openWhileEditing':\n \"Nothing was opened: a cell is being edited. Press Enter to commit the edit or Escape to cancel it, then open the file again.\",\n 'opened': \"The file was opened.\",\n 'openingCancelled': \"Nothing was opened: the opening was cancelled. The Workbook is as it was.\",\n 'openingRefused': \"Nothing was opened, and the Workbook is as it was. {0}\",\n 'openingAlreadyLanded': \"The file had already opened: Escape cancelled nothing.\",\n 'openingNothingToCancel': \"There was nothing to cancel: the opening had already ended.\",\n 'editDiscardedByOpening': \"What was typed was not entered: a file was opened while the cell was being edited.\",\n 'formatKeyWhileEditing':\n `Nothing was formatted: a cell is being edited, and a format applies to whole cells, not to part of the text. ${editOpenThenTryAgain}`,\n 'structureKeyWhileEditing.insert': `Nothing was inserted: a cell is being edited. ${editOpenThenTryAgain}`,\n 'structureKeyWhileEditing.delete': `Nothing was deleted: a cell is being edited. ${editOpenThenTryAgain}`,\n 'structureKeyNeedsWholeRowsOrColumns.insert':\n \"Nothing was inserted: select whole rows (Shift+Space) or whole columns (Ctrl+Space) to insert. A Sheet does not shift cells.\",\n 'structureKeyNeedsWholeRowsOrColumns.delete':\n \"Nothing was deleted: select whole rows (Shift+Space) or whole columns (Ctrl+Space) to delete. A Sheet does not shift cells.\",\n 'toolbarName': \"Formatting\",\n 'toolbarWhileEditing': \"A cell is being edited. Press Enter to commit the edit or Escape to cancel it first.\",\n 'toolbar.row.home': \"Home\",\n 'toolbar.withShortcut': \"{0} ({1})\",\n 'toolbar.item.bold': \"Bold\",\n 'toolbar.item.italic': \"Italic\",\n 'toolbar.item.underline': \"Underline\",\n 'toolbar.item.strikethrough': \"Strikethrough\",\n 'toolbar.item.fontColour': \"Font Colour\",\n 'toolbar.item.fill': \"Fill Colour\",\n 'toolbar.item.borders': \"Borders\",\n 'toolbar.item.alignLeft': \"Align Left\",\n 'toolbar.item.alignCenter': \"Centre\",\n 'toolbar.item.alignRight': \"Align Right\",\n 'toolbar.item.numberFormat': \"Number Format\",\n 'toolbar.item.percent': \"Percent Style\",\n 'toolbar.item.comma': \"Comma Style\",\n 'toolbar.item.formatCells': \"Format Cells\",\n 'toolbar.more': \"{0}, more\",\n 'toolbar.automatic': \"Automatic\",\n 'toolbar.noFill': \"No Fill\",\n 'toolbar.border.bottom': \"Bottom Border\",\n 'toolbar.border.top': \"Top Border\",\n 'toolbar.border.left': \"Left Border\",\n 'toolbar.border.right': \"Right Border\",\n 'toolbar.border.none': \"No Border\",\n 'toolbar.border.all': \"All Borders\",\n 'toolbar.border.outside': \"Outside Borders\",\n 'toolbar.border.thickOutside': \"Thick Outside Borders\",\n 'toolbar.moreNumberFormats': \"More Number Formats\u2026\",\n 'sheetTabsName': \"Sheets\",\n 'editSheetGone': \"The edit was not committed: the Sheet it was typed on is no longer in the Workbook.\",\n 'sheetSwitchWhileEditing':\n `Another Sheet was not shown: a cell is being edited. ${editOpenThenTryAgain} While a Formula is typed, another Sheet can be shown to point at its cells.`,\n 'sheetOperationWhileEditing': `No Sheet was changed: a cell is being edited. ${editOpenThenTryAgain}`,\n 'sheetAdded': \"Sheet '{0}' was added.\",\n 'sheetRenamed': \"Sheet '{0}' was renamed '{1}'.\",\n 'sheetDeleted': \"Sheet '{0}' was deleted. Ctrl+Z gives it back.\",\n 'sheetMoved': \"Sheet '{0}' was moved to position {1} of {2}.\",\n 'sheetCopied': \"Sheet '{0}' was copied as '{1}'.\",\n 'sheetNotRenamed': \"The Sheet was not renamed: {0}\",\n 'newSheetName': \"New sheet\",\n 'sheetNameField': \"Sheet name\",\n 'sheetMenuName': \"Sheet '{0}'\",\n 'tabCommand.rename': \"Rename\",\n 'tabCommand.delete': \"Delete\",\n 'tabCommand.moveLeft': \"Move Left\",\n 'tabCommand.moveRight': \"Move Right\",\n 'tabCommand.copy': \"Copy\",\n 'onlySheet': \"A Workbook holds at least one Sheet.\",\n 'sheetGone': \"The Sheet is no longer in the Workbook.\",\n 'sheetNotChanged': \"No Sheet was changed: {0}\",\n 'firstSheet': \"The Sheet is already the first.\",\n 'lastSheet': \"The Sheet is already the last.\",\n 'commaStyleUnread':\n \"Excel's Comma Style pads each value with * to fill its column, which ExSheet does not read. Use Number with the thousands separator in Format Cells.\",\n 'editDiscardedByNewDocument':\n \"What was typed was not entered: another Sheet Document was opened while the cell was being edited.\",\n 'editDiscarded.rowLeftTheWindow':\n \"What was typed was not entered: the row being edited was scrolled too far away to be written. Go back to it and type it again.\",\n 'editDiscarded.columnsChanged': \"What was typed was not entered: the columns changed while the cell was being edited.\",\n 'editDiscarded.columnNoLongerEditable': \"What was typed was not entered: the cell stopped taking entries while it was being edited.\",\n 'editDiscarded.orderMoved':\n \"What was typed was not entered: another Sheet was shown, or another Sheet Document opened, before the typing reached the Sheet, so nothing was written.\",\n 'editDiscarded.sourceChanged':\n \"What was typed was not entered: the data the Sheet shows was replaced while it was being typed, so nothing was written.\",\n 'pasteReadsDifferently':\n \"Nothing was pasted: '{0}' came as a value no culture changes, and typed under {1} it would not read as that value.\",\n 'pasteRefusedFormula':\n \"Nothing was pasted: the copy holds {0}, whose Formula ExSheet refused because it cannot answer it as Excel does. Pasted as a value, its refusal would become an Error Value a Formula can catch. To paste its Formula, copy one range alone, without the headers, and paste it into the Sheet it was copied from.\",\n 'summaryRefused':\n \"No figures: ExSheet refused the Formula in {0} with {1} because it cannot answer it as Excel does, so a figure over it would not be Excel's.\",\n 'pasteTooNarrowToShow':\n \"Nothing was pasted: the field for {1} is '{0}', which is how the source shows a value too wide for its column. The source column was too narrow to show the value, so the value itself was not copied. Widen the column there and copy again.\",\n 'pasteRefused.emptySelection': \"Select a cell to paste into.\",\n 'pasteRefused.singleCellTarget': \"Nothing was pasted: select a range of the copied block's shape.\",\n 'pasteRefused.shapeMismatch':\n \"Nothing was pasted: the selection is not a whole multiple of the copied block. Select one cell, or a range the block repeats over exactly.\",\n 'pasteRefused.disjointTarget':\n \"Nothing was pasted: a block of several cells cannot be pasted into a selection of several ranges. Select one range.\",\n 'pasteRefused.targetNotEditable': \"Nothing was pasted: the selection covers cells that cannot be written.\",\n 'pasteRefused.tooLarge': \"Nothing was pasted: the clipboard holds more than a paste reads at once.\",\n 'pasteRefused.unreadable': \"Nothing was pasted: the clipboard could not be read. Paste again.\",\n 'pasteRefused.cancelled': \"Nothing was pasted: the paste was cancelled.\",\n 'pasteRefused.spillPastExtent': \"Nothing was pasted: the block would run past the Sheet's edge ({0}).\",\n 'pasteRefused.nothingToFillFrom': \"Nothing was filled: there is no row above the selection, or column to its left, to fill from.\",\n 'pasteRefused.multipleRanges': \"Nothing was filled: a fill works on one range. Select one range.\",\n 'pasteRefused.sourceUnavailable': \"Nothing was filled: the cells to fill from could not be read.\",\n 'pasteRefused.sourceChanged':\n \"Nothing was entered: the data the Sheet shows was replaced before it landed, so nothing was written. Select the cells again.\",\n 'pasteRefused.orderMoved':\n \"Nothing was entered: another Sheet was shown, or another Sheet Document opened, after the cells were selected, so nothing was written. Select the cells again.\",\n 'commitRefused.orderMoved':\n \"What was typed was not entered: another Sheet was shown, or another Sheet Document opened, while {0} was being edited, so nothing was written. Press Escape to leave it.\",\n 'commitRefused.rowLeftTheWindow':\n \"What was typed was not entered: the row of {0} is not among the rows the Sheet holds now. Bring it back into view and press Enter again, or press Escape to leave it.\",\n 'commitRefused.cancelled':\n \"What was typed was not entered: the edit of {0} was cancelled while it was being checked, so nothing was written.\",\n 'placementRefused.orderMoved':\n \"The selection was not moved: another Sheet was shown, or another Sheet Document opened, after it was asked for.\",\n 'placementRefused.sourceChanged':\n \"The selection was not moved: the data the Sheet shows was replaced after it was asked for.\",\n 'placementRefused.columnsMoved':\n \"The selection was not moved: the Sheet's columns changed after it was asked for.\",\n 'overwritten':\n \"{0} was entered over a change made while it was being edited: it showed {1} when editing began and {2} just before.\",\n 'copyRefused.emptySelection': \"Select the cells to copy.\",\n 'copyRefused.misalignedShape':\n \"Nothing was copied: the selected ranges do not line up into one block. Select ranges that share their rows or their columns.\",\n 'copyRefused.tooLarge': \"Nothing was copied: the selection holds more cells than a copy carries.\",\n 'copyRefused.rowsUnavailable': \"Nothing was copied: the rows of the selection could not be read.\",\n 'copyRefused.clipboardUnavailable': \"Nothing was copied: the browser refused the clipboard, which still holds what it held before.\",\n 'copyRefused.refusedByConsumer': \"Nothing was copied.\",\n 'pointingRefused.severalCells':\n \"Nothing was written: more than one cell was pressed. A Formula reads one row of '{0}' by its key, and a range of cells cannot be written.\",\n 'pointingRefused.severalCellsTakenBack':\n \"What the press wrote was taken back: the drag reached another cell. A Formula reads one row of '{0}' by its key, and a range of cells cannot be written.\",\n 'pointingRefused.severalColumns':\n \"Nothing was written: more than one column was pressed. A Formula names one column of '{0}' at a time.\",\n 'pointingRefused.severalColumnsTakenBack':\n \"What the press wrote was taken back: the drag reached another column. A Formula names one column of '{0}' at a time.\",\n 'pointingRefused.headerGroup':\n \"Nothing was written: a Header Group stands over several columns, and a Formula names one column of '{0}' at a time.\",\n 'pointingRefused.columnNotInTable': \"Nothing was written: the column '{1}' is not a column of the Linked Table '{0}'.\",\n 'pointingRefused.noKey':\n \"Nothing was written: '{0}' was declared without a key, so a Formula cannot name one of its rows. Press a column's header to read the whole column.\",\n 'pointingRefused.blankKey': \"Nothing was written: this row's key in '{0}' is blank, so a Formula cannot name the row.\",\n 'pointingRefused.keyIsAnError': \"Nothing was written: this row's key in '{0}' is an error, which a lookup never finds.\",\n 'pointingRefused.rowNotArrived': \"Nothing was written: this row has not arrived yet.\",\n 'pointingRefused.tableNotDeclared': \"Nothing was written: this Sheet has no Linked Table '{0}' declared.\",\n 'pointingRefused.notPointing':\n \"Nothing was written: the Formula no longer stood where a Reference can go when the press arrived.\",\n 'pointingRefused.dataEdge':\n \"Nothing was written: Ctrl+arrow goes to the edge of the data, and the grid holds only the rows near those it shows, so where '{0}' ends is not known. Use the arrow alone.\",\n 'pointingRefused.cellNotHeld':\n \"Nothing was written: the grid no longer holds the cell of '{0}' pointed at, so the arrow has no cell to move from. Press a cell to point again.\",\n 'pointingRefused.columnNotHeld':\n \"Nothing was written: the grid no longer shows the column '{1}' of '{0}' pointed at, so the arrow has no column to move from. Press a cell or a column's header to point again.\",\n 'pointingExtendedByKey':\n \"Nothing was written: Shift+arrow points at more than one cell. A Formula reads one row of '{0}' by its key, and a range of cells cannot be written.\",\n 'nothingToUndo': \"There is nothing to undo.\",\n 'nothingToRedo': \"There is nothing to redo.\",\n 'command.insertRows': \"Insert rows above\",\n 'command.deleteRows': \"Delete rows\",\n 'command.insertColumns': \"Insert columns to the left\",\n 'command.deleteColumns': \"Delete columns\",\n 'command.formatCells': \"Format Cells\u2026\",\n 'find.within': \"Within\",\n 'find.withinSheet': \"Sheet\",\n 'find.withinWorkbook': \"Workbook\",\n 'formatCellsTitle': \"Format Cells\",\n 'formatCells.tab.number': \"Number\",\n 'formatCells.tab.alignment': \"Alignment\",\n 'formatCells.tab.font': \"Font\",\n 'formatCells.tab.border': \"Border\",\n 'formatCells.tab.fill': \"Fill\",\n 'formatCells.category.general': \"General\",\n 'formatCells.category.number': \"Number\",\n 'formatCells.category.currency': \"Currency\",\n 'formatCells.category.accounting': \"Accounting\",\n 'formatCells.category.date': \"Date\",\n 'formatCells.category.time': \"Time\",\n 'formatCells.category.percentage': \"Percentage\",\n 'formatCells.category.fraction': \"Fraction\",\n 'formatCells.category.scientific': \"Scientific\",\n 'formatCells.category.text': \"Text\",\n 'formatCells.category.special': \"Special\",\n 'formatCells.category.custom': \"Custom\",\n 'formatCells.disabled.accounting':\n \"Accounting pads each value with * to fill its column, which ExSheet does not read. Use Currency, or type a code under Custom.\",\n 'formatCells.disabled.fraction': \"Fractions are not among the format codes ExSheet reads.\",\n 'formatCells.disabled.special':\n \"Special's formats depend on the locale, and the phone number's takes a condition, which ExSheet does not read. Type a code under Custom.\",\n 'formatCells.noNumberFormatCode': \"Type a number format code under Custom.\",\n 'formatCells.numberFormatNotRead': \"The number format '{0}' is not one ExSheet reads: {1}\",\n 'formatCells.notAColour': \"'{0}' is not a colour. Type # and six hex digits, such as #1F4E79.\",\n 'formatCells.alignment.general': \"General\",\n 'formatCells.alignment.left': \"Left\",\n 'formatCells.alignment.center': \"Centre\",\n 'formatCells.alignment.right': \"Right\",\n 'formatCells.fontStyle.regular': \"Regular\",\n 'formatCells.fontStyle.italic': \"Italic\",\n 'formatCells.fontStyle.bold': \"Bold\",\n 'formatCells.fontStyle.boldItalic': \"Bold Italic\",\n 'formatCells.edge.top': \"Top\",\n 'formatCells.edge.insideHorizontal': \"Horizontal\",\n 'formatCells.edge.bottom': \"Bottom\",\n 'formatCells.edge.left': \"Left\",\n 'formatCells.edge.insideVertical': \"Vertical\",\n 'formatCells.edge.right': \"Right\",\n 'formatCells.preset.none': \"None\",\n 'formatCells.preset.outline': \"Outline\",\n 'formatCells.preset.inside': \"Inside\",\n 'formatCells.lineStyle.none': \"None\",\n 'formatCells.lineStyle.hair': \"Hair\",\n 'formatCells.lineStyle.dotted': \"Dotted\",\n 'formatCells.lineStyle.dashDotDot': \"Dash-dot-dot\",\n 'formatCells.lineStyle.dashDot': \"Dash-dot\",\n 'formatCells.lineStyle.dashed': \"Dashed\",\n 'formatCells.lineStyle.thin': \"Thin\",\n 'formatCells.lineStyle.mediumDashDotDot': \"Medium Dash-dot-dot\",\n 'formatCells.lineStyle.slantedDashDot': \"Slanted Dash-dot\",\n 'formatCells.lineStyle.mediumDashDot': \"Medium Dash-dot\",\n 'formatCells.lineStyle.mediumDashed': \"Medium Dashed\",\n 'formatCells.lineStyle.medium': \"Medium\",\n 'formatCells.lineStyle.thick': \"Thick\",\n 'formatCells.lineStyle.double': \"Double\",\n 'formatCells.colour.background1': \"White, Background 1\",\n 'formatCells.colour.text1': \"Black, Text 1\",\n 'formatCells.colour.background2': \"Light Grey, Background 2\",\n 'formatCells.colour.text2': \"Dark Blue, Text 2\",\n 'formatCells.colour.accent1': \"Dark Teal, Accent 1\",\n 'formatCells.colour.accent2': \"Orange, Accent 2\",\n 'formatCells.colour.accent3': \"Dark Green, Accent 3\",\n 'formatCells.colour.accent4': \"Turquoise, Accent 4\",\n 'formatCells.colour.accent5': \"Plum, Accent 5\",\n 'formatCells.colour.accent6': \"Green, Accent 6\",\n 'formatCells.colour.darkRed': \"Dark Red\",\n 'formatCells.colour.red': \"Red\",\n 'formatCells.colour.orange': \"Orange\",\n 'formatCells.colour.yellow': \"Yellow\",\n 'formatCells.colour.lightGreen': \"Light Green\",\n 'formatCells.colour.green': \"Green\",\n 'formatCells.colour.lightBlue': \"Light Blue\",\n 'formatCells.colour.blue': \"Blue\",\n 'formatCells.colour.darkBlue': \"Dark Blue\",\n 'formatCells.colour.purple': \"Purple\",\n 'formatCells.colourDarker': \"Darker {0}%\",\n 'formatCells.colourLighter': \"Lighter {0}%\",\n 'formatCells.colourStep': \"{0}, {1}\",\n 'formatCells.label.tabs': \"Format Cells\",\n 'formatCells.label.category': \"Category\",\n 'formatCells.label.generalHint': \"General cells have no specific number format.\",\n 'formatCells.label.textHint': \"Text cells show what is typed, as typed.\",\n 'formatCells.label.decimalPlaces': \"Decimal places\",\n 'formatCells.label.thousandsSeparator': \"Use 1000 Separator (,)\",\n 'formatCells.label.negativeNumbers': \"Negative numbers\",\n 'formatCells.label.type': \"Type\",\n 'formatCells.label.codes': \"Codes\",\n 'formatCells.label.horizontal': \"Horizontal\",\n 'formatCells.label.fontStyle': \"Font style\",\n 'formatCells.label.underline': \"Underline\",\n 'formatCells.label.underlineNone': \"None\",\n 'formatCells.label.underlineSingle': \"Single\",\n 'formatCells.label.strikethrough': \"Strikethrough\",\n 'formatCells.label.normalFont': \"Normal font\",\n 'formatCells.label.colour': \"Colour\",\n 'formatCells.label.lineStyle': \"Style\",\n 'formatCells.label.presets': \"Presets\",\n 'formatCells.label.border': \"Border\",\n 'formatCells.label.preview': \"Preview\",\n 'formatCells.label.backgroundColour': \"Background Colour\",\n 'formatCells.label.automatic': \"Automatic\",\n 'formatCells.label.noColour': \"No Colour\",\n 'formatCells.label.moreColours': \"More Colours\",\n 'formatCells.label.ok': \"OK\",\n 'formatCells.label.cancel': \"Cancel\",\n 'formatCells.symbol': \"Symbol: {0}\",\n});\n\n/** ExSheet's Japanese, for every id. */\nexport const japaneseSheetWordTable: Readonly<Record<SheetWordId, string>> = Object.freeze({\n 'formulaUnreadable': \"\u3053\u306E\u6570\u5F0F\u306F {0} \u6587\u5B57\u76EE\u3067\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093: {1}\",\n 'addressUnreadable':\n \"'{0}' \u306F\u30BB\u30EB\u756A\u5730\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002D200 \u306E\u3088\u3046\u306A\u756A\u5730\u3001A1:C3 \u306E\u3088\u3046\u306A\u7BC4\u56F2\u3001B:B \u306E\u3088\u3046\u306A\u5217\u30015:5 \u306E\u3088\u3046\u306A\u884C\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'addressPastEdge': \"'{0}' \u306F\u30B7\u30FC\u30C8\u306E\u7AEF ({1}) \u3088\u308A\u5916\u306B\u3042\u308A\u307E\u3059\u3002\",\n 'sheetNotNamed':\n \"\u4F55\u3082\u5909\u66F4\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30D6\u30C3\u30AF\u306B\u306F {0} \u679A\u306E\u30B7\u30FC\u30C8\u304C\u3042\u308A\u3001\u30B3\u30DE\u30F3\u30C9\u306F\u3069\u306E\u30B7\u30FC\u30C8\u3082\u6307\u5B9A\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u5BFE\u8C61\u306E\u30B7\u30FC\u30C8\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'editIsOpen': `\u4F55\u3082\u5909\u66F4\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30BB\u30EB\u3092\u7DE8\u96C6\u4E2D\u3067\u3059\u3002${japaneseEditOpenThenTryAgain}`,\n 'selectionMoved':\n \"\u4F55\u3082\u5909\u66F4\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30A2\u30AF\u30C6\u30A3\u30D6 \u30BB\u30EB\u304B\u3089\u5909\u66F4\u3092\u4F5C\u3063\u3066\u3044\u308B\u9593\u306B\u9078\u629E\u7BC4\u56F2\u304C\u79FB\u52D5\u3057\u307E\u3057\u305F\u3002\u4ECA\u306E\u9078\u629E\u7BC4\u56F2\u3067\u3082\u3046\u4E00\u5EA6\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'focusFormatChanged':\n \"\u4F55\u3082\u5909\u66F4\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30A2\u30AF\u30C6\u30A3\u30D6 \u30BB\u30EB\u304B\u3089\u5909\u66F4\u3092\u4F5C\u3063\u3066\u3044\u308B\u9593\u306B\u3001\u305D\u306E\u66F8\u5F0F\u304C\u5909\u308F\u308A\u307E\u3057\u305F\u3002\u4ECA\u306E\u66F8\u5F0F\u3067\u3082\u3046\u4E00\u5EA6\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'saveWhileEditing':\n \"\u4F55\u3082\u4FDD\u5B58\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30BB\u30EB\u3092\u7DE8\u96C6\u4E2D\u3067\u3059\u3002Enter \u30AD\u30FC\u3067\u7DE8\u96C6\u3092\u78BA\u5B9A\u3059\u308B\u304B Esc \u30AD\u30FC\u3067\u53D6\u308A\u6D88\u3057\u3066\u304B\u3089\u3001\u3082\u3046\u4E00\u5EA6\u4FDD\u5B58\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'opening': \"\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u3044\u3066\u3044\u307E\u3059\u3002\u53D6\u308A\u6D88\u3059\u306B\u306F\u3001\u30B7\u30FC\u30C8\u3067 Esc \u30AD\u30FC\u3092\u62BC\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'openWhileEditing':\n \"\u4F55\u3082\u958B\u304B\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30BB\u30EB\u3092\u7DE8\u96C6\u4E2D\u3067\u3059\u3002Enter \u30AD\u30FC\u3067\u7DE8\u96C6\u3092\u78BA\u5B9A\u3059\u308B\u304B Esc \u30AD\u30FC\u3067\u53D6\u308A\u6D88\u3057\u3066\u304B\u3089\u3001\u3082\u3046\u4E00\u5EA6\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u3044\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'opened': \"\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304D\u307E\u3057\u305F\u3002\",\n 'openingCancelled': \"\u4F55\u3082\u958B\u304B\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304F\u64CD\u4F5C\u306F\u53D6\u308A\u6D88\u3055\u308C\u307E\u3057\u305F\u3002\u30D6\u30C3\u30AF\u306F\u5143\u306E\u307E\u307E\u3067\u3059\u3002\",\n 'openingRefused': \"\u4F55\u3082\u958B\u304B\u308C\u305A\u3001\u30D6\u30C3\u30AF\u306F\u5143\u306E\u307E\u307E\u3067\u3059\u3002{0}\",\n 'openingAlreadyLanded': \"\u30D5\u30A1\u30A4\u30EB\u306F\u65E2\u306B\u958B\u304B\u308C\u3066\u3044\u307E\u3057\u305F: Esc \u30AD\u30FC\u3067\u306F\u4F55\u3082\u53D6\u308A\u6D88\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\",\n 'openingNothingToCancel': \"\u53D6\u308A\u6D88\u3059\u3082\u306E\u306F\u3042\u308A\u307E\u305B\u3093\u3067\u3057\u305F: \u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304F\u64CD\u4F5C\u306F\u65E2\u306B\u7D42\u308F\u3063\u3066\u3044\u307E\u3057\u305F\u3002\",\n 'editDiscardedByOpening': \"\u5165\u529B\u3057\u305F\u5185\u5BB9\u306F\u78BA\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30BB\u30EB\u306E\u7DE8\u96C6\u4E2D\u306B\u30D5\u30A1\u30A4\u30EB\u304C\u958B\u304B\u308C\u307E\u3057\u305F\u3002\",\n 'formatKeyWhileEditing':\n `\u66F8\u5F0F\u306F\u8A2D\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30BB\u30EB\u3092\u7DE8\u96C6\u4E2D\u3067\u3059\u3002\u66F8\u5F0F\u306F\u30BB\u30EB\u5168\u4F53\u306B\u8A2D\u5B9A\u3055\u308C\u3001\u6587\u5B57\u5217\u306E\u4E00\u90E8\u306B\u306F\u8A2D\u5B9A\u3055\u308C\u307E\u305B\u3093\u3002${japaneseEditOpenThenTryAgain}`,\n 'structureKeyWhileEditing.insert': `\u4F55\u3082\u633F\u5165\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30BB\u30EB\u3092\u7DE8\u96C6\u4E2D\u3067\u3059\u3002${japaneseEditOpenThenTryAgain}`,\n 'structureKeyWhileEditing.delete': `\u4F55\u3082\u524A\u9664\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30BB\u30EB\u3092\u7DE8\u96C6\u4E2D\u3067\u3059\u3002${japaneseEditOpenThenTryAgain}`,\n 'structureKeyNeedsWholeRowsOrColumns.insert':\n \"\u4F55\u3082\u633F\u5165\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u633F\u5165\u3059\u308B\u306B\u306F\u3001\u884C\u5168\u4F53 (Shift+Space) \u307E\u305F\u306F\u5217\u5168\u4F53 (Ctrl+Space) \u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30B7\u30FC\u30C8\u3067\u306F\u30BB\u30EB\u3092\u30B7\u30D5\u30C8\u3057\u307E\u305B\u3093\u3002\",\n 'structureKeyNeedsWholeRowsOrColumns.delete':\n \"\u4F55\u3082\u524A\u9664\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u524A\u9664\u3059\u308B\u306B\u306F\u3001\u884C\u5168\u4F53 (Shift+Space) \u307E\u305F\u306F\u5217\u5168\u4F53 (Ctrl+Space) \u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30B7\u30FC\u30C8\u3067\u306F\u30BB\u30EB\u3092\u30B7\u30D5\u30C8\u3057\u307E\u305B\u3093\u3002\",\n 'toolbarName': \"\u66F8\u5F0F\u8A2D\u5B9A\",\n 'toolbarWhileEditing': \"\u30BB\u30EB\u3092\u7DE8\u96C6\u4E2D\u3067\u3059\u3002\u5148\u306B Enter \u30AD\u30FC\u3067\u7DE8\u96C6\u3092\u78BA\u5B9A\u3059\u308B\u304B\u3001Esc \u30AD\u30FC\u3067\u53D6\u308A\u6D88\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'toolbar.row.home': \"\u30DB\u30FC\u30E0\",\n 'toolbar.withShortcut': \"{0} ({1})\",\n 'toolbar.item.bold': \"\u592A\u5B57\",\n 'toolbar.item.italic': \"\u659C\u4F53\",\n 'toolbar.item.underline': \"\u4E0B\u7DDA\",\n 'toolbar.item.strikethrough': \"\u53D6\u308A\u6D88\u3057\u7DDA\",\n 'toolbar.item.fontColour': \"\u30D5\u30A9\u30F3\u30C8\u306E\u8272\",\n 'toolbar.item.fill': \"\u5857\u308A\u3064\u3076\u3057\u306E\u8272\",\n 'toolbar.item.borders': \"\u7F6B\u7DDA\",\n 'toolbar.item.alignLeft': \"\u5DE6\u63C3\u3048\",\n 'toolbar.item.alignCenter': \"\u4E2D\u592E\u63C3\u3048\",\n 'toolbar.item.alignRight': \"\u53F3\u63C3\u3048\",\n 'toolbar.item.numberFormat': \"\u8868\u793A\u5F62\u5F0F\",\n 'toolbar.item.percent': \"\u30D1\u30FC\u30BB\u30F3\u30C8 \u30B9\u30BF\u30A4\u30EB\",\n 'toolbar.item.comma': \"\u6841\u533A\u5207\u308A\u30B9\u30BF\u30A4\u30EB\",\n 'toolbar.item.formatCells': \"\u30BB\u30EB\u306E\u66F8\u5F0F\u8A2D\u5B9A\",\n 'toolbar.more': \"{0}\u3001\u305D\u306E\u4ED6\",\n 'toolbar.automatic': \"\u81EA\u52D5\",\n 'toolbar.noFill': \"\u5857\u308A\u3064\u3076\u3057\u306A\u3057\",\n 'toolbar.border.bottom': \"\u4E0B\u7F6B\u7DDA\",\n 'toolbar.border.top': \"\u4E0A\u7F6B\u7DDA\",\n 'toolbar.border.left': \"\u5DE6\u7F6B\u7DDA\",\n 'toolbar.border.right': \"\u53F3\u7F6B\u7DDA\",\n 'toolbar.border.none': \"\u67A0\u306A\u3057\",\n 'toolbar.border.all': \"\u683C\u5B50\",\n 'toolbar.border.outside': \"\u5916\u67A0\",\n 'toolbar.border.thickOutside': \"\u592A\u3044\u5916\u67A0\",\n 'toolbar.moreNumberFormats': \"\u305D\u306E\u4ED6\u306E\u8868\u793A\u5F62\u5F0F\u2026\",\n 'sheetTabsName': \"\u30B7\u30FC\u30C8\",\n 'editSheetGone': \"\u7DE8\u96C6\u306F\u78BA\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u5165\u529B\u3057\u305F\u30B7\u30FC\u30C8\u306F\u3082\u3046\u30D6\u30C3\u30AF\u306B\u3042\u308A\u307E\u305B\u3093\u3002\",\n 'sheetSwitchWhileEditing':\n `\u5225\u306E\u30B7\u30FC\u30C8\u306F\u8868\u793A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30BB\u30EB\u3092\u7DE8\u96C6\u4E2D\u3067\u3059\u3002${japaneseEditOpenThenTryAgain}\u6570\u5F0F\u306E\u5165\u529B\u4E2D\u306F\u3001\u5225\u306E\u30B7\u30FC\u30C8\u3092\u8868\u793A\u3057\u3066\u305D\u306E\u30BB\u30EB\u3092\u53C2\u7167\u3067\u304D\u307E\u3059\u3002`,\n 'sheetOperationWhileEditing': `\u30B7\u30FC\u30C8\u306F\u5909\u66F4\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30BB\u30EB\u3092\u7DE8\u96C6\u4E2D\u3067\u3059\u3002${japaneseEditOpenThenTryAgain}`,\n 'sheetAdded': \"\u30B7\u30FC\u30C8 '{0}' \u3092\u8FFD\u52A0\u3057\u307E\u3057\u305F\u3002\",\n 'sheetRenamed': \"\u30B7\u30FC\u30C8 '{0}' \u306E\u540D\u524D\u3092 '{1}' \u306B\u5909\u66F4\u3057\u307E\u3057\u305F\u3002\",\n 'sheetDeleted': \"\u30B7\u30FC\u30C8 '{0}' \u3092\u524A\u9664\u3057\u307E\u3057\u305F\u3002Ctrl+Z \u3067\u5143\u306B\u623B\u305B\u307E\u3059\u3002\",\n 'sheetMoved': \"\u30B7\u30FC\u30C8 '{0}' \u3092 {2} \u679A\u4E2D {1} \u756A\u76EE\u306B\u79FB\u52D5\u3057\u307E\u3057\u305F\u3002\",\n 'sheetCopied': \"\u30B7\u30FC\u30C8 '{0}' \u3092 '{1}' \u3068\u3057\u3066\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F\u3002\",\n 'sheetNotRenamed': \"\u30B7\u30FC\u30C8\u306E\u540D\u524D\u306F\u5909\u66F4\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: {0}\",\n 'newSheetName': \"\u65B0\u3057\u3044\u30B7\u30FC\u30C8\",\n 'sheetNameField': \"\u30B7\u30FC\u30C8\u540D\",\n 'sheetMenuName': \"\u30B7\u30FC\u30C8 '{0}'\",\n 'tabCommand.rename': \"\u540D\u524D\u306E\u5909\u66F4\",\n 'tabCommand.delete': \"\u524A\u9664\",\n 'tabCommand.moveLeft': \"\u5DE6\u3078\u79FB\u52D5\",\n 'tabCommand.moveRight': \"\u53F3\u3078\u79FB\u52D5\",\n 'tabCommand.copy': \"\u30B3\u30D4\u30FC\",\n 'onlySheet': \"\u30D6\u30C3\u30AF\u306B\u306F\u5C11\u306A\u304F\u3068\u3082 1 \u679A\u306E\u30B7\u30FC\u30C8\u304C\u5FC5\u8981\u3067\u3059\u3002\",\n 'sheetGone': \"\u305D\u306E\u30B7\u30FC\u30C8\u306F\u3082\u3046\u30D6\u30C3\u30AF\u306B\u3042\u308A\u307E\u305B\u3093\u3002\",\n 'sheetNotChanged': \"\u30B7\u30FC\u30C8\u306F\u5909\u66F4\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: {0}\",\n 'firstSheet': \"\u3053\u306E\u30B7\u30FC\u30C8\u306F\u65E2\u306B\u5148\u982D\u306B\u3042\u308A\u307E\u3059\u3002\",\n 'lastSheet': \"\u3053\u306E\u30B7\u30FC\u30C8\u306F\u65E2\u306B\u672B\u5C3E\u306B\u3042\u308A\u307E\u3059\u3002\",\n 'commaStyleUnread':\n \"Excel \u306E\u6841\u533A\u5207\u308A\u30B9\u30BF\u30A4\u30EB\u306F\u5404\u5024\u3092 * \u3067\u57CB\u3081\u3066\u5217\u5E45\u3044\u3063\u3071\u3044\u306B\u8868\u793A\u3057\u307E\u3059\u304C\u3001ExSheet \u306F\u3053\u308C\u3092\u8AAD\u307F\u53D6\u308A\u307E\u305B\u3093\u3002\u30BB\u30EB\u306E\u66F8\u5F0F\u8A2D\u5B9A\u3067\u3001\u6841\u533A\u5207\u308A\u3092\u4F7F\u7528\u3059\u308B [\u6570\u5024] \u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'editDiscardedByNewDocument':\n \"\u5165\u529B\u3057\u305F\u5185\u5BB9\u306F\u78BA\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30BB\u30EB\u306E\u7DE8\u96C6\u4E2D\u306B\u5225\u306E\u30B7\u30FC\u30C8 \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u304C\u958B\u304B\u308C\u307E\u3057\u305F\u3002\",\n 'editDiscarded.rowLeftTheWindow':\n \"\u5165\u529B\u3057\u305F\u5185\u5BB9\u306F\u78BA\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u7DE8\u96C6\u4E2D\u306E\u884C\u304C\u3001\u66F8\u304D\u8FBC\u3081\u306A\u3044\u307B\u3069\u9060\u304F\u307E\u3067\u30B9\u30AF\u30ED\u30FC\u30EB\u3055\u308C\u307E\u3057\u305F\u3002\u305D\u306E\u884C\u306B\u623B\u3063\u3066\u3001\u3082\u3046\u4E00\u5EA6\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'editDiscarded.columnsChanged': \"\u5165\u529B\u3057\u305F\u5185\u5BB9\u306F\u78BA\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30BB\u30EB\u306E\u7DE8\u96C6\u4E2D\u306B\u5217\u304C\u5909\u308F\u308A\u307E\u3057\u305F\u3002\",\n 'editDiscarded.columnNoLongerEditable': \"\u5165\u529B\u3057\u305F\u5185\u5BB9\u306F\u78BA\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u7DE8\u96C6\u4E2D\u306B\u30BB\u30EB\u304C\u5165\u529B\u3092\u53D7\u3051\u4ED8\u3051\u306A\u304F\u306A\u308A\u307E\u3057\u305F\u3002\",\n 'editDiscarded.orderMoved':\n \"\u5165\u529B\u3057\u305F\u5185\u5BB9\u306F\u78BA\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u5165\u529B\u304C\u30B7\u30FC\u30C8\u306B\u5C4A\u304F\u524D\u306B\u5225\u306E\u30B7\u30FC\u30C8\u304C\u8868\u793A\u3055\u308C\u305F\u304B\u3001\u5225\u306E\u30B7\u30FC\u30C8 \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u304C\u958B\u304B\u308C\u305F\u305F\u3081\u3001\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\",\n 'editDiscarded.sourceChanged':\n \"\u5165\u529B\u3057\u305F\u5185\u5BB9\u306F\u78BA\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u5165\u529B\u4E2D\u306B\u30B7\u30FC\u30C8\u304C\u8868\u793A\u3059\u308B\u30C7\u30FC\u30BF\u304C\u7F6E\u304D\u63DB\u3048\u3089\u308C\u305F\u305F\u3081\u3001\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\",\n 'pasteReadsDifferently':\n \"\u4F55\u3082\u8CBC\u308A\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F: '{0}' \u306F\u3069\u306E\u30AB\u30EB\u30C1\u30E3\u3067\u3082\u5909\u308F\u3089\u306A\u3044\u5024\u3068\u3057\u3066\u5C4A\u304D\u307E\u3057\u305F\u304C\u3001{1} \u3067\u5165\u529B\u3059\u308B\u3068\u305D\u306E\u5024\u3068\u3057\u3066\u8AAD\u307F\u53D6\u3089\u308C\u307E\u305B\u3093\u3002\",\n 'pasteRefusedFormula':\n \"\u4F55\u3082\u8CBC\u308A\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30B3\u30D4\u30FC\u306B\u306F {0} \u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u304C\u3001\u305D\u306E\u6570\u5F0F\u306F Excel \u3068\u540C\u3058\u3088\u3046\u306B\u7B54\u3048\u3089\u308C\u306A\u3044\u305F\u3081\u3001ExSheet \u304C\u62D2\u5426\u3057\u307E\u3057\u305F\u3002\u5024\u3068\u3057\u3066\u8CBC\u308A\u4ED8\u3051\u308B\u3068\u3001\u305D\u306E\u62D2\u5426\u304C\u6570\u5F0F\u3067\u6355\u6349\u3067\u304D\u308B\u30A8\u30E9\u30FC\u5024\u306B\u306A\u3063\u3066\u3057\u307E\u3044\u307E\u3059\u3002\u6570\u5F0F\u3092\u8CBC\u308A\u4ED8\u3051\u308B\u306B\u306F\u30011 \u3064\u306E\u7BC4\u56F2\u3060\u3051\u3092\u898B\u51FA\u3057\u306A\u3057\u3067\u30B3\u30D4\u30FC\u3057\u3001\u30B3\u30D4\u30FC\u5143\u306E\u30B7\u30FC\u30C8\u306B\u8CBC\u308A\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'summaryRefused':\n \"\u96C6\u8A08\u306A\u3057: {0} \u306E\u6570\u5F0F\u306F Excel \u3068\u540C\u3058\u3088\u3046\u306B\u7B54\u3048\u3089\u308C\u306A\u3044\u305F\u3081\u3001ExSheet \u304C {1} \u3067\u62D2\u5426\u3057\u307E\u3057\u305F\u3002\u305D\u306E\u4E0A\u306E\u96C6\u8A08\u306F Excel \u306E\u5024\u306B\u306A\u3089\u306A\u3044\u305F\u3081\u3001\u8868\u793A\u3057\u307E\u305B\u3093\u3002\",\n 'pasteTooNarrowToShow':\n \"\u4F55\u3082\u8CBC\u308A\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F: {1} \u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u306F '{0}' \u3067\u3001\u3053\u308C\u306F\u30B3\u30D4\u30FC\u5143\u304C\u5217\u5E45\u306B\u53CE\u307E\u3089\u306A\u3044\u5024\u3092\u8868\u793A\u3059\u308B\u5F62\u3067\u3059\u3002\u30B3\u30D4\u30FC\u5143\u306E\u5217\u5E45\u304C\u72ED\u3059\u304E\u3066\u5024\u3092\u8868\u793A\u3067\u304D\u306A\u304B\u3063\u305F\u305F\u3081\u3001\u5024\u305D\u306E\u3082\u306E\u306F\u30B3\u30D4\u30FC\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u30B3\u30D4\u30FC\u5143\u306E\u5217\u5E45\u3092\u5E83\u3052\u3066\u304B\u3089\u3001\u3082\u3046\u4E00\u5EA6\u30B3\u30D4\u30FC\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'pasteRefused.emptySelection': \"\u8CBC\u308A\u4ED8\u3051\u5148\u306E\u30BB\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'pasteRefused.singleCellTarget': \"\u4F55\u3082\u8CBC\u308A\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30B3\u30D4\u30FC\u3057\u305F\u30D6\u30ED\u30C3\u30AF\u3068\u540C\u3058\u5F62\u306E\u7BC4\u56F2\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'pasteRefused.shapeMismatch':\n \"\u4F55\u3082\u8CBC\u308A\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u9078\u629E\u7BC4\u56F2\u304C\u30B3\u30D4\u30FC\u3057\u305F\u30D6\u30ED\u30C3\u30AF\u306E\u6574\u6570\u500D\u306B\u306A\u3063\u3066\u3044\u307E\u305B\u3093\u30021 \u3064\u306E\u30BB\u30EB\u304B\u3001\u30D6\u30ED\u30C3\u30AF\u304C\u3061\u3087\u3046\u3069\u7E70\u308A\u8FD4\u3055\u308C\u308B\u7BC4\u56F2\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'pasteRefused.disjointTarget':\n \"\u4F55\u3082\u8CBC\u308A\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u8907\u6570\u306E\u30BB\u30EB\u306E\u30D6\u30ED\u30C3\u30AF\u306F\u3001\u8907\u6570\u306E\u7BC4\u56F2\u306E\u9078\u629E\u306B\u306F\u8CBC\u308A\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u30021 \u3064\u306E\u7BC4\u56F2\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'pasteRefused.targetNotEditable': \"\u4F55\u3082\u8CBC\u308A\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u9078\u629E\u7BC4\u56F2\u306B\u66F8\u304D\u8FBC\u3081\u306A\u3044\u30BB\u30EB\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002\",\n 'pasteRefused.tooLarge': \"\u4F55\u3082\u8CBC\u308A\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30AF\u30EA\u30C3\u30D7\u30DC\u30FC\u30C9\u306E\u5185\u5BB9\u304C\u30011 \u56DE\u306E\u8CBC\u308A\u4ED8\u3051\u3067\u8AAD\u307F\u53D6\u308C\u308B\u91CF\u3092\u8D85\u3048\u3066\u3044\u307E\u3059\u3002\",\n 'pasteRefused.unreadable': \"\u4F55\u3082\u8CBC\u308A\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30AF\u30EA\u30C3\u30D7\u30DC\u30FC\u30C9\u3092\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u8CBC\u308A\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'pasteRefused.cancelled': \"\u4F55\u3082\u8CBC\u308A\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u8CBC\u308A\u4ED8\u3051\u306F\u53D6\u308A\u6D88\u3055\u308C\u307E\u3057\u305F\u3002\",\n 'pasteRefused.spillPastExtent': \"\u4F55\u3082\u8CBC\u308A\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30D6\u30ED\u30C3\u30AF\u304C\u30B7\u30FC\u30C8\u306E\u7AEF ({0}) \u3092\u8D8A\u3048\u3066\u3057\u307E\u3044\u307E\u3059\u3002\",\n 'pasteRefused.nothingToFillFrom': \"\u4F55\u3082\u30D5\u30A3\u30EB\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u9078\u629E\u7BC4\u56F2\u306E\u4E0A\u306B\u884C\u304C\u306A\u3044\u304B\u3001\u5DE6\u306B\u5217\u304C\u306A\u3044\u305F\u3081\u3001\u30D5\u30A3\u30EB\u5143\u304C\u3042\u308A\u307E\u305B\u3093\u3002\",\n 'pasteRefused.multipleRanges': \"\u4F55\u3082\u30D5\u30A3\u30EB\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30D5\u30A3\u30EB\u306F 1 \u3064\u306E\u7BC4\u56F2\u306B\u5BFE\u3057\u3066\u884C\u3044\u307E\u3059\u30021 \u3064\u306E\u7BC4\u56F2\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'pasteRefused.sourceUnavailable': \"\u4F55\u3082\u30D5\u30A3\u30EB\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30D5\u30A3\u30EB\u5143\u306E\u30BB\u30EB\u3092\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\",\n 'pasteRefused.sourceChanged':\n \"\u4F55\u3082\u5165\u529B\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u53CD\u6620\u3055\u308C\u308B\u524D\u306B\u30B7\u30FC\u30C8\u304C\u8868\u793A\u3059\u308B\u30C7\u30FC\u30BF\u304C\u7F6E\u304D\u63DB\u3048\u3089\u308C\u305F\u305F\u3081\u3001\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u30BB\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'pasteRefused.orderMoved':\n \"\u4F55\u3082\u5165\u529B\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30BB\u30EB\u3092\u9078\u629E\u3057\u305F\u5F8C\u306B\u5225\u306E\u30B7\u30FC\u30C8\u304C\u8868\u793A\u3055\u308C\u305F\u304B\u3001\u5225\u306E\u30B7\u30FC\u30C8 \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u304C\u958B\u304B\u308C\u305F\u305F\u3081\u3001\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u30BB\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'commitRefused.orderMoved':\n \"\u5165\u529B\u3057\u305F\u5185\u5BB9\u306F\u78BA\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: {0} \u306E\u7DE8\u96C6\u4E2D\u306B\u5225\u306E\u30B7\u30FC\u30C8\u304C\u8868\u793A\u3055\u308C\u305F\u304B\u3001\u5225\u306E\u30B7\u30FC\u30C8 \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u304C\u958B\u304B\u308C\u305F\u305F\u3081\u3001\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002Esc \u30AD\u30FC\u3067\u7DE8\u96C6\u3092\u7D42\u4E86\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'commitRefused.rowLeftTheWindow':\n \"\u5165\u529B\u3057\u305F\u5185\u5BB9\u306F\u78BA\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: {0} \u306E\u884C\u306F\u3001\u30B7\u30FC\u30C8\u304C\u73FE\u5728\u4FDD\u6301\u3057\u3066\u3044\u308B\u884C\u306B\u3042\u308A\u307E\u305B\u3093\u3002\u305D\u306E\u884C\u3092\u8868\u793A\u3057\u3066\u3082\u3046\u4E00\u5EA6 Enter \u30AD\u30FC\u3092\u62BC\u3059\u304B\u3001Esc \u30AD\u30FC\u3067\u7DE8\u96C6\u3092\u7D42\u4E86\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'commitRefused.cancelled':\n \"\u5165\u529B\u3057\u305F\u5185\u5BB9\u306F\u78BA\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: {0} \u306E\u7DE8\u96C6\u306F\u78BA\u8A8D\u4E2D\u306B\u53D6\u308A\u6D88\u3055\u308C\u305F\u305F\u3081\u3001\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\",\n 'placementRefused.orderMoved':\n \"\u9078\u629E\u7BC4\u56F2\u306F\u79FB\u52D5\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u8981\u6C42\u3055\u308C\u305F\u5F8C\u306B\u5225\u306E\u30B7\u30FC\u30C8\u304C\u8868\u793A\u3055\u308C\u305F\u304B\u3001\u5225\u306E\u30B7\u30FC\u30C8 \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u304C\u958B\u304B\u308C\u307E\u3057\u305F\u3002\",\n 'placementRefused.sourceChanged':\n \"\u9078\u629E\u7BC4\u56F2\u306F\u79FB\u52D5\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u8981\u6C42\u3055\u308C\u305F\u5F8C\u306B\u30B7\u30FC\u30C8\u304C\u8868\u793A\u3059\u308B\u30C7\u30FC\u30BF\u304C\u7F6E\u304D\u63DB\u3048\u3089\u308C\u307E\u3057\u305F\u3002\",\n 'placementRefused.columnsMoved':\n \"\u9078\u629E\u7BC4\u56F2\u306F\u79FB\u52D5\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u8981\u6C42\u3055\u308C\u305F\u5F8C\u306B\u30B7\u30FC\u30C8\u306E\u5217\u304C\u5909\u308F\u308A\u307E\u3057\u305F\u3002\",\n 'overwritten':\n \"{0} \u306F\u7DE8\u96C6\u4E2D\u306B\u884C\u308F\u308C\u305F\u5909\u66F4\u306E\u4E0A\u306B\u5165\u529B\u3055\u308C\u307E\u3057\u305F: \u7DE8\u96C6\u3092\u59CB\u3081\u305F\u3068\u304D\u306F {1}\u3001\u76F4\u524D\u306F {2} \u3068\u8868\u793A\u3055\u308C\u3066\u3044\u307E\u3057\u305F\u3002\",\n 'copyRefused.emptySelection': \"\u30B3\u30D4\u30FC\u3059\u308B\u30BB\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'copyRefused.misalignedShape':\n \"\u4F55\u3082\u30B3\u30D4\u30FC\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u9078\u629E\u3057\u305F\u7BC4\u56F2\u304C 1 \u3064\u306E\u30D6\u30ED\u30C3\u30AF\u306B\u4E26\u3073\u307E\u305B\u3093\u3002\u884C\u307E\u305F\u306F\u5217\u304C\u5171\u901A\u3059\u308B\u7BC4\u56F2\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'copyRefused.tooLarge': \"\u4F55\u3082\u30B3\u30D4\u30FC\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u9078\u629E\u7BC4\u56F2\u306E\u30BB\u30EB\u6570\u304C\u30011 \u56DE\u306E\u30B3\u30D4\u30FC\u3067\u904B\u3079\u308B\u6570\u3092\u8D85\u3048\u3066\u3044\u307E\u3059\u3002\",\n 'copyRefused.rowsUnavailable': \"\u4F55\u3082\u30B3\u30D4\u30FC\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u9078\u629E\u7BC4\u56F2\u306E\u884C\u3092\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\",\n 'copyRefused.clipboardUnavailable': \"\u4F55\u3082\u30B3\u30D4\u30FC\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u30D6\u30E9\u30A6\u30B6\u30FC\u304C\u30AF\u30EA\u30C3\u30D7\u30DC\u30FC\u30C9\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u3092\u62D2\u5426\u3057\u307E\u3057\u305F\u3002\u30AF\u30EA\u30C3\u30D7\u30DC\u30FC\u30C9\u306E\u5185\u5BB9\u306F\u4EE5\u524D\u306E\u307E\u307E\u3067\u3059\u3002\",\n 'copyRefused.refusedByConsumer': \"\u4F55\u3082\u30B3\u30D4\u30FC\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\",\n 'pointingRefused.severalCells':\n \"\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u8907\u6570\u306E\u30BB\u30EB\u304C\u62BC\u3055\u308C\u307E\u3057\u305F\u3002\u6570\u5F0F\u306F '{0}' \u306E 1 \u884C\u3092\u30AD\u30FC\u3067\u8AAD\u307F\u53D6\u308A\u307E\u3059\u3002\u30BB\u30EB\u306E\u7BC4\u56F2\u306F\u66F8\u304D\u8FBC\u3081\u307E\u305B\u3093\u3002\",\n 'pointingRefused.severalCellsTakenBack':\n \"\u62BC\u3057\u3066\u66F8\u304D\u8FBC\u3093\u3060\u5185\u5BB9\u3092\u53D6\u308A\u6D88\u3057\u307E\u3057\u305F: \u30C9\u30E9\u30C3\u30B0\u304C\u5225\u306E\u30BB\u30EB\u306B\u5C4A\u304D\u307E\u3057\u305F\u3002\u6570\u5F0F\u306F '{0}' \u306E 1 \u884C\u3092\u30AD\u30FC\u3067\u8AAD\u307F\u53D6\u308A\u307E\u3059\u3002\u30BB\u30EB\u306E\u7BC4\u56F2\u306F\u66F8\u304D\u8FBC\u3081\u307E\u305B\u3093\u3002\",\n 'pointingRefused.severalColumns':\n \"\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u8907\u6570\u306E\u5217\u304C\u62BC\u3055\u308C\u307E\u3057\u305F\u3002\u6570\u5F0F\u304C\u6307\u5B9A\u3067\u304D\u308B\u306E\u306F '{0}' \u306E\u5217 1 \u3064\u305A\u3064\u3067\u3059\u3002\",\n 'pointingRefused.severalColumnsTakenBack':\n \"\u62BC\u3057\u3066\u66F8\u304D\u8FBC\u3093\u3060\u5185\u5BB9\u3092\u53D6\u308A\u6D88\u3057\u307E\u3057\u305F: \u30C9\u30E9\u30C3\u30B0\u304C\u5225\u306E\u5217\u306B\u5C4A\u304D\u307E\u3057\u305F\u3002\u6570\u5F0F\u304C\u6307\u5B9A\u3067\u304D\u308B\u306E\u306F '{0}' \u306E\u5217 1 \u3064\u305A\u3064\u3067\u3059\u3002\",\n 'pointingRefused.headerGroup':\n \"\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u898B\u51FA\u3057\u30B0\u30EB\u30FC\u30D7\u306F\u8907\u6570\u306E\u5217\u306B\u307E\u305F\u304C\u3063\u3066\u3044\u307E\u3059\u3002\u6570\u5F0F\u304C\u6307\u5B9A\u3067\u304D\u308B\u306E\u306F '{0}' \u306E\u5217 1 \u3064\u305A\u3064\u3067\u3059\u3002\",\n 'pointingRefused.columnNotInTable': \"\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u5217 '{1}' \u306F\u30EA\u30F3\u30AF \u30C6\u30FC\u30D6\u30EB '{0}' \u306E\u5217\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\",\n 'pointingRefused.noKey':\n \"\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F: '{0}' \u306F\u30AD\u30FC\u306A\u3057\u3067\u5BA3\u8A00\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001\u6570\u5F0F\u306F\u305D\u306E\u884C\u3092\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002\u5217\u5168\u4F53\u3092\u8AAD\u307F\u53D6\u308B\u306B\u306F\u3001\u5217\u306E\u898B\u51FA\u3057\u3092\u62BC\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'pointingRefused.blankKey': \"\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u3053\u306E\u884C\u306E '{0}' \u3067\u306E\u30AD\u30FC\u306F\u7A7A\u767D\u306E\u305F\u3081\u3001\u6570\u5F0F\u306F\u3053\u306E\u884C\u3092\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002\",\n 'pointingRefused.keyIsAnError': \"\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u3053\u306E\u884C\u306E '{0}' \u3067\u306E\u30AD\u30FC\u306F\u30A8\u30E9\u30FC\u5024\u3067\u3001\u691C\u7D22\u3067\u898B\u3064\u304B\u308B\u3053\u3068\u306F\u3042\u308A\u307E\u305B\u3093\u3002\",\n 'pointingRefused.rowNotArrived': \"\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u3053\u306E\u884C\u306F\u307E\u3060\u5C4A\u3044\u3066\u3044\u307E\u305B\u3093\u3002\",\n 'pointingRefused.tableNotDeclared': \"\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u3053\u306E\u30B7\u30FC\u30C8\u306B\u306F\u30EA\u30F3\u30AF \u30C6\u30FC\u30D6\u30EB '{0}' \u304C\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\",\n 'pointingRefused.notPointing':\n \"\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u62BC\u3057\u305F\u64CD\u4F5C\u304C\u5C4A\u3044\u305F\u3068\u304D\u3001\u6570\u5F0F\u306F\u53C2\u7167\u3092\u5165\u308C\u3089\u308C\u308B\u4F4D\u7F6E\u306B\u3082\u3046\u3042\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002\",\n 'pointingRefused.dataEdge':\n \"\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F: Ctrl+\u65B9\u5411\u30AD\u30FC\u306F\u30C7\u30FC\u30BF\u306E\u7AEF\u306B\u79FB\u52D5\u3057\u307E\u3059\u304C\u3001\u30B0\u30EA\u30C3\u30C9\u306F\u8868\u793A\u4E2D\u306E\u884C\u306E\u8FD1\u304F\u3057\u304B\u4FDD\u6301\u3057\u3066\u3044\u306A\u3044\u305F\u3081\u3001'{0}' \u306E\u7D42\u308F\u308A\u304C\u308F\u304B\u308A\u307E\u305B\u3093\u3002\u65B9\u5411\u30AD\u30FC\u3060\u3051\u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'pointingRefused.cellNotHeld':\n \"\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u53C2\u7167\u3057\u3066\u3044\u305F '{0}' \u306E\u30BB\u30EB\u3092\u30B0\u30EA\u30C3\u30C9\u304C\u3082\u3046\u4FDD\u6301\u3057\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u65B9\u5411\u30AD\u30FC\u306E\u79FB\u52D5\u5143\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u3082\u3046\u4E00\u5EA6\u30BB\u30EB\u3092\u62BC\u3057\u3066\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'pointingRefused.columnNotHeld':\n \"\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F: \u53C2\u7167\u3057\u3066\u3044\u305F '{0}' \u306E\u5217 '{1}' \u3092\u30B0\u30EA\u30C3\u30C9\u304C\u3082\u3046\u8868\u793A\u3057\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u65B9\u5411\u30AD\u30FC\u306E\u79FB\u52D5\u5143\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u30BB\u30EB\u304B\u5217\u306E\u898B\u51FA\u3057\u3092\u62BC\u3057\u3066\u3001\u3082\u3046\u4E00\u5EA6\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'pointingExtendedByKey':\n \"\u4F55\u3082\u66F8\u304D\u8FBC\u307E\u308C\u307E\u305B\u3093\u3067\u3057\u305F: Shift+\u65B9\u5411\u30AD\u30FC\u306F\u8907\u6570\u306E\u30BB\u30EB\u3092\u6307\u3057\u307E\u3059\u3002\u6570\u5F0F\u306F '{0}' \u306E 1 \u884C\u3092\u30AD\u30FC\u3067\u8AAD\u307F\u53D6\u308A\u307E\u3059\u3002\u30BB\u30EB\u306E\u7BC4\u56F2\u306F\u66F8\u304D\u8FBC\u3081\u307E\u305B\u3093\u3002\",\n 'nothingToUndo': \"\u5143\u306B\u623B\u3059\u64CD\u4F5C\u306F\u3042\u308A\u307E\u305B\u3093\u3002\",\n 'nothingToRedo': \"\u3084\u308A\u76F4\u3059\u64CD\u4F5C\u306F\u3042\u308A\u307E\u305B\u3093\u3002\",\n 'command.insertRows': \"\u4E0A\u306B\u884C\u3092\u633F\u5165\",\n 'command.deleteRows': \"\u884C\u306E\u524A\u9664\",\n 'command.insertColumns': \"\u5DE6\u306B\u5217\u3092\u633F\u5165\",\n 'command.deleteColumns': \"\u5217\u306E\u524A\u9664\",\n 'command.formatCells': \"\u30BB\u30EB\u306E\u66F8\u5F0F\u8A2D\u5B9A\u2026\",\n 'find.within': \"\u691C\u7D22\u5834\u6240\",\n 'find.withinSheet': \"\u30B7\u30FC\u30C8\",\n 'find.withinWorkbook': \"\u30D6\u30C3\u30AF\",\n 'formatCellsTitle': \"\u30BB\u30EB\u306E\u66F8\u5F0F\u8A2D\u5B9A\",\n 'formatCells.tab.number': \"\u8868\u793A\u5F62\u5F0F\",\n 'formatCells.tab.alignment': \"\u914D\u7F6E\",\n 'formatCells.tab.font': \"\u30D5\u30A9\u30F3\u30C8\",\n 'formatCells.tab.border': \"\u7F6B\u7DDA\",\n 'formatCells.tab.fill': \"\u5857\u308A\u3064\u3076\u3057\",\n 'formatCells.category.general': \"\u6A19\u6E96\",\n 'formatCells.category.number': \"\u6570\u5024\",\n 'formatCells.category.currency': \"\u901A\u8CA8\",\n 'formatCells.category.accounting': \"\u4F1A\u8A08\",\n 'formatCells.category.date': \"\u65E5\u4ED8\",\n 'formatCells.category.time': \"\u6642\u523B\",\n 'formatCells.category.percentage': \"\u30D1\u30FC\u30BB\u30F3\u30C6\u30FC\u30B8\",\n 'formatCells.category.fraction': \"\u5206\u6570\",\n 'formatCells.category.scientific': \"\u6307\u6570\",\n 'formatCells.category.text': \"\u6587\u5B57\u5217\",\n 'formatCells.category.special': \"\u305D\u306E\u4ED6\",\n 'formatCells.category.custom': \"\u30E6\u30FC\u30B6\u30FC\u5B9A\u7FA9\",\n 'formatCells.disabled.accounting':\n \"\u4F1A\u8A08\u306F\u5404\u5024\u3092 * \u3067\u57CB\u3081\u3066\u5217\u5E45\u3044\u3063\u3071\u3044\u306B\u8868\u793A\u3057\u307E\u3059\u304C\u3001ExSheet \u306F\u3053\u308C\u3092\u8AAD\u307F\u53D6\u308A\u307E\u305B\u3093\u3002[\u901A\u8CA8] \u3092\u4F7F\u3046\u304B\u3001[\u30E6\u30FC\u30B6\u30FC\u5B9A\u7FA9] \u3067\u8868\u793A\u5F62\u5F0F\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'formatCells.disabled.fraction': \"\u5206\u6570\u306F\u3001ExSheet \u304C\u8AAD\u307F\u53D6\u308B\u8868\u793A\u5F62\u5F0F\u306B\u542B\u307E\u308C\u3066\u3044\u307E\u305B\u3093\u3002\",\n 'formatCells.disabled.special':\n \"\u305D\u306E\u4ED6\u306E\u8868\u793A\u5F62\u5F0F\u306F\u30ED\u30B1\u30FC\u30EB\u306B\u3088\u3063\u3066\u7570\u306A\u308A\u3001\u96FB\u8A71\u756A\u53F7\u306E\u8868\u793A\u5F62\u5F0F\u306B\u306F\u6761\u4EF6\u304C\u542B\u307E\u308C\u307E\u3059\u304C\u3001ExSheet \u306F\u3053\u308C\u3092\u8AAD\u307F\u53D6\u308A\u307E\u305B\u3093\u3002[\u30E6\u30FC\u30B6\u30FC\u5B9A\u7FA9] \u3067\u8868\u793A\u5F62\u5F0F\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'formatCells.noNumberFormatCode': \"[\u30E6\u30FC\u30B6\u30FC\u5B9A\u7FA9] \u3067\u8868\u793A\u5F62\u5F0F\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'formatCells.numberFormatNotRead': \"\u8868\u793A\u5F62\u5F0F '{0}' \u306F ExSheet \u304C\u8AAD\u307F\u53D6\u308B\u8868\u793A\u5F62\u5F0F\u3067\u306F\u3042\u308A\u307E\u305B\u3093: {1}\",\n 'formatCells.notAColour': \"'{0}' \u306F\u8272\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002#1F4E79 \u306E\u3088\u3046\u306B\u3001# \u3068 16 \u9032\u6570 6 \u6841\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002\",\n 'formatCells.alignment.general': \"\u6A19\u6E96\",\n 'formatCells.alignment.left': \"\u5DE6\u8A70\u3081 (\u30A4\u30F3\u30C7\u30F3\u30C8)\",\n 'formatCells.alignment.center': \"\u4E2D\u592E\u63C3\u3048\",\n 'formatCells.alignment.right': \"\u53F3\u8A70\u3081 (\u30A4\u30F3\u30C7\u30F3\u30C8)\",\n 'formatCells.fontStyle.regular': \"\u6A19\u6E96\",\n 'formatCells.fontStyle.italic': \"\u659C\u4F53\",\n 'formatCells.fontStyle.bold': \"\u592A\u5B57\",\n 'formatCells.fontStyle.boldItalic': \"\u592A\u5B57 \u659C\u4F53\",\n 'formatCells.edge.top': \"\u4E0A\u7F6B\u7DDA\",\n 'formatCells.edge.insideHorizontal': \"\u5185\u5074\u6A2A\u7F6B\u7DDA\",\n 'formatCells.edge.bottom': \"\u4E0B\u7F6B\u7DDA\",\n 'formatCells.edge.left': \"\u5DE6\u7F6B\u7DDA\",\n 'formatCells.edge.insideVertical': \"\u5185\u5074\u7E26\u7F6B\u7DDA\",\n 'formatCells.edge.right': \"\u53F3\u7F6B\u7DDA\",\n 'formatCells.preset.none': \"\u306A\u3057\",\n 'formatCells.preset.outline': \"\u5916\u67A0\",\n 'formatCells.preset.inside': \"\u5185\u5074\",\n 'formatCells.lineStyle.none': \"\u306A\u3057\",\n 'formatCells.lineStyle.hair': \"\u6975\u7D30\u7DDA\",\n 'formatCells.lineStyle.dotted': \"\u70B9\u7DDA\",\n 'formatCells.lineStyle.dashDotDot': \"\u4E8C\u70B9\u9396\u7DDA\",\n 'formatCells.lineStyle.dashDot': \"\u4E00\u70B9\u9396\u7DDA\",\n 'formatCells.lineStyle.dashed': \"\u7834\u7DDA\",\n 'formatCells.lineStyle.thin': \"\u7D30\u7DDA\",\n 'formatCells.lineStyle.mediumDashDotDot': \"\u4E2D\u592A\u4E8C\u70B9\u9396\u7DDA\",\n 'formatCells.lineStyle.slantedDashDot': \"\u4E2D\u592A\u659C\u3081\u4E00\u70B9\u9396\u7DDA\",\n 'formatCells.lineStyle.mediumDashDot': \"\u4E2D\u592A\u4E00\u70B9\u9396\u7DDA\",\n 'formatCells.lineStyle.mediumDashed': \"\u4E2D\u592A\u7834\u7DDA\",\n 'formatCells.lineStyle.medium': \"\u4E2D\u592A\u7DDA\",\n 'formatCells.lineStyle.thick': \"\u592A\u7DDA\",\n 'formatCells.lineStyle.double': \"\u4E8C\u91CD\u7DDA\",\n 'formatCells.colour.background1': \"\u767D\u3001\u80CC\u666F 1\",\n 'formatCells.colour.text1': \"\u9ED2\u3001\u30C6\u30AD\u30B9\u30C8 1\",\n 'formatCells.colour.background2': \"\u8584\u3044\u7070\u8272\u3001\u80CC\u666F 2\",\n 'formatCells.colour.text2': \"\u6FC3\u3044\u9752\u3001\u30C6\u30AD\u30B9\u30C8 2\",\n 'formatCells.colour.accent1': \"\u6FC3\u3044\u9752\u7DD1\u3001\u30A2\u30AF\u30BB\u30F3\u30C8 1\",\n 'formatCells.colour.accent2': \"\u30AA\u30EC\u30F3\u30B8\u3001\u30A2\u30AF\u30BB\u30F3\u30C8 2\",\n 'formatCells.colour.accent3': \"\u6FC3\u3044\u7DD1\u3001\u30A2\u30AF\u30BB\u30F3\u30C8 3\",\n 'formatCells.colour.accent4': \"\u30BF\u30FC\u30B3\u30A4\u30BA\u3001\u30A2\u30AF\u30BB\u30F3\u30C8 4\",\n 'formatCells.colour.accent5': \"\u30D7\u30E9\u30E0\u3001\u30A2\u30AF\u30BB\u30F3\u30C8 5\",\n 'formatCells.colour.accent6': \"\u7DD1\u3001\u30A2\u30AF\u30BB\u30F3\u30C8 6\",\n 'formatCells.colour.darkRed': \"\u6FC3\u3044\u8D64\",\n 'formatCells.colour.red': \"\u8D64\",\n 'formatCells.colour.orange': \"\u30AA\u30EC\u30F3\u30B8\",\n 'formatCells.colour.yellow': \"\u9EC4\",\n 'formatCells.colour.lightGreen': \"\u8584\u3044\u7DD1\",\n 'formatCells.colour.green': \"\u7DD1\",\n 'formatCells.colour.lightBlue': \"\u8584\u3044\u9752\",\n 'formatCells.colour.blue': \"\u9752\",\n 'formatCells.colour.darkBlue': \"\u6FC3\u3044\u9752\",\n 'formatCells.colour.purple': \"\u7D2B\",\n 'formatCells.colourDarker': \"\u9ED2 + \u57FA\u672C\u8272 {0}%\",\n 'formatCells.colourLighter': \"\u767D + \u57FA\u672C\u8272 {0}%\",\n 'formatCells.colourStep': \"{0}\u3001{1}\",\n 'formatCells.label.tabs': \"\u30BB\u30EB\u306E\u66F8\u5F0F\u8A2D\u5B9A\",\n 'formatCells.label.category': \"\u5206\u985E\",\n 'formatCells.label.generalHint': \"\u6A19\u6E96\u306E\u30BB\u30EB\u306B\u306F\u7279\u5B9A\u306E\u8868\u793A\u5F62\u5F0F\u306F\u3042\u308A\u307E\u305B\u3093\u3002\",\n 'formatCells.label.textHint': \"\u6587\u5B57\u5217\u306E\u30BB\u30EB\u306F\u5165\u529B\u3057\u305F\u3068\u304A\u308A\u306B\u8868\u793A\u3055\u308C\u307E\u3059\u3002\",\n 'formatCells.label.decimalPlaces': \"\u5C0F\u6570\u70B9\u4EE5\u4E0B\u306E\u6841\u6570\",\n 'formatCells.label.thousandsSeparator': \"\u6841\u533A\u5207\u308A (,) \u3092\u4F7F\u7528\u3059\u308B\",\n 'formatCells.label.negativeNumbers': \"\u8CA0\u306E\u6570\u306E\u8868\u793A\u5F62\u5F0F\",\n 'formatCells.label.type': \"\u7A2E\u985E\",\n 'formatCells.label.codes': \"\u8868\u793A\u5F62\u5F0F\u30B3\u30FC\u30C9\",\n 'formatCells.label.horizontal': \"\u6A2A\u4F4D\u7F6E\",\n 'formatCells.label.fontStyle': \"\u30B9\u30BF\u30A4\u30EB\",\n 'formatCells.label.underline': \"\u4E0B\u7DDA\",\n 'formatCells.label.underlineNone': \"\u306A\u3057\",\n 'formatCells.label.underlineSingle': \"\u4E00\u91CD\u4E0B\u7DDA\",\n 'formatCells.label.strikethrough': \"\u53D6\u308A\u6D88\u3057\u7DDA\",\n 'formatCells.label.normalFont': \"\u6A19\u6E96\u30D5\u30A9\u30F3\u30C8\",\n 'formatCells.label.colour': \"\u8272\",\n 'formatCells.label.lineStyle': \"\u30B9\u30BF\u30A4\u30EB\",\n 'formatCells.label.presets': \"\u30D7\u30EA\u30BB\u30C3\u30C8\",\n 'formatCells.label.border': \"\u7F6B\u7DDA\",\n 'formatCells.label.preview': \"\u30D7\u30EC\u30D3\u30E5\u30FC\",\n 'formatCells.label.backgroundColour': \"\u80CC\u666F\u8272\",\n 'formatCells.label.automatic': \"\u81EA\u52D5\",\n 'formatCells.label.noColour': \"\u8272\u306A\u3057\",\n 'formatCells.label.moreColours': \"\u305D\u306E\u4ED6\u306E\u8272\",\n 'formatCells.label.ok': \"OK\",\n 'formatCells.label.cancel': \"\u30AD\u30E3\u30F3\u30BB\u30EB\",\n 'formatCells.symbol': \"\u8A18\u53F7: {0}\",\n});\n", "// The Sheet's own Chrome slots beside the Toolbar Item's (ADR-0390, ADR-0071, ADR-0331 \u00A74): Format Cells' contents and\n// the faces of the Sheet Tabs, the C# `ISheetChrome.FormatCells`, `SheetTab` and `SheetTabAdd`. What each shows and\n// what a choice means stay the Sheet's: Format Cells' offer is `formatCellsOffer`, every choice is set through the\n// draft, and OK is the Sheet's; a tab, its keyboard and its press are the Sheet's, and the face only draws.\n\nimport type { FormatCellsDraft } from './format-cells-draft';\nimport type { FormatCellsTab } from './format-cells-offer';\nimport type { SheetWords } from './sheet-words';\n\n/**\n * What Format Cells' contents are handed (ADR-0071, ADR-0390), once per opening. The contents stand in the grid's\n * popover frame, as the built-in Format Cells does: where it stands, Escape, a press elsewhere, Tab wrapping inside\n * it and the keyboard back on the grid as it closes are the grid's (ADR-0050 item 16), so the frame is never the\n * Chrome's own dialog under TypeScript. The contents draw the tabs and their controls from `formatCellsOffer` and\n * `draft`, set every choice through `draft`, and call `ok` or `cancel`.\n */\nexport interface SheetFormatCellsSlotContext {\n /** What Format Cells opens on, the Focus cell's Cell Format with the parts that differ across the Selection shown\n * as Excel shows them, and what the user has touched. Every control is set through it, so what a choice means is\n * the Sheet's under every Chrome. */\n readonly draft: FormatCellsDraft;\n /** The tab to open on: the one shown last in this Sheet. */\n readonly tab: FormatCellsTab;\n /** Hears each tab the contents show, so the next opening shows it again, as Excel's does. */\n readonly tabShown: (tab: FormatCellsTab) => void;\n /** Sets the parts the user touched on the Selection Format Cells was opened over, as one undo step, and closes it:\n * `true`. `false` while the draft holds a refusal, which the contents show in the Sheet's words\n * (`words.formatCellsRefusal(draft.refusal)`), and Format Cells stays open. */\n readonly ok: () => boolean;\n /** Sets nothing, and closes Format Cells. */\n readonly cancel: () => void;\n /** The Sheet's words, its Japanese or its English and the Consumer's label over either: the tabs' names, the\n * fields' labels, OK and Cancel, a refusal. */\n readonly words: SheetWords;\n /** Gives the keyboard, which the frame holds while the contents are being drawn, to a control they drew: the tab\n * shown, as the opening asks. Granted only while the keyboard is still the grid's, so a press the user made\n * meanwhile keeps it where it put it. */\n readonly takeKeyboard: (control: HTMLElement) => void;\n /** The contents report a popup of their own opening (`true`) and closing (`false`): while one is open, Escape is\n * the popup's, not the frame's (ADR-0039). */\n readonly innerPopupChanged: (open: boolean) => void;\n}\n\n/**\n * Format Cells' slot (ADR-0390): mounts the contents into `slot`, which stands in the grid's popover frame, and\n * answers the function that takes them away, called however Format Cells closes. Asked once per opening.\n */\nexport type SheetFormatCellsSlot = (slot: HTMLElement, context: SheetFormatCellsSlotContext) => () => void;\n\n/** What a Sheet Tab's face shows (ADR-0331 \u00A74): the C# `SheetTabContext`. */\nexport interface SheetTabSlotContext {\n /** The Sheet's name, which the face shows as its only text. */\n readonly name: string;\n /** Whether the Sheet is the one shown. */\n readonly selected: boolean;\n}\n\n/**\n * A Sheet Tab's face (ADR-0331 \u00A74, ADR-0390): mounts what stands inside the tab the Sheet keeps, which takes the\n * keyboard, is a tab to assistive technology and hears the press. The face takes no keyboard and hears nothing. It is\n * mounted again, on the same slot, whenever the name or `selected` changes, and answers the function that takes it\n * away.\n */\nexport type SheetTabSlot = (slot: HTMLElement, context: SheetTabSlotContext) => () => void;\n\n/** The face of the button that adds a Sheet (ADR-0331 \u00A74, ADR-0390), inside the button the Sheet keeps, which is\n * named and hears the press; the face takes no keyboard and hears nothing. Mounted once. */\nexport type SheetTabAddSlot = (slot: HTMLElement) => () => void;\n\n/** Calls `mount` and answers the cleanup it returned, refused by name where it is not a function. */\nexport function mountedSlot(name: string, mount: () => unknown): () => void {\n const cleanup = mount();\n if (typeof cleanup !== 'function') {\n throw new TypeError(`chrome.${name} answered ${typeof cleanup}: a mount function answers the function that takes its contents away (ADR-0390).`);\n }\n return () => { Reflect.apply(cleanup, undefined, []); };\n}\n", "// The small DOM helpers the Sheet's own elements share: an attribute written only when it differs, so a repaint\n// that changes nothing touches nothing, and a press whose default is taken from the browser, so it keeps the\n// keyboard where it is.\n\n/** Writes `value` into `name` only when it differs from what is there. */\nexport function setAttr(element: HTMLElement, name: string, value: string): void {\n if (element.getAttribute(name) !== value) element.setAttribute(name, value);\n}\n\n/** Prevents the event's default: on a mousedown, the move of the keyboard to what was pressed. */\nexport function preventDefault(event: Event): void {\n event.preventDefault();\n}\n", "// The Sheet Tabs (ADR-0331 \u00A71, \u00A74): one tab per Sheet of the Workbook, at the Sheet's foot under the grid, as Excel\n// draws them, and the + button after them. A tab list to assistive technology, the selected tab its one tab stop.\n// A press on a tab or on + keeps the keyboard where it is, in the grid; the keys on the tab list, where Tab put the\n// keyboard, select a tab or give the keyboard back. A double click edits a tab's name in place, a secondary press\n// opens the tab's menu, and a drag from one tab onto another moves it (exsheet-workbook ticket 06). The elements wear\n// the C# Sheet's classes, so one stylesheet lays out both. What a press or a key means is the Sheet's: this draws,\n// and reports what was pressed.\n\nimport type { Sheet } from '@ex-grid/sheet-engine';\nimport { mountedSlot, type SheetTabAddSlot, type SheetTabSlot } from './sheet-chrome-slots';\nimport { preventDefault, setAttr } from './dom-attributes';\nimport type { SheetTabCommand } from './sheet-words';\n\n/** What the tabs tell the Sheet they hear. */\nexport interface SheetTabsHooks {\n /** A tab was pressed. */\n readonly pressed: (sheet: Sheet) => void;\n /** The + button was pressed. */\n readonly added: () => void;\n /** A key on the tab list: true where it was the Sheet's, which the browser then does not act on. */\n readonly listKey: (event: KeyboardEvent) => boolean;\n /** A double click on a tab: its name is to be edited. */\n readonly renameAsked: (sheet: Sheet) => void;\n /** The text in the name's field changed. */\n readonly renameInput: (text: string) => void;\n /** Enter or Escape in the name's field, outside a composition. */\n readonly renameKey: (key: 'Enter' | 'Escape') => void;\n /** The keyboard left the name's field opened as `session`. */\n readonly renameLeft: (session: number) => void;\n /** A secondary press on a tab, or the browser's context menu for it: its menu is to open. */\n readonly menuAsked: (sheet: Sheet) => void;\n /** A key on the tab's menu: true where it was the menu's. */\n readonly menuKey: (event: KeyboardEvent) => boolean;\n /** A command of the tab's menu pressed. */\n readonly menuCommand: (command: SheetTabCommand) => void;\n /** The keyboard left the tab's menu opened as `session`. */\n readonly menuLeft: (session: number) => void;\n /** A tab dragged onto another tab, or past the last (`undefined`). */\n readonly dropped: (sheet: Sheet, target: Sheet | undefined) => void;\n}\n\n/** One command of a tab's menu, as it is drawn. */\nexport interface SheetTabMenuItem {\n readonly command: SheetTabCommand;\n readonly label: string;\n /** Why it cannot be done on the Sheet now, or `undefined` where it can. */\n readonly disabledReason: string | undefined;\n}\n\n/** The tab's menu, as it is drawn: its name, its commands, and the one the keyboard is on. */\nexport interface SheetTabMenuPaint {\n readonly name: string;\n readonly items: readonly SheetTabMenuItem[];\n readonly active: SheetTabCommand;\n}\n\n// The name being edited on its tab: the element standing in the tab's place, its field, and the edit's session.\ninterface Renaming {\n readonly sheet: Sheet;\n readonly element: HTMLElement;\n readonly field: HTMLInputElement;\n readonly session: number;\n}\n\n// The tab's menu standing: its element and its session.\ninterface TabMenu {\n readonly element: HTMLElement;\n readonly session: number;\n}\n\n/** What one pass shows. */\nexport interface SheetTabsPaint {\n readonly sheets: readonly Sheet[];\n readonly shown: Sheet;\n readonly heightPx: number;\n readonly listName: string;\n readonly addName: string;\n /** A Chrome's face for each tab, or none for the built-in one, the name (ADR-0390). */\n readonly tabFace: SheetTabSlot | undefined;\n /** A Chrome's face for the + button, or none for the built-in one. */\n readonly addFace: SheetTabAddSlot | undefined;\n}\n\n// A face a Chrome drew inside a tab or the + button: its slot, the mount it was drawn by, what it was drawn for, and\n// what takes it away.\ninterface DrawnFace {\n readonly slot: HTMLElement;\n readonly mount: unknown;\n readonly shown: string;\n readonly cleanup: () => void;\n}\n\n/** The tab areas made so far, so each menu's ids are its own. */\nlet tabAreas = 0;\n\n/** The tab area's elements, one button per Sheet, each made for its Sheet and never handed to another. */\nexport class SheetTabs {\n readonly area: HTMLElement;\n readonly #list: HTMLElement;\n readonly #add: HTMLButtonElement;\n readonly #tabs = new Map<Sheet, HTMLButtonElement>();\n readonly #hooks: SheetTabsHooks;\n readonly #doc: Document;\n readonly #faces = new Map<HTMLButtonElement, DrawnFace>();\n // The + button's built-in face, the glyph.\n readonly #plus: HTMLElement;\n #renaming: Renaming | undefined;\n #menu: TabMenu | undefined;\n // Each name edit and each menu is numbered, so the keyboard leaving one already ended is not taken for the next.\n #session = 0;\n // The tab a drag started on, from the press until its release or the pointer leaving the tabs.\n #dragFrom: Sheet | undefined;\n // The ids the menu's commands are named by, unique to these tabs.\n readonly #menuIds = `ex-sheet-tab-menu-${String(++tabAreas)}`;\n\n constructor(doc: Document, hooks: SheetTabsHooks) {\n this.#doc = doc;\n this.#hooks = hooks;\n this.area = doc.createElement('div');\n this.area.className = 'ex-sheet-tab-area';\n this.#list = doc.createElement('div');\n this.#list.className = 'ex-sheet-tabs';\n this.#list.setAttribute('role', 'tablist');\n this.#list.addEventListener('keydown', event => {\n if (event.isComposing) return;\n if (hooks.listKey(event)) event.preventDefault();\n });\n this.#add = doc.createElement('button');\n this.#add.type = 'button';\n this.#add.className = 'ex-sheet-tab-add';\n this.#add.tabIndex = -1;\n this.#plus = doc.createElement('span');\n this.#plus.setAttribute('aria-hidden', 'true');\n this.#plus.textContent = '+';\n this.#add.append(this.#plus);\n // A press keeps the keyboard where it is: in the grid, where the next key acts on the Sheet it showed.\n // Its press takes its place in the Sheet's order, behind a commit or an opening (ADR-0240).\n this.#add.setAttribute('data-ex-claims', 'click');\n this.#add.addEventListener('mousedown', preventDefault);\n this.#add.addEventListener('click', () => { hooks.added(); });\n // Past the last tab: the strip's empty end.\n const end = doc.createElement('span');\n end.className = 'ex-sheet-tab-end';\n end.setAttribute('aria-hidden', 'true');\n // A release on + or past the last tab drops a tab dragged there, last; a release anywhere else in the area,\n // or the pointer leaving it, ends the drag with nothing moved.\n for (const past of [this.#add, end]) past.addEventListener('mouseup', event => { this.#drop(event, undefined); });\n this.area.addEventListener('mouseup', () => { this.#endDrag(); });\n this.area.addEventListener('mouseleave', () => { this.#endDrag(); });\n this.area.append(this.#list, this.#add, end);\n }\n\n paint(paint: SheetTabsPaint): void {\n setAttr(this.area, 'style', `height: ${String(paint.heightPx)}px`);\n setAttr(this.#list, 'aria-label', paint.listName);\n setAttr(this.#add, 'aria-label', paint.addName);\n setAttr(this.#add, 'title', paint.addName);\n this.#drawAddFace(paint.addFace);\n for (const [sheet, tab] of this.#tabs) {\n if (paint.sheets.includes(sheet)) continue;\n this.#tabs.delete(sheet);\n this.#takeFace(tab);\n tab.remove();\n }\n const tabs = paint.sheets.map(sheet => {\n const tab = this.#tabOf(sheet);\n const selected = sheet === paint.shown;\n this.#drawTabFace(tab, paint.tabFace, sheet.name, selected);\n const renaming = this.#renaming?.sheet === sheet ? this.#renaming.element : undefined;\n // The tab keeps its place in the Tab order while its name is edited, as the field's frame.\n for (const element of renaming === undefined ? [tab] : [tab, renaming]) {\n setAttr(element, 'aria-selected', selected ? 'true' : 'false');\n setAttr(element, 'tabindex', selected ? '0' : '-1');\n }\n return renaming ?? tab;\n });\n // Moved only when the order differs: a tab moved loses the keyboard it holds. A name's field being edited is\n // never moved itself, the others are moved round it: moved, it would lose the keyboard, and losing it ends the\n // edit the user did not end.\n const children = [...this.#list.children];\n if (children.length === tabs.length && tabs.every((tab, i) => children[i] === tab)) return;\n const field = this.#renaming?.element;\n const at = field === undefined || field.parentNode !== this.#list ? -1 : tabs.indexOf(field);\n if (field === undefined || at < 0) {\n this.#list.replaceChildren(...tabs);\n return;\n }\n const kept = new Set<Element>(tabs);\n for (const child of children) if (child !== field && !kept.has(child)) child.remove();\n field.before(...tabs.slice(0, at));\n field.after(...tabs.slice(at + 1));\n }\n\n /** Takes away every face a Chrome drew, as the band or the Sheet goes. */\n dispose(): void {\n for (const button of this.#faces.keys()) this.#takeFace(button);\n }\n\n // ---- The name edited on its tab --------------------------------------------------------------------------\n\n /** The Sheet whose name is being edited on its tab, if one is. */\n get renaming(): Sheet | undefined {\n return this.#renaming?.sheet;\n }\n\n /** The name's field takes the tab's place, holding `name` whole selected, and the keyboard: what is typed next\n * replaces it. Answers the edit's session. */\n beginRename(sheet: Sheet, name: string, fieldName: string): number {\n this.endRename();\n const tab = this.#tabOf(sheet);\n const element = this.#doc.createElement('span');\n element.className = 'ex-sheet-tab ex-sheet-tab-renaming';\n element.setAttribute('role', 'tab');\n // Selected as its tab is: the next paint keeps the two alike.\n const selected = tab.getAttribute('aria-selected') === 'true';\n element.setAttribute('aria-selected', selected ? 'true' : 'false');\n element.tabIndex = selected ? 0 : -1;\n const box = this.#doc.createElement('span');\n box.className = 'ex-sheet-tab-name-box';\n const field = this.#doc.createElement('input');\n field.type = 'text';\n field.className = 'ex-sheet-tab-name';\n field.setAttribute('aria-label', fieldName);\n field.spellcheck = false;\n field.autocomplete = 'off';\n field.setAttribute('data-ex-claims', 'keydown');\n field.value = name;\n const session = ++this.#session;\n field.addEventListener('input', () => { this.#hooks.renameInput(field.value); });\n field.addEventListener('keydown', event => {\n // An IME's keys are its own while it composes: its Enter confirms a candidate and its Escape cancels the\n // composition, and neither ends the name's edit (ADR-0010, ADR-0080).\n if (event.isComposing || event.key === 'Process' || (event.key !== 'Enter' && event.key !== 'Escape')) return;\n event.preventDefault();\n event.stopPropagation();\n this.#hooks.renameKey(event.key);\n });\n field.addEventListener('focusout', () => { this.#hooks.renameLeft(session); });\n box.append(field);\n element.append(box);\n this.#renaming = { sheet, element, field, session };\n if (tab.parentElement === this.#list) tab.replaceWith(element);\n field.focus({ preventScroll: true });\n field.select();\n return session;\n }\n\n /** Marks the name's field refused, or takes the mark away. */\n markRenameRefused(refused: boolean): void {\n const field = this.#renaming?.field;\n if (field === undefined) return;\n if (refused) field.setAttribute('aria-invalid', 'true');\n else field.removeAttribute('aria-invalid');\n }\n\n /** The tab is drawn again in the field's place. The keyboard, where the field held it, is the caller's to have\n * handed on first: a field taken away holding it leaves it on the page's body. */\n endRename(): void {\n const renaming = this.#renaming;\n if (renaming === undefined) return;\n this.#renaming = undefined;\n this.#session++;\n const tab = this.#tabs.get(renaming.sheet);\n if (tab !== undefined && renaming.element.parentElement === this.#list) renaming.element.replaceWith(tab);\n else renaming.element.remove();\n }\n\n // ---- The tab's menu --------------------------------------------------------------------------------------\n\n /** Whether the tab's menu stands. */\n get menuOpen(): boolean {\n return this.#menu !== undefined;\n }\n\n /** Opens the tab's menu, or draws it again as it stands, the keyboard on it. Answers its session. */\n showMenu(paint: SheetTabMenuPaint): number {\n let menu = this.#menu;\n if (menu === undefined) {\n const element = this.#doc.createElement('div');\n element.className = 'ex-sheet-tab-menu';\n element.setAttribute('role', 'menu');\n element.tabIndex = -1;\n element.setAttribute('data-ex-claims', 'keydown click');\n const session = ++this.#session;\n element.addEventListener('keydown', event => {\n if (event.isComposing) return;\n if (this.#hooks.menuKey(event)) event.preventDefault();\n });\n element.addEventListener('mousedown', preventDefault);\n element.addEventListener('contextmenu', preventDefault);\n element.addEventListener('focusout', () => { this.#hooks.menuLeft(session); });\n menu = { element, session };\n this.#menu = menu;\n this.area.append(element);\n }\n const { element } = menu;\n setAttr(element, 'aria-label', paint.name);\n const items = paint.items.map(item => {\n const id = `${this.#menuIds}-${item.command.toLowerCase()}`;\n const command = this.#doc.createElement('div');\n command.id = id;\n command.setAttribute('role', 'menuitem');\n command.className = item.command === paint.active ? 'ex-sheet-tab-command ex-sheet-tab-command-active' : 'ex-sheet-tab-command';\n if (item.disabledReason !== undefined) {\n command.setAttribute('aria-disabled', 'true');\n command.title = item.disabledReason;\n }\n command.textContent = item.label;\n command.addEventListener('click', () => { this.#hooks.menuCommand(item.command); });\n return command;\n });\n element.replaceChildren(...items);\n setAttr(element, 'aria-activedescendant', `${this.#menuIds}-${paint.active.toLowerCase()}`);\n if (this.#doc.activeElement !== element) element.focus({ preventScroll: true });\n return menu.session;\n }\n\n /** The tab's menu goes. The keyboard, where the menu held it, is the caller's to have handed on first. */\n closeMenu(): void {\n const menu = this.#menu;\n if (menu === undefined) return;\n this.#menu = undefined;\n this.#session++;\n menu.element.remove();\n }\n\n // ---- Dragging --------------------------------------------------------------------------------------------\n\n // A press of the main button on a tab notes where a drag starts; nothing is done yet.\n #startDrag(event: MouseEvent, sheet: Sheet): void {\n if (event.button !== 0 || event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) {\n this.#endDrag();\n return;\n }\n this.#dragFrom = sheet;\n this.area.setAttribute('data-ex-dragging', 'true');\n }\n\n #endDrag(): void {\n this.#dragFrom = undefined;\n this.area.removeAttribute('data-ex-dragging');\n }\n\n // The release on a tab, or past the last: the tab dragged moves there.\n #drop(event: MouseEvent, target: Sheet | undefined): void {\n event.stopPropagation();\n const from = this.#dragFrom;\n this.#endDrag();\n if (from === undefined || from === target || event.button !== 0) return;\n this.#hooks.dropped(from, target);\n }\n\n // A tab's face: the Chrome's, mounted again on the same slot when what it shows changes, or the name.\n #drawTabFace(tab: HTMLButtonElement, mount: SheetTabSlot | undefined, name: string, selected: boolean): void {\n if (mount === undefined) {\n this.#takeFace(tab);\n tab.removeAttribute('aria-label');\n if (tab.textContent !== name) tab.textContent = name;\n return;\n }\n // The face is the Chrome's; the tab's name for a screen reader stays the Sheet's, whatever the face shows.\n setAttr(tab, 'aria-label', name);\n const shown = JSON.stringify([name, selected]);\n this.#drawFace(tab, mount, shown, slot => mount(slot, Object.freeze({ name, selected })), 'sheetTab');\n }\n\n // The + button's face: the Chrome's, mounted once for each mount function, or the glyph.\n #drawAddFace(mount: SheetTabAddSlot | undefined): void {\n if (mount === undefined) {\n this.#takeFace(this.#add);\n if (this.#plus.parentElement !== this.#add) this.#add.replaceChildren(this.#plus);\n return;\n }\n this.#drawFace(this.#add, mount, '', slot => mount(slot), 'sheetTabAdd');\n }\n\n #drawFace(button: HTMLButtonElement, mount: unknown, shown: string, draw: (slot: HTMLElement) => unknown, name: string): void {\n const standing = this.#faces.get(button);\n if (standing !== undefined && standing.mount === mount && standing.shown === shown) return;\n let slot = standing?.slot;\n if (standing !== undefined) {\n this.#faces.delete(button);\n standing.cleanup();\n }\n if (slot === undefined) {\n slot = this.#doc.createElement('span');\n slot.className = 'ex-sheet-tab-face';\n button.replaceChildren(slot);\n }\n const at = slot;\n this.#faces.set(button, { slot: at, mount, shown, cleanup: mountedSlot(name, () => draw(at)) });\n }\n\n // Takes a Chrome's face away from a tab or the + button, where one stands.\n #takeFace(button: HTMLButtonElement): void {\n const standing = this.#faces.get(button);\n if (standing === undefined) return;\n this.#faces.delete(button);\n standing.cleanup();\n standing.slot.remove();\n }\n\n /** Gives the keyboard to the tab of `sheet`, where it stands: nothing scrolls. */\n focus(sheet: Sheet): void {\n this.#tabs.get(sheet)?.focus({ preventScroll: true });\n }\n\n /** Whether the keyboard is on the tab list. */\n get holdsKeyboard(): boolean {\n return this.#list.contains(this.#doc.activeElement);\n }\n\n /** Whether a name's field or a tab's menu holds the keyboard. */\n get gestureHoldsKeyboard(): boolean {\n const active = this.#doc.activeElement;\n return active !== null && ((this.#renaming?.element.contains(active) ?? false) || (this.#menu?.element.contains(active) ?? false)); // oxlint-disable-line ex-grid/no-stand-in-default -- no field or menu holds nothing\n }\n\n #tabOf(sheet: Sheet): HTMLButtonElement {\n const known = this.#tabs.get(sheet);\n if (known !== undefined) return known;\n const tab = this.#doc.createElement('button');\n tab.type = 'button';\n tab.className = 'ex-sheet-tab';\n tab.setAttribute('role', 'tab');\n tab.setAttribute('aria-haspopup', 'menu');\n tab.setAttribute('data-ex-claims', 'click dblclick contextmenu keydown');\n tab.addEventListener('mousedown', event => {\n event.preventDefault();\n this.#startDrag(event, sheet);\n });\n tab.addEventListener('mouseup', event => { this.#drop(event, sheet); });\n tab.addEventListener('click', () => { this.#hooks.pressed(sheet); });\n tab.addEventListener('dblclick', () => { this.#hooks.renameAsked(sheet); });\n tab.addEventListener('contextmenu', event => {\n event.preventDefault();\n this.#hooks.menuAsked(sheet);\n });\n this.#tabs.set(sheet, tab);\n return tab;\n }\n}\n", "// Written by tools/assets/minify.mjs (ADR-0123): do not edit. Edit dotnet/src/ExSheet/Assets/ and run it\n// again, and commit what it writes. test/shipped-stylesheet.test.ts checks it against the source.\n\n/** The name of the stylesheet the sheet draws against, by which its notice rules find the notice. */\nexport const stylesheetName = 'ex-sheet.css';\n\n/** The SHA-256 of that stylesheet's source: the stamp its own notice rule hides the notice for. */\nexport const stylesheetStamp = '17ce2ebd71ab40f9a773a2965946086201667a9c8f52525abd042a581c4c26f7';\n", "// A Toolbar Item drawn by the Consumer's Chrome (ADR-0100, ADR-0390): the C# Sheet's `ISheetChrome.ToolbarItem`, as a\n// mount function. The band keeps the item's place, its id, its active mark and its KeyTip; the contents draw the\n// item's control inside it, and may draw its list where they like, beside the Sheet or in their own popover. What the\n// item means stays the Sheet's: a press is `invoke`, a choice is handed back through `choicesClosed`, and the toolbar's\n// keys ask for the list through `openRequest`. A mount that answers nothing leaves the item to the built-in Chrome.\n\n/** A picture the built-in Chrome draws for a Toolbar Item. */\nexport type SheetToolbarIcon =\n | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'alignLeft' | 'alignCenter' | 'alignRight' | 'percent' | 'comma'\n | 'formatCells' | 'fontColour' | 'fill' | 'borders';\n\n/**\n * A Consumer's own content for a Toolbar Item (ADR-0100), such as an icon, drawn in place of its text: mounted into\n * `element`, it answers the function that takes it away. The item's text still names it, as its accessible name and its\n * tooltip. The C# `ToolbarButton`'s `ChildContent`.\n */\nexport type SheetToolbarContent = (element: HTMLElement) => () => void;\n\n/** What a Toolbar Item is: a split control's face does what it shows and its arrow opens its list; a menu opens its\n * list. */\nexport type SheetToolbarItemKind = 'toggle' | 'button' | 'split' | 'menu';\n\n/** One choice of a Toolbar Item's list, as the item's contents are handed it. */\nexport interface SheetToolbarItemChoice {\n /** Its words: a colour's name, a Number Format's category, a border preset's name. */\n readonly label: string;\n /** For a colour, the colour as CSS paints it: the label is its name. */\n readonly swatch: string | undefined;\n /** Whether it is what the Focus cell has. */\n readonly selected: boolean;\n /** Why it cannot be chosen, or `undefined` where it can. */\n readonly disabledReason: string | undefined;\n}\n\n/** What a Toolbar Item shows now: read through {@link SheetToolbarItemSlotContext.view}, the same object until\n * something in it changes. */\nexport interface SheetToolbarItemView {\n /** The item's name, the built-in Chrome's `aria-label`: `Fill Colour`. */\n readonly name: string;\n /** The name with its key, for the tooltip: `Bold (Ctrl+B)`. */\n readonly tooltip: string;\n /** The built-in Chrome's picture for it, or `undefined` for an item that shows its text. */\n readonly icon: SheetToolbarIcon | undefined;\n /** For a menu, the text its face shows: the Number Format's category; for a Consumer's button, its text, unless it\n * has `content`. */\n readonly text: string | undefined;\n /** For a Consumer's button, its own content, drawn in place of its text: the contents mount it into an element of\n * theirs, and call what it answers when they take that element away. */\n readonly content: SheetToolbarContent | undefined;\n /** For a colour control, the colour its face sets, as CSS paints it. */\n readonly swatch: string | undefined;\n /** For a split control, its arrow's name: `Borders, more`. */\n readonly moreName: string | undefined;\n /** For a toggle: whether the Focus cell has what it sets. */\n readonly pressed: boolean;\n /** Why it cannot be pressed now, or `undefined` where it can: while an edit is open, every item says so. */\n readonly disabledReason: string | undefined;\n /** Whether the toolbar's keyboard is on it, as the built-in Chrome outlines the item. */\n readonly active: boolean;\n /** For a menu or a split control, its list's choices, the Focus cell's marked; none otherwise. */\n readonly choices: readonly SheetToolbarItemChoice[];\n /** The count of the toolbar's requests for the list: \u2193, Enter or Space on a menu, or a KeyTip. Whenever it\n * differs from the one the contents last answered, they open their list and give it the keyboard; one they\n * cannot open is closed at once through `choicesClosed`, choosing nothing. It starts at 0, a request not yet\n * made. */\n readonly openRequest: number;\n /** Set to `openRequest` when the toolbar asks the list to close: it gives the keyboard back while the list it\n * asked for may still be opening, or what the list was opened over has changed \u2014 the Selection moved, another\n * Sheet shown, an operation run, the toolbar hidden \u2014 as each ends the built-in list. Where no request stood, both\n * move on together, so a list opened by a press closes too. The contents close their list, telling nothing, and\n * answer no `openRequest` that `closeRequest` has reached. */\n readonly closeRequest: number;\n}\n\n/**\n * What a Toolbar Item's contents are handed (ADR-0100, ADR-0390), once per mount: what the item is, and how it shows\n * now through `view` and `subscribe`, as the Cell Editor's slot is. The contents draw a control in the slot that keeps\n * the keyboard where it is on a pointer press (its `mousedown` default prevented), as the built-in items do. A control\n * marked `data-ex-claims=\"click\"`, as the built-in items are, has its press wait behind a commit or an opening and taken\n * in its turn (ADR-0240); the keys typed on the toolbar wait whatever the contents are.\n */\nexport interface SheetToolbarItemSlotContext {\n /** Stable for the item's place in the toolbar. */\n readonly id: string;\n /** What the item is, which decides whether it has a list. */\n readonly kind: SheetToolbarItemKind;\n /** What the item shows now. */\n readonly view: () => SheetToolbarItemView;\n /** Hears each change to the view; answers the function that stops hearing it. */\n readonly subscribe: (listener: () => void) => () => void;\n /** Presses the item as the built-in Chrome's does: a toggle or a button, a split control's face, or a menu's,\n * which opens the built-in list. An item that cannot be pressed now does nothing. */\n readonly invoke: () => void;\n /**\n * The contents' own list has closed: with the index of the choice made, or `undefined` for none, and whether\n * Escape closed it. The keyboard goes back to the Sheet, or to the KeyTips where Escape closes a list a KeyTip\n * opened, and the choice is then made, as the built-in list makes it. A choice that is not the list's, or one that\n * cannot be chosen, is refused by name.\n */\n readonly choicesClosed: (choice: number | undefined, escaped: boolean) => void;\n}\n\n/**\n * A Toolbar Item's slot (ADR-0390): mounts the item's contents in `slot` and answers the function that takes them\n * away, or answers `undefined` and draws nothing, for the built-in Chrome to draw the item, as the C# Chrome's\n * `ToolbarItem` answers null. Asked once per item, again only when the item's kind or the slot changes.\n */\nexport type SheetToolbarItemSlot = (slot: HTMLElement, context: SheetToolbarItemSlotContext) => (() => void) | undefined;\n\n/** What the contents' calls reach. */\nexport interface SlottedToolbarItemHooks {\n readonly invoke: () => void;\n readonly choicesClosed: (choice: number, escaped: boolean) => void;\n readonly closedChoosingNothing: (escaped: boolean) => void;\n}\n\n/** The view less what the slotted item counts itself. */\nexport type SheetToolbarItemShown = Omit<SheetToolbarItemView, 'openRequest' | 'closeRequest'>;\n\n/** An item the Chrome draws: its place in the band, its contents, and the view they read. */\nexport class SlottedToolbarItem {\n /** The item's place in the band, which wears its id, its active mark and its KeyTip. */\n readonly element: HTMLElement;\n readonly mount: SheetToolbarItemSlot;\n readonly kind: SheetToolbarItemKind;\n /** The KeyTip shown on it, while one is. */\n badge: HTMLElement | undefined;\n readonly #listeners = new Set<() => void>();\n #cleanup: (() => void) | undefined;\n #shown: SheetToolbarItemShown;\n #shownKey: string;\n #view: SheetToolbarItemView;\n #openRequest = 0;\n #closeRequest = 0;\n #live = true;\n\n private constructor(element: HTMLElement, mount: SheetToolbarItemSlot, kind: SheetToolbarItemKind, shown: SheetToolbarItemShown) {\n this.element = element;\n this.mount = mount;\n this.kind = kind;\n this.#shown = shown;\n this.#shownKey = JSON.stringify(shown);\n this.#view = this.#made();\n }\n\n /** Mounts the contents for the item, or answers `undefined` where the slot leaves it to the built-in Chrome. */\n static tryMount(doc: Document, id: string, kind: SheetToolbarItemKind, shown: SheetToolbarItemShown, mount: SheetToolbarItemSlot,\n hooks: SlottedToolbarItemHooks): SlottedToolbarItem | undefined {\n const element = doc.createElement('span');\n element.className = 'ex-sheet-toolbar-slot';\n const slot = doc.createElement('span');\n slot.className = 'ex-sheet-toolbar-slot-contents';\n element.append(slot);\n const made = new SlottedToolbarItem(element, mount, kind, shown);\n const context: SheetToolbarItemSlotContext = Object.freeze({\n id, kind,\n view: () => made.#view,\n subscribe: (listener: () => void) => {\n if (typeof listener !== 'function') throw new TypeError('subscribe is handed the function that hears each change to the view.');\n made.#listeners.add(listener);\n return () => { made.#listeners.delete(listener); };\n },\n invoke: () => { if (made.#live) hooks.invoke(); },\n choicesClosed: (choice: number | undefined, escaped: boolean) => {\n // Checked as a script may hand it, whatever its type says.\n const index: unknown = choice;\n if (index !== undefined && (typeof index !== 'number' || !Number.isInteger(index))) {\n throw new TypeError('choicesClosed is handed the index of the choice made, or undefined for none (ADR-0100).');\n }\n if (typeof escaped !== 'boolean') throw new TypeError('choicesClosed is handed whether Escape closed the list (ADR-0100).');\n if (!made.#live) return;\n if (choice === undefined) hooks.closedChoosingNothing(escaped);\n else hooks.choicesClosed(choice, escaped);\n },\n });\n const cleanup: unknown = mount(slot, context);\n if (cleanup === undefined) {\n // Left to the built-in Chrome: the context handed reaches nothing.\n made.#live = false;\n return undefined;\n }\n if (typeof cleanup !== 'function') {\n throw new TypeError('A toolbarItem slot answers the function that takes its contents away, or undefined for the built-in item (ADR-0390).');\n }\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- checked a function just above, the cleanup the slot's type answers\n made.#cleanup = cleanup as () => void;\n return made;\n }\n\n /** What the item shows now: the contents hear it where it changed. */\n show(shown: SheetToolbarItemShown): void {\n // A function is not written by JSON: the content is compared as itself.\n const key = JSON.stringify(shown);\n if (key === this.#shownKey && shown.content === this.#shown.content) return;\n this.#shown = shown;\n this.#shownKey = key;\n this.#changed();\n }\n\n /** Whether the toolbar's keyboard is on the item. */\n setActive(active: boolean): void {\n if (this.#shown.active !== active) this.show({ ...this.#shown, active });\n }\n\n /** The toolbar's keys ask for the list. */\n requestOpen(): void {\n this.#openRequest += 1;\n this.#changed();\n }\n\n /** The toolbar asks the list to close: the one it asked for, or, where no request stands, any the contents opened. */\n requestClose(): void {\n if (this.#closeRequest === this.#openRequest) this.#openRequest += 1;\n this.#closeRequest = this.#openRequest;\n this.#changed();\n }\n\n /** Takes the contents away; their calls reach nothing from now on. */\n dispose(): void {\n if (!this.#live) return;\n this.#live = false;\n this.#listeners.clear();\n const cleanup = this.#cleanup;\n this.#cleanup = undefined;\n this.element.remove();\n cleanup?.();\n }\n\n #changed(): void {\n this.#view = this.#made();\n for (const listener of this.#listeners) listener();\n }\n\n #made(): SheetToolbarItemView {\n return Object.freeze({ ...this.#shown, openRequest: this.#openRequest, closeRequest: this.#closeRequest });\n }\n}\n", "// The Sheet Toolbar's band (ADR-0100): above the Formula Bar, inside the Sheet's box and outside the grid's root, so\n// the grid's key listener never hears a key pressed here. It is ARIA's toolbar: one tab stop, which names the item\n// the keyboard is on through aria-activedescendant. \u2190 and \u2192 move among the items that can be pressed, Home and End go\n// to the ends, Enter and Space press one and give the keyboard back to the Sheet, and Escape gives it back. A menu, and a\n// split control's arrow, open their list: Enter or Space on a menu, \u2193 or Alt+\u2193 on either, or a press. A pointer\n// press keeps the keyboard where it is (mousedown's default is prevented), as Excel's ribbon leaves it in the cell.\n// While an edit is open every item is unavailable.\n//\n// The KeyTips take the keyboard to the band, as Excel's Alt takes it to the ribbon: the rows' letters first, a row's\n// letter its items' letters, an item's letters press it, or open its list (Alt, H, H opens the Fill's palette). Letters\n// typed that narrow a level are a level of their own, as Excel's Format menu is behind O. Escape goes back one level,\n// from the rows' letters to the Sheet, as Excel's does (the Windows readings of 2026-10-12, R2); any other key ends\n// them and does nothing, and every key typed while they stand is theirs, its default too. The elements wear the C# Sheet's classes, so one stylesheet lays\n// out both. What an item means is the Sheet's: this draws, and reports what was pressed.\n//\n// A Chrome's toolbarItem slot may draw an item in the band's place for it (ADR-0390): the band keeps the keys, the\n// active mark and the KeyTip, and asks for the item's list through the item's openRequest rather than opening the\n// built-in one.\n\nimport type { SheetToolbarChoice } from './sheet-choices';\nimport { preventDefault, setAttr } from './dom-attributes';\nimport { SlottedToolbarItem, type SheetToolbarContent, type SheetToolbarIcon, type SheetToolbarItemKind, type SheetToolbarItemShown, type SheetToolbarItemSlot } from './sheet-toolbar-slot';\n\nexport type { SheetToolbarIcon } from './sheet-toolbar-slot';\n\n/** One Toolbar Item as one pass shows it. */\nexport interface SheetToolbarItem {\n /** Stable within the toolbar: the element's id is made from it, so the item the keyboard is on stays named. */\n readonly key: string;\n /** A split control's face does what it shows and its arrow opens its list; a menu opens its list. */\n readonly kind: SheetToolbarItemKind;\n readonly name: string;\n /** The name with its key, for the tooltip: `Bold (Ctrl+B)`. */\n readonly tooltip: string;\n /** The picture, or `undefined` for an item that shows its text instead. */\n readonly icon: SheetToolbarIcon | undefined;\n /** For a menu, the text its face shows: the Number Format's category. */\n readonly text: string | undefined;\n /** For a Consumer's button, its own content, drawn in place of its text. */\n readonly content: SheetToolbarContent | undefined;\n /** For a colour control, the colour its face sets, as CSS paints it. */\n readonly swatch: string | undefined;\n /** For a split control, its arrow's name: `Borders, more`. */\n readonly moreName: string | undefined;\n /** For a toggle: whether the Focus cell has what it sets. */\n readonly pressed: boolean;\n /** Why it cannot be pressed now, or `undefined` where it can. */\n readonly disabledReason: string | undefined;\n /** What a press does; `undefined` for an item that is never pressed, whose `disabledReason` says why. */\n readonly press: (() => void) | undefined;\n /** For a menu or a split control, what opens its list; `keyTipRow` is the row whose KeyTips opened it, which Escape\n * there goes back to, or `undefined` where no KeyTip did. */\n readonly open: ((keyTipRow: number | undefined) => void) | undefined;\n /** For a menu or a split control, its list's choices as they stand now, which a Chrome-drawn item is handed. */\n readonly list: (() => readonly SheetToolbarChoice[]) | undefined;\n /** Its KeyTip letters, Excel's Home tab's, or `undefined` for none. */\n readonly keyTip: string | undefined;\n}\n\n/** A Toolbar Row as one pass shows it. */\nexport interface SheetToolbarRow {\n readonly label: string;\n /** Its KeyTip letter, a ribbon tab's: the formatting row's is H, Excel's Home. */\n readonly keyTip: string | undefined;\n readonly items: readonly (SheetToolbarItem | 'separator')[];\n}\n\n/** What one pass shows: the rows of items, a separator between groups. */\nexport interface SheetToolbarPaint {\n readonly rows: readonly SheetToolbarRow[];\n readonly rowHeightPx: number;\n readonly name: string;\n /** The Chrome's slot for each item, or `undefined` for the built-in items alone. */\n readonly itemSlot: SheetToolbarItemSlot | undefined;\n}\n\n/** What the band tells the Sheet. */\nexport interface SheetToolbarHooks {\n /** The keyboard goes back to the Sheet: after a press from the keys, or Escape. */\n readonly giveBack: () => void;\n /** A Chrome-drawn item's list made a choice, the keyboard given back: the Sheet makes it, as the built-in list's. */\n readonly chosen: (choice: SheetToolbarChoice) => void;\n /** The band's keys ask for a Chrome-drawn item's list: the Sheet notes what it is opened over. */\n readonly opening: () => void;\n}\n\nconst svgOpen = '<svg class=\"ex-sheet-toolbar-icon\" viewBox=\"0 0 16 16\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\">';\n\n/**\n * The built-in Chrome's pictures for the Toolbar Items (ADR-0100), the C# Chrome's: each the inside of an SVG of view\n * box `0 0 16 16`, drawn with `fill=\"none\"` and `stroke=\"currentColor\"`, round caps and joins, so the colour is the\n * text's. A Chrome without pictures of its own draws these.\n */\nexport const sheetToolbarPictures: Readonly<Record<SheetToolbarIcon, string>> = Object.freeze({\n bold: '<path stroke-width=\"2\" d=\"M4.5 2.5h4a2.75 2.75 0 0 1 0 5.5h-4zM4.5 8h4.75a2.75 2.75 0 0 1 0 5.5H4.5z\"/>',\n italic: '<path stroke-width=\"1.5\" d=\"M7 2.5h6M3 13.5h6M10 2.5 6 13.5\"/>',\n underline: '<path stroke-width=\"1.5\" d=\"M4.5 2v5.5a3.5 3.5 0 0 0 7 0V2M3 14.5h10\"/>',\n strikethrough: '<path stroke-width=\"1.5\" d=\"M11 4.5C11 3.2 9.7 2.2 8 2.2S5 3.2 5 4.5c0 1.4 1.2 2.2 3 2.6M5 11.5c0 1.3 1.3 2.3 3 2.3s3-1 3-2.3M2 8.5h12\"/>',\n alignLeft: '<path stroke-width=\"1.5\" d=\"M2 3h12M2 6.5h8M2 10h12M2 13.5h8\"/>',\n alignCenter: '<path stroke-width=\"1.5\" d=\"M2 3h12M4 6.5h8M2 10h12M4 13.5h8\"/>',\n alignRight: '<path stroke-width=\"1.5\" d=\"M2 3h12M6 6.5h8M2 10h12M6 13.5h8\"/>',\n percent: '<path stroke-width=\"1.5\" d=\"M3 13 13 3\"/><circle cx=\"4.5\" cy=\"4.5\" r=\"1.75\" stroke-width=\"1.25\"/><circle cx=\"11.5\" cy=\"11.5\" r=\"1.75\" stroke-width=\"1.25\"/>',\n formatCells: '<path stroke-width=\"1.25\" d=\"M2 2.5h12v11H2zM2 5.5h12M5 5.5v8\"/><path stroke-width=\"1.25\" d=\"M8 9h4M8 11.5h3\"/>',\n comma: '<circle cx=\"8\" cy=\"9\" r=\"1.5\" fill=\"currentColor\" stroke=\"none\"/><path stroke-width=\"1.5\" d=\"M9.4 9.2c0 2.2-.8 3.6-2.4 4.6\"/>',\n fontColour: '<path stroke-width=\"1.5\" d=\"M4 11.5 8 2l4 9.5M5.5 8h5\"/>',\n fill: '<path stroke-width=\"1.25\" d=\"M2.5 7.5 7 3l4.5 4.5L7 12zM5 1.5 7 3M13 9.5s1.5 1.8 1.5 2.8a1.5 1.5 0 0 1-3 0c0-1 1.5-2.8 1.5-2.8\"/>',\n borders: '<path stroke-width=\"1.25\" stroke-dasharray=\"1.5 1.5\" d=\"M2 8h12M8 2v12\"/><path stroke-width=\"1.5\" d=\"M2 2h12v12H2z\"/>',\n});\n\n// The arrow a menu or a split control's list opens from.\nconst caret = `${svgOpen}<path stroke-width=\"1.5\" d=\"M4.5 6.5 8 10l3.5-3.5\"/></svg>`;\n\n// What an element of an item is drawn from: kept, so a pass that changes nothing writes nothing.\ninterface BuiltInDrawn {\n readonly element: HTMLElement;\n readonly buttons: readonly HTMLButtonElement[];\n readonly face: HTMLButtonElement;\n readonly kind: SheetToolbarItemKind;\n picture: string | undefined;\n // The Consumer's content drawn on the face, and what takes it away, while it is.\n content: SheetToolbarContent | undefined;\n unmount: (() => void) | undefined;\n // The KeyTip shown on it, while one is.\n badge: HTMLElement | undefined;\n // The Chrome's slot that left it to the built-in Chrome, which is not asked again.\n readonly declinedBy: SheetToolbarItemSlot | undefined;\n}\n\ntype Drawn = BuiltInDrawn | SlottedToolbarItem;\n\n// The KeyTips standing: the rows' letters, or one row's items' letters; and the letters typed at that level so far.\ninterface KeyTips {\n readonly row: number | undefined;\n readonly typed: string;\n}\n\nlet instances = 0;\n\n/** The band and its items' buttons, each made once for its key and kept while the key is shown. */\nexport class SheetToolbar {\n readonly band: HTMLElement;\n readonly #doc: Document;\n readonly #hooks: SheetToolbarHooks;\n readonly #prefix: string;\n readonly #rows: HTMLElement[] = [];\n // Each row's separators, the n-th kept for the n-th gap between groups.\n readonly #separators = new Map<HTMLElement, HTMLElement[]>();\n readonly #drawn = new Map<string, Drawn>();\n #items: readonly SheetToolbarItem[] = [];\n // The item the keyboard is on while the band holds it: its key, so a repaint keeps it.\n #active: string | undefined;\n #painted: SheetToolbarPaint | undefined;\n #disposed = false;\n // The KeyTips while they stand.\n #keyTips: KeyTips | undefined;\n // What a Chrome's slot threw in this pass, thrown once the pass is done: the item is the built-in Chrome's.\n #failed: Error | undefined;\n readonly #rowBadges = new Map<HTMLElement, HTMLElement>();\n // The list the band's keys asked a Chrome-drawn item for, until it closes: the item's key, and the row whose\n // KeyTips asked, which Escape in the list goes back to.\n #requested: { readonly key: string; readonly keyTipRow: number | undefined } | undefined;\n\n constructor(doc: Document, hooks: SheetToolbarHooks) {\n this.#doc = doc;\n this.#hooks = hooks;\n this.#prefix = `ex-sheet-toolbar-${String(++instances)}-`;\n this.band = doc.createElement('div');\n this.band.className = 'ex-sheet-toolbar';\n this.band.setAttribute('role', 'toolbar');\n this.band.setAttribute('aria-orientation', 'horizontal');\n this.band.tabIndex = 0;\n this.band.addEventListener('keydown', this.#onKey);\n // A press anywhere on the band keeps the keyboard where it is: on a button, a disabled one, a separator or the\n // gap between them, none of which takes it from the Sheet.\n this.band.addEventListener('mousedown', preventDefault);\n // The keyboard arriving by Tab lands on the item it last stood on, or on the first that can be pressed.\n this.band.addEventListener('focus', () => {\n // The KeyTips take it with no item active, as the C# toolbar's do: the letters choose.\n if (this.#keyTips !== undefined) return;\n if (this.#activeItem() === undefined) this.#active = this.#enabled()[0]?.key;\n this.#showActive();\n });\n this.band.addEventListener('blur', () => {\n // The keyboard left the band, by a press elsewhere or Tab: the KeyTips go with it.\n if (this.#keyTips !== undefined) this.#showKeyTips(undefined);\n this.#showActive();\n });\n }\n\n /** Whether the KeyTips stand. */\n get showsKeyTips(): boolean {\n return this.#keyTips !== undefined;\n }\n\n /** Starts the KeyTips, the rows' letters, and takes the keyboard to the band; false where no row has a letter. */\n startKeyTips(): boolean {\n if (this.#painted?.rows.some(row => row.keyTip !== undefined) !== true) return false;\n this.#withdrawRequest();\n this.#showKeyTips({ row: undefined, typed: '' });\n this.band.focus({ preventScroll: true });\n return true;\n }\n\n /** Escape in a list a KeyTip opened: back to the letters of the row it was opened from, the keyboard on the band. */\n backToKeyTips(row: number): void {\n this.#showKeyTips({ row, typed: '' });\n this.band.focus({ preventScroll: true });\n }\n\n /** Ends the KeyTips where they stand without moving the keyboard, as the band is taken away. */\n dropKeyTips(): void {\n this.#keyTips = undefined;\n }\n\n /** The band's height for `rows` rows of `rowHeightPx`. */\n static heightPx(rows: number, rowHeightPx: number): number {\n return rows * rowHeightPx;\n }\n\n paint(paint: SheetToolbarPaint): void {\n // A band gone with its Sheet is drawn no more: a Chrome's slots, gone before it, would be mounted again.\n if (this.#disposed) return;\n this.#painted = paint;\n setAttr(this.band, 'aria-label', paint.name);\n setAttr(this.band, 'style', `height: ${String(SheetToolbar.heightPx(paint.rows.length, paint.rowHeightPx))}px; --ex-sheet-toolbar-row-height: ${String(paint.rowHeightPx)}px`);\n while (this.#rows.length > paint.rows.length) {\n const row = this.#rows.pop();\n if (row === undefined) break;\n this.#separators.delete(row);\n this.#rowBadges.delete(row);\n row.remove();\n }\n const items: SheetToolbarItem[] = [];\n const shown = new Set<string>();\n paint.rows.forEach((row, r) => {\n const element = this.#rowAt(r);\n setAttr(element, 'aria-label', row.label);\n setAttr(element, 'style', `height: ${String(paint.rowHeightPx)}px`);\n let gaps = 0;\n const children = row.items.map(item => {\n if (item === 'separator') return this.#separator(element, gaps++);\n items.push(item);\n shown.add(item.key);\n return this.#paintItem(item, this.#keyTipShown(r, item.keyTip));\n });\n const tips = this.#keyTips;\n if (tips !== undefined && tips.row === undefined && row.keyTip !== undefined && row.keyTip.startsWith(tips.typed)) {\n children.unshift(this.#rowBadge(element, row.keyTip));\n }\n const current = [...element.children];\n if (current.length !== children.length || children.some((child, i) => current[i] !== child)) element.replaceChildren(...children);\n });\n for (const [key, drawn] of this.#drawn) {\n if (shown.has(key)) continue;\n this.#takeAway(drawn);\n this.#drawn.delete(key);\n }\n this.#items = items;\n const failed = this.#failed;\n this.#failed = undefined;\n // The item the keyboard was on went, or can no longer be pressed: the nearest that can, from the start.\n if (this.#active !== undefined && this.#activeItem() === undefined) this.#active = this.#enabled()[0]?.key;\n this.#showActive();\n if (failed !== undefined) throw failed;\n }\n\n /** What the Chrome-drawn lists were opened over has changed, as it ends the built-in list: each is asked to close. */\n endLists(): void {\n this.#requested = undefined;\n for (const drawn of this.#drawn.values()) {\n if (drawn instanceof SlottedToolbarItem && (drawn.kind === 'menu' || drawn.kind === 'split')) drawn.requestClose();\n }\n }\n\n /** Takes every Chrome-drawn item's contents away, as the Sheet goes. */\n dispose(): void {\n this.#disposed = true;\n // The KeyTips go with the band: its blur, as the Sheet empties its element, has none to take away.\n this.#keyTips = undefined;\n for (const drawn of this.#drawn.values()) this.#takeAway(drawn);\n this.#drawn.clear();\n this.#requested = undefined;\n }\n\n /** Whether the keyboard is on the band. */\n get holdsKeyboard(): boolean {\n return this.#doc.activeElement === this.band;\n }\n\n #rowAt(index: number): HTMLElement {\n const known = this.#rows[index];\n if (known !== undefined) return known;\n const row = this.#doc.createElement('div');\n row.className = 'ex-sheet-toolbar-row';\n row.setAttribute('role', 'group');\n this.#rows.push(row);\n this.band.append(row);\n return row;\n }\n\n #separator(row: HTMLElement, ordinal: number): HTMLElement {\n const kept = this.#separators.get(row) ?? []; // oxlint-disable-line ex-grid/no-stand-in-default -- a row not yet holding a separator starts with none\n this.#separators.set(row, kept);\n const known = kept[ordinal];\n if (known !== undefined) return known;\n const separator = this.#doc.createElement('span');\n separator.className = 'ex-sheet-toolbar-separator';\n separator.setAttribute('role', 'separator');\n separator.setAttribute('aria-orientation', 'vertical');\n kept.push(separator);\n return separator;\n }\n\n // The letters an item shows while its row's KeyTips stand, those that begin with what was typed.\n #keyTipShown(row: number, letters: string | undefined): string | undefined {\n const tips = this.#keyTips;\n return tips?.row === row && letters?.startsWith(tips.typed) === true ? letters : undefined;\n }\n\n #rowBadge(row: HTMLElement, letters: string): HTMLElement {\n const badge = this.#badge(this.#rowBadges.get(row), letters, 'ex-sheet-keytip ex-sheet-row-keytip');\n this.#rowBadges.set(row, badge);\n return badge;\n }\n\n // A KeyTip's badge, the one kept or a new one, showing `letters`.\n #badge(kept: HTMLElement | undefined, letters: string, className: string): HTMLElement {\n const badge = kept ?? this.#doc.createElement('span');\n setAttr(badge, 'class', className);\n setAttr(badge, 'aria-hidden', 'true');\n if (badge.textContent !== letters) badge.textContent = letters;\n return badge;\n }\n\n #paintItem(item: SheetToolbarItem, keyTip: string | undefined): HTMLElement {\n const drawn = this.#drawnOf(item);\n if (drawn instanceof SlottedToolbarItem) {\n drawn.show(this.#shownOf(item, drawn.element.classList.contains('ex-sheet-toolbar-active')));\n drawn.badge = this.#placeBadge(drawn.element, drawn.badge, keyTip);\n return drawn.element;\n }\n const title = item.disabledReason === undefined ? item.tooltip : `${item.tooltip}: ${item.disabledReason}`;\n setAttr(drawn.face, 'title', title);\n setAttr(drawn.face, 'aria-label', item.name);\n if (item.kind === 'split') {\n setAttr(drawn.element, 'aria-label', item.name);\n const arrow = drawn.buttons[1];\n if (arrow === undefined || item.moreName === undefined) throw new Error(`Internal: the split control '${item.key}' has an arrow, and names it.`);\n setAttr(arrow, 'title', title);\n setAttr(arrow, 'aria-label', item.moreName);\n }\n if (item.kind === 'toggle') setAttr(drawn.face, 'aria-pressed', item.pressed ? 'true' : 'false');\n else drawn.face.removeAttribute('aria-pressed');\n const disabled = item.disabledReason !== undefined;\n for (const button of drawn.buttons) if (button.disabled !== disabled) button.disabled = disabled;\n drawn.element.classList.toggle('ex-sheet-toolbar-pressed', item.kind === 'toggle' && item.pressed);\n const picture = JSON.stringify([item.icon, item.text, item.swatch]);\n if (drawn.picture !== picture || drawn.content !== item.content) {\n drawn.picture = picture;\n this.#drawFace(drawn, item);\n }\n drawn.badge = this.#placeBadge(drawn.element, drawn.badge, keyTip);\n return drawn.element;\n }\n\n // The KeyTip stands last in the item, over its face, as the C# Chrome draws it.\n #placeBadge(element: HTMLElement, kept: HTMLElement | undefined, keyTip: string | undefined): HTMLElement | undefined {\n if (keyTip === undefined) {\n kept?.remove();\n return undefined;\n }\n const badge = this.#badge(kept, keyTip, 'ex-sheet-keytip');\n if (badge.parentElement !== element || element.lastChild !== badge) element.append(badge);\n return badge;\n }\n\n // What a Chrome-drawn item's contents are told it shows.\n #shownOf(item: SheetToolbarItem, active: boolean): SheetToolbarItemShown {\n return {\n name: item.name, tooltip: item.tooltip, icon: item.icon, text: item.text, content: item.content, swatch: item.swatch, moreName: item.moreName,\n pressed: item.pressed, disabledReason: item.disabledReason, active,\n choices: item.list?.().map(({ label, swatch, selected, disabledReason }) => ({ label, swatch, selected, disabledReason })) ?? [], // oxlint-disable-line ex-grid/no-stand-in-default -- ADR-0100: an item with no list, a toggle or a button, has no choices\n };\n }\n\n // The face's contents: the picture, a menu's text and its caret, a colour control's swatch; or a Consumer's own\n // content in their place.\n #drawFace(drawn: BuiltInDrawn, item: SheetToolbarItem): void {\n const { face } = drawn;\n this.#unmountContent(drawn);\n face.replaceChildren();\n if (item.content !== undefined) {\n const element = this.#doc.createElement('span');\n element.className = 'ex-sheet-toolbar-content';\n face.append(element);\n // Not mounted again on every pass where it fails: what it throws is thrown once this pass has drawn the rest.\n drawn.content = item.content;\n try {\n drawn.unmount = mountedContent(item.content, element, item.name);\n } catch (error: unknown) { // oxlint-disable-line ex-grid/no-catch -- ADR-0390: rethrown by paint once the pass has drawn the rest\n this.#failed ??= error instanceof Error ? error : new Error(`The content of the toolbar button '${item.name}' threw something that is not an Error.`, { cause: error });\n }\n return;\n }\n if (item.icon !== undefined) face.insertAdjacentHTML('beforeend', `${svgOpen}${sheetToolbarPictures[item.icon]}</svg>`);\n if (item.text !== undefined) {\n const text = this.#doc.createElement('span');\n text.className = 'ex-sheet-toolbar-text';\n text.textContent = item.text;\n face.append(text);\n }\n if (item.swatch !== undefined) {\n const swatch = this.#doc.createElement('span');\n swatch.className = 'ex-sheet-toolbar-swatch';\n // The colour is the user's choice, document data painted as recorded (ADR-0071).\n swatch.style.backgroundColor = item.swatch;\n face.append(swatch);\n }\n if (item.kind === 'menu') face.insertAdjacentHTML('beforeend', caret);\n }\n\n #drawnOf(item: SheetToolbarItem): Drawn {\n const known = this.#drawn.get(item.key);\n const slot = this.#painted?.itemSlot;\n if (known !== undefined && known.kind === item.kind\n && (known instanceof SlottedToolbarItem ? known.mount === slot : slot === undefined || known.declinedBy === slot)) return known;\n if (known !== undefined) this.#takeAway(known);\n this.#drawn.delete(item.key);\n const id = `${this.#prefix}${item.key}`;\n let declinedBy: SheetToolbarItemSlot | undefined;\n if (slot !== undefined) {\n // Not asked again on every pass where it fails, or answers that the built-in Chrome draws the item. What it\n // throws is thrown once this pass has drawn the rest.\n declinedBy = slot;\n let slotted: SlottedToolbarItem | undefined;\n try {\n slotted = SlottedToolbarItem.tryMount(this.#doc, item.key, item.kind, this.#shownOf(item, false), slot, {\n invoke: () => { this.#invoke(item.key); },\n choicesClosed: (choice, escaped) => { this.#choicesClosed(item.key, choice, escaped); },\n closedChoosingNothing: escaped => { this.#choicesClosed(item.key, undefined, escaped); },\n });\n } catch (error: unknown) { // oxlint-disable-line ex-grid/no-catch -- ADR-0390: rethrown by paint once the pass has drawn the rest\n this.#failed ??= error instanceof Error ? error : new Error('A toolbarItem slot threw something that is not an Error.', { cause: error });\n }\n if (slotted !== undefined) {\n slotted.element.id = id;\n slotted.element.dataset['exKind'] = item.kind;\n this.#drawn.set(item.key, slotted);\n return slotted;\n }\n }\n const button = (className: string, act: () => void): HTMLButtonElement => {\n const made = this.#doc.createElement('button');\n made.type = 'button';\n made.className = className;\n made.tabIndex = -1;\n // A press keeps the keyboard where it is: on the Sheet, where the next key acts on what the command left.\n // Its press takes its place in the Sheet's order, behind a commit or an opening (ADR-0240).\n made.setAttribute('data-ex-claims', 'click');\n made.addEventListener('mousedown', preventDefault);\n made.addEventListener('click', act);\n return made;\n };\n const press = (): void => { this.#pressOf(item.key)?.(); };\n const open = (): void => { this.#openFromBand(item.key); };\n let drawn: Drawn;\n if (item.kind === 'split') {\n const group = this.#doc.createElement('span');\n group.className = 'ex-sheet-toolbar-item ex-sheet-toolbar-split';\n group.setAttribute('role', 'group');\n const face = button('ex-sheet-toolbar-face', press);\n const arrow = button('ex-sheet-toolbar-arrow', open);\n arrow.setAttribute('aria-haspopup', 'menu');\n arrow.innerHTML = caret;\n group.append(face, arrow);\n drawn = { element: group, buttons: [face, arrow], face, kind: item.kind, picture: undefined, content: undefined, unmount: undefined, badge: undefined, declinedBy };\n } else {\n const face = button(item.kind === 'menu' ? 'ex-sheet-toolbar-item ex-sheet-toolbar-menu' : 'ex-sheet-toolbar-item', item.kind === 'menu' ? open : press);\n if (item.kind === 'menu') face.setAttribute('aria-haspopup', 'menu');\n drawn = { element: face, buttons: [face], face, kind: item.kind, picture: undefined, content: undefined, unmount: undefined, badge: undefined, declinedBy };\n }\n drawn.element.id = id;\n drawn.element.dataset['exKind'] = item.kind;\n this.#drawn.set(item.key, drawn);\n return drawn;\n }\n\n // The item by its key, as the last pass described it: a press acts on what is shown now, never on a closure\n // a pass replaced.\n #pressOf(key: string): (() => void) | undefined {\n return this.#shownItem(key)?.press;\n }\n\n // Opens an item's list from a press or the band's keys, not a KeyTip; answers whether the item has one.\n #openFromBand(key: string): boolean {\n const item = this.#shownItem(key);\n if (item?.open === undefined) return false;\n this.#openList(item, undefined);\n return true;\n }\n\n // Opens an item's list: the built-in one, or, for a Chrome-drawn item, the Chrome's, which the band asks for.\n #openList(item: SheetToolbarItem, keyTipRow: number | undefined): void {\n const drawn = this.#drawn.get(item.key);\n if (!(drawn instanceof SlottedToolbarItem)) {\n item.open?.(keyTipRow);\n return;\n }\n this.#withdrawRequest();\n this.#hooks.opening();\n this.#requested = { key: item.key, keyTipRow };\n drawn.requestOpen();\n }\n\n // The keyboard goes back to the Sheet from the band's own keys: a list asked for and not yet closed is closed.\n #giveBack(): void {\n this.#withdrawRequest();\n this.#hooks.giveBack();\n }\n\n #withdrawRequest(): void {\n const requested = this.#requested;\n if (requested === undefined) return;\n this.#requested = undefined;\n const drawn = this.#drawn.get(requested.key);\n if (drawn instanceof SlottedToolbarItem) drawn.requestClose();\n }\n\n // A Chrome-drawn item's press: as the built-in item's, a menu's opening the built-in list.\n #invoke(key: string): void {\n const item = this.#shownItem(key);\n if (item === undefined) return;\n if (item.kind === 'menu') item.open?.(undefined);\n else item.press?.();\n }\n\n // A Chrome-drawn item's list closed: the keyboard goes back, to the KeyTips after Escape in a list one opened, and\n // the choice is then made.\n #choicesClosed(key: string, choice: number | undefined, escaped: boolean): void {\n const requested = this.#requested?.key === key ? this.#requested : undefined;\n if (requested !== undefined) this.#requested = undefined;\n if (choice === undefined) {\n if (escaped && requested?.keyTipRow !== undefined) this.backToKeyTips(requested.keyTipRow);\n // A list the band asked to close, closing late, leaves the keyboard where the band has it: on its KeyTips.\n else if (!this.holdsKeyboard) this.#hooks.giveBack();\n return;\n }\n const choices = this.#items.find(item => item.key === key)?.list?.() ?? []; // oxlint-disable-line ex-grid/no-stand-in-default -- an item with no list has no choice to make, and the index is refused below\n const made = choices[choice];\n if (made === undefined) throw new RangeError(`choicesClosed is handed the index of one of the item's ${String(choices.length)} choices, not ${String(choice)} (ADR-0100).`);\n if (made.disabledReason !== undefined) throw new Error(`The choice '${made.label}' cannot be made: ${made.disabledReason}`);\n this.#hooks.giveBack();\n this.#hooks.chosen(made);\n }\n\n #takeAway(drawn: Drawn): void {\n if (drawn instanceof SlottedToolbarItem) {\n if (this.#requested !== undefined && this.#drawn.get(this.#requested.key) === drawn) this.#requested = undefined;\n drawn.dispose();\n } else {\n this.#unmountContent(drawn);\n drawn.element.remove();\n }\n }\n\n // The Consumer's content goes with the face it was drawn on.\n #unmountContent(drawn: BuiltInDrawn): void {\n const unmount = drawn.unmount;\n drawn.content = undefined;\n drawn.unmount = undefined;\n unmount?.();\n }\n\n #shownItem(key: string): SheetToolbarItem | undefined {\n return this.#items.find(shown => shown.key === key && shown.disabledReason === undefined);\n }\n\n #enabled(): SheetToolbarItem[] {\n return this.#items.filter(item => item.disabledReason === undefined);\n }\n\n #activeItem(): SheetToolbarItem | undefined {\n return this.#enabled().find(item => item.key === this.#active);\n }\n\n #showActive(): void {\n const active = this.holdsKeyboard && this.#keyTips === undefined ? this.#activeItem() : undefined;\n for (const [key, drawn] of this.#drawn) {\n drawn.element.classList.toggle('ex-sheet-toolbar-active', key === active?.key);\n if (drawn instanceof SlottedToolbarItem) drawn.setActive(key === active?.key);\n }\n if (active === undefined) this.band.removeAttribute('aria-activedescendant');\n else setAttr(this.band, 'aria-activedescendant', `${this.#prefix}${active.key}`);\n }\n\n readonly #onKey = (event: KeyboardEvent): void => {\n if (event.isComposing || event.target !== this.band) return;\n if (this.#keyTips !== undefined) {\n event.preventDefault();\n event.stopPropagation();\n this.#keyTipKey(event, this.#keyTips);\n return;\n }\n if (event.ctrlKey || event.metaKey) return;\n const enabled = this.#enabled();\n const at = enabled.findIndex(item => item.key === this.#active);\n const active = enabled[at];\n // \u2193 or Alt+\u2193 opens a menu's or a split control's list, which takes the keyboard; Alt and nothing else.\n if (event.key === 'ArrowDown') {\n if (active === undefined || !this.#openFromBand(active.key)) return;\n event.preventDefault();\n return;\n }\n if (event.altKey) return;\n const move = (to: SheetToolbarItem | undefined): void => {\n if (to !== undefined) this.#active = to.key;\n this.#showActive();\n };\n switch (event.key) {\n case 'ArrowRight': move(enabled[at + 1]); break;\n case 'ArrowLeft': move(at > 0 ? enabled[at - 1] : undefined); break;\n case 'Home': move(enabled[0]); break;\n case 'End': move(enabled.at(-1)); break;\n case 'Enter':\n case ' ': {\n if (active?.kind === 'menu') {\n if (!this.#openFromBand(active.key)) return;\n break;\n }\n const press = active === undefined ? undefined : this.#pressOf(active.key);\n if (press === undefined) return;\n // The keyboard goes back before the press, so an item that opens what takes it (Format Cells) keeps it.\n this.#giveBack();\n press();\n break;\n }\n case 'Escape': this.#giveBack(); break;\n default: return;\n }\n event.preventDefault();\n };\n\n // A key while the KeyTips stand (ADR-0100).\n #keyTipKey(event: KeyboardEvent, tips: KeyTips): void {\n if (event.key === 'Escape') {\n if (tips.typed !== '') this.#showKeyTips({ row: tips.row, typed: '' });\n else if (tips.row !== undefined) this.#showKeyTips({ row: undefined, typed: '' });\n else this.#endKeyTips();\n return;\n }\n // Shift and Caps Lock change no letter the KeyTips read, which are matched in capitals: the letter they come\n // before is still to come.\n if (event.key === 'Shift' || event.key === 'CapsLock') return;\n if (event.key.length !== 1 || event.ctrlKey || event.metaKey || event.altKey) {\n this.#endKeyTips();\n return;\n }\n const typed = tips.typed + event.key.toUpperCase();\n const painted = this.#painted;\n if (painted === undefined) throw new Error('Internal: the KeyTips stand only on a painted band.');\n const rows = painted.rows;\n if (tips.row === undefined) {\n const exact = rows.findIndex(row => row.keyTip === typed);\n if (exact >= 0) this.#showKeyTips({ row: exact, typed: '' });\n else if (rows.some(row => row.keyTip?.startsWith(typed) === true)) this.#showKeyTips({ row: undefined, typed });\n else this.#endKeyTips();\n return;\n }\n const row = rows[tips.row];\n if (row === undefined) {\n // A repaint took the row away: its letters went with it.\n this.#endKeyTips();\n return;\n }\n const items = row.items.filter(item => item !== 'separator');\n const chosen = items.find(item => item.keyTip === typed);\n if (chosen === undefined) {\n if (items.some(item => item.keyTip?.startsWith(typed) === true)) this.#showKeyTips({ row: tips.row, typed });\n else this.#endKeyTips();\n return;\n }\n if (chosen.disabledReason !== undefined) {\n this.#endKeyTips();\n return;\n }\n // The item becomes the active one before the letters go, so the band shows the item its keys act on should\n // the list not open.\n this.#active = chosen.key;\n this.#showKeyTips(undefined);\n // Excel's Alt, H, H opens the Fill's palette rather than setting its colour: a list opens.\n if (chosen.open !== undefined) {\n this.#openList(chosen, tips.row);\n return;\n }\n this.#giveBack();\n chosen.press?.();\n }\n\n #endKeyTips(): void {\n this.#showKeyTips(undefined);\n this.#giveBack();\n }\n\n #showKeyTips(tips: KeyTips | undefined): void {\n this.#keyTips = tips;\n if (this.#painted !== undefined) this.paint(this.#painted);\n }\n}\n\n// A Consumer's content mounted on a face, and what takes it away: checked as a script may answer it.\nfunction mountedContent(content: SheetToolbarContent, element: HTMLElement, name: string): () => void {\n const unmount: unknown = content(element);\n if (typeof unmount !== 'function') throw new TypeError(`The content of the toolbar button '${name}' answers the function that takes it away (ADR-0100).`);\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- checked a function just above, the cleanup the content's type answers\n return unmount as () => void;\n}\n", "// A Toolbar Item's choices (ADR-0100): a menu in the grid's popover frame, as Format Cells stands there (ADR-0050\n// item 16). The frame is the grid's \u2014 where it stands, its bound, Escape, a press elsewhere \u2014 and gives the keyboard\n// back when it closes (ADR-0039). Colours are a grid of swatches, ten across as Excel's palette is; everything else is\n// a list. The arrow keys move among the choices that can be made, Home and End go to the ends, and Enter, Space or a\n// press makes one. A choice that cannot be made says why beside it. The elements wear the C# Sheet's classes, so one\n// stylesheet lays out both. What a choice means is the Sheet's: this draws, and reports what was chosen.\n\nimport { setAttr } from './dom-attributes';\n\n/** One choice of a Toolbar Item's list. */\nexport interface SheetToolbarChoice {\n readonly label: string;\n /** For a colour, the colour as CSS paints it: drawn as a swatch, the label its name. */\n readonly swatch: string | undefined;\n /** Whether it is what the Focus cell has. */\n readonly selected: boolean;\n /** Why it cannot be made, or `undefined` where it can. */\n readonly disabledReason: string | undefined;\n /** Whether it opens a popover in the list's place, as More Number Formats\u2026 opens Format Cells. */\n readonly opensPopover: boolean;\n readonly choose: () => void;\n}\n\n/** What the list tells the Sheet. */\nexport interface SheetChoicesHooks {\n /** A choice was made: the list closes, unless the choice opens a popover in its place, and the choice is made. */\n readonly chosen: (choice: SheetToolbarChoice) => void;\n}\n\n// Ten swatches to a row, as Excel's palette lays them out.\nconst swatchesAcross = 10;\n\n/** A Toolbar Item's choices as one opening shows them. One choice per opening: the first closes it. */\nexport class SheetChoicesPanel {\n readonly element: HTMLElement;\n readonly #choices: readonly SheetToolbarChoice[];\n readonly #buttons: HTMLButtonElement[];\n readonly #hooks: SheetChoicesHooks;\n #focused: number;\n #chosen = false;\n\n constructor(doc: Document, title: string, choices: readonly SheetToolbarChoice[], hooks: SheetChoicesHooks) {\n this.#choices = choices;\n this.#hooks = hooks;\n this.element = doc.createElement('div');\n this.element.className = 'ex-sheet-choices';\n this.element.setAttribute('role', 'menu');\n this.element.setAttribute('aria-label', title);\n this.element.addEventListener('keydown', this.#onKey);\n this.#buttons = choices.map((choice, at) => {\n const button = doc.createElement('button');\n button.type = 'button';\n button.setAttribute('role', 'menuitemradio');\n button.setAttribute('aria-checked', choice.selected ? 'true' : 'false');\n if (choice.swatch === undefined) {\n button.className = 'ex-sheet-choice';\n const label = doc.createElement('span');\n label.className = 'ex-sheet-choice-label';\n label.textContent = choice.label;\n button.append(label);\n if (choice.disabledReason !== undefined) {\n button.setAttribute('aria-disabled', 'true');\n button.title = choice.disabledReason;\n const reason = doc.createElement('span');\n reason.className = 'ex-sheet-choice-reason';\n reason.textContent = choice.disabledReason;\n button.append(reason);\n }\n } else {\n button.className = 'ex-sheet-swatch-choice';\n button.title = choice.label;\n button.setAttribute('aria-label', choice.label);\n const swatch = doc.createElement('span');\n swatch.className = 'ex-sheet-swatch';\n // The colour is the user's choice, document data painted as recorded (ADR-0071).\n swatch.style.backgroundColor = choice.swatch;\n button.append(swatch);\n }\n // A press is a choice; the browser's click of Enter or Space never comes, the keydown having taken it.\n button.addEventListener('click', () => { this.#choose(at); });\n button.addEventListener('focus', () => {\n this.#focused = at;\n this.#showFocused();\n });\n return button;\n });\n this.element.append(...this.#buttons);\n // The keys start from what the Focus cell has, or from the first choice that can be made.\n const selected = choices.findIndex(choice => choice.selected && choice.disabledReason === undefined);\n this.#focused = selected >= 0 ? selected : this.#next(-1, 1);\n this.#showFocused();\n }\n\n /** Puts the keyboard on the choice the keys start from: the list stands in the frame, which took it first. */\n takeKeyboard(): void {\n this.#buttons[this.#focused]?.focus({ preventScroll: true });\n }\n\n // One tab stop, the choice the keys are on.\n #showFocused(): void {\n this.#buttons.forEach((button, at) => { setAttr(button, 'tabindex', at === this.#focused ? '0' : '-1'); });\n }\n\n // The next choice from `from` that can be made, `step` at a time; `from` itself, kept inside the list, when none is.\n #next(from: number, step: number): number {\n for (let at = from + step; at >= 0 && at < this.#choices.length; at += step) {\n if (this.#choices[at]?.disabledReason === undefined) return at;\n }\n return Math.min(Math.max(from, 0), Math.max(this.#choices.length - 1, 0));\n }\n\n readonly #onKey = (event: KeyboardEvent): void => {\n if (event.isComposing || event.ctrlKey || event.altKey || event.metaKey) return;\n if ((event.key === 'Enter' || event.key === ' ') && !event.shiftKey) {\n event.preventDefault();\n this.#choose(this.#focused);\n return;\n }\n const across = this.#choices[this.#focused]?.swatch === undefined ? 1 : swatchesAcross;\n let moved: number;\n switch (event.key) {\n case 'ArrowDown': moved = this.#next(this.#focused, across); break;\n case 'ArrowUp': moved = across > 1 ? this.#upFromSwatch() : this.#next(this.#focused, -1); break;\n case 'ArrowRight': moved = across > 1 ? this.#next(this.#focused, 1) : this.#focused; break;\n case 'ArrowLeft': moved = across > 1 ? this.#next(this.#focused, -1) : this.#focused; break;\n case 'Home': moved = this.#next(-1, 1); break;\n case 'End': moved = this.#next(this.#choices.length, -1); break;\n default: return;\n }\n event.preventDefault();\n if (moved === this.#focused) return;\n this.#focused = moved;\n this.#showFocused();\n this.#buttons[moved]?.focus();\n };\n\n // Up from a swatch: the swatch above, or from the first row the choice listed before the swatches, as Automatic and\n // No Fill stand above Excel's palette.\n #upFromSwatch(): number {\n const above = this.#next(this.#focused, -swatchesAcross);\n if (above !== this.#focused) return above;\n const firstSwatch = this.#choices.findIndex(choice => choice.swatch !== undefined);\n return firstSwatch > 0 ? this.#next(firstSwatch, -1) : this.#focused;\n }\n\n #choose(at: number): void {\n const choice = this.#choices[at];\n if (this.#chosen || choice === undefined || choice.disabledReason !== undefined) return;\n this.#chosen = true;\n this.#hooks.chosen(choice);\n }\n}\n", "// A Cell Colour from its RGB value, and the colours the Sheet's own lists paint.\n\nimport { CellColour } from '@ex-grid/sheet-engine';\n\n/** The Cell Colour of an RGB value, `0xRRGGBB`. */\nexport function colourFromRgb(rgb: number): CellColour {\n return CellColour.fromRgb(rgb);\n}\n\n/** Automatic: the Ink, the colour a Font and a Border line take unless one is chosen. */\nexport function automaticColour(): CellColour {\n return CellColour.automatic;\n}\n\n/** A colour as a swatch and a preview paint it: Automatic is the Ink of the text around it. */\nexport function paintOf(colour: CellColour): string {\n return colour.isAutomatic ? 'currentColor' : colour.toString();\n}\n", "// The format codes the Number tab's categories write, and how a code is recognised as one of them when Format\n// Cells opens (ADR-0071), the counterpart of C#'s NumberFormatCodes. Every code here is one the engine reads; a\n// code that matches none of them opens under Custom, as it is.\n\nimport { NumberFormat, type Culture } from '@ex-grid/sheet-engine';\nimport { currencyDecimalDigitsOf, currencyPositivePatternOf, currencySymbolOf } from './culture-facts';\nimport type { NumberFormatCategory } from './format-cells-offer';\nimport { elementAt, unreachable } from './must';\n\n/** The most decimal places Excel's spinner offers. */\nexport const mostDecimalPlaces = 30;\n\n/** How many ways a negative number shows under Number: `-1234.10`, in red, in brackets, in red brackets. */\nexport const numberNegativeStyles = 4;\n\n/** How many ways a negative amount shows under Currency: with a minus, in red, in red with a minus, in brackets,\n * in red brackets. */\nexport const currencyNegativeStyles = 5;\n\n/** The Date category's formats: Excel's built-in short date first, shown in the culture's own pattern. */\nexport const dateTypes: readonly string[] = Object.freeze(\n ['m/d/yyyy', 'd-mmm-yy', 'd-mmm', 'mmm-yy', 'mmmm d, yyyy', 'd mmmm yyyy', 'yyyy-mm-dd', 'dd/mm/yyyy']);\n\n/** The Time category's formats. */\nexport const timeTypes: readonly string[] = Object.freeze(['h:mm', 'h:mm AM/PM', 'h:mm:ss', 'h:mm:ss AM/PM', 'mm:ss', 'm/d/yyyy h:mm']);\n\n/** The codes Custom lists to start from. */\nexport const customTypes: readonly string[] = Object.freeze(\n ['General', '0', '0.00', '#,##0', '#,##0.00', '0%', '0.00%', '0.00E+00', '@', ...dateTypes, ...timeTypes]);\n\nfunction checkPlaces(places: number): void {\n if (!Number.isInteger(places) || places < 0 || places > mostDecimalPlaces) {\n throw new RangeError(`Decimal places are 0 to ${mostDecimalPlaces}, not ${places}.`);\n }\n}\n\n/** The digits of a number: with or without the thousands separator, and the decimal places. */\nfunction digits(places: number, separator: boolean): string {\n checkPlaces(places);\n return (separator ? '#,##0' : '0') + (places > 0 ? `.${'0'.repeat(places)}` : '');\n}\n\n/** The Number category's code. */\nexport function numberCode(places: number, separator: boolean, negative: number): string {\n const body = digits(places, separator);\n switch (negative) {\n case 0: return body;\n case 1: return `${body};[Red]${body}`;\n case 2: return `${body}_);(${body})`;\n case 3: return `${body}_);[Red](${body})`;\n default: throw new RangeError(`${negative} is not one of Number's negative styles.`);\n }\n}\n\n/** The Currency category's code, with the culture's symbol on the side and at the distance the culture puts it. */\nexport function currencyCode(places: number, negative: number, culture: Culture): string {\n const body = symbolised(digits(places, true), culture);\n switch (negative) {\n case 0: return body;\n case 1: return `${body};[Red]${body}`;\n case 2: return `${body};[Red]-${body}`;\n case 3: return `${body}_);(${body})`;\n case 4: return `${body}_);[Red](${body})`;\n default: throw new RangeError(`${negative} is not one of Currency's negative styles.`);\n }\n}\n\n/** The Percentage category's code. */\nexport function percentageCode(places: number): string {\n return `${digits(places, false)}%`;\n}\n\n/** The Scientific category's code. */\nexport function scientificCode(places: number): string {\n return `${digits(places, false)}E+00`;\n}\n\n/**\n * The culture's currency symbol beside the digits, where the culture puts it. A symbol of currency signs alone\n * (`$`, `\u00A3`, `\u00A5`, `\u20AC`) is written as it is, as Excel writes it; any other is quoted, so its letters are not read\n * as codes.\n */\nfunction symbolised(body: string, culture: Culture): string {\n const currencySymbol = currencySymbolOf(culture);\n const symbol = /^\\p{Sc}*$/u.test(currencySymbol) ? currencySymbol : `\"${currencySymbol.replaceAll('\"', '')}\"`;\n switch (currencyPositivePatternOf(culture)) {\n case 1: return body + symbol;\n case 2: return `${symbol} ${body}`;\n case 3: return `${body} ${symbol}`;\n default: return symbol + body;\n }\n}\n\n/** The culture's default decimal places for a category, as Excel offers them. */\nexport function defaultPlaces(category: NumberFormatCategory, culture: Culture): number {\n return category === 'currency' ? currencyDecimalDigitsOf(culture) : 2;\n}\n\n/**\n * The code a category writes with its defaults, as Format Cells' Number tab sets it when the category is chosen and as\n * the Sheet Toolbar's Number Format list sets it (ADR-0100). Only a category chosen from a code alone: Accounting and\n * Fraction are shown disabled, Special is not on the list, and Custom is the code as typed.\n */\nexport function defaultCodeOf(category: Exclude<NumberFormatCategory, 'accounting' | 'fraction' | 'special' | 'custom'>, culture: Culture): string {\n const places = defaultPlaces(category, culture);\n switch (category) {\n case 'general': return NumberFormat.general.code;\n case 'number': return numberCode(places, false, 0);\n case 'currency': return currencyCode(places, 0, culture);\n case 'date': return elementAt(dateTypes, 0);\n case 'time': return elementAt(timeTypes, 0);\n case 'percentage': return percentageCode(places);\n case 'scientific': return scientificCode(places);\n case 'text': return '@';\n default: return unreachable(category);\n }\n}\n\n/** What a category shows a code as when Format Cells opens on it. */\nexport interface RecognisedNumberFormat {\n /** The category that writes the code. */\n readonly category: NumberFormatCategory;\n /** Its decimal places, 2 where the category takes none. */\n readonly places: number;\n /** Whether Number groups thousands. */\n readonly separator: boolean;\n /** Which negative style. */\n readonly negative: number;\n /** The code as the category shows it: a Date's or a Time's as listed, a Custom code as the culture spells\n * it, any other as written. */\n readonly type: string;\n}\n\nfunction recognised(category: NumberFormatCategory, places: number, separator: boolean, negative: number, type: string): RecognisedNumberFormat {\n return Object.freeze({ category, places, separator, negative, type });\n}\n\nfunction sameIgnoringCase(a: string, b: string): boolean {\n return a.toUpperCase() === b.toUpperCase();\n}\n\n/**\n * The category, and its options, that writes the format's code exactly; Custom when none does, with the code as\n * the culture spells it (`NumberFormat.localCode`), which the Custom box reads back as the same format (the\n * fourteenth Windows run, case 11).\n */\nexport function recogniseNumberFormat(format: NumberFormat, culture: Culture): RecognisedNumberFormat {\n const code = format.code;\n if (format.isGeneral) return recognised('general', 2, false, 0, code);\n if (code === '@') return recognised('text', 2, false, 0, code);\n for (let places = 0; places <= mostDecimalPlaces; places++) {\n for (let negative = 0; negative < numberNegativeStyles; negative++) {\n if (code === numberCode(places, false, negative)) return recognised('number', places, false, negative, code);\n if (code === numberCode(places, true, negative)) return recognised('number', places, true, negative, code);\n }\n for (let negative = 0; negative < currencyNegativeStyles; negative++) {\n if (code === currencyCode(places, negative, culture)) return recognised('currency', places, true, negative, code);\n }\n if (code === percentageCode(places)) return recognised('percentage', places, false, 0, code);\n if (code === scientificCode(places)) return recognised('scientific', places, false, 0, code);\n }\n const date = dateTypes.find(type => sameIgnoringCase(type, code));\n if (date !== undefined) return recognised('date', 2, false, 0, date);\n const time = timeTypes.find(type => sameIgnoringCase(type, code));\n if (time !== undefined) return recognised('time', 2, false, 0, time);\n return recognised('custom', 2, false, 0, format.localCode(culture));\n}\n\n/**\n * The codes Custom lists to start from, as the culture spells them (`NumberFormat.localCode`), each once: under\n * en-GB the built-in short date is listed as `dd/mm/yyyy`, so that the one picked from the list is the built-in,\n * as one typed is.\n */\nexport function customTypesIn(culture: Culture): readonly string[] {\n const listed: string[] = [];\n for (const code of customTypes) {\n const local = NumberFormat.parse(code).localCode(culture);\n if (!listed.some(other => sameIgnoringCase(other, local))) listed.push(local);\n }\n return Object.freeze(listed);\n}\n", "// What the Sheet reads of its culture beside what the engine formats with it: the currency symbol, where it\n// stands and how many decimals it takes, and whether the short time is twelve-hour. The engine keeps these in\n// Culture's data, which it marks internal, and does not export its currencySymbolOf; this module reads them in\n// one place until the engine makes them public.\n\nimport type { Culture } from '@ex-grid/sheet-engine';\n\n/**\n * The currency symbol Excel shows under a culture: the culture's own, with Windows' ja-JP yen sign U+00A5 where\n * ICU gives the full-width U+FFE5 (ADR-0071), as the engine's currencySymbolOf reads it.\n */\nexport function currencySymbolOf(culture: Culture): string {\n return culture.data.currencySymbol.replaceAll('\uFFE5', '\u00A5');\n}\n\n/** `NumberFormatInfo.CurrencyPositivePattern`: 0 is `$n`, 1 `n$`, 2 `$ n`, 3 `n $`. */\nexport function currencyPositivePatternOf(culture: Culture): number {\n return culture.data.currencyPositivePattern;\n}\n\n/** How many decimal places the culture's currency shows. */\nexport function currencyDecimalDigitsOf(culture: Culture): number {\n return culture.data.currencyDecimalDigits;\n}\n\n/** Whether the culture's own short time is twelve-hour: its pattern has an AM/PM designator. */\nexport function hasTwelveHourTime(culture: Culture): boolean {\n return culture.data.shortTimePattern.includes('t');\n}\n", "// Excel's keys for the Sheet Tabs, as ExSheet declares them to its grid (ADR-0331 \u00A74), the counterpart of C#'s\n// SheetTabKeys: Ctrl+PageUp shows the Sheet before the one shown, Ctrl+PageDown the one after it, and neither\n// goes past the first or the last, as in Excel. Shift+F11 adds a Sheet before the one shown, as Excel's does\n// (exsheet-workbook ticket 06). Declared, they are claimed from the browser, whose own meaning for them moves\n// among its tabs.\n\n/** Excel's keys for the Sheet Tabs, in the grid's canonical form. */\nexport const sheetTabKeys = Object.freeze({\n /** Shows the Sheet before the one shown. */\n previous: 'Control+PageUp',\n /** Shows the Sheet after the one shown. */\n next: 'Control+PageDown',\n /** Adds a Sheet before the one shown. */\n insert: 'Shift+F11',\n} as const);\n\n/** The keys ExSheet declares to its grid for the Sheet Tabs. */\nexport function sheetTabKeysDeclared(): readonly string[] {\n return Object.freeze([sheetTabKeys.previous, sheetTabKeys.next, sheetTabKeys.insert]);\n}\n\n/** How far the key moves among the Sheets: -1 or 1, or `undefined` for a key that is not one of these. */\nexport function sheetTabStepOf(key: string): -1 | 1 | undefined {\n if (key === sheetTabKeys.previous) return -1;\n if (key === sheetTabKeys.next) return 1;\n return undefined;\n}\n", "// Excel's formatting keys, as ExSheet declares them to its grid (ADR-0071, \"Keys\"; ADR-0050 item 14) and what\n// each applies, the counterpart of C#'s SheetFormatKeys. Only the keys Excel has, each only as Excel has it, as\n// the eleventh Windows run found them (verification/2026-10-01-windows-excel-11/cell-format.md, cases 16 to 20).\n\nimport { BorderChange, BorderLine, CellFormatChange, NumberFormat, type CellFormat, type Culture } from '@ex-grid/sheet-engine';\nimport { hasTwelveHourTime } from './culture-facts';\nimport { unreachable } from './must';\n\n/** What a formatting key does. Ctrl+1 opens Format Cells (ticket 52) and sets nothing itself. */\nexport type SheetFormatKey =\n | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'general' | 'number' | 'time' | 'date' | 'currency' | 'percent'\n | 'scientific' | 'outline' | 'noBorders' | 'formatCells';\n\n// Each key is the character it types with Ctrl, as Excel reads it \u2014 by the character, not by where the key lies\n// (case 19) \u2014 so a layout that types `#` without Shift (UK) reaches the date format as one that needs Shift does.\n// A letter is claimed in both cases for CapsLock, and without Shift: Ctrl+Shift+U is another key in Excel. Every\n// other character is claimed with Shift and without it, whichever its layout needs.\nconst keys: readonly (readonly [string, SheetFormatKey])[] = [\n ['b', 'bold'], ['2', 'bold'],\n ['i', 'italic'], ['3', 'italic'],\n ['u', 'underline'], ['4', 'underline'],\n ['5', 'strikethrough'],\n ['~', 'general'],\n ['!', 'number'],\n ['@', 'time'],\n ['#', 'date'],\n ['$', 'currency'],\n ['%', 'percent'],\n ['^', 'scientific'],\n ['&', 'outline'],\n ['_', 'noBorders'],\n ['1', 'formatCells'],\n];\n\nfunction declaredKeys(): ReadonlyMap<string, SheetFormatKey> {\n const byKey = new Map<string, SheetFormatKey>();\n for (const [character, kind] of keys) {\n if (/^[a-z]$/u.test(character)) {\n byKey.set(`Control+${character}`, kind);\n byKey.set(`Control+${character.toUpperCase()}`, kind);\n } else {\n byKey.set(`Control+${character}`, kind);\n byKey.set(`Control+Shift+${character}`, kind);\n }\n }\n return byKey;\n}\n\n/** The formatting keys ExSheet declares to its grid, in the grid's canonical form. */\nexport function sheetFormatKeysDeclared(): readonly string[] {\n return Object.freeze([...declaredKeys().keys()]);\n}\n\n/** What a declared key does; `undefined` for a key that is not one of these. */\nexport function sheetFormatKeyOf(key: string): SheetFormatKey | undefined {\n return declaredKeys().get(key);\n}\n\n/**\n * What a key sets on the Selection, under the Sheet's culture (cases 16 to 20). A toggle's direction is the\n * Focus cell's (case 17): over a Focus that is bold, Ctrl+B takes bold off every cell, and otherwise puts it on\n * every cell. The Number Formats are the ones Excel applied under en-GB, en-US and ja-JP alike, but for two: the\n * time is 12-hour where the culture's own time is (`h:mm AM/PM` under en-US, `h:mm` under en-GB and ja-JP), and\n * the currency is Excel's built-in, shown in the culture's own currency (`NumberFormat.builtInCurrency`). The\n * date and the time are Excel's built-ins 15 and 20 (or the AM/PM one), recorded in their codes and shown in the\n * culture's own form, as Excel shows them (the twelfth run, case 19). A Number Format widens the columns it no\n * longer fits, as every Number Format set on the Selection does (case 17), and so do strikethrough and underline\n * (`widensAsAKeyDoes`). The outline is thin and Automatic on each range's four edges; no borders clears every\n * edge of each range. Ctrl+1 sets nothing, and is refused here.\n */\nexport function sheetFormatChangeFor(kind: SheetFormatKey, focus: CellFormat, culture: Culture): CellFormatChange {\n switch (kind) {\n case 'bold': return new CellFormatChange({ bold: !focus.font.bold });\n case 'italic': return new CellFormatChange({ italic: !focus.font.italic });\n case 'underline': return new CellFormatChange({ underline: !focus.font.underline });\n case 'strikethrough': return new CellFormatChange({ strikethrough: !focus.font.strikethrough });\n case 'general': return new CellFormatChange({ numberFormat: NumberFormat.general });\n case 'number': return new CellFormatChange({ numberFormat: NumberFormat.parse('#,##0.00') });\n case 'time': return new CellFormatChange({ numberFormat: NumberFormat.parse(hasTwelveHourTime(culture) ? 'h:mm AM/PM' : 'h:mm') });\n case 'date': return new CellFormatChange({ numberFormat: NumberFormat.parse('d-mmm-yy') });\n case 'currency': return new CellFormatChange({ numberFormat: NumberFormat.builtInCurrency(culture) });\n case 'percent': return new CellFormatChange({ numberFormat: NumberFormat.parse('0%') });\n case 'scientific': return new CellFormatChange({ numberFormat: NumberFormat.parse('0.00E+00') });\n case 'outline': return new CellFormatChange({ borders: BorderChange.outline(new BorderLine('thin')) });\n case 'noBorders': return new CellFormatChange({ borders: BorderChange.none });\n case 'formatCells': throw new RangeError('Ctrl+1 opens Format Cells, and sets no format of its own.');\n default: return unreachable(kind);\n }\n}\n", "// ExSheet's Context Menu commands (ADR-0036), C#'s SheetCommandIds and ContextCommandsFor: inserting and deleting the\n// rows or columns the Selection spans, and Format Cells (ADR-0071). A command carries no label: the menu asks the\n// grid's `commandLabel` for the wording of an id, which the Sheet answers from its words for its own ids.\n\nimport type { GridCommand, SelectionRange } from '@ex-grid/core';\nimport { SheetEdit } from '@ex-grid/sheet-engine';\nimport { sheetFindLabelIds } from './sheet-find-panel';\nimport type { SheetContextCommand, SheetFindWithinWord, SheetWords } from './sheet-words';\n\n/** The ids of the commands ExSheet adds to the grid's Context Menu, as C#'s SheetCommandIds spells them. */\nexport const sheetCommandIds: Readonly<Record<SheetContextCommand, string>> = Object.freeze({\n insertRows: 'exsheet.insert-rows',\n deleteRows: 'exsheet.delete-rows',\n insertColumns: 'exsheet.insert-columns',\n deleteColumns: 'exsheet.delete-columns',\n formatCells: 'exsheet.format-cells',\n});\n\nconst commands: readonly SheetContextCommand[] = ['insertRows', 'deleteRows', 'insertColumns', 'deleteColumns', 'formatCells'];\nconst commandOfId: ReadonlyMap<string, SheetContextCommand> = new Map(commands.map(command => [sheetCommandIds[command], command]));\n\nconst findWords: readonly SheetFindWithinWord[] = ['within', 'withinSheet', 'withinWorkbook'];\nconst findWordOfId: ReadonlyMap<string, SheetFindWithinWord> = new Map(findWords.map(word => [sheetFindLabelIds[word], word]));\n\n/** The Sheet's word for one of its own ids the grid shows, a Context Menu command's or the find panel's Within, or\n * `undefined` for an id that is not ExSheet's. */\nexport function sheetCommandWord(words: SheetWords, id: string): string | undefined {\n const command = commandOfId.get(id);\n if (command !== undefined) return words.command(command);\n const find = findWordOfId.get(id);\n return find === undefined ? undefined : words.findWithin(find);\n}\n\n/** What the commands do, as the Sheet does them: a structural edit, each one step on the undo stack, and Format\n * Cells opened by the user. */\nexport interface SheetContextActions {\n readonly structure: (edit: SheetEdit) => void;\n readonly formatCells: () => void;\n}\n\n/**\n * The Sheet's commands for a Context Menu opened over `selection`. Rows and columns are places, so the Row Sequence\n * Version does not move and the Selection stays where it was (ADR-0046). A Selection of several ranges has no one\n * span to act on, so the structural commands are unavailable for it rather than guessing one; Format Cells acts on\n * every range of the Selection, so it stands for several as for one.\n */\nexport function sheetContextCommands(selection: readonly SelectionRange[], actions: SheetContextActions): readonly GridCommand[] {\n const span = selection.length === 1 ? selection[0] : undefined;\n const structure = (id: string, edit: (range: SelectionRange) => SheetEdit): GridCommand => ({\n id,\n enabled: span !== undefined,\n invoke: () => {\n if (span === undefined) throw new Error('Internal: a disabled command is never run.');\n actions.structure(edit(span));\n },\n });\n return [\n structure(sheetCommandIds.insertRows, r => SheetEdit.insertRows(r.topRow, r.rowCount)),\n structure(sheetCommandIds.deleteRows, r => SheetEdit.deleteRows(r.topRow, r.rowCount)),\n structure(sheetCommandIds.insertColumns, r => SheetEdit.insertColumns(r.leftColumn, r.columnCount)),\n structure(sheetCommandIds.deleteColumns, r => SheetEdit.deleteColumns(r.leftColumn, r.columnCount)),\n { id: sheetCommandIds.formatCells, enabled: selection.length > 0, invoke: actions.formatCells },\n ];\n}\n", "// Excel's insert and delete keys, as ExSheet declares them to its grid (ADR-0050 item 14's note of 2026-10-02;\n// ADR-0071, Part C's case 12), the counterpart of C#'s SheetStructureKeys: Ctrl with `+`, typed with Shift\n// (Ctrl+Shift+= on a US or UK layout) or without it (the numeric keypad's `+`, or a layout with a key of its\n// own), and Ctrl with `-`. They are the browser's zoom keys, so declaring them is what keeps a Sheet from zooming\n// the page. Like the formatting keys they are read by the character typed.\n\nimport type { GridExtent, GridSelection } from '@ex-grid/core';\nimport { SheetEdit } from '@ex-grid/sheet-engine';\n\n/** What an insert or delete key does. */\nexport type SheetStructureKey = 'insert' | 'delete';\n\nconst byKey: ReadonlyMap<string, SheetStructureKey> = new Map([\n ['Control++', 'insert'],\n ['Control+Shift++', 'insert'],\n ['Control+-', 'delete'],\n]);\n\n/** The keys ExSheet declares to its grid for inserting and deleting, in the grid's canonical form. */\nexport function sheetStructureKeysDeclared(): readonly string[] {\n return Object.freeze([...byKey.keys()]);\n}\n\n/** What a declared key does; `undefined` for a key that is not one of these. */\nexport function sheetStructureKeyOf(key: string): SheetStructureKey | undefined {\n return byKey.get(key);\n}\n\n/**\n * What the key does to the Selection on a Sheet of the extent: the rows a Selection of whole rows spans, or the\n * columns a Selection of whole columns spans, inserted above or to the left, or deleted, as the Context Menu's\n * commands do. `undefined` for every other Selection \u2014 several ranges, every cell at once, or a range that is\n * not whole rows or whole columns \u2014 which the key refuses: Excel opens a dialog there that shifts cells, and\n * ExSheet shifts no cells (ADR-0050 item 14).\n */\nexport function sheetStructureEditFor(kind: SheetStructureKey, selection: GridSelection, extent: GridExtent): SheetEdit | undefined {\n if (selection.ranges.length !== 1) return undefined;\n const [range] = selection.ranges;\n if (range === undefined) return undefined;\n const wholeRows = range.leftColumn === 0 && range.columnCount === extent.columnCount;\n const wholeColumns = range.topRow === 0 && range.rowCount === extent.rowCount;\n if (wholeRows === wholeColumns) return undefined;\n if (wholeRows) return kind === 'insert' ? SheetEdit.insertRows(range.topRow, range.rowCount) : SheetEdit.deleteRows(range.topRow, range.rowCount);\n return kind === 'insert'\n ? SheetEdit.insertColumns(range.leftColumn, range.columnCount)\n : SheetEdit.deleteColumns(range.leftColumn, range.columnCount);\n}\n", "// Which changes widen the columns whose numbers no longer fit, as Excel's do (ADR-0047, second round; SH-20;\n// ADR-0071, case 17), the counterpart of the rules in C#'s SheetWidening. A recorded width is one of three kinds\n// (ADR-0046, 2026-09-28; SH-26): a column at the default width, or one an earlier entry or Number Format\n// widened, is widened again by a number that needs more; a width the user set is never widened (case 18). Only\n// these widen: not a paste, a fill or a recalculated Formula. Which columns widen, and to what, is measured\n// against the grid's text estimate, which the core does not export yet; that part of SheetWidening is not here.\n\nimport type { CellFormatChange } from '@ex-grid/sheet-engine';\n\n/**\n * Whether a change a formatting key sets widens the columns whose numbers no longer fit (ADR-0071; ticket 58's\n * rule): a Number Format key widens (case 17), and so do Ctrl+5 and Ctrl+U, setting strikethrough or underline\n * or taking it off, though they set no Number Format. Excel's Ctrl+5 widened column A for `1234567.50` (the\n * fourteenth Windows run, case 7) and from 8.09 to 11.73 for `123456789.12` in `0.00` (the seventeenth's h8),\n * and Ctrl+U the same column the same way (h7). Ctrl+B and the Fill did not (case 7), nor did Ctrl+I (h7). That\n * Ctrl+4 widens as Ctrl+U does, that the Border keys widen nothing, and that taking strikethrough or underline\n * off widens are readings. `SetCellFormatAsync` widens by this rule too (decided 2026-10-12), as Excel's\n * `Range.Font` set through COM did (the readings of 2026-10-12 (R6), case (5); of 2026-10-14, run 18a, widening\n * cases 2 and 6).\n */\nexport function widensAsAKeyDoes(change: CellFormatChange): boolean {\n return change.numberFormat !== undefined || change.underline !== undefined || change.strikethrough !== undefined;\n}\n\n/**\n * Whether a change a Sheet Toolbar item sets widens the columns whose numbers no longer fit, as Excel's Home tab\n * buttons do (ADR-0071, ADR-0100): as a key does, and for a Font colour too. Excel's Bold and Italic buttons did\n * not widen and its Underline button did (R6, case (3)); its Fill Color button did not (the fourteenth Windows\n * run, case 7); and its Font Color button widened, where `Font.Color` set through COM did not (run 18a, widening\n * case 5; decided with the user, 2026-10-14).\n */\nexport function widensAsAHomeTabButtonDoes(change: CellFormatChange): boolean {\n return widensAsAKeyDoes(change) || change.fontColour !== undefined;\n}\n\n/**\n * Whether a change Format Cells' OK sets widens the columns whose numbers no longer fit, in OK's one undo step\n * (ADR-0071; decided 2026-10-12): one that sets a Number Format (case 17; the fourteenth Windows run, case 8),\n * and one that sets any part of the Font, though Ctrl+B and Ctrl+I widen nothing (the seventeenth run, h7; R6,\n * case (1)). A Fill, Borders or an alignment widens nothing (R6, case (2); case 9); Borders over #### and the\n * horizontal alignment are readings.\n */\nexport function widensAsFormatCellsOkDoes(change: CellFormatChange): boolean {\n return change.numberFormat !== undefined || change.fontColour !== undefined || change.bold !== undefined\n || change.italic !== undefined || change.underline !== undefined || change.strikethrough !== undefined;\n}\n", "// What Format Cells opens on, and what the user has touched since (ADR-0071, SH-45), the counterpart of C#'s\n// FormatCellsDraft and FormatCellsSpread: the rules every Chrome's Format Cells sets its controls by, so that\n// what a choice means and what OK sets are ExSheet's under every Chrome.\n//\n// The draft is the dialog's state while it is open, changed in place by each choice as the C# draft is: a\n// Chrome reads it after each call. What it hands out \u2014 the change OK sets, the lists it offers \u2014 is frozen.\n\nimport {\n BorderChange, BorderLine, CellAddress, CellFill, CellFormatChange, CellRange, NumberFormat,\n type BorderLineStyle, type CellColour, type CellFont, type CellFormat, type Culture, type HorizontalAlignment,\n type NumberFormatReading, type Sheet,\n} from '@ex-grid/sheet-engine';\nimport { automaticColour, colourFromRgb } from './cell-colour';\nimport { currencySymbolOf } from './culture-facts';\nimport {\n formatCellsOffer, isDisabledCategory,\n type BorderEdge, type BorderPreset, type ColourTarget, type FontStyle, type NumberFormatCategory,\n} from './format-cells-offer';\nimport { unreachable } from './must';\nimport {\n currencyCode, currencyNegativeStyles, customTypesIn, dateTypes, defaultPlaces, mostDecimalPlaces, numberCode,\n numberNegativeStyles, percentageCode, recogniseNumberFormat, scientificCode, timeTypes, type RecognisedNumberFormat,\n} from './number-format-codes';\nimport { SheetWords, type FormatCellsRefusal } from './sheet-words';\n\n/** Each edge's one line across the Selection: `undefined` where it differs, drawn as a grey dotted line. */\ntype EdgeLines = Record<BorderEdge, BorderLine | undefined>;\n\n/**\n * What differs across a Selection, as Format Cells shows it (ADR-0071): whether bold or italic differs, whether\n * the Fill does, each edge's one line, or `undefined` where it differs. An outer edge is read as it is drawn, so\n * a neighbour's line shows where the cell records none (the fourteenth Windows run, case 13); an edge inside a\n * range is read from its cells' own sides, so a thick bottom over a plain cell differs (the eleventh run, case\n * 24).\n */\ninterface FormatCellsSpread {\n readonly fontStyleDiffers: boolean;\n readonly fillDiffers: boolean;\n readonly edges: Readonly<EdgeLines>;\n readonly insideHorizontal: boolean;\n readonly insideVertical: boolean;\n}\n\nfunction distinct<T extends { equals(other: T): boolean }>(items: readonly T[]): T[] {\n const kept: T[] = [];\n for (const item of items) {\n if (!kept.some(other => other.equals(item))) kept.push(item);\n }\n return kept;\n}\n\nfunction spreadOf(sheet: Sheet, ranges: readonly CellRange[]): FormatCellsSpread {\n const shown = ranges.flatMap(range => sheet.getCellFormats(range));\n const sides: Record<BorderEdge, BorderLine[]> = { top: [], insideHorizontal: [], bottom: [], left: [], insideVertical: [], right: [] };\n const add = (edge: BorderEdge, part: CellRange, side: (format: CellFormat) => BorderLine): void => {\n for (const format of sheet.getCellFormats(part)) sides[edge].push(side(format));\n };\n for (const range of ranges) {\n const { first, last } = range;\n // An outer edge shows as it is drawn: a neighbour's line where the cell records none (the fourteenth\n // Windows run, case 13).\n const outer = sheet.getEdgeLines(range);\n sides.top.push(...outer.top);\n sides.bottom.push(...outer.bottom);\n sides.left.push(...outer.left);\n sides.right.push(...outer.right);\n // An edge inside the range compares the cells' own sides (the eleventh run, case 24): the lower side of\n // every row but the last and the upper side of every row but the first; and the same across columns.\n if (range.rowCount > 1) {\n add('insideHorizontal', new CellRange(first, new CellAddress(last.row - 1, last.column)), format => format.borders.bottom);\n add('insideHorizontal', new CellRange(new CellAddress(first.row + 1, first.column), last), format => format.borders.top);\n }\n if (range.columnCount > 1) {\n add('insideVertical', new CellRange(first, new CellAddress(last.row, last.column - 1)), format => format.borders.right);\n add('insideVertical', new CellRange(new CellAddress(first.row, first.column + 1), last), format => format.borders.left);\n }\n }\n const edgeLine = (edge: BorderEdge): BorderLine | undefined => {\n const lines = distinct(sides[edge]);\n if (lines.length === 0) return BorderLine.none;\n return lines.length === 1 ? lines[0] : undefined;\n };\n return {\n fontStyleDiffers: new Set(shown.map(format => `${format.font.bold}|${format.font.italic}`)).size > 1,\n fillDiffers: distinct(shown.map(format => format.fill)).length > 1,\n edges: {\n top: edgeLine('top'), insideHorizontal: edgeLine('insideHorizontal'), bottom: edgeLine('bottom'),\n left: edgeLine('left'), insideVertical: edgeLine('insideVertical'), right: edgeLine('right'),\n },\n insideHorizontal: ranges.some(range => range.rowCount > 1),\n insideVertical: ranges.some(range => range.columnCount > 1),\n };\n}\n\n/**\n * The line the Border tab opens on (ADR-0071): the line an outer edge of the Selection shows, the first of the\n * top, the bottom, the left and the right that shows one, in its style and colour; with none, Thin and Automatic.\n * Excel was seen to open on the one line shown over one cell, on a top, a bottom, a left and a right edge alike,\n * its own or a neighbour's as drawn (the seventeenth Windows run, h10; the fourteenth run, case 13; run 18a,\n * format-cells 1, 6, 7 and 8); on it over a range and over several ranges whose top all show it (run 18a, 4 and\n * 5); and, with two lines shown, on the top's (run 18a, 2 and 3; the readings of 2026-10-12 (R8)). That the\n * bottom comes before the left and the right, and the left before the right, no run has read: it is the engine's\n * order, by generalisation, as an edge whose line differs along it is passed over.\n */\nfunction openingPen(edges: Readonly<EdgeLines>): BorderLine {\n for (const edge of ['top', 'bottom', 'left', 'right'] as const) {\n const line = edges[edge];\n if (line !== undefined && !line.isNone) return line;\n }\n return new BorderLine('thin');\n}\n\nfunction styleOf(font: CellFont): FontStyle {\n if (font.bold) return font.italic ? 'boldItalic' : 'bold';\n return font.italic ? 'italic' : 'regular';\n}\n\nfunction emphasisOf(style: FontStyle): { readonly bold: boolean; readonly italic: boolean } {\n switch (style) {\n case 'boldItalic': return { bold: true, italic: true };\n case 'bold': return { bold: true, italic: false };\n case 'italic': return { bold: false, italic: true };\n case 'regular': return { bold: false, italic: false };\n default: return unreachable(style);\n }\n}\n\n/**\n * What Format Cells opens on, and what the user has touched since (ADR-0071, SH-45).\n *\n * It opens on the Focus cell's Cell Format. A part that differs across the Selection is shown as Excel shows it\n * (the eleventh Windows run, case 24): the Font style empty (`fontStyle` is `undefined`), a Fill as No Colour,\n * and an edge as a grey dotted line (`edgeLine` is `undefined`). Every other part shows the Focus cell's. A\n * range's outer edges show as they are drawn, a neighbour's line where the cell records none (the fourteenth run,\n * case 13); an edge inside a range shows the cells' own sides.\n *\n * `change` names only the parts the user touched, so OK leaves every other part as each cell has it; with\n * nothing touched it is empty, and OK sets nothing. An edge shown from a neighbour and left alone writes nothing;\n * taken away, it is cleared on both sides, as clearing an edge is (SH-45; the seventeenth Windows run, h10). A\n * choice that cannot be set \u2014 a Custom code ExSheet does not read, More Colours text that is not a colour \u2014 is\n * held as `refusal`, by name, and OK sets nothing until it is put right.\n */\nexport class FormatCellsDraft {\n readonly #culture: Culture;\n readonly #openingNumber: RecognisedNumberFormat;\n readonly #edges: EdgeLines;\n readonly #edgesTouched = new Set<BorderEdge>();\n readonly #colourText = new Map<ColourTarget, string>();\n readonly #colourRefusals = new Map<ColourTarget, FormatCellsRefusal>();\n #customTypes: readonly string[] | undefined;\n\n #numberTouched = false;\n #alignmentTouched = false;\n #fontStyleTouched = false;\n #underlineTouched = false;\n #strikethroughTouched = false;\n #fontColourTouched = false;\n #fillTouched = false;\n\n #category: NumberFormatCategory = 'general';\n #decimalPlaces = 2;\n #thousandsSeparator = false;\n #negativeNumber = 0;\n #typeCode = '';\n #alignment: HorizontalAlignment;\n #fontStyle: FontStyle | undefined;\n #underline: boolean;\n #strikethrough: boolean;\n #fontColour: CellColour;\n #fill: CellFill;\n #lineStyle: BorderLineStyle;\n #lineColour: CellColour;\n\n /** The Focus cell's Cell Format, which Format Cells opens on. */\n readonly opening: CellFormat;\n /** Whether a selected range spans more than one row, so that it has an edge inside it between rows. */\n readonly hasInsideHorizontal: boolean;\n /** Whether a selected range spans more than one column, so that it has an edge inside it between columns. */\n readonly hasInsideVertical: boolean;\n\n private constructor(opening: CellFormat, spread: FormatCellsSpread, culture: Culture) {\n this.#culture = culture;\n this.opening = opening;\n this.hasInsideHorizontal = spread.insideHorizontal;\n this.hasInsideVertical = spread.insideVertical;\n this.#openingNumber = recogniseNumberFormat(opening.numberFormat, culture);\n this.#restoreNumber(this.#openingNumber);\n this.#alignment = opening.alignment;\n this.#fontStyle = spread.fontStyleDiffers ? undefined : styleOf(opening.font);\n this.#underline = opening.font.underline;\n this.#strikethrough = opening.font.strikethrough;\n this.#fontColour = opening.font.colour;\n this.#fill = spread.fillDiffers ? CellFill.none : opening.fill;\n this.#edges = { ...spread.edges };\n const pen = openingPen(this.#edges);\n this.#lineStyle = pen.style;\n this.#lineColour = pen.colour;\n }\n\n /**\n * Format Cells' draft over the ranges, opening on the Focus cell (ADR-0071): what differs across the ranges is\n * read from what the Sheet records (`Sheet.getCellFormats`), so a Selection of whole columns opens as quickly\n * as one cell.\n */\n static open(sheet: Sheet, focus: CellAddress, ranges: readonly CellRange[]): FormatCellsDraft {\n return new FormatCellsDraft(sheet.getCellFormat(focus), spreadOf(sheet, ranges), sheet.culture);\n }\n\n // ---- Number ----\n\n /** The Number Format category chosen. */\n get category(): NumberFormatCategory {\n return this.#category;\n }\n\n /** The decimal places, under Number, Currency, Percentage and Scientific. */\n get decimalPlaces(): number {\n return this.#decimalPlaces;\n }\n\n /** Whether Number groups thousands. */\n get thousandsSeparator(): boolean {\n return this.#thousandsSeparator;\n }\n\n /** Which of `negativeNumbers` is chosen. */\n get negativeNumber(): number {\n return this.#negativeNumber;\n }\n\n /** The Date or Time format chosen, or the Custom code as typed; empty under any other category. */\n get typeCode(): string {\n return this.#typeCode;\n }\n\n /** The ways a negative number shows under the chosen category, each as its code. */\n get negativeNumbers(): readonly string[] {\n switch (this.#category) {\n case 'number':\n return Object.freeze(Array.from({ length: numberNegativeStyles },\n (_, n) => numberCode(this.#decimalPlaces, this.#thousandsSeparator, n)));\n case 'currency':\n return Object.freeze(Array.from({ length: currencyNegativeStyles }, (_, n) => currencyCode(this.#decimalPlaces, n, this.#culture)));\n case 'general': case 'accounting': case 'date': case 'time': case 'percentage': case 'fraction': case 'scientific':\n case 'text': case 'special': case 'custom':\n return Object.freeze([]);\n default:\n return unreachable(this.#category);\n }\n }\n\n /** The formats the chosen category lists: Date's, Time's, or the codes Custom starts from. */\n get types(): readonly string[] {\n switch (this.#category) {\n case 'date': return dateTypes;\n case 'time': return timeTypes;\n case 'custom': {\n const listed = this.#listedCustomTypes();\n const opening = this.#openingNumber;\n return opening.category === 'custom' && !listed.includes(opening.type) ? Object.freeze([opening.type, ...listed]) : listed;\n }\n case 'general': case 'number': case 'currency': case 'accounting': case 'percentage': case 'fraction':\n case 'scientific': case 'text': case 'special':\n return Object.freeze([]);\n default: return unreachable(this.#category);\n }\n }\n\n /** The codes Custom lists, as the Sheet's culture spells them. */\n #listedCustomTypes(): readonly string[] {\n if (this.#customTypes === undefined) this.#customTypes = customTypesIn(this.#culture);\n return this.#customTypes;\n }\n\n /** The Sheet culture's currency symbol, which Currency writes. */\n get currencySymbol(): string {\n return currencySymbolOf(this.#culture);\n }\n\n /** Whether the chosen category takes decimal places. */\n get takesDecimalPlaces(): boolean {\n return this.#category === 'number' || this.#category === 'currency' || this.#category === 'percentage' || this.#category === 'scientific';\n }\n\n /**\n * The code the Number tab shows now. Under Custom it is the code as typed, which is read as the Sheet's culture\n * spells codes (`NumberFormat.tryParseLocal`): a built-in only where it spells that built-in's code under the\n * culture (the fourteenth Windows run, case 11).\n */\n get numberFormatCode(): string {\n switch (this.#category) {\n case 'general': return NumberFormat.general.code;\n case 'number': return numberCode(this.#decimalPlaces, this.#thousandsSeparator, this.#negativeNumber);\n case 'currency': return currencyCode(this.#decimalPlaces, this.#negativeNumber, this.#culture);\n case 'percentage': return percentageCode(this.#decimalPlaces);\n case 'scientific': return scientificCode(this.#decimalPlaces);\n case 'text': return '@';\n case 'accounting':\n case 'date':\n case 'time':\n case 'fraction':\n case 'special':\n case 'custom':\n return this.#typeCode;\n default: return unreachable(this.#category);\n }\n }\n\n /** Why the Number tab's code cannot be set, or `undefined` when it can. */\n get numberFormatRefusal(): FormatCellsRefusal | undefined {\n const read = this.#readNumberFormat();\n return 'refusal' in read ? read.refusal : undefined;\n }\n\n /**\n * Chooses a category, with its options as they opened when it is the one the Focus cell's code is, and the\n * category's defaults otherwise. A category shown disabled is refused, with its reason.\n */\n selectCategory(category: NumberFormatCategory): void {\n if (!formatCellsOffer.categories.some(offer => offer.category === category)) {\n throw new TypeError(`'${category}' is not a Number Format category.`);\n }\n if (isDisabledCategory(category)) throw new TypeError(SheetWords.english.categoryDisabled(category));\n this.#numberTouched = true;\n if (category === this.#openingNumber.category) {\n this.#restoreNumber(this.#openingNumber);\n return;\n }\n // Custom starts from the code shown, as Excel's does, spelled as the Custom box reads it; a code already in\n // the box is spelled so.\n const code = this.numberFormatCode;\n const shownFormat = this.#category === 'custom' ? undefined : NumberFormat.tryParse(code).format;\n const shown = shownFormat === undefined ? code : shownFormat.localCode(this.#culture);\n this.#category = category;\n this.#decimalPlaces = defaultPlaces(category, this.#culture);\n this.#thousandsSeparator = false;\n this.#negativeNumber = 0;\n this.#typeCode = category === 'date' ? firstOf(dateTypes)\n : category === 'time' ? firstOf(timeTypes)\n : category === 'custom' ? shown : '';\n }\n\n /** Sets the decimal places, 0 to 30. */\n setDecimalPlaces(places: number): void {\n if (!Number.isInteger(places) || places < 0 || places > mostDecimalPlaces) {\n throw new RangeError(`Decimal places are 0 to ${mostDecimalPlaces}, not ${places}.`);\n }\n this.#numberTouched = true;\n this.#decimalPlaces = places;\n }\n\n /** Sets whether Number groups thousands. */\n setThousandsSeparator(separator: boolean): void {\n this.#numberTouched = true;\n this.#thousandsSeparator = separator;\n }\n\n /** Chooses one of `negativeNumbers`. */\n setNegativeNumber(index: number): void {\n if (!Number.isInteger(index) || index < 0 || index >= this.negativeNumbers.length) {\n throw new RangeError(`${index} is not one of the ${this.negativeNumbers.length} ways a negative number shows here.`);\n }\n this.#numberTouched = true;\n this.#negativeNumber = index;\n }\n\n /** Chooses a Date or Time format, or types the Custom code. */\n setType(code: string): void {\n if (typeof code !== 'string') throw new TypeError('A format code is text.');\n this.#numberTouched = true;\n this.#typeCode = code;\n }\n\n // ---- Alignment ----\n\n /** The horizontal alignment. */\n get alignment(): HorizontalAlignment {\n return this.#alignment;\n }\n\n /** Sets the horizontal alignment. */\n setAlignment(alignment: HorizontalAlignment): void {\n if (!formatCellsOffer.alignments.includes(alignment)) throw new TypeError(`'${alignment}' is not an alignment.`);\n this.#alignmentTouched = true;\n this.#alignment = alignment;\n }\n\n // ---- Font ----\n\n /** The Font style; `undefined`, shown empty, while bold or italic differs across the Selection. */\n get fontStyle(): FontStyle | undefined {\n return this.#fontStyle;\n }\n\n /** Whether the text is underlined. */\n get underline(): boolean {\n return this.#underline;\n }\n\n /** Whether the text is struck through. */\n get strikethrough(): boolean {\n return this.#strikethrough;\n }\n\n /** The Font's colour; Automatic is the Ink. */\n get fontColour(): CellColour {\n return this.#fontColour;\n }\n\n /** Sets the Font style: bold and italic together. */\n setFontStyle(style: FontStyle): void {\n if (!formatCellsOffer.fontStyles.includes(style)) throw new TypeError(`'${style}' is not a font style.`);\n this.#fontStyleTouched = true;\n this.#fontStyle = style;\n }\n\n /** Sets the single underline on or off. */\n setUnderline(underline: boolean): void {\n this.#underlineTouched = true;\n this.#underline = underline;\n }\n\n /** Sets strikethrough on or off. */\n setStrikethrough(strikethrough: boolean): void {\n this.#strikethroughTouched = true;\n this.#strikethrough = strikethrough;\n }\n\n /** Sets the Font's colour: Automatic, or a colour of the palette or More Colours. */\n setFontColour(colour: CellColour): void {\n this.#fontColourTouched = true;\n this.#fontColour = colour;\n this.#forgetColourText('font');\n }\n\n /**\n * Whether the Font is Excel's Normal font as ExSheet has it \u2014 the colour Automatic, and neither bold, italic,\n * underline nor strikethrough \u2014 which the Font tab's Normal font box shows checked (ADR-0071, 2026-10-02).\n * False while bold or italic differs across the Selection.\n */\n get isNormalFont(): boolean {\n return this.#fontStyle === 'regular' && !this.#underline && !this.#strikethrough && this.#fontColour.isAutomatic;\n }\n\n /**\n * The Font tab's Normal font box, checked (ADR-0071, 2026-10-02): every part of the Font set to its default and\n * touched, so OK records them on each selected cell over a row's or a column's Font, as Excel writes its Normal\n * style's font. ExSheet has no Normal style: a typeface and a size stay out.\n */\n setNormalFont(): void {\n this.setFontStyle('regular');\n this.setUnderline(false);\n this.setStrikethrough(false);\n this.setFontColour(automaticColour());\n }\n\n // ---- Fill ----\n\n /** The Fill; No Colour while the Fill differs across the Selection. */\n get fill(): CellFill {\n return this.#fill;\n }\n\n /** Sets the Fill: No Colour, or a colour of the palette or More Colours. */\n setFill(fill: CellFill): void {\n this.#fillTouched = true;\n this.#fill = fill;\n this.#forgetColourText('fill');\n }\n\n // ---- Border ----\n\n /**\n * The line style an edge or a preset sets. Format Cells opens on the line an outer edge shows, and on Thin\n * where none shows one (`openingPen`).\n */\n get lineStyle(): BorderLineStyle {\n return this.#lineStyle;\n }\n\n /** The line colour an edge or a preset sets: the colour of the line the style opens on, else Automatic. */\n get lineColour(): CellColour {\n return this.#lineColour;\n }\n\n /** Chooses the line style. */\n setLineStyle(style: BorderLineStyle): void {\n if (!formatCellsOffer.lineStyleColumns.some(column => column.includes(style))) {\n throw new TypeError(`'${style}' is not a line style.`);\n }\n this.#lineStyle = style;\n }\n\n /** Chooses the line colour. */\n setLineColour(colour: CellColour): void {\n this.#lineColour = colour;\n this.#forgetColourText('border');\n }\n\n /** The line on an edge; `undefined`, drawn as a grey dotted line, while it differs across the Selection. */\n edgeLine(edge: BorderEdge): BorderLine | undefined {\n return this.#edges[edge];\n }\n\n /** Whether an edge can be set: an edge inside the range only where a range has more than one row or column. */\n canSet(edge: BorderEdge): boolean {\n switch (edge) {\n case 'insideHorizontal': return this.hasInsideHorizontal;\n case 'insideVertical': return this.hasInsideVertical;\n case 'top':\n case 'bottom':\n case 'left':\n case 'right':\n return true;\n default: return unreachable(edge);\n }\n }\n\n /** Whether a preset is offered: Inside only where a range has an edge inside it. */\n canApply(preset: BorderPreset): boolean {\n return preset !== 'inside' || this.hasInsideHorizontal || this.hasInsideVertical;\n }\n\n /**\n * An edge's button, as Excel's: an edge that shows the chosen line loses it, and any other takes it. A line\n * style of None takes the line away. An edge that cannot be set for this Selection is refused.\n */\n toggleEdge(edge: BorderEdge): void {\n if (!this.canSet(edge)) {\n throw new Error(`The ${SheetWords.english.edgeName(edge)} edge lies inside a range, and no selected range has one.`);\n }\n const pen = this.#pen();\n const shown = this.#edges[edge];\n this.#setEdge(edge, shown !== undefined && shown.equals(pen) ? BorderLine.none : pen);\n }\n\n /** A preset: None takes every line of the range away; Outline and Inside set the chosen line there. Inside,\n * where no selected range has an edge inside it, is refused. */\n applyPreset(preset: BorderPreset): void {\n if (!this.canApply(preset)) throw new Error('Inside sets the edges inside a range, and no selected range has one.');\n const line = preset === 'none' ? BorderLine.none : this.#pen();\n for (const edge of formatCellsOffer.edges) {\n const outer = edge !== 'insideHorizontal' && edge !== 'insideVertical';\n const sets = preset === 'outline' ? outer : preset === 'inside' ? !outer : true;\n if (sets && this.canSet(edge)) this.#setEdge(edge, line);\n }\n }\n\n #pen(): BorderLine {\n return new BorderLine(this.#lineStyle, this.#lineColour);\n }\n\n #setEdge(edge: BorderEdge, line: BorderLine): void {\n this.#edges[edge] = line;\n this.#edgesTouched.add(edge);\n }\n\n // ---- A palette's colour ----\n\n /** The colour a palette shows chosen for a target: the Font's or the Border's, Automatic among them, or the Fill's,\n * `undefined` for No Colour. */\n colourOf(target: ColourTarget): CellColour | undefined {\n switch (target) {\n case 'font': return this.fontColour;\n case 'fill': return this.#fill.colour;\n case 'border': return this.lineColour;\n default: return unreachable(target);\n }\n }\n\n /** Chooses a palette's colour for a target: `undefined` is a palette's first choice, Automatic for the Font and the\n * Border, and No Colour for the Fill. */\n setColour(target: ColourTarget, colour: CellColour | undefined): void {\n switch (target) {\n case 'font': this.setFontColour(colour === undefined ? automaticColour() : colour); break;\n case 'fill': this.setFill(colour === undefined ? CellFill.none : CellFill.solid(colour)); break;\n case 'border': this.setLineColour(colour === undefined ? automaticColour() : colour); break;\n default: unreachable(target);\n }\n }\n\n // ---- More Colours ----\n\n /** The text typed under More Colours for a colour, or empty. */\n colourText(target: ColourTarget): string {\n const text = this.#colourText.get(target);\n return text === undefined ? '' : text;\n }\n\n /**\n * Reads text typed under More Colours: `#` and six hex digits, such as `#1F4E79`, sets the colour for the\n * target. Any other text stands as a `refusal` until it is corrected, cleared, or a colour is chosen from the\n * palette.\n */\n setColourText(target: ColourTarget, text: string): void {\n if (typeof text !== 'string') throw new TypeError('More Colours text is text.');\n const colour = FormatCellsDraft.tryReadHex(text);\n if (colour !== undefined) {\n switch (target) {\n case 'font': this.setFontColour(colour); break;\n case 'fill': this.setFill(CellFill.solid(colour)); break;\n case 'border': this.setLineColour(colour); break;\n default: unreachable(target);\n }\n this.#colourText.set(target, text);\n return;\n }\n this.#colourText.set(target, text);\n if (text.trim().length === 0) this.#colourRefusals.delete(target);\n else this.#colourRefusals.set(target, Object.freeze({ kind: 'notAColour', target, text }));\n }\n\n /** A colour written `#RRGGBB`, or `RRGGBB`, in either case; `undefined` for any other text. */\n static tryReadHex(text: string): CellColour | undefined {\n const digits = text.trim().replace(/^#+/u, '');\n return /^[0-9A-Fa-f]{6}$/u.test(digits) ? colourFromRgb(Number.parseInt(digits, 16)) : undefined;\n }\n\n #forgetColourText(target: ColourTarget): void {\n this.#colourText.delete(target);\n this.#colourRefusals.delete(target);\n }\n\n // ---- OK ----\n\n /**\n * Why OK cannot set what Format Cells shows, by name, or `undefined` when it can: a Custom code ExSheet does\n * not read, or More Colours text that is not a colour. `SheetWords.formatCellsRefusal` words it.\n */\n get refusal(): FormatCellsRefusal | undefined {\n const number = this.#numberTouched ? this.numberFormatRefusal : undefined;\n if (number !== undefined) return number;\n for (const refusal of this.#colourRefusals.values()) return refusal;\n return undefined;\n }\n\n /** Whether the user has touched anything that OK would set. */\n get isTouched(): boolean {\n return !this.change.isEmpty;\n }\n\n /** The parts the user touched, as one change; empty when nothing was. */\n get change(): CellFormatChange {\n const style = this.#fontStyleTouched ? this.#fontStyle : undefined;\n const emphasis = style === undefined ? undefined : emphasisOf(style);\n const touched = (edge: BorderEdge): BorderLine | undefined => (this.#edgesTouched.has(edge) ? this.#edges[edge] : undefined);\n const read = this.#numberTouched ? this.#readNumberFormat() : undefined;\n return new CellFormatChange({\n numberFormat: read !== undefined && 'format' in read ? read.format : undefined,\n alignment: this.#alignmentTouched ? this.#alignment : undefined,\n bold: emphasis?.bold,\n italic: emphasis?.italic,\n underline: this.#underlineTouched ? this.#underline : undefined,\n strikethrough: this.#strikethroughTouched ? this.#strikethrough : undefined,\n fontColour: this.#fontColourTouched ? this.#fontColour : undefined,\n fill: this.#fillTouched ? this.#fill : undefined,\n borders: this.#edgesTouched.size === 0 ? undefined : new BorderChange({\n top: touched('top'),\n bottom: touched('bottom'),\n left: touched('left'),\n right: touched('right'),\n insideHorizontal: touched('insideHorizontal'),\n insideVertical: touched('insideVertical'),\n }),\n });\n }\n\n /**\n * The Number tab's code as the engine reads it \u2014 a Custom code as the Sheet's culture spells codes, any other\n * as written \u2014 or the refusal, by name.\n */\n #readNumberFormat(): { readonly format: NumberFormat } | { readonly refusal: FormatCellsRefusal } {\n const code = this.numberFormatCode;\n if (code.trim().length === 0) return { refusal: Object.freeze({ kind: 'noNumberFormatCode' }) };\n const reading: NumberFormatReading = this.#category === 'custom'\n ? NumberFormat.tryParseLocal(code, this.#culture)\n : NumberFormat.tryParse(code);\n if (reading.format !== undefined) return { format: reading.format };\n return { refusal: Object.freeze({ kind: 'numberFormatNotRead', code, reason: reading.reason }) };\n }\n\n #restoreNumber(number: RecognisedNumberFormat): void {\n this.#category = number.category;\n this.#decimalPlaces = number.places;\n this.#thousandsSeparator = number.separator;\n this.#negativeNumber = number.negative;\n this.#typeCode = number.category === 'date' || number.category === 'time' || number.category === 'custom' ? number.type : '';\n }\n}\n\nfunction firstOf(list: readonly string[]): string {\n const first = list[0];\n if (first === undefined) throw new Error('Internal: a category lists no format.');\n return first;\n}\n", "// What Format Cells offers, in Excel's order (ADR-0071; the eleventh Windows run, cases 22 and 23): the same\n// under every Chrome. The C# counterpart is FormatCellsOffer and the enums beside it in FormatCells.cs; what\n// each offer is called is a word (sheet-words.ts), resolved from its name as ADR-0370 section 10 has it, so a\n// Chrome in another language names the same offers.\n\nimport type { BorderLineStyle, CellColour, HorizontalAlignment } from '@ex-grid/sheet-engine';\nimport { colourFromRgb } from './cell-colour';\n\n/** Format Cells' tabs, in Excel's order: five of Excel's six, Protection left out (ADR-0071). */\nexport type FormatCellsTab = 'number' | 'alignment' | 'font' | 'border' | 'fill';\n\n/**\n * The Number tab's categories, in Excel's order (ADR-0071; the eleventh Windows run, case 22). Accounting,\n * Fraction and Special are offered disabled ({@link DisabledNumberFormatCategory}).\n */\nexport type NumberFormatCategory =\n | 'general' | 'number' | 'currency' | 'accounting' | 'date' | 'time' | 'percentage' | 'fraction'\n | 'scientific' | 'text' | 'special' | 'custom';\n\n/**\n * The categories Format Cells shows disabled, each with its reason: Accounting pads with `*`, Fraction is not\n * among the codes ExSheet reads, and Special's formats depend on the locale (ADR-0071).\n */\nexport type DisabledNumberFormatCategory = 'accounting' | 'fraction' | 'special';\n\n/** The Font tab's styles, as Excel lists them: emphasis as one choice of four. */\nexport type FontStyle = 'regular' | 'italic' | 'bold' | 'boldItalic';\n\n/** An edge the Border tab sets, relative to each selected range, as Excel's dialog sets it (ADR-0071). The\n * inside edges are Excel's Horizontal and Vertical. */\nexport type BorderEdge = 'top' | 'insideHorizontal' | 'bottom' | 'left' | 'insideVertical' | 'right';\n\n/** The Border tab's presets, as Excel's dialog offers them (the eleventh Windows run, case 22). */\nexport type BorderPreset = 'none' | 'outline' | 'inside';\n\n/** Which colour a More Colours entry is for: the Font's, the Fill, or the Border's line. */\nexport type ColourTarget = 'font' | 'fill' | 'border';\n\n/** Excel's ten standard colours (case 23), by name. */\nexport type StandardColourName =\n | 'darkRed' | 'red' | 'orange' | 'yellow' | 'lightGreen' | 'green' | 'lightBlue' | 'blue' | 'darkBlue' | 'purple';\n\n/** The Office theme's ten colours (case 23), by the name of their column. */\nexport type ThemeColourName =\n | 'background1' | 'text1' | 'background2' | 'text2' | 'accent1' | 'accent2' | 'accent3' | 'accent4' | 'accent5' | 'accent6';\n\n/** A tint or a shade of a theme colour, as Excel's tooltip names it: `Darker 5%`, `Lighter 80%`. */\nexport interface SwatchStep {\n /** Whether the theme colour is darkened or lightened. */\n readonly shade: 'darker' | 'lighter';\n /** By how much, in percent. */\n readonly percent: number;\n}\n\n/**\n * One colour of the palette, with what Excel names it (ADR-0071; the eleventh Windows run, case 23): a theme\n * colour, with its step for a tint or a shade, or a standard colour. Its words are\n * {@link SheetWords.swatchName}'s.\n */\nexport interface PaletteSwatch {\n /** The RGB value Excel names it with in Format Cells' Fill tab, not the colour sampled from the screen. */\n readonly colour: CellColour;\n /** The colour's name: a theme colour's column, or a standard colour. */\n readonly name: ThemeColourName | StandardColourName;\n /** The tint or the shade of a theme colour, or `undefined` for the colour itself and a standard colour. */\n readonly step: SwatchStep | undefined;\n}\n\n/** A Number Format category as Format Cells offers it: available, or shown disabled with its reason. */\nexport interface NumberFormatCategoryOffer {\n /** The category. */\n readonly category: NumberFormatCategory;\n /** Whether it can be chosen; one that cannot is shown with {@link SheetWords.categoryDisabled}'s reason. */\n readonly enabled: boolean;\n}\n\n/** Whether a category is one Format Cells shows disabled. */\nexport function isDisabledCategory(category: NumberFormatCategory): category is DisabledNumberFormatCategory {\n return category === 'accounting' || category === 'fraction' || category === 'special';\n}\n\nfunction swatch(name: ThemeColourName | StandardColourName, rgb: number, shade?: SwatchStep): PaletteSwatch {\n return Object.freeze({ colour: colourFromRgb(rgb), name, step: shade });\n}\n\nfunction step(shade: 'darker' | 'lighter', percent: number): SwatchStep {\n return Object.freeze({ shade, percent });\n}\n\n// The column's name, then its RGB values from the theme row down, as the Fill tab names them (case 22's\n// \"tab-fill\"), and the steps its tooltips name (case 23).\nconst themeColumns: readonly (readonly [ThemeColourName, readonly number[], readonly SwatchStep[]])[] = [\n ['background1', [0xFFFFFF, 0xF2F2F2, 0xD9D9D9, 0xBFBFBF, 0xA6A6A6, 0x7F7F7F],\n [step('darker', 5), step('darker', 15), step('darker', 25), step('darker', 35), step('darker', 50)]],\n ['text1', [0x000000, 0x7F7F7F, 0x595959, 0x404040, 0x262626, 0x0D0D0D],\n [step('lighter', 50), step('lighter', 35), step('lighter', 25), step('lighter', 15), step('lighter', 5)]],\n ['background2', [0xE8E8E8, 0xD0D0D0, 0xADADAD, 0x747474, 0x393939, 0x161616],\n [step('darker', 10), step('darker', 25), step('darker', 50), step('darker', 75), step('darker', 90)]],\n ['text2', [0x0E2841, 0xDAE9F8, 0xA6C9EC, 0x4D93D9, 0x215C98, 0x153D64],\n [step('lighter', 90), step('lighter', 75), step('lighter', 50), step('lighter', 25), step('lighter', 10)]],\n ['accent1', [0x156082, 0xC0E6F5, 0x83CCEB, 0x44B3E1, 0x104861, 0x0B3040], accentSteps()],\n ['accent2', [0xE97132, 0xFBE2D5, 0xF7C7AC, 0xF1A983, 0xBE5014, 0x7E350E], accentSteps()],\n ['accent3', [0x196B24, 0xC1F0C8, 0x83E28E, 0x47D359, 0x12501A, 0x0D3512], accentSteps()],\n ['accent4', [0x0F9ED5, 0xCAEDFB, 0x94DCF8, 0x61CBF3, 0x0C769E, 0x074F69], accentSteps()],\n ['accent5', [0xA02B93, 0xF2CEEF, 0xE49EDD, 0xD86DCD, 0x782170, 0x50154A], accentSteps()],\n ['accent6', [0x4EA72E, 0xDAF2D0, 0xB5E6A2, 0x8ED973, 0x3C7D22, 0x275317], accentSteps()],\n];\n\nfunction accentSteps(): readonly SwatchStep[] {\n return [step('lighter', 80), step('lighter', 60), step('lighter', 40), step('darker', 25), step('darker', 50)];\n}\n\nfunction themeRows(): readonly (readonly PaletteSwatch[])[] {\n const rows: (readonly PaletteSwatch[])[] = [];\n for (let row = 0; row < 6; row++) {\n rows.push(Object.freeze(themeColumns.map(([name, rgb, steps]) => {\n const value = rgb[row];\n if (value === undefined) throw new Error(`Internal: the theme column '${name}' has no row ${row}.`);\n return swatch(name, value, row === 0 ? undefined : steps[row - 1]);\n })));\n }\n return Object.freeze(rows);\n}\n\n/** What Format Cells offers, in Excel's order (ADR-0071; the eleventh Windows run, cases 22 and 23). */\nexport const formatCellsOffer = Object.freeze({\n /** The tabs, in Excel's order. */\n tabs: Object.freeze<FormatCellsTab[]>(['number', 'alignment', 'font', 'border', 'fill']),\n /** The Number tab's categories, in Excel's order, each available or disabled. */\n categories: Object.freeze((\n ['general', 'number', 'currency', 'accounting', 'date', 'time', 'percentage', 'fraction', 'scientific', 'text', 'special', 'custom'] as const\n ).map((category): NumberFormatCategoryOffer => Object.freeze({ category, enabled: !isDisabledCategory(category) }))),\n /** The Alignment tab's horizontal alignments, as Excel lists them. */\n alignments: Object.freeze<HorizontalAlignment[]>(['general', 'left', 'center', 'right']),\n /** The Font tab's styles, as Excel lists them. */\n fontStyles: Object.freeze<FontStyle[]>(['regular', 'italic', 'bold', 'boldItalic']),\n /**\n * The Border tab's line styles in Excel's two columns, each from the top: None, Hair, Dotted, Dash-dot-dot,\n * Dash-dot, Dashed and Thin; then Medium Dash-dot-dot, Slanted Dash-dot, Medium Dash-dot, Medium Dashed,\n * Medium, Thick and Double (case 22).\n */\n lineStyleColumns: Object.freeze([\n Object.freeze<BorderLineStyle[]>(['none', 'hair', 'dotted', 'dashDotDot', 'dashDot', 'dashed', 'thin']),\n Object.freeze<BorderLineStyle[]>(['mediumDashDotDot', 'slantedDashDot', 'mediumDashDot', 'mediumDashed', 'medium', 'thick', 'double']),\n ]),\n /** The Border tab's presets, in Excel's order. */\n presets: Object.freeze<BorderPreset[]>(['none', 'outline', 'inside']),\n /** The Border tab's edges, in Excel's order, without its diagonals (ADR-0071). */\n edges: Object.freeze<BorderEdge[]>(['top', 'insideHorizontal', 'bottom', 'left', 'insideVertical', 'right']),\n /**\n * The Office theme's colours (case 23): ten across, in six rows \u2014 the theme colours, then five rows of their\n * tints and shades. Each records the RGB value Excel names it with in Format Cells' Fill tab; the two named\n * \"Grey\" are `#7F7F7F`.\n */\n themeColours: themeRows(),\n /** Excel's ten standard colours (case 23). */\n standardColours: Object.freeze([\n swatch('darkRed', 0xC00000), swatch('red', 0xFF0000), swatch('orange', 0xFFC000), swatch('yellow', 0xFFFF00),\n swatch('lightGreen', 0x92D050), swatch('green', 0x00B050), swatch('lightBlue', 0x00B0F0), swatch('blue', 0x0070C0),\n swatch('darkBlue', 0x002060), swatch('purple', 0x7030A0),\n ]),\n});\n", "// Format Cells under the built-in Chrome (ADR-0071), the counterpart of C#'s FormatCellsPanel: the contents ExSheet\n// shows in the grid's popover frame (ADR-0050 item 16). The frame is the grid's \u2014 where it stands, its bound,\n// Escape, a press elsewhere and the box shrinking \u2014 and these contents draw what ExSheet offers (formatCellsOffer),\n// set what the user chooses through the draft, and call back on OK and Cancel. Nothing here decides what a choice\n// means: that is FormatCellsDraft's, under every Chrome.\n//\n// The tabs are ARIA's tabs pattern: one tab stop, the arrow keys and Home and End move between the tabs and show\n// the one they reach. Each list of choices is a group of native radio buttons, so the arrow keys move inside it as\n// the browser moves them. A choice never redraws the control it was made in: every control is built once for the\n// tab shown, and after each choice its state is set from the draft, a field the user is typing in excepted, whose\n// text outranks the draft's (ADR-0240 section 1). It wears the C# panel's classes, so one stylesheet lays out both.\n\nimport type { BorderLine, BorderLineStyle, CellColour } from '@ex-grid/sheet-engine';\nimport { paintOf } from './cell-colour';\nimport type { FormatCellsDraft } from './format-cells-draft';\nimport { formatCellsOffer, isDisabledCategory, type BorderEdge, type ColourTarget, type FormatCellsTab, type PaletteSwatch } from './format-cells-offer';\nimport { unreachable } from './must';\nimport type { SheetWords } from './sheet-words';\n\n/** What Format Cells calls back on (ADR-0071). */\nexport interface FormatCellsPanelCallbacks {\n /** OK, by its button or Enter in a field: whether it was taken. One that was not leaves the draft's refusal shown. */\n readonly ok: () => boolean;\n /** Cancel: sets nothing. */\n readonly cancel: () => void;\n /** A tab was shown, so that the next opening shows it again, as Excel's does. */\n readonly tabShown: (tab: FormatCellsTab) => void;\n}\n\nconst svgNamespace = 'http://www.w3.org/2000/svg';\n\n// Unique on the page, for the tabs' aria-controls and the radio groups' names: two Sheets each have their own.\nlet instances = 0;\n\n/**\n * A line style's stroke width and dashes, as Format Cells' Border tab pictures it in an SVG (ADR-0071): only a picture\n * of the style, which a Chrome's Format Cells draws too; how a Border is painted on the Sheet is the grid's. `double`\n * is two strokes of the width given, and `none` is none.\n */\nexport function formatCellsLineStroke(style: BorderLineStyle): { readonly width: string; readonly dashes: string | undefined } {\n switch (style) {\n case 'hair': return { width: '1', dashes: '1 1' };\n case 'dotted': return { width: '1', dashes: '1 2' };\n case 'dashDotDot': return { width: '1', dashes: '6 2 1 2 1 2' };\n case 'dashDot': return { width: '1', dashes: '6 2 1 2' };\n case 'dashed': return { width: '1', dashes: '4 2' };\n case 'mediumDashDotDot': return { width: '2', dashes: '6 2 2 2 2 2' };\n case 'slantedDashDot': return { width: '2', dashes: '8 2 4 2' };\n case 'mediumDashDot': return { width: '2', dashes: '8 2 2 2' };\n case 'mediumDashed': return { width: '2', dashes: '6 3' };\n case 'medium': return { width: '2', dashes: undefined };\n case 'thick': return { width: '3', dashes: undefined };\n case 'none': case 'thin': case 'double': return { width: '1', dashes: undefined };\n default: return unreachable(style);\n }\n}\n\n// An edge shows its line; one whose cells' sides differ reads mixed, as Excel reads its button.\nfunction pressedOf(line: BorderLine | undefined): string {\n if (line === undefined) return 'mixed';\n return line.isNone ? 'false' : 'true';\n}\n\n/** Format Cells' contents under the built-in Chrome, over a draft (ADR-0071). */\nexport class FormatCellsPanel {\n /** The form the grid's popover frame holds. */\n readonly element: HTMLFormElement;\n readonly #doc: Document;\n readonly #draft: FormatCellsDraft;\n readonly #words: SheetWords;\n readonly #callbacks: FormatCellsPanelCallbacks;\n readonly #id: string;\n readonly #tabs = new Map<FormatCellsTab, HTMLButtonElement>();\n readonly #panel: HTMLElement;\n readonly #refusal: HTMLElement;\n #tab: FormatCellsTab;\n // What sets each control of the tab shown from the draft, run after every choice.\n #syncs: (() => void)[] = [];\n\n constructor(doc: Document, draft: FormatCellsDraft, words: SheetWords, tab: FormatCellsTab, callbacks: FormatCellsPanelCallbacks) {\n this.#doc = doc;\n this.#draft = draft;\n this.#words = words;\n this.#callbacks = callbacks;\n this.#tab = tab;\n instances++;\n this.#id = `ex-format-cells-${String(instances)}`;\n this.element = doc.createElement('form');\n this.element.className = 'ex-format-cells';\n this.element.addEventListener('submit', event => {\n event.preventDefault();\n this.#ok();\n });\n const tabList = this.#el('div', 'ex-format-cells-tabs');\n tabList.setAttribute('role', 'tablist');\n tabList.setAttribute('aria-label', words.formatCellsLabel('tabs'));\n for (const shown of formatCellsOffer.tabs) {\n const button = this.#button('ex-format-cells-tab', words.tabName(shown), () => { this.#show(shown, false); });\n button.id = this.#tabId(shown);\n button.setAttribute('role', 'tab');\n button.setAttribute('aria-controls', this.#panelId);\n button.addEventListener('keydown', this.#onTabKey);\n this.#tabs.set(shown, button);\n tabList.append(button);\n }\n this.#panel = this.#el('div', 'ex-format-cells-panel');\n this.#panel.id = this.#panelId;\n this.#panel.setAttribute('role', 'tabpanel');\n this.#refusal = this.#el('div', 'ex-format-cells-refusal');\n this.#refusal.setAttribute('role', 'alert');\n this.#refusal.hidden = true;\n const ok = this.#el('button', 'ex-format-cells-ok ex-popover-closes', words.formatCellsLabel('ok'));\n ok.setAttribute('type', 'submit');\n const cancel = this.#button('ex-format-cells-cancel ex-popover-closes', words.formatCellsLabel('cancel'), () => { callbacks.cancel(); });\n this.element.append(tabList, this.#panel, this.#refusal, this.#el('div', 'ex-popover-actions ex-format-cells-actions', ok, cancel));\n this.#show(tab, false);\n }\n\n get #panelId(): string {\n return `${this.#id}-panel`;\n }\n\n #tabId(tab: FormatCellsTab): string {\n return `${this.#id}-tab-${tab}`;\n }\n\n // Shows a tab, its controls built afresh from the draft; `focus` moves the keyboard onto its tab, as the arrows do.\n #show(tab: FormatCellsTab, focus: boolean): void {\n this.#tab = tab;\n for (const [each, button] of this.#tabs) {\n button.setAttribute('aria-selected', each === tab ? 'true' : 'false');\n button.tabIndex = each === tab ? 0 : -1;\n }\n this.#panel.setAttribute('aria-labelledby', this.#tabId(tab));\n this.#syncs = [];\n this.#panel.replaceChildren(this.#tabContents(tab));\n this.#changed();\n if (focus) this.#tabs.get(tab)?.focus();\n this.#callbacks.tabShown(tab);\n }\n\n #tabContents(tab: FormatCellsTab): HTMLElement {\n switch (tab) {\n case 'number': return this.#numberTab();\n case 'alignment': return this.#alignmentTab();\n case 'font': return this.#fontTab();\n case 'border': return this.#borderTab();\n case 'fill': return this.#fillTab();\n default: return unreachable(tab);\n }\n }\n\n // ARIA's tabs pattern: the arrows move to the previous or next tab, wrapping, and Home and End to the first and\n // the last; the tab reached is shown.\n readonly #onTabKey = (event: KeyboardEvent): void => {\n const tabs = formatCellsOffer.tabs;\n const at = tabs.indexOf(this.#tab);\n const to = { ArrowRight: (at + 1) % tabs.length, ArrowLeft: (at + tabs.length - 1) % tabs.length, Home: 0, End: tabs.length - 1 }[event.key];\n const next = to === undefined ? undefined : tabs[to];\n if (next === undefined) return;\n event.preventDefault();\n this.#show(next, true);\n };\n\n // A choice was made: every control of the tab shown takes the draft's state, and a refusal OK showed goes once\n // its cause has.\n #changed(): void {\n for (const sync of this.#syncs) sync();\n if (this.#draft.refusal === undefined) this.#showRefusal(undefined);\n }\n\n // OK, its fields checked first: one the browser holds invalid, a number of places out of range, is reported where\n // it stands, and nothing is set.\n #ok(): void {\n if (!this.element.checkValidity()) {\n this.element.reportValidity();\n return;\n }\n if (this.#callbacks.ok()) return;\n const refusal = this.#draft.refusal;\n this.#showRefusal(refusal === undefined ? undefined : this.#words.formatCellsRefusal(refusal));\n }\n\n #showRefusal(text: string | undefined): void {\n this.#refusal.textContent = text === undefined ? '' : text;\n this.#refusal.hidden = text === undefined;\n }\n\n // ---- Number ----\n\n #numberTab(): HTMLElement {\n const words = this.#words;\n const draft = this.#draft;\n const categories = this.#fieldset('ex-format-cells-categories', words.formatCellsLabel('category'));\n for (const offer of formatCellsOffer.categories) {\n const { category } = offer;\n const radio = this.#radio(`${this.#id}-category`, () => draft.category === category, () => { draft.selectCategory(category); });\n radio.disabled = !offer.enabled;\n categories.append(this.#choice(radio, words.categoryName(category)));\n if (isDisabledCategory(category)) {\n const reason = this.#el('span', 'ex-format-cells-reason', words.categoryDisabled(category));\n reason.id = `${this.#id}-reason-${category}`;\n radio.setAttribute('aria-describedby', reason.id);\n categories.append(reason);\n }\n }\n const options = this.#el('div', 'ex-format-cells-options');\n // The options are the category's: built afresh when the category changes, and set from the draft otherwise.\n let builtFor = draft.category;\n let optionSyncs: (() => void)[] = [];\n const build = (): void => {\n const outer = this.#syncs;\n this.#syncs = [];\n options.replaceChildren(...this.#numberOptions());\n optionSyncs = this.#syncs;\n this.#syncs = outer;\n builtFor = draft.category;\n };\n build();\n this.#syncs.push(() => {\n if (builtFor !== draft.category) build();\n for (const sync of optionSyncs) sync();\n });\n return this.#el('div', 'ex-format-cells-columns', categories, options);\n }\n\n #numberOptions(): HTMLElement[] {\n const words = this.#words;\n const draft = this.#draft;\n const { category } = draft;\n const shown: HTMLElement[] = [];\n if (category === 'general') shown.push(this.#el('p', '', words.formatCellsLabel('generalHint')));\n else if (category === 'text') shown.push(this.#el('p', '', words.formatCellsLabel('textHint')));\n if (draft.takesDecimalPlaces) {\n const places = this.#field('number', 'ex-format-cells-places', () => String(draft.decimalPlaces), typed => {\n const value = Number(typed);\n // Only a whole number of places Excel takes is set; anything else leaves the field invalid, which OK\n // refuses rather than set the places the field no longer shows.\n if (typed.trim() !== '' && Number.isInteger(value) && value >= 0 && value <= 30) draft.setDecimalPlaces(value);\n });\n places.min = '0';\n places.max = '30';\n places.required = true;\n shown.push(this.#labelled(words.formatCellsLabel('decimalPlaces'), places));\n }\n if (category === 'number') {\n shown.push(this.#choice(this.#checkbox('ex-format-cells-separator', () => draft.thousandsSeparator,\n checked => { draft.setThousandsSeparator(checked); }), words.formatCellsLabel('thousandsSeparator')));\n }\n if (category === 'currency') shown.push(this.#el('p', 'ex-format-cells-symbol', words.currencySymbolShown(draft.currencySymbol)));\n if (draft.negativeNumbers.length > 0) {\n shown.push(this.#codeList('ex-format-cells-negatives', words.formatCellsLabel('negativeNumbers'), `${this.#id}-negative`,\n () => draft.negativeNumbers, index => draft.negativeNumber === index, index => { draft.setNegativeNumber(index); }));\n }\n if (category === 'custom') {\n const code = this.#field('text', 'ex-format-cells-code', () => draft.typeCode, typed => { draft.setType(typed); });\n const refusal = this.#el('span', 'ex-format-cells-refusal');\n refusal.id = `${this.#id}-code-refusal`;\n code.setAttribute('aria-describedby', refusal.id);\n this.#syncs.push(() => {\n const why = draft.numberFormatRefusal;\n refusal.textContent = why === undefined ? '' : words.formatCellsRefusal(why);\n });\n shown.push(this.#labelled(words.formatCellsLabel('type'), code), refusal);\n }\n if (draft.types.length > 0) {\n shown.push(this.#codeList('ex-format-cells-types', words.formatCellsLabel(category === 'custom' ? 'codes' : 'type'), `${this.#id}-type`,\n () => draft.types, (_, code) => draft.typeCode === code, (_, code) => { draft.setType(code); }));\n }\n return shown;\n }\n\n // A list of codes to choose one of, its codes the draft's at each choice: a list of another length is built\n // afresh, and one of the same length has its codes and its choice set in place.\n #codeList(className: string, legend: string, name: string, codes: () => readonly string[],\n chosen: (index: number, code: string) => boolean, choose: (index: number, code: string) => void): HTMLElement {\n const fieldset = this.#fieldset(className, legend);\n let shown: { readonly radio: HTMLInputElement; readonly code: HTMLElement }[] = [];\n this.#syncs.push(() => {\n const now = codes();\n if (now.length !== shown.length) {\n for (const { radio } of shown) radio.closest('label')?.remove();\n shown = now.map((_, index) => {\n const radio = this.#input('radio');\n radio.name = name;\n radio.addEventListener('change', () => {\n const code = codes()[index];\n if (code !== undefined) choose(index, code);\n this.#changed();\n });\n const code = this.#el('code', '');\n fieldset.append(this.#choice(radio, code));\n return { radio, code };\n });\n }\n shown.forEach(({ radio, code }, index) => {\n const text = now[index];\n if (text === undefined) return;\n code.textContent = text;\n radio.checked = chosen(index, text);\n });\n });\n return fieldset;\n }\n\n // ---- Alignment ----\n\n #alignmentTab(): HTMLElement {\n const draft = this.#draft;\n const select = this.#doc.createElement('select');\n select.className = 'ex-format-cells-alignment';\n for (const alignment of formatCellsOffer.alignments) {\n const option = this.#el('option', '', this.#words.alignmentName(alignment));\n option.setAttribute('value', alignment);\n select.append(option);\n }\n select.addEventListener('change', () => {\n const alignment = formatCellsOffer.alignments.find(each => each === select.value);\n if (alignment !== undefined) draft.setAlignment(alignment);\n this.#changed();\n });\n this.#syncs.push(() => { select.value = draft.alignment; });\n return this.#labelled(this.#words.formatCellsLabel('horizontal'), select);\n }\n\n // ---- Font ----\n\n #fontTab(): HTMLElement {\n const words = this.#words;\n const draft = this.#draft;\n const styles = this.#fieldset('ex-format-cells-font-styles', words.formatCellsLabel('fontStyle'));\n for (const style of formatCellsOffer.fontStyles) {\n styles.append(this.#choice(this.#radio(`${this.#id}-font-style`, () => draft.fontStyle === style, () => { draft.setFontStyle(style); }),\n words.fontStyleName(style)));\n }\n const underline = this.#doc.createElement('select');\n underline.className = 'ex-format-cells-underline';\n for (const [value, label] of [['none', words.formatCellsLabel('underlineNone')], ['single', words.formatCellsLabel('underlineSingle')]] as const) {\n const option = this.#el('option', '', label);\n option.setAttribute('value', value);\n underline.append(option);\n }\n underline.addEventListener('change', () => {\n draft.setUnderline(underline.value === 'single');\n this.#changed();\n });\n this.#syncs.push(() => { underline.value = draft.underline ? 'single' : 'none'; });\n const strikethrough = this.#checkbox('ex-format-cells-strikethrough', () => draft.strikethrough, checked => { draft.setStrikethrough(checked); });\n // Excel's Normal font (ADR-0071, 2026-10-02): checking it sets every part of the Font to its default. It shows\n // checked while they are, so unchecking it changes nothing, and the click that would only clear the box is\n // not let through.\n const normal = this.#checkbox('ex-format-cells-normal-font', () => draft.isNormalFont, checked => { if (checked) draft.setNormalFont(); });\n normal.addEventListener('click', event => { if (draft.isNormalFont) event.preventDefault(); });\n const options = this.#el('div', 'ex-format-cells-options',\n this.#labelled(words.formatCellsLabel('underline'), underline),\n this.#choice(strikethrough, words.formatCellsLabel('strikethrough')),\n this.#choice(normal, words.formatCellsLabel('normalFont')));\n const colour = this.#fieldset('ex-format-cells-colour', words.formatCellsLabel('colour'), this.#palette('font', () => draft.colourOf('font')));\n return this.#el('div', '', this.#el('div', 'ex-format-cells-columns', styles, options), colour);\n }\n\n // ---- Border ----\n\n #borderTab(): HTMLElement {\n const words = this.#words;\n const draft = this.#draft;\n const styles = this.#fieldset('ex-format-cells-line-styles', words.formatCellsLabel('lineStyle'));\n const columns = this.#el('div', 'ex-format-cells-columns');\n for (const column of formatCellsOffer.lineStyleColumns) {\n const shown = this.#el('div', 'ex-format-cells-line-column');\n for (const style of column) {\n const name = words.lineStyleName(style);\n const radio = this.#radio(`${this.#id}-line-style`, () => draft.lineStyle === style, () => { draft.setLineStyle(style); });\n radio.setAttribute('aria-label', name);\n const choice = this.#choice(radio, this.#lineSample(style));\n choice.title = name;\n shown.append(choice);\n }\n columns.append(shown);\n }\n styles.append(columns);\n const presets = this.#el('div', 'ex-format-cells-presets');\n presets.setAttribute('role', 'group');\n presets.setAttribute('aria-label', words.formatCellsLabel('presets'));\n for (const preset of formatCellsOffer.presets) {\n const button = this.#button('ex-format-cells-preset', words.presetName(preset), () => { draft.applyPreset(preset); this.#changed(); });\n this.#syncs.push(() => { button.disabled = !draft.canApply(preset); });\n presets.append(button);\n }\n const edges = this.#el('div', 'ex-format-cells-edges');\n edges.setAttribute('role', 'group');\n edges.setAttribute('aria-label', words.formatCellsLabel('border'));\n for (const edge of formatCellsOffer.edges) {\n const button = this.#button('ex-format-cells-edge', words.edgeName(edge), () => { draft.toggleEdge(edge); this.#changed(); });\n button.dataset['edge'] = edge;\n this.#syncs.push(() => {\n button.disabled = !draft.canSet(edge);\n button.setAttribute('aria-pressed', pressedOf(draft.edgeLine(edge)));\n });\n edges.append(button);\n }\n const preview = this.#doc.createElementNS(svgNamespace, 'svg');\n preview.setAttribute('class', 'ex-format-cells-preview');\n for (const [name, value] of [['width', '120'], ['height', '72'], ['viewBox', '0 0 120 72'], ['role', 'img']] as const) preview.setAttribute(name, value);\n preview.setAttribute('aria-label', words.formatCellsLabel('preview'));\n this.#syncs.push(() => { this.#drawPreview(preview); });\n const colour = this.#fieldset('ex-format-cells-colour', words.formatCellsLabel('colour'), this.#palette('border', () => draft.colourOf('border')));\n return this.#el('div', '', this.#el('div', 'ex-format-cells-columns', styles, this.#el('div', 'ex-format-cells-options', presets, edges, preview)), colour);\n }\n\n // The preview: the range's edges as they will be \u2014 outer ones round the box, inner ones across it where a range\n // has them \u2014 and an edge whose cells' sides differ as a grey dotted line, as Excel draws it (the eleventh Windows\n // run, case 24).\n #drawPreview(preview: SVGElement): void {\n const draft = this.#draft;\n const edges: [BorderEdge, number, number, number, number][] = [\n ['top', 4, 4, 116, 4], ['bottom', 4, 68, 116, 68], ['left', 4, 4, 4, 68], ['right', 116, 4, 116, 68],\n ];\n if (draft.hasInsideHorizontal) edges.push(['insideHorizontal', 4, 36, 116, 36]);\n if (draft.hasInsideVertical) edges.push(['insideVertical', 60, 4, 60, 68]);\n const lines: SVGElement[] = [];\n for (const [edge, x1, y1, x2, y2] of edges) {\n const line = draft.edgeLine(edge);\n if (line?.isNone === true) continue;\n const drawn = this.#svgLine(x1, y1, x2, y2);\n drawn.dataset['edge'] = edge;\n if (line === undefined) {\n drawn.setAttribute('class', 'ex-format-cells-differs');\n for (const [name, value] of [['stroke', '#808080'], ['stroke-width', '1'], ['stroke-dasharray', '1 2']] as const) drawn.setAttribute(name, value);\n } else {\n const { width, dashes } = formatCellsLineStroke(line.style);\n drawn.setAttribute('stroke', paintOf(line.colour));\n drawn.setAttribute('stroke-width', width);\n if (dashes !== undefined) drawn.setAttribute('stroke-dasharray', dashes);\n }\n lines.push(drawn);\n }\n preview.replaceChildren(...lines);\n }\n\n // A line style's sample, as the Border tab draws it: a stroke and its dashes.\n #lineSample(style: BorderLineStyle): SVGElement {\n const svg = this.#doc.createElementNS(svgNamespace, 'svg');\n svg.setAttribute('class', 'ex-format-cells-line');\n svg.setAttribute('width', '56');\n svg.setAttribute('height', '8');\n svg.setAttribute('aria-hidden', 'true');\n if (style === 'double') {\n svg.append(this.#svgLine(0, 2.5, 56, 2.5), this.#svgLine(0, 5.5, 56, 5.5));\n } else if (style !== 'none') {\n const { width, dashes } = formatCellsLineStroke(style);\n const line = this.#svgLine(0, 4, 56, 4);\n line.setAttribute('stroke-width', width);\n if (dashes !== undefined) line.setAttribute('stroke-dasharray', dashes);\n svg.append(line);\n }\n return svg;\n }\n\n #svgLine(x1: number, y1: number, x2: number, y2: number): SVGElement {\n const line = this.#doc.createElementNS(svgNamespace, 'line');\n for (const [name, value] of [['x1', x1], ['y1', y1], ['x2', x2], ['y2', y2]] as const) line.setAttribute(name, String(value));\n line.setAttribute('stroke', 'currentColor');\n line.setAttribute('stroke-width', '1');\n return line;\n }\n\n // ---- Fill ----\n\n #fillTab(): HTMLElement {\n const draft = this.#draft;\n return this.#fieldset('ex-format-cells-colour', this.#words.formatCellsLabel('backgroundColour'), this.#palette('fill', () => draft.colourOf('fill')));\n }\n\n // ---- The palette ----\n\n // Case 23's palette as one group of radio buttons: Automatic (the Font and the Border) or No Colour (the Fill)\n // first, then the theme's sixty and the ten standard colours, each named as Excel names it, and More Colours,\n // which takes a hex value. `chosen` is `undefined` for No Colour.\n #palette(target: ColourTarget, chosen: () => CellColour | undefined): HTMLElement {\n const words = this.#words;\n const name = `${this.#id}-palette-${target}`;\n const isFill = target === 'fill';\n const palette = this.#el('div', 'ex-format-cells-palette');\n palette.setAttribute('role', 'radiogroup');\n palette.setAttribute('aria-label', words.formatCellsLabel(isFill ? 'backgroundColour' : 'colour'));\n const first = this.#radio(name, () => (isFill ? chosen() === undefined : chosen()?.isAutomatic === true), () => { this.#choose(target, undefined); });\n const firstChoice = this.#choice(first, words.formatCellsLabel(isFill ? 'noColour' : 'automatic'));\n firstChoice.classList.add('ex-format-cells-first-colour');\n const swatches = (row: readonly PaletteSwatch[]): HTMLElement => this.#el('div', 'ex-format-cells-swatches', ...row.map(swatch => {\n const radio = this.#radio(name, () => {\n const colour = chosen();\n return colour !== undefined && !colour.isAutomatic && colour.equals(swatch.colour);\n }, () => { this.#choose(target, swatch.colour); });\n radio.classList.add('ex-format-cells-swatch');\n radio.style.backgroundColor = paintOf(swatch.colour);\n const swatchName = words.swatchName(swatch);\n radio.setAttribute('aria-label', swatchName);\n radio.title = swatchName;\n radio.dataset['rgb'] = paintOf(swatch.colour);\n return radio;\n }));\n const hex = this.#field('text', 'ex-format-cells-hex', () => this.#draft.colourText(target), typed => { this.#draft.setColourText(target, typed); });\n hex.dataset['target'] = target;\n hex.placeholder = '#RRGGBB';\n hex.maxLength = 7;\n palette.append(firstChoice, swatches(formatCellsOffer.themeColours.flat()), swatches(formatCellsOffer.standardColours),\n this.#labelled(words.formatCellsLabel('moreColours'), hex));\n return palette;\n }\n\n // A colour chosen for a target: `undefined` is Automatic for the Font and the Border, and No Colour for the Fill.\n #choose(target: ColourTarget, colour: CellColour | undefined): void {\n this.#draft.setColour(target, colour);\n }\n\n // ---- Controls ----\n\n #el<K extends keyof HTMLElementTagNameMap>(tag: K, className: string, ...children: (Node | string)[]): HTMLElementTagNameMap[K] {\n const element = this.#doc.createElement(tag);\n if (className !== '') element.className = className;\n element.append(...children);\n return element;\n }\n\n #input(type: string): HTMLInputElement {\n const input = this.#doc.createElement('input');\n input.type = type;\n return input;\n }\n\n #button(className: string, text: string, press: () => void): HTMLButtonElement {\n const button = this.#el('button', className, text);\n button.type = 'button';\n button.addEventListener('click', press);\n return button;\n }\n\n #fieldset(className: string, legend: string, ...children: Node[]): HTMLFieldSetElement {\n return this.#el('fieldset', className, this.#el('legend', '', legend), ...children);\n }\n\n #choice(input: HTMLInputElement, ...label: (Node | string)[]): HTMLLabelElement {\n return this.#el('label', 'ex-format-cells-choice', input, ...label);\n }\n\n #labelled(label: string, control: HTMLElement): HTMLLabelElement {\n return this.#el('label', 'ex-format-cells-field', label, control);\n }\n\n // A radio button of a group, checked while `checked` holds.\n #radio(name: string, checked: () => boolean, choose: () => void): HTMLInputElement {\n const radio = this.#input('radio');\n radio.name = name;\n radio.addEventListener('change', () => {\n choose();\n this.#changed();\n });\n this.#syncs.push(() => { radio.checked = checked(); });\n return radio;\n }\n\n #checkbox(className: string, checked: () => boolean, set: (checked: boolean) => void): HTMLInputElement {\n const box = this.#input('checkbox');\n box.className = className;\n box.addEventListener('change', () => {\n set(box.checked);\n this.#changed();\n });\n this.#syncs.push(() => { box.checked = checked(); });\n return box;\n }\n\n // A field typed into: each keystroke is handed to the draft, and the field shows the draft's text only while the\n // user is not typing in it, so a choice never writes over what is being typed (ADR-0240 section 1).\n #field(type: 'text' | 'number', className: string, value: () => string, typed: (text: string) => void): HTMLInputElement {\n const field = this.#input(type);\n field.className = className;\n field.spellcheck = false;\n field.addEventListener('input', () => {\n typed(field.value);\n this.#changed();\n });\n this.#syncs.push(() => { if (this.#doc.activeElement !== field) field.value = value(); });\n // Left, it shows the draft's text again, unless the draft did not take what it holds: that stays as typed, so OK\n // refuses it rather than set what the field no longer shows.\n field.addEventListener('blur', () => { if (field.checkValidity()) field.value = value(); });\n return field;\n }\n}\n", "// What the Sheet tells its grid about the Formula being edited (ADR-0057), as the C# Sheet's SheetFormulaAids: the\n// References in the editor's text, and the Linked Table columns behind the keys the grid coloured.\n\nimport { EditorCompletion, EditorHint, type GridEditorReference, type GridEditorRewrite, type ReferenceKeyColour, type SelectionRange } from '@ex-grid/core';\nimport {\n CellAddress, CellRange, cycleReference, formulaHintAt, formulaPointAt, LinkedTableColumn, moveReference, referenceText, type ArgumentHint, type Sheet,\n} from '@ex-grid/sheet-engine';\nimport { defined } from './must';\nimport type { LinkedColumnColour } from './pointing-scope';\n\n/** Whether a Reference can go at the caret (ADR-0051): after `=`, an operator, `(` or `,` in a Formula. */\nexport function sheetPointAt(text: string, caret: number): boolean {\n return caret >= 0 && caret <= text.length && formulaPointAt(text, caret) !== undefined;\n}\n\n/**\n * Completion and the argument hint (ADR-0051, ADR-0058), as the C# Sheet's `SheetFormulaAids.Complete`: the declared\n * functions and `sheet`'s Linked Tables whose names begin with the name at the caret, a table's columns after `Table[`,\n * an argument's values where it takes one of a fixed list, and the hint for the function whose argument list holds the\n * caret. Nothing for text that is not a Formula.\n */\nexport function sheetCompletion(sheet: Sheet, text: string, caret: number): EditorCompletion | undefined {\n if (!text.startsWith('=') || caret < 0 || caret > text.length) return undefined;\n const completion = sheet.complete(text, caret);\n const hint = hintOf(formulaHintAt(text, caret));\n if (completion === undefined && hint === undefined) return undefined;\n const candidates = completion === undefined ? [] : completion.candidates.map(candidate => ({\n label: candidate.name, start: completion.start, length: completion.length, insert: candidate.insertText,\n }));\n return new EditorCompletion(hint === undefined ? { candidates } : { candidates, hint });\n}\n\n/**\n * The hint line for an argument hint: the function's signature, `SUM(number1, [number2], ...)`, with the name of the\n * argument the caret is in set off, none past the last argument the function takes.\n */\nexport function hintOf(hint: ArgumentHint | undefined): EditorHint | undefined {\n if (hint === undefined) return undefined;\n const { function: declared, currentArgument } = hint;\n const text = declared.signature;\n if (currentArgument === undefined) return new EditorHint({ text });\n // The signature is the name, \"(\", the arguments joined by \", \", and \")\": the argument's place in it is counted\n // over the names before it, never searched for as text, so a name that is a prefix of another is set off where it\n // stands.\n let at = declared.name.length + 1;\n for (const name of declared.arguments.split(', ')) {\n if (name === currentArgument) return new EditorHint({ text, emphasisStart: at, emphasisLength: name.length });\n at += name.length + 2;\n }\n return new EditorHint({ text });\n}\n\n/** The Reference Point mode writes for a pointed range (ADR-0051): `A3`, or `B7:C9` from its top-left. */\nexport function sheetReferenceText(range: SelectionRange): string {\n return referenceText(cellRangeOf(range));\n}\n\n/**\n * The Reference Point writes for a range pointed at on `shown` while the Formula is typed on `home` (ADR-0331 \u00A75): bare\n * on the Sheet it is typed on, and qualified with the Sheet's name on another, `Sheet2!A3`, quoted as a Reference\n * quotes a name.\n */\nexport function sheetReferenceTextOn(range: SelectionRange, shown: Sheet, home: Sheet | undefined): string {\n return home === undefined || home === shown ? sheetReferenceText(range) : referenceText(cellRangeOf(range), shown.name);\n}\n\n/**\n * A Reference Outline dragged by its edge or a corner square (ADR-0480): the Reference, as it stands in the Formula,\n * rewritten to name `range` on `sheet`, the Sheet shown, written as it was: each part's `$` kept, a Sheet qualifier\n * kept, and whole columns or rows still whole where they span every row or column of the Sheet's size (ADR-0460).\n */\nexport function sheetMoveReference(sheet: Sheet, reference: string, range: SelectionRange): string {\n return moveReference(reference, cellRangeOf(range), sheet.workbook.size);\n}\n\nfunction cellRangeOf(range: SelectionRange): CellRange {\n return new CellRange(new CellAddress(range.topRow, range.leftColumn),\n new CellAddress(range.topRow + range.rowCount - 1, range.leftColumn + range.columnCount - 1));\n}\n\n/**\n * F4 (ADR-0051, 2026-09-29): the Reference at the caret, the end of a range the caret touches, or every one the\n * selection covers, overlaps or touches, cycled to its next form by the engine, with the selection over what was\n * rewritten. Nothing where nothing changes: no Reference there, or text that is not a Formula.\n */\nexport function sheetCycleReference(text: string, selectionStart: number, selectionEnd: number): GridEditorRewrite | undefined {\n return cycleReference(text, selectionStart, selectionEnd);\n}\n\n/**\n * The References function (ADR-0057): each Reference in the text being edited, with its span and the cells it names\n * on `sheet`, for the grid to colour and outline. A structured reference names no cells here, so it carries the key\n * of its Linked Table's column instead. Nothing for text that is not a Formula.\n */\nexport function sheetReferences(sheet: Sheet, text: string, home?: Sheet): readonly GridEditorReference[] {\n // While a Formula typed on `home` is edited with `sheet` shown, a Reference names cells on the Sheet shown only where\n // it names a Sheet: one that names none is the home Sheet's (ADR-0331 \u00A75).\n const away = home !== undefined && home !== sheet;\n const found = sheet.references(text).filter(({ start, length, cells }) => !away || cells === undefined || text.slice(start, start + length).includes('!'));\n return found.map(({ start, length, cells, linkedColumn }) => (cells === undefined\n ? { start, length, key: linkedColumnKey(defined(linkedColumn, 'the Linked Table column a structured reference reads')) }\n : { start, length, range: { topRow: cells.first.row, leftColumn: cells.first.column, rowCount: cells.rowCount, columnCount: cells.columnCount } }));\n}\n\n/** The key a Linked Table's column is coloured under (ADR-0057): one per column, however the Formula cased its\n * names, folded as the engine finds tables and columns, ignoring case. */\nexport function linkedColumnKey(column: LinkedTableColumn): string {\n return column.key;\n}\n\n/**\n * The Linked Table columns behind the keys the grid told colours for (ADR-0057), in the grid's order, each under the\n * names the Consumer declared: the key is the Formula's casing, upper-cased, and the Consumer knows its table by the\n * names it gave. A key no declared column carries names nothing, and is left out.\n */\nexport function linkedColumnsOf(sheet: Sheet, keys: readonly ReferenceKeyColour[]): readonly LinkedColumnColour[] {\n if (keys.length === 0) return [];\n const declared = new Map<string, LinkedTableColumn>();\n for (const table of sheet.workbook.linkedTables) {\n for (const column of table.columns) {\n const named = new LinkedTableColumn(table.name, column);\n declared.set(linkedColumnKey(named), named);\n }\n }\n return keys.flatMap(({ key, colour }) => {\n const column = declared.get(key);\n return column === undefined ? [] : [Object.freeze({ column, colour })];\n });\n}\n\n/** Whether two tellings hold the same columns in the same colours at the same places, the names compared as\n * declared. */\nexport function sameLinkedColumns(a: readonly LinkedColumnColour[], b: readonly LinkedColumnColour[]): boolean {\n return a.length === b.length && a.every((told, i) => {\n const other = b[i];\n return other !== undefined && other.colour === told.colour && other.column.table === told.column.table && other.column.column === told.column.column;\n });\n}\n", "// A Pointing Scope (ADR-0058), the counterpart of C#'s PointingScope.cs: the Sheets and the grids a Consumer\n// groups so that a Formula edited in one of the Sheets can point at the grids' cells. What a press or an arrow\n// writes, and which it refuses, is decided here; the grid only names the shape a press landed on and answers a\n// step, and the Sheet only writes the text into its edit.\n//\n// The grid's side of this, GridPointedAt and the records it hands over, is @ex-grid/core's, as C#'s is ExGrid's\n// Cells; it is re-exported here for the Consumers that met it here first.\n\nimport { GridPointedAt } from '@ex-grid/core';\nimport type {\n GridDirection, GridOutlinedColumn, GridPointArrow, GridPointDashes, GridPointedPress, GridPointedPressKind, GridPointedStep,\n GridPointedStepKind, GridPointState, PointedAtGrid, ReferenceColour,\n} from '@ex-grid/core';\nimport { lookupFinds, lookupText, structuredReferenceText } from '@ex-grid/sheet-engine';\nimport type { LinkedTable, LinkedTableColumn, Value } from '@ex-grid/sheet-engine';\nimport { defined, elementAt } from './must';\nimport type { PointingRefusal, PointingRefusalReason } from './pointing-refusal';\nimport { sheetWords, type SheetWords } from './sheet-words';\n\nexport { GridPointedAt };\nexport type {\n GridPointArrow, GridPointDashes, GridPointedPress, GridPointedPressKind, GridPointedStep, GridPointedStepKind, PointedAtGrid, ReferenceColour,\n};\n\n/**\n * Where an open edit stands with respect to Point (ADR-0051, ADR-0058): `none`, no Reference can go at the\n * caret; `inPoint`, one can; `writtenFromOutside`, what stands at the caret was written by a press outside the\n * grid.\n */\nexport type PointState = GridPointState;\n\n/** A grid column outlined in a Reference colour while a Formula reads it (ADR-0057): the grid's own\n * `outlinedColumns` entry. */\nexport type OutlinedColumn = GridOutlinedColumn;\n\n/** A Linked Table column a Formula edited in a Sheet reads, and the colour its References wear (ADR-0057). */\nexport interface LinkedColumnColour {\n /** The table and column. */\n readonly column: LinkedTableColumn;\n /** The colour. */\n readonly colour: ReferenceColour;\n}\n\n/** What a Pointing Scope asks of a Sheet in it (ADR-0058): its own declarations, to read a table's columns and\n * key from, and its edit, to write into. */\nexport interface PointingSheet {\n /** The Linked Tables the Sheet declares, keys included. */\n readonly linkedTables: readonly LinkedTable[];\n /** The id of the root of the Sheet's grid; `undefined` before it is rendered. */\n readonly rootId: string | undefined;\n /** Writes text into the Sheet's open edit where Point writes; false when it is no longer in Point. */\n writePointedText(text: string): Promise<boolean>;\n /** Takes back what the last write put there, while it stands. */\n takeBackPointedText(): Promise<boolean>;\n /** Tells the Sheet's Consumer why a press wrote nothing. */\n tellPointingRefused(refusal: PointingRefusal): Promise<void>;\n}\n\n/** A row of a registered grid read as the table's row: one Value per declared column, `undefined` for a blank. */\nexport type TableRow = readonly (Value | undefined)[];\n\n/** Where a press's dashes stand in its grid, read as the table's rows. */\ninterface PointDashes {\n readonly column: string;\n readonly isRow: ((row: TableRow) => boolean) | undefined;\n}\n\ninterface Dashed {\n readonly grid: GridMember;\n readonly sheet: PointingSheet;\n readonly where: PointDashes;\n}\n\ninterface Step {\n readonly kind: GridPointedStepKind;\n readonly row: (() => TableRow) | undefined;\n readonly column: string | undefined;\n}\n\n/** A grid registered in the Scope, whatever its row type. */\ninterface GridMember {\n readonly table: string;\n tableColumnOf(gridColumn: string): string;\n outline(told: readonly (readonly [PointingSheet, readonly LinkedColumnColour[]])[]): void;\n declarePointedAt(pointing: PointingSheet | undefined): void;\n showDashes(dashes: PointDashes | undefined): void;\n step(from: PointDashes, direction: GridDirection, isColumn: (column: string) => boolean): Promise<Step>;\n stepFromColumn(column: string, direction: GridDirection, isColumn: (column: string) => boolean): Promise<Step>;\n reveal(dashes: PointDashes): Promise<void>;\n}\n\n/**\n * A Pointing Scope (ADR-0058): the Sheets and the grids a Consumer groups so that a Formula edited in one of the\n * Sheets can point at the grids' cells. Pointing at a grid of the Scope writes what reads the pressed cell by its\n * row's key, `XLOOKUP(\"R-4471\", Positions[Id], Positions[PV])`, or the pressed column's structured reference,\n * `Positions[PV]` \u2014 never a position, so the Formula reads the same row after the grid is sorted (ADR-0049,\n * rule 2).\n *\n * The Consumer makes one per group and registers each grid that shows a Linked Table with\n * {@link PointingScope.registerGrid}. A Sheet of the Scope joins it, says whether it points, tells the columns\n * its Formula reads and where its edit stands with respect to Point, and hands over its arrow keys; the Scope\n * writes into the Sheet that points, or tells it why a press wrote nothing. Only the Sheet that holds the\n * keyboard points, and a Sheet is never pointed at.\n */\nexport class PointingScope {\n readonly #words: SheetWords;\n readonly #sheets: PointingSheet[] = [];\n readonly #grids: GridMember[] = [];\n #pointing: PointingSheet | undefined;\n #pointedLast: PointingSheet | undefined;\n // The grid whose press wrote what the pointing Sheet's Point holds: a drag from that press takes it back.\n #wrote: GridMember | undefined;\n // What each Sheet last told of the Linked Table columns its Formula reads, the latest last.\n readonly #linkedColumns: (readonly [PointingSheet, readonly LinkedColumnColour[]])[] = [];\n #dashed: Dashed | undefined;\n #dashedBeforeWrite: Dashed | undefined;\n\n /** A Scope whose refusals are worded by `words`: ExSheet's English unless a Consumer's words are given. */\n constructor(words: SheetWords = sheetWords()) {\n this.#words = words;\n }\n\n /**\n * Registers a grid that shows a Linked Table, and gives back the declaration to pass it (ADR-0058).\n *\n * @param table - The Linked Table's name, as the Sheets declare it; matched without regard to case.\n * @param tableRow - A grid row as the table's row: one Value per declared column, in the declared order, a\n * blank as `undefined`. Asked for a pressed cell's row and, while that cell is dashed, for the rows the grid\n * paints: it must be cheap and must not throw.\n * @param tableColumns - Which table column each grid column is, by the grid column's name, for the grid\n * columns named otherwise than their table column. A grid column with no entry is the table column of its\n * own name, if the table has one.\n * @throws RangeError when the table's name is empty, or an entry of `tableColumns` names no column.\n */\n registerGrid<TRow>(table: string, tableRow: (row: TRow) => TableRow, tableColumns?: Readonly<Record<string, string>>): GridPointedAt<TRow> {\n if (table.length === 0) throw new RangeError('A registered grid names the Linked Table it shows (ADR-0058).');\n const columns = new Map<string, string>();\n for (const [gridColumn, tableColumn] of Object.entries(tableColumns === undefined ? {} : tableColumns)) {\n if (gridColumn.length === 0 || tableColumn.length === 0)\n throw new RangeError('A grid column and the table column it is are both named (ADR-0058).');\n columns.set(gridColumn, tableColumn);\n }\n const [grid, declaration] = gridMember(table, tableRow, columns, async (...press) => this.#press(...press));\n this.#grids.push(grid);\n grid.declarePointedAt(this.#pointing);\n grid.outline(this.#linkedColumns);\n return declaration;\n }\n\n /** A Sheet given this Scope joins it. */\n join(sheet: PointingSheet): void {\n if (!this.#sheets.includes(sheet)) this.#sheets.push(sheet);\n }\n\n /** A Sheet no longer given this Scope, or disposed, leaves it; if it pointed, no grid is pointed at. */\n leave(sheet: PointingSheet): void {\n this.points(sheet, false);\n const at = this.#sheets.indexOf(sheet);\n if (at >= 0) this.#sheets.splice(at, 1);\n if (this.#pointedLast === sheet) this.#pointedLast = undefined;\n this.pointStateChanged(sheet, 'none');\n this.outlineLinkedColumns(sheet, []);\n }\n\n /** A Sheet of the Scope says whether it points: it holds the keyboard, has an edit open, and is in Point. A\n * Sheet that stops pointing after another started changes nothing. */\n points(sheet: PointingSheet, points: boolean): void {\n if (points) {\n if (!this.#sheets.includes(sheet)) return;\n if (this.#pointing !== sheet) this.#wrote = undefined;\n this.#pointing = sheet;\n this.#pointedLast = sheet;\n this.#declarePointedAt();\n } else if (this.#pointing === sheet) {\n this.#pointing = undefined;\n this.#wrote = undefined;\n this.#declarePointedAt();\n }\n }\n\n /** A Sheet of the Scope tells the Linked Table columns the Formula it edits reads, and their colours, or none\n * once the edit ends (ADR-0057); each registered grid outlines those of its table, whether or not the Sheet\n * points. */\n outlineLinkedColumns(sheet: PointingSheet, columns: readonly LinkedColumnColour[]): void {\n const told = this.#linkedColumns.findIndex(([teller]) => teller === sheet);\n if (told >= 0) this.#linkedColumns.splice(told, 1);\n if (columns.length > 0 && this.#sheets.includes(sheet)) this.#linkedColumns.push([sheet, columns]);\n else if (told < 0) return;\n for (const grid of this.#grids) grid.outline(this.#linkedColumns);\n }\n\n /** A Sheet of the Scope tells where its edit stands with respect to Point. Anything but `writtenFromOutside`\n * means Point over what a press wrote has ended, and its dashes go (ADR-0058, \"What is drawn\"). */\n pointStateChanged(sheet: PointingSheet, state: PointState): void {\n if (state === 'writtenFromOutside') return;\n if (this.#dashedBeforeWrite?.sheet === sheet) this.#dashedBeforeWrite = undefined;\n if (this.#dashed?.sheet === sheet) this.#dash(undefined);\n }\n\n /**\n * An arrow key in a Sheet of the Scope while what a press on a registered grid wrote stands in its edit\n * (ADR-0058, \"The keyboard\"): the cell or the column that press wrote for moves one step inside that grid,\n * and the text is rewritten for what it reached. At an edge nothing moves; a row that has not arrived, Shift\n * and an arrow, and the Primary Modifier and an arrow write nothing, and the reason is told.\n */\n async pointArrow(sheet: PointingSheet, arrow: GridPointArrow): Promise<void> {\n const dashed = this.#dashed;\n if (this.#pointing !== sheet || dashed === undefined || dashed.sheet !== sheet) return;\n const grid = dashed.grid;\n if (arrow.toEdge === true) {\n await sheet.tellPointingRefused(this.#refusal('dataEdge', grid.table, undefined, false));\n return;\n }\n if (arrow.extends === true) {\n await sheet.tellPointingRefused({ reason: 'severalCells', message: this.#words.pointingExtendedByKey(grid.table) });\n return;\n }\n const table = findTable(sheet, grid.table);\n if (table === undefined) {\n await this.#refuse(sheet, 'tableNotDeclared', grid.table, undefined, false);\n return;\n }\n const isTableColumn = (gridColumn: string): boolean => findColumn(table, grid.tableColumnOf(gridColumn)) !== undefined;\n const fromColumn = dashed.where.isRow === undefined;\n const step = fromColumn\n ? await grid.stepFromColumn(dashed.where.column, arrow.direction, isTableColumn)\n : await grid.step(dashed.where, arrow.direction, isTableColumn);\n switch (step.kind) {\n case 'edge':\n return;\n case 'rowNotArrived':\n await this.#refuse(sheet, 'rowNotArrived', table.name, undefined, false);\n return;\n case 'notHeld': {\n // From a column, the column is named: it is what the grid no longer shows.\n const notShown = fromColumn ? orOwn(findColumn(table, grid.tableColumnOf(dashed.where.column)), dashed.where.column) : undefined;\n await this.#refuse(sheet, 'cellNotHeld', table.name, notShown, false);\n return;\n }\n case 'cell':\n case 'column':\n break;\n }\n const column = defined(step.column, 'the grid column a step reached');\n const tableColumn = findColumn(table, grid.tableColumnOf(column));\n if (tableColumn === undefined) {\n await this.#refuse(sheet, 'columnNotInTable', table.name, column, false);\n return;\n }\n const written = step.kind === 'column' ? columnReference(table, tableColumn, column) : cellLookup(table, tableColumn, column, step.row);\n if (written.kind === 'refused') {\n await this.#refuse(sheet, written.reason, table.name, tableColumn, false);\n return;\n }\n if (!(await sheet.writePointedText(written.text))) {\n await this.#refuse(sheet, 'notPointing', table.name, tableColumn, false);\n return;\n }\n // A gesture of its own: a drag from the press that began this no longer takes anything back.\n this.#wrote = undefined;\n this.#dashedBeforeWrite = undefined;\n this.#dash({ grid, sheet, where: written.dashes });\n await grid.reveal(written.dashes);\n }\n\n /** A press a registered grid handed over: written into the pointing Sheet's edit, or refused with the\n * reason; a drag takes back what its press wrote. */\n async #press(grid: GridMember, kind: GridPointedPressKind, row: (() => TableRow) | undefined, column: string | undefined, dragged: boolean): Promise<void> {\n // The drag shows the user meant a range, so the text goes back to what it was before the press. Any other\n // press is a gesture of its own, and forgets which press wrote last.\n const writer = this.#pointing;\n const tookBack = dragged && this.#wrote === grid && writer !== undefined && await writer.takeBackPointedText();\n this.#wrote = undefined;\n if (tookBack) this.#dash(this.#dashedBeforeWrite);\n this.#dashedBeforeWrite = undefined;\n const sheet = this.#pointing;\n if (sheet === undefined) {\n // Handed over by a grid still painted pointed at, after the Sheet stopped pointing.\n const last = this.#pointedLast;\n if (last !== undefined) await last.tellPointingRefused(this.#refusal('notPointing', grid.table, undefined, false));\n return;\n }\n switch (kind) {\n case 'severalCells':\n await this.#refuse(sheet, 'severalCells', grid.table, undefined, tookBack);\n return;\n case 'severalColumns':\n await this.#refuse(sheet, 'severalColumns', grid.table, undefined, tookBack);\n return;\n case 'headerGroup':\n await this.#refuse(sheet, 'headerGroup', grid.table, undefined, false);\n return;\n case 'cell':\n case 'columnHeader':\n break;\n }\n const table = findTable(sheet, grid.table);\n if (table === undefined) {\n await this.#refuse(sheet, 'tableNotDeclared', grid.table, undefined, false);\n return;\n }\n const pressed = defined(column, 'the grid column a press on a cell or a column header names');\n const tableColumn = findColumn(table, grid.tableColumnOf(pressed));\n if (tableColumn === undefined) {\n await this.#refuse(sheet, 'columnNotInTable', table.name, pressed, false);\n return;\n }\n const written = kind === 'columnHeader' ? columnReference(table, tableColumn, pressed) : cellLookup(table, tableColumn, pressed, row);\n if (written.kind === 'refused') {\n await this.#refuse(sheet, written.reason, table.name, tableColumn, false);\n return;\n }\n const dashedBefore = this.#dashed;\n if (!(await sheet.writePointedText(written.text))) {\n // The Sheet's edit left Point while the press was on its way.\n await this.#refuse(sheet, 'notPointing', table.name, tableColumn, false);\n return;\n }\n this.#wrote = grid;\n this.#dashedBeforeWrite = dashedBefore?.sheet === sheet ? dashedBefore : undefined;\n this.#dash({ grid, sheet, where: written.dashes });\n }\n\n #declarePointedAt(): void {\n for (const grid of this.#grids) grid.declarePointedAt(this.#pointing);\n }\n\n #dash(dashed: Dashed | undefined): void {\n const shown = this.#dashed;\n if (shown !== undefined && shown.grid !== dashed?.grid) shown.grid.showDashes(undefined);\n this.#dashed = dashed;\n if (dashed !== undefined) dashed.grid.showDashes(dashed.where);\n }\n\n async #refuse(sheet: PointingSheet, reason: PointingRefusalReason, table: string, column: string | undefined, tookBack: boolean): Promise<void> {\n await sheet.tellPointingRefused(this.#refusal(reason, table, column, tookBack));\n }\n\n #refusal(reason: PointingRefusalReason, table: string, column: string | undefined, tookBack: boolean): PointingRefusal {\n return { reason, message: this.#words.pointingRefused(reason, table, column, tookBack) };\n }\n}\n\ntype Written =\n | { readonly kind: 'written'; readonly text: string; readonly dashes: PointDashes }\n | { readonly kind: 'refused'; readonly reason: PointingRefusalReason };\n\n/** What a column writes, `T[<column>]`, and the dashes down its body. */\nfunction columnReference(table: LinkedTable, tableColumn: string, gridColumn: string): Written {\n return { kind: 'written', text: structuredReferenceText(table.name, tableColumn), dashes: { column: gridColumn, isRow: undefined } };\n}\n\n/**\n * What a cell writes, `XLOOKUP(<key>, T[<key column>], T[<column>])`, or for a key of several columns\n * `XLOOKUP(1, (T[K1]=v1)*(T[K2]=v2), T[<column>])` (ADR-0058, amended 2026-10-03), and the dashes that find it by\n * its row's key; or the reason nothing is written.\n */\nfunction cellLookup(table: LinkedTable, tableColumn: string, gridColumn: string, row: (() => TableRow) | undefined): Written {\n if (row === undefined) return { kind: 'refused', reason: 'rowNotArrived' };\n const keyColumns = table.keyColumns;\n if (keyColumns.length === 0) return { kind: 'refused', reason: 'noKey' };\n const values = row();\n if (values.length !== table.columns.length) {\n throw new RangeError(\n `The row a grid registered for '${table.name}' gave has ${values.length} Values, and the table declares ${table.columns.length} columns: `\n + \"registerGrid's tableRow gives one Value per declared column, in the declared order, as a push does (ADR-0058).\");\n }\n const keyIndexes = keyColumns.map(key => indexOf(table, key));\n const keys: Value[] = [];\n for (const index of keyIndexes) {\n const key = values[index];\n if (key === undefined) return { kind: 'refused', reason: 'blankKey' };\n if (key.isError) return { kind: 'refused', reason: 'keyIsAnError' };\n keys.push(key);\n }\n const width = table.columns.length;\n return {\n kind: 'written',\n text: lookupText(table.name, keyColumns, keys, tableColumn),\n dashes: {\n column: gridColumn,\n isRow: candidate => candidate.length === width && lookupFinds(keys, keyIndexes.map(index => candidate[index])),\n },\n };\n}\n\n/** The pointing Sheet's declaration of the table, found as a Formula finds a table: without regard to case. */\nfunction findTable(sheet: PointingSheet, name: string): LinkedTable | undefined {\n return sheet.linkedTables.find(table => sameName(table.name, name));\n}\n\n/** The table's column of that name, as declared, found without regard to case. */\nfunction findColumn(table: LinkedTable, name: string): string | undefined {\n return table.columns.find(column => sameName(column, name));\n}\n\nfunction indexOf(table: LinkedTable, column: string): number {\n const at = table.columns.findIndex(declared => sameName(declared, column));\n if (at < 0) throw new RangeError(`The key '${column}' is not one of the columns of '${table.name}'.`);\n return at;\n}\n\nfunction sameName(a: string, b: string): boolean {\n return a.toUpperCase() === b.toUpperCase();\n}\n\nfunction orOwn(found: string | undefined, own: string): string {\n return found === undefined ? own : found;\n}\n\n/** Hands a press over to the Scope. */\ntype HandOver = (grid: GridMember, kind: GridPointedPressKind, row: (() => TableRow) | undefined, column: string | undefined, dragged: boolean) => Promise<void>;\n\n/** A registered grid of rows of `TRow`, and the declaration that hands each press to the Scope. */\nfunction gridMember<TRow>(\n table: string, tableRow: (row: TRow) => TableRow, tableColumns: ReadonlyMap<string, string>, handOver: HandOver,\n): readonly [GridMember, GridPointedAt<TRow>] {\n const tableColumnOf = (gridColumn: string): string => orOwn(tableColumns.get(gridColumn), gridColumn);\n // The grid columns that are a table column: each given it as its entry, and the one of its own name unless\n // that one is given another.\n const gridColumnsOf = (tableColumn: string): string[] => {\n const found = [...tableColumns].filter(([, entry]) => sameName(entry, tableColumn)).map(([gridColumn]) => gridColumn);\n if (!tableColumns.has(tableColumn)) found.push(tableColumn);\n return found;\n };\n const asTableRow = (isRow: (row: TableRow) => boolean) => (row: TRow): boolean => isRow(tableRow(row));\n const read = (step: GridPointedStep<TRow>): Step => {\n const reached = step.row;\n return { kind: step.kind, row: reached === undefined ? undefined : () => tableRow(reached), column: step.column };\n };\n const declaration = new GridPointedAt<TRow>(async press => {\n const pressed = press.row;\n await handOver(member, press.kind, pressed === undefined ? undefined : () => tableRow(pressed), press.column, press.dragged === true);\n });\n const member: GridMember = {\n table,\n tableColumnOf,\n outline(told) {\n const outlined: OutlinedColumn[] = [];\n for (const [, columns] of told) {\n for (const { column, colour } of columns) {\n if (!sameName(column.table, table)) continue;\n for (const gridColumn of gridColumnsOf(column.column)) outlined.push({ column: gridColumn, colour });\n }\n }\n const current = declaration.outlinedColumns;\n const same = outlined.length === 0\n ? current === undefined\n : current !== undefined && current.length === outlined.length\n && current.every((one, i) => one.column === elementAt(outlined, i).column && one.colour === elementAt(outlined, i).colour);\n if (!same) declaration.outlinedColumns = outlined.length === 0 ? undefined : outlined;\n },\n declarePointedAt(pointing) {\n // The Sheet's root is named first, so the render that paints the grid pointed at names it too.\n if (pointing !== undefined) declaration.pointingRootId = pointing.rootId;\n declaration.isPointedAt = pointing !== undefined;\n },\n showDashes(dashes) {\n const isRow = dashes?.isRow;\n declaration.dashes = dashes === undefined\n ? undefined\n : { row: isRow === undefined ? undefined : asTableRow(isRow), column: dashes.column };\n },\n async step(from, direction, isColumn) {\n const isRow = defined(from.isRow, 'the row of the dashed cell a step starts from');\n return read(await declaration.step(asTableRow(isRow), from.column, direction, isColumn));\n },\n async stepFromColumn(column, direction, isColumn) {\n return read(await declaration.stepFromColumn(column, direction, isColumn));\n },\n async reveal(dashes) {\n const isRow = dashes.isRow;\n await (isRow === undefined ? declaration.revealColumn(dashes.column) : declaration.reveal(asTableRow(isRow), dashes.column));\n },\n };\n return [member, declaration];\n}\n", "// The keys of a Toolbar Item's list drawn by a Chrome (ADR-0100, ADR-0390), the built-in list's: the arrows, Home and\n// End move among the choices that can be made, swatches ten across, and the list opens on the choice the Focus cell has.\n// Every Wrapper's list moves alike: React's hook and the Blazor adapter's wiring read them from here.\n\nimport type { SheetToolbarItemChoice } from './sheet-toolbar-slot';\n\n/** Swatches to a row, as Excel's palette lays them out and as the built-in list moves among them. */\nexport const toolbarSwatchesAcross = 10;\n\n/** The index the list's `key` moves the keyboard to from the choice at `at` (-1 for none), or `undefined` where it\n * stays. */\nexport function toolbarChoiceMovedTo(key: string, at: number, choices: readonly SheetToolbarItemChoice[]): number | undefined {\n const can = (index: number): boolean => choices[index] !== undefined && choices[index].disabledReason === undefined;\n const enabled = choices.map((_, index) => index).filter(can);\n const first = enabled[0];\n const last = enabled.at(-1);\n if (first === undefined || last === undefined) return undefined;\n const swatch = choices[at]?.swatch !== undefined;\n const step = (by: number): number | undefined => {\n for (let next = at + by; next >= 0 && next < choices.length; next += by) if (can(next)) return next;\n return undefined;\n };\n switch (key) {\n case 'Home': return first;\n case 'End': return last;\n case 'ArrowDown': return step(swatch ? toolbarSwatchesAcross : 1) ?? step(1);\n case 'ArrowUp': return step(swatch ? -toolbarSwatchesAcross : -1) ?? step(-1);\n case 'ArrowRight': return swatch ? step(1) : undefined;\n case 'ArrowLeft': return swatch ? step(-1) : undefined;\n default: return undefined;\n }\n}\n\n/** The choice the list's keyboard starts on: the one the Focus cell has, else the first that can be made. */\nexport function toolbarChoiceStart(choices: readonly SheetToolbarItemChoice[]): number | undefined {\n const selected = choices.findIndex(choice => choice.selected && choice.disabledReason === undefined);\n if (selected >= 0) return selected;\n const first = choices.findIndex(choice => choice.disabledReason === undefined);\n return first >= 0 ? first : undefined;\n}\n\n/** One row of a list, in the Sheet's order: the index of a choice drawn on a row of its own, or the indices of the\n * swatches drawn together, ten across, as the list's keys move among them. */\nexport type ToolbarChoiceRow = number | readonly number[];\n\n/** The list's rows: a run of swatches is cut ten across, and every other choice stands on a row of its own. */\nexport function toolbarChoiceRows(choices: readonly SheetToolbarItemChoice[]): readonly ToolbarChoiceRow[] {\n const rows: ToolbarChoiceRow[] = [];\n let swatches: number[] = [];\n choices.forEach((choice, index) => {\n if (choice.swatch !== undefined) {\n swatches.push(index);\n if (swatches.length === toolbarSwatchesAcross) {\n rows.push(swatches);\n swatches = [];\n }\n return;\n }\n if (swatches.length > 0) rows.push(swatches);\n swatches = [];\n rows.push(index);\n });\n if (swatches.length > 0) rows.push(swatches);\n return rows;\n}\n"],
5
+ "mappings": ";AASA;AAAA,EACI;AAAA,EAAY;AAAA,EAAkB;AAAA,EAAiB;AAAA,EAAgD;AAAA,EAAqB;AAAA,EAAc;AAAA,EAAoB;AAAA,EAEmE;AAAA,EAG9K;AAAA,EAAqB;AAAA,OAC7D;AACP;AAAA,EACI,gBAAAA;AAAA,EAAc,cAAAC;AAAA,EAAY,eAAAC;AAAA,EAAa,YAAAC;AAAA,EAAU,oBAAAC;AAAA,EAAkB,aAAAC;AAAA,EAAW;AAAA,EAAS,SAAAC;AAAA,EAAO,gBAAAC;AAAA,EAAc,sBAAAC;AAAA,EAAoB;AAAA,EAAkB,aAAAC;AAAA,EAAW;AAAA,EAAmB,aAAAC;AAAA,EAAW;AAAA,EAAO;AAAA,EAClM,SAAAC;AAAA,EAAO;AAAA,EAAc;AAAA,EAAkB,iBAAAC;AAAA,OACpC;;;ACfA,SAAS,UAAwE,MAAoB,OAA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heet", "referenceText", "part", "mark", "CellAddress", "segment", "CellAddress", "CellAddress", "Sheet", "CellAddress", "Entry", "align", "CellAddress", "digits", "Entry", "fill", "Sheet", "CellAddress", "CellAddress", "CellRange", "distinct", "CellRange", "CellAddress", "step", "CellAddress", "Sheet", "columnCount", "Sheet", "CellAddress", "field", "within", "CellAddress", "step", "CellAddress", "CellRange", "CellAddress", "CellAddress", "step", "at", "SheetSize", "SheetSize", "swatch", "step", "element", "swatch", "row", "swatch", "step", "NumberFormat", "byKey", "NumberFormat", "SheetEdit", "BorderChange", "BorderLine", "CellAddress", "CellFormatChange", "CellRange", "NumberFormat", "CellRange", "CellAddress", "BorderLine", "NumberFormat", "fill", "digits", "CellFormatChange", "BorderChange", "instances", "code", "swatch", "CellAddress", "CellRange", "caret", "CellRange", "CellAddress", "keys", "step", "indexOf", "keys", "SheetEdit", "CellAddress", "document", "CellRange", "FormulaSyntaxError", "Entry", "step", "caret", "keys", "holds", "key", "swatch", "fill", "commands", "CellFormatChange", "CellFill", "NumberFormat", "tab", "referenceText", "Sheet", "BorderLine", "BorderChange", "SheetSize", "swatch", "step"]
7
+ }