{ "version": 3, "sources": ["../src/isObject.ts", "../src/allowAdditionalItems.ts", "../src/asNumber.ts", "../src/constants.ts", "../src/getUiOptions.ts", "../src/canExpand.ts", "../src/createErrorHandler.ts", "../src/deepEquals.ts", "../src/schema/getDefaultFormState.ts", "../src/findSchemaDefinition.ts", "../src/schema/getClosestMatchingOption.ts", "../src/schema/getMatchingOption.ts", "../src/getOptionMatchingSimpleDiscriminator.ts", "../src/schema/getFirstMatchingOption.ts", "../src/schema/retrieveSchema.ts", "../src/getDiscriminatorFieldFromSchema.ts", "../src/guessType.ts", "../src/mergeSchemas.ts", "../src/getSchemaType.ts", "../src/isFixedItems.ts", "../src/mergeDefaultsWithFormData.ts", "../src/mergeObjects.ts", "../src/isConstant.ts", "../src/schema/isSelect.ts", "../src/schema/isMultiSelect.ts", "../src/isCustomWidget.ts", "../src/schema/isFilesArray.ts", "../src/schema/getDisplayLabel.ts", "../src/schema/mergeValidationData.ts", "../src/schema/sanitizeDataForNewSchema.ts", "../src/schema/toIdSchema.ts", "../src/schema/toPathSchema.ts", "../src/createSchemaUtils.ts", "../src/dataURItoBlob.ts", "../src/pad.ts", "../src/dateRangeOptions.ts", "../src/replaceStringParameters.ts", "../src/englishStringTranslator.ts", "../src/enumOptionsDeselectValue.ts", "../src/enumOptionsValueForIndex.ts", "../src/enumOptionsIsSelected.ts", "../src/enumOptionsIndexForValue.ts", "../src/enumOptionsSelectValue.ts", "../src/ErrorSchemaBuilder.ts", "../src/getDateElementProps.ts", "../src/rangeSpec.ts", "../src/getInputProps.ts", "../src/getSubmitButtonOptions.ts", "../src/getTemplate.ts", "../src/getWidget.tsx", "../src/hashForSchema.ts", "../src/hasWidget.ts", "../src/idGenerators.ts", "../src/labelValue.ts", "../src/localToUTC.ts", "../src/toConstant.ts", "../src/optionsList.ts", "../src/orderProperties.ts", "../src/parseDateString.ts", "../src/schemaRequiresTrueValue.ts", "../src/shouldRender.ts", "../src/toDateString.ts", "../src/toErrorList.ts", "../src/toErrorSchema.ts", "../src/unwrapErrorHandler.ts", "../src/utcToLocal.ts", "../src/validationDataMerge.ts", "../src/withIdRefPrefix.ts", "../src/enums.ts", "../src/parser/schemaParser.ts", "../src/parser/ParserValidator.ts"], "sourcesContent": ["/** Determines whether a `thing` is an object for the purposes of RJSF. In this case, `thing` is an object if it has\n * the type `object` but is NOT null, an array or a File.\n *\n * @param thing - The thing to check to see whether it is an object\n * @returns - True if it is a non-null, non-array, non-File object\n */\nexport default function isObject(thing: any) {\n if (typeof thing !== 'object' || thing === null) {\n return false;\n }\n // lastModified is guaranteed to be a number on a File instance\n // as per https://w3c.github.io/FileAPI/#dfn-lastModified\n if (typeof thing.lastModified === 'number' && typeof File !== 'undefined' && thing instanceof File) {\n return false;\n }\n // getMonth is guaranteed to be a method on a Date instance\n // as per https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-date.prototype.getmonth\n if (typeof thing.getMonth === 'function' && typeof Date !== 'undefined' && thing instanceof Date) {\n return false;\n }\n return !Array.isArray(thing);\n}\n", "import isObject from './isObject';\nimport { RJSFSchema, StrictRJSFSchema } from './types';\n\n/** Checks the schema to see if it is allowing additional items, by verifying that `schema.additionalItems` is an\n * object. The user is warned in the console if `schema.additionalItems` has the value `true`.\n *\n * @param schema - The schema object to check\n * @returns - True if additional items is allowed, otherwise false\n */\nexport default function allowAdditionalItems(schema: S) {\n if (schema.additionalItems === true) {\n console.warn('additionalItems=true is currently not supported');\n }\n return isObject(schema.additionalItems);\n}\n", "/** Attempts to convert the string into a number. If an empty string is provided, then `undefined` is returned. If a\n * `null` is provided, it is returned. If the string ends in a `.` then the string is returned because the user may be\n * in the middle of typing a float number. If a number ends in a pattern like `.0`, `.20`, `.030`, string is returned\n * because the user may be typing number that will end in a non-zero digit. Otherwise, the string is wrapped by\n * `Number()` and if that result is not `NaN`, that number will be returned, otherwise the string `value` will be.\n *\n * @param value - The string or null value to convert to a number\n * @returns - The `value` converted to a number when appropriate, otherwise the `value`\n */\nexport default function asNumber(value: string | null) {\n if (value === '') {\n return undefined;\n }\n if (value === null) {\n return null;\n }\n if (/\\.$/.test(value)) {\n // '3.' can't really be considered a number even if it parses in js. The\n // user is most likely entering a float.\n return value;\n }\n if (/\\.0$/.test(value)) {\n // we need to return this as a string here, to allow for input like 3.07\n return value;\n }\n\n if (/\\.\\d*0$/.test(value)) {\n // It's a number, that's cool - but we need it as a string so it doesn't screw\n // with the user when entering dollar amounts or other values (such as those with\n // specific precision or number of significant digits)\n return value;\n }\n\n const n = Number(value);\n const valid = typeof n === 'number' && !Number.isNaN(n);\n\n return valid ? n : value;\n}\n", "/** Below are the list of all the keys into various elements of a RJSFSchema or UiSchema that are used by the various\n * utility functions. In addition to those keys, there are the special `ADDITIONAL_PROPERTY_FLAG` and\n * `RJSF_ADDITIONAL_PROPERTIES_FLAG` flags that is added to a schema under certain conditions by the `retrieveSchema()`\n * utility.\n */\nexport const ADDITIONAL_PROPERTY_FLAG = '__additional_property';\nexport const ADDITIONAL_PROPERTIES_KEY = 'additionalProperties';\nexport const ALL_OF_KEY = 'allOf';\nexport const ANY_OF_KEY = 'anyOf';\nexport const CONST_KEY = 'const';\nexport const DEFAULT_KEY = 'default';\nexport const DEFINITIONS_KEY = 'definitions';\nexport const DEPENDENCIES_KEY = 'dependencies';\nexport const ENUM_KEY = 'enum';\nexport const ERRORS_KEY = '__errors';\nexport const ID_KEY = '$id';\nexport const IF_KEY = 'if';\nexport const ITEMS_KEY = 'items';\nexport const JUNK_OPTION_ID = '_$junk_option_schema_id$_';\nexport const NAME_KEY = '$name';\nexport const ONE_OF_KEY = 'oneOf';\nexport const PROPERTIES_KEY = 'properties';\nexport const REQUIRED_KEY = 'required';\nexport const SUBMIT_BTN_OPTIONS_KEY = 'submitButtonOptions';\nexport const REF_KEY = '$ref';\n/**\n * @deprecated Replace with correctly spelled constant `RJSF_ADDITIONAL_PROPERTIES_FLAG`\n */\nexport const RJSF_ADDITONAL_PROPERTIES_FLAG = '__rjsf_additionalProperties';\nexport const RJSF_ADDITIONAL_PROPERTIES_FLAG = '__rjsf_additionalProperties';\nexport const ROOT_SCHEMA_PREFIX = '__rjsf_rootSchema';\nexport const UI_FIELD_KEY = 'ui:field';\nexport const UI_WIDGET_KEY = 'ui:widget';\nexport const UI_OPTIONS_KEY = 'ui:options';\nexport const UI_GLOBAL_OPTIONS_KEY = 'ui:globalOptions';\n", "import { UI_OPTIONS_KEY, UI_WIDGET_KEY } from './constants';\nimport isObject from './isObject';\nimport { FormContextType, GlobalUISchemaOptions, RJSFSchema, StrictRJSFSchema, UIOptionsType, UiSchema } from './types';\n\n/** Get all passed options from ui:options, and ui:, returning them in an object with the `ui:`\n * stripped off. Any `globalOptions` will always be returned, unless they are overridden by options in the `uiSchema`.\n *\n * @param [uiSchema={}] - The UI Schema from which to get any `ui:xxx` options\n * @param [globalOptions={}] - The optional Global UI Schema from which to get any fallback `xxx` options\n * @returns - An object containing all the `ui:xxx` options with the `ui:` stripped off along with all `globalOptions`\n */\nexport default function getUiOptions(\n uiSchema: UiSchema = {},\n globalOptions: GlobalUISchemaOptions = {}\n): UIOptionsType {\n return Object.keys(uiSchema)\n .filter((key) => key.indexOf('ui:') === 0)\n .reduce(\n (options, key) => {\n const value = uiSchema[key];\n if (key === UI_WIDGET_KEY && isObject(value)) {\n console.error('Setting options via ui:widget object is no longer supported, use ui:options instead');\n return options;\n }\n if (key === UI_OPTIONS_KEY && isObject(value)) {\n return { ...options, ...value };\n }\n return { ...options, [key.substring(3)]: value };\n },\n { ...globalOptions }\n );\n}\n", "import { FormContextType, RJSFSchema, StrictRJSFSchema, UiSchema } from './types';\nimport getUiOptions from './getUiOptions';\n\n/** Checks whether the field described by `schema`, having the `uiSchema` and `formData` supports expanding. The UI for\n * the field can expand if it has additional properties, is not forced as non-expandable by the `uiSchema` and the\n * `formData` object doesn't already have `schema.maxProperties` elements.\n *\n * @param schema - The schema for the field that is being checked\n * @param [uiSchema={}] - The uiSchema for the field\n * @param [formData] - The formData for the field\n * @returns - True if the schema element has additionalProperties, is expandable, and not at the maxProperties limit\n */\nexport default function canExpand(\n schema: RJSFSchema,\n uiSchema: UiSchema = {},\n formData?: T\n) {\n if (!schema.additionalProperties) {\n return false;\n }\n const { expandable = true } = getUiOptions(uiSchema);\n if (expandable === false) {\n return expandable;\n }\n // if ui:options.expandable was not explicitly set to false, we can add\n // another property if we have not exceeded maxProperties yet\n if (schema.maxProperties !== undefined && formData) {\n return Object.keys(formData).length < schema.maxProperties;\n }\n return true;\n}\n", "import isPlainObject from 'lodash/isPlainObject';\n\nimport { ERRORS_KEY } from './constants';\nimport { FieldValidation, FormValidation, GenericObjectType } from './types';\n\n/** Given a `formData` object, recursively creates a `FormValidation` error handling structure around it\n *\n * @param formData - The form data around which the error handler is created\n * @returns - A `FormValidation` object based on the `formData` structure\n */\nexport default function createErrorHandler(formData: T): FormValidation {\n const handler: FieldValidation = {\n // We store the list of errors for this node in a property named __errors\n // to avoid name collision with a possible sub schema field named\n // 'errors' (see `utils.toErrorSchema`).\n [ERRORS_KEY]: [],\n addError(message: string) {\n this[ERRORS_KEY]!.push(message);\n },\n };\n if (Array.isArray(formData)) {\n return formData.reduce((acc, value, key) => {\n return { ...acc, [key]: createErrorHandler(value) };\n }, handler);\n }\n if (isPlainObject(formData)) {\n const formObject: GenericObjectType = formData as GenericObjectType;\n return Object.keys(formObject).reduce((acc, key) => {\n return { ...acc, [key]: createErrorHandler(formObject[key]) };\n }, handler as FormValidation);\n }\n return handler as FormValidation;\n}\n", "import isEqualWith from 'lodash/isEqualWith';\n\n/** Implements a deep equals using the `lodash.isEqualWith` function, that provides a customized comparator that\n * assumes all functions are equivalent.\n *\n * @param a - The first element to compare\n * @param b - The second element to compare\n * @returns - True if the `a` and `b` are deeply equal, false otherwise\n */\nexport default function deepEquals(a: any, b: any): boolean {\n return isEqualWith(a, b, (obj: any, other: any) => {\n if (typeof obj === 'function' && typeof other === 'function') {\n // Assume all functions are equivalent\n // see https://github.com/rjsf-team/react-jsonschema-form/issues/255\n return true;\n }\n return undefined; // fallback to default isEquals behavior\n });\n}\n", "import get from 'lodash/get';\nimport isEmpty from 'lodash/isEmpty';\n\nimport {\n ANY_OF_KEY,\n CONST_KEY,\n DEFAULT_KEY,\n DEPENDENCIES_KEY,\n PROPERTIES_KEY,\n ONE_OF_KEY,\n REF_KEY,\n ALL_OF_KEY,\n} from '../constants';\nimport findSchemaDefinition from '../findSchemaDefinition';\nimport getClosestMatchingOption from './getClosestMatchingOption';\nimport getDiscriminatorFieldFromSchema from '../getDiscriminatorFieldFromSchema';\nimport getSchemaType from '../getSchemaType';\nimport isObject from '../isObject';\nimport isFixedItems from '../isFixedItems';\nimport mergeDefaultsWithFormData from '../mergeDefaultsWithFormData';\nimport mergeObjects from '../mergeObjects';\nimport mergeSchemas from '../mergeSchemas';\nimport {\n Experimental_CustomMergeAllOf,\n Experimental_DefaultFormStateBehavior,\n FormContextType,\n GenericObjectType,\n RJSFSchema,\n StrictRJSFSchema,\n ValidatorType,\n} from '../types';\nimport isMultiSelect from './isMultiSelect';\nimport retrieveSchema, { resolveDependencies } from './retrieveSchema';\nimport { JSONSchema7Object } from 'json-schema';\n\nconst PRIMITIVE_TYPES = ['string', 'number', 'integer', 'boolean', 'null'];\n\n/** Enum that indicates how `schema.additionalItems` should be handled by the `getInnerSchemaForArrayItem()` function.\n */\nexport enum AdditionalItemsHandling {\n Ignore,\n Invert,\n Fallback,\n}\n\n/** Given a `schema` will return an inner schema that for an array item. This is computed differently based on the\n * `additionalItems` enum and the value of `idx`. There are four possible returns:\n * 1. If `idx` is >= 0, then if `schema.items` is an array the `idx`th element of the array is returned if it is a valid\n * index and not a boolean, otherwise it falls through to 3.\n * 2. If `schema.items` is not an array AND truthy and not a boolean, then `schema.items` is returned since it actually\n * is a schema, otherwise it falls through to 3.\n * 3. If `additionalItems` is not `AdditionalItemsHandling.Ignore` and `schema.additionalItems` is an object, then\n * `schema.additionalItems` is returned since it actually is a schema, otherwise it falls through to 4.\n * 4. {} is returned representing an empty schema\n *\n * @param schema - The schema from which to get the particular item\n * @param [additionalItems=AdditionalItemsHandling.Ignore] - How do we want to handle additional items?\n * @param [idx=-1] - Index, if non-negative, will be used to return the idx-th element in a `schema.items` array\n * @returns - The best fit schema object from the `schema` given the `additionalItems` and `idx` modifiers\n */\nexport function getInnerSchemaForArrayItem(\n schema: S,\n additionalItems: AdditionalItemsHandling = AdditionalItemsHandling.Ignore,\n idx = -1\n): S {\n if (idx >= 0) {\n if (Array.isArray(schema.items) && idx < schema.items.length) {\n const item = schema.items[idx];\n if (typeof item !== 'boolean') {\n return item as S;\n }\n }\n } else if (schema.items && !Array.isArray(schema.items) && typeof schema.items !== 'boolean') {\n return schema.items as S;\n }\n if (additionalItems !== AdditionalItemsHandling.Ignore && isObject(schema.additionalItems)) {\n return schema.additionalItems as S;\n }\n return {} as S;\n}\n\n/** Either add `computedDefault` at `key` into `obj` or not add it based on its value, the value of\n * `includeUndefinedValues`, the value of `emptyObjectFields` and if its parent field is required. Generally undefined\n * `computedDefault` values are added only when `includeUndefinedValues` is either true/\"excludeObjectChildren\". If `\n * includeUndefinedValues` is false and `emptyObjectFields` is not \"skipDefaults\", then non-undefined and non-empty-object\n * values will be added based on certain conditions.\n *\n * @param obj - The object into which the computed default may be added\n * @param key - The key into the object at which the computed default may be added\n * @param computedDefault - The computed default value that maybe should be added to the obj\n * @param includeUndefinedValues - Optional flag, if true, cause undefined values to be added as defaults.\n * If \"excludeObjectChildren\", cause undefined values for this object and pass `includeUndefinedValues` as\n * false when computing defaults for any nested object properties. If \"allowEmptyObject\", prevents undefined\n * values in this object while allow the object itself to be empty and passing `includeUndefinedValues` as\n * false when computing defaults for any nested object properties.\n * @param isParentRequired - The optional boolean that indicates whether the parent field is required\n * @param requiredFields - The list of fields that are required\n * @param experimental_defaultFormStateBehavior - Optional configuration object, if provided, allows users to override\n * default form state behavior\n * @param isConst - Optional flag, if true, indicates that the schema has a const property defined, thus we should always return the computedDefault since it's coming from the const.\n */\nfunction maybeAddDefaultToObject(\n obj: GenericObjectType,\n key: string,\n computedDefault: T | T[] | undefined,\n includeUndefinedValues: boolean | 'excludeObjectChildren',\n isParentRequired?: boolean,\n requiredFields: string[] = [],\n experimental_defaultFormStateBehavior: Experimental_DefaultFormStateBehavior = {},\n isConst = false\n) {\n const { emptyObjectFields = 'populateAllDefaults' } = experimental_defaultFormStateBehavior;\n if (includeUndefinedValues || isConst) {\n // If includeUndefinedValues\n // Or if the schema has a const property defined, then we should always return the computedDefault since it's coming from the const.\n obj[key] = computedDefault;\n } else if (emptyObjectFields !== 'skipDefaults') {\n if (isObject(computedDefault)) {\n // If isParentRequired is undefined, then we are at the root level of the schema so defer to the requiredness of\n // the field key itself in the `requiredField` list\n const isSelfOrParentRequired = isParentRequired === undefined ? requiredFields.includes(key) : isParentRequired;\n\n // If emptyObjectFields 'skipEmptyDefaults' store computedDefault if it's a non-empty object(e.g. not {})\n if (emptyObjectFields === 'skipEmptyDefaults') {\n if (!isEmpty(computedDefault)) {\n obj[key] = computedDefault;\n }\n }\n // Else store computedDefault if it's a non-empty object(e.g. not {}) and satisfies certain conditions\n // Condition 1: If computedDefault is not empty or if the key is a required field\n // Condition 2: If the parent object is required or emptyObjectFields is not 'populateRequiredDefaults'\n else if (\n (!isEmpty(computedDefault) || requiredFields.includes(key)) &&\n (isSelfOrParentRequired || emptyObjectFields !== 'populateRequiredDefaults')\n ) {\n obj[key] = computedDefault;\n }\n } else if (\n // Store computedDefault if it's a defined primitive (e.g., true) and satisfies certain conditions\n // Condition 1: computedDefault is not undefined\n // Condition 2: If emptyObjectFields is 'populateAllDefaults' or 'skipEmptyDefaults) or if the key is a required field\n computedDefault !== undefined &&\n (emptyObjectFields === 'populateAllDefaults' ||\n emptyObjectFields === 'skipEmptyDefaults' ||\n requiredFields.includes(key))\n ) {\n obj[key] = computedDefault;\n }\n }\n}\n\ninterface ComputeDefaultsProps {\n /** Any defaults provided by the parent field in the schema */\n parentDefaults?: T;\n /** The options root schema, used to primarily to look up `$ref`s */\n rootSchema?: S;\n /** The current formData, if any, onto which to provide any missing defaults */\n rawFormData?: T;\n /** Optional flag, if true, cause undefined values to be added as defaults.\n * If \"excludeObjectChildren\", cause undefined values for this object and pass `includeUndefinedValues` as\n * false when computing defaults for any nested object properties.\n */\n includeUndefinedValues?: boolean | 'excludeObjectChildren';\n /** The list of ref names currently being recursed, used to prevent infinite recursion */\n _recurseList?: string[];\n /** Optional configuration object, if provided, allows users to override default form state behavior */\n experimental_defaultFormStateBehavior?: Experimental_DefaultFormStateBehavior;\n /** Optional function that allows for custom merging of `allOf` schemas */\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf;\n /** Optional flag, if true, indicates this schema was required in the parent schema. */\n required?: boolean;\n}\n\n/** Computes the defaults for the current `schema` given the `rawFormData` and `parentDefaults` if any. This drills into\n * each level of the schema, recursively, to fill out every level of defaults provided by the schema.\n *\n * @param validator - an implementation of the `ValidatorType` interface that will be used when necessary\n * @param rawSchema - The schema for which the default state is desired\n * @param {ComputeDefaultsProps} computeDefaultsProps - Optional props for this function\n * @returns - The resulting `formData` with all the defaults provided\n */\nexport function computeDefaults(\n validator: ValidatorType,\n rawSchema: S,\n computeDefaultsProps: ComputeDefaultsProps = {}\n): T | T[] | undefined {\n const {\n parentDefaults,\n rawFormData,\n rootSchema = {} as S,\n includeUndefinedValues = false,\n _recurseList = [],\n experimental_defaultFormStateBehavior = undefined,\n experimental_customMergeAllOf = undefined,\n required,\n } = computeDefaultsProps;\n const formData: T = (isObject(rawFormData) ? rawFormData : {}) as T;\n const schema: S = isObject(rawSchema) ? rawSchema : ({} as S);\n // Compute the defaults recursively: give highest priority to deepest nodes.\n let defaults: T | T[] | undefined = parentDefaults;\n // If we get a new schema, then we need to recompute defaults again for the new schema found.\n let schemaToCompute: S | null = null;\n let experimental_dfsb_to_compute = experimental_defaultFormStateBehavior;\n let updatedRecurseList = _recurseList;\n\n if (schema[CONST_KEY] && experimental_defaultFormStateBehavior?.constAsDefaults !== 'never') {\n defaults = schema.const as unknown as T;\n } else if (isObject(defaults) && isObject(schema.default)) {\n // For object defaults, only override parent defaults that are defined in\n // schema.default.\n defaults = mergeObjects(defaults!, schema.default as GenericObjectType) as T;\n } else if (DEFAULT_KEY in schema) {\n defaults = schema.default as unknown as T;\n } else if (REF_KEY in schema) {\n const refName = schema[REF_KEY];\n // Use referenced schema defaults for this node.\n if (!_recurseList.includes(refName!)) {\n updatedRecurseList = _recurseList.concat(refName!);\n schemaToCompute = findSchemaDefinition(refName, rootSchema);\n }\n } else if (DEPENDENCIES_KEY in schema) {\n // Get the default if set from properties to ensure the dependencies conditions are resolved based on it\n const defaultFormData: T = {\n ...getDefaultBasedOnSchemaType(validator, schema, computeDefaultsProps, defaults),\n ...formData,\n };\n const resolvedSchema = resolveDependencies(\n validator,\n schema,\n rootSchema,\n false,\n [],\n defaultFormData,\n experimental_customMergeAllOf\n );\n schemaToCompute = resolvedSchema[0]; // pick the first element from resolve dependencies\n } else if (isFixedItems(schema)) {\n defaults = (schema.items! as S[]).map((itemSchema: S, idx: number) =>\n computeDefaults(validator, itemSchema, {\n rootSchema,\n includeUndefinedValues,\n _recurseList,\n experimental_defaultFormStateBehavior,\n experimental_customMergeAllOf,\n parentDefaults: Array.isArray(parentDefaults) ? parentDefaults[idx] : undefined,\n rawFormData: formData as T,\n required,\n })\n ) as T[];\n } else if (ONE_OF_KEY in schema) {\n const { oneOf, ...remaining } = schema;\n if (oneOf!.length === 0) {\n return undefined;\n }\n const discriminator = getDiscriminatorFieldFromSchema(schema);\n const { type = 'null' } = remaining;\n if (\n !Array.isArray(type) &&\n PRIMITIVE_TYPES.includes(type) &&\n experimental_dfsb_to_compute?.constAsDefaults === 'skipOneOf'\n ) {\n // If we are in a oneOf of a primitive type, then we want to pass constAsDefaults as 'never' for the recursion\n experimental_dfsb_to_compute = { ...experimental_dfsb_to_compute, constAsDefaults: 'never' };\n }\n schemaToCompute = oneOf![\n getClosestMatchingOption(\n validator,\n rootSchema,\n isEmpty(formData) ? undefined : formData,\n oneOf as S[],\n 0,\n discriminator,\n experimental_customMergeAllOf\n )\n ] as S;\n schemaToCompute = mergeSchemas(remaining, schemaToCompute) as S;\n } else if (ANY_OF_KEY in schema) {\n const { anyOf, ...remaining } = schema;\n if (anyOf!.length === 0) {\n return undefined;\n }\n const discriminator = getDiscriminatorFieldFromSchema(schema);\n schemaToCompute = anyOf![\n getClosestMatchingOption(\n validator,\n rootSchema,\n isEmpty(formData) ? undefined : formData,\n anyOf as S[],\n 0,\n discriminator,\n experimental_customMergeAllOf\n )\n ] as S;\n schemaToCompute = mergeSchemas(remaining, schemaToCompute) as S;\n }\n\n if (schemaToCompute) {\n return computeDefaults(validator, schemaToCompute, {\n rootSchema,\n includeUndefinedValues,\n _recurseList: updatedRecurseList,\n experimental_defaultFormStateBehavior: experimental_dfsb_to_compute,\n experimental_customMergeAllOf,\n parentDefaults: defaults as T | undefined,\n rawFormData: formData as T,\n required,\n });\n }\n\n // No defaults defined for this node, fallback to generic typed ones.\n if (defaults === undefined) {\n defaults = schema.default as unknown as T;\n }\n\n const defaultBasedOnSchemaType = getDefaultBasedOnSchemaType(validator, schema, computeDefaultsProps, defaults);\n\n return defaultBasedOnSchemaType ?? defaults;\n}\n\n/** Computes the default value for objects.\n *\n * @param validator - an implementation of the `ValidatorType` interface that will be used when necessary\n * @param rawSchema - The schema for which the default state is desired\n * @param {ComputeDefaultsProps} computeDefaultsProps - Optional props for this function\n * @param defaults - Optional props for this function\n * @returns - The default value based on the schema type if they are defined for object or array schemas.\n */\nexport function getObjectDefaults(\n validator: ValidatorType,\n rawSchema: S,\n {\n rawFormData,\n rootSchema = {} as S,\n includeUndefinedValues = false,\n _recurseList = [],\n experimental_defaultFormStateBehavior = undefined,\n experimental_customMergeAllOf = undefined,\n required,\n }: ComputeDefaultsProps = {},\n defaults?: T | T[] | undefined\n): T {\n {\n const formData: T = (isObject(rawFormData) ? rawFormData : {}) as T;\n const schema: S = rawSchema;\n // This is a custom addition that fixes this issue:\n // https://github.com/rjsf-team/react-jsonschema-form/issues/3832\n const retrievedSchema =\n experimental_defaultFormStateBehavior?.allOf === 'populateDefaults' && ALL_OF_KEY in schema\n ? retrieveSchema(validator, schema, rootSchema, formData, experimental_customMergeAllOf)\n : schema;\n const parentConst = retrievedSchema[CONST_KEY];\n const objectDefaults = Object.keys(retrievedSchema.properties || {}).reduce(\n (acc: GenericObjectType, key: string) => {\n const propertySchema = get(retrievedSchema, [PROPERTIES_KEY, key]);\n // Check if the parent schema has a const property defined AND we are supporting const as defaults, then we\n // should always return the computedDefault since it's coming from the const.\n const hasParentConst = isObject(parentConst) && (parentConst as JSONSchema7Object)[key] !== undefined;\n const hasConst =\n ((isObject(propertySchema) && CONST_KEY in propertySchema) || hasParentConst) &&\n experimental_defaultFormStateBehavior?.constAsDefaults !== 'never';\n // Compute the defaults for this node, with the parent defaults we might\n // have from a previous run: defaults[key].\n const computedDefault = computeDefaults(validator, propertySchema, {\n rootSchema,\n _recurseList,\n experimental_defaultFormStateBehavior,\n experimental_customMergeAllOf,\n includeUndefinedValues: includeUndefinedValues === true,\n parentDefaults: get(defaults, [key]),\n rawFormData: get(formData, [key]),\n required: retrievedSchema.required?.includes(key),\n });\n maybeAddDefaultToObject(\n acc,\n key,\n computedDefault,\n includeUndefinedValues,\n required,\n retrievedSchema.required,\n experimental_defaultFormStateBehavior,\n hasConst\n );\n return acc;\n },\n {}\n ) as T;\n if (retrievedSchema.additionalProperties) {\n // as per spec additionalProperties may be either schema or boolean\n const additionalPropertiesSchema = isObject(retrievedSchema.additionalProperties)\n ? retrievedSchema.additionalProperties\n : {};\n\n const keys = new Set();\n if (isObject(defaults)) {\n Object.keys(defaults as GenericObjectType)\n .filter((key) => !retrievedSchema.properties || !retrievedSchema.properties[key])\n .forEach((key) => keys.add(key));\n }\n const formDataRequired: string[] = [];\n Object.keys(formData as GenericObjectType)\n .filter((key) => !retrievedSchema.properties || !retrievedSchema.properties[key])\n .forEach((key) => {\n keys.add(key);\n formDataRequired.push(key);\n });\n keys.forEach((key) => {\n const computedDefault = computeDefaults(validator, additionalPropertiesSchema as S, {\n rootSchema,\n _recurseList,\n experimental_defaultFormStateBehavior,\n experimental_customMergeAllOf,\n includeUndefinedValues: includeUndefinedValues === true,\n parentDefaults: get(defaults, [key]),\n rawFormData: get(formData, [key]),\n required: retrievedSchema.required?.includes(key),\n });\n // Since these are additional properties we don't need to add the `experimental_defaultFormStateBehavior` prop\n maybeAddDefaultToObject(\n objectDefaults as GenericObjectType,\n key,\n computedDefault,\n includeUndefinedValues,\n required,\n formDataRequired\n );\n });\n }\n return objectDefaults;\n }\n}\n\n/** Computes the default value for arrays.\n *\n * @param validator - an implementation of the `ValidatorType` interface that will be used when necessary\n * @param rawSchema - The schema for which the default state is desired\n * @param {ComputeDefaultsProps} computeDefaultsProps - Optional props for this function\n * @param defaults - Optional props for this function\n * @returns - The default value based on the schema type if they are defined for object or array schemas.\n */\nexport function getArrayDefaults(\n validator: ValidatorType,\n rawSchema: S,\n {\n rawFormData,\n rootSchema = {} as S,\n _recurseList = [],\n experimental_defaultFormStateBehavior = undefined,\n experimental_customMergeAllOf = undefined,\n required,\n }: ComputeDefaultsProps = {},\n defaults?: T | T[] | undefined\n): T | T[] | undefined {\n const schema: S = rawSchema;\n\n const arrayMinItemsStateBehavior = experimental_defaultFormStateBehavior?.arrayMinItems ?? {};\n const { populate: arrayMinItemsPopulate, mergeExtraDefaults: arrayMergeExtraDefaults } = arrayMinItemsStateBehavior;\n\n const neverPopulate = arrayMinItemsPopulate === 'never';\n const ignoreMinItemsFlagSet = arrayMinItemsPopulate === 'requiredOnly';\n const isPopulateAll = arrayMinItemsPopulate === 'all' || (!neverPopulate && !ignoreMinItemsFlagSet);\n const computeSkipPopulate = arrayMinItemsStateBehavior?.computeSkipPopulate ?? (() => false);\n const isSkipEmptyDefaults = experimental_defaultFormStateBehavior?.emptyObjectFields === 'skipEmptyDefaults';\n\n const emptyDefault = isSkipEmptyDefaults ? undefined : [];\n\n // Inject defaults into existing array defaults\n if (Array.isArray(defaults)) {\n defaults = defaults.map((item, idx) => {\n const schemaItem: S = getInnerSchemaForArrayItem(schema, AdditionalItemsHandling.Fallback, idx);\n return computeDefaults(validator, schemaItem, {\n rootSchema,\n _recurseList,\n experimental_defaultFormStateBehavior,\n experimental_customMergeAllOf,\n parentDefaults: item,\n required,\n });\n }) as T[];\n }\n\n // Deeply inject defaults into already existing form data\n if (Array.isArray(rawFormData)) {\n const schemaItem: S = getInnerSchemaForArrayItem(schema);\n if (neverPopulate) {\n defaults = rawFormData;\n } else {\n const itemDefaults = rawFormData.map((item: T, idx: number) => {\n return computeDefaults(validator, schemaItem, {\n rootSchema,\n _recurseList,\n experimental_defaultFormStateBehavior,\n experimental_customMergeAllOf,\n rawFormData: item,\n parentDefaults: get(defaults, [idx]),\n required,\n });\n }) as T[];\n\n // If the populate 'requiredOnly' flag is set then we only merge and include extra defaults if they are required.\n // Or if populate 'all' is set we merge and include extra defaults.\n const mergeExtraDefaults = ((ignoreMinItemsFlagSet && required) || isPopulateAll) && arrayMergeExtraDefaults;\n defaults = mergeDefaultsWithFormData(defaults, itemDefaults, mergeExtraDefaults);\n }\n }\n\n // Check if the schema has a const property defined AND we are supporting const as defaults, then we should always\n // return the computedDefault since it's coming from the const.\n const hasConst =\n isObject(schema) && CONST_KEY in schema && experimental_defaultFormStateBehavior?.constAsDefaults !== 'never';\n if (hasConst === false) {\n if (neverPopulate) {\n return defaults ?? emptyDefault;\n }\n if (ignoreMinItemsFlagSet && !required) {\n // If no form data exists or defaults are set leave the field empty/non-existent, otherwise\n // return form data/defaults\n return defaults ? defaults : undefined;\n }\n }\n\n const defaultsLength = Array.isArray(defaults) ? defaults.length : 0;\n if (\n !schema.minItems ||\n isMultiSelect(validator, schema, rootSchema, experimental_customMergeAllOf) ||\n computeSkipPopulate(validator, schema, rootSchema) ||\n schema.minItems <= defaultsLength\n ) {\n return defaults ? defaults : emptyDefault;\n }\n\n const defaultEntries: T[] = (defaults || []) as T[];\n const fillerSchema: S = getInnerSchemaForArrayItem(schema, AdditionalItemsHandling.Invert);\n const fillerDefault = fillerSchema.default;\n\n // Calculate filler entries for remaining items (minItems - existing raw data/defaults)\n const fillerEntries: T[] = new Array(schema.minItems - defaultsLength).fill(\n computeDefaults(validator, fillerSchema, {\n parentDefaults: fillerDefault,\n rootSchema,\n _recurseList,\n experimental_defaultFormStateBehavior,\n experimental_customMergeAllOf,\n required,\n })\n ) as T[];\n // then fill up the rest with either the item default or empty, up to minItems\n return defaultEntries.concat(fillerEntries);\n}\n\n/** Computes the default value based on the schema type.\n *\n * @param validator - an implementation of the `ValidatorType` interface that will be used when necessary\n * @param rawSchema - The schema for which the default state is desired\n * @param {ComputeDefaultsProps} computeDefaultsProps - Optional props for this function\n * @param defaults - Optional props for this function\n * @returns - The default value based on the schema type if they are defined for object or array schemas.\n */\nexport function getDefaultBasedOnSchemaType<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(\n validator: ValidatorType,\n rawSchema: S,\n computeDefaultsProps: ComputeDefaultsProps = {},\n defaults?: T | T[] | undefined\n): T | T[] | void {\n switch (getSchemaType(rawSchema)) {\n // We need to recurse for object schema inner default values.\n case 'object': {\n return getObjectDefaults(validator, rawSchema, computeDefaultsProps, defaults);\n }\n case 'array': {\n return getArrayDefaults(validator, rawSchema, computeDefaultsProps, defaults);\n }\n }\n}\n\n/** Returns the superset of `formData` that includes the given set updated to include any missing fields that have\n * computed to have defaults provided in the `schema`.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary\n * @param theSchema - The schema for which the default state is desired\n * @param [formData] - The current formData, if any, onto which to provide any missing defaults\n * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s\n * @param [includeUndefinedValues=false] - Optional flag, if true, cause undefined values to be added as defaults.\n * If \"excludeObjectChildren\", cause undefined values for this object and pass `includeUndefinedValues` as\n * false when computing defaults for any nested object properties.\n * @param [experimental_defaultFormStateBehavior] Optional configuration object, if provided, allows users to override default form state behavior\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The resulting `formData` with all the defaults provided\n */\nexport default function getDefaultFormState<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(\n validator: ValidatorType,\n theSchema: S,\n formData?: T,\n rootSchema?: S,\n includeUndefinedValues: boolean | 'excludeObjectChildren' = false,\n experimental_defaultFormStateBehavior?: Experimental_DefaultFormStateBehavior,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n) {\n if (!isObject(theSchema)) {\n throw new Error('Invalid schema: ' + theSchema);\n }\n const schema = retrieveSchema(validator, theSchema, rootSchema, formData, experimental_customMergeAllOf);\n const defaults = computeDefaults(validator, schema, {\n rootSchema,\n includeUndefinedValues,\n experimental_defaultFormStateBehavior,\n experimental_customMergeAllOf,\n rawFormData: formData,\n });\n\n if (formData === undefined || formData === null || (typeof formData === 'number' && isNaN(formData))) {\n // No form data? Use schema defaults.\n return defaults;\n }\n const { mergeDefaultsIntoFormData, arrayMinItems = {} } = experimental_defaultFormStateBehavior || {};\n const { mergeExtraDefaults } = arrayMinItems;\n const defaultSupercedesUndefined = mergeDefaultsIntoFormData === 'useDefaultIfFormDataUndefined';\n if (isObject(formData)) {\n return mergeDefaultsWithFormData(defaults as T, formData, mergeExtraDefaults, defaultSupercedesUndefined);\n }\n if (Array.isArray(formData)) {\n return mergeDefaultsWithFormData(defaults as T[], formData, mergeExtraDefaults, defaultSupercedesUndefined);\n }\n return formData;\n}\n", "import jsonpointer from 'jsonpointer';\nimport omit from 'lodash/omit';\n\nimport { REF_KEY } from './constants';\nimport { GenericObjectType, RJSFSchema, StrictRJSFSchema } from './types';\n\n/** Splits out the value at the `key` in `object` from the `object`, returning an array that contains in the first\n * location, the `object` minus the `key: value` and in the second location the `value`.\n *\n * @param key - The key from the object to extract\n * @param object - The object from which to extract the element\n * @returns - An array with the first value being the object minus the `key` element and the second element being the\n * value from `object[key]`\n */\nexport function splitKeyElementFromObject(key: string, object: GenericObjectType) {\n const value = object[key];\n const remaining = omit(object, [key]);\n return [remaining, value];\n}\n\n/** Given the name of a `$ref` from within a schema, using the `rootSchema`, recursively look up and return the\n * sub-schema using the path provided by that reference. If `#` is not the first character of the reference, the path\n * does not exist in the schema, or the reference resolves circularly back to itself, then throw an Error.\n * Otherwise return the sub-schema. Also deals with nested `$ref`s in the sub-schema.\n *\n * @param $ref - The ref string for which the schema definition is desired\n * @param [rootSchema={}] - The root schema in which to search for the definition\n * @param recurseList - List of $refs already resolved to prevent recursion\n * @returns - The sub-schema within the `rootSchema` which matches the `$ref` if it exists\n * @throws - Error indicating that no schema for that reference could be resolved\n */\nexport function findSchemaDefinitionRecursive(\n $ref?: string,\n rootSchema: S = {} as S,\n recurseList: string[] = []\n): S {\n const ref = $ref || '';\n let decodedRef;\n if (ref.startsWith('#')) {\n // Decode URI fragment representation.\n decodedRef = decodeURIComponent(ref.substring(1));\n } else {\n throw new Error(`Could not find a definition for ${$ref}.`);\n }\n const current: S = jsonpointer.get(rootSchema, decodedRef);\n if (current === undefined) {\n throw new Error(`Could not find a definition for ${$ref}.`);\n }\n const nextRef = current[REF_KEY];\n if (nextRef) {\n // Check for circular references.\n if (recurseList.includes(nextRef)) {\n if (recurseList.length === 1) {\n throw new Error(`Definition for ${$ref} is a circular reference`);\n }\n const [firstRef, ...restRefs] = recurseList;\n const circularPath = [...restRefs, ref, firstRef].join(' -> ');\n throw new Error(`Definition for ${firstRef} contains a circular reference through ${circularPath}`);\n }\n const [remaining, theRef] = splitKeyElementFromObject(REF_KEY, current);\n const subSchema = findSchemaDefinitionRecursive(theRef, rootSchema, [...recurseList, ref]);\n if (Object.keys(remaining).length > 0) {\n return { ...remaining, ...subSchema };\n }\n return subSchema;\n }\n return current;\n}\n\n/** Given the name of a `$ref` from within a schema, using the `rootSchema`, look up and return the sub-schema using the\n * path provided by that reference. If `#` is not the first character of the reference, the path does not exist in\n * the schema, or the reference resolves circularly back to itself, then throw an Error. Otherwise return the\n * sub-schema. Also deals with nested `$ref`s in the sub-schema.\n *\n * @param $ref - The ref string for which the schema definition is desired\n * @param [rootSchema={}] - The root schema in which to search for the definition\n * @returns - The sub-schema within the `rootSchema` which matches the `$ref` if it exists\n * @throws - Error indicating that no schema for that reference could be resolved\n */\nexport default function findSchemaDefinition(\n $ref?: string,\n rootSchema: S = {} as S\n): S {\n const recurseList: string[] = [];\n return findSchemaDefinitionRecursive($ref, rootSchema, recurseList);\n}\n", "import get from 'lodash/get';\nimport has from 'lodash/has';\nimport isNumber from 'lodash/isNumber';\nimport isObject from 'lodash/isObject';\nimport isString from 'lodash/isString';\nimport reduce from 'lodash/reduce';\nimport times from 'lodash/times';\n\nimport getFirstMatchingOption from './getFirstMatchingOption';\nimport retrieveSchema, { resolveAllReferences } from './retrieveSchema';\nimport { ONE_OF_KEY, REF_KEY, JUNK_OPTION_ID, ANY_OF_KEY } from '../constants';\nimport guessType from '../guessType';\nimport { Experimental_CustomMergeAllOf, FormContextType, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types';\nimport getDiscriminatorFieldFromSchema from '../getDiscriminatorFieldFromSchema';\nimport getOptionMatchingSimpleDiscriminator from '../getOptionMatchingSimpleDiscriminator';\n\n/** A junk option used to determine when the getFirstMatchingOption call really matches an option rather than returning\n * the first item\n */\nexport const JUNK_OPTION: StrictRJSFSchema = {\n type: 'object',\n $id: JUNK_OPTION_ID,\n properties: {\n __not_really_there__: {\n type: 'number',\n },\n },\n};\n\n/** Recursive function that calculates the score of a `formData` against the given `schema`. The computation is fairly\n * simple. Initially the total score is 0. When `schema.properties` object exists, then all the `key/value` pairs within\n * the object are processed as follows after obtaining the formValue from `formData` using the `key`:\n * - If the `value` contains a `$ref`, `calculateIndexScore()` is called recursively with the formValue and the new\n * schema that is the result of the ref in the schema being resolved and that sub-schema's resulting score is added to\n * the total.\n * - If the `value` contains a `oneOf` and there is a formValue, then score based on the index returned from calling\n * `getClosestMatchingOption()` of that oneOf.\n * - If the type of the `value` is 'object', `calculateIndexScore()` is called recursively with the formValue and the\n * `value` itself as the sub-schema, and the score is added to the total.\n * - If the type of the `value` matches the guessed-type of the `formValue`, the score is incremented by 1, UNLESS the\n * value has a `default` or `const`. In those case, if the `default` or `const` and the `formValue` match, the score\n * is incremented by another 1 otherwise it is decremented by 1.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary\n * @param rootSchema - The root JSON schema of the entire form\n * @param schema - The schema for which the score is being calculated\n * @param formData - The form data associated with the schema, used to calculate the score\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The score a schema against the formData\n */\nexport function calculateIndexScore(\n validator: ValidatorType,\n rootSchema: S,\n schema?: S,\n formData?: any,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): number {\n let totalScore = 0;\n if (schema) {\n if (isObject(schema.properties)) {\n totalScore += reduce(\n schema.properties,\n (score, value, key) => {\n const formValue = get(formData, key);\n if (typeof value === 'boolean') {\n return score;\n }\n if (has(value, REF_KEY)) {\n const newSchema = retrieveSchema(\n validator,\n value as S,\n rootSchema,\n formValue,\n experimental_customMergeAllOf\n );\n return (\n score +\n calculateIndexScore(\n validator,\n rootSchema,\n newSchema,\n formValue || {},\n experimental_customMergeAllOf\n )\n );\n }\n if ((has(value, ONE_OF_KEY) || has(value, ANY_OF_KEY)) && formValue) {\n const key = has(value, ONE_OF_KEY) ? ONE_OF_KEY : ANY_OF_KEY;\n const discriminator = getDiscriminatorFieldFromSchema(value as S);\n return (\n score +\n getClosestMatchingOption(\n validator,\n rootSchema,\n formValue,\n get(value, key) as S[],\n -1,\n discriminator,\n experimental_customMergeAllOf\n )\n );\n }\n if (value.type === 'object') {\n if (isObject(formValue)) {\n // If the structure is matching then give it a little boost in score\n score += 1;\n }\n return (\n score +\n calculateIndexScore(validator, rootSchema, value as S, formValue, experimental_customMergeAllOf)\n );\n }\n if (value.type === guessType(formValue)) {\n // If the types match, then we bump the score by one\n let newScore = score + 1;\n if (value.default) {\n // If the schema contains a readonly default value score the value that matches the default higher and\n // any non-matching value lower\n newScore += formValue === value.default ? 1 : -1;\n } else if (value.const) {\n // If the schema contains a const value score the value that matches the default higher and\n // any non-matching value lower\n newScore += formValue === value.const ? 1 : -1;\n }\n // TODO eventually, deal with enums/arrays\n return newScore;\n }\n return score;\n },\n 0\n );\n } else if (isString(schema.type) && schema.type === guessType(formData)) {\n totalScore += 1;\n }\n }\n return totalScore;\n}\n\n/** Determines which of the given `options` provided most closely matches the `formData`. Using\n * `getFirstMatchingOption()` to match two schemas that differ only by the readOnly, default or const value of a field\n * based on the `formData` and returns 0 when there is no match. Rather than passing in all the `options` at once to\n * this utility, instead an array of valid option indexes is created by iterating over the list of options, call\n * `getFirstMatchingOptions` with a list of one junk option and one good option, seeing if the good option is considered\n * matched.\n *\n * Once the list of valid indexes is created, if there is only one valid index, just return it. Otherwise, if there are\n * no valid indexes, then fill the valid indexes array with the indexes of all the options. Next, the index of the\n * option with the highest score is determined by iterating over the list of valid options, calling\n * `calculateIndexScore()` on each, comparing it against the current best score, and returning the index of the one that\n * eventually has the best score.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary\n * @param rootSchema - The root JSON schema of the entire form\n * @param formData - The form data associated with the schema\n * @param options - The list of options that can be selected from\n * @param [selectedOption=-1] - The index of the currently selected option, defaulted to -1 if not specified\n * @param [discriminatorField] - The optional name of the field within the options object whose value is used to\n * determine which option is selected\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The index of the option that is the closest match to the `formData` or the `selectedOption` if no match\n */\nexport default function getClosestMatchingOption<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(\n validator: ValidatorType,\n rootSchema: S,\n formData: T | undefined,\n options: S[],\n selectedOption = -1,\n discriminatorField?: string,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): number {\n // First resolve any refs in the options\n const resolvedOptions = options.map((option) => {\n return resolveAllReferences(option, rootSchema, []);\n });\n\n const simpleDiscriminatorMatch = getOptionMatchingSimpleDiscriminator(formData, options, discriminatorField);\n if (isNumber(simpleDiscriminatorMatch)) {\n return simpleDiscriminatorMatch;\n }\n\n // Reduce the array of options down to a list of the indexes that are considered matching options\n const allValidIndexes = resolvedOptions.reduce((validList: number[], option, index: number) => {\n const testOptions: S[] = [JUNK_OPTION as S, option];\n const match = getFirstMatchingOption(validator, formData, testOptions, rootSchema, discriminatorField);\n // The match is the real option, so add its index to list of valid indexes\n if (match === 1) {\n validList.push(index);\n }\n return validList;\n }, []);\n\n // There is only one valid index, so return it!\n if (allValidIndexes.length === 1) {\n return allValidIndexes[0];\n }\n if (!allValidIndexes.length) {\n // No indexes were valid, so we'll score all the options, add all the indexes\n times(resolvedOptions.length, (i) => allValidIndexes.push(i));\n }\n type BestType = { bestIndex: number; bestScore: number };\n const scoreCount = new Set();\n // Score all the options in the list of valid indexes and return the index with the best score\n const { bestIndex }: BestType = allValidIndexes.reduce(\n (scoreData: BestType, index: number) => {\n const { bestScore } = scoreData;\n const option = resolvedOptions[index];\n const score = calculateIndexScore(validator, rootSchema, option, formData, experimental_customMergeAllOf);\n scoreCount.add(score);\n if (score > bestScore) {\n return { bestIndex: index, bestScore: score };\n }\n return scoreData;\n },\n { bestIndex: selectedOption, bestScore: 0 }\n );\n // if all scores are the same go with selectedOption\n if (scoreCount.size === 1 && selectedOption >= 0) {\n return selectedOption;\n }\n\n return bestIndex;\n}\n", "import get from 'lodash/get';\nimport has from 'lodash/has';\nimport isNumber from 'lodash/isNumber';\n\nimport { PROPERTIES_KEY } from '../constants';\nimport { FormContextType, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types';\nimport getOptionMatchingSimpleDiscriminator from '../getOptionMatchingSimpleDiscriminator';\n\n/** Given the `formData` and list of `options`, attempts to find the index of the option that best matches the data.\n * Deprecated, use `getFirstMatchingOption()` instead.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary\n * @param formData - The current formData, if any, used to figure out a match\n * @param options - The list of options to find a matching options from\n * @param rootSchema - The root schema, used to primarily to look up `$ref`s\n * @param [discriminatorField] - The optional name of the field within the options object whose value is used to\n * determine which option is selected\n * @returns - The index of the matched option or 0 if none is available\n * @deprecated\n */\nexport default function getMatchingOption<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(\n validator: ValidatorType,\n formData: T | undefined,\n options: S[],\n rootSchema: S,\n discriminatorField?: string\n): number {\n // For performance, skip validating subschemas if formData is undefined. We just\n // want to get the first option in that case.\n if (formData === undefined) {\n return 0;\n }\n\n const simpleDiscriminatorMatch = getOptionMatchingSimpleDiscriminator(formData, options, discriminatorField);\n if (isNumber(simpleDiscriminatorMatch)) {\n return simpleDiscriminatorMatch;\n }\n\n for (let i = 0; i < options.length; i++) {\n const option = options[i];\n\n // If we have a discriminator field, then we will use this to make the determination\n if (discriminatorField && has(option, [PROPERTIES_KEY, discriminatorField])) {\n const value = get(formData, discriminatorField);\n const discriminator = get(option, [PROPERTIES_KEY, discriminatorField], {});\n if (validator.isValid(discriminator, value, rootSchema)) {\n return i;\n }\n } else if (option[PROPERTIES_KEY]) {\n // If the schema describes an object then we need to add slightly more\n // strict matching to the schema, because unless the schema uses the\n // \"requires\" keyword, an object will match the schema as long as it\n // doesn't have matching keys with a conflicting type. To do this we use an\n // \"anyOf\" with an array of requires. This augmentation expresses that the\n // schema should match if any of the keys in the schema are present on the\n // object and pass validation.\n //\n // Create an \"anyOf\" schema that requires at least one of the keys in the\n // \"properties\" object\n const requiresAnyOf = {\n anyOf: Object.keys(option[PROPERTIES_KEY]).map((key) => ({\n required: [key],\n })),\n };\n\n let augmentedSchema;\n\n // If the \"anyOf\" keyword already exists, wrap the augmentation in an \"allOf\"\n if (option.anyOf) {\n // Create a shallow clone of the option\n const { ...shallowClone } = option;\n\n if (!shallowClone.allOf) {\n shallowClone.allOf = [];\n } else {\n // If \"allOf\" already exists, shallow clone the array\n shallowClone.allOf = shallowClone.allOf.slice();\n }\n\n shallowClone.allOf.push(requiresAnyOf);\n\n augmentedSchema = shallowClone;\n } else {\n augmentedSchema = Object.assign({}, option, requiresAnyOf);\n }\n\n // Remove the \"required\" field as it's likely that not all fields have\n // been filled in yet, which will mean that the schema is not valid\n delete augmentedSchema.required;\n\n if (validator.isValid(augmentedSchema, formData, rootSchema)) {\n return i;\n }\n } else if (validator.isValid(option, formData, rootSchema)) {\n return i;\n }\n }\n return 0;\n}\n", "import get from 'lodash/get';\nimport { PROPERTIES_KEY } from './constants';\nimport { RJSFSchema, StrictRJSFSchema } from './types';\n\n/** Compares the value of `discriminatorField` within `formData` against the value of `discriminatorField` within schema for each `option`.\n * Returns index of first `option` whose discriminator matches formData. Returns `undefined` if there is no match.\n * This function does not work with discriminators of `\"type\": \"object\"` and `\"type\": \"array\"`\n *\n * @param formData - The current formData, if any, used to figure out a match\n * @param options - The list of options to find a matching options from\n * @param [discriminatorField] - The optional name of the field within the options object whose value is used to\n * determine which option is selected\n * @returns - The index of the matched option or undefined if there is no match\n */\nexport default function getOptionMatchingSimpleDiscriminator(\n formData: T | undefined,\n options: S[],\n discriminatorField?: string\n): number | undefined {\n if (formData && discriminatorField) {\n const value = get(formData, discriminatorField);\n\n if (value === undefined) {\n return;\n }\n\n for (let i = 0; i < options.length; i++) {\n const option = options[i];\n const discriminator = get(option, [PROPERTIES_KEY, discriminatorField], {});\n\n if (discriminator.type === 'object' || discriminator.type === 'array') {\n continue;\n }\n\n if (discriminator.const === value) {\n return i;\n }\n\n if (discriminator.enum?.includes(value)) {\n return i;\n }\n }\n }\n\n return;\n}\n", "import getMatchingOption from './getMatchingOption';\nimport { FormContextType, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types';\n\n/** Given the `formData` and list of `options`, attempts to find the index of the first option that matches the data.\n * Always returns the first option if there is nothing that matches.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary\n * @param formData - The current formData, if any, used to figure out a match\n * @param options - The list of options to find a matching options from\n * @param rootSchema - The root schema, used to primarily to look up `$ref`s\n * @param [discriminatorField] - The optional name of the field within the options object whose value is used to\n * determine which option is selected\n * @returns - The index of the first matched option or 0 if none is available\n */\nexport default function getFirstMatchingOption<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(\n validator: ValidatorType,\n formData: T | undefined,\n options: S[],\n rootSchema: S,\n discriminatorField?: string\n): number {\n return getMatchingOption(validator, formData, options, rootSchema, discriminatorField);\n}\n", "import get from 'lodash/get';\nimport isEqual from 'lodash/isEqual';\nimport set from 'lodash/set';\nimport times from 'lodash/times';\nimport transform from 'lodash/transform';\nimport merge from 'lodash/merge';\nimport flattenDeep from 'lodash/flattenDeep';\nimport uniq from 'lodash/uniq';\nimport mergeAllOf, { Options } from 'json-schema-merge-allof';\n\nimport {\n ADDITIONAL_PROPERTIES_KEY,\n ADDITIONAL_PROPERTY_FLAG,\n ALL_OF_KEY,\n ANY_OF_KEY,\n DEPENDENCIES_KEY,\n IF_KEY,\n ONE_OF_KEY,\n REF_KEY,\n PROPERTIES_KEY,\n ITEMS_KEY,\n} from '../constants';\nimport findSchemaDefinition, { splitKeyElementFromObject } from '../findSchemaDefinition';\nimport getDiscriminatorFieldFromSchema from '../getDiscriminatorFieldFromSchema';\nimport guessType from '../guessType';\nimport isObject from '../isObject';\nimport mergeSchemas from '../mergeSchemas';\nimport {\n Experimental_CustomMergeAllOf,\n FormContextType,\n GenericObjectType,\n RJSFSchema,\n StrictRJSFSchema,\n ValidatorType,\n} from '../types';\nimport getFirstMatchingOption from './getFirstMatchingOption';\n\n/** Retrieves an expanded schema that has had all of its conditions, additional properties, references and dependencies\n * resolved and merged into the `schema` given a `validator`, `rootSchema` and `rawFormData` that is used to do the\n * potentially recursive resolution.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs\n * @param schema - The schema for which retrieving a schema is desired\n * @param [rootSchema={}] - The root schema that will be forwarded to all the APIs\n * @param [rawFormData] - The current formData, if any, to assist retrieving a schema\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The schema having its conditions, additional properties, references and dependencies resolved\n */\nexport default function retrieveSchema<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(\n validator: ValidatorType,\n schema: S,\n rootSchema: S = {} as S,\n rawFormData?: T,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): S {\n return retrieveSchemaInternal(\n validator,\n schema,\n rootSchema,\n rawFormData,\n undefined,\n undefined,\n experimental_customMergeAllOf\n )[0];\n}\n\n/** Resolves a conditional block (if/else/then) by removing the condition and merging the appropriate conditional branch\n * with the rest of the schema. If `expandAllBranches` is true, then the `retrieveSchemaInteral()` results for both\n * conditions will be returned.\n *\n * @param validator - An implementation of the `ValidatorType` interface that is used to detect valid schema conditions\n * @param schema - The schema for which resolving a condition is desired\n * @param rootSchema - The root schema that will be forwarded to all the APIs\n * @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and\n * dependencies as a list of schemas\n * @param recurseList - The list of recursive references already processed\n * @param [formData] - The current formData to assist retrieving a schema\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - A list of schemas with the appropriate conditions resolved, possibly with all branches expanded\n */\nexport function resolveCondition(\n validator: ValidatorType,\n schema: S,\n rootSchema: S,\n expandAllBranches: boolean,\n recurseList: string[],\n formData?: T,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): S[] {\n const { if: expression, then, else: otherwise, ...resolvedSchemaLessConditional } = schema;\n\n const conditionValue = validator.isValid(expression as S, formData || ({} as T), rootSchema);\n let resolvedSchemas = [resolvedSchemaLessConditional as S];\n let schemas: S[] = [];\n if (expandAllBranches) {\n if (then && typeof then !== 'boolean') {\n schemas = schemas.concat(\n retrieveSchemaInternal(\n validator,\n then as S,\n rootSchema,\n formData,\n expandAllBranches,\n recurseList,\n experimental_customMergeAllOf\n )\n );\n }\n if (otherwise && typeof otherwise !== 'boolean') {\n schemas = schemas.concat(\n retrieveSchemaInternal(\n validator,\n otherwise as S,\n rootSchema,\n formData,\n expandAllBranches,\n recurseList,\n experimental_customMergeAllOf\n )\n );\n }\n } else {\n const conditionalSchema = conditionValue ? then : otherwise;\n if (conditionalSchema && typeof conditionalSchema !== 'boolean') {\n schemas = schemas.concat(\n retrieveSchemaInternal(\n validator,\n conditionalSchema as S,\n rootSchema,\n formData,\n expandAllBranches,\n recurseList,\n experimental_customMergeAllOf\n )\n );\n }\n }\n if (schemas.length) {\n resolvedSchemas = schemas.map((s) => mergeSchemas(resolvedSchemaLessConditional, s) as S);\n }\n return resolvedSchemas.flatMap((s) =>\n retrieveSchemaInternal(\n validator,\n s,\n rootSchema,\n formData,\n expandAllBranches,\n recurseList,\n experimental_customMergeAllOf\n )\n );\n}\n\n/** Given a list of lists of allOf, anyOf or oneOf values, create a list of lists of all permutations of the values. The\n * `listOfLists` is expected to be all resolved values of the 1st...nth schemas within an `allOf`, `anyOf` or `oneOf`.\n * From those lists, build a matrix for each `xxxOf` where there is more than one schema for a row in the list of lists.\n *\n * For example:\n * - If there are three xxxOf rows (A, B, C) and they have been resolved such that there is only one A, two B and three\n * C schemas then:\n * - The permutation for the first row is `[[A]]`\n * - The permutations for the second row are `[[A,B1], [A,B2]]`\n * - The permutations for the third row are `[[A,B1,C1], [A,B1,C2], [A,B1,C3], [A,B2,C1], [A,B2,C2], [A,B2,C3]]`\n *\n * @param listOfLists - The list of lists of elements that represent the allOf, anyOf or oneOf resolved values in order\n * @returns - The list of all permutations of schemas for a set of `xxxOf`s\n */\nexport function getAllPermutationsOfXxxOf(listOfLists: S[][]) {\n const allPermutations: S[][] = listOfLists.reduce(\n (permutations, list) => {\n // When there are more than one set of schemas for a row, duplicate the set of permutations and add in the values\n if (list.length > 1) {\n return list.flatMap((element) => times(permutations.length, (i) => [...permutations[i]].concat(element)));\n }\n // Otherwise just push in the single value into the current set of permutations\n permutations.forEach((permutation) => permutation.push(list[0]));\n return permutations;\n },\n [[]] as S[][] // Start with an empty list\n );\n\n return allPermutations;\n}\n\n/** Resolves references and dependencies within a schema and its 'allOf' children. Passes the `expandAllBranches` flag\n * down to the `retrieveSchemaInternal()`, `resolveReference()` and `resolveDependencies()` helper calls. If\n * `expandAllBranches` is true, then all possible dependencies and/or allOf branches are returned.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs\n * @param schema - The schema for which resolving a schema is desired\n * @param rootSchema - The root schema that will be forwarded to all the APIs\n * @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and dependencies\n * as a list of schemas\n * @param recurseList - The list of recursive references already processed\n * @param [formData] - The current formData, if any, to assist retrieving a schema\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The list of schemas having its references, dependencies and allOf schemas resolved\n */\nexport function resolveSchema(\n validator: ValidatorType,\n schema: S,\n rootSchema: S,\n expandAllBranches: boolean,\n recurseList: string[],\n formData?: T,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): S[] {\n const updatedSchemas = resolveReference(\n validator,\n schema,\n rootSchema,\n expandAllBranches,\n recurseList,\n formData\n );\n if (updatedSchemas.length > 1 || updatedSchemas[0] !== schema) {\n // return the updatedSchemas array if it has either multiple schemas within it\n // OR the first schema is not the same as the original schema\n return updatedSchemas;\n }\n if (DEPENDENCIES_KEY in schema) {\n const resolvedSchemas = resolveDependencies(\n validator,\n schema,\n rootSchema,\n expandAllBranches,\n recurseList,\n formData\n );\n return resolvedSchemas.flatMap((s) => {\n return retrieveSchemaInternal(\n validator,\n s,\n rootSchema,\n formData,\n expandAllBranches,\n recurseList,\n experimental_customMergeAllOf\n );\n });\n }\n if (ALL_OF_KEY in schema && Array.isArray(schema.allOf)) {\n const allOfSchemaElements: S[][] = schema.allOf.map((allOfSubschema) =>\n retrieveSchemaInternal(\n validator,\n allOfSubschema as S,\n rootSchema,\n formData,\n expandAllBranches,\n recurseList,\n experimental_customMergeAllOf\n )\n );\n const allPermutations = getAllPermutationsOfXxxOf(allOfSchemaElements);\n return allPermutations.map((permutation) => ({ ...schema, allOf: permutation }));\n }\n // No $ref or dependencies or allOf attribute was found, returning the original schema.\n return [schema];\n}\n\n/** Resolves all references within a schema and then returns the `retrieveSchemaInternal()` if the resolved schema is\n * actually different than the original. Passes the `expandAllBranches` flag down to the `retrieveSchemaInternal()`\n * helper call.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs\n * @param schema - The schema for which resolving a reference is desired\n * @param rootSchema - The root schema that will be forwarded to all the APIs\n * @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and dependencies\n * as a list of schemas\n * @param recurseList - The list of recursive references already processed\n * @param [formData] - The current formData, if any, to assist retrieving a schema\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The list schemas retrieved after having all references resolved\n */\nexport function resolveReference(\n validator: ValidatorType,\n schema: S,\n rootSchema: S,\n expandAllBranches: boolean,\n recurseList: string[],\n formData?: T,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): S[] {\n const updatedSchema = resolveAllReferences(schema, rootSchema, recurseList);\n if (updatedSchema !== schema) {\n // Only call this if the schema was actually changed by the `resolveAllReferences()` function\n return retrieveSchemaInternal(\n validator,\n updatedSchema,\n rootSchema,\n formData,\n expandAllBranches,\n recurseList,\n experimental_customMergeAllOf\n );\n }\n return [schema];\n}\n\n/** Resolves all references within the schema itself as well as any of its properties and array items.\n *\n * @param schema - The schema for which resolving all references is desired\n * @param rootSchema - The root schema that will be forwarded to all the APIs\n * @param recurseList - List of $refs already resolved to prevent recursion\n * @returns - given schema will all references resolved or the original schema if no internal `$refs` were resolved\n */\nexport function resolveAllReferences(\n schema: S,\n rootSchema: S,\n recurseList: string[]\n): S {\n if (!isObject(schema)) {\n return schema;\n }\n let resolvedSchema: S = schema;\n // resolve top level ref\n if (REF_KEY in resolvedSchema) {\n const { $ref, ...localSchema } = resolvedSchema;\n // Check for a recursive reference and stop the loop\n if (recurseList.includes($ref!)) {\n return resolvedSchema;\n }\n recurseList.push($ref!);\n // Retrieve the referenced schema definition.\n const refSchema = findSchemaDefinition($ref, rootSchema);\n resolvedSchema = { ...refSchema, ...localSchema };\n }\n\n if (PROPERTIES_KEY in resolvedSchema) {\n const childrenLists: string[][] = [];\n const updatedProps = transform(\n resolvedSchema[PROPERTIES_KEY]!,\n (result, value, key: string) => {\n const childList: string[] = [...recurseList];\n result[key] = resolveAllReferences(value as S, rootSchema, childList);\n childrenLists.push(childList);\n },\n {} as RJSFSchema\n );\n merge(recurseList, uniq(flattenDeep(childrenLists)));\n resolvedSchema = { ...resolvedSchema, [PROPERTIES_KEY]: updatedProps };\n }\n\n if (\n ITEMS_KEY in resolvedSchema &&\n !Array.isArray(resolvedSchema.items) &&\n typeof resolvedSchema.items !== 'boolean'\n ) {\n resolvedSchema = {\n ...resolvedSchema,\n items: resolveAllReferences(resolvedSchema.items as S, rootSchema, recurseList),\n };\n }\n\n return isEqual(schema, resolvedSchema) ? schema : resolvedSchema;\n}\n\n/** Creates new 'properties' items for each key in the `formData`\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary\n * @param theSchema - The schema for which the existing additional properties is desired\n * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s * @param validator\n * @param [aFormData] - The current formData, if any, to assist retrieving a schema\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The updated schema with additional properties stubbed\n */\nexport function stubExistingAdditionalProperties<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(\n validator: ValidatorType,\n theSchema: S,\n rootSchema?: S,\n aFormData?: T,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): S {\n // Clone the schema so that we don't ruin the consumer's original\n const schema = {\n ...theSchema,\n properties: { ...theSchema.properties },\n };\n\n // make sure formData is an object\n const formData: GenericObjectType = aFormData && isObject(aFormData) ? aFormData : {};\n Object.keys(formData).forEach((key) => {\n if (key in schema.properties) {\n // No need to stub, our schema already has the property\n return;\n }\n\n let additionalProperties: S['additionalProperties'] = {};\n if (typeof schema.additionalProperties !== 'boolean') {\n if (REF_KEY in schema.additionalProperties!) {\n additionalProperties = retrieveSchema(\n validator,\n { $ref: get(schema.additionalProperties, [REF_KEY]) } as S,\n rootSchema,\n formData as T,\n experimental_customMergeAllOf\n );\n } else if ('type' in schema.additionalProperties!) {\n additionalProperties = { ...schema.additionalProperties };\n } else if (ANY_OF_KEY in schema.additionalProperties! || ONE_OF_KEY in schema.additionalProperties!) {\n additionalProperties = {\n type: 'object',\n ...schema.additionalProperties,\n };\n } else {\n additionalProperties = { type: guessType(get(formData, [key])) };\n }\n } else {\n additionalProperties = { type: guessType(get(formData, [key])) };\n }\n\n // The type of our new key should match the additionalProperties value;\n schema.properties[key] = additionalProperties;\n // Set our additional property flag so we know it was dynamically added\n set(schema.properties, [key, ADDITIONAL_PROPERTY_FLAG], true);\n });\n\n return schema;\n}\n\n/** Internal handler that retrieves an expanded schema that has had all of its conditions, additional properties,\n * references and dependencies resolved and merged into the `schema` given a `validator`, `rootSchema` and `rawFormData`\n * that is used to do the potentially recursive resolution. If `expandAllBranches` is true, then all possible branches\n * of the schema and its references, conditions and dependencies are returned.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs\n * @param schema - The schema for which retrieving a schema is desired\n * @param rootSchema - The root schema that will be forwarded to all the APIs\n * @param [rawFormData] - The current formData, if any, to assist retrieving a schema\n * @param [expandAllBranches=false] - Flag, if true, will return all possible branches of conditions, any/oneOf and\n * dependencies as a list of schemas\n * @param [recurseList=[]] - The optional, list of recursive references already processed\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The schema(s) resulting from having its conditions, additional properties, references and dependencies\n * resolved. Multiple schemas may be returned if `expandAllBranches` is true.\n */\nexport function retrieveSchemaInternal<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(\n validator: ValidatorType,\n schema: S,\n rootSchema: S,\n rawFormData?: T,\n expandAllBranches = false,\n recurseList: string[] = [],\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): S[] {\n if (!isObject(schema)) {\n return [{} as S];\n }\n const resolvedSchemas = resolveSchema(\n validator,\n schema,\n rootSchema,\n expandAllBranches,\n recurseList,\n rawFormData,\n experimental_customMergeAllOf\n );\n return resolvedSchemas.flatMap((s: S) => {\n let resolvedSchema = s;\n if (IF_KEY in resolvedSchema) {\n return resolveCondition(\n validator,\n resolvedSchema,\n rootSchema,\n expandAllBranches,\n recurseList,\n rawFormData as T,\n experimental_customMergeAllOf\n );\n }\n if (ALL_OF_KEY in resolvedSchema) {\n // resolve allOf schemas\n if (expandAllBranches) {\n const { allOf, ...restOfSchema } = resolvedSchema;\n return [...(allOf as S[]), restOfSchema as S];\n }\n try {\n const withContainsSchemas = [] as S[];\n const withoutContainsSchemas = [] as S[];\n resolvedSchema.allOf?.forEach((s) => {\n if (typeof s === 'object' && s.contains) {\n withContainsSchemas.push(s as S);\n } else {\n withoutContainsSchemas.push(s as S);\n }\n });\n if (withContainsSchemas.length) {\n resolvedSchema = { ...resolvedSchema, allOf: withoutContainsSchemas };\n }\n resolvedSchema = experimental_customMergeAllOf\n ? experimental_customMergeAllOf(resolvedSchema)\n : (mergeAllOf(resolvedSchema, {\n deep: false,\n } as Options) as S);\n if (withContainsSchemas.length) {\n resolvedSchema.allOf = withContainsSchemas;\n }\n } catch (e) {\n console.warn('could not merge subschemas in allOf:\\n', e);\n const { allOf, ...resolvedSchemaWithoutAllOf } = resolvedSchema;\n return resolvedSchemaWithoutAllOf as S;\n }\n }\n const hasAdditionalProperties =\n ADDITIONAL_PROPERTIES_KEY in resolvedSchema && resolvedSchema.additionalProperties !== false;\n if (hasAdditionalProperties) {\n return stubExistingAdditionalProperties(\n validator,\n resolvedSchema,\n rootSchema,\n rawFormData as T,\n experimental_customMergeAllOf\n );\n }\n\n return resolvedSchema;\n });\n}\n\n/** Resolves an `anyOf` or `oneOf` within a schema (if present) to the list of schemas returned from\n * `retrieveSchemaInternal()` for the best matching option. If `expandAllBranches` is true, then a list of schemas for ALL\n * options are retrieved and returned.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs\n * @param schema - The schema for which retrieving a schema is desired\n * @param rootSchema - The root schema that will be forwarded to all the APIs\n * @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and dependencies\n * as a list of schemas\n * @param [rawFormData] - The current formData, if any, to assist retrieving a schema, defaults to an empty object\n * @returns - Either an array containing the best matching option or all options if `expandAllBranches` is true\n */\nexport function resolveAnyOrOneOfSchemas<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(validator: ValidatorType, schema: S, rootSchema: S, expandAllBranches: boolean, rawFormData?: T) {\n let anyOrOneOf: S[] | undefined;\n const { oneOf, anyOf, ...remaining } = schema;\n if (Array.isArray(oneOf)) {\n anyOrOneOf = oneOf as S[];\n } else if (Array.isArray(anyOf)) {\n anyOrOneOf = anyOf as S[];\n }\n if (anyOrOneOf) {\n // Ensure that during expand all branches we pass an object rather than undefined so that all options are interrogated\n const formData = rawFormData === undefined && expandAllBranches ? ({} as T) : rawFormData;\n const discriminator = getDiscriminatorFieldFromSchema(schema);\n anyOrOneOf = anyOrOneOf.map((s) => {\n // Due to anyOf/oneOf possibly using the same $ref we always pass a fresh recurse list array so that each option\n // can resolve recursive references independently\n return resolveAllReferences(s, rootSchema, []);\n });\n // Call this to trigger the set of isValid() calls that the schema parser will need\n const option = getFirstMatchingOption(validator, formData, anyOrOneOf, rootSchema, discriminator);\n if (expandAllBranches) {\n return anyOrOneOf.map((item) => mergeSchemas(remaining, item) as S);\n }\n schema = mergeSchemas(remaining, anyOrOneOf[option]) as S;\n }\n return [schema];\n}\n\n/** Resolves dependencies within a schema and its 'anyOf/oneOf' children. Passes the `expandAllBranches` flag down to\n * the `resolveAnyOrOneOfSchema()` and `processDependencies()` helper calls.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs\n * @param schema - The schema for which resolving a dependency is desired\n * @param rootSchema - The root schema that will be forwarded to all the APIs\n * @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and dependencies\n * as a list of schemas\n * @param recurseList - The list of recursive references already processed\n * @param [formData] - The current formData, if any, to assist retrieving a schema\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The list of schemas with their dependencies resolved\n */\nexport function resolveDependencies(\n validator: ValidatorType,\n schema: S,\n rootSchema: S,\n expandAllBranches: boolean,\n recurseList: string[],\n formData?: T,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): S[] {\n // Drop the dependencies from the source schema.\n const { dependencies, ...remainingSchema } = schema;\n const resolvedSchemas = resolveAnyOrOneOfSchemas(\n validator,\n remainingSchema as S,\n rootSchema,\n expandAllBranches,\n formData\n );\n return resolvedSchemas.flatMap((resolvedSchema) =>\n processDependencies(\n validator,\n dependencies,\n resolvedSchema,\n rootSchema,\n expandAllBranches,\n recurseList,\n formData,\n experimental_customMergeAllOf\n )\n );\n}\n\n/** Processes all the `dependencies` recursively into the list of `resolvedSchema`s as needed. Passes the\n * `expandAllBranches` flag down to the `withDependentSchema()` and the recursive `processDependencies()` helper calls.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs\n * @param dependencies - The set of dependencies that needs to be processed\n * @param resolvedSchema - The schema for which processing dependencies is desired\n * @param rootSchema - The root schema that will be forwarded to all the APIs\n * @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and dependencies\n * as a list of schemas\n * @param recurseList - The list of recursive references already processed\n * @param [formData] - The current formData, if any, to assist retrieving a schema\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The schema with the `dependencies` resolved into it\n */\nexport function processDependencies(\n validator: ValidatorType,\n dependencies: S['dependencies'],\n resolvedSchema: S,\n rootSchema: S,\n expandAllBranches: boolean,\n recurseList: string[],\n formData?: T,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): S[] {\n let schemas = [resolvedSchema];\n // Process dependencies updating the local schema properties as appropriate.\n for (const dependencyKey in dependencies) {\n // Skip this dependency if its trigger property is not present.\n if (!expandAllBranches && get(formData, [dependencyKey]) === undefined) {\n continue;\n }\n // Skip this dependency if it is not included in the schema (such as when dependencyKey is itself a hidden dependency.)\n if (resolvedSchema.properties && !(dependencyKey in resolvedSchema.properties)) {\n continue;\n }\n const [remainingDependencies, dependencyValue] = splitKeyElementFromObject(\n dependencyKey,\n dependencies as GenericObjectType\n );\n if (Array.isArray(dependencyValue)) {\n schemas[0] = withDependentProperties(resolvedSchema, dependencyValue);\n } else if (isObject(dependencyValue)) {\n schemas = withDependentSchema(\n validator,\n resolvedSchema,\n rootSchema,\n dependencyKey,\n dependencyValue as S,\n expandAllBranches,\n recurseList,\n formData,\n experimental_customMergeAllOf\n );\n }\n return schemas.flatMap((schema) =>\n processDependencies(\n validator,\n remainingDependencies,\n schema,\n rootSchema,\n expandAllBranches,\n recurseList,\n formData,\n experimental_customMergeAllOf\n )\n );\n }\n return schemas;\n}\n\n/** Updates a schema with additionally required properties added\n *\n * @param schema - The schema for which resolving a dependent properties is desired\n * @param [additionallyRequired] - An optional array of additionally required names\n * @returns - The schema with the additional required values merged in\n */\nexport function withDependentProperties(\n schema: S,\n additionallyRequired?: string[]\n) {\n if (!additionallyRequired) {\n return schema;\n }\n const required = Array.isArray(schema.required)\n ? Array.from(new Set([...schema.required, ...additionallyRequired]))\n : additionallyRequired;\n return { ...schema, required: required };\n}\n\n/** Merges a dependent schema into the `schema` dealing with oneOfs and references. Passes the `expandAllBranches` flag\n * down to the `retrieveSchemaInternal()`, `resolveReference()` and `withExactlyOneSubschema()` helper calls.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs\n * @param schema - The schema for which resolving a dependent schema is desired\n * @param rootSchema - The root schema that will be forwarded to all the APIs\n * @param dependencyKey - The key name of the dependency\n * @param dependencyValue - The potentially dependent schema\n * @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and dependencies\n * as a list of schemas\n * @param recurseList - The list of recursive references already processed\n * @param [formData]- The current formData to assist retrieving a schema\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The list of schemas with the dependent schema resolved into them\n */\nexport function withDependentSchema(\n validator: ValidatorType,\n schema: S,\n rootSchema: S,\n dependencyKey: string,\n dependencyValue: S,\n expandAllBranches: boolean,\n recurseList: string[],\n formData?: T,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): S[] {\n const dependentSchemas = retrieveSchemaInternal(\n validator,\n dependencyValue,\n rootSchema,\n formData,\n expandAllBranches,\n recurseList,\n experimental_customMergeAllOf\n );\n return dependentSchemas.flatMap((dependent) => {\n const { oneOf, ...dependentSchema } = dependent;\n schema = mergeSchemas(schema, dependentSchema) as S;\n // Since it does not contain oneOf, we return the original schema.\n if (oneOf === undefined) {\n return schema;\n }\n // Resolve $refs inside oneOf.\n const resolvedOneOfs = oneOf.map((subschema) => {\n if (typeof subschema === 'boolean' || !(REF_KEY in subschema)) {\n return [subschema as S];\n }\n return resolveReference(validator, subschema as S, rootSchema, expandAllBranches, recurseList, formData);\n });\n const allPermutations = getAllPermutationsOfXxxOf(resolvedOneOfs);\n return allPermutations.flatMap((resolvedOneOf) =>\n withExactlyOneSubschema(\n validator,\n schema,\n rootSchema,\n dependencyKey,\n resolvedOneOf,\n expandAllBranches,\n recurseList,\n formData,\n experimental_customMergeAllOf\n )\n );\n });\n}\n\n/** Returns a list of `schema`s with the best choice from the `oneOf` options merged into it. If `expandAllBranches` is\n * true, then a list of schemas for ALL options are retrieved and returned. Passes the `expandAllBranches` flag down to\n * the `retrieveSchemaInternal()` helper call.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used to validate oneOf options\n * @param schema - The schema for which resolving a oneOf subschema is desired\n * @param rootSchema - The root schema that will be forwarded to all the APIs\n * @param dependencyKey - The key name of the oneOf dependency\n * @param oneOf - The list of schemas representing the oneOf options\n * @param expandAllBranches - Flag, if true, will return all possible branches of conditions, any/oneOf and dependencies\n * as a list of schemas\n * @param recurseList - The list of recursive references already processed\n * @param [formData] - The current formData to assist retrieving a schema\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - Either an array containing the best matching option or all options if `expandAllBranches` is true\n */\nexport function withExactlyOneSubschema<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(\n validator: ValidatorType,\n schema: S,\n rootSchema: S,\n dependencyKey: string,\n oneOf: S['oneOf'],\n expandAllBranches: boolean,\n recurseList: string[],\n formData?: T,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): S[] {\n const validSubschemas = oneOf!.filter((subschema) => {\n if (typeof subschema === 'boolean' || !subschema || !subschema.properties) {\n return false;\n }\n const { [dependencyKey]: conditionPropertySchema } = subschema.properties;\n if (conditionPropertySchema) {\n const conditionSchema: S = {\n type: 'object',\n properties: {\n [dependencyKey]: conditionPropertySchema,\n },\n } as S;\n return validator.isValid(conditionSchema, formData, rootSchema) || expandAllBranches;\n }\n return false;\n });\n\n if (!expandAllBranches && validSubschemas!.length !== 1) {\n console.warn(\"ignoring oneOf in dependencies because there isn't exactly one subschema that is valid\");\n return [schema];\n }\n return validSubschemas.flatMap((s) => {\n const subschema: S = s as S;\n const [dependentSubschema] = splitKeyElementFromObject(dependencyKey, subschema.properties as GenericObjectType);\n const dependentSchema = { ...subschema, properties: dependentSubschema };\n const schemas = retrieveSchemaInternal(\n validator,\n dependentSchema,\n rootSchema,\n formData,\n expandAllBranches,\n recurseList,\n experimental_customMergeAllOf\n );\n return schemas.map((s) => mergeSchemas(schema, s) as S);\n });\n}\n", "import get from 'lodash/get';\nimport isString from 'lodash/isString';\n\nimport { RJSFSchema, StrictRJSFSchema } from './types';\n\n/** Returns the `discriminator.propertyName` when defined in the `schema` if it is a string. A warning is generated when\n * it is not a string. Returns `undefined` when a valid discriminator is not present.\n *\n * @param schema - The schema from which the discriminator is potentially obtained\n * @returns - The `discriminator.propertyName` if it exists in the schema, otherwise `undefined`\n */\nexport default function getDiscriminatorFieldFromSchema(schema: S) {\n let discriminator: string | undefined;\n const maybeString = get(schema, 'discriminator.propertyName', undefined);\n if (isString(maybeString)) {\n discriminator = maybeString;\n } else if (maybeString !== undefined) {\n console.warn(`Expecting discriminator to be a string, got \"${typeof maybeString}\" instead`);\n }\n return discriminator;\n}\n", "/** Given a specific `value` attempts to guess the type of a schema element. In the case where we have to implicitly\n * create a schema, it is useful to know what type to use based on the data we are defining.\n *\n * @param value - The value from which to guess the type\n * @returns - The best guess for the object type\n */\nexport default function guessType(value: any) {\n if (Array.isArray(value)) {\n return 'array';\n }\n if (typeof value === 'string') {\n return 'string';\n }\n if (value == null) {\n return 'null';\n }\n if (typeof value === 'boolean') {\n return 'boolean';\n }\n if (!isNaN(value)) {\n return 'number';\n }\n if (typeof value === 'object') {\n return 'object';\n }\n // Default to string if we can't figure it out\n return 'string';\n}\n", "import union from 'lodash/union';\n\nimport { REQUIRED_KEY } from './constants';\nimport getSchemaType from './getSchemaType';\nimport isObject from './isObject';\nimport { GenericObjectType } from './types';\n\n/** Recursively merge deeply nested schemas. The difference between `mergeSchemas` and `mergeObjects` is that\n * `mergeSchemas` only concats arrays for values under the 'required' keyword, and when it does, it doesn't include\n * duplicate values.\n *\n * @param obj1 - The first schema object to merge\n * @param obj2 - The second schema object to merge\n * @returns - The merged schema object\n */\nexport default function mergeSchemas(obj1: GenericObjectType, obj2: GenericObjectType) {\n const acc = Object.assign({}, obj1); // Prevent mutation of source object.\n return Object.keys(obj2).reduce((acc, key) => {\n const left = obj1 ? obj1[key] : {},\n right = obj2[key];\n if (obj1 && key in obj1 && isObject(right)) {\n acc[key] = mergeSchemas(left, right);\n } else if (\n obj1 &&\n obj2 &&\n (getSchemaType(obj1) === 'object' || getSchemaType(obj2) === 'object') &&\n key === REQUIRED_KEY &&\n Array.isArray(left) &&\n Array.isArray(right)\n ) {\n // Don't include duplicate values when merging 'required' fields.\n acc[key] = union(left, right);\n } else {\n acc[key] = right;\n }\n return acc;\n }, acc);\n}\n", "import guessType from './guessType';\nimport { RJSFSchema, StrictRJSFSchema } from './types';\n\n/** Gets the type of a given `schema`. If the type is not explicitly defined, then an attempt is made to infer it from\n * other elements of the schema as follows:\n * - schema.const: Returns the `guessType()` of that value\n * - schema.enum: Returns `string`\n * - schema.properties: Returns `object`\n * - schema.additionalProperties: Returns `object`\n * - type is an array with a length of 2 and one type is 'null': Returns the other type\n *\n * @param schema - The schema for which to get the type\n * @returns - The type of the schema\n */\nexport default function getSchemaType(\n schema: S\n): string | string[] | undefined {\n let { type } = schema;\n\n if (!type && schema.const) {\n return guessType(schema.const);\n }\n\n if (!type && schema.enum) {\n return 'string';\n }\n\n if (!type && (schema.properties || schema.additionalProperties)) {\n return 'object';\n }\n\n if (Array.isArray(type)) {\n if (type.length === 2 && type.includes('null')) {\n type = type.find((type) => type !== 'null');\n } else {\n type = type[0];\n }\n }\n\n return type;\n}\n", "import isObject from './isObject';\nimport { RJSFSchema, StrictRJSFSchema } from './types';\n\n/** Detects whether the given `schema` contains fixed items. This is the case when `schema.items` is a non-empty array\n * that only contains objects.\n *\n * @param schema - The schema in which to check for fixed items\n * @returns - True if there are fixed items in the schema, false otherwise\n */\nexport default function isFixedItems(schema: S) {\n return Array.isArray(schema.items) && schema.items.length > 0 && schema.items.every((item) => isObject(item));\n}\n", "import get from 'lodash/get';\n\nimport isObject from './isObject';\nimport { GenericObjectType } from '../src';\n\n/** Merges the `defaults` object of type `T` into the `formData` of type `T`\n *\n * When merging defaults and form data, we want to merge in this specific way:\n * - objects are deeply merged\n * - arrays are merged in such a way that:\n * - when the array is set in form data, only array entries set in form data\n * are deeply merged; additional entries from the defaults are ignored unless `mergeExtraArrayDefaults` is true, in\n * which case the extras are appended onto the end of the form data\n * - when the array is not set in form data, the default is copied over\n * - scalars are overwritten/set by form data unless undefined and there is a default AND `defaultSupercedesUndefined`\n * is true\n *\n * @param [defaults] - The defaults to merge\n * @param [formData] - The form data into which the defaults will be merged\n * @param [mergeExtraArrayDefaults=false] - If true, any additional default array entries are appended onto the formData\n * @param [defaultSupercedesUndefined=false] - If true, an explicit undefined value will be overwritten by the default value\n * @returns - The resulting merged form data with defaults\n */\nexport default function mergeDefaultsWithFormData(\n defaults?: T,\n formData?: T,\n mergeExtraArrayDefaults = false,\n defaultSupercedesUndefined = false\n): T | undefined {\n if (Array.isArray(formData)) {\n const defaultsArray = Array.isArray(defaults) ? defaults : [];\n const mapped = formData.map((value, idx) => {\n if (defaultsArray[idx]) {\n return mergeDefaultsWithFormData(\n defaultsArray[idx],\n value,\n mergeExtraArrayDefaults,\n defaultSupercedesUndefined\n );\n }\n return value;\n });\n // Merge any extra defaults when mergeExtraArrayDefaults is true\n if (mergeExtraArrayDefaults && mapped.length < defaultsArray.length) {\n mapped.push(...defaultsArray.slice(mapped.length));\n }\n return mapped as unknown as T;\n }\n if (isObject(formData)) {\n const acc: { [key in keyof T]: any } = Object.assign({}, defaults); // Prevent mutation of source object.\n return Object.keys(formData as GenericObjectType).reduce((acc, key) => {\n acc[key as keyof T] = mergeDefaultsWithFormData(\n defaults ? get(defaults, key) : {},\n get(formData, key),\n mergeExtraArrayDefaults,\n defaultSupercedesUndefined\n );\n return acc;\n }, acc);\n }\n if (defaultSupercedesUndefined && formData === undefined) {\n return defaults;\n }\n return formData;\n}\n", "import isObject from './isObject';\nimport { GenericObjectType } from './types';\n\n/** Recursively merge deeply nested objects.\n *\n * @param obj1 - The first object to merge\n * @param obj2 - The second object to merge\n * @param [concatArrays=false] - Optional flag that, when true, will cause arrays to be concatenated. Use\n * \"preventDuplicates\" to merge arrays in a manner that prevents any duplicate entries from being merged.\n * NOTE: Uses shallow comparison for the duplicate checking.\n * @returns - A new object that is the merge of the two given objects\n */\nexport default function mergeObjects(\n obj1: GenericObjectType,\n obj2: GenericObjectType,\n concatArrays: boolean | 'preventDuplicates' = false\n) {\n return Object.keys(obj2).reduce((acc, key) => {\n const left = obj1 ? obj1[key] : {},\n right = obj2[key];\n if (obj1 && key in obj1 && isObject(right)) {\n acc[key] = mergeObjects(left, right, concatArrays);\n } else if (concatArrays && Array.isArray(left) && Array.isArray(right)) {\n let toMerge = right;\n if (concatArrays === 'preventDuplicates') {\n toMerge = right.reduce((result, value) => {\n if (!left.includes(value)) {\n result.push(value);\n }\n return result;\n }, []);\n }\n acc[key] = left.concat(toMerge);\n } else {\n acc[key] = right;\n }\n return acc;\n }, Object.assign({}, obj1)); // Prevent mutation of source object.\n}\n", "import { CONST_KEY } from './constants';\nimport { RJSFSchema, StrictRJSFSchema } from './types';\n\n/** This function checks if the given `schema` matches a single constant value. This happens when either the schema has\n * an `enum` array with a single value or there is a `const` defined.\n *\n * @param schema - The schema for a field\n * @returns - True if the `schema` has a single constant value, false otherwise\n */\nexport default function isConstant(schema: S) {\n return (Array.isArray(schema.enum) && schema.enum.length === 1) || CONST_KEY in schema;\n}\n", "import isConstant from '../isConstant';\nimport { FormContextType, RJSFSchema, StrictRJSFSchema, ValidatorType, Experimental_CustomMergeAllOf } from '../types';\nimport retrieveSchema from './retrieveSchema';\n\n/** Checks to see if the `schema` combination represents a select\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary\n * @param theSchema - The schema for which check for a select flag is desired\n * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - True if schema contains a select, otherwise false\n */\nexport default function isSelect(\n validator: ValidatorType,\n theSchema: S,\n rootSchema: S = {} as S,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n) {\n const schema = retrieveSchema(validator, theSchema, rootSchema, undefined, experimental_customMergeAllOf);\n const altSchemas = schema.oneOf || schema.anyOf;\n if (Array.isArray(schema.enum)) {\n return true;\n }\n if (Array.isArray(altSchemas)) {\n return altSchemas.every((altSchemas) => typeof altSchemas !== 'boolean' && isConstant(altSchemas));\n }\n return false;\n}\n", "import { FormContextType, RJSFSchema, StrictRJSFSchema, ValidatorType, Experimental_CustomMergeAllOf } from '../types';\n\nimport isSelect from './isSelect';\n\n/** Checks to see if the `schema` combination represents a multi-select\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary\n * @param schema - The schema for which check for a multi-select flag is desired\n * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - True if schema contains a multi-select, otherwise false\n */\nexport default function isMultiSelect<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(\n validator: ValidatorType,\n schema: S,\n rootSchema?: S,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n) {\n if (!schema.uniqueItems || !schema.items || typeof schema.items === 'boolean') {\n return false;\n }\n return isSelect(validator, schema.items as S, rootSchema, experimental_customMergeAllOf);\n}\n", "import getUiOptions from './getUiOptions';\nimport { FormContextType, RJSFSchema, StrictRJSFSchema, UiSchema } from './types';\n\n/** Checks to see if the `uiSchema` contains the `widget` field and that the widget is not `hidden`\n *\n * @param uiSchema - The UI Schema from which to detect if it is customized\n * @returns - True if the `uiSchema` describes a custom widget, false otherwise\n */\nexport default function isCustomWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(uiSchema: UiSchema = {}) {\n return (\n // TODO: Remove the `&& uiSchema['ui:widget'] !== 'hidden'` once we support hidden widgets for arrays.\n // https://rjsf-team.github.io/react-jsonschema-form/docs/usage/widgets/#hidden-widgets\n 'widget' in getUiOptions(uiSchema) && getUiOptions(uiSchema)['widget'] !== 'hidden'\n );\n}\n", "import { UI_WIDGET_KEY } from '../constants';\nimport {\n Experimental_CustomMergeAllOf,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n UiSchema,\n ValidatorType,\n} from '../types';\nimport retrieveSchema from './retrieveSchema';\n\n/** Checks to see if the `schema` and `uiSchema` combination represents an array of files\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary\n * @param schema - The schema for which check for array of files flag is desired\n * @param [uiSchema={}] - The UI schema from which to check the widget\n * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - True if schema/uiSchema contains an array of files, otherwise false\n */\nexport default function isFilesArray(\n validator: ValidatorType,\n schema: S,\n uiSchema: UiSchema = {},\n rootSchema?: S,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n) {\n if (uiSchema[UI_WIDGET_KEY] === 'files') {\n return true;\n }\n if (schema.items) {\n const itemsSchema = retrieveSchema(\n validator,\n schema.items as S,\n rootSchema,\n undefined,\n experimental_customMergeAllOf\n );\n return itemsSchema.type === 'string' && itemsSchema.format === 'data-url';\n }\n return false;\n}\n", "import { UI_FIELD_KEY, UI_WIDGET_KEY } from '../constants';\nimport getSchemaType from '../getSchemaType';\nimport getUiOptions from '../getUiOptions';\nimport isCustomWidget from '../isCustomWidget';\nimport {\n FormContextType,\n GlobalUISchemaOptions,\n RJSFSchema,\n StrictRJSFSchema,\n UiSchema,\n ValidatorType,\n Experimental_CustomMergeAllOf,\n} from '../types';\nimport isFilesArray from './isFilesArray';\nimport isMultiSelect from './isMultiSelect';\n\n/** Determines whether the combination of `schema` and `uiSchema` properties indicates that the label for the `schema`\n * should be displayed in a UI.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary\n * @param schema - The schema for which the display label flag is desired\n * @param [uiSchema={}] - The UI schema from which to derive potentially displayable information\n * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s\n * @param [globalOptions={}] - The optional Global UI Schema from which to get any fallback `xxx` options\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - True if the label should be displayed or false if it should not\n */\nexport default function getDisplayLabel<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(\n validator: ValidatorType,\n schema: S,\n uiSchema: UiSchema = {},\n rootSchema?: S,\n globalOptions?: GlobalUISchemaOptions,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): boolean {\n const uiOptions = getUiOptions(uiSchema, globalOptions);\n const { label = true } = uiOptions;\n let displayLabel = !!label;\n const schemaType = getSchemaType(schema);\n\n if (schemaType === 'array') {\n displayLabel =\n isMultiSelect(validator, schema, rootSchema, experimental_customMergeAllOf) ||\n isFilesArray(validator, schema, uiSchema, rootSchema, experimental_customMergeAllOf) ||\n isCustomWidget(uiSchema);\n }\n\n if (schemaType === 'object') {\n displayLabel = false;\n }\n if (schemaType === 'boolean' && !uiSchema[UI_WIDGET_KEY]) {\n displayLabel = false;\n }\n if (uiSchema[UI_FIELD_KEY]) {\n displayLabel = false;\n }\n return displayLabel;\n}\n", "import isEmpty from 'lodash/isEmpty';\n\nimport mergeObjects from '../mergeObjects';\nimport { ErrorSchema, FormContextType, RJSFSchema, StrictRJSFSchema, ValidationData, ValidatorType } from '../types';\n\n/** Merges the errors in `additionalErrorSchema` into the existing `validationData` by combining the hierarchies in the\n * two `ErrorSchema`s and then appending the error list from the `additionalErrorSchema` obtained by calling\n * `validator.toErrorList()` onto the `errors` in the `validationData`. If no `additionalErrorSchema` is passed, then\n * `validationData` is returned.\n *\n * @param validator - The validator used to convert an ErrorSchema to a list of errors\n * @param validationData - The current `ValidationData` into which to merge the additional errors\n * @param [additionalErrorSchema] - The additional set of errors in an `ErrorSchema`\n * @returns - The `validationData` with the additional errors from `additionalErrorSchema` merged into it, if provided.\n * @deprecated - Use the `validationDataMerge()` function exported from `@rjsf/utils` instead. This function will be\n * removed in the next major release.\n */\nexport default function mergeValidationData<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(\n validator: ValidatorType,\n validationData: ValidationData,\n additionalErrorSchema?: ErrorSchema\n): ValidationData {\n if (!additionalErrorSchema) {\n return validationData;\n }\n const { errors: oldErrors, errorSchema: oldErrorSchema } = validationData;\n let errors = validator.toErrorList(additionalErrorSchema);\n let errorSchema = additionalErrorSchema;\n if (!isEmpty(oldErrorSchema)) {\n errorSchema = mergeObjects(oldErrorSchema, additionalErrorSchema, true) as ErrorSchema;\n errors = [...oldErrors].concat(errors);\n }\n return { errorSchema, errors };\n}\n", "import get from 'lodash/get';\nimport has from 'lodash/has';\n\nimport {\n Experimental_CustomMergeAllOf,\n FormContextType,\n GenericObjectType,\n RJSFSchema,\n StrictRJSFSchema,\n ValidatorType,\n} from '../types';\nimport { PROPERTIES_KEY, REF_KEY } from '../constants';\nimport retrieveSchema from './retrieveSchema';\n\nconst NO_VALUE = Symbol('no Value');\n\n/** Sanitize the `data` associated with the `oldSchema` so it is considered appropriate for the `newSchema`. If the new\n * schema does not contain any properties, then `undefined` is returned to clear all the form data. Due to the nature\n * of schemas, this sanitization happens recursively for nested objects of data. Also, any properties in the old schema\n * that are non-existent in the new schema are set to `undefined`. The data sanitization process has the following flow:\n *\n * - If the new schema is an object that contains a `properties` object then:\n * - Create a `removeOldSchemaData` object, setting each key in the `oldSchema.properties` having `data` to undefined\n * - Create an empty `nestedData` object for use in the key filtering below:\n * - Iterate over each key in the `newSchema.properties` as follows:\n * - Get the `formValue` of the key from the `data`\n * - Get the `oldKeySchema` and `newKeyedSchema` for the key, defaulting to `{}` when it doesn't exist\n * - Retrieve the schema for any refs within each `oldKeySchema` and/or `newKeySchema`\n * - Get the types of the old and new keyed schemas and if the old doesn't exist or the old & new are the same then:\n * - If `removeOldSchemaData` has an entry for the key, delete it since the new schema has the same property\n * - If type of the key in the new schema is `object`:\n * - Store the value from the recursive `sanitizeDataForNewSchema` call in `nestedData[key]`\n * - Otherwise, check for default or const values:\n * - Get the old and new `default` values from the schema and check:\n * - If the new `default` value does not match the form value:\n * - If the old `default` value DOES match the form value, then:\n * - Replace `removeOldSchemaData[key]` with the new `default`\n * - Otherwise, if the new schema is `readOnly` then replace `removeOldSchemaData[key]` with undefined\n * - Get the old and new `const` values from the schema and check:\n * - If the new `const` value does not match the form value:\n * - If the old `const` value DOES match the form value, then:\n * - Replace `removeOldSchemaData[key]` with the new `const`\n * - Otherwise, replace `removeOldSchemaData[key]` with undefined\n * - Once all keys have been processed, return an object built as follows:\n * - `{ ...removeOldSchemaData, ...nestedData, ...pick(data, keysToKeep) }`\n * - If the new and old schema types are array and the `data` is an array then:\n * - If the type of the old and new schema `items` are a non-array objects:\n * - Retrieve the schema for any refs within each `oldKeySchema.items` and/or `newKeySchema.items`\n * - If the `type`s of both items are the same (or the old does not have a type):\n * - If the type is \"object\", then:\n * - For each element in the `data` recursively sanitize the data, stopping at `maxItems` if specified\n * - Otherwise, just return the `data` removing any values after `maxItems` if it is set\n * - If the type of the old and new schema `items` are booleans of the same value, return `data` as is\n * - Otherwise return `undefined`\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary\n * @param rootSchema - The root JSON schema of the entire form\n * @param [newSchema] - The new schema for which the data is being sanitized\n * @param [oldSchema] - The old schema from which the data originated\n * @param [data={}] - The form data associated with the schema, defaulting to an empty object when undefined\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The new form data, with all the fields uniquely associated with the old schema set\n * to `undefined`. Will return `undefined` if the new schema is not an object containing properties.\n */\nexport default function sanitizeDataForNewSchema<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(\n validator: ValidatorType,\n rootSchema: S,\n newSchema?: S,\n oldSchema?: S,\n data: any = {},\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): T {\n // By default, we will clear the form data\n let newFormData;\n // If the new schema is of type object and that object contains a list of properties\n if (has(newSchema, PROPERTIES_KEY)) {\n // Create an object containing root-level keys in the old schema, setting each key to undefined to remove the data\n const removeOldSchemaData: GenericObjectType = {};\n if (has(oldSchema, PROPERTIES_KEY)) {\n const properties = get(oldSchema, PROPERTIES_KEY, {});\n Object.keys(properties).forEach((key) => {\n if (has(data, key)) {\n removeOldSchemaData[key] = undefined;\n }\n });\n }\n const keys: string[] = Object.keys(get(newSchema, PROPERTIES_KEY, {}));\n // Create a place to store nested data that will be a side-effect of the filter\n const nestedData: GenericObjectType = {};\n keys.forEach((key) => {\n const formValue = get(data, key);\n let oldKeyedSchema: S = get(oldSchema, [PROPERTIES_KEY, key], {});\n let newKeyedSchema: S = get(newSchema, [PROPERTIES_KEY, key], {});\n // Resolve the refs if they exist\n if (has(oldKeyedSchema, REF_KEY)) {\n oldKeyedSchema = retrieveSchema(\n validator,\n oldKeyedSchema,\n rootSchema,\n formValue,\n experimental_customMergeAllOf\n );\n }\n if (has(newKeyedSchema, REF_KEY)) {\n newKeyedSchema = retrieveSchema(\n validator,\n newKeyedSchema,\n rootSchema,\n formValue,\n experimental_customMergeAllOf\n );\n }\n // Now get types and see if they are the same\n const oldSchemaTypeForKey = get(oldKeyedSchema, 'type');\n const newSchemaTypeForKey = get(newKeyedSchema, 'type');\n // Check if the old option has the same key with the same type\n if (!oldSchemaTypeForKey || oldSchemaTypeForKey === newSchemaTypeForKey) {\n if (has(removeOldSchemaData, key)) {\n // SIDE-EFFECT: remove the undefined value for a key that has the same type between the old and new schemas\n delete removeOldSchemaData[key];\n }\n // If it is an object, we'll recurse and store the resulting sanitized data for the key\n if (newSchemaTypeForKey === 'object' || (newSchemaTypeForKey === 'array' && Array.isArray(formValue))) {\n // SIDE-EFFECT: process the new schema type of object recursively to save iterations\n const itemData = sanitizeDataForNewSchema(\n validator,\n rootSchema,\n newKeyedSchema,\n oldKeyedSchema,\n formValue,\n experimental_customMergeAllOf\n );\n if (itemData !== undefined || newSchemaTypeForKey === 'array') {\n // only put undefined values for the array type and not the object type\n nestedData[key] = itemData;\n }\n } else {\n // Ok, the non-object types match, let's make sure that a default or a const of a different value is replaced\n // with the new default or const. This allows the case where two schemas differ that only by the default/const\n // value to be properly selected\n const newOptionDefault = get(newKeyedSchema, 'default', NO_VALUE);\n const oldOptionDefault = get(oldKeyedSchema, 'default', NO_VALUE);\n if (newOptionDefault !== NO_VALUE && newOptionDefault !== formValue) {\n if (oldOptionDefault === formValue) {\n // If the old default matches the formValue, we'll update the new value to match the new default\n removeOldSchemaData[key] = newOptionDefault;\n } else if (get(newKeyedSchema, 'readOnly') === true) {\n // If the new schema has the default set to read-only, treat it like a const and remove the value\n removeOldSchemaData[key] = undefined;\n }\n }\n\n const newOptionConst = get(newKeyedSchema, 'const', NO_VALUE);\n const oldOptionConst = get(oldKeyedSchema, 'const', NO_VALUE);\n if (newOptionConst !== NO_VALUE && newOptionConst !== formValue) {\n // Since this is a const, if the old value matches, replace the value with the new const otherwise clear it\n removeOldSchemaData[key] = oldOptionConst === formValue ? newOptionConst : undefined;\n }\n }\n }\n });\n\n newFormData = {\n ...(typeof data == 'string' || Array.isArray(data) ? undefined : data),\n ...removeOldSchemaData,\n ...nestedData,\n };\n // First apply removing the old schema data, then apply the nested data, then apply the old data keys to keep\n } else if (get(oldSchema, 'type') === 'array' && get(newSchema, 'type') === 'array' && Array.isArray(data)) {\n let oldSchemaItems = get(oldSchema, 'items');\n let newSchemaItems = get(newSchema, 'items');\n // If any of the array types `items` are arrays (remember arrays are objects) then we'll just drop the data\n // Eventually, we may want to deal with when either of the `items` are arrays since those tuple validations\n if (\n typeof oldSchemaItems === 'object' &&\n typeof newSchemaItems === 'object' &&\n !Array.isArray(oldSchemaItems) &&\n !Array.isArray(newSchemaItems)\n ) {\n if (has(oldSchemaItems, REF_KEY)) {\n oldSchemaItems = retrieveSchema(\n validator,\n oldSchemaItems as S,\n rootSchema,\n data as T,\n experimental_customMergeAllOf\n );\n }\n if (has(newSchemaItems, REF_KEY)) {\n newSchemaItems = retrieveSchema(\n validator,\n newSchemaItems as S,\n rootSchema,\n data as T,\n experimental_customMergeAllOf\n );\n }\n // Now get types and see if they are the same\n const oldSchemaType = get(oldSchemaItems, 'type');\n const newSchemaType = get(newSchemaItems, 'type');\n // Check if the old option has the same key with the same type\n if (!oldSchemaType || oldSchemaType === newSchemaType) {\n const maxItems = get(newSchema, 'maxItems', -1);\n if (newSchemaType === 'object') {\n newFormData = data.reduce((newValue, aValue) => {\n const itemValue = sanitizeDataForNewSchema(\n validator,\n rootSchema,\n newSchemaItems as S,\n oldSchemaItems as S,\n aValue,\n experimental_customMergeAllOf\n );\n if (itemValue !== undefined && (maxItems < 0 || newValue.length < maxItems)) {\n newValue.push(itemValue);\n }\n return newValue;\n }, []);\n } else {\n newFormData = maxItems > 0 && data.length > maxItems ? data.slice(0, maxItems) : data;\n }\n }\n } else if (\n typeof oldSchemaItems === 'boolean' &&\n typeof newSchemaItems === 'boolean' &&\n oldSchemaItems === newSchemaItems\n ) {\n // If they are both booleans and have the same value just return the data as is otherwise fall-thru to undefined\n newFormData = data;\n }\n // Also probably want to deal with `prefixItems` as tuples with the latest 2020 draft\n }\n return newFormData as T;\n}\n", "import get from 'lodash/get';\nimport isEqual from 'lodash/isEqual';\n\nimport { ALL_OF_KEY, DEPENDENCIES_KEY, ID_KEY, ITEMS_KEY, PROPERTIES_KEY, REF_KEY } from '../constants';\nimport isObject from '../isObject';\nimport {\n Experimental_CustomMergeAllOf,\n FormContextType,\n GenericObjectType,\n IdSchema,\n RJSFSchema,\n StrictRJSFSchema,\n ValidatorType,\n} from '../types';\nimport retrieveSchema from './retrieveSchema';\nimport getSchemaType from '../getSchemaType';\n\n/** An internal helper that generates an `IdSchema` object for the `schema`, recursively with protection against\n * infinite recursion\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary\n * @param schema - The schema for which the `IdSchema` is desired\n * @param idPrefix - The prefix to use for the id\n * @param idSeparator - The separator to use for the path segments in the id\n * @param [id] - The base id for the schema\n * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s\n * @param [formData] - The current formData, if any, to assist retrieving a schema\n * @param [_recurseList=[]] - The list of retrieved schemas currently being recursed, used to prevent infinite recursion\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The `IdSchema` object for the `schema`\n */\nfunction toIdSchemaInternal(\n validator: ValidatorType,\n schema: S,\n idPrefix: string,\n idSeparator: string,\n id?: string | null,\n rootSchema?: S,\n formData?: T,\n _recurseList: S[] = [],\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): IdSchema {\n if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema) {\n const _schema = retrieveSchema(validator, schema, rootSchema, formData, experimental_customMergeAllOf);\n const sameSchemaIndex = _recurseList.findIndex((item) => isEqual(item, _schema));\n if (sameSchemaIndex === -1) {\n return toIdSchemaInternal(\n validator,\n _schema,\n idPrefix,\n idSeparator,\n id,\n rootSchema,\n formData,\n _recurseList.concat(_schema),\n experimental_customMergeAllOf\n );\n }\n }\n if (ITEMS_KEY in schema && !get(schema, [ITEMS_KEY, REF_KEY])) {\n return toIdSchemaInternal(\n validator,\n get(schema, ITEMS_KEY) as S,\n idPrefix,\n idSeparator,\n id,\n rootSchema,\n formData,\n _recurseList,\n experimental_customMergeAllOf\n );\n }\n const $id = id || idPrefix;\n const idSchema: IdSchema = { $id } as IdSchema;\n if (getSchemaType(schema) === 'object' && PROPERTIES_KEY in schema) {\n for (const name in schema.properties) {\n const field = get(schema, [PROPERTIES_KEY, name]);\n const fieldId = idSchema[ID_KEY] + idSeparator + name;\n (idSchema as IdSchema)[name] = toIdSchemaInternal(\n validator,\n isObject(field) ? field : {},\n idPrefix,\n idSeparator,\n fieldId,\n rootSchema,\n // It's possible that formData is not an object -- this can happen if an\n // array item has just been added, but not populated with data yet\n get(formData, [name]),\n _recurseList,\n experimental_customMergeAllOf\n );\n }\n }\n return idSchema;\n}\n\n/** Generates an `IdSchema` object for the `schema`, recursively\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary\n * @param schema - The schema for which the `IdSchema` is desired\n * @param [id] - The base id for the schema\n * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s\n * @param [formData] - The current formData, if any, to assist retrieving a schema\n * @param [idPrefix='root'] - The prefix to use for the id\n * @param [idSeparator='_'] - The separator to use for the path segments in the id\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The `IdSchema` object for the `schema`\n */\nexport default function toIdSchema(\n validator: ValidatorType,\n schema: S,\n id?: string | null,\n rootSchema?: S,\n formData?: T,\n idPrefix = 'root',\n idSeparator = '_',\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): IdSchema {\n return toIdSchemaInternal(\n validator,\n schema,\n idPrefix,\n idSeparator,\n id,\n rootSchema,\n formData,\n undefined,\n experimental_customMergeAllOf\n );\n}\n", "import get from 'lodash/get';\nimport isEqual from 'lodash/isEqual';\nimport set from 'lodash/set';\n\nimport {\n ALL_OF_KEY,\n ANY_OF_KEY,\n ADDITIONAL_PROPERTIES_KEY,\n DEPENDENCIES_KEY,\n ITEMS_KEY,\n NAME_KEY,\n ONE_OF_KEY,\n PROPERTIES_KEY,\n REF_KEY,\n RJSF_ADDITIONAL_PROPERTIES_FLAG,\n} from '../constants';\nimport getDiscriminatorFieldFromSchema from '../getDiscriminatorFieldFromSchema';\nimport {\n Experimental_CustomMergeAllOf,\n FormContextType,\n GenericObjectType,\n PathSchema,\n RJSFSchema,\n StrictRJSFSchema,\n ValidatorType,\n} from '../types';\nimport getClosestMatchingOption from './getClosestMatchingOption';\nimport retrieveSchema from './retrieveSchema';\n\n/** An internal helper that generates an `PathSchema` object for the `schema`, recursively with protection against\n * infinite recursion\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary\n * @param schema - The schema for which the `PathSchema` is desired\n * @param [name=''] - The base name for the schema\n * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s\n * @param [formData] - The current formData, if any, to assist retrieving a schema\n * @param [_recurseList=[]] - The list of retrieved schemas currently being recursed, used to prevent infinite recursion\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The `PathSchema` object for the `schema`\n */\nfunction toPathSchemaInternal(\n validator: ValidatorType,\n schema: S,\n name: string,\n rootSchema?: S,\n formData?: T,\n _recurseList: S[] = [],\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): PathSchema {\n if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema) {\n const _schema = retrieveSchema(validator, schema, rootSchema, formData, experimental_customMergeAllOf);\n const sameSchemaIndex = _recurseList.findIndex((item) => isEqual(item, _schema));\n if (sameSchemaIndex === -1) {\n return toPathSchemaInternal(\n validator,\n _schema,\n name,\n rootSchema,\n formData,\n _recurseList.concat(_schema),\n experimental_customMergeAllOf\n );\n }\n }\n\n let pathSchema: PathSchema = {\n [NAME_KEY]: name.replace(/^\\./, ''),\n } as PathSchema;\n\n if (ONE_OF_KEY in schema || ANY_OF_KEY in schema) {\n const xxxOf: S[] = ONE_OF_KEY in schema ? (schema.oneOf as S[]) : (schema.anyOf as S[]);\n const discriminator = getDiscriminatorFieldFromSchema(schema);\n const index = getClosestMatchingOption(\n validator,\n rootSchema!,\n formData,\n xxxOf,\n 0,\n discriminator,\n experimental_customMergeAllOf\n );\n const _schema: S = xxxOf![index] as S;\n pathSchema = {\n ...pathSchema,\n ...toPathSchemaInternal(\n validator,\n _schema,\n name,\n rootSchema,\n formData,\n _recurseList,\n experimental_customMergeAllOf\n ),\n };\n }\n\n if (ADDITIONAL_PROPERTIES_KEY in schema && schema[ADDITIONAL_PROPERTIES_KEY] !== false) {\n set(pathSchema, RJSF_ADDITIONAL_PROPERTIES_FLAG, true);\n }\n\n if (ITEMS_KEY in schema && Array.isArray(formData)) {\n const { items: schemaItems, additionalItems: schemaAdditionalItems } = schema;\n\n if (Array.isArray(schemaItems)) {\n formData.forEach((element, i: number) => {\n if (schemaItems[i]) {\n (pathSchema as PathSchema)[i] = toPathSchemaInternal(\n validator,\n schemaItems[i] as S,\n `${name}.${i}`,\n rootSchema,\n element,\n _recurseList,\n experimental_customMergeAllOf\n );\n } else if (schemaAdditionalItems) {\n (pathSchema as PathSchema)[i] = toPathSchemaInternal(\n validator,\n schemaAdditionalItems as S,\n `${name}.${i}`,\n rootSchema,\n element,\n _recurseList,\n experimental_customMergeAllOf\n );\n } else {\n console.warn(`Unable to generate path schema for \"${name}.${i}\". No schema defined for it`);\n }\n });\n } else {\n formData.forEach((element, i: number) => {\n (pathSchema as PathSchema)[i] = toPathSchemaInternal(\n validator,\n schemaItems as S,\n `${name}.${i}`,\n rootSchema,\n element,\n _recurseList,\n experimental_customMergeAllOf\n );\n });\n }\n } else if (PROPERTIES_KEY in schema) {\n for (const property in schema.properties) {\n const field = get(schema, [PROPERTIES_KEY, property]);\n (pathSchema as PathSchema)[property] = toPathSchemaInternal(\n validator,\n field,\n `${name}.${property}`,\n rootSchema,\n // It's possible that formData is not an object -- this can happen if an\n // array item has just been added, but not populated with data yet\n get(formData, [property]),\n _recurseList,\n experimental_customMergeAllOf\n );\n }\n }\n return pathSchema;\n}\n\n/** Generates an `PathSchema` object for the `schema`, recursively\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary\n * @param schema - The schema for which the `PathSchema` is desired\n * @param [name=''] - The base name for the schema\n * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s\n * @param [formData] - The current formData, if any, to assist retrieving a schema\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - The `PathSchema` object for the `schema`\n */\nexport default function toPathSchema(\n validator: ValidatorType,\n schema: S,\n name = '',\n rootSchema?: S,\n formData?: T,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): PathSchema {\n return toPathSchemaInternal(validator, schema, name, rootSchema, formData, undefined, experimental_customMergeAllOf);\n}\n", "import deepEquals from './deepEquals';\nimport {\n ErrorSchema,\n Experimental_CustomMergeAllOf,\n Experimental_DefaultFormStateBehavior,\n FormContextType,\n GlobalUISchemaOptions,\n IdSchema,\n PathSchema,\n RJSFSchema,\n SchemaUtilsType,\n StrictRJSFSchema,\n UiSchema,\n ValidationData,\n ValidatorType,\n} from './types';\nimport {\n getDefaultFormState,\n getDisplayLabel,\n getClosestMatchingOption,\n getFirstMatchingOption,\n getMatchingOption,\n isFilesArray,\n isMultiSelect,\n isSelect,\n mergeValidationData,\n retrieveSchema,\n sanitizeDataForNewSchema,\n toIdSchema,\n toPathSchema,\n} from './schema';\n\n/** The `SchemaUtils` class provides a wrapper around the publicly exported APIs in the `utils/schema` directory such\n * that one does not have to explicitly pass the `validator`, `rootSchema`, `experimental_defaultFormStateBehavior` or\n * `experimental_customMergeAllOf` to each method. Since these generally do not change across a `Form`, this allows for\n * providing a simplified set of APIs to the `@rjsf/core` components and the various themes as well. This class\n * implements the `SchemaUtilsType` interface.\n */\nclass SchemaUtils\n implements SchemaUtilsType\n{\n rootSchema: S;\n validator: ValidatorType;\n experimental_defaultFormStateBehavior: Experimental_DefaultFormStateBehavior;\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf;\n\n /** Constructs the `SchemaUtils` instance with the given `validator` and `rootSchema` stored as instance variables\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs\n * @param rootSchema - The root schema that will be forwarded to all the APIs\n * @param experimental_defaultFormStateBehavior - Configuration flags to allow users to override default form state behavior\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n */\n constructor(\n validator: ValidatorType,\n rootSchema: S,\n experimental_defaultFormStateBehavior: Experimental_DefaultFormStateBehavior,\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n ) {\n this.rootSchema = rootSchema;\n this.validator = validator;\n this.experimental_defaultFormStateBehavior = experimental_defaultFormStateBehavior;\n this.experimental_customMergeAllOf = experimental_customMergeAllOf;\n }\n\n /** Returns the `ValidatorType` in the `SchemaUtilsType`\n *\n * @returns - The `ValidatorType`\n */\n getValidator() {\n return this.validator;\n }\n\n /** Determines whether either the `validator` and `rootSchema` differ from the ones associated with this instance of\n * the `SchemaUtilsType`. If either `validator` or `rootSchema` are falsy, then return false to prevent the creation\n * of a new `SchemaUtilsType` with incomplete properties.\n *\n * @param validator - An implementation of the `ValidatorType` interface that will be compared against the current one\n * @param rootSchema - The root schema that will be compared against the current one\n * @param [experimental_defaultFormStateBehavior] Optional configuration object, if provided, allows users to override default form state behavior\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - True if the `SchemaUtilsType` differs from the given `validator` or `rootSchema`\n */\n doesSchemaUtilsDiffer(\n validator: ValidatorType,\n rootSchema: S,\n experimental_defaultFormStateBehavior = {},\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n ): boolean {\n if (!validator || !rootSchema) {\n return false;\n }\n return (\n this.validator !== validator ||\n !deepEquals(this.rootSchema, rootSchema) ||\n !deepEquals(this.experimental_defaultFormStateBehavior, experimental_defaultFormStateBehavior) ||\n this.experimental_customMergeAllOf !== experimental_customMergeAllOf\n );\n }\n\n /** Returns the superset of `formData` that includes the given set updated to include any missing fields that have\n * computed to have defaults provided in the `schema`.\n *\n * @param schema - The schema for which the default state is desired\n * @param [formData] - The current formData, if any, onto which to provide any missing defaults\n * @param [includeUndefinedValues=false] - Optional flag, if true, cause undefined values to be added as defaults.\n * If \"excludeObjectChildren\", pass `includeUndefinedValues` as false when computing defaults for any nested\n * object properties.\n * @returns - The resulting `formData` with all the defaults provided\n */\n getDefaultFormState(\n schema: S,\n formData?: T,\n includeUndefinedValues: boolean | 'excludeObjectChildren' = false\n ): T | T[] | undefined {\n return getDefaultFormState(\n this.validator,\n schema,\n formData,\n this.rootSchema,\n includeUndefinedValues,\n this.experimental_defaultFormStateBehavior,\n this.experimental_customMergeAllOf\n );\n }\n\n /** Determines whether the combination of `schema` and `uiSchema` properties indicates that the label for the `schema`\n * should be displayed in a UI.\n *\n * @param schema - The schema for which the display label flag is desired\n * @param [uiSchema] - The UI schema from which to derive potentially displayable information\n * @param [globalOptions={}] - The optional Global UI Schema from which to get any fallback `xxx` options\n * @returns - True if the label should be displayed or false if it should not\n */\n getDisplayLabel(schema: S, uiSchema?: UiSchema, globalOptions?: GlobalUISchemaOptions) {\n return getDisplayLabel(\n this.validator,\n schema,\n uiSchema,\n this.rootSchema,\n globalOptions,\n this.experimental_customMergeAllOf\n );\n }\n\n /** Determines which of the given `options` provided most closely matches the `formData`.\n * Returns the index of the option that is valid and is the closest match, or 0 if there is no match.\n *\n * The closest match is determined using the number of matching properties, and more heavily favors options with\n * matching readOnly, default, or const values.\n *\n * @param formData - The form data associated with the schema\n * @param options - The list of options that can be selected from\n * @param [selectedOption] - The index of the currently selected option, defaulted to -1 if not specified\n * @param [discriminatorField] - The optional name of the field within the options object whose value is used to\n * determine which option is selected\n * @returns - The index of the option that is the closest match to the `formData` or the `selectedOption` if no match\n */\n getClosestMatchingOption(\n formData: T | undefined,\n options: S[],\n selectedOption?: number,\n discriminatorField?: string\n ): number {\n return getClosestMatchingOption(\n this.validator,\n this.rootSchema,\n formData,\n options,\n selectedOption,\n discriminatorField,\n this.experimental_customMergeAllOf\n );\n }\n\n /** Given the `formData` and list of `options`, attempts to find the index of the first option that matches the data.\n * Always returns the first option if there is nothing that matches.\n *\n * @param formData - The current formData, if any, used to figure out a match\n * @param options - The list of options to find a matching options from\n * @param [discriminatorField] - The optional name of the field within the options object whose value is used to\n * determine which option is selected\n * @returns - The firstindex of the matched option or 0 if none is available\n */\n getFirstMatchingOption(formData: T | undefined, options: S[], discriminatorField?: string): number {\n return getFirstMatchingOption(this.validator, formData, options, this.rootSchema, discriminatorField);\n }\n\n /** Given the `formData` and list of `options`, attempts to find the index of the option that best matches the data.\n * Deprecated, use `getFirstMatchingOption()` instead.\n *\n * @param formData - The current formData, if any, onto which to provide any missing defaults\n * @param options - The list of options to find a matching options from\n * @param [discriminatorField] - The optional name of the field within the options object whose value is used to\n * determine which option is selected\n * @returns - The index of the matched option or 0 if none is available\n * @deprecated\n */\n getMatchingOption(formData: T | undefined, options: S[], discriminatorField?: string) {\n return getMatchingOption(this.validator, formData, options, this.rootSchema, discriminatorField);\n }\n\n /** Checks to see if the `schema` and `uiSchema` combination represents an array of files\n *\n * @param schema - The schema for which check for array of files flag is desired\n * @param [uiSchema] - The UI schema from which to check the widget\n * @returns - True if schema/uiSchema contains an array of files, otherwise false\n */\n isFilesArray(schema: S, uiSchema?: UiSchema) {\n return isFilesArray(this.validator, schema, uiSchema, this.rootSchema, this.experimental_customMergeAllOf);\n }\n\n /** Checks to see if the `schema` combination represents a multi-select\n *\n * @param schema - The schema for which check for a multi-select flag is desired\n * @returns - True if schema contains a multi-select, otherwise false\n */\n isMultiSelect(schema: S) {\n return isMultiSelect(this.validator, schema, this.rootSchema, this.experimental_customMergeAllOf);\n }\n\n /** Checks to see if the `schema` combination represents a select\n *\n * @param schema - The schema for which check for a select flag is desired\n * @returns - True if schema contains a select, otherwise false\n */\n isSelect(schema: S) {\n return isSelect(this.validator, schema, this.rootSchema, this.experimental_customMergeAllOf);\n }\n\n /** Merges the errors in `additionalErrorSchema` into the existing `validationData` by combining the hierarchies in\n * the two `ErrorSchema`s and then appending the error list from the `additionalErrorSchema` obtained by calling\n * `getValidator().toErrorList()` onto the `errors` in the `validationData`. If no `additionalErrorSchema` is passed,\n * then `validationData` is returned.\n *\n * @param validationData - The current `ValidationData` into which to merge the additional errors\n * @param [additionalErrorSchema] - The additional set of errors\n * @returns - The `validationData` with the additional errors from `additionalErrorSchema` merged into it, if provided.\n * @deprecated - Use the `validationDataMerge()` function exported from `@rjsf/utils` instead. This function will be\n * removed in the next major release.\n */\n mergeValidationData(validationData: ValidationData, additionalErrorSchema?: ErrorSchema): ValidationData {\n return mergeValidationData(this.validator, validationData, additionalErrorSchema);\n }\n\n /** Retrieves an expanded schema that has had all of its conditions, additional properties, references and\n * dependencies resolved and merged into the `schema` given a `rawFormData` that is used to do the potentially\n * recursive resolution.\n *\n * @param schema - The schema for which retrieving a schema is desired\n * @param [rawFormData] - The current formData, if any, to assist retrieving a schema\n * @returns - The schema having its conditions, additional properties, references and dependencies resolved\n */\n retrieveSchema(schema: S, rawFormData?: T) {\n return retrieveSchema(\n this.validator,\n schema,\n this.rootSchema,\n rawFormData,\n this.experimental_customMergeAllOf\n );\n }\n\n /** Sanitize the `data` associated with the `oldSchema` so it is considered appropriate for the `newSchema`. If the\n * new schema does not contain any properties, then `undefined` is returned to clear all the form data. Due to the\n * nature of schemas, this sanitization happens recursively for nested objects of data. Also, any properties in the\n * old schemas that are non-existent in the new schema are set to `undefined`.\n *\n * @param [newSchema] - The new schema for which the data is being sanitized\n * @param [oldSchema] - The old schema from which the data originated\n * @param [data={}] - The form data associated with the schema, defaulting to an empty object when undefined\n * @returns - The new form data, with all the fields uniquely associated with the old schema set\n * to `undefined`. Will return `undefined` if the new schema is not an object containing properties.\n */\n sanitizeDataForNewSchema(newSchema?: S, oldSchema?: S, data?: any): T {\n return sanitizeDataForNewSchema(\n this.validator,\n this.rootSchema,\n newSchema,\n oldSchema,\n data,\n this.experimental_customMergeAllOf\n );\n }\n\n /** Generates an `IdSchema` object for the `schema`, recursively\n *\n * @param schema - The schema for which the display label flag is desired\n * @param [id] - The base id for the schema\n * @param [formData] - The current formData, if any, onto which to provide any missing defaults\n * @param [idPrefix='root'] - The prefix to use for the id\n * @param [idSeparator='_'] - The separator to use for the path segments in the id\n * @returns - The `IdSchema` object for the `schema`\n */\n toIdSchema(schema: S, id?: string | null, formData?: T, idPrefix = 'root', idSeparator = '_'): IdSchema {\n return toIdSchema(\n this.validator,\n schema,\n id,\n this.rootSchema,\n formData,\n idPrefix,\n idSeparator,\n this.experimental_customMergeAllOf\n );\n }\n\n /** Generates an `PathSchema` object for the `schema`, recursively\n *\n * @param schema - The schema for which the display label flag is desired\n * @param [name] - The base name for the schema\n * @param [formData] - The current formData, if any, onto which to provide any missing defaults\n * @returns - The `PathSchema` object for the `schema`\n */\n toPathSchema(schema: S, name?: string, formData?: T): PathSchema {\n return toPathSchema(\n this.validator,\n schema,\n name,\n this.rootSchema,\n formData,\n this.experimental_customMergeAllOf\n );\n }\n}\n\n/** Creates a `SchemaUtilsType` interface that is based around the given `validator` and `rootSchema` parameters. The\n * resulting interface implementation will forward the `validator` and `rootSchema` to all the wrapped APIs.\n *\n * @param validator - an implementation of the `ValidatorType` interface that will be forwarded to all the APIs\n * @param rootSchema - The root schema that will be forwarded to all the APIs\n * @param [experimental_defaultFormStateBehavior] Optional configuration object, if provided, allows users to override default form state behavior\n * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas\n * @returns - An implementation of a `SchemaUtilsType` interface\n */\nexport default function createSchemaUtils<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(\n validator: ValidatorType,\n rootSchema: S,\n experimental_defaultFormStateBehavior = {},\n experimental_customMergeAllOf?: Experimental_CustomMergeAllOf\n): SchemaUtilsType {\n return new SchemaUtils(\n validator,\n rootSchema,\n experimental_defaultFormStateBehavior,\n experimental_customMergeAllOf\n );\n}\n", "/** Given the `FileReader.readAsDataURL()` based `dataURI` extracts that data into an actual Blob along with the name\n * of that Blob if provided in the URL. If no name is provided, then the name falls back to `unknown`.\n *\n * @param dataURI - The `DataUrl` potentially containing name and raw data to be converted to a Blob\n * @returns - an object containing a Blob and its name, extracted from the URI\n */\nexport default function dataURItoBlob(dataURILike: string) {\n // check if is dataURI\n if (dataURILike.indexOf('data:') === -1) {\n throw new Error('File is invalid: URI must be a dataURI');\n }\n const dataURI = dataURILike.slice(5);\n // split the dataURI into media and base64, with the base64 signature\n const splitted = dataURI.split(';base64,');\n // if the base64 signature is not present, the latter part will become empty\n if (splitted.length !== 2) {\n throw new Error('File is invalid: dataURI must be base64');\n }\n // extract the mime type, media parameters including the name, and the base64 string\n const [media, base64] = splitted;\n const [mime, ...mediaparams] = media.split(';');\n const type = mime || '';\n\n // extract the name from the parameters\n const name = decodeURI(\n // parse the parameters into key-value pairs, find a key, and extract a value\n // if no key is found, then the name is unknown\n mediaparams.map((param) => param.split('=')).find(([key]) => key === 'name')?.[1] || 'unknown'\n );\n\n // Built the Uint8Array Blob parameter from the base64 string.\n try {\n const binary = atob(base64);\n const array = new Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n array[i] = binary.charCodeAt(i);\n }\n // Create the blob object\n const blob = new window.Blob([new Uint8Array(array)], { type });\n\n return { blob, name };\n } catch (error) {\n throw new Error('File is invalid: ' + (error as Error).message);\n }\n}\n", "/** Returns a string representation of the `num` that is padded with leading \"0\"s if necessary\n *\n * @param num - The number to pad\n * @param width - The width of the string at which no lead padding is necessary\n * @returns - The number converted to a string with leading zero padding if the number of digits is less than `width`\n */\nexport default function pad(num: number, width: number) {\n let s = String(num);\n while (s.length < width) {\n s = '0' + s;\n }\n return s;\n}\n", "import pad from './pad';\nimport { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types';\n\n/** Returns a list of options for a date range between `start` and `stop`. If the start date is greater than the end\n * date, then the date range is reversed. If `start` and `stop` are negative numbers (or zero), then they will be\n * treated as relative to the current year.\n *\n * @param start - The starting point of the date range\n * @param stop - The ending point of the date range\n * @returns - The list of EnumOptionsType for the date range between `start` and `stop`\n * @throws - Error when `start` and `stop` aren't both <= 0 or > 0\n */\nexport default function dateRangeOptions(\n start: number,\n stop: number\n): EnumOptionsType[] {\n if (start <= 0 && stop <= 0) {\n start = new Date().getFullYear() + start;\n stop = new Date().getFullYear() + stop;\n } else if (start < 0 || stop < 0) {\n throw new Error(`Both start (${start}) and stop (${stop}) must both be <= 0 or > 0, got one of each`);\n }\n if (start > stop) {\n return dateRangeOptions(stop, start).reverse();\n }\n const options: EnumOptionsType[] = [];\n for (let i = start; i <= stop; i++) {\n options.push({ value: i, label: pad(i, 2) });\n }\n return options;\n}\n", "/** Potentially substitutes all replaceable parameters with the associated value(s) from the `params` if available. When\n * a `params` array is provided, each value in the array is used to replace any of the replaceable parameters in the\n * `inputString` using the `%1`, `%2`, etc. replacement specifiers.\n *\n * @param inputString - The string which will be potentially updated with replacement parameters\n * @param params - The optional list of replaceable parameter values to substitute into the english string\n * @returns - The updated string with any replacement specifiers replaced\n */\nexport default function replaceStringParameters(inputString: string, params?: string[]) {\n let output = inputString;\n if (Array.isArray(params)) {\n const parts = output.split(/(%\\d)/);\n params.forEach((param, index) => {\n const partIndex = parts.findIndex((part) => part === `%${index + 1}`);\n if (partIndex >= 0) {\n parts[partIndex] = param;\n }\n });\n output = parts.join('');\n }\n return output;\n}\n", "import { TranslatableString } from './enums';\nimport replaceStringParameters from './replaceStringParameters';\n\n/** Translates a `TranslatableString` value `stringToTranslate` into english. When a `params` array is provided, each\n * value in the array is used to replace any of the replaceable parameters in the `stringToTranslate` using the `%1`,\n * `%2`, etc. replacement specifiers.\n *\n * @param stringToTranslate - The `TranslatableString` value to convert to english\n * @param params - The optional list of replaceable parameter values to substitute into the english string\n * @returns - The `stringToTranslate` itself with any replaceable parameter values substituted\n */\nexport default function englishStringTranslator(stringToTranslate: TranslatableString, params?: string[]): string {\n return replaceStringParameters(stringToTranslate, params);\n}\n", "import isEqual from 'lodash/isEqual';\n\nimport { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types';\nimport enumOptionsValueForIndex from './enumOptionsValueForIndex';\n\n/** Removes the enum option value at the `valueIndex` from the currently `selected` (list of) value(s). If `selected` is\n * a list, then that list is updated to remove the enum option value with the `valueIndex` in `allEnumOptions`. If it is\n * a single value, then if the enum option value with the `valueIndex` in `allEnumOptions` matches `selected`, undefined\n * is returned, otherwise the `selected` value is returned.\n *\n * @param valueIndex - The index of the value to be removed from the selected list or single value\n * @param selected - The current (list of) selected value(s)\n * @param [allEnumOptions=[]] - The list of all the known enumOptions\n * @returns - The updated `selected` with the enum option value at `valueIndex` in `allEnumOptions` removed from it,\n * unless `selected` is a single value. In that case, if the `valueIndex` value matches `selected`, returns\n * undefined, otherwise `selected`.\n */\nexport default function enumOptionsDeselectValue(\n valueIndex: string | number,\n selected?: EnumOptionsType['value'] | EnumOptionsType['value'][],\n allEnumOptions: EnumOptionsType[] = []\n): EnumOptionsType['value'] | EnumOptionsType['value'][] | undefined {\n const value = enumOptionsValueForIndex(valueIndex, allEnumOptions);\n if (Array.isArray(selected)) {\n return selected.filter((v) => !isEqual(v, value));\n }\n return isEqual(value, selected) ? undefined : selected;\n}\n", "import { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types';\n\n/** Returns the value(s) from `allEnumOptions` at the index(es) provided by `valueIndex`. If `valueIndex` is not an\n * array AND the index is not valid for `allEnumOptions`, `emptyValue` is returned. If `valueIndex` is an array, AND it\n * contains an invalid index, the returned array will have the resulting undefined values filtered out, leaving only\n * valid values or in the worst case, an empty array.\n *\n * @param valueIndex - The index(es) of the value(s) that should be returned\n * @param [allEnumOptions=[]] - The list of all the known enumOptions\n * @param [emptyValue] - The value to return when the non-array `valueIndex` does not refer to a real option\n * @returns - The single or list of values specified by the single or list of indexes if they are valid. Otherwise,\n * `emptyValue` or an empty list.\n */\nexport default function enumOptionsValueForIndex(\n valueIndex: string | number | Array,\n allEnumOptions: EnumOptionsType[] = [],\n emptyValue?: EnumOptionsType['value']\n): EnumOptionsType['value'] | EnumOptionsType['value'][] | undefined {\n if (Array.isArray(valueIndex)) {\n return (\n valueIndex\n .map((index) => enumOptionsValueForIndex(index, allEnumOptions))\n // Since the recursive call returns `emptyValue` when we get a bad option, only filter those out\n .filter((val) => val !== emptyValue)\n );\n }\n // So Number(null) and Number('') both return 0, so use emptyValue for those two values\n const index = valueIndex === '' || valueIndex === null ? -1 : Number(valueIndex);\n const option = allEnumOptions[index];\n return option ? option.value : emptyValue;\n}\n", "import isEqual from 'lodash/isEqual';\n\nimport { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types';\n\n/** Determines whether the given `value` is (one of) the `selected` value(s).\n *\n * @param value - The value being checked to see if it is selected\n * @param selected - The current selected value or list of values\n * @returns - true if the `value` is one of the `selected` ones, false otherwise\n */\nexport default function enumOptionsIsSelected(\n value: EnumOptionsType['value'],\n selected: EnumOptionsType['value'] | EnumOptionsType['value'][]\n) {\n if (Array.isArray(selected)) {\n return selected.some((sel) => isEqual(sel, value));\n }\n return isEqual(selected, value);\n}\n", "import { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types';\nimport enumOptionsIsSelected from './enumOptionsIsSelected';\n\n/** Returns the index(es) of the options in `allEnumOptions` whose value(s) match the ones in `value`. All the\n * `enumOptions` are filtered based on whether they are a \"selected\" `value` and the index of each selected one is then\n * stored in an array. If `multiple` is true, that array is returned, otherwise the first element in the array is\n * returned.\n *\n * @param value - The single value or list of values for which indexes are desired\n * @param [allEnumOptions=[]] - The list of all the known enumOptions\n * @param [multiple=false] - Optional flag, if true will return a list of index, otherwise a single one\n * @returns - A single string index for the first `value` in `allEnumOptions`, if not `multiple`. Otherwise, the list\n * of indexes for (each of) the value(s) in `value`.\n */\nexport default function enumOptionsIndexForValue(\n value: EnumOptionsType['value'] | EnumOptionsType['value'][],\n allEnumOptions: EnumOptionsType[] = [],\n multiple = false\n): string | string[] | undefined {\n const selectedIndexes: string[] = allEnumOptions\n .map((opt, index) => (enumOptionsIsSelected(opt.value, value) ? String(index) : undefined))\n .filter((opt) => typeof opt !== 'undefined') as string[];\n if (!multiple) {\n return selectedIndexes[0];\n }\n return selectedIndexes;\n}\n", "import { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types';\nimport enumOptionsValueForIndex from './enumOptionsValueForIndex';\nimport isNil from 'lodash/isNil';\n\n/** Add the enum option value at the `valueIndex` to the list of `selected` values in the proper order as defined by\n * `allEnumOptions`\n *\n * @param valueIndex - The index of the value that should be selected\n * @param selected - The current list of selected values\n * @param [allEnumOptions=[]] - The list of all the known enumOptions\n * @returns - The updated list of selected enum values with enum value at the `valueIndex` added to it\n */\nexport default function enumOptionsSelectValue(\n valueIndex: string | number,\n selected: EnumOptionsType['value'][],\n allEnumOptions: EnumOptionsType[] = []\n) {\n const value = enumOptionsValueForIndex(valueIndex, allEnumOptions);\n if (!isNil(value)) {\n const index = allEnumOptions.findIndex((opt) => value === opt.value);\n const all = allEnumOptions.map(({ value: val }) => val);\n const updated = selected.slice(0, index).concat(value, selected.slice(index));\n // As inserting values at predefined index positions doesn't work with empty\n // arrays, we need to reorder the updated selection to match the initial order\n return updated.sort((a, b) => Number(all.indexOf(a) > all.indexOf(b)));\n }\n return selected;\n}\n", "import cloneDeep from 'lodash/cloneDeep';\nimport get from 'lodash/get';\nimport set from 'lodash/set';\nimport setWith from 'lodash/setWith';\n\nimport { ErrorSchema } from './types';\nimport { ERRORS_KEY } from './constants';\n\n/** The `ErrorSchemaBuilder` is used to build an `ErrorSchema` since the definition of the `ErrorSchema` type is\n * designed for reading information rather than writing it. Use this class to add, replace or clear errors in an error\n * schema by using either dotted path or an array of path names. Once you are done building the `ErrorSchema`, you can\n * get the result and/or reset all the errors back to an initial set and start again.\n */\nexport default class ErrorSchemaBuilder {\n /** The error schema being built\n *\n * @private\n */\n private errorSchema: ErrorSchema = {};\n\n /** Construct an `ErrorSchemaBuilder` with an optional initial set of errors in an `ErrorSchema`.\n *\n * @param [initialSchema] - The optional set of initial errors, that will be cloned into the class\n */\n constructor(initialSchema?: ErrorSchema) {\n this.resetAllErrors(initialSchema);\n }\n\n /** Returns the `ErrorSchema` that has been updated by the methods of the `ErrorSchemaBuilder`\n */\n get ErrorSchema() {\n return this.errorSchema;\n }\n\n /** Will get an existing `ErrorSchema` at the specified `pathOfError` or create and return one.\n *\n * @param [pathOfError] - The optional path into the `ErrorSchema` at which to add the error(s)\n * @returns - The error block for the given `pathOfError` or the root if not provided\n * @private\n */\n private getOrCreateErrorBlock(pathOfError?: string | (string | number)[]) {\n const hasPath = (Array.isArray(pathOfError) && pathOfError.length > 0) || typeof pathOfError === 'string';\n let errorBlock: ErrorSchema = hasPath ? get(this.errorSchema, pathOfError) : this.errorSchema;\n if (!errorBlock && pathOfError) {\n errorBlock = {};\n setWith(this.errorSchema, pathOfError, errorBlock, Object);\n }\n return errorBlock;\n }\n\n /** Resets all errors in the `ErrorSchemaBuilder` back to the `initialSchema` if provided, otherwise an empty set.\n *\n * @param [initialSchema] - The optional set of initial errors, that will be cloned into the class\n * @returns - The `ErrorSchemaBuilder` object for chaining purposes\n */\n resetAllErrors(initialSchema?: ErrorSchema) {\n this.errorSchema = initialSchema ? cloneDeep(initialSchema) : {};\n return this;\n }\n\n /** Adds the `errorOrList` to the list of errors in the `ErrorSchema` at either the root level or the location within\n * the schema described by the `pathOfError`. For more information about how to specify the path see the\n * [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).\n *\n * @param errorOrList - The error or list of errors to add into the `ErrorSchema`\n * @param [pathOfError] - The optional path into the `ErrorSchema` at which to add the error(s)\n * @returns - The `ErrorSchemaBuilder` object for chaining purposes\n */\n addErrors(errorOrList: string | string[], pathOfError?: string | (string | number)[]) {\n const errorBlock: ErrorSchema = this.getOrCreateErrorBlock(pathOfError);\n let errorsList = get(errorBlock, ERRORS_KEY);\n if (!Array.isArray(errorsList)) {\n errorsList = [];\n errorBlock[ERRORS_KEY] = errorsList;\n }\n\n if (Array.isArray(errorOrList)) {\n set(errorBlock, ERRORS_KEY, [...new Set([...errorsList, ...errorOrList])]);\n } else {\n set(errorBlock, ERRORS_KEY, [...new Set([...errorsList, errorOrList])]);\n }\n return this;\n }\n\n /** Sets/replaces the `errorOrList` as the error(s) in the `ErrorSchema` at either the root level or the location\n * within the schema described by the `pathOfError`. For more information about how to specify the path see the\n * [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).\n *\n * @param errorOrList - The error or list of errors to set into the `ErrorSchema`\n * @param [pathOfError] - The optional path into the `ErrorSchema` at which to set the error(s)\n * @returns - The `ErrorSchemaBuilder` object for chaining purposes\n */\n setErrors(errorOrList: string | string[], pathOfError?: string | (string | number)[]) {\n const errorBlock: ErrorSchema = this.getOrCreateErrorBlock(pathOfError);\n // Effectively clone the array being given to prevent accidental outside manipulation of the given list\n const listToAdd = Array.isArray(errorOrList) ? [...new Set([...errorOrList])] : [errorOrList];\n set(errorBlock, ERRORS_KEY, listToAdd);\n return this;\n }\n\n /** Clears the error(s) in the `ErrorSchema` at either the root level or the location within the schema described by\n * the `pathOfError`. For more information about how to specify the path see the\n * [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).\n *\n * @param [pathOfError] - The optional path into the `ErrorSchema` at which to clear the error(s)\n * @returns - The `ErrorSchemaBuilder` object for chaining purposes\n */\n clearErrors(pathOfError?: string | (string | number)[]) {\n const errorBlock: ErrorSchema = this.getOrCreateErrorBlock(pathOfError);\n set(errorBlock, ERRORS_KEY, []);\n return this;\n }\n}\n", "import { type DateObject } from './types';\n\n/** Available options for re-ordering date input element */\nexport type DateElementFormat = 'DMY' | 'MDY' | 'YMD';\n\n/** Type describing format of DateElement prop */\ntype DateElementProp = {\n type: string;\n range: [number, number];\n value: number | undefined;\n};\n\n/** Given date & time information with optional yearRange & format, returns props for DateElement\n *\n * @param date - Object containing date with optional time information\n * @param time - Determines whether to include time or not\n * @param [yearRange=[1900, new Date().getFullYear() + 2]] - Controls the list of years to be displayed\n * @param [format='YMD'] - Controls the order in which day, month and year input element will be displayed\n * @returns Array of props for DateElement\n */\n\nexport default function getDateElementProps(\n date: DateObject,\n time: boolean,\n yearRange: [number, number] = [1900, new Date().getFullYear() + 2],\n format: DateElementFormat = 'YMD'\n) {\n const { day, month, year, hour, minute, second } = date;\n\n const dayObj: DateElementProp = { type: 'day', range: [1, 31], value: day };\n const monthObj: DateElementProp = { type: 'month', range: [1, 12], value: month };\n const yearObj: DateElementProp = { type: 'year', range: yearRange, value: year };\n\n const dateElementProp: DateElementProp[] = [];\n switch (format) {\n case 'MDY':\n dateElementProp.push(monthObj, dayObj, yearObj);\n break;\n case 'DMY':\n dateElementProp.push(dayObj, monthObj, yearObj);\n break;\n case 'YMD':\n default:\n dateElementProp.push(yearObj, monthObj, dayObj);\n }\n\n if (time) {\n dateElementProp.push(\n { type: 'hour', range: [0, 23], value: hour },\n { type: 'minute', range: [0, 59], value: minute },\n { type: 'second', range: [0, 59], value: second }\n );\n }\n\n return dateElementProp;\n}\n", "import { RangeSpecType, StrictRJSFSchema } from './types';\nimport { RJSFSchema } from './types';\n\n/** Extracts the range spec information `{ step?: number, min?: number, max?: number }` that can be spread onto an HTML\n * input from the range analog in the schema `{ multipleOf?: number, minimum?: number, maximum?: number }`.\n *\n * @param schema - The schema from which to extract the range spec\n * @returns - A range specification from the schema\n */\nexport default function rangeSpec(schema: S) {\n const spec: RangeSpecType = {};\n if (schema.multipleOf) {\n spec.step = schema.multipleOf;\n }\n if (schema.minimum || schema.minimum === 0) {\n spec.min = schema.minimum;\n }\n if (schema.maximum || schema.maximum === 0) {\n spec.max = schema.maximum;\n }\n return spec;\n}\n", "import rangeSpec from './rangeSpec';\nimport { FormContextType, InputPropsType, RJSFSchema, StrictRJSFSchema, UIOptionsType } from './types';\n\n/** Using the `schema`, `defaultType` and `options`, extract out the props for the element that make sense.\n *\n * @param schema - The schema for the field provided by the widget\n * @param [defaultType] - The default type, if any, for the field provided by the widget\n * @param [options={}] - The UI Options for the field provided by the widget\n * @param [autoDefaultStepAny=true] - Determines whether to auto-default step=any when the type is number and no step\n * @returns - The extracted `InputPropsType` object\n */\nexport default function getInputProps<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(\n schema: RJSFSchema,\n defaultType?: string,\n options: UIOptionsType = {},\n autoDefaultStepAny = true\n): InputPropsType {\n const inputProps: InputPropsType = {\n type: defaultType || 'text',\n ...rangeSpec(schema),\n };\n\n // If options.inputType is set use that as the input type\n if (options.inputType) {\n inputProps.type = options.inputType;\n } else if (!defaultType) {\n // If the schema is of type number or integer, set the input type to number\n if (schema.type === 'number') {\n inputProps.type = 'number';\n // Only add step if one isn't already defined and we are auto-defaulting the \"any\" step\n if (autoDefaultStepAny && inputProps.step === undefined) {\n // Setting step to 'any' fixes a bug in Safari where decimals are not\n // allowed in number inputs\n inputProps.step = 'any';\n }\n } else if (schema.type === 'integer') {\n inputProps.type = 'number';\n // Only add step if one isn't already defined\n if (inputProps.step === undefined) {\n // Since this is integer, you always want to step up or down in multiples of 1\n inputProps.step = 1;\n }\n }\n }\n\n if (options.autocomplete) {\n inputProps.autoComplete = options.autocomplete;\n }\n\n return inputProps;\n}\n", "import { SUBMIT_BTN_OPTIONS_KEY } from './constants';\nimport getUiOptions from './getUiOptions';\nimport { FormContextType, RJSFSchema, StrictRJSFSchema, UiSchema, UISchemaSubmitButtonOptions } from './types';\n\n/** The default submit button options, exported for testing purposes\n */\nexport const DEFAULT_OPTIONS: UISchemaSubmitButtonOptions = {\n props: {\n disabled: false,\n },\n submitText: 'Submit',\n norender: false,\n};\n\n/** Extracts any `ui:submitButtonOptions` from the `uiSchema` and merges them onto the `DEFAULT_OPTIONS`\n *\n * @param [uiSchema={}] - the UI Schema from which to extract submit button props\n * @returns - The merging of the `DEFAULT_OPTIONS` with any custom ones\n */\nexport default function getSubmitButtonOptions<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(uiSchema: UiSchema = {}): UISchemaSubmitButtonOptions {\n const uiOptions = getUiOptions(uiSchema);\n if (uiOptions && uiOptions[SUBMIT_BTN_OPTIONS_KEY]) {\n const options = uiOptions[SUBMIT_BTN_OPTIONS_KEY] as UISchemaSubmitButtonOptions;\n return { ...DEFAULT_OPTIONS, ...options };\n }\n\n return DEFAULT_OPTIONS;\n}\n", "import { FormContextType, TemplatesType, Registry, UIOptionsType, StrictRJSFSchema, RJSFSchema } from './types';\n\n/** Returns the template with the given `name` from either the `uiSchema` if it is defined or from the `registry`\n * otherwise. NOTE, since `ButtonTemplates` are not overridden in `uiSchema` only those in the `registry` are returned.\n *\n * @param name - The name of the template to fetch, restricted to the keys of `TemplatesType`\n * @param registry - The `Registry` from which to read the template\n * @param [uiOptions={}] - The `UIOptionsType` from which to read an alternate template\n * @returns - The template from either the `uiSchema` or `registry` for the `name`\n */\nexport default function getTemplate<\n Name extends keyof TemplatesType,\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(name: Name, registry: Registry, uiOptions: UIOptionsType = {}): TemplatesType[Name] {\n const { templates } = registry;\n if (name === 'ButtonTemplates') {\n return templates[name];\n }\n return (\n // Evaluating uiOptions[name] results in TS2590: Expression produces a union type that is too complex to represent\n // To avoid that, we cast uiOptions to `any` before accessing the name field\n ((uiOptions as any)[name] as TemplatesType[Name]) || templates[name]\n );\n}\n", "import { createElement } from 'react';\nimport ReactIs from 'react-is';\nimport get from 'lodash/get';\nimport set from 'lodash/set';\n\nimport { FormContextType, RJSFSchema, Widget, RegistryWidgetsType, StrictRJSFSchema } from './types';\nimport getSchemaType from './getSchemaType';\n\n/** The map of schema types to widget type to widget name\n */\nconst widgetMap: { [k: string]: { [j: string]: string } } = {\n boolean: {\n checkbox: 'CheckboxWidget',\n radio: 'RadioWidget',\n select: 'SelectWidget',\n hidden: 'HiddenWidget',\n },\n string: {\n text: 'TextWidget',\n password: 'PasswordWidget',\n email: 'EmailWidget',\n hostname: 'TextWidget',\n ipv4: 'TextWidget',\n ipv6: 'TextWidget',\n uri: 'URLWidget',\n 'data-url': 'FileWidget',\n radio: 'RadioWidget',\n select: 'SelectWidget',\n textarea: 'TextareaWidget',\n hidden: 'HiddenWidget',\n date: 'DateWidget',\n datetime: 'DateTimeWidget',\n 'date-time': 'DateTimeWidget',\n 'alt-date': 'AltDateWidget',\n 'alt-datetime': 'AltDateTimeWidget',\n time: 'TimeWidget',\n color: 'ColorWidget',\n file: 'FileWidget',\n },\n number: {\n text: 'TextWidget',\n select: 'SelectWidget',\n updown: 'UpDownWidget',\n range: 'RangeWidget',\n radio: 'RadioWidget',\n hidden: 'HiddenWidget',\n },\n integer: {\n text: 'TextWidget',\n select: 'SelectWidget',\n updown: 'UpDownWidget',\n range: 'RangeWidget',\n radio: 'RadioWidget',\n hidden: 'HiddenWidget',\n },\n array: {\n select: 'SelectWidget',\n checkboxes: 'CheckboxesWidget',\n files: 'FileWidget',\n hidden: 'HiddenWidget',\n },\n};\n\n/** Wraps the given widget with stateless functional component that will merge any `defaultProps.options` with the\n * `options` that are provided in the props. It will add the wrapper component as a `MergedWidget` property onto the\n * `Widget` so that future attempts to wrap `AWidget` will return the already existing wrapper.\n *\n * @param AWidget - A widget that will be wrapped or one that is already wrapped\n * @returns - The wrapper widget\n */\nfunction mergeWidgetOptions(\n AWidget: Widget\n) {\n let MergedWidget: Widget | undefined = get(AWidget, 'MergedWidget');\n // cache return value as property of widget for proper react reconciliation\n if (!MergedWidget) {\n const defaultOptions = (AWidget.defaultProps && AWidget.defaultProps.options) || {};\n MergedWidget = ({ options, ...props }) => {\n return ;\n };\n set(AWidget, 'MergedWidget', MergedWidget);\n }\n return MergedWidget;\n}\n\n/** Given a schema representing a field to render and either the name or actual `Widget` implementation, returns the\n * React component that is used to render the widget. If the `widget` is already a React component, then it is wrapped\n * with a `MergedWidget`. Otherwise an attempt is made to look up the widget inside of the `registeredWidgets` map based\n * on the schema type and `widget` name. If no widget component can be found an `Error` is thrown.\n *\n * @param schema - The schema for the field\n * @param [widget] - Either the name of the widget OR a `Widget` implementation to use\n * @param [registeredWidgets={}] - A registry of widget name to `Widget` implementation\n * @returns - The `Widget` component to use\n * @throws - An error if there is no `Widget` component that can be returned\n */\nexport default function getWidget(\n schema: RJSFSchema,\n widget?: Widget | string,\n registeredWidgets: RegistryWidgetsType = {}\n): Widget {\n const type = getSchemaType(schema);\n\n if (\n typeof widget === 'function' ||\n (widget && ReactIs.isForwardRef(createElement(widget))) ||\n ReactIs.isMemo(widget)\n ) {\n return mergeWidgetOptions(widget as Widget);\n }\n\n if (typeof widget !== 'string') {\n throw new Error(`Unsupported widget definition: ${typeof widget}`);\n }\n\n if (widget in registeredWidgets) {\n const registeredWidget = registeredWidgets[widget];\n return getWidget(schema, registeredWidget, registeredWidgets);\n }\n\n if (typeof type === 'string') {\n if (!(type in widgetMap)) {\n throw new Error(`No widget for type '${type}'`);\n }\n\n if (widget in widgetMap[type]) {\n const registeredWidget = registeredWidgets[widgetMap[type][widget]];\n return getWidget(schema, registeredWidget, registeredWidgets);\n }\n }\n\n throw new Error(`No widget '${widget}' for type '${type}'`);\n}\n", "import { RJSFSchema, StrictRJSFSchema } from './types';\n\n/** JS has no built-in hashing function, so rolling our own\n * based on Java's hashing fn:\n * http://www.java2s.com/example/nodejs-utility-method/string-hash/hashcode-4dc2b.html\n *\n * @param string - The string for which to get the hash\n * @returns - The resulting hash of the string in hex format\n */\nfunction hashString(string: string): string {\n let hash = 0;\n for (let i = 0; i < string.length; i += 1) {\n const chr = string.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash = hash & hash; // Convert to 32bit integer\n }\n return hash.toString(16);\n}\n\n/** Stringifies the schema and returns the hash of the resulting string. Sorts schema fields\n * in consistent order before stringify to prevent different hash ids for the same schema.\n *\n * @param schema - The schema for which the hash is desired\n * @returns - The string obtained from the hash of the stringified schema\n */\nexport default function hashForSchema(schema: S) {\n const allKeys = new Set();\n // solution source: https://stackoverflow.com/questions/16167581/sort-object-properties-and-json-stringify/53593328#53593328\n JSON.stringify(schema, (key, value) => (allKeys.add(key), value));\n return hashString(JSON.stringify(schema, Array.from(allKeys).sort()));\n}\n", "import getWidget from './getWidget';\nimport { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema, Widget } from './types';\n\n/** Detects whether the `widget` exists for the `schema` with the associated `registryWidgets` and returns true if it\n * does, or false if it doesn't.\n *\n * @param schema - The schema for the field\n * @param widget - Either the name of the widget OR a `Widget` implementation to use\n * @param [registeredWidgets={}] - A registry of widget name to `Widget` implementation\n * @returns - True if the widget exists, false otherwise\n */\nexport default function hasWidget(\n schema: RJSFSchema,\n widget: Widget | string,\n registeredWidgets: RegistryWidgetsType = {}\n) {\n try {\n getWidget(schema, widget, registeredWidgets);\n return true;\n } catch (e) {\n const err: Error = e as Error;\n if (err.message && (err.message.startsWith('No widget') || err.message.startsWith('Unsupported widget'))) {\n return false;\n }\n throw e;\n }\n}\n", "import isString from 'lodash/isString';\n\nimport { IdSchema } from './types';\nimport { ID_KEY } from './constants';\n\n/** Generates a consistent `id` pattern for a given `id` and a `suffix`\n *\n * @param id - Either simple string id or an IdSchema from which to extract it\n * @param suffix - The suffix to append to the id\n */\nfunction idGenerator(id: IdSchema | string, suffix: string) {\n const theId = isString(id) ? id : id[ID_KEY];\n return `${theId}__${suffix}`;\n}\n/** Return a consistent `id` for the field description element\n *\n * @param id - Either simple string id or an IdSchema from which to extract it\n * @returns - The consistent id for the field description element from the given `id`\n */\nexport function descriptionId(id: IdSchema | string) {\n return idGenerator(id, 'description');\n}\n\n/** Return a consistent `id` for the field error element\n *\n * @param id - Either simple string id or an IdSchema from which to extract it\n * @returns - The consistent id for the field error element from the given `id`\n */\nexport function errorId(id: IdSchema | string) {\n return idGenerator(id, 'error');\n}\n\n/** Return a consistent `id` for the field examples element\n *\n * @param id - Either simple string id or an IdSchema from which to extract it\n * @returns - The consistent id for the field examples element from the given `id`\n */\nexport function examplesId(id: IdSchema | string) {\n return idGenerator(id, 'examples');\n}\n\n/** Return a consistent `id` for the field help element\n *\n * @param id - Either simple string id or an IdSchema from which to extract it\n * @returns - The consistent id for the field help element from the given `id`\n */\nexport function helpId(id: IdSchema | string) {\n return idGenerator(id, 'help');\n}\n\n/** Return a consistent `id` for the field title element\n *\n * @param id - Either simple string id or an IdSchema from which to extract it\n * @returns - The consistent id for the field title element from the given `id`\n */\nexport function titleId(id: IdSchema | string) {\n return idGenerator(id, 'title');\n}\n\n/** Return a list of element ids that contain additional information about the field that can be used to as the aria\n * description of the field. This is correctly omitting `titleId` which would be \"labeling\" rather than \"describing\" the\n * element.\n *\n * @param id - Either simple string id or an IdSchema from which to extract it\n * @param [includeExamples=false] - Optional flag, if true, will add the `examplesId` into the list\n * @returns - The string containing the list of ids for use in an `aria-describedBy` attribute\n */\nexport function ariaDescribedByIds(id: IdSchema | string, includeExamples = false) {\n const examples = includeExamples ? ` ${examplesId(id)}` : '';\n return `${errorId(id)} ${descriptionId(id)} ${helpId(id)}${examples}`;\n}\n\n/** Return a consistent `id` for the `optionIndex`s of a `Radio` or `Checkboxes` widget\n *\n * @param id - The id of the parent component for the option\n * @param optionIndex - The index of the option for which the id is desired\n * @returns - An id for the option index based on the parent `id`\n */\nexport function optionId(id: string, optionIndex: number) {\n return `${id}-${optionIndex}`;\n}\n", "import { ReactElement } from 'react';\n\n/** Helper function that will return the value to use for a widget `label` based on `hideLabel`. The `fallback` is used\n * as the return value from the function when `hideLabel` is true. Due to the implementation of theme components, it\n * may be necessary to return something other than `undefined` to cause the theme component to not render a label. Some\n * themes require may `false` and others may require an empty string.\n *\n * @param [label] - The label string or component to render when not hidden\n * @param [hideLabel] - Flag, if true, will cause the label to be hidden\n * @param [fallback] - One of 3 values, `undefined` (the default), `false` or an empty string\n * @returns - `fallback` if `hideLabel` is true, otherwise `label`\n */\n\nexport default function labelValue(label?: string, hideLabel?: boolean, fallback?: ''): undefined | string;\nexport default function labelValue(label?: string, hideLabel?: boolean, fallback?: false): undefined | false | string;\nexport default function labelValue(label?: ReactElement, hideLabel?: boolean, fallback?: ''): undefined | ReactElement;\nexport default function labelValue(\n label?: ReactElement,\n hideLabel?: boolean,\n fallback?: false\n): undefined | false | ReactElement;\nexport default function labelValue(\n label?: string | ReactElement,\n hideLabel?: boolean,\n fallback?: false | ''\n): undefined | false | string | ReactElement {\n return hideLabel ? fallback : label;\n}\n", "/** Converts a local Date string into a UTC date string\n *\n * @param dateString - The string representation of a date as accepted by the `Date()` constructor\n * @returns - A UTC date string if `dateString` is truthy, otherwise undefined\n */\nexport default function localToUTC(dateString: string) {\n return dateString ? new Date(dateString).toJSON() : undefined;\n}\n", "import { CONST_KEY, ENUM_KEY } from './constants';\nimport { RJSFSchema, StrictRJSFSchema } from './types';\n\n/** Returns the constant value from the schema when it is either a single value enum or has a const key. Otherwise\n * throws an error.\n *\n * @param schema - The schema from which to obtain the constant value\n * @returns - The constant value for the schema\n * @throws - Error when the schema does not have a constant value\n */\nexport default function toConstant(schema: S) {\n if (ENUM_KEY in schema && Array.isArray(schema.enum) && schema.enum.length === 1) {\n return schema.enum[0];\n }\n if (CONST_KEY in schema) {\n return schema.const;\n }\n throw new Error('schema cannot be inferred as a constant');\n}\n", "import toConstant from './toConstant';\nimport { RJSFSchema, EnumOptionsType, StrictRJSFSchema, FormContextType, UiSchema } from './types';\nimport getUiOptions from './getUiOptions';\n\n/** Gets the list of options from the `schema`. If the schema has an enum list, then those enum values are returned. The\n * labels for the options will be extracted from the non-standard, RJSF-deprecated `enumNames` if it exists, otherwise\n * the label will be the same as the `value`. If the schema has a `oneOf` or `anyOf`, then the value is the list of\n * `const` values from the schema and the label is either the `schema.title` or the value. If a `uiSchema` is provided\n * and it has the `ui:enumNames` matched with `enum` or it has an associated `oneOf` or `anyOf` with a list of objects\n * containing `ui:title` then the UI schema values will replace the values from the schema.\n *\n * @param schema - The schema from which to extract the options list\n * @param [uiSchema] - The optional uiSchema from which to get alternate labels for the options\n * @returns - The list of options from the schema\n */\nexport default function optionsList(\n schema: S,\n uiSchema?: UiSchema\n): EnumOptionsType[] | undefined {\n // TODO flip generics to move T first in v6\n const schemaWithEnumNames = schema as S & { enumNames?: string[] };\n if (schema.enum) {\n let enumNames: string[] | undefined;\n if (uiSchema) {\n const { enumNames: uiEnumNames } = getUiOptions(uiSchema);\n enumNames = uiEnumNames;\n }\n if (!enumNames && schemaWithEnumNames.enumNames) {\n // enumNames was deprecated in v5 and is intentionally omitted from the RJSFSchema type.\n // Cast the type to include enumNames so the feature still works.\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'The \"enumNames\" property in the schema is deprecated and will be removed in a future major release. Use the \"ui:enumNames\" property in the uiSchema instead.'\n );\n }\n enumNames = schemaWithEnumNames.enumNames;\n }\n return schema.enum.map((value, i) => {\n const label = enumNames?.[i] || String(value);\n return { label, value };\n });\n }\n let altSchemas: S['anyOf'] | S['oneOf'] = undefined;\n let altUiSchemas: UiSchema | undefined = undefined;\n if (schema.anyOf) {\n altSchemas = schema.anyOf;\n altUiSchemas = uiSchema?.anyOf;\n } else if (schema.oneOf) {\n altSchemas = schema.oneOf;\n altUiSchemas = uiSchema?.oneOf;\n }\n return (\n altSchemas &&\n altSchemas.map((aSchemaDef, index) => {\n const { title } = getUiOptions(altUiSchemas?.[index]);\n const aSchema = aSchemaDef as S;\n const value = toConstant(aSchema);\n const label = title || aSchema.title || String(value);\n return {\n schema: aSchema,\n label,\n value,\n };\n })\n );\n}\n", "import { GenericObjectType } from './types';\n\n/** Given a list of `properties` and an `order` list, returns a list that contains the `properties` ordered correctly.\n * If `order` is not an array, then the untouched `properties` list is returned. Otherwise `properties` is ordered per\n * the `order` list. If `order` contains a '*' then any `properties` that are not mentioned explicity in `order` will be\n * places in the location of the `*`.\n *\n * @param properties - The list of property keys to be ordered\n * @param order - An array of property keys to be ordered first, with an optional '*' property\n * @returns - A list with the `properties` ordered\n * @throws - Error when the properties cannot be ordered correctly\n */\nexport default function orderProperties(properties: string[], order?: string[]): string[] {\n if (!Array.isArray(order)) {\n return properties;\n }\n\n const arrayToHash = (arr: string[]) =>\n arr.reduce((prev: GenericObjectType, curr) => {\n prev[curr] = true;\n return prev;\n }, {});\n const errorPropList = (arr: string[]) =>\n arr.length > 1 ? `properties '${arr.join(\"', '\")}'` : `property '${arr[0]}'`;\n const propertyHash = arrayToHash(properties);\n const orderFiltered = order.filter((prop) => prop === '*' || propertyHash[prop]);\n const orderHash = arrayToHash(orderFiltered);\n\n const rest = properties.filter((prop: string) => !orderHash[prop]);\n const restIndex = orderFiltered.indexOf('*');\n if (restIndex === -1) {\n if (rest.length) {\n throw new Error(`uiSchema order list does not contain ${errorPropList(rest)}`);\n }\n return orderFiltered;\n }\n if (restIndex !== orderFiltered.lastIndexOf('*')) {\n throw new Error('uiSchema order list contains more than one wildcard item');\n }\n\n const complete = [...orderFiltered];\n complete.splice(restIndex, 1, ...rest);\n return complete;\n}\n", "import { DateObject } from './types';\n\n/** Parses the `dateString` into a `DateObject`, including the time information when `includeTime` is true\n *\n * @param dateString - The date string to parse into a DateObject\n * @param [includeTime=true] - Optional flag, if false, will not include the time data into the object\n * @returns - The date string converted to a `DateObject`\n * @throws - Error when the date cannot be parsed from the string\n */\nexport default function parseDateString(dateString?: string, includeTime = true): DateObject {\n if (!dateString) {\n return {\n year: -1,\n month: -1,\n day: -1,\n hour: includeTime ? -1 : 0,\n minute: includeTime ? -1 : 0,\n second: includeTime ? -1 : 0,\n };\n }\n const date = new Date(dateString);\n if (Number.isNaN(date.getTime())) {\n throw new Error('Unable to parse date ' + dateString);\n }\n return {\n year: date.getUTCFullYear(),\n month: date.getUTCMonth() + 1, // oh you, javascript.\n day: date.getUTCDate(),\n hour: includeTime ? date.getUTCHours() : 0,\n minute: includeTime ? date.getUTCMinutes() : 0,\n second: includeTime ? date.getUTCSeconds() : 0,\n };\n}\n", "import { RJSFSchema, StrictRJSFSchema } from './types';\n\n/** Check to see if a `schema` specifies that a value must be true. This happens when:\n * - `schema.const` is truthy\n * - `schema.enum` == `[true]`\n * - `schema.anyOf` or `schema.oneOf` has a single value which recursively returns true\n * - `schema.allOf` has at least one value which recursively returns true\n *\n * @param schema - The schema to check\n * @returns - True if the schema specifies a value that must be true, false otherwise\n */\nexport default function schemaRequiresTrueValue(schema: S): boolean {\n // Check if const is a truthy value\n if (schema.const) {\n return true;\n }\n\n // Check if an enum has a single value of true\n if (schema.enum && schema.enum.length === 1 && schema.enum[0] === true) {\n return true;\n }\n\n // If anyOf has a single value, evaluate the subschema\n if (schema.anyOf && schema.anyOf.length === 1) {\n return schemaRequiresTrueValue(schema.anyOf[0] as S);\n }\n\n // If oneOf has a single value, evaluate the subschema\n if (schema.oneOf && schema.oneOf.length === 1) {\n return schemaRequiresTrueValue(schema.oneOf[0] as S);\n }\n\n // Evaluate each subschema in allOf, to see if one of them requires a true value\n if (schema.allOf) {\n const schemaSome = (subSchema: S['additionalProperties']) => schemaRequiresTrueValue(subSchema as S);\n return schema.allOf.some(schemaSome);\n }\n\n return false;\n}\n", "import React from 'react';\n\nimport deepEquals from './deepEquals';\n\n/** Determines whether the given `component` should be rerendered by comparing its current set of props and state\n * against the next set. If either of those two sets are not the same, then the component should be rerendered.\n *\n * @param component - A React component being checked\n * @param nextProps - The next set of props against which to check\n * @param nextState - The next set of state against which to check\n * @returns - True if the component should be re-rendered, false otherwise\n */\nexport default function shouldRender(component: React.Component, nextProps: any, nextState: any) {\n const { props, state } = component;\n return !deepEquals(props, nextProps) || !deepEquals(state, nextState);\n}\n", "import { DateObject } from './types';\n\n/** Returns a UTC date string for the given `dateObject`. If `time` is false, then the time portion of the string is\n * removed.\n *\n * @param dateObject - The `DateObject` to convert to a date string\n * @param [time=true] - Optional flag used to remove the time portion of the date string if false\n * @returns - The UTC date string\n */\nexport default function toDateString(dateObject: DateObject, time = true) {\n const { year, month, day, hour = 0, minute = 0, second = 0 } = dateObject;\n const utcTime = Date.UTC(year, month - 1, day, hour, minute, second);\n const datetime = new Date(utcTime).toJSON();\n return time ? datetime : datetime.slice(0, 10);\n}\n", "import isPlainObject from 'lodash/isPlainObject';\n\nimport { ERRORS_KEY } from './constants';\nimport { ErrorSchema, GenericObjectType, RJSFValidationError } from './types';\n\n/** Converts an `errorSchema` into a list of `RJSFValidationErrors`\n *\n * @param errorSchema - The `ErrorSchema` instance to convert\n * @param [fieldPath=[]] - The current field path, defaults to [] if not specified\n * @returns - The list of `RJSFValidationErrors` extracted from the `errorSchema`\n */\nexport default function toErrorList(\n errorSchema?: ErrorSchema,\n fieldPath: string[] = []\n): RJSFValidationError[] {\n if (!errorSchema) {\n return [];\n }\n let errorList: RJSFValidationError[] = [];\n if (ERRORS_KEY in errorSchema) {\n errorList = errorList.concat(\n errorSchema[ERRORS_KEY]!.map((message: string) => {\n const property = `.${fieldPath.join('.')}`;\n return {\n property,\n message,\n stack: `${property} ${message}`,\n };\n })\n );\n }\n return Object.keys(errorSchema).reduce((acc, key) => {\n if (key !== ERRORS_KEY) {\n const childSchema = (errorSchema as GenericObjectType)[key];\n if (isPlainObject(childSchema)) {\n acc = acc.concat(toErrorList(childSchema, [...fieldPath, key]));\n }\n }\n return acc;\n }, errorList);\n}\n", "import toPath from 'lodash/toPath';\n\nimport { ErrorSchema, RJSFValidationError } from './types';\nimport ErrorSchemaBuilder from './ErrorSchemaBuilder';\n\n/** Transforms a rjsf validation errors list:\n * [\n * {property: '.level1.level2[2].level3', message: 'err a'},\n * {property: '.level1.level2[2].level3', message: 'err b'},\n * {property: '.level1.level2[4].level3', message: 'err b'},\n * ]\n * Into an error tree:\n * {\n * level1: {\n * level2: {\n * 2: {level3: {errors: ['err a', 'err b']}},\n * 4: {level3: {errors: ['err b']}},\n * }\n * }\n * };\n *\n * @param errors - The list of RJSFValidationError objects\n * @returns - The `ErrorSchema` built from the list of `RJSFValidationErrors`\n */\nexport default function toErrorSchema(errors: RJSFValidationError[]): ErrorSchema {\n const builder = new ErrorSchemaBuilder();\n if (errors.length) {\n errors.forEach((error) => {\n const { property, message } = error;\n // When the property is the root element, just use an empty array for the path\n const path = property === '.' ? [] : toPath(property);\n // If the property is at the root (.level1) then toPath creates\n // an empty array element at the first index. Remove it.\n if (path.length > 0 && path[0] === '') {\n path.splice(0, 1);\n }\n if (message) {\n builder.addErrors(message, path);\n }\n });\n }\n return builder.ErrorSchema;\n}\n", "import isPlainObject from 'lodash/isPlainObject';\n\nimport { ErrorSchema, FormValidation, GenericObjectType } from './types';\n\n/** Unwraps the `errorHandler` structure into the associated `ErrorSchema`, stripping the `addError()` functions from it\n *\n * @param errorHandler - The `FormValidation` error handling structure\n * @returns - The `ErrorSchema` resulting from the stripping of the `addError()` function\n */\nexport default function unwrapErrorHandler(errorHandler: FormValidation): ErrorSchema {\n return Object.keys(errorHandler).reduce((acc, key) => {\n if (key === 'addError') {\n return acc;\n } else {\n const childSchema = (errorHandler as GenericObjectType)[key];\n if (isPlainObject(childSchema)) {\n return {\n ...acc,\n [key]: unwrapErrorHandler(childSchema),\n };\n }\n return { ...acc, [key]: childSchema };\n }\n }, {} as ErrorSchema);\n}\n", "import pad from './pad';\n\n/** Converts a UTC date string into a local Date format\n *\n * @param jsonDate - A UTC date string\n * @returns - An empty string when `jsonDate` is falsey, otherwise a date string in local format\n */\nexport default function utcToLocal(jsonDate: string) {\n if (!jsonDate) {\n return '';\n }\n\n // required format of `'yyyy-MM-ddThh:mm' followed by optional ':ss' or ':ss.SSS'\n // https://html.spec.whatwg.org/multipage/input.html#local-date-and-time-state-(type%3Ddatetime-local)\n // > should be a _valid local date and time string_ (not GMT)\n\n // Note - date constructor passed local ISO-8601 does not correctly\n // change time to UTC in node pre-8\n const date = new Date(jsonDate);\n\n const yyyy = pad(date.getFullYear(), 4);\n const MM = pad(date.getMonth() + 1, 2);\n const dd = pad(date.getDate(), 2);\n const hh = pad(date.getHours(), 2);\n const mm = pad(date.getMinutes(), 2);\n const ss = pad(date.getSeconds(), 2);\n const SSS = pad(date.getMilliseconds(), 3);\n\n return `${yyyy}-${MM}-${dd}T${hh}:${mm}:${ss}.${SSS}`;\n}\n", "import isEmpty from 'lodash/isEmpty';\n\nimport mergeObjects from './mergeObjects';\nimport toErrorList from './toErrorList';\nimport { ErrorSchema, ValidationData } from './types';\n\n/** Merges the errors in `additionalErrorSchema` into the existing `validationData` by combining the hierarchies in the\n * two `ErrorSchema`s and then appending the error list from the `additionalErrorSchema` obtained by calling\n * `toErrorList()` on the `errors` in the `validationData`. If no `additionalErrorSchema` is passed, then\n * `validationData` is returned.\n *\n * @param validationData - The current `ValidationData` into which to merge the additional errors\n * @param [additionalErrorSchema] - The optional additional set of errors in an `ErrorSchema`\n * @returns - The `validationData` with the additional errors from `additionalErrorSchema` merged into it, if provided.\n */\nexport default function validationDataMerge(\n validationData: ValidationData,\n additionalErrorSchema?: ErrorSchema\n): ValidationData {\n if (!additionalErrorSchema) {\n return validationData;\n }\n const { errors: oldErrors, errorSchema: oldErrorSchema } = validationData;\n let errors = toErrorList(additionalErrorSchema);\n let errorSchema = additionalErrorSchema;\n if (!isEmpty(oldErrorSchema)) {\n errorSchema = mergeObjects(oldErrorSchema, additionalErrorSchema, true) as ErrorSchema;\n errors = [...oldErrors].concat(errors);\n }\n return { errorSchema, errors };\n}\n", "import { REF_KEY, ROOT_SCHEMA_PREFIX } from './constants';\nimport { RJSFSchema, StrictRJSFSchema } from './types';\nimport isObject from 'lodash/isObject';\n\n/** Takes a `node` object and transforms any contained `$ref` node variables with a prefix, recursively calling\n * `withIdRefPrefix` for any other elements.\n *\n * @param node - The object node to which a ROOT_SCHEMA_PREFIX is added when a REF_KEY is part of it\n */\nfunction withIdRefPrefixObject(node: S): S {\n for (const key in node) {\n const realObj: { [k: string]: any } = node;\n const value = realObj[key];\n if (key === REF_KEY && typeof value === 'string' && value.startsWith('#')) {\n realObj[key] = ROOT_SCHEMA_PREFIX + value;\n } else {\n realObj[key] = withIdRefPrefix(value);\n }\n }\n return node;\n}\n\n/** Takes a `node` object list and transforms any contained `$ref` node variables with a prefix, recursively calling\n * `withIdRefPrefix` for any other elements.\n *\n * @param node - The list of object nodes to which a ROOT_SCHEMA_PREFIX is added when a REF_KEY is part of it\n */\nfunction withIdRefPrefixArray(node: S[]): S[] {\n for (let i = 0; i < node.length; i++) {\n node[i] = withIdRefPrefix(node[i]) as S;\n }\n return node;\n}\n\n/** Recursively prefixes all `$ref`s in a schema with the value of the `ROOT_SCHEMA_PREFIX` constant.\n * This is used in isValid to make references to the rootSchema\n *\n * @param schemaNode - The object node to which a ROOT_SCHEMA_PREFIX is added when a REF_KEY is part of it\n * @returns - A copy of the `schemaNode` with updated `$ref`s\n */\nexport default function withIdRefPrefix(\n schemaNode: S | S[] | S[keyof S]\n): S | S[] | S[keyof S] {\n if (Array.isArray(schemaNode)) {\n return withIdRefPrefixArray([...schemaNode]);\n }\n if (isObject(schemaNode)) {\n return withIdRefPrefixObject({ ...schemaNode });\n }\n return schemaNode;\n}\n", "/** An enumeration of all the translatable strings used by `@rjsf/core` and its themes. The value of each of the\n * enumeration keys is expected to be the actual english string. Some strings contain replaceable parameter values\n * as indicated by `%1`, `%2`, etc. The number after the `%` indicates the order of the parameter. The ordering of\n * parameters is important because some languages may choose to put the second parameter before the first in its\n * translation. Also, some strings are rendered using `markdown-to-jsx` and thus support markdown and inline html.\n */\nexport enum TranslatableString {\n /** Fallback title of an array item, used by ArrayField */\n ArrayItemTitle = 'Item',\n /** Missing items reason, used by ArrayField */\n MissingItems = 'Missing items definition',\n /** Yes label, used by BooleanField */\n YesLabel = 'Yes',\n /** No label, used by BooleanField */\n NoLabel = 'No',\n /** Close label, used by ErrorList */\n CloseLabel = 'Close',\n /** Errors label, used by ErrorList */\n ErrorsLabel = 'Errors',\n /** New additionalProperties string default value, used by ObjectField */\n NewStringDefault = 'New Value',\n /** Add button title, used by AddButton */\n AddButton = 'Add',\n /** Add button title, used by AddButton */\n AddItemButton = 'Add Item',\n /** Copy button title, used by IconButton */\n CopyButton = 'Copy',\n /** Move down button title, used by IconButton */\n MoveDownButton = 'Move down',\n /** Move up button title, used by IconButton */\n MoveUpButton = 'Move up',\n /** Remove button title, used by IconButton */\n RemoveButton = 'Remove',\n /** Now label, used by AltDateWidget */\n NowLabel = 'Now',\n /** Clear label, used by AltDateWidget */\n ClearLabel = 'Clear',\n /** Aria date label, used by DateWidget */\n AriaDateLabel = 'Select a date',\n /** File preview label, used by FileWidget */\n PreviewLabel = 'Preview',\n /** Decrement button aria label, used by UpDownWidget */\n DecrementAriaLabel = 'Decrease value by 1',\n /** Increment button aria label, used by UpDownWidget */\n IncrementAriaLabel = 'Increase value by 1',\n // Strings with replaceable parameters\n /** Unknown field type reason, where %1 will be replaced with the type as provided by SchemaField */\n UnknownFieldType = 'Unknown field type %1',\n /** Option prefix, where %1 will be replaced with the option index as provided by MultiSchemaField */\n OptionPrefix = 'Option %1',\n /** Option prefix, where %1 and %2 will be replaced by the schema title and option index, respectively as provided by\n * MultiSchemaField\n */\n TitleOptionPrefix = '%1 option %2',\n /** Key label, where %1 will be replaced by the label as provided by WrapIfAdditionalTemplate */\n KeyLabel = '%1 Key',\n // Strings with replaceable parameters AND/OR that support markdown and html\n /** Invalid object field configuration as provided by the ObjectField.\n * NOTE: Use markdown notation rather than html tags.\n */\n InvalidObjectField = 'Invalid \"%1\" object field configuration: _%2_.',\n /** Unsupported field schema, used by UnsupportedField */\n UnsupportedField = 'Unsupported field schema.',\n /** Unsupported field schema, where %1 will be replaced by the idSchema.$id as provided by UnsupportedField.\n * NOTE: Use markdown notation rather than html tags.\n */\n UnsupportedFieldWithId = 'Unsupported field schema for field `%1`.',\n /** Unsupported field schema, where %1 will be replaced by the reason string as provided by UnsupportedField.\n * NOTE: Use markdown notation rather than html tags.\n */\n UnsupportedFieldWithReason = 'Unsupported field schema: _%1_.',\n /** Unsupported field schema, where %1 and %2 will be replaced by the idSchema.$id and reason strings, respectively,\n * as provided by UnsupportedField.\n * NOTE: Use markdown notation rather than html tags.\n */\n UnsupportedFieldWithIdAndReason = 'Unsupported field schema for field `%1`: _%2_.',\n /** File name, type and size info, where %1, %2 and %3 will be replaced by the file name, file type and file size as\n * provided by FileWidget\n */\n FilesInfo = '**%1** (%2, %3 bytes)',\n}\n", "import forEach from 'lodash/forEach';\nimport isEqual from 'lodash/isEqual';\n\nimport { FormContextType, RJSFSchema, StrictRJSFSchema } from '../types';\nimport { PROPERTIES_KEY, ITEMS_KEY } from '../constants';\nimport ParserValidator, { SchemaMap } from './ParserValidator';\nimport { retrieveSchemaInternal, resolveAnyOrOneOfSchemas } from '../schema/retrieveSchema';\n\n/** Recursive function used to parse the given `schema` belonging to the `rootSchema`. The `validator` is used to\n * capture the sub-schemas that the `isValid()` function is called with. For each schema returned by the\n * `retrieveSchemaInternal()`, the `resolveAnyOrOneOfSchemas()` function is called. For each of the schemas returned\n * from THAT call have `properties`, then each of the sub-schema property objects are then recursively parsed.\n *\n * @param validator - The `ParserValidator` implementation used to capture `isValid()` calls during parsing\n * @param recurseList - The list of schemas returned from the `retrieveSchemaInternal`, preventing infinite recursion\n * @param rootSchema - The root schema from which the schema parsing began\n * @param schema - The current schema element being parsed\n */\nfunction parseSchema(\n validator: ParserValidator,\n recurseList: S[],\n rootSchema: S,\n schema: S\n) {\n const schemas = retrieveSchemaInternal(validator, schema, rootSchema, undefined, true);\n schemas.forEach((schema) => {\n const sameSchemaIndex = recurseList.findIndex((item) => isEqual(item, schema));\n if (sameSchemaIndex === -1) {\n recurseList.push(schema);\n const allOptions = resolveAnyOrOneOfSchemas(validator, schema, rootSchema, true);\n allOptions.forEach((s) => {\n if (PROPERTIES_KEY in s && s[PROPERTIES_KEY]) {\n forEach(schema[PROPERTIES_KEY], (value) => {\n parseSchema(validator, recurseList, rootSchema, value as S);\n });\n }\n });\n if (ITEMS_KEY in schema && !Array.isArray(schema.items) && typeof schema.items !== 'boolean') {\n parseSchema(validator, recurseList, rootSchema, schema.items as S);\n }\n }\n });\n}\n\n/** Parses the given `rootSchema` to extract out all the sub-schemas that maybe contained within it. Returns a map of\n * the hash of the schema to schema/sub-schema.\n *\n * @param rootSchema - The root schema to parse for sub-schemas used by `isValid()` calls\n * @returns - The `SchemaMap` of all schemas that were parsed\n */\nexport default function schemaParser(\n rootSchema: S\n): SchemaMap {\n const validator = new ParserValidator(rootSchema);\n const recurseList: S[] = [];\n\n parseSchema(validator, recurseList, rootSchema, rootSchema);\n\n return validator.getSchemaMap();\n}\n", "import get from 'lodash/get';\nimport isEqual from 'lodash/isEqual';\n\nimport { ID_KEY } from '../constants';\nimport hashForSchema from '../hashForSchema';\nimport {\n CustomValidator,\n ErrorSchema,\n ErrorTransformer,\n FormContextType,\n RJSFSchema,\n RJSFValidationError,\n StrictRJSFSchema,\n UiSchema,\n ValidationData,\n ValidatorType,\n} from '../types';\n\n/** The type of the map of schema hash to schema\n */\nexport type SchemaMap = {\n [hash: string]: S;\n};\n\n/** An implementation of the `ValidatorType` interface that is designed for use in capturing schemas used by the\n * `isValid()` function. The rest of the implementation of the interface throws errors when it is attempted to be used.\n * An instance of the object allows the caller to capture the schemas used in calls to the `isValid()` function. These\n * captured schema, along with the root schema used to construct the object are stored in the map of schemas keyed by\n * the hashed value of the schema. NOTE: After hashing the schema, an $id with the hash value is added to the\n * schema IF that schema doesn't already have an $id, prior to putting the schema into the map.\n */\nexport default class ParserValidator\n implements ValidatorType\n{\n /** The rootSchema provided during construction of the class */\n readonly rootSchema: S;\n\n /** The map of schemas encountered by the ParserValidator */\n schemaMap: SchemaMap = {};\n\n /** Construct the ParserValidator for the given `rootSchema`. This `rootSchema` will be stashed in the `schemaMap`\n * first.\n *\n * @param rootSchema - The root schema against which this validator will be executed\n */\n constructor(rootSchema: S) {\n this.rootSchema = rootSchema;\n this.addSchema(rootSchema, hashForSchema(rootSchema));\n }\n\n /** Resets the internal AJV validator to clear schemas from it. Can be helpful for resetting the validator for tests.\n */\n reset() {\n this.schemaMap = {};\n }\n\n /** Adds the given `schema` to the `schemaMap` keyed by the `hash` or `ID_KEY` if present on the `schema`. If the\n * schema does not have an `ID_KEY`, then the `hash` will be added as the `ID_KEY` to allow the schema to be\n * associated with it's `hash` for future use (by a schema compiler).\n *\n * @param schema - The schema which is to be added to the map\n * @param hash - The hash value at which to map the schema\n */\n addSchema(schema: S, hash: string) {\n const key = get(schema, ID_KEY, hash);\n const identifiedSchema = { ...schema, [ID_KEY]: key };\n const existing = this.schemaMap[key];\n if (!existing) {\n this.schemaMap[key] = identifiedSchema;\n } else if (!isEqual(existing, identifiedSchema)) {\n console.error('existing schema:', JSON.stringify(existing, null, 2));\n console.error('new schema:', JSON.stringify(identifiedSchema, null, 2));\n throw new Error(\n `Two different schemas exist with the same key ${key}! What a bad coincidence. If possible, try adding an $id to one of the schemas`\n );\n }\n }\n\n /** Returns the current `schemaMap` to the caller\n */\n getSchemaMap() {\n return this.schemaMap;\n }\n\n /** Implements the `ValidatorType` `isValid()` method to capture the `schema` in the `schemaMap`. Throws an error when\n * the `rootSchema` is not the same as the root schema provided during construction.\n *\n * @param schema - The schema to record in the `schemaMap`\n * @param _formData - The formData parameter that is ignored\n * @param rootSchema - The root schema associated with the schema\n * @throws - Error when the given `rootSchema` differs from the root schema provided during construction\n */\n isValid(schema: S, _formData: T, rootSchema: S): boolean {\n if (!isEqual(rootSchema, this.rootSchema)) {\n throw new Error('Unexpectedly calling isValid() with a rootSchema that differs from the construction rootSchema');\n }\n this.addSchema(schema, hashForSchema(schema));\n\n return false;\n }\n\n /** Implements the `ValidatorType` `rawValidation()` method to throw an error since it is never supposed to be called\n *\n * @param _schema - The schema parameter that is ignored\n * @param _formData - The formData parameter that is ignored\n */\n rawValidation(_schema: S, _formData?: T): { errors?: Result[]; validationError?: Error } {\n throw new Error('Unexpectedly calling the `rawValidation()` method during schema parsing');\n }\n\n /** Implements the `ValidatorType` `toErrorList()` method to throw an error since it is never supposed to be called\n *\n * @param _errorSchema - The error schema parameter that is ignored\n * @param _fieldPath - The field path parameter that is ignored\n */\n toErrorList(_errorSchema?: ErrorSchema, _fieldPath?: string[]): RJSFValidationError[] {\n throw new Error('Unexpectedly calling the `toErrorList()` method during schema parsing');\n }\n\n /** Implements the `ValidatorType` `validateFormData()` method to throw an error since it is never supposed to be\n * called\n *\n * @param _formData - The formData parameter that is ignored\n * @param _schema - The schema parameter that is ignored\n * @param _customValidate - The customValidate parameter that is ignored\n * @param _transformErrors - The transformErrors parameter that is ignored\n * @param _uiSchema - The uiSchema parameter that is ignored\n */\n validateFormData(\n _formData: T,\n _schema: S,\n _customValidate?: CustomValidator,\n _transformErrors?: ErrorTransformer,\n _uiSchema?: UiSchema\n ): ValidationData {\n throw new Error('Unexpectedly calling the `validateFormData()` method during schema parsing');\n }\n}\n"], "mappings": ";AAMe,SAAR,SAA0B,OAAY;AAC3C,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,WAAO;AAAA,EACT;AAGA,MAAI,OAAO,MAAM,iBAAiB,YAAY,OAAO,SAAS,eAAe,iBAAiB,MAAM;AAClG,WAAO;AAAA,EAC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+B,YAA8C;AACvF,UAAM,IAAI,MAAM,uEAAuE;AAAA,EACzF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,iBACE,WACA,SACA,iBACA,kBACA,WACmB;AACnB,UAAM,IAAI,MAAM,4EAA4E;AAAA,EAC9F;AACF;;;ADvHA,SAAS,YACP,WACA,aACA,YACA,QACA;AACA,QAAM,UAAU,uBAAgC,WAAW,QAAQ,YAAY,QAAW,IAAI;AAC9F,UAAQ,QAAQ,CAACC,YAAW;AAC1B,UAAM,kBAAkB,YAAY,UAAU,CAAC,SAASC,SAAQ,MAAMD,OAAM,CAAC;AAC7E,QAAI,oBAAoB,IAAI;AAC1B,kBAAY,KAAKA,OAAM;AACvB,YAAM,aAAa,yBAAkC,WAAWA,SAAQ,YAAY,IAAI;AACxF,iBAAW,QAAQ,CAAC,MAAM;AACxB,YAAI,kBAAkB,KAAK,EAAE,cAAc,GAAG;AAC5C,kBAAQA,QAAO,cAAc,GAAG,CAAC,UAAU;AACzC,wBAAqB,WAAW,aAAa,YAAY,KAAU;AAAA,UACrE,CAAC;AAAA,QACH;AAAA,MACF,CAAC;AACD,UAAI,aAAaA,WAAU,CAAC,MAAM,QAAQA,QAAO,KAAK,KAAK,OAAOA,QAAO,UAAU,WAAW;AAC5F,oBAAqB,WAAW,aAAa,YAAYA,QAAO,KAAU;AAAA,MAC5E;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAQe,SAAR,aACL,YACc;AACd,QAAM,YAAY,IAAI,gBAAyB,UAAU;AACzD,QAAM,cAAmB,CAAC;AAE1B,cAAY,WAAW,aAAa,YAAY,UAAU;AAE1D,SAAO,UAAU,aAAa;AAChC;", "names": ["get", "get", "has", "isNumber", "isObject", "isString", "times", "get", "get", "get", "get", "type", "acc", "get", "s", "isObject", "get", "has", "key", "isString", "isNumber", "times", "get", "acc", "get", "altSchemas", "get", "isEmpty", "isEmpty", "get", "has", "has", "get", "get", "isEqual", "isEqual", "get", "get", "isEqual", "set", "isEqual", "set", "get", "isEqual", "index", "isEqual", "isEqual", "get", "set", "get", "set", "get", "set", "get", "set", "isString", "isString", "isPlainObject", "isPlainObject", "isPlainObject", "isEmpty", "isEmpty", "isObject", "TranslatableString", "isEqual", "get", "isEqual", "get", "isEqual", "schema", "isEqual"] }