@doenet/v06-to-v07 0.7.26-dev.551 → 0.7.26-dev.554
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-D5mqYa1b.js → index-73JwkM8q.js} +2055 -1318
- package/{index-D5mqYa1b.js.map → index-73JwkM8q.js.map} +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/{sha256-DT5xJ2Hv-BKf1gPKZ-BIVxkAku.js → sha256-DT5xJ2Hv-DLZ_0KQR-CTejU37e.js} +2 -2
- package/{sha256-DT5xJ2Hv-BKf1gPKZ-BIVxkAku.js.map → sha256-DT5xJ2Hv-DLZ_0KQR-CTejU37e.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. `$column` is the\n# authored name of the data column being summarized and is never translated.\n# The table's own headings (`mean`, `stdev`, `quartile1`, …) are the statistic\n# ids an author references, not prose, and stay in place.\nsummary-statistics-caption = Summary statistics of { $column }\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\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# $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\nattribute-value-invalid-using-default = Invalid value `{ $value }` for attribute `{ $attribute }`, using value `{ $default }`\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';
|
|
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\nattribute-value-invalid-using-default = Invalid value `{ $value }` for attribute `{ $attribute }`, using value `{ $default }`\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 `<barChart>` when a value is not a finite number, so it gets no bar.\n# The alternative reading of a missing bar is a value of zero, which the author\n# cannot distinguish by looking, so the absence is stated rather than left to be\n# inferred. No count: the queue is append-only and deduplicates by message, and\n# the number of such values changes as an input is typed into.\nbar-chart-values-not-drawable =\n `<barChart>` 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 `<barChart>` when `barWidth` is outside the (0, 1] range a fraction\n# 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';
|
|
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",
|
|
@@ -42885,6 +42885,9 @@ const DIAGNOSTIC_CODES = {
|
|
|
42885
42885
|
"doenet-w0140": "bin-counts-values-not-numeric",
|
|
42886
42886
|
"doenet-w0141": "bin-counts-cut-points-decreasing",
|
|
42887
42887
|
"doenet-w0142": "tally-repeated-category",
|
|
42888
|
+
"doenet-w0143": "bar-chart-bar-width-invalid",
|
|
42889
|
+
"doenet-w0144": "bar-chart-values-not-drawable",
|
|
42890
|
+
"doenet-w0145": "invalid-type-ignored",
|
|
42888
42891
|
"doenet-e0001": "pretzel-circuit-first-problem-distractor",
|
|
42889
42892
|
"doenet-e0002": "component-type-invalid",
|
|
42890
42893
|
"doenet-e0003": "attribute-repeated",
|
|
@@ -47291,7 +47294,7 @@ async function cidFromArrayBuffer(data) {
|
|
|
47291
47294
|
await crypto.subtle.digest("SHA-256", new Uint8Array());
|
|
47292
47295
|
digest = (data2) => crypto.subtle.digest("SHA-256", data2);
|
|
47293
47296
|
} catch (e22) {
|
|
47294
|
-
const sha256 = (await import("./sha256-DT5xJ2Hv-
|
|
47297
|
+
const sha256 = (await import("./sha256-DT5xJ2Hv-DLZ_0KQR-CTejU37e.js").then((n2) => n2.s)).default;
|
|
47295
47298
|
digest = (data2) => sha256(data2, {
|
|
47296
47299
|
asBytes: true
|
|
47297
47300
|
});
|
|
@@ -53963,11 +53966,24 @@ function expandAttribute({
|
|
|
53963
53966
|
}
|
|
53964
53967
|
}
|
|
53965
53968
|
if (attrDef.copyComponentAttributesForCreatedComponent) {
|
|
53969
|
+
const lowerCaseMapping = {};
|
|
53970
|
+
for (const authorSpelling in allUnflattenedAttributes) {
|
|
53971
|
+
lowerCaseMapping[authorSpelling.toLowerCase()] = authorSpelling;
|
|
53972
|
+
}
|
|
53966
53973
|
for (let attrName of attrDef.copyComponentAttributesForCreatedComponent) {
|
|
53967
|
-
|
|
53968
|
-
|
|
53969
|
-
|
|
53970
|
-
|
|
53974
|
+
const authorSpelling = lowerCaseMapping[attrName.toLowerCase()];
|
|
53975
|
+
if (authorSpelling !== void 0) {
|
|
53976
|
+
unflattenedComponentAttributes[attrName] = {
|
|
53977
|
+
...JSON.parse(
|
|
53978
|
+
JSON.stringify(
|
|
53979
|
+
allUnflattenedAttributes[authorSpelling]
|
|
53980
|
+
)
|
|
53981
|
+
),
|
|
53982
|
+
// The declared spelling, not the author's, so that
|
|
53983
|
+
// the copy is indistinguishable from one written
|
|
53984
|
+
// out on the created component.
|
|
53985
|
+
name: attrName
|
|
53986
|
+
};
|
|
53971
53987
|
}
|
|
53972
53988
|
}
|
|
53973
53989
|
}
|
|
@@ -54401,7 +54417,6 @@ function postProcessCopy({
|
|
|
54401
54417
|
componentIdx,
|
|
54402
54418
|
addShadowDependencies = true,
|
|
54403
54419
|
markAsPrimaryShadow = false,
|
|
54404
|
-
identifierPrefix = "",
|
|
54405
54420
|
unlinkExternalCopies = false,
|
|
54406
54421
|
copiesByRefIdx = {},
|
|
54407
54422
|
componentIndicesFound = [],
|
|
@@ -54459,13 +54474,22 @@ function postProcessCopy({
|
|
|
54459
54474
|
componentIdx,
|
|
54460
54475
|
addShadowDependencies,
|
|
54461
54476
|
markAsPrimaryShadow,
|
|
54462
|
-
identifierPrefix,
|
|
54463
54477
|
unlinkExternalCopies,
|
|
54464
54478
|
copiesByRefIdx,
|
|
54465
54479
|
componentIndicesFound,
|
|
54466
54480
|
init: false
|
|
54467
54481
|
});
|
|
54468
54482
|
}
|
|
54483
|
+
function recurseIntoPathIndices(component) {
|
|
54484
|
+
if (!component.extending) {
|
|
54485
|
+
return;
|
|
54486
|
+
}
|
|
54487
|
+
for (const pathPart of unwrapSource(component.extending).originalPath ?? []) {
|
|
54488
|
+
for (const index2 of pathPart.index) {
|
|
54489
|
+
recurse(index2.value);
|
|
54490
|
+
}
|
|
54491
|
+
}
|
|
54492
|
+
}
|
|
54469
54493
|
for (let ind in serializedComponents) {
|
|
54470
54494
|
let component = serializedComponents[ind];
|
|
54471
54495
|
if (typeof component !== "object") {
|
|
@@ -54476,18 +54500,16 @@ function postProcessCopy({
|
|
|
54476
54500
|
let attribute = component.attributes[attrName];
|
|
54477
54501
|
if (attribute.component) {
|
|
54478
54502
|
attribute.component = recurse([attribute.component])[0];
|
|
54503
|
+
} else if (attribute.references) {
|
|
54504
|
+
for (const reference of attribute.references) {
|
|
54505
|
+
recurseIntoPathIndices(reference);
|
|
54506
|
+
}
|
|
54479
54507
|
}
|
|
54480
54508
|
}
|
|
54481
54509
|
if (component.replacements) {
|
|
54482
54510
|
recurse(component.replacements);
|
|
54483
54511
|
}
|
|
54484
|
-
|
|
54485
|
-
for (const pathPart of unwrapSource(component.extending).originalPath ?? []) {
|
|
54486
|
-
for (const index2 of pathPart.index) {
|
|
54487
|
-
recurse(index2.value);
|
|
54488
|
-
}
|
|
54489
|
-
}
|
|
54490
|
-
}
|
|
54512
|
+
recurseIntoPathIndices(component);
|
|
54491
54513
|
}
|
|
54492
54514
|
if (init && unlinkExternalCopies) {
|
|
54493
54515
|
for (let extendIdxStr in copiesByRefIdx) {
|
|
@@ -91129,6 +91151,39 @@ function comparableValueFromRaw(value) {
|
|
|
91129
91151
|
}
|
|
91130
91152
|
return { numericalValue: NaN, textValue: String(value), isNumeric: false };
|
|
91131
91153
|
}
|
|
91154
|
+
function delimitersBalanced(token) {
|
|
91155
|
+
const closerFor = { ")": "(", "]": "[", "}": "{" };
|
|
91156
|
+
const open = [];
|
|
91157
|
+
for (const character of token) {
|
|
91158
|
+
if (character === "(" || character === "[" || character === "{") {
|
|
91159
|
+
open.push(character);
|
|
91160
|
+
} else if (character in closerFor) {
|
|
91161
|
+
if (open.pop() !== closerFor[character]) {
|
|
91162
|
+
return false;
|
|
91163
|
+
}
|
|
91164
|
+
}
|
|
91165
|
+
}
|
|
91166
|
+
return open.length === 0;
|
|
91167
|
+
}
|
|
91168
|
+
function tokenIsRealNumber(token) {
|
|
91169
|
+
if (!delimitersBalanced(token)) {
|
|
91170
|
+
return false;
|
|
91171
|
+
}
|
|
91172
|
+
let value;
|
|
91173
|
+
try {
|
|
91174
|
+
value = Context.fromAst(textToAst.convert(token)).evaluate_to_constant();
|
|
91175
|
+
} catch (e32) {
|
|
91176
|
+
return false;
|
|
91177
|
+
}
|
|
91178
|
+
return typeof value === "number" && !Number.isNaN(value);
|
|
91179
|
+
}
|
|
91180
|
+
function inferTypeFromStrings(matchedChildren) {
|
|
91181
|
+
const tokens = matchedChildren.filter((child) => typeof child === "string").flatMap((child) => child.split(/\s+/)).filter((token) => token !== "");
|
|
91182
|
+
if (tokens.length === 0) {
|
|
91183
|
+
return null;
|
|
91184
|
+
}
|
|
91185
|
+
return tokens.every(tokenIsRealNumber) ? "number" : "text";
|
|
91186
|
+
}
|
|
91132
91187
|
function returnBreakStringsIntoTypeSugarInstruction(componentName) {
|
|
91133
91188
|
function breakStringsMacrosIntoTypeBySpaces({
|
|
91134
91189
|
matchedChildren,
|
|
@@ -91142,31 +91197,22 @@ function returnBreakStringsIntoTypeSugarInstruction(componentName) {
|
|
|
91142
91197
|
)) {
|
|
91143
91198
|
return { success: false };
|
|
91144
91199
|
}
|
|
91145
|
-
let type;
|
|
91146
|
-
if (
|
|
91147
|
-
type = componentAttributes.type.value;
|
|
91148
|
-
} else {
|
|
91149
|
-
if (matchedChildren.some((child) => typeof child === "string")) {
|
|
91150
|
-
diagnostics2.push(
|
|
91151
|
-
codedDiagnostic({
|
|
91152
|
-
type: "warning",
|
|
91153
|
-
code: "doenet-w0013",
|
|
91154
|
-
args: { component: componentName }
|
|
91155
|
-
})
|
|
91156
|
-
);
|
|
91157
|
-
}
|
|
91158
|
-
return { success: false, diagnostics: diagnostics2 };
|
|
91159
|
-
}
|
|
91160
|
-
if (!["math", "text", "number", "boolean"].includes(type)) {
|
|
91161
|
-
console.warn(`Invalid type ${type}`);
|
|
91200
|
+
let type = componentAttributes.type?.value;
|
|
91201
|
+
if (type && !["math", "text", "number", "boolean"].includes(type)) {
|
|
91162
91202
|
diagnostics2.push(
|
|
91163
91203
|
codedDiagnostic({
|
|
91164
91204
|
type: "warning",
|
|
91165
|
-
code: "doenet-
|
|
91205
|
+
code: "doenet-w0145",
|
|
91166
91206
|
args: { type, component: componentName }
|
|
91167
91207
|
})
|
|
91168
91208
|
);
|
|
91169
|
-
type =
|
|
91209
|
+
type = void 0;
|
|
91210
|
+
}
|
|
91211
|
+
if (!type) {
|
|
91212
|
+
type = inferTypeFromStrings(matchedChildren);
|
|
91213
|
+
if (type === null) {
|
|
91214
|
+
return { success: false, diagnostics: diagnostics2 };
|
|
91215
|
+
}
|
|
91170
91216
|
}
|
|
91171
91217
|
let groupIntoComponentTypesSeparatedBySpaces = returnGroupIntoComponentTypeSeparatedBySpacesOutsideParens({
|
|
91172
91218
|
componentType: type,
|
|
@@ -91190,15 +91236,11 @@ function returnBreakStringsIntoTypeSugarInstruction(componentName) {
|
|
|
91190
91236
|
}
|
|
91191
91237
|
return { replacementFunction: breakStringsMacrosIntoTypeBySpaces };
|
|
91192
91238
|
}
|
|
91193
|
-
function returnListTypeAttribute({
|
|
91194
|
-
|
|
91195
|
-
alsoReads = null
|
|
91196
|
-
} = {}) {
|
|
91197
|
-
const base = "Component type to interpret bare string children as.";
|
|
91198
|
-
const attributeItAlsoReads = readsTarget ? "target" : alsoReads;
|
|
91239
|
+
function returnListTypeAttribute({ readsTarget = false } = {}) {
|
|
91240
|
+
const base = "Component type to interpret bare string children as. Omit it and they are read as what they look like: every piece naming a number makes the list numeric, anything else makes it text.";
|
|
91199
91241
|
return {
|
|
91200
91242
|
createPrimitiveOfType: "string",
|
|
91201
|
-
description:
|
|
91243
|
+
description: readsTarget ? `${base} Also decides how \`target\` is read, since it has no type of its own.` : base,
|
|
91202
91244
|
highlighted: true,
|
|
91203
91245
|
validValues: [
|
|
91204
91246
|
{
|
|
@@ -91717,20 +91759,8 @@ class CountingBaseListOperator extends CompositeComponent {
|
|
|
91717
91759
|
// Since the operator treats each child as a separate argument,
|
|
91718
91760
|
// composites with no replacement should be ignored.
|
|
91719
91761
|
static descendantCompositesMustHaveAReplacement = false;
|
|
91720
|
-
// Named by a subclass whose own attribute is a
|
|
91721
|
-
// `_componentListWithSelectableType` and so is read by `type` as well —
|
|
91722
|
-
// `<tally>`'s `categories`. The reference pages show the `type`
|
|
91723
|
-
// description, and an author who cannot see that it governs their
|
|
91724
|
-
// categories writes `categories="apple fig"` without `type="text"` and
|
|
91725
|
-
// gets a numeric reading that matches nothing, silently.
|
|
91726
|
-
static typeAlsoReads = null;
|
|
91727
91762
|
static createAttributesObject() {
|
|
91728
91763
|
let attributes = super.createAttributesObject();
|
|
91729
|
-
attributes.type = {
|
|
91730
|
-
...returnListTypeAttribute({ alsoReads: this.typeAlsoReads }),
|
|
91731
|
-
createStateVariable: "type",
|
|
91732
|
-
defaultValue: null
|
|
91733
|
-
};
|
|
91734
91764
|
Object.assign(attributes, returnPassThroughAttributeDeclarations());
|
|
91735
91765
|
attributes.asList = {
|
|
91736
91766
|
createPrimitiveOfType: "boolean",
|
|
@@ -91741,15 +91771,11 @@ class CountingBaseListOperator extends CompositeComponent {
|
|
|
91741
91771
|
};
|
|
91742
91772
|
return attributes;
|
|
91743
91773
|
}
|
|
91744
|
-
// Include children that can be added due to sugar
|
|
91774
|
+
// Include children that can be added due to sugar. What bare strings are
|
|
91775
|
+
// read *as* is left to the subclass: `<binCounts>` can only ever count
|
|
91776
|
+
// numbers, so it reads them the way `<sum>` does, while `<tally>` counts
|
|
91777
|
+
// values of any comparable type and so has to be told which.
|
|
91745
91778
|
static additionalSchemaChildren = ["string"];
|
|
91746
|
-
static returnSugarInstructions() {
|
|
91747
|
-
let sugarInstructions = super.returnSugarInstructions();
|
|
91748
|
-
sugarInstructions.push(
|
|
91749
|
-
returnBreakStringsIntoTypeSugarInstruction(this.componentType)
|
|
91750
|
-
);
|
|
91751
|
-
return sugarInstructions;
|
|
91752
|
-
}
|
|
91753
91779
|
static returnChildGroups() {
|
|
91754
91780
|
return [
|
|
91755
91781
|
{
|
|
@@ -91905,21 +91931,53 @@ function distinctValues(values2, numeric2) {
|
|
|
91905
91931
|
}
|
|
91906
91932
|
class Tally extends CountingBaseListOperator {
|
|
91907
91933
|
static componentType = "tally";
|
|
91908
|
-
static typeAlsoReads = "categories";
|
|
91909
91934
|
static componentDocs = {
|
|
91910
91935
|
summary: "How many times each category appears in a list"
|
|
91911
91936
|
};
|
|
91912
91937
|
static createAttributesObject() {
|
|
91913
91938
|
let attributes = super.createAttributesObject();
|
|
91939
|
+
attributes.type = {
|
|
91940
|
+
...returnListTypeAttribute(),
|
|
91941
|
+
description: "Component type to interpret bare string children as. Omit it and they are read as what they look like: every piece naming a number makes the list numeric, anything else makes it text. Also overrides how `categories` is read, which is otherwise text."
|
|
91942
|
+
};
|
|
91914
91943
|
attributes.categories = {
|
|
91915
91944
|
createComponentOfType: "_componentListWithSelectableType",
|
|
91945
|
+
// The type reaches the categories twice over, and both routes have
|
|
91946
|
+
// to agree: the sugar that wraps the bare strings reads the
|
|
91947
|
+
// attribute written here, while the state variable that reads the
|
|
91948
|
+
// wrapped values back resolves `type` on the parent. So the
|
|
91949
|
+
// default is declared in both places — `text` below, and `text`
|
|
91950
|
+
// again on the `type` state variable — and an explicit `type` is
|
|
91951
|
+
// copied down here so that it still wins on both routes.
|
|
91952
|
+
attributesForCreatedComponent: { type: "text" },
|
|
91953
|
+
copyComponentAttributesForCreatedComponent: ["type"],
|
|
91916
91954
|
description: "The categories to count, in the order the counts are reported. Omit to count the distinct values present, in sorted order.",
|
|
91917
91955
|
highlighted: true
|
|
91918
91956
|
};
|
|
91919
91957
|
return attributes;
|
|
91920
91958
|
}
|
|
91959
|
+
static returnSugarInstructions() {
|
|
91960
|
+
let sugarInstructions = super.returnSugarInstructions();
|
|
91961
|
+
sugarInstructions.push(
|
|
91962
|
+
returnBreakStringsIntoTypeSugarInstruction(this.componentType)
|
|
91963
|
+
);
|
|
91964
|
+
return sugarInstructions;
|
|
91965
|
+
}
|
|
91921
91966
|
static returnStateVariableDefinitions() {
|
|
91922
91967
|
let stateVariableDefinitions = super.returnStateVariableDefinitions();
|
|
91968
|
+
stateVariableDefinitions.type = {
|
|
91969
|
+
returnDependencies: () => ({
|
|
91970
|
+
typeAttr: {
|
|
91971
|
+
dependencyType: "attributePrimitive",
|
|
91972
|
+
attributeName: "type"
|
|
91973
|
+
}
|
|
91974
|
+
}),
|
|
91975
|
+
definition({ dependencyValues }) {
|
|
91976
|
+
return {
|
|
91977
|
+
setValue: { type: dependencyValues.typeAttr ?? "text" }
|
|
91978
|
+
};
|
|
91979
|
+
}
|
|
91980
|
+
};
|
|
91923
91981
|
stateVariableDefinitions.countValues = {
|
|
91924
91982
|
returnDependencies: () => ({
|
|
91925
91983
|
categoriesAttr: {
|
|
@@ -91990,7 +92048,7 @@ class Tally extends CountingBaseListOperator {
|
|
|
91990
92048
|
}
|
|
91991
92049
|
}
|
|
91992
92050
|
function tallyValues({ values: values2, numeric: numeric2, declaredCategories, declaredType }) {
|
|
91993
|
-
const comparableCategories = declaredCategories === null ? distinctValues(values2, numeric2) : declaredCategories.map(
|
|
92051
|
+
const comparableCategories = declaredCategories === null ? distinctValues(values2, numeric2) : declaredCategories.map((raw) => comparableCategory(raw, numeric2));
|
|
91994
92052
|
const counts = comparableCategories.map(() => 0);
|
|
91995
92053
|
let anyUncounted = false;
|
|
91996
92054
|
for (const value of values2) {
|
|
@@ -92036,6 +92094,19 @@ function tallyValues({ values: values2, numeric: numeric2, declaredCategories, d
|
|
|
92036
92094
|
}
|
|
92037
92095
|
return { counts, labels, diagnostics: diagnostics2 };
|
|
92038
92096
|
}
|
|
92097
|
+
function comparableCategory(raw, numeric2) {
|
|
92098
|
+
const value = comparableValueFromRaw(raw);
|
|
92099
|
+
if (!numeric2 || value === null || typeof raw !== "string") {
|
|
92100
|
+
return value;
|
|
92101
|
+
}
|
|
92102
|
+
let numericalValue;
|
|
92103
|
+
try {
|
|
92104
|
+
numericalValue = Context.fromText(raw).evaluate_to_constant();
|
|
92105
|
+
} catch (e32) {
|
|
92106
|
+
return value;
|
|
92107
|
+
}
|
|
92108
|
+
return typeof numericalValue === "number" && !Number.isNaN(numericalValue) ? { numericalValue, textValue: raw, isNumeric: true } : value;
|
|
92109
|
+
}
|
|
92039
92110
|
function labelComponentType({ declaredType, comparableCategories, numeric: numeric2 }) {
|
|
92040
92111
|
if (declaredType !== null) {
|
|
92041
92112
|
return declaredType === "letters" ? "text" : declaredType;
|
|
@@ -92075,6 +92146,13 @@ class BinCounts extends CountingBaseListOperator {
|
|
|
92075
92146
|
};
|
|
92076
92147
|
return attributes;
|
|
92077
92148
|
}
|
|
92149
|
+
static returnSugarInstructions() {
|
|
92150
|
+
let sugarInstructions = super.returnSugarInstructions();
|
|
92151
|
+
sugarInstructions.push(
|
|
92152
|
+
returnBreakStringsIntoMathsBySpacesSugarInstruction()
|
|
92153
|
+
);
|
|
92154
|
+
return sugarInstructions;
|
|
92155
|
+
}
|
|
92078
92156
|
static returnStateVariableDefinitions() {
|
|
92079
92157
|
let stateVariableDefinitions = super.returnStateVariableDefinitions();
|
|
92080
92158
|
stateVariableDefinitions.countValues = {
|
|
@@ -92229,6 +92307,1885 @@ const CountOperators = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defi
|
|
|
92229
92307
|
BinCounts,
|
|
92230
92308
|
Tally
|
|
92231
92309
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
92310
|
+
function returnSizeAttributes({ componentName }) {
|
|
92311
|
+
return {
|
|
92312
|
+
width: {
|
|
92313
|
+
createComponentOfType: "componentSize",
|
|
92314
|
+
description: `Explicit width of the ${componentName} (overrides size).`
|
|
92315
|
+
},
|
|
92316
|
+
size: {
|
|
92317
|
+
createComponentOfType: "text",
|
|
92318
|
+
createStateVariable: "specifiedSize",
|
|
92319
|
+
defaultValue: "medium",
|
|
92320
|
+
toLowerCase: true,
|
|
92321
|
+
validValues: [
|
|
92322
|
+
{ value: "tiny", description: "About 1/12 the full width." },
|
|
92323
|
+
{ value: "small", description: "About 30% of the full width." },
|
|
92324
|
+
{ value: "medium", description: "About half the full width." },
|
|
92325
|
+
{ value: "large", description: "About 70% of the full width." },
|
|
92326
|
+
{ value: "full", description: "The full available width." }
|
|
92327
|
+
],
|
|
92328
|
+
description: `Named size preset for the ${componentName}.`
|
|
92329
|
+
}
|
|
92330
|
+
};
|
|
92331
|
+
}
|
|
92332
|
+
function returnSizeStateVariableDefinitions({ componentName }) {
|
|
92333
|
+
return {
|
|
92334
|
+
size: {
|
|
92335
|
+
description: `The size of the ${componentName}.`,
|
|
92336
|
+
public: true,
|
|
92337
|
+
defaultValue: "medium",
|
|
92338
|
+
hasEssential: true,
|
|
92339
|
+
shadowingInstructions: {
|
|
92340
|
+
createComponentOfType: "text"
|
|
92341
|
+
},
|
|
92342
|
+
returnDependencies: () => ({
|
|
92343
|
+
specifiedSize: {
|
|
92344
|
+
dependencyType: "stateVariable",
|
|
92345
|
+
variableName: "specifiedSize"
|
|
92346
|
+
},
|
|
92347
|
+
widthAttr: {
|
|
92348
|
+
dependencyType: "attributeComponent",
|
|
92349
|
+
attributeName: "width",
|
|
92350
|
+
variableNames: ["componentSize"]
|
|
92351
|
+
}
|
|
92352
|
+
}),
|
|
92353
|
+
definition({ dependencyValues, usedDefault }) {
|
|
92354
|
+
const defaultSize = "medium";
|
|
92355
|
+
if (!usedDefault.specifiedSize) {
|
|
92356
|
+
return {
|
|
92357
|
+
setValue: { size: dependencyValues.specifiedSize }
|
|
92358
|
+
};
|
|
92359
|
+
} else if (dependencyValues.widthAttr) {
|
|
92360
|
+
let componentSize = dependencyValues.widthAttr.stateValues.componentSize;
|
|
92361
|
+
if (componentSize === null) {
|
|
92362
|
+
return {
|
|
92363
|
+
setValue: { size: defaultSize }
|
|
92364
|
+
};
|
|
92365
|
+
}
|
|
92366
|
+
let { isAbsolute, size: widthSize } = componentSize;
|
|
92367
|
+
let size2;
|
|
92368
|
+
if (isAbsolute) {
|
|
92369
|
+
for (let [
|
|
92370
|
+
ind,
|
|
92371
|
+
pixels
|
|
92372
|
+
] of orderedWidthMidpoints.entries()) {
|
|
92373
|
+
if (widthSize <= pixels) {
|
|
92374
|
+
size2 = sizePossibilities[ind];
|
|
92375
|
+
break;
|
|
92376
|
+
}
|
|
92377
|
+
}
|
|
92378
|
+
if (!size2) {
|
|
92379
|
+
size2 = defaultSize;
|
|
92380
|
+
}
|
|
92381
|
+
} else {
|
|
92382
|
+
for (let [
|
|
92383
|
+
ind,
|
|
92384
|
+
percent
|
|
92385
|
+
] of orderedPercentWidthMidpoints.entries()) {
|
|
92386
|
+
if (widthSize <= percent) {
|
|
92387
|
+
size2 = sizePossibilities[ind];
|
|
92388
|
+
break;
|
|
92389
|
+
}
|
|
92390
|
+
}
|
|
92391
|
+
if (!size2) {
|
|
92392
|
+
size2 = defaultSize;
|
|
92393
|
+
}
|
|
92394
|
+
}
|
|
92395
|
+
return {
|
|
92396
|
+
setValue: { size: size2 }
|
|
92397
|
+
};
|
|
92398
|
+
} else {
|
|
92399
|
+
return {
|
|
92400
|
+
useEssentialOrDefaultValue: { size: true }
|
|
92401
|
+
};
|
|
92402
|
+
}
|
|
92403
|
+
}
|
|
92404
|
+
},
|
|
92405
|
+
width: {
|
|
92406
|
+
description: `The width of the ${componentName}.`,
|
|
92407
|
+
public: true,
|
|
92408
|
+
forRenderer: true,
|
|
92409
|
+
shadowingInstructions: {
|
|
92410
|
+
createComponentOfType: "componentSize"
|
|
92411
|
+
},
|
|
92412
|
+
returnDependencies: () => ({
|
|
92413
|
+
size: {
|
|
92414
|
+
dependencyType: "stateVariable",
|
|
92415
|
+
variableName: "size"
|
|
92416
|
+
}
|
|
92417
|
+
}),
|
|
92418
|
+
definition({ dependencyValues }) {
|
|
92419
|
+
let width = {
|
|
92420
|
+
isAbsolute: true,
|
|
92421
|
+
size: widthsBySize[dependencyValues.size]
|
|
92422
|
+
};
|
|
92423
|
+
return {
|
|
92424
|
+
setValue: { width }
|
|
92425
|
+
};
|
|
92426
|
+
}
|
|
92427
|
+
}
|
|
92428
|
+
};
|
|
92429
|
+
}
|
|
92430
|
+
function returnAxisLabelChildGroup({ axis }) {
|
|
92431
|
+
return {
|
|
92432
|
+
group: `${axis}Labels`,
|
|
92433
|
+
componentTypes: [`${axis}Label`]
|
|
92434
|
+
};
|
|
92435
|
+
}
|
|
92436
|
+
function returnAxisLabelStateVariableDefinitions({ axis }) {
|
|
92437
|
+
const labelVar = `${axis}Label`;
|
|
92438
|
+
const hasLatexVar = `${axis}LabelHasLatex`;
|
|
92439
|
+
const childGroup = `${axis}Labels`;
|
|
92440
|
+
return {
|
|
92441
|
+
[labelVar]: {
|
|
92442
|
+
description: `The ${axis}-axis label text.`,
|
|
92443
|
+
forRenderer: true,
|
|
92444
|
+
public: true,
|
|
92445
|
+
shadowingInstructions: {
|
|
92446
|
+
createComponentOfType: "label",
|
|
92447
|
+
addStateVariablesShadowingStateVariables: {
|
|
92448
|
+
hasLatex: {
|
|
92449
|
+
stateVariableToShadow: hasLatexVar
|
|
92450
|
+
}
|
|
92451
|
+
}
|
|
92452
|
+
},
|
|
92453
|
+
hasEssential: true,
|
|
92454
|
+
defaultValue: "",
|
|
92455
|
+
additionalStateVariablesDefined: [
|
|
92456
|
+
{
|
|
92457
|
+
variableName: hasLatexVar,
|
|
92458
|
+
forRenderer: true
|
|
92459
|
+
}
|
|
92460
|
+
],
|
|
92461
|
+
returnDependencies: () => ({
|
|
92462
|
+
labelChild: {
|
|
92463
|
+
dependencyType: "child",
|
|
92464
|
+
childGroups: [childGroup],
|
|
92465
|
+
variableNames: ["value", "hasLatex"]
|
|
92466
|
+
}
|
|
92467
|
+
}),
|
|
92468
|
+
definition({ dependencyValues }) {
|
|
92469
|
+
if (dependencyValues.labelChild.length > 0) {
|
|
92470
|
+
const labelChild = dependencyValues.labelChild[dependencyValues.labelChild.length - 1];
|
|
92471
|
+
return {
|
|
92472
|
+
setValue: {
|
|
92473
|
+
[labelVar]: labelChild.stateValues.value,
|
|
92474
|
+
[hasLatexVar]: labelChild.stateValues.hasLatex
|
|
92475
|
+
}
|
|
92476
|
+
};
|
|
92477
|
+
} else {
|
|
92478
|
+
return {
|
|
92479
|
+
useEssentialOrDefaultValue: { [labelVar]: true },
|
|
92480
|
+
setValue: { [hasLatexVar]: false }
|
|
92481
|
+
};
|
|
92482
|
+
}
|
|
92483
|
+
},
|
|
92484
|
+
inverseDefinition({
|
|
92485
|
+
desiredStateVariableValues,
|
|
92486
|
+
dependencyValues
|
|
92487
|
+
}) {
|
|
92488
|
+
if (typeof desiredStateVariableValues[labelVar] !== "string") {
|
|
92489
|
+
return { success: false };
|
|
92490
|
+
}
|
|
92491
|
+
if (dependencyValues.labelChild.length > 0) {
|
|
92492
|
+
const lastLabelInd = dependencyValues.labelChild.length - 1;
|
|
92493
|
+
return {
|
|
92494
|
+
success: true,
|
|
92495
|
+
instructions: [
|
|
92496
|
+
{
|
|
92497
|
+
setDependency: "labelChild",
|
|
92498
|
+
desiredValue: desiredStateVariableValues[labelVar],
|
|
92499
|
+
childIndex: lastLabelInd,
|
|
92500
|
+
variableIndex: 0
|
|
92501
|
+
}
|
|
92502
|
+
]
|
|
92503
|
+
};
|
|
92504
|
+
} else {
|
|
92505
|
+
return {
|
|
92506
|
+
success: true,
|
|
92507
|
+
instructions: [
|
|
92508
|
+
{
|
|
92509
|
+
setEssentialValue: labelVar,
|
|
92510
|
+
value: desiredStateVariableValues[labelVar]
|
|
92511
|
+
}
|
|
92512
|
+
]
|
|
92513
|
+
};
|
|
92514
|
+
}
|
|
92515
|
+
}
|
|
92516
|
+
}
|
|
92517
|
+
};
|
|
92518
|
+
}
|
|
92519
|
+
function escapeXml(value) {
|
|
92520
|
+
return String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
92521
|
+
}
|
|
92522
|
+
function asFiniteNumber(value) {
|
|
92523
|
+
return Number.isFinite(value) ? Number(value) : null;
|
|
92524
|
+
}
|
|
92525
|
+
function formatNumber$1(value) {
|
|
92526
|
+
const num = asFiniteNumber(value);
|
|
92527
|
+
return num === null ? null : `${num}`;
|
|
92528
|
+
}
|
|
92529
|
+
function formatPoint(point2) {
|
|
92530
|
+
if (!Array.isArray(point2) || point2.length < 2) {
|
|
92531
|
+
return null;
|
|
92532
|
+
}
|
|
92533
|
+
const x2 = formatNumber$1(point2[0]);
|
|
92534
|
+
const y2 = formatNumber$1(point2[1]);
|
|
92535
|
+
if (x2 === null || y2 === null) {
|
|
92536
|
+
return null;
|
|
92537
|
+
}
|
|
92538
|
+
return `(${x2},${y2})`;
|
|
92539
|
+
}
|
|
92540
|
+
function extractFinitePoint(point2) {
|
|
92541
|
+
if (!Array.isArray(point2) || point2.length < 2) {
|
|
92542
|
+
return null;
|
|
92543
|
+
}
|
|
92544
|
+
const x2 = asFiniteNumber(point2[0]);
|
|
92545
|
+
const y2 = asFiniteNumber(point2[1]);
|
|
92546
|
+
if (x2 === null || y2 === null) {
|
|
92547
|
+
return null;
|
|
92548
|
+
}
|
|
92549
|
+
return [x2, y2];
|
|
92550
|
+
}
|
|
92551
|
+
function extractFinitePointPair(points) {
|
|
92552
|
+
if (!Array.isArray(points) || points.length < 2) {
|
|
92553
|
+
return null;
|
|
92554
|
+
}
|
|
92555
|
+
const point1 = extractFinitePoint(points[0]);
|
|
92556
|
+
const point2 = extractFinitePoint(points[1]);
|
|
92557
|
+
if (point1 === null || point2 === null) {
|
|
92558
|
+
return null;
|
|
92559
|
+
}
|
|
92560
|
+
return [point1, point2];
|
|
92561
|
+
}
|
|
92562
|
+
function sanitizeHandle(value) {
|
|
92563
|
+
return String(value).toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
92564
|
+
}
|
|
92565
|
+
function createStableHandle(descendant, index2, usedHandles) {
|
|
92566
|
+
const stem = sanitizeHandle(`${descendant.componentType}_${index2}`);
|
|
92567
|
+
let handle = stem || `graphical_${index2}`;
|
|
92568
|
+
let suffix = 1;
|
|
92569
|
+
while (usedHandles.has(handle)) {
|
|
92570
|
+
suffix += 1;
|
|
92571
|
+
handle = `${stem}_${suffix}`;
|
|
92572
|
+
}
|
|
92573
|
+
usedHandles.add(handle);
|
|
92574
|
+
return handle;
|
|
92575
|
+
}
|
|
92576
|
+
function warningSubjectForDescendant(descendant) {
|
|
92577
|
+
if (descendant?.componentName) {
|
|
92578
|
+
return `<${descendant.componentType}> (${descendant.componentName})`;
|
|
92579
|
+
}
|
|
92580
|
+
return `<${descendant?.componentType ?? "?"}>`;
|
|
92581
|
+
}
|
|
92582
|
+
function pushWarning({
|
|
92583
|
+
diagnostics: diagnostics2,
|
|
92584
|
+
code,
|
|
92585
|
+
args,
|
|
92586
|
+
position: position2
|
|
92587
|
+
}) {
|
|
92588
|
+
diagnostics2.push(
|
|
92589
|
+
codedDiagnostic({ type: "warning", code, args, position: position2 })
|
|
92590
|
+
);
|
|
92591
|
+
}
|
|
92592
|
+
function sortDescendantsByOrder(a2, b2) {
|
|
92593
|
+
if (Number.isFinite(a2.componentIdx) && Number.isFinite(b2.componentIdx)) {
|
|
92594
|
+
return a2.componentIdx - b2.componentIdx;
|
|
92595
|
+
}
|
|
92596
|
+
return String(a2.componentName ?? "").localeCompare(
|
|
92597
|
+
String(b2.componentName ?? "")
|
|
92598
|
+
);
|
|
92599
|
+
}
|
|
92600
|
+
function normalizeLineClipInputs({
|
|
92601
|
+
point1,
|
|
92602
|
+
point2,
|
|
92603
|
+
bounds
|
|
92604
|
+
}) {
|
|
92605
|
+
if (!Array.isArray(point1) || !Array.isArray(point2) || point1.length < 2 || point2.length < 2 || !Array.isArray(bounds) || bounds.length < 4) {
|
|
92606
|
+
return null;
|
|
92607
|
+
}
|
|
92608
|
+
const x0 = asFiniteNumber(point1[0]);
|
|
92609
|
+
const y0 = asFiniteNumber(point1[1]);
|
|
92610
|
+
const x1 = asFiniteNumber(point2[0]);
|
|
92611
|
+
const y1 = asFiniteNumber(point2[1]);
|
|
92612
|
+
const bxMin = asFiniteNumber(bounds[0]);
|
|
92613
|
+
const byMin = asFiniteNumber(bounds[1]);
|
|
92614
|
+
const bxMax = asFiniteNumber(bounds[2]);
|
|
92615
|
+
const byMax = asFiniteNumber(bounds[3]);
|
|
92616
|
+
if (x0 === null || y0 === null || x1 === null || y1 === null || bxMin === null || byMin === null || bxMax === null || byMax === null) {
|
|
92617
|
+
return null;
|
|
92618
|
+
}
|
|
92619
|
+
const dx = x1 - x0;
|
|
92620
|
+
const dy = y1 - y0;
|
|
92621
|
+
if (dx === 0 && dy === 0) {
|
|
92622
|
+
return null;
|
|
92623
|
+
}
|
|
92624
|
+
return { x0, y0, dx, dy, bxMin, byMin, bxMax, byMax };
|
|
92625
|
+
}
|
|
92626
|
+
function clipLineLikeToBounds({
|
|
92627
|
+
point1,
|
|
92628
|
+
point2,
|
|
92629
|
+
bounds,
|
|
92630
|
+
tMin,
|
|
92631
|
+
tMax
|
|
92632
|
+
}) {
|
|
92633
|
+
const inputs = normalizeLineClipInputs({ point1, point2, bounds });
|
|
92634
|
+
if (!inputs) {
|
|
92635
|
+
return null;
|
|
92636
|
+
}
|
|
92637
|
+
const { x0, y0, dx, dy, bxMin, byMin, bxMax, byMax } = inputs;
|
|
92638
|
+
let clippedTMin = tMin;
|
|
92639
|
+
let clippedTMax = tMax;
|
|
92640
|
+
const updateRange = (p0, delta, minBound, maxBound) => {
|
|
92641
|
+
if (delta !== 0) {
|
|
92642
|
+
let ta2 = (minBound - p0) / delta;
|
|
92643
|
+
let tb = (maxBound - p0) / delta;
|
|
92644
|
+
if (ta2 > tb) {
|
|
92645
|
+
[ta2, tb] = [tb, ta2];
|
|
92646
|
+
}
|
|
92647
|
+
clippedTMin = Math.max(clippedTMin, ta2);
|
|
92648
|
+
clippedTMax = Math.min(clippedTMax, tb);
|
|
92649
|
+
return clippedTMin <= clippedTMax;
|
|
92650
|
+
}
|
|
92651
|
+
return p0 >= minBound && p0 <= maxBound;
|
|
92652
|
+
};
|
|
92653
|
+
if (!updateRange(x0, dx, bxMin, bxMax)) {
|
|
92654
|
+
return null;
|
|
92655
|
+
}
|
|
92656
|
+
if (!updateRange(y0, dy, byMin, byMax)) {
|
|
92657
|
+
return null;
|
|
92658
|
+
}
|
|
92659
|
+
return [
|
|
92660
|
+
[x0 + clippedTMin * dx, y0 + clippedTMin * dy],
|
|
92661
|
+
[x0 + clippedTMax * dx, y0 + clippedTMax * dy]
|
|
92662
|
+
];
|
|
92663
|
+
}
|
|
92664
|
+
const PREFIGURE_DARK_AXIS_COLOR = "#ffffff";
|
|
92665
|
+
function darkModeAxisStrokeAttr(darkMode) {
|
|
92666
|
+
return darkMode ? ` stroke="${PREFIGURE_DARK_AXIS_COLOR}"` : "";
|
|
92667
|
+
}
|
|
92668
|
+
const prefigurePointAlignmentByLabelPosition = {
|
|
92669
|
+
upperright: "ne",
|
|
92670
|
+
upperleft: "nw",
|
|
92671
|
+
lowerright: "se",
|
|
92672
|
+
lowerleft: "sw",
|
|
92673
|
+
top: "n",
|
|
92674
|
+
bottom: "s",
|
|
92675
|
+
left: "w",
|
|
92676
|
+
right: "e"
|
|
92677
|
+
};
|
|
92678
|
+
function normalizeKey(value) {
|
|
92679
|
+
return String(value).toLowerCase().replace(/[^a-z0-9]+/g, "");
|
|
92680
|
+
}
|
|
92681
|
+
const THEME_AWARE_LABEL_COLOR_ATTR = 'color="currentColor"';
|
|
92682
|
+
const LABEL_EDGE_PADDING_RATIO = 0.02;
|
|
92683
|
+
const LINE_LABEL_ENDPOINT_INSET_RATIO = 0.05;
|
|
92684
|
+
const LINE_LABEL_ENDPOINT_INSET_PIXELS = 12;
|
|
92685
|
+
const KNOWN_LINE_POSITIONS = /* @__PURE__ */ new Set([
|
|
92686
|
+
"left",
|
|
92687
|
+
"upperleft",
|
|
92688
|
+
"lowerleft",
|
|
92689
|
+
"right",
|
|
92690
|
+
"upperright",
|
|
92691
|
+
"lowerright",
|
|
92692
|
+
"center",
|
|
92693
|
+
"top",
|
|
92694
|
+
"bottom"
|
|
92695
|
+
]);
|
|
92696
|
+
function formatLocation(value) {
|
|
92697
|
+
const rounded = Number(value.toFixed(6));
|
|
92698
|
+
return `${rounded}`;
|
|
92699
|
+
}
|
|
92700
|
+
function clamp01(value) {
|
|
92701
|
+
return Math.min(1, Math.max(0, value));
|
|
92702
|
+
}
|
|
92703
|
+
function getPreferredDirectionForLabelPosition(labelPosition) {
|
|
92704
|
+
switch (normalizeKey(labelPosition ?? "")) {
|
|
92705
|
+
case "right":
|
|
92706
|
+
return [1, 0];
|
|
92707
|
+
case "left":
|
|
92708
|
+
return [-1, 0];
|
|
92709
|
+
case "top":
|
|
92710
|
+
return [0, 1];
|
|
92711
|
+
case "bottom":
|
|
92712
|
+
return [0, -1];
|
|
92713
|
+
case "upperright":
|
|
92714
|
+
return [1 / Math.SQRT2, 1 / Math.SQRT2];
|
|
92715
|
+
case "upperleft":
|
|
92716
|
+
return [-1 / Math.SQRT2, 1 / Math.SQRT2];
|
|
92717
|
+
case "lowerright":
|
|
92718
|
+
return [1 / Math.SQRT2, -1 / Math.SQRT2];
|
|
92719
|
+
case "lowerleft":
|
|
92720
|
+
return [-1 / Math.SQRT2, -1 / Math.SQRT2];
|
|
92721
|
+
default:
|
|
92722
|
+
return null;
|
|
92723
|
+
}
|
|
92724
|
+
}
|
|
92725
|
+
function biasFromPreferredDirection(preferredDirection, ep1, ep2) {
|
|
92726
|
+
const dx = ep2[0] - ep1[0];
|
|
92727
|
+
const dy = ep2[1] - ep1[1];
|
|
92728
|
+
const segmentLength = Math.hypot(dx, dy);
|
|
92729
|
+
if (!(segmentLength > 0)) {
|
|
92730
|
+
return 0;
|
|
92731
|
+
}
|
|
92732
|
+
const tx = dx / segmentLength;
|
|
92733
|
+
const ty = dy / segmentLength;
|
|
92734
|
+
const agreement = tx * preferredDirection[0] + ty * preferredDirection[1];
|
|
92735
|
+
return Math.max(-1, Math.min(1, Math.SQRT2 * agreement));
|
|
92736
|
+
}
|
|
92737
|
+
function chooseEndpointBiasForLabelPosition(labelPosition, ep1, ep2) {
|
|
92738
|
+
const pos = normalizeKey(labelPosition ?? "");
|
|
92739
|
+
if (!KNOWN_LINE_POSITIONS.has(pos) || pos === "center") {
|
|
92740
|
+
return null;
|
|
92741
|
+
}
|
|
92742
|
+
const preferredDirection = getPreferredDirectionForLabelPosition(pos);
|
|
92743
|
+
if (!preferredDirection) {
|
|
92744
|
+
return null;
|
|
92745
|
+
}
|
|
92746
|
+
return biasFromPreferredDirection(preferredDirection, ep1, ep2);
|
|
92747
|
+
}
|
|
92748
|
+
function lineLabelAnchorPoint({
|
|
92749
|
+
ep1,
|
|
92750
|
+
ep2,
|
|
92751
|
+
location
|
|
92752
|
+
}) {
|
|
92753
|
+
return [
|
|
92754
|
+
ep1[0] + (ep2[0] - ep1[0]) * location,
|
|
92755
|
+
ep1[1] + (ep2[1] - ep1[1]) * location
|
|
92756
|
+
];
|
|
92757
|
+
}
|
|
92758
|
+
function getGraphBounds(graphBounds) {
|
|
92759
|
+
const bounds = Array.isArray(graphBounds) ? graphBounds : null;
|
|
92760
|
+
if (!bounds || bounds.length !== 4) {
|
|
92761
|
+
return null;
|
|
92762
|
+
}
|
|
92763
|
+
const [xMin, yMin, xMax, yMax] = bounds;
|
|
92764
|
+
if (!Number.isFinite(xMin) || !Number.isFinite(yMin) || !Number.isFinite(xMax) || !Number.isFinite(yMax) || !(xMax > xMin) || !(yMax > yMin)) {
|
|
92765
|
+
return null;
|
|
92766
|
+
}
|
|
92767
|
+
return { xMin, yMin, xMax, yMax };
|
|
92768
|
+
}
|
|
92769
|
+
function getGraphDimensions(graphDimensions) {
|
|
92770
|
+
const dims = Array.isArray(graphDimensions) ? graphDimensions : null;
|
|
92771
|
+
if (!dims || dims.length !== 2) {
|
|
92772
|
+
return null;
|
|
92773
|
+
}
|
|
92774
|
+
const [width, height] = dims;
|
|
92775
|
+
if (!Number.isFinite(width) || !Number.isFinite(height) || !(width > 0) || !(height > 0)) {
|
|
92776
|
+
return null;
|
|
92777
|
+
}
|
|
92778
|
+
return { width, height };
|
|
92779
|
+
}
|
|
92780
|
+
function getLineTangent(ep1, ep2) {
|
|
92781
|
+
const dx = ep2[0] - ep1[0];
|
|
92782
|
+
const dy = ep2[1] - ep1[1];
|
|
92783
|
+
const length = Math.hypot(dx, dy);
|
|
92784
|
+
if (!(length > 0)) {
|
|
92785
|
+
return null;
|
|
92786
|
+
}
|
|
92787
|
+
return [dx / length, dy / length];
|
|
92788
|
+
}
|
|
92789
|
+
function estimateLabelMetrics(labelText, labelHasLatex) {
|
|
92790
|
+
const raw = typeof labelText === "string" ? labelText.trim() : "";
|
|
92791
|
+
const visibleLength = raw.length;
|
|
92792
|
+
let effectiveLength = visibleLength;
|
|
92793
|
+
if (labelHasLatex) {
|
|
92794
|
+
const latexRuns = (raw.match(/\\\(|\\\)|<m>|<\/m>/g) ?? []).length;
|
|
92795
|
+
effectiveLength += latexRuns * 3;
|
|
92796
|
+
}
|
|
92797
|
+
return {
|
|
92798
|
+
width: Math.min(6, Math.max(0.9, effectiveLength * 0.27)),
|
|
92799
|
+
height: 1
|
|
92800
|
+
};
|
|
92801
|
+
}
|
|
92802
|
+
function getLineAlignmentCandidates(labelPosition, location, preferNorth = true) {
|
|
92803
|
+
const pos = normalizeKey(labelPosition ?? "");
|
|
92804
|
+
if (!pos || !KNOWN_LINE_POSITIONS.has(pos)) {
|
|
92805
|
+
return null;
|
|
92806
|
+
}
|
|
92807
|
+
const h2 = location >= 0.5 ? "w" : "e";
|
|
92808
|
+
const oppositeH = h2 === "w" ? "e" : "w";
|
|
92809
|
+
const primary = preferNorth ? "n" : "s";
|
|
92810
|
+
const secondary = preferNorth ? "s" : "n";
|
|
92811
|
+
if (pos === "center") {
|
|
92812
|
+
return ["n", "s", `n${h2}`, `s${h2}`, `n${oppositeH}`, `s${oppositeH}`];
|
|
92813
|
+
}
|
|
92814
|
+
return [
|
|
92815
|
+
primary,
|
|
92816
|
+
`${primary}${h2}`,
|
|
92817
|
+
secondary,
|
|
92818
|
+
`${secondary}${h2}`,
|
|
92819
|
+
`${primary}${oppositeH}`,
|
|
92820
|
+
`${secondary}${oppositeH}`
|
|
92821
|
+
];
|
|
92822
|
+
}
|
|
92823
|
+
function getAlignmentExtents(tangent, alignment, metrics) {
|
|
92824
|
+
const normal2 = [-tangent[1], tangent[0]];
|
|
92825
|
+
const width = metrics?.width ?? 1.2;
|
|
92826
|
+
const height = metrics?.height ?? 1;
|
|
92827
|
+
let minT = -width / 2;
|
|
92828
|
+
let maxT = width / 2;
|
|
92829
|
+
let minN = -height / 2;
|
|
92830
|
+
let maxN = height / 2;
|
|
92831
|
+
switch (alignment) {
|
|
92832
|
+
case "n":
|
|
92833
|
+
minN = 0;
|
|
92834
|
+
maxN = height;
|
|
92835
|
+
break;
|
|
92836
|
+
case "s":
|
|
92837
|
+
minN = -height;
|
|
92838
|
+
maxN = 0;
|
|
92839
|
+
break;
|
|
92840
|
+
case "e":
|
|
92841
|
+
minT = 0;
|
|
92842
|
+
maxT = width;
|
|
92843
|
+
break;
|
|
92844
|
+
case "w":
|
|
92845
|
+
minT = -width;
|
|
92846
|
+
maxT = 0;
|
|
92847
|
+
break;
|
|
92848
|
+
case "ne":
|
|
92849
|
+
minT = 0;
|
|
92850
|
+
maxT = width;
|
|
92851
|
+
minN = 0;
|
|
92852
|
+
maxN = height;
|
|
92853
|
+
break;
|
|
92854
|
+
case "nw":
|
|
92855
|
+
minT = -width;
|
|
92856
|
+
maxT = 0;
|
|
92857
|
+
minN = 0;
|
|
92858
|
+
maxN = height;
|
|
92859
|
+
break;
|
|
92860
|
+
case "se":
|
|
92861
|
+
minT = 0;
|
|
92862
|
+
maxT = width;
|
|
92863
|
+
minN = -height;
|
|
92864
|
+
maxN = 0;
|
|
92865
|
+
break;
|
|
92866
|
+
case "sw":
|
|
92867
|
+
minT = -width;
|
|
92868
|
+
maxT = 0;
|
|
92869
|
+
minN = -height;
|
|
92870
|
+
maxN = 0;
|
|
92871
|
+
break;
|
|
92872
|
+
}
|
|
92873
|
+
const points = [
|
|
92874
|
+
[
|
|
92875
|
+
tangent[0] * minT + normal2[0] * minN,
|
|
92876
|
+
tangent[1] * minT + normal2[1] * minN
|
|
92877
|
+
],
|
|
92878
|
+
[
|
|
92879
|
+
tangent[0] * minT + normal2[0] * maxN,
|
|
92880
|
+
tangent[1] * minT + normal2[1] * maxN
|
|
92881
|
+
],
|
|
92882
|
+
[
|
|
92883
|
+
tangent[0] * maxT + normal2[0] * minN,
|
|
92884
|
+
tangent[1] * maxT + normal2[1] * minN
|
|
92885
|
+
],
|
|
92886
|
+
[
|
|
92887
|
+
tangent[0] * maxT + normal2[0] * maxN,
|
|
92888
|
+
tangent[1] * maxT + normal2[1] * maxN
|
|
92889
|
+
]
|
|
92890
|
+
];
|
|
92891
|
+
return {
|
|
92892
|
+
minX: Math.min(...points.map((point2) => point2[0])),
|
|
92893
|
+
maxX: Math.max(...points.map((point2) => point2[0])),
|
|
92894
|
+
minY: Math.min(...points.map((point2) => point2[1])),
|
|
92895
|
+
maxY: Math.max(...points.map((point2) => point2[1]))
|
|
92896
|
+
};
|
|
92897
|
+
}
|
|
92898
|
+
function computeAlignmentOverflowAt({
|
|
92899
|
+
anchor,
|
|
92900
|
+
tangent,
|
|
92901
|
+
alignment,
|
|
92902
|
+
graphBounds,
|
|
92903
|
+
labelMetrics
|
|
92904
|
+
}) {
|
|
92905
|
+
const bounds = getGraphBounds(graphBounds);
|
|
92906
|
+
if (!bounds) {
|
|
92907
|
+
return { overflowAmount: 0 };
|
|
92908
|
+
}
|
|
92909
|
+
const { xMin, yMin, xMax, yMax } = bounds;
|
|
92910
|
+
const width = xMax - xMin;
|
|
92911
|
+
const height = yMax - yMin;
|
|
92912
|
+
const edgePaddingX = width * LABEL_EDGE_PADDING_RATIO;
|
|
92913
|
+
const edgePaddingY = height * LABEL_EDGE_PADDING_RATIO;
|
|
92914
|
+
const extents = getAlignmentExtents(tangent, alignment, labelMetrics);
|
|
92915
|
+
const projectedLeft = anchor[0] + extents.minX;
|
|
92916
|
+
const projectedRight = anchor[0] + extents.maxX;
|
|
92917
|
+
const projectedBottom = anchor[1] + extents.minY;
|
|
92918
|
+
const projectedTop = anchor[1] + extents.maxY;
|
|
92919
|
+
const overflowLeft = Math.max(0, xMin + edgePaddingX - projectedLeft);
|
|
92920
|
+
const overflowRight = Math.max(0, projectedRight - (xMax - edgePaddingX));
|
|
92921
|
+
const overflowBottom = Math.max(0, yMin + edgePaddingY - projectedBottom);
|
|
92922
|
+
const overflowTop = Math.max(0, projectedTop - (yMax - edgePaddingY));
|
|
92923
|
+
const overflowAmount = overflowLeft + overflowRight + overflowBottom + overflowTop;
|
|
92924
|
+
return { overflowAmount };
|
|
92925
|
+
}
|
|
92926
|
+
function evaluateLineAlignmentOverflow({
|
|
92927
|
+
alignment,
|
|
92928
|
+
ep1,
|
|
92929
|
+
ep2,
|
|
92930
|
+
location,
|
|
92931
|
+
graphBounds,
|
|
92932
|
+
labelMetrics
|
|
92933
|
+
}) {
|
|
92934
|
+
const tangent = getLineTangent(ep1, ep2);
|
|
92935
|
+
if (!tangent) {
|
|
92936
|
+
return { overflowAmount: 0 };
|
|
92937
|
+
}
|
|
92938
|
+
const anchor = lineLabelAnchorPoint({ ep1, ep2, location });
|
|
92939
|
+
return computeAlignmentOverflowAt({
|
|
92940
|
+
anchor,
|
|
92941
|
+
tangent,
|
|
92942
|
+
alignment,
|
|
92943
|
+
graphBounds,
|
|
92944
|
+
labelMetrics
|
|
92945
|
+
});
|
|
92946
|
+
}
|
|
92947
|
+
function getLineLabelAlignment({
|
|
92948
|
+
labelPosition,
|
|
92949
|
+
location,
|
|
92950
|
+
ep1,
|
|
92951
|
+
ep2,
|
|
92952
|
+
graphBounds,
|
|
92953
|
+
labelText,
|
|
92954
|
+
labelHasLatex
|
|
92955
|
+
}) {
|
|
92956
|
+
const tangent = getLineTangent(ep1, ep2);
|
|
92957
|
+
const preferredDirection = getPreferredDirectionForLabelPosition(labelPosition);
|
|
92958
|
+
const preferNorth = preferredDirection && tangent ? -tangent[1] * preferredDirection[0] + tangent[0] * preferredDirection[1] >= 0 : true;
|
|
92959
|
+
const candidates = getLineAlignmentCandidates(
|
|
92960
|
+
labelPosition,
|
|
92961
|
+
location,
|
|
92962
|
+
preferNorth
|
|
92963
|
+
);
|
|
92964
|
+
if (!candidates?.length) {
|
|
92965
|
+
return null;
|
|
92966
|
+
}
|
|
92967
|
+
const labelMetrics = estimateLabelMetrics(labelText, labelHasLatex);
|
|
92968
|
+
let bestAlignment = candidates[0];
|
|
92969
|
+
let minimumOverflow = Number.POSITIVE_INFINITY;
|
|
92970
|
+
for (const candidate of candidates) {
|
|
92971
|
+
const result2 = evaluateLineAlignmentOverflow({
|
|
92972
|
+
alignment: candidate,
|
|
92973
|
+
ep1,
|
|
92974
|
+
ep2,
|
|
92975
|
+
location,
|
|
92976
|
+
graphBounds,
|
|
92977
|
+
labelMetrics
|
|
92978
|
+
});
|
|
92979
|
+
if (result2.overflowAmount === 0) {
|
|
92980
|
+
return candidate;
|
|
92981
|
+
}
|
|
92982
|
+
if (result2.overflowAmount < minimumOverflow) {
|
|
92983
|
+
bestAlignment = candidate;
|
|
92984
|
+
minimumOverflow = result2.overflowAmount;
|
|
92985
|
+
}
|
|
92986
|
+
}
|
|
92987
|
+
return bestAlignment;
|
|
92988
|
+
}
|
|
92989
|
+
function orientEndpointsForLineLabel(p1Raw, p2Raw) {
|
|
92990
|
+
if (p1Raw[0] > p2Raw[0] || p1Raw[0] === p2Raw[0] && p1Raw[1] > p2Raw[1]) {
|
|
92991
|
+
return [p2Raw, p1Raw];
|
|
92992
|
+
}
|
|
92993
|
+
return [p1Raw, p2Raw];
|
|
92994
|
+
}
|
|
92995
|
+
function labelMarkup({
|
|
92996
|
+
label,
|
|
92997
|
+
labelHasLatex
|
|
92998
|
+
}) {
|
|
92999
|
+
if (typeof label !== "string") {
|
|
93000
|
+
return null;
|
|
93001
|
+
}
|
|
93002
|
+
const text = label.trim();
|
|
93003
|
+
if (!text) {
|
|
93004
|
+
return null;
|
|
93005
|
+
}
|
|
93006
|
+
if (labelHasLatex) {
|
|
93007
|
+
const openDelimiters = (text.match(/\\\(/g) ?? []).length;
|
|
93008
|
+
const closeDelimiters = (text.match(/\\\)/g) ?? []).length;
|
|
93009
|
+
if (openDelimiters > 0 && openDelimiters === closeDelimiters) {
|
|
93010
|
+
return escapeXml(text).replace(/\\\(/g, "<m>").replace(/\\\)/g, "</m>");
|
|
93011
|
+
}
|
|
93012
|
+
return `<m>${escapeXml(text)}</m>`;
|
|
93013
|
+
}
|
|
93014
|
+
return escapeXml(text);
|
|
93015
|
+
}
|
|
93016
|
+
const POINT_ALIGNMENT_CANDIDATES = {
|
|
93017
|
+
n: ["n", "nw", "ne", "w", "e", "sw", "se", "s"],
|
|
93018
|
+
ne: ["ne", "n", "e", "nw", "se", "w", "s", "sw"],
|
|
93019
|
+
e: ["e", "ne", "se", "n", "s", "nw", "sw", "w"],
|
|
93020
|
+
se: ["se", "e", "s", "ne", "sw", "n", "w", "nw"],
|
|
93021
|
+
s: ["s", "se", "sw", "e", "w", "ne", "nw", "n"],
|
|
93022
|
+
sw: ["sw", "s", "w", "se", "nw", "e", "n", "ne"],
|
|
93023
|
+
w: ["w", "nw", "sw", "n", "s", "ne", "se", "e"],
|
|
93024
|
+
nw: ["nw", "n", "w", "ne", "sw", "e", "s", "se"]
|
|
93025
|
+
};
|
|
93026
|
+
function getPointAlignmentCandidates(labelPosition) {
|
|
93027
|
+
const key = normalizeKey(labelPosition ?? "");
|
|
93028
|
+
const primary = prefigurePointAlignmentByLabelPosition[key];
|
|
93029
|
+
if (!primary) return null;
|
|
93030
|
+
return POINT_ALIGNMENT_CANDIDATES[primary] ?? null;
|
|
93031
|
+
}
|
|
93032
|
+
function getPointLabelAlignment({
|
|
93033
|
+
labelPosition,
|
|
93034
|
+
point: point2,
|
|
93035
|
+
graphBounds,
|
|
93036
|
+
labelText,
|
|
93037
|
+
labelHasLatex
|
|
93038
|
+
}) {
|
|
93039
|
+
const candidates = getPointAlignmentCandidates(labelPosition);
|
|
93040
|
+
if (!candidates?.length) return null;
|
|
93041
|
+
const tangent = [1, 0];
|
|
93042
|
+
const labelMetrics = estimateLabelMetrics(labelText, labelHasLatex);
|
|
93043
|
+
let bestAlignment = candidates[0];
|
|
93044
|
+
let minimumOverflow = Number.POSITIVE_INFINITY;
|
|
93045
|
+
for (const candidate of candidates) {
|
|
93046
|
+
const { overflowAmount } = computeAlignmentOverflowAt({
|
|
93047
|
+
anchor: point2,
|
|
93048
|
+
tangent,
|
|
93049
|
+
alignment: candidate,
|
|
93050
|
+
graphBounds,
|
|
93051
|
+
labelMetrics
|
|
93052
|
+
});
|
|
93053
|
+
if (overflowAmount === 0) {
|
|
93054
|
+
return candidate;
|
|
93055
|
+
}
|
|
93056
|
+
if (overflowAmount < minimumOverflow) {
|
|
93057
|
+
bestAlignment = candidate;
|
|
93058
|
+
minimumOverflow = overflowAmount;
|
|
93059
|
+
}
|
|
93060
|
+
}
|
|
93061
|
+
return bestAlignment;
|
|
93062
|
+
}
|
|
93063
|
+
function pointLabelAttributes({
|
|
93064
|
+
stateValues,
|
|
93065
|
+
diagnostics: diagnostics2,
|
|
93066
|
+
warningPrefix,
|
|
93067
|
+
warningPosition
|
|
93068
|
+
}) {
|
|
93069
|
+
const label = labelMarkup({
|
|
93070
|
+
label: stateValues?.label,
|
|
93071
|
+
labelHasLatex: stateValues?.labelHasLatex
|
|
93072
|
+
});
|
|
93073
|
+
if (!label) {
|
|
93074
|
+
return null;
|
|
93075
|
+
}
|
|
93076
|
+
const attrs = [THEME_AWARE_LABEL_COLOR_ATTR];
|
|
93077
|
+
const rawPosition = stateValues?.labelPosition;
|
|
93078
|
+
if (rawPosition) {
|
|
93079
|
+
const rawXs = stateValues?.numericalXs;
|
|
93080
|
+
const pointCoord = Array.isArray(rawXs) && rawXs.length >= 2 && Number.isFinite(rawXs[0]) && Number.isFinite(rawXs[1]) ? [Number(rawXs[0]), Number(rawXs[1])] : null;
|
|
93081
|
+
const directAlignment = prefigurePointAlignmentByLabelPosition[normalizeKey(rawPosition)];
|
|
93082
|
+
if (directAlignment) {
|
|
93083
|
+
const alignment = pointCoord !== null && stateValues?.graphBounds ? getPointLabelAlignment({
|
|
93084
|
+
labelPosition: rawPosition,
|
|
93085
|
+
point: pointCoord,
|
|
93086
|
+
graphBounds: stateValues.graphBounds,
|
|
93087
|
+
labelText: stateValues?.label,
|
|
93088
|
+
labelHasLatex: stateValues?.labelHasLatex
|
|
93089
|
+
}) ?? directAlignment : directAlignment;
|
|
93090
|
+
attrs.push(`alignment="${escapeXml(alignment)}"`);
|
|
93091
|
+
} else {
|
|
93092
|
+
pushWarning({
|
|
93093
|
+
diagnostics: diagnostics2,
|
|
93094
|
+
code: "doenet-w0090",
|
|
93095
|
+
args: {
|
|
93096
|
+
subject: warningPrefix,
|
|
93097
|
+
labelPosition: rawPosition,
|
|
93098
|
+
labelKind: "point"
|
|
93099
|
+
},
|
|
93100
|
+
position: warningPosition
|
|
93101
|
+
});
|
|
93102
|
+
}
|
|
93103
|
+
}
|
|
93104
|
+
return { attrs, label };
|
|
93105
|
+
}
|
|
93106
|
+
function locationFromBiasWithInsetRatio({
|
|
93107
|
+
bias,
|
|
93108
|
+
insetRatio
|
|
93109
|
+
}) {
|
|
93110
|
+
const clampedBias = Math.max(-1, Math.min(1, bias));
|
|
93111
|
+
const clampedInset = clamp01(Math.min(0.5, insetRatio));
|
|
93112
|
+
const span = Math.max(0, 0.5 - clampedInset);
|
|
93113
|
+
return clamp01(0.5 + clampedBias * span);
|
|
93114
|
+
}
|
|
93115
|
+
function locationFromBiasWithAbsoluteEndpointOffset({
|
|
93116
|
+
bias,
|
|
93117
|
+
ep1,
|
|
93118
|
+
ep2,
|
|
93119
|
+
graphBounds,
|
|
93120
|
+
graphDimensions
|
|
93121
|
+
}) {
|
|
93122
|
+
const bounds = getGraphBounds(graphBounds);
|
|
93123
|
+
const dims = getGraphDimensions(graphDimensions);
|
|
93124
|
+
const dx = ep2[0] - ep1[0];
|
|
93125
|
+
const dy = ep2[1] - ep1[1];
|
|
93126
|
+
const segmentLength = Math.hypot(dx, dy);
|
|
93127
|
+
const graphWidth = bounds ? bounds.xMax - bounds.xMin : 0;
|
|
93128
|
+
const graphHeight = bounds ? bounds.yMax - bounds.yMin : 0;
|
|
93129
|
+
const shouldUseRelativeInsetFallback = !bounds || !dims || !(segmentLength > 0) || !(graphWidth > 0) || !(graphHeight > 0);
|
|
93130
|
+
if (shouldUseRelativeInsetFallback) {
|
|
93131
|
+
return locationFromBiasWithInsetRatio({
|
|
93132
|
+
bias,
|
|
93133
|
+
insetRatio: LINE_LABEL_ENDPOINT_INSET_RATIO
|
|
93134
|
+
});
|
|
93135
|
+
}
|
|
93136
|
+
const tx = dx / segmentLength;
|
|
93137
|
+
const ty = dy / segmentLength;
|
|
93138
|
+
const unitsPerPixelAlongLine = Math.hypot(
|
|
93139
|
+
tx * (graphWidth / dims.width),
|
|
93140
|
+
ty * (graphHeight / dims.height)
|
|
93141
|
+
);
|
|
93142
|
+
const absoluteOffset = LINE_LABEL_ENDPOINT_INSET_PIXELS * unitsPerPixelAlongLine;
|
|
93143
|
+
const insetRatio = Math.min(0.45, clamp01(absoluteOffset / segmentLength));
|
|
93144
|
+
const location = locationFromBiasWithInsetRatio({
|
|
93145
|
+
bias,
|
|
93146
|
+
insetRatio
|
|
93147
|
+
});
|
|
93148
|
+
return location;
|
|
93149
|
+
}
|
|
93150
|
+
function lineLabelLocationValue(labelPosition, ep1, ep2, options = {}) {
|
|
93151
|
+
const endpointBias = chooseEndpointBiasForLabelPosition(
|
|
93152
|
+
labelPosition,
|
|
93153
|
+
ep1,
|
|
93154
|
+
ep2
|
|
93155
|
+
);
|
|
93156
|
+
if (endpointBias === null) {
|
|
93157
|
+
return null;
|
|
93158
|
+
}
|
|
93159
|
+
if (options.absoluteEndpointOffset) {
|
|
93160
|
+
return locationFromBiasWithAbsoluteEndpointOffset({
|
|
93161
|
+
bias: endpointBias,
|
|
93162
|
+
ep1,
|
|
93163
|
+
ep2,
|
|
93164
|
+
graphBounds: options.graphBounds,
|
|
93165
|
+
graphDimensions: options.graphDimensions
|
|
93166
|
+
});
|
|
93167
|
+
}
|
|
93168
|
+
return locationFromBiasWithInsetRatio({
|
|
93169
|
+
bias: endpointBias,
|
|
93170
|
+
insetRatio: LINE_LABEL_ENDPOINT_INSET_RATIO
|
|
93171
|
+
});
|
|
93172
|
+
}
|
|
93173
|
+
function getLabelForLine({
|
|
93174
|
+
stateValues,
|
|
93175
|
+
ep1,
|
|
93176
|
+
ep2,
|
|
93177
|
+
diagnostics: diagnostics2,
|
|
93178
|
+
warningPrefix,
|
|
93179
|
+
warningPosition
|
|
93180
|
+
}) {
|
|
93181
|
+
const label = labelMarkup({
|
|
93182
|
+
label: stateValues?.label,
|
|
93183
|
+
labelHasLatex: stateValues?.labelHasLatex
|
|
93184
|
+
});
|
|
93185
|
+
if (!label) {
|
|
93186
|
+
return {
|
|
93187
|
+
labelAttrs: [],
|
|
93188
|
+
label: null
|
|
93189
|
+
};
|
|
93190
|
+
}
|
|
93191
|
+
const labelAttrs = [THEME_AWARE_LABEL_COLOR_ATTR];
|
|
93192
|
+
const rawPosition = stateValues?.labelPosition;
|
|
93193
|
+
const normalizedPosition = normalizeKey(rawPosition ?? "");
|
|
93194
|
+
const overrideLocRaw = stateValues?.lineLabelLocationOverride;
|
|
93195
|
+
const overrideLoc = Number(overrideLocRaw);
|
|
93196
|
+
const hasOverrideLoc = Number.isFinite(overrideLoc);
|
|
93197
|
+
const baseLoc = hasOverrideLoc ? clamp01(overrideLoc) : lineLabelLocationValue(rawPosition, ep1, ep2, {
|
|
93198
|
+
absoluteEndpointOffset: stateValues?.lineLabelAbsoluteEndpointOffset === true,
|
|
93199
|
+
graphBounds: stateValues?.graphBounds,
|
|
93200
|
+
graphDimensions: stateValues?.graphDimensions
|
|
93201
|
+
});
|
|
93202
|
+
let location = 0.5;
|
|
93203
|
+
if (baseLoc !== null && Number.isFinite(baseLoc)) {
|
|
93204
|
+
location = baseLoc;
|
|
93205
|
+
labelAttrs.push(
|
|
93206
|
+
`label-location="${escapeXml(formatLocation(location))}"`
|
|
93207
|
+
);
|
|
93208
|
+
}
|
|
93209
|
+
const alignmentLocationRaw = stateValues?.lineLabelAlignmentLocationOverride;
|
|
93210
|
+
const alignmentLocation = Number.isFinite(Number(alignmentLocationRaw)) ? Number(alignmentLocationRaw) : location;
|
|
93211
|
+
if (rawPosition) {
|
|
93212
|
+
const alignment = getLineLabelAlignment({
|
|
93213
|
+
labelPosition: rawPosition,
|
|
93214
|
+
location: alignmentLocation,
|
|
93215
|
+
ep1,
|
|
93216
|
+
ep2,
|
|
93217
|
+
graphBounds: stateValues?.graphBounds,
|
|
93218
|
+
labelText: stateValues?.label,
|
|
93219
|
+
labelHasLatex: stateValues?.labelHasLatex
|
|
93220
|
+
});
|
|
93221
|
+
if (alignment) {
|
|
93222
|
+
labelAttrs.push(`alignment="${escapeXml(alignment)}"`);
|
|
93223
|
+
} else if (!KNOWN_LINE_POSITIONS.has(normalizedPosition)) {
|
|
93224
|
+
pushWarning({
|
|
93225
|
+
diagnostics: diagnostics2,
|
|
93226
|
+
code: "doenet-w0090",
|
|
93227
|
+
args: {
|
|
93228
|
+
subject: warningPrefix,
|
|
93229
|
+
labelPosition: rawPosition,
|
|
93230
|
+
labelKind: "line-family"
|
|
93231
|
+
},
|
|
93232
|
+
position: warningPosition
|
|
93233
|
+
});
|
|
93234
|
+
}
|
|
93235
|
+
}
|
|
93236
|
+
return { labelAttrs, label };
|
|
93237
|
+
}
|
|
93238
|
+
const prefigureFillPatternByFillStyle = {
|
|
93239
|
+
horizontal: "horizontal",
|
|
93240
|
+
vertical: "vertical",
|
|
93241
|
+
diagonal: "diagonal",
|
|
93242
|
+
backdiagonal: "backdiagonal",
|
|
93243
|
+
dots: "dot",
|
|
93244
|
+
diamonds: "diamond"
|
|
93245
|
+
};
|
|
93246
|
+
const prefigureDashByLineStyle = {
|
|
93247
|
+
solid: null,
|
|
93248
|
+
dashed: "9 9",
|
|
93249
|
+
dotted: "4 4"
|
|
93250
|
+
};
|
|
93251
|
+
const prefigurePointStyleByMarkerStyle = {
|
|
93252
|
+
circle: "circle",
|
|
93253
|
+
square: "box",
|
|
93254
|
+
box: "box",
|
|
93255
|
+
diamond: "diamond",
|
|
93256
|
+
cross: "cross",
|
|
93257
|
+
plus: "plus",
|
|
93258
|
+
"double-circle": "double-circle"
|
|
93259
|
+
};
|
|
93260
|
+
function resolveSelectedStyleForTheme(selectedStyle, darkMode) {
|
|
93261
|
+
if (!selectedStyle || !darkMode) {
|
|
93262
|
+
return selectedStyle;
|
|
93263
|
+
}
|
|
93264
|
+
const pickDark = (darkKey, lightValue) => {
|
|
93265
|
+
const darkValue = selectedStyle[darkKey];
|
|
93266
|
+
return typeof darkValue === "string" ? darkValue : lightValue;
|
|
93267
|
+
};
|
|
93268
|
+
return {
|
|
93269
|
+
...selectedStyle,
|
|
93270
|
+
lineColor: pickDark("lineColorDarkMode", selectedStyle.lineColor),
|
|
93271
|
+
lineColorWord: pickDark(
|
|
93272
|
+
"lineColorWordDarkMode",
|
|
93273
|
+
selectedStyle.lineColorWord
|
|
93274
|
+
),
|
|
93275
|
+
fillColor: pickDark("fillColorDarkMode", selectedStyle.fillColor),
|
|
93276
|
+
fillColorWord: pickDark(
|
|
93277
|
+
"fillColorWordDarkMode",
|
|
93278
|
+
selectedStyle.fillColorWord
|
|
93279
|
+
),
|
|
93280
|
+
markerColor: pickDark("markerColorDarkMode", selectedStyle.markerColor),
|
|
93281
|
+
markerColorWord: pickDark(
|
|
93282
|
+
"markerColorWordDarkMode",
|
|
93283
|
+
selectedStyle.markerColorWord
|
|
93284
|
+
)
|
|
93285
|
+
};
|
|
93286
|
+
}
|
|
93287
|
+
function styleAttributes({
|
|
93288
|
+
selectedStyle,
|
|
93289
|
+
diagnostics: diagnostics2,
|
|
93290
|
+
warningPrefix,
|
|
93291
|
+
warningPosition,
|
|
93292
|
+
includeFill = true
|
|
93293
|
+
}) {
|
|
93294
|
+
const attrs = [];
|
|
93295
|
+
const stroke = selectedStyle?.lineColor ?? selectedStyle?.lineColorWord;
|
|
93296
|
+
if (stroke) {
|
|
93297
|
+
attrs.push(`stroke="${escapeXml(stroke)}"`);
|
|
93298
|
+
}
|
|
93299
|
+
const thickness = formatNumber$1(selectedStyle?.lineWidth);
|
|
93300
|
+
if (thickness !== null) {
|
|
93301
|
+
attrs.push(`thickness="${escapeXml(thickness)}"`);
|
|
93302
|
+
}
|
|
93303
|
+
if (includeFill) {
|
|
93304
|
+
const fillStyle = selectedStyle?.fillStyle;
|
|
93305
|
+
const prefigurePattern = fillStyle && fillStyle !== "solid" ? prefigureFillPatternByFillStyle[fillStyle] : void 0;
|
|
93306
|
+
const fill = selectedStyle?.fillColor ?? selectedStyle?.fillColorWord;
|
|
93307
|
+
if (prefigurePattern !== void 0) {
|
|
93308
|
+
attrs.push(`fill-pattern="${escapeXml(prefigurePattern)}"`);
|
|
93309
|
+
if (fill) {
|
|
93310
|
+
attrs.push(`fill="${escapeXml(fill)}"`);
|
|
93311
|
+
}
|
|
93312
|
+
const fillPatternOpacity = formatNumber$1(
|
|
93313
|
+
selectedStyle?.fillPatternOpacity
|
|
93314
|
+
);
|
|
93315
|
+
if (fillPatternOpacity !== null) {
|
|
93316
|
+
attrs.push(`fill-opacity="${escapeXml(fillPatternOpacity)}"`);
|
|
93317
|
+
}
|
|
93318
|
+
} else {
|
|
93319
|
+
if (fill) {
|
|
93320
|
+
attrs.push(`fill="${escapeXml(fill)}"`);
|
|
93321
|
+
}
|
|
93322
|
+
const fillOpacity = formatNumber$1(selectedStyle?.fillOpacity);
|
|
93323
|
+
if (fillOpacity !== null) {
|
|
93324
|
+
attrs.push(`fill-opacity="${escapeXml(fillOpacity)}"`);
|
|
93325
|
+
}
|
|
93326
|
+
if (fillStyle && fillStyle !== "solid") {
|
|
93327
|
+
pushWarning({
|
|
93328
|
+
diagnostics: diagnostics2,
|
|
93329
|
+
code: "doenet-w0091",
|
|
93330
|
+
args: { subject: warningPrefix, fillStyle },
|
|
93331
|
+
position: warningPosition
|
|
93332
|
+
});
|
|
93333
|
+
}
|
|
93334
|
+
}
|
|
93335
|
+
}
|
|
93336
|
+
const lineOpacity = formatNumber$1(selectedStyle?.lineOpacity);
|
|
93337
|
+
if (lineOpacity !== null) {
|
|
93338
|
+
attrs.push(`stroke-opacity="${escapeXml(lineOpacity)}"`);
|
|
93339
|
+
}
|
|
93340
|
+
const lineStyle = selectedStyle?.lineStyle;
|
|
93341
|
+
if (lineStyle) {
|
|
93342
|
+
const dash = prefigureDashByLineStyle[lineStyle];
|
|
93343
|
+
if (dash) {
|
|
93344
|
+
attrs.push(`dash="${escapeXml(dash)}"`);
|
|
93345
|
+
} else if (!(lineStyle in prefigureDashByLineStyle)) {
|
|
93346
|
+
pushWarning({
|
|
93347
|
+
diagnostics: diagnostics2,
|
|
93348
|
+
code: "doenet-w0092",
|
|
93349
|
+
args: { subject: warningPrefix, lineStyle },
|
|
93350
|
+
position: warningPosition
|
|
93351
|
+
});
|
|
93352
|
+
}
|
|
93353
|
+
}
|
|
93354
|
+
return attrs;
|
|
93355
|
+
}
|
|
93356
|
+
function pointStyleAttributes({
|
|
93357
|
+
selectedStyle,
|
|
93358
|
+
diagnostics: diagnostics2,
|
|
93359
|
+
warningPrefix,
|
|
93360
|
+
warningPosition,
|
|
93361
|
+
includeFill = true
|
|
93362
|
+
}) {
|
|
93363
|
+
const attrs = [];
|
|
93364
|
+
const markerStyle = selectedStyle?.markerStyle;
|
|
93365
|
+
if (markerStyle) {
|
|
93366
|
+
const markerStyleString = String(markerStyle);
|
|
93367
|
+
const mappedStyle = prefigurePointStyleByMarkerStyle[markerStyleString];
|
|
93368
|
+
if (mappedStyle) {
|
|
93369
|
+
attrs.push(`style="${escapeXml(mappedStyle)}"`);
|
|
93370
|
+
} else if (markerStyleString.slice(0, 8) === "triangle") {
|
|
93371
|
+
attrs.push('style="diamond"');
|
|
93372
|
+
pushWarning({
|
|
93373
|
+
diagnostics: diagnostics2,
|
|
93374
|
+
code: "doenet-w0093",
|
|
93375
|
+
args: {
|
|
93376
|
+
subject: warningPrefix,
|
|
93377
|
+
markerStyle: markerStyleString
|
|
93378
|
+
},
|
|
93379
|
+
position: warningPosition
|
|
93380
|
+
});
|
|
93381
|
+
} else {
|
|
93382
|
+
pushWarning({
|
|
93383
|
+
diagnostics: diagnostics2,
|
|
93384
|
+
code: "doenet-w0094",
|
|
93385
|
+
args: {
|
|
93386
|
+
subject: warningPrefix,
|
|
93387
|
+
markerStyle: markerStyleString
|
|
93388
|
+
},
|
|
93389
|
+
position: warningPosition
|
|
93390
|
+
});
|
|
93391
|
+
}
|
|
93392
|
+
}
|
|
93393
|
+
const size2 = formatNumber$1(selectedStyle?.markerSize);
|
|
93394
|
+
if (size2 !== null) {
|
|
93395
|
+
attrs.push(`size="${escapeXml(size2)}"`);
|
|
93396
|
+
}
|
|
93397
|
+
const color = selectedStyle?.markerColor ?? selectedStyle?.markerColorWord ?? null;
|
|
93398
|
+
if (color) {
|
|
93399
|
+
if (includeFill) {
|
|
93400
|
+
attrs.push(`fill="${escapeXml(color)}"`);
|
|
93401
|
+
}
|
|
93402
|
+
attrs.push(`stroke="${escapeXml(color)}"`);
|
|
93403
|
+
}
|
|
93404
|
+
const opacity = formatNumber$1(selectedStyle?.markerOpacity);
|
|
93405
|
+
if (opacity !== null) {
|
|
93406
|
+
if (includeFill) {
|
|
93407
|
+
attrs.push(`fill-opacity="${escapeXml(opacity)}"`);
|
|
93408
|
+
}
|
|
93409
|
+
attrs.push(`stroke-opacity="${escapeXml(opacity)}"`);
|
|
93410
|
+
}
|
|
93411
|
+
const thickness = formatNumber$1(selectedStyle?.lineWidth);
|
|
93412
|
+
if (thickness !== null) {
|
|
93413
|
+
attrs.push(`thickness="${escapeXml(thickness)}"`);
|
|
93414
|
+
}
|
|
93415
|
+
return attrs;
|
|
93416
|
+
}
|
|
93417
|
+
const CHART_MARGINS_BOTTOM_RIGHT_TOP = [30, 12, 16];
|
|
93418
|
+
const AXIS_LABEL_MARGIN_BASE = 14;
|
|
93419
|
+
const AXIS_LABEL_MARGIN_PER_CHARACTER = 9;
|
|
93420
|
+
function fitMargins(available, near, far) {
|
|
93421
|
+
const total = near + far;
|
|
93422
|
+
const budget = Math.max(Math.floor(available / 2), 0);
|
|
93423
|
+
if (!Number.isFinite(available) || total <= budget || total <= 0) {
|
|
93424
|
+
return [near, far];
|
|
93425
|
+
}
|
|
93426
|
+
const scale = budget / total;
|
|
93427
|
+
return [Math.floor(near * scale), Math.floor(far * scale)];
|
|
93428
|
+
}
|
|
93429
|
+
const MAX_TICKS_MEASURED = 64;
|
|
93430
|
+
function widestTickLabelLength(firstTick, lastTick, step) {
|
|
93431
|
+
const asDrawn = (value) => Number.isFinite(value) ? snapNumber(value).toLocaleString("en-US", {
|
|
93432
|
+
maximumFractionDigits: 20
|
|
93433
|
+
}).length : 1;
|
|
93434
|
+
let widest = Math.max(asDrawn(firstTick), asDrawn(lastTick), 1);
|
|
93435
|
+
if (Number.isFinite(step) && step > 0) {
|
|
93436
|
+
const numTicks = Math.min(
|
|
93437
|
+
Math.floor((lastTick - firstTick) / step),
|
|
93438
|
+
MAX_TICKS_MEASURED
|
|
93439
|
+
);
|
|
93440
|
+
for (let ind = 1; ind < numTicks; ind++) {
|
|
93441
|
+
widest = Math.max(widest, asDrawn(firstTick + ind * step));
|
|
93442
|
+
}
|
|
93443
|
+
}
|
|
93444
|
+
return widest;
|
|
93445
|
+
}
|
|
93446
|
+
const TARGET_TICK_INTERVALS = 5;
|
|
93447
|
+
function snapNumber(value) {
|
|
93448
|
+
return Number.isFinite(value) ? Number(value.toPrecision(12)) : value;
|
|
93449
|
+
}
|
|
93450
|
+
function niceTickStep(span, minStep) {
|
|
93451
|
+
if (Number.isNaN(span) || span <= 0) {
|
|
93452
|
+
return Math.max(minStep, 1);
|
|
93453
|
+
}
|
|
93454
|
+
if (!Number.isFinite(span)) {
|
|
93455
|
+
return Math.max(
|
|
93456
|
+
minStep,
|
|
93457
|
+
snapNumber(Number.MAX_VALUE / TARGET_TICK_INTERVALS)
|
|
93458
|
+
);
|
|
93459
|
+
}
|
|
93460
|
+
const rough = span / TARGET_TICK_INTERVALS;
|
|
93461
|
+
const magnitude = 10 ** Math.floor(Math.log10(rough));
|
|
93462
|
+
if (!(magnitude > 0)) {
|
|
93463
|
+
return Math.max(minStep, rough) || Number.MIN_VALUE;
|
|
93464
|
+
}
|
|
93465
|
+
const normalized = rough / magnitude;
|
|
93466
|
+
let step;
|
|
93467
|
+
if (normalized <= 1) {
|
|
93468
|
+
step = 1;
|
|
93469
|
+
} else if (normalized <= 2) {
|
|
93470
|
+
step = 2;
|
|
93471
|
+
} else if (normalized <= 5) {
|
|
93472
|
+
step = 5;
|
|
93473
|
+
} else {
|
|
93474
|
+
step = 10;
|
|
93475
|
+
}
|
|
93476
|
+
return Math.max(minStep, snapNumber(step * magnitude));
|
|
93477
|
+
}
|
|
93478
|
+
function tickAtOrBeyond(value, step, direction) {
|
|
93479
|
+
const ratio = snapNumber(value / step);
|
|
93480
|
+
const index2 = direction === 1 ? Math.ceil(ratio) : Math.floor(ratio);
|
|
93481
|
+
return snapNumber(index2 * step);
|
|
93482
|
+
}
|
|
93483
|
+
function nextTickBeyond(value, step, direction) {
|
|
93484
|
+
const rounded = tickAtOrBeyond(value, step, direction);
|
|
93485
|
+
const beyond = rounded === snapNumber(value) ? snapNumber(rounded + direction * step) : rounded;
|
|
93486
|
+
return Number.isFinite(beyond) ? beyond : value;
|
|
93487
|
+
}
|
|
93488
|
+
function computeBarChartGeometry({
|
|
93489
|
+
values: values2,
|
|
93490
|
+
labels,
|
|
93491
|
+
barWidth,
|
|
93492
|
+
yMinAttr,
|
|
93493
|
+
yMaxAttr
|
|
93494
|
+
}) {
|
|
93495
|
+
const drawable = values2.map((value) => Number.isFinite(value));
|
|
93496
|
+
let largest = 0;
|
|
93497
|
+
let smallest = 0;
|
|
93498
|
+
let anyDrawable = false;
|
|
93499
|
+
for (const [ind, value] of values2.entries()) {
|
|
93500
|
+
if (!drawable[ind]) {
|
|
93501
|
+
continue;
|
|
93502
|
+
}
|
|
93503
|
+
if (!anyDrawable) {
|
|
93504
|
+
largest = value;
|
|
93505
|
+
smallest = value;
|
|
93506
|
+
anyDrawable = true;
|
|
93507
|
+
} else {
|
|
93508
|
+
largest = Math.max(largest, value);
|
|
93509
|
+
smallest = Math.min(smallest, value);
|
|
93510
|
+
}
|
|
93511
|
+
}
|
|
93512
|
+
const reachAbove = Math.max(0, largest);
|
|
93513
|
+
const reachBelow = Math.min(0, smallest);
|
|
93514
|
+
const wholeValues = values2.every(
|
|
93515
|
+
(value, ind) => !drawable[ind] || Number.isInteger(value)
|
|
93516
|
+
);
|
|
93517
|
+
const minStep = wholeValues ? 1 : 0;
|
|
93518
|
+
function autoBoundsFor(step) {
|
|
93519
|
+
return [
|
|
93520
|
+
reachBelow >= 0 ? 0 : nextTickBeyond(reachBelow, step, -1),
|
|
93521
|
+
reachAbove <= 0 ? step : nextTickBeyond(reachAbove, step, 1)
|
|
93522
|
+
];
|
|
93523
|
+
}
|
|
93524
|
+
const [firstMin, firstMax] = autoBoundsFor(
|
|
93525
|
+
niceTickStep(reachAbove - reachBelow || 1, minStep)
|
|
93526
|
+
);
|
|
93527
|
+
const [autoYMin, autoYMax] = autoBoundsFor(
|
|
93528
|
+
niceTickStep(firstMax - firstMin, minStep)
|
|
93529
|
+
);
|
|
93530
|
+
let yMin = yMinAttr ?? autoYMin;
|
|
93531
|
+
let yMax = yMaxAttr ?? autoYMax;
|
|
93532
|
+
if (!Number.isFinite(yMin) || !Number.isFinite(yMax) || !(yMin < yMax)) {
|
|
93533
|
+
yMin = autoYMin;
|
|
93534
|
+
yMax = autoYMax;
|
|
93535
|
+
}
|
|
93536
|
+
const tickStep = niceTickStep(
|
|
93537
|
+
yMax - yMin,
|
|
93538
|
+
wholeValues && Number.isInteger(yMin) && Number.isInteger(yMax) ? 1 : 0
|
|
93539
|
+
);
|
|
93540
|
+
const halfWidth = barWidth / 2;
|
|
93541
|
+
const bars = [];
|
|
93542
|
+
const slots = [];
|
|
93543
|
+
values2.forEach((value, ind) => {
|
|
93544
|
+
const center = ind + 1;
|
|
93545
|
+
const label = labels[ind] ?? String(center);
|
|
93546
|
+
slots.push({ center, label });
|
|
93547
|
+
if (drawable[ind]) {
|
|
93548
|
+
bars.push({
|
|
93549
|
+
center,
|
|
93550
|
+
label,
|
|
93551
|
+
value,
|
|
93552
|
+
lowerLeft: [center - halfWidth, Math.min(0, value)],
|
|
93553
|
+
dimensions: [barWidth, Math.abs(value)]
|
|
93554
|
+
});
|
|
93555
|
+
}
|
|
93556
|
+
});
|
|
93557
|
+
return {
|
|
93558
|
+
bars,
|
|
93559
|
+
slots,
|
|
93560
|
+
// Every slot still counts toward the width, drawn or not, so a chart
|
|
93561
|
+
// with a gap in it keeps its remaining bars under their categories.
|
|
93562
|
+
//
|
|
93563
|
+
// The box ends one unit past the last bar's *center*, which is where
|
|
93564
|
+
// the gap beyond the last bar comes out the same size as the gap before
|
|
93565
|
+
// the first one: both are `1 - barWidth/2`. Ending half a unit past the
|
|
93566
|
+
// center instead leaves the last bar six times closer to the frame than
|
|
93567
|
+
// the first at the default width, and flush against it at `barWidth="1"`.
|
|
93568
|
+
bounds: [0, yMin, values2.length + 1, yMax],
|
|
93569
|
+
tickStep,
|
|
93570
|
+
undrawnValues: drawable.filter((canDraw) => !canDraw).length
|
|
93571
|
+
};
|
|
93572
|
+
}
|
|
93573
|
+
function createBarChartPrefigureXML({
|
|
93574
|
+
geometry,
|
|
93575
|
+
widthPx,
|
|
93576
|
+
heightPx,
|
|
93577
|
+
xLabel,
|
|
93578
|
+
xLabelHasLatex,
|
|
93579
|
+
yLabel,
|
|
93580
|
+
yLabelHasLatex,
|
|
93581
|
+
selectedStyle,
|
|
93582
|
+
displayValues,
|
|
93583
|
+
shortDescription,
|
|
93584
|
+
darkMode = false
|
|
93585
|
+
}) {
|
|
93586
|
+
const diagnostics2 = [];
|
|
93587
|
+
const [xMin, yMin, xMax, yMax] = geometry.bounds;
|
|
93588
|
+
const bbox = `(${formatNumber$1(xMin)},${formatNumber$1(yMin)},${formatNumber$1(xMax)},${formatNumber$1(yMax)})`;
|
|
93589
|
+
const step = geometry.tickStep;
|
|
93590
|
+
const firstTick = tickAtOrBeyond(yMin, step, 1);
|
|
93591
|
+
const lastTick = tickAtOrBeyond(yMax, step, -1);
|
|
93592
|
+
const vlabels = `(${formatNumber$1(firstTick)},${formatNumber$1(step)},${formatNumber$1(lastTick)})`;
|
|
93593
|
+
const [wantedBottom, wantedRight, wantedTop] = CHART_MARGINS_BOTTOM_RIGHT_TOP;
|
|
93594
|
+
const wantedLeft = AXIS_LABEL_MARGIN_BASE + AXIS_LABEL_MARGIN_PER_CHARACTER * widestTickLabelLength(firstTick, lastTick, step);
|
|
93595
|
+
const [marginLeft, marginRight] = fitMargins(
|
|
93596
|
+
widthPx,
|
|
93597
|
+
wantedLeft,
|
|
93598
|
+
wantedRight
|
|
93599
|
+
);
|
|
93600
|
+
const [marginBottom, marginTop] = fitMargins(
|
|
93601
|
+
heightPx,
|
|
93602
|
+
wantedBottom,
|
|
93603
|
+
wantedTop
|
|
93604
|
+
);
|
|
93605
|
+
const innerWidth = widthPx - marginLeft - marginRight;
|
|
93606
|
+
const innerHeight = heightPx - marginBottom - marginTop;
|
|
93607
|
+
const dimensions = `(${formatNumber$1(innerWidth)},${formatNumber$1(innerHeight)})`;
|
|
93608
|
+
const margins = `[${marginLeft},${marginBottom},${marginRight},${marginTop}]`;
|
|
93609
|
+
const strokeAttr = darkModeAxisStrokeAttr(darkMode);
|
|
93610
|
+
const axisLabelElements = [];
|
|
93611
|
+
const xLabelText = labelMarkup({
|
|
93612
|
+
label: xLabel,
|
|
93613
|
+
labelHasLatex: xLabelHasLatex
|
|
93614
|
+
});
|
|
93615
|
+
if (xLabelText) {
|
|
93616
|
+
axisLabelElements.push(
|
|
93617
|
+
`<xlabel alignment="nw" ${THEME_AWARE_LABEL_COLOR_ATTR}>${xLabelText}</xlabel>`
|
|
93618
|
+
);
|
|
93619
|
+
}
|
|
93620
|
+
const yLabelText = labelMarkup({
|
|
93621
|
+
label: yLabel,
|
|
93622
|
+
labelHasLatex: yLabelHasLatex
|
|
93623
|
+
});
|
|
93624
|
+
if (yLabelText) {
|
|
93625
|
+
axisLabelElements.push(
|
|
93626
|
+
`<ylabel alignment="se" ${THEME_AWARE_LABEL_COLOR_ATTR}>${yLabelText}</ylabel>`
|
|
93627
|
+
);
|
|
93628
|
+
}
|
|
93629
|
+
const axesInner = axisLabelElements.join("");
|
|
93630
|
+
const axesAttrs = `axes="all" decorations="no" vlabels="${escapeXml(vlabels)}"${strokeAttr}`;
|
|
93631
|
+
const axesElement = axesInner ? `<axes ${axesAttrs}>${axesInner}</axes>` : `<axes ${axesAttrs} />`;
|
|
93632
|
+
const barAttrs = styleAttributes({
|
|
93633
|
+
selectedStyle,
|
|
93634
|
+
diagnostics: diagnostics2,
|
|
93635
|
+
warningPrefix: "<barChart>"
|
|
93636
|
+
}).join(" ");
|
|
93637
|
+
const elements = [];
|
|
93638
|
+
const annotationElements = [];
|
|
93639
|
+
for (const slot of geometry.slots) {
|
|
93640
|
+
elements.push(
|
|
93641
|
+
`<tick-mark axis="horizontal" location="${formatNumber$1(slot.center)}"${strokeAttr} ${THEME_AWARE_LABEL_COLOR_ATTR}>${escapeXml(slot.label)}</tick-mark>`
|
|
93642
|
+
);
|
|
93643
|
+
}
|
|
93644
|
+
for (const bar of geometry.bars) {
|
|
93645
|
+
const handle = `bar-${bar.center}`;
|
|
93646
|
+
const lowerLeft = `(${formatNumber$1(bar.lowerLeft[0])},${formatNumber$1(bar.lowerLeft[1])})`;
|
|
93647
|
+
const barDimensions = `(${formatNumber$1(bar.dimensions[0])},${formatNumber$1(bar.dimensions[1])})`;
|
|
93648
|
+
elements.push(
|
|
93649
|
+
`<rectangle at="${escapeXml(handle)}" lower-left="${escapeXml(lowerLeft)}" dimensions="${escapeXml(barDimensions)}"${barAttrs ? ` ${barAttrs}` : ""} />`
|
|
93650
|
+
);
|
|
93651
|
+
if (displayValues) {
|
|
93652
|
+
const alignment = bar.value < 0 ? "south" : "north";
|
|
93653
|
+
const anchor = `(${formatNumber$1(bar.center)},${formatNumber$1(bar.value)})`;
|
|
93654
|
+
elements.push(
|
|
93655
|
+
`<label anchor="${escapeXml(anchor)}" alignment="${alignment}" ${THEME_AWARE_LABEL_COLOR_ATTR}>${escapeXml(formatNumber$1(bar.value) ?? "")}</label>`
|
|
93656
|
+
);
|
|
93657
|
+
}
|
|
93658
|
+
annotationElements.push(
|
|
93659
|
+
`<annotation ref="${escapeXml(handle)}" text="${escapeXml(`${bar.label}: ${formatNumber$1(bar.value)}`)}" />`
|
|
93660
|
+
);
|
|
93661
|
+
}
|
|
93662
|
+
const figureAnnotationText = shortDescription ? ` text="${escapeXml(shortDescription)}"` : "";
|
|
93663
|
+
const annotationsElement = `<annotations><annotation ref="figure"${figureAnnotationText}>${annotationElements.join("")}</annotation></annotations>`;
|
|
93664
|
+
const xml = `<diagram dimensions="${escapeXml(dimensions)}" margins="${escapeXml(margins)}"><coordinates bbox="${escapeXml(bbox)}">${axesElement}${elements.join("")}</coordinates>${annotationsElement}</diagram>`;
|
|
93665
|
+
return { xml, diagnostics: diagnostics2 };
|
|
93666
|
+
}
|
|
93667
|
+
function returnShortDescriptionStateVariableDefinition({
|
|
93668
|
+
componentType,
|
|
93669
|
+
componentName
|
|
93670
|
+
}) {
|
|
93671
|
+
return {
|
|
93672
|
+
shortDescription: {
|
|
93673
|
+
description: `A short accessibility description of the ${componentName}.`,
|
|
93674
|
+
forRenderer: true,
|
|
93675
|
+
public: true,
|
|
93676
|
+
shadowingInstructions: {
|
|
93677
|
+
createComponentOfType: "text"
|
|
93678
|
+
},
|
|
93679
|
+
returnDependencies: () => ({
|
|
93680
|
+
shortDescriptionChild: {
|
|
93681
|
+
dependencyType: "child",
|
|
93682
|
+
childGroups: ["shortDescriptions"],
|
|
93683
|
+
variableNames: ["text"]
|
|
93684
|
+
},
|
|
93685
|
+
decorative: {
|
|
93686
|
+
dependencyType: "stateVariable",
|
|
93687
|
+
variableName: "decorative"
|
|
93688
|
+
}
|
|
93689
|
+
}),
|
|
93690
|
+
definition({ dependencyValues }) {
|
|
93691
|
+
const children = dependencyValues.shortDescriptionChild;
|
|
93692
|
+
const shortDescription = children.length > 0 ? children[children.length - 1].stateValues.text.trim() : "";
|
|
93693
|
+
const diagnostics2 = [];
|
|
93694
|
+
if (shortDescription === "" && !dependencyValues.decorative) {
|
|
93695
|
+
diagnostics2.push(
|
|
93696
|
+
codedDiagnostic({
|
|
93697
|
+
type: "accessibility",
|
|
93698
|
+
level: 1,
|
|
93699
|
+
code: "doenet-a0001",
|
|
93700
|
+
args: { component: componentType }
|
|
93701
|
+
})
|
|
93702
|
+
);
|
|
93703
|
+
}
|
|
93704
|
+
return {
|
|
93705
|
+
setValue: { shortDescription },
|
|
93706
|
+
sendDiagnostics: diagnostics2
|
|
93707
|
+
};
|
|
93708
|
+
}
|
|
93709
|
+
}
|
|
93710
|
+
};
|
|
93711
|
+
}
|
|
93712
|
+
const DEFAULT_ASPECT_RATIO = 1.5;
|
|
93713
|
+
const DEFAULT_BAR_WIDTH = 0.8;
|
|
93714
|
+
class BarChart extends BlockComponent {
|
|
93715
|
+
constructor(args) {
|
|
93716
|
+
super(args);
|
|
93717
|
+
Object.assign(this.actions, {
|
|
93718
|
+
recordVisibilityChange: this.recordVisibilityChange.bind(this)
|
|
93719
|
+
});
|
|
93720
|
+
}
|
|
93721
|
+
static componentType = "barChart";
|
|
93722
|
+
static componentDocs = {
|
|
93723
|
+
summary: "A bar chart of a list of values, one bar per value."
|
|
93724
|
+
};
|
|
93725
|
+
static createAttributesObject() {
|
|
93726
|
+
let attributes = super.createAttributesObject();
|
|
93727
|
+
Object.assign(
|
|
93728
|
+
attributes,
|
|
93729
|
+
returnSizeAttributes({ componentName: "bar chart" })
|
|
93730
|
+
);
|
|
93731
|
+
attributes.aspectRatio = {
|
|
93732
|
+
description: "Aspect ratio (width / height) for the bar chart.",
|
|
93733
|
+
createComponentOfType: "number",
|
|
93734
|
+
createStateVariable: "aspectRatioAttr",
|
|
93735
|
+
defaultValue: DEFAULT_ASPECT_RATIO
|
|
93736
|
+
};
|
|
93737
|
+
attributes.categories = {
|
|
93738
|
+
createComponentOfType: "textList",
|
|
93739
|
+
description: "The label under each bar. Defaults to the bar's position, 1, 2, 3 and so on.",
|
|
93740
|
+
highlighted: true
|
|
93741
|
+
};
|
|
93742
|
+
attributes.barWidth = {
|
|
93743
|
+
description: "How much of each bar's slot the bar fills: greater than 0 and at most 1, so a bar may fill its slot but must have some width. The rest is the gap to the next bar.",
|
|
93744
|
+
createComponentOfType: "number",
|
|
93745
|
+
createStateVariable: "barWidthAttr",
|
|
93746
|
+
defaultValue: DEFAULT_BAR_WIDTH
|
|
93747
|
+
};
|
|
93748
|
+
attributes.yMin = {
|
|
93749
|
+
description: "Lowest value shown on the vertical axis. Defaults to 0, or to the first tick past the smallest value when some are negative, so that bar does not touch the bottom of the frame. Ignored, along with `yMax`, unless it is a finite number below it.",
|
|
93750
|
+
createComponentOfType: "number",
|
|
93751
|
+
createStateVariable: "yMinAttr",
|
|
93752
|
+
defaultValue: null
|
|
93753
|
+
};
|
|
93754
|
+
attributes.yMax = {
|
|
93755
|
+
description: "Highest value shown on the vertical axis. Defaults to the next tick above the tallest bar. Ignored, along with `yMin`, unless it is a finite number above it.",
|
|
93756
|
+
createComponentOfType: "number",
|
|
93757
|
+
createStateVariable: "yMaxAttr",
|
|
93758
|
+
defaultValue: null
|
|
93759
|
+
};
|
|
93760
|
+
attributes.displayValues = {
|
|
93761
|
+
description: "Whether to print each bar's value at its far end — above a bar that rises, below one that falls.",
|
|
93762
|
+
createComponentOfType: "boolean",
|
|
93763
|
+
createStateVariable: "displayValues",
|
|
93764
|
+
defaultValue: false,
|
|
93765
|
+
public: true
|
|
93766
|
+
};
|
|
93767
|
+
attributes.showBorder = {
|
|
93768
|
+
description: "Whether to render a border around the bar chart.",
|
|
93769
|
+
createComponentOfType: "boolean",
|
|
93770
|
+
createStateVariable: "showBorder",
|
|
93771
|
+
defaultValue: true,
|
|
93772
|
+
public: true,
|
|
93773
|
+
forRenderer: true
|
|
93774
|
+
};
|
|
93775
|
+
attributes.displayMode = {
|
|
93776
|
+
description: "How to size the bar chart.",
|
|
93777
|
+
createComponentOfType: "text",
|
|
93778
|
+
createStateVariable: "displayMode",
|
|
93779
|
+
validValues: [
|
|
93780
|
+
{
|
|
93781
|
+
value: "block",
|
|
93782
|
+
description: "Display as a block element on its own line."
|
|
93783
|
+
},
|
|
93784
|
+
{
|
|
93785
|
+
value: "inline",
|
|
93786
|
+
description: "Render inline with surrounding text."
|
|
93787
|
+
}
|
|
93788
|
+
],
|
|
93789
|
+
defaultValue: "block",
|
|
93790
|
+
toLowerCase: true,
|
|
93791
|
+
forRenderer: true,
|
|
93792
|
+
public: true
|
|
93793
|
+
};
|
|
93794
|
+
attributes.horizontalAlign = {
|
|
93795
|
+
description: "Horizontal alignment of the bar chart within its container.",
|
|
93796
|
+
createComponentOfType: "text",
|
|
93797
|
+
createStateVariable: "horizontalAlign",
|
|
93798
|
+
validValues: [
|
|
93799
|
+
{
|
|
93800
|
+
value: "center",
|
|
93801
|
+
description: "Center the chart horizontally."
|
|
93802
|
+
},
|
|
93803
|
+
{
|
|
93804
|
+
value: "left",
|
|
93805
|
+
description: "Align the chart to the left edge."
|
|
93806
|
+
},
|
|
93807
|
+
{
|
|
93808
|
+
value: "right",
|
|
93809
|
+
description: "Align the chart to the right edge."
|
|
93810
|
+
}
|
|
93811
|
+
],
|
|
93812
|
+
defaultValue: "center",
|
|
93813
|
+
toLowerCase: true,
|
|
93814
|
+
forRenderer: true,
|
|
93815
|
+
public: true
|
|
93816
|
+
};
|
|
93817
|
+
attributes.decorative = {
|
|
93818
|
+
description: "Whether the chart is purely decorative (excluded from a11y tree).",
|
|
93819
|
+
createPrimitiveOfType: "boolean",
|
|
93820
|
+
createStateVariable: "decorative",
|
|
93821
|
+
defaultValue: false,
|
|
93822
|
+
public: true,
|
|
93823
|
+
forRenderer: true
|
|
93824
|
+
};
|
|
93825
|
+
return attributes;
|
|
93826
|
+
}
|
|
93827
|
+
/**
|
|
93828
|
+
* No `annotations` group, unlike `<graph>`: a chart writes its own
|
|
93829
|
+
* annotations out of the bars it drew, so an authored `<annotations>` child
|
|
93830
|
+
* would have nothing to describe and would be silently dropped. Better that
|
|
93831
|
+
* it be reported as a child this is not.
|
|
93832
|
+
*/
|
|
93833
|
+
// Include children that can be added by the sugar below.
|
|
93834
|
+
static additionalSchemaChildren = ["string"];
|
|
93835
|
+
/**
|
|
93836
|
+
* Bare numbers are read as bar heights: `<barChart>41 63 18</barChart>`.
|
|
93837
|
+
* Unconditional, with nothing to consult — a bar height is a number
|
|
93838
|
+
* whatever else the chart is doing, and the categories are labels that no
|
|
93839
|
+
* reading of the values touches. Broken into maths rather than numbers, as
|
|
93840
|
+
* `<sum>` and `<mean>` do, so that `1/2` is half rather than `NaN`.
|
|
93841
|
+
*/
|
|
93842
|
+
static returnSugarInstructions() {
|
|
93843
|
+
let sugarInstructions = super.returnSugarInstructions();
|
|
93844
|
+
sugarInstructions.push(
|
|
93845
|
+
returnBreakStringsIntoMathsBySpacesSugarInstruction()
|
|
93846
|
+
);
|
|
93847
|
+
return sugarInstructions;
|
|
93848
|
+
}
|
|
93849
|
+
static returnChildGroups() {
|
|
93850
|
+
return [
|
|
93851
|
+
returnAxisLabelChildGroup({ axis: "x" }),
|
|
93852
|
+
returnAxisLabelChildGroup({ axis: "y" }),
|
|
93853
|
+
{
|
|
93854
|
+
group: "shortDescriptions",
|
|
93855
|
+
componentTypes: ["shortDescription"]
|
|
93856
|
+
},
|
|
93857
|
+
{
|
|
93858
|
+
group: "numbers",
|
|
93859
|
+
componentTypes: ["number"]
|
|
93860
|
+
},
|
|
93861
|
+
{
|
|
93862
|
+
group: "maths",
|
|
93863
|
+
componentTypes: ["math"]
|
|
93864
|
+
}
|
|
93865
|
+
];
|
|
93866
|
+
}
|
|
93867
|
+
static returnStateVariableDefinitions() {
|
|
93868
|
+
let stateVariableDefinitions = super.returnStateVariableDefinitions();
|
|
93869
|
+
Object.assign(
|
|
93870
|
+
stateVariableDefinitions,
|
|
93871
|
+
returnSelectedStyleStateVariableDefinition(),
|
|
93872
|
+
returnSizeStateVariableDefinitions({ componentName: "bar chart" }),
|
|
93873
|
+
returnAxisLabelStateVariableDefinitions({ axis: "x" }),
|
|
93874
|
+
returnAxisLabelStateVariableDefinitions({ axis: "y" })
|
|
93875
|
+
);
|
|
93876
|
+
stateVariableDefinitions.aspectRatio = {
|
|
93877
|
+
description: "The aspect ratio (width / height) of the bar chart.",
|
|
93878
|
+
public: true,
|
|
93879
|
+
forRenderer: true,
|
|
93880
|
+
shadowingInstructions: {
|
|
93881
|
+
createComponentOfType: "number"
|
|
93882
|
+
},
|
|
93883
|
+
returnDependencies: () => ({
|
|
93884
|
+
aspectRatioAttr: {
|
|
93885
|
+
dependencyType: "stateVariable",
|
|
93886
|
+
variableName: "aspectRatioAttr"
|
|
93887
|
+
}
|
|
93888
|
+
}),
|
|
93889
|
+
definition({ dependencyValues }) {
|
|
93890
|
+
const requested = dependencyValues.aspectRatioAttr;
|
|
93891
|
+
const heightAtWidest = widthsBySize.full / requested;
|
|
93892
|
+
const aspectRatio = Number.isFinite(requested) && requested > 0 && Number.isFinite(heightAtWidest) ? requested : DEFAULT_ASPECT_RATIO;
|
|
93893
|
+
return { setValue: { aspectRatio } };
|
|
93894
|
+
}
|
|
93895
|
+
};
|
|
93896
|
+
stateVariableDefinitions.barWidth = {
|
|
93897
|
+
description: "How much of its slot each bar fills: greater than 0 and at most 1.",
|
|
93898
|
+
public: true,
|
|
93899
|
+
shadowingInstructions: {
|
|
93900
|
+
createComponentOfType: "number"
|
|
93901
|
+
},
|
|
93902
|
+
returnDependencies: () => ({
|
|
93903
|
+
barWidthAttr: {
|
|
93904
|
+
dependencyType: "stateVariable",
|
|
93905
|
+
variableName: "barWidthAttr"
|
|
93906
|
+
}
|
|
93907
|
+
}),
|
|
93908
|
+
definition({ dependencyValues }) {
|
|
93909
|
+
const requested = dependencyValues.barWidthAttr;
|
|
93910
|
+
if (requested > 0 && requested <= 1) {
|
|
93911
|
+
return { setValue: { barWidth: requested } };
|
|
93912
|
+
}
|
|
93913
|
+
return {
|
|
93914
|
+
setValue: { barWidth: DEFAULT_BAR_WIDTH },
|
|
93915
|
+
sendDiagnostics: [
|
|
93916
|
+
codedDiagnostic({
|
|
93917
|
+
type: "warning",
|
|
93918
|
+
code: "doenet-w0143",
|
|
93919
|
+
args: { barWidth: String(requested) }
|
|
93920
|
+
})
|
|
93921
|
+
]
|
|
93922
|
+
};
|
|
93923
|
+
}
|
|
93924
|
+
};
|
|
93925
|
+
stateVariableDefinitions.hasAuthorAnnotations = {
|
|
93926
|
+
description: "Whether the bar chart carries annotations to navigate. Always true: they are generated from the bars.",
|
|
93927
|
+
public: true,
|
|
93928
|
+
forRenderer: true,
|
|
93929
|
+
shadowingInstructions: {
|
|
93930
|
+
createComponentOfType: "boolean"
|
|
93931
|
+
},
|
|
93932
|
+
returnDependencies: () => ({}),
|
|
93933
|
+
definition: () => ({ setValue: { hasAuthorAnnotations: true } })
|
|
93934
|
+
};
|
|
93935
|
+
Object.assign(
|
|
93936
|
+
stateVariableDefinitions,
|
|
93937
|
+
returnShortDescriptionStateVariableDefinition({
|
|
93938
|
+
componentType: "barChart",
|
|
93939
|
+
componentName: "bar chart"
|
|
93940
|
+
})
|
|
93941
|
+
);
|
|
93942
|
+
stateVariableDefinitions.barValues = {
|
|
93943
|
+
description: "The value of each bar, in order.",
|
|
93944
|
+
public: true,
|
|
93945
|
+
isArray: true,
|
|
93946
|
+
entryPrefixes: ["barValue"],
|
|
93947
|
+
shadowingInstructions: {
|
|
93948
|
+
createComponentOfType: "number"
|
|
93949
|
+
},
|
|
93950
|
+
returnArraySizeDependencies: () => ({
|
|
93951
|
+
valueChildren: {
|
|
93952
|
+
dependencyType: "child",
|
|
93953
|
+
childGroups: ["numbers", "maths"],
|
|
93954
|
+
variableNames: ["value"]
|
|
93955
|
+
}
|
|
93956
|
+
}),
|
|
93957
|
+
returnArraySize({ dependencyValues }) {
|
|
93958
|
+
return [dependencyValues.valueChildren.length];
|
|
93959
|
+
},
|
|
93960
|
+
returnArrayDependenciesByKey: () => ({
|
|
93961
|
+
globalDependencies: {
|
|
93962
|
+
valueChildren: {
|
|
93963
|
+
dependencyType: "child",
|
|
93964
|
+
childGroups: ["numbers", "maths"],
|
|
93965
|
+
variableNames: ["value"]
|
|
93966
|
+
}
|
|
93967
|
+
}
|
|
93968
|
+
}),
|
|
93969
|
+
arrayDefinitionByKey({ globalDependencyValues, arrayKeys }) {
|
|
93970
|
+
const barValues = {};
|
|
93971
|
+
for (const arrayKey of arrayKeys) {
|
|
93972
|
+
const child = globalDependencyValues.valueChildren[arrayKey];
|
|
93973
|
+
const value = child?.stateValues.value;
|
|
93974
|
+
barValues[arrayKey] = typeof value?.evaluate_to_constant === "function" ? value.evaluate_to_constant() : value;
|
|
93975
|
+
}
|
|
93976
|
+
return { setValue: { barValues } };
|
|
93977
|
+
}
|
|
93978
|
+
};
|
|
93979
|
+
stateVariableDefinitions.categories = {
|
|
93980
|
+
description: "The label under each bar, in order.",
|
|
93981
|
+
public: true,
|
|
93982
|
+
isArray: true,
|
|
93983
|
+
entryPrefixes: ["category"],
|
|
93984
|
+
shadowingInstructions: {
|
|
93985
|
+
createComponentOfType: "text"
|
|
93986
|
+
},
|
|
93987
|
+
returnArraySizeDependencies: () => ({
|
|
93988
|
+
barValues: {
|
|
93989
|
+
dependencyType: "stateVariable",
|
|
93990
|
+
variableName: "barValues"
|
|
93991
|
+
}
|
|
93992
|
+
}),
|
|
93993
|
+
returnArraySize({ dependencyValues }) {
|
|
93994
|
+
return [dependencyValues.barValues.length];
|
|
93995
|
+
},
|
|
93996
|
+
returnArrayDependenciesByKey: () => ({
|
|
93997
|
+
globalDependencies: {
|
|
93998
|
+
categoriesAttr: {
|
|
93999
|
+
dependencyType: "attributeComponent",
|
|
94000
|
+
attributeName: "categories",
|
|
94001
|
+
variableNames: ["texts"]
|
|
94002
|
+
}
|
|
94003
|
+
}
|
|
94004
|
+
}),
|
|
94005
|
+
arrayDefinitionByKey({ globalDependencyValues, arrayKeys }) {
|
|
94006
|
+
const declared = globalDependencyValues.categoriesAttr?.stateValues.texts;
|
|
94007
|
+
const categories = {};
|
|
94008
|
+
for (const arrayKey of arrayKeys) {
|
|
94009
|
+
const ind = Number(arrayKey);
|
|
94010
|
+
const declaredLabel = declared?.[ind];
|
|
94011
|
+
categories[arrayKey] = declaredLabel === void 0 ? String(ind + 1) : declaredLabel;
|
|
94012
|
+
}
|
|
94013
|
+
return { setValue: { categories } };
|
|
94014
|
+
}
|
|
94015
|
+
};
|
|
94016
|
+
stateVariableDefinitions.chartGeometry = {
|
|
94017
|
+
description: "The bars and bounding box of the chart, in data coordinates.",
|
|
94018
|
+
returnDependencies: () => ({
|
|
94019
|
+
barValues: {
|
|
94020
|
+
dependencyType: "stateVariable",
|
|
94021
|
+
variableName: "barValues"
|
|
94022
|
+
},
|
|
94023
|
+
categories: {
|
|
94024
|
+
dependencyType: "stateVariable",
|
|
94025
|
+
variableName: "categories"
|
|
94026
|
+
},
|
|
94027
|
+
barWidth: {
|
|
94028
|
+
dependencyType: "stateVariable",
|
|
94029
|
+
variableName: "barWidth"
|
|
94030
|
+
},
|
|
94031
|
+
yMinAttr: {
|
|
94032
|
+
dependencyType: "stateVariable",
|
|
94033
|
+
variableName: "yMinAttr"
|
|
94034
|
+
},
|
|
94035
|
+
yMaxAttr: {
|
|
94036
|
+
dependencyType: "stateVariable",
|
|
94037
|
+
variableName: "yMaxAttr"
|
|
94038
|
+
}
|
|
94039
|
+
}),
|
|
94040
|
+
definition({ dependencyValues }) {
|
|
94041
|
+
const geometry = computeBarChartGeometry({
|
|
94042
|
+
values: dependencyValues.barValues,
|
|
94043
|
+
labels: dependencyValues.categories,
|
|
94044
|
+
barWidth: dependencyValues.barWidth,
|
|
94045
|
+
yMinAttr: dependencyValues.yMinAttr,
|
|
94046
|
+
yMaxAttr: dependencyValues.yMaxAttr
|
|
94047
|
+
});
|
|
94048
|
+
return {
|
|
94049
|
+
setValue: { chartGeometry: geometry },
|
|
94050
|
+
// A value that is not a finite number gets no bar. Saying
|
|
94051
|
+
// so matters because the alternative reading of a missing
|
|
94052
|
+
// bar is a value of zero, and the author cannot tell the
|
|
94053
|
+
// two apart by looking. The message carries no count, so
|
|
94054
|
+
// the append-only diagnostics queue holds one of it however
|
|
94055
|
+
// often the values change.
|
|
94056
|
+
sendDiagnostics: geometry.undrawnValues > 0 ? [
|
|
94057
|
+
codedDiagnostic({
|
|
94058
|
+
type: "warning",
|
|
94059
|
+
code: "doenet-w0144"
|
|
94060
|
+
})
|
|
94061
|
+
] : []
|
|
94062
|
+
};
|
|
94063
|
+
}
|
|
94064
|
+
};
|
|
94065
|
+
stateVariableDefinitions.yMin = {
|
|
94066
|
+
description: "The lowest value shown on the vertical axis.",
|
|
94067
|
+
public: true,
|
|
94068
|
+
shadowingInstructions: {
|
|
94069
|
+
createComponentOfType: "number"
|
|
94070
|
+
},
|
|
94071
|
+
additionalStateVariablesDefined: [
|
|
94072
|
+
{
|
|
94073
|
+
variableName: "yMax",
|
|
94074
|
+
description: "The highest value shown on the vertical axis.",
|
|
94075
|
+
public: true,
|
|
94076
|
+
shadowingInstructions: {
|
|
94077
|
+
createComponentOfType: "number"
|
|
94078
|
+
}
|
|
94079
|
+
}
|
|
94080
|
+
],
|
|
94081
|
+
returnDependencies: () => ({
|
|
94082
|
+
chartGeometry: {
|
|
94083
|
+
dependencyType: "stateVariable",
|
|
94084
|
+
variableName: "chartGeometry"
|
|
94085
|
+
}
|
|
94086
|
+
}),
|
|
94087
|
+
definition({ dependencyValues }) {
|
|
94088
|
+
const [, yMin, , yMax] = dependencyValues.chartGeometry.bounds;
|
|
94089
|
+
return { setValue: { yMin, yMax } };
|
|
94090
|
+
}
|
|
94091
|
+
};
|
|
94092
|
+
stateVariableDefinitions.prefigureXML = {
|
|
94093
|
+
description: "The PreFigure-formatted XML rendered for this bar chart.",
|
|
94094
|
+
public: true,
|
|
94095
|
+
forRenderer: true,
|
|
94096
|
+
shadowingInstructions: {
|
|
94097
|
+
createComponentOfType: "text"
|
|
94098
|
+
},
|
|
94099
|
+
returnDependencies: () => ({
|
|
94100
|
+
chartGeometry: {
|
|
94101
|
+
dependencyType: "stateVariable",
|
|
94102
|
+
variableName: "chartGeometry"
|
|
94103
|
+
},
|
|
94104
|
+
width: {
|
|
94105
|
+
dependencyType: "stateVariable",
|
|
94106
|
+
variableName: "width"
|
|
94107
|
+
},
|
|
94108
|
+
aspectRatio: {
|
|
94109
|
+
dependencyType: "stateVariable",
|
|
94110
|
+
variableName: "aspectRatio"
|
|
94111
|
+
},
|
|
94112
|
+
xLabel: {
|
|
94113
|
+
dependencyType: "stateVariable",
|
|
94114
|
+
variableName: "xLabel"
|
|
94115
|
+
},
|
|
94116
|
+
xLabelHasLatex: {
|
|
94117
|
+
dependencyType: "stateVariable",
|
|
94118
|
+
variableName: "xLabelHasLatex"
|
|
94119
|
+
},
|
|
94120
|
+
yLabel: {
|
|
94121
|
+
dependencyType: "stateVariable",
|
|
94122
|
+
variableName: "yLabel"
|
|
94123
|
+
},
|
|
94124
|
+
yLabelHasLatex: {
|
|
94125
|
+
dependencyType: "stateVariable",
|
|
94126
|
+
variableName: "yLabelHasLatex"
|
|
94127
|
+
},
|
|
94128
|
+
displayValues: {
|
|
94129
|
+
dependencyType: "stateVariable",
|
|
94130
|
+
variableName: "displayValues"
|
|
94131
|
+
},
|
|
94132
|
+
shortDescription: {
|
|
94133
|
+
dependencyType: "stateVariable",
|
|
94134
|
+
variableName: "shortDescription"
|
|
94135
|
+
},
|
|
94136
|
+
selectedStyle: {
|
|
94137
|
+
dependencyType: "stateVariable",
|
|
94138
|
+
variableName: "selectedStyle"
|
|
94139
|
+
},
|
|
94140
|
+
document: {
|
|
94141
|
+
dependencyType: "ancestor",
|
|
94142
|
+
componentType: "document",
|
|
94143
|
+
variableNames: ["theme"]
|
|
94144
|
+
}
|
|
94145
|
+
}),
|
|
94146
|
+
definition({ dependencyValues }) {
|
|
94147
|
+
const darkMode = dependencyValues.document?.stateValues.theme === "dark";
|
|
94148
|
+
const widthPx = dependencyValues.width?.size ?? 425;
|
|
94149
|
+
const { xml, diagnostics: diagnostics2 } = createBarChartPrefigureXML({
|
|
94150
|
+
geometry: dependencyValues.chartGeometry,
|
|
94151
|
+
widthPx,
|
|
94152
|
+
heightPx: widthPx / dependencyValues.aspectRatio,
|
|
94153
|
+
xLabel: dependencyValues.xLabel,
|
|
94154
|
+
xLabelHasLatex: dependencyValues.xLabelHasLatex,
|
|
94155
|
+
yLabel: dependencyValues.yLabel,
|
|
94156
|
+
yLabelHasLatex: dependencyValues.yLabelHasLatex,
|
|
94157
|
+
selectedStyle: resolveSelectedStyleForTheme(
|
|
94158
|
+
dependencyValues.selectedStyle,
|
|
94159
|
+
darkMode
|
|
94160
|
+
),
|
|
94161
|
+
displayValues: dependencyValues.displayValues,
|
|
94162
|
+
shortDescription: dependencyValues.shortDescription,
|
|
94163
|
+
darkMode
|
|
94164
|
+
});
|
|
94165
|
+
return {
|
|
94166
|
+
setValue: { prefigureXML: xml },
|
|
94167
|
+
sendDiagnostics: diagnostics2
|
|
94168
|
+
};
|
|
94169
|
+
}
|
|
94170
|
+
};
|
|
94171
|
+
return stateVariableDefinitions;
|
|
94172
|
+
}
|
|
94173
|
+
/**
|
|
94174
|
+
* Records the chart scrolling into and out of the viewport, the same event
|
|
94175
|
+
* `<graph>`, `<image>` and the other framed block components record, so a
|
|
94176
|
+
* chart is not a hole in an activity's record of what was looked at.
|
|
94177
|
+
*/
|
|
94178
|
+
recordVisibilityChange({ isVisible }) {
|
|
94179
|
+
this.coreFunctions.requestRecordEvent({
|
|
94180
|
+
verb: "visibilityChanged",
|
|
94181
|
+
object: {
|
|
94182
|
+
componentIdx: this.componentIdx,
|
|
94183
|
+
componentType: this.componentType
|
|
94184
|
+
},
|
|
94185
|
+
result: { isVisible }
|
|
94186
|
+
});
|
|
94187
|
+
}
|
|
94188
|
+
}
|
|
92232
94189
|
function returnLabelAttributes() {
|
|
92233
94190
|
return {
|
|
92234
94191
|
labelIsName: {
|
|
@@ -130483,8 +132440,7 @@ class Collect extends CompositeComponent {
|
|
|
130483
132440
|
nComponents = res.nComponents;
|
|
130484
132441
|
serializedReplacements = postProcessCopy({
|
|
130485
132442
|
serializedComponents: serializedReplacements,
|
|
130486
|
-
componentIdx: component.componentIdx
|
|
130487
|
-
identifierPrefix: collectedNum + "|"
|
|
132443
|
+
componentIdx: component.componentIdx
|
|
130488
132444
|
});
|
|
130489
132445
|
for (let repl of serializedReplacements) {
|
|
130490
132446
|
if (!repl.attributes) {
|
|
@@ -156126,721 +158082,6 @@ const GRAPH_CONTROL_DESCENDANT_CONFIGS = [
|
|
|
156126
158082
|
}
|
|
156127
158083
|
}
|
|
156128
158084
|
];
|
|
156129
|
-
function escapeXml(value) {
|
|
156130
|
-
return String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
156131
|
-
}
|
|
156132
|
-
function asFiniteNumber(value) {
|
|
156133
|
-
return Number.isFinite(value) ? Number(value) : null;
|
|
156134
|
-
}
|
|
156135
|
-
function formatNumber$1(value) {
|
|
156136
|
-
const num = asFiniteNumber(value);
|
|
156137
|
-
return num === null ? null : `${num}`;
|
|
156138
|
-
}
|
|
156139
|
-
function formatPoint(point2) {
|
|
156140
|
-
if (!Array.isArray(point2) || point2.length < 2) {
|
|
156141
|
-
return null;
|
|
156142
|
-
}
|
|
156143
|
-
const x2 = formatNumber$1(point2[0]);
|
|
156144
|
-
const y2 = formatNumber$1(point2[1]);
|
|
156145
|
-
if (x2 === null || y2 === null) {
|
|
156146
|
-
return null;
|
|
156147
|
-
}
|
|
156148
|
-
return `(${x2},${y2})`;
|
|
156149
|
-
}
|
|
156150
|
-
function extractFinitePoint(point2) {
|
|
156151
|
-
if (!Array.isArray(point2) || point2.length < 2) {
|
|
156152
|
-
return null;
|
|
156153
|
-
}
|
|
156154
|
-
const x2 = asFiniteNumber(point2[0]);
|
|
156155
|
-
const y2 = asFiniteNumber(point2[1]);
|
|
156156
|
-
if (x2 === null || y2 === null) {
|
|
156157
|
-
return null;
|
|
156158
|
-
}
|
|
156159
|
-
return [x2, y2];
|
|
156160
|
-
}
|
|
156161
|
-
function extractFinitePointPair(points) {
|
|
156162
|
-
if (!Array.isArray(points) || points.length < 2) {
|
|
156163
|
-
return null;
|
|
156164
|
-
}
|
|
156165
|
-
const point1 = extractFinitePoint(points[0]);
|
|
156166
|
-
const point2 = extractFinitePoint(points[1]);
|
|
156167
|
-
if (point1 === null || point2 === null) {
|
|
156168
|
-
return null;
|
|
156169
|
-
}
|
|
156170
|
-
return [point1, point2];
|
|
156171
|
-
}
|
|
156172
|
-
function sanitizeHandle(value) {
|
|
156173
|
-
return String(value).toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
156174
|
-
}
|
|
156175
|
-
function createStableHandle(descendant, index2, usedHandles) {
|
|
156176
|
-
const stem = sanitizeHandle(`${descendant.componentType}_${index2}`);
|
|
156177
|
-
let handle = stem || `graphical_${index2}`;
|
|
156178
|
-
let suffix = 1;
|
|
156179
|
-
while (usedHandles.has(handle)) {
|
|
156180
|
-
suffix += 1;
|
|
156181
|
-
handle = `${stem}_${suffix}`;
|
|
156182
|
-
}
|
|
156183
|
-
usedHandles.add(handle);
|
|
156184
|
-
return handle;
|
|
156185
|
-
}
|
|
156186
|
-
function warningSubjectForDescendant(descendant) {
|
|
156187
|
-
if (descendant?.componentName) {
|
|
156188
|
-
return `<${descendant.componentType}> (${descendant.componentName})`;
|
|
156189
|
-
}
|
|
156190
|
-
return `<${descendant?.componentType ?? "?"}>`;
|
|
156191
|
-
}
|
|
156192
|
-
function pushWarning({
|
|
156193
|
-
diagnostics: diagnostics2,
|
|
156194
|
-
code,
|
|
156195
|
-
args,
|
|
156196
|
-
position: position2
|
|
156197
|
-
}) {
|
|
156198
|
-
diagnostics2.push(
|
|
156199
|
-
codedDiagnostic({ type: "warning", code, args, position: position2 })
|
|
156200
|
-
);
|
|
156201
|
-
}
|
|
156202
|
-
function sortDescendantsByOrder(a2, b2) {
|
|
156203
|
-
if (Number.isFinite(a2.componentIdx) && Number.isFinite(b2.componentIdx)) {
|
|
156204
|
-
return a2.componentIdx - b2.componentIdx;
|
|
156205
|
-
}
|
|
156206
|
-
return String(a2.componentName ?? "").localeCompare(
|
|
156207
|
-
String(b2.componentName ?? "")
|
|
156208
|
-
);
|
|
156209
|
-
}
|
|
156210
|
-
function normalizeLineClipInputs({
|
|
156211
|
-
point1,
|
|
156212
|
-
point2,
|
|
156213
|
-
bounds
|
|
156214
|
-
}) {
|
|
156215
|
-
if (!Array.isArray(point1) || !Array.isArray(point2) || point1.length < 2 || point2.length < 2 || !Array.isArray(bounds) || bounds.length < 4) {
|
|
156216
|
-
return null;
|
|
156217
|
-
}
|
|
156218
|
-
const x0 = asFiniteNumber(point1[0]);
|
|
156219
|
-
const y0 = asFiniteNumber(point1[1]);
|
|
156220
|
-
const x1 = asFiniteNumber(point2[0]);
|
|
156221
|
-
const y1 = asFiniteNumber(point2[1]);
|
|
156222
|
-
const bxMin = asFiniteNumber(bounds[0]);
|
|
156223
|
-
const byMin = asFiniteNumber(bounds[1]);
|
|
156224
|
-
const bxMax = asFiniteNumber(bounds[2]);
|
|
156225
|
-
const byMax = asFiniteNumber(bounds[3]);
|
|
156226
|
-
if (x0 === null || y0 === null || x1 === null || y1 === null || bxMin === null || byMin === null || bxMax === null || byMax === null) {
|
|
156227
|
-
return null;
|
|
156228
|
-
}
|
|
156229
|
-
const dx = x1 - x0;
|
|
156230
|
-
const dy = y1 - y0;
|
|
156231
|
-
if (dx === 0 && dy === 0) {
|
|
156232
|
-
return null;
|
|
156233
|
-
}
|
|
156234
|
-
return { x0, y0, dx, dy, bxMin, byMin, bxMax, byMax };
|
|
156235
|
-
}
|
|
156236
|
-
function clipLineLikeToBounds({
|
|
156237
|
-
point1,
|
|
156238
|
-
point2,
|
|
156239
|
-
bounds,
|
|
156240
|
-
tMin,
|
|
156241
|
-
tMax
|
|
156242
|
-
}) {
|
|
156243
|
-
const inputs = normalizeLineClipInputs({ point1, point2, bounds });
|
|
156244
|
-
if (!inputs) {
|
|
156245
|
-
return null;
|
|
156246
|
-
}
|
|
156247
|
-
const { x0, y0, dx, dy, bxMin, byMin, bxMax, byMax } = inputs;
|
|
156248
|
-
let clippedTMin = tMin;
|
|
156249
|
-
let clippedTMax = tMax;
|
|
156250
|
-
const updateRange = (p0, delta, minBound, maxBound) => {
|
|
156251
|
-
if (delta !== 0) {
|
|
156252
|
-
let ta2 = (minBound - p0) / delta;
|
|
156253
|
-
let tb = (maxBound - p0) / delta;
|
|
156254
|
-
if (ta2 > tb) {
|
|
156255
|
-
[ta2, tb] = [tb, ta2];
|
|
156256
|
-
}
|
|
156257
|
-
clippedTMin = Math.max(clippedTMin, ta2);
|
|
156258
|
-
clippedTMax = Math.min(clippedTMax, tb);
|
|
156259
|
-
return clippedTMin <= clippedTMax;
|
|
156260
|
-
}
|
|
156261
|
-
return p0 >= minBound && p0 <= maxBound;
|
|
156262
|
-
};
|
|
156263
|
-
if (!updateRange(x0, dx, bxMin, bxMax)) {
|
|
156264
|
-
return null;
|
|
156265
|
-
}
|
|
156266
|
-
if (!updateRange(y0, dy, byMin, byMax)) {
|
|
156267
|
-
return null;
|
|
156268
|
-
}
|
|
156269
|
-
return [
|
|
156270
|
-
[x0 + clippedTMin * dx, y0 + clippedTMin * dy],
|
|
156271
|
-
[x0 + clippedTMax * dx, y0 + clippedTMax * dy]
|
|
156272
|
-
];
|
|
156273
|
-
}
|
|
156274
|
-
const prefigurePointAlignmentByLabelPosition = {
|
|
156275
|
-
upperright: "ne",
|
|
156276
|
-
upperleft: "nw",
|
|
156277
|
-
lowerright: "se",
|
|
156278
|
-
lowerleft: "sw",
|
|
156279
|
-
top: "n",
|
|
156280
|
-
bottom: "s",
|
|
156281
|
-
left: "w",
|
|
156282
|
-
right: "e"
|
|
156283
|
-
};
|
|
156284
|
-
function normalizeKey(value) {
|
|
156285
|
-
return String(value).toLowerCase().replace(/[^a-z0-9]+/g, "");
|
|
156286
|
-
}
|
|
156287
|
-
const THEME_AWARE_LABEL_COLOR_ATTR = 'color="currentColor"';
|
|
156288
|
-
const LABEL_EDGE_PADDING_RATIO = 0.02;
|
|
156289
|
-
const LINE_LABEL_ENDPOINT_INSET_RATIO = 0.05;
|
|
156290
|
-
const LINE_LABEL_ENDPOINT_INSET_PIXELS = 12;
|
|
156291
|
-
const KNOWN_LINE_POSITIONS = /* @__PURE__ */ new Set([
|
|
156292
|
-
"left",
|
|
156293
|
-
"upperleft",
|
|
156294
|
-
"lowerleft",
|
|
156295
|
-
"right",
|
|
156296
|
-
"upperright",
|
|
156297
|
-
"lowerright",
|
|
156298
|
-
"center",
|
|
156299
|
-
"top",
|
|
156300
|
-
"bottom"
|
|
156301
|
-
]);
|
|
156302
|
-
function formatLocation(value) {
|
|
156303
|
-
const rounded = Number(value.toFixed(6));
|
|
156304
|
-
return `${rounded}`;
|
|
156305
|
-
}
|
|
156306
|
-
function clamp01(value) {
|
|
156307
|
-
return Math.min(1, Math.max(0, value));
|
|
156308
|
-
}
|
|
156309
|
-
function getPreferredDirectionForLabelPosition(labelPosition) {
|
|
156310
|
-
switch (normalizeKey(labelPosition ?? "")) {
|
|
156311
|
-
case "right":
|
|
156312
|
-
return [1, 0];
|
|
156313
|
-
case "left":
|
|
156314
|
-
return [-1, 0];
|
|
156315
|
-
case "top":
|
|
156316
|
-
return [0, 1];
|
|
156317
|
-
case "bottom":
|
|
156318
|
-
return [0, -1];
|
|
156319
|
-
case "upperright":
|
|
156320
|
-
return [1 / Math.SQRT2, 1 / Math.SQRT2];
|
|
156321
|
-
case "upperleft":
|
|
156322
|
-
return [-1 / Math.SQRT2, 1 / Math.SQRT2];
|
|
156323
|
-
case "lowerright":
|
|
156324
|
-
return [1 / Math.SQRT2, -1 / Math.SQRT2];
|
|
156325
|
-
case "lowerleft":
|
|
156326
|
-
return [-1 / Math.SQRT2, -1 / Math.SQRT2];
|
|
156327
|
-
default:
|
|
156328
|
-
return null;
|
|
156329
|
-
}
|
|
156330
|
-
}
|
|
156331
|
-
function biasFromPreferredDirection(preferredDirection, ep1, ep2) {
|
|
156332
|
-
const dx = ep2[0] - ep1[0];
|
|
156333
|
-
const dy = ep2[1] - ep1[1];
|
|
156334
|
-
const segmentLength = Math.hypot(dx, dy);
|
|
156335
|
-
if (!(segmentLength > 0)) {
|
|
156336
|
-
return 0;
|
|
156337
|
-
}
|
|
156338
|
-
const tx = dx / segmentLength;
|
|
156339
|
-
const ty = dy / segmentLength;
|
|
156340
|
-
const agreement = tx * preferredDirection[0] + ty * preferredDirection[1];
|
|
156341
|
-
return Math.max(-1, Math.min(1, Math.SQRT2 * agreement));
|
|
156342
|
-
}
|
|
156343
|
-
function chooseEndpointBiasForLabelPosition(labelPosition, ep1, ep2) {
|
|
156344
|
-
const pos = normalizeKey(labelPosition ?? "");
|
|
156345
|
-
if (!KNOWN_LINE_POSITIONS.has(pos) || pos === "center") {
|
|
156346
|
-
return null;
|
|
156347
|
-
}
|
|
156348
|
-
const preferredDirection = getPreferredDirectionForLabelPosition(pos);
|
|
156349
|
-
if (!preferredDirection) {
|
|
156350
|
-
return null;
|
|
156351
|
-
}
|
|
156352
|
-
return biasFromPreferredDirection(preferredDirection, ep1, ep2);
|
|
156353
|
-
}
|
|
156354
|
-
function lineLabelAnchorPoint({
|
|
156355
|
-
ep1,
|
|
156356
|
-
ep2,
|
|
156357
|
-
location
|
|
156358
|
-
}) {
|
|
156359
|
-
return [
|
|
156360
|
-
ep1[0] + (ep2[0] - ep1[0]) * location,
|
|
156361
|
-
ep1[1] + (ep2[1] - ep1[1]) * location
|
|
156362
|
-
];
|
|
156363
|
-
}
|
|
156364
|
-
function getGraphBounds(graphBounds) {
|
|
156365
|
-
const bounds = Array.isArray(graphBounds) ? graphBounds : null;
|
|
156366
|
-
if (!bounds || bounds.length !== 4) {
|
|
156367
|
-
return null;
|
|
156368
|
-
}
|
|
156369
|
-
const [xMin, yMin, xMax, yMax] = bounds;
|
|
156370
|
-
if (!Number.isFinite(xMin) || !Number.isFinite(yMin) || !Number.isFinite(xMax) || !Number.isFinite(yMax) || !(xMax > xMin) || !(yMax > yMin)) {
|
|
156371
|
-
return null;
|
|
156372
|
-
}
|
|
156373
|
-
return { xMin, yMin, xMax, yMax };
|
|
156374
|
-
}
|
|
156375
|
-
function getGraphDimensions(graphDimensions) {
|
|
156376
|
-
const dims = Array.isArray(graphDimensions) ? graphDimensions : null;
|
|
156377
|
-
if (!dims || dims.length !== 2) {
|
|
156378
|
-
return null;
|
|
156379
|
-
}
|
|
156380
|
-
const [width, height] = dims;
|
|
156381
|
-
if (!Number.isFinite(width) || !Number.isFinite(height) || !(width > 0) || !(height > 0)) {
|
|
156382
|
-
return null;
|
|
156383
|
-
}
|
|
156384
|
-
return { width, height };
|
|
156385
|
-
}
|
|
156386
|
-
function getLineTangent(ep1, ep2) {
|
|
156387
|
-
const dx = ep2[0] - ep1[0];
|
|
156388
|
-
const dy = ep2[1] - ep1[1];
|
|
156389
|
-
const length = Math.hypot(dx, dy);
|
|
156390
|
-
if (!(length > 0)) {
|
|
156391
|
-
return null;
|
|
156392
|
-
}
|
|
156393
|
-
return [dx / length, dy / length];
|
|
156394
|
-
}
|
|
156395
|
-
function estimateLabelMetrics(labelText, labelHasLatex) {
|
|
156396
|
-
const raw = typeof labelText === "string" ? labelText.trim() : "";
|
|
156397
|
-
const visibleLength = raw.length;
|
|
156398
|
-
let effectiveLength = visibleLength;
|
|
156399
|
-
if (labelHasLatex) {
|
|
156400
|
-
const latexRuns = (raw.match(/\\\(|\\\)|<m>|<\/m>/g) ?? []).length;
|
|
156401
|
-
effectiveLength += latexRuns * 3;
|
|
156402
|
-
}
|
|
156403
|
-
return {
|
|
156404
|
-
width: Math.min(6, Math.max(0.9, effectiveLength * 0.27)),
|
|
156405
|
-
height: 1
|
|
156406
|
-
};
|
|
156407
|
-
}
|
|
156408
|
-
function getLineAlignmentCandidates(labelPosition, location, preferNorth = true) {
|
|
156409
|
-
const pos = normalizeKey(labelPosition ?? "");
|
|
156410
|
-
if (!pos || !KNOWN_LINE_POSITIONS.has(pos)) {
|
|
156411
|
-
return null;
|
|
156412
|
-
}
|
|
156413
|
-
const h2 = location >= 0.5 ? "w" : "e";
|
|
156414
|
-
const oppositeH = h2 === "w" ? "e" : "w";
|
|
156415
|
-
const primary = preferNorth ? "n" : "s";
|
|
156416
|
-
const secondary = preferNorth ? "s" : "n";
|
|
156417
|
-
if (pos === "center") {
|
|
156418
|
-
return ["n", "s", `n${h2}`, `s${h2}`, `n${oppositeH}`, `s${oppositeH}`];
|
|
156419
|
-
}
|
|
156420
|
-
return [
|
|
156421
|
-
primary,
|
|
156422
|
-
`${primary}${h2}`,
|
|
156423
|
-
secondary,
|
|
156424
|
-
`${secondary}${h2}`,
|
|
156425
|
-
`${primary}${oppositeH}`,
|
|
156426
|
-
`${secondary}${oppositeH}`
|
|
156427
|
-
];
|
|
156428
|
-
}
|
|
156429
|
-
function getAlignmentExtents(tangent, alignment, metrics) {
|
|
156430
|
-
const normal2 = [-tangent[1], tangent[0]];
|
|
156431
|
-
const width = metrics?.width ?? 1.2;
|
|
156432
|
-
const height = metrics?.height ?? 1;
|
|
156433
|
-
let minT = -width / 2;
|
|
156434
|
-
let maxT = width / 2;
|
|
156435
|
-
let minN = -height / 2;
|
|
156436
|
-
let maxN = height / 2;
|
|
156437
|
-
switch (alignment) {
|
|
156438
|
-
case "n":
|
|
156439
|
-
minN = 0;
|
|
156440
|
-
maxN = height;
|
|
156441
|
-
break;
|
|
156442
|
-
case "s":
|
|
156443
|
-
minN = -height;
|
|
156444
|
-
maxN = 0;
|
|
156445
|
-
break;
|
|
156446
|
-
case "e":
|
|
156447
|
-
minT = 0;
|
|
156448
|
-
maxT = width;
|
|
156449
|
-
break;
|
|
156450
|
-
case "w":
|
|
156451
|
-
minT = -width;
|
|
156452
|
-
maxT = 0;
|
|
156453
|
-
break;
|
|
156454
|
-
case "ne":
|
|
156455
|
-
minT = 0;
|
|
156456
|
-
maxT = width;
|
|
156457
|
-
minN = 0;
|
|
156458
|
-
maxN = height;
|
|
156459
|
-
break;
|
|
156460
|
-
case "nw":
|
|
156461
|
-
minT = -width;
|
|
156462
|
-
maxT = 0;
|
|
156463
|
-
minN = 0;
|
|
156464
|
-
maxN = height;
|
|
156465
|
-
break;
|
|
156466
|
-
case "se":
|
|
156467
|
-
minT = 0;
|
|
156468
|
-
maxT = width;
|
|
156469
|
-
minN = -height;
|
|
156470
|
-
maxN = 0;
|
|
156471
|
-
break;
|
|
156472
|
-
case "sw":
|
|
156473
|
-
minT = -width;
|
|
156474
|
-
maxT = 0;
|
|
156475
|
-
minN = -height;
|
|
156476
|
-
maxN = 0;
|
|
156477
|
-
break;
|
|
156478
|
-
}
|
|
156479
|
-
const points = [
|
|
156480
|
-
[
|
|
156481
|
-
tangent[0] * minT + normal2[0] * minN,
|
|
156482
|
-
tangent[1] * minT + normal2[1] * minN
|
|
156483
|
-
],
|
|
156484
|
-
[
|
|
156485
|
-
tangent[0] * minT + normal2[0] * maxN,
|
|
156486
|
-
tangent[1] * minT + normal2[1] * maxN
|
|
156487
|
-
],
|
|
156488
|
-
[
|
|
156489
|
-
tangent[0] * maxT + normal2[0] * minN,
|
|
156490
|
-
tangent[1] * maxT + normal2[1] * minN
|
|
156491
|
-
],
|
|
156492
|
-
[
|
|
156493
|
-
tangent[0] * maxT + normal2[0] * maxN,
|
|
156494
|
-
tangent[1] * maxT + normal2[1] * maxN
|
|
156495
|
-
]
|
|
156496
|
-
];
|
|
156497
|
-
return {
|
|
156498
|
-
minX: Math.min(...points.map((point2) => point2[0])),
|
|
156499
|
-
maxX: Math.max(...points.map((point2) => point2[0])),
|
|
156500
|
-
minY: Math.min(...points.map((point2) => point2[1])),
|
|
156501
|
-
maxY: Math.max(...points.map((point2) => point2[1]))
|
|
156502
|
-
};
|
|
156503
|
-
}
|
|
156504
|
-
function computeAlignmentOverflowAt({
|
|
156505
|
-
anchor,
|
|
156506
|
-
tangent,
|
|
156507
|
-
alignment,
|
|
156508
|
-
graphBounds,
|
|
156509
|
-
labelMetrics
|
|
156510
|
-
}) {
|
|
156511
|
-
const bounds = getGraphBounds(graphBounds);
|
|
156512
|
-
if (!bounds) {
|
|
156513
|
-
return { overflowAmount: 0 };
|
|
156514
|
-
}
|
|
156515
|
-
const { xMin, yMin, xMax, yMax } = bounds;
|
|
156516
|
-
const width = xMax - xMin;
|
|
156517
|
-
const height = yMax - yMin;
|
|
156518
|
-
const edgePaddingX = width * LABEL_EDGE_PADDING_RATIO;
|
|
156519
|
-
const edgePaddingY = height * LABEL_EDGE_PADDING_RATIO;
|
|
156520
|
-
const extents = getAlignmentExtents(tangent, alignment, labelMetrics);
|
|
156521
|
-
const projectedLeft = anchor[0] + extents.minX;
|
|
156522
|
-
const projectedRight = anchor[0] + extents.maxX;
|
|
156523
|
-
const projectedBottom = anchor[1] + extents.minY;
|
|
156524
|
-
const projectedTop = anchor[1] + extents.maxY;
|
|
156525
|
-
const overflowLeft = Math.max(0, xMin + edgePaddingX - projectedLeft);
|
|
156526
|
-
const overflowRight = Math.max(0, projectedRight - (xMax - edgePaddingX));
|
|
156527
|
-
const overflowBottom = Math.max(0, yMin + edgePaddingY - projectedBottom);
|
|
156528
|
-
const overflowTop = Math.max(0, projectedTop - (yMax - edgePaddingY));
|
|
156529
|
-
const overflowAmount = overflowLeft + overflowRight + overflowBottom + overflowTop;
|
|
156530
|
-
return { overflowAmount };
|
|
156531
|
-
}
|
|
156532
|
-
function evaluateLineAlignmentOverflow({
|
|
156533
|
-
alignment,
|
|
156534
|
-
ep1,
|
|
156535
|
-
ep2,
|
|
156536
|
-
location,
|
|
156537
|
-
graphBounds,
|
|
156538
|
-
labelMetrics
|
|
156539
|
-
}) {
|
|
156540
|
-
const tangent = getLineTangent(ep1, ep2);
|
|
156541
|
-
if (!tangent) {
|
|
156542
|
-
return { overflowAmount: 0 };
|
|
156543
|
-
}
|
|
156544
|
-
const anchor = lineLabelAnchorPoint({ ep1, ep2, location });
|
|
156545
|
-
return computeAlignmentOverflowAt({
|
|
156546
|
-
anchor,
|
|
156547
|
-
tangent,
|
|
156548
|
-
alignment,
|
|
156549
|
-
graphBounds,
|
|
156550
|
-
labelMetrics
|
|
156551
|
-
});
|
|
156552
|
-
}
|
|
156553
|
-
function getLineLabelAlignment({
|
|
156554
|
-
labelPosition,
|
|
156555
|
-
location,
|
|
156556
|
-
ep1,
|
|
156557
|
-
ep2,
|
|
156558
|
-
graphBounds,
|
|
156559
|
-
labelText,
|
|
156560
|
-
labelHasLatex
|
|
156561
|
-
}) {
|
|
156562
|
-
const tangent = getLineTangent(ep1, ep2);
|
|
156563
|
-
const preferredDirection = getPreferredDirectionForLabelPosition(labelPosition);
|
|
156564
|
-
const preferNorth = preferredDirection && tangent ? -tangent[1] * preferredDirection[0] + tangent[0] * preferredDirection[1] >= 0 : true;
|
|
156565
|
-
const candidates = getLineAlignmentCandidates(
|
|
156566
|
-
labelPosition,
|
|
156567
|
-
location,
|
|
156568
|
-
preferNorth
|
|
156569
|
-
);
|
|
156570
|
-
if (!candidates?.length) {
|
|
156571
|
-
return null;
|
|
156572
|
-
}
|
|
156573
|
-
const labelMetrics = estimateLabelMetrics(labelText, labelHasLatex);
|
|
156574
|
-
let bestAlignment = candidates[0];
|
|
156575
|
-
let minimumOverflow = Number.POSITIVE_INFINITY;
|
|
156576
|
-
for (const candidate of candidates) {
|
|
156577
|
-
const result2 = evaluateLineAlignmentOverflow({
|
|
156578
|
-
alignment: candidate,
|
|
156579
|
-
ep1,
|
|
156580
|
-
ep2,
|
|
156581
|
-
location,
|
|
156582
|
-
graphBounds,
|
|
156583
|
-
labelMetrics
|
|
156584
|
-
});
|
|
156585
|
-
if (result2.overflowAmount === 0) {
|
|
156586
|
-
return candidate;
|
|
156587
|
-
}
|
|
156588
|
-
if (result2.overflowAmount < minimumOverflow) {
|
|
156589
|
-
bestAlignment = candidate;
|
|
156590
|
-
minimumOverflow = result2.overflowAmount;
|
|
156591
|
-
}
|
|
156592
|
-
}
|
|
156593
|
-
return bestAlignment;
|
|
156594
|
-
}
|
|
156595
|
-
function orientEndpointsForLineLabel(p1Raw, p2Raw) {
|
|
156596
|
-
if (p1Raw[0] > p2Raw[0] || p1Raw[0] === p2Raw[0] && p1Raw[1] > p2Raw[1]) {
|
|
156597
|
-
return [p2Raw, p1Raw];
|
|
156598
|
-
}
|
|
156599
|
-
return [p1Raw, p2Raw];
|
|
156600
|
-
}
|
|
156601
|
-
function labelMarkup({
|
|
156602
|
-
label,
|
|
156603
|
-
labelHasLatex
|
|
156604
|
-
}) {
|
|
156605
|
-
if (typeof label !== "string") {
|
|
156606
|
-
return null;
|
|
156607
|
-
}
|
|
156608
|
-
const text = label.trim();
|
|
156609
|
-
if (!text) {
|
|
156610
|
-
return null;
|
|
156611
|
-
}
|
|
156612
|
-
if (labelHasLatex) {
|
|
156613
|
-
const openDelimiters = (text.match(/\\\(/g) ?? []).length;
|
|
156614
|
-
const closeDelimiters = (text.match(/\\\)/g) ?? []).length;
|
|
156615
|
-
if (openDelimiters > 0 && openDelimiters === closeDelimiters) {
|
|
156616
|
-
return escapeXml(text).replace(/\\\(/g, "<m>").replace(/\\\)/g, "</m>");
|
|
156617
|
-
}
|
|
156618
|
-
return `<m>${escapeXml(text)}</m>`;
|
|
156619
|
-
}
|
|
156620
|
-
return escapeXml(text);
|
|
156621
|
-
}
|
|
156622
|
-
const POINT_ALIGNMENT_CANDIDATES = {
|
|
156623
|
-
n: ["n", "nw", "ne", "w", "e", "sw", "se", "s"],
|
|
156624
|
-
ne: ["ne", "n", "e", "nw", "se", "w", "s", "sw"],
|
|
156625
|
-
e: ["e", "ne", "se", "n", "s", "nw", "sw", "w"],
|
|
156626
|
-
se: ["se", "e", "s", "ne", "sw", "n", "w", "nw"],
|
|
156627
|
-
s: ["s", "se", "sw", "e", "w", "ne", "nw", "n"],
|
|
156628
|
-
sw: ["sw", "s", "w", "se", "nw", "e", "n", "ne"],
|
|
156629
|
-
w: ["w", "nw", "sw", "n", "s", "ne", "se", "e"],
|
|
156630
|
-
nw: ["nw", "n", "w", "ne", "sw", "e", "s", "se"]
|
|
156631
|
-
};
|
|
156632
|
-
function getPointAlignmentCandidates(labelPosition) {
|
|
156633
|
-
const key = normalizeKey(labelPosition ?? "");
|
|
156634
|
-
const primary = prefigurePointAlignmentByLabelPosition[key];
|
|
156635
|
-
if (!primary) return null;
|
|
156636
|
-
return POINT_ALIGNMENT_CANDIDATES[primary] ?? null;
|
|
156637
|
-
}
|
|
156638
|
-
function getPointLabelAlignment({
|
|
156639
|
-
labelPosition,
|
|
156640
|
-
point: point2,
|
|
156641
|
-
graphBounds,
|
|
156642
|
-
labelText,
|
|
156643
|
-
labelHasLatex
|
|
156644
|
-
}) {
|
|
156645
|
-
const candidates = getPointAlignmentCandidates(labelPosition);
|
|
156646
|
-
if (!candidates?.length) return null;
|
|
156647
|
-
const tangent = [1, 0];
|
|
156648
|
-
const labelMetrics = estimateLabelMetrics(labelText, labelHasLatex);
|
|
156649
|
-
let bestAlignment = candidates[0];
|
|
156650
|
-
let minimumOverflow = Number.POSITIVE_INFINITY;
|
|
156651
|
-
for (const candidate of candidates) {
|
|
156652
|
-
const { overflowAmount } = computeAlignmentOverflowAt({
|
|
156653
|
-
anchor: point2,
|
|
156654
|
-
tangent,
|
|
156655
|
-
alignment: candidate,
|
|
156656
|
-
graphBounds,
|
|
156657
|
-
labelMetrics
|
|
156658
|
-
});
|
|
156659
|
-
if (overflowAmount === 0) {
|
|
156660
|
-
return candidate;
|
|
156661
|
-
}
|
|
156662
|
-
if (overflowAmount < minimumOverflow) {
|
|
156663
|
-
bestAlignment = candidate;
|
|
156664
|
-
minimumOverflow = overflowAmount;
|
|
156665
|
-
}
|
|
156666
|
-
}
|
|
156667
|
-
return bestAlignment;
|
|
156668
|
-
}
|
|
156669
|
-
function pointLabelAttributes({
|
|
156670
|
-
stateValues,
|
|
156671
|
-
diagnostics: diagnostics2,
|
|
156672
|
-
warningPrefix,
|
|
156673
|
-
warningPosition
|
|
156674
|
-
}) {
|
|
156675
|
-
const label = labelMarkup({
|
|
156676
|
-
label: stateValues?.label,
|
|
156677
|
-
labelHasLatex: stateValues?.labelHasLatex
|
|
156678
|
-
});
|
|
156679
|
-
if (!label) {
|
|
156680
|
-
return null;
|
|
156681
|
-
}
|
|
156682
|
-
const attrs = [THEME_AWARE_LABEL_COLOR_ATTR];
|
|
156683
|
-
const rawPosition = stateValues?.labelPosition;
|
|
156684
|
-
if (rawPosition) {
|
|
156685
|
-
const rawXs = stateValues?.numericalXs;
|
|
156686
|
-
const pointCoord = Array.isArray(rawXs) && rawXs.length >= 2 && Number.isFinite(rawXs[0]) && Number.isFinite(rawXs[1]) ? [Number(rawXs[0]), Number(rawXs[1])] : null;
|
|
156687
|
-
const directAlignment = prefigurePointAlignmentByLabelPosition[normalizeKey(rawPosition)];
|
|
156688
|
-
if (directAlignment) {
|
|
156689
|
-
const alignment = pointCoord !== null && stateValues?.graphBounds ? getPointLabelAlignment({
|
|
156690
|
-
labelPosition: rawPosition,
|
|
156691
|
-
point: pointCoord,
|
|
156692
|
-
graphBounds: stateValues.graphBounds,
|
|
156693
|
-
labelText: stateValues?.label,
|
|
156694
|
-
labelHasLatex: stateValues?.labelHasLatex
|
|
156695
|
-
}) ?? directAlignment : directAlignment;
|
|
156696
|
-
attrs.push(`alignment="${escapeXml(alignment)}"`);
|
|
156697
|
-
} else {
|
|
156698
|
-
pushWarning({
|
|
156699
|
-
diagnostics: diagnostics2,
|
|
156700
|
-
code: "doenet-w0090",
|
|
156701
|
-
args: {
|
|
156702
|
-
subject: warningPrefix,
|
|
156703
|
-
labelPosition: rawPosition,
|
|
156704
|
-
labelKind: "point"
|
|
156705
|
-
},
|
|
156706
|
-
position: warningPosition
|
|
156707
|
-
});
|
|
156708
|
-
}
|
|
156709
|
-
}
|
|
156710
|
-
return { attrs, label };
|
|
156711
|
-
}
|
|
156712
|
-
function locationFromBiasWithInsetRatio({
|
|
156713
|
-
bias,
|
|
156714
|
-
insetRatio
|
|
156715
|
-
}) {
|
|
156716
|
-
const clampedBias = Math.max(-1, Math.min(1, bias));
|
|
156717
|
-
const clampedInset = clamp01(Math.min(0.5, insetRatio));
|
|
156718
|
-
const span = Math.max(0, 0.5 - clampedInset);
|
|
156719
|
-
return clamp01(0.5 + clampedBias * span);
|
|
156720
|
-
}
|
|
156721
|
-
function locationFromBiasWithAbsoluteEndpointOffset({
|
|
156722
|
-
bias,
|
|
156723
|
-
ep1,
|
|
156724
|
-
ep2,
|
|
156725
|
-
graphBounds,
|
|
156726
|
-
graphDimensions
|
|
156727
|
-
}) {
|
|
156728
|
-
const bounds = getGraphBounds(graphBounds);
|
|
156729
|
-
const dims = getGraphDimensions(graphDimensions);
|
|
156730
|
-
const dx = ep2[0] - ep1[0];
|
|
156731
|
-
const dy = ep2[1] - ep1[1];
|
|
156732
|
-
const segmentLength = Math.hypot(dx, dy);
|
|
156733
|
-
const graphWidth = bounds ? bounds.xMax - bounds.xMin : 0;
|
|
156734
|
-
const graphHeight = bounds ? bounds.yMax - bounds.yMin : 0;
|
|
156735
|
-
const shouldUseRelativeInsetFallback = !bounds || !dims || !(segmentLength > 0) || !(graphWidth > 0) || !(graphHeight > 0);
|
|
156736
|
-
if (shouldUseRelativeInsetFallback) {
|
|
156737
|
-
return locationFromBiasWithInsetRatio({
|
|
156738
|
-
bias,
|
|
156739
|
-
insetRatio: LINE_LABEL_ENDPOINT_INSET_RATIO
|
|
156740
|
-
});
|
|
156741
|
-
}
|
|
156742
|
-
const tx = dx / segmentLength;
|
|
156743
|
-
const ty = dy / segmentLength;
|
|
156744
|
-
const unitsPerPixelAlongLine = Math.hypot(
|
|
156745
|
-
tx * (graphWidth / dims.width),
|
|
156746
|
-
ty * (graphHeight / dims.height)
|
|
156747
|
-
);
|
|
156748
|
-
const absoluteOffset = LINE_LABEL_ENDPOINT_INSET_PIXELS * unitsPerPixelAlongLine;
|
|
156749
|
-
const insetRatio = Math.min(0.45, clamp01(absoluteOffset / segmentLength));
|
|
156750
|
-
const location = locationFromBiasWithInsetRatio({
|
|
156751
|
-
bias,
|
|
156752
|
-
insetRatio
|
|
156753
|
-
});
|
|
156754
|
-
return location;
|
|
156755
|
-
}
|
|
156756
|
-
function lineLabelLocationValue(labelPosition, ep1, ep2, options = {}) {
|
|
156757
|
-
const endpointBias = chooseEndpointBiasForLabelPosition(
|
|
156758
|
-
labelPosition,
|
|
156759
|
-
ep1,
|
|
156760
|
-
ep2
|
|
156761
|
-
);
|
|
156762
|
-
if (endpointBias === null) {
|
|
156763
|
-
return null;
|
|
156764
|
-
}
|
|
156765
|
-
if (options.absoluteEndpointOffset) {
|
|
156766
|
-
return locationFromBiasWithAbsoluteEndpointOffset({
|
|
156767
|
-
bias: endpointBias,
|
|
156768
|
-
ep1,
|
|
156769
|
-
ep2,
|
|
156770
|
-
graphBounds: options.graphBounds,
|
|
156771
|
-
graphDimensions: options.graphDimensions
|
|
156772
|
-
});
|
|
156773
|
-
}
|
|
156774
|
-
return locationFromBiasWithInsetRatio({
|
|
156775
|
-
bias: endpointBias,
|
|
156776
|
-
insetRatio: LINE_LABEL_ENDPOINT_INSET_RATIO
|
|
156777
|
-
});
|
|
156778
|
-
}
|
|
156779
|
-
function getLabelForLine({
|
|
156780
|
-
stateValues,
|
|
156781
|
-
ep1,
|
|
156782
|
-
ep2,
|
|
156783
|
-
diagnostics: diagnostics2,
|
|
156784
|
-
warningPrefix,
|
|
156785
|
-
warningPosition
|
|
156786
|
-
}) {
|
|
156787
|
-
const label = labelMarkup({
|
|
156788
|
-
label: stateValues?.label,
|
|
156789
|
-
labelHasLatex: stateValues?.labelHasLatex
|
|
156790
|
-
});
|
|
156791
|
-
if (!label) {
|
|
156792
|
-
return {
|
|
156793
|
-
labelAttrs: [],
|
|
156794
|
-
label: null
|
|
156795
|
-
};
|
|
156796
|
-
}
|
|
156797
|
-
const labelAttrs = [THEME_AWARE_LABEL_COLOR_ATTR];
|
|
156798
|
-
const rawPosition = stateValues?.labelPosition;
|
|
156799
|
-
const normalizedPosition = normalizeKey(rawPosition ?? "");
|
|
156800
|
-
const overrideLocRaw = stateValues?.lineLabelLocationOverride;
|
|
156801
|
-
const overrideLoc = Number(overrideLocRaw);
|
|
156802
|
-
const hasOverrideLoc = Number.isFinite(overrideLoc);
|
|
156803
|
-
const baseLoc = hasOverrideLoc ? clamp01(overrideLoc) : lineLabelLocationValue(rawPosition, ep1, ep2, {
|
|
156804
|
-
absoluteEndpointOffset: stateValues?.lineLabelAbsoluteEndpointOffset === true,
|
|
156805
|
-
graphBounds: stateValues?.graphBounds,
|
|
156806
|
-
graphDimensions: stateValues?.graphDimensions
|
|
156807
|
-
});
|
|
156808
|
-
let location = 0.5;
|
|
156809
|
-
if (baseLoc !== null && Number.isFinite(baseLoc)) {
|
|
156810
|
-
location = baseLoc;
|
|
156811
|
-
labelAttrs.push(
|
|
156812
|
-
`label-location="${escapeXml(formatLocation(location))}"`
|
|
156813
|
-
);
|
|
156814
|
-
}
|
|
156815
|
-
const alignmentLocationRaw = stateValues?.lineLabelAlignmentLocationOverride;
|
|
156816
|
-
const alignmentLocation = Number.isFinite(Number(alignmentLocationRaw)) ? Number(alignmentLocationRaw) : location;
|
|
156817
|
-
if (rawPosition) {
|
|
156818
|
-
const alignment = getLineLabelAlignment({
|
|
156819
|
-
labelPosition: rawPosition,
|
|
156820
|
-
location: alignmentLocation,
|
|
156821
|
-
ep1,
|
|
156822
|
-
ep2,
|
|
156823
|
-
graphBounds: stateValues?.graphBounds,
|
|
156824
|
-
labelText: stateValues?.label,
|
|
156825
|
-
labelHasLatex: stateValues?.labelHasLatex
|
|
156826
|
-
});
|
|
156827
|
-
if (alignment) {
|
|
156828
|
-
labelAttrs.push(`alignment="${escapeXml(alignment)}"`);
|
|
156829
|
-
} else if (!KNOWN_LINE_POSITIONS.has(normalizedPosition)) {
|
|
156830
|
-
pushWarning({
|
|
156831
|
-
diagnostics: diagnostics2,
|
|
156832
|
-
code: "doenet-w0090",
|
|
156833
|
-
args: {
|
|
156834
|
-
subject: warningPrefix,
|
|
156835
|
-
labelPosition: rawPosition,
|
|
156836
|
-
labelKind: "line-family"
|
|
156837
|
-
},
|
|
156838
|
-
position: warningPosition
|
|
156839
|
-
});
|
|
156840
|
-
}
|
|
156841
|
-
}
|
|
156842
|
-
return { labelAttrs, label };
|
|
156843
|
-
}
|
|
156844
158085
|
const PREFIGURE_DARK_GRID_COLOR = "#666666";
|
|
156845
158086
|
const PREFIGURE_GRID_DELTA = {
|
|
156846
158087
|
2: 0.1,
|
|
@@ -156962,185 +158203,6 @@ function gridElementFromGrid({
|
|
|
156962
158203
|
const spacings = `((${xTriple.join(",")}),(${yTriple.join(",")}))`;
|
|
156963
158204
|
return `<grid spacings="${escapeXml(spacings)}"${strokeAttr} />`;
|
|
156964
158205
|
}
|
|
156965
|
-
const prefigureFillPatternByFillStyle = {
|
|
156966
|
-
horizontal: "horizontal",
|
|
156967
|
-
vertical: "vertical",
|
|
156968
|
-
diagonal: "diagonal",
|
|
156969
|
-
backdiagonal: "backdiagonal",
|
|
156970
|
-
dots: "dot",
|
|
156971
|
-
diamonds: "diamond"
|
|
156972
|
-
};
|
|
156973
|
-
const prefigureDashByLineStyle = {
|
|
156974
|
-
solid: null,
|
|
156975
|
-
dashed: "9 9",
|
|
156976
|
-
dotted: "4 4"
|
|
156977
|
-
};
|
|
156978
|
-
const prefigurePointStyleByMarkerStyle = {
|
|
156979
|
-
circle: "circle",
|
|
156980
|
-
square: "box",
|
|
156981
|
-
box: "box",
|
|
156982
|
-
diamond: "diamond",
|
|
156983
|
-
cross: "cross",
|
|
156984
|
-
plus: "plus",
|
|
156985
|
-
"double-circle": "double-circle"
|
|
156986
|
-
};
|
|
156987
|
-
function resolveSelectedStyleForTheme(selectedStyle, darkMode) {
|
|
156988
|
-
if (!selectedStyle || !darkMode) {
|
|
156989
|
-
return selectedStyle;
|
|
156990
|
-
}
|
|
156991
|
-
const pickDark = (darkKey, lightValue) => {
|
|
156992
|
-
const darkValue = selectedStyle[darkKey];
|
|
156993
|
-
return typeof darkValue === "string" ? darkValue : lightValue;
|
|
156994
|
-
};
|
|
156995
|
-
return {
|
|
156996
|
-
...selectedStyle,
|
|
156997
|
-
lineColor: pickDark("lineColorDarkMode", selectedStyle.lineColor),
|
|
156998
|
-
lineColorWord: pickDark(
|
|
156999
|
-
"lineColorWordDarkMode",
|
|
157000
|
-
selectedStyle.lineColorWord
|
|
157001
|
-
),
|
|
157002
|
-
fillColor: pickDark("fillColorDarkMode", selectedStyle.fillColor),
|
|
157003
|
-
fillColorWord: pickDark(
|
|
157004
|
-
"fillColorWordDarkMode",
|
|
157005
|
-
selectedStyle.fillColorWord
|
|
157006
|
-
),
|
|
157007
|
-
markerColor: pickDark("markerColorDarkMode", selectedStyle.markerColor),
|
|
157008
|
-
markerColorWord: pickDark(
|
|
157009
|
-
"markerColorWordDarkMode",
|
|
157010
|
-
selectedStyle.markerColorWord
|
|
157011
|
-
)
|
|
157012
|
-
};
|
|
157013
|
-
}
|
|
157014
|
-
function styleAttributes({
|
|
157015
|
-
selectedStyle,
|
|
157016
|
-
diagnostics: diagnostics2,
|
|
157017
|
-
warningPrefix,
|
|
157018
|
-
warningPosition,
|
|
157019
|
-
includeFill = true
|
|
157020
|
-
}) {
|
|
157021
|
-
const attrs = [];
|
|
157022
|
-
const stroke = selectedStyle?.lineColor ?? selectedStyle?.lineColorWord;
|
|
157023
|
-
if (stroke) {
|
|
157024
|
-
attrs.push(`stroke="${escapeXml(stroke)}"`);
|
|
157025
|
-
}
|
|
157026
|
-
const thickness = formatNumber$1(selectedStyle?.lineWidth);
|
|
157027
|
-
if (thickness !== null) {
|
|
157028
|
-
attrs.push(`thickness="${escapeXml(thickness)}"`);
|
|
157029
|
-
}
|
|
157030
|
-
if (includeFill) {
|
|
157031
|
-
const fillStyle = selectedStyle?.fillStyle;
|
|
157032
|
-
const prefigurePattern = fillStyle && fillStyle !== "solid" ? prefigureFillPatternByFillStyle[fillStyle] : void 0;
|
|
157033
|
-
const fill = selectedStyle?.fillColor ?? selectedStyle?.fillColorWord;
|
|
157034
|
-
if (prefigurePattern !== void 0) {
|
|
157035
|
-
attrs.push(`fill-pattern="${escapeXml(prefigurePattern)}"`);
|
|
157036
|
-
if (fill) {
|
|
157037
|
-
attrs.push(`fill="${escapeXml(fill)}"`);
|
|
157038
|
-
}
|
|
157039
|
-
const fillPatternOpacity = formatNumber$1(
|
|
157040
|
-
selectedStyle?.fillPatternOpacity
|
|
157041
|
-
);
|
|
157042
|
-
if (fillPatternOpacity !== null) {
|
|
157043
|
-
attrs.push(`fill-opacity="${escapeXml(fillPatternOpacity)}"`);
|
|
157044
|
-
}
|
|
157045
|
-
} else {
|
|
157046
|
-
if (fill) {
|
|
157047
|
-
attrs.push(`fill="${escapeXml(fill)}"`);
|
|
157048
|
-
}
|
|
157049
|
-
const fillOpacity = formatNumber$1(selectedStyle?.fillOpacity);
|
|
157050
|
-
if (fillOpacity !== null) {
|
|
157051
|
-
attrs.push(`fill-opacity="${escapeXml(fillOpacity)}"`);
|
|
157052
|
-
}
|
|
157053
|
-
if (fillStyle && fillStyle !== "solid") {
|
|
157054
|
-
pushWarning({
|
|
157055
|
-
diagnostics: diagnostics2,
|
|
157056
|
-
code: "doenet-w0091",
|
|
157057
|
-
args: { subject: warningPrefix, fillStyle },
|
|
157058
|
-
position: warningPosition
|
|
157059
|
-
});
|
|
157060
|
-
}
|
|
157061
|
-
}
|
|
157062
|
-
}
|
|
157063
|
-
const lineOpacity = formatNumber$1(selectedStyle?.lineOpacity);
|
|
157064
|
-
if (lineOpacity !== null) {
|
|
157065
|
-
attrs.push(`stroke-opacity="${escapeXml(lineOpacity)}"`);
|
|
157066
|
-
}
|
|
157067
|
-
const lineStyle = selectedStyle?.lineStyle;
|
|
157068
|
-
if (lineStyle) {
|
|
157069
|
-
const dash = prefigureDashByLineStyle[lineStyle];
|
|
157070
|
-
if (dash) {
|
|
157071
|
-
attrs.push(`dash="${escapeXml(dash)}"`);
|
|
157072
|
-
} else if (!(lineStyle in prefigureDashByLineStyle)) {
|
|
157073
|
-
pushWarning({
|
|
157074
|
-
diagnostics: diagnostics2,
|
|
157075
|
-
code: "doenet-w0092",
|
|
157076
|
-
args: { subject: warningPrefix, lineStyle },
|
|
157077
|
-
position: warningPosition
|
|
157078
|
-
});
|
|
157079
|
-
}
|
|
157080
|
-
}
|
|
157081
|
-
return attrs;
|
|
157082
|
-
}
|
|
157083
|
-
function pointStyleAttributes({
|
|
157084
|
-
selectedStyle,
|
|
157085
|
-
diagnostics: diagnostics2,
|
|
157086
|
-
warningPrefix,
|
|
157087
|
-
warningPosition,
|
|
157088
|
-
includeFill = true
|
|
157089
|
-
}) {
|
|
157090
|
-
const attrs = [];
|
|
157091
|
-
const markerStyle = selectedStyle?.markerStyle;
|
|
157092
|
-
if (markerStyle) {
|
|
157093
|
-
const markerStyleString = String(markerStyle);
|
|
157094
|
-
const mappedStyle = prefigurePointStyleByMarkerStyle[markerStyleString];
|
|
157095
|
-
if (mappedStyle) {
|
|
157096
|
-
attrs.push(`style="${escapeXml(mappedStyle)}"`);
|
|
157097
|
-
} else if (markerStyleString.slice(0, 8) === "triangle") {
|
|
157098
|
-
attrs.push('style="diamond"');
|
|
157099
|
-
pushWarning({
|
|
157100
|
-
diagnostics: diagnostics2,
|
|
157101
|
-
code: "doenet-w0093",
|
|
157102
|
-
args: {
|
|
157103
|
-
subject: warningPrefix,
|
|
157104
|
-
markerStyle: markerStyleString
|
|
157105
|
-
},
|
|
157106
|
-
position: warningPosition
|
|
157107
|
-
});
|
|
157108
|
-
} else {
|
|
157109
|
-
pushWarning({
|
|
157110
|
-
diagnostics: diagnostics2,
|
|
157111
|
-
code: "doenet-w0094",
|
|
157112
|
-
args: {
|
|
157113
|
-
subject: warningPrefix,
|
|
157114
|
-
markerStyle: markerStyleString
|
|
157115
|
-
},
|
|
157116
|
-
position: warningPosition
|
|
157117
|
-
});
|
|
157118
|
-
}
|
|
157119
|
-
}
|
|
157120
|
-
const size2 = formatNumber$1(selectedStyle?.markerSize);
|
|
157121
|
-
if (size2 !== null) {
|
|
157122
|
-
attrs.push(`size="${escapeXml(size2)}"`);
|
|
157123
|
-
}
|
|
157124
|
-
const color = selectedStyle?.markerColor ?? selectedStyle?.markerColorWord ?? null;
|
|
157125
|
-
if (color) {
|
|
157126
|
-
if (includeFill) {
|
|
157127
|
-
attrs.push(`fill="${escapeXml(color)}"`);
|
|
157128
|
-
}
|
|
157129
|
-
attrs.push(`stroke="${escapeXml(color)}"`);
|
|
157130
|
-
}
|
|
157131
|
-
const opacity = formatNumber$1(selectedStyle?.markerOpacity);
|
|
157132
|
-
if (opacity !== null) {
|
|
157133
|
-
if (includeFill) {
|
|
157134
|
-
attrs.push(`fill-opacity="${escapeXml(opacity)}"`);
|
|
157135
|
-
}
|
|
157136
|
-
attrs.push(`stroke-opacity="${escapeXml(opacity)}"`);
|
|
157137
|
-
}
|
|
157138
|
-
const thickness = formatNumber$1(selectedStyle?.lineWidth);
|
|
157139
|
-
if (thickness !== null) {
|
|
157140
|
-
attrs.push(`thickness="${escapeXml(thickness)}"`);
|
|
157141
|
-
}
|
|
157142
|
-
return attrs;
|
|
157143
|
-
}
|
|
157144
158206
|
function convertPointToPrefigure({
|
|
157145
158207
|
sv,
|
|
157146
158208
|
handle,
|
|
@@ -158855,7 +159917,6 @@ function pushUnsupportedAxisPositionWarnings({
|
|
|
158855
159917
|
);
|
|
158856
159918
|
}
|
|
158857
159919
|
}
|
|
158858
|
-
const PREFIGURE_DARK_AXIS_COLOR = "#ffffff";
|
|
158859
159920
|
function axesElementFromLabels({
|
|
158860
159921
|
dependencyValues,
|
|
158861
159922
|
axesMode,
|
|
@@ -158880,7 +159941,7 @@ function axesElementFromLabels({
|
|
|
158880
159941
|
`<ylabel alignment="se" ${THEME_AWARE_LABEL_COLOR_ATTR}>${yLabel}</ylabel>`
|
|
158881
159942
|
);
|
|
158882
159943
|
}
|
|
158883
|
-
const strokeAttr = darkMode
|
|
159944
|
+
const strokeAttr = darkModeAxisStrokeAttr(darkMode);
|
|
158884
159945
|
if (axisLabelElements.length > 0) {
|
|
158885
159946
|
return `<axes axes="${axesMode}"${strokeAttr}>${axisLabelElements.join("")}</axes>`;
|
|
158886
159947
|
}
|
|
@@ -159564,24 +160625,10 @@ let Graph$1 = class Graph extends BlockComponent {
|
|
|
159564
160625
|
defaultValue: 10,
|
|
159565
160626
|
description: "Maximum value displayed on the y axis."
|
|
159566
160627
|
};
|
|
159567
|
-
|
|
159568
|
-
|
|
159569
|
-
|
|
159570
|
-
|
|
159571
|
-
attributes.size = {
|
|
159572
|
-
createComponentOfType: "text",
|
|
159573
|
-
createStateVariable: "specifiedSize",
|
|
159574
|
-
defaultValue: "medium",
|
|
159575
|
-
toLowerCase: true,
|
|
159576
|
-
validValues: [
|
|
159577
|
-
{ value: "tiny", description: "About 1/12 the full width." },
|
|
159578
|
-
{ value: "small", description: "About 30% of the full width." },
|
|
159579
|
-
{ value: "medium", description: "About half the full width." },
|
|
159580
|
-
{ value: "large", description: "About 70% of the full width." },
|
|
159581
|
-
{ value: "full", description: "The full available width." }
|
|
159582
|
-
],
|
|
159583
|
-
description: "Named size preset for the graph."
|
|
159584
|
-
};
|
|
160628
|
+
Object.assign(
|
|
160629
|
+
attributes,
|
|
160630
|
+
returnSizeAttributes({ componentName: "graph" })
|
|
160631
|
+
);
|
|
159585
160632
|
attributes.aspectRatio = {
|
|
159586
160633
|
createComponentOfType: "number",
|
|
159587
160634
|
description: "Aspect ratio (width / height) for the graph."
|
|
@@ -159897,14 +160944,8 @@ let Graph$1 = class Graph extends BlockComponent {
|
|
|
159897
160944
|
}
|
|
159898
160945
|
static returnChildGroups() {
|
|
159899
160946
|
return [
|
|
159900
|
-
{
|
|
159901
|
-
|
|
159902
|
-
componentTypes: ["xLabel"]
|
|
159903
|
-
},
|
|
159904
|
-
{
|
|
159905
|
-
group: "yLabels",
|
|
159906
|
-
componentTypes: ["yLabel"]
|
|
159907
|
-
},
|
|
160947
|
+
returnAxisLabelChildGroup({ axis: "x" }),
|
|
160948
|
+
returnAxisLabelChildGroup({ axis: "y" }),
|
|
159908
160949
|
{
|
|
159909
160950
|
group: "shortDescriptions",
|
|
159910
160951
|
componentTypes: ["shortDescription"]
|
|
@@ -159954,47 +160995,13 @@ let Graph$1 = class Graph extends BlockComponent {
|
|
|
159954
160995
|
stateVariableDefinitions,
|
|
159955
160996
|
returnNumberDisplayStateVariableDefinitions()
|
|
159956
160997
|
);
|
|
159957
|
-
|
|
159958
|
-
|
|
159959
|
-
|
|
159960
|
-
|
|
159961
|
-
|
|
159962
|
-
|
|
159963
|
-
|
|
159964
|
-
returnDependencies: () => ({
|
|
159965
|
-
shortDescriptionChild: {
|
|
159966
|
-
dependencyType: "child",
|
|
159967
|
-
childGroups: ["shortDescriptions"],
|
|
159968
|
-
variableNames: ["text"]
|
|
159969
|
-
},
|
|
159970
|
-
decorative: {
|
|
159971
|
-
dependencyType: "stateVariable",
|
|
159972
|
-
variableName: "decorative"
|
|
159973
|
-
}
|
|
159974
|
-
}),
|
|
159975
|
-
definition({ dependencyValues }) {
|
|
159976
|
-
let shortDescription = "";
|
|
159977
|
-
const diagnostics2 = [];
|
|
159978
|
-
if (dependencyValues.shortDescriptionChild.length > 0) {
|
|
159979
|
-
const shortDescriptionChild = dependencyValues.shortDescriptionChild[dependencyValues.shortDescriptionChild.length - 1];
|
|
159980
|
-
shortDescription = shortDescriptionChild.stateValues.text.trim();
|
|
159981
|
-
}
|
|
159982
|
-
if (shortDescription === "" && !dependencyValues.decorative) {
|
|
159983
|
-
diagnostics2.push(
|
|
159984
|
-
codedDiagnostic({
|
|
159985
|
-
type: "accessibility",
|
|
159986
|
-
level: 1,
|
|
159987
|
-
code: "doenet-a0001",
|
|
159988
|
-
args: { component: "graph" }
|
|
159989
|
-
})
|
|
159990
|
-
);
|
|
159991
|
-
}
|
|
159992
|
-
return {
|
|
159993
|
-
setValue: { shortDescription },
|
|
159994
|
-
sendDiagnostics: diagnostics2
|
|
159995
|
-
};
|
|
159996
|
-
}
|
|
159997
|
-
};
|
|
160998
|
+
Object.assign(
|
|
160999
|
+
stateVariableDefinitions,
|
|
161000
|
+
returnShortDescriptionStateVariableDefinition({
|
|
161001
|
+
componentType: "graph",
|
|
161002
|
+
componentName: "graph"
|
|
161003
|
+
})
|
|
161004
|
+
);
|
|
159998
161005
|
stateVariableDefinitions.descriptionChildInd = {
|
|
159999
161006
|
forRenderer: true,
|
|
160000
161007
|
returnDependencies: () => ({
|
|
@@ -160038,158 +161045,11 @@ let Graph$1 = class Graph extends BlockComponent {
|
|
|
160038
161045
|
};
|
|
160039
161046
|
}
|
|
160040
161047
|
};
|
|
160041
|
-
|
|
160042
|
-
|
|
160043
|
-
|
|
160044
|
-
|
|
160045
|
-
|
|
160046
|
-
createComponentOfType: "label",
|
|
160047
|
-
addStateVariablesShadowingStateVariables: {
|
|
160048
|
-
hasLatex: {
|
|
160049
|
-
stateVariableToShadow: "xLabelHasLatex"
|
|
160050
|
-
}
|
|
160051
|
-
}
|
|
160052
|
-
},
|
|
160053
|
-
hasEssential: true,
|
|
160054
|
-
defaultValue: "",
|
|
160055
|
-
additionalStateVariablesDefined: [
|
|
160056
|
-
{
|
|
160057
|
-
variableName: "xLabelHasLatex",
|
|
160058
|
-
forRenderer: true
|
|
160059
|
-
}
|
|
160060
|
-
],
|
|
160061
|
-
returnDependencies: () => ({
|
|
160062
|
-
xLabelChild: {
|
|
160063
|
-
dependencyType: "child",
|
|
160064
|
-
childGroups: ["xLabels"],
|
|
160065
|
-
variableNames: ["value", "hasLatex"]
|
|
160066
|
-
}
|
|
160067
|
-
}),
|
|
160068
|
-
definition({ dependencyValues }) {
|
|
160069
|
-
if (dependencyValues.xLabelChild.length > 0) {
|
|
160070
|
-
let xLabelChild = dependencyValues.xLabelChild[dependencyValues.xLabelChild.length - 1];
|
|
160071
|
-
return {
|
|
160072
|
-
setValue: {
|
|
160073
|
-
xLabel: xLabelChild.stateValues.value,
|
|
160074
|
-
xLabelHasLatex: xLabelChild.stateValues.hasLatex
|
|
160075
|
-
}
|
|
160076
|
-
};
|
|
160077
|
-
} else {
|
|
160078
|
-
return {
|
|
160079
|
-
useEssentialOrDefaultValue: { xLabel: true },
|
|
160080
|
-
setValue: { xLabelHasLatex: false }
|
|
160081
|
-
};
|
|
160082
|
-
}
|
|
160083
|
-
},
|
|
160084
|
-
inverseDefinition({
|
|
160085
|
-
desiredStateVariableValues,
|
|
160086
|
-
dependencyValues
|
|
160087
|
-
}) {
|
|
160088
|
-
if (typeof desiredStateVariableValues.xLabel !== "string") {
|
|
160089
|
-
return { success: false };
|
|
160090
|
-
}
|
|
160091
|
-
if (dependencyValues.xLabelChild.length > 0) {
|
|
160092
|
-
let lastLabelInd = dependencyValues.xLabelChild.length - 1;
|
|
160093
|
-
return {
|
|
160094
|
-
success: true,
|
|
160095
|
-
instructions: [
|
|
160096
|
-
{
|
|
160097
|
-
setDependency: "xLabelChild",
|
|
160098
|
-
desiredValue: desiredStateVariableValues.xLabel,
|
|
160099
|
-
childIndex: lastLabelInd,
|
|
160100
|
-
variableIndex: 0
|
|
160101
|
-
}
|
|
160102
|
-
]
|
|
160103
|
-
};
|
|
160104
|
-
} else {
|
|
160105
|
-
return {
|
|
160106
|
-
success: true,
|
|
160107
|
-
instructions: [
|
|
160108
|
-
{
|
|
160109
|
-
setEssentialValue: "xLabel",
|
|
160110
|
-
value: desiredStateVariableValues.xLabel
|
|
160111
|
-
}
|
|
160112
|
-
]
|
|
160113
|
-
};
|
|
160114
|
-
}
|
|
160115
|
-
}
|
|
160116
|
-
};
|
|
160117
|
-
stateVariableDefinitions.yLabel = {
|
|
160118
|
-
description: "The y-axis label text.",
|
|
160119
|
-
forRenderer: true,
|
|
160120
|
-
public: true,
|
|
160121
|
-
shadowingInstructions: {
|
|
160122
|
-
createComponentOfType: "label",
|
|
160123
|
-
addStateVariablesShadowingStateVariables: {
|
|
160124
|
-
hasLatex: {
|
|
160125
|
-
stateVariableToShadow: "yLabelHasLatex"
|
|
160126
|
-
}
|
|
160127
|
-
}
|
|
160128
|
-
},
|
|
160129
|
-
hasEssential: true,
|
|
160130
|
-
defaultValue: "",
|
|
160131
|
-
additionalStateVariablesDefined: [
|
|
160132
|
-
{
|
|
160133
|
-
variableName: "yLabelHasLatex",
|
|
160134
|
-
forRenderer: true
|
|
160135
|
-
}
|
|
160136
|
-
],
|
|
160137
|
-
returnDependencies: () => ({
|
|
160138
|
-
yLabelChild: {
|
|
160139
|
-
dependencyType: "child",
|
|
160140
|
-
childGroups: ["yLabels"],
|
|
160141
|
-
variableNames: ["value", "hasLatex"]
|
|
160142
|
-
}
|
|
160143
|
-
}),
|
|
160144
|
-
definition({ dependencyValues }) {
|
|
160145
|
-
if (dependencyValues.yLabelChild.length > 0) {
|
|
160146
|
-
let yLabelChild = dependencyValues.yLabelChild[dependencyValues.yLabelChild.length - 1];
|
|
160147
|
-
return {
|
|
160148
|
-
setValue: {
|
|
160149
|
-
yLabel: yLabelChild.stateValues.value,
|
|
160150
|
-
yLabelHasLatex: yLabelChild.stateValues.hasLatex
|
|
160151
|
-
}
|
|
160152
|
-
};
|
|
160153
|
-
} else {
|
|
160154
|
-
return {
|
|
160155
|
-
useEssentialOrDefaultValue: { yLabel: true },
|
|
160156
|
-
setValue: { yLabelHasLatex: false }
|
|
160157
|
-
};
|
|
160158
|
-
}
|
|
160159
|
-
},
|
|
160160
|
-
inverseDefinition({
|
|
160161
|
-
desiredStateVariableValues,
|
|
160162
|
-
dependencyValues
|
|
160163
|
-
}) {
|
|
160164
|
-
if (typeof desiredStateVariableValues.yLabel !== "string") {
|
|
160165
|
-
return { success: false };
|
|
160166
|
-
}
|
|
160167
|
-
if (dependencyValues.yLabelChild.length > 0) {
|
|
160168
|
-
let lastLabelInd = dependencyValues.yLabelChild.length - 1;
|
|
160169
|
-
return {
|
|
160170
|
-
success: true,
|
|
160171
|
-
instructions: [
|
|
160172
|
-
{
|
|
160173
|
-
setDependency: "yLabelChild",
|
|
160174
|
-
desiredValue: desiredStateVariableValues.yLabel,
|
|
160175
|
-
childIndex: lastLabelInd,
|
|
160176
|
-
variableIndex: 0
|
|
160177
|
-
}
|
|
160178
|
-
]
|
|
160179
|
-
};
|
|
160180
|
-
} else {
|
|
160181
|
-
return {
|
|
160182
|
-
success: true,
|
|
160183
|
-
instructions: [
|
|
160184
|
-
{
|
|
160185
|
-
setEssentialValue: "yLabel",
|
|
160186
|
-
value: desiredStateVariableValues.yLabel
|
|
160187
|
-
}
|
|
160188
|
-
]
|
|
160189
|
-
};
|
|
160190
|
-
}
|
|
160191
|
-
}
|
|
160192
|
-
};
|
|
161048
|
+
Object.assign(
|
|
161049
|
+
stateVariableDefinitions,
|
|
161050
|
+
returnAxisLabelStateVariableDefinitions({ axis: "x" }),
|
|
161051
|
+
returnAxisLabelStateVariableDefinitions({ axis: "y" })
|
|
161052
|
+
);
|
|
160193
161053
|
stateVariableDefinitions.graphicalDescendants = {
|
|
160194
161054
|
forRenderer: true,
|
|
160195
161055
|
returnDependencies: () => ({
|
|
@@ -160327,100 +161187,10 @@ let Graph$1 = class Graph extends BlockComponent {
|
|
|
160327
161187
|
};
|
|
160328
161188
|
}
|
|
160329
161189
|
};
|
|
160330
|
-
|
|
160331
|
-
|
|
160332
|
-
|
|
160333
|
-
|
|
160334
|
-
hasEssential: true,
|
|
160335
|
-
shadowingInstructions: {
|
|
160336
|
-
createComponentOfType: "text"
|
|
160337
|
-
},
|
|
160338
|
-
returnDependencies: () => ({
|
|
160339
|
-
specifiedSize: {
|
|
160340
|
-
dependencyType: "stateVariable",
|
|
160341
|
-
variableName: "specifiedSize"
|
|
160342
|
-
},
|
|
160343
|
-
widthAttr: {
|
|
160344
|
-
dependencyType: "attributeComponent",
|
|
160345
|
-
attributeName: "width",
|
|
160346
|
-
variableNames: ["componentSize"]
|
|
160347
|
-
}
|
|
160348
|
-
}),
|
|
160349
|
-
definition({ dependencyValues, usedDefault }) {
|
|
160350
|
-
const defaultSize = "medium";
|
|
160351
|
-
if (!usedDefault.specifiedSize) {
|
|
160352
|
-
return {
|
|
160353
|
-
setValue: { size: dependencyValues.specifiedSize }
|
|
160354
|
-
};
|
|
160355
|
-
} else if (dependencyValues.widthAttr) {
|
|
160356
|
-
let componentSize = dependencyValues.widthAttr.stateValues.componentSize;
|
|
160357
|
-
if (componentSize === null) {
|
|
160358
|
-
return {
|
|
160359
|
-
setValue: { size: defaultSize }
|
|
160360
|
-
};
|
|
160361
|
-
}
|
|
160362
|
-
let { isAbsolute, size: widthSize } = componentSize;
|
|
160363
|
-
let size2;
|
|
160364
|
-
if (isAbsolute) {
|
|
160365
|
-
for (let [
|
|
160366
|
-
ind,
|
|
160367
|
-
pixels
|
|
160368
|
-
] of orderedWidthMidpoints.entries()) {
|
|
160369
|
-
if (widthSize <= pixels) {
|
|
160370
|
-
size2 = sizePossibilities[ind];
|
|
160371
|
-
break;
|
|
160372
|
-
}
|
|
160373
|
-
}
|
|
160374
|
-
if (!size2) {
|
|
160375
|
-
size2 = defaultSize;
|
|
160376
|
-
}
|
|
160377
|
-
} else {
|
|
160378
|
-
for (let [
|
|
160379
|
-
ind,
|
|
160380
|
-
percent
|
|
160381
|
-
] of orderedPercentWidthMidpoints.entries()) {
|
|
160382
|
-
if (widthSize <= percent) {
|
|
160383
|
-
size2 = sizePossibilities[ind];
|
|
160384
|
-
break;
|
|
160385
|
-
}
|
|
160386
|
-
}
|
|
160387
|
-
if (!size2) {
|
|
160388
|
-
size2 = defaultSize;
|
|
160389
|
-
}
|
|
160390
|
-
}
|
|
160391
|
-
return {
|
|
160392
|
-
setValue: { size: size2 }
|
|
160393
|
-
};
|
|
160394
|
-
} else {
|
|
160395
|
-
return {
|
|
160396
|
-
useEssentialOrDefaultValue: { size: true }
|
|
160397
|
-
};
|
|
160398
|
-
}
|
|
160399
|
-
}
|
|
160400
|
-
};
|
|
160401
|
-
stateVariableDefinitions.width = {
|
|
160402
|
-
description: "The width of the graph.",
|
|
160403
|
-
public: true,
|
|
160404
|
-
forRenderer: true,
|
|
160405
|
-
shadowingInstructions: {
|
|
160406
|
-
createComponentOfType: "componentSize"
|
|
160407
|
-
},
|
|
160408
|
-
returnDependencies: () => ({
|
|
160409
|
-
size: {
|
|
160410
|
-
dependencyType: "stateVariable",
|
|
160411
|
-
variableName: "size"
|
|
160412
|
-
}
|
|
160413
|
-
}),
|
|
160414
|
-
definition({ dependencyValues }) {
|
|
160415
|
-
let width = {
|
|
160416
|
-
isAbsolute: true,
|
|
160417
|
-
size: widthsBySize[dependencyValues.size]
|
|
160418
|
-
};
|
|
160419
|
-
return {
|
|
160420
|
-
setValue: { width }
|
|
160421
|
-
};
|
|
160422
|
-
}
|
|
160423
|
-
};
|
|
161190
|
+
Object.assign(
|
|
161191
|
+
stateVariableDefinitions,
|
|
161192
|
+
returnSizeStateVariableDefinitions({ componentName: "graph" })
|
|
161193
|
+
);
|
|
160424
161194
|
stateVariableDefinitions.aspectRatioFromAxisScales = {
|
|
160425
161195
|
returnDependencies: () => ({
|
|
160426
161196
|
aspectRatioAttr: {
|
|
@@ -217613,47 +218383,13 @@ class Image extends BlockComponent {
|
|
|
217613
218383
|
Object.assign(stateVariableDefinitions, selectedStyleDefinition);
|
|
217614
218384
|
let anchorDefinition = returnAnchorStateVariableDefinition();
|
|
217615
218385
|
Object.assign(stateVariableDefinitions, anchorDefinition);
|
|
217616
|
-
|
|
217617
|
-
|
|
217618
|
-
|
|
217619
|
-
|
|
217620
|
-
|
|
217621
|
-
|
|
217622
|
-
|
|
217623
|
-
returnDependencies: () => ({
|
|
217624
|
-
shortDescriptionChild: {
|
|
217625
|
-
dependencyType: "child",
|
|
217626
|
-
childGroups: ["shortDescriptions"],
|
|
217627
|
-
variableNames: ["text"]
|
|
217628
|
-
},
|
|
217629
|
-
decorative: {
|
|
217630
|
-
dependencyType: "stateVariable",
|
|
217631
|
-
variableName: "decorative"
|
|
217632
|
-
}
|
|
217633
|
-
}),
|
|
217634
|
-
definition({ dependencyValues }) {
|
|
217635
|
-
let shortDescription = "";
|
|
217636
|
-
const diagnostics2 = [];
|
|
217637
|
-
if (dependencyValues.shortDescriptionChild.length > 0) {
|
|
217638
|
-
const shortDescriptionChild = dependencyValues.shortDescriptionChild[dependencyValues.shortDescriptionChild.length - 1];
|
|
217639
|
-
shortDescription = shortDescriptionChild.stateValues.text.trim();
|
|
217640
|
-
}
|
|
217641
|
-
if (shortDescription === "" && !dependencyValues.decorative) {
|
|
217642
|
-
diagnostics2.push(
|
|
217643
|
-
codedDiagnostic({
|
|
217644
|
-
type: "accessibility",
|
|
217645
|
-
level: 1,
|
|
217646
|
-
code: "doenet-a0001",
|
|
217647
|
-
args: { component: "image" }
|
|
217648
|
-
})
|
|
217649
|
-
);
|
|
217650
|
-
}
|
|
217651
|
-
return {
|
|
217652
|
-
setValue: { shortDescription },
|
|
217653
|
-
sendDiagnostics: diagnostics2
|
|
217654
|
-
};
|
|
217655
|
-
}
|
|
217656
|
-
};
|
|
218386
|
+
Object.assign(
|
|
218387
|
+
stateVariableDefinitions,
|
|
218388
|
+
returnShortDescriptionStateVariableDefinition({
|
|
218389
|
+
componentType: "image",
|
|
218390
|
+
componentName: "image"
|
|
218391
|
+
})
|
|
218392
|
+
);
|
|
217657
218393
|
stateVariableDefinitions.childIndicesToRender = {
|
|
217658
218394
|
returnDependencies: () => ({
|
|
217659
218395
|
allChildren: {
|
|
@@ -225740,7 +226476,7 @@ class Sort extends CompositeComponent {
|
|
|
225740
226476
|
attributes.type = {
|
|
225741
226477
|
createPrimitiveOfType: "string",
|
|
225742
226478
|
highlighted: true,
|
|
225743
|
-
description: "Component type to sort children as.",
|
|
226479
|
+
description: "Component type to sort bare string children as. Omit it and they are read as what they look like: every piece naming a number sorts by value, anything else sorts alphabetically.",
|
|
225744
226480
|
validValues: [
|
|
225745
226481
|
{
|
|
225746
226482
|
value: "number",
|
|
@@ -225934,7 +226670,7 @@ class Shuffle extends CompositeComponent {
|
|
|
225934
226670
|
attributes.type = {
|
|
225935
226671
|
highlighted: true,
|
|
225936
226672
|
createPrimitiveOfType: "string",
|
|
225937
|
-
description: "Component type to
|
|
226673
|
+
description: "Component type to read bare string children as. Omit it and they are read as what they look like: every piece naming a number makes them numbers, anything else makes them text.",
|
|
225938
226674
|
validValues: [
|
|
225939
226675
|
{
|
|
225940
226676
|
value: "number",
|
|
@@ -239916,6 +240652,7 @@ const componentTypeArray = [
|
|
|
239916
240652
|
...Object.values(MathListOperators),
|
|
239917
240653
|
...Object.values(ListIndexOperators),
|
|
239918
240654
|
...Object.values(CountOperators),
|
|
240655
|
+
BarChart,
|
|
239919
240656
|
...Object.values(FunctionOperators),
|
|
239920
240657
|
...Object.values(TextOperatorsOfMath),
|
|
239921
240658
|
...Object.values(Extrema$1),
|
|
@@ -242450,4 +243187,4 @@ export {
|
|
|
242450
243187
|
getDefaultExportFromCjs$1 as g,
|
|
242451
243188
|
updateSyntaxFromV06toV07 as u
|
|
242452
243189
|
};
|
|
242453
|
-
//# sourceMappingURL=index-
|
|
243190
|
+
//# sourceMappingURL=index-73JwkM8q.js.map
|