@saas-ui/forms 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"index.modern.js","sources":["../src/display-field.tsx","../src/field.tsx","../src/resolvers/yup.ts","../src/layout.tsx","../src/utils.ts","../src/use-array-field.tsx","../src/array-field.tsx","../src/object-field.tsx","../src/fields.tsx","../src/form.tsx","../src/submit-button.tsx","../src/auto-form.tsx","../src/display-if.tsx","../../../node_modules/@chakra-ui/utils/dist/chakra-ui-utils.esm.js","../../../node_modules/lodash.mergewith/index.js","../../saas-ui-stepper/node_modules/@chakra-ui/utils/dist/chakra-ui-utils.esm.js","../../saas-ui-stepper/dist/index.modern.js","../src/use-step-form.tsx","../src/step-form.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useFormContext } from 'react-hook-form'\n\nimport {\n Text,\n FormControl,\n FormControlProps,\n FormLabel,\n} from '@chakra-ui/react'\n\nimport { FieldProps } from './field'\n\nexport interface DisplayFieldProps\n extends FormControlProps,\n Omit<FieldProps, 'type' | 'label'> {}\n\nexport const DisplayField: React.FC<DisplayFieldProps> = ({\n name,\n label,\n placeholder,\n ...props\n}) => {\n return (\n <FormControl {...props}>\n {label ? <FormLabel htmlFor={name}>{label}</FormLabel> : null}\n <Text fontSize=\"md\">\n <FormValue name={name} />\n </Text>\n </FormControl>\n )\n}\n\nexport const FormValue: React.FC<{ name: string }> = ({ name }) => {\n const { getValues } = useFormContext()\n return getValues(name) || null\n}\n","import * as React from 'react'\nimport {\n useFormContext,\n FormState,\n Controller,\n get,\n RegisterOptions,\n FieldValues,\n FieldPath,\n} from 'react-hook-form'\n\nimport {\n forwardRef,\n Box,\n FormControl,\n FormControlProps,\n FormLabel,\n FormHelperText,\n FormErrorMessage,\n Input,\n Textarea,\n Checkbox,\n Switch,\n useMergeRefs,\n} from '@chakra-ui/react'\n\nimport { NumberInput } from '@saas-ui/number-input'\nimport { PasswordInput } from '@saas-ui/password-input'\nimport { RadioInput } from '@saas-ui/radio'\nimport { PinInput } from '@saas-ui/pin-input'\nimport { Select, NativeSelect } from '@saas-ui/select'\n\nexport interface Option {\n value: string\n label?: string\n [key: string]: unknown\n}\n\nexport type FieldRules = Pick<\n RegisterOptions,\n 'required' | 'min' | 'max' | 'maxLength' | 'minLength' | 'pattern'\n>\n\nexport type FieldTypes =\n | 'text'\n | 'number'\n | 'password'\n | 'textarea'\n | 'select'\n | 'native-select'\n | 'checkbox'\n | 'radio'\n | 'switch'\n | 'pin'\n | string\n\nexport interface FieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> extends Omit<FormControlProps, 'label' | 'type'> {\n /**\n * The field name\n */\n name: TName\n /**\n * The field label\n */\n label?: string\n /**\n * Hide the field label\n */\n hideLabel?: boolean\n /**\n * Field help text\n */\n help?: string\n /**\n * React hook form rules\n */\n rules?: Omit<\n RegisterOptions<TFieldValues, TName>,\n 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'\n >\n /**\n * Options used for selects and radio fields\n */\n options?: Option[]\n /**\n * The field type\n * Build-in types:\n * - text\n * - number\n * - password\n * - textarea\n * - select\n * - native-select\n * - checkbox\n * - radio\n * - switch\n * - pin\n *\n * Will default to a text field if there is no matching type.\n * @default 'text'\n */\n type?: FieldTypes\n /**\n * The input placeholder\n */\n placeholder?: string\n}\n\nconst inputTypes: Record<FieldTypes, any> = {}\n\nconst defaultInputType = 'text'\n\nconst getInput = (type: string) => {\n return inputTypes[type] || inputTypes[defaultInputType]\n}\n\nconst getError = (name: string, formState: FormState<{ [x: string]: any }>) => {\n return get(formState.errors, name)\n}\n\nconst isTouched = (\n name: string,\n formState: FormState<{ [x: string]: any }>\n) => {\n return get(formState.touchedFields, name)\n}\n\nexport const BaseField: React.FC<FieldProps> = (props) => {\n const { name, label, help, variant, hideLabel, children, ...controlProps } =\n props\n\n const { formState } = useFormContext()\n\n const error = getError(name, formState)\n\n return (\n <FormControl variant={variant} {...controlProps} isInvalid={!!error}>\n {label && !hideLabel ? (\n <FormLabel variant={variant}>{label}</FormLabel>\n ) : null}\n <Box>\n {children}\n {help && !error?.message ? (\n <FormHelperText>{help}</FormHelperText>\n ) : null}\n {error?.message && (\n <FormErrorMessage>{error?.message}</FormErrorMessage>\n )}\n </Box>\n </FormControl>\n )\n}\nexport const Field = forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: FieldProps<TFieldValues> & {\n [key: string]: unknown // Make sure attributes of custom components work. Need to change this to a global typedef at some point.\n },\n ref: React.ForwardedRef<typeof FormControl>\n ) => {\n const { type = defaultInputType } = props\n const InputComponent = getInput(type)\n\n return <InputComponent ref={ref} {...props} />\n }\n) as <TFieldValues extends FieldValues>(\n props: FieldProps<TFieldValues> & {\n [key: string]: unknown\n } & {\n ref?: React.ForwardedRef<typeof FormControl>\n }\n) => React.ReactElement\n\ninterface CreateFieldProps {\n displayName: string\n hideLabel?: boolean\n BaseField: React.FC<any>\n}\n\nconst createField = (\n InputComponent: React.FC<any>,\n { displayName, hideLabel, BaseField }: CreateFieldProps\n) => {\n const Field = forwardRef<FieldProps, typeof FormControl>((props, ref) => {\n const {\n name,\n label,\n help,\n isDisabled,\n isInvalid,\n isReadOnly,\n isRequired,\n rules,\n variant,\n ...inputProps\n } = props\n\n const inputRules = {\n required: isRequired,\n ...rules,\n }\n\n return (\n <BaseField\n name={name}\n label={label}\n help={help}\n hideLabel={hideLabel}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n variant={variant}\n >\n <InputComponent\n ref={ref}\n name={name}\n label={label}\n rules={inputRules}\n {...inputProps}\n />\n </BaseField>\n )\n })\n Field.displayName = displayName\n\n return Field\n}\n\nexport const withControlledInput = (InputComponent: any) => {\n return forwardRef<FieldProps, typeof InputComponent>(\n ({ name, rules, ...inputProps }, ref) => {\n const { control } = useFormContext()\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ field: { ref: _ref, ...field } }) => (\n <InputComponent\n {...field}\n {...inputProps}\n ref={useMergeRefs(ref, _ref)}\n />\n )}\n />\n )\n }\n )\n}\n\nexport const withUncontrolledInput = (InputComponent: any) => {\n return forwardRef<FieldProps, typeof InputComponent>(\n ({ name, rules, ...inputProps }, ref) => {\n const { register } = useFormContext()\n\n const { ref: _ref, ...field } = register(name, rules)\n\n return (\n <InputComponent\n {...field}\n {...inputProps}\n ref={useMergeRefs(ref, _ref)}\n />\n )\n }\n )\n}\n\nexport interface RegisterFieldTypeOptions {\n isControlled?: boolean\n hideLabel?: boolean\n BaseField?: React.FC<any>\n}\n\n/**\n * Register a new field type\n * @param type The name for this field in kebab-case, eg `email` or `array-field`\n * @param component The React component\n * @param options\n * @param options.isControlled Set this to true if this is a controlled field.\n * @param options.hideLabel Hide the field label, for example for checkbox or switch field.\n */\nexport const registerFieldType = (\n type: string,\n component: React.FC<any>,\n options?: RegisterFieldTypeOptions\n) => {\n let InputComponent\n if (options?.isControlled) {\n InputComponent = withControlledInput(component)\n } else {\n InputComponent = withUncontrolledInput(component)\n }\n\n const Field = createField(InputComponent, {\n displayName: `${type\n .split('-')\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join('')}Field`,\n hideLabel: options?.hideLabel,\n BaseField: options?.BaseField || BaseField,\n })\n\n inputTypes[type] = Field\n\n return Field\n}\n\n// @todo Consider not registering all fields by default to lower the package size and computations.\n// Not all types may be required in a project.\nexport const InputField = registerFieldType('text', Input)\nexport const NumberInputField = registerFieldType('number', NumberInput, {\n isControlled: true,\n})\nexport const PasswordInputFIeld = registerFieldType('password', PasswordInput)\nexport const TextareaField = registerFieldType('textarea', Textarea)\nexport const SwitchField = registerFieldType(\n 'switch',\n forwardRef(({ label, ...props }: { label?: string }, ref) => {\n return (\n <Switch ref={ref} {...props}>\n {label}\n </Switch>\n )\n }),\n {\n isControlled: true,\n hideLabel: true,\n }\n)\nexport const SelectField = registerFieldType('select', Select, {\n isControlled: true,\n})\nexport const CheckboxField = registerFieldType(\n 'checkbox',\n forwardRef(({ label, ...props }: { label?: string }, ref) => {\n return (\n <Checkbox ref={ref} {...props}>\n {label}\n </Checkbox>\n )\n }),\n {\n hideLabel: true,\n }\n)\nexport const RadioField = registerFieldType('radio', RadioInput, {\n isControlled: true,\n})\nexport const PinField = registerFieldType('pin', PinInput, {\n isControlled: true,\n})\nexport const NativeSelectField = registerFieldType(\n 'native-select',\n NativeSelect,\n { isControlled: true }\n)\n","import { SchemaOf, AnySchema, reach } from 'yup'\nexport { yupResolver } from '@hookform/resolvers/yup'\n\nimport { FieldProps } from '../field'\n\n// @TODO get proper typings for the schema fields\n\nconst getType = (field: any) => {\n if (field.spec.meta?.type) {\n return field.spec.meta.type\n }\n\n switch (field.type) {\n case 'array':\n return 'array'\n case 'object':\n return 'object'\n case 'number':\n return 'number'\n case 'date':\n return 'date'\n case 'string':\n default:\n return 'text'\n }\n}\n\ntype Options = {\n min?: number\n max?: number\n}\n\nconst getArrayOption = (field: any, name: string) => {\n for (const test of field.tests) {\n if (test.OPTIONS?.params[name]) return test.OPTIONS.params[name]\n }\n}\n\n/**\n * A helper function to render forms automatically based on a Yup schema\n *\n * @param schema The Yup schema\n * @returns {FieldProps[]}\n */\nexport const getFieldsFromSchema = (\n schema: SchemaOf<AnySchema>\n): FieldProps[] => {\n const fields = []\n\n let schemaFields: Record<string, any> = {}\n if (schema.type === 'array') {\n /* @ts-ignore this is actually valid */\n schemaFields = schema.innerType.fields\n } else {\n schemaFields = schema.fields\n }\n\n for (const name in schemaFields) {\n const field = schemaFields[name]\n\n const options: Options = {}\n if (field.type === 'array') {\n options.min = getArrayOption(field, 'min')\n options.max = getArrayOption(field, 'max')\n }\n\n fields.push({\n name,\n label: field.spec.label || name,\n type: getType(field),\n ...options,\n })\n }\n return fields\n}\n\nexport const getNestedSchema = (schema: SchemaOf<AnySchema>, path: string) => {\n return reach(schema, path)\n}\n","import * as React from 'react'\n\nimport { chakra, SimpleGrid, SimpleGridProps, useTheme } from '@chakra-ui/react'\n\nexport type FormLayoutProps = SimpleGridProps\n\ninterface FormLayoutItemProps {\n children: React.ReactNode\n}\n\nconst FormLayoutItem: React.FC<FormLayoutItemProps> = ({ children }) => {\n return <chakra.div>{children}</chakra.div>\n}\n\n/**\n * FormLayout\n *\n * Renders form items in a `SimpleGrid`\n * @see https://chakra-ui.com/docs/layout/simple-grid\n */\nexport const FormLayout = ({ children, ...props }: FormLayoutProps) => {\n const theme = useTheme()\n\n const defaultProps = theme.components?.FormLayout?.defaultProps ?? {\n spacing: 4,\n }\n\n const gridProps = {\n ...defaultProps,\n ...props,\n }\n\n return (\n <SimpleGrid {...gridProps}>\n {React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n return <FormLayoutItem>{child}</FormLayoutItem>\n }\n return child\n })}\n </SimpleGrid>\n )\n}\n","import * as React from 'react'\n\nexport const mapNestedFields = (name: string, children: React.ReactNode) => {\n return React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child.props.name) {\n return React.cloneElement(child, {\n ...child.props,\n name: `${name}.${child.props.name}`,\n })\n }\n return child\n })\n}\n","import * as React from 'react'\nimport {\n useFieldArray,\n useFormContext,\n UseFieldArrayReturn,\n} from 'react-hook-form'\n\nimport { createContext } from '@chakra-ui/react-utils'\n\nexport interface UseArrayFieldReturn extends UseFieldArrayReturn {\n /**\n * The array field name\n */\n name: string\n /**\n * The default value for new items\n */\n defaultValue: Record<string, any>\n /**\n * Min amount of items\n */\n min?: number\n /**\n * Max amount of items\n */\n max?: number\n}\n\nexport const [ArrayFieldProvider, useArrayFieldContext] =\n createContext<UseArrayFieldReturn>({\n name: 'ArrayFieldContext',\n })\n\nexport interface UseArrayFieldRowReturn {\n /**\n * Name of the array field including the index, eg 'field.0'\n */\n name: string\n /**\n * The field index\n */\n index: number\n /**\n * Remove this array item\n */\n remove: () => void\n /**\n * True if this is the first item\n */\n isFirst: boolean\n /**\n * True if this is the last item\n */\n isLast: boolean\n}\n\nexport const [ArrayFieldRowProvider, useArrayFieldRowContext] =\n createContext<UseArrayFieldRowReturn>({\n name: 'ArrayFieldRowContext',\n })\n\nexport interface ArrayFieldOptions {\n /**\n * The field name\n */\n name: string\n /**\n * Default value for new values in the array\n */\n defaultValue?: Record<string, any>\n /**\n * Default key name for rows, change this if your data uses 'id'\n * @default \"id\"\n */\n keyName?: string\n min?: number\n max?: number\n}\n\nexport const useArrayField = ({\n name,\n defaultValue = {},\n keyName,\n min,\n max,\n}: ArrayFieldOptions) => {\n const { control } = useFormContext()\n const context = useFieldArray({\n control,\n name,\n keyName,\n })\n\n return {\n ...context,\n name,\n defaultValue,\n min,\n max,\n }\n}\n\nexport interface UseArrayFieldRowProps {\n index: number\n}\n\nexport const useArrayFieldRow = ({ index }: UseArrayFieldRowProps) => {\n const { clearErrors } = useFormContext()\n const { name, remove, fields } = useArrayFieldContext()\n\n React.useEffect(() => {\n // reset errors, to make sure min/max errors reset correctly\n clearErrors(name)\n }, [])\n\n return {\n index,\n isFirst: index === 0,\n isLast: index === fields.length - 1,\n name: `${name}.${index}`,\n remove: React.useCallback(() => {\n clearErrors(name)\n remove(index)\n }, [index]),\n }\n}\n\nexport const useArrayFieldRemoveButton = () => {\n const { isFirst, remove } = useArrayFieldRowContext()\n const { min, fields } = useArrayFieldContext()\n\n const isDisabled = isFirst && !!(min && fields.length <= min)\n\n return {\n onClick: () => remove(),\n isDisabled,\n }\n}\n\nexport const useArrayFieldAddButton = () => {\n const { append, defaultValue, max, fields } = useArrayFieldContext()\n\n const isDisabled = !!(max && fields.length >= max)\n\n return {\n onClick: () =>\n append(defaultValue, {\n shouldFocus: false,\n }),\n isDisabled,\n }\n}\n","import * as React from 'react'\n\nimport { chakra, ResponsiveValue } from '@chakra-ui/system'\n\nimport { AddIcon, MinusIcon } from '@chakra-ui/icons'\nimport { IconButton, ButtonProps } from '@saas-ui/button'\n\nimport { FormLayout } from './layout'\nimport { BaseField, FieldProps } from './field'\n\nimport { mapNestedFields } from './utils'\n\nimport {\n useArrayField,\n useArrayFieldRow,\n useArrayFieldContext,\n ArrayFieldProvider,\n ArrayFieldOptions,\n ArrayFieldRowProvider,\n useArrayFieldRowContext,\n useArrayFieldRemoveButton,\n useArrayFieldAddButton,\n} from './use-array-field'\n\ninterface ArrayField {\n id: string\n [key: string]: unknown\n}\n\ninterface ArrayFieldRowProps {\n /**\n * Amount of field columns\n */\n columns?: ResponsiveValue<number>\n /**\n * Spacing between fields\n */\n spacing?: ResponsiveValue<string | number>\n /**\n * The array index\n */\n index: number\n}\n\nexport const ArrayFieldRow: React.FC<ArrayFieldRowProps> = ({\n children,\n columns,\n spacing,\n index,\n}) => {\n return (\n <ArrayFieldRowContainer index={index}>\n <ArrayFieldRowFields columns={columns} spacing={spacing}>\n {children}\n </ArrayFieldRowFields>\n <ArrayFieldRemoveButton />\n </ArrayFieldRowContainer>\n )\n}\n\nexport interface ArrayFieldRowFieldsProps {\n /**\n * Amount of field columns\n */\n columns?: ResponsiveValue<number>\n /**\n * Spacing between fields\n */\n spacing?: ResponsiveValue<string | number>\n}\n\nexport const ArrayFieldRowFields: React.FC<ArrayFieldRowFieldsProps> = ({\n children,\n columns,\n spacing,\n ...layoutProps\n}) => {\n const { name } = useArrayFieldRowContext()\n return (\n <FormLayout\n flex=\"1\"\n columns={columns}\n gridGap={spacing}\n mr=\"2\"\n {...layoutProps}\n >\n {mapNestedFields(name, children)}\n </FormLayout>\n )\n}\n\nexport const ArrayFieldRowContainer: React.FC<ArrayFieldRowProps> = ({\n children,\n index,\n}) => {\n const context = useArrayFieldRow({ index })\n\n const styles = {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'flex-end',\n width: '100%',\n mb: 4,\n }\n\n return (\n <ArrayFieldRowProvider value={context}>\n <chakra.div __css={styles}>{children}</chakra.div>\n </ArrayFieldRowProvider>\n )\n}\n\nexport const ArrayFieldRemoveButton: React.FC<ButtonProps> = (props) => {\n return (\n <IconButton\n icon={<MinusIcon />}\n aria-label=\"Remove row\"\n {...useArrayFieldRemoveButton()}\n {...props}\n />\n )\n}\n\nexport const ArrayFieldAddButton: React.FC<ButtonProps> = (props) => {\n return (\n <IconButton\n icon={<AddIcon />}\n aria-label=\"Add row\"\n float=\"right\"\n {...useArrayFieldAddButton()}\n {...props}\n />\n )\n}\n\nexport interface ArrayFieldProps\n extends ArrayFieldOptions,\n Omit<FieldProps, 'defaultValue'> {}\n\nexport const ArrayField: React.FC<ArrayFieldProps> = (props) => {\n const { children, ...containerProps } = props\n\n return (\n <ArrayFieldContainer {...containerProps}>\n <ArrayFieldRows>\n {(fields: ArrayField[]) => (\n <>\n {fields.map(({ id }, index: number) => (\n <ArrayFieldRow key={id} index={index}>\n {children}\n </ArrayFieldRow>\n ))}\n </>\n )}\n </ArrayFieldRows>\n <ArrayFieldAddButton />\n </ArrayFieldContainer>\n )\n}\n\nexport interface ArrayFieldRowsProps {\n children: (fields: ArrayField[]) => React.ReactElement | null\n}\n\nexport const ArrayFieldRows = ({\n children,\n}: ArrayFieldRowsProps): React.ReactElement | null => {\n const { fields } = useArrayFieldContext()\n return children(fields)\n}\n\nexport const ArrayFieldContainer: React.FC<ArrayFieldProps> = ({\n name,\n defaultValue,\n keyName,\n min,\n max,\n children,\n ...fieldProps\n}) => {\n const context = useArrayField({\n name,\n defaultValue,\n keyName,\n min,\n max,\n })\n\n return (\n <ArrayFieldProvider value={context}>\n <BaseField name={name} {...fieldProps}>\n {children}\n </BaseField>\n </ArrayFieldProvider>\n )\n}\n","import * as React from 'react'\nimport {\n FormControl,\n FormLabel,\n FormLabelProps,\n ResponsiveValue,\n useStyles,\n} from '@chakra-ui/react'\n\nimport { FormLayout } from './layout'\nimport { FieldProps } from './field'\n\nimport { mapNestedFields } from './utils'\n\nexport interface ObjectFieldProps extends FieldProps {\n name: string\n children: React.ReactNode\n columns?: ResponsiveValue<number>\n spacing?: ResponsiveValue<string | number>\n}\n\nexport const FormLegend = (props: FormLabelProps) => {\n const styles = useStyles()\n return <FormLabel as=\"legend\" sx={styles.legend} {...props} />\n}\n\nexport const ObjectField: React.FC<ObjectFieldProps> = (props) => {\n const { name, label, hideLabel, children, columns, spacing, ...fieldProps } =\n props\n\n return (\n <FormControl name={name} as=\"fieldset\" {...fieldProps}>\n <FormLegend display={hideLabel ? 'none' : 'block'}>{label}</FormLegend>\n <FormLayout columns={columns} gridGap={spacing}>\n {mapNestedFields(name, children)}\n </FormLayout>\n </FormControl>\n )\n}\n","import * as React from 'react'\nimport { getFieldsFromSchema, getNestedSchema } from './resolvers/yup'\n\nimport { FormLayout } from './layout'\nimport { Field, FieldProps } from './field'\n\nimport { ArrayField } from './array-field'\nimport { ObjectField } from './object-field'\n\nexport interface FieldsProps {\n schema: any\n}\n\nconst getNestedFields = (schema: any, name: string) => {\n return getFieldsFromSchema(getNestedSchema(schema, name)).map(\n ({ name, type, ...nestedFieldProps }: FieldProps): React.ReactNode => (\n <Field key={name} name={name} type={type} {...nestedFieldProps} />\n )\n )\n}\n\nexport const Fields: React.FC<FieldsProps> = ({ schema, ...props }) => {\n return (\n <FormLayout {...props}>\n {getFieldsFromSchema(schema).map(\n ({\n name,\n type,\n defaultValue,\n ...fieldProps\n }: FieldProps): React.ReactNode => {\n if (type === 'array') {\n return (\n <ArrayField name={name} {...fieldProps}>\n {getNestedFields(schema, name)}\n </ArrayField>\n )\n } else if (type === 'object') {\n return (\n <ObjectField name={name} {...fieldProps}>\n {getNestedFields(schema, name)}\n </ObjectField>\n )\n }\n\n return <Field key={name} name={name} type={type} {...fieldProps} />\n }\n )}\n </FormLayout>\n )\n}\n","import * as React from 'react'\n\nimport { chakra, HTMLChakraProps, forwardRef } from '@chakra-ui/react'\n\nimport {\n useForm,\n FormProvider,\n UseFormProps,\n UseFormReturn,\n FieldValues,\n SubmitHandler,\n SubmitErrorHandler,\n} from 'react-hook-form'\n\nimport { yupResolver } from './resolvers/yup'\n\nexport type { UseFormReturn }\n\ninterface FormOptions<TFieldValues extends FieldValues = FieldValues> {\n /**\n * The form schema, currently supports Yup schema only.\n */\n schema?: any\n /**\n * The submit handler.\n */\n onSubmit: SubmitHandler<TFieldValues>\n /**\n * Triggers when there are validation errors.\n */\n onError?: SubmitErrorHandler<TFieldValues>\n /**\n * Ref on the HTMLFormElement.\n */\n formRef?: React.MutableRefObject<HTMLFormElement>\n}\n\nexport interface FormProps<TFieldValues extends FieldValues = FieldValues>\n extends UseFormProps<TFieldValues>,\n Omit<HTMLChakraProps<'form'>, 'onSubmit' | 'onError'>,\n FormOptions<TFieldValues> {}\n\n/**\n * @todo Figure out how to pass down FieldValues to all Field components,\n * if at all possible.\n */\nexport const Form = forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: FormProps<TFieldValues>,\n ref: React.ForwardedRef<UseFormReturn<TFieldValues>>\n ) => {\n const {\n mode = 'all',\n resolver,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n schema,\n defaultValues,\n onSubmit,\n onError,\n formRef,\n children,\n ...rest\n } = props\n\n const form = {\n mode,\n resolver,\n defaultValues,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n }\n\n // @todo remove yup dependency and just use resolver prop?\n if (schema) {\n form.resolver = yupResolver(schema)\n }\n\n const methods = useForm<TFieldValues>(form)\n const { handleSubmit } = methods\n\n // This exposes the useForm api through the forwareded ref\n React.useImperativeHandle(ref, () => methods, [ref, methods])\n\n return (\n <FormProvider {...methods}>\n <chakra.form\n ref={formRef}\n onSubmit={handleSubmit(onSubmit, onError)}\n {...rest}\n >\n {children}\n </chakra.form>\n </FormProvider>\n )\n }\n) as <TFieldValues extends FieldValues>(\n props: FormProps<TFieldValues> & {\n ref?: React.ForwardedRef<UseFormReturn<TFieldValues>>\n }\n) => React.ReactElement\n","import * as React from 'react'\n\nimport { useFormContext } from 'react-hook-form'\n\nimport { Button, ButtonProps } from '@saas-ui/button'\n\nimport { forwardRef } from '@chakra-ui/system'\n\nexport interface SubmitButtonProps extends ButtonProps {\n /**\n * Disable the submit button if the form is untouched.\n *\n * Change the default behavior by updating\n * `SubmitButton.defaultProps.disableIfUntouched`\n */\n disableIfUntouched?: boolean\n /**\n * Disable the submit button if the form is invalid.\n *\n * Change the default behavior by updating\n * `SubmitButton.defaultProps.disableIfInvalid`\n */\n disableIfInvalid?: boolean\n}\n\nexport const SubmitButton = forwardRef<SubmitButtonProps, 'button'>(\n (props, ref) => {\n const { children, disableIfUntouched, disableIfInvalid, ...rest } = props\n const { formState } = useFormContext()\n\n const isDisabled =\n (disableIfUntouched && !formState.isDirty) ||\n (disableIfInvalid && !formState.isValid)\n\n return (\n <Button\n type=\"submit\"\n isLoading={formState.isSubmitting}\n isPrimary\n ref={ref}\n isDisabled={isDisabled}\n {...rest}\n >\n {children}\n </Button>\n )\n }\n)\n\nSubmitButton.defaultProps = {\n label: 'Submit',\n disableIfUntouched: false,\n disableIfInvalid: false,\n}\n","import * as React from 'react'\nimport { FieldValues, UseFormReturn } from 'react-hook-form'\nimport { forwardRef } from '@chakra-ui/react'\n\nimport { Form, FormProps } from './form'\n\nimport { FormLayout } from './layout'\nimport { Fields } from './fields'\nimport { SubmitButton } from './submit-button'\n\ninterface AutoFormOptions {\n schema: any\n submitLabel?: false | string\n}\n\nexport interface AutoFormProps<TFieldValues extends FieldValues>\n extends Omit<FormProps<TFieldValues>, 'schema'>,\n AutoFormOptions {}\n\nexport const AutoForm = forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: AutoFormProps<TFieldValues>,\n ref: React.ForwardedRef<UseFormReturn<TFieldValues>>\n ) => {\n const { schema, submitLabel = 'Submit', ...rest } = props\n return (\n <Form {...rest} schema={schema} ref={ref}>\n <FormLayout>\n {<Fields schema={schema} />}\n {submitLabel && <SubmitButton label={submitLabel} />}\n </FormLayout>\n </Form>\n )\n }\n) as <TFieldValues extends FieldValues>(\n props: AutoFormProps<TFieldValues> & {\n ref?: React.ForwardedRef<UseFormReturn<TFieldValues>>\n }\n) => React.ReactElement\n","import * as React from 'react'\nimport {\n useFormContext,\n useWatch,\n FieldValues,\n UseFormReturn,\n} from 'react-hook-form'\n\nexport interface DisplayIfProps<TFieldValues> {\n children: React.ReactElement\n name: string\n defaultValue?: unknown\n isDisabled?: boolean\n isExact?: boolean\n condition?: (value: unknown, context: UseFormReturn<TFieldValues>) => boolean\n}\n\nexport const DisplayIf = <TFieldValues extends FieldValues = FieldValues>({\n children,\n name,\n defaultValue,\n isDisabled,\n isExact,\n condition = (value) => !!value,\n}: DisplayIfProps<TFieldValues>) => {\n const value = useWatch({\n name,\n defaultValue,\n disabled: isDisabled,\n exact: isExact,\n })\n const context = useFormContext<TFieldValues>()\n return condition(value, context) ? children : null\n}\n","export * from 'css-box-model';\nexport { default as mergeWith } from 'lodash.mergewith';\nimport sync, { cancelSync, getFrameData } from 'framesync';\n\nfunction getFirstItem(array) {\n return array != null && array.length ? array[0] : undefined;\n}\nfunction getLastItem(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n}\nfunction getPrevItem(index, array, loop) {\n if (loop === void 0) {\n loop = true;\n }\n\n var prevIndex = getPrevIndex(index, array.length, loop);\n return array[prevIndex];\n}\nfunction getNextItem(index, array, loop) {\n if (loop === void 0) {\n loop = true;\n }\n\n var nextIndex = getNextIndex(index, array.length, 1, loop);\n return array[nextIndex];\n}\nfunction removeIndex(array, index) {\n return array.filter(function (_, idx) {\n return idx !== index;\n });\n}\nfunction addItem(array, item) {\n return [].concat(array, [item]);\n}\nfunction removeItem(array, item) {\n return array.filter(function (eachItem) {\n return eachItem !== item;\n });\n}\n/**\n * Get the next index based on the current index and step.\n *\n * @param currentIndex the current index\n * @param length the total length or count of items\n * @param step the number of steps\n * @param loop whether to circle back once `currentIndex` is at the start/end\n */\n\nfunction getNextIndex(currentIndex, length, step, loop) {\n if (step === void 0) {\n step = 1;\n }\n\n if (loop === void 0) {\n loop = true;\n }\n\n var lastIndex = length - 1;\n\n if (currentIndex === -1) {\n return step > 0 ? 0 : lastIndex;\n }\n\n var nextIndex = currentIndex + step;\n\n if (nextIndex < 0) {\n return loop ? lastIndex : 0;\n }\n\n if (nextIndex >= length) {\n if (loop) return 0;\n return currentIndex > length ? length : currentIndex;\n }\n\n return nextIndex;\n}\n/**\n * Get's the previous index based on the current index.\n * Mostly used for keyboard navigation.\n *\n * @param index - the current index\n * @param count - the length or total count of items in the array\n * @param loop - whether we should circle back to the\n * first/last once `currentIndex` is at the start/end\n */\n\nfunction getPrevIndex(index, count, loop) {\n if (loop === void 0) {\n loop = true;\n }\n\n return getNextIndex(index, count, -1, loop);\n}\n/**\n * Converts an array into smaller chunks or groups.\n *\n * @param array the array to chunk into group\n * @param size the length of each chunk\n */\n\nfunction chunk(array, size) {\n return array.reduce(function (rows, currentValue, index) {\n if (index % size === 0) {\n rows.push([currentValue]);\n } else {\n rows[rows.length - 1].push(currentValue);\n }\n\n return rows;\n }, []);\n}\n/**\n * Gets the next item based on a search string\n *\n * @param items array of items\n * @param searchString the search string\n * @param itemToString resolves an item to string\n * @param currentItem the current selected item\n */\n\nfunction getNextItemFromSearch(items, searchString, itemToString, currentItem) {\n if (searchString == null) {\n return currentItem;\n } // If current item doesn't exist, find the item that matches the search string\n\n\n if (!currentItem) {\n var foundItem = items.find(function (item) {\n return itemToString(item).toLowerCase().startsWith(searchString.toLowerCase());\n });\n return foundItem;\n } // Filter items for ones that match the search string (case insensitive)\n\n\n var matchingItems = items.filter(function (item) {\n return itemToString(item).toLowerCase().startsWith(searchString.toLowerCase());\n }); // If there's a match, let's get the next item to select\n\n if (matchingItems.length > 0) {\n var nextIndex; // If the currentItem is in the available items, we move to the next available option\n\n if (matchingItems.includes(currentItem)) {\n var currentIndex = matchingItems.indexOf(currentItem);\n nextIndex = currentIndex + 1;\n\n if (nextIndex === matchingItems.length) {\n nextIndex = 0;\n }\n\n return matchingItems[nextIndex];\n } // Else, we pick the first item in the available items\n\n\n nextIndex = items.indexOf(matchingItems[0]);\n return items[nextIndex];\n } // a decent fallback to the currentItem\n\n\n return currentItem;\n}\n\n// Number assertions\nfunction isNumber(value) {\n return typeof value === \"number\";\n}\nfunction isNotNumber(value) {\n return typeof value !== \"number\" || Number.isNaN(value) || !Number.isFinite(value);\n}\nfunction isNumeric(value) {\n return value != null && value - parseFloat(value) + 1 >= 0;\n} // Array assertions\n\nfunction isArray(value) {\n return Array.isArray(value);\n}\nfunction isEmptyArray(value) {\n return isArray(value) && value.length === 0;\n} // Function assertions\n\nfunction isFunction(value) {\n return typeof value === \"function\";\n} // Generic assertions\n\nfunction isDefined(value) {\n return typeof value !== \"undefined\" && value !== undefined;\n}\nfunction isUndefined(value) {\n return typeof value === \"undefined\" || value === undefined;\n} // Object assertions\n\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type === \"object\" || type === \"function\") && !isArray(value);\n}\nfunction isEmptyObject(value) {\n return isObject(value) && Object.keys(value).length === 0;\n}\nfunction isNotEmptyObject(value) {\n return value && !isEmptyObject(value);\n}\nfunction isNull(value) {\n return value == null;\n} // String assertions\n\nfunction isString(value) {\n return Object.prototype.toString.call(value) === \"[object String]\";\n}\nfunction isCssVar(value) {\n return /^var\\(--.+\\)$/.test(value);\n} // Empty assertions\n\nfunction isEmpty(value) {\n if (isArray(value)) return isEmptyArray(value);\n if (isObject(value)) return isEmptyObject(value);\n if (value == null || value === \"\") return true;\n return false;\n}\nvar __DEV__ = process.env.NODE_ENV !== \"production\";\nvar __TEST__ = process.env.NODE_ENV === \"test\";\nfunction isRefObject(val) {\n return \"current\" in val;\n}\nfunction isInputEvent(value) {\n return value && isObject(value) && isObject(value.target);\n}\n\nfunction omit(object, keys) {\n var result = {};\n Object.keys(object).forEach(function (key) {\n if (keys.includes(key)) return;\n result[key] = object[key];\n });\n return result;\n}\nfunction pick(object, keys) {\n var result = {};\n keys.forEach(function (key) {\n if (key in object) {\n result[key] = object[key];\n }\n });\n return result;\n}\nfunction split(object, keys) {\n var picked = {};\n var omitted = {};\n Object.keys(object).forEach(function (key) {\n if (keys.includes(key)) {\n picked[key] = object[key];\n } else {\n omitted[key] = object[key];\n }\n });\n return [picked, omitted];\n}\n/**\n * Get value from a deeply nested object using a string path.\n * Memoizes the value.\n * @param obj - the object\n * @param path - the string path\n * @param def - the fallback value\n */\n\nfunction get(obj, path, fallback, index) {\n var key = typeof path === \"string\" ? path.split(\".\") : [path];\n\n for (index = 0; index < key.length; index += 1) {\n if (!obj) break;\n obj = obj[key[index]];\n }\n\n return obj === undefined ? fallback : obj;\n}\nvar memoize = function memoize(fn) {\n var cache = new WeakMap();\n\n var memoizedFn = function memoizedFn(obj, path, fallback, index) {\n if (typeof obj === \"undefined\") {\n return fn(obj, path, fallback);\n }\n\n if (!cache.has(obj)) {\n cache.set(obj, new Map());\n }\n\n var map = cache.get(obj);\n\n if (map.has(path)) {\n return map.get(path);\n }\n\n var value = fn(obj, path, fallback, index);\n map.set(path, value);\n return value;\n };\n\n return memoizedFn;\n};\nvar memoizedGet = memoize(get);\n/**\n * Get value from deeply nested object, based on path\n * It returns the path value if not found in object\n *\n * @param path - the string path or value\n * @param scale - the string path or value\n */\n\nfunction getWithDefault(path, scale) {\n return memoizedGet(scale, path, path);\n}\n\n/**\n * Returns the items of an object that meet the condition specified in a callback function.\n *\n * @param object the object to loop through\n * @param fn The filter function\n */\nfunction objectFilter(object, fn) {\n var result = {};\n Object.keys(object).forEach(function (key) {\n var value = object[key];\n var shouldPass = fn(value, key, object);\n\n if (shouldPass) {\n result[key] = value;\n }\n });\n return result;\n}\nvar filterUndefined = function filterUndefined(object) {\n return objectFilter(object, function (val) {\n return val !== null && val !== undefined;\n });\n};\nvar objectKeys = function objectKeys(obj) {\n return Object.keys(obj);\n};\n/**\n * Object.entries polyfill for Nodev10 compatibility\n */\n\nvar fromEntries = function fromEntries(entries) {\n return entries.reduce(function (carry, _ref) {\n var key = _ref[0],\n value = _ref[1];\n carry[key] = value;\n return carry;\n }, {});\n};\n/**\n * Get the CSS variable ref stored in the theme\n */\n\nvar getCSSVar = function getCSSVar(theme, scale, value) {\n var _theme$__cssMap$$varR, _theme$__cssMap$;\n\n return (_theme$__cssMap$$varR = (_theme$__cssMap$ = theme.__cssMap[scale + \".\" + value]) == null ? void 0 : _theme$__cssMap$.varRef) != null ? _theme$__cssMap$$varR : value;\n};\n\nfunction analyzeCSSValue(value) {\n var num = parseFloat(value.toString());\n var unit = value.toString().replace(String(num), \"\");\n return {\n unitless: !unit,\n value: num,\n unit: unit\n };\n}\n\nfunction px(value) {\n if (value == null) return value;\n\n var _analyzeCSSValue = analyzeCSSValue(value),\n unitless = _analyzeCSSValue.unitless;\n\n return unitless || isNumber(value) ? value + \"px\" : value;\n}\n\nvar sortByBreakpointValue = function sortByBreakpointValue(a, b) {\n return parseInt(a[1], 10) > parseInt(b[1], 10) ? 1 : -1;\n};\n\nvar sortBps = function sortBps(breakpoints) {\n return fromEntries(Object.entries(breakpoints).sort(sortByBreakpointValue));\n};\n\nfunction normalize(breakpoints) {\n var sorted = sortBps(breakpoints);\n return Object.assign(Object.values(sorted), sorted);\n}\n\nfunction keys(breakpoints) {\n var value = Object.keys(sortBps(breakpoints));\n return new Set(value);\n}\n\nfunction subtract(value) {\n var _px;\n\n if (!value) return value;\n value = (_px = px(value)) != null ? _px : value;\n var factor = value.endsWith(\"px\") ? -1 : // the equivalent of 1px in em using a 16px base\n -0.0635;\n return isNumber(value) ? \"\" + (value + factor) : value.replace(/([0-9]+\\.?[0-9]*)/, function (m) {\n return \"\" + (parseFloat(m) + factor);\n });\n}\n\nfunction queryString(min, max) {\n var query = [];\n if (min) query.push(\"@media screen and (min-width: \" + px(min) + \")\");\n if (query.length > 0 && max) query.push(\"and\");\n if (max) query.push(\"@media screen and (max-width: \" + px(max) + \")\");\n return query.join(\" \");\n}\n\nfunction analyzeBreakpoints(breakpoints) {\n var _breakpoints$base;\n\n if (!breakpoints) return null;\n breakpoints.base = (_breakpoints$base = breakpoints.base) != null ? _breakpoints$base : \"0px\";\n var normalized = normalize(breakpoints);\n var queries = Object.entries(breakpoints).sort(sortByBreakpointValue).map(function (_ref, index, entry) {\n var _entry;\n\n var breakpoint = _ref[0],\n minW = _ref[1];\n\n var _ref2 = (_entry = entry[index + 1]) != null ? _entry : [],\n maxW = _ref2[1];\n\n maxW = parseFloat(maxW) > 0 ? subtract(maxW) : undefined;\n return {\n breakpoint: breakpoint,\n minW: minW,\n maxW: maxW,\n maxWQuery: queryString(null, maxW),\n minWQuery: queryString(minW),\n minMaxQuery: queryString(minW, maxW)\n };\n });\n\n var _keys = keys(breakpoints);\n\n var _keysArr = Array.from(_keys.values());\n\n return {\n keys: _keys,\n normalized: normalized,\n isResponsive: function isResponsive(test) {\n var keys = Object.keys(test);\n return keys.length > 0 && keys.every(function (key) {\n return _keys.has(key);\n });\n },\n asObject: sortBps(breakpoints),\n asArray: normalize(breakpoints),\n details: queries,\n media: [null].concat(normalized.map(function (minW) {\n return queryString(minW);\n }).slice(1)),\n toArrayValue: function toArrayValue(test) {\n if (!isObject(test)) {\n throw new Error(\"toArrayValue: value must be an object\");\n }\n\n var result = _keysArr.map(function (bp) {\n var _test$bp;\n\n return (_test$bp = test[bp]) != null ? _test$bp : null;\n });\n\n while (getLastItem(result) === null) {\n result.pop();\n }\n\n return result;\n },\n toObjectValue: function toObjectValue(test) {\n if (!Array.isArray(test)) {\n throw new Error(\"toObjectValue: value must be an array\");\n }\n\n return test.reduce(function (acc, value, index) {\n var key = _keysArr[index];\n if (key != null && value != null) acc[key] = value;\n return acc;\n }, {});\n }\n };\n}\n\nfunction isElement(el) {\n return el != null && typeof el == \"object\" && \"nodeType\" in el && el.nodeType === Node.ELEMENT_NODE;\n}\nfunction isHTMLElement(el) {\n var _el$ownerDocument$def;\n\n if (!isElement(el)) {\n return false;\n }\n\n var win = (_el$ownerDocument$def = el.ownerDocument.defaultView) != null ? _el$ownerDocument$def : window;\n return el instanceof win.HTMLElement;\n}\nfunction getOwnerWindow(node) {\n var _getOwnerDocument$def, _getOwnerDocument;\n\n return isElement(node) ? (_getOwnerDocument$def = (_getOwnerDocument = getOwnerDocument(node)) == null ? void 0 : _getOwnerDocument.defaultView) != null ? _getOwnerDocument$def : window : window;\n}\nfunction getOwnerDocument(node) {\n var _node$ownerDocument;\n\n return isElement(node) ? (_node$ownerDocument = node.ownerDocument) != null ? _node$ownerDocument : document : document;\n}\nfunction getEventWindow(event) {\n var _view;\n\n return (_view = event.view) != null ? _view : window;\n}\nfunction canUseDOM() {\n return !!(typeof window !== \"undefined\" && window.document && window.document.createElement);\n}\nvar isBrowser = canUseDOM();\nvar dataAttr = function dataAttr(condition) {\n return condition ? \"\" : undefined;\n};\nvar ariaAttr = function ariaAttr(condition) {\n return condition ? true : undefined;\n};\nvar cx = function cx() {\n for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) {\n classNames[_key] = arguments[_key];\n }\n\n return classNames.filter(Boolean).join(\" \");\n};\nfunction getActiveElement(node) {\n var doc = getOwnerDocument(node);\n return doc == null ? void 0 : doc.activeElement;\n}\nfunction contains(parent, child) {\n if (!parent) return false;\n return parent === child || parent.contains(child);\n}\nfunction addDomEvent(target, eventName, handler, options) {\n target.addEventListener(eventName, handler, options);\n return function () {\n target.removeEventListener(eventName, handler, options);\n };\n}\n/**\n * Get the normalized event key across all browsers\n * @param event keyboard event\n */\n\nfunction normalizeEventKey(event) {\n var key = event.key,\n keyCode = event.keyCode;\n var isArrowKey = keyCode >= 37 && keyCode <= 40 && key.indexOf(\"Arrow\") !== 0;\n var eventKey = isArrowKey ? \"Arrow\" + key : key;\n return eventKey;\n}\nfunction getRelatedTarget(event) {\n var _event$target, _event$relatedTarget;\n\n var target = (_event$target = event.target) != null ? _event$target : event.currentTarget;\n var activeElement = getActiveElement(target);\n return (_event$relatedTarget = event.relatedTarget) != null ? _event$relatedTarget : activeElement;\n}\nfunction isRightClick(event) {\n return event.button !== 0;\n}\n\n// Really great work done by Diego Haz on this one\nvar hasDisplayNone = function hasDisplayNone(element) {\n return window.getComputedStyle(element).display === \"none\";\n};\nvar hasTabIndex = function hasTabIndex(element) {\n return element.hasAttribute(\"tabindex\");\n};\nvar hasNegativeTabIndex = function hasNegativeTabIndex(element) {\n return hasTabIndex(element) && element.tabIndex === -1;\n};\nfunction isDisabled(element) {\n return Boolean(element.getAttribute(\"disabled\")) === true || Boolean(element.getAttribute(\"aria-disabled\")) === true;\n}\nfunction isInputElement(element) {\n return isHTMLElement(element) && element.tagName.toLowerCase() === \"input\" && \"select\" in element;\n}\nfunction isActiveElement(element) {\n var doc = isHTMLElement(element) ? getOwnerDocument(element) : document;\n return doc.activeElement === element;\n}\nfunction hasFocusWithin(element) {\n if (!document.activeElement) return false;\n return element.contains(document.activeElement);\n}\nfunction isHidden(element) {\n if (element.parentElement && isHidden(element.parentElement)) return true;\n return element.hidden;\n}\nfunction isContentEditable(element) {\n var value = element.getAttribute(\"contenteditable\");\n return value !== \"false\" && value != null;\n}\nfunction isFocusable(element) {\n if (!isHTMLElement(element) || isHidden(element) || isDisabled(element)) {\n return false;\n }\n\n var localName = element.localName;\n var focusableTags = [\"input\", \"select\", \"textarea\", \"button\"];\n if (focusableTags.indexOf(localName) >= 0) return true;\n var others = {\n a: function a() {\n return element.hasAttribute(\"href\");\n },\n audio: function audio() {\n return element.hasAttribute(\"controls\");\n },\n video: function video() {\n return element.hasAttribute(\"controls\");\n }\n };\n\n if (localName in others) {\n return others[localName]();\n }\n\n if (isContentEditable(element)) return true;\n return hasTabIndex(element);\n}\nfunction isTabbable(element) {\n if (!element) return false;\n return isHTMLElement(element) && isFocusable(element) && !hasNegativeTabIndex(element);\n}\n\nvar focusableElList = [\"input:not([disabled])\", \"select:not([disabled])\", \"textarea:not([disabled])\", \"embed\", \"iframe\", \"object\", \"a[href]\", \"area[href]\", \"button:not([disabled])\", \"[tabindex]\", \"audio[controls]\", \"video[controls]\", \"*[tabindex]:not([aria-disabled])\", \"*[contenteditable]\"];\nvar focusableElSelector = focusableElList.join();\nfunction getAllFocusable(container) {\n var focusableEls = Array.from(container.querySelectorAll(focusableElSelector));\n focusableEls.unshift(container);\n return focusableEls.filter(isFocusable).filter(function (el) {\n return window.getComputedStyle(el).display !== \"none\";\n });\n}\nfunction getFirstFocusable(container) {\n var allFocusable = getAllFocusable(container);\n return allFocusable.length ? allFocusable[0] : null;\n}\nfunction getAllTabbable(container, fallbackToFocusable) {\n var allFocusable = Array.from(container.querySelectorAll(focusableElSelector));\n var allTabbable = allFocusable.filter(isTabbable);\n\n if (isTabbable(container)) {\n allTabbable.unshift(container);\n }\n\n if (!allTabbable.length && fallbackToFocusable) {\n return allFocusable;\n }\n\n return allTabbable;\n}\nfunction getFirstTabbableIn(container, fallbackToFocusable) {\n var _getAllTabbable = getAllTabbable(container, fallbackToFocusable),\n first = _getAllTabbable[0];\n\n return first || null;\n}\nfunction getLastTabbableIn(container, fallbackToFocusable) {\n var allTabbable = getAllTabbable(container, fallbackToFocusable);\n return allTabbable[allTabbable.length - 1] || null;\n}\nfunction getNextTabbable(container, fallbackToFocusable) {\n var allFocusable = getAllFocusable(container);\n var index = allFocusable.indexOf(document.activeElement);\n var slice = allFocusable.slice(index + 1);\n return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);\n}\nfunction getPreviousTabbable(container, fallbackToFocusable) {\n var allFocusable = getAllFocusable(container).reverse();\n var index = allFocusable.indexOf(document.activeElement);\n var slice = allFocusable.slice(index + 1);\n return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);\n}\nfunction focusNextTabbable(container, fallbackToFocusable) {\n var nextTabbable = getNextTabbable(container, fallbackToFocusable);\n\n if (nextTabbable && isHTMLElement(nextTabbable)) {\n nextTabbable.focus();\n }\n}\nfunction focusPreviousTabbable(container, fallbackToFocusable) {\n var previousTabbable = getPreviousTabbable(container, fallbackToFocusable);\n\n if (previousTabbable && isHTMLElement(previousTabbable)) {\n previousTabbable.focus();\n }\n}\n\nfunction matches(element, selectors) {\n if (\"matches\" in element) return element.matches(selectors);\n if (\"msMatchesSelector\" in element) return element.msMatchesSelector(selectors);\n return element.webkitMatchesSelector(selectors);\n}\n\nfunction closest(element, selectors) {\n if (\"closest\" in element) return element.closest(selectors);\n\n do {\n if (matches(element, selectors)) return element;\n element = element.parentElement || element.parentNode;\n } while (element !== null && element.nodeType === 1);\n\n return null;\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\n/* eslint-disable no-nested-ternary */\nfunction runIfFn(valueOrFn) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return isFunction(valueOrFn) ? valueOrFn.apply(void 0, args) : valueOrFn;\n}\nfunction callAllHandlers() {\n for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n fns[_key2] = arguments[_key2];\n }\n\n return function func(event) {\n fns.some(function (fn) {\n fn == null ? void 0 : fn(event);\n return event == null ? void 0 : event.defaultPrevented;\n });\n };\n}\nfunction callAll() {\n for (var _len3 = arguments.length, fns = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n fns[_key3] = arguments[_key3];\n }\n\n return function mergedFn(arg) {\n fns.forEach(function (fn) {\n fn == null ? void 0 : fn(arg);\n });\n };\n}\nvar compose = function compose(fn1) {\n for (var _len4 = arguments.length, fns = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n fns[_key4 - 1] = arguments[_key4];\n }\n\n return fns.reduce(function (f1, f2) {\n return function () {\n return f1(f2.apply(void 0, arguments));\n };\n }, fn1);\n};\nfunction once(fn) {\n var result;\n return function func() {\n if (fn) {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n\n result = fn.apply(this, args);\n fn = null;\n }\n\n return result;\n };\n}\nvar noop = function noop() {};\nvar warn = once(function (options) {\n return function () {\n var condition = options.condition,\n message = options.message;\n\n if (condition && __DEV__) {\n console.warn(message);\n }\n };\n});\nvar error = once(function (options) {\n return function () {\n var condition = options.condition,\n message = options.message;\n\n if (condition && __DEV__) {\n console.error(message);\n }\n };\n});\nvar pipe = function pipe() {\n for (var _len6 = arguments.length, fns = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n fns[_key6] = arguments[_key6];\n }\n\n return function (v) {\n return fns.reduce(function (a, b) {\n return b(a);\n }, v);\n };\n};\n\nvar distance1D = function distance1D(a, b) {\n return Math.abs(a - b);\n};\n\nvar isPoint = function isPoint(point) {\n return \"x\" in point && \"y\" in point;\n};\n\nfunction distance(a, b) {\n if (isNumber(a) && isNumber(b)) {\n return distance1D(a, b);\n }\n\n if (isPoint(a) && isPoint(b)) {\n var xDelta = distance1D(a.x, b.x);\n var yDelta = distance1D(a.y, b.y);\n return Math.sqrt(Math.pow(xDelta, 2) + Math.pow(yDelta, 2));\n }\n\n return 0;\n}\n\nfunction focus(element, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$isActive = _options.isActive,\n isActive = _options$isActive === void 0 ? isActiveElement : _options$isActive,\n nextTick = _options.nextTick,\n _options$preventScrol = _options.preventScroll,\n preventScroll = _options$preventScrol === void 0 ? true : _options$preventScrol,\n _options$selectTextIf = _options.selectTextIfInput,\n selectTextIfInput = _options$selectTextIf === void 0 ? true : _options$selectTextIf;\n if (!element || isActive(element)) return -1;\n\n function triggerFocus() {\n if (!element) {\n warn({\n condition: true,\n message: \"[chakra-ui]: can't call focus() on `null` or `undefined` element\"\n });\n return;\n }\n\n if (supportsPreventScroll()) {\n element.focus({\n preventScroll: preventScroll\n });\n } else {\n element.focus();\n\n if (preventScroll) {\n var scrollableElements = getScrollableElements(element);\n restoreScrollPosition(scrollableElements);\n }\n }\n\n if (isInputElement(element) && selectTextIfInput) {\n element.select();\n }\n }\n\n if (nextTick) {\n return requestAnimationFrame(triggerFocus);\n }\n\n triggerFocus();\n return -1;\n}\nvar supportsPreventScrollCached = null;\n\nfunction supportsPreventScroll() {\n if (supportsPreventScrollCached == null) {\n supportsPreventScrollCached = false;\n\n try {\n var div = document.createElement(\"div\");\n div.focus({\n get preventScroll() {\n supportsPreventScrollCached = true;\n return true;\n }\n\n });\n } catch (e) {// Ignore\n }\n }\n\n return supportsPreventScrollCached;\n}\n\nfunction getScrollableElements(element) {\n var _doc$defaultView;\n\n var doc = getOwnerDocument(element);\n var win = (_doc$defaultView = doc.defaultView) != null ? _doc$defaultView : window;\n var parent = element.parentNode;\n var scrollableElements = [];\n var rootScrollingElement = doc.scrollingElement || doc.documentElement;\n\n while (parent instanceof win.HTMLElement && parent !== rootScrollingElement) {\n if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) {\n scrollableElements.push({\n element: parent,\n scrollTop: parent.scrollTop,\n scrollLeft: parent.scrollLeft\n });\n }\n\n parent = parent.parentNode;\n }\n\n if (rootScrollingElement instanceof win.HTMLElement) {\n scrollableElements.push({\n element: rootScrollingElement,\n scrollTop: rootScrollingElement.scrollTop,\n scrollLeft: rootScrollingElement.scrollLeft\n });\n }\n\n return scrollableElements;\n}\n\nfunction restoreScrollPosition(scrollableElements) {\n for (var _iterator = _createForOfIteratorHelperLoose(scrollableElements), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n element = _step$value.element,\n scrollTop = _step$value.scrollTop,\n scrollLeft = _step$value.scrollLeft;\n element.scrollTop = scrollTop;\n element.scrollLeft = scrollLeft;\n }\n}\n\nfunction flatten(target, maxDepth) {\n if (maxDepth === void 0) {\n maxDepth = Infinity;\n }\n\n if (!isObject(target) && !Array.isArray(target) || !maxDepth) {\n return target;\n }\n\n return Object.entries(target).reduce(function (result, _ref) {\n var key = _ref[0],\n value = _ref[1];\n\n if (isObject(value) || isArray(value)) {\n Object.entries(flatten(value, maxDepth - 1)).forEach(function (_ref2) {\n var childKey = _ref2[0],\n childValue = _ref2[1];\n // e.g. gray.500\n result[key + \".\" + childKey] = childValue;\n });\n } else {\n // e.g. transparent\n result[key] = value;\n }\n\n return result;\n }, {});\n}\n\n/**\n * Determines whether the children of a disclosure widget\n * should be rendered or not, depending on the lazy behavior.\n *\n * Used in accordion, tabs, popover, menu and other disclosure\n * widgets.\n */\nfunction determineLazyBehavior(options) {\n var hasBeenSelected = options.hasBeenSelected,\n isLazy = options.isLazy,\n isSelected = options.isSelected,\n _options$lazyBehavior = options.lazyBehavior,\n lazyBehavior = _options$lazyBehavior === void 0 ? \"unmount\" : _options$lazyBehavior; // if not lazy, always render the disclosure's content\n\n if (!isLazy) return true; // if the diclosure is selected, render the disclosure's content\n\n if (isSelected) return true; // if the disclosure was selected but not active, keep its content active\n\n if (lazyBehavior === \"keepMounted\" && hasBeenSelected) return true;\n return false;\n}\n\nvar minSafeInteger = Number.MIN_SAFE_INTEGER || -9007199254740991;\nvar maxSafeInteger = Number.MAX_SAFE_INTEGER || 9007199254740991;\n\nfunction toNumber(value) {\n var num = parseFloat(value);\n return isNotNumber(num) ? 0 : num;\n}\n/**\n * Converts a value to a specific precision (or decimal points).\n *\n * Returns a string representing a number in fixed-point notation.\n *\n * @param value the value to convert\n * @param precision the precision or decimal points\n */\n\n\nfunction toPrecision(value, precision) {\n var nextValue = toNumber(value);\n var scaleFactor = Math.pow(10, precision != null ? precision : 10);\n nextValue = Math.round(nextValue * scaleFactor) / scaleFactor;\n return precision ? nextValue.toFixed(precision) : nextValue.toString();\n}\n/**\n * Counts the number of decimal places a number has\n *\n * @param value the decimal value to count\n */\n\nfunction countDecimalPlaces(value) {\n if (!Number.isFinite(value)) return 0;\n var e = 1;\n var p = 0;\n\n while (Math.round(value * e) / e !== value) {\n e *= 10;\n p += 1;\n }\n\n return p;\n}\n/**\n * Convert a value to percentage based on lower and upper bound values\n *\n * @param value the value in number\n * @param min the minimum value\n * @param max the maximum value\n */\n\nfunction valueToPercent(value, min, max) {\n return (value - min) * 100 / (max - min);\n}\n/**\n * Calculate the value based on percentage, lower and upper bound values\n *\n * @param percent the percent value in decimals (e.g 0.6, 0.3)\n * @param min the minimum value\n * @param max the maximum value\n */\n\nfunction percentToValue(percent, min, max) {\n return (max - min) * percent + min;\n}\n/**\n * Rounds a specific value to the next or previous step\n *\n * @param value the value to round\n * @param from the number that stepping started from\n * @param step the specified step\n */\n\nfunction roundValueToStep(value, from, step) {\n var nextValue = Math.round((value - from) / step) * step + from;\n var precision = countDecimalPlaces(step);\n return toPrecision(nextValue, precision);\n}\n/**\n * Clamps a value to ensure it stays within the min and max range.\n *\n * @param value the value to clamp\n * @param min the minimum value\n * @param max the maximum value\n */\n\nfunction clampValue(value, min, max) {\n if (value == null) return value;\n warn({\n condition: max < min,\n message: \"clamp: max cannot be less than min\"\n });\n return Math.min(Math.max(value, min), max);\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\n/**\n * Credit goes to `framer-motion` of this useful utilities.\n * License can be found here: https://github.com/framer/motion\n */\nfunction isMouseEvent(event) {\n var win = getEventWindow(event); // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.\n\n if (typeof win.PointerEvent !== \"undefined\" && event instanceof win.PointerEvent) {\n return !!(event.pointerType === \"mouse\");\n }\n\n return event instanceof win.MouseEvent;\n}\nfunction isTouchEvent(event) {\n var hasTouches = !!event.touches;\n return hasTouches;\n}\n\n/**\n * Filters out events not attached to the primary pointer (currently left mouse button)\n * @param eventHandler\n */\nfunction filterPrimaryPointer(eventHandler) {\n return function (event) {\n var win = getEventWindow(event);\n var isMouseEvent = event instanceof win.MouseEvent;\n var isPrimaryPointer = !isMouseEvent || isMouseEvent && event.button === 0;\n\n if (isPrimaryPointer) {\n eventHandler(event);\n }\n };\n}\n\nvar defaultPagePoint = {\n pageX: 0,\n pageY: 0\n};\n\nfunction pointFromTouch(e, pointType) {\n if (pointType === void 0) {\n pointType = \"page\";\n }\n\n var primaryTouch = e.touches[0] || e.changedTouches[0];\n var point = primaryTouch || defaultPagePoint;\n return {\n x: point[pointType + \"X\"],\n y: point[pointType + \"Y\"]\n };\n}\n\nfunction pointFromMouse(point, pointType) {\n if (pointType === void 0) {\n pointType = \"page\";\n }\n\n return {\n x: point[pointType + \"X\"],\n y: point[pointType + \"Y\"]\n };\n}\n\nfunction extractEventInfo(event, pointType) {\n if (pointType === void 0) {\n pointType = \"page\";\n }\n\n return {\n point: isTouchEvent(event) ? pointFromTouch(event, pointType) : pointFromMouse(event, pointType)\n };\n}\nfunction getViewportPointFromEvent(event) {\n return extractEventInfo(event, \"client\");\n}\nvar wrapPointerEventHandler = function wrapPointerEventHandler(handler, shouldFilterPrimaryPointer) {\n if (shouldFilterPrimaryPointer === void 0) {\n shouldFilterPrimaryPointer = false;\n }\n\n var listener = function listener(event) {\n return handler(event, extractEventInfo(event));\n };\n\n return shouldFilterPrimaryPointer ? filterPrimaryPointer(listener) : listener;\n}; // We check for event support via functions in case they've been mocked by a testing suite.\n\nvar supportsPointerEvents = function supportsPointerEvents() {\n return isBrowser && window.onpointerdown === null;\n};\n\nvar supportsTouchEvents = function supportsTouchEvents() {\n return isBrowser && window.ontouchstart === null;\n};\n\nvar supportsMouseEvents = function supportsMouseEvents() {\n return isBrowser && window.onmousedown === null;\n};\n\nvar mouseEventNames = {\n pointerdown: \"mousedown\",\n pointermove: \"mousemove\",\n pointerup: \"mouseup\",\n pointercancel: \"mousecancel\",\n pointerover: \"mouseover\",\n pointerout: \"mouseout\",\n pointerenter: \"mouseenter\",\n pointerleave: \"mouseleave\"\n};\nvar touchEventNames = {\n pointerdown: \"touchstart\",\n pointermove: \"touchmove\",\n pointerup: \"touchend\",\n pointercancel: \"touchcancel\"\n};\nfunction getPointerEventName(name) {\n if (supportsPointerEvents()) {\n return name;\n }\n\n if (supportsTouchEvents()) {\n return touchEventNames[name];\n }\n\n if (supportsMouseEvents()) {\n return mouseEventNames[name];\n }\n\n return name;\n}\nfunction addPointerEvent(target, eventName, handler, options) {\n return addDomEvent(target, getPointerEventName(eventName), wrapPointerEventHandler(handler, eventName === \"pointerdown\"), options);\n}\nfunction isMultiTouchEvent(event) {\n return isTouchEvent(event) && event.touches.length > 1;\n}\n\n/**\n * The event information passed to pan event handlers like `onPan`, `onPanStart`.\n *\n * It contains information about the current state of the tap gesture such as its\n * `point`, `delta`, and `offset`\n */\n\n/**\n * @internal\n *\n * A Pan Session is recognized when the pointer is down\n * and moved in the allowed direction.\n */\nvar PanSession = /*#__PURE__*/function () {\n /**\n * We use this to keep track of the `x` and `y` pan session history\n * as the pan event happens. It helps to calculate the `offset` and `delta`\n */\n // The pointer event that started the pan session\n // The current pointer event for the pan session\n // The current pointer event info for the pan session\n\n /**\n * Minimal pan distance required before recognizing the pan.\n * @default \"3px\"\n */\n function PanSession(_event, handlers, threshold) {\n var _this = this;\n\n this.history = [];\n this.startEvent = null;\n this.lastEvent = null;\n this.lastEventInfo = null;\n this.handlers = {};\n this.removeListeners = noop;\n this.threshold = 3;\n this.win = void 0;\n\n this.updatePoint = function () {\n if (!(_this.lastEvent && _this.lastEventInfo)) return;\n var info = getPanInfo(_this.lastEventInfo, _this.history);\n var isPanStarted = _this.startEvent !== null;\n\n var isDistancePastThreshold = distance(info.offset, {\n x: 0,\n y: 0\n }) >= _this.threshold;\n\n if (!isPanStarted && !isDistancePastThreshold) return;\n\n var _getFrameData = getFrameData(),\n timestamp = _getFrameData.timestamp;\n\n _this.history.push(_extends({}, info.point, {\n timestamp: timestamp\n }));\n\n var _this$handlers = _this.handlers,\n onStart = _this$handlers.onStart,\n onMove = _this$handlers.onMove;\n\n if (!isPanStarted) {\n onStart == null ? void 0 : onStart(_this.lastEvent, info);\n _this.startEvent = _this.lastEvent;\n }\n\n onMove == null ? void 0 : onMove(_this.lastEvent, info);\n };\n\n this.onPointerMove = function (event, info) {\n _this.lastEvent = event;\n _this.lastEventInfo = info; // Because Safari doesn't trigger mouseup events when it's above a `<select>`\n\n if (isMouseEvent(event) && event.buttons === 0) {\n _this.onPointerUp(event, info);\n\n return;\n } // Throttle mouse move event to once per frame\n\n\n sync.update(_this.updatePoint, true);\n };\n\n this.onPointerUp = function (event, info) {\n // notify pan session ended\n var panInfo = getPanInfo(info, _this.history);\n var _this$handlers2 = _this.handlers,\n onEnd = _this$handlers2.onEnd,\n onSessionEnd = _this$handlers2.onSessionEnd;\n onSessionEnd == null ? void 0 : onSessionEnd(event, panInfo);\n\n _this.end(); // if panning never started, no need to call `onEnd`\n // panning requires a pointermove of at least 3px\n\n\n if (!onEnd || !_this.startEvent) return;\n onEnd == null ? void 0 : onEnd(event, panInfo);\n };\n\n this.win = getEventWindow(_event); // If we have more than one touch, don't start detecting this gesture\n\n if (isMultiTouchEvent(_event)) return;\n this.handlers = handlers;\n\n if (threshold) {\n this.threshold = threshold;\n } // stop default browser behavior\n\n\n _event.stopPropagation();\n\n _event.preventDefault(); // get and save the `pointerdown` event info in history\n // we'll use it to compute the `offset`\n\n\n var _info = extractEventInfo(_event);\n\n var _getFrameData2 = getFrameData(),\n _timestamp = _getFrameData2.timestamp;\n\n this.history = [_extends({}, _info.point, {\n timestamp: _timestamp\n })]; // notify pan session start\n\n var onSessionStart = handlers.onSessionStart;\n onSessionStart == null ? void 0 : onSessionStart(_event, getPanInfo(_info, this.history)); // attach event listeners and return a single function to remove them all\n\n this.removeListeners = pipe(addPointerEvent(this.win, \"pointermove\", this.onPointerMove), addPointerEvent(this.win, \"pointerup\", this.onPointerUp), addPointerEvent(this.win, \"pointercancel\", this.onPointerUp));\n }\n\n var _proto = PanSession.prototype;\n\n _proto.updateHandlers = function updateHandlers(handlers) {\n this.handlers = handlers;\n };\n\n _proto.end = function end() {\n var _this$removeListeners;\n\n (_this$removeListeners = this.removeListeners) == null ? void 0 : _this$removeListeners.call(this);\n cancelSync.update(this.updatePoint);\n };\n\n return PanSession;\n}();\n\nfunction subtractPoint(a, b) {\n return {\n x: a.x - b.x,\n y: a.y - b.y\n };\n}\n\nfunction startPanPoint(history) {\n return history[0];\n}\n\nfunction lastPanPoint(history) {\n return history[history.length - 1];\n}\n\nfunction getPanInfo(info, history) {\n return {\n point: info.point,\n delta: subtractPoint(info.point, lastPanPoint(history)),\n offset: subtractPoint(info.point, startPanPoint(history)),\n velocity: getVelocity(history, 0.1)\n };\n}\n\nfunction lastDevicePoint(history) {\n return history[history.length - 1];\n}\n\nvar toMilliseconds = function toMilliseconds(seconds) {\n return seconds * 1000;\n};\n\nfunction getVelocity(history, timeDelta) {\n if (history.length < 2) {\n return {\n x: 0,\n y: 0\n };\n }\n\n var i = history.length - 1;\n var timestampedPoint = null;\n var lastPoint = lastDevicePoint(history);\n\n while (i >= 0) {\n timestampedPoint = history[i];\n\n if (lastPoint.timestamp - timestampedPoint.timestamp > toMilliseconds(timeDelta)) {\n break;\n }\n\n i--;\n }\n\n if (!timestampedPoint) {\n return {\n x: 0,\n y: 0\n };\n }\n\n var time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;\n\n if (time === 0) {\n return {\n x: 0,\n y: 0\n };\n }\n\n var currentVelocity = {\n x: (lastPoint.x - timestampedPoint.x) / time,\n y: (lastPoint.y - timestampedPoint.y) / time\n };\n\n if (currentVelocity.x === Infinity) {\n currentVelocity.x = 0;\n }\n\n if (currentVelocity.y === Infinity) {\n currentVelocity.y = 0;\n }\n\n return currentVelocity;\n}\n\nvar breakpoints = Object.freeze([\"base\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"]);\nfunction mapResponsive(prop, mapper) {\n if (isArray(prop)) {\n return prop.map(function (item) {\n if (item === null) {\n return null;\n }\n\n return mapper(item);\n });\n }\n\n if (isObject(prop)) {\n return objectKeys(prop).reduce(function (result, key) {\n result[key] = mapper(prop[key]);\n return result;\n }, {});\n }\n\n if (prop != null) {\n return mapper(prop);\n }\n\n return null;\n}\nfunction objectToArrayNotation(obj, bps) {\n if (bps === void 0) {\n bps = breakpoints;\n }\n\n var result = bps.map(function (br) {\n var _obj$br;\n\n return (_obj$br = obj[br]) != null ? _obj$br : null;\n });\n\n while (getLastItem(result) === null) {\n result.pop();\n }\n\n return result;\n}\nfunction arrayToObjectNotation(values, bps) {\n if (bps === void 0) {\n bps = breakpoints;\n }\n\n var result = {};\n values.forEach(function (value, index) {\n var key = bps[index];\n if (value == null) return;\n result[key] = value;\n });\n return result;\n}\nfunction isResponsiveObjectLike(obj, bps) {\n if (bps === void 0) {\n bps = breakpoints;\n }\n\n var keys = Object.keys(obj);\n return keys.length > 0 && keys.every(function (key) {\n return bps.includes(key);\n });\n}\n/**\n * since breakpoints are defined as custom properties on an array, you may\n * `Object.keys(theme.breakpoints)` to retrieve both regular numeric indices\n * and custom breakpoints as string.\n *\n * This function returns true given a custom array property.\n */\n\nvar isCustomBreakpoint = function isCustomBreakpoint(maybeBreakpoint) {\n return Number.isNaN(Number(maybeBreakpoint));\n};\n\nfunction getUserAgentBrowser(navigator) {\n var ua = navigator.userAgent,\n vendor = navigator.vendor;\n var android = /(android)/i.test(ua);\n\n switch (true) {\n case /CriOS/.test(ua):\n return \"Chrome for iOS\";\n\n case /Edg\\//.test(ua):\n return \"Edge\";\n\n case android && /Silk\\//.test(ua):\n return \"Silk\";\n\n case /Chrome/.test(ua) && /Google Inc/.test(vendor):\n return \"Chrome\";\n\n case /Firefox\\/\\d+\\.\\d+$/.test(ua):\n return \"Firefox\";\n\n case android:\n return \"AOSP\";\n\n case /MSIE|Trident/.test(ua):\n return \"IE\";\n\n case /Safari/.test(navigator.userAgent) && /Apple Computer/.test(ua):\n return \"Safari\";\n\n case /AppleWebKit/.test(ua):\n return \"WebKit\";\n\n default:\n return null;\n }\n}\n\nfunction getUserAgentOS(navigator) {\n var ua = navigator.userAgent,\n platform = navigator.platform;\n\n switch (true) {\n case /Android/.test(ua):\n return \"Android\";\n\n case /iPhone|iPad|iPod/.test(platform):\n return \"iOS\";\n\n case /Win/.test(platform):\n return \"Windows\";\n\n case /Mac/.test(platform):\n return \"Mac\";\n\n case /CrOS/.test(ua):\n return \"Chrome OS\";\n\n case /Firefox/.test(ua):\n return \"Firefox OS\";\n\n default:\n return null;\n }\n}\n\nfunction detectDeviceType(navigator) {\n var ua = navigator.userAgent;\n if (/(tablet)|(iPad)|(Nexus 9)/i.test(ua)) return \"tablet\";\n if (/(mobi)/i.test(ua)) return \"phone\";\n return \"desktop\";\n}\nfunction detectOS(os) {\n if (!isBrowser) return false;\n return getUserAgentOS(window.navigator) === os;\n}\nfunction detectBrowser(browser) {\n if (!isBrowser) return false;\n return getUserAgentBrowser(window.navigator) === browser;\n}\nfunction detectTouch() {\n if (!isBrowser) return false;\n return window.ontouchstart === null && window.ontouchmove === null && window.ontouchend === null;\n}\n\nfunction walkObject(target, predicate) {\n function inner(value, path) {\n if (path === void 0) {\n path = [];\n }\n\n if (isArray(value)) {\n return value.map(function (item, index) {\n return inner(item, [].concat(path, [String(index)]));\n });\n }\n\n if (isObject(value)) {\n return fromEntries(Object.entries(value).map(function (_ref) {\n var key = _ref[0],\n child = _ref[1];\n return [key, inner(child, [].concat(path, [key]))];\n }));\n }\n\n return predicate(value, path);\n }\n\n return inner(target);\n}\n\nexport { PanSession, __DEV__, __TEST__, addDomEvent, addItem, addPointerEvent, analyzeBreakpoints, ariaAttr, arrayToObjectNotation, breakpoints, callAll, callAllHandlers, canUseDOM, chunk, clampValue, closest, compose, contains, countDecimalPlaces, cx, dataAttr, detectBrowser, detectDeviceType, detectOS, detectTouch, determineLazyBehavior, distance, error, extractEventInfo, filterUndefined, flatten, focus, focusNextTabbable, focusPreviousTabbable, fromEntries, get, getActiveElement, getAllFocusable, getAllTabbable, getCSSVar, getEventWindow, getFirstFocusable, getFirstItem, getFirstTabbableIn, getLastItem, getLastTabbableIn, getNextIndex, getNextItem, getNextItemFromSearch, getNextTabbable, getOwnerDocument, getOwnerWindow, getPointerEventName, getPrevIndex, getPrevItem, getPreviousTabbable, getRelatedTarget, getViewportPointFromEvent, getWithDefault, hasDisplayNone, hasFocusWithin, hasNegativeTabIndex, hasTabIndex, isActiveElement, isArray, isBrowser, isContentEditable, isCssVar, isCustomBreakpoint, isDefined, isDisabled, isElement, isEmpty, isEmptyArray, isEmptyObject, isFocusable, isFunction, isHTMLElement, isHidden, isInputElement, isInputEvent, isMouseEvent, isMultiTouchEvent, isNotEmptyObject, isNotNumber, isNull, isNumber, isNumeric, isObject, isRefObject, isResponsiveObjectLike, isRightClick, isString, isTabbable, isTouchEvent, isUndefined, mapResponsive, maxSafeInteger, memoize, memoizedGet, minSafeInteger, noop, normalizeEventKey, objectFilter, objectKeys, objectToArrayNotation, omit, once, percentToValue, pick, pipe, px, removeIndex, removeItem, roundValueToStep, runIfFn, split, toPrecision, valueToPercent, walkObject, warn, wrapPointerEventHandler };\n","/**\n * Lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeMax = Math.max,\n nativeNow = Date.now;\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map'),\n nativeCreate = getNative(Object, 'create');\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq(object[key], value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n stack || (stack = new Stack);\n if (isObject(srcValue)) {\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n}\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || isFunction(objValue)) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n}\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n}\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\n/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n}\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return copyObject(value, keysIn(value));\n}\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\n/**\n * This method is like `_.merge` except that it accepts `customizer` which\n * is invoked to produce the merged values of the destination and source\n * properties. If `customizer` returns `undefined`, merging is handled by the\n * method instead. The `customizer` is invoked with six arguments:\n * (objValue, srcValue, key, object, source, stack).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} customizer The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function customizer(objValue, srcValue) {\n * if (_.isArray(objValue)) {\n * return objValue.concat(srcValue);\n * }\n * }\n *\n * var object = { 'a': [1], 'b': [2] };\n * var other = { 'a': [3], 'b': [4] };\n *\n * _.mergeWith(object, other, customizer);\n * // => { 'a': [1, 3], 'b': [2, 4] }\n */\nvar mergeWith = createAssigner(function(object, source, srcIndex, customizer) {\n baseMerge(object, source, srcIndex, customizer);\n});\n\n/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\n/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = mergeWith;\n","export * from 'css-box-model';\nexport { default as mergeWith } from 'lodash.mergewith';\nimport sync, { cancelSync, getFrameData } from 'framesync';\n\nfunction getFirstItem(array) {\n return array != null && array.length ? array[0] : undefined;\n}\nfunction getLastItem(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n}\nfunction getPrevItem(index, array, loop) {\n if (loop === void 0) {\n loop = true;\n }\n\n var prevIndex = getPrevIndex(index, array.length, loop);\n return array[prevIndex];\n}\nfunction getNextItem(index, array, loop) {\n if (loop === void 0) {\n loop = true;\n }\n\n var nextIndex = getNextIndex(index, array.length, 1, loop);\n return array[nextIndex];\n}\nfunction removeIndex(array, index) {\n return array.filter(function (_, idx) {\n return idx !== index;\n });\n}\nfunction addItem(array, item) {\n return [].concat(array, [item]);\n}\nfunction removeItem(array, item) {\n return array.filter(function (eachItem) {\n return eachItem !== item;\n });\n}\n/**\n * Get the next index based on the current index and step.\n *\n * @param currentIndex the current index\n * @param length the total length or count of items\n * @param step the number of steps\n * @param loop whether to circle back once `currentIndex` is at the start/end\n */\n\nfunction getNextIndex(currentIndex, length, step, loop) {\n if (step === void 0) {\n step = 1;\n }\n\n if (loop === void 0) {\n loop = true;\n }\n\n var lastIndex = length - 1;\n\n if (currentIndex === -1) {\n return step > 0 ? 0 : lastIndex;\n }\n\n var nextIndex = currentIndex + step;\n\n if (nextIndex < 0) {\n return loop ? lastIndex : 0;\n }\n\n if (nextIndex >= length) {\n if (loop) return 0;\n return currentIndex > length ? length : currentIndex;\n }\n\n return nextIndex;\n}\n/**\n * Get's the previous index based on the current index.\n * Mostly used for keyboard navigation.\n *\n * @param index - the current index\n * @param count - the length or total count of items in the array\n * @param loop - whether we should circle back to the\n * first/last once `currentIndex` is at the start/end\n */\n\nfunction getPrevIndex(index, count, loop) {\n if (loop === void 0) {\n loop = true;\n }\n\n return getNextIndex(index, count, -1, loop);\n}\n/**\n * Converts an array into smaller chunks or groups.\n *\n * @param array the array to chunk into group\n * @param size the length of each chunk\n */\n\nfunction chunk(array, size) {\n return array.reduce(function (rows, currentValue, index) {\n if (index % size === 0) {\n rows.push([currentValue]);\n } else {\n rows[rows.length - 1].push(currentValue);\n }\n\n return rows;\n }, []);\n}\n/**\n * Gets the next item based on a search string\n *\n * @param items array of items\n * @param searchString the search string\n * @param itemToString resolves an item to string\n * @param currentItem the current selected item\n */\n\nfunction getNextItemFromSearch(items, searchString, itemToString, currentItem) {\n if (searchString == null) {\n return currentItem;\n } // If current item doesn't exist, find the item that matches the search string\n\n\n if (!currentItem) {\n var foundItem = items.find(function (item) {\n return itemToString(item).toLowerCase().startsWith(searchString.toLowerCase());\n });\n return foundItem;\n } // Filter items for ones that match the search string (case insensitive)\n\n\n var matchingItems = items.filter(function (item) {\n return itemToString(item).toLowerCase().startsWith(searchString.toLowerCase());\n }); // If there's a match, let's get the next item to select\n\n if (matchingItems.length > 0) {\n var nextIndex; // If the currentItem is in the available items, we move to the next available option\n\n if (matchingItems.includes(currentItem)) {\n var currentIndex = matchingItems.indexOf(currentItem);\n nextIndex = currentIndex + 1;\n\n if (nextIndex === matchingItems.length) {\n nextIndex = 0;\n }\n\n return matchingItems[nextIndex];\n } // Else, we pick the first item in the available items\n\n\n nextIndex = items.indexOf(matchingItems[0]);\n return items[nextIndex];\n } // a decent fallback to the currentItem\n\n\n return currentItem;\n}\n\n// Number assertions\nfunction isNumber(value) {\n return typeof value === \"number\";\n}\nfunction isNotNumber(value) {\n return typeof value !== \"number\" || Number.isNaN(value) || !Number.isFinite(value);\n}\nfunction isNumeric(value) {\n return value != null && value - parseFloat(value) + 1 >= 0;\n} // Array assertions\n\nfunction isArray(value) {\n return Array.isArray(value);\n}\nfunction isEmptyArray(value) {\n return isArray(value) && value.length === 0;\n} // Function assertions\n\nfunction isFunction(value) {\n return typeof value === \"function\";\n} // Generic assertions\n\nfunction isDefined(value) {\n return typeof value !== \"undefined\" && value !== undefined;\n}\nfunction isUndefined(value) {\n return typeof value === \"undefined\" || value === undefined;\n} // Object assertions\n\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type === \"object\" || type === \"function\") && !isArray(value);\n}\nfunction isEmptyObject(value) {\n return isObject(value) && Object.keys(value).length === 0;\n}\nfunction isNotEmptyObject(value) {\n return value && !isEmptyObject(value);\n}\nfunction isNull(value) {\n return value == null;\n} // String assertions\n\nfunction isString(value) {\n return Object.prototype.toString.call(value) === \"[object String]\";\n}\nfunction isCssVar(value) {\n return /^var\\(--.+\\)$/.test(value);\n} // Empty assertions\n\nfunction isEmpty(value) {\n if (isArray(value)) return isEmptyArray(value);\n if (isObject(value)) return isEmptyObject(value);\n if (value == null || value === \"\") return true;\n return false;\n}\nvar __DEV__ = process.env.NODE_ENV !== \"production\";\nvar __TEST__ = process.env.NODE_ENV === \"test\";\nfunction isRefObject(val) {\n return \"current\" in val;\n}\nfunction isInputEvent(value) {\n return value && isObject(value) && isObject(value.target);\n}\n\nfunction omit(object, keys) {\n var result = {};\n Object.keys(object).forEach(function (key) {\n if (keys.includes(key)) return;\n result[key] = object[key];\n });\n return result;\n}\nfunction pick(object, keys) {\n var result = {};\n keys.forEach(function (key) {\n if (key in object) {\n result[key] = object[key];\n }\n });\n return result;\n}\nfunction split(object, keys) {\n var picked = {};\n var omitted = {};\n Object.keys(object).forEach(function (key) {\n if (keys.includes(key)) {\n picked[key] = object[key];\n } else {\n omitted[key] = object[key];\n }\n });\n return [picked, omitted];\n}\n/**\n * Get value from a deeply nested object using a string path.\n * Memoizes the value.\n * @param obj - the object\n * @param path - the string path\n * @param def - the fallback value\n */\n\nfunction get(obj, path, fallback, index) {\n var key = typeof path === \"string\" ? path.split(\".\") : [path];\n\n for (index = 0; index < key.length; index += 1) {\n if (!obj) break;\n obj = obj[key[index]];\n }\n\n return obj === undefined ? fallback : obj;\n}\nvar memoize = function memoize(fn) {\n var cache = new WeakMap();\n\n var memoizedFn = function memoizedFn(obj, path, fallback, index) {\n if (typeof obj === \"undefined\") {\n return fn(obj, path, fallback);\n }\n\n if (!cache.has(obj)) {\n cache.set(obj, new Map());\n }\n\n var map = cache.get(obj);\n\n if (map.has(path)) {\n return map.get(path);\n }\n\n var value = fn(obj, path, fallback, index);\n map.set(path, value);\n return value;\n };\n\n return memoizedFn;\n};\nvar memoizedGet = memoize(get);\n/**\n * Get value from deeply nested object, based on path\n * It returns the path value if not found in object\n *\n * @param path - the string path or value\n * @param scale - the string path or value\n */\n\nfunction getWithDefault(path, scale) {\n return memoizedGet(scale, path, path);\n}\n\n/**\n * Returns the items of an object that meet the condition specified in a callback function.\n *\n * @param object the object to loop through\n * @param fn The filter function\n */\nfunction objectFilter(object, fn) {\n var result = {};\n Object.keys(object).forEach(function (key) {\n var value = object[key];\n var shouldPass = fn(value, key, object);\n\n if (shouldPass) {\n result[key] = value;\n }\n });\n return result;\n}\nvar filterUndefined = function filterUndefined(object) {\n return objectFilter(object, function (val) {\n return val !== null && val !== undefined;\n });\n};\nvar objectKeys = function objectKeys(obj) {\n return Object.keys(obj);\n};\n/**\n * Object.entries polyfill for Nodev10 compatibility\n */\n\nvar fromEntries = function fromEntries(entries) {\n return entries.reduce(function (carry, _ref) {\n var key = _ref[0],\n value = _ref[1];\n carry[key] = value;\n return carry;\n }, {});\n};\n/**\n * Get the CSS variable ref stored in the theme\n */\n\nvar getCSSVar = function getCSSVar(theme, scale, value) {\n var _theme$__cssMap$$varR, _theme$__cssMap$;\n\n return (_theme$__cssMap$$varR = (_theme$__cssMap$ = theme.__cssMap[scale + \".\" + value]) == null ? void 0 : _theme$__cssMap$.varRef) != null ? _theme$__cssMap$$varR : value;\n};\n\nfunction analyzeCSSValue(value) {\n var num = parseFloat(value.toString());\n var unit = value.toString().replace(String(num), \"\");\n return {\n unitless: !unit,\n value: num,\n unit: unit\n };\n}\n\nfunction px(value) {\n if (value == null) return value;\n\n var _analyzeCSSValue = analyzeCSSValue(value),\n unitless = _analyzeCSSValue.unitless;\n\n return unitless || isNumber(value) ? value + \"px\" : value;\n}\n\nvar sortByBreakpointValue = function sortByBreakpointValue(a, b) {\n return parseInt(a[1], 10) > parseInt(b[1], 10) ? 1 : -1;\n};\n\nvar sortBps = function sortBps(breakpoints) {\n return fromEntries(Object.entries(breakpoints).sort(sortByBreakpointValue));\n};\n\nfunction normalize(breakpoints) {\n var sorted = sortBps(breakpoints);\n return Object.assign(Object.values(sorted), sorted);\n}\n\nfunction keys(breakpoints) {\n var value = Object.keys(sortBps(breakpoints));\n return new Set(value);\n}\n\nfunction subtract(value) {\n var _px;\n\n if (!value) return value;\n value = (_px = px(value)) != null ? _px : value;\n var factor = value.endsWith(\"px\") ? -1 : // the equivalent of 1px in em using a 16px base\n -0.0635;\n return isNumber(value) ? \"\" + (value + factor) : value.replace(/([0-9]+\\.?[0-9]*)/, function (m) {\n return \"\" + (parseFloat(m) + factor);\n });\n}\n\nfunction queryString(min, max) {\n var query = [\"@media screen\"];\n if (min) query.push(\"and\", \"(min-width: \" + px(min) + \")\");\n if (max) query.push(\"and\", \"(max-width: \" + px(max) + \")\");\n return query.join(\" \");\n}\n\nfunction analyzeBreakpoints(breakpoints) {\n var _breakpoints$base;\n\n if (!breakpoints) return null;\n breakpoints.base = (_breakpoints$base = breakpoints.base) != null ? _breakpoints$base : \"0px\";\n var normalized = normalize(breakpoints);\n var queries = Object.entries(breakpoints).sort(sortByBreakpointValue).map(function (_ref, index, entry) {\n var _entry;\n\n var breakpoint = _ref[0],\n minW = _ref[1];\n\n var _ref2 = (_entry = entry[index + 1]) != null ? _entry : [],\n maxW = _ref2[1];\n\n maxW = parseFloat(maxW) > 0 ? subtract(maxW) : undefined;\n return {\n breakpoint: breakpoint,\n minW: minW,\n maxW: maxW,\n maxWQuery: queryString(null, maxW),\n minWQuery: queryString(minW),\n minMaxQuery: queryString(minW, maxW)\n };\n });\n\n var _keys = keys(breakpoints);\n\n var _keysArr = Array.from(_keys.values());\n\n return {\n keys: _keys,\n normalized: normalized,\n isResponsive: function isResponsive(test) {\n var keys = Object.keys(test);\n return keys.length > 0 && keys.every(function (key) {\n return _keys.has(key);\n });\n },\n asObject: sortBps(breakpoints),\n asArray: normalize(breakpoints),\n details: queries,\n media: [null].concat(normalized.map(function (minW) {\n return queryString(minW);\n }).slice(1)),\n toArrayValue: function toArrayValue(test) {\n if (!isObject(test)) {\n throw new Error(\"toArrayValue: value must be an object\");\n }\n\n var result = _keysArr.map(function (bp) {\n var _test$bp;\n\n return (_test$bp = test[bp]) != null ? _test$bp : null;\n });\n\n while (getLastItem(result) === null) {\n result.pop();\n }\n\n return result;\n },\n toObjectValue: function toObjectValue(test) {\n if (!Array.isArray(test)) {\n throw new Error(\"toObjectValue: value must be an array\");\n }\n\n return test.reduce(function (acc, value, index) {\n var key = _keysArr[index];\n if (key != null && value != null) acc[key] = value;\n return acc;\n }, {});\n }\n };\n}\n\nfunction isElement(el) {\n return el != null && typeof el == \"object\" && \"nodeType\" in el && el.nodeType === Node.ELEMENT_NODE;\n}\nfunction isHTMLElement(el) {\n var _el$ownerDocument$def;\n\n if (!isElement(el)) {\n return false;\n }\n\n var win = (_el$ownerDocument$def = el.ownerDocument.defaultView) != null ? _el$ownerDocument$def : window;\n return el instanceof win.HTMLElement;\n}\nfunction getOwnerWindow(node) {\n var _getOwnerDocument$def, _getOwnerDocument;\n\n return isElement(node) ? (_getOwnerDocument$def = (_getOwnerDocument = getOwnerDocument(node)) == null ? void 0 : _getOwnerDocument.defaultView) != null ? _getOwnerDocument$def : window : window;\n}\nfunction getOwnerDocument(node) {\n var _node$ownerDocument;\n\n return isElement(node) ? (_node$ownerDocument = node.ownerDocument) != null ? _node$ownerDocument : document : document;\n}\nfunction getEventWindow(event) {\n var _view;\n\n return (_view = event.view) != null ? _view : window;\n}\nfunction canUseDOM() {\n return !!(typeof window !== \"undefined\" && window.document && window.document.createElement);\n}\nvar isBrowser = canUseDOM();\nvar dataAttr = function dataAttr(condition) {\n return condition ? \"\" : undefined;\n};\nvar ariaAttr = function ariaAttr(condition) {\n return condition ? true : undefined;\n};\nvar cx = function cx() {\n for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) {\n classNames[_key] = arguments[_key];\n }\n\n return classNames.filter(Boolean).join(\" \");\n};\nfunction getActiveElement(node) {\n var doc = getOwnerDocument(node);\n return doc == null ? void 0 : doc.activeElement;\n}\nfunction contains(parent, child) {\n if (!parent) return false;\n return parent === child || parent.contains(child);\n}\nfunction addDomEvent(target, eventName, handler, options) {\n target.addEventListener(eventName, handler, options);\n return function () {\n target.removeEventListener(eventName, handler, options);\n };\n}\n/**\n * Get the normalized event key across all browsers\n * @param event keyboard event\n */\n\nfunction normalizeEventKey(event) {\n var key = event.key,\n keyCode = event.keyCode;\n var isArrowKey = keyCode >= 37 && keyCode <= 40 && key.indexOf(\"Arrow\") !== 0;\n var eventKey = isArrowKey ? \"Arrow\" + key : key;\n return eventKey;\n}\nfunction getRelatedTarget(event) {\n var _event$target, _event$relatedTarget;\n\n var target = (_event$target = event.target) != null ? _event$target : event.currentTarget;\n var activeElement = getActiveElement(target);\n return (_event$relatedTarget = event.relatedTarget) != null ? _event$relatedTarget : activeElement;\n}\nfunction isRightClick(event) {\n return event.button !== 0;\n}\n\n// Really great work done by Diego Haz on this one\nvar hasDisplayNone = function hasDisplayNone(element) {\n return window.getComputedStyle(element).display === \"none\";\n};\nvar hasTabIndex = function hasTabIndex(element) {\n return element.hasAttribute(\"tabindex\");\n};\nvar hasNegativeTabIndex = function hasNegativeTabIndex(element) {\n return hasTabIndex(element) && element.tabIndex === -1;\n};\nfunction isDisabled(element) {\n return Boolean(element.getAttribute(\"disabled\")) === true || Boolean(element.getAttribute(\"aria-disabled\")) === true;\n}\nfunction isInputElement(element) {\n return isHTMLElement(element) && element.tagName.toLowerCase() === \"input\" && \"select\" in element;\n}\nfunction isActiveElement(element) {\n var doc = isHTMLElement(element) ? getOwnerDocument(element) : document;\n return doc.activeElement === element;\n}\nfunction hasFocusWithin(element) {\n if (!document.activeElement) return false;\n return element.contains(document.activeElement);\n}\nfunction isHidden(element) {\n if (element.parentElement && isHidden(element.parentElement)) return true;\n return element.hidden;\n}\nfunction isContentEditable(element) {\n var value = element.getAttribute(\"contenteditable\");\n return value !== \"false\" && value != null;\n}\nfunction isFocusable(element) {\n if (!isHTMLElement(element) || isHidden(element) || isDisabled(element)) {\n return false;\n }\n\n var localName = element.localName;\n var focusableTags = [\"input\", \"select\", \"textarea\", \"button\"];\n if (focusableTags.indexOf(localName) >= 0) return true;\n var others = {\n a: function a() {\n return element.hasAttribute(\"href\");\n },\n audio: function audio() {\n return element.hasAttribute(\"controls\");\n },\n video: function video() {\n return element.hasAttribute(\"controls\");\n }\n };\n\n if (localName in others) {\n return others[localName]();\n }\n\n if (isContentEditable(element)) return true;\n return hasTabIndex(element);\n}\nfunction isTabbable(element) {\n if (!element) return false;\n return isHTMLElement(element) && isFocusable(element) && !hasNegativeTabIndex(element);\n}\n\nvar focusableElList = [\"input:not([disabled])\", \"select:not([disabled])\", \"textarea:not([disabled])\", \"embed\", \"iframe\", \"object\", \"a[href]\", \"area[href]\", \"button:not([disabled])\", \"[tabindex]\", \"audio[controls]\", \"video[controls]\", \"*[tabindex]:not([aria-disabled])\", \"*[contenteditable]\"];\nvar focusableElSelector = focusableElList.join();\nfunction getAllFocusable(container) {\n var focusableEls = Array.from(container.querySelectorAll(focusableElSelector));\n focusableEls.unshift(container);\n return focusableEls.filter(isFocusable).filter(function (el) {\n return window.getComputedStyle(el).display !== \"none\";\n });\n}\nfunction getFirstFocusable(container) {\n var allFocusable = getAllFocusable(container);\n return allFocusable.length ? allFocusable[0] : null;\n}\nfunction getAllTabbable(container, fallbackToFocusable) {\n var allFocusable = Array.from(container.querySelectorAll(focusableElSelector));\n var allTabbable = allFocusable.filter(isTabbable);\n\n if (isTabbable(container)) {\n allTabbable.unshift(container);\n }\n\n if (!allTabbable.length && fallbackToFocusable) {\n return allFocusable;\n }\n\n return allTabbable;\n}\nfunction getFirstTabbableIn(container, fallbackToFocusable) {\n var _getAllTabbable = getAllTabbable(container, fallbackToFocusable),\n first = _getAllTabbable[0];\n\n return first || null;\n}\nfunction getLastTabbableIn(container, fallbackToFocusable) {\n var allTabbable = getAllTabbable(container, fallbackToFocusable);\n return allTabbable[allTabbable.length - 1] || null;\n}\nfunction getNextTabbable(container, fallbackToFocusable) {\n var allFocusable = getAllFocusable(container);\n var index = allFocusable.indexOf(document.activeElement);\n var slice = allFocusable.slice(index + 1);\n return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);\n}\nfunction getPreviousTabbable(container, fallbackToFocusable) {\n var allFocusable = getAllFocusable(container).reverse();\n var index = allFocusable.indexOf(document.activeElement);\n var slice = allFocusable.slice(index + 1);\n return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);\n}\nfunction focusNextTabbable(container, fallbackToFocusable) {\n var nextTabbable = getNextTabbable(container, fallbackToFocusable);\n\n if (nextTabbable && isHTMLElement(nextTabbable)) {\n nextTabbable.focus();\n }\n}\nfunction focusPreviousTabbable(container, fallbackToFocusable) {\n var previousTabbable = getPreviousTabbable(container, fallbackToFocusable);\n\n if (previousTabbable && isHTMLElement(previousTabbable)) {\n previousTabbable.focus();\n }\n}\n\nfunction matches(element, selectors) {\n if (\"matches\" in element) return element.matches(selectors);\n if (\"msMatchesSelector\" in element) return element.msMatchesSelector(selectors);\n return element.webkitMatchesSelector(selectors);\n}\n\nfunction closest(element, selectors) {\n if (\"closest\" in element) return element.closest(selectors);\n\n do {\n if (matches(element, selectors)) return element;\n element = element.parentElement || element.parentNode;\n } while (element !== null && element.nodeType === 1);\n\n return null;\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\n/* eslint-disable no-nested-ternary */\nfunction runIfFn(valueOrFn) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return isFunction(valueOrFn) ? valueOrFn.apply(void 0, args) : valueOrFn;\n}\nfunction callAllHandlers() {\n for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n fns[_key2] = arguments[_key2];\n }\n\n return function func(event) {\n fns.some(function (fn) {\n fn == null ? void 0 : fn(event);\n return event == null ? void 0 : event.defaultPrevented;\n });\n };\n}\nfunction callAll() {\n for (var _len3 = arguments.length, fns = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n fns[_key3] = arguments[_key3];\n }\n\n return function mergedFn(arg) {\n fns.forEach(function (fn) {\n fn == null ? void 0 : fn(arg);\n });\n };\n}\nvar compose = function compose(fn1) {\n for (var _len4 = arguments.length, fns = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n fns[_key4 - 1] = arguments[_key4];\n }\n\n return fns.reduce(function (f1, f2) {\n return function () {\n return f1(f2.apply(void 0, arguments));\n };\n }, fn1);\n};\nfunction once(fn) {\n var result;\n return function func() {\n if (fn) {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n\n result = fn.apply(this, args);\n fn = null;\n }\n\n return result;\n };\n}\nvar noop = function noop() {};\nvar warn = once(function (options) {\n return function () {\n var condition = options.condition,\n message = options.message;\n\n if (condition && __DEV__) {\n console.warn(message);\n }\n };\n});\nvar error = once(function (options) {\n return function () {\n var condition = options.condition,\n message = options.message;\n\n if (condition && __DEV__) {\n console.error(message);\n }\n };\n});\nvar pipe = function pipe() {\n for (var _len6 = arguments.length, fns = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n fns[_key6] = arguments[_key6];\n }\n\n return function (v) {\n return fns.reduce(function (a, b) {\n return b(a);\n }, v);\n };\n};\n\nvar distance1D = function distance1D(a, b) {\n return Math.abs(a - b);\n};\n\nvar isPoint = function isPoint(point) {\n return \"x\" in point && \"y\" in point;\n};\n\nfunction distance(a, b) {\n if (isNumber(a) && isNumber(b)) {\n return distance1D(a, b);\n }\n\n if (isPoint(a) && isPoint(b)) {\n var xDelta = distance1D(a.x, b.x);\n var yDelta = distance1D(a.y, b.y);\n return Math.sqrt(Math.pow(xDelta, 2) + Math.pow(yDelta, 2));\n }\n\n return 0;\n}\n\nfunction focus(element, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$isActive = _options.isActive,\n isActive = _options$isActive === void 0 ? isActiveElement : _options$isActive,\n nextTick = _options.nextTick,\n _options$preventScrol = _options.preventScroll,\n preventScroll = _options$preventScrol === void 0 ? true : _options$preventScrol,\n _options$selectTextIf = _options.selectTextIfInput,\n selectTextIfInput = _options$selectTextIf === void 0 ? true : _options$selectTextIf;\n if (!element || isActive(element)) return -1;\n\n function triggerFocus() {\n if (!element) {\n warn({\n condition: true,\n message: \"[chakra-ui]: can't call focus() on `null` or `undefined` element\"\n });\n return;\n }\n\n if (supportsPreventScroll()) {\n element.focus({\n preventScroll: preventScroll\n });\n } else {\n element.focus();\n\n if (preventScroll) {\n var scrollableElements = getScrollableElements(element);\n restoreScrollPosition(scrollableElements);\n }\n }\n\n if (isInputElement(element) && selectTextIfInput) {\n element.select();\n }\n }\n\n if (nextTick) {\n return requestAnimationFrame(triggerFocus);\n }\n\n triggerFocus();\n return -1;\n}\nvar supportsPreventScrollCached = null;\n\nfunction supportsPreventScroll() {\n if (supportsPreventScrollCached == null) {\n supportsPreventScrollCached = false;\n\n try {\n var div = document.createElement(\"div\");\n div.focus({\n get preventScroll() {\n supportsPreventScrollCached = true;\n return true;\n }\n\n });\n } catch (e) {// Ignore\n }\n }\n\n return supportsPreventScrollCached;\n}\n\nfunction getScrollableElements(element) {\n var _doc$defaultView;\n\n var doc = getOwnerDocument(element);\n var win = (_doc$defaultView = doc.defaultView) != null ? _doc$defaultView : window;\n var parent = element.parentNode;\n var scrollableElements = [];\n var rootScrollingElement = doc.scrollingElement || doc.documentElement;\n\n while (parent instanceof win.HTMLElement && parent !== rootScrollingElement) {\n if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) {\n scrollableElements.push({\n element: parent,\n scrollTop: parent.scrollTop,\n scrollLeft: parent.scrollLeft\n });\n }\n\n parent = parent.parentNode;\n }\n\n if (rootScrollingElement instanceof win.HTMLElement) {\n scrollableElements.push({\n element: rootScrollingElement,\n scrollTop: rootScrollingElement.scrollTop,\n scrollLeft: rootScrollingElement.scrollLeft\n });\n }\n\n return scrollableElements;\n}\n\nfunction restoreScrollPosition(scrollableElements) {\n for (var _iterator = _createForOfIteratorHelperLoose(scrollableElements), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n element = _step$value.element,\n scrollTop = _step$value.scrollTop,\n scrollLeft = _step$value.scrollLeft;\n element.scrollTop = scrollTop;\n element.scrollLeft = scrollLeft;\n }\n}\n\nfunction flatten(target, maxDepth) {\n if (maxDepth === void 0) {\n maxDepth = Infinity;\n }\n\n if (!isObject(target) && !Array.isArray(target) || !maxDepth) {\n return target;\n }\n\n return Object.entries(target).reduce(function (result, _ref) {\n var key = _ref[0],\n value = _ref[1];\n\n if (isObject(value) || isArray(value)) {\n Object.entries(flatten(value, maxDepth - 1)).forEach(function (_ref2) {\n var childKey = _ref2[0],\n childValue = _ref2[1];\n // e.g. gray.500\n result[key + \".\" + childKey] = childValue;\n });\n } else {\n // e.g. transparent\n result[key] = value;\n }\n\n return result;\n }, {});\n}\n\n/**\n * Determines whether the children of a disclosure widget\n * should be rendered or not, depending on the lazy behavior.\n *\n * Used in accordion, tabs, popover, menu and other disclosure\n * widgets.\n */\nfunction determineLazyBehavior(options) {\n var hasBeenSelected = options.hasBeenSelected,\n isLazy = options.isLazy,\n isSelected = options.isSelected,\n _options$lazyBehavior = options.lazyBehavior,\n lazyBehavior = _options$lazyBehavior === void 0 ? \"unmount\" : _options$lazyBehavior; // if not lazy, always render the disclosure's content\n\n if (!isLazy) return true; // if the diclosure is selected, render the disclosure's content\n\n if (isSelected) return true; // if the disclosure was selected but not active, keep its content active\n\n if (lazyBehavior === \"keepMounted\" && hasBeenSelected) return true;\n return false;\n}\n\nvar minSafeInteger = Number.MIN_SAFE_INTEGER || -9007199254740991;\nvar maxSafeInteger = Number.MAX_SAFE_INTEGER || 9007199254740991;\n\nfunction toNumber(value) {\n var num = parseFloat(value);\n return isNotNumber(num) ? 0 : num;\n}\n/**\n * Converts a value to a specific precision (or decimal points).\n *\n * Returns a string representing a number in fixed-point notation.\n *\n * @param value the value to convert\n * @param precision the precision or decimal points\n */\n\n\nfunction toPrecision(value, precision) {\n var nextValue = toNumber(value);\n var scaleFactor = Math.pow(10, precision != null ? precision : 10);\n nextValue = Math.round(nextValue * scaleFactor) / scaleFactor;\n return precision ? nextValue.toFixed(precision) : nextValue.toString();\n}\n/**\n * Counts the number of decimal places a number has\n *\n * @param value the decimal value to count\n */\n\nfunction countDecimalPlaces(value) {\n if (!Number.isFinite(value)) return 0;\n var e = 1;\n var p = 0;\n\n while (Math.round(value * e) / e !== value) {\n e *= 10;\n p += 1;\n }\n\n return p;\n}\n/**\n * Convert a value to percentage based on lower and upper bound values\n *\n * @param value the value in number\n * @param min the minimum value\n * @param max the maximum value\n */\n\nfunction valueToPercent(value, min, max) {\n return (value - min) * 100 / (max - min);\n}\n/**\n * Calculate the value based on percentage, lower and upper bound values\n *\n * @param percent the percent value in decimals (e.g 0.6, 0.3)\n * @param min the minimum value\n * @param max the maximum value\n */\n\nfunction percentToValue(percent, min, max) {\n return (max - min) * percent + min;\n}\n/**\n * Rounds a specific value to the next or previous step\n *\n * @param value the value to round\n * @param from the number that stepping started from\n * @param step the specified step\n */\n\nfunction roundValueToStep(value, from, step) {\n var nextValue = Math.round((value - from) / step) * step + from;\n var precision = countDecimalPlaces(step);\n return toPrecision(nextValue, precision);\n}\n/**\n * Clamps a value to ensure it stays within the min and max range.\n *\n * @param value the value to clamp\n * @param min the minimum value\n * @param max the maximum value\n */\n\nfunction clampValue(value, min, max) {\n if (value == null) return value;\n warn({\n condition: max < min,\n message: \"clamp: max cannot be less than min\"\n });\n return Math.min(Math.max(value, min), max);\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\n/**\n * Credit goes to `framer-motion` of this useful utilities.\n * License can be found here: https://github.com/framer/motion\n */\nfunction isMouseEvent(event) {\n var win = getEventWindow(event); // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.\n\n if (typeof win.PointerEvent !== \"undefined\" && event instanceof win.PointerEvent) {\n return !!(event.pointerType === \"mouse\");\n }\n\n return event instanceof win.MouseEvent;\n}\nfunction isTouchEvent(event) {\n var hasTouches = !!event.touches;\n return hasTouches;\n}\n\n/**\n * Filters out events not attached to the primary pointer (currently left mouse button)\n * @param eventHandler\n */\nfunction filterPrimaryPointer(eventHandler) {\n return function (event) {\n var win = getEventWindow(event);\n var isMouseEvent = event instanceof win.MouseEvent;\n var isPrimaryPointer = !isMouseEvent || isMouseEvent && event.button === 0;\n\n if (isPrimaryPointer) {\n eventHandler(event);\n }\n };\n}\n\nvar defaultPagePoint = {\n pageX: 0,\n pageY: 0\n};\n\nfunction pointFromTouch(e, pointType) {\n if (pointType === void 0) {\n pointType = \"page\";\n }\n\n var primaryTouch = e.touches[0] || e.changedTouches[0];\n var point = primaryTouch || defaultPagePoint;\n return {\n x: point[pointType + \"X\"],\n y: point[pointType + \"Y\"]\n };\n}\n\nfunction pointFromMouse(point, pointType) {\n if (pointType === void 0) {\n pointType = \"page\";\n }\n\n return {\n x: point[pointType + \"X\"],\n y: point[pointType + \"Y\"]\n };\n}\n\nfunction extractEventInfo(event, pointType) {\n if (pointType === void 0) {\n pointType = \"page\";\n }\n\n return {\n point: isTouchEvent(event) ? pointFromTouch(event, pointType) : pointFromMouse(event, pointType)\n };\n}\nfunction getViewportPointFromEvent(event) {\n return extractEventInfo(event, \"client\");\n}\nvar wrapPointerEventHandler = function wrapPointerEventHandler(handler, shouldFilterPrimaryPointer) {\n if (shouldFilterPrimaryPointer === void 0) {\n shouldFilterPrimaryPointer = false;\n }\n\n var listener = function listener(event) {\n return handler(event, extractEventInfo(event));\n };\n\n return shouldFilterPrimaryPointer ? filterPrimaryPointer(listener) : listener;\n}; // We check for event support via functions in case they've been mocked by a testing suite.\n\nvar supportsPointerEvents = function supportsPointerEvents() {\n return isBrowser && window.onpointerdown === null;\n};\n\nvar supportsTouchEvents = function supportsTouchEvents() {\n return isBrowser && window.ontouchstart === null;\n};\n\nvar supportsMouseEvents = function supportsMouseEvents() {\n return isBrowser && window.onmousedown === null;\n};\n\nvar mouseEventNames = {\n pointerdown: \"mousedown\",\n pointermove: \"mousemove\",\n pointerup: \"mouseup\",\n pointercancel: \"mousecancel\",\n pointerover: \"mouseover\",\n pointerout: \"mouseout\",\n pointerenter: \"mouseenter\",\n pointerleave: \"mouseleave\"\n};\nvar touchEventNames = {\n pointerdown: \"touchstart\",\n pointermove: \"touchmove\",\n pointerup: \"touchend\",\n pointercancel: \"touchcancel\"\n};\nfunction getPointerEventName(name) {\n if (supportsPointerEvents()) {\n return name;\n }\n\n if (supportsTouchEvents()) {\n return touchEventNames[name];\n }\n\n if (supportsMouseEvents()) {\n return mouseEventNames[name];\n }\n\n return name;\n}\nfunction addPointerEvent(target, eventName, handler, options) {\n return addDomEvent(target, getPointerEventName(eventName), wrapPointerEventHandler(handler, eventName === \"pointerdown\"), options);\n}\nfunction isMultiTouchEvent(event) {\n return isTouchEvent(event) && event.touches.length > 1;\n}\n\n/**\n * The event information passed to pan event handlers like `onPan`, `onPanStart`.\n *\n * It contains information about the current state of the tap gesture such as its\n * `point`, `delta`, and `offset`\n */\n\n/**\n * @internal\n *\n * A Pan Session is recognized when the pointer is down\n * and moved in the allowed direction.\n */\nvar PanSession = /*#__PURE__*/function () {\n /**\n * We use this to keep track of the `x` and `y` pan session history\n * as the pan event happens. It helps to calculate the `offset` and `delta`\n */\n // The pointer event that started the pan session\n // The current pointer event for the pan session\n // The current pointer event info for the pan session\n\n /**\n * Minimal pan distance required before recognizing the pan.\n * @default \"3px\"\n */\n function PanSession(_event, handlers, threshold) {\n var _this = this;\n\n this.history = [];\n this.startEvent = null;\n this.lastEvent = null;\n this.lastEventInfo = null;\n this.handlers = {};\n this.removeListeners = noop;\n this.threshold = 3;\n this.win = void 0;\n\n this.updatePoint = function () {\n if (!(_this.lastEvent && _this.lastEventInfo)) return;\n var info = getPanInfo(_this.lastEventInfo, _this.history);\n var isPanStarted = _this.startEvent !== null;\n\n var isDistancePastThreshold = distance(info.offset, {\n x: 0,\n y: 0\n }) >= _this.threshold;\n\n if (!isPanStarted && !isDistancePastThreshold) return;\n\n var _getFrameData = getFrameData(),\n timestamp = _getFrameData.timestamp;\n\n _this.history.push(_extends({}, info.point, {\n timestamp: timestamp\n }));\n\n var _this$handlers = _this.handlers,\n onStart = _this$handlers.onStart,\n onMove = _this$handlers.onMove;\n\n if (!isPanStarted) {\n onStart == null ? void 0 : onStart(_this.lastEvent, info);\n _this.startEvent = _this.lastEvent;\n }\n\n onMove == null ? void 0 : onMove(_this.lastEvent, info);\n };\n\n this.onPointerMove = function (event, info) {\n _this.lastEvent = event;\n _this.lastEventInfo = info; // Because Safari doesn't trigger mouseup events when it's above a `<select>`\n\n if (isMouseEvent(event) && event.buttons === 0) {\n _this.onPointerUp(event, info);\n\n return;\n } // Throttle mouse move event to once per frame\n\n\n sync.update(_this.updatePoint, true);\n };\n\n this.onPointerUp = function (event, info) {\n // notify pan session ended\n var panInfo = getPanInfo(info, _this.history);\n var _this$handlers2 = _this.handlers,\n onEnd = _this$handlers2.onEnd,\n onSessionEnd = _this$handlers2.onSessionEnd;\n onSessionEnd == null ? void 0 : onSessionEnd(event, panInfo);\n\n _this.end(); // if panning never started, no need to call `onEnd`\n // panning requires a pointermove of at least 3px\n\n\n if (!onEnd || !_this.startEvent) return;\n onEnd == null ? void 0 : onEnd(event, panInfo);\n };\n\n this.win = getEventWindow(_event); // If we have more than one touch, don't start detecting this gesture\n\n if (isMultiTouchEvent(_event)) return;\n this.handlers = handlers;\n\n if (threshold) {\n this.threshold = threshold;\n } // stop default browser behavior\n\n\n _event.stopPropagation();\n\n _event.preventDefault(); // get and save the `pointerdown` event info in history\n // we'll use it to compute the `offset`\n\n\n var _info = extractEventInfo(_event);\n\n var _getFrameData2 = getFrameData(),\n _timestamp = _getFrameData2.timestamp;\n\n this.history = [_extends({}, _info.point, {\n timestamp: _timestamp\n })]; // notify pan session start\n\n var onSessionStart = handlers.onSessionStart;\n onSessionStart == null ? void 0 : onSessionStart(_event, getPanInfo(_info, this.history)); // attach event listeners and return a single function to remove them all\n\n this.removeListeners = pipe(addPointerEvent(this.win, \"pointermove\", this.onPointerMove), addPointerEvent(this.win, \"pointerup\", this.onPointerUp), addPointerEvent(this.win, \"pointercancel\", this.onPointerUp));\n }\n\n var _proto = PanSession.prototype;\n\n _proto.updateHandlers = function updateHandlers(handlers) {\n this.handlers = handlers;\n };\n\n _proto.end = function end() {\n var _this$removeListeners;\n\n (_this$removeListeners = this.removeListeners) == null ? void 0 : _this$removeListeners.call(this);\n cancelSync.update(this.updatePoint);\n };\n\n return PanSession;\n}();\n\nfunction subtractPoint(a, b) {\n return {\n x: a.x - b.x,\n y: a.y - b.y\n };\n}\n\nfunction startPanPoint(history) {\n return history[0];\n}\n\nfunction lastPanPoint(history) {\n return history[history.length - 1];\n}\n\nfunction getPanInfo(info, history) {\n return {\n point: info.point,\n delta: subtractPoint(info.point, lastPanPoint(history)),\n offset: subtractPoint(info.point, startPanPoint(history)),\n velocity: getVelocity(history, 0.1)\n };\n}\n\nfunction lastDevicePoint(history) {\n return history[history.length - 1];\n}\n\nvar toMilliseconds = function toMilliseconds(seconds) {\n return seconds * 1000;\n};\n\nfunction getVelocity(history, timeDelta) {\n if (history.length < 2) {\n return {\n x: 0,\n y: 0\n };\n }\n\n var i = history.length - 1;\n var timestampedPoint = null;\n var lastPoint = lastDevicePoint(history);\n\n while (i >= 0) {\n timestampedPoint = history[i];\n\n if (lastPoint.timestamp - timestampedPoint.timestamp > toMilliseconds(timeDelta)) {\n break;\n }\n\n i--;\n }\n\n if (!timestampedPoint) {\n return {\n x: 0,\n y: 0\n };\n }\n\n var time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;\n\n if (time === 0) {\n return {\n x: 0,\n y: 0\n };\n }\n\n var currentVelocity = {\n x: (lastPoint.x - timestampedPoint.x) / time,\n y: (lastPoint.y - timestampedPoint.y) / time\n };\n\n if (currentVelocity.x === Infinity) {\n currentVelocity.x = 0;\n }\n\n if (currentVelocity.y === Infinity) {\n currentVelocity.y = 0;\n }\n\n return currentVelocity;\n}\n\nvar breakpoints = Object.freeze([\"base\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"]);\nfunction mapResponsive(prop, mapper) {\n if (isArray(prop)) {\n return prop.map(function (item) {\n if (item === null) {\n return null;\n }\n\n return mapper(item);\n });\n }\n\n if (isObject(prop)) {\n return objectKeys(prop).reduce(function (result, key) {\n result[key] = mapper(prop[key]);\n return result;\n }, {});\n }\n\n if (prop != null) {\n return mapper(prop);\n }\n\n return null;\n}\nfunction objectToArrayNotation(obj, bps) {\n if (bps === void 0) {\n bps = breakpoints;\n }\n\n var result = bps.map(function (br) {\n var _obj$br;\n\n return (_obj$br = obj[br]) != null ? _obj$br : null;\n });\n\n while (getLastItem(result) === null) {\n result.pop();\n }\n\n return result;\n}\nfunction arrayToObjectNotation(values, bps) {\n if (bps === void 0) {\n bps = breakpoints;\n }\n\n var result = {};\n values.forEach(function (value, index) {\n var key = bps[index];\n if (value == null) return;\n result[key] = value;\n });\n return result;\n}\nfunction isResponsiveObjectLike(obj, bps) {\n if (bps === void 0) {\n bps = breakpoints;\n }\n\n var keys = Object.keys(obj);\n return keys.length > 0 && keys.every(function (key) {\n return bps.includes(key);\n });\n}\n/**\n * since breakpoints are defined as custom properties on an array, you may\n * `Object.keys(theme.breakpoints)` to retrieve both regular numeric indices\n * and custom breakpoints as string.\n *\n * This function returns true given a custom array property.\n */\n\nvar isCustomBreakpoint = function isCustomBreakpoint(maybeBreakpoint) {\n return Number.isNaN(Number(maybeBreakpoint));\n};\n\nfunction getUserAgentBrowser(navigator) {\n var ua = navigator.userAgent,\n vendor = navigator.vendor;\n var android = /(android)/i.test(ua);\n\n switch (true) {\n case /CriOS/.test(ua):\n return \"Chrome for iOS\";\n\n case /Edg\\//.test(ua):\n return \"Edge\";\n\n case android && /Silk\\//.test(ua):\n return \"Silk\";\n\n case /Chrome/.test(ua) && /Google Inc/.test(vendor):\n return \"Chrome\";\n\n case /Firefox\\/\\d+\\.\\d+$/.test(ua):\n return \"Firefox\";\n\n case android:\n return \"AOSP\";\n\n case /MSIE|Trident/.test(ua):\n return \"IE\";\n\n case /Safari/.test(navigator.userAgent) && /Apple Computer/.test(ua):\n return \"Safari\";\n\n case /AppleWebKit/.test(ua):\n return \"WebKit\";\n\n default:\n return null;\n }\n}\n\nfunction getUserAgentOS(navigator) {\n var ua = navigator.userAgent,\n platform = navigator.platform;\n\n switch (true) {\n case /Android/.test(ua):\n return \"Android\";\n\n case /iPhone|iPad|iPod/.test(platform):\n return \"iOS\";\n\n case /Win/.test(platform):\n return \"Windows\";\n\n case /Mac/.test(platform):\n return \"Mac\";\n\n case /CrOS/.test(ua):\n return \"Chrome OS\";\n\n case /Firefox/.test(ua):\n return \"Firefox OS\";\n\n default:\n return null;\n }\n}\n\nfunction detectDeviceType(navigator) {\n var ua = navigator.userAgent;\n if (/(tablet)|(iPad)|(Nexus 9)/i.test(ua)) return \"tablet\";\n if (/(mobi)/i.test(ua)) return \"phone\";\n return \"desktop\";\n}\nfunction detectOS(os) {\n if (!isBrowser) return false;\n return getUserAgentOS(window.navigator) === os;\n}\nfunction detectBrowser(browser) {\n if (!isBrowser) return false;\n return getUserAgentBrowser(window.navigator) === browser;\n}\nfunction detectTouch() {\n if (!isBrowser) return false;\n return window.ontouchstart === null && window.ontouchmove === null && window.ontouchend === null;\n}\n\nfunction walkObject(target, predicate) {\n function inner(value, path) {\n if (path === void 0) {\n path = [];\n }\n\n if (isArray(value)) {\n return value.map(function (item, index) {\n return inner(item, [].concat(path, [String(index)]));\n });\n }\n\n if (isObject(value)) {\n return fromEntries(Object.entries(value).map(function (_ref) {\n var key = _ref[0],\n child = _ref[1];\n return [key, inner(child, [].concat(path, [key]))];\n }));\n }\n\n return predicate(value, path);\n }\n\n return inner(target);\n}\n\nexport { PanSession, __DEV__, __TEST__, addDomEvent, addItem, addPointerEvent, analyzeBreakpoints, ariaAttr, arrayToObjectNotation, breakpoints, callAll, callAllHandlers, canUseDOM, chunk, clampValue, closest, compose, contains, countDecimalPlaces, cx, dataAttr, detectBrowser, detectDeviceType, detectOS, detectTouch, determineLazyBehavior, distance, error, extractEventInfo, filterUndefined, flatten, focus, focusNextTabbable, focusPreviousTabbable, fromEntries, get, getActiveElement, getAllFocusable, getAllTabbable, getCSSVar, getEventWindow, getFirstFocusable, getFirstItem, getFirstTabbableIn, getLastItem, getLastTabbableIn, getNextIndex, getNextItem, getNextItemFromSearch, getNextTabbable, getOwnerDocument, getOwnerWindow, getPointerEventName, getPrevIndex, getPrevItem, getPreviousTabbable, getRelatedTarget, getViewportPointFromEvent, getWithDefault, hasDisplayNone, hasFocusWithin, hasNegativeTabIndex, hasTabIndex, isActiveElement, isArray, isBrowser, isContentEditable, isCssVar, isCustomBreakpoint, isDefined, isDisabled, isElement, isEmpty, isEmptyArray, isEmptyObject, isFocusable, isFunction, isHTMLElement, isHidden, isInputElement, isInputEvent, isMouseEvent, isMultiTouchEvent, isNotEmptyObject, isNotNumber, isNull, isNumber, isNumeric, isObject, isRefObject, isResponsiveObjectLike, isRightClick, isString, isTabbable, isTouchEvent, isUndefined, mapResponsive, maxSafeInteger, memoize, memoizedGet, minSafeInteger, noop, normalizeEventKey, objectFilter, objectKeys, objectToArrayNotation, omit, once, percentToValue, pick, pipe, px, removeIndex, removeItem, roundValueToStep, runIfFn, split, toPrecision, valueToPercent, walkObject, warn, wrapPointerEventHandler };\n","import*as e from\"react\";import{forwardRef as t,useMultiStyleConfig as s,omitThemingProps as r,StylesProvider as n,chakra as a,useStyles as i}from\"@chakra-ui/system\";import{Icon as c,CheckIcon as p}from\"@chakra-ui/icons\";import{Collapse as l}from\"@saas-ui/collapse\";import{getChildrenOfType as o,getChildOfType as m}from\"@saas-ui/react-utils\";import{cx as u,__DEV__ as d}from\"@chakra-ui/utils\";import{createContext as f}from\"@chakra-ui/react-utils\";function v(){return v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},v.apply(this,arguments)}function S(e,t){if(null==e)return{};var s,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(s=a[r])>=0||(n[s]=e[s]);return n}const[_,N]=f({name:\"StepperContext\",errorMessage:\"useStepperContext: `context` is undefined. Seems you forgot to wrap stepper components in `<Stepper />`\"});function h(t){const{step:s}=t,[r,n]=e.useState(-1),a=e.useRef([]),[,i]=e.useState(Date.now()),c=e.useCallback(e=>{const t=[...a.current];-1===t.indexOf(e)&&t.push(e),a.current=t,i(Date.now())},[a,i]),p=e=>{const t=a.current.indexOf(e);-1!==t&&n(t)};return e.useLayoutEffect(()=>{\"string\"==typeof s?p(s):\"number\"==typeof s?n(s):-1===r&&n(0)},[s]),{stepsRef:a,activeStep:a.current[r],activeIndex:r,isFirstStep:0===r,isLastStep:r===a.current.length-1,isCompleted:r>=a.current.length,setIndex:n,setStep:p,nextStep:()=>{n(r+1)},prevStep:()=>{n(r-1)},registerStep:c,unregisterStep:e=>{a.current=a.current.slice(a.current.indexOf(e),1)}}}function x(t){const{name:s,isActive:r,isCompleted:n}=t,{registerStep:a,unregisterStep:i,activeStep:c}=N();return e.useEffect(()=>{if(s)return a(s),()=>{i(s)}},[]),{isActive:s?c===s:r,isCompleted:n}}function y({label:e=\"Back\"}={}){const{isFirstStep:t,prevStep:s}=N();return{isDisabled:t,onClick:s,label:e}}function C({label:e=\"Next\",submitLabel:t=\"Submit\"}={}){const{isLastStep:s,isCompleted:r,nextStep:n}=N();return{isDisabled:r,onClick:n,label:s?t:e}}const E=[\"children\",\"orientation\"],g=[\"children\",\"orientation\",\"stepComponent\"],b=[\"children\",\"isOpen\"],k=[\"icon\",\"isActive\",\"isCompleted\",\"className\"],A=[\"title\",\"icon\",\"isActive\",\"isCompleted\"],O=[\"isActive\"],D=t((t,i)=>{const c=s(\"Stepper\",t),p=r(t),{children:l,orientation:o}=p,m=S(p,E),d=h(t),f=v({display:\"flex\",flexDirection:\"column\"},c.container);/*#__PURE__*/return e.createElement(n,{value:c},/*#__PURE__*/e.createElement(_,{value:d},/*#__PURE__*/e.createElement(a.div,v({ref:i,__css:f},m,{className:u(\"saas-stepper__container\",t.className)}),/*#__PURE__*/e.createElement(I,{orientation:o},l))))});d&&(D.displayName=\"Stepper\");const I=t=>{var s,r;const{children:n,orientation:c,stepComponent:p}=t,l=S(t,g),d=i(),{activeIndex:f}=N(),_=v({display:\"flex\",flexDirection:\"row\",alignItems:\"center\"},d.steps),h=\"vertical\"===c,x=p||L,y=o(n,x),C=y.reduce((t,s,r,n)=>(t.push(/*#__PURE__*/e.createElement(x,v({key:r},s.props,{icon:s.props.icon||r+1,isActive:f===r,isCompleted:s.props.isCompleted||f>r}))),\"vertical\"===c&&t.push(/*#__PURE__*/e.createElement(w,{isOpen:f===r},s.props.children)),r<n.length-1&&t.push(/*#__PURE__*/e.createElement(F,{key:`separator-${r}`,isActive:r<f})),t),[]),E=m(n,T),b=f>=y.length?E:h?null:null==(s=y[f])||null==(r=s.props)?void 0:r.children;/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(a.div,v({__css:_},l,{className:u(\"saas-stepper__steps\",t.className)}),C),b&&/*#__PURE__*/e.createElement(w,null,b))};d&&(I.displayName=\"StepperSteps\");const w=t=>{const{children:s,isOpen:r=!0}=t,n=S(t,b),c=i();/*#__PURE__*/return e.createElement(a.div,v({__css:c.content},n,{className:u(\"saas-stepper__content\",t.className)}),/*#__PURE__*/e.createElement(l,{in:r},s))};d&&(w.displayName=\"StepperContent\");const j=t=>{const{icon:s,isCompleted:r,className:n}=t,l=S(t,k),o=v({display:\"flex\",alignItems:\"center\",justifyContent:\"center\",borderRadius:\"full\",fontSize:\"1em\",me:2},i().icon);let m;return m=r?/*#__PURE__*/e.createElement(c,{as:p}):s,/*#__PURE__*/e.createElement(a.div,v({__css:o},l,{className:u(\"saas-stepper__icon\",n)}),m)};d&&(j.displayName=\"StepperIcon\");const L=t=>{const{title:s,icon:r,isActive:n,isCompleted:c}=t,p=S(t,A),l=x(t),o=v({display:\"flex\",alignItems:\"center\",flexDirection:\"row\"},i().step);/*#__PURE__*/return e.createElement(a.div,v({__css:o,\"data-active\":l.isActive,\"data-completed\":l.isCompleted},p,{className:u(\"saas-stepper__step\",t.className)}),/*#__PURE__*/e.createElement(j,{icon:r,isActive:n,isCompleted:c}),s&&/*#__PURE__*/e.createElement(R,null,s))};d&&(L.displayName=\"StepperStep\");const F=t=>{const{isActive:s}=t,r=S(t,O),n=v({flex:1,borderTopWidth:\"1px\",mx:2},i().separator);/*#__PURE__*/return e.createElement(a.div,v({\"data-active\":s},r,{className:u(\"saas-stepper__separator\",t.className),__css:n}))};d&&(F.displayName=\"StepperSeparator\");const R=t=>{const s=i();/*#__PURE__*/return e.createElement(a.p,v({},t,{__css:s.title,className:u(\"saas-stepper__title\",t.className)}))};d&&(R.displayName=\"StepperStepTitle\");const T=t=>{const s=i();/*#__PURE__*/return e.createElement(a.div,v({__css:s.completed},t,{className:u(\"saas-stepper__completed\",t.className)}))};d&&(T.displayName=\"StepperCompleted\");export{D as Stepper,T as StepperCompleted,w as StepperContent,j as StepperIcon,_ as StepperProvider,F as StepperSeparator,L as StepperStep,R as StepperStepTitle,I as StepperSteps,C as useNext,y as usePrev,x as useStep,h as useStepper,N as useStepperContext};\n//# sourceMappingURL=index.modern.js.map\n","import * as React from 'react'\nimport { FieldValues, SubmitHandler } from 'react-hook-form'\nimport { createContext } from '@chakra-ui/react-utils'\nimport {\n useStepper,\n useStep,\n UseStepperProps,\n UseStepperReturn,\n} from '@saas-ui/stepper'\n\nexport interface StepState {\n name: string\n schema?: any\n isActive?: boolean\n isCompleted?: boolean\n}\n\nexport interface StepFormContext extends UseStepperReturn {\n updateStep(state: StepState): void\n steps: Record<string, StepState>\n}\n\nexport const [StepFormProvider, useStepFormContext] =\n createContext<StepFormContext>({\n name: 'StepFormContext',\n errorMessage:\n 'useStepFormContext: `context` is undefined. Seems you forgot to wrap step form components in `<StepForm />`',\n })\n\nimport { FormProps } from './form'\n\nexport interface UseStepFormProps<\n TFieldValues extends FieldValues = FieldValues\n> extends UseStepperProps,\n FormProps<TFieldValues> {}\n\nexport function useStepForm<TFieldValues extends FieldValues = FieldValues>(\n props: UseStepFormProps<TFieldValues>\n) {\n const stepper = useStepper(props)\n\n const { activeStep, isLastStep, nextStep } = stepper\n\n const [steps, updateSteps] = React.useState({})\n\n const onSubmitStep: SubmitHandler<TFieldValues> = React.useCallback(\n async (data) => {\n if (isLastStep) {\n return props\n .onSubmit?.(data)\n .then(() => {\n const step = steps[activeStep]\n updateStep({\n ...step,\n isCompleted: true,\n })\n })\n .then(nextStep) // Show completed step\n }\n\n nextStep()\n },\n [activeStep, isLastStep]\n )\n\n const getFormProps = React.useCallback(\n (props) => {\n const step = steps[activeStep]\n return {\n onSubmit: onSubmitStep,\n schema: step?.schema,\n }\n },\n [steps, onSubmitStep, activeStep]\n )\n\n const updateStep = React.useCallback(\n (step) => {\n updateSteps((steps) => {\n return {\n ...steps,\n [step.name]: step,\n }\n })\n },\n [steps]\n )\n\n return {\n getFormProps,\n updateStep,\n steps,\n ...stepper,\n }\n}\n\nexport type UseStepFormReturn = ReturnType<typeof useStepForm>\n\nexport interface UseFormStepProps {\n name: string\n schema?: any\n}\n\nexport function useFormStep(props: UseFormStepProps): StepState {\n const { name, schema } = props\n const step = useStep({ name })\n\n const { steps, updateStep } = useStepFormContext()\n\n React.useEffect(() => {\n updateStep({ name, schema })\n }, [name, schema])\n\n return {\n ...step,\n ...(steps[name] || {}),\n }\n}\n","import * as React from 'react'\n\nimport { FieldValues, UseFormReturn } from 'react-hook-form'\n\nimport {\n chakra,\n HTMLChakraProps,\n useMultiStyleConfig,\n StylesProvider,\n} from '@chakra-ui/system'\n\nimport { callAllHandlers, runIfFn, cx, __DEV__ } from '@chakra-ui/utils'\n\nimport {\n StepperProvider,\n StepperSteps,\n StepperStepsProps,\n StepperStep,\n useStepperContext,\n} from '@saas-ui/stepper'\nimport { Button, ButtonProps } from '@saas-ui/button'\n\nimport { Form, FormProps, SubmitButton } from '.'\n\nimport {\n useStepForm,\n useFormStep,\n StepFormProvider,\n UseStepFormProps,\n} from './use-step-form'\n\nexport interface StepFormProps<TFieldValues extends FieldValues = FieldValues>\n extends UseStepFormProps<TFieldValues>,\n FormProps<TFieldValues> {}\n\nexport const StepForm = React.forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: StepFormProps<TFieldValues>,\n ref: React.ForwardedRef<UseFormReturn<TFieldValues>>\n ) => {\n const { children, onSubmit, ...rest } = props\n\n const stepper = useStepForm<TFieldValues>(props)\n\n const { getFormProps, ...ctx } = stepper\n\n const context = React.useMemo(() => ctx, [ctx])\n\n return (\n <StepperProvider value={context}>\n <StepFormProvider value={context}>\n <Form ref={ref} {...rest} {...getFormProps(props)}>\n {runIfFn(children, stepper)}\n </Form>\n </StepFormProvider>\n </StepperProvider>\n )\n }\n) as <TFieldValues extends FieldValues>(\n props: FormProps<TFieldValues> & {\n ref?: React.ForwardedRef<UseFormReturn<TFieldValues>>\n }\n) => React.ReactElement\n\nexport interface FormStepOptions {\n /**\n * The step name\n */\n name: string\n /**\n * Schema\n */\n schema?: any\n}\n\nexport const FormStepper: React.FC<StepperStepsProps> = (props) => {\n const styles = useMultiStyleConfig('Stepper', props)\n\n const { children } = props\n\n const elements = React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child?.type === FormStep) {\n const { isCompleted } = useFormStep(child.props) // Register this step\n return (\n <StepperStep\n name={child.props.name}\n title={child.props.title}\n isCompleted={isCompleted}\n >\n {child.props.children}\n </StepperStep>\n )\n }\n return child\n })\n\n return (\n <StylesProvider value={styles}>\n <StepperSteps mb=\"4\" {...props}>\n {elements}\n </StepperSteps>\n </StylesProvider>\n )\n}\n\nexport interface FormStepProps\n extends FormStepOptions,\n HTMLChakraProps<'div'> {}\n\nexport const FormStep: React.FC<FormStepProps> = (props) => {\n const { name, schema, children, className, ...rest } = props\n const step = useFormStep({ name, schema })\n\n const { isActive } = step\n\n return isActive ? (\n <chakra.div {...rest} className={cx('saas-form__step', className)}>\n {children}\n </chakra.div>\n ) : null\n}\n\nif (__DEV__) {\n FormStep.displayName = 'FormStep'\n}\n\nexport const PrevButton: React.FC<ButtonProps> = (props) => {\n const { isFirstStep, isCompleted, prevStep } = useStepperContext()\n\n return (\n <Button\n isDisabled={isFirstStep || isCompleted}\n label=\"Back\"\n {...props}\n className={cx('saas-form__prev-button', props.className)}\n onClick={callAllHandlers(props.onClick, prevStep)}\n />\n )\n}\n\nif (__DEV__) {\n PrevButton.displayName = 'PrevButton'\n}\n\nexport interface NextButtonProps extends ButtonProps {\n submitLabel?: string\n}\n\nexport const NextButton: React.FC<NextButtonProps> = (props) => {\n const { label = 'Next', submitLabel = 'Complete', ...rest } = props\n const { isLastStep, isCompleted } = useStepperContext()\n\n return (\n <SubmitButton\n isDisabled={isCompleted}\n label={isLastStep || isCompleted ? submitLabel : label}\n {...rest}\n className={cx('saas-form__next-button', props.className)}\n />\n )\n}\n\nif (__DEV__) {\n NextButton.displayName = 'NextButton'\n}\n"],"names":["DisplayField","_ref","name","label","props","React","FormControl","FormLabel","htmlFor","Text","fontSize","FormValue","getValues","useFormContext","inputTypes","defaultInputType","BaseField","help","variant","hideLabel","children","controlProps","formState","error","get","errors","getError","isInvalid","Box","message","FormHelperText","FormErrorMessage","Field","forwardRef","ref","type","InputComponent","getInput","withControlledInput","rules","inputProps","control","Controller","render","_ref3","field","useMergeRefs","withUncontrolledInput","register","registerFieldType","component","options","isControlled","displayName","isDisabled","isReadOnly","isRequired","inputRules","required","createField","split","map","part","charAt","toUpperCase","slice","join","InputField","Input","NumberInputField","NumberInput","PasswordInputFIeld","PasswordInput","TextareaField","Textarea","SwitchField","Switch","SelectField","Select","CheckboxField","Checkbox","RadioField","RadioInput","PinField","PinInput","NativeSelectField","NativeSelect","getType","spec","meta","_field$spec$meta","getArrayOption","test","tests","OPTIONS","_test$OPTIONS","params","getFieldsFromSchema","schema","fields","schemaFields","innerType","min","max","push","FormLayoutItem","chakra","div","FormLayout","gridProps","useTheme","components","_theme$components","_theme$components$For2","defaultProps","spacing","SimpleGrid","Children","child","isValidElement","mapNestedFields","cloneElement","ArrayFieldProvider","useArrayFieldContext","createContext","ArrayFieldRowProvider","useArrayFieldRowContext","useArrayField","defaultValue","keyName","useFieldArray","useArrayFieldRow","index","clearErrors","remove","useEffect","isFirst","isLast","length","useCallback","useArrayFieldRemoveButton","onClick","useArrayFieldAddButton","append","shouldFocus","ArrayFieldRow","columns","ArrayFieldRowContainer","ArrayFieldRowFields","ArrayFieldRemoveButton","layoutProps","flex","gridGap","mr","context","value","__css","display","flexDirection","alignItems","width","mb","IconButton","icon","MinusIcon","ArrayFieldAddButton","AddIcon","float","ArrayField","containerProps","ArrayFieldContainer","ArrayFieldRows","id","key","_ref2","fieldProps","FormLegend","styles","useStyles","as","sx","legend","ObjectField","getNestedFields","path","reach","getNestedSchema","nestedFieldProps","Fields","Form","mode","resolver","reValidateMode","shouldFocusError","shouldUnregister","shouldUseNativeValidation","criteriaMode","delayError","defaultValues","onSubmit","onError","formRef","rest","form","yupResolver","methods","useForm","handleSubmit","useImperativeHandle","FormProvider","SubmitButton","disableIfUntouched","disableIfInvalid","Button","isLoading","isSubmitting","isPrimary","isDirty","isValid","AutoForm","submitLabel","DisplayIf","isExact","condition","useWatch","disabled","exact","isFunction","HASH_UNDEFINED","MAX_SAFE_INTEGER","argsTag","funcTag","objectTag","reIsHostCtor","reIsUint","typedArrayTags","freeGlobal","global","Object","freeSelf","self","root","Function","freeExports","exports","nodeType","freeModule","module","moduleExports","freeProcess","process","nodeUtil","require","types","binding","e","nodeIsTypedArray","isTypedArray","apply","func","thisArg","args","call","uid","transform","arrayProto","Array","prototype","objectProto","coreJsData","funcToString","toString","hasOwnProperty","maskSrcKey","exec","keys","IE_PROTO","nativeObjectToString","objectCtorString","reIsNative","RegExp","replace","Buffer","undefined","Symbol","Uint8Array","getPrototype","getPrototypeOf","arg","objectCreate","create","propertyIsEnumerable","splice","symToStringTag","toStringTag","defineProperty","getNative","nativeIsBuffer","isBuffer","nativeMax","Math","nativeNow","Date","now","Map","nativeCreate","baseCreate","object","proto","isObject","result","Hash","entries","this","clear","entry","set","ListCache","MapCache","Stack","data","__data__","size","assignMergeValue","eq","baseAssignValue","assignValue","objValue","assocIndexOf","array","configurable","enumerable","writable","baseGetTag","isOwn","tag","unmasked","getRawTag","objectToString","baseIsArguments","isObjectLike","baseMerge","source","srcIndex","customizer","stack","iteratee","keysFunc","iterable","baseFor","srcValue","mergeFunc","safeGet","stacked","typedArray","arrayBuffer","newValue","isCommon","isArr","isArray","isBuff","isTyped","isArrayLike","copyArray","buffer","constructor","byteLength","byteOffset","Ctor","isPlainObject","isArguments","isNew","copyObject","keysIn","toPlainObject","isPrototype","initCloneObject","baseMergeDeep","has","pop","hash","string","getMapData","pairs","LARGE_ARRAY_SIZE","baseSetToString","identity","getValue","isMasked","toSource","baseIsNative","isIndex","setToString","count","lastCalled","stamp","remaining","arguments","shortOut","other","isLength","baseUnary","inherited","isArg","isType","skipIndexes","n","baseTimes","String","arrayLikeKeys","nativeKeysIn","isProto","baseKeysIn","assigner","mergeWith","start","otherArgs","overRest","baseRest","sources","guard","isIterateeCall","__DEV__","env","NODE_ENV","cx","_len","classNames","_key","filter","Boolean","callAllHandlers","_len2","fns","_key2","event","some","fn","defaultPrevented","freeze","StepperProvider","useStepperContext","errorMessage","useStepper","step","activeIndex","setIndex","useState","stepsRef","useRef","onUpdate","registerStep","newSteps","current","indexOf","setStep","i","useLayoutEffect","activeStep","isFirstStep","isLastStep","isCompleted","nextStep","prevStep","unregisterStep","useStep","isActive","StepFormProvider","useStepFormContext","useStepForm","stepper","steps","updateSteps","onSubmitStep","async","then","updateStep","getFormProps","useFormStep","StepForm","ctx","useMemo","valueOrFn","runIfFn","FormStepper","useMultiStyleConfig","elements","FormStep","StepperStep","title","StylesProvider","StepperSteps","className","PrevButton","NextButton"],"mappings":"6kDAgBaA,EAA4CC,QAACC,KACxDA,EADwDC,MAExDA,KAEGC,sBAEH,OACEC,gBAACC,EAAgBF,EACdD,eAAQE,gBAACE,GAAUC,QAASN,GAAOC,GAAqB,kBACzDE,gBAACI,GAAKC,SAAS,mBACbL,gBAACM,GAAUT,KAAMA,OAMZS,EAAwC,EA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BgX,SAAEA,GAAatB,EAErB,OAAOsB,eACL7c,gBAACqG,EAAOC,SAAQ+F,GAAMkS,UAAWnE,GAAG,kBAAmBmE,KACpDxd,GAED,MAGFkZ,KACFiE,GAASlb,YAAc,YAGZwb,MAAAA,GAAqCze,IAChD,MAAMuc,YAAEA,EAAFE,YAAeA,EAAfE,SAA4BA,GAAatB,kBAE/C,OACEpb,gBAACgN,KACC/J,WAAYqZ,GAAeE,EAC3B1c,MAAM,QACFC,GACJwe,UAAWnE,GAAG,yBAA0Bra,EAAMwe,WAC9C/V,QAASkS,GAAgB3a,EAAMyI,QAASkU,OAK1CzC,KACFuE,GAAWxb,YAAc,cAOdyb,MAAAA,GAAyC1e,IACpD,MAAMD,MAAEA,EAAQ,OAAVyN,YAAkBA,EAAc,YAAwBxN,EAATsM,IAAStM,OACxDwc,WAAEA,EAAFC,YAAcA,GAAgBpB,kBAEpC,OACEpb,gBAAC6M,MACC5J,WAAYuZ,EACZ1c,MAAOyc,GAAcC,EAAcjP,EAAczN,GAC7CuM,GACJkS,UAAWnE,GAAG,yBAA0Bra,EAAMwe,eAKhDtE,KACFwE,GAAWzb,YAAc"}
1
+ {"version":3,"file":"index.modern.js","sources":["../src/display-field.tsx","../src/field.tsx","../src/resolvers/yup.ts","../src/layout.tsx","../src/utils.ts","../src/use-array-field.tsx","../src/array-field.tsx","../src/object-field.tsx","../src/fields.tsx","../src/form.tsx","../src/submit-button.tsx","../src/auto-form.tsx","../src/display-if.tsx","../../saas-ui-stepper/dist/index.modern.js","../src/use-step-form.tsx","../src/step-form.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useFormContext } from 'react-hook-form'\n\nimport {\n Text,\n FormControl,\n FormControlProps,\n FormLabel,\n} from '@chakra-ui/react'\n\nimport { FieldProps } from './field'\n\nexport interface DisplayFieldProps\n extends FormControlProps,\n Omit<FieldProps, 'type' | 'label'> {}\n\nexport const DisplayField: React.FC<DisplayFieldProps> = ({\n name,\n label,\n placeholder,\n ...props\n}) => {\n return (\n <FormControl {...props}>\n {label ? <FormLabel htmlFor={name}>{label}</FormLabel> : null}\n <Text fontSize=\"md\">\n <FormValue name={name} />\n </Text>\n </FormControl>\n )\n}\n\nexport const FormValue: React.FC<{ name: string }> = ({ name }) => {\n const { getValues } = useFormContext()\n return getValues(name) || null\n}\n","import * as React from 'react'\nimport {\n useFormContext,\n FormState,\n Controller,\n get,\n RegisterOptions,\n FieldValues,\n FieldPath,\n} from 'react-hook-form'\n\nimport {\n forwardRef,\n Box,\n FormControl,\n FormControlProps,\n FormLabel,\n FormHelperText,\n FormErrorMessage,\n Input,\n Textarea,\n Checkbox,\n Switch,\n useMergeRefs,\n} from '@chakra-ui/react'\n\nimport { NumberInput } from '@saas-ui/number-input'\nimport { PasswordInput } from '@saas-ui/password-input'\nimport { RadioInput } from '@saas-ui/radio'\nimport { PinInput } from '@saas-ui/pin-input'\nimport { Select, NativeSelect } from '@saas-ui/select'\n\nexport interface Option {\n value: string\n label?: string\n [key: string]: unknown\n}\n\nexport type FieldRules = Pick<\n RegisterOptions,\n 'required' | 'min' | 'max' | 'maxLength' | 'minLength' | 'pattern'\n>\n\nexport type FieldTypes =\n | 'text'\n | 'number'\n | 'password'\n | 'textarea'\n | 'select'\n | 'native-select'\n | 'checkbox'\n | 'radio'\n | 'switch'\n | 'pin'\n | string\n\nexport interface FieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> extends Omit<FormControlProps, 'label' | 'type'> {\n /**\n * The field name\n */\n name: TName\n /**\n * The field label\n */\n label?: string\n /**\n * Hide the field label\n */\n hideLabel?: boolean\n /**\n * Field help text\n */\n help?: string\n /**\n * React hook form rules\n */\n rules?: Omit<\n RegisterOptions<TFieldValues, TName>,\n 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'\n >\n /**\n * Options used for selects and radio fields\n */\n options?: Option[]\n /**\n * The field type\n * Build-in types:\n * - text\n * - number\n * - password\n * - textarea\n * - select\n * - native-select\n * - checkbox\n * - radio\n * - switch\n * - pin\n *\n * Will default to a text field if there is no matching type.\n * @default 'text'\n */\n type?: FieldTypes\n /**\n * The input placeholder\n */\n placeholder?: string\n}\n\nconst inputTypes: Record<FieldTypes, any> = {}\n\nconst defaultInputType = 'text'\n\nconst getInput = (type: string) => {\n return inputTypes[type] || inputTypes[defaultInputType]\n}\n\nconst getError = (name: string, formState: FormState<{ [x: string]: any }>) => {\n return get(formState.errors, name)\n}\n\nconst isTouched = (\n name: string,\n formState: FormState<{ [x: string]: any }>\n) => {\n return get(formState.touchedFields, name)\n}\n\nexport const BaseField: React.FC<FieldProps> = (props) => {\n const { name, label, help, variant, hideLabel, children, ...controlProps } =\n props\n\n const { formState } = useFormContext()\n\n const error = getError(name, formState)\n\n return (\n <FormControl variant={variant} {...controlProps} isInvalid={!!error}>\n {label && !hideLabel ? (\n <FormLabel variant={variant}>{label}</FormLabel>\n ) : null}\n <Box>\n {children}\n {help && !error?.message ? (\n <FormHelperText>{help}</FormHelperText>\n ) : null}\n {error?.message && (\n <FormErrorMessage>{error?.message}</FormErrorMessage>\n )}\n </Box>\n </FormControl>\n )\n}\nexport const Field = forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: FieldProps<TFieldValues> & {\n [key: string]: unknown // Make sure attributes of custom components work. Need to change this to a global typedef at some point.\n },\n ref: React.ForwardedRef<typeof FormControl>\n ) => {\n const { type = defaultInputType } = props\n const InputComponent = getInput(type)\n\n return <InputComponent ref={ref} {...props} />\n }\n) as <TFieldValues extends FieldValues>(\n props: FieldProps<TFieldValues> & {\n [key: string]: unknown\n } & {\n ref?: React.ForwardedRef<typeof FormControl>\n }\n) => React.ReactElement\n\ninterface CreateFieldProps {\n displayName: string\n hideLabel?: boolean\n BaseField: React.FC<any>\n}\n\nconst createField = (\n InputComponent: React.FC<any>,\n { displayName, hideLabel, BaseField }: CreateFieldProps\n) => {\n const Field = forwardRef<FieldProps, typeof FormControl>((props, ref) => {\n const {\n name,\n label,\n help,\n isDisabled,\n isInvalid,\n isReadOnly,\n isRequired,\n rules,\n variant,\n ...inputProps\n } = props\n\n const inputRules = {\n required: isRequired,\n ...rules,\n }\n\n return (\n <BaseField\n name={name}\n label={label}\n help={help}\n hideLabel={hideLabel}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n variant={variant}\n >\n <InputComponent\n ref={ref}\n name={name}\n label={label}\n rules={inputRules}\n {...inputProps}\n />\n </BaseField>\n )\n })\n Field.displayName = displayName\n\n return Field\n}\n\nexport const withControlledInput = (InputComponent: any) => {\n return forwardRef<FieldProps, typeof InputComponent>(\n ({ name, rules, ...inputProps }, ref) => {\n const { control } = useFormContext()\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ field: { ref: _ref, ...field } }) => (\n <InputComponent\n {...field}\n {...inputProps}\n ref={useMergeRefs(ref, _ref)}\n />\n )}\n />\n )\n }\n )\n}\n\nexport const withUncontrolledInput = (InputComponent: any) => {\n return forwardRef<FieldProps, typeof InputComponent>(\n ({ name, rules, ...inputProps }, ref) => {\n const { register } = useFormContext()\n\n const { ref: _ref, ...field } = register(name, rules)\n\n return (\n <InputComponent\n {...field}\n {...inputProps}\n ref={useMergeRefs(ref, _ref)}\n />\n )\n }\n )\n}\n\nexport interface RegisterFieldTypeOptions {\n isControlled?: boolean\n hideLabel?: boolean\n BaseField?: React.FC<any>\n}\n\n/**\n * Register a new field type\n * @param type The name for this field in kebab-case, eg `email` or `array-field`\n * @param component The React component\n * @param options\n * @param options.isControlled Set this to true if this is a controlled field.\n * @param options.hideLabel Hide the field label, for example for checkbox or switch field.\n */\nexport const registerFieldType = (\n type: string,\n component: React.FC<any>,\n options?: RegisterFieldTypeOptions\n) => {\n let InputComponent\n if (options?.isControlled) {\n InputComponent = withControlledInput(component)\n } else {\n InputComponent = withUncontrolledInput(component)\n }\n\n const Field = createField(InputComponent, {\n displayName: `${type\n .split('-')\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join('')}Field`,\n hideLabel: options?.hideLabel,\n BaseField: options?.BaseField || BaseField,\n })\n\n inputTypes[type] = Field\n\n return Field\n}\n\n// @todo Consider not registering all fields by default to lower the package size and computations.\n// Not all types may be required in a project.\nexport const InputField = registerFieldType('text', Input)\nexport const NumberInputField = registerFieldType('number', NumberInput, {\n isControlled: true,\n})\nexport const PasswordInputFIeld = registerFieldType('password', PasswordInput)\nexport const TextareaField = registerFieldType('textarea', Textarea)\nexport const SwitchField = registerFieldType(\n 'switch',\n forwardRef(({ label, ...props }: { label?: string }, ref) => {\n return (\n <Switch ref={ref} {...props}>\n {label}\n </Switch>\n )\n }),\n {\n isControlled: true,\n hideLabel: true,\n }\n)\nexport const SelectField = registerFieldType('select', Select, {\n isControlled: true,\n})\nexport const CheckboxField = registerFieldType(\n 'checkbox',\n forwardRef(({ label, ...props }: { label?: string }, ref) => {\n return (\n <Checkbox ref={ref} {...props}>\n {label}\n </Checkbox>\n )\n }),\n {\n hideLabel: true,\n }\n)\nexport const RadioField = registerFieldType('radio', RadioInput, {\n isControlled: true,\n})\nexport const PinField = registerFieldType('pin', PinInput, {\n isControlled: true,\n})\nexport const NativeSelectField = registerFieldType(\n 'native-select',\n NativeSelect,\n { isControlled: true }\n)\n","import { SchemaOf, AnySchema, reach } from 'yup'\nexport { yupResolver } from '@hookform/resolvers/yup'\n\nimport { FieldProps } from '../field'\n\n// @TODO get proper typings for the schema fields\n\nconst getType = (field: any) => {\n if (field.spec.meta?.type) {\n return field.spec.meta.type\n }\n\n switch (field.type) {\n case 'array':\n return 'array'\n case 'object':\n return 'object'\n case 'number':\n return 'number'\n case 'date':\n return 'date'\n case 'string':\n default:\n return 'text'\n }\n}\n\ntype Options = {\n min?: number\n max?: number\n}\n\nconst getArrayOption = (field: any, name: string) => {\n for (const test of field.tests) {\n if (test.OPTIONS?.params[name]) return test.OPTIONS.params[name]\n }\n}\n\n/**\n * A helper function to render forms automatically based on a Yup schema\n *\n * @param schema The Yup schema\n * @returns {FieldProps[]}\n */\nexport const getFieldsFromSchema = (\n schema: SchemaOf<AnySchema>\n): FieldProps[] => {\n const fields = []\n\n let schemaFields: Record<string, any> = {}\n if (schema.type === 'array') {\n /* @ts-ignore this is actually valid */\n schemaFields = schema.innerType.fields\n } else {\n schemaFields = schema.fields\n }\n\n for (const name in schemaFields) {\n const field = schemaFields[name]\n\n const options: Options = {}\n if (field.type === 'array') {\n options.min = getArrayOption(field, 'min')\n options.max = getArrayOption(field, 'max')\n }\n\n fields.push({\n name,\n label: field.spec.label || name,\n type: getType(field),\n ...options,\n })\n }\n return fields\n}\n\nexport const getNestedSchema = (schema: SchemaOf<AnySchema>, path: string) => {\n return reach(schema, path)\n}\n","import * as React from 'react'\n\nimport { chakra, SimpleGrid, SimpleGridProps, useTheme } from '@chakra-ui/react'\n\nexport type FormLayoutProps = SimpleGridProps\n\ninterface FormLayoutItemProps {\n children: React.ReactNode\n}\n\nconst FormLayoutItem: React.FC<FormLayoutItemProps> = ({ children }) => {\n return <chakra.div>{children}</chakra.div>\n}\n\n/**\n * FormLayout\n *\n * Renders form items in a `SimpleGrid`\n * @see https://chakra-ui.com/docs/layout/simple-grid\n */\nexport const FormLayout = ({ children, ...props }: FormLayoutProps) => {\n const theme = useTheme()\n\n const defaultProps = theme.components?.FormLayout?.defaultProps ?? {\n spacing: 4,\n }\n\n const gridProps = {\n ...defaultProps,\n ...props,\n }\n\n return (\n <SimpleGrid {...gridProps}>\n {React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n return <FormLayoutItem>{child}</FormLayoutItem>\n }\n return child\n })}\n </SimpleGrid>\n )\n}\n","import * as React from 'react'\n\nexport const mapNestedFields = (name: string, children: React.ReactNode) => {\n return React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child.props.name) {\n return React.cloneElement(child, {\n ...child.props,\n name: `${name}.${child.props.name}`,\n })\n }\n return child\n })\n}\n","import * as React from 'react'\nimport {\n useFieldArray,\n useFormContext,\n UseFieldArrayReturn,\n} from 'react-hook-form'\n\nimport { createContext } from '@chakra-ui/react-utils'\n\nexport interface UseArrayFieldReturn extends UseFieldArrayReturn {\n /**\n * The array field name\n */\n name: string\n /**\n * The default value for new items\n */\n defaultValue: Record<string, any>\n /**\n * Min amount of items\n */\n min?: number\n /**\n * Max amount of items\n */\n max?: number\n}\n\nexport const [ArrayFieldProvider, useArrayFieldContext] =\n createContext<UseArrayFieldReturn>({\n name: 'ArrayFieldContext',\n })\n\nexport interface UseArrayFieldRowReturn {\n /**\n * Name of the array field including the index, eg 'field.0'\n */\n name: string\n /**\n * The field index\n */\n index: number\n /**\n * Remove this array item\n */\n remove: () => void\n /**\n * True if this is the first item\n */\n isFirst: boolean\n /**\n * True if this is the last item\n */\n isLast: boolean\n}\n\nexport const [ArrayFieldRowProvider, useArrayFieldRowContext] =\n createContext<UseArrayFieldRowReturn>({\n name: 'ArrayFieldRowContext',\n })\n\nexport interface ArrayFieldOptions {\n /**\n * The field name\n */\n name: string\n /**\n * Default value for new values in the array\n */\n defaultValue?: Record<string, any>\n /**\n * Default key name for rows, change this if your data uses a different 'id' field\n * @default \"id\"\n */\n keyName?: string\n min?: number\n max?: number\n}\n\nexport const useArrayField = ({\n name,\n defaultValue = {},\n keyName,\n min,\n max,\n}: ArrayFieldOptions) => {\n const { control } = useFormContext()\n const context = useFieldArray({\n control,\n name,\n keyName,\n })\n\n return {\n ...context,\n name,\n defaultValue,\n min,\n max,\n }\n}\n\nexport interface UseArrayFieldRowProps {\n index: number\n}\n\nexport const useArrayFieldRow = ({ index }: UseArrayFieldRowProps) => {\n const { clearErrors } = useFormContext()\n const { name, remove, fields } = useArrayFieldContext()\n\n React.useEffect(() => {\n // reset errors, to make sure min/max errors reset correctly\n clearErrors(name)\n }, [])\n\n return {\n index,\n isFirst: index === 0,\n isLast: index === fields.length - 1,\n name: `${name}.${index}`,\n remove: React.useCallback(() => {\n clearErrors(name)\n remove(index)\n }, [index]),\n }\n}\n\nexport const useArrayFieldRemoveButton = () => {\n const { isFirst, remove } = useArrayFieldRowContext()\n const { min, fields } = useArrayFieldContext()\n\n const isDisabled = isFirst && !!(min && fields.length <= min)\n\n return {\n onClick: () => remove(),\n isDisabled,\n }\n}\n\nexport const useArrayFieldAddButton = () => {\n const { append, defaultValue, max, fields } = useArrayFieldContext()\n\n const isDisabled = !!(max && fields.length >= max)\n\n return {\n onClick: () =>\n append(defaultValue, {\n shouldFocus: false,\n }),\n isDisabled,\n }\n}\n","import * as React from 'react'\n\nimport { chakra, ResponsiveValue } from '@chakra-ui/system'\n\nimport { AddIcon, MinusIcon } from '@chakra-ui/icons'\nimport { IconButton, ButtonProps } from '@saas-ui/button'\n\nimport { FormLayout } from './layout'\nimport { BaseField, FieldProps } from './field'\n\nimport { mapNestedFields } from './utils'\n\nimport {\n useArrayField,\n useArrayFieldRow,\n useArrayFieldContext,\n ArrayFieldProvider,\n ArrayFieldOptions,\n ArrayFieldRowProvider,\n useArrayFieldRowContext,\n useArrayFieldRemoveButton,\n useArrayFieldAddButton,\n UseArrayFieldReturn,\n} from './use-array-field'\n\ninterface ArrayField {\n id: string\n [key: string]: unknown\n}\n\ninterface ArrayFieldRowProps {\n /**\n * Amount of field columns\n */\n columns?: ResponsiveValue<number>\n /**\n * Spacing between fields\n */\n spacing?: ResponsiveValue<string | number>\n /**\n * The array index\n */\n index: number\n}\n\nexport const ArrayFieldRow: React.FC<ArrayFieldRowProps> = ({\n children,\n columns,\n spacing,\n index,\n}) => {\n return (\n <ArrayFieldRowContainer index={index}>\n <ArrayFieldRowFields columns={columns} spacing={spacing}>\n {children}\n </ArrayFieldRowFields>\n <ArrayFieldRemoveButton />\n </ArrayFieldRowContainer>\n )\n}\n\nexport interface ArrayFieldRowFieldsProps {\n /**\n * Amount of field columns\n */\n columns?: ResponsiveValue<number>\n /**\n * Spacing between fields\n */\n spacing?: ResponsiveValue<string | number>\n}\n\nexport const ArrayFieldRowFields: React.FC<ArrayFieldRowFieldsProps> = ({\n children,\n columns,\n spacing,\n ...layoutProps\n}) => {\n const { name } = useArrayFieldRowContext()\n return (\n <FormLayout\n flex=\"1\"\n columns={columns}\n gridGap={spacing}\n mr=\"2\"\n {...layoutProps}\n >\n {mapNestedFields(name, children)}\n </FormLayout>\n )\n}\n\nexport const ArrayFieldRowContainer: React.FC<ArrayFieldRowProps> = ({\n children,\n index,\n}) => {\n const context = useArrayFieldRow({ index })\n\n const styles = {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'flex-end',\n width: '100%',\n mb: 4,\n }\n\n return (\n <ArrayFieldRowProvider value={context}>\n <chakra.div __css={styles}>{children}</chakra.div>\n </ArrayFieldRowProvider>\n )\n}\n\nexport const ArrayFieldRemoveButton: React.FC<ButtonProps> = (props) => {\n return (\n <IconButton\n icon={<MinusIcon />}\n aria-label=\"Remove row\"\n {...useArrayFieldRemoveButton()}\n {...props}\n />\n )\n}\n\nexport const ArrayFieldAddButton: React.FC<ButtonProps> = (props) => {\n return (\n <IconButton\n icon={<AddIcon />}\n aria-label=\"Add row\"\n float=\"right\"\n {...useArrayFieldAddButton()}\n {...props}\n />\n )\n}\n\nexport interface ArrayFieldProps\n extends ArrayFieldOptions,\n Omit<FieldProps, 'defaultValue'> {}\n\nexport const ArrayField = React.forwardRef(\n (props: ArrayFieldProps, ref: React.ForwardedRef<UseArrayFieldReturn>) => {\n const { children, ...containerProps } = props\n\n return (\n <ArrayFieldContainer ref={ref} {...containerProps}>\n <ArrayFieldRows>\n {(fields: ArrayField[]) => (\n <>\n {fields.map(({ id }, index: number) => (\n <ArrayFieldRow key={id} index={index}>\n {children}\n </ArrayFieldRow>\n ))}\n </>\n )}\n </ArrayFieldRows>\n <ArrayFieldAddButton />\n </ArrayFieldContainer>\n )\n }\n)\n\nexport interface ArrayFieldRowsProps {\n children: (fields: ArrayField[]) => React.ReactElement | null\n}\n\nexport const ArrayFieldRows = ({\n children,\n}: ArrayFieldRowsProps): React.ReactElement | null => {\n const { fields } = useArrayFieldContext()\n return children(fields)\n}\n\nexport const ArrayFieldContainer = React.forwardRef(\n (\n {\n name,\n defaultValue,\n keyName,\n min,\n max,\n children,\n ...fieldProps\n }: ArrayFieldProps,\n ref: React.ForwardedRef<UseArrayFieldReturn>\n ) => {\n const context = useArrayField({\n name,\n defaultValue,\n keyName,\n min,\n max,\n })\n\n // This exposes the useArrayField api through the forwarded ref\n React.useImperativeHandle(ref, () => context, [ref, context])\n\n return (\n <ArrayFieldProvider value={context}>\n <BaseField name={name} {...fieldProps}>\n {children}\n </BaseField>\n </ArrayFieldProvider>\n )\n }\n)\n","import * as React from 'react'\nimport {\n FormControl,\n FormLabel,\n FormLabelProps,\n ResponsiveValue,\n useStyles,\n} from '@chakra-ui/react'\n\nimport { FormLayout } from './layout'\nimport { FieldProps } from './field'\n\nimport { mapNestedFields } from './utils'\n\nexport interface ObjectFieldProps extends FieldProps {\n name: string\n children: React.ReactNode\n columns?: ResponsiveValue<number>\n spacing?: ResponsiveValue<string | number>\n}\n\nexport const FormLegend = (props: FormLabelProps) => {\n const styles = useStyles()\n return <FormLabel as=\"legend\" sx={styles.legend} {...props} />\n}\n\nexport const ObjectField: React.FC<ObjectFieldProps> = (props) => {\n const { name, label, hideLabel, children, columns, spacing, ...fieldProps } =\n props\n\n return (\n <FormControl name={name} as=\"fieldset\" {...fieldProps}>\n <FormLegend display={hideLabel ? 'none' : 'block'}>{label}</FormLegend>\n <FormLayout columns={columns} gridGap={spacing}>\n {mapNestedFields(name, children)}\n </FormLayout>\n </FormControl>\n )\n}\n","import * as React from 'react'\nimport { getFieldsFromSchema, getNestedSchema } from './resolvers/yup'\n\nimport { FormLayout } from './layout'\nimport { Field, FieldProps } from './field'\n\nimport { ArrayField } from './array-field'\nimport { ObjectField } from './object-field'\n\nexport interface FieldsProps {\n schema: any\n}\n\nconst getNestedFields = (schema: any, name: string) => {\n return getFieldsFromSchema(getNestedSchema(schema, name)).map(\n ({ name, type, ...nestedFieldProps }: FieldProps): React.ReactNode => (\n <Field key={name} name={name} type={type} {...nestedFieldProps} />\n )\n )\n}\n\nexport const Fields: React.FC<FieldsProps> = ({ schema, ...props }) => {\n return (\n <FormLayout {...props}>\n {getFieldsFromSchema(schema).map(\n ({\n name,\n type,\n defaultValue,\n ...fieldProps\n }: FieldProps): React.ReactNode => {\n if (type === 'array') {\n return (\n <ArrayField name={name} {...fieldProps}>\n {getNestedFields(schema, name)}\n </ArrayField>\n )\n } else if (type === 'object') {\n return (\n <ObjectField name={name} {...fieldProps}>\n {getNestedFields(schema, name)}\n </ObjectField>\n )\n }\n\n return <Field key={name} name={name} type={type} {...fieldProps} />\n }\n )}\n </FormLayout>\n )\n}\n","import * as React from 'react'\n\nimport { chakra, HTMLChakraProps, forwardRef } from '@chakra-ui/react'\n\nimport {\n useForm,\n FormProvider,\n UseFormProps,\n UseFormReturn,\n FieldValues,\n SubmitHandler,\n SubmitErrorHandler,\n} from 'react-hook-form'\n\nimport { yupResolver } from './resolvers/yup'\n\nexport type { UseFormReturn }\n\ninterface FormOptions<TFieldValues extends FieldValues = FieldValues> {\n /**\n * The form schema, currently supports Yup schema only.\n */\n schema?: any\n /**\n * The submit handler.\n */\n onSubmit: SubmitHandler<TFieldValues>\n /**\n * Triggers when there are validation errors.\n */\n onError?: SubmitErrorHandler<TFieldValues>\n /**\n * Ref on the HTMLFormElement.\n */\n formRef?: React.MutableRefObject<HTMLFormElement>\n}\n\nexport interface FormProps<TFieldValues extends FieldValues = FieldValues>\n extends UseFormProps<TFieldValues>,\n Omit<HTMLChakraProps<'form'>, 'onSubmit' | 'onError'>,\n FormOptions<TFieldValues> {}\n\n/**\n * @todo Figure out how to pass down FieldValues to all Field components,\n * if at all possible.\n */\nexport const Form = forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: FormProps<TFieldValues>,\n ref: React.ForwardedRef<UseFormReturn<TFieldValues>>\n ) => {\n const {\n mode = 'all',\n resolver,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n schema,\n defaultValues,\n onSubmit,\n onError,\n formRef,\n children,\n ...rest\n } = props\n\n const form = {\n mode,\n resolver,\n defaultValues,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n }\n\n // @todo remove yup dependency and just use resolver prop?\n if (schema) {\n form.resolver = yupResolver(schema)\n }\n\n const methods = useForm<TFieldValues>(form)\n const { handleSubmit } = methods\n\n // This exposes the useForm api through the forwarded ref\n React.useImperativeHandle(ref, () => methods, [ref, methods])\n\n return (\n <FormProvider {...methods}>\n <chakra.form\n ref={formRef}\n onSubmit={handleSubmit(onSubmit, onError)}\n {...rest}\n >\n {children}\n </chakra.form>\n </FormProvider>\n )\n }\n) as <TFieldValues extends FieldValues>(\n props: FormProps<TFieldValues> & {\n ref?: React.ForwardedRef<UseFormReturn<TFieldValues>>\n }\n) => React.ReactElement\n","import * as React from 'react'\n\nimport { useFormContext } from 'react-hook-form'\n\nimport { Button, ButtonProps } from '@saas-ui/button'\n\nimport { forwardRef } from '@chakra-ui/system'\n\nexport interface SubmitButtonProps extends ButtonProps {\n /**\n * Disable the submit button if the form is untouched.\n *\n * Change the default behavior by updating\n * `SubmitButton.defaultProps.disableIfUntouched`\n */\n disableIfUntouched?: boolean\n /**\n * Disable the submit button if the form is invalid.\n *\n * Change the default behavior by updating\n * `SubmitButton.defaultProps.disableIfInvalid`\n */\n disableIfInvalid?: boolean\n}\n\nexport const SubmitButton = forwardRef<SubmitButtonProps, 'button'>(\n (props, ref) => {\n const { children, disableIfUntouched, disableIfInvalid, ...rest } = props\n const { formState } = useFormContext()\n\n const isDisabled =\n (disableIfUntouched && !formState.isDirty) ||\n (disableIfInvalid && !formState.isValid)\n\n return (\n <Button\n type=\"submit\"\n isLoading={formState.isSubmitting}\n isPrimary\n ref={ref}\n isDisabled={isDisabled}\n {...rest}\n >\n {children}\n </Button>\n )\n }\n)\n\nSubmitButton.defaultProps = {\n label: 'Submit',\n disableIfUntouched: false,\n disableIfInvalid: false,\n}\n","import * as React from 'react'\nimport { FieldValues, UseFormReturn } from 'react-hook-form'\nimport { forwardRef } from '@chakra-ui/react'\n\nimport { Form, FormProps } from './form'\n\nimport { FormLayout } from './layout'\nimport { Fields } from './fields'\nimport { SubmitButton } from './submit-button'\n\ninterface AutoFormOptions {\n schema: any\n submitLabel?: false | string\n}\n\nexport interface AutoFormProps<TFieldValues extends FieldValues>\n extends Omit<FormProps<TFieldValues>, 'schema'>,\n AutoFormOptions {}\n\nexport const AutoForm = forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: AutoFormProps<TFieldValues>,\n ref: React.ForwardedRef<UseFormReturn<TFieldValues>>\n ) => {\n const { schema, submitLabel = 'Submit', ...rest } = props\n return (\n <Form {...rest} schema={schema} ref={ref}>\n <FormLayout>\n {<Fields schema={schema} />}\n {submitLabel && <SubmitButton label={submitLabel} />}\n </FormLayout>\n </Form>\n )\n }\n) as <TFieldValues extends FieldValues>(\n props: AutoFormProps<TFieldValues> & {\n ref?: React.ForwardedRef<UseFormReturn<TFieldValues>>\n }\n) => React.ReactElement\n","import * as React from 'react'\nimport {\n useFormContext,\n useWatch,\n FieldValues,\n UseFormReturn,\n} from 'react-hook-form'\n\nexport interface DisplayIfProps<TFieldValues> {\n children: React.ReactElement\n name: string\n defaultValue?: unknown\n isDisabled?: boolean\n isExact?: boolean\n condition?: (value: unknown, context: UseFormReturn<TFieldValues>) => boolean\n}\n\nexport const DisplayIf = <TFieldValues extends FieldValues = FieldValues>({\n children,\n name,\n defaultValue,\n isDisabled,\n isExact,\n condition = (value) => !!value,\n}: DisplayIfProps<TFieldValues>) => {\n const value = useWatch({\n name,\n defaultValue,\n disabled: isDisabled,\n exact: isExact,\n })\n const context = useFormContext<TFieldValues>()\n return condition(value, context) ? children : null\n}\n","import*as e from\"react\";import{forwardRef as t,useMultiStyleConfig as s,omitThemingProps as r,StylesProvider as n,chakra as a,useStyles as i}from\"@chakra-ui/system\";import{Icon as c,CheckIcon as p}from\"@chakra-ui/icons\";import{Collapse as l}from\"@saas-ui/collapse\";import{getChildrenOfType as o,getChildOfType as m}from\"@saas-ui/react-utils\";import{cx as u,__DEV__ as d}from\"@chakra-ui/utils\";import{createContext as f}from\"@chakra-ui/react-utils\";function v(){return v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},v.apply(this,arguments)}function S(e,t){if(null==e)return{};var s,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(s=a[r])>=0||(n[s]=e[s]);return n}const[_,N]=f({name:\"StepperContext\",errorMessage:\"useStepperContext: `context` is undefined. Seems you forgot to wrap stepper components in `<Stepper />`\"});function h(t){const{step:s}=t,[r,n]=e.useState(-1),a=e.useRef([]),[,i]=e.useState(Date.now()),c=e.useCallback(e=>{const t=[...a.current];-1===t.indexOf(e)&&t.push(e),a.current=t,i(Date.now())},[a,i]),p=e=>{const t=a.current.indexOf(e);-1!==t&&n(t)};return e.useLayoutEffect(()=>{\"string\"==typeof s?p(s):\"number\"==typeof s?n(s):-1===r&&n(0)},[s]),{stepsRef:a,activeStep:a.current[r],activeIndex:r,isFirstStep:0===r,isLastStep:r===a.current.length-1,isCompleted:r>=a.current.length,setIndex:n,setStep:p,nextStep:()=>{n(r+1)},prevStep:()=>{n(r-1)},registerStep:c,unregisterStep:e=>{a.current=a.current.slice(a.current.indexOf(e),1)}}}function x(t){const{name:s,isActive:r,isCompleted:n}=t,{registerStep:a,unregisterStep:i,activeStep:c}=N();return e.useEffect(()=>{if(s)return a(s),()=>{i(s)}},[]),{isActive:s?c===s:r,isCompleted:n}}function y({label:e=\"Back\"}={}){const{isFirstStep:t,prevStep:s}=N();return{isDisabled:t,onClick:s,label:e}}function C({label:e=\"Next\",submitLabel:t=\"Submit\"}={}){const{isLastStep:s,isCompleted:r,nextStep:n}=N();return{isDisabled:r,onClick:n,label:s?t:e}}const E=[\"children\",\"orientation\"],g=[\"children\",\"orientation\",\"stepComponent\"],b=[\"children\",\"isOpen\"],k=[\"icon\",\"isActive\",\"isCompleted\",\"className\"],A=[\"title\",\"icon\",\"isActive\",\"isCompleted\"],O=[\"isActive\"],D=t((t,i)=>{const c=s(\"Stepper\",t),p=r(t),{children:l,orientation:o}=p,m=S(p,E),d=h(t),f=v({display:\"flex\",flexDirection:\"column\"},c.container);/*#__PURE__*/return e.createElement(n,{value:c},/*#__PURE__*/e.createElement(_,{value:d},/*#__PURE__*/e.createElement(a.div,v({ref:i,__css:f},m,{className:u(\"saas-stepper__container\",t.className)}),/*#__PURE__*/e.createElement(I,{orientation:o},l))))});d&&(D.displayName=\"Stepper\");const I=t=>{var s,r;const{children:n,orientation:c,stepComponent:p}=t,l=S(t,g),d=i(),{activeIndex:f}=N(),_=v({display:\"flex\",flexDirection:\"row\",alignItems:\"center\"},d.steps),h=\"vertical\"===c,x=p||L,y=o(n,x),C=y.reduce((t,s,r,n)=>(t.push(/*#__PURE__*/e.createElement(x,v({key:r},s.props,{icon:s.props.icon||r+1,isActive:f===r,isCompleted:s.props.isCompleted||f>r}))),\"vertical\"===c&&t.push(/*#__PURE__*/e.createElement(w,{isOpen:f===r},s.props.children)),r<n.length-1&&t.push(/*#__PURE__*/e.createElement(F,{key:`separator-${r}`,isActive:r<f})),t),[]),E=m(n,T),b=f>=y.length?E:h?null:/*#__PURE__*/e.createElement(w,null,null==(s=y[f])||null==(r=s.props)?void 0:r.children);/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(a.div,v({__css:_},l,{className:u(\"saas-stepper__steps\",t.className)}),C),b)};d&&(I.displayName=\"StepperSteps\");const w=t=>{const{children:s,isOpen:r=!0}=t,n=S(t,b),c=i();/*#__PURE__*/return e.createElement(a.div,v({__css:c.content},n,{className:u(\"saas-stepper__content\",t.className)}),/*#__PURE__*/e.createElement(l,{in:r},s))};d&&(w.displayName=\"StepperContent\");const j=t=>{const{icon:s,isCompleted:r,className:n}=t,l=S(t,k),o=v({display:\"flex\",alignItems:\"center\",justifyContent:\"center\",borderRadius:\"full\",fontSize:\"1em\",me:2},i().icon);let m;return m=r?/*#__PURE__*/e.createElement(c,{as:p}):s,/*#__PURE__*/e.createElement(a.div,v({__css:o},l,{className:u(\"saas-stepper__icon\",n)}),m)};d&&(j.displayName=\"StepperIcon\");const L=t=>{const{title:s,icon:r,isActive:n,isCompleted:c}=t,p=S(t,A),l=x(t),o=v({display:\"flex\",alignItems:\"center\",flexDirection:\"row\"},i().step);/*#__PURE__*/return e.createElement(a.div,v({__css:o,\"data-active\":l.isActive,\"data-completed\":l.isCompleted},p,{className:u(\"saas-stepper__step\",t.className)}),/*#__PURE__*/e.createElement(j,{icon:r,isActive:n,isCompleted:c}),s&&/*#__PURE__*/e.createElement(R,null,s))};d&&(L.displayName=\"StepperStep\");const F=t=>{const{isActive:s}=t,r=S(t,O),n=v({flex:1,borderTopWidth:\"1px\",mx:2},i().separator);/*#__PURE__*/return e.createElement(a.div,v({\"data-active\":s},r,{className:u(\"saas-stepper__separator\",t.className),__css:n}))};d&&(F.displayName=\"StepperSeparator\");const R=t=>{const s=i();/*#__PURE__*/return e.createElement(a.p,v({},t,{__css:s.title,className:u(\"saas-stepper__title\",t.className)}))};d&&(R.displayName=\"StepperStepTitle\");const T=t=>{const s=i();/*#__PURE__*/return e.createElement(a.div,v({__css:s.completed},t,{className:u(\"saas-stepper__completed\",t.className)}))};d&&(T.displayName=\"StepperCompleted\");export{D as Stepper,T as StepperCompleted,w as StepperContent,j as StepperIcon,_ as StepperProvider,F as StepperSeparator,L as StepperStep,R as StepperStepTitle,I as StepperSteps,C as useNext,y as usePrev,x as useStep,h as useStepper,N as useStepperContext};\n//# sourceMappingURL=index.modern.js.map\n","import * as React from 'react'\nimport { FieldValues, SubmitHandler } from 'react-hook-form'\nimport { createContext } from '@chakra-ui/react-utils'\nimport {\n useStepper,\n useStep,\n UseStepperProps,\n UseStepperReturn,\n} from '@saas-ui/stepper'\n\nexport interface StepState {\n name: string\n schema?: any\n isActive?: boolean\n isCompleted?: boolean\n}\n\nexport interface StepFormContext extends UseStepperReturn {\n updateStep(state: StepState): void\n steps: Record<string, StepState>\n}\n\nexport const [StepFormProvider, useStepFormContext] =\n createContext<StepFormContext>({\n name: 'StepFormContext',\n errorMessage:\n 'useStepFormContext: `context` is undefined. Seems you forgot to wrap step form components in `<StepForm />`',\n })\n\nimport { FormProps } from './form'\n\nexport interface UseStepFormProps<\n TFieldValues extends FieldValues = FieldValues\n> extends UseStepperProps,\n FormProps<TFieldValues> {}\n\nexport function useStepForm<TFieldValues extends FieldValues = FieldValues>(\n props: UseStepFormProps<TFieldValues>\n) {\n const stepper = useStepper(props)\n\n const { activeStep, isLastStep, nextStep } = stepper\n\n const [steps, updateSteps] = React.useState({})\n\n const onSubmitStep: SubmitHandler<TFieldValues> = React.useCallback(\n async (data) => {\n if (isLastStep) {\n return props\n .onSubmit?.(data)\n .then(() => {\n const step = steps[activeStep]\n updateStep({\n ...step,\n isCompleted: true,\n })\n })\n .then(nextStep) // Show completed step\n }\n\n nextStep()\n },\n [activeStep, isLastStep]\n )\n\n const getFormProps = React.useCallback(\n (props) => {\n const step = steps[activeStep]\n return {\n onSubmit: onSubmitStep,\n schema: step?.schema,\n }\n },\n [steps, onSubmitStep, activeStep]\n )\n\n const updateStep = React.useCallback(\n (step) => {\n updateSteps((steps) => {\n return {\n ...steps,\n [step.name]: step,\n }\n })\n },\n [steps]\n )\n\n return {\n getFormProps,\n updateStep,\n steps,\n ...stepper,\n }\n}\n\nexport type UseStepFormReturn = ReturnType<typeof useStepForm>\n\nexport interface UseFormStepProps {\n name: string\n schema?: any\n}\n\nexport function useFormStep(props: UseFormStepProps): StepState {\n const { name, schema } = props\n const step = useStep({ name })\n\n const { steps, updateStep } = useStepFormContext()\n\n React.useEffect(() => {\n updateStep({ name, schema })\n }, [name, schema])\n\n return {\n ...step,\n ...(steps[name] || { name, schema }),\n }\n}\n","import * as React from 'react'\n\nimport { FieldValues, UseFormReturn } from 'react-hook-form'\n\nimport {\n chakra,\n HTMLChakraProps,\n useMultiStyleConfig,\n StylesProvider,\n} from '@chakra-ui/system'\n\nimport { callAllHandlers, runIfFn, cx, __DEV__ } from '@chakra-ui/utils'\n\nimport {\n StepperProvider,\n StepperSteps,\n StepperStepsProps,\n StepperStep,\n useStepperContext,\n} from '@saas-ui/stepper'\nimport { Button, ButtonProps } from '@saas-ui/button'\n\nimport { Form, FormProps } from './form'\nimport { SubmitButton } from './submit-button'\n\nimport {\n useStepForm,\n useFormStep,\n StepFormProvider,\n UseStepFormProps,\n} from './use-step-form'\n\nexport interface StepFormProps<TFieldValues extends FieldValues = FieldValues>\n extends UseStepFormProps<TFieldValues>,\n FormProps<TFieldValues> {}\n\nexport const StepForm = React.forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: StepFormProps<TFieldValues>,\n ref: React.ForwardedRef<UseFormReturn<TFieldValues>>\n ) => {\n const { children, onSubmit, ...rest } = props\n\n const stepper = useStepForm<TFieldValues>(props)\n\n const { getFormProps, ...ctx } = stepper\n\n const context = React.useMemo(() => ctx, [ctx])\n\n return (\n <StepperProvider value={context}>\n <StepFormProvider value={context}>\n <Form ref={ref} {...rest} {...getFormProps(props)}>\n {runIfFn(children, stepper)}\n </Form>\n </StepFormProvider>\n </StepperProvider>\n )\n }\n) as <TFieldValues extends FieldValues>(\n props: FormProps<TFieldValues> & {\n ref?: React.ForwardedRef<UseFormReturn<TFieldValues>>\n }\n) => React.ReactElement\n\nexport interface FormStepOptions {\n /**\n * The step name\n */\n name: string\n /**\n * Schema\n */\n schema?: any\n}\n\nexport const FormStepper: React.FC<StepperStepsProps> = (props) => {\n const styles = useMultiStyleConfig('Stepper', props)\n\n const { children } = props\n\n const elements = React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child?.type === FormStep) {\n const { isCompleted } = useFormStep(child.props) // Register this step\n return (\n <StepperStep\n name={child.props.name}\n title={child.props.title}\n isCompleted={isCompleted}\n >\n {child.props.children}\n </StepperStep>\n )\n }\n return child\n })\n\n return (\n <StylesProvider value={styles}>\n <StepperSteps mb=\"4\" {...props}>\n {elements}\n </StepperSteps>\n </StylesProvider>\n )\n}\n\nexport interface FormStepProps\n extends FormStepOptions,\n HTMLChakraProps<'div'> {}\n\nexport const FormStep: React.FC<FormStepProps> = (props) => {\n const { name, schema, children, className, ...rest } = props\n const step = useFormStep({ name, schema })\n\n const { isActive } = step\n\n return isActive ? (\n <chakra.div {...rest} className={cx('saas-form__step', className)}>\n {children}\n </chakra.div>\n ) : null\n}\n\nif (__DEV__) {\n FormStep.displayName = 'FormStep'\n}\n\nexport const PrevButton: React.FC<ButtonProps> = (props) => {\n const { isFirstStep, isCompleted, prevStep } = useStepperContext()\n\n return (\n <Button\n isDisabled={isFirstStep || isCompleted}\n label=\"Back\"\n {...props}\n className={cx('saas-form__prev-button', props.className)}\n onClick={callAllHandlers(props.onClick, prevStep)}\n />\n )\n}\n\nif (__DEV__) {\n PrevButton.displayName = 'PrevButton'\n}\n\nexport interface NextButtonProps extends ButtonProps {\n submitLabel?: string\n}\n\nexport const NextButton: React.FC<NextButtonProps> = (props) => {\n const { label = 'Next', submitLabel = 'Complete', ...rest } = props\n const { isLastStep, isCompleted } = useStepperContext()\n\n return (\n <SubmitButton\n isDisabled={isCompleted}\n label={isLastStep || isCompleted ? submitLabel : label}\n {...rest}\n className={cx('saas-form__next-button', props.className)}\n />\n )\n}\n\nif (__DEV__) {\n NextButton.displayName = 'NextButton'\n}\n"],"names":["DisplayField","_ref","name","label","props","React","FormControl","FormLabel","htmlFor","Text","fontSize","FormValue","getValues","useFormContext","inputTypes","defaultInputType","BaseField","help","variant","hideLabel","children","controlProps","formState","error","get","errors","getError","isInvalid","Box","message","FormHelperText","FormErrorMessage","Field","forwardRef","ref","type","InputComponent","getInput","withControlledInput","rules","inputProps","control","Controller","render","_ref3","field","useMergeRefs","withUncontrolledInput","register","registerFieldType","component","options","isControlled","displayName","isDisabled","isReadOnly","isRequired","inputRules","required","createField","split","map","part","charAt","toUpperCase","slice","join","InputField","Input","NumberInputField","NumberInput","PasswordInputFIeld","PasswordInput","TextareaField","Textarea","SwitchField","Switch","SelectField","Select","CheckboxField","Checkbox","RadioField","RadioInput","PinField","PinInput","NativeSelectField","NativeSelect","getType","spec","meta","_field$spec$meta","getArrayOption","test","tests","OPTIONS","_test$OPTIONS","params","getFieldsFromSchema","schema","fields","schemaFields","innerType","min","max","push","FormLayoutItem","chakra","div","FormLayout","gridProps","useTheme","components","_theme$components","_theme$components$For2","defaultProps","spacing","SimpleGrid","Children","child","isValidElement","mapNestedFields","cloneElement","ArrayFieldProvider","useArrayFieldContext","createContext","ArrayFieldRowProvider","useArrayFieldRowContext","useArrayField","defaultValue","keyName","useFieldArray","useArrayFieldRow","index","clearErrors","remove","useEffect","isFirst","isLast","length","useCallback","useArrayFieldRemoveButton","onClick","useArrayFieldAddButton","append","shouldFocus","ArrayFieldRow","columns","ArrayFieldRowContainer","ArrayFieldRowFields","ArrayFieldRemoveButton","layoutProps","flex","gridGap","mr","context","value","__css","display","flexDirection","alignItems","width","mb","IconButton","icon","MinusIcon","ArrayFieldAddButton","AddIcon","float","ArrayField","containerProps","ArrayFieldContainer","ArrayFieldRows","id","key","fieldProps","useImperativeHandle","FormLegend","styles","useStyles","as","sx","legend","ObjectField","getNestedFields","path","reach","getNestedSchema","nestedFieldProps","Fields","_ref2","Form","mode","resolver","reValidateMode","shouldFocusError","shouldUnregister","shouldUseNativeValidation","criteriaMode","delayError","defaultValues","onSubmit","onError","formRef","rest","form","yupResolver","methods","useForm","handleSubmit","FormProvider","SubmitButton","disableIfUntouched","disableIfInvalid","Button","isLoading","isSubmitting","isPrimary","isDirty","isValid","AutoForm","submitLabel","DisplayIf","isExact","condition","useWatch","disabled","exact","StepperProvider","useStepperContext","errorMessage","useStepper","step","activeIndex","setIndex","useState","stepsRef","useRef","onUpdate","Date","now","registerStep","newSteps","current","indexOf","setStep","i","useLayoutEffect","activeStep","isFirstStep","isLastStep","isCompleted","nextStep","prevStep","unregisterStep","useStep","isActive","StepFormProvider","useStepFormContext","useStepForm","stepper","steps","updateSteps","onSubmitStep","async","data","then","updateStep","getFormProps","useFormStep","StepForm","ctx","useMemo","runIfFn","FormStepper","useMultiStyleConfig","elements","FormStep","StepperStep","title","StylesProvider","StepperSteps","className","cx","__DEV__","PrevButton","callAllHandlers","NextButton"],"mappings":"mqDAgBaA,GAA4CC,QAACC,KACxDA,EADwDC,MAExDA,KAEGC,uBAEH,OACEC,gBAACC,EAAgBF,EACdD,eAAQE,gBAACE,GAAUC,QAASN,GAAOC,GAAqB,kBACzDE,gBAACI,GAAKC,SAAS,mBACbL,gBAACM,IAAUT,KAAMA,OAMZS,GAAwC,EAAGT,KAAAA,MACtD,MAAMU,UAAEA,GAAcC,IACtB,OAAOD,EAAUV,IAAS,0PC6EtBY,GAAsC,GAEtCC,GAAmB,OAiBZC,GAAmCZ,IAC9C,MAAMF,KAAEA,EAAFC,MAAQA,EAARc,KAAeA,EAAfC,QAAqBA,EAArBC,UAA8BA,EAA9BC,SAAyCA,GAC7ChB,EAD0DiB,IAC1DjB,OAEIkB,UAAEA,GAAcT,IAEhBU,EAjBS,EAACrB,EAAcoB,IACvBE,EAAIF,EAAUG,OAAQvB,GAgBfwB,CAASxB,EAAMoB,gBAE7B,OACEjB,gBAACC,KAAYY,QAASA,GAAaG,GAAcM,YAAaJ,IAC3DpB,IAAUgB,eACTd,gBAACE,GAAUW,QAASA,GAAUf,GAC5B,kBACJE,gBAACuB,OACER,GACAH,SAASM,GAAAA,EAAOM,QAEb,kBADFxB,gBAACyB,OAAgBb,UAElBM,SAAAA,EAAOM,uBACNxB,gBAAC0B,aAAkBR,SAAAA,EAAOM,YAMvBG,GAAQC,EACnB,CACE7B,EAGA8B,KAEA,MAAMC,KAAEA,EAAOpB,IAAqBX,EAC9BgC,EAhDQD,CAAAA,GACTrB,GAAWqB,IAASrB,GAAWC,IA+CbsB,CAASF,g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