@khanacademy/perseus 92.0.2 → 92.1.0
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/dist/{chunk-register-all-widgets-for-testing-BicV4HKq.js → chunk-register-all-widgets-for-testing-DhqLyGU0.js} +85 -54
- package/dist/chunk-register-all-widgets-for-testing-DhqLyGU0.js.map +1 -0
- package/dist/components/button-group.d.ts +7 -7
- package/dist/index.css +7 -7
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/server-item-renderer.d.ts +1 -1
- package/dist/strings.js.map +1 -1
- package/dist/testing/feature-flags-util.d.ts +1 -1
- package/dist/testing/item-renderer-hooks.d.ts +1 -1
- package/dist/testing.js +4 -1
- package/dist/testing.js.map +1 -1
- package/dist/widgets/grapher/util.d.ts +6 -1
- package/dist/widgets/input-number/input-number.d.ts +1 -1
- package/dist/widgets/interactive-graphs/interactive-graph.d.ts +1 -1
- package/dist/widgets/sorter/index.d.ts +2 -2
- package/dist/widgets/sorter/new/sorter.d.ts +6 -0
- package/dist/widgets/sorter/old/sorter.d.ts +16 -0
- package/dist/widgets/sorter/sorter.d.ts +2 -11
- package/package.json +8 -8
- package/dist/chunk-register-all-widgets-for-testing-BicV4HKq.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/components/range-input.tsx","../src/init.ts","../src/version.ts","../src/perseus-version.ts","../src/article-renderer.tsx","../src/hint-renderer.tsx","../src/hints-renderer.tsx","../src/loading-context.ts","../src/server-item-renderer.tsx","../src/sigfigs.ts","../src/util/extract-perseus-data.ts","../src/util/test-utils.ts","../src/util/widget-enum-utils.ts","../src/util/extract-widget-ids.ts","../src/index.ts"],"sourcesContent":["import * as React from \"react\";\n\nimport NumberInput from \"./number-input\";\n\nimport type {MathFormat} from \"@khanacademy/perseus-core\";\n\ntype Pair<T> = [T, T];\n\ninterface Props {\n value: Pair<number>;\n /**\n * The number format to use for display before the user edits the value.\n * After the first edit, the format is detected from the input.\n */\n format?: MathFormat | null;\n /**\n * Values to display when the input is empty. If a placeholder value is\n * numeric and finite, it is also emitted via `onChange` when the\n * corresponding input is cleared.\n */\n placeholder?: Pair<number | string | null>;\n /**\n * Called when the user changes the value of the input to a valid number.\n */\n onChange: (value: Pair<number>) => void;\n /**\n * Validates input. If `checkValidity` returns false, the new value will\n * not be emitted via `onChange`, and the input will display an error state.\n */\n checkValidity?: (value: Pair<number>) => boolean;\n /**\n * When true, values that approximate an integer or fraction multiple of\n * pi will be displayed in a format like \"3π\", \"1/2π\", etc.\n */\n allowPiTruncation?: boolean;\n /**\n * Whether the up and down arrow keys should increment/decrement the value.\n */\n useArrowKeys?: boolean;\n /**\n * HTML `id` to apply to the underlying inputs.\n */\n // TODO(benchristel): This `id` prop is a bad way of associating labels\n // with the input. It results in non-unique IDs, and therefore duplicated\n // labels. Each input should have its own accessible label.\n id?: string;\n}\n\n/**\n * A minor abstraction on top of `NumberInput` for ranges\n */\nfunction RangeInput(props: Props) {\n const {\n value,\n placeholder = [null, null],\n checkValidity = () => true,\n allowPiTruncation,\n ...restOfProps\n } = props;\n\n const onChange = (i: number) => (newVal: number) => {\n const value = props.value;\n if (i === 0) {\n props.onChange([newVal, value[1]]);\n } else {\n props.onChange([value[0], newVal]);\n }\n };\n\n return (\n <div className=\"range-input\">\n <NumberInput\n {...restOfProps}\n value={value[0]}\n checkValidity={(val) => checkValidity([val, value[1]])}\n onChange={onChange(0)}\n placeholder={placeholder[0]}\n allowPiTruncation={allowPiTruncation}\n />\n <NumberInput\n {...restOfProps}\n value={value[1]}\n checkValidity={(val) => checkValidity([value[0], val])}\n onChange={onChange(1)}\n placeholder={placeholder[1]}\n allowPiTruncation={allowPiTruncation}\n />\n </div>\n );\n}\n\nexport default RangeInput;\n","import basicWidgets from \"./basic-widgets\";\nimport extraWidgets from \"./extra-widgets\";\nimport * as Widgets from \"./widgets\";\n\n/**\n * This should be called by all clients, specifying whether extra widgets are\n * needed via `loadExtraWidgets`. It is idempotent, so it's not a problem to\n * call it multiple times.\n */\nconst init = function () {\n Widgets.registerWidgets(basicWidgets);\n Widgets.registerWidgets(extraWidgets);\n};\n\nexport default init;\n","// This file is processed by a Rollup plugin (replace) to inject the production\n// version number during the release build.\n// In dev, you'll never see the version number.\n\nimport {addLibraryVersionToPerseusDebug} from \"@khanacademy/perseus-utils\";\n\nconst libName = \"@khanacademy/perseus\";\nexport const libVersion = \"__lib_version__\";\n\naddLibraryVersionToPerseusDebug(libName, libVersion);\n","export const apiVersion = {\n major: 12,\n minor: 0,\n};\n","/**\n * An article renderer. Articles are long-form pieces of content,\n * composed of multiple (Renderer) sections concatenated together.\n */\n\nimport * as PerseusLinter from \"@khanacademy/perseus-linter\";\nimport classNames from \"classnames\";\nimport * as React from \"react\";\n\nimport {PerseusI18nContext} from \"./components/i18n-context\";\nimport {DependenciesContext, getDependencies} from \"./dependencies\";\nimport JiptParagraphs from \"./jipt-paragraphs\";\nimport {ClassNames as ApiClassNames, ApiOptions} from \"./perseus-api\";\nimport Renderer from \"./renderer\";\nimport UserInputManager from \"./user-input-manager\";\nimport Util from \"./util\";\n\nimport type {PerseusDependenciesV2, SharedRendererProps} from \"./types\";\nimport type {KeypadAPI} from \"@khanacademy/math-input\";\nimport type {\n PerseusArticle,\n PerseusRenderer,\n KeypadContextRendererInterface,\n} from \"@khanacademy/perseus-core\";\n\ntype Props = Partial<React.ContextType<typeof DependenciesContext>> &\n SharedRendererProps & {\n json: PerseusArticle;\n legacyPerseusLint?: ReadonlyArray<string>;\n keypadElement?: KeypadAPI | null | undefined;\n dependencies: PerseusDependenciesV2;\n // the seed for deterministic shuffling (randomization)\n seed: number;\n };\n\ntype DefaultProps = {\n apiOptions: Props[\"apiOptions\"];\n linterContext: Props[\"linterContext\"];\n};\n\nclass ArticleRenderer\n extends React.Component<Props>\n implements KeypadContextRendererInterface\n{\n static contextType = PerseusI18nContext;\n declare context: React.ContextType<typeof PerseusI18nContext>;\n\n _currentFocus: any;\n sectionRenderers: Array<Renderer> = [];\n\n static defaultProps: DefaultProps = {\n apiOptions: ApiOptions.defaults,\n linterContext: PerseusLinter.linterContextDefault,\n };\n\n constructor(props: Props) {\n super(props);\n }\n\n componentDidMount() {\n this._currentFocus = null;\n }\n\n _handleFocusChange: (arg1: any, arg2: any) => void = (\n newFocusPath,\n oldFocusPath,\n ) => {\n if (newFocusPath) {\n this._setCurrentFocus(newFocusPath);\n } else {\n this._onRendererBlur(oldFocusPath);\n }\n };\n\n _setCurrentFocus: (arg1: any) => void = (newFocusPath) => {\n const {keypadElement, apiOptions} = this.props;\n const {isMobile} = apiOptions;\n\n const prevFocusPath = this._currentFocus;\n this._currentFocus = newFocusPath;\n\n // Use the section prefix to extract the relevant Renderer's input\n // paths, so as to check whether the focused path represents an\n // input.\n let didFocusInput = false;\n let focusedInput;\n\n if (this._currentFocus) {\n const [sectionIndex, ...focusPath] = this._currentFocus;\n\n const inputPaths =\n this.sectionRenderers[sectionIndex].getInputPaths();\n\n didFocusInput = inputPaths.some((inputPath) => {\n return Util.inputPathsEqual(inputPath, focusPath);\n });\n focusedInput =\n this.sectionRenderers[sectionIndex].getDOMNodeForPath(\n focusPath,\n );\n }\n\n const {onFocusChange} = this.props.apiOptions;\n if (onFocusChange) {\n // Wait for the keypad to mount before getting the height\n setTimeout(() => {\n const keypadDomNode =\n // eslint-disable-next-line no-restricted-syntax\n keypadElement?.getDOMNode() as HTMLElement;\n const keypadHeight =\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n keypadDomNode && didFocusInput\n ? keypadDomNode.getBoundingClientRect().height\n : 0;\n\n onFocusChange(\n this._currentFocus,\n prevFocusPath,\n keypadHeight,\n didFocusInput ? focusedInput : null,\n );\n }, 0);\n }\n\n if (keypadElement && isMobile) {\n if (didFocusInput) {\n keypadElement.activate();\n } else {\n keypadElement.dismiss();\n }\n }\n };\n\n _onRendererBlur: (arg1: any) => void = (blurPath) => {\n const blurringFocusPath = this._currentFocus;\n\n // Failsafe: abort if ID is different, because focus probably happened\n // before blur.\n if (!Util.inputPathsEqual(blurPath, blurringFocusPath)) {\n return;\n }\n\n // Wait until after any new focus events fire this tick before declaring\n // that nothing is focused, since if there were a focus change across\n // sections, we could receive the blur before the focus.\n // TODO(jeff, CP-3128): Use Wonder Blocks Timing API\n setTimeout(() => {\n if (Util.inputPathsEqual(this._currentFocus, blurringFocusPath)) {\n this._setCurrentFocus(null);\n }\n });\n };\n\n blur: () => void = () => {\n if (this._currentFocus) {\n const [sectionIndex, ...inputPath] = this._currentFocus;\n this.sectionRenderers[sectionIndex].blurPath(inputPath);\n }\n };\n\n _sections: () => PerseusRenderer[] = () => {\n const sections = Array.isArray(this.props.json)\n ? this.props.json\n : [this.props.json];\n\n // In JIPT context we split sections to paragraphs in order match the\n // translatable strings found on Crowdin when rendering articles in\n // the WYSIWYG mode for translation. This is needed for the jipt.js\n // integration in order to attribute the rendered strings on Crowdin.\n if (getDependencies().JIPT.useJIPT) {\n const paragraphs: Array<PerseusRenderer> = [];\n\n for (const section of sections) {\n JiptParagraphs.parseToArray(section.content).forEach(\n (paragraph) => {\n paragraphs.push({\n ...section,\n content: paragraph,\n });\n },\n );\n }\n\n return paragraphs;\n }\n\n return sections;\n };\n\n render(): React.ReactNode {\n const apiOptions = {\n ...ApiOptions.defaults,\n ...this.props.apiOptions,\n isArticle: true,\n } as const;\n\n const classes = classNames({\n \"framework-perseus\": true,\n \"perseus-article\": true,\n // NOTE(charlie): For exercises, this is applied outside of Perseus\n // (in khan/frontend).\n [ApiClassNames.MOBILE]: apiOptions.isMobile,\n });\n\n // We're using the index as the key here because we don't have a unique\n // identifier for each section. This should be fine as we never remove\n // or reorder sections.\n const sections = this._sections().map((section, sectionIndex) => {\n const sectionSeed = this.props.seed + sectionIndex;\n\n return (\n <UserInputManager\n key={sectionIndex}\n widgets={section.widgets}\n problemNum={sectionSeed}\n >\n {({userInput, handleUserInput, initializeUserInput}) => (\n <Renderer\n {...section}\n problemNum={sectionSeed}\n userInput={userInput}\n handleUserInput={handleUserInput}\n initializeUserInput={initializeUserInput}\n ref={(elem) => {\n if (elem) {\n this.sectionRenderers[sectionIndex] = elem;\n }\n }}\n key={sectionIndex}\n keypadElement={this.props.keypadElement}\n apiOptions={{\n ...apiOptions,\n onFocusChange: (newFocusPath, oldFocusPath) => {\n // Prefix the paths with the relevant section index,\n // so as to allow us to distinguish between\n // equivalently-named inputs across Renderers.\n this._handleFocusChange(\n newFocusPath &&\n [sectionIndex].concat(\n // eslint-disable-next-line no-restricted-syntax\n newFocusPath as any,\n ),\n oldFocusPath &&\n [sectionIndex].concat(\n // eslint-disable-next-line no-restricted-syntax\n oldFocusPath as any,\n ),\n );\n },\n }}\n linterContext={PerseusLinter.pushContextStack(\n this.props.linterContext,\n \"article\",\n )}\n legacyPerseusLint={this.props.legacyPerseusLint}\n strings={this.context.strings}\n />\n )}\n </UserInputManager>\n );\n });\n\n return (\n <div className={classes}>\n <DependenciesContext.Provider value={this.props.dependencies}>\n {sections}\n </DependenciesContext.Provider>\n </div>\n );\n }\n}\n\nexport default ArticleRenderer;\n","import * as PerseusLinter from \"@khanacademy/perseus-linter\";\nimport {semanticColor, sizing} from \"@khanacademy/wonder-blocks-tokens\";\nimport {StyleSheet, css} from \"aphrodite\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\n\nimport {PerseusI18nContext} from \"./components/i18n-context\";\nimport {DependenciesContext} from \"./dependencies\";\nimport Renderer from \"./renderer\";\nimport {hintBorderWidth, hintPaddingInlineStart} from \"./styles/constants\";\nimport mediaQueries from \"./styles/media-queries\";\nimport UserInputManager from \"./user-input-manager\";\n\nimport type {\n FindWidgetsFunction,\n PerseusDependenciesV2,\n SharedRendererProps,\n} from \"./types\";\nimport type {Hint} from \"@khanacademy/perseus-core\";\n\ntype Props = SharedRendererProps & {\n className?: string;\n hint: Hint;\n /**\n * Whether this is the last hint in the list.\n */\n lastHint?: boolean;\n /**\n * Whether this is the last hint rendered. Compared to lastHint, this is\n * used to tell the HintRenderer if this hint was most recently rendered.\n */\n lastRendered?: boolean;\n /**\n * The position of this hint in the list (ie. Hint 4 of 6 - pos is 4).\n */\n pos: number;\n /**\n * The total number of hints (used to render the `Hint x of y` display)\n */\n totalHints?: number;\n findExternalWidgets?: FindWidgetsFunction;\n dependencies: PerseusDependenciesV2;\n};\n\ntype DefaultProps = {\n linterContext: Props[\"linterContext\"];\n};\n\n/* Renders just a hint preview */\nclass HintRenderer extends React.Component<Props> {\n static contextType = PerseusI18nContext;\n declare context: React.ContextType<typeof PerseusI18nContext>;\n\n rendererRef = React.createRef<Renderer>();\n\n static defaultProps: DefaultProps = {\n linterContext: PerseusLinter.linterContextDefault,\n };\n\n // TODO(LEMS-3185): remove serializedState\n /**\n * @deprecated - do not use in new code.\n */\n getSerializedState: () => void = () => {\n return this.rendererRef.current?.getSerializedState();\n };\n\n render(): React.ReactNode {\n if (this.props.hint.placeholder) {\n // TODO(LEMS-3806): there's probably a better way to do this,\n // but this can't be null because other components\n // reference the ref on HintRenderer\n return <span />;\n }\n\n const {\n apiOptions,\n className,\n hint,\n lastHint,\n lastRendered,\n pos,\n totalHints,\n } = this.props;\n\n const {isMobile} = apiOptions;\n\n const classNames = classnames(\n \"hint\",\n !isMobile && \"perseus-hint-renderer\",\n isMobile && css(styles.newHint),\n isMobile && lastRendered && css(styles.lastRenderedNewHint),\n lastHint && \"last-hint\",\n lastRendered && \"last-rendered\",\n className,\n );\n\n const rendererApiOptions = {\n ...apiOptions,\n customKeypad: false,\n } as const;\n\n return (\n <DependenciesContext.Provider value={this.props.dependencies}>\n {/* @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'number | undefined'. */}\n <div className={classNames} tabIndex=\"-1\">\n {!apiOptions.isMobile && (\n <span className=\"perseus-sr-only\">\n {this.context.strings.hintPos({pos: pos + 1})}\n </span>\n )}\n {!apiOptions.isMobile &&\n totalHints != null &&\n pos != null && (\n <span\n className=\"perseus-hint-label\"\n style={{\n display: \"block\",\n color: apiOptions.hintProgressColor,\n }}\n >\n {`${pos + 1} / ${totalHints}`}\n </span>\n )}\n\n <UserInputManager widgets={hint.widgets} problemNum={0}>\n {({\n userInput,\n handleUserInput,\n initializeUserInput,\n }) => (\n <Renderer\n ref={this.rendererRef}\n userInput={userInput}\n handleUserInput={handleUserInput}\n initializeUserInput={initializeUserInput}\n widgets={hint.widgets}\n content={hint.content || \"\"}\n images={hint.images}\n apiOptions={rendererApiOptions}\n findExternalWidgets={\n this.props.findExternalWidgets\n }\n linterContext={PerseusLinter.pushContextStack(\n this.props.linterContext,\n \"hint\",\n )}\n strings={this.context.strings}\n />\n )}\n </UserInputManager>\n </div>\n </DependenciesContext.Provider>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n newHint: {\n marginBlockEnd: sizing.size_240,\n\n borderInlineStartColor: semanticColor.core.border.neutral.subtle,\n borderInlineStartStyle: \"solid\",\n borderInlineStartWidth: hintBorderWidth,\n\n // Only apply left-padding on tablets, to avoid being flush with the\n // border. On phones, padding is applied internally by the child\n // renderers. Some content on phones that is rendered at full-bleed may\n // end up flush with the border, but that's acceptable for now.\n [mediaQueries.lgOrSmaller]: {\n paddingInlineStart: hintPaddingInlineStart,\n },\n [mediaQueries.smOrSmaller]: {\n paddingInlineStart: 0,\n },\n\n \":focus\": {\n outline: \"none\",\n },\n },\n\n lastRenderedNewHint: {\n marginBlockEnd: 0,\n borderInlineStartColor: semanticColor.core.border.instructive.default,\n },\n});\n\nexport default HintRenderer;\n","import * as PerseusLinter from \"@khanacademy/perseus-linter\";\nimport Button from \"@khanacademy/wonder-blocks-button\";\nimport {semanticColor, sizing} from \"@khanacademy/wonder-blocks-tokens\";\nimport plus from \"@phosphor-icons/core/regular/plus.svg\";\nimport {StyleSheet, css} from \"aphrodite\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport _ from \"underscore\";\n\nimport {PerseusI18nContext} from \"./components/i18n-context\";\nimport HintRenderer from \"./hint-renderer\";\nimport {ApiOptions} from \"./perseus-api\";\nimport {hintBorderWidth, hintPaddingInlineStart} from \"./styles/constants\";\nimport mediaQueries from \"./styles/media-queries\";\nimport sharedStyles from \"./styles/shared\";\nimport Util from \"./util\";\n\nimport type Renderer from \"./renderer\";\nimport type {APIOptionsWithDefaults, PerseusDependenciesV2} from \"./types\";\nimport type {Hint} from \"@khanacademy/perseus-core\";\nimport type {PropsFor} from \"@khanacademy/wonder-blocks-core\";\n\ntype Props = PropsFor<typeof Renderer> & {\n className?: string;\n hints: Hint[];\n hintsVisible?: number;\n dependencies: PerseusDependenciesV2;\n};\n\ntype DefaultProps = {\n linterContext: Props[\"linterContext\"];\n};\n\ntype State = {\n isFinalHelpPage: boolean;\n};\n\nclass HintsRenderer extends React.Component<Props, State> {\n static contextType = PerseusI18nContext;\n declare context: React.ContextType<typeof PerseusI18nContext>;\n\n static defaultProps: DefaultProps = {\n linterContext: PerseusLinter.linterContextDefault,\n };\n\n // The isFinalHelpPage property determines if the user has requested help\n // after answering an exercise question incorrectly, which differs from\n // the case when the user is requesting successive hints. In the case\n // where isFinalHelpPage property is true, we want to display all hints.\n // We know the user is on the final help page when the hintsVisible\n // property jumps from 0 to the total number of hints.\n state: any = {isFinalHelpPage: false};\n\n componentDidMount() {\n this._cacheHintImages();\n }\n\n UNSAFE_componentWillReceiveProps(nextProps: Props) {\n // @ts-expect-error - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.\n if (nextProps.hintsVisible - this.props.hintsVisible > 1) {\n this.setState({isFinalHelpPage: true});\n }\n }\n\n componentDidUpdate(prevProps: Props, prevState: State) {\n if (\n !_.isEqual(prevProps.hints, this.props.hints) ||\n prevProps.hintsVisible !== this.props.hintsVisible\n ) {\n this._cacheHintImages();\n }\n\n // Force number to make TypeScript happy\n const prevHintsVisible = prevProps.hintsVisible || 0;\n const nextHintsVisible = this.props.hintsVisible || 0;\n\n // When a new hint is displayed we immediately focus it\n // (keeping within the boundaries of hint count)\n if (\n prevHintsVisible < nextHintsVisible &&\n nextHintsVisible <= this.props.hints.length &&\n nextHintsVisible >= 0\n ) {\n const pos = nextHintsVisible - 1;\n const hint = this.props.hints[pos];\n\n // Skip focusing placeholder hints - they don't render focusable content\n if (hint?.placeholder) {\n return;\n }\n\n try {\n const ref = this.refs[\"hintRenderer\" + pos];\n\n // Ensure the ref exists before trying to find its DOM node\n if (ref == null) {\n return;\n }\n\n // eslint-disable-next-line no-restricted-syntax\n const domNode = ReactDOM.findDOMNode(ref) as HTMLElement | null;\n\n // Only focus if we have a valid DOM node that supports focus\n if (domNode && typeof domNode.focus === \"function\") {\n domNode.focus();\n }\n } catch (e) {\n // Silently fail if we can't focus the hint (e.g., ref not ready,\n // DOM node doesn't exist, etc.)\n // This can happen with placeholder hints or timing issues\n }\n }\n }\n\n _hintsVisible: () => number = () => {\n if (this.props.hintsVisible == null || this.props.hintsVisible === -1) {\n return this.props.hints.length;\n }\n return this.props.hintsVisible;\n };\n\n _cacheImagesInHint: (arg1: any) => void = (hint) => {\n _.each(hint.images, (data, src) => {\n const image = new Image();\n image.src = Util.getRealImageUrl(src);\n });\n };\n\n _cacheHintImages: () => any = () => {\n // Only cache images in the first hint at the start. When hints are\n // taken, cache images in the rest of the hints\n if (this._hintsVisible() > 0) {\n _.each(this.props.hints, this._cacheImagesInHint);\n } else if (this.props.hints.length > 0) {\n this._cacheImagesInHint(this.props.hints[0]);\n }\n };\n\n getApiOptions: () => APIOptionsWithDefaults = () => {\n // When an item is answered correctly, the entire exercise is set to\n // `readOnly = true` so that the user cannot switch answers. However, this\n // makes hyperlinks in hints unclickable. Thus, we always set readOnly to be\n // false in hints.\n return {\n ...ApiOptions.defaults,\n ...this.props.apiOptions,\n readOnly: false,\n };\n };\n\n // TODO(LEMS-3185): remove serializedState\n /**\n * @deprecated - do not use in new code.\n */\n getSerializedState: () => any = () => {\n return _.times(this._hintsVisible(), (i) => {\n // @ts-expect-error - TS2339 - Property 'getSerializedState' does not exist on type 'ReactInstance'.\n return this.refs[\"hintRenderer\" + i].getSerializedState();\n });\n };\n\n render(): React.ReactNode {\n const apiOptions = this.getApiOptions();\n const hintsVisible = this._hintsVisible();\n const hints: Array<\n React.ReactElement<React.ComponentProps<typeof HintRenderer>>\n > = [];\n const isFinalHelpPage = this.state.isFinalHelpPage;\n this.props.hints.slice(0, hintsVisible).forEach((hint, i) => {\n const lastHint =\n i === this.props.hints.length - 1 && !/\\*\\*/.test(hint.content);\n const lastRendered = i === hintsVisible - 1;\n\n const renderer = (\n <HintRenderer\n dependencies={this.props.dependencies}\n lastHint={lastHint}\n lastRendered={lastRendered}\n hint={hint}\n pos={i}\n totalHints={this.props.hints.length}\n ref={\"hintRenderer\" + i}\n key={\"hintRenderer\" + i}\n apiOptions={apiOptions}\n findExternalWidgets={this.props.findExternalWidgets}\n linterContext={PerseusLinter.pushContextStack(\n this.props.linterContext,\n \"hints[\" + i + \"]\",\n )}\n />\n );\n\n if (isFinalHelpPage) {\n hints.push(renderer);\n } else {\n if (hint.replace && hints.length > 0) {\n hints[hints.length - 1] = renderer;\n } else {\n hints.push(renderer);\n }\n }\n });\n\n const {getAnotherHint} = apiOptions;\n\n const showGetAnotherHint =\n getAnotherHint &&\n hintsVisible > 0 &&\n hintsVisible < this.props.hints.length;\n const hintRatioCopy = `(${hintsVisible}/${this.props.hints.length})`;\n\n const classNames = classnames(\n this.props.className,\n apiOptions.isMobile &&\n hintsVisible > 0 &&\n css(styles.mobileHintStylesHintsRenderer),\n );\n\n return (\n <div className={classNames}>\n {apiOptions.isMobile && hintsVisible > 0 && (\n <div\n className={css(\n styles.mobileHintStylesHintTitle,\n sharedStyles.responsiveLabel,\n )}\n >\n {this.context.strings.hints}\n </div>\n )}\n {hints}\n {showGetAnotherHint && (\n <Button\n rel=\"button\"\n kind=\"tertiary\"\n startIcon={plus}\n onClick={(evt) => {\n evt.preventDefault();\n evt.stopPropagation();\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (getAnotherHint) {\n getAnotherHint();\n }\n }}\n >\n {this.context.strings.getAnotherHint +\n \" \" +\n hintRatioCopy}\n </Button>\n )}\n </div>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n mobileHintStylesHintsRenderer: {\n marginBlockStart: sizing.size_640,\n border: `solid ${semanticColor.core.border.neutral.subtle}`,\n borderWidth: \"1px 0 0 0\",\n\n position: \"relative\",\n \":before\": {\n content: '\"\"',\n display: \"table\",\n clear: \"both\",\n },\n \":after\": {\n content: '\"\"',\n display: \"table\",\n clear: \"both\",\n },\n },\n\n mobileHintStylesHintTitle: {\n fontWeight: \"bold\",\n color: semanticColor.core.foreground.neutral.strong,\n\n paddingBlockStart: sizing.size_160,\n paddingBlockEnd: sizing.size_240,\n\n [mediaQueries.lgOrSmaller]: {\n paddingInlineStart: 0,\n },\n [mediaQueries.smOrSmaller]: {\n // On phones, ensure that the button is aligned with the hint body\n // content.\n paddingInlineStart: `calc(${hintPaddingInlineStart} + ${hintBorderWidth})`,\n },\n },\n});\n\nexport default HintsRenderer;\n","/**\n * A React context for signaling when all of the components in a Perseus\n * renderer is fully rendered. This means that all images and math have\n * finished loading/rendering.\n *\n * Currently only used by ServerItemRender to indicate when the question\n * renderer is fully rendered.\n */\nimport * as React from \"react\";\n\ntype Context = {\n onRendered: (isRendered: boolean) => void;\n};\n\nconst defaultContext: Context = {\n onRendered: (isRendered: boolean) => {},\n};\n\nconst context: React.Context<Context> = React.createContext(defaultContext);\n\nexport default context;\n","import * as PerseusLinter from \"@khanacademy/perseus-linter\";\nimport {StyleSheet, css} from \"aphrodite\";\n/**\n * The main item (aka Exercise) renderer in Perseus. This component renders its\n * question renderer and hints renderer using standard React practices (an\n * earlier ItemRenderer component used to use jQuery and ReactDOM.render()ing\n * to render into elements it didn't own.\n *\n * This component is compatible with server-rendering of a perseus exercise.\n */\nimport * as React from \"react\";\nimport _ from \"underscore\";\n\nimport AssetContext from \"./asset-context\";\nimport {PerseusI18nContext} from \"./components/i18n-context\";\nimport {DependenciesContext} from \"./dependencies\";\nimport HintsRenderer from \"./hints-renderer\";\nimport LoadingContext from \"./loading-context\";\nimport {ApiOptions} from \"./perseus-api\";\nimport Renderer from \"./renderer\";\nimport UserInputManager from \"./user-input-manager\";\nimport Util from \"./util\";\n\nimport type {\n FocusPath,\n PerseusDependenciesV2,\n SharedRendererProps,\n} from \"./types\";\nimport type {\n GetPromptJSONInterface,\n RendererPromptJSON,\n} from \"./widget-ai-utils/prompt-types\";\nimport type {KeypadAPI} from \"@khanacademy/math-input\";\nimport type {\n PerseusItem,\n ShowSolutions,\n KeypadContextRendererInterface,\n RendererInterface,\n UserInputMap,\n} from \"@khanacademy/perseus-core\";\nimport type {PropsFor} from \"@khanacademy/wonder-blocks-core\";\n\ntype OwnProps = {\n hintsVisible?: number;\n item: PerseusItem;\n problemNum?: number;\n reviewMode?: boolean;\n keypadElement?: KeypadAPI | null | undefined;\n dependencies: PerseusDependenciesV2;\n showSolutions?: ShowSolutions;\n};\n\ntype HOCProps = {\n onRendered: (isRendered: boolean) => void;\n};\n\ntype Props = SharedRendererProps & OwnProps & HOCProps;\n\ntype DefaultProps = Required<\n Pick<Props, \"apiOptions\" | \"onRendered\" | \"linterContext\">\n>;\n\n/**\n * @deprecated and likely a very broken API\n * [LEMS-3185] do not trust serializedState\n */\ntype SerializedState = {\n question: any;\n hints: any;\n};\n\nexport class ServerItemRenderer\n extends React.Component<Props>\n implements\n RendererInterface,\n KeypadContextRendererInterface,\n GetPromptJSONInterface\n{\n static contextType = PerseusI18nContext;\n declare context: React.ContextType<typeof PerseusI18nContext>;\n\n // @ts-expect-error - TS2564 - Property 'questionRenderer' has no initializer and is not definitely assigned in the constructor.\n questionRenderer: Renderer;\n hintsRenderer: any;\n _currentFocus: FocusPath;\n _fullyRendered: boolean;\n /**\n * Tracks whether each asset rendered below us (images, math, anything else\n * that takes extra passes to settle) has finished rendering.\n *\n * This is deliberately not React state: assets register themselves in\n * their constructors, while we're still rendering, and a state update\n * from there isn't visible to us until a later render pass — by which point we'd\n * already have called `onRendered()` under the assumption\n * there were no assets to wait for.\n */\n _assetStatuses: {[assetKey: string]: boolean};\n blurTimeoutID: number | null | undefined;\n userInput: UserInputMap;\n\n static defaultProps: DefaultProps = {\n // eslint-disable-next-line no-restricted-syntax\n apiOptions: {} as any, // a deep default is done in `this.update()`\n linterContext: PerseusLinter.linterContextDefault,\n onRendered: (isRendered: boolean) => {},\n };\n\n constructor(props: Props) {\n super(props);\n\n this._assetStatuses = {};\n this._fullyRendered = false;\n this.userInput = {};\n }\n\n componentDidMount() {\n this._currentFocus = null;\n\n // In cases where we are rendering content that doesn't have any assets\n // (things that are async loaded/rendered, such as images or TeX), we\n // want to ensure that we fire the onRendered callback at least once.\n // Assets register themselves in their constructors, so by the time we\n // mount they're all in _assetStatuses (unloaded) and we can tell\n // whether there's anything to wait for.\n this.maybeCallOnRendered();\n }\n\n componentWillUnmount() {\n if (this.blurTimeoutID != null) {\n // TODO(jeff, CP-3128): Use Wonder Blocks Timing API.\n clearTimeout(this.blurTimeoutID);\n this.blurTimeoutID = null;\n }\n }\n\n /**\n * Reports that we've finished rendering, if every asset has settled.\n *\n * Called once we've mounted (to cover content with no assets at all) and\n * again on every status change, so it doesn't depend on a render pass\n * happening at the right moment. Only ever reports once.\n */\n maybeCallOnRendered() {\n if (!this._fullyRendered) {\n const assetsLoaded = Object.values(this._assetStatuses).every(\n Boolean,\n );\n\n if (assetsLoaded) {\n this._fullyRendered = true;\n this.props.onRendered(true);\n }\n }\n }\n\n _handleFocusChange: (newFocus: FocusPath, oldFocus: FocusPath) => void = (\n newFocus: FocusPath,\n oldFocus: FocusPath,\n ) => {\n if (newFocus != null) {\n this._setCurrentFocus(newFocus);\n } else {\n this._onRendererBlur(oldFocus);\n }\n };\n\n // Sets the current focus path and element and\n // send an onChangeFocus event back to our parent.\n _setCurrentFocus(newFocus: FocusPath) {\n const {\n apiOptions: {isMobile, onFocusChange},\n keypadElement,\n } = this.props;\n\n // By the time this happens, newFocus cannot be a prefix of\n // prevFocused, since we must have either been called from\n // an onFocusChange within a renderer, which is only called when\n // this is not a prefix, or between the question and answer areas,\n // which can never prefix each other.\n const prevFocus = this._currentFocus;\n this._currentFocus = newFocus;\n\n // Determine whether the newly focused path represents an input.\n const inputPaths = this.getInputPaths();\n const didFocusInput =\n this._currentFocus &&\n inputPaths.some((inputPath) => {\n return Util.inputPathsEqual(inputPath, this._currentFocus);\n });\n\n if (onFocusChange != null) {\n // Wait for the keypad to mount before getting the height\n setTimeout(() => {\n // First, calculate the current keypad height\n const keypadDomNode: HTMLElement =\n // eslint-disable-next-line no-restricted-syntax\n keypadElement?.getDOMNode() as HTMLElement;\n const keypadHeight =\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n keypadDomNode && didFocusInput\n ? keypadDomNode.getBoundingClientRect().height\n : 0;\n\n // Then call the callback\n onFocusChange(\n this._currentFocus,\n prevFocus,\n keypadHeight,\n // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.\n didFocusInput &&\n this.questionRenderer.getDOMNodeForPath(newFocus),\n );\n }, 0);\n }\n\n if (keypadElement && isMobile) {\n if (didFocusInput) {\n keypadElement.activate();\n } else {\n keypadElement.dismiss();\n }\n }\n }\n\n _onRendererBlur(blurPath: FocusPath) {\n const blurringFocusPath = this._currentFocus;\n\n // Failsafe: abort if ID is different, because focus probably happened\n // before blur\n if (!_.isEqual(blurPath, blurringFocusPath)) {\n return;\n }\n\n // Wait until after any new focus events fire this tick before\n // declaring that nothing is focused.\n // If a different widget was focused, we'll see an onBlur event\n // now, but then an onFocus event on a different element before\n // this callback is executed\n // TODO(jeff, CP-3128): Use Wonder Blocks Timing API.\n // @ts-expect-error - TS2322 - Type 'Timeout' is not assignable to type 'number'.\n this.blurTimeoutID = setTimeout(() => {\n if (_.isEqual(this._currentFocus, blurringFocusPath)) {\n this._setCurrentFocus(null);\n }\n }, 0);\n }\n\n focusPath(path: FocusPath): void {\n return this.questionRenderer.focusPath(path);\n }\n\n blurPath(path: FocusPath): void {\n return this.questionRenderer.blurPath(path);\n }\n\n getDOMNodeForPath(path: FocusPath): Element | Text | null | undefined {\n return this.questionRenderer.getDOMNodeForPath(path);\n }\n\n getInputPaths(): ReadonlyArray<FocusPath> {\n const questionAreaInputPaths = this.questionRenderer.getInputPaths();\n return questionAreaInputPaths;\n }\n\n focus(): boolean | null | undefined {\n return this.questionRenderer.focus();\n }\n\n blur(): void {\n if (this._currentFocus) {\n this.blurPath(this._currentFocus);\n }\n }\n\n getNumHints(): number {\n return this.props.item.hints.length;\n }\n\n getPromptJSON(): RendererPromptJSON {\n return this.questionRenderer.getPromptJSON();\n }\n\n /**\n * Returns an object of the widget `.getUserInput()` results\n */\n getUserInput(): UserInputMap {\n return this.userInput;\n }\n\n /**\n * Returns an array of all widget IDs in the order they occur in\n * the question content.\n */\n getWidgetIds(): ReadonlyArray<string> {\n return this.questionRenderer.getWidgetIds();\n }\n\n /**\n * Get a representation of the current state of the item.\n */\n // TODO(LEMS-3185): remove serializedState\n /**\n * @deprecated - do not use in new code.\n */\n getSerializedState(): SerializedState {\n return {\n question: this.questionRenderer.getSerializedState(),\n hints: this.hintsRenderer.getSerializedState(),\n };\n }\n\n // This must be pre-bound otherwise SvgImage's shouldComponentUpdate\n // won't behave correctly and we'll get an infinite loop.\n setAssetStatus: (assetKey: string, status: boolean) => void = (\n assetKey,\n status,\n ) => {\n this._assetStatuses[assetKey] = status;\n this.maybeCallOnRendered();\n };\n\n render(): React.ReactNode {\n const apiOptions = {\n ...ApiOptions.defaults,\n ...this.props.apiOptions,\n onFocusChange: this._handleFocusChange,\n } as const;\n\n const contextValue = {\n assetStatuses: this._assetStatuses,\n setAssetStatus: this.setAssetStatus,\n } as const;\n\n const questionRenderer = (\n <AssetContext.Provider value={contextValue}>\n <UserInputManager\n widgets={this.props.item.question.widgets}\n problemNum={this.props.problemNum ?? 0}\n >\n {({userInput, handleUserInput, initializeUserInput}) => {\n this.userInput = userInput;\n return (\n <Renderer\n keypadElement={this.props.keypadElement}\n problemNum={this.props.problemNum}\n apiOptions={apiOptions}\n reviewMode={this.props.reviewMode}\n showSolutions={this.props.showSolutions}\n ref={(elem) => {\n if (elem != null) {\n this.questionRenderer = elem;\n }\n }}\n content={this.props.item.question.content}\n widgets={this.props.item.question.widgets}\n images={this.props.item.question.images}\n linterContext={PerseusLinter.pushContextStack(\n this.props.linterContext,\n \"question\",\n )}\n strings={this.context.strings}\n {...this.props.dependencies}\n userInput={userInput}\n handleUserInput={(\n id,\n userInput,\n widgetsEmpty,\n ) => {\n handleUserInput(\n id,\n userInput,\n widgetsEmpty,\n );\n }}\n initializeUserInput={initializeUserInput}\n isScorable\n />\n );\n }}\n </UserInputManager>\n </AssetContext.Provider>\n );\n\n const hintsRenderer = (\n <HintsRenderer\n dependencies={this.props.dependencies}\n hints={this.props.item.hints}\n hintsVisible={this.props.hintsVisible}\n apiOptions={apiOptions}\n ref={(elem) => (this.hintsRenderer = elem)}\n linterContext={PerseusLinter.pushContextStack(\n this.props.linterContext,\n \"hints\",\n )}\n strings={this.context.strings}\n />\n );\n\n return (\n <DependenciesContext.Provider value={this.props.dependencies}>\n <div>\n <div>{questionRenderer}</div>\n <div\n className={\n // Avoid adding any horizontal padding when applying the\n // mobile hint styles, which are flush to the left.\n // NOTE(charlie): We may still want to apply this\n // padding for desktop exercises.\n apiOptions.isMobile\n ? undefined\n : css(styles.hintsContainer)\n }\n >\n {hintsRenderer}\n </div>\n </div>\n </DependenciesContext.Provider>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n hintsContainer: {\n marginInlineStart: 50,\n },\n});\n\nexport default React.forwardRef<\n ServerItemRenderer,\n Omit<PropsFor<typeof ServerItemRenderer>, \"onRendered\">\n>(function ServerItemRendererWithRef(props, ref) {\n return (\n <LoadingContext.Consumer>\n {({onRendered}) => (\n <ServerItemRenderer\n {...props}\n onRendered={onRendered}\n ref={ref}\n />\n )}\n </LoadingContext.Consumer>\n );\n});\n","/* eslint-disable eqeqeq, @typescript-eslint/no-unused-vars */\n/*\n * A class for formatting number to significant digits.\n * Copyright (C) 2001 Stephen Ostermiller\n * http://ostermiller.org/contact.pl?regarding?JavaScript+Significant+Figures\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n */\n\n/**\n * Format a floating point for display using the specified\n * number of significant figures and least significant decimal.\n * Scientific notation may used by this method if this\n * object is very small, very large, has many significant\n * figures, or the number of significant figures would be\n * ambiguous in the output if scientific notation were not\n * used.\n *\n * @param f A floating point number that should be displayed\n * @param sigFigs desired number of significant figures (integer).\n * @param sigDecs the least significant decimal place (integer).\n * @param scientific true iff scientific notation should always be used.\n * @return a string of this object formatted correctly.\n */\nexport function displaySigFigs(\n f: number,\n sigFigs: number,\n sigDecs: number,\n scientific: boolean,\n): string {\n const s = \"\" + f;\n let order = parseOrder(s);\n let mantissa = parseMantissa(s);\n let positive = parseSign(s);\n let add;\n let decAdd;\n let sigAdd;\n let zeroScientific = false;\n if (f == 0 || mantissa == \"\" || mantissa == \"0\") {\n mantissa = \"\";\n for (let i = 0; i < sigFigs; i++) {\n mantissa += \"0\";\n }\n order = sigFigs + sigDecs;\n if (sigDecs < 0 && -sigDecs >= sigFigs) {\n zeroScientific = true;\n }\n } else {\n decAdd = order - mantissa.length - sigDecs;\n sigAdd = sigFigs - mantissa.length;\n add = Math.min(sigAdd, decAdd);\n if (add < 0) {\n let rounded = round(mantissa, -add);\n if (rounded.length > mantissa.length + add) {\n order++;\n if (decAdd > sigAdd) {\n rounded = round(rounded, 1);\n }\n }\n mantissa = rounded;\n } else if (add > 0) {\n for (let i = 0; i < add; i++) {\n mantissa += \"0\";\n }\n }\n if (mantissa == \"\" || mantissa == \"0\") {\n mantissa = \"0\";\n positive = true;\n order = 1 + sigDecs;\n if (order != 0) {\n zeroScientific = true;\n }\n }\n }\n const useScientific =\n scientific ||\n mantissa.length > 20 ||\n order > 4 ||\n order < -2 ||\n (order - mantissa.length > 0 && trailingZeros(mantissa) > 0) ||\n zeroScientific;\n let returnVal = \"\";\n if (!positive) {\n returnVal += \"-\";\n }\n if (useScientific) {\n returnVal += mantissa.charAt(0);\n if (mantissa.length > 1) {\n returnVal += \".\" + mantissa.substring(1, mantissa.length);\n }\n if (order - 1 != 0) {\n returnVal += \" x 10^\" + (order - 1);\n }\n } else {\n let wholePart = \"\";\n let fractPart = \"\";\n let needDot = true;\n if (order > 0) {\n if (mantissa.length > order) {\n wholePart = mantissa.substring(0, order);\n fractPart = mantissa.substring(order, mantissa.length);\n } else {\n wholePart = mantissa;\n needDot = trailingZeros(mantissa) != 0;\n for (let i = 0; i < order - mantissa.length; i++) {\n wholePart += \"0\";\n }\n }\n } else {\n for (let i = 0; i < -order; i++) {\n fractPart += \"0\";\n }\n fractPart += mantissa;\n }\n returnVal +=\n (wholePart == \"\" ? \"0\" : wholePart) +\n (needDot ? \".\" : \"\") +\n fractPart;\n }\n return returnVal;\n}\n\n/**\n * Count the significant trailing zeros on this object.\n *\n * @return the number of trailing zeros\n */\nfunction trailingZeros(mantissa: string) {\n let zeros = 0;\n for (let i = mantissa.length - 1; i >= 0; i--) {\n const c = mantissa.charAt(i);\n if (c == \"0\") {\n zeros++;\n } else {\n return zeros;\n }\n }\n return zeros;\n}\n\n/**\n * Parse a string representation of a floating point\n * and pull out the sign.\n *\n * @param s the string representation of a floating point.\n * @return true iff this is a positive number\n */\nfunction parseSign(s: string) {\n let beginning = true;\n let seenDot = false;\n let seenSomething = false;\n let zeros = \"\";\n let leadZeros = \"\";\n let all = \"\";\n let decPlaces = 0;\n let totalDecs = 0;\n let pos = true;\n for (let i = 0; i < s.length; i++) {\n const c = s.charAt(i);\n if (c >= \"1\" && c <= \"9\") {\n all += zeros + c;\n zeros = \"\";\n seenSomething = true;\n if (!seenDot) {\n totalDecs++;\n decPlaces++;\n }\n beginning = false;\n } else if (c == \"0\") {\n if (seenDot) {\n if (seenSomething) {\n all += zeros + c;\n zeros = \"\";\n } else {\n leadZeros += c;\n decPlaces--;\n }\n } else {\n totalDecs++;\n if (seenSomething) {\n leadZeros += c;\n decPlaces++;\n zeros += c;\n } else {\n leadZeros += c;\n }\n }\n beginning = false;\n } else if (!seenDot && c == \".\") {\n all += zeros;\n zeros = \"\";\n seenDot = true;\n beginning = false;\n } else if (c == \"e\" || (c == \"E\" && i + 1 < s.length)) {\n const raised = parseInt(s.substring(i + 1, s.length));\n decPlaces += raised;\n totalDecs += raised;\n i = s.length;\n } else if (beginning && (c == \"+\" || c == \"-\")) {\n if (c == \"-\") {\n pos = !pos;\n }\n }\n }\n if (all == \"\") {\n return true;\n }\n return pos;\n}\n\n/**\n * Parse a string representation of a floating point\n * and pull out the mantissa.\n *\n * @param s the string representation of a floating point.\n * @return the mantissa of this number.\n */\nfunction parseMantissa(s: string) {\n let beginning = true;\n let seenDot = false;\n let seenSomething = false;\n let zeros = \"\";\n let leadZeros = \"\";\n let all = \"\";\n let decPlaces = 0;\n let totalDecs = 0;\n let pos = true;\n for (let i = 0; i < s.length; i++) {\n const c = s.charAt(i);\n if (c >= \"1\" && c <= \"9\") {\n all += zeros + c;\n zeros = \"\";\n seenSomething = true;\n if (!seenDot) {\n totalDecs++;\n decPlaces++;\n }\n beginning = false;\n } else if (c == \"0\") {\n if (seenDot) {\n if (seenSomething) {\n all += zeros + c;\n zeros = \"\";\n } else {\n leadZeros += c;\n decPlaces--;\n }\n } else {\n totalDecs++;\n if (seenSomething) {\n leadZeros += c;\n decPlaces++;\n zeros += c;\n } else {\n leadZeros += c;\n }\n }\n beginning = false;\n } else if (!seenDot && c == \".\") {\n all += zeros;\n zeros = \"\";\n seenDot = true;\n beginning = false;\n } else if (c == \"e\" || (c == \"E\" && i + 1 < s.length)) {\n const raised = parseInt(s.substring(i + 1, s.length));\n decPlaces += raised;\n totalDecs += raised;\n i = s.length;\n } else if (beginning && (c == \"+\" || c == \"-\")) {\n if (c == \"-\") {\n pos = !pos;\n }\n }\n }\n if (all == \"\") {\n return leadZeros;\n }\n return all;\n}\n\n/**\n * Parse a string representation of a floating point\n * and pull out the exponent.\n *\n * @param s the string representation of a floating point.\n * @return (integer) the number after the e.\n */\nfunction parseOrder(s: string) {\n let beginning = true;\n let seenDot = false;\n let seenSomething = false;\n let zeros = \"\";\n let leadZeros = \"\";\n let all = \"\";\n let decPlaces = 0;\n let totalDecs = 0;\n let pos = true;\n for (let i = 0; i < s.length; i++) {\n const c = s.charAt(i);\n if (c >= \"1\" && c <= \"9\") {\n all += zeros + c;\n zeros = \"\";\n seenSomething = true;\n if (!seenDot) {\n totalDecs++;\n decPlaces++;\n }\n beginning = false;\n } else if (c == \"0\") {\n if (seenDot) {\n if (seenSomething) {\n all += zeros + c;\n zeros = \"\";\n } else {\n leadZeros += c;\n decPlaces--;\n }\n } else {\n totalDecs++;\n if (seenSomething) {\n leadZeros += c;\n decPlaces++;\n zeros += c;\n } else {\n leadZeros += c;\n }\n }\n beginning = false;\n } else if (!seenDot && c == \".\") {\n all += zeros;\n zeros = \"\";\n seenDot = true;\n beginning = false;\n } else if (c == \"e\" || (c == \"E\" && i + 1 < s.length)) {\n const raised = parseInt(s.substring(i + 1, s.length));\n decPlaces += raised;\n totalDecs += raised;\n i = s.length;\n } else if (beginning && (c == \"+\" || c == \"-\")) {\n if (c == \"-\") {\n pos = !pos;\n }\n }\n }\n if (all == \"\") {\n return totalDecs;\n }\n return decPlaces;\n}\n\n/**\n * Remove the specified number of digits from string by\n * rounding. Proper rounding rules for scientific purposes\n * are followed.\n * This method may cause an extra significant figure\n * to be added to the number. For example, if 999999\n * were rounded, A one would carry over and become\n * a significant figure. Those who call this method\n * should check for this and call round again if needed.\n *\n * @param mantissa A string representing an whole number of arbitrary length.\n * @param digits A number of digits to remove\n * @return A string represted the rounded version of mantissa\n */\nfunction round(mantissa: string, digits: number): string {\n const last = mantissa.length - digits - 1;\n if (last < 0) {\n return \"\";\n }\n if (last >= mantissa.length - 1) {\n return mantissa;\n }\n const nextToLast = mantissa.charAt(last + 1);\n const lastChar = mantissa.charAt(last);\n let roundUp = false;\n if (nextToLast > \"5\") {\n roundUp = true;\n } else if (nextToLast == \"5\") {\n for (let j = last + 2; j < mantissa.length; j++) {\n if (mantissa.charAt(j) != \"0\") {\n roundUp = true;\n }\n }\n // @ts-expect-error - TS2362 - The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.\n if (lastChar % 2 == 1) {\n roundUp = true;\n }\n }\n let result = \"\";\n for (let i = last; i >= 0; i--) {\n const c = mantissa.charAt(i);\n if (roundUp) {\n let nextChar;\n if (c == \"9\") {\n nextChar = \"0\";\n } else {\n switch (c) {\n case \"0\":\n nextChar = \"1\";\n break;\n case \"1\":\n nextChar = \"2\";\n break;\n case \"2\":\n nextChar = \"3\";\n break;\n case \"3\":\n nextChar = \"4\";\n break;\n case \"4\":\n nextChar = \"5\";\n break;\n case \"5\":\n nextChar = \"6\";\n break;\n case \"6\":\n nextChar = \"7\";\n break;\n case \"7\":\n nextChar = \"8\";\n break;\n case \"8\":\n nextChar = \"9\";\n break;\n }\n roundUp = false;\n }\n result = nextChar + result;\n } else {\n result = c + result;\n }\n }\n if (roundUp) {\n result = \"1\" + result;\n }\n return result;\n}\n","import {keys} from \"@khanacademy/wonder-stuff-core\";\n\nimport {getWidgetTypeByWidgetId} from \"../widget-type-utils\";\nimport * as Widgets from \"../widgets\";\n\nimport type {\n PerseusItem,\n PerseusWidgetsMap,\n PerseusRenderer,\n} from \"@khanacademy/perseus-core\";\n\n/**\n * Looks through widgets to identify images that do not have alt text.\n *\n * We pass in the fuller perseusRenderer object to allow for the possibility\n * of expanding to include other img data from content & images in the future.\n *\n * @param {PerseusRenderer} perseusRenderer\n * @returns a stringified list of {widgetId, imageUrl} for imgs that don't have alt text\n */\nfunction getImagesWithoutAltData(perseusRenderer: PerseusRenderer): string {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (!perseusRenderer.widgets) {\n return \"\";\n }\n\n const imgsWithoutAltData: {imgUrl: string; widgetId: string}[] = [];\n\n Object.entries(perseusRenderer.widgets).forEach(([widgetId, widget]) => {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (!widget.options) {\n return;\n }\n\n // Add to imagesWithoutAltData if img alt is missing and\n // image has valid img url data.\n if (\n widget.type === \"image\" &&\n !widget.options.alt &&\n widget.options.backgroundImage?.url\n ) {\n imgsWithoutAltData.push({\n widgetId,\n imgUrl: widget.options.backgroundImage.url,\n });\n }\n });\n\n return JSON.stringify(imgsWithoutAltData);\n}\n\n/* Widgets that have individual answers */\nconst INDIVIDUAL_ANSWER_WIDGETS = [\n \"interactive-graph\",\n \"categorizer\",\n \"grapher\",\n];\n\n/* Widgets that are supported for automatic scoring */\nconst SUPPORTED_WIDGETS = [\n \"radio\",\n \"numeric-input\",\n \"input-number\",\n \"expression\",\n ...INDIVIDUAL_ANSWER_WIDGETS,\n];\n\n/* Verify if the perseus item has supported widgets for automatic scoring */\nexport const isWrongAnswerSupported = (\n widgetIds: Array<string>,\n widgetMap: PerseusWidgetsMap,\n): boolean => {\n return (\n widgetIds.length !== 0 &&\n widgetIds.every((widgetId) =>\n SUPPORTED_WIDGETS.includes(\n // eslint-disable-next-line no-restricted-syntax\n getWidgetTypeByWidgetId(widgetId, widgetMap) as string,\n ),\n )\n );\n};\n\n/* Verify if the widget ID has an individual answer for the coach report view */\nexport const shouldHaveIndividualAnswer = (\n widgetId: string,\n widgetMap: PerseusWidgetsMap,\n): boolean => {\n return INDIVIDUAL_ANSWER_WIDGETS.includes(\n // eslint-disable-next-line no-restricted-syntax\n getWidgetTypeByWidgetId(widgetId, widgetMap) as string,\n );\n};\n\n/* Returns the answer userInput submission for currently supported widgets */\n// TODO (LEMS-1834): Fix userInput any types to be specific\nexport const getAnswerFromUserInput = (widgetType: string, userInput: any) => {\n switch (widgetType) {\n case \"categorizer\":\n return userInput.values;\n case \"input-number\":\n return userInput.currentValue;\n case \"numeric-input\":\n return userInput.currentValue;\n case \"radio\":\n return userInput.selectedChoiceIds;\n }\n return userInput;\n};\n\n/* Returns the correct answer for a given widget ID and Perseus Item */\n// TODO (LEMS-1835): We should fix the resonse type from getWidget to be specific.\n// TODO (LEMS-1836): We should also consider adding the getOneCorrectAnswerFromRubric method to all widgets.\nexport const getCorrectAnswerForWidgetId = (\n widgetId: string,\n itemData: PerseusItem,\n): string | null | undefined => {\n const rubric = itemData.question.widgets[widgetId].options;\n const widgetMap = itemData.question.widgets;\n // eslint-disable-next-line no-restricted-syntax\n const widgetType = getWidgetTypeByWidgetId(widgetId, widgetMap) as string;\n\n const widget = Widgets.getWidgetExport(widgetType);\n\n return widget?.getOneCorrectAnswerFromRubric?.(rubric);\n};\n\n/* Verify if the widget ID exists in the content string of the Perseus Item */\nexport const isWidgetIdInContent = (\n perseusItem: PerseusItem,\n widgetId: string,\n): boolean => {\n // eslint-disable-next-line no-restricted-syntax\n return perseusItem.question.content.indexOf(widgetId as string) !== -1;\n};\n\n/* Return an array of all the widget IDs that exist in the content string of a Perseus Item */\nexport const getValidWidgetIds = (perseusItem: PerseusItem): Array<string> => {\n const {widgets} = perseusItem.question;\n return keys(widgets).filter((id) => isWidgetIdInContent(perseusItem, id));\n};\n\nexport {getImagesWithoutAltData};\n","import {\n generateTestPerseusItem,\n splitPerseusItem,\n} from \"@khanacademy/perseus-core\";\nimport {scorePerseusItem} from \"@khanacademy/perseus-score\";\n\nimport type {\n CategorizerWidget,\n PerseusRenderer,\n PerseusWidgetTypes,\n PerseusScore,\n UserInputMap,\n PerseusItem,\n} from \"@khanacademy/perseus-core\";\n\n/**\n * Thin wrapper around scorePerseusItem for internal testing. Returns the\n * aggregate score; tests that need the per-widget breakdown should call\n * `scorePerseusItem` directly.\n */\nexport function scorePerseusItemTesting(\n perseusRenderData: PerseusRenderer,\n userInputMap: UserInputMap,\n): PerseusScore {\n return scorePerseusItem(perseusRenderData, userInputMap, \"en\");\n}\n\n/**\n * Creates an object with the bare amount\n * of data to be a properly typed InteractiveGraphWidget\n *\n * @returns {InteractiveGraphWidget} skeleton InteractiveGraphWidget for testing\n */\nexport function generateTestCategorizerWidget(): CategorizerWidget {\n return {\n type: \"categorizer\",\n options: {\n items: [],\n categories: [],\n randomizeItems: false,\n values: [],\n },\n };\n}\n\n/**\n * Creates an object with the minimum amount\n * of data to be a properly typed PerseusItem\n * containing answerful information\n *\n * @template T - The widget type extending keyof PerseusWidgetTypes\n * @param {T} widgetType - The type of widget to create, as a string, ex. \"radio\"\n * @param {PerseusWidgetTypes[T][\"options\"]} options - The options for the widget\n * @returns {PerseusItem} skeleton PerseusItem for testing\n */\nexport function getAnswerfulItem<T extends keyof PerseusWidgetTypes>(\n widgetType: T,\n options: PerseusWidgetTypes[T][\"options\"],\n): PerseusItem {\n const widgetName = `${widgetType} 1`;\n const widget = {\n type: widgetType,\n options,\n };\n const widgets = {};\n widgets[widgetName] = widget;\n const question: PerseusRenderer = {\n content: `[[☃ ${widgetName}]]`,\n images: {},\n widgets,\n };\n return generateTestPerseusItem({question});\n}\n\n/**\n * Creates an object with the minimum amount\n * of data to be a properly typed PerseusItem\n * containing answerless information\n *\n * @template T - The widget type extending keyof PerseusWidgetTypes\n * @param {T} widgetType - The type of widget to create, as a string, ex. \"radio\"\n * @param {PerseusWidgetTypes[T][\"options\"]} options - The options for the widget\n * @returns {PerseusItem} skeleton PerseusItem for testing\n */\nexport function getAnswerlessItem<T extends keyof PerseusWidgetTypes>(\n widgetType: T,\n options: PerseusWidgetTypes[T][\"options\"],\n): PerseusItem {\n return splitPerseusItem(getAnswerfulItem(widgetType, options));\n}\n","/**\n * Some helpers for CEDAR logging. CEDAR convention dictates\n * that enum values should be upper case. Ex: for the\n * PerseusWidgetUsedInProblemAttempt CEDAR event, we needed\n * to: get the type and convert that to an enum value.\n */\n\ntype WidgetName =\n | \"blank\"\n | \"categorizer\"\n | \"cs-program\"\n | \"definition\"\n | \"dropdown\"\n | \"explanation\"\n | \"expression\"\n | \"fill-in-the-blank\"\n | \"free-response\"\n | \"graded-group-set\"\n | \"graded-group\"\n | \"grapher\"\n | \"group\"\n | \"iframe\"\n | \"image\"\n | \"input-number\"\n | \"interaction\"\n | \"interactive-graph\"\n | \"label-image\"\n | \"lights-puzzle\" // Deprecated\n | \"matcher\"\n | \"matrix\"\n | \"measurer\"\n | \"molecule-renderer\" // Deprecated\n | \"number-line\"\n | \"numeric-input\"\n | \"orderer\"\n | \"passage\" // Deprecated\n | \"passage-ref\" // Deprecated\n | \"passage-ref-target\" // Deprecated\n | \"phet-simulation\"\n | \"plotter\"\n | \"python-program\"\n | \"reaction-diagram\"\n | \"radio\"\n | \"sequence\" // Deprecated\n | \"simulator\" // Deprecated\n | \"sorter\"\n | \"table\"\n | \"video\";\n\ntype WidgetEnum =\n | \"BLANK\"\n | \"CATEGORIZER\"\n | \"CS_PROGRAM\"\n | \"DEFINITION\"\n | \"DROPDOWN\"\n | \"EXPLANATION\"\n | \"EXPRESSION\"\n | \"FILL_IN_THE_BLANK\"\n | \"FREE_RESPONSE\"\n | \"GRADED_GROUP\"\n | \"GRADED_GROUP_SET\"\n | \"GRAPHER\"\n | \"GROUP\"\n | \"IFRAME\"\n | \"IMAGE\"\n | \"INPUT_NUMBER\"\n | \"INTERACTIVE\"\n | \"INTERACTIVE_GRAPH\"\n | \"LABEL_IMAGE\"\n | \"LIGHTS_PUZZLE\"\n | \"MATCHER\"\n | \"MATRIX\"\n | \"MEASURER\"\n | \"MOLECULE\"\n | \"NUMBER_LINE\"\n | \"NUMERIC_INPUT\"\n | \"ORDERER\"\n | \"PASSAGE\"\n | \"PASSAGE_REF\"\n | \"PASSAGE_REF_TARGET\"\n | \"PHET_SIMULATION\"\n | \"PLOTTER\"\n | \"PYTHON_PROGRAM\"\n | \"REACTION_DIAGRAM\"\n | \"RADIO\"\n | \"SEQUENCE\"\n | \"SIMULATOR\"\n | \"SORTER\"\n | \"TABLE\"\n | \"UNIT\"\n | \"VIDEO\";\n\nconst widgetNameToEnum: Record<WidgetName, WidgetEnum> = {\n blank: \"BLANK\",\n categorizer: \"CATEGORIZER\",\n \"cs-program\": \"CS_PROGRAM\",\n definition: \"DEFINITION\",\n dropdown: \"DROPDOWN\",\n explanation: \"EXPLANATION\",\n expression: \"EXPRESSION\",\n \"fill-in-the-blank\": \"FILL_IN_THE_BLANK\",\n \"free-response\": \"FREE_RESPONSE\",\n \"graded-group-set\": \"GRADED_GROUP_SET\",\n \"graded-group\": \"GRADED_GROUP\",\n grapher: \"GRAPHER\",\n group: \"GROUP\",\n iframe: \"IFRAME\",\n image: \"IMAGE\",\n \"input-number\": \"INPUT_NUMBER\",\n interaction: \"INTERACTIVE\",\n \"interactive-graph\": \"INTERACTIVE_GRAPH\",\n \"label-image\": \"LABEL_IMAGE\",\n \"lights-puzzle\": \"LIGHTS_PUZZLE\",\n matcher: \"MATCHER\",\n matrix: \"MATRIX\",\n measurer: \"MEASURER\",\n \"molecule-renderer\": \"MOLECULE\",\n \"number-line\": \"NUMBER_LINE\",\n \"numeric-input\": \"NUMERIC_INPUT\",\n orderer: \"ORDERER\",\n passage: \"PASSAGE\",\n \"passage-ref\": \"PASSAGE_REF\",\n \"passage-ref-target\": \"PASSAGE_REF_TARGET\",\n \"phet-simulation\": \"PHET_SIMULATION\",\n plotter: \"PLOTTER\",\n \"python-program\": \"PYTHON_PROGRAM\",\n \"reaction-diagram\": \"REACTION_DIAGRAM\",\n radio: \"RADIO\",\n sequence: \"SEQUENCE\",\n simulator: \"SIMULATOR\",\n sorter: \"SORTER\",\n table: \"TABLE\",\n video: \"VIDEO\",\n};\n\nexport function convertWidgetNameToEnum(name: string): WidgetEnum {\n const widgetEnum = widgetNameToEnum[name];\n\n if (!widgetEnum) {\n throw new Error(`Unknown widget name: ${name}`);\n }\n\n return widgetEnum;\n}\n","import PerseusMarkdown from \"../perseus-markdown\";\n\nimport type {PerseusRenderer} from \"@khanacademy/perseus-core\";\n\n/**\n * Extracts widget IDs from a PerseusRenderer in the order they appear in the content.\n * Handles deduplication by only including the first occurrence of each widget ID.\n */\nexport function extractWidgetIds(\n perseusRenderer: PerseusRenderer,\n options?: {inline?: boolean},\n): ReadonlyArray<string> {\n const widgetIds: string[] = [];\n\n // Get content from the perseus renderer\n const content = perseusRenderer.content;\n const inline = options?.inline ?? false;\n\n // Parse the markdown content using the same logic as the renderer\n const parsedMarkdown = inline\n ? PerseusMarkdown.parseInline(content, options)\n : PerseusMarkdown.parse(content, options);\n\n PerseusMarkdown.traverseContent(parsedMarkdown, (node) => {\n if (node.type === \"widget\") {\n if (!widgetIds.includes(node.id)) {\n widgetIds.push(node.id);\n }\n }\n });\n\n return widgetIds;\n}\n","/**\n * Main entry point\n */\n\nexport {default as init} from \"./init\";\n\nexport {ApiOptions} from \"./perseus-api\";\n/** @hidden */\nexport {ClassNames} from \"./perseus-api\";\n\n/** @hidden */\nexport {libVersion} from \"./version\";\n/** @hidden */\nexport {apiVersion} from \"./perseus-version\";\n\n/**\n * Renderers\n */\nexport {default as ArticleRenderer} from \"./article-renderer\";\nexport {default as ServerItemRenderer} from \"./server-item-renderer\";\nexport {default as HintsRenderer} from \"./hints-renderer\";\nexport {default as HintRenderer} from \"./hint-renderer\";\nexport {default as Renderer} from \"./renderer\";\n\n/**\n * Widgets\n */\nexport * as Widgets from \"./widgets\";\n/** @hidden */\nexport {default as widgets} from \"./all-widgets\";\nexport {Expression} from \"./widgets/expression\";\nexport {default as InputNumber} from \"./widgets/input-number\";\nexport {default as NumericInput} from \"./widgets/numeric-input\";\nexport {default as Radio} from \"./widgets/radio\";\nexport {default as Categorizer} from \"./widgets/categorizer\";\n/** @hidden */\nexport {default as InteractiveGraphWidget} from \"./widgets/interactive-graphs/interactive-graph\";\n/** @hidden */\nexport {default as MatrixWidget} from \"./widgets/matrix\";\n/** @hidden */\nexport {default as TableWidget} from \"./widgets/table\";\n/** @hidden */\nexport {default as PlotterWidget} from \"./widgets/plotter\";\n/** @hidden */\nexport {default as GrapherWidget} from \"./widgets/grapher\";\n\n// Some utils in grapher/utils and scoring don't need to be used outside of\n// `perseus`, so only export the stuff that does need to be exposed\nimport {\n DEFAULT_GRAPHER_PROPS,\n chooseType,\n defaultPlotProps,\n getEquationString,\n typeToButton,\n} from \"./widgets/grapher/util\";\n\n/** @hidden */\nexport const GrapherUtil = {\n DEFAULT_GRAPHER_PROPS,\n chooseType,\n defaultPlotProps,\n getEquationString,\n typeToButton,\n};\n\n/**\n * Misc\n */\n\n/** @hidden */\nexport * as components from \"./components\";\n/** @hidden */\nexport {iconChevronDown, iconTrash} from \"./icon-paths\";\n/** @hidden */\nexport {bodyXsmallBold} from \"./styles/global-styles\";\nexport * as Dependencies from \"./dependencies\";\n/** @hidden */\nexport {Log} from \"./logging/log\";\nexport {default as JiptParagraphs} from \"./jipt-paragraphs\";\nexport {default as LoadingContext} from \"./loading-context\";\nexport {default as MathRenderingContext} from \"./math-rendering-context\";\nexport {default as PerseusMarkdown} from \"./perseus-markdown\";\n/** @hidden */\nexport {interactiveSizes} from \"./styles/constants\";\n/** @hidden */\nexport {displaySigFigs} from \"./sigfigs\";\nexport {DependenciesContext} from \"./dependencies\";\n\n// Context for managing i18n\nexport {\n PerseusI18nContextProvider,\n PerseusI18nContext,\n} from \"./components/i18n-context\";\n/** @hidden */\nexport {usePerseusI18n} from \"./components/i18n-context\";\n\n/**\n * Util\n */\nexport {default as Util} from \"./util\";\n/** @hidden */\nexport {default as KhanColors} from \"./util/colors\";\n/** @hidden */\nexport {default as preprocessTex} from \"./util/tex-preprocess\";\nexport {registerAllWidgetsForTesting} from \"./util/register-all-widgets-for-testing\";\n/** @hidden */\nexport {\n containerSizeClass,\n getInteractiveBoxFromSizeClass,\n} from \"./util/sizing-utils\";\n/** @hidden */\nexport {mathOnlyParser} from \"./widgets/interactive-graphs/utils\";\nexport {\n isWrongAnswerSupported,\n shouldHaveIndividualAnswer,\n getCorrectAnswerForWidgetId,\n getAnswerFromUserInput,\n getImagesWithoutAltData,\n} from \"./util/extract-perseus-data\";\n/** @hidden */\nexport {\n isWidgetIdInContent,\n getValidWidgetIds,\n} from \"./util/extract-perseus-data\";\n\nexport {generateTestCategorizerWidget} from \"./util/test-utils\";\nexport {\n getWidgetTypeByWidgetId,\n getWidgetSubTypeByWidgetId,\n} from \"./widget-type-utils\";\n/** @hidden */\nexport {\n contentHasWidgetType,\n getWidgetFromWidgetMap,\n getWidgetsFromWidgetMap,\n} from \"./widget-type-utils\";\nexport {convertWidgetNameToEnum} from \"./util/widget-enum-utils\";\n/** @hidden */\nexport {\n getAbsoluteValueCoords,\n getCircleCoords,\n getExponentialCoords,\n getLogarithmCoords,\n getLineCoords,\n getLinearSystemCoords,\n getPointCoords,\n getPolygonCoords,\n getSegmentCoords,\n getSinusoidCoords,\n getTangentCoords,\n getVectorCoords,\n getQuadraticCoords,\n getAngleCoords,\n} from \"./widgets/interactive-graphs/reducer/initialize-graph-state\";\nexport {\n default as UserInputManager,\n deriveUserInputFromSerializedState,\n} from \"./user-input-manager\";\n\n// These exports are to support shared functionality between Perseus and Graphie2000\n/** @hidden */\nexport {parseDataFromJSONP} from \"./util/graphie-utils\";\nexport type {\n /** @hidden */\n GraphieData,\n /** @hidden */\n GraphieLabel,\n /** @hidden */\n GraphieRange,\n} from \"./util/graphie-utils\";\n/** @hidden */\nexport {extractWidgetIds} from \"./util/extract-widget-ids\";\n\n/**\n * Types\n */\nexport type {ILogger, LogErrorOptions} from \"./logging/log\";\nexport type {ServerItemRenderer as ServerItemRendererComponent} from \"./server-item-renderer\";\nexport type {\n APIOptions,\n /** @hidden */\n APIOptionsWithDefaults,\n /** @hidden */\n ChangeHandler,\n /** @hidden */\n DeviceType,\n /** @hidden */\n DomInsertCheckFn,\n /** @hidden */\n EditorMode,\n /** @hidden */\n FocusPath,\n GenerateUrlArgs,\n /** @hidden */\n GraphieLabelElement,\n /** @hidden */\n ImageDict,\n /** @hidden */\n ImageUploader,\n /** @hidden */\n JiptLabelStore,\n /** @hidden */\n JiptRenderer,\n PerseusDependencies,\n PerseusDependenciesV2,\n /** @hidden */\n VideoData,\n /** @hidden */\n VideoKind,\n /** @hidden */\n WidgetExports,\n /** @hidden */\n SharedRendererProps,\n} from \"./types\";\n/** @hidden */\nexport type {ParsedValue} from \"./util\";\n/** @hidden */\nexport type {Coord} from \"./interactive2/types\";\nexport type {\n RendererPromptJSON,\n WidgetPromptJSON,\n} from \"./widget-ai-utils/prompt-types\";\nexport type {CategorizerPromptJSON} from \"./widget-ai-utils/categorizer/categorizer-ai-utils\";\nexport type {DefinitionPromptJSON} from \"./widget-ai-utils/definition/definition-ai-utils\";\nexport type {DropdownPromptJSON} from \"./widget-ai-utils/dropdown/dropdown-ai-utils\";\nexport type {ExplanationPromptJSON} from \"./widget-ai-utils/explanation/explanation-ai-utils\";\nexport type {ExpressionPromptJSON} from \"./widget-ai-utils/expression/expression-ai-utils\";\nexport type {GradedGroupPromptJSON} from \"./widget-ai-utils/graded-group/graded-group-ai-utils\";\nexport type {GradedGroupSetPromptJSON} from \"./widget-ai-utils/graded-group-set/graded-group-set-ai-utils\";\nexport type {GrapherPromptJSON} from \"./widget-ai-utils/grapher/grapher-ai-utils\";\nexport type {GroupPromptJSON} from \"./widget-ai-utils/group/group-ai-utils\";\nexport type {ImagePromptJSON} from \"./widget-ai-utils/image/image-ai-utils\";\nexport type {InteractiveGraphPromptJSON} from \"./widget-ai-utils/interactive-graph/interactive-graph-ai-utils\";\nexport type {LabelImagePromptJSON} from \"./widget-ai-utils/label-image/label-image-ai-utils\";\nexport type {MatcherPromptJSON} from \"./widget-ai-utils/matcher/matcher-ai-utils\";\nexport type {MatrixPromptJSON} from \"./widget-ai-utils/matrix/matrix-ai-utils\";\nexport type {NumberLinePromptJSON} from \"./widget-ai-utils/number-line/number-line-ai-utils\";\nexport type {NumericInputPromptJSON} from \"./widget-ai-utils/numeric-input/prompt-utils\";\nexport type {OrdererPromptJSON} from \"./widget-ai-utils/orderer/orderer-ai-utils\";\nexport type {RadioPromptJSON} from \"./widget-ai-utils/radio/radio-ai-utils\";\nexport type {SorterPromptJSON} from \"./widget-ai-utils/sorter/sorter-ai-utils\";\nexport type {UnsupportedWidgetPromptJSON} from \"./widget-ai-utils/unsupported-widget\";\n"],"names":["RangeInput","props","value","placeholder","checkValidity","allowPiTruncation","restOfProps","onChange","i","newVal","_jsxs","div","className","_jsx","NumberInput","val","init","Widgets","basicWidgets","extraWidgets","libName","libVersion","addLibraryVersionToPerseusDebug","apiVersion","major","minor","ArticleRenderer","React","Component","componentDidMount","_currentFocus","render","apiOptions","ApiOptions","defaults","isArticle","classes","classNames","ApiClassNames","MOBILE","isMobile","sections","_sections","map","section","sectionIndex","sectionSeed","seed","UserInputManager","widgets","problemNum","userInput","handleUserInput","initializeUserInput","_createElement","Renderer","ref","elem","sectionRenderers","key","keypadElement","onFocusChange","newFocusPath","oldFocusPath","_handleFocusChange","concat","linterContext","PerseusLinter","pushContextStack","legacyPerseusLint","strings","context","DependenciesContext","Provider","dependencies","constructor","_setCurrentFocus","_onRendererBlur","prevFocusPath","didFocusInput","focusedInput","focusPath","inputPaths","getInputPaths","some","inputPath","Util","inputPathsEqual","getDOMNodeForPath","setTimeout","keypadDomNode","getDOMNode","keypadHeight","getBoundingClientRect","height","activate","dismiss","blurPath","blurringFocusPath","blur","Array","isArray","json","getDependencies","JIPT","useJIPT","paragraphs","JiptParagraphs","parseToArray","content","forEach","push","paragraph","contextType","PerseusI18nContext","defaultProps","linterContextDefault","HintRenderer","hint","span","lastHint","lastRendered","pos","totalHints","classnames","css","styles","newHint","lastRenderedNewHint","rendererApiOptions","customKeypad","tabIndex","hintPos","style","display","color","hintProgressColor","rendererRef","images","findExternalWidgets","createRef","getSerializedState","current","StyleSheet","create","marginBlockEnd","sizing","size_240","borderInlineStartColor","semanticColor","core","border","neutral","subtle","borderInlineStartStyle","borderInlineStartWidth","hintBorderWidth","mediaQueries","lgOrSmaller","paddingInlineStart","hintPaddingInlineStart","smOrSmaller","outline","instructive","default","HintsRenderer","_cacheHintImages","UNSAFE_componentWillReceiveProps","nextProps","hintsVisible","setState","isFinalHelpPage","componentDidUpdate","prevProps","prevState","_","isEqual","hints","prevHintsVisible","nextHintsVisible","length","refs","domNode","ReactDOM","findDOMNode","focus","e","getApiOptions","_hintsVisible","state","slice","test","renderer","replace","getAnotherHint","showGetAnotherHint","hintRatioCopy","mobileHintStylesHintsRenderer","mobileHintStylesHintTitle","sharedStyles","responsiveLabel","Button","rel","kind","startIcon","plus","onClick","evt","preventDefault","stopPropagation","_cacheImagesInHint","each","data","src","image","Image","getRealImageUrl","readOnly","times","marginBlockStart","size_640","borderWidth","position","clear","fontWeight","foreground","strong","paddingBlockStart","size_160","paddingBlockEnd","defaultContext","onRendered","isRendered","createContext","ServerItemRenderer","maybeCallOnRendered","componentWillUnmount","blurTimeoutID","clearTimeout","_fullyRendered","assetsLoaded","Object","values","_assetStatuses","every","Boolean","newFocus","prevFocus","questionRenderer","path","questionAreaInputPaths","getNumHints","item","getPromptJSON","getUserInput","getWidgetIds","question","hintsRenderer","contextValue","assetStatuses","setAssetStatus","AssetContext","reviewMode","showSolutions","id","widgetsEmpty","isScorable","undefined","hintsContainer","oldFocus","assetKey","status","marginInlineStart","forwardRef","ServerItemRendererWithRef","LoadingContext","Consumer","displaySigFigs","f","sigFigs","sigDecs","scientific","s","order","parseOrder","mantissa","parseMantissa","positive","parseSign","add","decAdd","sigAdd","zeroScientific","Math","min","rounded","round","useScientific","trailingZeros","returnVal","charAt","substring","wholePart","fractPart","needDot","zeros","c","beginning","seenDot","seenSomething","all","parseInt","leadZeros","decPlaces","totalDecs","raised","digits","last","nextToLast","lastChar","roundUp","j","result","nextChar","getImagesWithoutAltData","perseusRenderer","imgsWithoutAltData","entries","widgetId","widget","options","type","alt","backgroundImage","url","imgUrl","JSON","stringify","INDIVIDUAL_ANSWER_WIDGETS","SUPPORTED_WIDGETS","isWrongAnswerSupported","widgetIds","widgetMap","includes","getWidgetTypeByWidgetId","shouldHaveIndividualAnswer","getAnswerFromUserInput","widgetType","currentValue","selectedChoiceIds","getCorrectAnswerForWidgetId","itemData","rubric","getOneCorrectAnswerFromRubric","isWidgetIdInContent","perseusItem","indexOf","getValidWidgetIds","keys","filter","generateTestCategorizerWidget","items","categories","randomizeItems","widgetNameToEnum","blank","categorizer","definition","dropdown","explanation","expression","grapher","group","iframe","interaction","matcher","matrix","measurer","orderer","passage","plotter","radio","sequence","simulator","sorter","table","video","convertWidgetNameToEnum","name","widgetEnum","Error","extractWidgetIds","inline","parsedMarkdown","PerseusMarkdown","parseInline","parse","traverseContent","node","GrapherUtil","DEFAULT_GRAPHER_PROPS","chooseType","defaultPlotProps","getEquationString","typeToButton"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,SAASA,UAAWC,CAAAA,KAAY,CAC5B,CAAA,KAAM,CACFC,KAAK,CACLC,WAAc,CAAA,CAAC,IAAM,CAAA,IAAA,CAAK,CAC1BC,aAAAA,CAAgB,IAAM,IAAI,CAC1BC,iBAAiB,CACjB,GAAGC,WAAAA,CACN,CAAGL,KAAAA,CAEJ,MAAMM,QAAW,CAACC,CAAc,EAACC,MAC7B,EAAA,CAAA,MAAMP,KAAQD,CAAAA,KAAAA,CAAMC,KAAK,CACzB,GAAIM,CAAM,GAAA,CAAA,CAAG,CACTP,KAAAA,CAAMM,QAAQ,CAAC,CAACE,MAAQP,CAAAA,KAAK,CAAC,CAAA,CAAE,CAAC,EACrC,CAAO,KAAA,CACHD,MAAMM,QAAQ,CAAC,CAACL,KAAK,CAAC,CAAA,CAAE,CAAEO,MAAAA,CAAO,EACrC,CACJ,CAAA,CAEA,OACIC,sBAAA,CAACC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MAAMC,WAAazB,gBAAgB,CAACwB,IAAK,CAAA,CAEzC,GAAI,CAACC,WAAY,CACb,MAAM,IAAIC,KAAAA,CAAM,CAAC,qBAAqB,EAAEF,IAAAA,CAAK,CAAC,CAClD,CAEA,OAAOC,UACX;;ACvIO,SAASE,gBACZlE,CAAAA,eAAgC,CAChCK,OAA4B,CAE5B,CAAA,MAAMW,SAAsB,CAAA,EAAE,CAG9B,MAAMxO,OAAAA,CAAUwN,eAAgBxN,CAAAA,OAAO,CACvC,MAAM2R,MAAS9D,CAAAA,OAAAA,EAAS8D,QAAU,KAGlC,CAAA,MAAMC,cAAiBD,CAAAA,MAAAA,CACjBE,eAAgBC,CAAAA,WAAW,CAAC9R,OAAAA,CAAS6N,SACrCgE,eAAgBE,CAAAA,KAAK,CAAC/R,OAAAA,CAAS6N,OAErCgE,CAAAA,CAAAA,eAAAA,CAAgBG,eAAe,CAACJ,eAAgB,IAACK,EAAAA,CAC7C,GAAIA,IAAAA,CAAKnE,IAAI,GAAK,QAAU,CAAA,CACxB,GAAI,CAACU,SAAAA,CAAUE,QAAQ,CAACuD,IAAKtI,CAAAA,EAAE,CAAG,CAAA,CAC9B6E,UAAUtO,IAAI,CAAC+R,IAAKtI,CAAAA,EAAE,EAC1B,CACJ,CACJ,CAAA,CAAA,CAEA,OAAO6E,SACX;;ACyBO,MAAM0D,YAAc,CACvBC,qBAAAA,CACAC,WACAC,gBACAC,CAAAA,iBAAAA,CACAC,YACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/components/range-input.tsx","../src/init.ts","../src/version.ts","../src/perseus-version.ts","../src/article-renderer.tsx","../src/hint-renderer.tsx","../src/hints-renderer.tsx","../src/loading-context.ts","../src/server-item-renderer.tsx","../src/sigfigs.ts","../src/util/extract-perseus-data.ts","../src/util/test-utils.ts","../src/util/widget-enum-utils.ts","../src/util/extract-widget-ids.ts","../src/index.ts"],"sourcesContent":["import * as React from \"react\";\n\nimport NumberInput from \"./number-input\";\n\nimport type {MathFormat} from \"@khanacademy/perseus-core\";\n\ntype Pair<T> = [T, T];\n\ninterface Props {\n value: Pair<number>;\n /**\n * The number format to use for display before the user edits the value.\n * After the first edit, the format is detected from the input.\n */\n format?: MathFormat | null;\n /**\n * Values to display when the input is empty. If a placeholder value is\n * numeric and finite, it is also emitted via `onChange` when the\n * corresponding input is cleared.\n */\n placeholder?: Pair<number | string | null>;\n /**\n * Called when the user changes the value of the input to a valid number.\n */\n onChange: (value: Pair<number>) => void;\n /**\n * Validates input. If `checkValidity` returns false, the new value will\n * not be emitted via `onChange`, and the input will display an error state.\n */\n checkValidity?: (value: Pair<number>) => boolean;\n /**\n * When true, values that approximate an integer or fraction multiple of\n * pi will be displayed in a format like \"3π\", \"1/2π\", etc.\n */\n allowPiTruncation?: boolean;\n /**\n * Whether the up and down arrow keys should increment/decrement the value.\n */\n useArrowKeys?: boolean;\n /**\n * HTML `id` to apply to the underlying inputs.\n */\n // TODO(benchristel): This `id` prop is a bad way of associating labels\n // with the input. It results in non-unique IDs, and therefore duplicated\n // labels. Each input should have its own accessible label.\n id?: string;\n}\n\n/**\n * A minor abstraction on top of `NumberInput` for ranges\n */\nfunction RangeInput(props: Props) {\n const {\n value,\n placeholder = [null, null],\n checkValidity = () => true,\n allowPiTruncation,\n ...restOfProps\n } = props;\n\n const onChange = (i: number) => (newVal: number) => {\n const value = props.value;\n if (i === 0) {\n props.onChange([newVal, value[1]]);\n } else {\n props.onChange([value[0], newVal]);\n }\n };\n\n return (\n <div className=\"range-input\">\n <NumberInput\n {...restOfProps}\n value={value[0]}\n checkValidity={(val) => checkValidity([val, value[1]])}\n onChange={onChange(0)}\n placeholder={placeholder[0]}\n allowPiTruncation={allowPiTruncation}\n />\n <NumberInput\n {...restOfProps}\n value={value[1]}\n checkValidity={(val) => checkValidity([value[0], val])}\n onChange={onChange(1)}\n placeholder={placeholder[1]}\n allowPiTruncation={allowPiTruncation}\n />\n </div>\n );\n}\n\nexport default RangeInput;\n","import basicWidgets from \"./basic-widgets\";\nimport extraWidgets from \"./extra-widgets\";\nimport * as Widgets from \"./widgets\";\n\n/**\n * This should be called by all clients, specifying whether extra widgets are\n * needed via `loadExtraWidgets`. It is idempotent, so it's not a problem to\n * call it multiple times.\n */\nconst init = function () {\n Widgets.registerWidgets(basicWidgets);\n Widgets.registerWidgets(extraWidgets);\n};\n\nexport default init;\n","// This file is processed by a Rollup plugin (replace) to inject the production\n// version number during the release build.\n// In dev, you'll never see the version number.\n\nimport {addLibraryVersionToPerseusDebug} from \"@khanacademy/perseus-utils\";\n\nconst libName = \"@khanacademy/perseus\";\nexport const libVersion = \"__lib_version__\";\n\naddLibraryVersionToPerseusDebug(libName, libVersion);\n","export const apiVersion = {\n major: 12,\n minor: 0,\n};\n","/**\n * An article renderer. Articles are long-form pieces of content,\n * composed of multiple (Renderer) sections concatenated together.\n */\n\nimport * as PerseusLinter from \"@khanacademy/perseus-linter\";\nimport classNames from \"classnames\";\nimport * as React from \"react\";\n\nimport {PerseusI18nContext} from \"./components/i18n-context\";\nimport {DependenciesContext, getDependencies} from \"./dependencies\";\nimport JiptParagraphs from \"./jipt-paragraphs\";\nimport {ClassNames as ApiClassNames, ApiOptions} from \"./perseus-api\";\nimport Renderer from \"./renderer\";\nimport UserInputManager from \"./user-input-manager\";\nimport Util from \"./util\";\n\nimport type {PerseusDependenciesV2, SharedRendererProps} from \"./types\";\nimport type {KeypadAPI} from \"@khanacademy/math-input\";\nimport type {\n PerseusArticle,\n PerseusRenderer,\n KeypadContextRendererInterface,\n} from \"@khanacademy/perseus-core\";\n\ntype Props = Partial<React.ContextType<typeof DependenciesContext>> &\n SharedRendererProps & {\n json: PerseusArticle;\n legacyPerseusLint?: ReadonlyArray<string>;\n keypadElement?: KeypadAPI | null | undefined;\n dependencies: PerseusDependenciesV2;\n // the seed for deterministic shuffling (randomization)\n seed: number;\n };\n\ntype DefaultProps = {\n apiOptions: Props[\"apiOptions\"];\n linterContext: Props[\"linterContext\"];\n};\n\nclass ArticleRenderer\n extends React.Component<Props>\n implements KeypadContextRendererInterface\n{\n static contextType = PerseusI18nContext;\n declare context: React.ContextType<typeof PerseusI18nContext>;\n\n _currentFocus: any;\n sectionRenderers: Array<Renderer> = [];\n\n static defaultProps: DefaultProps = {\n apiOptions: ApiOptions.defaults,\n linterContext: PerseusLinter.linterContextDefault,\n };\n\n constructor(props: Props) {\n super(props);\n }\n\n componentDidMount() {\n this._currentFocus = null;\n }\n\n _handleFocusChange: (arg1: any, arg2: any) => void = (\n newFocusPath,\n oldFocusPath,\n ) => {\n if (newFocusPath) {\n this._setCurrentFocus(newFocusPath);\n } else {\n this._onRendererBlur(oldFocusPath);\n }\n };\n\n _setCurrentFocus: (arg1: any) => void = (newFocusPath) => {\n const {keypadElement, apiOptions} = this.props;\n const {isMobile} = apiOptions;\n\n const prevFocusPath = this._currentFocus;\n this._currentFocus = newFocusPath;\n\n // Use the section prefix to extract the relevant Renderer's input\n // paths, so as to check whether the focused path represents an\n // input.\n let didFocusInput = false;\n let focusedInput;\n\n if (this._currentFocus) {\n const [sectionIndex, ...focusPath] = this._currentFocus;\n\n const inputPaths =\n this.sectionRenderers[sectionIndex].getInputPaths();\n\n didFocusInput = inputPaths.some((inputPath) => {\n return Util.inputPathsEqual(inputPath, focusPath);\n });\n focusedInput =\n this.sectionRenderers[sectionIndex].getDOMNodeForPath(\n focusPath,\n );\n }\n\n const {onFocusChange} = this.props.apiOptions;\n if (onFocusChange) {\n // Wait for the keypad to mount before getting the height\n setTimeout(() => {\n const keypadDomNode =\n // eslint-disable-next-line no-restricted-syntax\n keypadElement?.getDOMNode() as HTMLElement;\n const keypadHeight =\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n keypadDomNode && didFocusInput\n ? keypadDomNode.getBoundingClientRect().height\n : 0;\n\n onFocusChange(\n this._currentFocus,\n prevFocusPath,\n keypadHeight,\n didFocusInput ? focusedInput : null,\n );\n }, 0);\n }\n\n if (keypadElement && isMobile) {\n if (didFocusInput) {\n keypadElement.activate();\n } else {\n keypadElement.dismiss();\n }\n }\n };\n\n _onRendererBlur: (arg1: any) => void = (blurPath) => {\n const blurringFocusPath = this._currentFocus;\n\n // Failsafe: abort if ID is different, because focus probably happened\n // before blur.\n if (!Util.inputPathsEqual(blurPath, blurringFocusPath)) {\n return;\n }\n\n // Wait until after any new focus events fire this tick before declaring\n // that nothing is focused, since if there were a focus change across\n // sections, we could receive the blur before the focus.\n // TODO(jeff, CP-3128): Use Wonder Blocks Timing API\n setTimeout(() => {\n if (Util.inputPathsEqual(this._currentFocus, blurringFocusPath)) {\n this._setCurrentFocus(null);\n }\n });\n };\n\n blur: () => void = () => {\n if (this._currentFocus) {\n const [sectionIndex, ...inputPath] = this._currentFocus;\n this.sectionRenderers[sectionIndex].blurPath(inputPath);\n }\n };\n\n _sections: () => PerseusRenderer[] = () => {\n const sections = Array.isArray(this.props.json)\n ? this.props.json\n : [this.props.json];\n\n // In JIPT context we split sections to paragraphs in order match the\n // translatable strings found on Crowdin when rendering articles in\n // the WYSIWYG mode for translation. This is needed for the jipt.js\n // integration in order to attribute the rendered strings on Crowdin.\n if (getDependencies().JIPT.useJIPT) {\n const paragraphs: Array<PerseusRenderer> = [];\n\n for (const section of sections) {\n JiptParagraphs.parseToArray(section.content).forEach(\n (paragraph) => {\n paragraphs.push({\n ...section,\n content: paragraph,\n });\n },\n );\n }\n\n return paragraphs;\n }\n\n return sections;\n };\n\n render(): React.ReactNode {\n const apiOptions = {\n ...ApiOptions.defaults,\n ...this.props.apiOptions,\n isArticle: true,\n } as const;\n\n const classes = classNames({\n \"framework-perseus\": true,\n \"perseus-article\": true,\n // NOTE(charlie): For exercises, this is applied outside of Perseus\n // (in khan/frontend).\n [ApiClassNames.MOBILE]: apiOptions.isMobile,\n });\n\n // We're using the index as the key here because we don't have a unique\n // identifier for each section. This should be fine as we never remove\n // or reorder sections.\n const sections = this._sections().map((section, sectionIndex) => {\n const sectionSeed = this.props.seed + sectionIndex;\n\n return (\n <UserInputManager\n key={sectionIndex}\n widgets={section.widgets}\n problemNum={sectionSeed}\n >\n {({userInput, handleUserInput, initializeUserInput}) => (\n <Renderer\n {...section}\n problemNum={sectionSeed}\n userInput={userInput}\n handleUserInput={handleUserInput}\n initializeUserInput={initializeUserInput}\n ref={(elem) => {\n if (elem) {\n this.sectionRenderers[sectionIndex] = elem;\n }\n }}\n key={sectionIndex}\n keypadElement={this.props.keypadElement}\n apiOptions={{\n ...apiOptions,\n onFocusChange: (newFocusPath, oldFocusPath) => {\n // Prefix the paths with the relevant section index,\n // so as to allow us to distinguish between\n // equivalently-named inputs across Renderers.\n this._handleFocusChange(\n newFocusPath &&\n [sectionIndex].concat(\n // eslint-disable-next-line no-restricted-syntax\n newFocusPath as any,\n ),\n oldFocusPath &&\n [sectionIndex].concat(\n // eslint-disable-next-line no-restricted-syntax\n oldFocusPath as any,\n ),\n );\n },\n }}\n linterContext={PerseusLinter.pushContextStack(\n this.props.linterContext,\n \"article\",\n )}\n legacyPerseusLint={this.props.legacyPerseusLint}\n strings={this.context.strings}\n />\n )}\n </UserInputManager>\n );\n });\n\n return (\n <div className={classes}>\n <DependenciesContext.Provider value={this.props.dependencies}>\n {sections}\n </DependenciesContext.Provider>\n </div>\n );\n }\n}\n\nexport default ArticleRenderer;\n","import * as PerseusLinter from \"@khanacademy/perseus-linter\";\nimport {semanticColor, sizing} from \"@khanacademy/wonder-blocks-tokens\";\nimport {StyleSheet, css} from \"aphrodite\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\n\nimport {PerseusI18nContext} from \"./components/i18n-context\";\nimport {DependenciesContext} from \"./dependencies\";\nimport Renderer from \"./renderer\";\nimport {hintBorderWidth, hintPaddingInlineStart} from \"./styles/constants\";\nimport mediaQueries from \"./styles/media-queries\";\nimport UserInputManager from \"./user-input-manager\";\n\nimport type {\n FindWidgetsFunction,\n PerseusDependenciesV2,\n SharedRendererProps,\n} from \"./types\";\nimport type {Hint} from \"@khanacademy/perseus-core\";\n\ntype Props = SharedRendererProps & {\n className?: string;\n hint: Hint;\n /**\n * Whether this is the last hint in the list.\n */\n lastHint?: boolean;\n /**\n * Whether this is the last hint rendered. Compared to lastHint, this is\n * used to tell the HintRenderer if this hint was most recently rendered.\n */\n lastRendered?: boolean;\n /**\n * The position of this hint in the list (ie. Hint 4 of 6 - pos is 4).\n */\n pos: number;\n /**\n * The total number of hints (used to render the `Hint x of y` display)\n */\n totalHints?: number;\n findExternalWidgets?: FindWidgetsFunction;\n dependencies: PerseusDependenciesV2;\n};\n\ntype DefaultProps = {\n linterContext: Props[\"linterContext\"];\n};\n\n/* Renders just a hint preview */\nclass HintRenderer extends React.Component<Props> {\n static contextType = PerseusI18nContext;\n declare context: React.ContextType<typeof PerseusI18nContext>;\n\n rendererRef = React.createRef<Renderer>();\n\n static defaultProps: DefaultProps = {\n linterContext: PerseusLinter.linterContextDefault,\n };\n\n // TODO(LEMS-3185): remove serializedState\n /**\n * @deprecated - do not use in new code.\n */\n getSerializedState: () => void = () => {\n return this.rendererRef.current?.getSerializedState();\n };\n\n render(): React.ReactNode {\n if (this.props.hint.placeholder) {\n // TODO(LEMS-3806): there's probably a better way to do this,\n // but this can't be null because other components\n // reference the ref on HintRenderer\n return <span />;\n }\n\n const {\n apiOptions,\n className,\n hint,\n lastHint,\n lastRendered,\n pos,\n totalHints,\n } = this.props;\n\n const {isMobile} = apiOptions;\n\n const classNames = classnames(\n \"hint\",\n !isMobile && \"perseus-hint-renderer\",\n isMobile && css(styles.newHint),\n isMobile && lastRendered && css(styles.lastRenderedNewHint),\n lastHint && \"last-hint\",\n lastRendered && \"last-rendered\",\n className,\n );\n\n const rendererApiOptions = {\n ...apiOptions,\n customKeypad: false,\n } as const;\n\n return (\n <DependenciesContext.Provider value={this.props.dependencies}>\n {/* @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'number | undefined'. */}\n <div className={classNames} tabIndex=\"-1\">\n {!apiOptions.isMobile && (\n <span className=\"perseus-sr-only\">\n {this.context.strings.hintPos({pos: pos + 1})}\n </span>\n )}\n {!apiOptions.isMobile &&\n totalHints != null &&\n pos != null && (\n <span\n className=\"perseus-hint-label\"\n style={{\n display: \"block\",\n color: apiOptions.hintProgressColor,\n }}\n >\n {`${pos + 1} / ${totalHints}`}\n </span>\n )}\n\n <UserInputManager widgets={hint.widgets} problemNum={0}>\n {({\n userInput,\n handleUserInput,\n initializeUserInput,\n }) => (\n <Renderer\n ref={this.rendererRef}\n userInput={userInput}\n handleUserInput={handleUserInput}\n initializeUserInput={initializeUserInput}\n widgets={hint.widgets}\n content={hint.content || \"\"}\n images={hint.images}\n apiOptions={rendererApiOptions}\n findExternalWidgets={\n this.props.findExternalWidgets\n }\n linterContext={PerseusLinter.pushContextStack(\n this.props.linterContext,\n \"hint\",\n )}\n strings={this.context.strings}\n />\n )}\n </UserInputManager>\n </div>\n </DependenciesContext.Provider>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n newHint: {\n marginBlockEnd: sizing.size_240,\n\n borderInlineStartColor: semanticColor.core.border.neutral.subtle,\n borderInlineStartStyle: \"solid\",\n borderInlineStartWidth: hintBorderWidth,\n\n // Only apply left-padding on tablets, to avoid being flush with the\n // border. On phones, padding is applied internally by the child\n // renderers. Some content on phones that is rendered at full-bleed may\n // end up flush with the border, but that's acceptable for now.\n [mediaQueries.lgOrSmaller]: {\n paddingInlineStart: hintPaddingInlineStart,\n },\n [mediaQueries.smOrSmaller]: {\n paddingInlineStart: 0,\n },\n\n \":focus\": {\n outline: \"none\",\n },\n },\n\n lastRenderedNewHint: {\n marginBlockEnd: 0,\n borderInlineStartColor: semanticColor.core.border.instructive.default,\n },\n});\n\nexport default HintRenderer;\n","import * as PerseusLinter from \"@khanacademy/perseus-linter\";\nimport Button from \"@khanacademy/wonder-blocks-button\";\nimport {semanticColor, sizing} from \"@khanacademy/wonder-blocks-tokens\";\nimport plus from \"@phosphor-icons/core/regular/plus.svg\";\nimport {StyleSheet, css} from \"aphrodite\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport _ from \"underscore\";\n\nimport {PerseusI18nContext} from \"./components/i18n-context\";\nimport HintRenderer from \"./hint-renderer\";\nimport {ApiOptions} from \"./perseus-api\";\nimport {hintBorderWidth, hintPaddingInlineStart} from \"./styles/constants\";\nimport mediaQueries from \"./styles/media-queries\";\nimport sharedStyles from \"./styles/shared\";\nimport Util from \"./util\";\n\nimport type Renderer from \"./renderer\";\nimport type {APIOptionsWithDefaults, PerseusDependenciesV2} from \"./types\";\nimport type {Hint} from \"@khanacademy/perseus-core\";\nimport type {PropsFor} from \"@khanacademy/wonder-blocks-core\";\n\ntype Props = PropsFor<typeof Renderer> & {\n className?: string;\n hints: Hint[];\n hintsVisible?: number;\n dependencies: PerseusDependenciesV2;\n};\n\ntype DefaultProps = {\n linterContext: Props[\"linterContext\"];\n};\n\ntype State = {\n isFinalHelpPage: boolean;\n};\n\nclass HintsRenderer extends React.Component<Props, State> {\n static contextType = PerseusI18nContext;\n declare context: React.ContextType<typeof PerseusI18nContext>;\n\n static defaultProps: DefaultProps = {\n linterContext: PerseusLinter.linterContextDefault,\n };\n\n // The isFinalHelpPage property determines if the user has requested help\n // after answering an exercise question incorrectly, which differs from\n // the case when the user is requesting successive hints. In the case\n // where isFinalHelpPage property is true, we want to display all hints.\n // We know the user is on the final help page when the hintsVisible\n // property jumps from 0 to the total number of hints.\n state: any = {isFinalHelpPage: false};\n\n componentDidMount() {\n this._cacheHintImages();\n }\n\n UNSAFE_componentWillReceiveProps(nextProps: Props) {\n // @ts-expect-error - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.\n if (nextProps.hintsVisible - this.props.hintsVisible > 1) {\n this.setState({isFinalHelpPage: true});\n }\n }\n\n componentDidUpdate(prevProps: Props, prevState: State) {\n if (\n !_.isEqual(prevProps.hints, this.props.hints) ||\n prevProps.hintsVisible !== this.props.hintsVisible\n ) {\n this._cacheHintImages();\n }\n\n // Force number to make TypeScript happy\n const prevHintsVisible = prevProps.hintsVisible || 0;\n const nextHintsVisible = this.props.hintsVisible || 0;\n\n // When a new hint is displayed we immediately focus it\n // (keeping within the boundaries of hint count)\n if (\n prevHintsVisible < nextHintsVisible &&\n nextHintsVisible <= this.props.hints.length &&\n nextHintsVisible >= 0\n ) {\n const pos = nextHintsVisible - 1;\n const hint = this.props.hints[pos];\n\n // Skip focusing placeholder hints - they don't render focusable content\n if (hint?.placeholder) {\n return;\n }\n\n try {\n const ref = this.refs[\"hintRenderer\" + pos];\n\n // Ensure the ref exists before trying to find its DOM node\n if (ref == null) {\n return;\n }\n\n // eslint-disable-next-line no-restricted-syntax\n const domNode = ReactDOM.findDOMNode(ref) as HTMLElement | null;\n\n // Only focus if we have a valid DOM node that supports focus\n if (domNode && typeof domNode.focus === \"function\") {\n domNode.focus();\n }\n } catch (e) {\n // Silently fail if we can't focus the hint (e.g., ref not ready,\n // DOM node doesn't exist, etc.)\n // This can happen with placeholder hints or timing issues\n }\n }\n }\n\n _hintsVisible: () => number = () => {\n if (this.props.hintsVisible == null || this.props.hintsVisible === -1) {\n return this.props.hints.length;\n }\n return this.props.hintsVisible;\n };\n\n _cacheImagesInHint: (arg1: any) => void = (hint) => {\n _.each(hint.images, (data, src) => {\n const image = new Image();\n image.src = Util.getRealImageUrl(src);\n });\n };\n\n _cacheHintImages: () => any = () => {\n // Only cache images in the first hint at the start. When hints are\n // taken, cache images in the rest of the hints\n if (this._hintsVisible() > 0) {\n _.each(this.props.hints, this._cacheImagesInHint);\n } else if (this.props.hints.length > 0) {\n this._cacheImagesInHint(this.props.hints[0]);\n }\n };\n\n getApiOptions: () => APIOptionsWithDefaults = () => {\n // When an item is answered correctly, the entire exercise is set to\n // `readOnly = true` so that the user cannot switch answers. However, this\n // makes hyperlinks in hints unclickable. Thus, we always set readOnly to be\n // false in hints.\n return {\n ...ApiOptions.defaults,\n ...this.props.apiOptions,\n readOnly: false,\n };\n };\n\n // TODO(LEMS-3185): remove serializedState\n /**\n * @deprecated - do not use in new code.\n */\n getSerializedState: () => any = () => {\n return _.times(this._hintsVisible(), (i) => {\n // @ts-expect-error - TS2339 - Property 'getSerializedState' does not exist on type 'ReactInstance'.\n return this.refs[\"hintRenderer\" + i].getSerializedState();\n });\n };\n\n render(): React.ReactNode {\n const apiOptions = this.getApiOptions();\n const hintsVisible = this._hintsVisible();\n const hints: Array<\n React.ReactElement<React.ComponentProps<typeof HintRenderer>>\n > = [];\n const isFinalHelpPage = this.state.isFinalHelpPage;\n this.props.hints.slice(0, hintsVisible).forEach((hint, i) => {\n const lastHint =\n i === this.props.hints.length - 1 && !/\\*\\*/.test(hint.content);\n const lastRendered = i === hintsVisible - 1;\n\n const renderer = (\n <HintRenderer\n dependencies={this.props.dependencies}\n lastHint={lastHint}\n lastRendered={lastRendered}\n hint={hint}\n pos={i}\n totalHints={this.props.hints.length}\n ref={\"hintRenderer\" + i}\n key={\"hintRenderer\" + i}\n apiOptions={apiOptions}\n findExternalWidgets={this.props.findExternalWidgets}\n linterContext={PerseusLinter.pushContextStack(\n this.props.linterContext,\n \"hints[\" + i + \"]\",\n )}\n />\n );\n\n if (isFinalHelpPage) {\n hints.push(renderer);\n } else {\n if (hint.replace && hints.length > 0) {\n hints[hints.length - 1] = renderer;\n } else {\n hints.push(renderer);\n }\n }\n });\n\n const {getAnotherHint} = apiOptions;\n\n const showGetAnotherHint =\n getAnotherHint &&\n hintsVisible > 0 &&\n hintsVisible < this.props.hints.length;\n const hintRatioCopy = `(${hintsVisible}/${this.props.hints.length})`;\n\n const classNames = classnames(\n this.props.className,\n apiOptions.isMobile &&\n hintsVisible > 0 &&\n css(styles.mobileHintStylesHintsRenderer),\n );\n\n return (\n <div className={classNames}>\n {apiOptions.isMobile && hintsVisible > 0 && (\n <div\n className={css(\n styles.mobileHintStylesHintTitle,\n sharedStyles.responsiveLabel,\n )}\n >\n {this.context.strings.hints}\n </div>\n )}\n {hints}\n {showGetAnotherHint && (\n <Button\n rel=\"button\"\n kind=\"tertiary\"\n startIcon={plus}\n onClick={(evt) => {\n evt.preventDefault();\n evt.stopPropagation();\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (getAnotherHint) {\n getAnotherHint();\n }\n }}\n >\n {this.context.strings.getAnotherHint +\n \" \" +\n hintRatioCopy}\n </Button>\n )}\n </div>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n mobileHintStylesHintsRenderer: {\n marginBlockStart: sizing.size_640,\n border: `solid ${semanticColor.core.border.neutral.subtle}`,\n borderWidth: \"1px 0 0 0\",\n\n position: \"relative\",\n \":before\": {\n content: '\"\"',\n display: \"table\",\n clear: \"both\",\n },\n \":after\": {\n content: '\"\"',\n display: \"table\",\n clear: \"both\",\n },\n },\n\n mobileHintStylesHintTitle: {\n fontWeight: \"bold\",\n color: semanticColor.core.foreground.neutral.strong,\n\n paddingBlockStart: sizing.size_160,\n paddingBlockEnd: sizing.size_240,\n\n [mediaQueries.lgOrSmaller]: {\n paddingInlineStart: 0,\n },\n [mediaQueries.smOrSmaller]: {\n // On phones, ensure that the button is aligned with the hint body\n // content.\n paddingInlineStart: `calc(${hintPaddingInlineStart} + ${hintBorderWidth})`,\n },\n },\n});\n\nexport default HintsRenderer;\n","/**\n * A React context for signaling when all of the components in a Perseus\n * renderer is fully rendered. This means that all images and math have\n * finished loading/rendering.\n *\n * Currently only used by ServerItemRender to indicate when the question\n * renderer is fully rendered.\n */\nimport * as React from \"react\";\n\ntype Context = {\n onRendered: (isRendered: boolean) => void;\n};\n\nconst defaultContext: Context = {\n onRendered: (isRendered: boolean) => {},\n};\n\nconst context: React.Context<Context> = React.createContext(defaultContext);\n\nexport default context;\n","import * as PerseusLinter from \"@khanacademy/perseus-linter\";\nimport {StyleSheet, css} from \"aphrodite\";\n/**\n * The main item (aka Exercise) renderer in Perseus. This component renders its\n * question renderer and hints renderer using standard React practices (an\n * earlier ItemRenderer component used to use jQuery and ReactDOM.render()ing\n * to render into elements it didn't own.\n *\n * This component is compatible with server-rendering of a perseus exercise.\n */\nimport * as React from \"react\";\nimport _ from \"underscore\";\n\nimport AssetContext from \"./asset-context\";\nimport {PerseusI18nContext} from \"./components/i18n-context\";\nimport {DependenciesContext} from \"./dependencies\";\nimport HintsRenderer from \"./hints-renderer\";\nimport LoadingContext from \"./loading-context\";\nimport {ApiOptions} from \"./perseus-api\";\nimport Renderer from \"./renderer\";\nimport UserInputManager from \"./user-input-manager\";\nimport Util from \"./util\";\n\nimport type {\n FocusPath,\n PerseusDependenciesV2,\n SharedRendererProps,\n} from \"./types\";\nimport type {\n GetPromptJSONInterface,\n RendererPromptJSON,\n} from \"./widget-ai-utils/prompt-types\";\nimport type {KeypadAPI} from \"@khanacademy/math-input\";\nimport type {\n PerseusItem,\n ShowSolutions,\n KeypadContextRendererInterface,\n RendererInterface,\n UserInputMap,\n} from \"@khanacademy/perseus-core\";\nimport type {PropsFor} from \"@khanacademy/wonder-blocks-core\";\n\ntype OwnProps = {\n hintsVisible?: number;\n item: PerseusItem;\n problemNum?: number;\n reviewMode?: boolean;\n keypadElement?: KeypadAPI | null | undefined;\n dependencies: PerseusDependenciesV2;\n showSolutions?: ShowSolutions;\n};\n\ntype HOCProps = {\n onRendered: (isRendered: boolean) => void;\n};\n\ntype Props = SharedRendererProps & OwnProps & HOCProps;\n\ntype DefaultProps = Required<\n Pick<Props, \"apiOptions\" | \"onRendered\" | \"linterContext\">\n>;\n\n/**\n * @deprecated and likely a very broken API\n * [LEMS-3185] do not trust serializedState\n */\ntype SerializedState = {\n question: any;\n hints: any;\n};\n\nexport class ServerItemRenderer\n extends React.Component<Props>\n implements\n RendererInterface,\n KeypadContextRendererInterface,\n GetPromptJSONInterface\n{\n static contextType = PerseusI18nContext;\n declare context: React.ContextType<typeof PerseusI18nContext>;\n\n // @ts-expect-error - TS2564 - Property 'questionRenderer' has no initializer and is not definitely assigned in the constructor.\n questionRenderer: Renderer;\n hintsRenderer: any;\n _currentFocus: FocusPath;\n _fullyRendered: boolean;\n /**\n * Tracks whether each asset rendered below us (images, math, anything else\n * that takes extra passes to settle) has finished rendering.\n *\n * This is deliberately not React state: assets register themselves in\n * their constructors, while we're still rendering, and a state update\n * from there isn't visible to us until a later render pass — by which point we'd\n * already have called `onRendered()` under the assumption\n * there were no assets to wait for.\n */\n _assetStatuses: {[assetKey: string]: boolean};\n blurTimeoutID: number | null | undefined;\n userInput: UserInputMap;\n\n static defaultProps: DefaultProps = {\n // eslint-disable-next-line no-restricted-syntax\n apiOptions: {} as any, // a deep default is done in `this.update()`\n linterContext: PerseusLinter.linterContextDefault,\n onRendered: (isRendered: boolean) => {},\n };\n\n constructor(props: Props) {\n super(props);\n\n this._assetStatuses = {};\n this._fullyRendered = false;\n this.userInput = {};\n }\n\n componentDidMount() {\n this._currentFocus = null;\n\n // In cases where we are rendering content that doesn't have any assets\n // (things that are async loaded/rendered, such as images or TeX), we\n // want to ensure that we fire the onRendered callback at least once.\n // Assets register themselves in their constructors, so by the time we\n // mount they're all in _assetStatuses (unloaded) and we can tell\n // whether there's anything to wait for.\n this.maybeCallOnRendered();\n }\n\n componentWillUnmount() {\n if (this.blurTimeoutID != null) {\n // TODO(jeff, CP-3128): Use Wonder Blocks Timing API.\n clearTimeout(this.blurTimeoutID);\n this.blurTimeoutID = null;\n }\n }\n\n /**\n * Reports that we've finished rendering, if every asset has settled.\n *\n * Called once we've mounted (to cover content with no assets at all) and\n * again on every status change, so it doesn't depend on a render pass\n * happening at the right moment. Only ever reports once.\n */\n maybeCallOnRendered() {\n if (!this._fullyRendered) {\n const assetsLoaded = Object.values(this._assetStatuses).every(\n Boolean,\n );\n\n if (assetsLoaded) {\n this._fullyRendered = true;\n this.props.onRendered(true);\n }\n }\n }\n\n _handleFocusChange: (newFocus: FocusPath, oldFocus: FocusPath) => void = (\n newFocus: FocusPath,\n oldFocus: FocusPath,\n ) => {\n if (newFocus != null) {\n this._setCurrentFocus(newFocus);\n } else {\n this._onRendererBlur(oldFocus);\n }\n };\n\n // Sets the current focus path and element and\n // send an onChangeFocus event back to our parent.\n _setCurrentFocus(newFocus: FocusPath) {\n const {\n apiOptions: {isMobile, onFocusChange},\n keypadElement,\n } = this.props;\n\n // By the time this happens, newFocus cannot be a prefix of\n // prevFocused, since we must have either been called from\n // an onFocusChange within a renderer, which is only called when\n // this is not a prefix, or between the question and answer areas,\n // which can never prefix each other.\n const prevFocus = this._currentFocus;\n this._currentFocus = newFocus;\n\n // Determine whether the newly focused path represents an input.\n const inputPaths = this.getInputPaths();\n const didFocusInput =\n this._currentFocus &&\n inputPaths.some((inputPath) => {\n return Util.inputPathsEqual(inputPath, this._currentFocus);\n });\n\n if (onFocusChange != null) {\n // Wait for the keypad to mount before getting the height\n setTimeout(() => {\n // First, calculate the current keypad height\n const keypadDomNode: HTMLElement =\n // eslint-disable-next-line no-restricted-syntax\n keypadElement?.getDOMNode() as HTMLElement;\n const keypadHeight =\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n keypadDomNode && didFocusInput\n ? keypadDomNode.getBoundingClientRect().height\n : 0;\n\n // Then call the callback\n onFocusChange(\n this._currentFocus,\n prevFocus,\n keypadHeight,\n // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.\n didFocusInput &&\n this.questionRenderer.getDOMNodeForPath(newFocus),\n );\n }, 0);\n }\n\n if (keypadElement && isMobile) {\n if (didFocusInput) {\n keypadElement.activate();\n } else {\n keypadElement.dismiss();\n }\n }\n }\n\n _onRendererBlur(blurPath: FocusPath) {\n const blurringFocusPath = this._currentFocus;\n\n // Failsafe: abort if ID is different, because focus probably happened\n // before blur\n if (!_.isEqual(blurPath, blurringFocusPath)) {\n return;\n }\n\n // Wait until after any new focus events fire this tick before\n // declaring that nothing is focused.\n // If a different widget was focused, we'll see an onBlur event\n // now, but then an onFocus event on a different element before\n // this callback is executed\n // TODO(jeff, CP-3128): Use Wonder Blocks Timing API.\n // @ts-expect-error - TS2322 - Type 'Timeout' is not assignable to type 'number'.\n this.blurTimeoutID = setTimeout(() => {\n if (_.isEqual(this._currentFocus, blurringFocusPath)) {\n this._setCurrentFocus(null);\n }\n }, 0);\n }\n\n focusPath(path: FocusPath): void {\n return this.questionRenderer.focusPath(path);\n }\n\n blurPath(path: FocusPath): void {\n return this.questionRenderer.blurPath(path);\n }\n\n getDOMNodeForPath(path: FocusPath): Element | Text | null | undefined {\n return this.questionRenderer.getDOMNodeForPath(path);\n }\n\n getInputPaths(): ReadonlyArray<FocusPath> {\n const questionAreaInputPaths = this.questionRenderer.getInputPaths();\n return questionAreaInputPaths;\n }\n\n focus(): boolean | null | undefined {\n return this.questionRenderer.focus();\n }\n\n blur(): void {\n if (this._currentFocus) {\n this.blurPath(this._currentFocus);\n }\n }\n\n getNumHints(): number {\n return this.props.item.hints.length;\n }\n\n getPromptJSON(): RendererPromptJSON {\n return this.questionRenderer.getPromptJSON();\n }\n\n /**\n * Returns an object of the widget `.getUserInput()` results\n */\n getUserInput(): UserInputMap {\n return this.userInput;\n }\n\n /**\n * Returns an array of all widget IDs in the order they occur in\n * the question content.\n */\n getWidgetIds(): ReadonlyArray<string> {\n return this.questionRenderer.getWidgetIds();\n }\n\n /**\n * Get a representation of the current state of the item.\n */\n // TODO(LEMS-3185): remove serializedState\n /**\n * @deprecated - do not use in new code.\n */\n getSerializedState(): SerializedState {\n return {\n question: this.questionRenderer.getSerializedState(),\n hints: this.hintsRenderer.getSerializedState(),\n };\n }\n\n // This must be pre-bound otherwise SvgImage's shouldComponentUpdate\n // won't behave correctly and we'll get an infinite loop.\n setAssetStatus: (assetKey: string, status: boolean) => void = (\n assetKey,\n status,\n ) => {\n this._assetStatuses[assetKey] = status;\n this.maybeCallOnRendered();\n };\n\n render(): React.ReactNode {\n const apiOptions = {\n ...ApiOptions.defaults,\n ...this.props.apiOptions,\n onFocusChange: this._handleFocusChange,\n } as const;\n\n const contextValue = {\n assetStatuses: this._assetStatuses,\n setAssetStatus: this.setAssetStatus,\n } as const;\n\n const questionRenderer = (\n <AssetContext.Provider value={contextValue}>\n <UserInputManager\n widgets={this.props.item.question.widgets}\n problemNum={this.props.problemNum ?? 0}\n >\n {({userInput, handleUserInput, initializeUserInput}) => {\n this.userInput = userInput;\n return (\n <Renderer\n keypadElement={this.props.keypadElement}\n problemNum={this.props.problemNum}\n apiOptions={apiOptions}\n reviewMode={this.props.reviewMode}\n showSolutions={this.props.showSolutions}\n ref={(elem) => {\n if (elem != null) {\n this.questionRenderer = elem;\n }\n }}\n content={this.props.item.question.content}\n widgets={this.props.item.question.widgets}\n images={this.props.item.question.images}\n linterContext={PerseusLinter.pushContextStack(\n this.props.linterContext,\n \"question\",\n )}\n strings={this.context.strings}\n {...this.props.dependencies}\n userInput={userInput}\n handleUserInput={(\n id,\n userInput,\n widgetsEmpty,\n ) => {\n handleUserInput(\n id,\n userInput,\n widgetsEmpty,\n );\n }}\n initializeUserInput={initializeUserInput}\n isScorable\n />\n );\n }}\n </UserInputManager>\n </AssetContext.Provider>\n );\n\n const hintsRenderer = (\n <HintsRenderer\n dependencies={this.props.dependencies}\n hints={this.props.item.hints}\n hintsVisible={this.props.hintsVisible}\n apiOptions={apiOptions}\n ref={(elem) => (this.hintsRenderer = elem)}\n linterContext={PerseusLinter.pushContextStack(\n this.props.linterContext,\n \"hints\",\n )}\n strings={this.context.strings}\n />\n );\n\n return (\n <DependenciesContext.Provider value={this.props.dependencies}>\n <div>\n <div>{questionRenderer}</div>\n <div\n className={\n // Avoid adding any horizontal padding when applying the\n // mobile hint styles, which are flush to the left.\n // NOTE(charlie): We may still want to apply this\n // padding for desktop exercises.\n apiOptions.isMobile\n ? undefined\n : css(styles.hintsContainer)\n }\n >\n {hintsRenderer}\n </div>\n </div>\n </DependenciesContext.Provider>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n hintsContainer: {\n marginInlineStart: 50,\n },\n});\n\nexport default React.forwardRef<\n ServerItemRenderer,\n Omit<PropsFor<typeof ServerItemRenderer>, \"onRendered\">\n>(function ServerItemRendererWithRef(props, ref) {\n return (\n <LoadingContext.Consumer>\n {({onRendered}) => (\n <ServerItemRenderer\n {...props}\n onRendered={onRendered}\n ref={ref}\n />\n )}\n </LoadingContext.Consumer>\n );\n});\n","/* eslint-disable eqeqeq, @typescript-eslint/no-unused-vars */\n/*\n * A class for formatting number to significant digits.\n * Copyright (C) 2001 Stephen Ostermiller\n * http://ostermiller.org/contact.pl?regarding?JavaScript+Significant+Figures\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n */\n\n/**\n * Format a floating point for display using the specified\n * number of significant figures and least significant decimal.\n * Scientific notation may used by this method if this\n * object is very small, very large, has many significant\n * figures, or the number of significant figures would be\n * ambiguous in the output if scientific notation were not\n * used.\n *\n * @param f A floating point number that should be displayed\n * @param sigFigs desired number of significant figures (integer).\n * @param sigDecs the least significant decimal place (integer).\n * @param scientific true iff scientific notation should always be used.\n * @return a string of this object formatted correctly.\n */\nexport function displaySigFigs(\n f: number,\n sigFigs: number,\n sigDecs: number,\n scientific: boolean,\n): string {\n const s = \"\" + f;\n let order = parseOrder(s);\n let mantissa = parseMantissa(s);\n let positive = parseSign(s);\n let add;\n let decAdd;\n let sigAdd;\n let zeroScientific = false;\n if (f == 0 || mantissa == \"\" || mantissa == \"0\") {\n mantissa = \"\";\n for (let i = 0; i < sigFigs; i++) {\n mantissa += \"0\";\n }\n order = sigFigs + sigDecs;\n if (sigDecs < 0 && -sigDecs >= sigFigs) {\n zeroScientific = true;\n }\n } else {\n decAdd = order - mantissa.length - sigDecs;\n sigAdd = sigFigs - mantissa.length;\n add = Math.min(sigAdd, decAdd);\n if (add < 0) {\n let rounded = round(mantissa, -add);\n if (rounded.length > mantissa.length + add) {\n order++;\n if (decAdd > sigAdd) {\n rounded = round(rounded, 1);\n }\n }\n mantissa = rounded;\n } else if (add > 0) {\n for (let i = 0; i < add; i++) {\n mantissa += \"0\";\n }\n }\n if (mantissa == \"\" || mantissa == \"0\") {\n mantissa = \"0\";\n positive = true;\n order = 1 + sigDecs;\n if (order != 0) {\n zeroScientific = true;\n }\n }\n }\n const useScientific =\n scientific ||\n mantissa.length > 20 ||\n order > 4 ||\n order < -2 ||\n (order - mantissa.length > 0 && trailingZeros(mantissa) > 0) ||\n zeroScientific;\n let returnVal = \"\";\n if (!positive) {\n returnVal += \"-\";\n }\n if (useScientific) {\n returnVal += mantissa.charAt(0);\n if (mantissa.length > 1) {\n returnVal += \".\" + mantissa.substring(1, mantissa.length);\n }\n if (order - 1 != 0) {\n returnVal += \" x 10^\" + (order - 1);\n }\n } else {\n let wholePart = \"\";\n let fractPart = \"\";\n let needDot = true;\n if (order > 0) {\n if (mantissa.length > order) {\n wholePart = mantissa.substring(0, order);\n fractPart = mantissa.substring(order, mantissa.length);\n } else {\n wholePart = mantissa;\n needDot = trailingZeros(mantissa) != 0;\n for (let i = 0; i < order - mantissa.length; i++) {\n wholePart += \"0\";\n }\n }\n } else {\n for (let i = 0; i < -order; i++) {\n fractPart += \"0\";\n }\n fractPart += mantissa;\n }\n returnVal +=\n (wholePart == \"\" ? \"0\" : wholePart) +\n (needDot ? \".\" : \"\") +\n fractPart;\n }\n return returnVal;\n}\n\n/**\n * Count the significant trailing zeros on this object.\n *\n * @return the number of trailing zeros\n */\nfunction trailingZeros(mantissa: string) {\n let zeros = 0;\n for (let i = mantissa.length - 1; i >= 0; i--) {\n const c = mantissa.charAt(i);\n if (c == \"0\") {\n zeros++;\n } else {\n return zeros;\n }\n }\n return zeros;\n}\n\n/**\n * Parse a string representation of a floating point\n * and pull out the sign.\n *\n * @param s the string representation of a floating point.\n * @return true iff this is a positive number\n */\nfunction parseSign(s: string) {\n let beginning = true;\n let seenDot = false;\n let seenSomething = false;\n let zeros = \"\";\n let leadZeros = \"\";\n let all = \"\";\n let decPlaces = 0;\n let totalDecs = 0;\n let pos = true;\n for (let i = 0; i < s.length; i++) {\n const c = s.charAt(i);\n if (c >= \"1\" && c <= \"9\") {\n all += zeros + c;\n zeros = \"\";\n seenSomething = true;\n if (!seenDot) {\n totalDecs++;\n decPlaces++;\n }\n beginning = false;\n } else if (c == \"0\") {\n if (seenDot) {\n if (seenSomething) {\n all += zeros + c;\n zeros = \"\";\n } else {\n leadZeros += c;\n decPlaces--;\n }\n } else {\n totalDecs++;\n if (seenSomething) {\n leadZeros += c;\n decPlaces++;\n zeros += c;\n } else {\n leadZeros += c;\n }\n }\n beginning = false;\n } else if (!seenDot && c == \".\") {\n all += zeros;\n zeros = \"\";\n seenDot = true;\n beginning = false;\n } else if (c == \"e\" || (c == \"E\" && i + 1 < s.length)) {\n const raised = parseInt(s.substring(i + 1, s.length));\n decPlaces += raised;\n totalDecs += raised;\n i = s.length;\n } else if (beginning && (c == \"+\" || c == \"-\")) {\n if (c == \"-\") {\n pos = !pos;\n }\n }\n }\n if (all == \"\") {\n return true;\n }\n return pos;\n}\n\n/**\n * Parse a string representation of a floating point\n * and pull out the mantissa.\n *\n * @param s the string representation of a floating point.\n * @return the mantissa of this number.\n */\nfunction parseMantissa(s: string) {\n let beginning = true;\n let seenDot = false;\n let seenSomething = false;\n let zeros = \"\";\n let leadZeros = \"\";\n let all = \"\";\n let decPlaces = 0;\n let totalDecs = 0;\n let pos = true;\n for (let i = 0; i < s.length; i++) {\n const c = s.charAt(i);\n if (c >= \"1\" && c <= \"9\") {\n all += zeros + c;\n zeros = \"\";\n seenSomething = true;\n if (!seenDot) {\n totalDecs++;\n decPlaces++;\n }\n beginning = false;\n } else if (c == \"0\") {\n if (seenDot) {\n if (seenSomething) {\n all += zeros + c;\n zeros = \"\";\n } else {\n leadZeros += c;\n decPlaces--;\n }\n } else {\n totalDecs++;\n if (seenSomething) {\n leadZeros += c;\n decPlaces++;\n zeros += c;\n } else {\n leadZeros += c;\n }\n }\n beginning = false;\n } else if (!seenDot && c == \".\") {\n all += zeros;\n zeros = \"\";\n seenDot = true;\n beginning = false;\n } else if (c == \"e\" || (c == \"E\" && i + 1 < s.length)) {\n const raised = parseInt(s.substring(i + 1, s.length));\n decPlaces += raised;\n totalDecs += raised;\n i = s.length;\n } else if (beginning && (c == \"+\" || c == \"-\")) {\n if (c == \"-\") {\n pos = !pos;\n }\n }\n }\n if (all == \"\") {\n return leadZeros;\n }\n return all;\n}\n\n/**\n * Parse a string representation of a floating point\n * and pull out the exponent.\n *\n * @param s the string representation of a floating point.\n * @return (integer) the number after the e.\n */\nfunction parseOrder(s: string) {\n let beginning = true;\n let seenDot = false;\n let seenSomething = false;\n let zeros = \"\";\n let leadZeros = \"\";\n let all = \"\";\n let decPlaces = 0;\n let totalDecs = 0;\n let pos = true;\n for (let i = 0; i < s.length; i++) {\n const c = s.charAt(i);\n if (c >= \"1\" && c <= \"9\") {\n all += zeros + c;\n zeros = \"\";\n seenSomething = true;\n if (!seenDot) {\n totalDecs++;\n decPlaces++;\n }\n beginning = false;\n } else if (c == \"0\") {\n if (seenDot) {\n if (seenSomething) {\n all += zeros + c;\n zeros = \"\";\n } else {\n leadZeros += c;\n decPlaces--;\n }\n } else {\n totalDecs++;\n if (seenSomething) {\n leadZeros += c;\n decPlaces++;\n zeros += c;\n } else {\n leadZeros += c;\n }\n }\n beginning = false;\n } else if (!seenDot && c == \".\") {\n all += zeros;\n zeros = \"\";\n seenDot = true;\n beginning = false;\n } else if (c == \"e\" || (c == \"E\" && i + 1 < s.length)) {\n const raised = parseInt(s.substring(i + 1, s.length));\n decPlaces += raised;\n totalDecs += raised;\n i = s.length;\n } else if (beginning && (c == \"+\" || c == \"-\")) {\n if (c == \"-\") {\n pos = !pos;\n }\n }\n }\n if (all == \"\") {\n return totalDecs;\n }\n return decPlaces;\n}\n\n/**\n * Remove the specified number of digits from string by\n * rounding. Proper rounding rules for scientific purposes\n * are followed.\n * This method may cause an extra significant figure\n * to be added to the number. For example, if 999999\n * were rounded, A one would carry over and become\n * a significant figure. Those who call this method\n * should check for this and call round again if needed.\n *\n * @param mantissa A string representing an whole number of arbitrary length.\n * @param digits A number of digits to remove\n * @return A string represted the rounded version of mantissa\n */\nfunction round(mantissa: string, digits: number): string {\n const last = mantissa.length - digits - 1;\n if (last < 0) {\n return \"\";\n }\n if (last >= mantissa.length - 1) {\n return mantissa;\n }\n const nextToLast = mantissa.charAt(last + 1);\n const lastChar = mantissa.charAt(last);\n let roundUp = false;\n if (nextToLast > \"5\") {\n roundUp = true;\n } else if (nextToLast == \"5\") {\n for (let j = last + 2; j < mantissa.length; j++) {\n if (mantissa.charAt(j) != \"0\") {\n roundUp = true;\n }\n }\n // @ts-expect-error - TS2362 - The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.\n if (lastChar % 2 == 1) {\n roundUp = true;\n }\n }\n let result = \"\";\n for (let i = last; i >= 0; i--) {\n const c = mantissa.charAt(i);\n if (roundUp) {\n let nextChar;\n if (c == \"9\") {\n nextChar = \"0\";\n } else {\n switch (c) {\n case \"0\":\n nextChar = \"1\";\n break;\n case \"1\":\n nextChar = \"2\";\n break;\n case \"2\":\n nextChar = \"3\";\n break;\n case \"3\":\n nextChar = \"4\";\n break;\n case \"4\":\n nextChar = \"5\";\n break;\n case \"5\":\n nextChar = \"6\";\n break;\n case \"6\":\n nextChar = \"7\";\n break;\n case \"7\":\n nextChar = \"8\";\n break;\n case \"8\":\n nextChar = \"9\";\n break;\n }\n roundUp = false;\n }\n result = nextChar + result;\n } else {\n result = c + result;\n }\n }\n if (roundUp) {\n result = \"1\" + result;\n }\n return result;\n}\n","import {keys} from \"@khanacademy/wonder-stuff-core\";\n\nimport {getWidgetTypeByWidgetId} from \"../widget-type-utils\";\nimport * as Widgets from \"../widgets\";\n\nimport type {\n PerseusItem,\n PerseusWidgetsMap,\n PerseusRenderer,\n} from \"@khanacademy/perseus-core\";\n\n/**\n * Looks through widgets to identify images that do not have alt text.\n *\n * We pass in the fuller perseusRenderer object to allow for the possibility\n * of expanding to include other img data from content & images in the future.\n *\n * @param {PerseusRenderer} perseusRenderer\n * @returns a stringified list of {widgetId, imageUrl} for imgs that don't have alt text\n */\nfunction getImagesWithoutAltData(perseusRenderer: PerseusRenderer): string {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (!perseusRenderer.widgets) {\n return \"\";\n }\n\n const imgsWithoutAltData: {imgUrl: string; widgetId: string}[] = [];\n\n Object.entries(perseusRenderer.widgets).forEach(([widgetId, widget]) => {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (!widget.options) {\n return;\n }\n\n // Add to imagesWithoutAltData if img alt is missing and\n // image has valid img url data.\n if (\n widget.type === \"image\" &&\n !widget.options.alt &&\n widget.options.backgroundImage?.url\n ) {\n imgsWithoutAltData.push({\n widgetId,\n imgUrl: widget.options.backgroundImage.url,\n });\n }\n });\n\n return JSON.stringify(imgsWithoutAltData);\n}\n\n/* Widgets that have individual answers */\nconst INDIVIDUAL_ANSWER_WIDGETS = [\n \"interactive-graph\",\n \"categorizer\",\n \"grapher\",\n];\n\n/* Widgets that are supported for automatic scoring */\nconst SUPPORTED_WIDGETS = [\n \"radio\",\n \"numeric-input\",\n \"input-number\",\n \"expression\",\n ...INDIVIDUAL_ANSWER_WIDGETS,\n];\n\n/* Verify if the perseus item has supported widgets for automatic scoring */\nexport const isWrongAnswerSupported = (\n widgetIds: Array<string>,\n widgetMap: PerseusWidgetsMap,\n): boolean => {\n return (\n widgetIds.length !== 0 &&\n widgetIds.every((widgetId) =>\n SUPPORTED_WIDGETS.includes(\n // eslint-disable-next-line no-restricted-syntax\n getWidgetTypeByWidgetId(widgetId, widgetMap) as string,\n ),\n )\n );\n};\n\n/* Verify if the widget ID has an individual answer for the coach report view */\nexport const shouldHaveIndividualAnswer = (\n widgetId: string,\n widgetMap: PerseusWidgetsMap,\n): boolean => {\n return INDIVIDUAL_ANSWER_WIDGETS.includes(\n // eslint-disable-next-line no-restricted-syntax\n getWidgetTypeByWidgetId(widgetId, widgetMap) as string,\n );\n};\n\n/* Returns the answer userInput submission for currently supported widgets */\n// TODO (LEMS-1834): Fix userInput any types to be specific\nexport const getAnswerFromUserInput = (widgetType: string, userInput: any) => {\n switch (widgetType) {\n case \"categorizer\":\n return userInput.values;\n case \"input-number\":\n return userInput.currentValue;\n case \"numeric-input\":\n return userInput.currentValue;\n case \"radio\":\n return userInput.selectedChoiceIds;\n }\n return userInput;\n};\n\n/* Returns the correct answer for a given widget ID and Perseus Item */\n// TODO (LEMS-1835): We should fix the resonse type from getWidget to be specific.\n// TODO (LEMS-1836): We should also consider adding the getOneCorrectAnswerFromRubric method to all widgets.\nexport const getCorrectAnswerForWidgetId = (\n widgetId: string,\n itemData: PerseusItem,\n): string | null | undefined => {\n const rubric = itemData.question.widgets[widgetId].options;\n const widgetMap = itemData.question.widgets;\n // eslint-disable-next-line no-restricted-syntax\n const widgetType = getWidgetTypeByWidgetId(widgetId, widgetMap) as string;\n\n const widget = Widgets.getWidgetExport(widgetType);\n\n return widget?.getOneCorrectAnswerFromRubric?.(rubric);\n};\n\n/* Verify if the widget ID exists in the content string of the Perseus Item */\nexport const isWidgetIdInContent = (\n perseusItem: PerseusItem,\n widgetId: string,\n): boolean => {\n // eslint-disable-next-line no-restricted-syntax\n return perseusItem.question.content.indexOf(widgetId as string) !== -1;\n};\n\n/* Return an array of all the widget IDs that exist in the content string of a Perseus Item */\nexport const getValidWidgetIds = (perseusItem: PerseusItem): Array<string> => {\n const {widgets} = perseusItem.question;\n return keys(widgets).filter((id) => isWidgetIdInContent(perseusItem, id));\n};\n\nexport {getImagesWithoutAltData};\n","import {\n generateTestPerseusItem,\n splitPerseusItem,\n} from \"@khanacademy/perseus-core\";\nimport {scorePerseusItem} from \"@khanacademy/perseus-score\";\n\nimport type {\n CategorizerWidget,\n PerseusRenderer,\n PerseusWidgetTypes,\n PerseusScore,\n UserInputMap,\n PerseusItem,\n} from \"@khanacademy/perseus-core\";\n\n/**\n * Thin wrapper around scorePerseusItem for internal testing. Returns the\n * aggregate score; tests that need the per-widget breakdown should call\n * `scorePerseusItem` directly.\n */\nexport function scorePerseusItemTesting(\n perseusRenderData: PerseusRenderer,\n userInputMap: UserInputMap,\n): PerseusScore {\n return scorePerseusItem(perseusRenderData, userInputMap, \"en\");\n}\n\n/**\n * Creates an object with the bare amount\n * of data to be a properly typed InteractiveGraphWidget\n *\n * @returns {InteractiveGraphWidget} skeleton InteractiveGraphWidget for testing\n */\nexport function generateTestCategorizerWidget(): CategorizerWidget {\n return {\n type: \"categorizer\",\n options: {\n items: [],\n categories: [],\n randomizeItems: false,\n values: [],\n },\n };\n}\n\n/**\n * Creates an object with the minimum amount\n * of data to be a properly typed PerseusItem\n * containing answerful information\n *\n * @template T - The widget type extending keyof PerseusWidgetTypes\n * @param {T} widgetType - The type of widget to create, as a string, ex. \"radio\"\n * @param {PerseusWidgetTypes[T][\"options\"]} options - The options for the widget\n * @returns {PerseusItem} skeleton PerseusItem for testing\n */\nexport function getAnswerfulItem<T extends keyof PerseusWidgetTypes>(\n widgetType: T,\n options: PerseusWidgetTypes[T][\"options\"],\n): PerseusItem {\n const widgetName = `${widgetType} 1`;\n const widget = {\n type: widgetType,\n options,\n };\n const widgets = {};\n widgets[widgetName] = widget;\n const question: PerseusRenderer = {\n content: `[[☃ ${widgetName}]]`,\n images: {},\n widgets,\n };\n return generateTestPerseusItem({question});\n}\n\n/**\n * Creates an object with the minimum amount\n * of data to be a properly typed PerseusItem\n * containing answerless information\n *\n * @template T - The widget type extending keyof PerseusWidgetTypes\n * @param {T} widgetType - The type of widget to create, as a string, ex. \"radio\"\n * @param {PerseusWidgetTypes[T][\"options\"]} options - The options for the widget\n * @returns {PerseusItem} skeleton PerseusItem for testing\n */\nexport function getAnswerlessItem<T extends keyof PerseusWidgetTypes>(\n widgetType: T,\n options: PerseusWidgetTypes[T][\"options\"],\n): PerseusItem {\n return splitPerseusItem(getAnswerfulItem(widgetType, options));\n}\n","/**\n * Some helpers for CEDAR logging. CEDAR convention dictates\n * that enum values should be upper case. Ex: for the\n * PerseusWidgetUsedInProblemAttempt CEDAR event, we needed\n * to: get the type and convert that to an enum value.\n */\n\ntype WidgetName =\n | \"blank\"\n | \"categorizer\"\n | \"cs-program\"\n | \"definition\"\n | \"dropdown\"\n | \"explanation\"\n | \"expression\"\n | \"fill-in-the-blank\"\n | \"free-response\"\n | \"graded-group-set\"\n | \"graded-group\"\n | \"grapher\"\n | \"group\"\n | \"iframe\"\n | \"image\"\n | \"input-number\"\n | \"interaction\"\n | \"interactive-graph\"\n | \"label-image\"\n | \"lights-puzzle\" // Deprecated\n | \"matcher\"\n | \"matrix\"\n | \"measurer\"\n | \"molecule-renderer\" // Deprecated\n | \"number-line\"\n | \"numeric-input\"\n | \"orderer\"\n | \"passage\" // Deprecated\n | \"passage-ref\" // Deprecated\n | \"passage-ref-target\" // Deprecated\n | \"phet-simulation\"\n | \"plotter\"\n | \"python-program\"\n | \"reaction-diagram\"\n | \"radio\"\n | \"sequence\" // Deprecated\n | \"simulator\" // Deprecated\n | \"sorter\"\n | \"table\"\n | \"video\";\n\ntype WidgetEnum =\n | \"BLANK\"\n | \"CATEGORIZER\"\n | \"CS_PROGRAM\"\n | \"DEFINITION\"\n | \"DROPDOWN\"\n | \"EXPLANATION\"\n | \"EXPRESSION\"\n | \"FILL_IN_THE_BLANK\"\n | \"FREE_RESPONSE\"\n | \"GRADED_GROUP\"\n | \"GRADED_GROUP_SET\"\n | \"GRAPHER\"\n | \"GROUP\"\n | \"IFRAME\"\n | \"IMAGE\"\n | \"INPUT_NUMBER\"\n | \"INTERACTIVE\"\n | \"INTERACTIVE_GRAPH\"\n | \"LABEL_IMAGE\"\n | \"LIGHTS_PUZZLE\"\n | \"MATCHER\"\n | \"MATRIX\"\n | \"MEASURER\"\n | \"MOLECULE\"\n | \"NUMBER_LINE\"\n | \"NUMERIC_INPUT\"\n | \"ORDERER\"\n | \"PASSAGE\"\n | \"PASSAGE_REF\"\n | \"PASSAGE_REF_TARGET\"\n | \"PHET_SIMULATION\"\n | \"PLOTTER\"\n | \"PYTHON_PROGRAM\"\n | \"REACTION_DIAGRAM\"\n | \"RADIO\"\n | \"SEQUENCE\"\n | \"SIMULATOR\"\n | \"SORTER\"\n | \"TABLE\"\n | \"UNIT\"\n | \"VIDEO\";\n\nconst widgetNameToEnum: Record<WidgetName, WidgetEnum> = {\n blank: \"BLANK\",\n categorizer: \"CATEGORIZER\",\n \"cs-program\": \"CS_PROGRAM\",\n definition: \"DEFINITION\",\n dropdown: \"DROPDOWN\",\n explanation: \"EXPLANATION\",\n expression: \"EXPRESSION\",\n \"fill-in-the-blank\": \"FILL_IN_THE_BLANK\",\n \"free-response\": \"FREE_RESPONSE\",\n \"graded-group-set\": \"GRADED_GROUP_SET\",\n \"graded-group\": \"GRADED_GROUP\",\n grapher: \"GRAPHER\",\n group: \"GROUP\",\n iframe: \"IFRAME\",\n image: \"IMAGE\",\n \"input-number\": \"INPUT_NUMBER\",\n interaction: \"INTERACTIVE\",\n \"interactive-graph\": \"INTERACTIVE_GRAPH\",\n \"label-image\": \"LABEL_IMAGE\",\n \"lights-puzzle\": \"LIGHTS_PUZZLE\",\n matcher: \"MATCHER\",\n matrix: \"MATRIX\",\n measurer: \"MEASURER\",\n \"molecule-renderer\": \"MOLECULE\",\n \"number-line\": \"NUMBER_LINE\",\n \"numeric-input\": \"NUMERIC_INPUT\",\n orderer: \"ORDERER\",\n passage: \"PASSAGE\",\n \"passage-ref\": \"PASSAGE_REF\",\n \"passage-ref-target\": \"PASSAGE_REF_TARGET\",\n \"phet-simulation\": \"PHET_SIMULATION\",\n plotter: \"PLOTTER\",\n \"python-program\": \"PYTHON_PROGRAM\",\n \"reaction-diagram\": \"REACTION_DIAGRAM\",\n radio: \"RADIO\",\n sequence: \"SEQUENCE\",\n simulator: \"SIMULATOR\",\n sorter: \"SORTER\",\n table: \"TABLE\",\n video: \"VIDEO\",\n};\n\nexport function convertWidgetNameToEnum(name: string): WidgetEnum {\n const widgetEnum = widgetNameToEnum[name];\n\n if (!widgetEnum) {\n throw new Error(`Unknown widget name: ${name}`);\n }\n\n return widgetEnum;\n}\n","import PerseusMarkdown from \"../perseus-markdown\";\n\nimport type {PerseusRenderer} from \"@khanacademy/perseus-core\";\n\n/**\n * Extracts widget IDs from a PerseusRenderer in the order they appear in the content.\n * Handles deduplication by only including the first occurrence of each widget ID.\n */\nexport function extractWidgetIds(\n perseusRenderer: PerseusRenderer,\n options?: {inline?: boolean},\n): ReadonlyArray<string> {\n const widgetIds: string[] = [];\n\n // Get content from the perseus renderer\n const content = perseusRenderer.content;\n const inline = options?.inline ?? false;\n\n // Parse the markdown content using the same logic as the renderer\n const parsedMarkdown = inline\n ? PerseusMarkdown.parseInline(content, options)\n : PerseusMarkdown.parse(content, options);\n\n PerseusMarkdown.traverseContent(parsedMarkdown, (node) => {\n if (node.type === \"widget\") {\n if (!widgetIds.includes(node.id)) {\n widgetIds.push(node.id);\n }\n }\n });\n\n return widgetIds;\n}\n","/**\n * Main entry point\n */\n\nexport {default as init} from \"./init\";\n\nexport {ApiOptions} from \"./perseus-api\";\n/** @hidden */\nexport {ClassNames} from \"./perseus-api\";\n\n/** @hidden */\nexport {libVersion} from \"./version\";\n/** @hidden */\nexport {apiVersion} from \"./perseus-version\";\n\n/**\n * Renderers\n */\nexport {default as ArticleRenderer} from \"./article-renderer\";\nexport {default as ServerItemRenderer} from \"./server-item-renderer\";\nexport {default as HintsRenderer} from \"./hints-renderer\";\nexport {default as HintRenderer} from \"./hint-renderer\";\nexport {default as Renderer} from \"./renderer\";\n\n/**\n * Widgets\n */\nexport * as Widgets from \"./widgets\";\n/** @hidden */\nexport {default as widgets} from \"./all-widgets\";\nexport {Expression} from \"./widgets/expression\";\nexport {default as InputNumber} from \"./widgets/input-number\";\nexport {default as NumericInput} from \"./widgets/numeric-input\";\nexport {default as Radio} from \"./widgets/radio\";\nexport {default as Categorizer} from \"./widgets/categorizer\";\n/** @hidden */\nexport {default as InteractiveGraphWidget} from \"./widgets/interactive-graphs/interactive-graph\";\n/** @hidden */\nexport {default as MatrixWidget} from \"./widgets/matrix\";\n/** @hidden */\nexport {default as TableWidget} from \"./widgets/table\";\n/** @hidden */\nexport {default as PlotterWidget} from \"./widgets/plotter\";\n/** @hidden */\nexport {default as GrapherWidget} from \"./widgets/grapher\";\n\n// Some utils in grapher/utils and scoring don't need to be used outside of\n// `perseus`, so only export the stuff that does need to be exposed\nimport {\n DEFAULT_GRAPHER_PROPS,\n chooseType,\n defaultPlotProps,\n getEquationString,\n typeToButton,\n} from \"./widgets/grapher/util\";\n\n/** @hidden */\nexport const GrapherUtil = {\n DEFAULT_GRAPHER_PROPS,\n chooseType,\n defaultPlotProps,\n getEquationString,\n typeToButton,\n};\n\n/**\n * Misc\n */\n\n/** @hidden */\nexport * as components from \"./components\";\n/** @hidden */\nexport {iconChevronDown, iconTrash} from \"./icon-paths\";\n/** @hidden */\nexport {bodyXsmallBold} from \"./styles/global-styles\";\nexport * as Dependencies from \"./dependencies\";\n/** @hidden */\nexport {Log} from \"./logging/log\";\nexport {default as JiptParagraphs} from \"./jipt-paragraphs\";\nexport {default as LoadingContext} from \"./loading-context\";\nexport {default as MathRenderingContext} from \"./math-rendering-context\";\nexport {default as PerseusMarkdown} from \"./perseus-markdown\";\n/** @hidden */\nexport {interactiveSizes} from \"./styles/constants\";\n/** @hidden */\nexport {displaySigFigs} from \"./sigfigs\";\nexport {DependenciesContext} from \"./dependencies\";\n\n// Context for managing i18n\nexport {\n PerseusI18nContextProvider,\n PerseusI18nContext,\n} from \"./components/i18n-context\";\n/** @hidden */\nexport {usePerseusI18n} from \"./components/i18n-context\";\n\n/**\n * Util\n */\nexport {default as Util} from \"./util\";\n/** @hidden */\nexport {default as KhanColors} from \"./util/colors\";\n/** @hidden */\nexport {default as preprocessTex} from \"./util/tex-preprocess\";\nexport {registerAllWidgetsForTesting} from \"./util/register-all-widgets-for-testing\";\n/** @hidden */\nexport {\n containerSizeClass,\n getInteractiveBoxFromSizeClass,\n} from \"./util/sizing-utils\";\n/** @hidden */\nexport {mathOnlyParser} from \"./widgets/interactive-graphs/utils\";\nexport {\n isWrongAnswerSupported,\n shouldHaveIndividualAnswer,\n getCorrectAnswerForWidgetId,\n getAnswerFromUserInput,\n getImagesWithoutAltData,\n} from \"./util/extract-perseus-data\";\n/** @hidden */\nexport {\n isWidgetIdInContent,\n getValidWidgetIds,\n} from \"./util/extract-perseus-data\";\n\nexport {generateTestCategorizerWidget} from \"./util/test-utils\";\nexport {\n getWidgetTypeByWidgetId,\n getWidgetSubTypeByWidgetId,\n} from \"./widget-type-utils\";\n/** @hidden */\nexport {\n contentHasWidgetType,\n getWidgetFromWidgetMap,\n getWidgetsFromWidgetMap,\n} from \"./widget-type-utils\";\nexport {convertWidgetNameToEnum} from \"./util/widget-enum-utils\";\n/** @hidden */\nexport {\n getAbsoluteValueCoords,\n getCircleCoords,\n getExponentialCoords,\n getLogarithmCoords,\n getLineCoords,\n getLinearSystemCoords,\n getPointCoords,\n getPolygonCoords,\n getSegmentCoords,\n getSinusoidCoords,\n getTangentCoords,\n getVectorCoords,\n getQuadraticCoords,\n getAngleCoords,\n} from \"./widgets/interactive-graphs/reducer/initialize-graph-state\";\nexport {\n default as UserInputManager,\n deriveUserInputFromSerializedState,\n} from \"./user-input-manager\";\n\n// These exports are to support shared functionality between Perseus and Graphie2000\n/** @hidden */\nexport {parseDataFromJSONP} from \"./util/graphie-utils\";\nexport type {\n /** @hidden */\n GraphieData,\n /** @hidden */\n GraphieLabel,\n /** @hidden */\n GraphieRange,\n} from \"./util/graphie-utils\";\n/** @hidden */\nexport {extractWidgetIds} from \"./util/extract-widget-ids\";\n\n/**\n * Types\n */\nexport type {ILogger, LogErrorOptions} from \"./logging/log\";\nexport type {ServerItemRenderer as ServerItemRendererComponent} from \"./server-item-renderer\";\nexport type {\n APIOptions,\n /** @hidden */\n APIOptionsWithDefaults,\n /** @hidden */\n ChangeHandler,\n /** @hidden */\n DeviceType,\n /** @hidden */\n DomInsertCheckFn,\n /** @hidden */\n EditorMode,\n /** @hidden */\n FocusPath,\n GenerateUrlArgs,\n /** @hidden */\n GraphieLabelElement,\n /** @hidden */\n ImageDict,\n /** @hidden */\n ImageUploader,\n /** @hidden */\n JiptLabelStore,\n /** @hidden */\n JiptRenderer,\n PerseusDependencies,\n PerseusDependenciesV2,\n /** @hidden */\n VideoData,\n /** @hidden */\n VideoKind,\n /** @hidden */\n WidgetExports,\n /** @hidden */\n SharedRendererProps,\n} from \"./types\";\n/** @hidden */\nexport type {ParsedValue} from \"./util\";\n/** @hidden */\nexport type {Coord} from \"./interactive2/types\";\nexport type {\n RendererPromptJSON,\n WidgetPromptJSON,\n} from \"./widget-ai-utils/prompt-types\";\nexport type {CategorizerPromptJSON} from \"./widget-ai-utils/categorizer/categorizer-ai-utils\";\nexport type {DefinitionPromptJSON} from \"./widget-ai-utils/definition/definition-ai-utils\";\nexport type {DropdownPromptJSON} from \"./widget-ai-utils/dropdown/dropdown-ai-utils\";\nexport type {ExplanationPromptJSON} from \"./widget-ai-utils/explanation/explanation-ai-utils\";\nexport type {ExpressionPromptJSON} from \"./widget-ai-utils/expression/expression-ai-utils\";\nexport type {GradedGroupPromptJSON} from \"./widget-ai-utils/graded-group/graded-group-ai-utils\";\nexport type {GradedGroupSetPromptJSON} from \"./widget-ai-utils/graded-group-set/graded-group-set-ai-utils\";\nexport type {GrapherPromptJSON} from \"./widget-ai-utils/grapher/grapher-ai-utils\";\nexport type {GroupPromptJSON} from \"./widget-ai-utils/group/group-ai-utils\";\nexport type {ImagePromptJSON} from \"./widget-ai-utils/image/image-ai-utils\";\nexport type {InteractiveGraphPromptJSON} from \"./widget-ai-utils/interactive-graph/interactive-graph-ai-utils\";\nexport type {LabelImagePromptJSON} from \"./widget-ai-utils/label-image/label-image-ai-utils\";\nexport type {MatcherPromptJSON} from \"./widget-ai-utils/matcher/matcher-ai-utils\";\nexport type {MatrixPromptJSON} from \"./widget-ai-utils/matrix/matrix-ai-utils\";\nexport type {NumberLinePromptJSON} from \"./widget-ai-utils/number-line/number-line-ai-utils\";\nexport type {NumericInputPromptJSON} from \"./widget-ai-utils/numeric-input/prompt-utils\";\nexport type {OrdererPromptJSON} from \"./widget-ai-utils/orderer/orderer-ai-utils\";\nexport type {RadioPromptJSON} from \"./widget-ai-utils/radio/radio-ai-utils\";\nexport type {SorterPromptJSON} from \"./widget-ai-utils/sorter/sorter-ai-utils\";\nexport type {UnsupportedWidgetPromptJSON} from \"./widget-ai-utils/unsupported-widget\";\n"],"names":["RangeInput","props","value","placeholder","checkValidity","allowPiTruncation","restOfProps","onChange","i","newVal","_jsxs","div","className","_jsx","NumberInput","val","init","Widgets","basicWidgets","extraWidgets","libName","libVersion","addLibraryVersionToPerseusDebug","apiVersion","major","minor","ArticleRenderer","React","Component","componentDidMount","_currentFocus","render","apiOptions","ApiOptions","defaults","isArticle","classes","classNames","ApiClassNames","MOBILE","isMobile","sections","_sections","map","section","sectionIndex","sectionSeed","seed","UserInputManager","widgets","problemNum","userInput","handleUserInput","initializeUserInput","_createElement","Renderer","ref","elem","sectionRenderers","key","keypadElement","onFocusChange","newFocusPath","oldFocusPath","_handleFocusChange","concat","linterContext","PerseusLinter","pushContextStack","legacyPerseusLint","strings","context","DependenciesContext","Provider","dependencies","constructor","_setCurrentFocus","_onRendererBlur","prevFocusPath","didFocusInput","focusedInput","focusPath","inputPaths","getInputPaths","some","inputPath","Util","inputPathsEqual","getDOMNodeForPath","setTimeout","keypadDomNode","getDOMNode","keypadHeight","getBoundingClientRect","height","activate","dismiss","blurPath","blurringFocusPath","blur","Array","isArray","json","getDependencies","JIPT","useJIPT","paragraphs","JiptParagraphs","parseToArray","content","forEach","push","paragraph","contextType","PerseusI18nContext","defaultProps","linterContextDefault","HintRenderer","hint","span","lastHint","lastRendered","pos","totalHints","classnames","css","styles","newHint","lastRenderedNewHint","rendererApiOptions","customKeypad","tabIndex","hintPos","style","display","color","hintProgressColor","rendererRef","images","findExternalWidgets","createRef","getSerializedState","current","StyleSheet","create","marginBlockEnd","sizing","size_240","borderInlineStartColor","semanticColor","core","border","neutral","subtle","borderInlineStartStyle","borderInlineStartWidth","hintBorderWidth","mediaQueries","lgOrSmaller","paddingInlineStart","hintPaddingInlineStart","smOrSmaller","outline","instructive","default","HintsRenderer","_cacheHintImages","UNSAFE_componentWillReceiveProps","nextProps","hintsVisible","setState","isFinalHelpPage","componentDidUpdate","prevProps","prevState","_","isEqual","hints","prevHintsVisible","nextHintsVisible","length","refs","domNode","ReactDOM","findDOMNode","focus","e","getApiOptions","_hintsVisible","state","slice","test","renderer","replace","getAnotherHint","showGetAnotherHint","hintRatioCopy","mobileHintStylesHintsRenderer","mobileHintStylesHintTitle","sharedStyles","responsiveLabel","Button","rel","kind","startIcon","plus","onClick","evt","preventDefault","stopPropagation","_cacheImagesInHint","each","data","src","image","Image","getRealImageUrl","readOnly","times","marginBlockStart","size_640","borderWidth","position","clear","fontWeight","foreground","strong","paddingBlockStart","size_160","paddingBlockEnd","defaultContext","onRendered","isRendered","createContext","ServerItemRenderer","maybeCallOnRendered","componentWillUnmount","blurTimeoutID","clearTimeout","_fullyRendered","assetsLoaded","Object","values","_assetStatuses","every","Boolean","newFocus","prevFocus","questionRenderer","path","questionAreaInputPaths","getNumHints","item","getPromptJSON","getUserInput","getWidgetIds","question","hintsRenderer","contextValue","assetStatuses","setAssetStatus","AssetContext","reviewMode","showSolutions","id","widgetsEmpty","isScorable","undefined","hintsContainer","oldFocus","assetKey","status","marginInlineStart","forwardRef","ServerItemRendererWithRef","LoadingContext","Consumer","displaySigFigs","f","sigFigs","sigDecs","scientific","s","order","parseOrder","mantissa","parseMantissa","positive","parseSign","add","decAdd","sigAdd","zeroScientific","Math","min","rounded","round","useScientific","trailingZeros","returnVal","charAt","substring","wholePart","fractPart","needDot","zeros","c","beginning","seenDot","seenSomething","all","parseInt","leadZeros","decPlaces","totalDecs","raised","digits","last","nextToLast","lastChar","roundUp","j","result","nextChar","getImagesWithoutAltData","perseusRenderer","imgsWithoutAltData","entries","widgetId","widget","options","type","alt","backgroundImage","url","imgUrl","JSON","stringify","INDIVIDUAL_ANSWER_WIDGETS","SUPPORTED_WIDGETS","isWrongAnswerSupported","widgetIds","widgetMap","includes","getWidgetTypeByWidgetId","shouldHaveIndividualAnswer","getAnswerFromUserInput","widgetType","currentValue","selectedChoiceIds","getCorrectAnswerForWidgetId","itemData","rubric","getOneCorrectAnswerFromRubric","isWidgetIdInContent","perseusItem","indexOf","getValidWidgetIds","keys","filter","generateTestCategorizerWidget","items","categories","randomizeItems","widgetNameToEnum","blank","categorizer","definition","dropdown","explanation","expression","grapher","group","iframe","interaction","matcher","matrix","measurer","orderer","passage","plotter","radio","sequence","simulator","sorter","table","video","convertWidgetNameToEnum","name","widgetEnum","Error","extractWidgetIds","inline","parsedMarkdown","PerseusMarkdown","parseInline","parse","traverseContent","node","GrapherUtil","DEFAULT_GRAPHER_PROPS","chooseType","defaultPlotProps","getEquationString","typeToButton"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,SAASA,UAAWC,CAAAA,KAAY,CAC5B,CAAA,KAAM,CACFC,KAAK,CACLC,WAAc,CAAA,CAAC,IAAM,CAAA,IAAA,CAAK,CAC1BC,aAAAA,CAAgB,IAAM,IAAI,CAC1BC,iBAAiB,CACjB,GAAGC,WAAAA,CACN,CAAGL,KAAAA,CAEJ,MAAMM,QAAW,CAACC,CAAc,EAACC,MAC7B,EAAA,CAAA,MAAMP,KAAQD,CAAAA,KAAAA,CAAMC,KAAK,CACzB,GAAIM,CAAM,GAAA,CAAA,CAAG,CACTP,KAAAA,CAAMM,QAAQ,CAAC,CAACE,MAAQP,CAAAA,KAAK,CAAC,CAAA,CAAE,CAAC,EACrC,CAAO,KAAA,CACHD,MAAMM,QAAQ,CAAC,CAACL,KAAK,CAAC,CAAA,CAAE,CAAEO,MAAAA,CAA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