@doenet/v06-to-v07 0.7.26-dev.565 → 0.7.26-dev.568
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{index-O78gHXM_.js → index-BGA86VGv.js} +1421 -350
- package/{index-O78gHXM_.js.map → index-BGA86VGv.js.map} +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/{sha256-DT5xJ2Hv-BafLAx3M-CN2yxnoD.js → sha256-8sXzDnE0-D8G4fjq_-DaSft1CG.js} +2 -2
- package/{sha256-DT5xJ2Hv-BafLAx3M-CN2yxnoD.js.map → sha256-8sXzDnE0-D8G4fjq_-DaSft1CG.js.map} +1 -1
|
@@ -38632,7 +38632,7 @@ class Indent {
|
|
|
38632
38632
|
}
|
|
38633
38633
|
const chrome$1 = "# Viewer chrome: buttons, panel headers, and other UI the reader interacts\n# with. Rendered on the main thread and selected by `uiLocale`.\n#\n# Message ids are lower-kebab-case Fluent identifiers, optionally with a\n# single `.attribute` suffix (`submit-button`, `answer-status.correct`).\n#\n# This catalog is the source of truth for every other locale: `lint:i18n`\n# rejects a translation that defines a key missing here. Run\n# `npm run codegen -w @doenet/i18n` after editing.\n\n\n## Answer submission — the check-work button and the status it reports.\n\nanswer-checking = Checking...\nanswer-submitting = Submitting...\n\n# Announced to a screen reader while the submission is in flight. Separate\n# from the button's own text, which is abbreviated.\nanswer-checking-status = Checking answer\nanswer-submitting-status = Submitting answer\n\nanswer-correct = Correct\nanswer-incorrect = Incorrect\n\n# Shown instead of a correctness verdict when the activity withholds\n# correctness: the response was recorded, nothing is claimed about it.\nanswer-response-saved = Response Saved\n\n# Partial credit. `-credit` is used when repeated attempts reduce the credit\n# available, `-correct` when they do not, and `-short` on a button too narrow\n# for a word.\nanswer-percent-credit = { $percent }% Credit\nanswer-percent-correct = { $percent }% Correct\nanswer-percent-short = { $percent } %\n\nmax-credit-available = Max credit available: { $percent }%\n\n# Fluent formats `{ $count }` with `Intl.NumberFormat`, so a four-digit\n# attempt count renders as \"1,000\" where the hand-built string said \"1000\".\n# That is the one place English output is not byte-identical to what this\n# replaced, and grouping is the locale-correct rendering, so it stands.\nattempts-remaining =\n { $count ->\n [0] no attempts remaining\n [one] { $count } attempt remaining\n *[other] { $count } attempts remaining\n }\n\n# Appended to an input's accessible name once its response has been graded,\n# so a screen reader reports the verdict along with the field.\nvalidation-correct = (Correct)\nvalidation-incorrect = (Incorrect)\nvalidation-partially-correct = (Partially correct)\n\n# Tooltip on the badge that reports how many responses have been submitted to\n# one answer, shown only to a host that asked for it. `$answerId` is the\n# answer's authored name and is never translated.\nanswer-show-responses =\n { $count ->\n [one] Show { $count } response to { $answerId }\n *[other] Show { $count } responses to { $answerId }\n }\n\n\n## Disclosure panels\n\nfeedback-heading = Feedback\n\n# Follows a disclosure panel's own heading — \"Solution (click to open)\" — and\n# is shared by `<solution>`, `<hint>`, and a collapsible `<section>`. The whole\n# parenthetical is one message: where the word for open or close falls inside\n# it is the translator's business.\ncollapsible-click-to-open = (click to open)\ncollapsible-click-to-close = (click to close)\n\n# Placeholder inside a panel that has been opened before its contents have\n# arrived from the core. Shared by `<solution>` and a collapsible `<section>`.\ncollapsible-initializing = Initializing...\n\n# Tooltip on a footnote marker, naming what activating it will do.\nfootnote-show = Show footnote\nfootnote-hide = Hide footnote\n\n# Tooltip on the ⓘ affordance that reveals an input's description.\ndescription-more-information = more information\n\n\n## Controls\n\nslider-previous = Prev\nslider-next = Next\n\nkeyboard-open = Open Keyboard\nkeyboard-close = Close Keyboard\n\n# Accessible name of the button that drops one selected choice from an inline\n# `<choiceInput selectMultiple>`. The button itself is drawn as a bare cross,\n# so `$choice` — the choice's own text, which is never translated — is the\n# only thing that says which chip it belongs to.\nchoice-input-remove-choice = Remove { $choice }\n\n# Accessible names of a matrix input's size controls, whose visible labels are\n# the symbols `r-` `r+` `c-` `c+`.\nmatrix-remove-row = Remove row\nmatrix-add-row = Add row\nmatrix-remove-column = Remove column\nmatrix-add-column = Add column\n\n# Modes and actions of the subset-of-reals input's control strip. The button\n# that selects all of the reals is the symbol `R`, not a word, and stays in\n# place.\nsubset-add-remove-points = Add/Remove points\nsubset-toggle-points-intervals = Toggle points and intervals\nsubset-move-points = Move Points\nsubset-clear = Clear\n\n# Buttons that edit an orbital diagram: rows hold boxes, boxes hold up to\n# three spin arrows.\norbital-add-row = Add Row\norbital-remove-row = Remove Row\norbital-add-box = Add Box\norbital-remove-box = Remove Box\norbital-add-up-arrow = Add Up Arrow\norbital-add-down-arrow = Add Down Arrow\norbital-remove-arrow = Remove Arrow\n\n# Accessible name of the text field naming one row of an orbital diagram,\n# counting from 1.\norbital-row-label = Label for row { $row }\n\n# Labels the answer column of a pretzel exercise's grid.\npretzel-answer = Answer\n\n# Caption above the table a `<summaryStatistics>` renders. It used to name the\n# data column being summarized; the statistics now come from values written in\n# the document, so there is no column to name and the message takes no\n# placeable. The table's own headings (`mean`, `stdev`, `quartile1`, …) are the\n# statistic ids an author references, not prose, and stay in place.\n#\n# Every translation of the old message named the column inside the sentence —\n# «Resumen estadístico de { $column }» — so none of them survives the placeable\n# being dropped, and the key was removed from the other catalogs rather than\n# truncated to whatever precedes the connector. Those locales fall back to\n# English here until the caption is translated again.\nsummary-statistics-caption = Summary statistics\n\n\n## Math input\n\n# Accessible name of the popover that previews the typed expression, and of\n# the rendered expression inside it.\nmath-input-preview-region = math expression preview\nmath-input-preview = Preview\nmath-input-invalid-expression = Invalid expression:\n\n\n## Document status\n\n# Shown while the core is still starting up and nothing can be rendered yet.\nviewer-initializing = Initializing...\n\n\n## Errors\n\n# Prefixes an error message wherever one is shown in place of content: an\n# `<error>` the core reported, the error boundary's fallback, and the\n# placeholder left where a renderer chunk failed to load.\nerror-heading = Error\n\n# Follows the error's own message inside that box, saying where in the source\n# the error was found. $span selects the sentence — one line or a range of\n# them — as a key rather than a phrase, so a translation is free to reorder the\n# whole of it. $startLine and $endLine are line numbers, and arrive as text\n# rather than as numbers so that line 1234 is not grouped as \"1,234\": a line\n# number is an identifier, not a quantity.\nerror-found-at =\n { $span ->\n [line] Found on line { $startLine }.\n *[lines] Found on lines { $startLine }–{ $endLine }.\n }\n\n# Banner above a document that compiled with at least one error in it.\ndocument-contains-errors = This document contains errors!\n\n# Headings of the tooltip the editor shows over a squiggle, naming what kind\n# of diagnostic it is. `-information` and `-hint` are styled identically but\n# are two different words; `-hint` is unreachable today, since nothing Doenet\n# raises is an LSP hint, and is here so the set is complete.\ndiagnostic-heading-error = Error\ndiagnostic-heading-warning = Warning\ndiagnostic-heading-information = Info\ndiagnostic-heading-hint = Hint\n\n# Headings of the same tooltip over an accessibility diagnostic, which says\n# what kind of problem it is rather than how severe. Level 1 is a failure\n# against the WCAG AA success criteria; level 2 is Doenet's own advice, which\n# no standard requires.\naccessibility-heading-level-1 = WCAG AA Accessibility Violation\naccessibility-heading-level-2 = Accessibility alert\n\n# Shown in place of the document when a renderer threw and the error boundary\n# caught it.\nsomething-went-wrong = Something went wrong.\n\n# Shown in place of a single renderer whose code chunk never arrived.\nrenderer-load-failed = a renderer failed to load. Please reload the page.\n\n# Shown in place of the document when the core worker could not be started\n# after retries, rather than leaving the pane blank.\ncore-start-failed = This document could not be started. Please reload the page.\n\n# Replaces `core-start-failed` when several documents were starting at the\n# same time — counted across every same-origin tab, so not necessarily all on\n# the page the reader sees. Naming the contention keeps the reader from\n# concluding the service is broken.\ncore-start-failed-busy = This document could not be started. Several documents were starting at once, which can take longer on a slower device. Reloading the page may help once the other documents have finished.\n\n# Shown for a core-start failure the reader can still retry, next to the\n# button that does it (`core-start-retry`). It leaves out the advice to\n# reload that the messages above carry: the button is the cheaper action,\n# and a reader told to reload will reload the whole page — restarting every\n# other document on it, which is what produced the failure in the first\n# place on a page that was already busy.\ncore-start-failed-retry = This document could not be started.\n\n# The contended variant of `core-start-failed-retry`, named for the same\n# reason `core-start-failed-busy` is: a reader who is told that several\n# documents were starting at once has a reason to try again in a moment\n# rather than concluding the service is broken.\ncore-start-failed-busy-retry = This document could not be started. Several documents were starting at once, which can take longer on a slower device.\n\n# Label of the button that starts a failed document over without reloading\n# the page. Offered once per document; a retry that fails too falls back to\n# `core-start-failed` / `core-start-failed-busy`, which advise the reload.\ncore-start-retry = Try again\n\n# Shown beside a document that is on screen and working, when the host\n# answered `SPLICE.getState` with an error and so the document started\n# without the reader's saved work (#1741). The host's own wording follows\n# this lead-in, so it says what was lost rather than why.\nsaved-state-unavailable = Your saved work could not be loaded.\n";
|
|
38634
38634
|
const content = '# Worker-generated content: style descriptions ("thick red line"), boolean\n# words, and other prose the core computes into the document. Selected by\n# `documentLocale`, which follows the content\'s language rather than the\n# reader\'s UI language.\n#\n# Message ids are lower-kebab-case Fluent identifiers, optionally with a\n# single `.attribute` suffix (`color.blue`, `noun.line-segment`).\n\n\n## Style vocabulary\n##\n## The words the style pipeline derives from a component\'s numeric and\n## enumerated style values. A word an author writes directly — `lineColorWord`,\n## `markerStyleWord`, and their siblings — passes through untranslated: the\n## author chose those words, and rewriting them would be a surprise. So does a\n## CSS named color asked for by name ("rebeccapurple"), which\n## `resolveColorWord` deliberately preserves.\n##\n## Every adjective here is handed `$gender`, the grammatical gender of the noun\n## it describes (see `noun-gender`), and `$role`, the syntactic position the\n## phrase it belongs to is going into. English has no agreement and ignores\n## both; a language that inflects selects on them.\n##\n## `$role` is one of:\n##\n## standalone the phrase stands on its own, which is where all but\n## the three below are\n## border-clause inside `style-border-clause`, behind its preposition\n## background-clause the background colour inside `style-text`, behind its\n## preposition\n## text-clause the text colour beside it, inside `style-text`\n##\n## The last three exist because those words are rendered in two places each —\n## once alone, as `borderStyleDescription`, `backgroundColor` and `textColor`\n## report them, and once embedded in a clause. A language that inflects for\n## case needs a different form in each, and no amount of `$gender` can say\n## which is wanted. Which case a position governs is the catalog\'s business:\n## `border-clause` is a dative in German, an instrumental in Russian and\n## Polish, and nothing at all in a language that does not inflect.\n\n# The canonical color families a color value resolves to.\ncolor =\n .black = black\n .white = white\n .gray = gray\n .red = red\n .orange = orange\n .yellow = yellow\n .green = green\n .cyan = cyan\n .blue = blue\n .purple = purple\n .pink = pink\n .brown = brown\n\n# Stroke widths. Only the extremes are named — a middling width is described by\n# its color alone.\nline-width =\n .thick = thick\n .thin = thin\n\n# Dash patterns. A solid stroke is described by its color alone.\nline-style =\n .dashed = dashed\n .dotted = dotted\n\n# Patterns a shape\'s interior can be filled with. A solid fill is described by\n# its color alone.\nfill-style =\n .horizontal = horizontal lines\n .vertical = vertical lines\n .diagonal = diagonal lines\n .backdiagonal = reverse diagonal lines\n .dots = dots\n .diamonds = diamonds\n\n# The things being described. The shapes a point can be drawn as ("square",\n# "cross") are nouns too: a point\'s description names its marker shape rather\n# than always saying "point".\nnoun =\n .line = line\n .line-segment = line segment\n .ray = ray\n .vector = vector\n .curve = curve\n .function = function\n .slope-field = slope field\n .vector-field = vector field\n .parabola = parabola\n .polyline = polyline\n .polygon = polygon\n .triangle = triangle\n .rectangle = rectangle\n .circle = circle\n .region = region\n .point = point\n .square = square\n .diamond = diamond\n .cross = cross\n .plus = plus\n\n# A regular polygon names its side count, so it is a message of its own rather\n# than one of `noun`\'s attributes.\n#\n# `$part` splits the noun where a language needs it split: `head` is the word\n# the adjectives attach to, `tail` a complement that follows them. English\n# folds the side count into the head and has no tail; Spanish says "polígono\n# regular" and puts "de 5 lados" after the adjectives, so that they stay beside\n# the noun they agree with. `style-with-noun` and `style-filled-with-noun`\n# place the two halves.\n#\n# `$numSides` is a real number, so it is formatted by the locale\'s own rules —\n# a 1000-gon reads "1,000-sided" here and "de 1000 lados" in Spanish. That is\n# the number-formatting policy in the README, and the one place a description\n# is not character-for-character what the pre-catalog code produced.\nnoun-regular-polygon =\n { $part ->\n [tail] { "" }\n *[head] { $numSides }-sided regular polygon\n }\n\n# The grammatical gender of the noun being described, passed to every adjective\n# describing it so that translations can agree. English has no grammatical\n# gender, so every noun answers the same and the answer goes unused.\n#\n# `$noun` is one of `noun`\'s attribute names, `regular-polygon` for the shape\n# `noun-regular-polygon` names, or the head of a phrase the description builds\n# without naming it as a noun: `border`, `fill`, `text`, or `background`. A\n# word this message does not list falls to its default gender — which is also\n# what an author\'s own `markerStyleWord` gets, since the catalog has never seen\n# it.\nnoun-gender = neuter\n\n\n## Style composition\n##\n## `$parts` names which pieces the style actually supplies, so that a\n## translation can order and inflect each combination on its own terms instead\n## of substituting into a fixed English frame. An absent piece is a different\n## branch, never an empty placeable.\n\n# The adjectives describing a stroke: its width, its dash pattern, and its\n# color. Also describes a shape\'s border, where the color is dropped when it\n# matches the fill it surrounds.\nstyle-stroke =\n { $parts ->\n [width-style-color] { $width } { $lineStyle } { $color }\n [width-color] { $width } { $color }\n [style-color] { $lineStyle } { $color }\n [width-style] { $width } { $lineStyle }\n [width] { $width }\n [style] { $lineStyle }\n *[color] { $color }\n }\n\n# A style description followed by what it describes: "thick red line".\n#\n# `$nounTail` is the noun\'s trailing complement, for the nouns whose\n# translation splits around the adjectives (see `noun-regular-polygon`).\n# English has none today, so it only ever selects `noun` for itself — the other\n# variant is still what a partly-translated locale falls back to, and dropping\n# it would drop that locale\'s side count.\n#\n# The phrase it builds is never governed by anything, so its `$role` is always\n# `standalone`.\nstyle-with-noun =\n { $parts ->\n [noun-tail] { $description } { $noun } { $nounTail }\n *[noun] { $description } { $noun }\n }\n\n# The word marking a shape as filled.\n#\n# A key of its own, looked up by the code and handed to the messages below as\n# `$filled`, rather than literal text inside them: a language that inflects it\n# has to agree it with the shape. Referencing it from those messages would not\n# do — a term reference (`{ -filled }`) gets an empty scope and never sees\n# `$gender`, and a message reference resolves only inside its own bundle, so a\n# locale that translated `style-filled` but not this word would render the\n# reference literally instead of falling back to English.\n#\n# Said only of the shape itself, so its `$role` is always `standalone`.\nstyle-filled-word = filled\n\n# A filled shape, and the pattern its interior is drawn with, if any.\nstyle-filled =\n { $parts ->\n [pattern] { $filled } { $color } with { $pattern }\n *[plain] { $filled } { $color }\n }\n\n# The same, naming the shape: "filled blue circle with diamonds".\n#\n# The `-tail` variants carry the noun\'s trailing complement, as\n# `style-with-noun` does.\nstyle-filled-with-noun =\n { $parts ->\n [pattern] { $filled } { $color } { $noun } with { $pattern }\n [plain-tail] { $filled } { $color } { $noun } { $nounTail }\n [pattern-tail] { $filled } { $color } { $noun } { $nounTail } with { $pattern }\n *[plain] { $filled } { $color } { $noun }\n }\n\n# The border clause appended to a filled shape: "with a thick red border".\n#\n# `$parts` carries two distinctions English cares about: whether a fill pattern\n# was already mentioned, which makes this a further clause ("and") rather than\n# the first ("with"), and whether the surrounding description named the shape,\n# which is where English wants an article.\nstyle-border-clause =\n { $parts ->\n [with-article] with a { $border } border\n [and] and { $border } border\n [and-article] and a { $border } border\n *[with] with { $border } border\n }\n\n# How a shape\'s interior is filled, on its own: "blue diamonds".\nstyle-fill =\n { $parts ->\n [pattern] { $color } { $pattern }\n *[plain] { $color }\n }\n\nstyle-unfilled = unfilled\n\n# How a piece of text is styled: its color, and the background behind it.\n#\n# The only composition message with no `$role`: its two words sit in two\n# different positions, so they arrive already inflected for `text-clause` and\n# `background-clause` respectively and no one token would describe them both.\nstyle-text =\n { $parts ->\n [background] { $color } with a { $background } background\n *[plain] { $color }\n }\n\n# What `backgroundColor` answers when nothing is drawn behind the text.\nstyle-background-none = none\n\n\n## Boolean words\n##\n## What a `<boolean>` or `<booleanInput>` *displays*.\n##\n## Not what it parses or serializes. `true` and `false` are DoenetML syntax —\n## an author writes them in the source, `<award>` compares against them, and\n## saved state stores them — so they stay English everywhere, in every\n## language, exactly as `<` stays `<`. Only the word the reader sees moves.\n##\n## The consequence is that a value has two spellings in a translated document,\n## and both have to be accepted where one is read back in: see\n## `booleanFromWord` in the worker.\n\nboolean-true = true\nboolean-false = false\n\n\n## Answer buttons\n##\n## The default text on an answer\'s submit button. Only the *default* is\n## translated: an author who writes `submitLabel="Ready?"` gets "Ready?" in\n## every locale, because they chose those words for their document and a\n## translation of it is not Doenet\'s to make.\n\n# Shown when the answer will report whether the response was right.\nanswer-submit-label = Check Work\n\n# Shown when it will not — the reader submits, and is told nothing more.\nanswer-submit-label-no-correctness = Submit Response\n\n\n## Sectional blocks\n##\n## The word a sectional block calls itself, which the reader sees in its\n## heading and on a `<solution>`\'s reveal control. Keyed by the element the\n## author writes, so `<subsection>` and `<subsubsection>` share `.section` —\n## they are all called a section.\n##\n## An author who writes `renameTo` has named the block themselves, and that\n## name passes through in every language.\n\nsection-name =\n .activity = Activity\n .aside = Aside\n .cascade = Cascade\n .definition = Definition\n .example = Example\n .exercise = Exercise\n .exercises = Exercises\n .given-answer = Answer\n .note = Note\n .objectives = Objectives\n .paragraphs = Paragraphs\n .part = Part\n .problem = Problem\n .problems = Problems\n .proof = Proof\n .question = Question\n .section = Section\n .solution = Solution\n .task = Task\n .theorem = Theorem\n\n# The heading a section builds for itself: "Example 2", "Section 1.3: Limits".\n#\n# `$parts` names which pieces are present and whether a `<title>` follows, so\n# that a translation orders and punctuates each combination on its own terms\n# rather than substituting into an English frame. English puts the word first\n# and separates a title with a colon — or with a period when the heading is a\n# bare number — and none of that is a given.\n#\n# The `-title` variants end in the separator, because what follows them is the\n# title child, rendered separately. Fluent trims trailing whitespace, so the\n# separator is written as a string literal to keep its space.\n#\n# `$sectionNumber` arrives as text ("2", "1.3") rather than as a number: it is\n# an identifier made of counters, and it is not the catalog\'s to reformat.\nsection-title-prefix =\n { $parts ->\n [name] { $sectionName }\n [number] { $sectionNumber }\n [name-title] { $sectionName }{ ": " }\n [number-title] { $sectionNumber }{ ". " }\n [name-number-title] { $sectionName } { $sectionNumber }{ ": " }\n *[name-number] { $sectionName } { $sectionNumber }\n }\n\n# The heading a `<hint>` shows when the author gave it no `<title>`.\nhint-title = Hint\n\n\n## Tables and figures\n##\n## The name a `<table>` or `<figure>` gives itself, which the renderer sets in\n## bold at the head of the title or caption: "Table 2", "Figure 3". An\n## unnumbered one is named by the bare word.\n##\n## The word and the number are one message rather than a word the code\n## concatenates a number onto, so that a language which orders or punctuates\n## them differently can say so.\n##\n## `$enumeration` arrives as text rather than as a number: it identifies the\n## table, so the thousandth one is "Table 1000" and not "Table 1,000".\n##\n## The `-title` and `-caption` branches end in the separator joining the name\n## to the authored title or caption, which the renderer used to write as a\n## literal `": "` of its own. That child is arbitrary marked-up content\n## rendered after this string rather than an argument passed into it, so where\n## it sits is the one thing a translation cannot reorder — the same shape\n## `section-title-prefix` has.\n\n## The name a `<chart>` gives a series that the author did not label.\n##\n## This is not decoration: it is the text a screen reader announces on the\n## level between the chart and its marks, so a reader stopping there is told\n## which group they have reached. A bare number would be indistinguishable\n## from a value or a category, which are what the levels either side of it\n## announce.\n##\n## `$position` arrives as text rather than as a number, for the reason\n## `table-name`\'s `$enumeration` does: it identifies the series, so the\n## thousandth one is "series 1000" and not "series 1,000".\nchart-unlabeled-series =\n series { $position }\n\ntable-name =\n { $parts ->\n [numbered] Table { $enumeration }\n [numbered-title] Table { $enumeration }{ ": " }\n [unnumbered-title] Table{ ": " }\n *[unnumbered] Table\n }\n\nfigure-name =\n { $parts ->\n [numbered] Figure { $enumeration }\n [numbered-caption] Figure { $enumeration }{ ": " }\n [unnumbered-caption] Figure{ ": " }\n *[unnumbered] Figure\n }\n\n\n## Paginator controls\n##\n## The strip of controls that steps through a `<paginator>`\'s pages. All three\n## words are author-overridable attributes, so only the default is translated.\n\npaginator-previous = Previous\npaginator-next = Next\npaginator-page = Page\n\n# The status between the two buttons: "Page 3 of 5".\n#\n# Composed in the worker rather than in the renderer so that the whole of it is\n# in one language: `$pageLabel` is the `pageLabel` attribute, which an author\n# may have written themselves, and the words joining it to the counts have to\n# sit beside it in the same tongue.\n#\n# The two counts arrive as text, for the same reason `$enumeration` does above.\npaginator-page-status = { $pageLabel } { $currentPage } of { $numPages }\n\n\n## Piecewise functions\n##\n## `<piecewiseFunction>` renders each branch\'s domain as mathematics and writes\n## these three words around it: "if 1 < x < 2 or 4 < x < 5", and "otherwise"\n## for the branch that catches what the others leave. The inequalities are\n## notation and stay as they are; these are prose, and are read aloud as prose.\n##\n## `or` is the only conjunction the core composes into content. Everything else\n## that reads as "a, b, and c" is a diagnostic, and those are joined by\n## `Intl.ListFormat` at the moment the reader\'s language is known rather than\n## by a catalog word (see `DiagnosticListArg`).\n\npiecewise-condition-or = or\n\n# Introduces the domain a branch applies on; the mathematics follows it.\npiecewise-condition-if = if\n\n# The last branch, which applies wherever none of the earlier ones do.\npiecewise-condition-otherwise = otherwise\n\n\n## Chemistry\n##\n## The names the chemistry components generate. Symbols (`H`, `Fe`), formulas,\n## and anything an author\'s `<award>` compares against by value stay as they\n## are; only what is displayed as prose is here.\n##\n## Element names are keyed by symbol, which is the identifier the atom database\n## is read through and is itself never translated.\n##\n## An element\'s periodic group, its phase at STP and its metal category are not\n## here. They are enumerated values an author\'s `<award>` compares against —\n## `$atom.groupName = Noble Gas` — and translating one would break that\n## comparison the moment a document declared a language (#1577).\n\nelement-name =\n .h = Hydrogen\n .he = Helium\n .li = Lithium\n .be = Beryllium\n .b = Boron\n .c = Carbon\n .n = Nitrogen\n .o = Oxygen\n .f = Fluorine\n .ne = Neon\n .na = Sodium\n .mg = Magnesium\n .al = Aluminum\n .si = Silicon\n .p = Phosphorus\n .s = Sulfur\n .cl = Chlorine\n .ar = Argon\n .k = Potassium\n .ca = Calcium\n .sc = Scandium\n .ti = Titanium\n .v = Vanadium\n .cr = Chromium\n .mn = Manganese\n .fe = Iron\n .co = Cobalt\n .ni = Nickel\n .cu = Copper\n .zn = Zinc\n .ga = Gallium\n .ge = Germanium\n .as = Arsenic\n .se = Selenium\n .br = Bromine\n .kr = Krypton\n .rb = Rubidium\n .sr = Strontium\n .y = Yttrium\n .zr = Zirconium\n .nb = Niobium\n .mo = Molybdenum\n .tc = Technetium\n .ru = Ruthenium\n .rh = Rhodium\n .pd = Palladium\n .ag = Silver\n .cd = Cadmium\n .in = Indium\n .sn = Tin\n .sb = Antimony\n .te = Tellurium\n .i = Iodine\n .xe = Xenon\n .cs = Cesium\n .ba = Barium\n .la = Lanthanum\n .ce = Cerium\n .pr = Praseodymium\n .nd = Neodymium\n .pm = Promethium\n .sm = Samarium\n .eu = Europium\n .gd = Gadolinium\n .tb = Terbium\n .dy = Dysprosium\n .ho = Holmium\n .er = Erbium\n .tm = Thulium\n .yb = Ytterbium\n .lu = Lutetium\n .hf = Hafnium\n .ta = Tantalum\n .w = Tungsten\n .re = Rhenium\n .os = Osmium\n .ir = Iridium\n .pt = Platinum\n .au = Gold\n .hg = Mercury\n .tl = Thallium\n .pb = Lead\n .bi = Bismuth\n .po = Polonium\n .at = Astatine\n .rn = Radon\n .fr = Francium\n .ra = Radium\n .ac = Actinium\n .th = Thorium\n .pa = Protactinium\n .u = Uranium\n .np = Neptunium\n .pu = Plutonium\n .am = Americium\n .cm = Curium\n .bk = Berkelium\n .cf = Californium\n .es = Einsteinium\n .fm = Fermium\n .md = Mendelevium\n .no = Nobelium\n .lr = Lawrencium\n .rf = Rutherfordium\n .db = Dubnium\n .sg = Seaborgium\n .bh = Bohrium\n .hs = Hassium\n .mt = Meitnerium\n .ds = Darmstadtium\n .rg = Roentgenium\n .cn = Copernicium\n .nh = Nihonium\n .fl = Flerovium\n .mc = Moscovium\n .lv = Livermorium\n .ts = Tennessine\n .og = Oganesson\n\n# The name an anion takes, for the elements that have one.\n#\n# English derives these — strip a trailing "ine", add "ide", with a small table\n# for the words that rule does not fit — but that is English morphology, not a\n# fact about anions. So each language supplies the names it uses. An element\n# with no entry here is called by its own name, which is also what the English\n# rule does for everything it does not match.\nelement-anion-name =\n .h = Hydride\n .c = Carbide\n .n = Nitride\n .o = Oxide\n .f = Fluoride\n .p = Phosphide\n .s = Sulfide\n .cl = Chloride\n .br = Bromide\n .i = Iodide\n .at = Astatide\n .ts = Tennesside\n\n# A transition metal\'s ion, named with its oxidation state: "Iron (II)".\n#\n# The Roman numeral is IUPAC notation and is the same in every language. Where\n# it sits and how it is punctuated is not, which is why this is a message and\n# not a suffix the code appends.\nion-name-oxidation-state = { $name } ({ $numeral })\n\n# Shown in place of a chemical symbol or formula that names nothing. Rendered\n# into mathematics as well as into text, so the brackets around it are added by\n# the code — inside `\\text{}` for the LaTeX form — and are not part of the\n# message.\nchemistry-invalid-symbol = Invalid Chemical Symbol\nchemistry-invalid-ionic-compound = Invalid Ionic Compound\n\n## Inputs embedded in math\n\n# Names the gap an input fills when it is drawn inside a typeset expression, so\n# that a screen reader reads "x equals blank plus 3" rather than skipping over\n# it. Written into the mathematics itself and never shown on screen, so keep it\n# to a word or two.\nmath-embedded-input-blank = blank\n\n# The same, when one expression has more than one gap, so that a reader can tell\n# which one they have reached.\nmath-embedded-input-blank-ordinal = blank { $ordinal } of { $total }\n';
|
|
38635
|
-
const diagnostics = '# Errors and warnings surfaced to the reader or author. Produced by the worker\n# but addressed to whoever is looking at the screen, so these are selected by\n# `uiLocale`, not `documentLocale`.\n#\n# Message ids are lower-kebab-case Fluent identifiers, optionally with a\n# single `.attribute` suffix (`invalid-attribute-value`).\n#\n# Reached by stable diagnostic code rather than by a literal `t("key")` call:\n# `DIAGNOSTIC_CODES` in `src/diagnostics.ts` maps `doenet-w0001` to the id\n# below, and `lint:i18n` treats that registry as the call site. Adding a\n# message here without registering a code for it fails the lint as an orphan.\n#\n# Translators: `through`, `endpoint`, `midpointOffset`, `numDimensions` and the\n# like are DoenetML attribute names. They are part of the language, not prose,\n# and must be left in English exactly as written.\n\n## `<lineSegment>`\n\n# $attributes is a list of attribute names; $attributesCount is its length.\nline-segment-attributes-ignored-with-endpoints =\n { $attributesCount ->\n [one] { $attributes } is ignored when two endpoints are specified\n *[other] { $attributes } are ignored when two endpoints are specified\n }\n\n# $attributes is a list of attribute names; $attributesCount is its length.\nline-segment-attributes-ignored-with-endpoint-and-midpoint =\n { $attributesCount ->\n [one] { $attributes } is ignored when an endpoint and a midpoint are both specified\n *[other] { $attributes } are ignored when an endpoint and a midpoint are both specified\n }\n\nline-segment-midpoint-offset-without-midpoint = midpointOffset has no effect without a midpoint\n\n## `<line>`\n\nline-points-undetermined-dimensions = Line through points of undetermined dimensions.\n\nline-points-too-few-dimensions = Line must be through points of at least two dimensions.\n\n# $variables is a bare enumeration of variable names, not an "and" list.\nline-points-depend-on-variables = Line is through points that depend on variables: { $variables }.\n\nline-equation-invalid-format = Invalid format for equation of line in variables { $variable1 } and { $variable2 }.\n\n## `<ray>`\n\nray-overprescribed-through = Ray is prescribed by through, endpoint, and direction. Ignoring specified through.\n\nray-dimension-mismatch = numDimensions mismatch in ray.\n\n## `<vector>`\n\nvector-overprescribed-head = Vector is prescribed by head, tail, and displacement. Ignoring specified head.\n\nvector-dimension-mismatch = numDimensions mismatch in vector.\n\n## Attracting and constraining\n\n# $component is the DoenetML tag of the child that was named, e.g. "polygon".\nattract-to-without-nearest-point = Cannot attract to a `<{ $component }>` as it doesn\'t have a nearestPoint state variable.\n\nconstrain-to-without-nearest-point = Cannot constrain to a `<{ $component }>` as it doesn\'t have a nearestPoint state variable.\n\nconstrain-to-interior-without-nearest-point = Cannot constrain to interior of a `<{ $component }>` as it doesn\'t have a nearestPoint state variable.\n\n## `<choiceInput>`\n\n# Translators: `labelPosition` is an attribute name and stays in English.\nchoice-input-label-position-ignored = labelPosition is ignored for non-inline choiceInput\n\n## Ordering children by index\n##\n## These name the component in prose rather than as a tag, matching how the\n## messages have always read. The component names stay in English; the nouns\n## around them are prose and should be translated.\n\nchoice-input-indices-count-mismatch = Ignoring indices specified for choiceInput as number of indices doesn\'t match number of choice children.\n\npretzel-indices-count-mismatch = Ignoring indices specified for problem as number of indices doesn\'t match number of problem children.\n\nshuffle-indices-count-mismatch = Ignoring indices specified for shuffle as number of indices doesn\'t match number of components.\n\n# $component is `choiceInput`, `pretzel` or `shuffle` — a DoenetML component\n# name, so it stays in English.\nindices-ignored-out-of-range = Ignoring indices specified for { $component } as some indices out of range.\n\npretzel-indices-repeated = Ignoring indices specified for pretzel as some indices are repeated.\n\npretzel-circuit-first-index = Ignoring indices specified for pretzel in circuit mode as the first index must be 1.\n\n## `<shuffle>` and `<sort>`\n\n# $component is `shuffle` or `sort`. These two components accept the same\n# children and fail the same ways, so they share their messages.\nstring-children-need-type = For `<{ $component }>` to work with string children, a `type` attribute must be specified.\n\n# $type is what the author wrote; math, text, number and boolean are attribute\n# values and stay in English.\ninvalid-type-defaulting-to-math = Invalid type { $type } for { $component } component. Must be one of math, text, number, or boolean. Defaulting to math.\n\n# Raised when `type` names something that is not one of the four readings. The\n# value is dropped rather than replaced by a guess, so the children are read as\n# though no type had been written. $type is what the author wrote.\ninvalid-type-ignored =\n Invalid type { $type } for { $component } component. Must be one of math, text, number, or boolean. Ignoring it and reading the values as though no type had been given.\n\n# $value is the string child that could not be used.\nstring-not-valid-component-to-arrange = String "{ $value }" is not a valid component to { $component }. Ignoring.\n\n## Types and variables\n\ninvalid-type-defaulting-to-number = Invalid type { $type }, setting type to number.\n\ninvalid-variable-value = Invalid value of a variable: `{ $value }`\n\n## Variants\n\n# $index is what the author wrote, reproduced verbatim rather than as a number:\n# it reached this message precisely because it was not one.\nvariant-index-must-be-number = Variant index { $index } must be a number\n\nvariant-index-must-be-integer = Variant index { $index } must be an integer\n\n## `<sideBySide>`\n\n# $component is `sideBySide` or `sbsGroup`.\nside-by-side-absolute-widths = `<{ $component }>` is not implemented for absolute measurements. Setting widths to relative.\n\nside-by-side-absolute-margins = `<{ $component }>` is not implemented for absolute measurements. Setting margins to relative.\n\nside-by-side-no-block-child = Invalid `<{ $component }>`: it must have at least one block child.\n\n## `<label>`\n\n# Translators: `for` is an attribute name and stays in English.\nlabel-for-ignored-on-graphical = The `for` attribute on graphical `<label>` is ignored.\n\nlabel-for-must-resolve-to-one = The `for` attribute on `<label>` must resolve to exactly one component.\n\nlabel-for-unresolved = The `for` attribute on `<label>` could not be resolved to a component.\n\nlabel-for-answer-with-authored-inputs = The `for` attribute on `<label>` references an `<answer>` with explicitly authored inputs; reference the input directly.\n\nlabel-for-answer-without-input = The `for` attribute on `<label>` references an `<answer>` without an input to label.\n\nlabel-for-must-reference-input-or-answer = The `for` attribute on `<label>` must reference an input or an answer.\n\n## Accessibility\n\n# $component is a DoenetML tag, e.g. "graph" or "image".\naccessibility-short-description-or-decorative = For accessibility, `<{ $component }>` must either have a short description or be specified as decorative.\n\naccessibility-video-short-description = For accessibility, `<video>` must have a short description.\n\naccessibility-input-short-description-or-label = For accessibility, `<{ $component }>` must have a short description or a label.\n\n# The companion to the message above, for the input an `<answer>` creates on the\n# author\'s behalf. Two messages rather than one with the subject passed in: the\n# subject is a phrase here, not a name, and a phrase handed over as an argument\n# would never reach a translator.\naccessibility-answer-input-short-description-or-label = For accessibility, an `<answer>` creating an input must have a short description or a label.\n\naccessibility-short-description-contains-math = Short descriptions should not contain math components such as `<{ $component }>`. Spell out any math with words.\n\n# $colorName is an attribute name and stays in English. $ratio and $threshold\n# are contrast ratios; $mode says which theme the shortfall was measured in,\n# and is `dark` or `light`.\naccessibility-section-title-insufficient-contrast =\n { $mode ->\n [dark] { $colorName } has insufficient contrast for the section heading text (dark mode) ({ NUMBER($ratio, minimumFractionDigits: 2, maximumFractionDigits: 2) }:1; requires at least { $threshold }:1).\n *[other] { $colorName } has insufficient contrast for the section heading text ({ NUMBER($ratio, minimumFractionDigits: 2, maximumFractionDigits: 2) }:1; requires at least { $threshold }:1).\n }\n\n## `<circle>`\n\n# $count is the number of through points.\ncircle-through-points-non-numerical = Haven\'t implemented `<circle>` through { $count } points in case where the points don\'t have numerical values.\n\ncircle-too-many-through-points = Cannot calculate circle through more than 3 points.\n\ncircle-overprescribed-radius-center-points = Cannot calculate circle with specified radius, center and through points.\n\ncircle-center-with-multiple-points = Cannot calculate circle with specified center through more than 1 point.\n\n# $distance and $radius arrive as strings, not numbers: $radius is the author\'s\n# own value echoed back for diagnosis, and formatting it as a quantity would\n# round a radius of 0.0001 away to 0.\ncircle-radius-too-small = Cannot calculate circle: given that the distance between the two points is { $distance }, the specified radius { $radius } is too small.\n\ncircle-radius-with-many-points = Cannot create circle through more than two points with a specified radius.\n\ncircle-invalid-center-or-through-points = Invalid center or through points of circle.\n\ncircle-radius-center-with-multiple-points = Cannot calculate radius of circle with specified center through more than 1 point.\n\ncircle-change-radius-non-numerical = Cannot change radius of circle with non-numerical through points\n\ncircle-radius-with-points-non-numerical = Cannot create circle through more than one point with specified radius when don\'t have numerical values.\n\ncircle-change-center-non-numerical = Haven\'t implemented changing center of circle through points with non numerical values.\n\n## `<function>`\n\n# Two independent counts in one sentence, so the variants multiply out. A\n# select\'s variants each need their own line, so the inner one spans lines too;\n# that is safe because newlines inside a placeable never reach the rendered\n# value. Only text continuing onto a further line would.\nfunction-domain-insufficient-dimensions =\n { $intervals ->\n [one] Insufficient dimensions for domain for function. Domain has { $intervals } interval but the function has { $inputs ->\n [one] { $inputs } input\n *[other] { $inputs } inputs\n }.\n *[other] Insufficient dimensions for domain for function. Domain has { $intervals } intervals but the function has { $inputs ->\n [one] { $inputs } input\n *[other] { $inputs } inputs\n }.\n }\n\nfunction-domain-invalid-format = Invalid format for domain for function.\n\n# $type is what was being read off the point. It selects the wording rather\n# than being substituted into it: "maximum", "slope" and the rest are English\n# nouns, and a noun handed over as an argument would never reach a translator.\n# The catch-all reproduces the pre-catalog behavior for a value not listed here.\nfunction-ignoring-non-numerical =\n { $type ->\n [maximum] Ignoring non-numerical maximum of function.\n [minimum] Ignoring non-numerical minimum of function.\n [extremum] Ignoring non-numerical extremum of function.\n [point] Ignoring non-numerical point of function.\n [slope] Ignoring non-numerical slope of function.\n *[other] Ignoring non-numerical { $type } of function.\n }\n\nfunction-ignoring-empty =\n { $type ->\n [maximum] Ignoring empty maximum of function.\n [minimum] Ignoring empty minimum of function.\n [extremum] Ignoring empty extremum of function.\n [point] Ignoring empty point of function.\n *[other] Ignoring empty { $type } of function.\n }\n\nfunction-points-too-close = Function contains two points with locations too close together. Can\'t define function.\n\nfunction-iterates-input-output-mismatch =\n { $inputs ->\n [one] Function iterates are possible only if the number of inputs of the function is equal to the number of outputs. This function has { $inputs } input and { $outputs ->\n [one] { $outputs } output\n *[other] { $outputs } outputs\n }.\n *[other] Function iterates are possible only if the number of inputs of the function is equal to the number of outputs. This function has { $inputs } inputs and { $outputs ->\n [one] { $outputs } output\n *[other] { $outputs } outputs\n }.\n }\n\n## `<sequence>`\n\nsequence-invalid-length = Invalid length of sequence. Must be a non-negative integer.\n\n# $type is a sequence type: number, letters, or math.\nsequence-invalid-step = Invalid step of sequence. Must be a number for sequence of type { $type }.\n\n# $attribute is `from` or `to` — an attribute name, so it stays in English.\nsequence-invalid-endpoint-number = Invalid "{ $attribute }" of number sequence. Must be a number.\n\nsequence-invalid-endpoint-letters = Invalid "{ $attribute }" of letters sequence. Must be a letter combination.\n\nsequence-invalid-endpoint = Invalid "{ $attribute }" of sequence.\n\nselect-from-sequence-coprime-not-numbers = coprime ignored since not selecting numbers\n\nselect-from-sequence-coprime-with-exclude-combinations = coprime ignored since excludeCombinations specified\n\n## Resolving a `target`\n##\n## Raised by the components that take a `target` attribute. They resolve it\n## through the same code and fail the same two ways, so they share these two\n## messages rather than spelling each one out per component: $source is the tag\n## of the component that raised it, part of the DoenetML language, so it stays\n## in English.\n\ntarget-not-found = Invalid target for `<{ $source }>`: cannot find target.\n\n# $property is the state variable that was looked for; $component is the tag it\n# was looked for on.\ntarget-state-variable-not-found = Invalid target for `<{ $source }>`: cannot find a state variable named "{ $property }" on a `<{ $component }>`.\n\n## `<odeSystem>`\n\node-system-variables-match-independent = Variables of `<odeSystem>` must be different than independent variable.\n\node-system-duplicate-variable-names = Can\'t define ODE RHS functions with duplicate dependent variable names.\n\node-system-rhs-function-error = Cannot define ODE RHS function. Error creating mathjs function.\n\n## `<angle>`, `<parabola>`, and `<intersection>`\n\n# $count is how many line children were found.\nangle-too-many-lines = Cannot define an angle between { $count } lines\n\nangle-invalid-through-point = Invalid point in through of `<angle>`\n\nparabola-vertex-too-many-points = Haven\'t implemented parabola with vertex through more than 1 point.\n\nparabola-too-many-points = Haven\'t implemented parabola through more than 3 points.\n\nintersection-too-many-items = Haven\'t implemented intersection for more than two items\n\n## Other math components\n\nionic-compound-not-two-ions = Have not implemented ionic compound for anything other than two ions.\n\nionic-compound-needs-cation-and-anion = Ionic compound implemented only for one cation and one anion.\n\n# $equation is the equation as the author wrote it.\nsolve-equations-cannot-evaluate = Cannot solve equation as could not evaluate equation: { $equation }\n\n# Translators: `operandNumber` is an attribute name and stays in English.\nmath-operators-operand-number-required = Must specify a operandNumber when extracting a math operand.\n\neigen-decomposition-failed = Could not calculate eigenvalues of matrix\n\n## `<matchesPattern>`\n\n# Translators: `parameters` is an attribute name and stays in English.\n# $parameters lists the parameters as the author wrote them;\n# $parametersCount is how many there were.\nmatches-pattern-parameter-not-in-pattern =\n { $parametersCount ->\n [one] `<matchesPattern>`: the parameter { $parameters } does not occur in the pattern, so it will always match a blank.\n *[other] `<matchesPattern>`: the parameters { $parameters } do not occur in the pattern, so they will always match a blank.\n }\n\n## `<graph>`\n\n# Translators: grid is an attribute name and none, medium and dense are its\n# values; all four stay in English, as does the example. $grid is the value the\n# author wrote, reproduced verbatim — it reached this message precisely because\n# it was not one of the forms listed.\ngraph-grid-invalid = `<graph>`: cannot interpret grid="{ $grid }". It must be none, medium, dense, or two positive numbers separated by a space, such as grid="1 0.5". No grid is drawn.\n\n## `<slopeField>` and `<vectorField>`\n\n# $component is the field\'s tag and $alternative the sibling field component\'s,\n# or `none` when the function would not suit it either; both are DoenetML tags\n# and stay in English, as do the example expressions. $expected is how many\n# outputs the component needs, $found how many the given function has. What a\n# field draws a mark from is the function\'s outputs, so the wrong number of\n# them means there is nothing to draw — and the author almost always wanted the\n# other component.\nfield-function-wrong-num-outputs =\n `<{ $component }>` needs a function with { $expected ->\n [one] one output, the slope y\' at each point, such as `y - x`\n *[other] two outputs, the vector at each point, such as `(y, -x)`\n }, but the function it was given has { $found ->\n [one] { $found } output\n *[other] { $found } outputs\n }. { $alternative ->\n [none] Nothing is drawn.\n *[other] `<{ $alternative }>` is the component for that function. Nothing is drawn.\n }\n\n# Translators: retired. `function` is an attribute name and stays in English.\n# It warned that a field had been given its function both as an attribute and\n# inside the component; the attribute no longer exists, so the two can no\n# longer disagree. Kept because diagnostic codes are never reused.\nfield-function-attribute-ignored-with-child = The `function` attribute is ignored because the function is also given inside the component; the one inside is used. Give the function only one of the two ways.\n\n# Translators: `variables` and `function` are a DoenetML attribute and tag and\n# stay in English, as does $component, the field\'s own tag. The attribute names\n# the inputs of an expression written directly inside the component; when there\n# is no such expression there is nothing for it to name, and $reason says which\n# of the two ways that happened.\nfield-variables-ignored =\n `<{ $component }>`: the `variables` attribute names the variables of an expression written directly inside the component. { $reason ->\n [function-child] The function here is given as a `<function>` child, which names its own variables, so `variables` is ignored.\n *[no-expression] No such expression is given here, so `variables` is ignored.\n }\n\n## PreFigure renderer\n\n# Translators: xLabelPosition, yLabelPosition and their values are attribute\n# names and stay in English, as does the renderer\'s name.\nprefigure-x-label-position-unsupported = `<graph>`: xLabelPosition="left" is not supported in prefigure renderer; using right-position behavior.\n\nprefigure-y-label-position-unsupported = `<graph>`: yLabelPosition="bottom" is not supported in prefigure renderer; using top-position behavior.\n\nprefigure-invalid-axis-bounds = `<graph>`: invalid axis bounds for prefigure conversion; using default bbox (-10,-10,10,10).\n\nprefigure-invalid-width = `<graph>`: invalid width for prefigure conversion; using default diagram width 425.\n\nprefigure-invalid-aspect-ratio = `<graph>`: invalid aspectRatio for prefigure conversion; using default aspect ratio 1.\n\n# Translators: the renderer\'s name, prefigure, stays in English. "grid" here is\n# the coordinate grid itself rather than the attribute that asks for one, so it\n# is prose and is translated.\nprefigure-grid-spacing-too-fine = `<graph>`: the grid spacing is too fine for the axis limits; the grid is omitted in the prefigure renderer.\n\nprefigure-annotations-not-rendered = `<graph>`: annotations will not be rendered when not using the PreFigure renderer.\n\nmultiple-annotations-children = Multiple `<annotations>` children found in `<graph>`; all but the last one are ignored.\n\n## Referring to other components\n##\n## `<updateValue>`\'s own "cannot find target" messages are not here: it\n## resolves a target the same way `<animateFromSequence>` does and fails the\n## same ways, so the two share `target-not-found` and\n## `target-state-variable-not-found` above.\n\ncopy-unrecognized-component-type = Cannot extend or copy an unrecognized component type: { $type }.\n\ncopy-prop-not-found = Could not find prop { $property } on a component of type { $component }\n\ncollect-no-source = No source found for collect.\n\ncollect-invalid-component-type = Cannot collect components of type `<{ $component }>` as it is an invalid component type.\n\n# $reference is the reference exactly as the author wrote it, `$` and all —\n# the `$p.styleDescription[1]` of `<text extend="$p.styleDescription[1]" />`.\n# An index only means something applied to an array, and the thing named here\n# is not one. The reference is quoted back rather than explained because the\n# text in front of the author is the only part of this they can act on: the\n# state variable and component index the core knows about are its own business\n# and go to the console instead.\nreference-index-unavailable = Cannot reference index `{ $reference }`\n\n## `<callAction>`\n\n# $action is the `actionName` the author asked for, part of the DoenetML\n# language, so it stays in English. $reference is the `target` as written.\ncomponent-action-unavailable = Cannot call { $action } on component `{ $reference }`\n\n## `<dataFrame>`\n\n# $componentIdx is an internal index, passed as a string so it is not grouped\n# like a quantity; the odd spacing before the colon is reproduced from the\n# original message.\ndata-frame-inconsistent-row-lengths = Data has invalid shape. Rows has inconsistent lengths. Found in componentIdx :{ $componentIdx }\n\ndata-frame-duplicate-column-names = Data has duplicate column names. Found in componentIdx :{ $componentIdx }\n\ndata-frame-missing-column-name = Data is missing a column name. Found in componentIdx :{ $componentIdx }\n\n## `<answer>` and scoring\n\nanswer-award-depends-on-own-response = An award for this answer is based on the answer tag\'s own submitted response, which will lead to unexpected behavior.\n\n# Translators: maxNumAttempts and sectionWideCheckWork are attribute names.\nanswer-max-num-attempts-in-section-wide-check-work = Setting `maxNumAttempts` on an `<answer>` inside a container with `sectionWideCheckWork` has no effect, as the number of attempts is controlled by the container. Set `maxNumAttempts` on the container instead.\n\nnested-section-wide-check-work-max-num-attempts = Setting `maxNumAttempts` on a container with `sectionWideCheckWork` that is inside another container with `sectionWideCheckWork` has no effect, as the number of attempts is controlled by the outer container. Set `maxNumAttempts` on the outer container instead.\n\n# $attributes is a list of attribute names; $attributesCount is its length.\nanswer-attributes-need-symbolic-equality =\n { $attributesCount ->\n [one] The { $attributes } attribute will have no effect without symbolicEquality set.\n *[other] The { $attributes } attributes will have no effect without symbolicEquality set.\n }\n\nanswer-invalid-type = Invalid type for answer: { $type }\n\n## `<module>`, `<conditionalContent>`, `<slider>`, `<pretzel>`\n\nmodule-attribute-child-needs-name = Since the component `<{ $component }>` does not have a name, it cannot be used for a module attribute\n\nmodule-attribute-name-already-defined = The component `<{ $component } name="{ $name }">` cannot be used as an attribute for a module because the `<module>` component type already has a "{ $name }" attribute defined.\n\nconditional-content-condition-ignored = Attribute `condition` is ignored on a `<conditionalContent>` component with case or else children.\n\nslider-markers-type-mismatch = Markers type doesn\'t match slider type.\n\npretzel-problem-needs-statement-and-answer = Invalid pretzel: each `<problem>` must contain one `<statement>` and one `<answer>`.\n\npretzel-circuit-first-problem-distractor = Invalid pretzel: in mode="circuit", the first `<problem>` cannot be a distractor.\n\n## Attribute values\n\n# $values is a list of the values that were rejected, each already in\n# backticks; $valuesCount is how many there were.\nattribute-invalid-values =\n { $valuesCount ->\n [one] Invalid value { $values } for attribute `{ $attribute }`; ignoring.\n *[other] Invalid values { $values } for attribute `{ $attribute }`; ignoring.\n }\n\nattribute-must-be-references = Invalid value `{ $value }` for attribute `{ $attribute }`. Attribute must be composed of references that begin with a `$`.\n\n# $names is a list of the rejected names, each already in single quotes.\nmath-input-invalid-function-names = <mathInput>: ignored invalid function name(s) in { $attribute }: { $names }. Each name\'s display segment must be at least 2 characters (letters or dashes); an optional `|<mathspeak alternative>` suffix may follow.\n\n## Building components from the source\n\n# Raised while the source is being turned into components, by throwing rather\n# than by building a record: the thrower is caught, the component becomes an\n# `_error`, and the diagnostic is re-raised from it.\n\ncomponent-type-invalid = Invalid component type: `<{ $componentType }>`\n\nattribute-repeated = Cannot repeat attribute { $attribute }.\n\nattribute-invalid-for-component = Invalid attribute "{ $attribute }" for a component of type `<{ $componentType }>`.\n\n## Style definition contrast\n\n# $context names the pair being compared, $mode which colour scheme it was\n# rendered in. Both are symbolic — the phrase is chosen here so a translator\n# can rewrite it, rather than being handed over already in English.\nstyle-definition-insufficient-contrast =\n Style definition { $styleNumber } has insufficient contrast for { $context ->\n [text-on-background] text color against background color\n [high-contrast] high-contrast color against the canvas\n [line] line color against the canvas\n [marker] marker color against the canvas\n *[text-on-canvas] text color against the canvas\n }{ $mode ->\n [dark] { " (dark mode)" }\n *[light] { "" }\n } ({ NUMBER($ratio, minimumFractionDigits: 2, maximumFractionDigits: 2) }:1; requires at least { $threshold }:1).\n\n# $suggestion says whether a concrete replacement colour could be computed.\n# The attribute names and colour values in the `available` branch are\n# DoenetML source, not prose, and stay as they are in every language.\nstyle-definition-dark-mode-text-background-contrast =\n Although style definition { $styleNumber } has specified colors that provide sufficient contrast for light mode, the dark-mode colors derived from these values have insufficient contrast for the text color against the background color ({ NUMBER($ratio, minimumFractionDigits: 2, maximumFractionDigits: 2) }:1; requires at least { $threshold }:1). { $suggestion ->\n [available] To ensure sufficient contrast in dark mode, either increase the light-mode contrast (e.g., set { $lightAttribute }="{ $lightColor }") or override the dark-mode color (e.g., set { $darkAttribute }="{ $darkColor }").\n *[none] To ensure sufficient contrast in dark mode, increase the light-mode contrast or override the derived colors with textColorDarkMode and/or backgroundColorDarkMode.\n }\n\nstyle-definition-dark-mode-text-canvas-contrast =\n Although style definition { $styleNumber } has a specified text color that provides sufficient contrast for light mode, the dark-mode text color derived from this value has insufficient contrast against the canvas ({ NUMBER($ratio, minimumFractionDigits: 2, maximumFractionDigits: 2) }:1; requires at least { $threshold }:1). { $suggestion ->\n [available] To ensure sufficient contrast in dark mode, either increase the light-mode contrast (e.g., set textColor="{ $lightColor }") or override the dark-mode color (e.g., set textColorDarkMode="{ $darkColor }").\n *[none] To ensure sufficient contrast in dark mode, increase the light-mode contrast or override the derived color with textColorDarkMode.\n }\n\nsection-multiple-style-palettes = A section can select only one <stylePalette>; using the last one.\n\n## Unique variants\n\n# Explanations of why a component\'s unique variants could not be worked out.\n# $component is the tag that could not be analyzed and stays as written; the\n# reason is a separate message per situation, so a host can tell them apart by\n# code and a translator sees a whole sentence rather than a fragment.\n\nvariant-num-to-select-not-non-negative-integer = cannot determine unique variants of { $component } as numToSelect isn\'t a non-negative integer.\n\nvariant-num-to-select-not-constant-number = cannot determine unique variants of { $component } as numToSelect isn\'t constant number.\n\nvariant-with-replacement-not-constant-boolean = cannot determine unique variants of { $component } as withReplacement isn\'t constant boolean.\n\nvariant-select-weight-disables-unique = Unique variants for select disabled if have an option with selectWeight or selectForVariants specified\n\nvariant-coprime-undetermined = cannot determine unique variants of { $component } as cannot determine coprime is always false.\n\n# $attribute is an attribute name (`from`, `to`, `step`, `sort`, `length`) and\n# stays as written.\nvariant-attribute-not-constant = cannot determine unique variants of { $component } as { $attribute } isn\'t a constant.\n\nvariant-attribute-not-number = cannot determine unique variants of { $component } as { $attribute } isn\'t a number.\n\n# $type is the sequence type the component was declared with. $expected names\n# what the value had to be, symbolically, because which one applies depends on\n# both the type and the attribute.\nvariant-attribute-wrong-type-for-sequence =\n cannot determine unique variants of { $component } of { $type } type as { $attribute } isn\'t { $expected ->\n [letters-combination] a combination of letters\n [math-expression] a valid math expression\n [integer] an integer\n *[number] a number\n }.\n\nvariant-length-not-integer = cannot determine unique variants of { $component } as length isn\'t an integer.\n\nvariant-sort-not-implemented = have not implemented unique variants of a { $component } with sort\n\nvariant-exclude-combinations-not-implemented = have not implemented unique variants of a { $component } with excludeCombinations\n\nvariant-math-exclude-not-implemented = have not implemented unique variants of a { $component } of type math with exclude\n\nvariant-non-constant-exclude-not-implemented = have not implemented unique variants of a { $component } with non-constant exclude\n\n## PreFigure conversion\n\n# $subject identifies the component the warning is about, already written as\n# `<tag>` or `<tag> (name)`. It is composed in code rather than here because\n# Fluent terms cannot take a variable as an argument, so a shared subject\n# fragment cannot be parameterized from the catalog. It holds only a tag name,\n# a component name and punctuation — never a word — which is why a descendant\n# with no type reads `<?>` rather than `<unknown>`.\n\nprefigure-descendant-unsupported = { $subject }: unsupported in graph prefigure renderer; descendant skipped.\n\nprefigure-descendant-invalid-geometry = { $subject }: non-finite or incomplete geometry; descendant skipped.\n\nprefigure-curve-label-omitted = { $subject }: labels are not supported on converted curve elements; label omitted.\n\nprefigure-curve-unsupported-definition-type = { $subject }: unsupported curve function definition type \'{ $definitionType }\'; descendant skipped.\n\nprefigure-region-flip-functions-unsupported = { $subject }: unsupported flipFunctions attribute on regionBetweenCurves; descendant skipped.\n\nprefigure-region-non-formula-child = { $subject }: only formula-typed child functions are supported on regionBetweenCurves; descendant skipped.\n\n# $labelKind says which family of object carried the label, since the advice\n# is the same but the object is not.\nprefigure-label-position-unsupported =\n { $subject }: unsupported labelPosition \'{ $labelPosition }\' for { $labelKind ->\n [line-family] line-family label\n *[point] point label\n }; default PreFigure alignment used.\n\nprefigure-fill-style-unsupported = { $subject }: fill style \'{ $fillStyle }\' is unsupported by PreFigure; falling back to a solid fill.\n\nprefigure-line-style-unknown = { $subject }: unknown line style \'{ $lineStyle }\' omitted from PreFigure output.\n\nprefigure-marker-style-mapped-to-diamond = { $subject }: marker style \'{ $markerStyle }\' mapped to PreFigure style \'diamond\'.\n\nprefigure-marker-style-unsupported = { $subject }: marker style \'{ $markerStyle }\' is unsupported by PreFigure; default style used.\n\n## PreFigure annotations\n\nannotation-ref-unresolvable = `<annotation>`: invalid `ref`; cannot resolve target. Annotation omitted.\n\nannotation-ref-multiple-targets = `<annotation>`: `ref` resolved to multiple targets; using the first target.\n\nannotation-ref-outside-graph = `<annotation>`: invalid `ref`; target is outside the containing graph. Annotation omitted.\n\nannotation-ref-unsupported-target = `<annotation>`: invalid `ref`; target is not a supported graphical object in prefigure conversion. Annotation omitted.\n\nannotation-text-missing = `<annotation>`: missing or empty `text`; emitting empty text.\n\n## Composites and references\n\n# $componentType is the type the composite was asked to create, when it is\n# known; `none` when the composite did not say.\ncomposite-circular-dependency =\n { $componentType ->\n [none] Circular dependency detected.\n *[other] Circular dependency detected involving `<{ $componentType }>` component.\n }\n\n# $reference is the reference as the author wrote it, already carrying its `$`.\nreference-no-referent = No referent found for reference: `{ $reference }`\n\nreference-multiple-referents = Multiple referents found for reference: `{ $reference }`\n\n## Children that do not match\n\nchildren-invalid-attribute-format = Invalid format for attribute { $attribute } of `<{ $componentType }>`.\n\n# $children is the list of child types that did not match, already joined.\nchildren-invalid = Invalid children for `<{ $componentType }>`: Found invalid children: { $children }\n\n## Falling back to a default\n\n# The attribute had a default to fall back to, and the message names it: the\n# component went on to behave as though the author had written that value, and\n# an author not told which one goes looking for the difference in the wrong\n# place.\nattribute-value-invalid-using-default = Invalid value `{ $value }` for attribute `{ $attribute }`, using value `{ $default }`\n\n# The same rejection where the attribute has no default to fall back to, so\n# nothing stood in for the value and the component behaves as though the\n# attribute had not been written. A separate message rather than the one above\n# with a blank in it: "using value `null`" would describe a substitution that\n# did not happen, and name a value no author could have typed. What follows is\n# usually a second message from the component itself, saying what it did\n# without the attribute.\nattribute-value-invalid-ignoring = Invalid value `{ $value }` for attribute `{ $attribute }`, ignoring it\n\n## Loading a DoenetML version\n\n# $fallback is the version that will be used instead, or `none` when the\n# embedding page named a standalone bundle of its own.\ndoenetml-version-not-found =\n { $fallback ->\n [none] DoenetML version { $version } not found.\n *[other] DoenetML version { $version } not found. Falling back to version { $fallback }\n }\n\n## Reading the DoenetML\n\n# The parser\'s own diagnostics: what the author sees before anything runs, and\n# for a beginner usually the first Doenet message they ever read.\n#\n# The parser writes its English beside the code rather than rendering it from\n# here, because `@doenet/parser` is inside the language-server bundle and a\n# catalog there is dead weight on the editor\'s critical path\n# (`packages/lsp/scripts/check-server-bundle.mjs` fails if one arrives). The\n# two copies are held together by a test in that package, which parses a\n# corpus and asserts every coded error renders to exactly what the parser\n# wrote — so a message edited here without its counterpart fails there.\n#\n# $tag, $value, $attribute and their relatives quote the author\'s own source\n# back at them and stay exactly as written. The `Invalid DoenetML: ` opening is\n# repeated in each message instead of being a shared term: a term a locale\n# forgets to define renders as its own name, and a prefix on fifteen messages\n# is not worth that failure mode.\n\nparse-invalid-doenetml = Invalid DoenetML: { $content }\n\nparse-tag-missing-close-tag = Invalid DoenetML: The tag `{ $tag }` has no closing tag. Expected a self-closing tag or a `</{ $tagName }>` tag.\n\nparse-tag-error = Invalid DoenetML: Error in tag `<{ $tagName }>`\n\nparse-attribute-missing-value = Invalid DoenetML: Invalid attribute `{ $attribute }` appears to be missing a value.\n\nparse-attribute-invalid = Invalid DoenetML: Invalid attribute `{ $attribute }`\n\nparse-attribute-value-invalid = Invalid DoenetML: Invalid attribute value `{ $value }`\n\n# $quote is the quote character that would balance the pair: `"` or `\'`.\nparse-attribute-value-quote-mismatch = Invalid DoenetML: Invalid attribute value `{ $value }`. The quote marks do not match. You appear to be missing a `{ $quote }`\n\nparse-open-tag-name-missing = Invalid DoenetML: Found a tag without a tag name, e.g. `<`\n\nparse-tag-not-closed = Invalid DoenetML: Tag `{ $tag }` was not closed (a `>` appears to be missing).\n\nparse-self-closing-tag-name-missing = Invalid DoenetML: Found a tag without a tag name `<{ $content }>`\n\nparse-self-closing-tag-not-closed = Invalid DoenetML: Tag `{ $tag }` was not closed (`/>` appears to be missing).\n\nparse-tag-invalid-attributes = Invalid DoenetML: Tag `{ $tag }` is not valid. It may have incorrect attributes.\n\nparse-close-tag-name-missing = Invalid DoenetML: Found a closing tag without a tag name, e.g. `</`\n\n# $attribute is the attribute name and $value the unquoted token that followed\n# it, shown reassembled the way the author should have written it.\nparse-attribute-value-unquoted = Attribute values must be enclosed in quotes: `{ $attribute }="{ $value }"`\n\nparse-close-tag-without-open-tag = Invalid DoenetML: Found closing tag `{ $tag }`, but no corresponding opening tag\n\nparse-close-tag-mismatched = Invalid DoenetML: Mismatched closing tag. Expected `</{ $expected }>`. Found `{ $found }`\n\n# The conversion\'s fall-through: the syntax tree held a node shape it has no\n# case for. Reaching an author means the grammar and the conversion have gone\n# out of step, which is a bug in Doenet rather than in their document — hence\n# `parser-` rather than the `parse-` of every message above, which is about\n# what the author wrote. They are still the one looking at it, so it is\n# translated like any other error. $node is the node\'s own name and stays as\n# it is.\nparser-node-unconvertible = Could not convert node { $node } to Dast node.\n\n## Names\n\n# $reason says which rule the name broke, as a key rather than a phrase, so the\n# whole sentence is translatable rather than assembled from two halves.\nname-attribute-invalid =\n Invalid attribute name=\'{ $name }\'. { $reason ->\n [characters] Names can contain only letters, numbers, underscores or hyphens.\n *[start] Names must start with a letter.\n }\n\ncomponent-name-invalid-start = Invalid component name "{ $name }". Names must start with a letter.\n\n## `<answer>` sugar\n\nanswer-video-watched-missing-video = Answer with type videoWatched must have a video attribute\n\nanswer-video-watched-video-not-reference = Answer with type videoWatched must have video attribute that is a reference\n\nanswer-name-not-single-text = Answer name attribute must have a single text child\n\n## Referencing another document\n\n# $attribute is the attribute the URI was written in (`copyFrom`, `extend`, …)\n# and stays as written; $uri is the author\'s own value.\n\nexternal-doenetml-recursion-limit = Unable to retrieve external DoenetML due to too many levels of recursion. Is there a circular reference?\n\nexternal-doenetml-unavailable = Unable to retrieve DoenetML from { $attribute }="{ $uri }"\n\nexternal-doenetml-type-mismatch = Invalid DoenetML retrieved from { $attribute }="{ $uri }": it did not match the component type "{ $componentType }"\n\n## Deprecated syntax\n\n# $from and $to are attribute names and $component a tag name; all three stay\n# as written. $component is `none` for a rename that applies to every component\n# accepting the attribute, where naming one would be wrong.\n#\n# The `[deprecation]` opening is a literal marker shared by all four messages,\n# not a word: leave it as it is.\n\ndeprecated-attribute-renamed =\n { $component ->\n [none] [deprecation] Attribute `{ $from }` is deprecated; use `{ $to }` instead.\n *[other] [deprecation] Attribute `{ $from }` on `<{ $component }>` is deprecated; use `{ $to }` instead.\n }\n\ndeprecated-attribute-renamed-conflict =\n { $component ->\n [none] [deprecation] Attribute `{ $from }` is deprecated and ignored because `{ $to }` is also specified.\n *[other] [deprecation] Attribute `{ $from }` on `<{ $component }>` is deprecated and ignored because `{ $to }` is also specified.\n }\n\ndeprecated-attribute-ignored = [deprecation] Attribute `{ $attribute }` on `<{ $component }>` is deprecated and ignored.\n\n# An attribute replaced by a child element rather than by another attribute:\n# $attribute and $component stay as written, and so does $child, which is the\n# tag name of the child to write instead.\n\ndeprecated-attribute-to-child = [deprecation] Attribute `{ $attribute }` on `<{ $component }>` is deprecated; use a `<{ $child }>` child instead.\n\n# One value of an attribute is deprecated while the attribute itself stays:\n# $value is what the author wrote and $to what to write instead, with\n# $attribute and $component naming where. All four stay as written.\n\ndeprecated-attribute-value-renamed = [deprecation] Value `{ $value }` of attribute `{ $attribute }` on `<{ $component }>` is deprecated; use `{ $to }` instead.\n\n\n## Language coverage\n\n# `<pluralize>` runs an English part-of-speech model over its text and puts the\n# nouns in the plural. There is no equivalent for an arbitrary language — a\n# correct plural needs that language\'s own morphology, and often its\n# dictionary — so in a document written in anything else the word is left as\n# the author typed it, and this says so rather than silently doing nothing.\n#\n# Raised only when there is nothing else to fall back on: a `pluralForm` is the\n# author supplying their own language\'s plural, and that is honored in every\n# language, which is why this can recommend it.\n#\n# $locale is the document\'s language tag, as declared.\npluralize-english-only = `<pluralize>` can only pluralize English, so its text is left unchanged in a document written in { $locale }. Write the plural form directly, or set it with the `pluralForm` attribute.\n\n\n## Checking against the schema\n\n# What the editor draws a squiggle under: the language server\'s own check of\n# the document against the DoenetML schema, run on every keystroke and\n# answered before anything is evaluated. A beginner meets these first, and\n# usually only these, because a document that does not pass them rarely gets\n# as far as producing a diagnostic from the core.\n#\n# `@doenet/lsp-tools` writes its English beside the code rather than rendering\n# it from here, for the same reason `@doenet/parser` does: it is inside the\n# language-server bundle, which `@doenet/codemirror` embeds verbatim and\n# starts as a blob worker, and a catalog on the editor\'s critical path is what\n# `packages/lsp/scripts/check-server-bundle.mjs` exists to reject. The two\n# copies are held together by a test in that package, which runs the checker\n# over a corpus and asserts every coded violation renders to exactly what the\n# checker wrote — so a message edited here without its counterpart fails\n# there.\n#\n# $tag, $parent and $attribute quote the author\'s own source back at them and\n# stay exactly as written; the angle brackets and backticks around them are\n# punctuation this catalog supplies, not part of the name.\n\nschema-element-unrecognized = Element `<{ $tag }>` is not a recognized Doenet element.\n\nschema-element-not-allowed-at-root = Element `<{ $tag }>` is not allowed at the root of the document.\n\nschema-element-not-allowed-inside = Element `<{ $tag }>` is not allowed inside of `<{ $parent }>`.\n\nschema-attribute-unrecognized = Element `<{ $tag }>` doesn\'t have an attribute called `{ $attribute }`.\n\n# $allowed is the attribute\'s permitted values, each already in double quotes\n# and joined for the reader\'s language. $isList says whether the attribute\n# takes several of them at once: one situation, two sentences, because the\n# reader has to be told they are choosing a whole list rather than a value.\nschema-attribute-value-not-allowed =\n { $isList ->\n [true] Attribute `{ $attribute }` of element `<{ $tag }>` must be a list whose items are each one of: { $allowed }\n *[other] Attribute `{ $attribute }` of element `<{ $tag }>` must be one of: { $allowed }\n }\n\n\n## The `<select>` family\'s error boxes\n##\n## The messages that replace the whole component with a red box rather than\n## warning beside it: nothing can be selected, so there is nothing to render.\n## They were the last uncoded `_error` path in the worker (#1581).\n##\n## Counts arrive as numbers rather than as text, so a language that agrees a\n## noun with them can select on them. English does not agree here — it says\n## "1 options" today and these messages reproduce it exactly, because the box\'s\n## text is what the existing suites pin.\n##\n## Being numbers, they are grouped: a count of 1500 renders as "1,500" in\n## English where the concatenated sentence these replaced wrote "1500". That is\n## the one way the English moved, and it moved in the right direction — these\n## are quantities, not identifiers like a line or a section number, which is\n## the distinction that decides between a number and a string everywhere in\n## these catalogs.\n##\n## Translators: component and attribute names — `selectFromSequence`,\n## `selectPrimeNumbers`, `from`, `to`, `step` — are DoenetML identifiers, not\n## words. They are written into these messages as they stand and must be left\n## in English exactly as written.\n\nselect-variant-name-option-count-mismatch = Invalid variant name for select. Variant name { $variantName } appears in { $numOptions } options but number to select is { $numToSelect }.\n\nselect-variant-name-without-options = Some variants are specified for select but no options are specified for possible variant name: { $variantName }.\n\nselect-variant-name-not-possible = Variant name { $variantName } that is specified for select is not a possible variant name.\n\nselect-too-few-options = Cannot select { $numToSelect } components from only { $numOptions }.\n\nselect-from-sequence-too-few-values = Cannot select { $numToSelect } values from a sequence of length { $length }.\n\nselect-from-sequence-indices-count-mismatch = Number of indices specified for select must match number to select\n\nselect-from-sequence-indices-not-integers = All indices specified for select must be integers\n\nselect-from-sequence-index-excluded = Specified index of selectfromsequence that was excluded\n\nselect-from-sequence-indices-excluded-combination = Specified indices of selectfromsequence that was an excluded combination\n\nselect-from-sequence-coprime-not-positive-integers = Cannot select coprime combinations as not selecting positive integers.\n\n# Translators: from, to and step are attribute names. They are written into\n# the message rather than passed in because these three never vary — an\n# argument is for a name that changes from one call to the next.\nselect-from-sequence-coprime-common-factor = Cannot select coprime numbers. All possible values share a common factor. (Specified values of "from" or "to" must be coprime with "step".)\n\nselect-from-sequence-coprime-single-number = Cannot select coprime combinations from a single number that is not 1.\n\nselect-from-sequence-excluded-too-many-combinations = Excluded over 70% of combinations in selectFromSequence\n\n# The sibling of `select-from-sequence-coprime-common-factor`, and a different\n# situation rather than a rewording of it: that one is decided up front, from\n# the sequence\'s own arithmetic. This one is what is left after two hundred\n# draws found no coprime combination among values that could have supplied one.\nselect-from-sequence-coprime-none-found = Could not select coprime numbers. All possible values share a common factor.\n\nselect-from-sequence-too-few-unique-values = Cannot select { $numToSelect } unique values from sequence of length { $numPossibleValues }\n\nselect-prime-numbers-too-few-values = Cannot select { $numToSelect } values from a list of primes of length { $numValues }\n\nselect-prime-numbers-values-count-mismatch = Number of values specified for select must match number to select\n\nselect-prime-numbers-values-not-prime = All values specified for select prime number must be in the list of primes\n\nselect-prime-numbers-values-excluded-combination = Specified values of selectPrimeNumbers was an excluded combination\n\nselect-prime-numbers-excluded-too-many-combinations = Excluded over 70% of combinations in selectPrimeNumbers\n\n# Both flukes are shared by `<selectFromSequence>` and `<selectPrimeNumbers>`,\n# which say the same thing in the same words. Neither is reachable in practice\n# — each follows two hundred independent draws — but an unreachable box is\n# still a box, and it renders in whatever language the rest of the page does.\nselect-random-combination-fluke = By extremely unlikely fluke, couldn\'t select combination of random values\n\nselect-random-value-fluke = By extremely unlikely fluke, couldn\'t select random value\n\n## Inputs embedded in math\n\n# Translators: $component is the input\'s own DoenetML tag and stays in English,\n# as do the attribute names `inline`, `expanded` and `width`. An input written\n# inside `<m>` is drawn in the place it is written, inside the typeset\n# expression, which makes room for it as it grows. That needs a control small\n# enough to sit in a line of mathematics, with a width the expression can\n# measure, in an expression that is not drawn on a graph; $reason says which of\n# those this input fails. When it fails, the input is not shown at all, and the\n# expression is typeset with the input\'s value in its place — a text input\'s\n# text, a math input\'s mathematics — or with nothing there for a choice input.\nmath-embedded-input-shape-unsuitable =\n { $reason ->\n [not-inline] This `<{ $component }>` is not shown because it is inside math and is not `inline`. Add `inline` so it becomes a drop-down list, which fits inside an expression.\n [expanded] This `<{ $component }>` is not shown because it is inside math and is `expanded`. Remove `expanded`; a multi-line box does not fit inside an expression.\n [on-graph] This `<{ $component }>` is not shown because it is inside math drawn on a graph, which has no room for an input.\n *[relative-width] This `<{ $component }>` is not shown because it is inside math and has a relative width. Give the width in absolute units, such as `px`, instead.\n }\n\n## `<sampleRandomNumbers>` and `<selectRandomNumbers>`\n##\n## Translators: `mean`, `standardDeviation`, `variance`, `numTotal`,\n## `numSuccesses`, `numDraws`, `numTrials`, `probability` and `numSamples` are\n## DoenetML attribute names. They are written into these messages as they stand\n## and must be left in English exactly as written. Each of these names the\n## attribute the author has to change, so a message that translated one would\n## point at an attribute that does not exist.\n\n# The spread reaches the sampler as a standard deviation however it was written,\n# so a negative `variance` arrives here as a `standardDeviation` of NaN and the\n# message has to name both for the author to know what to edit.\nsample-gaussian-parameters-invalid =\n Invalid mean ({ $mean }) or standardDeviation ({ $standardDeviation }) for a gaussian random variable. The mean must be a finite number, and the standardDeviation (or the variance it is derived from) must be finite and non-negative. No numbers can be sampled.\n\n# These three attributes are the only ones with no default, so leaving one out is\n# the commonest way to reach this message. Each arrives either as the number the\n# author wrote or as `not-set` for an attribute they left off entirely; translate\n# the "not set" wording, but leave the `not-set` key that selects it untouched.\nsample-hypergeometric-parameters-invalid =\n Invalid numTotal ({ $numTotal ->\n [not-set] not set\n *[other] { $numTotal }\n }), numSuccesses ({ $numSuccesses ->\n [not-set] not set\n *[other] { $numSuccesses }\n }), or numDraws ({ $numDraws ->\n [not-set] not set\n *[other] { $numDraws }\n }) for a hypergeometric random variable. numTotal must be a positive whole number, and numSuccesses and numDraws must be non-negative whole numbers no larger than numTotal. All three must also stay below about nine quadrillion, past which whole numbers can no longer be counted exactly.\n\n# $maxDraws is the largest number of random draws allowed for a single sample.\nsample-hypergeometric-draws-too-many =\n Drawing { $numDraws } items from a population of { $numTotal } would need more than { $maxDraws } random draws for each sample, which would stop the page from responding. Reduce numDraws, or bring it closer to numTotal.\n\nsample-binomial-parameters-invalid =\n Invalid numTrials ({ $numTrials }) or probability ({ $probability }) for a binomial random variable. numTrials must be a non-negative whole number below about nine quadrillion, past which whole numbers can no longer be counted exactly, and probability must be between 0 and 1.\n\n# $maxDraws is the largest number of random draws allowed for a single sample.\nsample-binomial-trials-too-many =\n Running { $numTrials } trials would need more than { $maxDraws } random draws for each sample, which would stop the page from responding. Reduce numTrials.\n\nsample-poisson-mean-invalid =\n Invalid mean ({ $mean }) for a poisson random variable. The mean must be a finite, non-negative number.\n\n# $maxDraws is the largest number of random draws allowed for a single sample.\nsample-poisson-mean-too-large =\n A poisson mean of { $mean } would need more than { $maxDraws } random draws for each sample, which would stop the page from responding. Reduce the mean.\n\n# $distribution names the distribution being sampled, e.g. "binomial" or\n# "multivariate hypergeometric"; $draws is roughly how many random draws each value\n# needs. Raised by `<sampleRandomNumbers>`, `<selectRandomNumbers>` and\n# `<sampleMultivariateRandomNumber>`, which count values with `numSamples`,\n# `numToSelect` and one vector respectively, so the wording names no attribute.\nsample-distribution-slow =\n Each value from this { $distribution } distribution needs about { $draws } random draws, so sampling may be slow. Reduce the distribution\'s parameters, or ask for fewer values, if the page feels sluggish.\n\n## List index operators\n\n# Raised by the index-returning list operators (`<indexOf>`, `<searchSorted>`)\n# when no `target` was given. $component names the tag the author wrote.\nindex-operator-missing-target =\n `{ $component }` has no `target` to look for, so it cannot report a position and gives 0.\n\n# Raised when the operator had no values to look through — an empty list, or one\n# whose only children were references that produced nothing.\nindex-operator-no-values =\n `{ $component }` has no values to look through, so it gives 0, which is not the index of any item.\n## `<sampleMultivariateRandomNumber>`\n##\n## Translators: `type`, `numInCategories` and `numDraws` are DoenetML attribute\n## names, and `hypergeometric` is one of the values `type` takes. They are written\n## into these messages as they stand and must be left in English exactly as\n## written. Each names the attribute the author has to change, so a message that\n## translated one would point at an attribute that does not exist.\n\n# Neither attribute has a default that names a population — numDraws has none at\n# all, and numInCategories falls back to a list with no categories in it — so\n# leaving one out is the commonest way to reach this message. Each arrives either\n# as the value the author wrote or as `not-set`: for numDraws when it is missing,\n# and for numInCategories when it names no categories, whether it was left off or\n# written empty. Translate the "not set" wording, but leave the `not-set` key that\n# selects it untouched.\nsample-multivariate-parameters-invalid =\n Invalid numInCategories ({ $numInCategories ->\n [not-set] not set\n *[other] { $numInCategories }\n }) or numDraws ({ $numDraws ->\n [not-set] not set\n *[other] { $numDraws }\n }) for a multivariate hypergeometric random variable. numInCategories must list at least one category, each a non-negative whole number, and numDraws must be a non-negative whole number no larger than their total. Each category, that total, and numDraws must also stay below about nine quadrillion, past which whole numbers can no longer be counted exactly.\n\n# $maxDraws is the largest number of random draws allowed for a single sample.\n# Drawing nearly the whole population is as cheap as drawing almost none of it, so\n# raising numDraws is a fix as well as lowering it. "could need" rather than "would\n# need": each category is counted at the most its draw could cost, so the count\n# these parameters are refused on is an upper bound on the work they really take.\nsample-multivariate-draws-too-many =\n Drawing { $numDraws } items from a population of { $numTotal } split into { $numCategories } categories could need more than { $maxDraws } random draws for each sample, which would stop the page from responding. Reduce numDraws, bring it closer to numTotal, or use fewer categories.\n\n# `type` has no default, so this is what leaving it off gets. A type the attribute\n# does not recognize falls back to no type at all and reaches this message too,\n# after a separate one naming the value that was rejected — hence "no distribution\n# was named" rather than wording that assumes the attribute is missing.\nsample-multivariate-type-not-specified =\n No multivariate distribution was named for this random variable, so nothing was sampled. Give the type attribute the name of a distribution, such as `type="hypergeometric"`.\n\n## Counting operators\n\n# Raised by `<tally>` when the author named `categories` explicitly and some\n# values matched none of them, so those values were not counted anywhere. Info\n# rather than a warning: a list fed by an input legitimately holds\n# non-categories while a student is typing. It deliberately does not say how\n# many such values there were: the diagnostics queue is append-only and\n# deduplicates by message, so a count would leave one permanent entry behind\n# for every number of stray values the list passed through while being typed.\ntally-values-outside-categories =\n Some values matched none of the declared categories, so they were not counted.\n\n# Raised by `<tally>` when `categories` names the same category more than once.\n# A warning rather than info: unlike a stray value, a repeated category is a\n# property of what the author wrote, so it stays true of a settled document. The\n# message says what the counts will be, since the behavior is defensible but not\n# what an author who repeated a category by accident expects.\ntally-repeated-category =\n `categories` names the same category more than once. Each count reports the values equal to its own category, so the repeated ones all report the same number.\n\n# Raised by `<binCounts>` when no `bins` attribute was given, so there are no\n# intervals to count into. $component names the tag the author wrote.\nbin-counts-missing-bins =\n `{ $component }` has no `bins` cut points, so there are no intervals to count into and it gives no counts.\n\n# Raised by `<binCounts>` when `bins` held fewer than the two cut points needed\n# to define a single interval. $count is how many were given, and can be 0 or 1,\n# so the sentence is worded to read for both without forking on the number.\nbin-counts-too-few-cut-points =\n `bins` needs at least 2 cut points to define an interval, but received { $count }.\n\n# Raised by `<binCounts>` when its values are not all numeric, so they cannot be\n# placed between numeric cut points. $component names the tag the author wrote.\nbin-counts-values-not-numeric =\n `{ $component }` can only count numeric values into bins, but not every value it was given is numeric. All counts are 0.\n\n# Raised by `<binCounts>` when the `bins` cut points do not climb: one is\n# smaller than the one before it, so a bin would run backwards and its count\n# would come out negative, or one is not a number at all, which has the same\n# effect. Equal adjacent cut points are accepted, so the message says "at least\n# as large as" rather than "increasing": what is rejected is a decrease, not a\n# failure to strictly increase. Between two interior cut points that names an\n# empty bin; at either end the outermost-edge rule can still put a value in it.\nbin-counts-cut-points-decreasing =\n Each `bins` cut point must be a number at least as large as the one before it, but one is not a number or is smaller than its predecessor, so no counts were produced.\n\n## Charts\n\n# Raised by `<chart type="bar">` when a value is not a finite number, so it gets\n# no bar. The alternative reading of a missing bar is a value of zero, which the\n# author cannot distinguish by looking, so the absence is stated rather than left\n# to be inferred. No count: the queue is append-only and deduplicates by message,\n# and the number of such values changes as an input is typed into. (The message\n# key is `bar-chart-…` because a code names one situation forever and this one\n# was issued while the component was still spelled `<barChart>`.)\nbar-chart-values-not-drawable =\n A bar chart draws no bar for a value that is not a finite number, so those places on the chart are empty rather than zero.\n\n# Raised by `<chart type="bar">` when `barWidth` is outside the (0, 1] range a\n# fraction of a bar\'s slot can take. $barWidth is what the author wrote.\nbar-chart-bar-width-invalid =\n `barWidth` must be greater than 0 and at most 1, but { $barWidth } was given. Using 0.8 instead.\n\n# `type` has no default, so this is what `<chart>` on its own gets. A type the\n# attribute does not recognize falls back to no type at all and reaches this\n# message too, after a separate one naming the value that was rejected — hence\n# "no chart type was named" rather than wording that assumes the attribute is\n# missing.\nchart-type-not-specified =\n No chart type was named, so nothing was drawn. Give the type attribute the name of a chart, such as `type="bar"`.\n\n# Raised by `<chart>` when values are written beside its `<series>` children.\n# A value outside every series belongs to no group of the data, so there is no\n# place on the chart to draw it; saying so matters because the alternative\n# reading of the missing bar is that the value was zero.\nchart-values-outside-series =\n A chart with `<series>` children draws only the values inside them, so values written beside a series were not drawn. Move them into a series of their own.\n';
|
|
38635
|
+
const diagnostics = '# Errors and warnings surfaced to the reader or author. Produced by the worker\n# but addressed to whoever is looking at the screen, so these are selected by\n# `uiLocale`, not `documentLocale`.\n#\n# Message ids are lower-kebab-case Fluent identifiers, optionally with a\n# single `.attribute` suffix (`invalid-attribute-value`).\n#\n# Reached by stable diagnostic code rather than by a literal `t("key")` call:\n# `DIAGNOSTIC_CODES` in `src/diagnostics.ts` maps `doenet-w0001` to the id\n# below, and `lint:i18n` treats that registry as the call site. Adding a\n# message here without registering a code for it fails the lint as an orphan.\n#\n# Translators: `through`, `endpoint`, `midpointOffset`, `numDimensions` and the\n# like are DoenetML attribute names. They are part of the language, not prose,\n# and must be left in English exactly as written.\n\n## `<lineSegment>`\n\n# $attributes is a list of attribute names; $attributesCount is its length.\nline-segment-attributes-ignored-with-endpoints =\n { $attributesCount ->\n [one] { $attributes } is ignored when two endpoints are specified\n *[other] { $attributes } are ignored when two endpoints are specified\n }\n\n# $attributes is a list of attribute names; $attributesCount is its length.\nline-segment-attributes-ignored-with-endpoint-and-midpoint =\n { $attributesCount ->\n [one] { $attributes } is ignored when an endpoint and a midpoint are both specified\n *[other] { $attributes } are ignored when an endpoint and a midpoint are both specified\n }\n\nline-segment-midpoint-offset-without-midpoint = midpointOffset has no effect without a midpoint\n\n## `<line>`\n\nline-points-undetermined-dimensions = Line through points of undetermined dimensions.\n\nline-points-too-few-dimensions = Line must be through points of at least two dimensions.\n\n# $variables is a bare enumeration of variable names, not an "and" list.\nline-points-depend-on-variables = Line is through points that depend on variables: { $variables }.\n\nline-equation-invalid-format = Invalid format for equation of line in variables { $variable1 } and { $variable2 }.\n\n## `<ray>`\n\nray-overprescribed-through = Ray is prescribed by through, endpoint, and direction. Ignoring specified through.\n\nray-dimension-mismatch = numDimensions mismatch in ray.\n\n## `<vector>`\n\nvector-overprescribed-head = Vector is prescribed by head, tail, and displacement. Ignoring specified head.\n\nvector-dimension-mismatch = numDimensions mismatch in vector.\n\n## Attracting and constraining\n\n# $component is the DoenetML tag of the child that was named, e.g. "polygon".\nattract-to-without-nearest-point = Cannot attract to a `<{ $component }>` as it doesn\'t have a nearestPoint state variable.\n\nconstrain-to-without-nearest-point = Cannot constrain to a `<{ $component }>` as it doesn\'t have a nearestPoint state variable.\n\nconstrain-to-interior-without-nearest-point = Cannot constrain to interior of a `<{ $component }>` as it doesn\'t have a nearestPoint state variable.\n\n## `<choiceInput>`\n\n# Translators: `labelPosition` is an attribute name and stays in English.\nchoice-input-label-position-ignored = labelPosition is ignored for non-inline choiceInput\n\n## Ordering children by index\n##\n## These name the component in prose rather than as a tag, matching how the\n## messages have always read. The component names stay in English; the nouns\n## around them are prose and should be translated.\n\nchoice-input-indices-count-mismatch = Ignoring indices specified for choiceInput as number of indices doesn\'t match number of choice children.\n\npretzel-indices-count-mismatch = Ignoring indices specified for problem as number of indices doesn\'t match number of problem children.\n\nshuffle-indices-count-mismatch = Ignoring indices specified for shuffle as number of indices doesn\'t match number of components.\n\n# $component is `choiceInput`, `pretzel` or `shuffle` — a DoenetML component\n# name, so it stays in English.\nindices-ignored-out-of-range = Ignoring indices specified for { $component } as some indices out of range.\n\npretzel-indices-repeated = Ignoring indices specified for pretzel as some indices are repeated.\n\npretzel-circuit-first-index = Ignoring indices specified for pretzel in circuit mode as the first index must be 1.\n\n## `<shuffle>` and `<sort>`\n\n# $component is `shuffle` or `sort`. These two components accept the same\n# children and fail the same ways, so they share their messages.\nstring-children-need-type = For `<{ $component }>` to work with string children, a `type` attribute must be specified.\n\n# $type is what the author wrote; math, text, number and boolean are attribute\n# values and stay in English.\ninvalid-type-defaulting-to-math = Invalid type { $type } for { $component } component. Must be one of math, text, number, or boolean. Defaulting to math.\n\n# Raised when `type` names something that is not one of the four readings. The\n# value is dropped rather than replaced by a guess, so the children are read as\n# though no type had been written. $type is what the author wrote.\ninvalid-type-ignored =\n Invalid type { $type } for { $component } component. Must be one of math, text, number, or boolean. Ignoring it and reading the values as though no type had been given.\n\n# $value is the string child that could not be used.\nstring-not-valid-component-to-arrange = String "{ $value }" is not a valid component to { $component }. Ignoring.\n\n## Types and variables\n\ninvalid-type-defaulting-to-number = Invalid type { $type }, setting type to number.\n\ninvalid-variable-value = Invalid value of a variable: `{ $value }`\n\n## Variants\n\n# $index is what the author wrote, reproduced verbatim rather than as a number:\n# it reached this message precisely because it was not one.\nvariant-index-must-be-number = Variant index { $index } must be a number\n\nvariant-index-must-be-integer = Variant index { $index } must be an integer\n\n## `<sideBySide>`\n\n# $component is `sideBySide` or `sbsGroup`.\nside-by-side-absolute-widths = `<{ $component }>` is not implemented for absolute measurements. Setting widths to relative.\n\nside-by-side-absolute-margins = `<{ $component }>` is not implemented for absolute measurements. Setting margins to relative.\n\nside-by-side-no-block-child = Invalid `<{ $component }>`: it must have at least one block child.\n\n## `<label>`\n\n# Translators: `for` is an attribute name and stays in English.\nlabel-for-ignored-on-graphical = The `for` attribute on graphical `<label>` is ignored.\n\nlabel-for-must-resolve-to-one = The `for` attribute on `<label>` must resolve to exactly one component.\n\nlabel-for-unresolved = The `for` attribute on `<label>` could not be resolved to a component.\n\nlabel-for-answer-with-authored-inputs = The `for` attribute on `<label>` references an `<answer>` with explicitly authored inputs; reference the input directly.\n\nlabel-for-answer-without-input = The `for` attribute on `<label>` references an `<answer>` without an input to label.\n\nlabel-for-must-reference-input-or-answer = The `for` attribute on `<label>` must reference an input or an answer.\n\n## Accessibility\n\n# $component is a DoenetML tag, e.g. "graph" or "image".\naccessibility-short-description-or-decorative = For accessibility, `<{ $component }>` must either have a short description or be specified as decorative.\n\naccessibility-video-short-description = For accessibility, `<video>` must have a short description.\n\naccessibility-input-short-description-or-label = For accessibility, `<{ $component }>` must have a short description or a label.\n\n# The companion to the message above, for the input an `<answer>` creates on the\n# author\'s behalf. Two messages rather than one with the subject passed in: the\n# subject is a phrase here, not a name, and a phrase handed over as an argument\n# would never reach a translator.\naccessibility-answer-input-short-description-or-label = For accessibility, an `<answer>` creating an input must have a short description or a label.\n\naccessibility-short-description-contains-math = Short descriptions should not contain math components such as `<{ $component }>`. Spell out any math with words.\n\n# $colorName is an attribute name and stays in English. $ratio and $threshold\n# are contrast ratios; $mode says which theme the shortfall was measured in,\n# and is `dark` or `light`.\naccessibility-section-title-insufficient-contrast =\n { $mode ->\n [dark] { $colorName } has insufficient contrast for the section heading text (dark mode) ({ NUMBER($ratio, minimumFractionDigits: 2, maximumFractionDigits: 2) }:1; requires at least { $threshold }:1).\n *[other] { $colorName } has insufficient contrast for the section heading text ({ NUMBER($ratio, minimumFractionDigits: 2, maximumFractionDigits: 2) }:1; requires at least { $threshold }:1).\n }\n\n## `<circle>`\n\n# $count is the number of through points.\ncircle-through-points-non-numerical = Haven\'t implemented `<circle>` through { $count } points in case where the points don\'t have numerical values.\n\ncircle-too-many-through-points = Cannot calculate circle through more than 3 points.\n\ncircle-overprescribed-radius-center-points = Cannot calculate circle with specified radius, center and through points.\n\ncircle-center-with-multiple-points = Cannot calculate circle with specified center through more than 1 point.\n\n# $distance and $radius arrive as strings, not numbers: $radius is the author\'s\n# own value echoed back for diagnosis, and formatting it as a quantity would\n# round a radius of 0.0001 away to 0.\ncircle-radius-too-small = Cannot calculate circle: given that the distance between the two points is { $distance }, the specified radius { $radius } is too small.\n\ncircle-radius-with-many-points = Cannot create circle through more than two points with a specified radius.\n\ncircle-invalid-center-or-through-points = Invalid center or through points of circle.\n\ncircle-radius-center-with-multiple-points = Cannot calculate radius of circle with specified center through more than 1 point.\n\ncircle-change-radius-non-numerical = Cannot change radius of circle with non-numerical through points\n\ncircle-radius-with-points-non-numerical = Cannot create circle through more than one point with specified radius when don\'t have numerical values.\n\ncircle-change-center-non-numerical = Haven\'t implemented changing center of circle through points with non numerical values.\n\n## `<function>`\n\n# Two independent counts in one sentence, so the variants multiply out. A\n# select\'s variants each need their own line, so the inner one spans lines too;\n# that is safe because newlines inside a placeable never reach the rendered\n# value. Only text continuing onto a further line would.\nfunction-domain-insufficient-dimensions =\n { $intervals ->\n [one] Insufficient dimensions for domain for function. Domain has { $intervals } interval but the function has { $inputs ->\n [one] { $inputs } input\n *[other] { $inputs } inputs\n }.\n *[other] Insufficient dimensions for domain for function. Domain has { $intervals } intervals but the function has { $inputs ->\n [one] { $inputs } input\n *[other] { $inputs } inputs\n }.\n }\n\nfunction-domain-invalid-format = Invalid format for domain for function.\n\n# $type is what was being read off the point. It selects the wording rather\n# than being substituted into it: "maximum", "slope" and the rest are English\n# nouns, and a noun handed over as an argument would never reach a translator.\n# The catch-all reproduces the pre-catalog behavior for a value not listed here.\nfunction-ignoring-non-numerical =\n { $type ->\n [maximum] Ignoring non-numerical maximum of function.\n [minimum] Ignoring non-numerical minimum of function.\n [extremum] Ignoring non-numerical extremum of function.\n [point] Ignoring non-numerical point of function.\n [slope] Ignoring non-numerical slope of function.\n *[other] Ignoring non-numerical { $type } of function.\n }\n\nfunction-ignoring-empty =\n { $type ->\n [maximum] Ignoring empty maximum of function.\n [minimum] Ignoring empty minimum of function.\n [extremum] Ignoring empty extremum of function.\n [point] Ignoring empty point of function.\n *[other] Ignoring empty { $type } of function.\n }\n\nfunction-points-too-close = Function contains two points with locations too close together. Can\'t define function.\n\nfunction-iterates-input-output-mismatch =\n { $inputs ->\n [one] Function iterates are possible only if the number of inputs of the function is equal to the number of outputs. This function has { $inputs } input and { $outputs ->\n [one] { $outputs } output\n *[other] { $outputs } outputs\n }.\n *[other] Function iterates are possible only if the number of inputs of the function is equal to the number of outputs. This function has { $inputs } inputs and { $outputs ->\n [one] { $outputs } output\n *[other] { $outputs } outputs\n }.\n }\n\n## `<sequence>`\n\nsequence-invalid-length = Invalid length of sequence. Must be a non-negative integer.\n\n# $type is a sequence type: number, letters, or math.\nsequence-invalid-step = Invalid step of sequence. Must be a number for sequence of type { $type }.\n\n# $attribute is `from` or `to` — an attribute name, so it stays in English.\nsequence-invalid-endpoint-number = Invalid "{ $attribute }" of number sequence. Must be a number.\n\nsequence-invalid-endpoint-letters = Invalid "{ $attribute }" of letters sequence. Must be a letter combination.\n\nsequence-invalid-endpoint = Invalid "{ $attribute }" of sequence.\n\nselect-from-sequence-coprime-not-numbers = coprime ignored since not selecting numbers\n\nselect-from-sequence-coprime-with-exclude-combinations = coprime ignored since excludeCombinations specified\n\n## Resolving a `target`\n##\n## Raised by the components that take a `target` attribute. They resolve it\n## through the same code and fail the same two ways, so they share these two\n## messages rather than spelling each one out per component: $source is the tag\n## of the component that raised it, part of the DoenetML language, so it stays\n## in English.\n\ntarget-not-found = Invalid target for `<{ $source }>`: cannot find target.\n\n# $property is the state variable that was looked for; $component is the tag it\n# was looked for on.\ntarget-state-variable-not-found = Invalid target for `<{ $source }>`: cannot find a state variable named "{ $property }" on a `<{ $component }>`.\n\n## `<odeSystem>`\n\node-system-variables-match-independent = Variables of `<odeSystem>` must be different than independent variable.\n\node-system-duplicate-variable-names = Can\'t define ODE RHS functions with duplicate dependent variable names.\n\node-system-rhs-function-error = Cannot define ODE RHS function. Error creating mathjs function.\n\n## `<angle>`, `<parabola>`, and `<intersection>`\n\n# $count is how many line children were found.\nangle-too-many-lines = Cannot define an angle between { $count } lines\n\nangle-invalid-through-point = Invalid point in through of `<angle>`\n\nparabola-vertex-too-many-points = Haven\'t implemented parabola with vertex through more than 1 point.\n\nparabola-too-many-points = Haven\'t implemented parabola through more than 3 points.\n\nintersection-too-many-items = Haven\'t implemented intersection for more than two items\n\n## Other math components\n\nionic-compound-not-two-ions = Have not implemented ionic compound for anything other than two ions.\n\nionic-compound-needs-cation-and-anion = Ionic compound implemented only for one cation and one anion.\n\n# $equation is the equation as the author wrote it.\nsolve-equations-cannot-evaluate = Cannot solve equation as could not evaluate equation: { $equation }\n\n# Translators: `operandNumber` is an attribute name and stays in English.\nmath-operators-operand-number-required = Must specify a operandNumber when extracting a math operand.\n\neigen-decomposition-failed = Could not calculate eigenvalues of matrix\n\n## `<matchesPattern>`\n\n# Translators: `parameters` is an attribute name and stays in English.\n# $parameters lists the parameters as the author wrote them;\n# $parametersCount is how many there were.\nmatches-pattern-parameter-not-in-pattern =\n { $parametersCount ->\n [one] `<matchesPattern>`: the parameter { $parameters } does not occur in the pattern, so it will always match a blank.\n *[other] `<matchesPattern>`: the parameters { $parameters } do not occur in the pattern, so they will always match a blank.\n }\n\n## `<graph>`\n\n# Translators: grid is an attribute name and none, medium and dense are its\n# values; all four stay in English, as does the example. $grid is the value the\n# author wrote, reproduced verbatim — it reached this message precisely because\n# it was not one of the forms listed.\ngraph-grid-invalid = `<graph>`: cannot interpret grid="{ $grid }". It must be none, medium, dense, or two positive numbers separated by a space, such as grid="1 0.5". No grid is drawn.\n\n## `<slopeField>` and `<vectorField>`\n\n# $component is the field\'s tag and $alternative the sibling field component\'s,\n# or `none` when the function would not suit it either; both are DoenetML tags\n# and stay in English, as do the example expressions. $expected is how many\n# outputs the component needs, $found how many the given function has. What a\n# field draws a mark from is the function\'s outputs, so the wrong number of\n# them means there is nothing to draw — and the author almost always wanted the\n# other component.\nfield-function-wrong-num-outputs =\n `<{ $component }>` needs a function with { $expected ->\n [one] one output, the slope y\' at each point, such as `y - x`\n *[other] two outputs, the vector at each point, such as `(y, -x)`\n }, but the function it was given has { $found ->\n [one] { $found } output\n *[other] { $found } outputs\n }. { $alternative ->\n [none] Nothing is drawn.\n *[other] `<{ $alternative }>` is the component for that function. Nothing is drawn.\n }\n\n# Translators: retired. `function` is an attribute name and stays in English.\n# It warned that a field had been given its function both as an attribute and\n# inside the component; the attribute no longer exists, so the two can no\n# longer disagree. Kept because diagnostic codes are never reused.\nfield-function-attribute-ignored-with-child = The `function` attribute is ignored because the function is also given inside the component; the one inside is used. Give the function only one of the two ways.\n\n# Translators: `variables` and `function` are a DoenetML attribute and tag and\n# stay in English, as does $component, the field\'s own tag. The attribute names\n# the inputs of an expression written directly inside the component; when there\n# is no such expression there is nothing for it to name, and $reason says which\n# of the two ways that happened.\nfield-variables-ignored =\n `<{ $component }>`: the `variables` attribute names the variables of an expression written directly inside the component. { $reason ->\n [function-child] The function here is given as a `<function>` child, which names its own variables, so `variables` is ignored.\n *[no-expression] No such expression is given here, so `variables` is ignored.\n }\n\n## PreFigure renderer\n\n# Translators: xLabelPosition, yLabelPosition and their values are attribute\n# names and stay in English, as does the renderer\'s name.\nprefigure-x-label-position-unsupported = `<graph>`: xLabelPosition="left" is not supported in prefigure renderer; using right-position behavior.\n\nprefigure-y-label-position-unsupported = `<graph>`: yLabelPosition="bottom" is not supported in prefigure renderer; using top-position behavior.\n\nprefigure-invalid-axis-bounds = `<graph>`: invalid axis bounds for prefigure conversion; using default bbox (-10,-10,10,10).\n\nprefigure-invalid-width = `<graph>`: invalid width for prefigure conversion; using default diagram width 425.\n\nprefigure-invalid-aspect-ratio = `<graph>`: invalid aspectRatio for prefigure conversion; using default aspect ratio 1.\n\n# Translators: the renderer\'s name, prefigure, stays in English. "grid" here is\n# the coordinate grid itself rather than the attribute that asks for one, so it\n# is prose and is translated.\nprefigure-grid-spacing-too-fine = `<graph>`: the grid spacing is too fine for the axis limits; the grid is omitted in the prefigure renderer.\n\nprefigure-annotations-not-rendered = `<graph>`: annotations will not be rendered when not using the PreFigure renderer.\n\nmultiple-annotations-children = Multiple `<annotations>` children found in `<graph>`; all but the last one are ignored.\n\n## Referring to other components\n##\n## `<updateValue>`\'s own "cannot find target" messages are not here: it\n## resolves a target the same way `<animateFromSequence>` does and fails the\n## same ways, so the two share `target-not-found` and\n## `target-state-variable-not-found` above.\n\ncopy-unrecognized-component-type = Cannot extend or copy an unrecognized component type: { $type }.\n\ncopy-prop-not-found = Could not find prop { $property } on a component of type { $component }\n\ncollect-no-source = No source found for collect.\n\ncollect-invalid-component-type = Cannot collect components of type `<{ $component }>` as it is an invalid component type.\n\n# $reference is the reference exactly as the author wrote it, `$` and all —\n# the `$p.styleDescription[1]` of `<text extend="$p.styleDescription[1]" />`.\n# An index only means something applied to an array, and the thing named here\n# is not one. The reference is quoted back rather than explained because the\n# text in front of the author is the only part of this they can act on: the\n# state variable and component index the core knows about are its own business\n# and go to the console instead.\nreference-index-unavailable = Cannot reference index `{ $reference }`\n\n## `<callAction>`\n\n# $action is the `actionName` the author asked for, part of the DoenetML\n# language, so it stays in English. $reference is the `target` as written.\ncomponent-action-unavailable = Cannot call { $action } on component `{ $reference }`\n\n## `<dataFrame>`\n\n# $componentIdx is an internal index, passed as a string so it is not grouped\n# like a quantity; the odd spacing before the colon is reproduced from the\n# original message.\ndata-frame-inconsistent-row-lengths = Data has invalid shape. Rows has inconsistent lengths. Found in componentIdx :{ $componentIdx }\n\ndata-frame-duplicate-column-names = Data has duplicate column names. Found in componentIdx :{ $componentIdx }\n\ndata-frame-missing-column-name = Data is missing a column name. Found in componentIdx :{ $componentIdx }\n\n## `<answer>` and scoring\n\nanswer-award-depends-on-own-response = An award for this answer is based on the answer tag\'s own submitted response, which will lead to unexpected behavior.\n\n# Translators: maxNumAttempts and sectionWideCheckWork are attribute names.\nanswer-max-num-attempts-in-section-wide-check-work = Setting `maxNumAttempts` on an `<answer>` inside a container with `sectionWideCheckWork` has no effect, as the number of attempts is controlled by the container. Set `maxNumAttempts` on the container instead.\n\nnested-section-wide-check-work-max-num-attempts = Setting `maxNumAttempts` on a container with `sectionWideCheckWork` that is inside another container with `sectionWideCheckWork` has no effect, as the number of attempts is controlled by the outer container. Set `maxNumAttempts` on the outer container instead.\n\n# $attributes is a list of attribute names; $attributesCount is its length.\nanswer-attributes-need-symbolic-equality =\n { $attributesCount ->\n [one] The { $attributes } attribute will have no effect without symbolicEquality set.\n *[other] The { $attributes } attributes will have no effect without symbolicEquality set.\n }\n\nanswer-invalid-type = Invalid type for answer: { $type }\n\n## `<module>`, `<conditionalContent>`, `<slider>`, `<pretzel>`\n\nmodule-attribute-child-needs-name = Since the component `<{ $component }>` does not have a name, it cannot be used for a module attribute\n\nmodule-attribute-name-already-defined = The component `<{ $component } name="{ $name }">` cannot be used as an attribute for a module because the `<module>` component type already has a "{ $name }" attribute defined.\n\nconditional-content-condition-ignored = Attribute `condition` is ignored on a `<conditionalContent>` component with case or else children.\n\nslider-markers-type-mismatch = Markers type doesn\'t match slider type.\n\npretzel-problem-needs-statement-and-answer = Invalid pretzel: each `<problem>` must contain one `<statement>` and one `<answer>`.\n\npretzel-circuit-first-problem-distractor = Invalid pretzel: in mode="circuit", the first `<problem>` cannot be a distractor.\n\n## Attribute values\n\n# $values is a list of the values that were rejected, each already in\n# backticks; $valuesCount is how many there were.\nattribute-invalid-values =\n { $valuesCount ->\n [one] Invalid value { $values } for attribute `{ $attribute }`; ignoring.\n *[other] Invalid values { $values } for attribute `{ $attribute }`; ignoring.\n }\n\nattribute-must-be-references = Invalid value `{ $value }` for attribute `{ $attribute }`. Attribute must be composed of references that begin with a `$`.\n\n# $names is a list of the rejected names, each already in single quotes.\nmath-input-invalid-function-names = <mathInput>: ignored invalid function name(s) in { $attribute }: { $names }. Each name\'s display segment must be at least 2 characters (letters or dashes); an optional `|<mathspeak alternative>` suffix may follow.\n\n## Building components from the source\n\n# Raised while the source is being turned into components, by throwing rather\n# than by building a record: the thrower is caught, the component becomes an\n# `_error`, and the diagnostic is re-raised from it.\n\ncomponent-type-invalid = Invalid component type: `<{ $componentType }>`\n\nattribute-repeated = Cannot repeat attribute { $attribute }.\n\nattribute-invalid-for-component = Invalid attribute "{ $attribute }" for a component of type `<{ $componentType }>`.\n\n## Style definition contrast\n\n# $context names the pair being compared, $mode which colour scheme it was\n# rendered in. Both are symbolic — the phrase is chosen here so a translator\n# can rewrite it, rather than being handed over already in English.\nstyle-definition-insufficient-contrast =\n Style definition { $styleNumber } has insufficient contrast for { $context ->\n [text-on-background] text color against background color\n [high-contrast] high-contrast color against the canvas\n [line] line color against the canvas\n [marker] marker color against the canvas\n *[text-on-canvas] text color against the canvas\n }{ $mode ->\n [dark] { " (dark mode)" }\n *[light] { "" }\n } ({ NUMBER($ratio, minimumFractionDigits: 2, maximumFractionDigits: 2) }:1; requires at least { $threshold }:1).\n\n# $suggestion says whether a concrete replacement colour could be computed.\n# The attribute names and colour values in the `available` branch are\n# DoenetML source, not prose, and stay as they are in every language.\nstyle-definition-dark-mode-text-background-contrast =\n Although style definition { $styleNumber } has specified colors that provide sufficient contrast for light mode, the dark-mode colors derived from these values have insufficient contrast for the text color against the background color ({ NUMBER($ratio, minimumFractionDigits: 2, maximumFractionDigits: 2) }:1; requires at least { $threshold }:1). { $suggestion ->\n [available] To ensure sufficient contrast in dark mode, either increase the light-mode contrast (e.g., set { $lightAttribute }="{ $lightColor }") or override the dark-mode color (e.g., set { $darkAttribute }="{ $darkColor }").\n *[none] To ensure sufficient contrast in dark mode, increase the light-mode contrast or override the derived colors with textColorDarkMode and/or backgroundColorDarkMode.\n }\n\nstyle-definition-dark-mode-text-canvas-contrast =\n Although style definition { $styleNumber } has a specified text color that provides sufficient contrast for light mode, the dark-mode text color derived from this value has insufficient contrast against the canvas ({ NUMBER($ratio, minimumFractionDigits: 2, maximumFractionDigits: 2) }:1; requires at least { $threshold }:1). { $suggestion ->\n [available] To ensure sufficient contrast in dark mode, either increase the light-mode contrast (e.g., set textColor="{ $lightColor }") or override the dark-mode color (e.g., set textColorDarkMode="{ $darkColor }").\n *[none] To ensure sufficient contrast in dark mode, increase the light-mode contrast or override the derived color with textColorDarkMode.\n }\n\nsection-multiple-style-palettes = A section can select only one <stylePalette>; using the last one.\n\n## Unique variants\n\n# Explanations of why a component\'s unique variants could not be worked out.\n# $component is the tag that could not be analyzed and stays as written; the\n# reason is a separate message per situation, so a host can tell them apart by\n# code and a translator sees a whole sentence rather than a fragment.\n\nvariant-num-to-select-not-non-negative-integer = cannot determine unique variants of { $component } as numToSelect isn\'t a non-negative integer.\n\nvariant-num-to-select-not-constant-number = cannot determine unique variants of { $component } as numToSelect isn\'t constant number.\n\nvariant-with-replacement-not-constant-boolean = cannot determine unique variants of { $component } as withReplacement isn\'t constant boolean.\n\nvariant-select-weight-disables-unique = Unique variants for select disabled if have an option with selectWeight or selectForVariants specified\n\nvariant-coprime-undetermined = cannot determine unique variants of { $component } as cannot determine coprime is always false.\n\n# $attribute is an attribute name (`from`, `to`, `step`, `sort`, `length`) and\n# stays as written.\nvariant-attribute-not-constant = cannot determine unique variants of { $component } as { $attribute } isn\'t a constant.\n\nvariant-attribute-not-number = cannot determine unique variants of { $component } as { $attribute } isn\'t a number.\n\n# $type is the sequence type the component was declared with. $expected names\n# what the value had to be, symbolically, because which one applies depends on\n# both the type and the attribute.\nvariant-attribute-wrong-type-for-sequence =\n cannot determine unique variants of { $component } of { $type } type as { $attribute } isn\'t { $expected ->\n [letters-combination] a combination of letters\n [math-expression] a valid math expression\n [integer] an integer\n *[number] a number\n }.\n\nvariant-length-not-integer = cannot determine unique variants of { $component } as length isn\'t an integer.\n\nvariant-sort-not-implemented = have not implemented unique variants of a { $component } with sort\n\nvariant-exclude-combinations-not-implemented = have not implemented unique variants of a { $component } with excludeCombinations\n\nvariant-math-exclude-not-implemented = have not implemented unique variants of a { $component } of type math with exclude\n\nvariant-non-constant-exclude-not-implemented = have not implemented unique variants of a { $component } with non-constant exclude\n\n## PreFigure conversion\n\n# $subject identifies the component the warning is about, already written as\n# `<tag>` or `<tag> (name)`. It is composed in code rather than here because\n# Fluent terms cannot take a variable as an argument, so a shared subject\n# fragment cannot be parameterized from the catalog. It holds only a tag name,\n# a component name and punctuation — never a word — which is why a descendant\n# with no type reads `<?>` rather than `<unknown>`.\n\nprefigure-descendant-unsupported = { $subject }: unsupported in graph prefigure renderer; descendant skipped.\n\nprefigure-descendant-invalid-geometry = { $subject }: non-finite or incomplete geometry; descendant skipped.\n\nprefigure-curve-label-omitted = { $subject }: labels are not supported on converted curve elements; label omitted.\n\nprefigure-curve-unsupported-definition-type = { $subject }: unsupported curve function definition type \'{ $definitionType }\'; descendant skipped.\n\nprefigure-region-flip-functions-unsupported = { $subject }: unsupported flipFunctions attribute on regionBetweenCurves; descendant skipped.\n\nprefigure-region-non-formula-child = { $subject }: only formula-typed child functions are supported on regionBetweenCurves; descendant skipped.\n\n# $labelKind says which family of object carried the label, since the advice\n# is the same but the object is not.\nprefigure-label-position-unsupported =\n { $subject }: unsupported labelPosition \'{ $labelPosition }\' for { $labelKind ->\n [line-family] line-family label\n *[point] point label\n }; default PreFigure alignment used.\n\nprefigure-fill-style-unsupported = { $subject }: fill style \'{ $fillStyle }\' is unsupported by PreFigure; falling back to a solid fill.\n\nprefigure-line-style-unknown = { $subject }: unknown line style \'{ $lineStyle }\' omitted from PreFigure output.\n\nprefigure-marker-style-mapped-to-diamond = { $subject }: marker style \'{ $markerStyle }\' mapped to PreFigure style \'diamond\'.\n\nprefigure-marker-style-unsupported = { $subject }: marker style \'{ $markerStyle }\' is unsupported by PreFigure; default style used.\n\n## PreFigure annotations\n\nannotation-ref-unresolvable = `<annotation>`: invalid `ref`; cannot resolve target. Annotation omitted.\n\nannotation-ref-multiple-targets = `<annotation>`: `ref` resolved to multiple targets; using the first target.\n\nannotation-ref-outside-graph = `<annotation>`: invalid `ref`; target is outside the containing graph. Annotation omitted.\n\nannotation-ref-unsupported-target = `<annotation>`: invalid `ref`; target is not a supported graphical object in prefigure conversion. Annotation omitted.\n\nannotation-text-missing = `<annotation>`: missing or empty `text`; emitting empty text.\n\n## Composites and references\n\n# $componentType is the type the composite was asked to create, when it is\n# known; `none` when the composite did not say.\ncomposite-circular-dependency =\n { $componentType ->\n [none] Circular dependency detected.\n *[other] Circular dependency detected involving `<{ $componentType }>` component.\n }\n\n# $reference is the reference as the author wrote it, already carrying its `$`.\nreference-no-referent = No referent found for reference: `{ $reference }`\n\nreference-multiple-referents = Multiple referents found for reference: `{ $reference }`\n\n## Children that do not match\n\nchildren-invalid-attribute-format = Invalid format for attribute { $attribute } of `<{ $componentType }>`.\n\n# $children is the list of child types that did not match, already joined.\nchildren-invalid = Invalid children for `<{ $componentType }>`: Found invalid children: { $children }\n\n## Falling back to a default\n\n# The attribute had a default to fall back to, and the message names it: the\n# component went on to behave as though the author had written that value, and\n# an author not told which one goes looking for the difference in the wrong\n# place.\nattribute-value-invalid-using-default = Invalid value `{ $value }` for attribute `{ $attribute }`, using value `{ $default }`\n\n# The same rejection where the attribute has no default to fall back to, so\n# nothing stood in for the value and the component behaves as though the\n# attribute had not been written. A separate message rather than the one above\n# with a blank in it: "using value `null`" would describe a substitution that\n# did not happen, and name a value no author could have typed. What follows is\n# usually a second message from the component itself, saying what it did\n# without the attribute.\nattribute-value-invalid-ignoring = Invalid value `{ $value }` for attribute `{ $attribute }`, ignoring it\n\n## Loading a DoenetML version\n\n# $fallback is the version that will be used instead, or `none` when the\n# embedding page named a standalone bundle of its own.\ndoenetml-version-not-found =\n { $fallback ->\n [none] DoenetML version { $version } not found.\n *[other] DoenetML version { $version } not found. Falling back to version { $fallback }\n }\n\n## Reading the DoenetML\n\n# The parser\'s own diagnostics: what the author sees before anything runs, and\n# for a beginner usually the first Doenet message they ever read.\n#\n# The parser writes its English beside the code rather than rendering it from\n# here, because `@doenet/parser` is inside the language-server bundle and a\n# catalog there is dead weight on the editor\'s critical path\n# (`packages/lsp/scripts/check-server-bundle.mjs` fails if one arrives). The\n# two copies are held together by a test in that package, which parses a\n# corpus and asserts every coded error renders to exactly what the parser\n# wrote — so a message edited here without its counterpart fails there.\n#\n# $tag, $value, $attribute and their relatives quote the author\'s own source\n# back at them and stay exactly as written. The `Invalid DoenetML: ` opening is\n# repeated in each message instead of being a shared term: a term a locale\n# forgets to define renders as its own name, and a prefix on fifteen messages\n# is not worth that failure mode.\n\nparse-invalid-doenetml = Invalid DoenetML: { $content }\n\nparse-tag-missing-close-tag = Invalid DoenetML: The tag `{ $tag }` has no closing tag. Expected a self-closing tag or a `</{ $tagName }>` tag.\n\nparse-tag-error = Invalid DoenetML: Error in tag `<{ $tagName }>`\n\nparse-attribute-missing-value = Invalid DoenetML: Invalid attribute `{ $attribute }` appears to be missing a value.\n\nparse-attribute-invalid = Invalid DoenetML: Invalid attribute `{ $attribute }`\n\nparse-attribute-value-invalid = Invalid DoenetML: Invalid attribute value `{ $value }`\n\n# $quote is the quote character that would balance the pair: `"` or `\'`.\nparse-attribute-value-quote-mismatch = Invalid DoenetML: Invalid attribute value `{ $value }`. The quote marks do not match. You appear to be missing a `{ $quote }`\n\nparse-open-tag-name-missing = Invalid DoenetML: Found a tag without a tag name, e.g. `<`\n\nparse-tag-not-closed = Invalid DoenetML: Tag `{ $tag }` was not closed (a `>` appears to be missing).\n\nparse-self-closing-tag-name-missing = Invalid DoenetML: Found a tag without a tag name `<{ $content }>`\n\nparse-self-closing-tag-not-closed = Invalid DoenetML: Tag `{ $tag }` was not closed (`/>` appears to be missing).\n\nparse-tag-invalid-attributes = Invalid DoenetML: Tag `{ $tag }` is not valid. It may have incorrect attributes.\n\nparse-close-tag-name-missing = Invalid DoenetML: Found a closing tag without a tag name, e.g. `</`\n\n# $attribute is the attribute name and $value the unquoted token that followed\n# it, shown reassembled the way the author should have written it.\nparse-attribute-value-unquoted = Attribute values must be enclosed in quotes: `{ $attribute }="{ $value }"`\n\nparse-close-tag-without-open-tag = Invalid DoenetML: Found closing tag `{ $tag }`, but no corresponding opening tag\n\nparse-close-tag-mismatched = Invalid DoenetML: Mismatched closing tag. Expected `</{ $expected }>`. Found `{ $found }`\n\n# The conversion\'s fall-through: the syntax tree held a node shape it has no\n# case for. Reaching an author means the grammar and the conversion have gone\n# out of step, which is a bug in Doenet rather than in their document — hence\n# `parser-` rather than the `parse-` of every message above, which is about\n# what the author wrote. They are still the one looking at it, so it is\n# translated like any other error. $node is the node\'s own name and stays as\n# it is.\nparser-node-unconvertible = Could not convert node { $node } to Dast node.\n\n## Names\n\n# $reason says which rule the name broke, as a key rather than a phrase, so the\n# whole sentence is translatable rather than assembled from two halves.\nname-attribute-invalid =\n Invalid attribute name=\'{ $name }\'. { $reason ->\n [characters] Names can contain only letters, numbers, underscores or hyphens.\n *[start] Names must start with a letter.\n }\n\ncomponent-name-invalid-start = Invalid component name "{ $name }". Names must start with a letter.\n\n## `<answer>` sugar\n\nanswer-video-watched-missing-video = Answer with type videoWatched must have a video attribute\n\nanswer-video-watched-video-not-reference = Answer with type videoWatched must have video attribute that is a reference\n\nanswer-name-not-single-text = Answer name attribute must have a single text child\n\n## Referencing another document\n\n# $attribute is the attribute the URI was written in (`copyFrom`, `extend`, …)\n# and stays as written; $uri is the author\'s own value.\n\nexternal-doenetml-recursion-limit = Unable to retrieve external DoenetML due to too many levels of recursion. Is there a circular reference?\n\nexternal-doenetml-unavailable = Unable to retrieve DoenetML from { $attribute }="{ $uri }"\n\nexternal-doenetml-type-mismatch = Invalid DoenetML retrieved from { $attribute }="{ $uri }": it did not match the component type "{ $componentType }"\n\n## Deprecated syntax\n\n# $from and $to are attribute names and $component a tag name; all three stay\n# as written. $component is `none` for a rename that applies to every component\n# accepting the attribute, where naming one would be wrong.\n#\n# The `[deprecation]` opening is a literal marker shared by all four messages,\n# not a word: leave it as it is.\n\ndeprecated-attribute-renamed =\n { $component ->\n [none] [deprecation] Attribute `{ $from }` is deprecated; use `{ $to }` instead.\n *[other] [deprecation] Attribute `{ $from }` on `<{ $component }>` is deprecated; use `{ $to }` instead.\n }\n\ndeprecated-attribute-renamed-conflict =\n { $component ->\n [none] [deprecation] Attribute `{ $from }` is deprecated and ignored because `{ $to }` is also specified.\n *[other] [deprecation] Attribute `{ $from }` on `<{ $component }>` is deprecated and ignored because `{ $to }` is also specified.\n }\n\ndeprecated-attribute-ignored = [deprecation] Attribute `{ $attribute }` on `<{ $component }>` is deprecated and ignored.\n\n# An attribute replaced by a child element rather than by another attribute:\n# $attribute and $component stay as written, and so does $child, which is the\n# tag name of the child to write instead.\n\ndeprecated-attribute-to-child = [deprecation] Attribute `{ $attribute }` on `<{ $component }>` is deprecated; use a `<{ $child }>` child instead.\n\n# One value of an attribute is deprecated while the attribute itself stays:\n# $value is what the author wrote and $to what to write instead, with\n# $attribute and $component naming where. All four stay as written.\n\ndeprecated-attribute-value-renamed = [deprecation] Value `{ $value }` of attribute `{ $attribute }` on `<{ $component }>` is deprecated; use `{ $to }` instead.\n\n\n## Language coverage\n\n# `<pluralize>` runs an English part-of-speech model over its text and puts the\n# nouns in the plural. There is no equivalent for an arbitrary language — a\n# correct plural needs that language\'s own morphology, and often its\n# dictionary — so in a document written in anything else the word is left as\n# the author typed it, and this says so rather than silently doing nothing.\n#\n# Raised only when there is nothing else to fall back on: a `pluralForm` is the\n# author supplying their own language\'s plural, and that is honored in every\n# language, which is why this can recommend it.\n#\n# $locale is the document\'s language tag, as declared.\npluralize-english-only = `<pluralize>` can only pluralize English, so its text is left unchanged in a document written in { $locale }. Write the plural form directly, or set it with the `pluralForm` attribute.\n\n\n## Checking against the schema\n\n# What the editor draws a squiggle under: the language server\'s own check of\n# the document against the DoenetML schema, run on every keystroke and\n# answered before anything is evaluated. A beginner meets these first, and\n# usually only these, because a document that does not pass them rarely gets\n# as far as producing a diagnostic from the core.\n#\n# `@doenet/lsp-tools` writes its English beside the code rather than rendering\n# it from here, for the same reason `@doenet/parser` does: it is inside the\n# language-server bundle, which `@doenet/codemirror` embeds verbatim and\n# starts as a blob worker, and a catalog on the editor\'s critical path is what\n# `packages/lsp/scripts/check-server-bundle.mjs` exists to reject. The two\n# copies are held together by a test in that package, which runs the checker\n# over a corpus and asserts every coded violation renders to exactly what the\n# checker wrote — so a message edited here without its counterpart fails\n# there.\n#\n# $tag, $parent and $attribute quote the author\'s own source back at them and\n# stay exactly as written; the angle brackets and backticks around them are\n# punctuation this catalog supplies, not part of the name.\n\nschema-element-unrecognized = Element `<{ $tag }>` is not a recognized Doenet element.\n\nschema-element-not-allowed-at-root = Element `<{ $tag }>` is not allowed at the root of the document.\n\nschema-element-not-allowed-inside = Element `<{ $tag }>` is not allowed inside of `<{ $parent }>`.\n\nschema-attribute-unrecognized = Element `<{ $tag }>` doesn\'t have an attribute called `{ $attribute }`.\n\n# $allowed is the attribute\'s permitted values, each already in double quotes\n# and joined for the reader\'s language. $isList says whether the attribute\n# takes several of them at once: one situation, two sentences, because the\n# reader has to be told they are choosing a whole list rather than a value.\nschema-attribute-value-not-allowed =\n { $isList ->\n [true] Attribute `{ $attribute }` of element `<{ $tag }>` must be a list whose items are each one of: { $allowed }\n *[other] Attribute `{ $attribute }` of element `<{ $tag }>` must be one of: { $allowed }\n }\n\n\n## The `<select>` family\'s error boxes\n##\n## The messages that replace the whole component with a red box rather than\n## warning beside it: nothing can be selected, so there is nothing to render.\n## They were the last uncoded `_error` path in the worker (#1581).\n##\n## Counts arrive as numbers rather than as text, so a language that agrees a\n## noun with them can select on them. English does not agree here — it says\n## "1 options" today and these messages reproduce it exactly, because the box\'s\n## text is what the existing suites pin.\n##\n## Being numbers, they are grouped: a count of 1500 renders as "1,500" in\n## English where the concatenated sentence these replaced wrote "1500". That is\n## the one way the English moved, and it moved in the right direction — these\n## are quantities, not identifiers like a line or a section number, which is\n## the distinction that decides between a number and a string everywhere in\n## these catalogs.\n##\n## Translators: component and attribute names — `selectFromSequence`,\n## `selectPrimeNumbers`, `from`, `to`, `step` — are DoenetML identifiers, not\n## words. They are written into these messages as they stand and must be left\n## in English exactly as written.\n\nselect-variant-name-option-count-mismatch = Invalid variant name for select. Variant name { $variantName } appears in { $numOptions } options but number to select is { $numToSelect }.\n\nselect-variant-name-without-options = Some variants are specified for select but no options are specified for possible variant name: { $variantName }.\n\nselect-variant-name-not-possible = Variant name { $variantName } that is specified for select is not a possible variant name.\n\nselect-too-few-options = Cannot select { $numToSelect } components from only { $numOptions }.\n\nselect-from-sequence-too-few-values = Cannot select { $numToSelect } values from a sequence of length { $length }.\n\nselect-from-sequence-indices-count-mismatch = Number of indices specified for select must match number to select\n\nselect-from-sequence-indices-not-integers = All indices specified for select must be integers\n\nselect-from-sequence-index-excluded = Specified index of selectfromsequence that was excluded\n\nselect-from-sequence-indices-excluded-combination = Specified indices of selectfromsequence that was an excluded combination\n\nselect-from-sequence-coprime-not-positive-integers = Cannot select coprime combinations as not selecting positive integers.\n\n# Translators: from, to and step are attribute names. They are written into\n# the message rather than passed in because these three never vary — an\n# argument is for a name that changes from one call to the next.\nselect-from-sequence-coprime-common-factor = Cannot select coprime numbers. All possible values share a common factor. (Specified values of "from" or "to" must be coprime with "step".)\n\nselect-from-sequence-coprime-single-number = Cannot select coprime combinations from a single number that is not 1.\n\nselect-from-sequence-excluded-too-many-combinations = Excluded over 70% of combinations in selectFromSequence\n\n# The sibling of `select-from-sequence-coprime-common-factor`, and a different\n# situation rather than a rewording of it: that one is decided up front, from\n# the sequence\'s own arithmetic. This one is what is left after two hundred\n# draws found no coprime combination among values that could have supplied one.\nselect-from-sequence-coprime-none-found = Could not select coprime numbers. All possible values share a common factor.\n\nselect-from-sequence-too-few-unique-values = Cannot select { $numToSelect } unique values from sequence of length { $numPossibleValues }\n\nselect-prime-numbers-too-few-values = Cannot select { $numToSelect } values from a list of primes of length { $numValues }\n\nselect-prime-numbers-values-count-mismatch = Number of values specified for select must match number to select\n\nselect-prime-numbers-values-not-prime = All values specified for select prime number must be in the list of primes\n\nselect-prime-numbers-values-excluded-combination = Specified values of selectPrimeNumbers was an excluded combination\n\nselect-prime-numbers-excluded-too-many-combinations = Excluded over 70% of combinations in selectPrimeNumbers\n\n# Both flukes are shared by `<selectFromSequence>` and `<selectPrimeNumbers>`,\n# which say the same thing in the same words. Neither is reachable in practice\n# — each follows two hundred independent draws — but an unreachable box is\n# still a box, and it renders in whatever language the rest of the page does.\nselect-random-combination-fluke = By extremely unlikely fluke, couldn\'t select combination of random values\n\nselect-random-value-fluke = By extremely unlikely fluke, couldn\'t select random value\n\n## Inputs embedded in math\n\n# Translators: $component is the input\'s own DoenetML tag and stays in English,\n# as do the attribute names `inline`, `expanded` and `width`. An input written\n# inside `<m>` is drawn in the place it is written, inside the typeset\n# expression, which makes room for it as it grows. That needs a control small\n# enough to sit in a line of mathematics, with a width the expression can\n# measure, in an expression that is not drawn on a graph; $reason says which of\n# those this input fails. When it fails, the input is not shown at all, and the\n# expression is typeset with the input\'s value in its place — a text input\'s\n# text, a math input\'s mathematics — or with nothing there for a choice input.\nmath-embedded-input-shape-unsuitable =\n { $reason ->\n [not-inline] This `<{ $component }>` is not shown because it is inside math and is not `inline`. Add `inline` so it becomes a drop-down list, which fits inside an expression.\n [expanded] This `<{ $component }>` is not shown because it is inside math and is `expanded`. Remove `expanded`; a multi-line box does not fit inside an expression.\n [on-graph] This `<{ $component }>` is not shown because it is inside math drawn on a graph, which has no room for an input.\n *[relative-width] This `<{ $component }>` is not shown because it is inside math and has a relative width. Give the width in absolute units, such as `px`, instead.\n }\n\n## `<sampleRandomNumbers>` and `<selectRandomNumbers>`\n##\n## Translators: `mean`, `standardDeviation`, `variance`, `numTotal`,\n## `numSuccesses`, `numDraws`, `numTrials`, `probability` and `numSamples` are\n## DoenetML attribute names. They are written into these messages as they stand\n## and must be left in English exactly as written. Each of these names the\n## attribute the author has to change, so a message that translated one would\n## point at an attribute that does not exist.\n\n# The spread reaches the sampler as a standard deviation however it was written,\n# so a negative `variance` arrives here as a `standardDeviation` of NaN and the\n# message has to name both for the author to know what to edit.\nsample-gaussian-parameters-invalid =\n Invalid mean ({ $mean }) or standardDeviation ({ $standardDeviation }) for a gaussian random variable. The mean must be a finite number, and the standardDeviation (or the variance it is derived from) must be finite and non-negative. No numbers can be sampled.\n\n# These three attributes are the only ones with no default, so leaving one out is\n# the commonest way to reach this message. Each arrives either as the number the\n# author wrote or as `not-set` for an attribute they left off entirely; translate\n# the "not set" wording, but leave the `not-set` key that selects it untouched.\nsample-hypergeometric-parameters-invalid =\n Invalid numTotal ({ $numTotal ->\n [not-set] not set\n *[other] { $numTotal }\n }), numSuccesses ({ $numSuccesses ->\n [not-set] not set\n *[other] { $numSuccesses }\n }), or numDraws ({ $numDraws ->\n [not-set] not set\n *[other] { $numDraws }\n }) for a hypergeometric random variable. numTotal must be a positive whole number, and numSuccesses and numDraws must be non-negative whole numbers no larger than numTotal. All three must also stay below about nine quadrillion, past which whole numbers can no longer be counted exactly.\n\n# $maxDraws is the largest number of random draws allowed for a single sample.\nsample-hypergeometric-draws-too-many =\n Drawing { $numDraws } items from a population of { $numTotal } would need more than { $maxDraws } random draws for each sample, which would stop the page from responding. Reduce numDraws, or bring it closer to numTotal.\n\nsample-binomial-parameters-invalid =\n Invalid numTrials ({ $numTrials }) or probability ({ $probability }) for a binomial random variable. numTrials must be a non-negative whole number below about nine quadrillion, past which whole numbers can no longer be counted exactly, and probability must be between 0 and 1.\n\n# $maxDraws is the largest number of random draws allowed for a single sample.\nsample-binomial-trials-too-many =\n Running { $numTrials } trials would need more than { $maxDraws } random draws for each sample, which would stop the page from responding. Reduce numTrials.\n\nsample-poisson-mean-invalid =\n Invalid mean ({ $mean }) for a poisson random variable. The mean must be a finite, non-negative number.\n\n# $maxDraws is the largest number of random draws allowed for a single sample.\nsample-poisson-mean-too-large =\n A poisson mean of { $mean } would need more than { $maxDraws } random draws for each sample, which would stop the page from responding. Reduce the mean.\n\n# $distribution names the distribution being sampled, e.g. "binomial" or\n# "multivariate hypergeometric"; $draws is roughly how many random draws each value\n# needs. Raised by `<sampleRandomNumbers>`, `<selectRandomNumbers>` and\n# `<sampleMultivariateRandomNumber>`, which count values with `numSamples`,\n# `numToSelect` and one vector respectively, so the wording names no attribute.\nsample-distribution-slow =\n Each value from this { $distribution } distribution needs about { $draws } random draws, so sampling may be slow. Reduce the distribution\'s parameters, or ask for fewer values, if the page feels sluggish.\n\n## List index operators\n\n# Raised by the index-returning list operators (`<indexOf>`, `<searchSorted>`)\n# when no `target` was given. $component names the tag the author wrote.\nindex-operator-missing-target =\n `{ $component }` has no `target` to look for, so it cannot report a position and gives 0.\n\n# Raised when the operator had no values to look through — an empty list, or one\n# whose only children were references that produced nothing.\nindex-operator-no-values =\n `{ $component }` has no values to look through, so it gives 0, which is not the index of any item.\n## `<sampleMultivariateRandomNumber>`\n##\n## Translators: `type`, `numInCategories` and `numDraws` are DoenetML attribute\n## names, and `hypergeometric` is one of the values `type` takes. They are written\n## into these messages as they stand and must be left in English exactly as\n## written. Each names the attribute the author has to change, so a message that\n## translated one would point at an attribute that does not exist.\n\n# Neither attribute has a default that names a population — numDraws has none at\n# all, and numInCategories falls back to a list with no categories in it — so\n# leaving one out is the commonest way to reach this message. Each arrives either\n# as the value the author wrote or as `not-set`: for numDraws when it is missing,\n# and for numInCategories when it names no categories, whether it was left off or\n# written empty. Translate the "not set" wording, but leave the `not-set` key that\n# selects it untouched.\nsample-multivariate-parameters-invalid =\n Invalid numInCategories ({ $numInCategories ->\n [not-set] not set\n *[other] { $numInCategories }\n }) or numDraws ({ $numDraws ->\n [not-set] not set\n *[other] { $numDraws }\n }) for a multivariate hypergeometric random variable. numInCategories must list at least one category, each a non-negative whole number, and numDraws must be a non-negative whole number no larger than their total. Each category, that total, and numDraws must also stay below about nine quadrillion, past which whole numbers can no longer be counted exactly.\n\n# $maxDraws is the largest number of random draws allowed for a single sample.\n# Drawing nearly the whole population is as cheap as drawing almost none of it, so\n# raising numDraws is a fix as well as lowering it. "could need" rather than "would\n# need": each category is counted at the most its draw could cost, so the count\n# these parameters are refused on is an upper bound on the work they really take.\nsample-multivariate-draws-too-many =\n Drawing { $numDraws } items from a population of { $numTotal } split into { $numCategories } categories could need more than { $maxDraws } random draws for each sample, which would stop the page from responding. Reduce numDraws, bring it closer to numTotal, or use fewer categories.\n\n# `type` has no default, so this is what leaving it off gets. A type the attribute\n# does not recognize falls back to no type at all and reaches this message too,\n# after a separate one naming the value that was rejected — hence "no distribution\n# was named" rather than wording that assumes the attribute is missing.\nsample-multivariate-type-not-specified =\n No multivariate distribution was named for this random variable, so nothing was sampled. Give the type attribute the name of a distribution, such as `type="hypergeometric"`.\n\n## Counting operators\n\n# Raised by `<tally>` when the author named `categories` explicitly and some\n# values matched none of them, so those values were not counted anywhere. Info\n# rather than a warning: a list fed by an input legitimately holds\n# non-categories while a student is typing. It deliberately does not say how\n# many such values there were: the diagnostics queue is append-only and\n# deduplicates by message, so a count would leave one permanent entry behind\n# for every number of stray values the list passed through while being typed.\ntally-values-outside-categories =\n Some values matched none of the declared categories, so they were not counted.\n\n# Raised by `<tally>` when `categories` names the same category more than once.\n# A warning rather than info: unlike a stray value, a repeated category is a\n# property of what the author wrote, so it stays true of a settled document. The\n# message says what the counts will be, since the behavior is defensible but not\n# what an author who repeated a category by accident expects.\ntally-repeated-category =\n `categories` names the same category more than once. Each count reports the values equal to its own category, so the repeated ones all report the same number.\n\n# Raised by `<binCounts>` when no `bins` attribute was given, so there are no\n# intervals to count into. $component names the tag the author wrote.\nbin-counts-missing-bins =\n `{ $component }` has no `bins` cut points, so there are no intervals to count into and it gives no counts.\n\n# Raised by `<binCounts>` when `bins` held fewer than the two cut points needed\n# to define a single interval. $count is how many were given, and can be 0 or 1,\n# so the sentence is worded to read for both without forking on the number.\nbin-counts-too-few-cut-points =\n `bins` needs at least 2 cut points to define an interval, but received { $count }.\n\n# Raised by `<binCounts>` when its values are not all numeric, so they cannot be\n# placed between numeric cut points. $component names the tag the author wrote.\nbin-counts-values-not-numeric =\n `{ $component }` can only count numeric values into bins, but not every value it was given is numeric. All counts are 0.\n\n# Raised by `<binCounts>` when the `bins` cut points do not climb: one is\n# smaller than the one before it, so a bin would run backwards and its count\n# would come out negative, or one is not a number at all, which has the same\n# effect. Equal adjacent cut points are accepted, so the message says "at least\n# as large as" rather than "increasing": what is rejected is a decrease, not a\n# failure to strictly increase. Between two interior cut points that names an\n# empty bin; at either end the outermost-edge rule can still put a value in it.\nbin-counts-cut-points-decreasing =\n Each `bins` cut point must be a number at least as large as the one before it, but one is not a number or is smaller than its predecessor, so no counts were produced.\n\n## Charts\n\n# Raised by `<chart type="bar">` when a value is not a finite number, so it gets\n# no bar. The alternative reading of a missing bar is a value of zero, which the\n# author cannot distinguish by looking, so the absence is stated rather than left\n# to be inferred. No count: the queue is append-only and deduplicates by message,\n# and the number of such values changes as an input is typed into. (The message\n# key is `bar-chart-…` because a code names one situation forever and this one\n# was issued while the component was still spelled `<barChart>`.)\nbar-chart-values-not-drawable =\n A bar chart draws no bar for a value that is not a finite number, so those places on the chart are empty rather than zero.\n\n# Raised by `<chart type="bar">` when `barWidth` is outside the (0, 1] range a\n# fraction of a bar\'s slot can take. $barWidth is what the author wrote.\nbar-chart-bar-width-invalid =\n `barWidth` must be greater than 0 and at most 1, but { $barWidth } was given. Using 0.8 instead.\n\n# `type` has no default, so this is what `<chart>` on its own gets. A type the\n# attribute does not recognize falls back to no type at all and reaches this\n# message too, after a separate one naming the value that was rejected — hence\n# "no chart type was named" rather than wording that assumes the attribute is\n# missing.\nchart-type-not-specified =\n No chart type was named, so nothing was drawn. Give the type attribute the name of a chart, such as `type="bar"`.\n\n# Raised by `<chart>` when values are written beside its `<series>` children.\n# A value outside every series belongs to no group of the data, so there is no\n# place on the chart to draw it; saying so matters because the alternative\n# reading of the missing bar is that the value was zero.\nchart-values-outside-series =\n A chart with `<series>` children draws only the values inside them, so values written beside a series were not drawn. Move them into a series of their own.\n\n# Raised by `<chart type="line">` and `<chart type="scatter">` when a point\n# cannot be placed. Two situations reach it and the message covers both: a value\n# that is not a finite number, and a value with no `x` beside it — which is what\n# a series given fewer horizontal coordinates than values produces from the\n# position they run out. Neither is distinguishable by looking from having asked\n# for fewer points. No count: the queue deduplicates by message, and the number\n# changes as an input is typed into.\nchart-points-not-drawable =\n A point needs a finite number for both coordinates, so values with no coordinate beside them, and coordinates with no value, were not drawn.\n\n# Raised by `<chart type="pie">` for a value that is not a finite number. The\n# bar chart\'s message says the place on the chart is empty rather than zero; a\n# pie has no places, so this says the slice is missing instead. No count, for\n# the reason the others give: the queue deduplicates by message.\nchart-pie-values-not-drawable =\n A pie chart draws no slice for a value that is not a finite number, and leaves it out of the total.\n\n# Raised by `<chart type="pie">` for a negative value. Its own message rather\n# than the one above, because the reason is different in kind: a negative bar\n# hangs below the baseline it is measured from, and a pie has no baseline to\n# hang anything from, so a negative value is not merely undrawable but has no\n# reading as a share of a total. It is left out of the total as well, so the\n# slices that are drawn are shares of what was actually charted.\nchart-pie-negative-values =\n A slice is a share of a total, so a pie chart draws no slice for a negative value and leaves it out of the total.\n\n# Raised by `<chart type="pie">` when the values that could be shares of a\n# total came to zero. Nothing is drawn: there is no share to take of zero, and\n# dividing by it would put `NaN` in every angle. Not raised for a pie with no\n# values at all, which is one being written rather than one that is wrong, nor\n# for one whose every value was rejected — those already have a message naming\n# the reason.\nchart-pie-total-not-positive =\n The values of this pie chart total zero, so there are no shares to draw. A pie needs at least one value above zero.\n\n# Raised by `<chart type="pie">` holding more than one `<series>` that is not\n# hidden — a hidden one is dropped before the count, like any drawn child of a\n# container that is hidden on its own account. Concentric\n# rings are not a standard chart and a donut is a styling variant rather than a\n# second group, so there is nowhere on a pie for a second series to go.\nchart-pie-one-series =\n A pie chart draws one series, so only the first was drawn. Chart the others separately, or use a type that draws several series at once.\n\n# Raised by `<chart type="pie">` whose `<xLabel>` or `<yLabel>` child has text\n# in it; a blank one asks for nothing and is not reported. A pie\n# has no axes for either to name, so the text is authored prose with nowhere on\n# the page to go — which is worth a message where an ignored *attribute* is not,\n# because what was dropped is something the author wrote for a reader to see.\nchart-pie-axis-name-ignored =\n A pie chart has no axes, so an `<xLabel>` or `<yLabel>` was not drawn. Put the text in a `<title>` instead, or in prose beside the chart.\n';
|
|
38636
38636
|
const editor = '# Editor and language-server surfaces: the footer, the diagnostics panel, the\n# variant picker, the accessibility button, and the context-help panel beside\n# them. Selected by `uiLocale`.\n#\n# The editor binds to *one* language, and it is the one the viewer below it\n# resolved rather than the one the surrounding host chrome uses: the panel\n# lists diagnostics rendered down there, where an authored `<document lang>` is\n# known, and a footer in one language above a panel in another reads worse than\n# either choice on its own (#1580).\n#\n# The LSP ships bundled with its DoenetML version, so these catalogs are\n# version-correct rather than always-latest.\n#\n# Message ids are lower-kebab-case Fluent identifiers, optionally with a\n# single `.attribute` suffix (`format-document`).\n\n\n## The viewer\'s controls\n##\n## `editor-update-viewer` names the button that recompiles the document. Its\n## word depends on whether the source changed or only the document\'s state\n## did, which is a distinction the code makes and a `$action` says: the button\n## is otherwise identical, and splitting it into two messages would let the two\n## drift.\n##\n## The keyboard hint is a separate branch rather than text appended after the\n## title, because where a shortcut sits in a sentence is not the same in every\n## language. `$shortcut` is a key combination and stays as written.\n##\n## The tooltip takes the word as `$word` rather than referencing the message\n## above it: a message reference resolves only inside its own bundle, so a\n## locale that translated the tooltip but not the word would render the\n## reference literally instead of falling back to English. This is the shape\n## `paginator-page-status` already uses.\n\n# Button label. "Update" recompiles after a source edit; "Reset" reverts\n# only the document\'s live state to match — same button, different verb.\n# Keep both forms short enough to fit a toolbar button.\neditor-update-viewer =\n { $action ->\n [reset] Reset\n *[update] Update\n }\n\n# Tooltip on the button above. { $word } is that button\'s own current label\n# ("Update" or "Reset"), so this reads as e.g. "Update Viewer" or\n# "Reset Viewer". { $shortcut } appends the keyboard shortcut when one exists.\neditor-update-viewer-title =\n { $shortcut ->\n [none] { $word } Viewer\n *[other] { $word } Viewer { $shortcut }\n }\n\n\n## The variant picker\n\n# Label for the variant picker control itself (a noun, like a field label).\neditor-variant = Variant\n\n# Placeholder text shown in the empty filter input, before the user types\n# anything — not a button or instruction.\neditor-variant-filter = Filter...\n\n# Button/action label: advances to the next variant in the list.\neditor-variant-next = Select next variant\n\n# Button/action label: goes back to the previous variant in the list.\neditor-variant-previous = Select previous variant\n\n\n## The accessibility status button\n##\n## `WCAG AA` is the name of the standard and is not translated, the way\n## `accessibility-heading-level-1` already leaves it.\n##\n## The tooltip and the label are separate messages rather than one with an\n## extra clause: the label counts the violations and the tooltip does not, and\n## a screen reader and a hover are different audiences.\n##\n## `$action` is whether clicking opens or closes the report — an interpolated\n## English verb before this, which no locale could reach and which no language\n## has to place where English does.\n\neditor-accessibility-title =\n { $status ->\n [violations] WCAG AA accessibility violation identified. Click to { $action ->\n [close] close\n *[open] open\n } accessibility report.\n [advisories] Click to { $action ->\n [close] close\n *[open] open\n } accessibility report. No WCAG AA violations were found, but additional accessibility recommendations are available.\n *[clean] Click to { $action ->\n [close] close\n *[open] open\n } accessibility report. No accessibility issues were found.\n }\n\neditor-accessibility-label =\n { $status ->\n [violations] WCAG AA accessibility violation identified. { $count ->\n [one] { $count } WCAG AA violation\n *[other] { $count } WCAG AA violations\n } found. Click to { $action ->\n [close] close\n *[open] open\n } accessibility report.\n [advisories] No WCAG AA violations identified. { $count ->\n [one] { $count } additional accessibility recommendation\n *[other] { $count } additional accessibility recommendations\n } found. Click to { $action ->\n [close] close\n *[open] open\n } accessibility report.\n *[clean] No WCAG AA violations identified. Click to { $action ->\n [close] close\n *[open] open\n } accessibility report.\n }\n\n# The word on the button itself, beside the icon, when there are violations.\neditor-accessibility-badge = WCAG\n\n\n## The footer\n##\n## `$version` is a version number and stays as written.\n\neditor-version-title = DoenetML version { $version }\n\neditor-tab-help = Context-sensitive help\n# The word beside the icon on that tab, which has room for one word.\neditor-tab-help-short = Context\neditor-tab-errors = Errors\neditor-tab-warnings = Warnings\neditor-tab-info = Info\neditor-tab-accessibility = Accessibility\neditor-tab-responses = Submitted responses\n\n# A tab\'s accessible name when it carries a count: "Errors: 3".\neditor-tab-with-count = { $label }: { $count }\n\neditor-options = Editor options\neditor-format-as-doenetml = Format as DoenetML\neditor-format-as-xml = Format as XML\n\n\n## The diagnostics panel\n\n# Where in the source a diagnostic was found. `$line` arrives as text, not as a\n# number: it identifies the line, so line 1234 is "#1234" and not "#1,234".\neditor-diagnostic-line = Line #{ $line }\n\neditor-no-errors = No Errors\neditor-no-warnings = No Warnings\neditor-no-info = No Info Diagnostics\n\neditor-show-info-annotations = Show info diagnostics in editor\neditor-show-accessibility-annotations = Show accessibility diagnostics in editor\n\n# Links into the documentation, which has no translated pages yet. The words\n# move; where they point does not (#1580).\neditor-accessibility-learn-more = Learn how Doenet approaches accessibility\n\n# The heading over the WCAG AA failures. The standard\'s name is a link, so it\n# arrives as an argument rather than being written into the sentence — the\n# brackets around it are this catalog\'s punctuation, and the link is the code\'s.\neditor-accessibility-violations-heading = Accessibility violations ({ $standard })\n\neditor-accessibility-other-heading = Other accessibility issues\neditor-none-found = None found\n\n\n## Submitted responses\n\neditor-no-responses = No submitted responses yet\neditor-response-answer-id = Answer Id\neditor-response-response = Response\neditor-response-credit = Credit\neditor-response-submitted = Submitted\n\n\n## The context-help panel\n##\n## The panel beside the diagnostics, which explains whatever the cursor is on.\n## It is the last of the surfaces the header above names.\n##\n## Several of these sentences have marked-up fragments in them — an element\n## name in `<code>`, a link, a rendered piece of inline markdown. Those arrive\n## as arguments and are put back as React nodes after the message is formatted,\n## so a translation owns the whole sentence including where each fragment sits\n## and the punctuation around it. A translation that drops one simply renders\n## without it rather than losing the sentence.\n##\n## Element names, attribute names and `styleNumber` are DoenetML identifiers\n## and stay as written. The descriptions and summaries the panel shows come\n## from the schema, which is generated from the documentation and is not\n## translated, and the values it resolves — a color\'s derived word, a\n## function name, a type — come from the language server in the same state.\n## What is here is the panel\'s own prose around them (#1580).\n\nhelp-placeholder = Place cursor on a tag name, attribute, or { $ref } for documentation.\n\nhelp-unsupported-ref-chain = Help for multi-part references like { $example } is not yet supported.\n\nhelp-unresolved-ref =\n { $reason ->\n [notFound] No referent found for reference: { $ref }.\n [multiple] Multiple referents found for reference: { $ref }.\n *[indeterminate] A referent for { $ref } could not be determined.\n }\n\n# Both links end in an arrow, which is direction rather than punctuation and is\n# the same in every language this ships in — but it is inside the message, so a\n# language written right to left can turn it around.\nhelp-learn-about-references = Learn about references →\nhelp-reference-page = Reference page →\n\n# What can go where the cursor is. Two selectors joined: where the cursor sits,\n# and what the schema allows there.\nhelp-suggestions-header =\n { $location ->\n [inside] Inside { $element }\n *[top] At the top level\n }{ $allowed ->\n [none] { " — nothing goes here." }\n [text] { " — type text here." }\n [text-and-components] { " — type text here, or try:" }\n *[components] { " — things to try:" }\n }\n\n# `$shortcut` is a key combination and stays as written. `$total` is a real\n# count, so a language that agrees a noun with it can select on it.\nhelp-suggestions-footer = Press { $shortcut } to see all { $total } components.\n\n# An element\'s name joined to its one-line summary. `$name` is empty where the\n# panel has already printed the name beside this — a suggestion in the list —\n# and only the separator is wanted, so the message has to read as punctuation\n# on its own.\nhelp-name-summary = { $name } — { $summary }\n\n# `$line` is text, not a number: it identifies a line, so line 1234 is "1234"\n# and not "1,234". `none` is how a position that is not known selects a\n# sentence without one rather than substituting an empty parenthesis.\nhelp-ref-is-reference =\n { $line ->\n [none] { $ref } is a reference to { $target }.\n *[other] { $ref } is a reference to { $target } (line { $line }).\n }\n\nhelp-ref-derived-from =\n { $line ->\n [none] Introduced by { $owner } as { $role }.\n *[other] Introduced by { $owner } on line { $line } as { $role }.\n }\n\nhelp-property-is-reference =\n { $line ->\n [none] { $ref } is a reference to the { $property } property of { $element }.\n *[other] { $ref } is a reference to the { $property } property of { $element } (line { $line }).\n }\n\n# The badge on the title row saying what kind of thing the panel is explaining.\nhelp-kind-attribute = attribute\nhelp-kind-snippet = snippet\nhelp-kind-array-entry = array entry\n\nhelp-default = Default:\nhelp-active-default = Active default:\n\n# Appended after the active default\'s value. `styleNumber` is the attribute\'s\n# own name and stays as written; the space and brackets around it do not.\nhelp-style-number-annotation = { " " }(styleNumber { $styleNumber })\n\nhelp-allowed-values =\n { $perItem ->\n [true] Allowed values (one per item):\n *[other] Allowed values:\n }\n\n# Heading for values the editor offers without requiring: the attribute accepts\n# others too, and nothing warns about them. Distinct from `help-allowed-values`\n# so a translation can pick a word that suggests rather than constrains.\nhelp-suggested-values = Suggested values:\n\nhelp-inserts = Inserts:\n\nhelp-coordinates =\n { $count ->\n [one] Coordinate:\n *[other] Coordinates:\n }\n\nhelp-type = Type:\n\nhelp-resolved-style = Resolved style (styleNumber { $styleNumber }):\n\nhelp-resolved-function-names = Resolved function names:\nhelp-reset-list = Reset list on this input:\nhelp-added-on-input = Added on this input:\nhelp-removed-on-input = Removed on this input:\n\n# The three names are attributes an author writes, so they stay as written.\nhelp-reset-overrides = { $reset } overrides { $additional } and { $removed }.\n\n# Length syntax for a `componentSize` attribute (`width`, `height`). The values\n# listed alongside this label are examples the panel renders as chips.\nhelp-accepted-sizes = Accepted sizes:\nhelp-size-units = A bare number is pixels. A percentage is a share of the width around the component.\n\n# For a `height`, which is offered no percentage: the note must not raise a form\n# the attribute does not support.\nhelp-size-units-absolute = A bare number is pixels.\n\n# For a width that picks a named `size` preset (`<graph>`, `<image>`, `<video>`):\n# a percentage there is a share of the largest width any component may take, not\n# of the space around this one.\nhelp-size-units-preset = A bare number is pixels, and a percentage is a share of the widest a component can be.\n\n# For a side-by-side `width`, which is offered no absolute form: the same rule,\n# the other way round.\nhelp-size-units-relative = A percentage is a share of the width around the component.\n\n# `size` names a sibling attribute an author writes, so it stays as written.\nhelp-size-snaps-to-preset = This width picks the nearest { $size } preset rather than being used exactly.\n';
|
|
38637
38637
|
const CATALOG_NAMESPACES = [
|
|
38638
38638
|
"chrome",
|
|
@@ -42891,6 +42891,12 @@ const DIAGNOSTIC_CODES = {
|
|
|
42891
42891
|
"doenet-w0145": "invalid-type-ignored",
|
|
42892
42892
|
"doenet-w0146": "chart-type-not-specified",
|
|
42893
42893
|
"doenet-w0147": "chart-values-outside-series",
|
|
42894
|
+
"doenet-w0148": "chart-points-not-drawable",
|
|
42895
|
+
"doenet-w0149": "chart-pie-values-not-drawable",
|
|
42896
|
+
"doenet-w0150": "chart-pie-negative-values",
|
|
42897
|
+
"doenet-w0151": "chart-pie-total-not-positive",
|
|
42898
|
+
"doenet-w0152": "chart-pie-one-series",
|
|
42899
|
+
"doenet-w0153": "chart-pie-axis-name-ignored",
|
|
42894
42900
|
"doenet-e0001": "pretzel-circuit-first-problem-distractor",
|
|
42895
42901
|
"doenet-e0002": "component-type-invalid",
|
|
42896
42902
|
"doenet-e0003": "attribute-repeated",
|
|
@@ -46143,6 +46149,33 @@ function returnStyleDefinitionStateVariables() {
|
|
|
46143
46149
|
};
|
|
46144
46150
|
return stateVariableDefinitions;
|
|
46145
46151
|
}
|
|
46152
|
+
function styleDefinitionForStyleNumber({
|
|
46153
|
+
styleNumber,
|
|
46154
|
+
ancestorWithStyle
|
|
46155
|
+
}) {
|
|
46156
|
+
const styleDefinitions = ancestorWithStyle?.stateValues?.styleDefinitions ?? returnDefaultStyleDefinitions();
|
|
46157
|
+
let selectedStyle = styleDefinitions[styleNumber];
|
|
46158
|
+
if (selectedStyle === void 0) {
|
|
46159
|
+
const effectivePaletteName = resolveReaderPaletteName(
|
|
46160
|
+
ancestorWithStyle?.stateValues?.readerStyleOverrides
|
|
46161
|
+
) ?? ancestorWithStyle?.stateValues?.activeStylePaletteName;
|
|
46162
|
+
if (effectivePaletteName != null) {
|
|
46163
|
+
selectedStyle = styleDefinitions[cycleStyleNumberForPalette(
|
|
46164
|
+
styleNumber,
|
|
46165
|
+
effectivePaletteName
|
|
46166
|
+
)];
|
|
46167
|
+
}
|
|
46168
|
+
}
|
|
46169
|
+
if (selectedStyle === void 0) {
|
|
46170
|
+
selectedStyle = cloneDefaultStyleWithMissingColorWords();
|
|
46171
|
+
}
|
|
46172
|
+
return selectedStyle;
|
|
46173
|
+
}
|
|
46174
|
+
function selectStyleForStyleNumber(options) {
|
|
46175
|
+
return resolveStyleDefinition(
|
|
46176
|
+
unwrapStyleDefinition(styleDefinitionForStyleNumber(options))
|
|
46177
|
+
);
|
|
46178
|
+
}
|
|
46146
46179
|
function returnSelectedStyleStateVariableDefinition(options = {}) {
|
|
46147
46180
|
const overrideAttributeNames = options.overrideAttributeNames ?? [];
|
|
46148
46181
|
return {
|
|
@@ -46176,25 +46209,10 @@ function returnSelectedStyleStateVariableDefinition(options = {}) {
|
|
|
46176
46209
|
definition: function({
|
|
46177
46210
|
dependencyValues
|
|
46178
46211
|
}) {
|
|
46179
|
-
let
|
|
46180
|
-
|
|
46181
|
-
|
|
46182
|
-
}
|
|
46183
|
-
let selectedStyle = styleDefinitions[dependencyValues.styleNumber];
|
|
46184
|
-
if (selectedStyle === void 0) {
|
|
46185
|
-
const effectivePaletteName = resolveReaderPaletteName(
|
|
46186
|
-
dependencyValues.ancestorWithStyle?.stateValues.readerStyleOverrides
|
|
46187
|
-
) ?? dependencyValues.ancestorWithStyle?.stateValues.activeStylePaletteName;
|
|
46188
|
-
if (effectivePaletteName != null) {
|
|
46189
|
-
selectedStyle = styleDefinitions[cycleStyleNumberForPalette(
|
|
46190
|
-
dependencyValues.styleNumber,
|
|
46191
|
-
effectivePaletteName
|
|
46192
|
-
)];
|
|
46193
|
-
}
|
|
46194
|
-
}
|
|
46195
|
-
if (selectedStyle === void 0) {
|
|
46196
|
-
selectedStyle = cloneDefaultStyleWithMissingColorWords();
|
|
46197
|
-
}
|
|
46212
|
+
let selectedStyle = styleDefinitionForStyleNumber({
|
|
46213
|
+
styleNumber: dependencyValues.styleNumber,
|
|
46214
|
+
ancestorWithStyle: dependencyValues.ancestorWithStyle
|
|
46215
|
+
});
|
|
46198
46216
|
if (overrideAttributeNames.length > 0) {
|
|
46199
46217
|
const overrideStyleDef = {};
|
|
46200
46218
|
for (const name2 of overrideAttributeNames) {
|
|
@@ -47297,7 +47315,7 @@ async function cidFromArrayBuffer(data) {
|
|
|
47297
47315
|
await crypto.subtle.digest("SHA-256", new Uint8Array());
|
|
47298
47316
|
digest = (data2) => crypto.subtle.digest("SHA-256", data2);
|
|
47299
47317
|
} catch (e22) {
|
|
47300
|
-
const sha256 = (await import("./sha256-
|
|
47318
|
+
const sha256 = (await import("./sha256-8sXzDnE0-D8G4fjq_-DaSft1CG.js").then((n2) => n2.s)).default;
|
|
47301
47319
|
digest = (data2) => sha256(data2, {
|
|
47302
47320
|
asBytes: true
|
|
47303
47321
|
});
|
|
@@ -93437,62 +93455,13 @@ function pointStyleAttributes({
|
|
|
93437
93455
|
}
|
|
93438
93456
|
return attrs;
|
|
93439
93457
|
}
|
|
93440
|
-
const CHART_MARGINS_BOTTOM_RIGHT_TOP = [30, 12, 16];
|
|
93441
|
-
const AXIS_LABEL_MARGIN_BASE = 14;
|
|
93442
|
-
const AXIS_LABEL_MARGIN_PER_CHARACTER = 9;
|
|
93443
|
-
function fitMargins(available, near, far, budgetFraction = 1 / 2) {
|
|
93444
|
-
const total = near + far;
|
|
93445
|
-
const budget = Math.max(Math.floor(available * budgetFraction), 0);
|
|
93446
|
-
if (!Number.isFinite(available) || total <= budget || total <= 0) {
|
|
93447
|
-
return [near, far];
|
|
93448
|
-
}
|
|
93449
|
-
const scale = budget / total;
|
|
93450
|
-
return [Math.floor(near * scale), Math.floor(far * scale)];
|
|
93451
|
-
}
|
|
93452
|
-
const MAX_TICKS_MEASURED = 64;
|
|
93453
|
-
function widestTickLabelLength(firstTick, lastTick, step) {
|
|
93454
|
-
const asDrawn = (value) => Number.isFinite(value) ? snapNumber(value).toLocaleString("en-US", {
|
|
93455
|
-
maximumFractionDigits: 20
|
|
93456
|
-
}).length : 1;
|
|
93457
|
-
let widest = Math.max(asDrawn(firstTick), asDrawn(lastTick), 1);
|
|
93458
|
-
if (Number.isFinite(step) && step > 0) {
|
|
93459
|
-
const numTicks = Math.min(
|
|
93460
|
-
Math.floor((lastTick - firstTick) / step),
|
|
93461
|
-
MAX_TICKS_MEASURED
|
|
93462
|
-
);
|
|
93463
|
-
for (let ind = 1; ind < numTicks; ind++) {
|
|
93464
|
-
widest = Math.max(widest, asDrawn(firstTick + ind * step));
|
|
93465
|
-
}
|
|
93466
|
-
}
|
|
93467
|
-
return widest;
|
|
93468
|
-
}
|
|
93469
|
-
function barChartLegendHasItems(geometry) {
|
|
93470
|
-
if (geometry === null) {
|
|
93471
|
-
return false;
|
|
93472
|
-
}
|
|
93473
|
-
const seriesWithABar = new Set(geometry.bars.map((bar) => bar.seriesIndex));
|
|
93474
|
-
return geometry.series.some(
|
|
93475
|
-
(oneSeries, seriesIndex) => seriesWithABar.has(seriesIndex) && labelMarkup({
|
|
93476
|
-
label: oneSeries.label,
|
|
93477
|
-
labelHasLatex: false
|
|
93478
|
-
}) !== null
|
|
93479
|
-
);
|
|
93480
|
-
}
|
|
93481
93458
|
const TARGET_TICK_INTERVALS = 5;
|
|
93459
|
+
function midpoint(low, high) {
|
|
93460
|
+
return low / 2 + high / 2;
|
|
93461
|
+
}
|
|
93482
93462
|
function snapNumber(value) {
|
|
93483
93463
|
return Number.isFinite(value) ? Number(value.toPrecision(12)) : value;
|
|
93484
93464
|
}
|
|
93485
|
-
function segmentHeight(base, top) {
|
|
93486
|
-
const exact = top - base;
|
|
93487
|
-
const snapped = snapNumber(exact);
|
|
93488
|
-
if (Number.isFinite(base + snapped)) {
|
|
93489
|
-
return snapped;
|
|
93490
|
-
}
|
|
93491
|
-
if (Number.isFinite(base + exact)) {
|
|
93492
|
-
return exact;
|
|
93493
|
-
}
|
|
93494
|
-
return exact * (1 - Number.EPSILON);
|
|
93495
|
-
}
|
|
93496
93465
|
function saturatingAdd(total, value) {
|
|
93497
93466
|
const sum2 = total + value;
|
|
93498
93467
|
if (Number.isFinite(sum2)) {
|
|
@@ -93538,134 +93507,84 @@ function nextTickBeyond(value, step, direction) {
|
|
|
93538
93507
|
const beyond = rounded === snapNumber(value) ? snapNumber(rounded + direction * step) : rounded;
|
|
93539
93508
|
return Number.isFinite(beyond) ? beyond : value;
|
|
93540
93509
|
}
|
|
93541
|
-
function
|
|
93542
|
-
|
|
93543
|
-
|
|
93544
|
-
|
|
93545
|
-
|
|
93546
|
-
yMinAttr,
|
|
93547
|
-
yMaxAttr
|
|
93510
|
+
function autoAxisBounds({
|
|
93511
|
+
low,
|
|
93512
|
+
high,
|
|
93513
|
+
minStep,
|
|
93514
|
+
baseline
|
|
93548
93515
|
}) {
|
|
93549
|
-
|
|
93550
|
-
(
|
|
93551
|
-
|
|
93552
|
-
|
|
93553
|
-
|
|
93554
|
-
|
|
93555
|
-
|
|
93556
|
-
|
|
93557
|
-
|
|
93558
|
-
|
|
93559
|
-
|
|
93560
|
-
|
|
93561
|
-
|
|
93562
|
-
}
|
|
93563
|
-
}
|
|
93564
|
-
const wholeValues = series.every(
|
|
93565
|
-
(oneSeries, seriesInd) => oneSeries.values.every(
|
|
93566
|
-
(value, ind) => !drawable[seriesInd][ind] || Number.isInteger(value)
|
|
93567
|
-
)
|
|
93568
|
-
);
|
|
93569
|
-
const minStep = wholeValues ? 1 : 0;
|
|
93570
|
-
const halfSlot = barWidth / 2;
|
|
93571
|
-
const stacked = layout === "stacked";
|
|
93572
|
-
const oneBarWidth = stacked ? barWidth : barWidth / Math.max(series.length, 1);
|
|
93573
|
-
const stackAbove = new Array(numSlots).fill(0);
|
|
93574
|
-
const stackBelow = new Array(numSlots).fill(0);
|
|
93575
|
-
const bars = [];
|
|
93576
|
-
series.forEach((oneSeries, seriesIndex) => {
|
|
93577
|
-
oneSeries.values.forEach((value, ind) => {
|
|
93578
|
-
if (!drawable[seriesIndex][ind]) {
|
|
93579
|
-
return;
|
|
93580
|
-
}
|
|
93581
|
-
const slot = ind + 1;
|
|
93582
|
-
const center = stacked ? slot : slot - halfSlot + (seriesIndex + 0.5) * oneBarWidth;
|
|
93583
|
-
let base;
|
|
93584
|
-
let height;
|
|
93585
|
-
if (!stacked) {
|
|
93586
|
-
base = Math.min(0, value);
|
|
93587
|
-
height = Math.abs(value);
|
|
93588
|
-
} else if (value < 0) {
|
|
93589
|
-
const bottom = saturatingAdd(stackBelow[ind], value);
|
|
93590
|
-
height = segmentHeight(bottom, stackBelow[ind]);
|
|
93591
|
-
base = bottom;
|
|
93592
|
-
stackBelow[ind] = bottom;
|
|
93593
|
-
} else {
|
|
93594
|
-
base = stackAbove[ind];
|
|
93595
|
-
const top = saturatingAdd(base, value);
|
|
93596
|
-
height = segmentHeight(base, top);
|
|
93597
|
-
stackAbove[ind] = top;
|
|
93516
|
+
function boundsFor(step) {
|
|
93517
|
+
if (baseline === null) {
|
|
93518
|
+
if (!(high > low)) {
|
|
93519
|
+
const spread = low - step < low && high + step > high ? step : Math.max(
|
|
93520
|
+
step,
|
|
93521
|
+
niceTickStep(Math.abs(low) || 1, minStep)
|
|
93522
|
+
);
|
|
93523
|
+
const lowBound = snapNumber(low - spread);
|
|
93524
|
+
const highBound = snapNumber(high + spread);
|
|
93525
|
+
return [
|
|
93526
|
+
Number.isFinite(lowBound) ? lowBound : low,
|
|
93527
|
+
Number.isFinite(highBound) ? highBound : high
|
|
93528
|
+
];
|
|
93598
93529
|
}
|
|
93599
|
-
|
|
93600
|
-
|
|
93601
|
-
|
|
93602
|
-
|
|
93603
|
-
value,
|
|
93604
|
-
lowerLeft: [
|
|
93605
|
-
snapNumber(center - oneBarWidth / 2),
|
|
93606
|
-
snapNumber(base)
|
|
93607
|
-
],
|
|
93608
|
-
dimensions: [snapNumber(oneBarWidth), height]
|
|
93609
|
-
});
|
|
93610
|
-
});
|
|
93611
|
-
});
|
|
93612
|
-
let reachAbove = 0;
|
|
93613
|
-
let reachBelow = 0;
|
|
93614
|
-
if (stacked) {
|
|
93615
|
-
for (let ind = 0; ind < numSlots; ind++) {
|
|
93616
|
-
reachAbove = Math.max(reachAbove, stackAbove[ind]);
|
|
93617
|
-
reachBelow = Math.min(reachBelow, stackBelow[ind]);
|
|
93618
|
-
}
|
|
93619
|
-
} else {
|
|
93620
|
-
for (const bar of bars) {
|
|
93621
|
-
reachAbove = Math.max(reachAbove, bar.value);
|
|
93622
|
-
reachBelow = Math.min(reachBelow, bar.value);
|
|
93530
|
+
return [
|
|
93531
|
+
nextTickBeyond(low, step, -1),
|
|
93532
|
+
nextTickBeyond(high, step, 1)
|
|
93533
|
+
];
|
|
93623
93534
|
}
|
|
93624
|
-
}
|
|
93625
|
-
function autoBoundsFor(step) {
|
|
93626
93535
|
return [
|
|
93627
|
-
|
|
93628
|
-
|
|
93536
|
+
low >= baseline ? baseline : nextTickBeyond(low, step, -1),
|
|
93537
|
+
high <= baseline ? snapNumber(baseline + step) : nextTickBeyond(high, step, 1)
|
|
93629
93538
|
];
|
|
93630
93539
|
}
|
|
93631
|
-
const [firstMin, firstMax] =
|
|
93632
|
-
niceTickStep(
|
|
93633
|
-
);
|
|
93634
|
-
const [autoYMin, autoYMax] = autoBoundsFor(
|
|
93635
|
-
niceTickStep(firstMax - firstMin, minStep)
|
|
93540
|
+
const [firstMin, firstMax] = boundsFor(
|
|
93541
|
+
niceTickStep(high - low || 1, minStep)
|
|
93636
93542
|
);
|
|
93637
|
-
|
|
93638
|
-
|
|
93639
|
-
|
|
93640
|
-
|
|
93641
|
-
|
|
93642
|
-
|
|
93643
|
-
|
|
93644
|
-
|
|
93645
|
-
|
|
93543
|
+
return boundsFor(niceTickStep(firstMax - firstMin, minStep));
|
|
93544
|
+
}
|
|
93545
|
+
function reconcileBounds(requestedMin, requestedMax, autoMin, autoMax) {
|
|
93546
|
+
const min2 = requestedMin ?? autoMin;
|
|
93547
|
+
const max2 = requestedMax ?? autoMax;
|
|
93548
|
+
if (!Number.isFinite(min2) || !Number.isFinite(max2) || !(min2 < max2)) {
|
|
93549
|
+
return [autoMin, autoMax];
|
|
93550
|
+
}
|
|
93551
|
+
return [min2, max2];
|
|
93552
|
+
}
|
|
93553
|
+
function tickStepForBounds(min2, max2, wholeValues) {
|
|
93554
|
+
return niceTickStep(
|
|
93555
|
+
max2 - min2,
|
|
93556
|
+
wholeValues && Number.isInteger(min2) && Number.isInteger(max2) ? 1 : 0
|
|
93646
93557
|
);
|
|
93647
|
-
|
|
93648
|
-
|
|
93649
|
-
|
|
93650
|
-
|
|
93558
|
+
}
|
|
93559
|
+
const CHART_MARGINS_BOTTOM_RIGHT_TOP = [30, 12, 16];
|
|
93560
|
+
const AXIS_LABEL_MARGIN_BASE = 14;
|
|
93561
|
+
const AXIS_LABEL_MARGIN_PER_CHARACTER = 9;
|
|
93562
|
+
const AXIS_LABEL_LINE_HEIGHT = 18;
|
|
93563
|
+
function fitMargins(available, near, far, budgetFraction = 1 / 2) {
|
|
93564
|
+
const total = near + far;
|
|
93565
|
+
const budget = Math.max(Math.floor(available * budgetFraction), 0);
|
|
93566
|
+
if (!Number.isFinite(available) || total <= budget || total <= 0) {
|
|
93567
|
+
return [near, far];
|
|
93651
93568
|
}
|
|
93652
|
-
|
|
93653
|
-
|
|
93654
|
-
|
|
93655
|
-
|
|
93656
|
-
|
|
93657
|
-
|
|
93658
|
-
|
|
93659
|
-
|
|
93660
|
-
|
|
93661
|
-
|
|
93662
|
-
|
|
93663
|
-
|
|
93664
|
-
|
|
93665
|
-
|
|
93666
|
-
|
|
93667
|
-
|
|
93668
|
-
|
|
93569
|
+
const scale = budget / total;
|
|
93570
|
+
return [Math.floor(near * scale), Math.floor(far * scale)];
|
|
93571
|
+
}
|
|
93572
|
+
const MAX_TICKS_MEASURED = 64;
|
|
93573
|
+
function widestTickLabelLength(firstTick, lastTick, step) {
|
|
93574
|
+
const asDrawn = (value) => Number.isFinite(value) ? snapNumber(value).toLocaleString("en-US", {
|
|
93575
|
+
maximumFractionDigits: 20
|
|
93576
|
+
}).length : 1;
|
|
93577
|
+
let widest = Math.max(asDrawn(firstTick), asDrawn(lastTick), 1);
|
|
93578
|
+
if (Number.isFinite(step) && step > 0) {
|
|
93579
|
+
const numTicks = Math.min(
|
|
93580
|
+
Math.floor((lastTick - firstTick) / step),
|
|
93581
|
+
MAX_TICKS_MEASURED
|
|
93582
|
+
);
|
|
93583
|
+
for (let ind = 1; ind < numTicks; ind++) {
|
|
93584
|
+
widest = Math.max(widest, asDrawn(firstTick + ind * step));
|
|
93585
|
+
}
|
|
93586
|
+
}
|
|
93587
|
+
return widest;
|
|
93669
93588
|
}
|
|
93670
93589
|
const LEGEND_PLACEMENTS = {
|
|
93671
93590
|
// Outside the plot, in a margin widened to hold it. Nothing is drawn there,
|
|
@@ -93681,13 +93600,13 @@ const LEGEND_PLACEMENTS = {
|
|
|
93681
93600
|
lowerright: { corner: "bottomRight", alignment: "nw" },
|
|
93682
93601
|
lowerleft: { corner: "bottomLeft", alignment: "ne" }
|
|
93683
93602
|
};
|
|
93684
|
-
function estimateLegendSize(labels) {
|
|
93603
|
+
function estimateLegendSize(labels, keyWidth) {
|
|
93685
93604
|
const widest = labels.reduce(
|
|
93686
93605
|
(widest2, label) => Math.max(widest2, estimateTextWidth(label)),
|
|
93687
93606
|
0
|
|
93688
93607
|
);
|
|
93689
93608
|
return {
|
|
93690
|
-
width: widest +
|
|
93609
|
+
width: widest + keyWidth,
|
|
93691
93610
|
height: LEGEND_BOX_PADDING + labels.length * LEGEND_ITEM_HEIGHT
|
|
93692
93611
|
};
|
|
93693
93612
|
}
|
|
@@ -93715,17 +93634,144 @@ const SEMI_NARROW_CHARACTERS = 'ftr/\\{}"_?–';
|
|
|
93715
93634
|
const WIDE_CHARACTERS = "mwMW@%";
|
|
93716
93635
|
const BROAD_CHARACTERS = "GDUHNOQ&";
|
|
93717
93636
|
const FULL_WIDTH_FIRST_CODE_POINT = 4352;
|
|
93718
|
-
const
|
|
93637
|
+
const LEGEND_SWATCH_KEY_WIDTH = 30;
|
|
93638
|
+
const LEGEND_LINE_KEY_WIDTH = 44;
|
|
93719
93639
|
const LEGEND_ITEM_HEIGHT = 21;
|
|
93720
93640
|
const LEGEND_BOX_PADDING = 3;
|
|
93721
93641
|
const LEGEND_OUTSIDE_GAP = 8;
|
|
93722
93642
|
const LEGEND_ANCHOR_OFFSET = 4;
|
|
93723
|
-
const
|
|
93643
|
+
const OUTSIDE_MARGIN_BUDGET = 2 / 3;
|
|
93724
93644
|
const TITLE_SCALE = 1.4;
|
|
93725
93645
|
const TITLE_MARGIN = 14 * TITLE_SCALE + 10;
|
|
93726
|
-
function
|
|
93727
|
-
|
|
93728
|
-
|
|
93646
|
+
function axisTicks(min2, max2, step) {
|
|
93647
|
+
return {
|
|
93648
|
+
first: tickAtOrBeyond(min2, step, 1),
|
|
93649
|
+
last: tickAtOrBeyond(max2, step, -1),
|
|
93650
|
+
step
|
|
93651
|
+
};
|
|
93652
|
+
}
|
|
93653
|
+
function axisLabelsAttr({ first: first2, last: last2, step }) {
|
|
93654
|
+
return `(${formatNumber$1(first2)},${formatNumber$1(step)},${formatNumber$1(last2)})`;
|
|
93655
|
+
}
|
|
93656
|
+
function axisLabelWidth(ticks) {
|
|
93657
|
+
return AXIS_LABEL_MARGIN_PER_CHARACTER * widestTickLabelLength(ticks.first, ticks.last, ticks.step);
|
|
93658
|
+
}
|
|
93659
|
+
function planLegend({
|
|
93660
|
+
entries,
|
|
93661
|
+
showLegend,
|
|
93662
|
+
legendPosition,
|
|
93663
|
+
legendKeyWidth
|
|
93664
|
+
}) {
|
|
93665
|
+
const items = entries.flatMap((entry) => {
|
|
93666
|
+
const markup = labelMarkup({
|
|
93667
|
+
label: entry.label,
|
|
93668
|
+
labelHasLatex: entry.labelHasLatex
|
|
93669
|
+
});
|
|
93670
|
+
if (entry.handle === null || markup === null) {
|
|
93671
|
+
return [];
|
|
93672
|
+
}
|
|
93673
|
+
return [{ label: entry.label, markup, handle: entry.handle }];
|
|
93674
|
+
});
|
|
93675
|
+
const drawn = showLegend && items.length > 0;
|
|
93676
|
+
const placement = LEGEND_PLACEMENTS[legendPosition] ?? LEGEND_PLACEMENTS.outsideright;
|
|
93677
|
+
const outside = drawn && "side" in placement;
|
|
93678
|
+
return {
|
|
93679
|
+
items,
|
|
93680
|
+
drawn,
|
|
93681
|
+
placement,
|
|
93682
|
+
size: estimateLegendSize(
|
|
93683
|
+
items.map((item) => item.label),
|
|
93684
|
+
legendKeyWidth
|
|
93685
|
+
),
|
|
93686
|
+
onRight: outside && "side" in placement && placement.side === "right",
|
|
93687
|
+
onBottom: outside && "side" in placement && placement.side === "bottom"
|
|
93688
|
+
};
|
|
93689
|
+
}
|
|
93690
|
+
function legendMarkup({
|
|
93691
|
+
plan,
|
|
93692
|
+
bounds,
|
|
93693
|
+
frame,
|
|
93694
|
+
rightOfPlot
|
|
93695
|
+
}) {
|
|
93696
|
+
if (!plan.drawn) {
|
|
93697
|
+
return "";
|
|
93698
|
+
}
|
|
93699
|
+
const [xMin, yMin, xMax, yMax] = bounds;
|
|
93700
|
+
const { placement } = plan;
|
|
93701
|
+
const {
|
|
93702
|
+
marginLeft,
|
|
93703
|
+
marginRight,
|
|
93704
|
+
marginBottom,
|
|
93705
|
+
marginTop,
|
|
93706
|
+
innerWidth,
|
|
93707
|
+
innerHeight,
|
|
93708
|
+
unitsPerPixelX,
|
|
93709
|
+
unitsPerPixelY
|
|
93710
|
+
} = frame;
|
|
93711
|
+
let anchorX;
|
|
93712
|
+
let anchorY;
|
|
93713
|
+
if (!("side" in placement)) {
|
|
93714
|
+
anchorX = placement.corner.endsWith("Right") ? xMax : xMin;
|
|
93715
|
+
anchorY = placement.corner.startsWith("top") ? yMax : yMin;
|
|
93716
|
+
} else if (placement.side === "right") {
|
|
93717
|
+
const overhangRight = rightOfPlot + LEGEND_ANCHOR_OFFSET + plan.size.width + LEGEND_OUTSIDE_GAP;
|
|
93718
|
+
const overhangBottom = LEGEND_ANCHOR_OFFSET + plan.size.height + LEGEND_OUTSIDE_GAP;
|
|
93719
|
+
const pullLeft = Math.min(
|
|
93720
|
+
Math.max(overhangRight - marginRight, 0),
|
|
93721
|
+
Math.max(
|
|
93722
|
+
marginLeft + innerWidth + LEGEND_ANCHOR_OFFSET - LEGEND_OUTSIDE_GAP,
|
|
93723
|
+
0
|
|
93724
|
+
)
|
|
93725
|
+
);
|
|
93726
|
+
const pullUp = Math.min(
|
|
93727
|
+
Math.max(overhangBottom - (innerHeight + marginBottom), 0),
|
|
93728
|
+
marginTop
|
|
93729
|
+
);
|
|
93730
|
+
anchorX = xMax + (rightOfPlot - pullLeft) * unitsPerPixelX;
|
|
93731
|
+
anchorY = yMax + pullUp * unitsPerPixelY;
|
|
93732
|
+
} else {
|
|
93733
|
+
const belowAxis = Math.max(
|
|
93734
|
+
marginBottom - LEGEND_OUTSIDE_GAP - plan.size.height - LEGEND_ANCHOR_OFFSET,
|
|
93735
|
+
-(marginTop + innerHeight)
|
|
93736
|
+
);
|
|
93737
|
+
anchorX = midpoint(xMin, xMax);
|
|
93738
|
+
anchorY = yMin - belowAxis * unitsPerPixelY;
|
|
93739
|
+
}
|
|
93740
|
+
const anchor = `(${formatNumber$1(anchorX)},${formatNumber$1(anchorY)})`;
|
|
93741
|
+
const items = plan.items.map(
|
|
93742
|
+
(item) => `<item ref="${escapeXml(item.handle)}" ${THEME_AWARE_LABEL_COLOR_ATTR}>${item.markup}</item>`
|
|
93743
|
+
).join("");
|
|
93744
|
+
return `<legend anchor="${escapeXml(anchor)}" alignment="${placement.alignment}" opacity="0" stroke="currentColor">${items}</legend>`;
|
|
93745
|
+
}
|
|
93746
|
+
function titleMarkup({
|
|
93747
|
+
titleText,
|
|
93748
|
+
bounds,
|
|
93749
|
+
lift,
|
|
93750
|
+
roomAbove,
|
|
93751
|
+
unitsPerPixelY
|
|
93752
|
+
}) {
|
|
93753
|
+
if (!titleText) {
|
|
93754
|
+
return { titleElement: "", captionElement: "" };
|
|
93755
|
+
}
|
|
93756
|
+
const raised = Math.min(lift, Math.max(roomAbove - TITLE_MARGIN, 0));
|
|
93757
|
+
const [xMin, , xMax, yMax] = bounds;
|
|
93758
|
+
const anchor = `(${formatNumber$1(midpoint(xMin, xMax))},${formatNumber$1(
|
|
93759
|
+
yMax + raised * unitsPerPixelY
|
|
93760
|
+
)})`;
|
|
93761
|
+
return {
|
|
93762
|
+
titleElement: `<label anchor="${escapeXml(anchor)}" alignment="north" scale="${TITLE_SCALE}" ${THEME_AWARE_LABEL_COLOR_ATTR}>${titleText}</label>`,
|
|
93763
|
+
captionElement: `<caption>${titleText}</caption>`
|
|
93764
|
+
};
|
|
93765
|
+
}
|
|
93766
|
+
function figureAnnotations(shortDescription, annotationElements) {
|
|
93767
|
+
const figureAnnotationText = shortDescription ? ` text="${escapeXml(shortDescription)}"` : "";
|
|
93768
|
+
return `<annotations><annotation ref="figure"${figureAnnotationText}>${annotationElements.join("")}</annotation></annotations>`;
|
|
93769
|
+
}
|
|
93770
|
+
function assembleChartDiagram({
|
|
93771
|
+
bounds,
|
|
93772
|
+
yTicks,
|
|
93773
|
+
xTicks,
|
|
93774
|
+
slots,
|
|
93729
93775
|
widthPx,
|
|
93730
93776
|
heightPx,
|
|
93731
93777
|
xLabel,
|
|
@@ -93735,57 +93781,82 @@ function createBarChartPrefigureXML({
|
|
|
93735
93781
|
title,
|
|
93736
93782
|
showLegend,
|
|
93737
93783
|
legendPosition,
|
|
93738
|
-
|
|
93784
|
+
seriesRendering,
|
|
93785
|
+
seriesLabels,
|
|
93786
|
+
seriesElements,
|
|
93787
|
+
seriesAnnotations,
|
|
93788
|
+
seriesKeyHandles,
|
|
93789
|
+
legendKeyWidth,
|
|
93790
|
+
markOverhang,
|
|
93791
|
+
overlayElements,
|
|
93739
93792
|
shortDescription,
|
|
93740
|
-
darkMode
|
|
93793
|
+
darkMode
|
|
93741
93794
|
}) {
|
|
93742
|
-
const
|
|
93743
|
-
const [xMin, yMin, xMax, yMax] = geometry.bounds;
|
|
93795
|
+
const [xMin, yMin, xMax, yMax] = bounds;
|
|
93744
93796
|
const bbox = `(${formatNumber$1(xMin)},${formatNumber$1(yMin)},${formatNumber$1(xMax)},${formatNumber$1(yMax)})`;
|
|
93745
|
-
const
|
|
93746
|
-
const
|
|
93747
|
-
const
|
|
93748
|
-
const
|
|
93749
|
-
const
|
|
93750
|
-
|
|
93751
|
-
|
|
93752
|
-
|
|
93753
|
-
|
|
93754
|
-
|
|
93755
|
-
|
|
93756
|
-
|
|
93757
|
-
|
|
93758
|
-
|
|
93759
|
-
|
|
93760
|
-
const
|
|
93761
|
-
const
|
|
93762
|
-
|
|
93797
|
+
const [rawBottom, rawRight, rawTop] = CHART_MARGINS_BOTTOM_RIGHT_TOP;
|
|
93798
|
+
const baseBottom = rawBottom + markOverhang;
|
|
93799
|
+
const baseRight = rawRight + markOverhang;
|
|
93800
|
+
const baseTop = rawTop + markOverhang;
|
|
93801
|
+
const legend = planLegend({
|
|
93802
|
+
entries: seriesLabels.map((label, seriesIndex) => ({
|
|
93803
|
+
label,
|
|
93804
|
+
labelHasLatex: Boolean(seriesRendering[seriesIndex]?.labelHasLatex),
|
|
93805
|
+
handle: seriesKeyHandles[seriesIndex]
|
|
93806
|
+
})),
|
|
93807
|
+
showLegend,
|
|
93808
|
+
legendPosition,
|
|
93809
|
+
legendKeyWidth
|
|
93810
|
+
});
|
|
93811
|
+
const xLabelsOnTop = yMax <= 0;
|
|
93812
|
+
const yLabelsOnRight = xMax <= 0;
|
|
93813
|
+
const yLabelBand = AXIS_LABEL_MARGIN_BASE + axisLabelWidth(yTicks);
|
|
93814
|
+
const xLabelBand = baseBottom;
|
|
93815
|
+
const halfWidestXLabel = xTicks ? Math.ceil(axisLabelWidth(xTicks) / 2) : 0;
|
|
93816
|
+
const rightOfPlot = yLabelsOnRight ? yLabelBand : 0;
|
|
93817
|
+
let wantedRight = Math.max(
|
|
93818
|
+
baseRight,
|
|
93819
|
+
halfWidestXLabel,
|
|
93820
|
+
rightOfPlot
|
|
93821
|
+
);
|
|
93822
|
+
let wantedBottom = xLabelsOnTop ? baseTop : xLabelBand;
|
|
93823
|
+
if (legend.onRight) {
|
|
93763
93824
|
wantedRight = Math.max(
|
|
93764
|
-
|
|
93765
|
-
LEGEND_ANCHOR_OFFSET +
|
|
93825
|
+
wantedRight,
|
|
93826
|
+
rightOfPlot + LEGEND_ANCHOR_OFFSET + legend.size.width + LEGEND_OUTSIDE_GAP
|
|
93766
93827
|
);
|
|
93767
|
-
} else if (
|
|
93768
|
-
wantedBottom
|
|
93828
|
+
} else if (legend.onBottom) {
|
|
93829
|
+
wantedBottom += LEGEND_ANCHOR_OFFSET + legend.size.height + LEGEND_OUTSIDE_GAP;
|
|
93769
93830
|
}
|
|
93770
93831
|
const titleText = labelMarkup({ label: title, labelHasLatex: false });
|
|
93771
|
-
const wantedTop = baseTop + (titleText ? TITLE_MARGIN : 0);
|
|
93772
|
-
const wantedLeft =
|
|
93832
|
+
const wantedTop = (xLabelsOnTop ? xLabelBand : baseTop) + (titleText ? TITLE_MARGIN : 0);
|
|
93833
|
+
const wantedLeft = Math.max(
|
|
93834
|
+
yLabelsOnRight ? 0 : yLabelBand,
|
|
93835
|
+
halfWidestXLabel,
|
|
93836
|
+
markOverhang
|
|
93837
|
+
);
|
|
93773
93838
|
const [marginLeft, marginRight] = fitMargins(
|
|
93774
93839
|
widthPx,
|
|
93775
93840
|
wantedLeft,
|
|
93776
93841
|
wantedRight,
|
|
93777
|
-
|
|
93842
|
+
legend.onRight ? OUTSIDE_MARGIN_BUDGET : void 0
|
|
93778
93843
|
);
|
|
93779
93844
|
const [marginBottom, marginTop] = fitMargins(
|
|
93780
93845
|
heightPx,
|
|
93781
93846
|
wantedBottom,
|
|
93782
93847
|
wantedTop,
|
|
93783
|
-
|
|
93848
|
+
legend.onBottom ? OUTSIDE_MARGIN_BUDGET : void 0
|
|
93784
93849
|
);
|
|
93785
93850
|
const innerWidth = widthPx - marginLeft - marginRight;
|
|
93786
93851
|
const innerHeight = heightPx - marginBottom - marginTop;
|
|
93787
93852
|
const dimensions = `(${formatNumber$1(innerWidth)},${formatNumber$1(innerHeight)})`;
|
|
93788
93853
|
const margins = `[${marginLeft},${marginBottom},${marginRight},${marginTop}]`;
|
|
93854
|
+
const finiteScale = (span, pixels) => {
|
|
93855
|
+
const scale = span / (pixels || 1);
|
|
93856
|
+
return Number.isFinite(scale) ? scale : 0;
|
|
93857
|
+
};
|
|
93858
|
+
const unitsPerPixelX = finiteScale(xMax - xMin, innerWidth);
|
|
93859
|
+
const unitsPerPixelY = finiteScale(yMax - yMin, innerHeight);
|
|
93789
93860
|
const strokeAttr = darkModeAxisStrokeAttr(darkMode);
|
|
93790
93861
|
const axisLabelElements = [];
|
|
93791
93862
|
const xLabelText = labelMarkup({
|
|
@@ -93794,7 +93865,7 @@ function createBarChartPrefigureXML({
|
|
|
93794
93865
|
});
|
|
93795
93866
|
if (xLabelText) {
|
|
93796
93867
|
axisLabelElements.push(
|
|
93797
|
-
`<xlabel alignment="nw" ${THEME_AWARE_LABEL_COLOR_ATTR}>${xLabelText}</xlabel>`
|
|
93868
|
+
`<xlabel alignment="${xLabelsOnTop ? "sw" : "nw"}" ${THEME_AWARE_LABEL_COLOR_ATTR}>${xLabelText}</xlabel>`
|
|
93798
93869
|
);
|
|
93799
93870
|
}
|
|
93800
93871
|
const yLabelText = labelMarkup({
|
|
@@ -93802,20 +93873,216 @@ function createBarChartPrefigureXML({
|
|
|
93802
93873
|
labelHasLatex: yLabelHasLatex
|
|
93803
93874
|
});
|
|
93804
93875
|
if (yLabelText) {
|
|
93876
|
+
const secondLine = xLabelsOnTop && yLabelsOnRight && xLabelText ? ` offset="(0,-${AXIS_LABEL_LINE_HEIGHT})"` : "";
|
|
93805
93877
|
axisLabelElements.push(
|
|
93806
|
-
`<ylabel alignment="se" ${THEME_AWARE_LABEL_COLOR_ATTR}>${yLabelText}</ylabel>`
|
|
93878
|
+
`<ylabel alignment="${yLabelsOnRight ? "sw" : "se"}"${secondLine} ${THEME_AWARE_LABEL_COLOR_ATTR}>${yLabelText}</ylabel>`
|
|
93807
93879
|
);
|
|
93808
93880
|
}
|
|
93809
93881
|
const axesInner = axisLabelElements.join("");
|
|
93810
|
-
const
|
|
93882
|
+
const hlabelsAttr = xTicks ? ` hlabels="${escapeXml(axisLabelsAttr(xTicks))}"` : "";
|
|
93883
|
+
const axesAttrs = `axes="all" decorations="no" vlabels="${escapeXml(axisLabelsAttr(yTicks))}"${hlabelsAttr}${strokeAttr}`;
|
|
93811
93884
|
const axesElement = axesInner ? `<axes ${axesAttrs}>${axesInner}</axes>` : `<axes ${axesAttrs} />`;
|
|
93812
93885
|
const elements = [];
|
|
93813
|
-
for (const slot of
|
|
93886
|
+
for (const slot of slots ?? []) {
|
|
93814
93887
|
elements.push(
|
|
93815
93888
|
`<tick-mark axis="horizontal" location="${formatNumber$1(slot.center)}"${strokeAttr} ${THEME_AWARE_LABEL_COLOR_ATTR}>${escapeXml(slot.label)}</tick-mark>`
|
|
93816
93889
|
);
|
|
93817
93890
|
}
|
|
93818
|
-
const groupSeries =
|
|
93891
|
+
const groupSeries = seriesLabels.length > 1;
|
|
93892
|
+
const annotationElements = [];
|
|
93893
|
+
seriesLabels.forEach((seriesLabel, seriesIndex) => {
|
|
93894
|
+
if (!groupSeries) {
|
|
93895
|
+
elements.push(...seriesElements[seriesIndex]);
|
|
93896
|
+
annotationElements.push(...seriesAnnotations[seriesIndex]);
|
|
93897
|
+
return;
|
|
93898
|
+
}
|
|
93899
|
+
const groupHandle = `series-${seriesIndex + 1}`;
|
|
93900
|
+
elements.push(
|
|
93901
|
+
`<group at="${escapeXml(groupHandle)}">${seriesElements[seriesIndex].join("")}</group>`
|
|
93902
|
+
);
|
|
93903
|
+
const seriesName = seriesLabel || seriesRendering[seriesIndex]?.unlabeledName || `${seriesIndex + 1}`;
|
|
93904
|
+
annotationElements.push(
|
|
93905
|
+
`<annotation ref="${escapeXml(groupHandle)}" text="${escapeXml(seriesName)}">${seriesAnnotations[seriesIndex].join("")}</annotation>`
|
|
93906
|
+
);
|
|
93907
|
+
});
|
|
93908
|
+
const legendElement = legendMarkup({
|
|
93909
|
+
plan: legend,
|
|
93910
|
+
bounds,
|
|
93911
|
+
frame: {
|
|
93912
|
+
marginLeft,
|
|
93913
|
+
marginRight,
|
|
93914
|
+
marginBottom,
|
|
93915
|
+
marginTop,
|
|
93916
|
+
innerWidth,
|
|
93917
|
+
innerHeight,
|
|
93918
|
+
unitsPerPixelX,
|
|
93919
|
+
unitsPerPixelY
|
|
93920
|
+
},
|
|
93921
|
+
rightOfPlot
|
|
93922
|
+
});
|
|
93923
|
+
const { titleElement, captionElement } = titleMarkup({
|
|
93924
|
+
titleText,
|
|
93925
|
+
bounds,
|
|
93926
|
+
lift: xLabelsOnTop ? xLabelBand : 0,
|
|
93927
|
+
roomAbove: marginTop,
|
|
93928
|
+
unitsPerPixelY
|
|
93929
|
+
});
|
|
93930
|
+
const annotationsElement = figureAnnotations(
|
|
93931
|
+
shortDescription,
|
|
93932
|
+
annotationElements
|
|
93933
|
+
);
|
|
93934
|
+
const xml = `<diagram dimensions="${escapeXml(dimensions)}" margins="${escapeXml(margins)}"><coordinates bbox="${escapeXml(bbox)}">${axesElement}${elements.join("")}${overlayElements.join("")}${titleElement}${legendElement}</coordinates>${captionElement}${annotationsElement}</diagram>`;
|
|
93935
|
+
return xml;
|
|
93936
|
+
}
|
|
93937
|
+
function segmentHeight(base, top) {
|
|
93938
|
+
const exact = top - base;
|
|
93939
|
+
const snapped = snapNumber(exact);
|
|
93940
|
+
if (Number.isFinite(base + snapped)) {
|
|
93941
|
+
return snapped;
|
|
93942
|
+
}
|
|
93943
|
+
if (Number.isFinite(base + exact)) {
|
|
93944
|
+
return exact;
|
|
93945
|
+
}
|
|
93946
|
+
return exact * (1 - Number.EPSILON);
|
|
93947
|
+
}
|
|
93948
|
+
function computeBarChartGeometry({
|
|
93949
|
+
series,
|
|
93950
|
+
labels,
|
|
93951
|
+
barWidth,
|
|
93952
|
+
layout,
|
|
93953
|
+
yMinAttr,
|
|
93954
|
+
yMaxAttr
|
|
93955
|
+
}) {
|
|
93956
|
+
const numSlots = series.reduce(
|
|
93957
|
+
(widest, oneSeries) => Math.max(widest, oneSeries.values.length),
|
|
93958
|
+
0
|
|
93959
|
+
);
|
|
93960
|
+
const drawable = series.map(
|
|
93961
|
+
(oneSeries) => oneSeries.values.map((value) => Number.isFinite(value))
|
|
93962
|
+
);
|
|
93963
|
+
let undrawnValues = 0;
|
|
93964
|
+
for (const seriesDrawable of drawable) {
|
|
93965
|
+
for (const canDraw of seriesDrawable) {
|
|
93966
|
+
if (!canDraw) {
|
|
93967
|
+
undrawnValues++;
|
|
93968
|
+
}
|
|
93969
|
+
}
|
|
93970
|
+
}
|
|
93971
|
+
const wholeValues = series.every(
|
|
93972
|
+
(oneSeries, seriesInd) => oneSeries.values.every(
|
|
93973
|
+
(value, ind) => !drawable[seriesInd][ind] || Number.isInteger(value)
|
|
93974
|
+
)
|
|
93975
|
+
);
|
|
93976
|
+
const minStep = wholeValues ? 1 : 0;
|
|
93977
|
+
const halfSlot = barWidth / 2;
|
|
93978
|
+
const stacked = layout === "stacked";
|
|
93979
|
+
const oneBarWidth = stacked ? barWidth : barWidth / Math.max(series.length, 1);
|
|
93980
|
+
const stackAbove = new Array(numSlots).fill(0);
|
|
93981
|
+
const stackBelow = new Array(numSlots).fill(0);
|
|
93982
|
+
const bars = [];
|
|
93983
|
+
series.forEach((oneSeries, seriesIndex) => {
|
|
93984
|
+
oneSeries.values.forEach((value, ind) => {
|
|
93985
|
+
if (!drawable[seriesIndex][ind]) {
|
|
93986
|
+
return;
|
|
93987
|
+
}
|
|
93988
|
+
const slot = ind + 1;
|
|
93989
|
+
const center = stacked ? slot : slot - halfSlot + (seriesIndex + 0.5) * oneBarWidth;
|
|
93990
|
+
let base;
|
|
93991
|
+
let height;
|
|
93992
|
+
if (!stacked) {
|
|
93993
|
+
base = Math.min(0, value);
|
|
93994
|
+
height = Math.abs(value);
|
|
93995
|
+
} else if (value < 0) {
|
|
93996
|
+
const bottom = saturatingAdd(stackBelow[ind], value);
|
|
93997
|
+
height = segmentHeight(bottom, stackBelow[ind]);
|
|
93998
|
+
base = bottom;
|
|
93999
|
+
stackBelow[ind] = bottom;
|
|
94000
|
+
} else {
|
|
94001
|
+
base = stackAbove[ind];
|
|
94002
|
+
const top = saturatingAdd(base, value);
|
|
94003
|
+
height = segmentHeight(base, top);
|
|
94004
|
+
stackAbove[ind] = top;
|
|
94005
|
+
}
|
|
94006
|
+
bars.push({
|
|
94007
|
+
seriesIndex,
|
|
94008
|
+
slot,
|
|
94009
|
+
label: labels[ind] ?? String(slot),
|
|
94010
|
+
value,
|
|
94011
|
+
lowerLeft: [
|
|
94012
|
+
snapNumber(center - oneBarWidth / 2),
|
|
94013
|
+
snapNumber(base)
|
|
94014
|
+
],
|
|
94015
|
+
dimensions: [snapNumber(oneBarWidth), height]
|
|
94016
|
+
});
|
|
94017
|
+
});
|
|
94018
|
+
});
|
|
94019
|
+
let reachAbove = 0;
|
|
94020
|
+
let reachBelow = 0;
|
|
94021
|
+
if (stacked) {
|
|
94022
|
+
for (let ind = 0; ind < numSlots; ind++) {
|
|
94023
|
+
reachAbove = Math.max(reachAbove, stackAbove[ind]);
|
|
94024
|
+
reachBelow = Math.min(reachBelow, stackBelow[ind]);
|
|
94025
|
+
}
|
|
94026
|
+
} else {
|
|
94027
|
+
for (const bar of bars) {
|
|
94028
|
+
reachAbove = Math.max(reachAbove, bar.value);
|
|
94029
|
+
reachBelow = Math.min(reachBelow, bar.value);
|
|
94030
|
+
}
|
|
94031
|
+
}
|
|
94032
|
+
const [autoYMin, autoYMax] = autoAxisBounds({
|
|
94033
|
+
low: reachBelow,
|
|
94034
|
+
high: reachAbove,
|
|
94035
|
+
minStep,
|
|
94036
|
+
baseline: 0
|
|
94037
|
+
});
|
|
94038
|
+
const [yMin, yMax] = reconcileBounds(
|
|
94039
|
+
yMinAttr,
|
|
94040
|
+
yMaxAttr,
|
|
94041
|
+
autoYMin,
|
|
94042
|
+
autoYMax
|
|
94043
|
+
);
|
|
94044
|
+
const slots = [];
|
|
94045
|
+
for (let ind = 0; ind < numSlots; ind++) {
|
|
94046
|
+
const center = ind + 1;
|
|
94047
|
+
slots.push({ center, label: labels[ind] ?? String(center) });
|
|
94048
|
+
}
|
|
94049
|
+
return {
|
|
94050
|
+
kind: "bar",
|
|
94051
|
+
series: series.map(({ label }) => ({ label })),
|
|
94052
|
+
bars,
|
|
94053
|
+
slots,
|
|
94054
|
+
// Every slot still counts toward the width, drawn or not, so a chart
|
|
94055
|
+
// with a gap in it keeps its remaining bars under their categories.
|
|
94056
|
+
//
|
|
94057
|
+
// The box ends one unit past the last slot, which is where the gap
|
|
94058
|
+
// beyond the last bar comes out the same size as the gap before the
|
|
94059
|
+
// first one: both are `1 - barWidth/2`. Ending half a unit past the
|
|
94060
|
+
// center instead leaves the last bar six times closer to the frame than
|
|
94061
|
+
// the first at the default width, and flush against it at
|
|
94062
|
+
// `barWidth="1"`.
|
|
94063
|
+
bounds: [0, yMin, numSlots + 1, yMax],
|
|
94064
|
+
tickStep: tickStepForBounds(yMin, yMax, wholeValues),
|
|
94065
|
+
undrawnValues
|
|
94066
|
+
};
|
|
94067
|
+
}
|
|
94068
|
+
function createBarChartPrefigureXML({
|
|
94069
|
+
geometry,
|
|
94070
|
+
seriesRendering,
|
|
94071
|
+
widthPx,
|
|
94072
|
+
heightPx,
|
|
94073
|
+
xLabel,
|
|
94074
|
+
xLabelHasLatex,
|
|
94075
|
+
yLabel,
|
|
94076
|
+
yLabelHasLatex,
|
|
94077
|
+
title,
|
|
94078
|
+
showLegend,
|
|
94079
|
+
legendPosition,
|
|
94080
|
+
displayValues,
|
|
94081
|
+
shortDescription,
|
|
94082
|
+
darkMode = false
|
|
94083
|
+
}) {
|
|
94084
|
+
const diagnostics2 = [];
|
|
94085
|
+
const [, yMin, , yMax] = geometry.bounds;
|
|
93819
94086
|
const seriesStyleAttrs = geometry.series.map(
|
|
93820
94087
|
(_unused, seriesIndex) => styleAttributes({
|
|
93821
94088
|
selectedStyle: seriesRendering[seriesIndex]?.selectedStyle,
|
|
@@ -93851,85 +94118,578 @@ function createBarChartPrefigureXML({
|
|
|
93851
94118
|
`<annotation ref="${escapeXml(handle)}" text="${escapeXml(`${bar.label}: ${formatNumber$1(bar.value)}`)}" />`
|
|
93852
94119
|
);
|
|
93853
94120
|
}
|
|
93854
|
-
const
|
|
93855
|
-
|
|
93856
|
-
|
|
93857
|
-
|
|
93858
|
-
|
|
93859
|
-
|
|
93860
|
-
|
|
93861
|
-
|
|
93862
|
-
|
|
93863
|
-
|
|
93864
|
-
|
|
93865
|
-
|
|
93866
|
-
|
|
93867
|
-
|
|
93868
|
-
|
|
94121
|
+
const xml = assembleChartDiagram({
|
|
94122
|
+
bounds: geometry.bounds,
|
|
94123
|
+
yTicks: axisTicks(yMin, yMax, geometry.tickStep),
|
|
94124
|
+
xTicks: null,
|
|
94125
|
+
slots: geometry.slots,
|
|
94126
|
+
widthPx,
|
|
94127
|
+
heightPx,
|
|
94128
|
+
xLabel,
|
|
94129
|
+
xLabelHasLatex,
|
|
94130
|
+
yLabel,
|
|
94131
|
+
yLabelHasLatex,
|
|
94132
|
+
title,
|
|
94133
|
+
showLegend,
|
|
94134
|
+
legendPosition,
|
|
94135
|
+
seriesRendering,
|
|
94136
|
+
seriesLabels: geometry.series.map(({ label }) => label),
|
|
94137
|
+
seriesElements,
|
|
94138
|
+
seriesAnnotations,
|
|
94139
|
+
seriesKeyHandles,
|
|
94140
|
+
legendKeyWidth: LEGEND_SWATCH_KEY_WIDTH,
|
|
94141
|
+
// A bar is drawn inside the box and clipped to it.
|
|
94142
|
+
markOverhang: 0,
|
|
94143
|
+
overlayElements: valueLabelElements,
|
|
94144
|
+
shortDescription,
|
|
94145
|
+
darkMode
|
|
93869
94146
|
});
|
|
93870
|
-
|
|
93871
|
-
|
|
93872
|
-
|
|
93873
|
-
|
|
93874
|
-
|
|
94147
|
+
return { xml, diagnostics: diagnostics2 };
|
|
94148
|
+
}
|
|
94149
|
+
function computePointChartGeometry({
|
|
94150
|
+
series,
|
|
94151
|
+
labels,
|
|
94152
|
+
xMinAttr,
|
|
94153
|
+
xMaxAttr,
|
|
94154
|
+
yMinAttr,
|
|
94155
|
+
yMaxAttr
|
|
94156
|
+
}) {
|
|
94157
|
+
const numericAxis = series.some((oneSeries) => oneSeries.x !== null);
|
|
94158
|
+
const numSlots = series.reduce(
|
|
94159
|
+
(widest, oneSeries) => Math.max(widest, oneSeries.values.length),
|
|
94160
|
+
0
|
|
94161
|
+
);
|
|
94162
|
+
const points = [];
|
|
94163
|
+
let undrawnValues = 0;
|
|
94164
|
+
series.forEach((oneSeries, seriesIndex) => {
|
|
94165
|
+
oneSeries.values.forEach((y2, ind) => {
|
|
94166
|
+
const slot = ind + 1;
|
|
94167
|
+
const x2 = numericAxis ? oneSeries.x?.[ind] ?? NaN : slot;
|
|
94168
|
+
if (!Number.isFinite(x2) || !Number.isFinite(y2)) {
|
|
94169
|
+
undrawnValues++;
|
|
94170
|
+
return;
|
|
94171
|
+
}
|
|
94172
|
+
points.push({
|
|
94173
|
+
seriesIndex,
|
|
94174
|
+
x: x2,
|
|
94175
|
+
y: y2,
|
|
94176
|
+
slot: numericAxis ? null : slot,
|
|
94177
|
+
label: numericAxis ? "" : labels[ind] ?? String(slot)
|
|
94178
|
+
});
|
|
93875
94179
|
});
|
|
93876
|
-
if (
|
|
93877
|
-
|
|
94180
|
+
if (numericAxis) {
|
|
94181
|
+
undrawnValues += Math.max(
|
|
94182
|
+
0,
|
|
94183
|
+
(oneSeries.x?.length ?? 0) - oneSeries.values.length
|
|
94184
|
+
);
|
|
93878
94185
|
}
|
|
93879
|
-
|
|
93880
|
-
|
|
93881
|
-
|
|
93882
|
-
|
|
93883
|
-
|
|
93884
|
-
|
|
93885
|
-
|
|
93886
|
-
|
|
93887
|
-
|
|
93888
|
-
|
|
93889
|
-
|
|
93890
|
-
|
|
93891
|
-
|
|
93892
|
-
|
|
93893
|
-
|
|
93894
|
-
}
|
|
93895
|
-
|
|
93896
|
-
|
|
93897
|
-
|
|
93898
|
-
|
|
93899
|
-
|
|
93900
|
-
|
|
93901
|
-
|
|
93902
|
-
|
|
94186
|
+
});
|
|
94187
|
+
function wholeAlong(pick2) {
|
|
94188
|
+
return points.every((point2) => Number.isInteger(pick2(point2)));
|
|
94189
|
+
}
|
|
94190
|
+
let low = 0;
|
|
94191
|
+
let high = 0;
|
|
94192
|
+
let first2 = true;
|
|
94193
|
+
for (const point2 of points) {
|
|
94194
|
+
if (first2) {
|
|
94195
|
+
low = point2.y;
|
|
94196
|
+
high = point2.y;
|
|
94197
|
+
first2 = false;
|
|
94198
|
+
} else {
|
|
94199
|
+
low = Math.min(low, point2.y);
|
|
94200
|
+
high = Math.max(high, point2.y);
|
|
94201
|
+
}
|
|
94202
|
+
}
|
|
94203
|
+
const wholeY = wholeAlong((point2) => point2.y);
|
|
94204
|
+
const [autoYMin, autoYMax] = autoAxisBounds({
|
|
94205
|
+
low,
|
|
94206
|
+
high,
|
|
94207
|
+
minStep: wholeY ? 1 : 0,
|
|
94208
|
+
baseline: null
|
|
94209
|
+
});
|
|
94210
|
+
const [yMin, yMax] = reconcileBounds(
|
|
94211
|
+
yMinAttr,
|
|
94212
|
+
yMaxAttr,
|
|
94213
|
+
autoYMin,
|
|
94214
|
+
autoYMax
|
|
94215
|
+
);
|
|
94216
|
+
if (!numericAxis) {
|
|
94217
|
+
return {
|
|
94218
|
+
kind: "point",
|
|
94219
|
+
series: series.map(({ label }) => ({ label })),
|
|
94220
|
+
points,
|
|
94221
|
+
slots: Array.from({ length: numSlots }, (_unused, ind) => ({
|
|
94222
|
+
center: ind + 1,
|
|
94223
|
+
label: labels[ind] ?? String(ind + 1)
|
|
94224
|
+
})),
|
|
94225
|
+
// The same horizontal extent a bar chart of the same categories
|
|
94226
|
+
// gets, so a `<chart type>` switched between them does not move the
|
|
94227
|
+
// data sideways. The vertical pair is the two charts' own: a bar
|
|
94228
|
+
// chart's includes zero and this one's does not.
|
|
94229
|
+
bounds: [0, yMin, numSlots + 1, yMax],
|
|
94230
|
+
tickStep: tickStepForBounds(yMin, yMax, wholeY),
|
|
94231
|
+
xTickStep: null,
|
|
94232
|
+
undrawnValues
|
|
94233
|
+
};
|
|
94234
|
+
}
|
|
94235
|
+
let xLow = 0;
|
|
94236
|
+
let xHigh = 0;
|
|
94237
|
+
let firstX = true;
|
|
94238
|
+
for (const point2 of points) {
|
|
94239
|
+
if (firstX) {
|
|
94240
|
+
xLow = point2.x;
|
|
94241
|
+
xHigh = point2.x;
|
|
94242
|
+
firstX = false;
|
|
94243
|
+
} else {
|
|
94244
|
+
xLow = Math.min(xLow, point2.x);
|
|
94245
|
+
xHigh = Math.max(xHigh, point2.x);
|
|
94246
|
+
}
|
|
94247
|
+
}
|
|
94248
|
+
const wholeX = wholeAlong((point2) => point2.x);
|
|
94249
|
+
const [autoXMin, autoXMax] = autoAxisBounds({
|
|
94250
|
+
low: xLow,
|
|
94251
|
+
high: xHigh,
|
|
94252
|
+
minStep: wholeX ? 1 : 0,
|
|
94253
|
+
baseline: null
|
|
94254
|
+
});
|
|
94255
|
+
const [xMin, xMax] = reconcileBounds(
|
|
94256
|
+
xMinAttr,
|
|
94257
|
+
xMaxAttr,
|
|
94258
|
+
autoXMin,
|
|
94259
|
+
autoXMax
|
|
94260
|
+
);
|
|
94261
|
+
return {
|
|
94262
|
+
kind: "point",
|
|
94263
|
+
series: series.map(({ label }) => ({ label })),
|
|
94264
|
+
points,
|
|
94265
|
+
slots: null,
|
|
94266
|
+
bounds: [xMin, yMin, xMax, yMax],
|
|
94267
|
+
tickStep: tickStepForBounds(yMin, yMax, wholeY),
|
|
94268
|
+
xTickStep: tickStepForBounds(xMin, xMax, wholeX),
|
|
94269
|
+
undrawnValues
|
|
94270
|
+
};
|
|
94271
|
+
}
|
|
94272
|
+
const MARKER_OVERHANG = 7;
|
|
94273
|
+
function pointCoordinates(point2) {
|
|
94274
|
+
return `(${formatNumber$1(point2.x)},${formatNumber$1(point2.y)})`;
|
|
94275
|
+
}
|
|
94276
|
+
function pointInBounds(point2, [xMin, yMin, xMax, yMax]) {
|
|
94277
|
+
return point2.x >= xMin && point2.x <= xMax && point2.y >= yMin && point2.y <= yMax;
|
|
94278
|
+
}
|
|
94279
|
+
function createPointChartPrefigureXML({
|
|
94280
|
+
geometry,
|
|
94281
|
+
shape,
|
|
94282
|
+
seriesRendering,
|
|
94283
|
+
markers,
|
|
94284
|
+
widthPx,
|
|
94285
|
+
heightPx,
|
|
94286
|
+
xLabel,
|
|
94287
|
+
xLabelHasLatex,
|
|
94288
|
+
yLabel,
|
|
94289
|
+
yLabelHasLatex,
|
|
94290
|
+
title,
|
|
94291
|
+
showLegend,
|
|
94292
|
+
legendPosition,
|
|
94293
|
+
displayValues,
|
|
94294
|
+
shortDescription,
|
|
94295
|
+
darkMode = false
|
|
94296
|
+
}) {
|
|
94297
|
+
const diagnostics2 = [];
|
|
94298
|
+
const [xMin, yMin, xMax, yMax] = geometry.bounds;
|
|
94299
|
+
const drawMarkers = shape === "scatter" || markers;
|
|
94300
|
+
const drawLine = shape === "line";
|
|
94301
|
+
const seriesElements = geometry.series.map(() => []);
|
|
94302
|
+
const seriesAnnotations = geometry.series.map(() => []);
|
|
94303
|
+
const seriesKeyHandles = geometry.series.map(() => null);
|
|
94304
|
+
const valueLabelElements = [];
|
|
94305
|
+
const pointsBySeries = geometry.series.map(() => []);
|
|
94306
|
+
for (const point2 of geometry.points) {
|
|
94307
|
+
pointsBySeries[point2.seriesIndex]?.push(point2);
|
|
94308
|
+
}
|
|
94309
|
+
pointsBySeries.forEach((seriesPoints, seriesIndex) => {
|
|
94310
|
+
const selectedStyle = seriesRendering[seriesIndex]?.selectedStyle;
|
|
94311
|
+
if (drawLine && seriesPoints.length > 0) {
|
|
94312
|
+
const lineAttrs = styleAttributes({
|
|
94313
|
+
selectedStyle,
|
|
94314
|
+
diagnostics: diagnostics2,
|
|
94315
|
+
warningPrefix: "<chart>",
|
|
94316
|
+
includeFill: false
|
|
94317
|
+
}).join(" ");
|
|
94318
|
+
const handle = `line-${seriesIndex + 1}`;
|
|
94319
|
+
const coordinates = seriesPoints.map(pointCoordinates).join(",");
|
|
94320
|
+
seriesElements[seriesIndex].push(
|
|
94321
|
+
`<polygon at="${escapeXml(handle)}" points="${escapeXml(`[${coordinates}]`)}" closed="no" cliptobbox="yes"${lineAttrs ? ` ${lineAttrs}` : ""} />`
|
|
93903
94322
|
);
|
|
93904
|
-
|
|
93905
|
-
|
|
93906
|
-
|
|
94323
|
+
seriesKeyHandles[seriesIndex] = handle;
|
|
94324
|
+
if (!drawMarkers) {
|
|
94325
|
+
const rendering = seriesRendering[seriesIndex];
|
|
94326
|
+
seriesAnnotations[seriesIndex].push(
|
|
94327
|
+
`<annotation ref="${escapeXml(handle)}" text="${escapeXml(
|
|
94328
|
+
rendering?.label || rendering?.unlabeledName || `${seriesIndex + 1}`
|
|
94329
|
+
)}" />`
|
|
94330
|
+
);
|
|
94331
|
+
}
|
|
94332
|
+
}
|
|
94333
|
+
if (displayValues) {
|
|
94334
|
+
for (const point2 of seriesPoints) {
|
|
94335
|
+
if (!pointInBounds(point2, geometry.bounds)) {
|
|
94336
|
+
continue;
|
|
94337
|
+
}
|
|
94338
|
+
valueLabelElements.push(
|
|
94339
|
+
`<label anchor="${escapeXml(pointCoordinates(point2))}" alignment="north" ${THEME_AWARE_LABEL_COLOR_ATTR}>${escapeXml(formatNumber$1(point2.y) ?? "")}</label>`
|
|
94340
|
+
);
|
|
94341
|
+
}
|
|
94342
|
+
}
|
|
94343
|
+
if (!drawMarkers) {
|
|
94344
|
+
return;
|
|
94345
|
+
}
|
|
94346
|
+
const pointAttrs = pointStyleAttributes({
|
|
94347
|
+
selectedStyle,
|
|
94348
|
+
diagnostics: diagnostics2,
|
|
94349
|
+
warningPrefix: "<chart>"
|
|
94350
|
+
}).join(" ");
|
|
94351
|
+
seriesPoints.forEach((point2, ind) => {
|
|
94352
|
+
if (!pointInBounds(point2, geometry.bounds)) {
|
|
94353
|
+
return;
|
|
94354
|
+
}
|
|
94355
|
+
const handle = `point-${seriesIndex + 1}-${ind + 1}`;
|
|
94356
|
+
if (seriesKeyHandles[seriesIndex] === null) {
|
|
94357
|
+
seriesKeyHandles[seriesIndex] = handle;
|
|
94358
|
+
}
|
|
94359
|
+
seriesElements[seriesIndex].push(
|
|
94360
|
+
`<point at="${escapeXml(handle)}" p="${escapeXml(pointCoordinates(point2))}"${pointAttrs ? ` ${pointAttrs}` : ""} />`
|
|
93907
94361
|
);
|
|
93908
|
-
|
|
93909
|
-
|
|
93910
|
-
|
|
93911
|
-
const belowAxis = Math.max(
|
|
93912
|
-
marginBottom - LEGEND_OUTSIDE_GAP - legendSize.height - LEGEND_ANCHOR_OFFSET,
|
|
93913
|
-
-(marginTop + innerHeight)
|
|
94362
|
+
const spoken = point2.label ? `${point2.label}: ${formatNumber$1(point2.y)}` : `${formatNumber$1(point2.x)}, ${formatNumber$1(point2.y)}`;
|
|
94363
|
+
seriesAnnotations[seriesIndex].push(
|
|
94364
|
+
`<annotation ref="${escapeXml(handle)}" text="${escapeXml(spoken)}" />`
|
|
93914
94365
|
);
|
|
93915
|
-
|
|
93916
|
-
|
|
94366
|
+
});
|
|
94367
|
+
});
|
|
94368
|
+
const xml = assembleChartDiagram({
|
|
94369
|
+
bounds: geometry.bounds,
|
|
94370
|
+
yTicks: axisTicks(yMin, yMax, geometry.tickStep),
|
|
94371
|
+
xTicks: geometry.xTickStep === null ? null : axisTicks(xMin, xMax, geometry.xTickStep),
|
|
94372
|
+
slots: geometry.slots,
|
|
94373
|
+
widthPx,
|
|
94374
|
+
heightPx,
|
|
94375
|
+
xLabel,
|
|
94376
|
+
xLabelHasLatex,
|
|
94377
|
+
yLabel,
|
|
94378
|
+
yLabelHasLatex,
|
|
94379
|
+
title,
|
|
94380
|
+
showLegend,
|
|
94381
|
+
legendPosition,
|
|
94382
|
+
seriesRendering,
|
|
94383
|
+
seriesLabels: geometry.series.map(({ label }) => label),
|
|
94384
|
+
seriesElements,
|
|
94385
|
+
seriesAnnotations,
|
|
94386
|
+
seriesKeyHandles,
|
|
94387
|
+
// A line chart keys its legend off the line, which PreFigure draws as
|
|
94388
|
+
// a segment rather than a swatch, and a segment is wider.
|
|
94389
|
+
legendKeyWidth: drawLine ? LEGEND_LINE_KEY_WIDTH : LEGEND_SWATCH_KEY_WIDTH,
|
|
94390
|
+
markOverhang: drawMarkers ? MARKER_OVERHANG : 0,
|
|
94391
|
+
overlayElements: valueLabelElements,
|
|
94392
|
+
shortDescription,
|
|
94393
|
+
darkMode
|
|
94394
|
+
});
|
|
94395
|
+
return { xml, diagnostics: diagnostics2 };
|
|
94396
|
+
}
|
|
94397
|
+
function computePieChartGeometry({
|
|
94398
|
+
series,
|
|
94399
|
+
labels
|
|
94400
|
+
}) {
|
|
94401
|
+
const values2 = series[0]?.values ?? [];
|
|
94402
|
+
let undrawnValues = 0;
|
|
94403
|
+
let negativeValues = 0;
|
|
94404
|
+
let total = 0;
|
|
94405
|
+
let largest = 0;
|
|
94406
|
+
const shares = [];
|
|
94407
|
+
values2.forEach((value, ind) => {
|
|
94408
|
+
if (!Number.isFinite(value)) {
|
|
94409
|
+
undrawnValues++;
|
|
94410
|
+
return;
|
|
94411
|
+
}
|
|
94412
|
+
if (value < 0) {
|
|
94413
|
+
negativeValues++;
|
|
94414
|
+
return;
|
|
94415
|
+
}
|
|
94416
|
+
total = saturatingAdd(total, value);
|
|
94417
|
+
largest = Math.max(largest, value);
|
|
94418
|
+
shares.push({ label: labels[ind] ?? String(ind + 1), value });
|
|
94419
|
+
});
|
|
94420
|
+
const slices = [];
|
|
94421
|
+
if (total > 0) {
|
|
94422
|
+
let scaledTotal = 0;
|
|
94423
|
+
for (const { value } of shares) {
|
|
94424
|
+
scaledTotal += value / largest;
|
|
94425
|
+
}
|
|
94426
|
+
let turned = 0;
|
|
94427
|
+
for (const { label, value } of shares) {
|
|
94428
|
+
const fraction2 = value / largest / scaledTotal;
|
|
94429
|
+
const sweep = Math.min(fraction2, Math.max(1 - turned, 0)) * 360;
|
|
94430
|
+
slices.push({
|
|
94431
|
+
label,
|
|
94432
|
+
value,
|
|
94433
|
+
fraction: fraction2,
|
|
94434
|
+
// Snapped like every other computed coordinate here: the angles
|
|
94435
|
+
// are reached by accumulating shares, and three equal ones
|
|
94436
|
+
// would otherwise start at `120.00000000000001`.
|
|
94437
|
+
startAngle: snapNumber(turned * 360),
|
|
94438
|
+
sweep: snapNumber(sweep)
|
|
94439
|
+
});
|
|
94440
|
+
turned += sweep / 360;
|
|
93917
94441
|
}
|
|
93918
|
-
const anchor = `(${formatNumber$1(anchorX)},${formatNumber$1(anchorY)})`;
|
|
93919
|
-
legendElement = `<legend anchor="${escapeXml(anchor)}" alignment="${placement.alignment}" opacity="0" stroke="currentColor">${legendItems.join("")}</legend>`;
|
|
93920
94442
|
}
|
|
93921
|
-
|
|
93922
|
-
|
|
93923
|
-
|
|
93924
|
-
|
|
93925
|
-
|
|
93926
|
-
|
|
94443
|
+
return {
|
|
94444
|
+
kind: "pie",
|
|
94445
|
+
series: series.length > 0 ? [{ label: series[0].label }] : [],
|
|
94446
|
+
slices,
|
|
94447
|
+
total,
|
|
94448
|
+
valuesInTotal: shares.length,
|
|
94449
|
+
undrawnValues,
|
|
94450
|
+
negativeValues,
|
|
94451
|
+
undrawnSeries: Math.max(series.length - 1, 0)
|
|
94452
|
+
};
|
|
94453
|
+
}
|
|
94454
|
+
const PIE_RADIUS = 1;
|
|
94455
|
+
const PIE_PADDING = 8;
|
|
94456
|
+
const COMPASS_ALIGNMENTS = [
|
|
94457
|
+
"east",
|
|
94458
|
+
"northeast",
|
|
94459
|
+
"north",
|
|
94460
|
+
"northwest",
|
|
94461
|
+
"west",
|
|
94462
|
+
"southwest",
|
|
94463
|
+
"south",
|
|
94464
|
+
"southeast"
|
|
94465
|
+
];
|
|
94466
|
+
function compassAlignment(degrees) {
|
|
94467
|
+
const octant = Math.round(degrees / 45);
|
|
94468
|
+
return COMPASS_ALIGNMENTS[(octant % 8 + 8) % 8];
|
|
94469
|
+
}
|
|
94470
|
+
const SLICE_LABEL_REACH = {
|
|
94471
|
+
east: { side: "right", cap: null },
|
|
94472
|
+
northeast: { side: "right", cap: "top" },
|
|
94473
|
+
southeast: { side: "right", cap: "bottom" },
|
|
94474
|
+
west: { side: "left", cap: null },
|
|
94475
|
+
northwest: { side: "left", cap: "top" },
|
|
94476
|
+
southwest: { side: "left", cap: "bottom" },
|
|
94477
|
+
north: { side: null, cap: "top" },
|
|
94478
|
+
south: { side: null, cap: "bottom" }
|
|
94479
|
+
};
|
|
94480
|
+
function assemblePieDiagram({
|
|
94481
|
+
widthPx,
|
|
94482
|
+
heightPx,
|
|
94483
|
+
title,
|
|
94484
|
+
showLegend,
|
|
94485
|
+
legendPosition,
|
|
94486
|
+
legendEntries,
|
|
94487
|
+
sliceLabelBands,
|
|
94488
|
+
elements,
|
|
94489
|
+
overlayElements,
|
|
94490
|
+
annotationElements,
|
|
94491
|
+
shortDescription
|
|
94492
|
+
}) {
|
|
94493
|
+
const legend = planLegend({
|
|
94494
|
+
entries: legendEntries,
|
|
94495
|
+
showLegend,
|
|
94496
|
+
legendPosition,
|
|
94497
|
+
legendKeyWidth: LEGEND_SWATCH_KEY_WIDTH
|
|
94498
|
+
});
|
|
94499
|
+
const titleText = labelMarkup({ label: title, labelHasLatex: false });
|
|
94500
|
+
const wantedLeft = PIE_PADDING + sliceLabelBands.left;
|
|
94501
|
+
const legendWidthRoom = LEGEND_ANCHOR_OFFSET + legend.size.width + LEGEND_OUTSIDE_GAP;
|
|
94502
|
+
const legendHeightRoom = LEGEND_ANCHOR_OFFSET + legend.size.height + LEGEND_OUTSIDE_GAP;
|
|
94503
|
+
const textBeyondRim = sliceLabelBands.left > 0 || sliceLabelBands.right > 0 || sliceLabelBands.top > 0 || sliceLabelBands.bottom > 0;
|
|
94504
|
+
const sideBudget = Math.floor(
|
|
94505
|
+
widthPx * (legend.onRight || textBeyondRim ? OUTSIDE_MARGIN_BUDGET : 1 / 2)
|
|
94506
|
+
);
|
|
94507
|
+
let rightOfPlot = 0;
|
|
94508
|
+
let wantedRight = PIE_PADDING + sliceLabelBands.right;
|
|
94509
|
+
let wantedBottom = PIE_PADDING + sliceLabelBands.bottom;
|
|
94510
|
+
if (legend.onRight) {
|
|
94511
|
+
const pastTheText = sliceLabelBands.right + legendWidthRoom;
|
|
94512
|
+
if (wantedLeft + Math.max(wantedRight, pastTheText) <= sideBudget) {
|
|
94513
|
+
rightOfPlot = sliceLabelBands.right;
|
|
94514
|
+
wantedRight = Math.max(wantedRight, pastTheText);
|
|
94515
|
+
} else {
|
|
94516
|
+
wantedRight = Math.max(wantedRight, legendWidthRoom);
|
|
94517
|
+
}
|
|
94518
|
+
} else if (legend.onBottom) {
|
|
94519
|
+
wantedBottom += legendHeightRoom;
|
|
93927
94520
|
}
|
|
93928
|
-
const
|
|
93929
|
-
const
|
|
93930
|
-
|
|
94521
|
+
const wantedTop = PIE_PADDING + sliceLabelBands.top + (titleText ? TITLE_MARGIN : 0);
|
|
94522
|
+
const [marginLeft, marginRight] = fitMargins(
|
|
94523
|
+
widthPx,
|
|
94524
|
+
wantedLeft,
|
|
94525
|
+
wantedRight,
|
|
94526
|
+
legend.onRight || textBeyondRim ? OUTSIDE_MARGIN_BUDGET : void 0
|
|
94527
|
+
);
|
|
94528
|
+
const [marginBottom, marginTop] = fitMargins(
|
|
94529
|
+
heightPx,
|
|
94530
|
+
wantedBottom,
|
|
94531
|
+
wantedTop,
|
|
94532
|
+
legend.onBottom || textBeyondRim ? OUTSIDE_MARGIN_BUDGET : void 0
|
|
94533
|
+
);
|
|
94534
|
+
const innerWidth = widthPx - marginLeft - marginRight;
|
|
94535
|
+
const innerHeight = heightPx - marginBottom - marginTop;
|
|
94536
|
+
const shorterSide = Math.min(innerWidth, innerHeight);
|
|
94537
|
+
const usable = shorterSide > 0 && Number.isFinite(shorterSide);
|
|
94538
|
+
const halfWidth = usable ? innerWidth / shorterSide : 1;
|
|
94539
|
+
const halfHeight = usable ? innerHeight / shorterSide : 1;
|
|
94540
|
+
const unitsPerPixel = usable ? 2 / shorterSide : 0;
|
|
94541
|
+
const bounds = [
|
|
94542
|
+
-halfWidth,
|
|
94543
|
+
-halfHeight,
|
|
94544
|
+
halfWidth,
|
|
94545
|
+
halfHeight
|
|
94546
|
+
];
|
|
94547
|
+
const dimensions = `(${formatNumber$1(innerWidth)},${formatNumber$1(innerHeight)})`;
|
|
94548
|
+
const margins = `[${marginLeft},${marginBottom},${marginRight},${marginTop}]`;
|
|
94549
|
+
const bbox = `(${formatNumber$1(bounds[0])},${formatNumber$1(bounds[1])},${formatNumber$1(bounds[2])},${formatNumber$1(bounds[3])})`;
|
|
94550
|
+
const legendElement = legendMarkup({
|
|
94551
|
+
plan: legend,
|
|
94552
|
+
bounds,
|
|
94553
|
+
frame: {
|
|
94554
|
+
marginLeft,
|
|
94555
|
+
marginRight,
|
|
94556
|
+
marginBottom,
|
|
94557
|
+
marginTop,
|
|
94558
|
+
innerWidth,
|
|
94559
|
+
innerHeight,
|
|
94560
|
+
unitsPerPixelX: unitsPerPixel,
|
|
94561
|
+
unitsPerPixelY: unitsPerPixel
|
|
94562
|
+
},
|
|
94563
|
+
rightOfPlot
|
|
94564
|
+
});
|
|
94565
|
+
const { titleElement, captionElement } = titleMarkup({
|
|
94566
|
+
titleText,
|
|
94567
|
+
bounds,
|
|
94568
|
+
// Above the text beyond the rim where that shares the top margin,
|
|
94569
|
+
// which is where the label of a slice pointing straight up is drawn.
|
|
94570
|
+
// Both are anchored at the top of the box and drawn upwards from it, so
|
|
94571
|
+
// without the lift a pie of eight equal slices drew its first name
|
|
94572
|
+
// through its own title. The margin already holds both bands.
|
|
94573
|
+
lift: sliceLabelBands.top,
|
|
94574
|
+
roomAbove: marginTop,
|
|
94575
|
+
unitsPerPixelY: unitsPerPixel
|
|
94576
|
+
});
|
|
94577
|
+
const annotationsElement = figureAnnotations(
|
|
94578
|
+
shortDescription,
|
|
94579
|
+
annotationElements
|
|
94580
|
+
);
|
|
94581
|
+
return `<diagram dimensions="${escapeXml(dimensions)}" margins="${escapeXml(margins)}"><coordinates bbox="${escapeXml(bbox)}">${elements.join("")}${overlayElements.join("")}${titleElement}${legendElement}</coordinates>${captionElement}${annotationsElement}</diagram>`;
|
|
94582
|
+
}
|
|
94583
|
+
function createPieChartPrefigureXML({
|
|
94584
|
+
geometry,
|
|
94585
|
+
sliceStyles,
|
|
94586
|
+
widthPx,
|
|
94587
|
+
heightPx,
|
|
94588
|
+
title,
|
|
94589
|
+
showLegend,
|
|
94590
|
+
legendPosition,
|
|
94591
|
+
displayValues,
|
|
94592
|
+
shortDescription
|
|
94593
|
+
}) {
|
|
94594
|
+
const diagnostics2 = [];
|
|
94595
|
+
const elements = [];
|
|
94596
|
+
const overlayElements = [];
|
|
94597
|
+
const annotationElements = [];
|
|
94598
|
+
const legendEntries = [];
|
|
94599
|
+
const namesBeyondRim = !showLegend;
|
|
94600
|
+
const sliceLabelBands = {
|
|
94601
|
+
left: 0,
|
|
94602
|
+
right: 0,
|
|
94603
|
+
top: 0,
|
|
94604
|
+
bottom: 0
|
|
94605
|
+
};
|
|
94606
|
+
geometry.slices.forEach((slice2, sliceIndex) => {
|
|
94607
|
+
if (!(slice2.sweep > 0)) {
|
|
94608
|
+
return;
|
|
94609
|
+
}
|
|
94610
|
+
const handle = `slice-${sliceIndex + 1}`;
|
|
94611
|
+
const sliceAttrs = styleAttributes({
|
|
94612
|
+
selectedStyle: sliceStyles[sliceIndex],
|
|
94613
|
+
diagnostics: diagnostics2,
|
|
94614
|
+
warningPrefix: "<chart>"
|
|
94615
|
+
}).join(" ");
|
|
94616
|
+
const startDegrees = snapNumber(90 - slice2.startAngle);
|
|
94617
|
+
const endDegrees = snapNumber(startDegrees - slice2.sweep);
|
|
94618
|
+
const range2 = `(${formatNumber$1(startDegrees)},${formatNumber$1(endDegrees)})`;
|
|
94619
|
+
elements.push(
|
|
94620
|
+
`<arc at="${escapeXml(handle)}" center="(0,0)" radius="${PIE_RADIUS}" range="${escapeXml(range2)}" sector="yes"${sliceAttrs ? ` ${sliceAttrs}` : ""} />`
|
|
94621
|
+
);
|
|
94622
|
+
const midDegrees = snapNumber(startDegrees - slice2.sweep / 2);
|
|
94623
|
+
const midRadians = midDegrees * Math.PI / 180;
|
|
94624
|
+
const atTheRim = `(${formatNumber$1(snapNumber(PIE_RADIUS * Math.cos(midRadians)))},${formatNumber$1(snapNumber(PIE_RADIUS * Math.sin(midRadians)))})`;
|
|
94625
|
+
if (!namesBeyondRim) {
|
|
94626
|
+
legendEntries.push({
|
|
94627
|
+
label: slice2.label,
|
|
94628
|
+
// A category is a `textList` entry, which is text and nothing
|
|
94629
|
+
// else — there is no LaTeX in it to typeset.
|
|
94630
|
+
labelHasLatex: false,
|
|
94631
|
+
handle
|
|
94632
|
+
});
|
|
94633
|
+
}
|
|
94634
|
+
const name2 = namesBeyondRim ? slice2.label.trim() : "";
|
|
94635
|
+
const shown = displayValues ? formatNumber$1(slice2.value) ?? "" : "";
|
|
94636
|
+
const rimText = name2 && shown ? `${name2} (${shown})` : name2 || shown;
|
|
94637
|
+
if (rimText) {
|
|
94638
|
+
const alignment = compassAlignment(midDegrees);
|
|
94639
|
+
const reach = SLICE_LABEL_REACH[alignment];
|
|
94640
|
+
if (reach?.side) {
|
|
94641
|
+
sliceLabelBands[reach.side] = Math.max(
|
|
94642
|
+
sliceLabelBands[reach.side],
|
|
94643
|
+
Math.ceil(estimateTextWidth(rimText))
|
|
94644
|
+
);
|
|
94645
|
+
}
|
|
94646
|
+
if (reach?.cap) {
|
|
94647
|
+
sliceLabelBands[reach.cap] = AXIS_LABEL_LINE_HEIGHT;
|
|
94648
|
+
}
|
|
94649
|
+
overlayElements.push(
|
|
94650
|
+
`<label anchor="${escapeXml(atTheRim)}" alignment="${alignment}" ${THEME_AWARE_LABEL_COLOR_ATTR}>${escapeXml(rimText)}</label>`
|
|
94651
|
+
);
|
|
94652
|
+
}
|
|
94653
|
+
annotationElements.push(
|
|
94654
|
+
`<annotation ref="${escapeXml(handle)}" text="${escapeXml(`${slice2.label}: ${formatNumber$1(slice2.value)}`)}" />`
|
|
94655
|
+
);
|
|
94656
|
+
});
|
|
94657
|
+
const xml = assemblePieDiagram({
|
|
94658
|
+
widthPx,
|
|
94659
|
+
heightPx,
|
|
94660
|
+
title,
|
|
94661
|
+
showLegend,
|
|
94662
|
+
legendPosition,
|
|
94663
|
+
legendEntries,
|
|
94664
|
+
sliceLabelBands,
|
|
94665
|
+
elements,
|
|
94666
|
+
overlayElements,
|
|
94667
|
+
annotationElements,
|
|
94668
|
+
shortDescription
|
|
94669
|
+
});
|
|
93931
94670
|
return { xml, diagnostics: diagnostics2 };
|
|
93932
94671
|
}
|
|
94672
|
+
function chartLegendHasItems(geometry) {
|
|
94673
|
+
if (geometry === null) {
|
|
94674
|
+
return false;
|
|
94675
|
+
}
|
|
94676
|
+
if (geometry.kind === "pie") {
|
|
94677
|
+
return geometry.slices.some(
|
|
94678
|
+
(slice2) => slice2.sweep > 0 && labelMarkup({
|
|
94679
|
+
label: slice2.label,
|
|
94680
|
+
labelHasLatex: false
|
|
94681
|
+
}) !== null
|
|
94682
|
+
);
|
|
94683
|
+
}
|
|
94684
|
+
const marks = geometry.kind === "bar" ? geometry.bars : geometry.points;
|
|
94685
|
+
const seriesWithAMark = new Set(marks.map((mark) => mark.seriesIndex));
|
|
94686
|
+
return geometry.series.some(
|
|
94687
|
+
(oneSeries, seriesIndex) => seriesWithAMark.has(seriesIndex) && labelMarkup({
|
|
94688
|
+
label: oneSeries.label,
|
|
94689
|
+
labelHasLatex: false
|
|
94690
|
+
}) !== null
|
|
94691
|
+
);
|
|
94692
|
+
}
|
|
93933
94693
|
function returnShortDescriptionStateVariableDefinition({
|
|
93934
94694
|
componentType,
|
|
93935
94695
|
componentName
|
|
@@ -93977,6 +94737,7 @@ function returnShortDescriptionStateVariableDefinition({
|
|
|
93977
94737
|
}
|
|
93978
94738
|
const DEFAULT_ASPECT_RATIO = 1.5;
|
|
93979
94739
|
const DEFAULT_BAR_WIDTH = 0.8;
|
|
94740
|
+
const DRAWABLE_TYPES = /* @__PURE__ */ new Set(["bar", "line", "scatter", "pie"]);
|
|
93980
94741
|
class Chart extends BlockComponent {
|
|
93981
94742
|
constructor(args) {
|
|
93982
94743
|
super(args);
|
|
@@ -93995,6 +94756,7 @@ class Chart extends BlockComponent {
|
|
|
93995
94756
|
returnSizeAttributes({ componentName: "chart" })
|
|
93996
94757
|
);
|
|
93997
94758
|
attributes.type = {
|
|
94759
|
+
groupName: "marks",
|
|
93998
94760
|
description: "Which chart to draw. Required; there is no default, and `<chart>` with no type draws nothing.",
|
|
93999
94761
|
createComponentOfType: "text",
|
|
94000
94762
|
createStateVariable: "type",
|
|
@@ -94006,6 +94768,18 @@ class Chart extends BlockComponent {
|
|
|
94006
94768
|
{
|
|
94007
94769
|
value: "bar",
|
|
94008
94770
|
description: "A bar chart: one bar per value, standing on a baseline of zero, under a horizontal axis of category names."
|
|
94771
|
+
},
|
|
94772
|
+
{
|
|
94773
|
+
value: "line",
|
|
94774
|
+
description: "A line chart: a path through each series' values in the order given, under category names or against an `x` of their own."
|
|
94775
|
+
},
|
|
94776
|
+
{
|
|
94777
|
+
value: "scatter",
|
|
94778
|
+
description: "A scatter plot: one point per value, against an `x` of its own, or under category names where no series carries one."
|
|
94779
|
+
},
|
|
94780
|
+
{
|
|
94781
|
+
value: "pie",
|
|
94782
|
+
description: "A pie chart: one slice per value, each a share of the total, named by the category names. Draws one series and has no axes."
|
|
94009
94783
|
}
|
|
94010
94784
|
]
|
|
94011
94785
|
};
|
|
@@ -94016,17 +94790,20 @@ class Chart extends BlockComponent {
|
|
|
94016
94790
|
defaultValue: DEFAULT_ASPECT_RATIO
|
|
94017
94791
|
};
|
|
94018
94792
|
attributes.categories = {
|
|
94793
|
+
groupName: "axes",
|
|
94019
94794
|
createComponentOfType: "textList",
|
|
94020
|
-
description: "The label under each
|
|
94795
|
+
description: "The name of each position in the data: the label under each position on the horizontal axis, or the name of each slice of a pie. Defaults to the position itself, 1, 2, 3 and so on. A line or scatter chart whose series carry an `x` is placed by measurement instead and has no positions to name; a bar chart and a pie name theirs whatever else the series carry.",
|
|
94021
94796
|
highlighted: true
|
|
94022
94797
|
};
|
|
94023
94798
|
attributes.barWidth = {
|
|
94024
|
-
|
|
94799
|
+
groupName: "marks",
|
|
94800
|
+
description: "How much of each category's slot the bars fill: greater than 0 and at most 1, so the bars may fill their slot but must have some width. The rest is the gap to the next category. With several series side by side, they divide this between them. Only a bar chart draws with it.",
|
|
94025
94801
|
createComponentOfType: "number",
|
|
94026
94802
|
createStateVariable: "barWidthAttr",
|
|
94027
94803
|
defaultValue: DEFAULT_BAR_WIDTH
|
|
94028
94804
|
};
|
|
94029
94805
|
attributes.layout = {
|
|
94806
|
+
groupName: "marks",
|
|
94030
94807
|
description: "How the bars of several series share a category's slot.",
|
|
94031
94808
|
createComponentOfType: "text",
|
|
94032
94809
|
createStateVariable: "layout",
|
|
@@ -94049,13 +94826,15 @@ class Chart extends BlockComponent {
|
|
|
94049
94826
|
]
|
|
94050
94827
|
};
|
|
94051
94828
|
attributes.legend = {
|
|
94052
|
-
|
|
94829
|
+
groupName: "legend",
|
|
94830
|
+
description: 'Whether to draw a legend naming the series — or, on a pie, naming the slices. A legend is drawn when a series carries a `<label>`, and on a pie whenever there is a slice to name; `legend="false"` suppresses it, and a pie then writes its slice names around the rim instead.',
|
|
94053
94831
|
createComponentOfType: "boolean",
|
|
94054
94832
|
createStateVariable: "legend",
|
|
94055
94833
|
defaultValue: true,
|
|
94056
94834
|
public: true
|
|
94057
94835
|
};
|
|
94058
94836
|
attributes.legendPosition = {
|
|
94837
|
+
groupName: "legend",
|
|
94059
94838
|
description: "Where the legend sits.",
|
|
94060
94839
|
createComponentOfType: "text",
|
|
94061
94840
|
createStateVariable: "legendPosition",
|
|
@@ -94089,25 +94868,56 @@ class Chart extends BlockComponent {
|
|
|
94089
94868
|
}
|
|
94090
94869
|
]
|
|
94091
94870
|
};
|
|
94871
|
+
attributes.xMin = {
|
|
94872
|
+
groupName: "axes",
|
|
94873
|
+
description: "Leftmost value shown on the horizontal axis, for a chart with a numeric one. Defaults to the first tick below the smallest `x`. If `xMin` and `xMax` do not describe a box — both finite, with `xMin` below `xMax` — the axis is chosen from the data instead. A pie has no axes and reads neither.",
|
|
94874
|
+
createComponentOfType: "number",
|
|
94875
|
+
createStateVariable: "xMinAttr",
|
|
94876
|
+
defaultValue: null
|
|
94877
|
+
};
|
|
94878
|
+
attributes.xMax = {
|
|
94879
|
+
groupName: "axes",
|
|
94880
|
+
description: "Rightmost value shown on the horizontal axis, for a chart with a numeric one. Defaults to the first tick above the largest `x`. If `xMin` and `xMax` do not describe a box — both finite, with `xMin` below `xMax` — the axis is chosen from the data instead. A pie has no axes and reads neither.",
|
|
94881
|
+
createComponentOfType: "number",
|
|
94882
|
+
createStateVariable: "xMaxAttr",
|
|
94883
|
+
defaultValue: null
|
|
94884
|
+
};
|
|
94092
94885
|
attributes.yMin = {
|
|
94093
|
-
|
|
94886
|
+
groupName: "axes",
|
|
94887
|
+
description: "Lowest value shown on the vertical axis. Defaults to 0 for a bar chart, whose bars are measured from it, or to the first tick past the smallest value — which is what a bar chart with negative values gets, and what a line or scatter chart always gets. If `yMin` and `yMax` do not describe a box — both finite, with `yMin` below `yMax` — the axis is chosen from the data instead. A pie has no axes and reads neither.",
|
|
94094
94888
|
createComponentOfType: "number",
|
|
94095
94889
|
createStateVariable: "yMinAttr",
|
|
94096
94890
|
defaultValue: null
|
|
94097
94891
|
};
|
|
94098
94892
|
attributes.yMax = {
|
|
94099
|
-
|
|
94893
|
+
groupName: "axes",
|
|
94894
|
+
description: "Highest value shown on the vertical axis. Defaults to the next tick above the largest value. If `yMin` and `yMax` do not describe a box — both finite, with `yMin` below `yMax` — the axis is chosen from the data instead. A pie has no axes and reads neither.",
|
|
94100
94895
|
createComponentOfType: "number",
|
|
94101
94896
|
createStateVariable: "yMaxAttr",
|
|
94102
94897
|
defaultValue: null
|
|
94103
94898
|
};
|
|
94104
94899
|
attributes.displayValues = {
|
|
94105
|
-
|
|
94900
|
+
groupName: "marks",
|
|
94901
|
+
description: "Whether to print each value beside its mark: at a bar's far end — above one that rises, below one that falls — above a line or scatter chart's point, and beyond the rim of a pie's slice.",
|
|
94106
94902
|
createComponentOfType: "boolean",
|
|
94107
94903
|
createStateVariable: "displayValues",
|
|
94108
94904
|
defaultValue: false,
|
|
94109
94905
|
public: true
|
|
94110
94906
|
};
|
|
94907
|
+
attributes.markers = {
|
|
94908
|
+
groupName: "marks",
|
|
94909
|
+
description: "Whether a line chart draws a marker at each of its points. A scatter plot is its markers, so it always draws them. Only a line chart draws with it.",
|
|
94910
|
+
createComponentOfType: "boolean",
|
|
94911
|
+
createStateVariable: "markers",
|
|
94912
|
+
defaultValue: true,
|
|
94913
|
+
public: true,
|
|
94914
|
+
// Alongside `layout`, which is the same thing for a bar chart: the
|
|
94915
|
+
// one control over how a type arranges what it draws. Turning
|
|
94916
|
+
// markers off also costs a screen reader the ability to walk the
|
|
94917
|
+
// series point by point, which is not a trade to make from a
|
|
94918
|
+
// collapsed section of the table.
|
|
94919
|
+
highlighted: true
|
|
94920
|
+
};
|
|
94111
94921
|
attributes.showBorder = {
|
|
94112
94922
|
description: "Whether to render a border around the chart.",
|
|
94113
94923
|
createComponentOfType: "boolean",
|
|
@@ -94246,6 +95056,7 @@ class Chart extends BlockComponent {
|
|
|
94246
95056
|
}
|
|
94247
95057
|
};
|
|
94248
95058
|
stateVariableDefinitions.barWidth = {
|
|
95059
|
+
groupName: "marks",
|
|
94249
95060
|
description: "How much of its slot each bar fills: greater than 0 and at most 1.",
|
|
94250
95061
|
public: true,
|
|
94251
95062
|
shadowingInstructions: {
|
|
@@ -94275,7 +95086,7 @@ class Chart extends BlockComponent {
|
|
|
94275
95086
|
}
|
|
94276
95087
|
};
|
|
94277
95088
|
stateVariableDefinitions.hasAuthorAnnotations = {
|
|
94278
|
-
description: "Whether the chart carries annotations to navigate. Always true: they are generated from the
|
|
95089
|
+
description: "Whether the chart carries annotations to navigate. Always true: they are generated from the marks the chart drew.",
|
|
94279
95090
|
public: true,
|
|
94280
95091
|
forRenderer: true,
|
|
94281
95092
|
shadowingInstructions: {
|
|
@@ -94321,11 +95132,17 @@ class Chart extends BlockComponent {
|
|
|
94321
95132
|
"label",
|
|
94322
95133
|
"labelHasLatex",
|
|
94323
95134
|
"values",
|
|
95135
|
+
"x",
|
|
95136
|
+
"styleNumber",
|
|
94324
95137
|
"selectedStyle",
|
|
94325
95138
|
"hiddenIgnoreParent"
|
|
94326
95139
|
]
|
|
94327
95140
|
},
|
|
94328
95141
|
...returnContentLocaleDependencies(),
|
|
95142
|
+
styleNumber: {
|
|
95143
|
+
dependencyType: "stateVariable",
|
|
95144
|
+
variableName: "styleNumber"
|
|
95145
|
+
},
|
|
94329
95146
|
valueChildren: {
|
|
94330
95147
|
dependencyType: "child",
|
|
94331
95148
|
childGroups: ["numbers", "maths"],
|
|
@@ -94348,6 +95165,16 @@ class Chart extends BlockComponent {
|
|
|
94348
95165
|
values: numericValuesFromValueChildren(
|
|
94349
95166
|
valueChildren
|
|
94350
95167
|
),
|
|
95168
|
+
// Bare values carry no coordinates, so the
|
|
95169
|
+
// horizontal axis stays categorical — which
|
|
95170
|
+
// is what makes `<chart type="line">4 9 2`
|
|
95171
|
+
// draw a line over three categories rather
|
|
95172
|
+
// than refuse for want of an `x`.
|
|
95173
|
+
x: null,
|
|
95174
|
+
// The chart's own, which is what a series
|
|
95175
|
+
// written out with no style of its own
|
|
95176
|
+
// would have taken.
|
|
95177
|
+
styleNumber: dependencyValues.styleNumber,
|
|
94351
95178
|
selectedStyle: dependencyValues.selectedStyle,
|
|
94352
95179
|
unlabeledName: contentTranslator(
|
|
94353
95180
|
dependencyValues
|
|
@@ -94364,6 +95191,14 @@ class Chart extends BlockComponent {
|
|
|
94364
95191
|
label: child.stateValues.label,
|
|
94365
95192
|
labelHasLatex: child.stateValues.labelHasLatex,
|
|
94366
95193
|
values: child.stateValues.values,
|
|
95194
|
+
// Null on a series that gave none, which is what puts
|
|
95195
|
+
// the chart on a categorical axis rather than a
|
|
95196
|
+
// numeric one.
|
|
95197
|
+
x: child.stateValues.x,
|
|
95198
|
+
// Carried alongside the resolved style because a pie
|
|
95199
|
+
// needs the *number* rather than the style: its slices
|
|
95200
|
+
// take a run of numbers starting from this one.
|
|
95201
|
+
styleNumber: child.stateValues.styleNumber,
|
|
94367
95202
|
selectedStyle: child.stateValues.selectedStyle,
|
|
94368
95203
|
// Built here, where the document's language is known.
|
|
94369
95204
|
// The drawing has no way to ask, and a bare position
|
|
@@ -94385,7 +95220,9 @@ class Chart extends BlockComponent {
|
|
|
94385
95220
|
}
|
|
94386
95221
|
};
|
|
94387
95222
|
stateVariableDefinitions.numSeries = {
|
|
94388
|
-
|
|
95223
|
+
groupName: "data",
|
|
95224
|
+
highlighted: true,
|
|
95225
|
+
description: "How many series the chart holds: its `<series>` children that are not hidden, or one for a chart of bare values. Not necessarily how many are drawn — a pie draws the first of them and no more.",
|
|
94389
95226
|
public: true,
|
|
94390
95227
|
shadowingInstructions: {
|
|
94391
95228
|
createComponentOfType: "integer"
|
|
@@ -94401,6 +95238,8 @@ class Chart extends BlockComponent {
|
|
|
94401
95238
|
})
|
|
94402
95239
|
};
|
|
94403
95240
|
stateVariableDefinitions.values = {
|
|
95241
|
+
groupName: "data",
|
|
95242
|
+
highlighted: true,
|
|
94404
95243
|
description: "Every value charted, series by series.",
|
|
94405
95244
|
public: true,
|
|
94406
95245
|
isArray: true,
|
|
@@ -94442,7 +95281,8 @@ class Chart extends BlockComponent {
|
|
|
94442
95281
|
}
|
|
94443
95282
|
};
|
|
94444
95283
|
stateVariableDefinitions.categories = {
|
|
94445
|
-
|
|
95284
|
+
groupName: "axes",
|
|
95285
|
+
description: "The name of each position in the data, in order: the label under each bar, or the name of each slice of a pie.",
|
|
94446
95286
|
public: true,
|
|
94447
95287
|
isArray: true,
|
|
94448
95288
|
entryPrefixes: ["category"],
|
|
@@ -94487,6 +95327,7 @@ class Chart extends BlockComponent {
|
|
|
94487
95327
|
}
|
|
94488
95328
|
};
|
|
94489
95329
|
stateVariableDefinitions.title = {
|
|
95330
|
+
groupName: "marks",
|
|
94490
95331
|
description: "The chart's title, or the empty string when it has none.",
|
|
94491
95332
|
public: true,
|
|
94492
95333
|
shadowingInstructions: {
|
|
@@ -94509,6 +95350,7 @@ class Chart extends BlockComponent {
|
|
|
94509
95350
|
}
|
|
94510
95351
|
};
|
|
94511
95352
|
stateVariableDefinitions.showLegend = {
|
|
95353
|
+
groupName: "legend",
|
|
94512
95354
|
description: "Whether a legend is drawn.",
|
|
94513
95355
|
public: true,
|
|
94514
95356
|
shadowingInstructions: {
|
|
@@ -94527,15 +95369,13 @@ class Chart extends BlockComponent {
|
|
|
94527
95369
|
definition({ dependencyValues }) {
|
|
94528
95370
|
return {
|
|
94529
95371
|
setValue: {
|
|
94530
|
-
showLegend: dependencyValues.legend &&
|
|
94531
|
-
dependencyValues.chartGeometry
|
|
94532
|
-
)
|
|
95372
|
+
showLegend: dependencyValues.legend && chartLegendHasItems(dependencyValues.chartGeometry)
|
|
94533
95373
|
}
|
|
94534
95374
|
};
|
|
94535
95375
|
}
|
|
94536
95376
|
};
|
|
94537
95377
|
stateVariableDefinitions.chartGeometry = {
|
|
94538
|
-
description: "The
|
|
95378
|
+
description: "The marks of the chart, in data coordinates, with the bounds they are drawn in where the type has any, or null when there is no chart to draw.",
|
|
94539
95379
|
returnDependencies: () => ({
|
|
94540
95380
|
type: {
|
|
94541
95381
|
dependencyType: "stateVariable",
|
|
@@ -94557,6 +95397,14 @@ class Chart extends BlockComponent {
|
|
|
94557
95397
|
dependencyType: "stateVariable",
|
|
94558
95398
|
variableName: "layout"
|
|
94559
95399
|
},
|
|
95400
|
+
xMinAttr: {
|
|
95401
|
+
dependencyType: "stateVariable",
|
|
95402
|
+
variableName: "xMinAttr"
|
|
95403
|
+
},
|
|
95404
|
+
xMaxAttr: {
|
|
95405
|
+
dependencyType: "stateVariable",
|
|
95406
|
+
variableName: "xMaxAttr"
|
|
95407
|
+
},
|
|
94560
95408
|
yMinAttr: {
|
|
94561
95409
|
dependencyType: "stateVariable",
|
|
94562
95410
|
variableName: "yMinAttr"
|
|
@@ -94567,7 +95415,8 @@ class Chart extends BlockComponent {
|
|
|
94567
95415
|
}
|
|
94568
95416
|
}),
|
|
94569
95417
|
definition({ dependencyValues }) {
|
|
94570
|
-
|
|
95418
|
+
const { type } = dependencyValues;
|
|
95419
|
+
if (!DRAWABLE_TYPES.has(type)) {
|
|
94571
95420
|
return {
|
|
94572
95421
|
setValue: { chartGeometry: null },
|
|
94573
95422
|
sendDiagnostics: [
|
|
@@ -94578,35 +95427,181 @@ class Chart extends BlockComponent {
|
|
|
94578
95427
|
]
|
|
94579
95428
|
};
|
|
94580
95429
|
}
|
|
94581
|
-
|
|
95430
|
+
if (type === "bar") {
|
|
95431
|
+
const geometry2 = computeBarChartGeometry({
|
|
95432
|
+
series: dependencyValues.seriesData.map(
|
|
95433
|
+
({ label, values: values2 }) => ({ label, values: values2 })
|
|
95434
|
+
),
|
|
95435
|
+
labels: dependencyValues.categories,
|
|
95436
|
+
barWidth: dependencyValues.barWidth,
|
|
95437
|
+
layout: dependencyValues.layout,
|
|
95438
|
+
yMinAttr: dependencyValues.yMinAttr,
|
|
95439
|
+
yMaxAttr: dependencyValues.yMaxAttr
|
|
95440
|
+
});
|
|
95441
|
+
return {
|
|
95442
|
+
setValue: { chartGeometry: geometry2 },
|
|
95443
|
+
// A value that is not a finite number gets no bar.
|
|
95444
|
+
// Saying so matters because the alternative reading of
|
|
95445
|
+
// a missing bar is a value of zero, and the author
|
|
95446
|
+
// cannot tell the two apart by looking. The message
|
|
95447
|
+
// carries no count, so the append-only diagnostics
|
|
95448
|
+
// queue holds one of it however often the values
|
|
95449
|
+
// change.
|
|
95450
|
+
sendDiagnostics: geometry2.undrawnValues > 0 ? [
|
|
95451
|
+
codedDiagnostic({
|
|
95452
|
+
type: "warning",
|
|
95453
|
+
code: "doenet-w0144"
|
|
95454
|
+
})
|
|
95455
|
+
] : []
|
|
95456
|
+
};
|
|
95457
|
+
}
|
|
95458
|
+
if (type === "pie") {
|
|
95459
|
+
const geometry2 = computePieChartGeometry({
|
|
95460
|
+
series: dependencyValues.seriesData.map(
|
|
95461
|
+
({ label, values: values2 }) => ({ label, values: values2 })
|
|
95462
|
+
),
|
|
95463
|
+
labels: dependencyValues.categories
|
|
95464
|
+
});
|
|
95465
|
+
const sendDiagnostics = [];
|
|
95466
|
+
if (geometry2.undrawnValues > 0) {
|
|
95467
|
+
sendDiagnostics.push(
|
|
95468
|
+
codedDiagnostic({
|
|
95469
|
+
type: "warning",
|
|
95470
|
+
code: "doenet-w0149"
|
|
95471
|
+
})
|
|
95472
|
+
);
|
|
95473
|
+
}
|
|
95474
|
+
if (geometry2.negativeValues > 0) {
|
|
95475
|
+
sendDiagnostics.push(
|
|
95476
|
+
codedDiagnostic({
|
|
95477
|
+
type: "warning",
|
|
95478
|
+
code: "doenet-w0150"
|
|
95479
|
+
})
|
|
95480
|
+
);
|
|
95481
|
+
}
|
|
95482
|
+
if (geometry2.valuesInTotal > 0 && !(geometry2.total > 0)) {
|
|
95483
|
+
sendDiagnostics.push(
|
|
95484
|
+
codedDiagnostic({
|
|
95485
|
+
type: "warning",
|
|
95486
|
+
code: "doenet-w0151"
|
|
95487
|
+
})
|
|
95488
|
+
);
|
|
95489
|
+
}
|
|
95490
|
+
if (geometry2.undrawnSeries > 0) {
|
|
95491
|
+
sendDiagnostics.push(
|
|
95492
|
+
codedDiagnostic({
|
|
95493
|
+
type: "warning",
|
|
95494
|
+
code: "doenet-w0152"
|
|
95495
|
+
})
|
|
95496
|
+
);
|
|
95497
|
+
}
|
|
95498
|
+
return {
|
|
95499
|
+
setValue: { chartGeometry: geometry2 },
|
|
95500
|
+
sendDiagnostics
|
|
95501
|
+
};
|
|
95502
|
+
}
|
|
95503
|
+
const geometry = computePointChartGeometry({
|
|
94582
95504
|
series: dependencyValues.seriesData.map(
|
|
94583
|
-
({ label, values: values2 }) => ({ label, values: values2 })
|
|
95505
|
+
({ label, values: values2, x: x2 }) => ({ label, values: values2, x: x2 })
|
|
94584
95506
|
),
|
|
94585
95507
|
labels: dependencyValues.categories,
|
|
94586
|
-
|
|
94587
|
-
|
|
95508
|
+
xMinAttr: dependencyValues.xMinAttr,
|
|
95509
|
+
xMaxAttr: dependencyValues.xMaxAttr,
|
|
94588
95510
|
yMinAttr: dependencyValues.yMinAttr,
|
|
94589
95511
|
yMaxAttr: dependencyValues.yMaxAttr
|
|
94590
95512
|
});
|
|
94591
95513
|
return {
|
|
94592
95514
|
setValue: { chartGeometry: geometry },
|
|
94593
|
-
// A
|
|
94594
|
-
//
|
|
94595
|
-
//
|
|
94596
|
-
//
|
|
94597
|
-
//
|
|
94598
|
-
// often the values change.
|
|
95515
|
+
// A point needs both of its coordinates, so this covers a
|
|
95516
|
+
// value that is not a finite number *and* a value whose
|
|
95517
|
+
// `x` ran out — the second of which is what a series given
|
|
95518
|
+
// fewer coordinates than values produces, and is otherwise
|
|
95519
|
+
// indistinguishable from having asked for fewer points.
|
|
94599
95520
|
sendDiagnostics: geometry.undrawnValues > 0 ? [
|
|
94600
95521
|
codedDiagnostic({
|
|
94601
95522
|
type: "warning",
|
|
94602
|
-
code: "doenet-
|
|
95523
|
+
code: "doenet-w0148"
|
|
94603
95524
|
})
|
|
94604
95525
|
] : []
|
|
94605
95526
|
};
|
|
94606
95527
|
}
|
|
94607
95528
|
};
|
|
95529
|
+
stateVariableDefinitions.sliceStyles = {
|
|
95530
|
+
description: "The style each of a pie's slices takes, in the order they are given — including one whose share of the total is nothing and so is never drawn.",
|
|
95531
|
+
returnDependencies: () => ({
|
|
95532
|
+
chartGeometry: {
|
|
95533
|
+
dependencyType: "stateVariable",
|
|
95534
|
+
variableName: "chartGeometry"
|
|
95535
|
+
},
|
|
95536
|
+
seriesData: {
|
|
95537
|
+
dependencyType: "stateVariable",
|
|
95538
|
+
variableName: "seriesData"
|
|
95539
|
+
},
|
|
95540
|
+
styleNumber: {
|
|
95541
|
+
dependencyType: "stateVariable",
|
|
95542
|
+
variableName: "styleNumber"
|
|
95543
|
+
},
|
|
95544
|
+
ancestorWithStyle: {
|
|
95545
|
+
dependencyType: "ancestor",
|
|
95546
|
+
variableNames: [
|
|
95547
|
+
"styleDefinitions",
|
|
95548
|
+
"activeStylePaletteName",
|
|
95549
|
+
"readerStyleOverrides"
|
|
95550
|
+
]
|
|
95551
|
+
}
|
|
95552
|
+
}),
|
|
95553
|
+
definition({ dependencyValues }) {
|
|
95554
|
+
const geometry = dependencyValues.chartGeometry;
|
|
95555
|
+
const numSlices = geometry?.kind === "pie" ? geometry.slices.length : 0;
|
|
95556
|
+
const runStart = dependencyValues.seriesData[0]?.styleNumber ?? dependencyValues.styleNumber;
|
|
95557
|
+
const sliceStyles = [];
|
|
95558
|
+
for (let ind = 0; ind < numSlices; ind++) {
|
|
95559
|
+
sliceStyles.push(
|
|
95560
|
+
selectStyleForStyleNumber({
|
|
95561
|
+
styleNumber: runStart + ind,
|
|
95562
|
+
ancestorWithStyle: dependencyValues.ancestorWithStyle
|
|
95563
|
+
})
|
|
95564
|
+
);
|
|
95565
|
+
}
|
|
95566
|
+
return { setValue: { sliceStyles } };
|
|
95567
|
+
}
|
|
95568
|
+
};
|
|
95569
|
+
stateVariableDefinitions.xMin = {
|
|
95570
|
+
groupName: "axes",
|
|
95571
|
+
description: "The leftmost value shown on the horizontal axis, or null when it is not a numeric axis.",
|
|
95572
|
+
public: true,
|
|
95573
|
+
shadowingInstructions: {
|
|
95574
|
+
createComponentOfType: "number"
|
|
95575
|
+
},
|
|
95576
|
+
additionalStateVariablesDefined: [
|
|
95577
|
+
{
|
|
95578
|
+
variableName: "xMax",
|
|
95579
|
+
groupName: "axes",
|
|
95580
|
+
description: "The rightmost value shown on the horizontal axis, or null when it is not a numeric axis.",
|
|
95581
|
+
public: true,
|
|
95582
|
+
shadowingInstructions: {
|
|
95583
|
+
createComponentOfType: "number"
|
|
95584
|
+
}
|
|
95585
|
+
}
|
|
95586
|
+
],
|
|
95587
|
+
returnDependencies: () => ({
|
|
95588
|
+
chartGeometry: {
|
|
95589
|
+
dependencyType: "stateVariable",
|
|
95590
|
+
variableName: "chartGeometry"
|
|
95591
|
+
}
|
|
95592
|
+
}),
|
|
95593
|
+
definition({ dependencyValues }) {
|
|
95594
|
+
const geometry = dependencyValues.chartGeometry;
|
|
95595
|
+
if (geometry?.kind !== "point" || geometry.slots) {
|
|
95596
|
+
return { setValue: { xMin: null, xMax: null } };
|
|
95597
|
+
}
|
|
95598
|
+
const [xMin, , xMax] = geometry.bounds;
|
|
95599
|
+
return { setValue: { xMin, xMax } };
|
|
95600
|
+
}
|
|
95601
|
+
};
|
|
94608
95602
|
stateVariableDefinitions.yMin = {
|
|
94609
|
-
|
|
95603
|
+
groupName: "axes",
|
|
95604
|
+
description: "The lowest value shown on the vertical axis, or null when the chart has no axes or was not drawn.",
|
|
94610
95605
|
public: true,
|
|
94611
95606
|
shadowingInstructions: {
|
|
94612
95607
|
createComponentOfType: "number"
|
|
@@ -94614,7 +95609,8 @@ class Chart extends BlockComponent {
|
|
|
94614
95609
|
additionalStateVariablesDefined: [
|
|
94615
95610
|
{
|
|
94616
95611
|
variableName: "yMax",
|
|
94617
|
-
|
|
95612
|
+
groupName: "axes",
|
|
95613
|
+
description: "The highest value shown on the vertical axis, or null when the chart has no axes or was not drawn.",
|
|
94618
95614
|
public: true,
|
|
94619
95615
|
shadowingInstructions: {
|
|
94620
95616
|
createComponentOfType: "number"
|
|
@@ -94628,11 +95624,11 @@ class Chart extends BlockComponent {
|
|
|
94628
95624
|
}
|
|
94629
95625
|
}),
|
|
94630
95626
|
definition({ dependencyValues }) {
|
|
94631
|
-
const
|
|
94632
|
-
if (!
|
|
95627
|
+
const geometry = dependencyValues.chartGeometry;
|
|
95628
|
+
if (!geometry || geometry.kind === "pie") {
|
|
94633
95629
|
return { setValue: { yMin: null, yMax: null } };
|
|
94634
95630
|
}
|
|
94635
|
-
const [, yMin, , yMax] = bounds;
|
|
95631
|
+
const [, yMin, , yMax] = geometry.bounds;
|
|
94636
95632
|
return { setValue: { yMin, yMax } };
|
|
94637
95633
|
}
|
|
94638
95634
|
};
|
|
@@ -94672,6 +95668,14 @@ class Chart extends BlockComponent {
|
|
|
94672
95668
|
dependencyType: "stateVariable",
|
|
94673
95669
|
variableName: "yLabelHasLatex"
|
|
94674
95670
|
},
|
|
95671
|
+
type: {
|
|
95672
|
+
dependencyType: "stateVariable",
|
|
95673
|
+
variableName: "type"
|
|
95674
|
+
},
|
|
95675
|
+
markers: {
|
|
95676
|
+
dependencyType: "stateVariable",
|
|
95677
|
+
variableName: "markers"
|
|
95678
|
+
},
|
|
94675
95679
|
title: {
|
|
94676
95680
|
dependencyType: "stateVariable",
|
|
94677
95681
|
variableName: "title"
|
|
@@ -94696,6 +95700,10 @@ class Chart extends BlockComponent {
|
|
|
94696
95700
|
dependencyType: "stateVariable",
|
|
94697
95701
|
variableName: "seriesData"
|
|
94698
95702
|
},
|
|
95703
|
+
sliceStyles: {
|
|
95704
|
+
dependencyType: "stateVariable",
|
|
95705
|
+
variableName: "sliceStyles"
|
|
95706
|
+
},
|
|
94699
95707
|
document: {
|
|
94700
95708
|
dependencyType: "ancestor",
|
|
94701
95709
|
componentType: "document",
|
|
@@ -94708,7 +95716,39 @@ class Chart extends BlockComponent {
|
|
|
94708
95716
|
}
|
|
94709
95717
|
const darkMode = dependencyValues.document?.stateValues.theme === "dark";
|
|
94710
95718
|
const widthPx = dependencyValues.width?.size ?? 425;
|
|
94711
|
-
const
|
|
95719
|
+
const heightPx = widthPx / dependencyValues.aspectRatio;
|
|
95720
|
+
if (dependencyValues.type === "pie") {
|
|
95721
|
+
const axisNames = [
|
|
95722
|
+
dependencyValues.xLabel,
|
|
95723
|
+
dependencyValues.yLabel
|
|
95724
|
+
].some((name2) => name2?.trim());
|
|
95725
|
+
const { xml: xml2, diagnostics: diagnostics3 } = createPieChartPrefigureXML({
|
|
95726
|
+
geometry: dependencyValues.chartGeometry,
|
|
95727
|
+
sliceStyles: dependencyValues.sliceStyles.map(
|
|
95728
|
+
(style) => resolveSelectedStyleForTheme(style, darkMode)
|
|
95729
|
+
),
|
|
95730
|
+
widthPx,
|
|
95731
|
+
heightPx,
|
|
95732
|
+
title: dependencyValues.title,
|
|
95733
|
+
showLegend: dependencyValues.showLegend,
|
|
95734
|
+
legendPosition: dependencyValues.legendPosition,
|
|
95735
|
+
displayValues: dependencyValues.displayValues,
|
|
95736
|
+
shortDescription: dependencyValues.shortDescription
|
|
95737
|
+
});
|
|
95738
|
+
if (axisNames) {
|
|
95739
|
+
diagnostics3.push(
|
|
95740
|
+
codedDiagnostic({
|
|
95741
|
+
type: "warning",
|
|
95742
|
+
code: "doenet-w0153"
|
|
95743
|
+
})
|
|
95744
|
+
);
|
|
95745
|
+
}
|
|
95746
|
+
return {
|
|
95747
|
+
setValue: { prefigureXML: xml2 },
|
|
95748
|
+
sendDiagnostics: diagnostics3
|
|
95749
|
+
};
|
|
95750
|
+
}
|
|
95751
|
+
const shared = {
|
|
94712
95752
|
geometry: dependencyValues.chartGeometry,
|
|
94713
95753
|
// Resolved here rather than in the geometry, which is
|
|
94714
95754
|
// renderer-neutral and has no view of the page's theme:
|
|
@@ -94731,7 +95771,7 @@ class Chart extends BlockComponent {
|
|
|
94731
95771
|
})
|
|
94732
95772
|
),
|
|
94733
95773
|
widthPx,
|
|
94734
|
-
heightPx
|
|
95774
|
+
heightPx,
|
|
94735
95775
|
xLabel: dependencyValues.xLabel,
|
|
94736
95776
|
xLabelHasLatex: dependencyValues.xLabelHasLatex,
|
|
94737
95777
|
yLabel: dependencyValues.yLabel,
|
|
@@ -94742,6 +95782,11 @@ class Chart extends BlockComponent {
|
|
|
94742
95782
|
displayValues: dependencyValues.displayValues,
|
|
94743
95783
|
shortDescription: dependencyValues.shortDescription,
|
|
94744
95784
|
darkMode
|
|
95785
|
+
};
|
|
95786
|
+
const { xml, diagnostics: diagnostics2 } = dependencyValues.type === "bar" ? createBarChartPrefigureXML(shared) : createPointChartPrefigureXML({
|
|
95787
|
+
...shared,
|
|
95788
|
+
shape: dependencyValues.type,
|
|
95789
|
+
markers: dependencyValues.markers
|
|
94745
95790
|
});
|
|
94746
95791
|
return {
|
|
94747
95792
|
setValue: { prefigureXML: xml },
|
|
@@ -95264,6 +96309,11 @@ class Series extends BaseComponent {
|
|
|
95264
96309
|
createStateVariable: "styleNumberAttr",
|
|
95265
96310
|
defaultValue: null
|
|
95266
96311
|
};
|
|
96312
|
+
attributes.x = {
|
|
96313
|
+
createComponentOfType: "numberList",
|
|
96314
|
+
description: "The horizontal coordinate of each value, for a chart whose marks are placed by measurement. Without it a series is drawn under `categories`, at 1, 2, 3 and so on.",
|
|
96315
|
+
highlighted: true
|
|
96316
|
+
};
|
|
95267
96317
|
return attributes;
|
|
95268
96318
|
}
|
|
95269
96319
|
// Include children that can be added by the sugar below.
|
|
@@ -95337,6 +96387,27 @@ class Series extends BaseComponent {
|
|
|
95337
96387
|
stateVariableDefinitions,
|
|
95338
96388
|
returnSelectedStyleStateVariableDefinition()
|
|
95339
96389
|
);
|
|
96390
|
+
stateVariableDefinitions.x = {
|
|
96391
|
+
description: "The horizontal coordinate of each value, or null when the series has none.",
|
|
96392
|
+
public: true,
|
|
96393
|
+
shadowingInstructions: {
|
|
96394
|
+
createComponentOfType: "numberList"
|
|
96395
|
+
},
|
|
96396
|
+
returnDependencies: () => ({
|
|
96397
|
+
xAttr: {
|
|
96398
|
+
dependencyType: "attributeComponent",
|
|
96399
|
+
attributeName: "x",
|
|
96400
|
+
variableNames: ["numbers"]
|
|
96401
|
+
}
|
|
96402
|
+
}),
|
|
96403
|
+
definition({ dependencyValues }) {
|
|
96404
|
+
return {
|
|
96405
|
+
setValue: {
|
|
96406
|
+
x: dependencyValues.xAttr?.stateValues.numbers ?? null
|
|
96407
|
+
}
|
|
96408
|
+
};
|
|
96409
|
+
}
|
|
96410
|
+
};
|
|
95340
96411
|
stateVariableDefinitions.values = {
|
|
95341
96412
|
description: "The values in this series, in order.",
|
|
95342
96413
|
public: true,
|
|
@@ -135088,7 +136159,7 @@ class LineSegment extends GraphicalComponent {
|
|
|
135088
136159
|
desiredStateVariableValues,
|
|
135089
136160
|
dependencyValues
|
|
135090
136161
|
}) {
|
|
135091
|
-
let
|
|
136162
|
+
let midpoint2 = [];
|
|
135092
136163
|
let dir = [];
|
|
135093
136164
|
let epoint1 = dependencyValues.endpoints[0];
|
|
135094
136165
|
let epoint2 = dependencyValues.endpoints[1];
|
|
@@ -135104,7 +136175,7 @@ class LineSegment extends GraphicalComponent {
|
|
|
135104
136175
|
all_numeric = false;
|
|
135105
136176
|
break;
|
|
135106
136177
|
}
|
|
135107
|
-
|
|
136178
|
+
midpoint2.push((v1 + v2) / 2);
|
|
135108
136179
|
dir.push(v1 - v2);
|
|
135109
136180
|
}
|
|
135110
136181
|
if (!all_numeric) {
|
|
@@ -135121,12 +136192,12 @@ class LineSegment extends GraphicalComponent {
|
|
|
135121
136192
|
for (let dim = 0; dim < dependencyValues.numDimensions; dim++) {
|
|
135122
136193
|
desiredEndpoint1.push(
|
|
135123
136194
|
Context.fromAst(
|
|
135124
|
-
|
|
136195
|
+
midpoint2[dim] + dir[dim] * halfDesiredlength
|
|
135125
136196
|
)
|
|
135126
136197
|
);
|
|
135127
136198
|
desiredEndpoint2.push(
|
|
135128
136199
|
Context.fromAst(
|
|
135129
|
-
|
|
136200
|
+
midpoint2[dim] - dir[dim] * halfDesiredlength
|
|
135130
136201
|
)
|
|
135131
136202
|
);
|
|
135132
136203
|
}
|
|
@@ -135450,7 +136521,7 @@ class LineSegment extends GraphicalComponent {
|
|
|
135450
136521
|
};
|
|
135451
136522
|
},
|
|
135452
136523
|
arrayDefinitionByKey({ globalDependencyValues, arrayKeys }) {
|
|
135453
|
-
let
|
|
136524
|
+
let midpoint2 = {};
|
|
135454
136525
|
let ep1 = globalDependencyValues.endpoints[0];
|
|
135455
136526
|
let ep2 = globalDependencyValues.endpoints[1];
|
|
135456
136527
|
for (let arrayKey of arrayKeys) {
|
|
@@ -135458,16 +136529,16 @@ class LineSegment extends GraphicalComponent {
|
|
|
135458
136529
|
let v1 = ep1[dim].evaluate_to_constant();
|
|
135459
136530
|
let v2 = ep2[dim].evaluate_to_constant();
|
|
135460
136531
|
if (Number.isFinite(v1) && Number.isFinite(v2)) {
|
|
135461
|
-
|
|
136532
|
+
midpoint2[arrayKey] = Context.fromAst((v1 + v2) / 2);
|
|
135462
136533
|
} else {
|
|
135463
|
-
|
|
136534
|
+
midpoint2[arrayKey] = Context.fromAst([
|
|
135464
136535
|
"/",
|
|
135465
136536
|
["+", ep1[dim].tree, ep2[dim].tree],
|
|
135466
136537
|
2
|
|
135467
136538
|
]);
|
|
135468
136539
|
}
|
|
135469
136540
|
}
|
|
135470
|
-
return { setValue: { midpoint } };
|
|
136541
|
+
return { setValue: { midpoint: midpoint2 } };
|
|
135471
136542
|
},
|
|
135472
136543
|
inverseArrayDefinitionByKey({
|
|
135473
136544
|
desiredStateVariableValues,
|
|
@@ -139873,7 +140944,7 @@ class RegularPolygon extends Polygon {
|
|
|
139873
140944
|
vertex2[0] - vertex1[0],
|
|
139874
140945
|
vertex2[1] - vertex1[1]
|
|
139875
140946
|
];
|
|
139876
|
-
let
|
|
140947
|
+
let midpoint2 = [
|
|
139877
140948
|
(vertex1[0] + vertex2[0]) / 2,
|
|
139878
140949
|
(vertex1[1] + vertex2[1]) / 2
|
|
139879
140950
|
];
|
|
@@ -139886,8 +140957,8 @@ class RegularPolygon extends Polygon {
|
|
|
139886
140957
|
sideVector[0] / sideLength
|
|
139887
140958
|
];
|
|
139888
140959
|
center = [
|
|
139889
|
-
|
|
139890
|
-
|
|
140960
|
+
midpoint2[0] + inradiusDirection[0] * inradius,
|
|
140961
|
+
midpoint2[1] + inradiusDirection[1] * inradius
|
|
139891
140962
|
];
|
|
139892
140963
|
unconstrainedDirectionWithRadius = [
|
|
139893
140964
|
vertex1[0] - center[0],
|
|
@@ -162693,10 +163764,10 @@ let Graph$1 = class Graph extends BlockComponent {
|
|
|
162693
163764
|
dependencyValues
|
|
162694
163765
|
}) {
|
|
162695
163766
|
let desiredScale = desiredStateVariableValues[scaleStateVariable];
|
|
162696
|
-
let
|
|
162697
|
-
let desiredMin =
|
|
162698
|
-
let desiredMax =
|
|
162699
|
-
if (!Number.isFinite(desiredScale) || desiredScale <= 0 || !Number.isFinite(
|
|
163767
|
+
let midpoint2 = dependencyValues[minDependency] / 2 + dependencyValues[maxDependency] / 2;
|
|
163768
|
+
let desiredMin = midpoint2 - desiredScale / 2;
|
|
163769
|
+
let desiredMax = midpoint2 + desiredScale / 2;
|
|
163770
|
+
if (!Number.isFinite(desiredScale) || desiredScale <= 0 || !Number.isFinite(midpoint2) || !Number.isFinite(desiredMin) || !Number.isFinite(desiredMax)) {
|
|
162700
163771
|
return { success: false };
|
|
162701
163772
|
}
|
|
162702
163773
|
return {
|
|
@@ -243717,4 +244788,4 @@ export {
|
|
|
243717
244788
|
getDefaultExportFromCjs$1 as g,
|
|
243718
244789
|
updateSyntaxFromV06toV07 as u
|
|
243719
244790
|
};
|
|
243720
|
-
//# sourceMappingURL=index-
|
|
244791
|
+
//# sourceMappingURL=index-BGA86VGv.js.map
|