id
stringlengths 1
6
| tokens
sequence | labels
sequence |
---|---|---|
700 | [
"import",
"React",
"from",
"'react'",
";",
"import",
"{",
"MultiContentProvider",
"}",
"from",
"'./multi_content_context'",
";",
"import",
"{",
"HookProps",
"}",
"from",
"'./use_multi_content'",
";",
"param",
"Component",
"export",
"function",
"WithMultiContent",
"<",
"P",
"extends",
"object",
"=",
"{",
"[",
"key",
"]",
":",
"any",
";",
"}",
">",
"(",
"Component",
")",
"{",
"return",
"function",
"<",
"T",
"extends",
"object",
"=",
"{",
"[",
"key",
"]",
":",
"any",
";",
"}",
">",
"(",
"props",
")",
"{",
"const",
"{",
"defaultValue",
",",
"onChange",
",",
"...",
"rest",
"}",
"=",
"props",
";",
"return",
"(",
"<",
"MultiContentProvider",
"<",
"T",
">",
"defaultValue",
"=",
"{",
"defaultValue",
"}",
"onChange",
"=",
"{",
"onChange",
"}",
">",
"<",
"Component",
"{",
"...",
"(",
"rest",
"as",
"P",
")",
"}",
"/",
">",
"<",
"/MultiContentProvider>);",
"}",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
97,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
701 | [
"import",
"React",
"from",
"'react'",
";",
"import",
"{",
"EuiStepsHorizontal",
",",
"EuiSpacer",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"{",
"FormWizardProvider",
",",
"FormWizardConsumer",
",",
"Props",
"as",
"ProviderProps",
",",
"}",
"from",
"'./form_wizard_context'",
";",
"import",
"{",
"FormWizardNav",
",",
"NavTexts",
"}",
"from",
"'./form_wizard_nav'",
";",
"interface",
"Props",
"<",
"T",
"extends",
"object",
",",
"S",
"extends",
"string",
">",
"extends",
"ProviderProps",
"<",
"T",
">",
"{",
"isSaving",
"?",
":",
"boolean",
";",
"apiError",
":",
"JSX",
".",
"Element",
"|",
"null",
";",
"texts",
"?",
":",
"Partial",
"<",
"NavTexts",
">",
";",
"rightContentNav",
"?",
":",
"JSX",
".",
"Element",
"|",
"null",
"|",
"(",
"(",
"stepId",
":",
"S",
")",
"=>",
"JSX",
".",
"Element",
"|",
"null",
")",
";",
"}",
"export",
"function",
"FormWizard",
"<",
"T",
"extends",
"object",
"=",
"{",
"[",
"key",
"]",
":",
"any",
";",
"}",
",",
"S",
"extends",
"string",
"=",
"any",
">",
"(",
"{",
"texts",
",",
"defaultActiveStep",
",",
"defaultValue",
",",
"apiError",
",",
"isEditing",
",",
"isSaving",
",",
"onSave",
",",
"onChange",
",",
"children",
",",
"rightContentNav",
",",
"}",
")",
"{",
"return",
"(",
"<",
"FormWizardProvider",
"<",
"T",
">",
"defaultValue",
"=",
"{",
"defaultValue",
"}",
"isEditing",
"=",
"{",
"isEditing",
"}",
"onSave",
"=",
"{",
"onSave",
"}",
"onChange",
"=",
"{",
"onChange",
"}",
"defaultActiveStep",
"=",
"{",
"defaultActiveStep",
"}",
">",
"<",
"FormWizardConsumer",
">",
"{",
"(",
"{",
"activeStepIndex",
",",
"lastStep",
",",
"steps",
",",
"isCurrentStepValid",
",",
"navigateToStep",
",",
"activeStepId",
",",
"}",
")",
"=>",
"{",
"const",
"stepsRequiredArray",
"=",
"Object",
".",
"values",
"(",
"steps",
")",
".",
"map",
"(",
"(",
"step",
")",
"=>",
"Boolean",
"(",
"step",
".",
"isRequired",
")",
"&&",
"step",
".",
"isComplete",
"===",
"false",
")",
";",
"const",
"getIsStepDisabled",
"=",
"(",
"stepIndex",
")",
"=>",
"{",
"if",
"(",
"stepIndex",
"!==",
"activeStepIndex",
"&&",
"isCurrentStepValid",
"===",
"false",
")",
"{",
"return",
"true",
";",
"}",
"let",
"isDisabled",
"=",
"false",
";",
"if",
"(",
"stepIndex",
">",
"activeStepIndex",
"+",
"1",
")",
"{",
"/**\n * Rule explained:\n * - all the previous steps are always enabled (we can go back anytime)\n * - the next step is also always enabled (it acts as the \"Next\" button)\n * - for the rest, the step is disabled if any of the previous step (_greater_ than the current\n * active step), is marked as isRequired **AND** has not been completed.\n */",
"isDisabled",
"=",
"stepsRequiredArray",
".",
"reduce",
"(",
"(",
"acc",
",",
"isRequired",
",",
"i",
")",
"=>",
"{",
"if",
"(",
"acc",
"===",
"true",
"||",
"i",
"<=",
"activeStepIndex",
"||",
"i",
">=",
"stepIndex",
")",
"{",
"return",
"acc",
";",
"}",
"return",
"Boolean",
"(",
"isRequired",
")",
";",
"}",
",",
"false",
")",
";",
"}",
"return",
"isDisabled",
";",
"}",
";",
"const",
"euiSteps",
"=",
"Object",
".",
"values",
"(",
"steps",
")",
".",
"map",
"(",
"(",
"{",
"index",
",",
"label",
"}",
")",
"=>",
"{",
"return",
"{",
"title",
":",
"label",
",",
"isComplete",
":",
"activeStepIndex",
">",
"index",
",",
"isSelected",
":",
"activeStepIndex",
"===",
"index",
",",
"disabled",
":",
"getIsStepDisabled",
"(",
"index",
")",
",",
"onClick",
":",
"(",
")",
"=>",
"navigateToStep",
"(",
"index",
")",
",",
"}",
";",
"}",
")",
";",
"const",
"getRightContentNav",
"=",
"(",
")",
"=>",
"{",
"if",
"(",
"typeof",
"rightContentNav",
"===",
"'function'",
")",
"{",
"return",
"rightContentNav",
"(",
"activeStepId",
")",
";",
"}",
"return",
"rightContentNav",
";",
"}",
";",
"const",
"onBack",
"=",
"(",
")",
"=>",
"{",
"const",
"prevStep",
"=",
"activeStepIndex",
"-",
"1",
";",
"navigateToStep",
"(",
"prevStep",
")",
";",
"}",
";",
"const",
"onNext",
"=",
"(",
")",
"=>",
"{",
"const",
"nextStep",
"=",
"activeStepIndex",
"+",
"1",
";",
"navigateToStep",
"(",
"nextStep",
")",
";",
"}",
";",
"return",
"(",
"<",
">",
"{",
"}",
"<",
"EuiStepsHorizontal",
"steps",
"=",
"{",
"euiSteps",
"}",
"/",
">",
"<",
"EuiSpacer",
"size",
"=",
"\"l\"",
"/",
">",
"{",
"}",
"{",
"apiError",
"}",
"{",
"}",
"{",
"children",
"}",
"<",
"EuiSpacer",
"size",
"=",
"\"l\"",
"/",
">",
"{",
"}",
"<",
"FormWizardNav",
"activeStepIndex",
"=",
"{",
"activeStepIndex",
"}",
"lastStep",
"=",
"{",
"lastStep",
"}",
"isStepValid",
"=",
"{",
"isCurrentStepValid",
"}",
"isSaving",
"=",
"{",
"isSaving",
"}",
"onBack",
"=",
"{",
"onBack",
"}",
"onNext",
"=",
"{",
"onNext",
"}",
"texts",
"=",
"{",
"texts",
"}",
"getRightContent",
"=",
"{",
"getRightContentNav",
"}",
"/",
">",
"<",
"/>);",
"}",
"}",
"<",
"/FormWizardConsumer>",
"<",
"/FormWizardProvider>);",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
702 | [
"import",
"React",
",",
"{",
"Component",
",",
"AriaAttributes",
"}",
"from",
"'react'",
";",
"import",
"classNames",
"from",
"'classnames'",
";",
"import",
"AceEditor",
",",
"{",
"IAceEditorProps",
"}",
"from",
"'react-ace'",
";",
"import",
"{",
"EuiI18n",
",",
"htmlIdGenerator",
",",
"keys",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"'./_index.scss'",
";",
"/**\n * Wraps Object.keys with proper typescript definition of the resulting array\n */",
"function",
"keysOf",
"<",
"T",
",",
"K",
"extends",
"keyof",
"T",
">",
"(",
"obj",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"obj",
")",
"as",
"K",
"[",
"]",
";",
"}",
"const",
"DEFAULT_MODE",
"=",
"'text'",
";",
"const",
"DEFAULT_THEME",
"=",
"'textmate'",
";",
"function",
"setOrRemoveAttribute",
"(",
"element",
",",
"attributeName",
",",
"value",
")",
"{",
"if",
"(",
"value",
"===",
"null",
"||",
"value",
"===",
"undefined",
")",
"{",
"element",
".",
"removeAttribute",
"(",
"attributeName",
")",
";",
"}",
"else",
"{",
"element",
".",
"setAttribute",
"(",
"attributeName",
",",
"value",
")",
";",
"}",
"}",
"type",
"SupportedAriaAttribute",
"=",
"'aria-label'",
"|",
"'aria-labelledby'",
"|",
"'aria-describedby'",
";",
"type",
"SupportedAriaAttributes",
"=",
"Pick",
"<",
"AriaAttributes",
",",
"SupportedAriaAttribute",
">",
";",
"export",
"interface",
"EuiCodeEditorProps",
"extends",
"SupportedAriaAttributes",
",",
"Omit",
"<",
"IAceEditorProps",
",",
"'mode'",
">",
"{",
"width",
"?",
":",
"string",
";",
"height",
"?",
":",
"string",
";",
"onBlur",
"?",
":",
"IAceEditorProps",
"[",
"'onBlur'",
"]",
";",
"onFocus",
"?",
":",
"IAceEditorProps",
"[",
"'onFocus'",
"]",
";",
"isReadOnly",
"?",
":",
"boolean",
";",
"setOptions",
"?",
":",
"IAceEditorProps",
"[",
"'setOptions'",
"]",
";",
"cursorStart",
"?",
":",
"number",
";",
"'data-test-subj'",
"?",
":",
"string",
";",
"/**\n * Select the `brace` theme\n * The matching theme file must also be imported from `brace` (e.g., `import 'brace/theme/github';`)\n */",
"theme",
"?",
":",
"IAceEditorProps",
"[",
"'theme'",
"]",
";",
"/**\n * Use string for a built-in mode or object for a custom mode\n */",
"mode",
"?",
":",
"IAceEditorProps",
"[",
"'mode'",
"]",
"|",
"object",
";",
"id",
"?",
":",
"string",
";",
"}",
"export",
"interface",
"EuiCodeEditorState",
"{",
"isHintActive",
":",
"boolean",
";",
"isEditing",
":",
"boolean",
";",
"name",
":",
"string",
";",
"}",
"class",
"EuiCodeEditor",
"extends",
"Component",
"<",
"EuiCodeEditorProps",
",",
"EuiCodeEditorState",
">",
"{",
"static",
"defaultProps",
"=",
"{",
"setOptions",
":",
"{",
"showLineNumbers",
":",
"false",
",",
"tabSize",
":",
"2",
",",
"}",
",",
"}",
";",
"state",
":",
"EuiCodeEditorState",
"=",
"{",
"isHintActive",
":",
"true",
",",
"isEditing",
":",
"false",
",",
"name",
":",
"htmlIdGenerator",
"(",
")",
"(",
")",
",",
"}",
";",
"constructor",
"(",
"props",
")",
"{",
"super",
"(",
"props",
")",
";",
"}",
"idGenerator",
"=",
"htmlIdGenerator",
"(",
")",
";",
"aceEditor",
":",
"AceEditor",
"|",
"null",
"=",
"null",
";",
"editorHint",
":",
"HTMLButtonElement",
"|",
"null",
"=",
"null",
";",
"aceEditorRef",
"=",
"(",
"aceEditor",
")",
"=>",
"{",
"if",
"(",
"aceEditor",
")",
"{",
"this",
".",
"aceEditor",
"=",
"aceEditor",
";",
"const",
"textbox",
"=",
"aceEditor",
".",
"editor",
".",
"textInput",
".",
"getElement",
"(",
")",
"as",
"HTMLTextAreaElement",
";",
"textbox",
".",
"tabIndex",
"=",
"-",
"1",
";",
"textbox",
".",
"addEventListener",
"(",
"'keydown'",
",",
"this",
".",
"onKeydownAce",
")",
";",
"setOrRemoveAttribute",
"(",
"textbox",
",",
"'aria-label'",
",",
"this",
".",
"props",
"[",
"'aria-label'",
"]",
")",
";",
"setOrRemoveAttribute",
"(",
"textbox",
",",
"'aria-labelledby'",
",",
"this",
".",
"props",
"[",
"'aria-labelledby'",
"]",
")",
";",
"setOrRemoveAttribute",
"(",
"textbox",
",",
"'aria-describedby'",
",",
"this",
".",
"props",
"[",
"'aria-describedby'",
"]",
")",
";",
"}",
"}",
";",
"onEscToExit",
"=",
"(",
")",
"=>",
"{",
"this",
".",
"stopEditing",
"(",
")",
";",
"if",
"(",
"this",
".",
"editorHint",
")",
"{",
"this",
".",
"editorHint",
".",
"focus",
"(",
")",
";",
"}",
"}",
";",
"onKeydownAce",
"=",
"(",
"event",
")",
"=>",
"{",
"if",
"(",
"event",
".",
"key",
"===",
"keys",
".",
"ESCAPE",
")",
"{",
"event",
".",
"preventDefault",
"(",
")",
";",
"event",
".",
"stopPropagation",
"(",
")",
";",
"if",
"(",
"this",
".",
"aceEditor",
"!==",
"null",
"&&",
"!",
"this",
".",
"aceEditor",
".",
"editor",
".",
"completer",
"&&",
"this",
".",
"state",
".",
"isEditing",
")",
"{",
"this",
".",
"onEscToExit",
"(",
")",
";",
"}",
"}",
"}",
";",
"onFocusAce",
":",
"IAceEditorProps",
"[",
"'onFocus'",
"]",
"=",
"(",
"event",
",",
"editor",
")",
"=>",
"{",
"this",
".",
"setState",
"(",
"{",
"isEditing",
":",
"true",
",",
"}",
")",
";",
"if",
"(",
"this",
".",
"props",
".",
"onFocus",
")",
"{",
"this",
".",
"props",
".",
"onFocus",
"(",
"event",
",",
"editor",
")",
";",
"}",
"}",
";",
"onBlurAce",
":",
"IAceEditorProps",
"[",
"'onBlur'",
"]",
"=",
"(",
"event",
",",
"editor",
")",
"=>",
"{",
"this",
".",
"stopEditing",
"(",
")",
";",
"if",
"(",
"this",
".",
"props",
".",
"onBlur",
")",
"{",
"this",
".",
"props",
".",
"onBlur",
"(",
"event",
",",
"editor",
")",
";",
"}",
"}",
";",
"startEditing",
"=",
"(",
")",
"=>",
"{",
"this",
".",
"setState",
"(",
"{",
"isHintActive",
":",
"false",
",",
"}",
")",
";",
"if",
"(",
"this",
".",
"aceEditor",
"!==",
"null",
")",
"{",
"this",
".",
"aceEditor",
".",
"editor",
".",
"textInput",
".",
"focus",
"(",
")",
";",
"}",
"}",
";",
"stopEditing",
"(",
")",
"{",
"this",
".",
"setState",
"(",
"{",
"isHintActive",
":",
"true",
",",
"isEditing",
":",
"false",
",",
"}",
")",
";",
"}",
"isCustomMode",
"(",
")",
"{",
"return",
"typeof",
"this",
".",
"props",
".",
"mode",
"===",
"'object'",
";",
"}",
"setCustomMode",
"(",
")",
"{",
"if",
"(",
"this",
".",
"aceEditor",
"!==",
"null",
")",
"{",
"this",
".",
"aceEditor",
".",
"editor",
".",
"getSession",
"(",
")",
".",
"setMode",
"(",
"this",
".",
"props",
".",
"mode",
")",
";",
"}",
"}",
"componentDidMount",
"(",
")",
"{",
"if",
"(",
"this",
".",
"isCustomMode",
"(",
")",
")",
"{",
"this",
".",
"setCustomMode",
"(",
")",
";",
"}",
"const",
"{",
"isReadOnly",
",",
"id",
"}",
"=",
"this",
".",
"props",
";",
"const",
"textareaProps",
"=",
"{",
"id",
",",
"readOnly",
":",
"isReadOnly",
"}",
";",
"const",
"el",
"=",
"document",
".",
"getElementById",
"(",
"this",
".",
"state",
".",
"name",
")",
";",
"if",
"(",
"el",
")",
"{",
"const",
"textarea",
"=",
"el",
".",
"querySelector",
"(",
"'textarea'",
")",
";",
"if",
"(",
"textarea",
")",
"keysOf",
"(",
"textareaProps",
")",
".",
"forEach",
"(",
"(",
"key",
")",
"=>",
"{",
"if",
"(",
"textareaProps",
"[",
"key",
"]",
")",
"textarea",
".",
"setAttribute",
"(",
"`${",
"key",
"}`",
",",
"textareaProps",
"[",
"key",
"]",
"!",
".",
"toString",
"(",
")",
")",
";",
"}",
")",
";",
"}",
"}",
"componentDidUpdate",
"(",
"prevProps",
")",
"{",
"if",
"(",
"this",
".",
"props",
".",
"mode",
"!==",
"prevProps",
".",
"mode",
"&&",
"this",
".",
"isCustomMode",
"(",
")",
")",
"{",
"this",
".",
"setCustomMode",
"(",
")",
";",
"}",
"}",
"render",
"(",
")",
"{",
"const",
"{",
"width",
",",
"height",
",",
"onBlur",
",",
"isReadOnly",
",",
"setOptions",
",",
"cursorStart",
",",
"mode",
"=",
"DEFAULT_MODE",
",",
"'data-test-subj'",
":",
"dataTestSubj",
"=",
"'codeEditorContainer'",
",",
"theme",
"=",
"DEFAULT_THEME",
",",
"commands",
"=",
"[",
"]",
",",
"...",
"rest",
"}",
"=",
"this",
".",
"props",
";",
"const",
"classes",
"=",
"classNames",
"(",
"'euiCodeEditorWrapper'",
",",
"{",
"'euiCodeEditorWrapper-isEditing'",
":",
"this",
".",
"state",
".",
"isEditing",
",",
"}",
")",
";",
"const",
"promptClasses",
"=",
"classNames",
"(",
"'euiCodeEditorKeyboardHint'",
",",
"{",
"'euiCodeEditorKeyboardHint-isInactive'",
":",
"!",
"this",
".",
"state",
".",
"isHintActive",
",",
"}",
")",
";",
"let",
"filteredCursorStart",
";",
"const",
"options",
"=",
"{",
"...",
"setOptions",
"}",
";",
"if",
"(",
"isReadOnly",
")",
"{",
"filteredCursorStart",
"=",
"-",
"1",
";",
"Object",
".",
"assign",
"(",
"options",
",",
"{",
"readOnly",
":",
"true",
",",
"highlightActiveLine",
":",
"false",
",",
"highlightGutterLine",
":",
"false",
",",
"}",
")",
";",
"}",
"else",
"{",
"filteredCursorStart",
"=",
"cursorStart",
";",
"}",
"const",
"prompt",
"=",
"(",
"<",
"button",
"className",
"=",
"{",
"promptClasses",
"}",
"id",
"=",
"{",
"this",
".",
"idGenerator",
"(",
"'codeEditor'",
")",
"}",
"ref",
"=",
"{",
"(",
"hint",
")",
"=>",
"{",
"this",
".",
"editorHint",
"=",
"hint",
";",
"}",
"}",
"onClick",
"=",
"{",
"this",
".",
"startEditing",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"codeEditorHint\"",
">",
"<",
"p",
"className",
"=",
"\"euiText\"",
">",
"{",
"isReadOnly",
"?",
"(",
"<",
"EuiI18n",
"token",
"=",
"\"euiCodeEditor.startInteracting\"",
"default",
"=",
"\"Press Enter to start interacting with the code.\"",
"/",
">",
")",
":",
"(",
"<",
"EuiI18n",
"token",
"=",
"\"euiCodeEditor.startEditing\"",
"default",
"=",
"\"Press Enter to start editing.\"",
"/>)}",
"<",
"/p>",
"<",
"p",
"className",
"=",
"\"euiText\"",
">",
"{",
"isReadOnly",
"?",
"(",
"<",
"EuiI18n",
"token",
"=",
"\"euiCodeEditor.stopInteracting\"",
"default",
"=",
"\"When you're done, press Escape to stop interacting with the code.\"",
"/",
">",
")",
":",
"(",
"<",
"EuiI18n",
"token",
"=",
"\"euiCodeEditor.stopEditing\"",
"default",
"=",
"\"When you're done, press Escape to stop editing.\"",
"/>)}",
"<",
"/p>",
"<",
"/button>);",
"return",
"(",
"<",
"div",
"className",
"=",
"{",
"classes",
"}",
"style",
"=",
"{",
"{",
"width",
",",
"height",
"}",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"{",
"dataTestSubj",
"}",
">",
"{",
"prompt",
"}",
"<",
"AceEditor",
"mode",
"=",
"{",
"this",
".",
"isCustomMode",
"(",
")",
"?",
"DEFAULT_MODE",
":",
"(",
"mode",
"as",
"string",
")",
"}",
"name",
"=",
"{",
"this",
".",
"state",
".",
"name",
"}",
"theme",
"=",
"{",
"theme",
"}",
"ref",
"=",
"{",
"this",
".",
"aceEditorRef",
"}",
"width",
"=",
"{",
"width",
"}",
"height",
"=",
"{",
"height",
"}",
"onFocus",
"=",
"{",
"this",
".",
"onFocusAce",
"}",
"onBlur",
"=",
"{",
"this",
".",
"onBlurAce",
"}",
"setOptions",
"=",
"{",
"options",
"}",
"editorProps",
"=",
"{",
"{",
"$blockScrolling",
":",
"Infinity",
",",
"}",
"}",
"cursorStart",
"=",
"{",
"filteredCursorStart",
"}",
"commands",
"=",
"{",
"[",
"{",
"name",
":",
"'stopEditingOnEsc'",
",",
"bindKey",
":",
"{",
"win",
":",
"'Esc'",
",",
"mac",
":",
"'Esc'",
"}",
",",
"exec",
":",
"this",
".",
"onEscToExit",
",",
"}",
",",
"...",
"commands",
",",
"]",
"}",
"{",
"...",
"rest",
"}",
"/>",
"<",
"/div>);",
"}",
"}",
"export",
"default",
"EuiCodeEditor",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
4,
null,
730,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
730,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
69,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
15,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
730,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
703 | [
"import",
"React",
"from",
"'react'",
";",
"import",
"{",
"EuiLoadingContentProps",
",",
"EuiLoadingContent",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"type",
"{",
"EuiCodeEditorProps",
"}",
"from",
"'./code_editor'",
";",
"const",
"Placeholder",
"=",
"(",
"{",
"height",
"}",
")",
"=>",
"{",
"const",
"numericalHeight",
"=",
"height",
"?",
"parseInt",
"(",
"height",
",",
"10",
")",
":",
"0",
";",
"const",
"lineHeight",
"=",
"24",
";",
"const",
"calculatedLineCount",
"=",
"numericalHeight",
"<",
"lineHeight",
"?",
"1",
":",
"Math",
".",
"floor",
"(",
"numericalHeight",
"/",
"lineHeight",
")",
";",
"const",
"lines",
"=",
"Math",
".",
"min",
"(",
"10",
",",
"calculatedLineCount",
")",
";",
"return",
"<",
"EuiLoadingContent",
"lines",
"=",
"{",
"lines",
"as",
"EuiLoadingContentProps",
"[",
"'lines'",
"]",
"}",
"/>;",
"}",
";",
"const",
"LazyEuiCodeEditor",
"=",
"React",
".",
"lazy",
"(",
"(",
")",
"=>",
"import",
"(",
"'./code_editor'",
")",
")",
";",
"export",
"const",
"EuiCodeEditor",
"=",
"(",
"props",
")",
"=>",
"(",
"<",
"React",
".",
"Suspense",
"fallback",
"=",
"{",
"<",
"Placeholder",
"height",
"=",
"{",
"props",
".",
"height",
"}",
"/",
">",
"}",
">",
"<",
"LazyEuiCodeEditor",
"{",
"...",
"props",
"}",
"/",
">",
"<",
"/React.Suspense>);",
"export",
"type",
"{",
"EuiCodeEditorProps",
"}",
"from",
"'./code_editor'",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
704 | [
"export",
"const",
"containsChars",
"=",
"(",
"chars",
")",
"=>",
"(",
"value",
")",
"=>",
"{",
"const",
"charToArray",
"=",
"Array",
".",
"isArray",
"(",
"chars",
")",
"?",
"(",
"chars",
"as",
"string",
"[",
"]",
")",
":",
"(",
"[",
"chars",
"]",
"as",
"string",
"[",
"]",
")",
";",
"const",
"charsFound",
"=",
"charToArray",
".",
"reduce",
"(",
"(",
"acc",
",",
"char",
")",
"=>",
"(",
"value",
".",
"includes",
"(",
"char",
")",
"?",
"[",
"...",
"acc",
",",
"char",
"]",
":",
"acc",
")",
",",
"[",
"]",
"as",
"string",
"[",
"]",
")",
";",
"return",
"{",
"charsFound",
",",
"doesContain",
":",
"charsFound",
".",
"length",
">",
"0",
",",
"}",
";",
"}",
";"
] | [
null,
null,
6,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
5,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
705 | [
"export",
"const",
"endsWith",
"=",
"(",
"char",
")",
"=>",
"(",
"value",
")",
"=>",
"value",
".",
"endsWith",
"(",
"char",
")",
";"
] | [
null,
null,
8,
null,
null,
2,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
706 | [
"export",
"const",
"hasMaxLengthString",
"=",
"(",
"length",
")",
"=>",
"(",
"str",
")",
"=>",
"str",
".",
"length",
"<=",
"length",
";"
] | [
null,
null,
8,
null,
null,
3,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null
] |
707 | [
"export",
"const",
"hasMinLengthString",
"=",
"(",
"length",
")",
"=>",
"(",
"str",
")",
"=>",
"str",
".",
"length",
">=",
"length",
";"
] | [
null,
null,
8,
null,
null,
3,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null
] |
708 | [
"export",
"const",
"isEmptyString",
"=",
"(",
"value",
")",
"=>",
"value",
".",
"trim",
"(",
")",
"===",
"''",
";"
] | [
null,
null,
8,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
709 | [
"const",
"protocolAndDomainRE",
"=",
"/^(?:\\w+:)?\\/\\/(\\S+)$/",
";",
"const",
"localhostDomainRE",
"=",
"/^localhost[\\:?\\d]*(?:[^\\:?\\d]\\S*)?$/",
";",
"const",
"nonLocalhostDomainRE",
"=",
"/^[^\\s\\.]+\\.\\S{2,}$/",
";",
"export",
"const",
"isUrl",
"=",
"(",
"string",
")",
"=>",
"{",
"if",
"(",
"typeof",
"string",
"!==",
"'string'",
")",
"{",
"return",
"false",
";",
"}",
"const",
"match",
"=",
"string",
".",
"match",
"(",
"protocolAndDomainRE",
")",
";",
"if",
"(",
"!",
"match",
")",
"{",
"return",
"false",
";",
"}",
"const",
"everythingAfterProtocol",
"=",
"match",
"[",
"1",
"]",
";",
"if",
"(",
"!",
"everythingAfterProtocol",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"localhostDomainRE",
".",
"test",
"(",
"everythingAfterProtocol",
")",
"||",
"nonLocalhostDomainRE",
".",
"test",
"(",
"everythingAfterProtocol",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
";"
] | [
null,
27,
null,
null,
null,
null,
27,
null,
null,
null,
null,
27,
null,
null,
null,
null,
null,
8,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
63,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
710 | [
"export",
"const",
"startsWith",
"=",
"(",
"char",
")",
"=>",
"(",
"value",
")",
"=>",
"value",
".",
"startsWith",
"(",
"char",
")",
";"
] | [
null,
null,
8,
null,
null,
2,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
711 | [
"export",
"const",
"isJSON",
"=",
"(",
"value",
")",
"=>",
"{",
"try",
"{",
"const",
"parsedJSON",
"=",
"JSON",
".",
"parse",
"(",
"value",
")",
";",
"if",
"(",
"parsedJSON",
"&&",
"typeof",
"parsedJSON",
"!==",
"'object'",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}",
";"
] | [
null,
null,
8,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
712 | [
"export",
"const",
"isLowerCaseString",
"=",
"(",
"value",
")",
"=>",
"value",
".",
"toLowerCase",
"(",
")",
"===",
"value",
";"
] | [
null,
null,
8,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
713 | [
"import",
"React",
"from",
"'react'",
";",
"import",
"{",
"EuiEmptyPrompt",
",",
"EuiLoadingSpinner",
",",
"EuiText",
",",
"EuiPageContent",
"}",
"from",
"'@elastic/eui'",
";",
"export",
"const",
"PageLoading",
"=",
"(",
"{",
"children",
"}",
")",
"=>",
"{",
"return",
"(",
"<",
"EuiPageContent",
"verticalPosition",
"=",
"\"center\"",
"horizontalPosition",
"=",
"\"center\"",
"color",
"=",
"\"subdued\"",
">",
"<",
"EuiEmptyPrompt",
"title",
"=",
"{",
"<",
"EuiLoadingSpinner",
"size",
"=",
"\"xl\"",
"/",
">",
"}",
"body",
"=",
"{",
"<",
"EuiText",
"color",
"=",
"\"subdued\"",
">",
"{",
"children",
"}",
"<",
"/EuiText>} data-test-subj=\"sectionLoading\"/",
">",
"<",
"/EuiPageContent>);",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
97,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
714 | [
"import",
"{",
"FieldToValueMap",
"}",
"from",
"'../types'",
";",
"export",
"function",
"cronExpressionToParts",
"(",
"expression",
")",
"{",
"const",
"parsedCron",
"=",
"{",
"second",
":",
"undefined",
",",
"minute",
":",
"undefined",
",",
"hour",
":",
"undefined",
",",
"day",
":",
"undefined",
",",
"date",
":",
"undefined",
",",
"month",
":",
"undefined",
",",
"}",
";",
"const",
"parts",
"=",
"expression",
".",
"split",
"(",
"' '",
")",
";",
"if",
"(",
"parts",
".",
"length",
">=",
"1",
")",
"{",
"parsedCron",
".",
"second",
"=",
"parts",
"[",
"0",
"]",
";",
"}",
"if",
"(",
"parts",
".",
"length",
">=",
"2",
")",
"{",
"parsedCron",
".",
"minute",
"=",
"parts",
"[",
"1",
"]",
";",
"}",
"if",
"(",
"parts",
".",
"length",
">=",
"3",
")",
"{",
"parsedCron",
".",
"hour",
"=",
"parts",
"[",
"2",
"]",
";",
"}",
"if",
"(",
"parts",
".",
"length",
">=",
"4",
")",
"{",
"parsedCron",
".",
"date",
"=",
"parts",
"[",
"3",
"]",
";",
"}",
"if",
"(",
"parts",
".",
"length",
">=",
"5",
")",
"{",
"parsedCron",
".",
"month",
"=",
"parts",
"[",
"4",
"]",
";",
"}",
"if",
"(",
"parts",
".",
"length",
">=",
"6",
")",
"{",
"parsedCron",
".",
"day",
"=",
"parts",
"[",
"5",
"]",
";",
"}",
"return",
"parsedCron",
";",
"}",
"export",
"function",
"cronPartsToExpression",
"(",
"{",
"second",
",",
"minute",
",",
"hour",
",",
"day",
",",
"date",
",",
"month",
",",
"}",
")",
"{",
"return",
"`${",
"second",
"} ${",
"minute",
"} ${",
"hour",
"} ${",
"date",
"} ${",
"month",
"} ${",
"day",
"}`",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
42368,
null,
2,
null,
null,
null,
42368,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
715 | [
"import",
"{",
"i18n",
"}",
"from",
"'@kbn/i18n'",
";",
"export",
"type",
"DayOrdinal",
"=",
"0",
"|",
"1",
"|",
"2",
"|",
"3",
"|",
"4",
"|",
"5",
"|",
"6",
";",
"export",
"type",
"MonthOrdinal",
"=",
"0",
"|",
"1",
"|",
"2",
"|",
"3",
"|",
"4",
"|",
"5",
"|",
"6",
"|",
"7",
"|",
"8",
"|",
"9",
"|",
"10",
"|",
"11",
";",
"const",
"dayOrdinalToDayNameMap",
"=",
"{",
"0",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.day.sunday'",
",",
"{",
"defaultMessage",
":",
"'Sunday'",
"}",
")",
",",
"1",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.day.monday'",
",",
"{",
"defaultMessage",
":",
"'Monday'",
"}",
")",
",",
"2",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.day.tuesday'",
",",
"{",
"defaultMessage",
":",
"'Tuesday'",
"}",
")",
",",
"3",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.day.wednesday'",
",",
"{",
"defaultMessage",
":",
"'Wednesday'",
"}",
")",
",",
"4",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.day.thursday'",
",",
"{",
"defaultMessage",
":",
"'Thursday'",
"}",
")",
",",
"5",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.day.friday'",
",",
"{",
"defaultMessage",
":",
"'Friday'",
"}",
")",
",",
"6",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.day.saturday'",
",",
"{",
"defaultMessage",
":",
"'Saturday'",
"}",
")",
",",
"}",
";",
"const",
"monthOrdinalToMonthNameMap",
"=",
"{",
"0",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.month.january'",
",",
"{",
"defaultMessage",
":",
"'January'",
"}",
")",
",",
"1",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.month.february'",
",",
"{",
"defaultMessage",
":",
"'February'",
"}",
")",
",",
"2",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.month.march'",
",",
"{",
"defaultMessage",
":",
"'March'",
"}",
")",
",",
"3",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.month.april'",
",",
"{",
"defaultMessage",
":",
"'April'",
"}",
")",
",",
"4",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.month.may'",
",",
"{",
"defaultMessage",
":",
"'May'",
"}",
")",
",",
"5",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.month.june'",
",",
"{",
"defaultMessage",
":",
"'June'",
"}",
")",
",",
"6",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.month.july'",
",",
"{",
"defaultMessage",
":",
"'July'",
"}",
")",
",",
"7",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.month.august'",
",",
"{",
"defaultMessage",
":",
"'August'",
"}",
")",
",",
"8",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.month.september'",
",",
"{",
"defaultMessage",
":",
"'September'",
"}",
")",
",",
"9",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.month.october'",
",",
"{",
"defaultMessage",
":",
"'October'",
"}",
")",
",",
"10",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.month.november'",
",",
"{",
"defaultMessage",
":",
"'November'",
"}",
")",
",",
"11",
":",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.month.december'",
",",
"{",
"defaultMessage",
":",
"'December'",
"}",
")",
",",
"}",
";",
"export",
"function",
"getOrdinalValue",
"(",
"number",
")",
"{",
"const",
"num",
"=",
"number",
"&&",
"number",
".",
"toString",
"(",
")",
";",
"const",
"lastDigitString",
"=",
"num",
"&&",
"num",
".",
"substr",
"(",
"-",
"1",
")",
";",
"let",
"ordinal",
";",
"if",
"(",
"!",
"lastDigitString",
")",
"{",
"return",
"number",
".",
"toString",
"(",
")",
";",
"}",
"const",
"lastDigitNumeric",
"=",
"parseFloat",
"(",
"lastDigitString",
")",
";",
"switch",
"(",
"lastDigitNumeric",
")",
"{",
"case",
"1",
":",
"ordinal",
"=",
"'st'",
";",
"break",
";",
"case",
"2",
":",
"ordinal",
"=",
"'nd'",
";",
"break",
";",
"case",
"3",
":",
"ordinal",
"=",
"'rd'",
";",
"break",
";",
"default",
":",
"ordinal",
"=",
"'th'",
";",
"}",
"return",
"`${",
"num",
"}${",
"ordinal",
"}`",
";",
"}",
"export",
"function",
"getDayName",
"(",
"dayOrdinal",
")",
"{",
"return",
"dayOrdinalToDayNameMap",
"[",
"dayOrdinal",
"]",
";",
"}",
"export",
"function",
"getMonthName",
"(",
"monthOrdinal",
")",
"{",
"return",
"monthOrdinalToMonthNameMap",
"[",
"monthOrdinal",
"]",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
3,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
716 | [
"import",
"{",
"padStart",
"}",
"from",
"'lodash'",
";",
"import",
"{",
"EuiSelectOption",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"{",
"DayOrdinal",
",",
"MonthOrdinal",
",",
"getOrdinalValue",
",",
"getDayName",
",",
"getMonthName",
"}",
"from",
"'./services'",
";",
"import",
"{",
"Frequency",
",",
"Field",
",",
"FieldToValueMap",
"}",
"from",
"'./types'",
";",
"type",
"FieldFlags",
"=",
"{",
"[",
"key",
"in",
"Field",
"]",
"?",
":",
"boolean",
";",
"}",
";",
"function",
"makeSequence",
"(",
"min",
",",
"max",
")",
"{",
"const",
"values",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"i",
"=",
"min",
";",
"i",
"<=",
"max",
";",
"i",
"++",
")",
"{",
"values",
".",
"push",
"(",
"i",
")",
";",
"}",
"return",
"values",
";",
"}",
"export",
"const",
"MINUTE_OPTIONS",
"=",
"makeSequence",
"(",
"0",
",",
"59",
")",
".",
"map",
"(",
"(",
"value",
")",
"=>",
"(",
"{",
"value",
":",
"value",
".",
"toString",
"(",
")",
",",
"text",
":",
"padStart",
"(",
"value",
".",
"toString",
"(",
")",
",",
"2",
",",
"'0'",
")",
",",
"}",
")",
")",
";",
"export",
"const",
"HOUR_OPTIONS",
"=",
"makeSequence",
"(",
"0",
",",
"23",
")",
".",
"map",
"(",
"(",
"value",
")",
"=>",
"(",
"{",
"value",
":",
"value",
".",
"toString",
"(",
")",
",",
"text",
":",
"padStart",
"(",
"value",
".",
"toString",
"(",
")",
",",
"2",
",",
"'0'",
")",
",",
"}",
")",
")",
";",
"export",
"const",
"DAY_OPTIONS",
"=",
"makeSequence",
"(",
"1",
",",
"7",
")",
".",
"map",
"(",
"(",
"value",
")",
"=>",
"(",
"{",
"value",
":",
"value",
".",
"toString",
"(",
")",
",",
"text",
":",
"getDayName",
"(",
"(",
"value",
"-",
"1",
")",
"as",
"DayOrdinal",
")",
",",
"}",
")",
")",
";",
"export",
"const",
"DATE_OPTIONS",
"=",
"makeSequence",
"(",
"1",
",",
"31",
")",
".",
"map",
"(",
"(",
"value",
")",
"=>",
"(",
"{",
"value",
":",
"value",
".",
"toString",
"(",
")",
",",
"text",
":",
"getOrdinalValue",
"(",
"value",
")",
",",
"}",
")",
")",
";",
"export",
"const",
"MONTH_OPTIONS",
"=",
"makeSequence",
"(",
"1",
",",
"12",
")",
".",
"map",
"(",
"(",
"value",
")",
"=>",
"(",
"{",
"value",
":",
"value",
".",
"toString",
"(",
")",
",",
"text",
":",
"getMonthName",
"(",
"(",
"value",
"-",
"1",
")",
"as",
"MonthOrdinal",
")",
",",
"}",
")",
")",
";",
"export",
"const",
"UNITS",
"=",
"[",
"{",
"value",
":",
"'MINUTE'",
",",
"text",
":",
"'minute'",
",",
"}",
",",
"{",
"value",
":",
"'HOUR'",
",",
"text",
":",
"'hour'",
",",
"}",
",",
"{",
"value",
":",
"'DAY'",
",",
"text",
":",
"'day'",
",",
"}",
",",
"{",
"value",
":",
"'WEEK'",
",",
"text",
":",
"'week'",
",",
"}",
",",
"{",
"value",
":",
"'MONTH'",
",",
"text",
":",
"'month'",
",",
"}",
",",
"{",
"value",
":",
"'YEAR'",
",",
"text",
":",
"'year'",
",",
"}",
",",
"]",
";",
"export",
"const",
"frequencyToFieldsMap",
"=",
"{",
"MINUTE",
":",
"{",
"}",
",",
"HOUR",
":",
"{",
"minute",
":",
"true",
",",
"}",
",",
"DAY",
":",
"{",
"hour",
":",
"true",
",",
"minute",
":",
"true",
",",
"}",
",",
"WEEK",
":",
"{",
"day",
":",
"true",
",",
"hour",
":",
"true",
",",
"minute",
":",
"true",
",",
"}",
",",
"MONTH",
":",
"{",
"date",
":",
"true",
",",
"hour",
":",
"true",
",",
"minute",
":",
"true",
",",
"}",
",",
"YEAR",
":",
"{",
"month",
":",
"true",
",",
"date",
":",
"true",
",",
"hour",
":",
"true",
",",
"minute",
":",
"true",
",",
"}",
",",
"}",
";",
"export",
"const",
"frequencyToBaselineFieldsMap",
"=",
"{",
"MINUTE",
":",
"{",
"second",
":",
"'0'",
",",
"minute",
":",
"'*'",
",",
"hour",
":",
"'*'",
",",
"date",
":",
"'*'",
",",
"month",
":",
"'*'",
",",
"day",
":",
"'?'",
",",
"}",
",",
"HOUR",
":",
"{",
"second",
":",
"'0'",
",",
"minute",
":",
"'0'",
",",
"hour",
":",
"'*'",
",",
"date",
":",
"'*'",
",",
"month",
":",
"'*'",
",",
"day",
":",
"'?'",
",",
"}",
",",
"DAY",
":",
"{",
"second",
":",
"'0'",
",",
"minute",
":",
"'0'",
",",
"hour",
":",
"'0'",
",",
"date",
":",
"'*'",
",",
"month",
":",
"'*'",
",",
"day",
":",
"'?'",
",",
"}",
",",
"WEEK",
":",
"{",
"second",
":",
"'0'",
",",
"minute",
":",
"'0'",
",",
"hour",
":",
"'0'",
",",
"date",
":",
"'?'",
",",
"month",
":",
"'*'",
",",
"day",
":",
"'7'",
",",
"}",
",",
"MONTH",
":",
"{",
"second",
":",
"'0'",
",",
"minute",
":",
"'0'",
",",
"hour",
":",
"'0'",
",",
"date",
":",
"'1'",
",",
"month",
":",
"'*'",
",",
"day",
":",
"'?'",
",",
"}",
",",
"YEAR",
":",
"{",
"second",
":",
"'0'",
",",
"minute",
":",
"'0'",
",",
"hour",
":",
"'0'",
",",
"date",
":",
"'1'",
",",
"month",
":",
"'1'",
",",
"day",
":",
"'?'",
",",
"}",
",",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
3,
null,
3,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
717 | [
"import",
"React",
",",
"{",
"Fragment",
"}",
"from",
"'react'",
";",
"import",
"{",
"FormattedMessage",
"}",
"from",
"'@kbn/i18n-react'",
";",
"import",
"{",
"i18n",
"}",
"from",
"'@kbn/i18n'",
";",
"import",
"{",
"EuiFormRow",
",",
"EuiSelect",
",",
"EuiSelectOption",
"}",
"from",
"'@elastic/eui'",
";",
"interface",
"Props",
"{",
"minute",
"?",
":",
"string",
";",
"minuteOptions",
":",
"EuiSelectOption",
"[",
"]",
";",
"onChange",
":",
"(",
"{",
"minute",
"}",
":",
"{",
"minute",
"?",
":",
"string",
";",
"}",
")",
"=>",
"void",
";",
"}",
"export",
"const",
"CronHourly",
"=",
"(",
"{",
"minute",
",",
"minuteOptions",
",",
"onChange",
"}",
")",
"=>",
"(",
"<",
"Fragment",
">",
"<",
"EuiFormRow",
"label",
"=",
"{",
"<",
"FormattedMessage",
"id",
"=",
"\"esUi.cronEditor.cronHourly.fieldTimeLabel\"",
"defaultMessage",
"=",
"\"Minute\"",
"/",
">",
"}",
"fullWidth",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyConfiguration\"",
">",
"<",
"EuiSelect",
"options",
"=",
"{",
"minuteOptions",
"}",
"value",
"=",
"{",
"minute",
"}",
"onChange",
"=",
"{",
"(",
"e",
")",
"=>",
"onChange",
"(",
"{",
"minute",
":",
"e",
".",
"target",
".",
"value",
"}",
")",
"}",
"fullWidth",
"prepend",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronHourly.fieldMinute.textAtLabel'",
",",
"{",
"defaultMessage",
":",
"'At'",
",",
"}",
")",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyHourlyMinuteSelect\"",
"/",
">",
"<",
"/EuiFormRow>",
"<",
"/Fragment>);"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
97,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
718 | [
"import",
"React",
",",
"{",
"Fragment",
"}",
"from",
"'react'",
";",
"import",
"{",
"FormattedMessage",
"}",
"from",
"'@kbn/i18n-react'",
";",
"import",
"{",
"i18n",
"}",
"from",
"'@kbn/i18n'",
";",
"import",
"{",
"EuiFlexGroup",
",",
"EuiFlexItem",
",",
"EuiFormRow",
",",
"EuiSelect",
",",
"EuiSelectOption",
"}",
"from",
"'@elastic/eui'",
";",
"interface",
"Props",
"{",
"minute",
"?",
":",
"string",
";",
"minuteOptions",
":",
"EuiSelectOption",
"[",
"]",
";",
"hour",
"?",
":",
"string",
";",
"hourOptions",
":",
"EuiSelectOption",
"[",
"]",
";",
"onChange",
":",
"(",
"{",
"minute",
",",
"hour",
"}",
":",
"{",
"minute",
"?",
":",
"string",
";",
"hour",
"?",
":",
"string",
";",
"}",
")",
"=>",
"void",
";",
"}",
"export",
"const",
"CronDaily",
"=",
"(",
"{",
"minute",
",",
"minuteOptions",
",",
"hour",
",",
"hourOptions",
",",
"onChange",
",",
"}",
")",
"=>",
"(",
"<",
"Fragment",
">",
"<",
"EuiFormRow",
"label",
"=",
"{",
"<",
"FormattedMessage",
"id",
"=",
"\"esUi.cronEditor.cronDaily.fieldTimeLabel\"",
"defaultMessage",
"=",
"\"Time\"",
"/",
">",
"}",
"fullWidth",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyConfiguration\"",
">",
"<",
"EuiFlexGroup",
"gutterSize",
"=",
"\"xs\"",
">",
"<",
"EuiFlexItem",
"grow",
"=",
"{",
"false",
"}",
">",
"<",
"EuiSelect",
"options",
"=",
"{",
"hourOptions",
"}",
"value",
"=",
"{",
"hour",
"}",
"aria",
"-",
"label",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronDaily.hourSelectLabel'",
",",
"{",
"defaultMessage",
":",
"'Hour'",
",",
"}",
")",
"}",
"onChange",
"=",
"{",
"(",
"e",
")",
"=>",
"onChange",
"(",
"{",
"hour",
":",
"e",
".",
"target",
".",
"value",
"}",
")",
"}",
"fullWidth",
"prepend",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronDaily.fieldHour.textAtLabel'",
",",
"{",
"defaultMessage",
":",
"'At'",
",",
"}",
")",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyDailyHourSelect\"",
"/",
">",
"<",
"/EuiFlexItem>",
"<",
"EuiFlexItem",
">",
"<",
"EuiSelect",
"options",
"=",
"{",
"minuteOptions",
"}",
"value",
"=",
"{",
"minute",
"}",
"aria",
"-",
"label",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronDaily.minuteSelectLabel'",
",",
"{",
"defaultMessage",
":",
"'Minute'",
",",
"}",
")",
"}",
"onChange",
"=",
"{",
"(",
"e",
")",
"=>",
"onChange",
"(",
"{",
"minute",
":",
"e",
".",
"target",
".",
"value",
"}",
")",
"}",
"fullWidth",
"prepend",
"=",
"\":\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyDailyMinuteSelect\"",
"/",
">",
"<",
"/EuiFlexItem>",
"<",
"/EuiFlexGroup>",
"<",
"/EuiFormRow>",
"<",
"/Fragment>);"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
97,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
719 | [
"import",
"React",
",",
"{",
"Fragment",
"}",
"from",
"'react'",
";",
"import",
"{",
"FormattedMessage",
"}",
"from",
"'@kbn/i18n-react'",
";",
"import",
"{",
"i18n",
"}",
"from",
"'@kbn/i18n'",
";",
"import",
"{",
"EuiFlexGroup",
",",
"EuiFlexItem",
",",
"EuiFormRow",
",",
"EuiSelect",
",",
"EuiSelectOption",
"}",
"from",
"'@elastic/eui'",
";",
"interface",
"Props",
"{",
"minute",
"?",
":",
"string",
";",
"minuteOptions",
":",
"EuiSelectOption",
"[",
"]",
";",
"hour",
"?",
":",
"string",
";",
"hourOptions",
":",
"EuiSelectOption",
"[",
"]",
";",
"day",
"?",
":",
"string",
";",
"dayOptions",
":",
"EuiSelectOption",
"[",
"]",
";",
"onChange",
":",
"(",
"{",
"minute",
",",
"hour",
",",
"day",
"}",
":",
"{",
"minute",
"?",
":",
"string",
";",
"hour",
"?",
":",
"string",
";",
"day",
"?",
":",
"string",
";",
"}",
")",
"=>",
"void",
";",
"}",
"export",
"const",
"CronWeekly",
"=",
"(",
"{",
"minute",
",",
"minuteOptions",
",",
"hour",
",",
"hourOptions",
",",
"day",
",",
"dayOptions",
",",
"onChange",
",",
"}",
")",
"=>",
"(",
"<",
"Fragment",
">",
"<",
"EuiFormRow",
"label",
"=",
"{",
"<",
"FormattedMessage",
"id",
"=",
"\"esUi.cronEditor.cronWeekly.fieldDateLabel\"",
"defaultMessage",
"=",
"\"Day\"",
"/",
">",
"}",
"fullWidth",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyConfiguration\"",
">",
"<",
"EuiSelect",
"options",
"=",
"{",
"dayOptions",
"}",
"value",
"=",
"{",
"day",
"}",
"onChange",
"=",
"{",
"(",
"e",
")",
"=>",
"onChange",
"(",
"{",
"day",
":",
"e",
".",
"target",
".",
"value",
"}",
")",
"}",
"fullWidth",
"prepend",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronWeekly.textOnLabel'",
",",
"{",
"defaultMessage",
":",
"'On'",
",",
"}",
")",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyWeeklyDaySelect\"",
"/",
">",
"<",
"/EuiFormRow>",
"<",
"EuiFormRow",
"label",
"=",
"{",
"<",
"FormattedMessage",
"id",
"=",
"\"esUi.cronEditor.cronWeekly.fieldTimeLabel\"",
"defaultMessage",
"=",
"\"Time\"",
"/",
">",
"}",
"fullWidth",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyConfiguration\"",
">",
"<",
"EuiFlexGroup",
"gutterSize",
"=",
"\"xs\"",
">",
"<",
"EuiFlexItem",
"grow",
"=",
"{",
"false",
"}",
">",
"<",
"EuiSelect",
"options",
"=",
"{",
"hourOptions",
"}",
"value",
"=",
"{",
"hour",
"}",
"aria",
"-",
"label",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronWeekly.hourSelectLabel'",
",",
"{",
"defaultMessage",
":",
"'Hour'",
",",
"}",
")",
"}",
"onChange",
"=",
"{",
"(",
"e",
")",
"=>",
"onChange",
"(",
"{",
"hour",
":",
"e",
".",
"target",
".",
"value",
"}",
")",
"}",
"fullWidth",
"prepend",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronWeekly.fieldHour.textAtLabel'",
",",
"{",
"defaultMessage",
":",
"'At'",
",",
"}",
")",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyWeeklyHourSelect\"",
"/",
">",
"<",
"/EuiFlexItem>",
"<",
"EuiFlexItem",
">",
"<",
"EuiSelect",
"options",
"=",
"{",
"minuteOptions",
"}",
"value",
"=",
"{",
"minute",
"}",
"onChange",
"=",
"{",
"(",
"e",
")",
"=>",
"onChange",
"(",
"{",
"minute",
":",
"e",
".",
"target",
".",
"value",
"}",
")",
"}",
"aria",
"-",
"label",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronWeekly.minuteSelectLabel'",
",",
"{",
"defaultMessage",
":",
"'Minute'",
",",
"}",
")",
"}",
"fullWidth",
"prepend",
"=",
"\":\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyWeeklyMinuteSelect\"",
"/",
">",
"<",
"/EuiFlexItem>",
"<",
"/EuiFlexGroup>",
"<",
"/EuiFormRow>",
"<",
"/Fragment>);"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
97,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
720 | [
"import",
"React",
",",
"{",
"Fragment",
"}",
"from",
"'react'",
";",
"import",
"{",
"FormattedMessage",
"}",
"from",
"'@kbn/i18n-react'",
";",
"import",
"{",
"i18n",
"}",
"from",
"'@kbn/i18n'",
";",
"import",
"{",
"EuiFlexGroup",
",",
"EuiFlexItem",
",",
"EuiFormRow",
",",
"EuiSelect",
",",
"EuiSelectOption",
"}",
"from",
"'@elastic/eui'",
";",
"interface",
"Props",
"{",
"minute",
"?",
":",
"string",
";",
"minuteOptions",
":",
"EuiSelectOption",
"[",
"]",
";",
"hour",
"?",
":",
"string",
";",
"hourOptions",
":",
"EuiSelectOption",
"[",
"]",
";",
"date",
"?",
":",
"string",
";",
"dateOptions",
":",
"EuiSelectOption",
"[",
"]",
";",
"onChange",
":",
"(",
"{",
"minute",
",",
"hour",
",",
"date",
"}",
":",
"{",
"minute",
"?",
":",
"string",
";",
"hour",
"?",
":",
"string",
";",
"date",
"?",
":",
"string",
";",
"}",
")",
"=>",
"void",
";",
"}",
"export",
"const",
"CronMonthly",
"=",
"(",
"{",
"minute",
",",
"minuteOptions",
",",
"hour",
",",
"hourOptions",
",",
"date",
",",
"dateOptions",
",",
"onChange",
",",
"}",
")",
"=>",
"(",
"<",
"Fragment",
">",
"<",
"EuiFormRow",
"label",
"=",
"{",
"<",
"FormattedMessage",
"id",
"=",
"\"esUi.cronEditor.cronMonthly.fieldDateLabel\"",
"defaultMessage",
"=",
"\"Date\"",
"/",
">",
"}",
"fullWidth",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyConfiguration\"",
">",
"<",
"EuiSelect",
"options",
"=",
"{",
"dateOptions",
"}",
"value",
"=",
"{",
"date",
"}",
"onChange",
"=",
"{",
"(",
"e",
")",
"=>",
"onChange",
"(",
"{",
"date",
":",
"e",
".",
"target",
".",
"value",
"}",
")",
"}",
"fullWidth",
"prepend",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronMonthly.textOnTheLabel'",
",",
"{",
"defaultMessage",
":",
"'On the'",
",",
"}",
")",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyMonthlyDateSelect\"",
"/",
">",
"<",
"/EuiFormRow>",
"<",
"EuiFormRow",
"label",
"=",
"{",
"<",
"FormattedMessage",
"id",
"=",
"\"esUi.cronEditor.cronMonthly.fieldTimeLabel\"",
"defaultMessage",
"=",
"\"Time\"",
"/",
">",
"}",
"fullWidth",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyConfiguration\"",
">",
"<",
"EuiFlexGroup",
"gutterSize",
"=",
"\"xs\"",
">",
"<",
"EuiFlexItem",
"grow",
"=",
"{",
"false",
"}",
">",
"<",
"EuiSelect",
"options",
"=",
"{",
"hourOptions",
"}",
"value",
"=",
"{",
"hour",
"}",
"aria",
"-",
"label",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronMonthly.hourSelectLabel'",
",",
"{",
"defaultMessage",
":",
"'Hour'",
",",
"}",
")",
"}",
"onChange",
"=",
"{",
"(",
"e",
")",
"=>",
"onChange",
"(",
"{",
"hour",
":",
"e",
".",
"target",
".",
"value",
"}",
")",
"}",
"fullWidth",
"prepend",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronMonthly.fieldHour.textAtLabel'",
",",
"{",
"defaultMessage",
":",
"'At'",
",",
"}",
")",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyMonthlyHourSelect\"",
"/",
">",
"<",
"/EuiFlexItem>",
"<",
"EuiFlexItem",
">",
"<",
"EuiSelect",
"options",
"=",
"{",
"minuteOptions",
"}",
"value",
"=",
"{",
"minute",
"}",
"aria",
"-",
"label",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronMonthly.minuteSelectLabel'",
",",
"{",
"defaultMessage",
":",
"'Minute'",
",",
"}",
")",
"}",
"onChange",
"=",
"{",
"(",
"e",
")",
"=>",
"onChange",
"(",
"{",
"minute",
":",
"e",
".",
"target",
".",
"value",
"}",
")",
"}",
"fullWidth",
"prepend",
"=",
"\":\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyMonthlyMinuteSelect\"",
"/",
">",
"<",
"/EuiFlexItem>",
"<",
"/EuiFlexGroup>",
"<",
"/EuiFormRow>",
"<",
"/Fragment>);"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
97,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
721 | [
"import",
"React",
",",
"{",
"Fragment",
"}",
"from",
"'react'",
";",
"import",
"{",
"FormattedMessage",
"}",
"from",
"'@kbn/i18n-react'",
";",
"import",
"{",
"i18n",
"}",
"from",
"'@kbn/i18n'",
";",
"import",
"{",
"EuiFlexGroup",
",",
"EuiFlexItem",
",",
"EuiFormRow",
",",
"EuiSelect",
",",
"EuiSelectOption",
"}",
"from",
"'@elastic/eui'",
";",
"interface",
"Props",
"{",
"minute",
"?",
":",
"string",
";",
"minuteOptions",
":",
"EuiSelectOption",
"[",
"]",
";",
"hour",
"?",
":",
"string",
";",
"hourOptions",
":",
"EuiSelectOption",
"[",
"]",
";",
"date",
"?",
":",
"string",
";",
"dateOptions",
":",
"EuiSelectOption",
"[",
"]",
";",
"month",
"?",
":",
"string",
";",
"monthOptions",
":",
"EuiSelectOption",
"[",
"]",
";",
"onChange",
":",
"(",
"{",
"minute",
",",
"hour",
",",
"date",
",",
"month",
",",
"}",
":",
"{",
"minute",
"?",
":",
"string",
";",
"hour",
"?",
":",
"string",
";",
"date",
"?",
":",
"string",
";",
"month",
"?",
":",
"string",
";",
"}",
")",
"=>",
"void",
";",
"}",
"export",
"const",
"CronYearly",
"=",
"(",
"{",
"minute",
",",
"minuteOptions",
",",
"hour",
",",
"hourOptions",
",",
"date",
",",
"dateOptions",
",",
"month",
",",
"monthOptions",
",",
"onChange",
",",
"}",
")",
"=>",
"(",
"<",
"Fragment",
">",
"<",
"EuiFormRow",
"label",
"=",
"{",
"<",
"FormattedMessage",
"id",
"=",
"\"esUi.cronEditor.cronYearly.fieldMonthLabel\"",
"defaultMessage",
"=",
"\"Month\"",
"/",
">",
"}",
"fullWidth",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyConfiguration\"",
">",
"<",
"EuiSelect",
"options",
"=",
"{",
"monthOptions",
"}",
"value",
"=",
"{",
"month",
"}",
"onChange",
"=",
"{",
"(",
"e",
")",
"=>",
"onChange",
"(",
"{",
"month",
":",
"e",
".",
"target",
".",
"value",
"}",
")",
"}",
"fullWidth",
"prepend",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronYearly.fieldMonth.textInLabel'",
",",
"{",
"defaultMessage",
":",
"'In'",
",",
"}",
")",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyYearlyMonthSelect\"",
"/",
">",
"<",
"/EuiFormRow>",
"<",
"EuiFormRow",
"label",
"=",
"{",
"<",
"FormattedMessage",
"id",
"=",
"\"esUi.cronEditor.cronYearly.fieldDateLabel\"",
"defaultMessage",
"=",
"\"Date\"",
"/",
">",
"}",
"fullWidth",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyConfiguration\"",
">",
"<",
"EuiSelect",
"options",
"=",
"{",
"dateOptions",
"}",
"value",
"=",
"{",
"date",
"}",
"onChange",
"=",
"{",
"(",
"e",
")",
"=>",
"onChange",
"(",
"{",
"date",
":",
"e",
".",
"target",
".",
"value",
"}",
")",
"}",
"fullWidth",
"prepend",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronYearly.fieldDate.textOnTheLabel'",
",",
"{",
"defaultMessage",
":",
"'On the'",
",",
"}",
")",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyYearlyDateSelect\"",
"/",
">",
"<",
"/EuiFormRow>",
"<",
"EuiFormRow",
"label",
"=",
"{",
"<",
"FormattedMessage",
"id",
"=",
"\"esUi.cronEditor.cronYearly.fieldTimeLabel\"",
"defaultMessage",
"=",
"\"Time\"",
"/",
">",
"}",
"fullWidth",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyConfiguration\"",
">",
"<",
"EuiFlexGroup",
"gutterSize",
"=",
"\"xs\"",
">",
"<",
"EuiFlexItem",
"grow",
"=",
"{",
"false",
"}",
">",
"<",
"EuiSelect",
"options",
"=",
"{",
"hourOptions",
"}",
"value",
"=",
"{",
"hour",
"}",
"aria",
"-",
"label",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronYearly.hourSelectLabel'",
",",
"{",
"defaultMessage",
":",
"'Hour'",
",",
"}",
")",
"}",
"onChange",
"=",
"{",
"(",
"e",
")",
"=>",
"onChange",
"(",
"{",
"hour",
":",
"e",
".",
"target",
".",
"value",
"}",
")",
"}",
"fullWidth",
"prepend",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronYearly.fieldHour.textAtLabel'",
",",
"{",
"defaultMessage",
":",
"'At'",
",",
"}",
")",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyYearlyHourSelect\"",
"/",
">",
"<",
"/EuiFlexItem>",
"<",
"EuiFlexItem",
">",
"<",
"EuiSelect",
"options",
"=",
"{",
"minuteOptions",
"}",
"value",
"=",
"{",
"minute",
"}",
"aria",
"-",
"label",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.cronYearly.minuteSelectLabel'",
",",
"{",
"defaultMessage",
":",
"'Minute'",
",",
"}",
")",
"}",
"onChange",
"=",
"{",
"(",
"e",
")",
"=>",
"onChange",
"(",
"{",
"minute",
":",
"e",
".",
"target",
".",
"value",
"}",
")",
"}",
"fullWidth",
"prepend",
"=",
"\":\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencyYearlyMinuteSelect\"",
"/",
">",
"<",
"/EuiFlexItem>",
"<",
"/EuiFlexGroup>",
"<",
"/EuiFormRow>",
"<",
"/Fragment>);"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
97,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
722 | [
"import",
"React",
",",
"{",
"Component",
",",
"Fragment",
"}",
"from",
"'react'",
";",
"import",
"{",
"FormattedMessage",
"}",
"from",
"'@kbn/i18n-react'",
";",
"import",
"{",
"i18n",
"}",
"from",
"'@kbn/i18n'",
";",
"import",
"{",
"EuiSelect",
",",
"EuiFormRow",
",",
"EuiSelectOption",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"{",
"Frequency",
",",
"Field",
",",
"FieldToValueMap",
"}",
"from",
"'./types'",
";",
"import",
"{",
"MINUTE_OPTIONS",
",",
"HOUR_OPTIONS",
",",
"DAY_OPTIONS",
",",
"DATE_OPTIONS",
",",
"MONTH_OPTIONS",
",",
"UNITS",
",",
"frequencyToFieldsMap",
",",
"frequencyToBaselineFieldsMap",
",",
"}",
"from",
"'./constants'",
";",
"import",
"{",
"cronExpressionToParts",
",",
"cronPartsToExpression",
"}",
"from",
"'./services'",
";",
"import",
"{",
"CronHourly",
"}",
"from",
"'./cron_hourly'",
";",
"import",
"{",
"CronDaily",
"}",
"from",
"'./cron_daily'",
";",
"import",
"{",
"CronWeekly",
"}",
"from",
"'./cron_weekly'",
";",
"import",
"{",
"CronMonthly",
"}",
"from",
"'./cron_monthly'",
";",
"import",
"{",
"CronYearly",
"}",
"from",
"'./cron_yearly'",
";",
"const",
"excludeBlockListedFrequencies",
"=",
"(",
"units",
",",
"blockListedUnits",
"=",
"[",
"]",
")",
":",
"EuiSelectOption",
"[",
"]",
"=>",
"{",
"if",
"(",
"blockListedUnits",
".",
"length",
"===",
"0",
")",
"{",
"return",
"units",
";",
"}",
"return",
"units",
".",
"filter",
"(",
"(",
"{",
"value",
"}",
")",
"=>",
"!",
"blockListedUnits",
".",
"includes",
"(",
"value",
"as",
"string",
")",
")",
";",
"}",
";",
"interface",
"Props",
"{",
"frequencyBlockList",
"?",
":",
"string",
"[",
"]",
";",
"fieldToPreferredValueMap",
":",
"FieldToValueMap",
";",
"frequency",
":",
"Frequency",
";",
"cronExpression",
":",
"string",
";",
"onChange",
":",
"(",
"{",
"cronExpression",
",",
"fieldToPreferredValueMap",
",",
"frequency",
",",
"}",
":",
"{",
"cronExpression",
":",
"string",
";",
"fieldToPreferredValueMap",
":",
"FieldToValueMap",
";",
"frequency",
":",
"Frequency",
";",
"}",
")",
"=>",
"void",
";",
"autoFocus",
"?",
":",
"boolean",
";",
"}",
"type",
"State",
"=",
"FieldToValueMap",
";",
"export",
"class",
"CronEditor",
"extends",
"Component",
"<",
"Props",
",",
"State",
">",
"{",
"static",
"getDerivedStateFromProps",
"(",
"props",
")",
"{",
"const",
"{",
"cronExpression",
"}",
"=",
"props",
";",
"return",
"cronExpressionToParts",
"(",
"cronExpression",
")",
";",
"}",
"constructor",
"(",
"props",
")",
"{",
"super",
"(",
"props",
")",
";",
"const",
"{",
"cronExpression",
"}",
"=",
"props",
";",
"const",
"parsedCron",
"=",
"cronExpressionToParts",
"(",
"cronExpression",
")",
";",
"this",
".",
"state",
"=",
"{",
"...",
"parsedCron",
",",
"}",
";",
"}",
"onChangeFrequency",
"=",
"(",
"frequency",
")",
"=>",
"{",
"const",
"{",
"onChange",
",",
"fieldToPreferredValueMap",
"}",
"=",
"this",
".",
"props",
";",
"const",
"editableFields",
"=",
"Object",
".",
"keys",
"(",
"frequencyToFieldsMap",
"[",
"frequency",
"]",
")",
"as",
"Field",
"[",
"]",
";",
"const",
"inheritedFields",
"=",
"editableFields",
".",
"reduce",
"<",
"FieldToValueMap",
">",
"(",
"(",
"fieldBaselines",
",",
"field",
")",
"=>",
"{",
"if",
"(",
"fieldToPreferredValueMap",
"[",
"field",
"]",
"!=",
"null",
")",
"{",
"fieldBaselines",
"[",
"field",
"]",
"=",
"fieldToPreferredValueMap",
"[",
"field",
"]",
";",
"}",
"return",
"fieldBaselines",
";",
"}",
",",
"{",
"...",
"frequencyToBaselineFieldsMap",
"[",
"frequency",
"]",
"}",
")",
";",
"const",
"newCronExpression",
"=",
"cronPartsToExpression",
"(",
"inheritedFields",
")",
";",
"onChange",
"(",
"{",
"frequency",
",",
"cronExpression",
":",
"newCronExpression",
",",
"fieldToPreferredValueMap",
",",
"}",
")",
";",
"}",
";",
"onChangeFields",
"=",
"(",
"fields",
")",
"=>",
"{",
"const",
"{",
"onChange",
",",
"frequency",
",",
"fieldToPreferredValueMap",
"}",
"=",
"this",
".",
"props",
";",
"const",
"editableFields",
"=",
"Object",
".",
"keys",
"(",
"frequencyToFieldsMap",
"[",
"frequency",
"]",
")",
"as",
"Field",
"[",
"]",
";",
"const",
"newFieldToPreferredValueMap",
"=",
"{",
"}",
";",
"const",
"editedFields",
"=",
"editableFields",
".",
"reduce",
"<",
"FieldToValueMap",
">",
"(",
"(",
"accumFields",
",",
"field",
")",
"=>",
"{",
"if",
"(",
"fields",
"[",
"field",
"]",
"!==",
"undefined",
")",
"{",
"accumFields",
"[",
"field",
"]",
"=",
"fields",
"[",
"field",
"]",
";",
"newFieldToPreferredValueMap",
"[",
"field",
"]",
"=",
"fields",
"[",
"field",
"]",
";",
"}",
"else",
"{",
"accumFields",
"[",
"field",
"]",
"=",
"this",
".",
"state",
"[",
"field",
"]",
";",
"}",
"return",
"accumFields",
";",
"}",
",",
"{",
"...",
"frequencyToBaselineFieldsMap",
"[",
"frequency",
"]",
"}",
")",
";",
"const",
"newCronExpression",
"=",
"cronPartsToExpression",
"(",
"editedFields",
")",
";",
"onChange",
"(",
"{",
"frequency",
",",
"cronExpression",
":",
"newCronExpression",
",",
"fieldToPreferredValueMap",
":",
"{",
"...",
"fieldToPreferredValueMap",
",",
"...",
"newFieldToPreferredValueMap",
",",
"}",
",",
"}",
")",
";",
"}",
";",
"renderForm",
"(",
")",
"{",
"const",
"{",
"frequency",
"}",
"=",
"this",
".",
"props",
";",
"const",
"{",
"minute",
",",
"hour",
",",
"day",
",",
"date",
",",
"month",
"}",
"=",
"this",
".",
"state",
";",
"switch",
"(",
"frequency",
")",
"{",
"case",
"'MINUTE'",
":",
"return",
";",
"case",
"'HOUR'",
":",
"return",
"(",
"<",
"CronHourly",
"minute",
"=",
"{",
"minute",
"}",
"minuteOptions",
"=",
"{",
"MINUTE_OPTIONS",
"}",
"onChange",
"=",
"{",
"this",
".",
"onChangeFields",
"}",
"/",
">",
")",
";",
"case",
"'DAY'",
":",
"return",
"(",
"<",
"CronDaily",
"minute",
"=",
"{",
"minute",
"}",
"minuteOptions",
"=",
"{",
"MINUTE_OPTIONS",
"}",
"hour",
"=",
"{",
"hour",
"}",
"hourOptions",
"=",
"{",
"HOUR_OPTIONS",
"}",
"onChange",
"=",
"{",
"this",
".",
"onChangeFields",
"}",
"/",
">",
")",
";",
"case",
"'WEEK'",
":",
"return",
"(",
"<",
"CronWeekly",
"minute",
"=",
"{",
"minute",
"}",
"minuteOptions",
"=",
"{",
"MINUTE_OPTIONS",
"}",
"hour",
"=",
"{",
"hour",
"}",
"hourOptions",
"=",
"{",
"HOUR_OPTIONS",
"}",
"day",
"=",
"{",
"day",
"}",
"dayOptions",
"=",
"{",
"DAY_OPTIONS",
"}",
"onChange",
"=",
"{",
"this",
".",
"onChangeFields",
"}",
"/",
">",
")",
";",
"case",
"'MONTH'",
":",
"return",
"(",
"<",
"CronMonthly",
"minute",
"=",
"{",
"minute",
"}",
"minuteOptions",
"=",
"{",
"MINUTE_OPTIONS",
"}",
"hour",
"=",
"{",
"hour",
"}",
"hourOptions",
"=",
"{",
"HOUR_OPTIONS",
"}",
"date",
"=",
"{",
"date",
"}",
"dateOptions",
"=",
"{",
"DATE_OPTIONS",
"}",
"onChange",
"=",
"{",
"this",
".",
"onChangeFields",
"}",
"/",
">",
")",
";",
"case",
"'YEAR'",
":",
"return",
"(",
"<",
"CronYearly",
"minute",
"=",
"{",
"minute",
"}",
"minuteOptions",
"=",
"{",
"MINUTE_OPTIONS",
"}",
"hour",
"=",
"{",
"hour",
"}",
"hourOptions",
"=",
"{",
"HOUR_OPTIONS",
"}",
"date",
"=",
"{",
"date",
"}",
"dateOptions",
"=",
"{",
"DATE_OPTIONS",
"}",
"month",
"=",
"{",
"month",
"}",
"monthOptions",
"=",
"{",
"MONTH_OPTIONS",
"}",
"onChange",
"=",
"{",
"this",
".",
"onChangeFields",
"}",
"/",
">",
")",
";",
"default",
":",
"return",
";",
"}",
"}",
"render",
"(",
")",
"{",
"const",
"{",
"frequency",
",",
"frequencyBlockList",
"}",
"=",
"this",
".",
"props",
";",
"return",
"(",
"<",
"Fragment",
">",
"<",
"EuiFormRow",
"label",
"=",
"{",
"<",
"FormattedMessage",
"id",
"=",
"\"esUi.cronEditor.fieldFrequencyLabel\"",
"defaultMessage",
"=",
"\"Frequency\"",
"/",
">",
"}",
"fullWidth",
">",
"<",
"EuiSelect",
"autoFocus",
"=",
"{",
"this",
".",
"props",
".",
"autoFocus",
"}",
"options",
"=",
"{",
"excludeBlockListedFrequencies",
"(",
"UNITS",
",",
"frequencyBlockList",
")",
"}",
"value",
"=",
"{",
"frequency",
"}",
"onChange",
"=",
"{",
"(",
"e",
")",
"=>",
"this",
".",
"onChangeFrequency",
"(",
"e",
".",
"target",
".",
"value",
"as",
"Frequency",
")",
"}",
"fullWidth",
"prepend",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.cronEditor.textEveryLabel'",
",",
"{",
"defaultMessage",
":",
"'Every'",
",",
"}",
")",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cronFrequencySelect\"",
"/",
">",
"<",
"/EuiFormRow>",
"{",
"this",
".",
"renderForm",
"(",
")",
"}",
"<",
"/Fragment>);",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
5,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
32,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
32,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7257,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
42368,
null,
null,
null,
null,
null,
null,
null,
null,
null,
42368,
null,
254,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
42368,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
42368,
null,
null,
null,
null,
null,
42368,
null,
null,
null,
null,
null,
null,
null,
null,
null,
42368,
null,
254,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
723 | [
"import",
"{",
"INDEX_ILLEGAL_CHARACTERS_VISIBLE",
"}",
"from",
"'../constants'",
";",
"export",
"function",
"indexNameBeginsWithPeriod",
"(",
"indexName",
"?",
")",
"{",
"if",
"(",
"indexName",
"===",
"undefined",
")",
"{",
"return",
"false",
";",
"}",
"return",
"indexName",
"[",
"0",
"]",
"===",
"'.'",
";",
"}",
"export",
"function",
"findIllegalCharactersInIndexName",
"(",
"indexName",
")",
"{",
"const",
"illegalCharacters",
"=",
"INDEX_ILLEGAL_CHARACTERS_VISIBLE",
".",
"reduce",
"(",
"(",
"chars",
",",
"char",
")",
":",
"string",
"[",
"]",
"=>",
"{",
"if",
"(",
"indexName",
".",
"includes",
"(",
"char",
")",
")",
"{",
"chars",
".",
"push",
"(",
"char",
")",
";",
"}",
"return",
"chars",
";",
"}",
",",
"[",
"]",
")",
";",
"return",
"illegalCharacters",
";",
"}",
"export",
"function",
"indexNameContainsSpaces",
"(",
"indexName",
")",
"{",
"return",
"indexName",
".",
"includes",
"(",
"' '",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
724 | [
"import",
"{",
"INDEX_ILLEGAL_CHARACTERS_VISIBLE",
"}",
"from",
"'./constants'",
";",
"import",
"{",
"indexNameBeginsWithPeriod",
",",
"findIllegalCharactersInIndexName",
",",
"indexNameContainsSpaces",
",",
"}",
"from",
"'./validate'",
";",
"export",
"const",
"indices",
"=",
"{",
"INDEX_ILLEGAL_CHARACTERS_VISIBLE",
",",
"indexNameBeginsWithPeriod",
",",
"findIllegalCharactersInIndexName",
",",
"indexNameContainsSpaces",
",",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
725 | [
"import",
"{",
"parse",
",",
"ParsedQuery",
"}",
"from",
"'query-string'",
";",
"export",
"function",
"extractQueryParams",
"(",
"queryString",
"=",
"''",
")",
"{",
"const",
"hrefSplit",
"=",
"queryString",
".",
"split",
"(",
"'?'",
")",
";",
"if",
"(",
"!",
"hrefSplit",
".",
"length",
")",
"{",
"return",
"{",
"}",
";",
"}",
"return",
"parse",
"(",
"hrefSplit",
"[",
"1",
"]",
",",
"{",
"sort",
":",
"false",
"}",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
1897,
null,
2,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
726 | [
"export",
"const",
"attemptToURIDecode",
"=",
"(",
"value",
"?",
")",
":",
"string",
"|",
"undefined",
"=>",
"{",
"let",
"result",
"=",
"value",
";",
"try",
"{",
"result",
"=",
"value",
"?",
"decodeURIComponent",
"(",
"value",
")",
":",
"value",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"}",
"return",
"result",
";",
"}",
";"
] | [
null,
null,
2,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
727 | [
"/**\n * Create a namespace for Forms\n * In the future, each top level folder should be exported like that to avoid naming collision\n */",
"import",
"*",
"as",
"Forms",
"from",
"'./forms'",
";",
"import",
"*",
"as",
"ace",
"from",
"'./ace'",
";",
"import",
"*",
"as",
"GlobalFlyout",
"from",
"'./global_flyout'",
";",
"import",
"*",
"as",
"XJson",
"from",
"'./xjson'",
";",
"export",
"type",
"{",
"OnJsonEditorUpdateHandler",
",",
"JsonEditorState",
"}",
"from",
"'./components/json_editor'",
";",
"export",
"{",
"JsonEditor",
"}",
"from",
"'./components/json_editor'",
";",
"export",
"{",
"PageLoading",
"}",
"from",
"'./components/page_loading'",
";",
"export",
"{",
"SectionLoading",
"}",
"from",
"'./components/section_loading'",
";",
"export",
"type",
"{",
"EuiCodeEditorProps",
"}",
"from",
"'./components/code_editor'",
";",
"export",
"{",
"EuiCodeEditor",
"}",
"from",
"'./components/code_editor'",
";",
"export",
"type",
"{",
"Frequency",
"}",
"from",
"'./components/cron_editor'",
";",
"export",
"{",
"CronEditor",
"}",
"from",
"'./components/cron_editor'",
";",
"export",
"type",
"{",
"SendRequestConfig",
",",
"SendRequestResponse",
",",
"UseRequestConfig",
",",
"UseRequestResponse",
",",
"}",
"from",
"'./request'",
";",
"export",
"{",
"sendRequest",
",",
"useRequest",
"}",
"from",
"'./request'",
";",
"export",
"{",
"indices",
"}",
"from",
"'./indices'",
";",
"export",
"type",
"{",
"Privileges",
",",
"MissingPrivileges",
",",
"Error",
",",
"Authorization",
"}",
"from",
"'./authorization'",
";",
"export",
"{",
"AuthorizationContext",
",",
"AuthorizationProvider",
",",
"NotAuthorizedSection",
",",
"WithPrivileges",
",",
"SectionError",
",",
"PageError",
",",
"useAuthorizationContext",
",",
"}",
"from",
"'./authorization'",
";",
"export",
"{",
"Forms",
",",
"ace",
",",
"GlobalFlyout",
",",
"XJson",
"}",
";",
"export",
"{",
"extractQueryParams",
",",
"attemptToURIDecode",
"}",
"from",
"'./url'",
";",
"/** dummy plugin, we just want esUiShared to have its own bundle */",
"export",
"function",
"plugin",
"(",
")",
"{",
"return",
"new",
"(",
"class",
"EsUiSharedPlugin",
"{",
"setup",
"(",
")",
"{",
"}",
"start",
"(",
")",
"{",
"}",
"}",
")",
"(",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
728 | [
"import",
"React",
"from",
"'react'",
";",
"import",
"{",
"mount",
",",
"ReactWrapper",
"}",
"from",
"'enzyme'",
";",
"import",
"EuiCodeEditor",
"from",
"'./code_editor'",
";",
"import",
"{",
"keys",
"}",
"from",
"'@elastic/eui/lib/services'",
";",
"import",
"{",
"findTestSubject",
",",
"requiredProps",
",",
"takeMountedSnapshot",
"}",
"from",
"'@elastic/eui/lib/test'",
";",
"describe",
"(",
"'EuiCodeEditor'",
",",
"(",
")",
"=>",
"{",
"test",
"(",
"'is rendered'",
",",
"(",
")",
"=>",
"{",
"const",
"component",
"=",
"mount",
"(",
"<",
"EuiCodeEditor",
"{",
"...",
"requiredProps",
"}",
"/",
">",
")",
";",
"expect",
"(",
"takeMountedSnapshot",
"(",
"component",
")",
")",
".",
"toMatchSnapshot",
"(",
")",
";",
"}",
")",
";",
"describe",
"(",
"'props'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'isReadOnly'",
",",
"(",
")",
"=>",
"{",
"test",
"(",
"'renders alternate hint text'",
",",
"(",
")",
"=>",
"{",
"const",
"component",
"=",
"mount",
"(",
"<",
"EuiCodeEditor",
"isReadOnly",
"/",
">",
")",
";",
"expect",
"(",
"takeMountedSnapshot",
"(",
"component",
")",
")",
".",
"toMatchSnapshot",
"(",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'theme'",
",",
"(",
")",
"=>",
"{",
"test",
"(",
"'renders terminal theme'",
",",
"(",
")",
"=>",
"{",
"const",
"component",
"=",
"mount",
"(",
"<",
"EuiCodeEditor",
"theme",
"=",
"\"terminal\"",
"/",
">",
")",
";",
"expect",
"(",
"takeMountedSnapshot",
"(",
"component",
")",
")",
".",
"toMatchSnapshot",
"(",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'aria attributes'",
",",
"(",
")",
"=>",
"{",
"test",
"(",
"'allows setting aria-labelledby on textbox'",
",",
"(",
")",
"=>",
"{",
"const",
"component",
"=",
"mount",
"(",
"<",
"EuiCodeEditor",
"aria",
"-",
"labelledby",
"=",
"\"labelledbyid\"",
"/",
">",
")",
";",
"expect",
"(",
"takeMountedSnapshot",
"(",
"component",
")",
")",
".",
"toMatchSnapshot",
"(",
")",
";",
"}",
")",
";",
"test",
"(",
"'allows setting aria-describedby on textbox'",
",",
"(",
")",
"=>",
"{",
"const",
"component",
"=",
"mount",
"(",
"<",
"EuiCodeEditor",
"aria",
"-",
"describedby",
"=",
"\"describedbyid\"",
"/",
">",
")",
";",
"expect",
"(",
"takeMountedSnapshot",
"(",
"component",
")",
")",
".",
"toMatchSnapshot",
"(",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'behavior'",
",",
"(",
")",
"=>",
"{",
"let",
"component",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"const",
"container",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"document",
".",
"body",
".",
"appendChild",
"(",
"container",
")",
";",
"component",
"=",
"mount",
"(",
"<",
"EuiCodeEditor",
"/>, { attachTo: container });",
"}",
")",
";",
"afterEach",
"(",
"(",
")",
"=>",
"{",
"if",
"(",
"component",
")",
"{",
"component",
".",
"unmount",
"(",
")",
";",
"}",
"}",
")",
";",
"describe",
"(",
"'hint element'",
",",
"(",
")",
"=>",
"{",
"test",
"(",
"'should be tabable'",
",",
"(",
")",
"=>",
"{",
"const",
"hint",
"=",
"findTestSubject",
"(",
"component",
",",
"'codeEditorHint'",
")",
".",
"getDOMNode",
"(",
")",
";",
"expect",
"(",
"hint",
")",
".",
"toMatchSnapshot",
"(",
")",
";",
"}",
")",
";",
"test",
"(",
"'should be disabled when the ui ace box gains focus'",
",",
"(",
")",
"=>",
"{",
"const",
"hint",
"=",
"findTestSubject",
"(",
"component",
",",
"'codeEditorHint'",
")",
";",
"hint",
".",
"simulate",
"(",
"'keyup'",
",",
"{",
"key",
":",
"keys",
".",
"ENTER",
"}",
")",
";",
"expect",
"(",
"findTestSubject",
"(",
"component",
",",
"'codeEditorHint'",
")",
".",
"getDOMNode",
"(",
")",
")",
".",
"toMatchSnapshot",
"(",
")",
";",
"}",
")",
";",
"test",
"(",
"'should be enabled when the ui ace box loses focus'",
",",
"(",
")",
"=>",
"{",
"const",
"hint",
"=",
"findTestSubject",
"(",
"component",
",",
"'codeEditorHint'",
")",
";",
"hint",
".",
"simulate",
"(",
"'keyup'",
",",
"{",
"key",
":",
"keys",
".",
"ENTER",
"}",
")",
";",
"component",
".",
"instance",
"(",
")",
".",
"onBlurAce",
"(",
")",
";",
"expect",
"(",
"findTestSubject",
"(",
"component",
",",
"'codeEditorHint'",
")",
".",
"getDOMNode",
"(",
")",
")",
".",
"toMatchSnapshot",
"(",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'interaction'",
",",
"(",
")",
"=>",
"{",
"test",
"(",
"'bluring the ace textbox should call a passed onBlur prop'",
",",
"(",
")",
"=>",
"{",
"const",
"blurSpy",
"=",
"jest",
".",
"fn",
"(",
")",
".",
"mockName",
"(",
"'blurSpy'",
")",
";",
"const",
"el",
"=",
"mount",
"(",
"<",
"EuiCodeEditor",
"onBlur",
"=",
"{",
"blurSpy",
"}",
"/",
">",
")",
";",
"el",
".",
"instance",
"(",
")",
".",
"onBlurAce",
"(",
")",
";",
"expect",
"(",
"blurSpy",
")",
".",
"toHaveBeenCalled",
"(",
")",
";",
"}",
")",
";",
"test",
"(",
"'pressing escape in ace textbox will enable overlay'",
",",
"(",
")",
"=>",
"{",
"component",
".",
"instance",
"(",
")",
".",
"onFocusAce",
"(",
")",
";",
"component",
".",
"instance",
"(",
")",
".",
"onKeydownAce",
"(",
"{",
"preventDefault",
":",
"(",
")",
"=>",
"{",
"}",
",",
"stopPropagation",
":",
"(",
")",
"=>",
"{",
"}",
",",
"key",
":",
"keys",
".",
"ESCAPE",
",",
"}",
")",
";",
"const",
"hint",
"=",
"findTestSubject",
"(",
"component",
",",
"'codeEditorHint'",
")",
".",
"getDOMNode",
"(",
")",
";",
"expect",
"(",
"hint",
")",
".",
"toBe",
"(",
"document",
".",
"activeElement",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
111,
null,
null,
null,
null,
null,
null,
null,
null,
39,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
729 | [
"import",
"React",
"from",
"'react'",
";",
"import",
"sinon",
"from",
"'sinon'",
";",
"import",
"{",
"findTestSubject",
"}",
"from",
"'@elastic/eui/lib/test'",
";",
"import",
"{",
"mountWithI18nProvider",
"}",
"from",
"'@kbn/test/jest'",
";",
"import",
"{",
"Frequency",
"}",
"from",
"'./types'",
";",
"import",
"{",
"CronEditor",
"}",
"from",
"'./cron_editor'",
";",
"describe",
"(",
"'CronEditor'",
",",
"(",
")",
"=>",
"{",
"[",
"'MINUTE'",
",",
"'HOUR'",
",",
"'DAY'",
",",
"'WEEK'",
",",
"'MONTH'",
",",
"'YEAR'",
"]",
".",
"forEach",
"(",
"(",
"unit",
")",
"=>",
"{",
"test",
"(",
"`is rendered with a ${",
"unit",
"} frequency`",
",",
"(",
")",
"=>",
"{",
"const",
"component",
"=",
"mountWithI18nProvider",
"(",
"<",
"CronEditor",
"fieldToPreferredValueMap",
"=",
"{",
"{",
"}",
"}",
"frequency",
"=",
"{",
"unit",
"as",
"Frequency",
"}",
"cronExpression",
"=",
"\"0 10 * * * ?\"",
"onChange",
"=",
"{",
"(",
")",
"=>",
"{",
"}",
"}",
"/>);",
"expect",
"(",
"component",
")",
".",
"toMatchSnapshot",
"(",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'props'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'frequencyBlockList'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'excludes the blocked frequencies from the frequency list'",
",",
"(",
")",
"=>",
"{",
"const",
"component",
"=",
"mountWithI18nProvider",
"(",
"<",
"CronEditor",
"frequencyBlockList",
"=",
"{",
"[",
"'HOUR'",
",",
"'WEEK'",
",",
"'YEAR'",
"]",
"}",
"fieldToPreferredValueMap",
"=",
"{",
"{",
"}",
"}",
"frequency",
"=",
"{",
"'WEEK'",
"}",
"cronExpression",
"=",
"\"0 10 * * * ?\"",
"onChange",
"=",
"{",
"(",
")",
"=>",
"{",
"}",
"}",
"/>);",
"const",
"frequencySelect",
"=",
"findTestSubject",
"(",
"component",
",",
"'cronFrequencySelect'",
")",
";",
"expect",
"(",
"frequencySelect",
".",
"text",
"(",
")",
")",
".",
"toBe",
"(",
"'minutedaymonth'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'cronExpression'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'sets the values of the fields'",
",",
"(",
")",
"=>",
"{",
"const",
"component",
"=",
"mountWithI18nProvider",
"(",
"<",
"CronEditor",
"fieldToPreferredValueMap",
"=",
"{",
"{",
"}",
"}",
"frequency",
"=",
"{",
"'YEAR'",
"}",
"cronExpression",
"=",
"\"0 20 10 5 2 ?\"",
"onChange",
"=",
"{",
"(",
")",
"=>",
"{",
"}",
"}",
"/>);",
"const",
"monthSelect",
"=",
"findTestSubject",
"(",
"component",
",",
"'cronFrequencyYearlyMonthSelect'",
")",
";",
"expect",
"(",
"monthSelect",
".",
"props",
"(",
")",
".",
"value",
")",
".",
"toBe",
"(",
"'2'",
")",
";",
"const",
"dateSelect",
"=",
"findTestSubject",
"(",
"component",
",",
"'cronFrequencyYearlyDateSelect'",
")",
";",
"expect",
"(",
"dateSelect",
".",
"props",
"(",
")",
".",
"value",
")",
".",
"toBe",
"(",
"'5'",
")",
";",
"const",
"hourSelect",
"=",
"findTestSubject",
"(",
"component",
",",
"'cronFrequencyYearlyHourSelect'",
")",
";",
"expect",
"(",
"hourSelect",
".",
"props",
"(",
")",
".",
"value",
")",
".",
"toBe",
"(",
"'10'",
")",
";",
"const",
"minuteSelect",
"=",
"findTestSubject",
"(",
"component",
",",
"'cronFrequencyYearlyMinuteSelect'",
")",
";",
"expect",
"(",
"minuteSelect",
".",
"props",
"(",
")",
".",
"value",
")",
".",
"toBe",
"(",
"'20'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'onChange'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'is called when the frequency changes'",
",",
"(",
")",
"=>",
"{",
"const",
"onChangeSpy",
"=",
"sinon",
".",
"spy",
"(",
")",
";",
"const",
"component",
"=",
"mountWithI18nProvider",
"(",
"<",
"CronEditor",
"fieldToPreferredValueMap",
"=",
"{",
"{",
"}",
"}",
"frequency",
"=",
"{",
"'YEAR'",
"}",
"cronExpression",
"=",
"\"0 10 * * * ?\"",
"onChange",
"=",
"{",
"onChangeSpy",
"}",
"/",
">",
")",
";",
"const",
"frequencySelect",
"=",
"findTestSubject",
"(",
"component",
",",
"'cronFrequencySelect'",
")",
";",
"frequencySelect",
".",
"simulate",
"(",
"'change'",
",",
"{",
"target",
":",
"{",
"value",
":",
"'MONTH'",
"}",
"}",
")",
";",
"sinon",
".",
"assert",
".",
"calledWith",
"(",
"onChangeSpy",
",",
"{",
"cronExpression",
":",
"'0 0 0 1 * ?'",
",",
"fieldToPreferredValueMap",
":",
"{",
"}",
",",
"frequency",
":",
"'MONTH'",
",",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"`is called when a field's value changes`",
",",
"(",
")",
"=>",
"{",
"const",
"onChangeSpy",
"=",
"sinon",
".",
"spy",
"(",
")",
";",
"const",
"component",
"=",
"mountWithI18nProvider",
"(",
"<",
"CronEditor",
"fieldToPreferredValueMap",
"=",
"{",
"{",
"}",
"}",
"frequency",
"=",
"{",
"'YEAR'",
"}",
"cronExpression",
"=",
"\"0 10 * * * ?\"",
"onChange",
"=",
"{",
"onChangeSpy",
"}",
"/",
">",
")",
";",
"const",
"minuteSelect",
"=",
"findTestSubject",
"(",
"component",
",",
"'cronFrequencyYearlyMinuteSelect'",
")",
";",
"minuteSelect",
".",
"simulate",
"(",
"'change'",
",",
"{",
"target",
":",
"{",
"value",
":",
"'40'",
"}",
"}",
")",
";",
"sinon",
".",
"assert",
".",
"calledWith",
"(",
"onChangeSpy",
",",
"{",
"cronExpression",
":",
"'0 40 * * * ?'",
",",
"fieldToPreferredValueMap",
":",
"{",
"minute",
":",
"'40'",
"}",
",",
"frequency",
":",
"'YEAR'",
",",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
730 | [
"import",
"{",
"INDEX_ILLEGAL_CHARACTERS_VISIBLE",
"}",
"from",
"'../constants'",
";",
"import",
"{",
"indexNameBeginsWithPeriod",
",",
"findIllegalCharactersInIndexName",
",",
"indexNameContainsSpaces",
",",
"}",
"from",
"'./validate_index'",
";",
"describe",
"(",
"'Index name validation'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'should not allow name to begin with a period'",
",",
"(",
")",
"=>",
"{",
"const",
"beginsWithPeriod",
"=",
"indexNameBeginsWithPeriod",
"(",
"'.system_index'",
")",
";",
"expect",
"(",
"beginsWithPeriod",
")",
".",
"toBe",
"(",
"true",
")",
";",
"}",
")",
";",
"it",
"(",
"'should not allow space in the name'",
",",
"(",
")",
"=>",
"{",
"const",
"containsSpaces",
"=",
"indexNameContainsSpaces",
"(",
"'my name'",
")",
";",
"expect",
"(",
"containsSpaces",
")",
".",
"toBe",
"(",
"true",
")",
";",
"}",
")",
";",
"it",
"(",
"'should not allow illegal characters'",
",",
"(",
")",
"=>",
"{",
"INDEX_ILLEGAL_CHARACTERS_VISIBLE",
".",
"forEach",
"(",
"(",
"char",
")",
"=>",
"{",
"const",
"illegalCharacters",
"=",
"findIllegalCharactersInIndexName",
"(",
"`name${",
"char",
"}`",
")",
";",
"expect",
"(",
"illegalCharacters",
")",
".",
"toEqual",
"(",
"[",
"char",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
731 | [
"import",
"sinon",
"from",
"'sinon'",
";",
"import",
"{",
"HttpSetup",
",",
"HttpFetchOptions",
"}",
"from",
"'../../../../../src/core/public'",
";",
"import",
"{",
"SendRequestConfig",
",",
"SendRequestResponse",
",",
"sendRequest",
"as",
"originalSendRequest",
",",
"}",
"from",
"'./send_request'",
";",
"export",
"interface",
"SendRequestHelpers",
"{",
"getSendRequestSpy",
":",
"(",
")",
"=>",
"sinon",
".",
"SinonStub",
";",
"sendSuccessRequest",
":",
"(",
")",
"=>",
"Promise",
"<",
"SendRequestResponse",
">",
";",
"getSuccessResponse",
":",
"(",
")",
"=>",
"SendRequestResponse",
";",
"sendErrorRequest",
":",
"(",
")",
"=>",
"Promise",
"<",
"SendRequestResponse",
">",
";",
"getErrorResponse",
":",
"(",
")",
"=>",
"SendRequestResponse",
";",
"}",
"const",
"successRequest",
"=",
"{",
"method",
":",
"'post'",
",",
"path",
":",
"'/success'",
",",
"body",
":",
"{",
"}",
"}",
";",
"const",
"successResponse",
"=",
"{",
"statusCode",
":",
"200",
",",
"data",
":",
"{",
"message",
":",
"'Success message'",
"}",
"}",
";",
"const",
"errorValue",
"=",
"{",
"statusCode",
":",
"400",
",",
"statusText",
":",
"'Error message'",
"}",
";",
"const",
"errorRequest",
"=",
"{",
"method",
":",
"'post'",
",",
"path",
":",
"'/error'",
",",
"body",
":",
"{",
"}",
"}",
";",
"const",
"errorResponse",
"=",
"{",
"response",
":",
"{",
"data",
":",
"errorValue",
"}",
"}",
";",
"export",
"const",
"createSendRequestHelpers",
"=",
"(",
")",
":",
"SendRequestHelpers",
"=>",
"{",
"const",
"sendRequestSpy",
"=",
"sinon",
".",
"stub",
"(",
")",
";",
"const",
"httpClient",
"=",
"{",
"post",
":",
"(",
"path",
",",
"options",
")",
"=>",
"sendRequestSpy",
"(",
"path",
",",
"options",
")",
",",
"}",
";",
"const",
"sendRequest",
"=",
"originalSendRequest",
".",
"bind",
"(",
"null",
",",
"httpClient",
"as",
"HttpSetup",
")",
"as",
"<",
"D",
"=",
"any",
",",
"E",
"=",
"any",
">",
"(",
"config",
":",
"SendRequestConfig",
")",
"=>",
"Promise",
"<",
"SendRequestResponse",
"<",
"D",
",",
"E",
">",
">",
";",
"sendRequestSpy",
".",
"withArgs",
"(",
"successRequest",
".",
"path",
",",
"sinon",
".",
"match",
"(",
"{",
"body",
":",
"JSON",
".",
"stringify",
"(",
"successRequest",
".",
"body",
")",
",",
"query",
":",
"undefined",
",",
"}",
")",
")",
".",
"resolves",
"(",
"successResponse",
")",
";",
"const",
"sendSuccessRequest",
"=",
"(",
")",
"=>",
"sendRequest",
"(",
"{",
"...",
"successRequest",
"}",
")",
";",
"const",
"getSuccessResponse",
"=",
"(",
")",
"=>",
"(",
"{",
"data",
":",
"successResponse",
".",
"data",
",",
"error",
":",
"null",
"}",
")",
";",
"sendRequestSpy",
".",
"withArgs",
"(",
"errorRequest",
".",
"path",
",",
"sinon",
".",
"match",
"(",
"{",
"body",
":",
"JSON",
".",
"stringify",
"(",
"errorRequest",
".",
"body",
")",
",",
"query",
":",
"undefined",
",",
"}",
")",
")",
".",
"rejects",
"(",
"errorResponse",
")",
";",
"const",
"sendErrorRequest",
"=",
"(",
")",
"=>",
"sendRequest",
"(",
"{",
"...",
"errorRequest",
"}",
")",
";",
"const",
"getErrorResponse",
"=",
"(",
")",
"=>",
"(",
"{",
"data",
":",
"null",
",",
"error",
":",
"errorResponse",
".",
"response",
".",
"data",
",",
"}",
")",
";",
"return",
"{",
"getSendRequestSpy",
":",
"(",
")",
"=>",
"sendRequestSpy",
",",
"sendSuccessRequest",
",",
"getSuccessResponse",
",",
"sendErrorRequest",
",",
"getErrorResponse",
",",
"}",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29918,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29918,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
2,
null,
24284,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
732 | [
"import",
"sinon",
"from",
"'sinon'",
";",
"import",
"{",
"SendRequestHelpers",
",",
"createSendRequestHelpers",
"}",
"from",
"'./send_request.test.helpers'",
";",
"describe",
"(",
"'sendRequest function'",
",",
"(",
")",
"=>",
"{",
"let",
"helpers",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"helpers",
"=",
"createSendRequestHelpers",
"(",
")",
";",
"}",
")",
";",
"it",
"(",
"'uses the provided path, method, and body to send the request'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"sendSuccessRequest",
",",
"getSendRequestSpy",
",",
"getSuccessResponse",
"}",
"=",
"helpers",
";",
"const",
"response",
"=",
"await",
"sendSuccessRequest",
"(",
")",
";",
"sinon",
".",
"assert",
".",
"calledOnce",
"(",
"getSendRequestSpy",
"(",
")",
")",
";",
"expect",
"(",
"response",
")",
".",
"toEqual",
"(",
"getSuccessResponse",
"(",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'surfaces errors'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"sendErrorRequest",
",",
"getSendRequestSpy",
",",
"getErrorResponse",
"}",
"=",
"helpers",
";",
"const",
"error",
"=",
"await",
"sendErrorRequest",
"(",
")",
";",
"sinon",
".",
"assert",
".",
"calledOnce",
"(",
"getSendRequestSpy",
"(",
")",
")",
";",
"expect",
"(",
"error",
")",
".",
"toEqual",
"(",
"getErrorResponse",
"(",
")",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
733 | [
"import",
"React",
",",
"{",
"useState",
",",
"useEffect",
"}",
"from",
"'react'",
";",
"import",
"{",
"act",
"}",
"from",
"'react-dom/test-utils'",
";",
"import",
"{",
"mount",
",",
"ReactWrapper",
"}",
"from",
"'enzyme'",
";",
"import",
"sinon",
"from",
"'sinon'",
";",
"import",
"{",
"HttpSetup",
",",
"HttpFetchOptions",
"}",
"from",
"'../../../../../src/core/public'",
";",
"import",
"{",
"SendRequestConfig",
",",
"SendRequestResponse",
"}",
"from",
"'./send_request'",
";",
"import",
"{",
"useRequest",
",",
"UseRequestResponse",
",",
"UseRequestConfig",
"}",
"from",
"'./use_request'",
";",
"export",
"interface",
"UseRequestHelpers",
"{",
"advanceTime",
":",
"(",
"ms",
":",
"number",
")",
"=>",
"Promise",
"<",
"void",
">",
";",
"completeRequest",
":",
"(",
")",
"=>",
"Promise",
"<",
"void",
">",
";",
"hookResult",
":",
"UseRequestResponse",
";",
"getSendRequestSpy",
":",
"(",
")",
"=>",
"sinon",
".",
"SinonStub",
";",
"setupSuccessRequest",
":",
"(",
"overrides",
"?",
":",
"{",
"}",
",",
"requestTimings",
"?",
":",
"number",
"[",
"]",
")",
"=>",
"void",
";",
"getSuccessResponse",
":",
"(",
")",
"=>",
"SendRequestResponse",
";",
"setupErrorRequest",
":",
"(",
"overrides",
"?",
":",
"{",
"}",
",",
"requestTimings",
"?",
":",
"number",
"[",
"]",
")",
"=>",
"void",
";",
"getErrorResponse",
":",
"(",
")",
"=>",
"SendRequestResponse",
";",
"setErrorResponse",
":",
"(",
"overrides",
"?",
":",
"{",
"}",
")",
"=>",
"void",
";",
"setupErrorWithBodyRequest",
":",
"(",
"overrides",
"?",
":",
"{",
"}",
")",
"=>",
"void",
";",
"getErrorWithBodyResponse",
":",
"(",
")",
"=>",
"SendRequestResponse",
";",
"}",
"export",
"const",
"REQUEST_TIME",
"=",
"1000",
";",
"const",
"successRequest",
"=",
"{",
"method",
":",
"'post'",
",",
"path",
":",
"'/success'",
",",
"body",
":",
"{",
"}",
"}",
";",
"const",
"successResponse",
"=",
"{",
"statusCode",
":",
"200",
",",
"data",
":",
"{",
"message",
":",
"'Success message'",
"}",
"}",
";",
"const",
"errorValue",
"=",
"{",
"statusCode",
":",
"400",
",",
"statusText",
":",
"'Error message'",
"}",
";",
"const",
"errorRequest",
"=",
"{",
"method",
":",
"'post'",
",",
"path",
":",
"'/error'",
",",
"body",
":",
"{",
"}",
"}",
";",
"const",
"errorResponse",
"=",
"{",
"response",
":",
"{",
"data",
":",
"errorValue",
"}",
"}",
";",
"const",
"errorWithBodyRequest",
"=",
"{",
"method",
":",
"'post'",
",",
"path",
":",
"'/errorWithBody'",
",",
"body",
":",
"{",
"}",
",",
"}",
";",
"const",
"errorWithBodyResponse",
"=",
"{",
"body",
":",
"errorValue",
"}",
";",
"export",
"const",
"createUseRequestHelpers",
"=",
"(",
")",
":",
"UseRequestHelpers",
"=>",
"{",
"jest",
".",
"useFakeTimers",
"(",
")",
";",
"const",
"flushPromiseJobQueue",
"=",
"async",
"(",
")",
"=>",
"{",
"await",
"Promise",
".",
"resolve",
"(",
")",
";",
"}",
";",
"const",
"completeRequest",
"=",
"async",
"(",
")",
"=>",
"{",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"jest",
".",
"runAllTimers",
"(",
")",
";",
"await",
"flushPromiseJobQueue",
"(",
")",
";",
"}",
")",
";",
"}",
";",
"const",
"advanceTime",
"=",
"async",
"(",
"ms",
")",
"=>",
"{",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"jest",
".",
"advanceTimersByTime",
"(",
"ms",
")",
";",
"await",
"flushPromiseJobQueue",
"(",
")",
";",
"}",
")",
";",
"}",
";",
"let",
"element",
";",
"const",
"hookResult",
"=",
"{",
"}",
"as",
"UseRequestResponse",
";",
"const",
"sendRequestSpy",
"=",
"sinon",
".",
"stub",
"(",
")",
";",
"const",
"setupUseRequest",
"=",
"(",
"config",
",",
"requestTimings",
"?",
")",
"=>",
"{",
"let",
"requestCount",
"=",
"0",
";",
"const",
"httpClient",
"=",
"{",
"post",
":",
"(",
"path",
",",
"options",
")",
"=>",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"setTimeout",
"(",
"(",
")",
"=>",
"{",
"try",
"{",
"resolve",
"(",
"sendRequestSpy",
"(",
"path",
",",
"options",
")",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"reject",
"(",
"e",
")",
";",
"}",
"}",
",",
"(",
"requestTimings",
"&&",
"requestTimings",
"[",
"requestCount",
"++",
"]",
")",
"||",
"REQUEST_TIME",
")",
";",
"}",
")",
";",
"}",
",",
"}",
";",
"const",
"TestComponent",
"=",
"(",
"{",
"requestConfig",
"}",
")",
"=>",
"{",
"const",
"{",
"isInitialRequest",
",",
"isLoading",
",",
"error",
",",
"data",
",",
"resendRequest",
"}",
"=",
"useRequest",
"(",
"httpClient",
"as",
"HttpSetup",
",",
"requestConfig",
")",
";",
"const",
"[",
",",
"setState",
"]",
"=",
"useState",
"(",
"false",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"setState",
"(",
"true",
")",
";",
"}",
",",
"[",
"]",
")",
";",
"hookResult",
".",
"isInitialRequest",
"=",
"isInitialRequest",
";",
"hookResult",
".",
"isLoading",
"=",
"isLoading",
";",
"hookResult",
".",
"error",
"=",
"error",
";",
"hookResult",
".",
"data",
"=",
"data",
";",
"hookResult",
".",
"resendRequest",
"=",
"resendRequest",
";",
"return",
"null",
";",
"}",
";",
"act",
"(",
"(",
")",
"=>",
"{",
"element",
"=",
"mount",
"(",
"<",
"TestComponent",
"requestConfig",
"=",
"{",
"config",
"}",
"/",
">",
")",
";",
"}",
")",
";",
"}",
";",
"sendRequestSpy",
".",
"withArgs",
"(",
"successRequest",
".",
"path",
",",
"sinon",
".",
"match",
"(",
"{",
"body",
":",
"JSON",
".",
"stringify",
"(",
"successRequest",
".",
"body",
")",
",",
"query",
":",
"undefined",
",",
"}",
")",
")",
".",
"resolves",
"(",
"successResponse",
")",
";",
"const",
"setupSuccessRequest",
"=",
"(",
"overrides",
"=",
"{",
"}",
",",
"requestTimings",
"?",
")",
"=>",
"setupUseRequest",
"(",
"{",
"...",
"successRequest",
",",
"...",
"overrides",
"}",
",",
"requestTimings",
")",
";",
"const",
"getSuccessResponse",
"=",
"(",
")",
"=>",
"(",
"{",
"data",
":",
"successResponse",
".",
"data",
",",
"error",
":",
"null",
"}",
")",
";",
"sendRequestSpy",
".",
"withArgs",
"(",
"errorRequest",
".",
"path",
",",
"sinon",
".",
"match",
"(",
"{",
"body",
":",
"JSON",
".",
"stringify",
"(",
"errorRequest",
".",
"body",
")",
",",
"query",
":",
"undefined",
",",
"}",
")",
")",
".",
"rejects",
"(",
"errorResponse",
")",
";",
"const",
"setupErrorRequest",
"=",
"(",
"overrides",
"=",
"{",
"}",
",",
"requestTimings",
"?",
")",
"=>",
"setupUseRequest",
"(",
"{",
"...",
"errorRequest",
",",
"...",
"overrides",
"}",
",",
"requestTimings",
")",
";",
"const",
"getErrorResponse",
"=",
"(",
")",
"=>",
"(",
"{",
"data",
":",
"null",
",",
"error",
":",
"errorResponse",
".",
"response",
".",
"data",
",",
"}",
")",
";",
"const",
"setErrorResponse",
"=",
"(",
"overrides",
"=",
"{",
"}",
")",
"=>",
"{",
"element",
".",
"setProps",
"(",
"{",
"requestConfig",
":",
"{",
"...",
"errorRequest",
",",
"...",
"overrides",
"}",
"}",
")",
";",
"}",
";",
"sendRequestSpy",
".",
"withArgs",
"(",
"errorWithBodyRequest",
".",
"path",
",",
"sinon",
".",
"match",
"(",
"{",
"body",
":",
"JSON",
".",
"stringify",
"(",
"errorWithBodyRequest",
".",
"body",
")",
",",
"query",
":",
"undefined",
",",
"}",
")",
")",
".",
"rejects",
"(",
"errorWithBodyResponse",
")",
";",
"const",
"setupErrorWithBodyRequest",
"=",
"(",
"overrides",
"=",
"{",
"}",
")",
"=>",
"setupUseRequest",
"(",
"{",
"...",
"errorWithBodyRequest",
",",
"...",
"overrides",
"}",
")",
";",
"const",
"getErrorWithBodyResponse",
"=",
"(",
")",
"=>",
"(",
"{",
"data",
":",
"null",
",",
"error",
":",
"errorWithBodyResponse",
".",
"body",
",",
"}",
")",
";",
"return",
"{",
"advanceTime",
",",
"completeRequest",
",",
"hookResult",
",",
"getSendRequestSpy",
":",
"(",
")",
"=>",
"sendRequestSpy",
",",
"setupSuccessRequest",
",",
"getSuccessResponse",
",",
"setupErrorRequest",
",",
"getErrorResponse",
",",
"setErrorResponse",
",",
"setupErrorWithBodyRequest",
",",
"getErrorWithBodyResponse",
",",
"}",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
29918,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29918,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
29918,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
111,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
35096,
null,
5,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
2,
null,
24284,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
734 | [
"import",
"{",
"act",
"}",
"from",
"'react-dom/test-utils'",
";",
"import",
"sinon",
"from",
"'sinon'",
";",
"import",
"{",
"UseRequestHelpers",
",",
"REQUEST_TIME",
",",
"createUseRequestHelpers",
",",
"}",
"from",
"'./use_request.test.helpers'",
";",
"describe",
"(",
"'useRequest hook'",
",",
"(",
")",
"=>",
"{",
"let",
"helpers",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"helpers",
"=",
"createUseRequestHelpers",
"(",
")",
";",
"}",
")",
";",
"describe",
"(",
"'parameters'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'path, method, body'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'is used to send the request'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"completeRequest",
",",
"hookResult",
",",
"getSuccessResponse",
"}",
"=",
"helpers",
";",
"setupSuccessRequest",
"(",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"data",
")",
".",
"toBe",
"(",
"getSuccessResponse",
"(",
")",
".",
"data",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'pollIntervalMs'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'sends another request after the specified time has elapsed'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"advanceTime",
",",
"getSendRequestSpy",
"}",
"=",
"helpers",
";",
"setupSuccessRequest",
"(",
"{",
"pollIntervalMs",
":",
"REQUEST_TIME",
"}",
")",
";",
"await",
"advanceTime",
"(",
"REQUEST_TIME",
")",
";",
"expect",
"(",
"getSendRequestSpy",
"(",
")",
".",
"callCount",
")",
".",
"toBe",
"(",
"1",
")",
";",
"await",
"advanceTime",
"(",
"REQUEST_TIME",
"*",
"2",
")",
";",
"expect",
"(",
"getSendRequestSpy",
"(",
")",
".",
"callCount",
")",
".",
"toBe",
"(",
"2",
")",
";",
"await",
"advanceTime",
"(",
"REQUEST_TIME",
"*",
"2",
")",
";",
"expect",
"(",
"getSendRequestSpy",
"(",
")",
".",
"callCount",
")",
".",
"toBe",
"(",
"3",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'initialData'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'sets the initial data value'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"completeRequest",
",",
"hookResult",
",",
"getSuccessResponse",
"}",
"=",
"helpers",
";",
"setupSuccessRequest",
"(",
"{",
"initialData",
":",
"'initialData'",
"}",
")",
";",
"expect",
"(",
"hookResult",
".",
"data",
")",
".",
"toBe",
"(",
"'initialData'",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"data",
")",
".",
"toBe",
"(",
"getSuccessResponse",
"(",
")",
".",
"data",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'deserializer'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'is called with the response once the request resolves'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"completeRequest",
",",
"getSuccessResponse",
"}",
"=",
"helpers",
";",
"const",
"deserializer",
"=",
"sinon",
".",
"stub",
"(",
")",
";",
"setupSuccessRequest",
"(",
"{",
"deserializer",
"}",
")",
";",
"sinon",
".",
"assert",
".",
"notCalled",
"(",
"deserializer",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"sinon",
".",
"assert",
".",
"calledOnce",
"(",
"deserializer",
")",
";",
"sinon",
".",
"assert",
".",
"calledWith",
"(",
"deserializer",
",",
"getSuccessResponse",
"(",
")",
".",
"data",
")",
";",
"}",
")",
";",
"it",
"(",
"'provides the data return value'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"completeRequest",
",",
"hookResult",
"}",
"=",
"helpers",
";",
"setupSuccessRequest",
"(",
"{",
"deserializer",
":",
"(",
")",
"=>",
"'intercepted'",
"}",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"data",
")",
".",
"toBe",
"(",
"'intercepted'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'state'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'isInitialRequest'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'is true for the first request and false for subsequent requests'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"completeRequest",
",",
"hookResult",
"}",
"=",
"helpers",
";",
"setupSuccessRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"isInitialRequest",
")",
".",
"toBe",
"(",
"true",
")",
";",
"act",
"(",
"(",
")",
"=>",
"{",
"hookResult",
".",
"resendRequest",
"(",
")",
";",
"}",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"isInitialRequest",
")",
".",
"toBe",
"(",
"false",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'isLoading'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'represents in-flight request status'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"completeRequest",
",",
"hookResult",
"}",
"=",
"helpers",
";",
"setupSuccessRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"isLoading",
")",
".",
"toBe",
"(",
"true",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"isLoading",
")",
".",
"toBe",
"(",
"false",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'error'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'surfaces errors from requests'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupErrorRequest",
",",
"completeRequest",
",",
"hookResult",
",",
"getErrorResponse",
"}",
"=",
"helpers",
";",
"setupErrorRequest",
"(",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"error",
")",
".",
"toBe",
"(",
"getErrorResponse",
"(",
")",
".",
"error",
")",
";",
"}",
")",
";",
"it",
"(",
"'surfaces body-shaped errors from requests'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupErrorWithBodyRequest",
",",
"completeRequest",
",",
"hookResult",
",",
"getErrorWithBodyResponse",
"}",
"=",
"helpers",
";",
"setupErrorWithBodyRequest",
"(",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"error",
")",
".",
"toBe",
"(",
"getErrorWithBodyResponse",
"(",
")",
".",
"error",
")",
";",
"}",
")",
";",
"it",
"(",
"'persists while a request is in-flight'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupErrorRequest",
",",
"completeRequest",
",",
"hookResult",
",",
"getErrorResponse",
"}",
"=",
"helpers",
";",
"setupErrorRequest",
"(",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"isLoading",
")",
".",
"toBe",
"(",
"false",
")",
";",
"expect",
"(",
"hookResult",
".",
"error",
")",
".",
"toBe",
"(",
"getErrorResponse",
"(",
")",
".",
"error",
")",
";",
"act",
"(",
"(",
")",
"=>",
"{",
"hookResult",
".",
"resendRequest",
"(",
")",
";",
"}",
")",
";",
"expect",
"(",
"hookResult",
".",
"isLoading",
")",
".",
"toBe",
"(",
"true",
")",
";",
"expect",
"(",
"hookResult",
".",
"error",
")",
".",
"toBe",
"(",
"getErrorResponse",
"(",
")",
".",
"error",
")",
";",
"}",
")",
";",
"it",
"(",
"'is null when the request is successful'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"completeRequest",
",",
"hookResult",
"}",
"=",
"helpers",
";",
"setupSuccessRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"error",
")",
".",
"toBeNull",
"(",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"isLoading",
")",
".",
"toBe",
"(",
"false",
")",
";",
"expect",
"(",
"hookResult",
".",
"error",
")",
".",
"toBeNull",
"(",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'data'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'surfaces payloads from requests'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"completeRequest",
",",
"hookResult",
",",
"getSuccessResponse",
"}",
"=",
"helpers",
";",
"setupSuccessRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"data",
")",
".",
"toBeUndefined",
"(",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"data",
")",
".",
"toBe",
"(",
"getSuccessResponse",
"(",
")",
".",
"data",
")",
";",
"}",
")",
";",
"it",
"(",
"'persists while a request is in-flight'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"completeRequest",
",",
"hookResult",
",",
"getSuccessResponse",
"}",
"=",
"helpers",
";",
"setupSuccessRequest",
"(",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"isLoading",
")",
".",
"toBe",
"(",
"false",
")",
";",
"expect",
"(",
"hookResult",
".",
"data",
")",
".",
"toBe",
"(",
"getSuccessResponse",
"(",
")",
".",
"data",
")",
";",
"act",
"(",
"(",
")",
"=>",
"{",
"hookResult",
".",
"resendRequest",
"(",
")",
";",
"}",
")",
";",
"expect",
"(",
"hookResult",
".",
"isLoading",
")",
".",
"toBe",
"(",
"true",
")",
";",
"expect",
"(",
"hookResult",
".",
"data",
")",
".",
"toBe",
"(",
"getSuccessResponse",
"(",
")",
".",
"data",
")",
";",
"}",
")",
";",
"it",
"(",
"'persists from last successful request when the next request fails'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"completeRequest",
",",
"hookResult",
",",
"getErrorResponse",
",",
"setErrorResponse",
",",
"getSuccessResponse",
",",
"}",
"=",
"helpers",
";",
"setupSuccessRequest",
"(",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"isLoading",
")",
".",
"toBe",
"(",
"false",
")",
";",
"expect",
"(",
"hookResult",
".",
"error",
")",
".",
"toBeNull",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"data",
")",
".",
"toBe",
"(",
"getSuccessResponse",
"(",
")",
".",
"data",
")",
";",
"setErrorResponse",
"(",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"hookResult",
".",
"isLoading",
")",
".",
"toBe",
"(",
"false",
")",
";",
"expect",
"(",
"hookResult",
".",
"error",
")",
".",
"toBe",
"(",
"getErrorResponse",
"(",
")",
".",
"error",
")",
";",
"expect",
"(",
"hookResult",
".",
"data",
")",
".",
"toBe",
"(",
"getSuccessResponse",
"(",
")",
".",
"data",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'callbacks'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'resendRequest'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'sends the request'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"completeRequest",
",",
"hookResult",
",",
"getSendRequestSpy",
"}",
"=",
"helpers",
";",
"setupSuccessRequest",
"(",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"getSendRequestSpy",
"(",
")",
".",
"callCount",
")",
".",
"toBe",
"(",
"1",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"hookResult",
".",
"resendRequest",
"(",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"}",
")",
";",
"expect",
"(",
"getSendRequestSpy",
"(",
")",
".",
"callCount",
")",
".",
"toBe",
"(",
"2",
")",
";",
"}",
")",
";",
"it",
"(",
"'resets the pollIntervalMs'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"advanceTime",
",",
"hookResult",
",",
"getSendRequestSpy",
"}",
"=",
"helpers",
";",
"const",
"DOUBLE_REQUEST_TIME",
"=",
"REQUEST_TIME",
"*",
"2",
";",
"setupSuccessRequest",
"(",
"{",
"pollIntervalMs",
":",
"DOUBLE_REQUEST_TIME",
"}",
")",
";",
"await",
"advanceTime",
"(",
"REQUEST_TIME",
")",
";",
"expect",
"(",
"getSendRequestSpy",
"(",
")",
".",
"callCount",
")",
".",
"toBe",
"(",
"1",
")",
";",
"act",
"(",
"(",
")",
"=>",
"{",
"hookResult",
".",
"resendRequest",
"(",
")",
";",
"}",
")",
";",
"await",
"advanceTime",
"(",
"REQUEST_TIME",
")",
";",
"expect",
"(",
"getSendRequestSpy",
"(",
")",
".",
"callCount",
")",
".",
"toBe",
"(",
"2",
")",
";",
"act",
"(",
"(",
")",
"=>",
"{",
"hookResult",
".",
"resendRequest",
"(",
")",
";",
"}",
")",
";",
"await",
"advanceTime",
"(",
"REQUEST_TIME",
")",
";",
"expect",
"(",
"getSendRequestSpy",
"(",
")",
".",
"callCount",
")",
".",
"toBe",
"(",
"3",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'request behavior'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'outdated responses are ignored by poll requests'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"setErrorResponse",
",",
"completeRequest",
",",
"hookResult",
",",
"getErrorResponse",
",",
"getSendRequestSpy",
",",
"}",
"=",
"helpers",
";",
"const",
"DOUBLE_REQUEST_TIME",
"=",
"REQUEST_TIME",
"*",
"2",
";",
"setupSuccessRequest",
"(",
"{",
"}",
",",
"[",
"DOUBLE_REQUEST_TIME",
"]",
")",
";",
"setErrorResponse",
"(",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"getSendRequestSpy",
"(",
")",
".",
"callCount",
")",
".",
"toBe",
"(",
"2",
")",
";",
"expect",
"(",
"hookResult",
".",
"error",
")",
".",
"toBe",
"(",
"getErrorResponse",
"(",
")",
".",
"error",
")",
";",
"expect",
"(",
"hookResult",
".",
"data",
")",
".",
"toBeUndefined",
"(",
")",
";",
"}",
")",
";",
"it",
"(",
"`outdated responses are ignored if there's a more recently-sent manual request`",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"advanceTime",
",",
"hookResult",
",",
"getSendRequestSpy",
"}",
"=",
"helpers",
";",
"const",
"HALF_REQUEST_TIME",
"=",
"REQUEST_TIME",
"*",
"0.5",
";",
"setupSuccessRequest",
"(",
"{",
"pollIntervalMs",
":",
"REQUEST_TIME",
"}",
")",
";",
"await",
"advanceTime",
"(",
"HALF_REQUEST_TIME",
")",
";",
"expect",
"(",
"getSendRequestSpy",
"(",
")",
".",
"callCount",
")",
".",
"toBe",
"(",
"0",
")",
";",
"act",
"(",
"(",
")",
"=>",
"{",
"hookResult",
".",
"resendRequest",
"(",
")",
";",
"}",
")",
";",
"await",
"advanceTime",
"(",
"HALF_REQUEST_TIME",
")",
";",
"expect",
"(",
"getSendRequestSpy",
"(",
")",
".",
"callCount",
")",
".",
"toBe",
"(",
"1",
")",
";",
"expect",
"(",
"hookResult",
".",
"data",
")",
".",
"toBeUndefined",
"(",
")",
";",
"}",
")",
";",
"it",
"(",
"`changing pollIntervalMs doesn't trigger a new request`",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupErrorRequest",
",",
"setErrorResponse",
",",
"completeRequest",
",",
"getSendRequestSpy",
"}",
"=",
"helpers",
";",
"const",
"DOUBLE_REQUEST_TIME",
"=",
"REQUEST_TIME",
"*",
"2",
";",
"setupErrorRequest",
"(",
"{",
"pollIntervalMs",
":",
"REQUEST_TIME",
"}",
")",
";",
"setErrorResponse",
"(",
"{",
"pollIntervalMs",
":",
"DOUBLE_REQUEST_TIME",
"}",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"getSendRequestSpy",
"(",
")",
".",
"callCount",
")",
".",
"toBe",
"(",
"2",
")",
";",
"}",
")",
";",
"it",
"(",
"`changing pollIntervalMs to undefined cancels the poll`",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupErrorRequest",
",",
"setErrorResponse",
",",
"completeRequest",
",",
"getSendRequestSpy",
"}",
"=",
"helpers",
";",
"setupErrorRequest",
"(",
"{",
"pollIntervalMs",
":",
"REQUEST_TIME",
"}",
")",
";",
"setErrorResponse",
"(",
"{",
"pollIntervalMs",
":",
"undefined",
"}",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"getSendRequestSpy",
"(",
")",
".",
"callCount",
")",
".",
"toBe",
"(",
"1",
")",
";",
"}",
")",
";",
"it",
"(",
"'when the path changes after a request is scheduled, the scheduled request is sent with that path'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"setupSuccessRequest",
",",
"completeRequest",
",",
"hookResult",
",",
"getErrorResponse",
",",
"setErrorResponse",
",",
"getSendRequestSpy",
",",
"}",
"=",
"helpers",
";",
"const",
"DOUBLE_REQUEST_TIME",
"=",
"REQUEST_TIME",
"*",
"2",
";",
"setupSuccessRequest",
"(",
"{",
"pollIntervalMs",
":",
"DOUBLE_REQUEST_TIME",
"}",
")",
";",
"setErrorResponse",
"(",
"{",
"pollIntervalMs",
":",
"DOUBLE_REQUEST_TIME",
"}",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"await",
"completeRequest",
"(",
")",
";",
"expect",
"(",
"getSendRequestSpy",
"(",
")",
".",
"callCount",
")",
".",
"toBe",
"(",
"3",
")",
";",
"expect",
"(",
"hookResult",
".",
"error",
")",
".",
"toBe",
"(",
"getErrorResponse",
"(",
")",
".",
"error",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
735 | [
"import",
"{",
"attemptToURIDecode",
"}",
"from",
"'./attempt_to_uri_decode'",
";",
"test",
"(",
"'decodes an encoded string'",
",",
"(",
")",
"=>",
"{",
"const",
"originalName",
"=",
"'test;,/?:@&=+$#'",
";",
"const",
"encodedName",
"=",
"encodeURIComponent",
"(",
"originalName",
")",
";",
"const",
"reactRouterDecoded",
"=",
"decodeURI",
"(",
"encodedName",
")",
";",
"expect",
"(",
"attemptToURIDecode",
"(",
"encodedName",
")",
")",
".",
"toBe",
"(",
"originalName",
")",
";",
"expect",
"(",
"attemptToURIDecode",
"(",
"reactRouterDecoded",
")",
")",
".",
"toBe",
"(",
"originalName",
")",
";",
"}",
")",
";",
"test",
"(",
"'ignores the error if a string is already decoded'",
",",
"(",
")",
"=>",
"{",
"const",
"originalName",
"=",
"'test%'",
";",
"const",
"encodedName",
"=",
"encodeURIComponent",
"(",
"originalName",
")",
";",
"const",
"reactRouterDecoded",
"=",
"decodeURI",
"(",
"encodedName",
")",
";",
"expect",
"(",
"attemptToURIDecode",
"(",
"encodedName",
")",
")",
".",
"toBe",
"(",
"originalName",
")",
";",
"expect",
"(",
"attemptToURIDecode",
"(",
"reactRouterDecoded",
")",
")",
".",
"toBe",
"(",
"originalName",
")",
";",
"}",
")",
";",
"test",
"(",
"'returns wrong decoded value for %25 sequence'",
",",
"(",
")",
"=>",
"{",
"const",
"originalName",
"=",
"'test%25'",
";",
"const",
"encodedName",
"=",
"encodeURIComponent",
"(",
"originalName",
")",
";",
"const",
"reactRouterDecoded",
"=",
"decodeURI",
"(",
"encodedName",
")",
";",
"expect",
"(",
"attemptToURIDecode",
"(",
"encodedName",
")",
")",
".",
"toBe",
"(",
"originalName",
")",
";",
"expect",
"(",
"attemptToURIDecode",
"(",
"reactRouterDecoded",
")",
")",
".",
"not",
".",
"toBe",
"(",
"originalName",
")",
";",
"}",
")",
";",
"test",
"(",
"'returns wrong decoded value for % with other escaped characters'",
",",
"(",
")",
"=>",
"{",
"const",
"originalName",
"=",
"'test%?#'",
";",
"const",
"encodedName",
"=",
"encodeURIComponent",
"(",
"originalName",
")",
";",
"const",
"reactRouterDecoded",
"=",
"decodeURI",
"(",
"encodedName",
")",
";",
"expect",
"(",
"attemptToURIDecode",
"(",
"encodedName",
")",
")",
".",
"toBe",
"(",
"originalName",
")",
";",
"expect",
"(",
"attemptToURIDecode",
"(",
"reactRouterDecoded",
")",
")",
".",
"not",
".",
"toBe",
"(",
"originalName",
")",
";",
"}",
")",
";",
"test",
"(",
"\"doesn't convert undefined to a string\"",
",",
"(",
")",
"=>",
"{",
"expect",
"(",
"attemptToURIDecode",
"(",
"undefined",
")",
")",
".",
"toBeUndefined",
"(",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
736 | [
"export",
"{",
"handleEsError",
",",
"parseEsError",
"}",
"from",
"'./errors'",
";",
"/** dummy plugin*/",
"export",
"function",
"plugin",
"(",
")",
"{",
"return",
"new",
"(",
"class",
"EsUiSharedPlugin",
"{",
"setup",
"(",
")",
"{",
"}",
"start",
"(",
")",
"{",
"}",
"}",
")",
"(",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
737 | [
"type",
"Listener",
"<",
"T",
">",
"=",
"(",
"value",
":",
"T",
")",
"=>",
"void",
";",
"export",
"interface",
"Subscription",
"{",
"unsubscribe",
":",
"(",
")",
"=>",
"void",
";",
"}",
"export",
"class",
"Subject",
"<",
"T",
">",
"{",
"private",
"callbacks",
":",
"Set",
"<",
"Listener",
"<",
"T",
">",
">",
"=",
"new",
"Set",
"(",
")",
";",
"value",
":",
"T",
";",
"constructor",
"(",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"subscribe",
"(",
"fn",
")",
"{",
"this",
".",
"callbacks",
".",
"add",
"(",
"fn",
")",
";",
"/**\n * We immediately call the function inside the subscribe so the consumer\n * receives the value immediately, withouth the need to wait for a change.\n */",
"fn",
"(",
"this",
".",
"value",
")",
";",
"const",
"unsubscribe",
"=",
"(",
")",
"=>",
"this",
".",
"callbacks",
".",
"delete",
"(",
"fn",
")",
";",
"return",
"{",
"unsubscribe",
",",
"}",
";",
"}",
"next",
"(",
"value",
")",
"{",
"if",
"(",
"value",
"!==",
"this",
".",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"this",
".",
"callbacks",
".",
"forEach",
"(",
"(",
"fn",
")",
"=>",
"fn",
"(",
"value",
")",
")",
";",
"}",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
157,
null,
601,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
601,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
738 | [
"import",
"{",
"set",
"}",
"from",
"'@elastic/safer-lodash-set'",
";",
"import",
"{",
"FieldHook",
"}",
"from",
"'../types'",
";",
"export",
"const",
"unflattenObject",
"=",
"<",
"T",
"extends",
"object",
"=",
"{",
"[",
"key",
"]",
":",
"any",
";",
"}",
">",
"(",
"object",
")",
":",
"T",
"=>",
"Object",
".",
"entries",
"(",
"object",
")",
".",
"reduce",
"(",
"(",
"acc",
",",
"[",
"key",
",",
"value",
"]",
")",
"=>",
"{",
"set",
"(",
"acc",
",",
"key",
",",
"value",
")",
";",
"return",
"acc",
";",
"}",
",",
"{",
"}",
"as",
"T",
")",
";",
"param",
"formFields",
"param",
"fn",
"export",
"const",
"mapFormFields",
"=",
"(",
"formFields",
",",
"fn",
")",
"=>",
"Object",
".",
"entries",
"(",
"formFields",
")",
".",
"reduce",
"(",
"(",
"acc",
",",
"[",
"key",
",",
"field",
"]",
")",
"=>",
"{",
"acc",
"[",
"key",
"]",
"=",
"fn",
"(",
"field",
")",
";",
"return",
"acc",
";",
"}",
",",
"{",
"}",
"as",
"Record",
"<",
"string",
",",
"unknown",
">",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17,
null,
null,
17,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
739 | [
"export",
"const",
"FIELD_TYPES",
"=",
"{",
"TEXT",
":",
"'text'",
",",
"TEXTAREA",
":",
"'textarea'",
",",
"NUMBER",
":",
"'number'",
",",
"TOGGLE",
":",
"'toggle'",
",",
"CHECKBOX",
":",
"'checkbox'",
",",
"COMBO_BOX",
":",
"'comboBox'",
",",
"RADIO_GROUP",
":",
"'radioGroup'",
",",
"RANGE",
":",
"'range'",
",",
"SELECT",
":",
"'select'",
",",
"SUPER_SELECT",
":",
"'superSelect'",
",",
"MULTI_SELECT",
":",
"'multiSelect'",
",",
"JSON",
":",
"'json'",
",",
"}",
";",
"export",
"const",
"VALIDATION_TYPES",
"=",
"{",
"/** Default validation error (on the field value) */",
"FIELD",
":",
"'field'",
",",
"/** Returned from asynchronous validations */",
"ASYNC",
":",
"'async'",
",",
"/** If the field value is an Array, this error type would be returned if an _item_ of the array is invalid */",
"ARRAY_ITEM",
":",
"'arrayItem'",
",",
"}",
";"
] | [
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
740 | [
"import",
"{",
"useMemo",
",",
"useState",
",",
"useEffect",
",",
"useRef",
",",
"useCallback",
"}",
"from",
"'react'",
";",
"import",
"{",
"FormHook",
",",
"FieldHook",
",",
"FieldConfig",
",",
"FieldValidateResponse",
",",
"ValidationError",
",",
"FormData",
",",
"ValidationConfig",
",",
"}",
"from",
"'../types'",
";",
"import",
"{",
"FIELD_TYPES",
",",
"VALIDATION_TYPES",
"}",
"from",
"'../constants'",
";",
"export",
"interface",
"InternalFieldConfig",
"<",
"T",
">",
"{",
"initialValue",
"?",
":",
"T",
";",
"isIncludedInOutput",
"?",
":",
"boolean",
";",
"}",
"export",
"const",
"useField",
"=",
"<",
"T",
",",
"FormType",
"=",
"FormData",
",",
"I",
"=",
"T",
">",
"(",
"form",
",",
"path",
",",
"config",
"=",
"{",
"}",
",",
"valueChangeListener",
"?",
",",
"errorChangeListener",
"?",
",",
"{",
"customValidationData",
"=",
"null",
",",
"customValidationDataProvider",
",",
"}",
"=",
"{",
"}",
")",
"=>",
"{",
"const",
"{",
"type",
"=",
"FIELD_TYPES",
".",
"TEXT",
",",
"defaultValue",
"=",
"''",
",",
"initialValue",
"=",
"config",
".",
"defaultValue",
"??",
"(",
"''",
"as",
"unknown",
"as",
"I",
")",
",",
"isIncludedInOutput",
"=",
"true",
",",
"label",
"=",
"''",
",",
"labelAppend",
"=",
"''",
",",
"helpText",
"=",
"''",
",",
"validations",
",",
"formatters",
",",
"fieldsToValidateOnChange",
",",
"valueChangeDebounceTime",
"=",
"form",
".",
"__options",
".",
"valueChangeDebounceTime",
",",
"serializer",
",",
"deserializer",
",",
"}",
"=",
"config",
";",
"const",
"{",
"getFormData",
",",
"getFields",
",",
"__addField",
",",
"__removeField",
",",
"__updateFormDataAt",
",",
"validateFields",
",",
"__getFormData$",
",",
"}",
"=",
"form",
";",
"const",
"deserializeValue",
"=",
"useCallback",
"(",
"(",
"rawValue",
"=",
"initialValue",
")",
"=>",
"{",
"if",
"(",
"typeof",
"rawValue",
"===",
"'function'",
")",
"{",
"return",
"deserializer",
"?",
"deserializer",
"(",
"rawValue",
"(",
")",
")",
":",
"rawValue",
"(",
")",
";",
"}",
"return",
"deserializer",
"?",
"deserializer",
"(",
"rawValue",
")",
":",
"rawValue",
";",
"}",
",",
"[",
"initialValue",
",",
"deserializer",
"]",
")",
";",
"const",
"[",
"value",
",",
"setStateValue",
"]",
"=",
"useState",
"<",
"I",
">",
"(",
"deserializeValue",
")",
";",
"const",
"[",
"errors",
",",
"setStateErrors",
"]",
"=",
"useState",
"<",
"ValidationError",
"[",
"]",
">",
"(",
"[",
"]",
")",
";",
"const",
"[",
"isPristine",
",",
"setPristine",
"]",
"=",
"useState",
"(",
"true",
")",
";",
"const",
"[",
"isModified",
",",
"setIsModified",
"]",
"=",
"useState",
"(",
"false",
")",
";",
"const",
"[",
"isValidating",
",",
"setValidating",
"]",
"=",
"useState",
"(",
"false",
")",
";",
"const",
"[",
"isChangingValue",
",",
"setIsChangingValue",
"]",
"=",
"useState",
"(",
"false",
")",
";",
"const",
"[",
"isValidated",
",",
"setIsValidated",
"]",
"=",
"useState",
"(",
"false",
")",
";",
"const",
"isMounted",
"=",
"useRef",
"<",
"boolean",
">",
"(",
"false",
")",
";",
"const",
"validateCounter",
"=",
"useRef",
"(",
"0",
")",
";",
"const",
"changeCounter",
"=",
"useRef",
"(",
"0",
")",
";",
"const",
"hasBeenReset",
"=",
"useRef",
"<",
"boolean",
">",
"(",
"false",
")",
";",
"const",
"inflightValidation",
"=",
"useRef",
"<",
"(",
"Promise",
"<",
"any",
">",
"&",
"{",
"cancel",
"?",
"(",
")",
":",
"void",
";",
"}",
")",
"|",
"null",
">",
"(",
"null",
")",
";",
"const",
"debounceTimeout",
"=",
"useRef",
"<",
"NodeJS",
".",
"Timeout",
"|",
"null",
">",
"(",
"null",
")",
";",
"const",
"lastNotifiedState",
"=",
"useRef",
"<",
"{",
"value",
"?",
":",
"I",
";",
"errors",
":",
"string",
"[",
"]",
"|",
"null",
";",
"}",
">",
"(",
"{",
"value",
":",
"undefined",
",",
"errors",
":",
"null",
",",
"}",
")",
";",
"const",
"hasAsyncValidation",
"=",
"useMemo",
"(",
"(",
")",
"=>",
"validations",
"===",
"undefined",
"?",
"false",
":",
"validations",
".",
"some",
"(",
"(",
"validation",
")",
"=>",
"validation",
".",
"isAsync",
"===",
"true",
")",
",",
"[",
"validations",
"]",
")",
";",
"param",
"_errors",
"param",
"validationType",
"const",
"filterErrors",
"=",
"(",
"_errors",
",",
"validationTypeToFilterOut",
"=",
"VALIDATION_TYPES",
".",
"FIELD",
")",
":",
"ValidationError",
"[",
"]",
"=>",
"{",
"const",
"validationTypeToArray",
"=",
"Array",
".",
"isArray",
"(",
"validationTypeToFilterOut",
")",
"?",
"(",
"validationTypeToFilterOut",
"as",
"string",
"[",
"]",
")",
":",
"(",
"[",
"validationTypeToFilterOut",
"]",
"as",
"string",
"[",
"]",
")",
";",
"return",
"_errors",
".",
"filter",
"(",
"(",
"error",
")",
"=>",
"validationTypeToArray",
".",
"every",
"(",
"(",
"_type",
")",
"=>",
"error",
".",
"validationType",
"!==",
"_type",
")",
")",
";",
"}",
";",
"/**\n * If the field has some \"formatters\" defined in its config, run them in series and return\n * the transformed value. This handler is called whenever the field value changes, right before\n * updating the \"value\" state.\n */",
"const",
"formatInputValue",
"=",
"useCallback",
"(",
"<",
"U",
">",
"(",
"inputValue",
")",
":",
"U",
"=>",
"{",
"const",
"isEmptyString",
"=",
"typeof",
"inputValue",
"===",
"'string'",
"&&",
"inputValue",
".",
"trim",
"(",
")",
"===",
"''",
";",
"if",
"(",
"isEmptyString",
"||",
"!",
"formatters",
")",
"{",
"return",
"inputValue",
"as",
"U",
";",
"}",
"const",
"formData",
"=",
"__getFormData$",
"(",
")",
".",
"value",
";",
"return",
"formatters",
".",
"reduce",
"(",
"(",
"output",
",",
"formatter",
")",
"=>",
"formatter",
"(",
"output",
",",
"formData",
")",
",",
"inputValue",
")",
"as",
"U",
";",
"}",
",",
"[",
"formatters",
",",
"__getFormData$",
"]",
")",
";",
"const",
"onValueChange",
"=",
"useCallback",
"(",
"async",
"(",
")",
"=>",
"{",
"const",
"changeIteration",
"=",
"++",
"changeCounter",
".",
"current",
";",
"const",
"startTime",
"=",
"Date",
".",
"now",
"(",
")",
";",
"setPristine",
"(",
"false",
")",
";",
"setIsChangingValue",
"(",
"true",
")",
";",
"__updateFormDataAt",
"(",
"path",
",",
"value",
")",
";",
"await",
"validateFields",
"(",
"fieldsToValidateOnChange",
"??",
"[",
"path",
"]",
")",
";",
"if",
"(",
"isMounted",
".",
"current",
"===",
"false",
")",
"{",
"return",
";",
"}",
"/**\n * If we have set a delay to display the error message after the field value has changed,\n * we first check that this is the last \"change iteration\" (=== the last keystroke from the user)\n * and then, we verify how long we've already waited for as form.validateFields() is asynchronous\n * and might already have taken more than the specified delay)\n */",
"if",
"(",
"changeIteration",
"===",
"changeCounter",
".",
"current",
")",
"{",
"if",
"(",
"valueChangeDebounceTime",
">",
"0",
")",
"{",
"const",
"timeElapsed",
"=",
"Date",
".",
"now",
"(",
")",
"-",
"startTime",
";",
"if",
"(",
"timeElapsed",
"<",
"valueChangeDebounceTime",
")",
"{",
"const",
"timeLeftToWait",
"=",
"valueChangeDebounceTime",
"-",
"timeElapsed",
";",
"debounceTimeout",
".",
"current",
"=",
"setTimeout",
"(",
"(",
")",
"=>",
"{",
"debounceTimeout",
".",
"current",
"=",
"null",
";",
"setIsChangingValue",
"(",
"false",
")",
";",
"}",
",",
"timeLeftToWait",
")",
";",
"return",
";",
"}",
"}",
"setIsChangingValue",
"(",
"false",
")",
";",
"}",
"}",
",",
"[",
"path",
",",
"value",
",",
"valueChangeDebounceTime",
",",
"fieldsToValidateOnChange",
",",
"__updateFormDataAt",
",",
"validateFields",
",",
"]",
")",
";",
"const",
"cancelInflightValidation",
"=",
"useCallback",
"(",
"(",
")",
"=>",
"{",
"if",
"(",
"inflightValidation",
".",
"current",
"&&",
"typeof",
"inflightValidation",
".",
"current",
".",
"cancel",
"===",
"'function'",
")",
"{",
"inflightValidation",
".",
"current",
".",
"cancel",
"(",
")",
";",
"inflightValidation",
".",
"current",
"=",
"null",
";",
"}",
"}",
",",
"[",
"]",
")",
";",
"const",
"runValidations",
"=",
"useCallback",
"(",
"(",
"{",
"formData",
",",
"value",
":",
"valueToValidate",
",",
"onlyBlocking",
":",
"runOnlyBlockingValidations",
",",
"validationTypeToValidate",
",",
"}",
",",
"clearFieldErrors",
")",
":",
"ValidationError",
"[",
"]",
"|",
"Promise",
"<",
"ValidationError",
"[",
"]",
">",
"=>",
"{",
"if",
"(",
"!",
"validations",
")",
"{",
"return",
"[",
"]",
";",
"}",
"clearFieldErrors",
"(",
"[",
"validationTypeToValidate",
"??",
"VALIDATION_TYPES",
".",
"FIELD",
",",
"VALIDATION_TYPES",
".",
"ASYNC",
",",
"]",
")",
";",
"cancelInflightValidation",
"(",
")",
";",
"const",
"doByPassValidation",
"=",
"(",
"{",
"type",
":",
"validationType",
",",
"isBlocking",
",",
"}",
")",
"=>",
"{",
"if",
"(",
"typeof",
"validationTypeToValidate",
"!==",
"'undefined'",
"&&",
"validationType",
"!==",
"validationTypeToValidate",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"runOnlyBlockingValidations",
"&&",
"isBlocking",
"===",
"false",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
";",
"const",
"dataProvider",
"=",
"customValidationDataProvider",
"??",
"(",
"(",
")",
"=>",
"Promise",
".",
"resolve",
"(",
"undefined",
")",
")",
";",
"const",
"runAsync",
"=",
"async",
"(",
")",
"=>",
"{",
"const",
"validationErrors",
"=",
"[",
"]",
";",
"for",
"(",
"const",
"validation",
"of",
"validations",
")",
"{",
"const",
"{",
"validator",
",",
"exitOnFail",
"=",
"true",
",",
"type",
":",
"validationType",
"=",
"VALIDATION_TYPES",
".",
"FIELD",
",",
"}",
"=",
"validation",
";",
"if",
"(",
"doByPassValidation",
"(",
"validation",
")",
")",
"{",
"continue",
";",
"}",
"inflightValidation",
".",
"current",
"=",
"validator",
"(",
"{",
"value",
":",
"valueToValidate",
",",
"errors",
":",
"validationErrors",
",",
"form",
":",
"{",
"getFormData",
",",
"getFields",
"}",
",",
"formData",
",",
"path",
",",
"customData",
":",
"{",
"provider",
":",
"dataProvider",
",",
"value",
":",
"customValidationData",
"}",
",",
"}",
")",
"as",
"Promise",
"<",
"ValidationError",
">",
";",
"const",
"validationResult",
"=",
"await",
"inflightValidation",
".",
"current",
";",
"inflightValidation",
".",
"current",
"=",
"null",
";",
"if",
"(",
"!",
"validationResult",
")",
"{",
"continue",
";",
"}",
"validationErrors",
".",
"push",
"(",
"{",
"...",
"validationResult",
",",
"__isBlocking__",
":",
"validationResult",
".",
"__isBlocking__",
"??",
"validation",
".",
"isBlocking",
",",
"validationType",
":",
"validationType",
"||",
"VALIDATION_TYPES",
".",
"FIELD",
",",
"}",
")",
";",
"if",
"(",
"exitOnFail",
")",
"{",
"break",
";",
"}",
"}",
"return",
"validationErrors",
";",
"}",
";",
"const",
"runSync",
"=",
"(",
")",
"=>",
"{",
"const",
"validationErrors",
"=",
"[",
"]",
";",
"for",
"(",
"const",
"validation",
"of",
"validations",
")",
"{",
"const",
"{",
"validator",
",",
"exitOnFail",
"=",
"true",
",",
"type",
":",
"validationType",
"=",
"VALIDATION_TYPES",
".",
"FIELD",
",",
"}",
"=",
"validation",
";",
"if",
"(",
"doByPassValidation",
"(",
"validation",
")",
")",
"{",
"continue",
";",
"}",
"const",
"validationResult",
"=",
"validator",
"(",
"{",
"value",
":",
"valueToValidate",
",",
"errors",
":",
"validationErrors",
",",
"form",
":",
"{",
"getFormData",
",",
"getFields",
"}",
",",
"formData",
",",
"path",
",",
"customData",
":",
"{",
"provider",
":",
"dataProvider",
",",
"value",
":",
"customValidationData",
"}",
",",
"}",
")",
";",
"if",
"(",
"!",
"validationResult",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"!",
"!",
"validationResult",
".",
"then",
")",
"{",
"inflightValidation",
".",
"current",
"=",
"validationResult",
"as",
"Promise",
"<",
"ValidationError",
">",
";",
"cancelInflightValidation",
"(",
")",
";",
"return",
"runAsync",
"(",
")",
";",
"}",
"validationErrors",
".",
"push",
"(",
"{",
"...",
"(",
"validationResult",
"as",
"ValidationError",
")",
",",
"__isBlocking__",
":",
"(",
"validationResult",
"as",
"ValidationError",
")",
".",
"__isBlocking__",
"??",
"validation",
".",
"isBlocking",
",",
"validationType",
":",
"validationType",
"||",
"VALIDATION_TYPES",
".",
"FIELD",
",",
"}",
")",
";",
"if",
"(",
"exitOnFail",
")",
"{",
"break",
";",
"}",
"}",
"return",
"validationErrors",
";",
"}",
";",
"if",
"(",
"hasAsyncValidation",
")",
"{",
"return",
"runAsync",
"(",
")",
";",
"}",
"return",
"runSync",
"(",
")",
";",
"}",
",",
"[",
"cancelInflightValidation",
",",
"validations",
",",
"hasAsyncValidation",
",",
"getFormData",
",",
"getFields",
",",
"path",
",",
"customValidationData",
",",
"customValidationDataProvider",
",",
"]",
")",
";",
"const",
"serializeValue",
"=",
"useCallback",
"(",
"(",
"internalValue",
"=",
"value",
")",
"=>",
"{",
"return",
"serializer",
"?",
"serializer",
"(",
"internalValue",
")",
":",
"(",
"internalValue",
"as",
"unknown",
"as",
"T",
")",
";",
"}",
",",
"[",
"serializer",
",",
"value",
"]",
")",
";",
"const",
"clearErrors",
"=",
"useCallback",
"(",
"(",
"validationType",
"=",
"VALIDATION_TYPES",
".",
"FIELD",
")",
"=>",
"{",
"setStateErrors",
"(",
"(",
"previousErrors",
")",
"=>",
"filterErrors",
"(",
"previousErrors",
",",
"validationType",
")",
")",
";",
"}",
",",
"[",
"]",
")",
";",
"const",
"validate",
"=",
"useCallback",
"(",
"(",
"validationData",
"=",
"{",
"}",
")",
"=>",
"{",
"const",
"{",
"formData",
"=",
"__getFormData$",
"(",
")",
".",
"value",
",",
"value",
":",
"valueToValidate",
"=",
"value",
",",
"validationType",
",",
"onlyBlocking",
"=",
"false",
",",
"}",
"=",
"validationData",
";",
"setValidating",
"(",
"true",
")",
";",
"const",
"validateIteration",
"=",
"++",
"validateCounter",
".",
"current",
";",
"const",
"onValidationResult",
"=",
"(",
"_validationErrors",
")",
":",
"FieldValidateResponse",
"=>",
"{",
"if",
"(",
"validateIteration",
"===",
"validateCounter",
".",
"current",
"&&",
"isMounted",
".",
"current",
")",
"{",
"setValidating",
"(",
"false",
")",
";",
"setIsValidated",
"(",
"true",
")",
";",
"setStateErrors",
"(",
"(",
"prev",
")",
"=>",
"{",
"const",
"filteredErrors",
"=",
"filterErrors",
"(",
"prev",
",",
"validationType",
")",
";",
"return",
"[",
"...",
"filteredErrors",
",",
"...",
"_validationErrors",
"]",
";",
"}",
")",
";",
"}",
"return",
"{",
"isValid",
":",
"_validationErrors",
".",
"length",
"===",
"0",
",",
"errors",
":",
"_validationErrors",
",",
"}",
";",
"}",
";",
"const",
"validationErrors",
"=",
"runValidations",
"(",
"{",
"formData",
",",
"value",
":",
"valueToValidate",
",",
"validationTypeToValidate",
":",
"validationType",
",",
"onlyBlocking",
",",
"}",
",",
"clearErrors",
")",
";",
"if",
"(",
"Reflect",
".",
"has",
"(",
"validationErrors",
",",
"'then'",
")",
")",
"{",
"return",
"(",
"validationErrors",
"as",
"Promise",
"<",
"ValidationError",
"[",
"]",
">",
")",
".",
"then",
"(",
"onValidationResult",
")",
";",
"}",
"return",
"onValidationResult",
"(",
"validationErrors",
"as",
"ValidationError",
"[",
"]",
")",
";",
"}",
",",
"[",
"__getFormData$",
",",
"value",
",",
"runValidations",
",",
"clearErrors",
"]",
")",
";",
"const",
"setValue",
"=",
"useCallback",
"(",
"(",
"newValue",
")",
"=>",
"{",
"setStateValue",
"(",
"(",
"prev",
")",
"=>",
"{",
"let",
"formattedValue",
";",
"if",
"(",
"typeof",
"newValue",
"===",
"'function'",
")",
"{",
"formattedValue",
"=",
"formatInputValue",
"<",
"I",
">",
"(",
"(",
"newValue",
"as",
"Function",
")",
"(",
"prev",
")",
")",
";",
"}",
"else",
"{",
"formattedValue",
"=",
"formatInputValue",
"<",
"I",
">",
"(",
"newValue",
")",
";",
"}",
"return",
"formattedValue",
";",
"}",
")",
";",
"}",
",",
"[",
"formatInputValue",
"]",
")",
";",
"const",
"setErrors",
"=",
"useCallback",
"(",
"(",
"_errors",
")",
"=>",
"{",
"setStateErrors",
"(",
"_errors",
".",
"map",
"(",
"(",
"error",
")",
"=>",
"(",
"{",
"validationType",
":",
"VALIDATION_TYPES",
".",
"FIELD",
",",
"__isBlocking__",
":",
"true",
",",
"...",
"error",
",",
"}",
")",
")",
")",
";",
"}",
",",
"[",
"]",
")",
";",
"const",
"onChange",
"=",
"useCallback",
"(",
"(",
"event",
")",
"=>",
"{",
"const",
"newValue",
"=",
"{",
"}",
".",
"hasOwnProperty",
".",
"call",
"(",
"event",
"!",
".",
"target",
",",
"'checked'",
")",
"?",
"event",
".",
"target",
".",
"checked",
":",
"event",
".",
"target",
".",
"value",
";",
"setValue",
"(",
"newValue",
"as",
"unknown",
"as",
"I",
")",
";",
"}",
",",
"[",
"setValue",
"]",
")",
";",
"param",
"validationType",
"const",
"getErrorsMessages",
"=",
"useCallback",
"(",
"(",
"args",
"=",
"{",
"}",
")",
"=>",
"{",
"const",
"{",
"errorCode",
",",
"validationType",
"=",
"VALIDATION_TYPES",
".",
"FIELD",
"}",
"=",
"args",
";",
"const",
"errorMessages",
"=",
"errors",
".",
"reduce",
"(",
"(",
"messages",
",",
"error",
")",
"=>",
"{",
"const",
"isSameErrorCode",
"=",
"errorCode",
"&&",
"error",
".",
"code",
"===",
"errorCode",
";",
"const",
"isSamevalidationType",
"=",
"error",
".",
"validationType",
"===",
"validationType",
"||",
"(",
"validationType",
"===",
"VALIDATION_TYPES",
".",
"FIELD",
"&&",
"!",
"{",
"}",
".",
"hasOwnProperty",
".",
"call",
"(",
"error",
",",
"'validationType'",
")",
")",
";",
"if",
"(",
"isSameErrorCode",
"||",
"(",
"typeof",
"errorCode",
"===",
"'undefined'",
"&&",
"isSamevalidationType",
")",
")",
"{",
"return",
"messages",
"?",
"`${",
"messages",
"}, ${",
"error",
".",
"message",
"}`",
":",
"(",
"error",
".",
"message",
"as",
"string",
")",
";",
"}",
"return",
"messages",
";",
"}",
",",
"''",
")",
";",
"return",
"errorMessages",
"?",
"errorMessages",
":",
"null",
";",
"}",
",",
"[",
"errors",
"]",
")",
";",
"const",
"reset",
"=",
"useCallback",
"(",
"(",
"resetOptions",
"=",
"{",
"resetValue",
":",
"true",
"}",
")",
"=>",
"{",
"const",
"{",
"resetValue",
"=",
"true",
",",
"defaultValue",
":",
"updatedDefaultValue",
"}",
"=",
"resetOptions",
";",
"setPristine",
"(",
"true",
")",
";",
"if",
"(",
"isMounted",
".",
"current",
")",
"{",
"setIsModified",
"(",
"false",
")",
";",
"setValidating",
"(",
"false",
")",
";",
"setIsChangingValue",
"(",
"false",
")",
";",
"setIsValidated",
"(",
"false",
")",
";",
"setStateErrors",
"(",
"[",
"]",
")",
";",
"if",
"(",
"resetValue",
")",
"{",
"hasBeenReset",
".",
"current",
"=",
"true",
";",
"const",
"newValue",
"=",
"deserializeValue",
"(",
"updatedDefaultValue",
"??",
"defaultValue",
")",
";",
"setValue",
"(",
"newValue",
")",
";",
"return",
"newValue",
";",
"}",
"}",
"}",
",",
"[",
"deserializeValue",
",",
"defaultValue",
",",
"setValue",
",",
"setStateErrors",
"]",
")",
";",
"const",
"isValid",
"=",
"errors",
".",
"filter",
"(",
"(",
"e",
")",
"=>",
"e",
".",
"__isBlocking__",
"!==",
"false",
")",
".",
"length",
"===",
"0",
";",
"const",
"field",
"=",
"useMemo",
"<",
"FieldHook",
"<",
"T",
",",
"I",
">",
">",
"(",
"(",
")",
"=>",
"{",
"return",
"{",
"path",
",",
"type",
",",
"label",
",",
"labelAppend",
",",
"helpText",
",",
"value",
",",
"errors",
",",
"isPristine",
",",
"isDirty",
":",
"!",
"isPristine",
",",
"isModified",
",",
"isValid",
",",
"isValidating",
",",
"isValidated",
",",
"isChangingValue",
",",
"onChange",
",",
"getErrorsMessages",
",",
"setValue",
",",
"setErrors",
",",
"clearErrors",
",",
"validate",
",",
"reset",
",",
"__isIncludedInOutput",
":",
"isIncludedInOutput",
",",
"__serializeValue",
":",
"serializeValue",
",",
"}",
";",
"}",
",",
"[",
"path",
",",
"type",
",",
"label",
",",
"labelAppend",
",",
"helpText",
",",
"value",
",",
"isPristine",
",",
"isModified",
",",
"errors",
",",
"isValid",
",",
"isValidating",
",",
"isValidated",
",",
"isChangingValue",
",",
"isIncludedInOutput",
",",
"onChange",
",",
"getErrorsMessages",
",",
"setValue",
",",
"setErrors",
",",
"clearErrors",
",",
"validate",
",",
"reset",
",",
"serializeValue",
",",
"]",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"__addField",
"(",
"field",
"as",
"FieldHook",
"<",
"any",
">",
")",
";",
"}",
",",
"[",
"field",
",",
"__addField",
"]",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"return",
"(",
")",
"=>",
"{",
"__removeField",
"(",
"path",
")",
";",
"}",
";",
"}",
",",
"[",
"path",
",",
"__removeField",
"]",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"if",
"(",
"!",
"isMounted",
".",
"current",
")",
"{",
"return",
";",
"}",
"if",
"(",
"valueChangeListener",
"&&",
"value",
"!==",
"lastNotifiedState",
".",
"current",
".",
"value",
")",
"{",
"valueChangeListener",
"(",
"value",
")",
";",
"lastNotifiedState",
".",
"current",
".",
"value",
"=",
"value",
";",
"}",
"}",
",",
"[",
"value",
",",
"valueChangeListener",
"]",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"if",
"(",
"hasBeenReset",
".",
"current",
")",
"{",
"hasBeenReset",
".",
"current",
"=",
"false",
";",
"return",
";",
"}",
"if",
"(",
"!",
"isMounted",
".",
"current",
")",
"{",
"return",
";",
"}",
"onValueChange",
"(",
")",
";",
"return",
"(",
")",
"=>",
"{",
"if",
"(",
"debounceTimeout",
".",
"current",
")",
"{",
"clearTimeout",
"(",
"debounceTimeout",
".",
"current",
")",
";",
"debounceTimeout",
".",
"current",
"=",
"null",
";",
"}",
"}",
";",
"}",
",",
"[",
"onValueChange",
"]",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"setIsModified",
"(",
"(",
")",
"=>",
"{",
"if",
"(",
"typeof",
"value",
"===",
"'object'",
")",
"{",
"return",
"JSON",
".",
"stringify",
"(",
"value",
")",
"!==",
"JSON",
".",
"stringify",
"(",
"initialValue",
")",
";",
"}",
"return",
"value",
"!==",
"initialValue",
";",
"}",
")",
";",
"}",
",",
"[",
"value",
",",
"initialValue",
"]",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"if",
"(",
"!",
"isMounted",
".",
"current",
")",
"{",
"return",
";",
"}",
"const",
"errorMessages",
"=",
"errors",
".",
"length",
"?",
"errors",
".",
"map",
"(",
"(",
"error",
")",
"=>",
"error",
".",
"message",
")",
":",
"null",
";",
"if",
"(",
"errorChangeListener",
"&&",
"lastNotifiedState",
".",
"current",
".",
"errors",
"!==",
"errorMessages",
")",
"{",
"errorChangeListener",
"(",
"errorMessages",
")",
";",
"lastNotifiedState",
".",
"current",
".",
"errors",
"=",
"errorMessages",
";",
"}",
"}",
",",
"[",
"errors",
",",
"errorChangeListener",
"]",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"isMounted",
".",
"current",
"=",
"true",
";",
"return",
"(",
")",
"=>",
"{",
"isMounted",
".",
"current",
"=",
"false",
";",
"}",
";",
"}",
",",
"[",
"]",
")",
";",
"return",
"field",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
18792,
null,
2,
null,
null,
null,
null,
null,
null,
4,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
741 | [
"import",
"{",
"useState",
",",
"useRef",
",",
"useEffect",
",",
"useMemo",
",",
"useCallback",
"}",
"from",
"'react'",
";",
"import",
"{",
"get",
"}",
"from",
"'lodash'",
";",
"import",
"{",
"set",
"}",
"from",
"'@elastic/safer-lodash-set'",
";",
"import",
"{",
"FormHook",
",",
"FieldHook",
",",
"FormData",
",",
"FieldConfig",
",",
"FieldsMap",
",",
"FormConfig",
"}",
"from",
"'../types'",
";",
"import",
"{",
"mapFormFields",
",",
"unflattenObject",
",",
"Subject",
",",
"Subscription",
"}",
"from",
"'../lib'",
";",
"const",
"DEFAULT_OPTIONS",
"=",
"{",
"valueChangeDebounceTime",
":",
"500",
",",
"stripEmptyFields",
":",
"true",
",",
"}",
";",
"export",
"interface",
"UseFormReturn",
"<",
"T",
"extends",
"FormData",
",",
"I",
"extends",
"FormData",
">",
"{",
"form",
":",
"FormHook",
"<",
"T",
",",
"I",
">",
";",
"}",
"export",
"function",
"useForm",
"<",
"T",
"extends",
"FormData",
"=",
"FormData",
",",
"I",
"extends",
"FormData",
"=",
"T",
">",
"(",
"formConfig",
"?",
")",
"{",
"const",
"{",
"onSubmit",
",",
"schema",
",",
"serializer",
",",
"deserializer",
",",
"options",
",",
"id",
"=",
"'default'",
",",
"defaultValue",
",",
"}",
"=",
"formConfig",
"??",
"{",
"}",
";",
"const",
"initDefaultValue",
"=",
"useCallback",
"(",
"(",
"_defaultValue",
"?",
")",
":",
"{",
"[",
"key",
"]",
":",
"any",
";",
"}",
"=>",
"{",
"if",
"(",
"_defaultValue",
"===",
"undefined",
"||",
"Object",
".",
"keys",
"(",
"_defaultValue",
")",
".",
"length",
"===",
"0",
")",
"{",
"return",
"{",
"}",
";",
"}",
"const",
"filtered",
"=",
"Object",
".",
"entries",
"(",
"_defaultValue",
"as",
"object",
")",
".",
"filter",
"(",
"(",
"{",
"1",
":",
"value",
"}",
")",
"=>",
"value",
"!==",
"undefined",
")",
".",
"reduce",
"(",
"(",
"acc",
",",
"[",
"key",
",",
"value",
"]",
")",
"=>",
"(",
"{",
"...",
"acc",
",",
"[",
"key",
"]",
":",
"value",
"}",
")",
",",
"{",
"}",
"as",
"T",
")",
";",
"return",
"deserializer",
"?",
"deserializer",
"(",
"filtered",
")",
":",
"filtered",
";",
"}",
",",
"[",
"deserializer",
"]",
")",
";",
"const",
"defaultValueMemoized",
"=",
"useMemo",
"<",
"{",
"[",
"key",
"]",
":",
"any",
";",
"}",
">",
"(",
"(",
")",
"=>",
"{",
"return",
"initDefaultValue",
"(",
"defaultValue",
")",
";",
"}",
",",
"[",
"defaultValue",
",",
"initDefaultValue",
"]",
")",
";",
"const",
"{",
"valueChangeDebounceTime",
",",
"stripEmptyFields",
":",
"doStripEmptyFields",
"}",
"=",
"options",
"??",
"{",
"}",
";",
"const",
"formOptions",
"=",
"useMemo",
"(",
"(",
")",
"=>",
"(",
"{",
"stripEmptyFields",
":",
"doStripEmptyFields",
"??",
"DEFAULT_OPTIONS",
".",
"stripEmptyFields",
",",
"valueChangeDebounceTime",
":",
"valueChangeDebounceTime",
"??",
"DEFAULT_OPTIONS",
".",
"valueChangeDebounceTime",
",",
"}",
")",
",",
"[",
"valueChangeDebounceTime",
",",
"doStripEmptyFields",
"]",
")",
";",
"const",
"[",
"isSubmitted",
",",
"setIsSubmitted",
"]",
"=",
"useState",
"(",
"false",
")",
";",
"const",
"[",
"isSubmitting",
",",
"setSubmitting",
"]",
"=",
"useState",
"(",
"false",
")",
";",
"const",
"[",
"isValid",
",",
"setIsValid",
"]",
"=",
"useState",
"<",
"boolean",
"|",
"undefined",
">",
"(",
"undefined",
")",
";",
"const",
"[",
"errorMessages",
",",
"setErrorMessages",
"]",
"=",
"useState",
"<",
"{",
"[",
"fieldName",
"]",
":",
"string",
";",
"}",
">",
"(",
"{",
"}",
")",
";",
"const",
"fieldsRefs",
"=",
"useRef",
"<",
"FieldsMap",
">",
"(",
"{",
"}",
")",
";",
"const",
"fieldsRemovedRefs",
"=",
"useRef",
"<",
"FieldsMap",
">",
"(",
"{",
"}",
")",
";",
"const",
"formUpdateSubscribers",
"=",
"useRef",
"<",
"Subscription",
"[",
"]",
">",
"(",
"[",
"]",
")",
";",
"const",
"isMounted",
"=",
"useRef",
"<",
"boolean",
">",
"(",
"false",
")",
";",
"const",
"defaultValueDeserialized",
"=",
"useRef",
"(",
"defaultValueMemoized",
")",
";",
"/**\n * We have both a state and a ref for the error messages so the consumer can, in the same callback,\n * validate the form **and** have the errors returned immediately.\n *\n * ```\n * const myHandler = useCallback(async () => {\n * const isFormValid = await validate();\n * const errors = getErrors(); // errors from the validate() call are there\n * }, [validate, getErrors]);\n * ```\n */",
"const",
"errorMessagesRef",
"=",
"useRef",
"<",
"{",
"[",
"fieldName",
"]",
":",
"string",
";",
"}",
">",
"(",
"{",
"}",
")",
";",
"const",
"formData$",
"=",
"useRef",
"<",
"Subject",
"<",
"FormData",
">",
"|",
"null",
">",
"(",
"null",
")",
";",
"const",
"getFormData$",
"=",
"useCallback",
"(",
"(",
")",
":",
"Subject",
"<",
"FormData",
">",
"=>",
"{",
"if",
"(",
"formData$",
".",
"current",
"===",
"null",
")",
"{",
"formData$",
".",
"current",
"=",
"new",
"Subject",
"<",
"FormData",
">",
"(",
"{",
"}",
")",
";",
"}",
"return",
"formData$",
".",
"current",
";",
"}",
",",
"[",
"]",
")",
";",
"const",
"updateFormData$",
"=",
"useCallback",
"(",
"(",
"nextValue",
")",
"=>",
"{",
"getFormData$",
"(",
")",
".",
"next",
"(",
"nextValue",
")",
";",
"}",
",",
"[",
"getFormData$",
"]",
")",
";",
"const",
"updateFieldErrorMessage",
"=",
"useCallback",
"(",
"(",
"path",
",",
"errorMessage",
")",
"=>",
"{",
"setErrorMessages",
"(",
"(",
"prev",
")",
"=>",
"{",
"const",
"previousMessageValue",
"=",
"prev",
"[",
"path",
"]",
";",
"if",
"(",
"errorMessage",
"===",
"previousMessageValue",
"||",
"(",
"previousMessageValue",
"===",
"undefined",
"&&",
"errorMessage",
"===",
"null",
")",
")",
"{",
"return",
"prev",
";",
"}",
"if",
"(",
"errorMessage",
"===",
"null",
")",
"{",
"const",
"{",
"[",
"path",
"]",
":",
"discard",
",",
"...",
"next",
"}",
"=",
"prev",
";",
"errorMessagesRef",
".",
"current",
"=",
"next",
";",
"return",
"next",
";",
"}",
"const",
"next",
"=",
"{",
"...",
"prev",
",",
"[",
"path",
"]",
":",
"errorMessage",
",",
"}",
";",
"errorMessagesRef",
".",
"current",
"=",
"next",
";",
"return",
"next",
";",
"}",
")",
";",
"}",
",",
"[",
"]",
")",
";",
"const",
"fieldsToArray",
"=",
"useCallback",
"<",
"(",
")",
"=>",
"FieldHook",
"[",
"]",
">",
"(",
"(",
")",
"=>",
"Object",
".",
"values",
"(",
"fieldsRefs",
".",
"current",
")",
",",
"[",
"]",
")",
";",
"const",
"getFieldsForOutput",
"=",
"useCallback",
"(",
"(",
"fields",
",",
"opts",
")",
":",
"FieldsMap",
"=>",
"{",
"return",
"Object",
".",
"entries",
"(",
"fields",
")",
".",
"reduce",
"(",
"(",
"acc",
",",
"[",
"key",
",",
"field",
"]",
")",
"=>",
"{",
"if",
"(",
"!",
"field",
".",
"__isIncludedInOutput",
")",
"{",
"return",
"acc",
";",
"}",
"if",
"(",
"opts",
".",
"stripEmptyFields",
")",
"{",
"const",
"isFieldEmpty",
"=",
"typeof",
"field",
".",
"value",
"===",
"'string'",
"&&",
"field",
".",
"value",
".",
"trim",
"(",
")",
"===",
"''",
";",
"if",
"(",
"isFieldEmpty",
")",
"{",
"return",
"acc",
";",
"}",
"}",
"acc",
"[",
"key",
"]",
"=",
"field",
";",
"return",
"acc",
";",
"}",
",",
"{",
"}",
"as",
"FieldsMap",
")",
";",
"}",
",",
"[",
"]",
")",
";",
"const",
"updateFormDataAt",
"=",
"useCallback",
"(",
"(",
"path",
",",
"value",
")",
"=>",
"{",
"const",
"currentFormData",
"=",
"getFormData$",
"(",
")",
".",
"value",
";",
"if",
"(",
"currentFormData",
"[",
"path",
"]",
"!==",
"value",
")",
"{",
"updateFormData$",
"(",
"{",
"...",
"currentFormData",
",",
"[",
"path",
"]",
":",
"value",
"}",
")",
";",
"}",
"}",
",",
"[",
"getFormData$",
",",
"updateFormData$",
"]",
")",
";",
"const",
"updateDefaultValueAt",
"=",
"useCallback",
"(",
"(",
"path",
",",
"value",
")",
"=>",
"{",
"set",
"(",
"defaultValueDeserialized",
".",
"current",
",",
"path",
",",
"value",
")",
";",
"}",
",",
"[",
"]",
")",
";",
"const",
"isFieldValid",
"=",
"(",
"field",
")",
"=>",
"field",
".",
"isValid",
"&&",
"!",
"field",
".",
"isValidating",
";",
"const",
"waitForFieldsToFinishValidating",
"=",
"useCallback",
"(",
"async",
"(",
")",
"=>",
"{",
"let",
"areSomeFieldValidating",
"=",
"fieldsToArray",
"(",
")",
".",
"some",
"(",
"(",
"field",
")",
"=>",
"field",
".",
"isValidating",
")",
";",
"if",
"(",
"!",
"areSomeFieldValidating",
")",
"{",
"return",
";",
"}",
"return",
"new",
"Promise",
"<",
"void",
">",
"(",
"(",
"resolve",
")",
"=>",
"{",
"setTimeout",
"(",
"(",
")",
"=>",
"{",
"areSomeFieldValidating",
"=",
"fieldsToArray",
"(",
")",
".",
"some",
"(",
"(",
"field",
")",
"=>",
"field",
".",
"isValidating",
")",
";",
"if",
"(",
"areSomeFieldValidating",
")",
"{",
"return",
"waitForFieldsToFinishValidating",
"(",
")",
".",
"then",
"(",
"resolve",
")",
";",
"}",
"resolve",
"(",
")",
";",
"}",
",",
"100",
")",
";",
"}",
")",
";",
"}",
",",
"[",
"fieldsToArray",
"]",
")",
";",
"const",
"validateFields",
"=",
"useCallback",
"(",
"async",
"(",
"fieldNames",
",",
"onlyBlocking",
"=",
"false",
")",
"=>",
"{",
"const",
"fieldsToValidate",
"=",
"fieldNames",
".",
"map",
"(",
"(",
"name",
")",
"=>",
"fieldsRefs",
".",
"current",
"[",
"name",
"]",
")",
".",
"filter",
"(",
"(",
"field",
")",
"=>",
"field",
"!==",
"undefined",
")",
";",
"const",
"formData",
"=",
"getFormData$",
"(",
")",
".",
"value",
";",
"const",
"validationResult",
"=",
"await",
"Promise",
".",
"all",
"(",
"fieldsToValidate",
".",
"map",
"(",
"(",
"field",
")",
"=>",
"field",
".",
"validate",
"(",
"{",
"formData",
",",
"onlyBlocking",
"}",
")",
")",
")",
";",
"if",
"(",
"isMounted",
".",
"current",
"===",
"false",
")",
"{",
"return",
"{",
"areFieldsValid",
":",
"true",
",",
"isFormValid",
":",
"true",
"}",
";",
"}",
"const",
"areFieldsValid",
"=",
"validationResult",
".",
"every",
"(",
"(",
"res",
")",
"=>",
"res",
".",
"isValid",
")",
";",
"const",
"validationResultByPath",
"=",
"fieldsToValidate",
".",
"reduce",
"(",
"(",
"acc",
",",
"field",
",",
"i",
")",
"=>",
"{",
"acc",
"[",
"field",
".",
"path",
"]",
"=",
"validationResult",
"[",
"i",
"]",
".",
"isValid",
";",
"return",
"acc",
";",
"}",
",",
"{",
"}",
"as",
"{",
"[",
"key",
"]",
":",
"boolean",
";",
"}",
")",
";",
"const",
"formFieldsValidity",
"=",
"fieldsToArray",
"(",
")",
".",
"map",
"(",
"(",
"field",
")",
"=>",
"{",
"const",
"hasUpdatedValidity",
"=",
"validationResultByPath",
"[",
"field",
".",
"path",
"]",
"!==",
"undefined",
";",
"const",
"_isValid",
"=",
"validationResultByPath",
"[",
"field",
".",
"path",
"]",
"??",
"field",
".",
"isValid",
";",
"const",
"_isValidated",
"=",
"hasUpdatedValidity",
"?",
"true",
":",
"field",
".",
"isValidated",
";",
"const",
"_isValidating",
"=",
"hasUpdatedValidity",
"?",
"false",
":",
"field",
".",
"isValidating",
";",
"return",
"{",
"isValid",
":",
"_isValid",
",",
"isValidated",
":",
"_isValidated",
",",
"isValidating",
":",
"_isValidating",
",",
"}",
";",
"}",
")",
";",
"const",
"areAllFieldsValidated",
"=",
"formFieldsValidity",
".",
"every",
"(",
"(",
"field",
")",
"=>",
"field",
".",
"isValidated",
")",
";",
"const",
"areSomeFieldValidating",
"=",
"formFieldsValidity",
".",
"some",
"(",
"(",
"field",
")",
"=>",
"field",
".",
"isValidating",
")",
";",
"const",
"isFormValid",
"=",
"areAllFieldsValidated",
"&&",
"areSomeFieldValidating",
"===",
"false",
"?",
"formFieldsValidity",
".",
"every",
"(",
"(",
"field",
")",
"=>",
"field",
".",
"isValid",
")",
":",
"undefined",
";",
"setIsValid",
"(",
"isFormValid",
")",
";",
"return",
"{",
"areFieldsValid",
",",
"isFormValid",
"}",
";",
"}",
",",
"[",
"getFormData$",
",",
"fieldsToArray",
"]",
")",
";",
"const",
"addField",
"=",
"useCallback",
"(",
"(",
"field",
")",
"=>",
"{",
"const",
"fieldExists",
"=",
"fieldsRefs",
".",
"current",
"[",
"field",
".",
"path",
"]",
"!==",
"undefined",
";",
"fieldsRefs",
".",
"current",
"[",
"field",
".",
"path",
"]",
"=",
"field",
";",
"delete",
"fieldsRemovedRefs",
".",
"current",
"[",
"field",
".",
"path",
"]",
";",
"updateFormDataAt",
"(",
"field",
".",
"path",
",",
"field",
".",
"value",
")",
";",
"updateFieldErrorMessage",
"(",
"field",
".",
"path",
",",
"field",
".",
"getErrorsMessages",
"(",
")",
")",
";",
"if",
"(",
"!",
"fieldExists",
"&&",
"!",
"field",
".",
"isValidated",
")",
"{",
"setIsValid",
"(",
"undefined",
")",
";",
"setIsSubmitted",
"(",
"false",
")",
";",
"}",
"}",
",",
"[",
"updateFormDataAt",
",",
"updateFieldErrorMessage",
"]",
")",
";",
"const",
"removeField",
"=",
"useCallback",
"(",
"(",
"_fieldNames",
")",
"=>",
"{",
"const",
"fieldNames",
"=",
"Array",
".",
"isArray",
"(",
"_fieldNames",
")",
"?",
"_fieldNames",
":",
"[",
"_fieldNames",
"]",
";",
"const",
"currentFormData",
"=",
"{",
"...",
"getFormData$",
"(",
")",
".",
"value",
"}",
";",
"fieldNames",
".",
"forEach",
"(",
"(",
"name",
")",
"=>",
"{",
"fieldsRemovedRefs",
".",
"current",
"[",
"name",
"]",
"=",
"fieldsRefs",
".",
"current",
"[",
"name",
"]",
";",
"updateFieldErrorMessage",
"(",
"name",
",",
"null",
")",
";",
"delete",
"fieldsRefs",
".",
"current",
"[",
"name",
"]",
";",
"delete",
"currentFormData",
"[",
"name",
"]",
";",
"}",
")",
";",
"updateFormData$",
"(",
"currentFormData",
")",
";",
"/**\n * After removing a field, the form validity might have changed\n * (an invalid field might have been removed and now the form is valid)\n */",
"setIsValid",
"(",
"(",
"prev",
")",
"=>",
"{",
"if",
"(",
"prev",
"===",
"false",
")",
"{",
"const",
"isFormValid",
"=",
"fieldsToArray",
"(",
")",
".",
"every",
"(",
"isFieldValid",
")",
";",
"return",
"isFormValid",
";",
"}",
"return",
"prev",
";",
"}",
")",
";",
"}",
",",
"[",
"getFormData$",
",",
"updateFormData$",
",",
"fieldsToArray",
",",
"updateFieldErrorMessage",
"]",
")",
";",
"const",
"getFormDefaultValue",
"=",
"useCallback",
"(",
"(",
")",
"=>",
"defaultValueDeserialized",
".",
"current",
",",
"[",
"]",
")",
";",
"const",
"readFieldConfigFromSchema",
"=",
"useCallback",
"(",
"(",
"fieldName",
")",
"=>",
"{",
"const",
"config",
"=",
"(",
"get",
"(",
"schema",
"??",
"{",
"}",
",",
"fieldName",
")",
"as",
"FieldConfig",
")",
"||",
"{",
"}",
";",
"return",
"config",
";",
"}",
",",
"[",
"schema",
"]",
")",
";",
"const",
"getFieldsRemoved",
"=",
"useCallback",
"(",
"(",
")",
"=>",
"fieldsRemovedRefs",
".",
"current",
",",
"[",
"]",
")",
";",
"const",
"getFormData",
"=",
"useCallback",
"(",
"(",
")",
"=>",
"{",
"const",
"fieldsToOutput",
"=",
"getFieldsForOutput",
"(",
"fieldsRefs",
".",
"current",
",",
"{",
"stripEmptyFields",
":",
"formOptions",
".",
"stripEmptyFields",
",",
"}",
")",
";",
"const",
"fieldsValue",
"=",
"mapFormFields",
"(",
"fieldsToOutput",
",",
"(",
"field",
")",
"=>",
"field",
".",
"__serializeValue",
"(",
")",
")",
";",
"return",
"serializer",
"?",
"serializer",
"(",
"unflattenObject",
"<",
"I",
">",
"(",
"fieldsValue",
")",
")",
":",
"unflattenObject",
"<",
"T",
">",
"(",
"fieldsValue",
")",
";",
"}",
",",
"[",
"getFieldsForOutput",
",",
"formOptions",
".",
"stripEmptyFields",
",",
"serializer",
"]",
")",
";",
"const",
"getErrors",
"=",
"useCallback",
"(",
"(",
")",
"=>",
"{",
"if",
"(",
"isValid",
"===",
"true",
")",
"{",
"return",
"[",
"]",
";",
"}",
"return",
"Object",
".",
"values",
"(",
"{",
"...",
"errorMessages",
",",
"...",
"errorMessagesRef",
".",
"current",
"}",
")",
";",
"}",
",",
"[",
"isValid",
",",
"errorMessages",
"]",
")",
";",
"const",
"validate",
"=",
"useCallback",
"(",
"async",
"(",
")",
":",
"Promise",
"<",
"boolean",
">",
"=>",
"{",
"await",
"waitForFieldsToFinishValidating",
"(",
")",
";",
"if",
"(",
"!",
"isMounted",
".",
"current",
")",
"{",
"return",
"false",
";",
"}",
"const",
"fieldsArray",
"=",
"fieldsToArray",
"(",
")",
";",
"const",
"fieldsToValidate",
"=",
"fieldsArray",
".",
"filter",
"(",
"(",
"field",
")",
"=>",
"!",
"field",
".",
"isValidated",
")",
";",
"let",
"isFormValid",
";",
"if",
"(",
"fieldsToValidate",
".",
"length",
"===",
"0",
")",
"{",
"isFormValid",
"=",
"fieldsArray",
".",
"every",
"(",
"isFieldValid",
")",
";",
"}",
"else",
"{",
"const",
"fieldPathsToValidate",
"=",
"fieldsToValidate",
".",
"map",
"(",
"(",
"field",
")",
"=>",
"field",
".",
"path",
")",
";",
"(",
"{",
"isFormValid",
"}",
"=",
"await",
"validateFields",
"(",
"fieldPathsToValidate",
",",
"true",
")",
")",
";",
"}",
"setIsValid",
"(",
"isFormValid",
")",
";",
"return",
"isFormValid",
"!",
";",
"}",
",",
"[",
"fieldsToArray",
",",
"validateFields",
",",
"waitForFieldsToFinishValidating",
"]",
")",
";",
"const",
"setFieldValue",
"=",
"useCallback",
"(",
"(",
"fieldName",
",",
"value",
")",
"=>",
"{",
"if",
"(",
"fieldsRefs",
".",
"current",
"[",
"fieldName",
"]",
"===",
"undefined",
")",
"{",
"return",
";",
"}",
"fieldsRefs",
".",
"current",
"[",
"fieldName",
"]",
".",
"setValue",
"(",
"value",
")",
";",
"}",
",",
"[",
"]",
")",
";",
"const",
"setFieldErrors",
"=",
"useCallback",
"(",
"(",
"fieldName",
",",
"errors",
")",
"=>",
"{",
"if",
"(",
"fieldsRefs",
".",
"current",
"[",
"fieldName",
"]",
"===",
"undefined",
")",
"{",
"return",
";",
"}",
"fieldsRefs",
".",
"current",
"[",
"fieldName",
"]",
".",
"setErrors",
"(",
"errors",
")",
";",
"}",
",",
"[",
"]",
")",
";",
"const",
"getFields",
"=",
"useCallback",
"(",
"(",
")",
"=>",
"fieldsRefs",
".",
"current",
",",
"[",
"]",
")",
";",
"const",
"getFieldDefaultValue",
"=",
"useCallback",
"(",
"(",
"fieldName",
")",
"=>",
"get",
"(",
"defaultValueDeserialized",
".",
"current",
",",
"fieldName",
")",
",",
"[",
"]",
")",
";",
"const",
"submit",
"=",
"useCallback",
"(",
"async",
"(",
"e",
")",
"=>",
"{",
"if",
"(",
"e",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"}",
"setIsSubmitted",
"(",
"true",
")",
";",
"setSubmitting",
"(",
"true",
")",
";",
"const",
"isFormValid",
"=",
"await",
"validate",
"(",
")",
";",
"const",
"formData",
"=",
"isFormValid",
"?",
"getFormData",
"(",
")",
":",
"(",
"{",
"}",
"as",
"T",
")",
";",
"if",
"(",
"onSubmit",
")",
"{",
"await",
"onSubmit",
"(",
"formData",
",",
"isFormValid",
"!",
")",
";",
"}",
"if",
"(",
"isMounted",
".",
"current",
")",
"{",
"setSubmitting",
"(",
"false",
")",
";",
"}",
"return",
"{",
"data",
":",
"formData",
",",
"isValid",
":",
"isFormValid",
"!",
"}",
";",
"}",
",",
"[",
"validate",
",",
"getFormData",
",",
"onSubmit",
"]",
")",
";",
"const",
"subscribe",
"=",
"useCallback",
"(",
"(",
"handler",
")",
"=>",
"{",
"const",
"subscription",
"=",
"getFormData$",
"(",
")",
".",
"subscribe",
"(",
"(",
"raw",
")",
"=>",
"{",
"handler",
"(",
"{",
"isValid",
",",
"data",
":",
"{",
"internal",
":",
"unflattenObject",
"<",
"I",
">",
"(",
"raw",
")",
",",
"format",
":",
"getFormData",
"}",
",",
"validate",
",",
"}",
")",
";",
"}",
")",
";",
"formUpdateSubscribers",
".",
"current",
".",
"push",
"(",
"subscription",
")",
";",
"return",
"{",
"unsubscribe",
"(",
")",
"{",
"formUpdateSubscribers",
".",
"current",
"=",
"formUpdateSubscribers",
".",
"current",
".",
"filter",
"(",
"(",
"sub",
")",
"=>",
"sub",
"!==",
"subscription",
")",
";",
"return",
"subscription",
".",
"unsubscribe",
"(",
")",
";",
"}",
",",
"}",
";",
"}",
",",
"[",
"getFormData$",
",",
"isValid",
",",
"getFormData",
",",
"validate",
"]",
")",
";",
"const",
"reset",
"=",
"useCallback",
"(",
"(",
"resetOptions",
"=",
"{",
"resetValues",
":",
"true",
"}",
")",
"=>",
"{",
"const",
"{",
"resetValues",
"=",
"true",
",",
"defaultValue",
":",
"updatedDefaultValue",
"}",
"=",
"resetOptions",
";",
"const",
"currentFormData",
"=",
"{",
"...",
"getFormData$",
"(",
")",
".",
"value",
"}",
";",
"if",
"(",
"updatedDefaultValue",
")",
"{",
"defaultValueDeserialized",
".",
"current",
"=",
"initDefaultValue",
"(",
"updatedDefaultValue",
")",
";",
"}",
"Object",
".",
"entries",
"(",
"fieldsRefs",
".",
"current",
")",
".",
"forEach",
"(",
"(",
"[",
"path",
",",
"field",
"]",
")",
"=>",
"{",
"const",
"isFieldMounted",
"=",
"fieldsRefs",
".",
"current",
"[",
"path",
"]",
"!==",
"undefined",
";",
"if",
"(",
"isFieldMounted",
")",
"{",
"const",
"fieldDefaultValue",
"=",
"getFieldDefaultValue",
"(",
"path",
")",
";",
"field",
".",
"reset",
"(",
"{",
"resetValue",
":",
"resetValues",
",",
"defaultValue",
":",
"fieldDefaultValue",
"}",
")",
";",
"currentFormData",
"[",
"path",
"]",
"=",
"fieldDefaultValue",
";",
"}",
"}",
")",
";",
"if",
"(",
"resetValues",
")",
"{",
"updateFormData$",
"(",
"currentFormData",
")",
";",
"}",
"setIsSubmitted",
"(",
"false",
")",
";",
"setSubmitting",
"(",
"false",
")",
";",
"setIsValid",
"(",
"undefined",
")",
";",
"}",
",",
"[",
"getFormData$",
",",
"updateFormData$",
",",
"initDefaultValue",
",",
"getFieldDefaultValue",
"]",
")",
";",
"const",
"form",
"=",
"useMemo",
"<",
"FormHook",
"<",
"T",
",",
"I",
">",
">",
"(",
"(",
")",
"=>",
"{",
"return",
"{",
"isSubmitted",
",",
"isSubmitting",
",",
"isValid",
",",
"id",
",",
"submit",
",",
"validate",
",",
"subscribe",
",",
"setFieldValue",
",",
"setFieldErrors",
",",
"getFields",
",",
"getFieldDefaultValue",
",",
"getFormData",
",",
"getErrors",
",",
"reset",
",",
"validateFields",
",",
"__options",
":",
"formOptions",
",",
"__getFormData$",
":",
"getFormData$",
",",
"__updateFormDataAt",
":",
"updateFormDataAt",
",",
"__updateDefaultValueAt",
":",
"updateDefaultValueAt",
",",
"__readFieldConfigFromSchema",
":",
"readFieldConfigFromSchema",
",",
"__getFormDefaultValue",
":",
"getFormDefaultValue",
",",
"__addField",
":",
"addField",
",",
"__removeField",
":",
"removeField",
",",
"__getFieldsRemoved",
":",
"getFieldsRemoved",
",",
"}",
";",
"}",
",",
"[",
"isSubmitted",
",",
"isSubmitting",
",",
"isValid",
",",
"id",
",",
"submit",
",",
"subscribe",
",",
"setFieldValue",
",",
"setFieldErrors",
",",
"getFields",
",",
"getFieldsRemoved",
",",
"getFormData",
",",
"getErrors",
",",
"getFormDefaultValue",
",",
"getFieldDefaultValue",
",",
"reset",
",",
"formOptions",
",",
"getFormData$",
",",
"updateFormDataAt",
",",
"updateDefaultValueAt",
",",
"readFieldConfigFromSchema",
",",
"addField",
",",
"removeField",
",",
"validateFields",
",",
"validate",
",",
"]",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"if",
"(",
"!",
"isMounted",
".",
"current",
")",
"{",
"return",
";",
"}",
"defaultValueDeserialized",
".",
"current",
"=",
"defaultValueMemoized",
";",
"}",
",",
"[",
"defaultValueMemoized",
"]",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"isMounted",
".",
"current",
"=",
"true",
";",
"return",
"(",
")",
"=>",
"{",
"isMounted",
".",
"current",
"=",
"false",
";",
"formUpdateSubscribers",
".",
"current",
".",
"forEach",
"(",
"(",
"subscription",
")",
"=>",
"subscription",
".",
"unsubscribe",
"(",
")",
")",
";",
"formUpdateSubscribers",
".",
"current",
"=",
"[",
"]",
";",
"}",
";",
"}",
",",
"[",
"]",
")",
";",
"return",
"{",
"form",
",",
"}",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
14326,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4034,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
20,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
381,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
21735,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
9384,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17,
null,
null,
null,
null,
null,
null,
21735,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
742 | [
"import",
"React",
",",
"{",
"createContext",
",",
"useContext",
",",
"useMemo",
"}",
"from",
"'react'",
";",
"import",
"{",
"FormData",
",",
"FormHook",
"}",
"from",
"'./types'",
";",
"import",
"{",
"Subject",
"}",
"from",
"'./lib'",
";",
"export",
"interface",
"Context",
"<",
"T",
"extends",
"FormData",
"=",
"FormData",
",",
"I",
"extends",
"FormData",
"=",
"T",
">",
"{",
"getFormData$",
":",
"(",
")",
"=>",
"Subject",
"<",
"FormData",
">",
";",
"getFormData",
":",
"FormHook",
"<",
"T",
",",
"I",
">",
"[",
"'getFormData'",
"]",
";",
"}",
"const",
"FormDataContext",
"=",
"createContext",
"<",
"Context",
"<",
"any",
">",
"|",
"undefined",
">",
"(",
"undefined",
")",
";",
"interface",
"Props",
"extends",
"Context",
"{",
"children",
":",
"React",
".",
"ReactNode",
";",
"}",
"export",
"const",
"FormDataContextProvider",
"=",
"(",
"{",
"children",
",",
"getFormData$",
",",
"getFormData",
"}",
")",
"=>",
"{",
"const",
"value",
"=",
"useMemo",
"<",
"Context",
">",
"(",
"(",
")",
"=>",
"(",
"{",
"getFormData",
",",
"getFormData$",
",",
"}",
")",
",",
"[",
"getFormData",
",",
"getFormData$",
"]",
")",
";",
"return",
"<",
"FormDataContext",
".",
"Provider",
"value",
"=",
"{",
"value",
"}",
">",
"{",
"children",
"}",
"<",
"/FormDataContext.Provider>;",
"}",
";",
"export",
"function",
"useFormDataContext",
"<",
"T",
"extends",
"FormData",
"=",
"FormData",
",",
"I",
"extends",
"FormData",
"=",
"T",
">",
"(",
")",
"{",
"return",
"useContext",
"<",
"Context",
"<",
"T",
",",
"I",
">",
"|",
"undefined",
">",
"(",
"FormDataContext",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
743 | [
"import",
"{",
"useState",
",",
"useEffect",
",",
"useRef",
",",
"useCallback",
"}",
"from",
"'react'",
";",
"import",
"{",
"FormData",
",",
"FormHook",
"}",
"from",
"'../types'",
";",
"import",
"{",
"unflattenObject",
"}",
"from",
"'../lib'",
";",
"import",
"{",
"useFormDataContext",
",",
"Context",
"}",
"from",
"'../form_data_context'",
";",
"interface",
"Options",
"<",
"I",
">",
"{",
"watch",
"?",
":",
"string",
"|",
"string",
"[",
"]",
";",
"form",
"?",
":",
"FormHook",
"<",
"any",
">",
";",
"/**\n * Use this handler if you want to listen to field value change\n * before the validations are ran.\n */",
"onChange",
"?",
":",
"(",
"formData",
":",
"I",
")",
"=>",
"void",
";",
"}",
"export",
"type",
"HookReturn",
"<",
"I",
"extends",
"object",
"=",
"FormData",
",",
"T",
"extends",
"object",
"=",
"I",
">",
"=",
"[",
"I",
",",
"(",
")",
"=>",
"T",
",",
"boolean",
"]",
";",
"export",
"const",
"useFormData",
"=",
"<",
"I",
"extends",
"object",
"=",
"FormData",
",",
"T",
"extends",
"object",
"=",
"I",
">",
"(",
"options",
"=",
"{",
"}",
")",
":",
"HookReturn",
"<",
"I",
",",
"T",
">",
"=>",
"{",
"const",
"{",
"watch",
",",
"form",
",",
"onChange",
"}",
"=",
"options",
";",
"const",
"ctx",
"=",
"useFormDataContext",
"<",
"T",
",",
"I",
">",
"(",
")",
";",
"const",
"watchToArray",
"=",
"watch",
"===",
"undefined",
"?",
"[",
"]",
":",
"Array",
".",
"isArray",
"(",
"watch",
")",
"?",
"watch",
":",
"[",
"watch",
"]",
";",
"const",
"stringifiedWatch",
"=",
"watchToArray",
".",
"join",
"(",
"'.'",
")",
";",
"let",
"getFormData",
";",
"let",
"getFormData$",
";",
"if",
"(",
"form",
"!==",
"undefined",
")",
"{",
"getFormData",
"=",
"form",
".",
"getFormData",
";",
"getFormData$",
"=",
"form",
".",
"__getFormData$",
";",
"}",
"else",
"if",
"(",
"ctx",
"!==",
"undefined",
")",
"{",
"(",
"{",
"getFormData",
",",
"getFormData$",
"}",
"=",
"ctx",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"Error",
"(",
"'useFormData() must be used within a <FormDataContextProvider /> or you need to pass FormHook object in the options.'",
")",
";",
"}",
"const",
"initialValue",
"=",
"getFormData$",
"(",
")",
".",
"value",
";",
"const",
"previousRawData",
"=",
"useRef",
"<",
"FormData",
">",
"(",
"initialValue",
")",
";",
"const",
"isMounted",
"=",
"useRef",
"(",
"false",
")",
";",
"const",
"[",
"formData",
",",
"setFormData",
"]",
"=",
"useState",
"<",
"I",
">",
"(",
"(",
")",
"=>",
"unflattenObject",
"<",
"I",
">",
"(",
"previousRawData",
".",
"current",
")",
")",
";",
"/**\n * We do want to offer to the consumer a handler to serialize the form data that changes each time\n * the formData **state** changes. This is why we added the \"formData\" dep to the array and added the eslint override.\n */",
"const",
"serializer",
"=",
"useCallback",
"(",
"(",
")",
"=>",
"{",
"return",
"getFormData",
"(",
")",
";",
"}",
",",
"[",
"getFormData",
",",
"formData",
"]",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"const",
"subscription",
"=",
"getFormData$",
"(",
")",
".",
"subscribe",
"(",
"(",
"raw",
")",
"=>",
"{",
"if",
"(",
"!",
"isMounted",
".",
"current",
"&&",
"Object",
".",
"keys",
"(",
"raw",
")",
".",
"length",
"===",
"0",
")",
"{",
"return",
";",
"}",
"if",
"(",
"watchToArray",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"watchToArray",
".",
"some",
"(",
"(",
"path",
")",
"=>",
"previousRawData",
".",
"current",
"[",
"path",
"]",
"!==",
"raw",
"[",
"path",
"]",
")",
")",
"{",
"previousRawData",
".",
"current",
"=",
"raw",
";",
"const",
"nextState",
"=",
"unflattenObject",
"<",
"I",
">",
"(",
"raw",
")",
";",
"if",
"(",
"onChange",
")",
"{",
"onChange",
"(",
"nextState",
")",
";",
"}",
"setFormData",
"(",
"nextState",
")",
";",
"}",
"}",
"else",
"{",
"const",
"nextState",
"=",
"unflattenObject",
"<",
"I",
">",
"(",
"raw",
")",
";",
"if",
"(",
"onChange",
")",
"{",
"onChange",
"(",
"nextState",
")",
";",
"}",
"setFormData",
"(",
"nextState",
")",
";",
"}",
"}",
")",
";",
"return",
"subscription",
".",
"unsubscribe",
";",
"}",
",",
"[",
"stringifiedWatch",
",",
"getFormData$",
",",
"onChange",
"]",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"isMounted",
".",
"current",
"=",
"true",
";",
"return",
"(",
")",
"=>",
"{",
"isMounted",
".",
"current",
"=",
"false",
";",
"}",
";",
"}",
",",
"[",
"]",
")",
";",
"if",
"(",
"!",
"isMounted",
".",
"current",
"&&",
"Object",
".",
"keys",
"(",
"formData",
")",
".",
"length",
"===",
"0",
")",
"{",
"return",
"[",
"formData",
",",
"serializer",
",",
"false",
"]",
";",
"}",
"return",
"[",
"formData",
",",
"serializer",
",",
"true",
"]",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
46485,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
74,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
381,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
381,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
804,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
804,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
744 | [
"import",
"React",
",",
"{",
"createContext",
",",
"useContext",
"}",
"from",
"'react'",
";",
"import",
"{",
"FormHook",
",",
"FormData",
"}",
"from",
"'./types'",
";",
"const",
"FormContext",
"=",
"createContext",
"<",
"FormHook",
"<",
"any",
">",
"|",
"undefined",
">",
"(",
"undefined",
")",
";",
"interface",
"Props",
"{",
"form",
":",
"FormHook",
"<",
"any",
">",
";",
"children",
":",
"React",
".",
"ReactNode",
";",
"}",
"export",
"const",
"FormProvider",
"=",
"(",
"{",
"children",
",",
"form",
"}",
")",
"=>",
"(",
"<",
"FormContext",
".",
"Provider",
"value",
"=",
"{",
"form",
"}",
">",
"{",
"children",
"}",
"<",
"/FormContext.Provider>);",
"interface",
"Options",
"{",
"throwIfNotFound",
"?",
":",
"boolean",
";",
"}",
"export",
"const",
"useFormContext",
"=",
"function",
"<",
"T",
"extends",
"FormData",
"=",
"FormData",
">",
"(",
"{",
"throwIfNotFound",
"=",
"true",
",",
"}",
"=",
"{",
"}",
")",
"{",
"const",
"context",
"=",
"useContext",
"(",
"FormContext",
")",
"as",
"FormHook",
"<",
"T",
">",
";",
"if",
"(",
"throwIfNotFound",
"&&",
"context",
"===",
"undefined",
")",
"{",
"throw",
"new",
"Error",
"(",
"'useFormContext must be used within a <FormProvider />'",
")",
";",
"}",
"return",
"context",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
745 | [
"import",
"{",
"useMemo",
"}",
"from",
"'react'",
";",
"import",
"{",
"get",
"}",
"from",
"'lodash'",
";",
"import",
"{",
"FieldHook",
",",
"FormHook",
"}",
"from",
"'../types'",
";",
"import",
"{",
"useFormContext",
"}",
"from",
"'../form_context'",
";",
"import",
"{",
"useFormData",
"}",
"from",
"'./use_form_data'",
";",
"interface",
"Options",
"{",
"form",
"?",
":",
"FormHook",
"<",
"any",
">",
";",
"/** List of field paths to discard when checking if a field has been modified */",
"discard",
"?",
":",
"string",
"[",
"]",
";",
"}",
"param",
"options",
"returns",
"export",
"const",
"useFormIsModified",
"=",
"(",
"{",
"form",
":",
"formFromOptions",
",",
"discard",
"=",
"[",
"]",
",",
"}",
"=",
"{",
"}",
")",
":",
"boolean",
"=>",
"{",
"let",
"form",
"=",
"useFormContext",
"(",
"{",
"throwIfNotFound",
":",
"false",
"}",
")",
";",
"if",
"(",
"formFromOptions",
")",
"{",
"form",
"=",
"formFromOptions",
";",
"}",
"if",
"(",
"!",
"form",
")",
"{",
"throw",
"new",
"Error",
"(",
"`useFormIsModified() used outside the form context and no form was provided in the options.`",
")",
";",
"}",
"const",
"{",
"getFields",
",",
"__getFieldsRemoved",
",",
"__getFormDefaultValue",
"}",
"=",
"form",
";",
"const",
"discardToString",
"=",
"JSON",
".",
"stringify",
"(",
"discard",
")",
";",
"const",
"fieldsToDiscard",
"=",
"useMemo",
"(",
"(",
")",
"=>",
"{",
"if",
"(",
"discard",
".",
"length",
"===",
"0",
")",
"{",
"return",
";",
"}",
"return",
"discard",
".",
"reduce",
"(",
"(",
"acc",
",",
"path",
")",
"=>",
"(",
"{",
"...",
"acc",
",",
"[",
"path",
"]",
":",
"{",
"}",
"}",
")",
",",
"{",
"}",
"as",
"{",
"[",
"key",
"]",
":",
"{",
"}",
";",
"}",
")",
";",
"}",
",",
"[",
"discardToString",
"]",
")",
";",
"useFormData",
"(",
"{",
"form",
"}",
")",
";",
"let",
"predicate",
"=",
"(",
")",
"=>",
"true",
";",
"if",
"(",
"fieldsToDiscard",
")",
"{",
"predicate",
"=",
"(",
"[",
"path",
"]",
")",
"=>",
"fieldsToDiscard",
"[",
"path",
"]",
"===",
"undefined",
";",
"}",
"let",
"isModified",
"=",
"Object",
".",
"entries",
"(",
"getFields",
"(",
")",
")",
".",
"filter",
"(",
"predicate",
")",
".",
"some",
"(",
"(",
"[",
"_",
",",
"field",
"]",
")",
"=>",
"field",
".",
"isModified",
")",
";",
"if",
"(",
"isModified",
")",
"{",
"return",
"isModified",
";",
"}",
"const",
"formDefaultValue",
"=",
"__getFormDefaultValue",
"(",
")",
";",
"const",
"fieldOnFormDefaultValue",
"=",
"(",
"path",
")",
"=>",
"Boolean",
"(",
"get",
"(",
"formDefaultValue",
",",
"path",
")",
")",
";",
"const",
"fieldsRemovedFromDOM",
"=",
"fieldsToDiscard",
"?",
"Object",
".",
"keys",
"(",
"__getFieldsRemoved",
"(",
")",
")",
".",
"filter",
"(",
"(",
"path",
")",
"=>",
"fieldsToDiscard",
"[",
"path",
"]",
"===",
"undefined",
")",
".",
"filter",
"(",
"fieldOnFormDefaultValue",
")",
":",
"Object",
".",
"keys",
"(",
"__getFieldsRemoved",
"(",
")",
")",
".",
"filter",
"(",
"fieldOnFormDefaultValue",
")",
";",
"isModified",
"=",
"fieldsRemovedFromDOM",
".",
"length",
">",
"0",
";",
"return",
"isModified",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
746 | [
"import",
"{",
"useCallback",
",",
"useRef",
",",
"useMemo",
"}",
"from",
"'react'",
";",
"import",
"{",
"BehaviorSubject",
",",
"Observable",
"}",
"from",
"'rxjs'",
";",
"export",
"const",
"useBehaviorSubject",
"=",
"<",
"T",
"=",
"any",
">",
"(",
"initialState",
")",
"=>",
"{",
"const",
"subjectRef",
"=",
"useRef",
"<",
"BehaviorSubject",
"<",
"T",
">",
">",
"(",
")",
";",
"const",
"getSubject$",
"=",
"useCallback",
"(",
"(",
")",
"=>",
"{",
"if",
"(",
"subjectRef",
".",
"current",
"===",
"undefined",
")",
"{",
"subjectRef",
".",
"current",
"=",
"new",
"BehaviorSubject",
"<",
"T",
">",
"(",
"initialState",
")",
";",
"}",
"return",
"subjectRef",
".",
"current",
";",
"}",
",",
"[",
"initialState",
"]",
")",
";",
"const",
"hook",
"=",
"useMemo",
"(",
"(",
")",
"=>",
"{",
"const",
"subject",
"=",
"getSubject$",
"(",
")",
";",
"const",
"observable",
"=",
"subject",
".",
"asObservable",
"(",
")",
";",
"const",
"next",
"=",
"subject",
".",
"next",
".",
"bind",
"(",
"subject",
")",
";",
"return",
"[",
"observable",
",",
"next",
"]",
";",
"}",
",",
"[",
"getSubject$",
"]",
")",
";",
"return",
"hook",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
747 | [
"import",
"{",
"FieldHook",
"}",
"from",
"'./types'",
";",
"export",
"const",
"getFieldValidityAndErrorMessage",
"=",
"(",
"field",
")",
":",
"{",
"isInvalid",
":",
"boolean",
";",
"errorMessage",
":",
"string",
"|",
"null",
";",
"}",
"=>",
"{",
"const",
"isInvalid",
"=",
"!",
"field",
".",
"isChangingValue",
"&&",
"field",
".",
"errors",
".",
"length",
">",
"0",
";",
"const",
"errorMessage",
"=",
"!",
"field",
".",
"isChangingValue",
"&&",
"field",
".",
"errors",
".",
"length",
"?",
"field",
".",
"errors",
"[",
"0",
"]",
".",
"message",
":",
"null",
";",
"return",
"{",
"isInvalid",
",",
"errorMessage",
"}",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
748 | [
"import",
"React",
",",
"{",
"ReactNode",
"}",
"from",
"'react'",
";",
"import",
"{",
"EuiForm",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"{",
"FormProvider",
"}",
"from",
"'../form_context'",
";",
"import",
"{",
"FormDataContextProvider",
"}",
"from",
"'../form_data_context'",
";",
"import",
"{",
"FormHook",
"}",
"from",
"'../types'",
";",
"interface",
"Props",
"{",
"form",
":",
"FormHook",
"<",
"any",
">",
";",
"FormWrapper",
"?",
":",
"React",
".",
"ComponentType",
";",
"children",
":",
"ReactNode",
"|",
"ReactNode",
"[",
"]",
";",
"[",
"key",
"]",
":",
"any",
";",
"}",
"export",
"const",
"Form",
"=",
"(",
"{",
"form",
",",
"FormWrapper",
"=",
"EuiForm",
",",
"...",
"rest",
"}",
")",
"=>",
"{",
"const",
"{",
"getFormData",
",",
"__getFormData$",
"}",
"=",
"form",
";",
"return",
"(",
"<",
"FormDataContextProvider",
"getFormData",
"=",
"{",
"getFormData",
"}",
"getFormData$",
"=",
"{",
"__getFormData$",
"}",
">",
"<",
"FormProvider",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"FormWrapper",
"{",
"...",
"rest",
"}",
"/",
">",
"<",
"/FormProvider>",
"<",
"/FormDataContextProvider>);",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
749 | [
"import",
"React",
",",
"{",
"FunctionComponent",
"}",
"from",
"'react'",
";",
"import",
"{",
"FieldHook",
",",
"FieldConfig",
",",
"FormData",
"}",
"from",
"'../types'",
";",
"import",
"{",
"useField",
"}",
"from",
"'../hooks'",
";",
"import",
"{",
"useFormContext",
"}",
"from",
"'../form_context'",
";",
"export",
"interface",
"Props",
"<",
"T",
",",
"FormType",
"=",
"FormData",
",",
"I",
"=",
"T",
">",
"{",
"path",
":",
"string",
";",
"config",
"?",
":",
"FieldConfig",
"<",
"T",
",",
"FormType",
",",
"I",
">",
";",
"defaultValue",
"?",
":",
"T",
";",
"component",
"?",
":",
"FunctionComponent",
"<",
"any",
">",
";",
"componentProps",
"?",
":",
"Record",
"<",
"string",
",",
"any",
">",
";",
"readDefaultValueOnForm",
"?",
":",
"boolean",
";",
"/**\n * Use this prop to pass down dynamic data **asynchronously** to your validators.\n * Your validator accesses the dynamic data by resolving the provider() Promise.\n * ```typescript\n * validator: ({ customData }) => {\n * // Wait until a value is sent to the \"validationData$\" Observable\n * const dynamicData = await customData.provider();\n * }\n * ```\n */",
"validationDataProvider",
"?",
":",
"(",
")",
"=>",
"Promise",
"<",
"unknown",
">",
";",
"/**\n * Use this prop to pass down dynamic data to your validators. The validation data\n * is then accessible in your validator inside the `customData.value` property.\n *\n * ```typescript\n * validator: ({ customData: { value: dynamicData } }) => {\n * // Validate with the dynamic data\n * if (dynamicData) { .. }\n * }\n * ```\n */",
"validationData",
"?",
":",
"unknown",
";",
"onChange",
"?",
":",
"(",
"value",
":",
"I",
")",
"=>",
"void",
";",
"onError",
"?",
":",
"(",
"errors",
":",
"string",
"[",
"]",
"|",
"null",
")",
"=>",
"void",
";",
"children",
"?",
":",
"(",
"field",
":",
"FieldHook",
"<",
"T",
",",
"I",
">",
")",
"=>",
"JSX",
".",
"Element",
"|",
"null",
";",
"[",
"key",
"]",
":",
"any",
";",
"}",
"function",
"UseFieldComp",
"<",
"T",
"=",
"unknown",
",",
"FormType",
"=",
"FormData",
",",
"I",
"=",
"T",
">",
"(",
"props",
")",
"{",
"const",
"{",
"path",
",",
"config",
",",
"defaultValue",
",",
"component",
",",
"componentProps",
",",
"readDefaultValueOnForm",
"=",
"true",
",",
"onChange",
",",
"onError",
",",
"children",
",",
"validationData",
":",
"customValidationData",
",",
"validationDataProvider",
":",
"customValidationDataProvider",
",",
"...",
"rest",
"}",
"=",
"props",
";",
"const",
"form",
"=",
"useFormContext",
"<",
"FormType",
">",
"(",
")",
";",
"const",
"ComponentToRender",
"=",
"component",
"??",
"'input'",
";",
"const",
"propsToForward",
"=",
"{",
"...",
"componentProps",
",",
"...",
"rest",
"}",
";",
"const",
"fieldConfig",
"=",
"config",
"!==",
"undefined",
"?",
"{",
"...",
"config",
"}",
":",
"(",
"{",
"...",
"form",
".",
"__readFieldConfigFromSchema",
"(",
"path",
")",
",",
"}",
"as",
"Partial",
"<",
"FieldConfig",
"<",
"T",
",",
"FormType",
",",
"I",
">",
">",
")",
";",
"if",
"(",
"defaultValue",
"!==",
"undefined",
")",
"{",
"form",
".",
"__updateDefaultValueAt",
"(",
"path",
",",
"defaultValue",
")",
";",
"fieldConfig",
".",
"initialValue",
"=",
"defaultValue",
";",
"}",
"else",
"{",
"if",
"(",
"readDefaultValueOnForm",
")",
"{",
"fieldConfig",
".",
"initialValue",
"=",
"(",
"form",
".",
"getFieldDefaultValue",
"(",
"path",
")",
"as",
"T",
")",
"??",
"fieldConfig",
".",
"defaultValue",
";",
"}",
"}",
"const",
"field",
"=",
"useField",
"<",
"T",
",",
"FormType",
",",
"I",
">",
"(",
"form",
",",
"path",
",",
"fieldConfig",
",",
"onChange",
",",
"onError",
",",
"{",
"customValidationData",
",",
"customValidationDataProvider",
",",
"}",
")",
";",
"if",
"(",
"children",
")",
"{",
"return",
"children",
"!",
"(",
"field",
")",
";",
"}",
"if",
"(",
"ComponentToRender",
"===",
"'input'",
")",
"{",
"return",
"(",
"<",
"ComponentToRender",
"type",
"=",
"{",
"field",
".",
"type",
"}",
"onChange",
"=",
"{",
"field",
".",
"onChange",
"}",
"value",
"=",
"{",
"field",
".",
"value",
"as",
"unknown",
"as",
"string",
"}",
"{",
"...",
"propsToForward",
"}",
"/>);",
"}",
"return",
"<",
"ComponentToRender",
"{",
"...",
"{",
"field",
",",
"...",
"propsToForward",
"}",
"}",
"/",
">",
";",
"}",
"export",
"const",
"UseField",
"=",
"React",
".",
"memo",
"(",
"UseFieldComp",
")",
"as",
"typeof",
"UseFieldComp",
";",
"param",
"partialProps",
"export",
"function",
"getUseField",
"<",
"T1",
"=",
"unknown",
",",
"FormType1",
"=",
"FormData",
",",
"I1",
"=",
"T1",
">",
"(",
"partialProps",
")",
"{",
"return",
"function",
"<",
"T2",
"=",
"T1",
",",
"FormType2",
"=",
"FormType1",
",",
"I2",
"=",
"I1",
">",
"(",
"props",
")",
"{",
"const",
"componentProps",
"=",
"{",
"...",
"partialProps",
",",
"...",
"props",
"}",
"as",
"Props",
"<",
"T2",
",",
"FormType2",
",",
"I2",
">",
";",
"return",
"<",
"UseField",
"<",
"T2",
",",
"FormType2",
",",
"I2",
">",
"{",
"...",
"componentProps",
"}",
"/",
">",
";",
"}",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
32,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
18792,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
20,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
20,
null,
null,
null,
32,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
750 | [
"import",
"React",
"from",
"'react'",
";",
"import",
"{",
"UseField",
",",
"Props",
"as",
"UseFieldProps",
"}",
"from",
"'./use_field'",
";",
"import",
"{",
"FieldHook",
"}",
"from",
"'../types'",
";",
"type",
"FieldsArray",
"=",
"Array",
"<",
"{",
"id",
":",
"string",
";",
"}",
"&",
"Omit",
"<",
"UseFieldProps",
"<",
"unknown",
",",
"{",
"}",
",",
"unknown",
">",
",",
"'children'",
">",
">",
";",
"interface",
"Props",
"<",
"T",
">",
"{",
"fields",
":",
"{",
"[",
"K",
"in",
"keyof",
"T",
"]",
":",
"Exclude",
"<",
"UseFieldProps",
"<",
"T",
"[",
"K",
"]",
">",
",",
"'children'",
">",
";",
"}",
";",
"children",
":",
"(",
"fields",
":",
"{",
"[",
"K",
"in",
"keyof",
"T",
"]",
":",
"FieldHook",
"<",
"T",
"[",
"K",
"]",
">",
";",
"}",
")",
"=>",
"JSX",
".",
"Element",
";",
"}",
"export",
"function",
"UseMultiFields",
"<",
"T",
"=",
"{",
"[",
"key",
"]",
":",
"unknown",
";",
"}",
">",
"(",
"{",
"fields",
",",
"children",
"}",
")",
"{",
"const",
"fieldsArray",
"=",
"Object",
".",
"entries",
"(",
"fields",
")",
".",
"reduce",
"(",
"(",
"acc",
",",
"[",
"fieldId",
",",
"field",
"]",
")",
"=>",
"[",
"...",
"acc",
",",
"{",
"id",
":",
"fieldId",
",",
"...",
"(",
"field",
"as",
"FieldHook",
")",
"}",
"]",
",",
"[",
"]",
"as",
"FieldsArray",
")",
";",
"const",
"hookFields",
"=",
"{",
"}",
"as",
"any",
";",
"const",
"renderField",
"=",
"(",
"index",
")",
"=>",
"{",
"const",
"{",
"id",
"}",
"=",
"fieldsArray",
"[",
"index",
"]",
";",
"return",
"(",
"<",
"UseField",
"{",
"...",
"fields",
"[",
"id",
"as",
"keyof",
"T",
"]",
"}",
">",
"{",
"(",
"field",
")",
"=>",
"{",
"hookFields",
"[",
"id",
"as",
"keyof",
"T",
"]",
"=",
"field",
";",
"return",
"index",
"===",
"fieldsArray",
".",
"length",
"-",
"1",
"?",
"children",
"(",
"hookFields",
")",
":",
"renderField",
"(",
"index",
"+",
"1",
")",
";",
"}",
"}",
"<",
"/UseField>);",
"}",
";",
"if",
"(",
"!",
"Boolean",
"(",
"fieldsArray",
".",
"length",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"renderField",
"(",
"0",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
751 | [
"import",
"{",
"useEffect",
",",
"useRef",
",",
"useCallback",
",",
"useMemo",
"}",
"from",
"'react'",
";",
"import",
"{",
"FormHook",
",",
"FieldConfig",
"}",
"from",
"'../types'",
";",
"import",
"{",
"getFieldValidityAndErrorMessage",
"}",
"from",
"'../helpers'",
";",
"import",
"{",
"useFormContext",
"}",
"from",
"'../form_context'",
";",
"import",
"{",
"useField",
",",
"InternalFieldConfig",
"}",
"from",
"'../hooks'",
";",
"interface",
"Props",
"{",
"path",
":",
"string",
";",
"initialNumberOfItems",
"?",
":",
"number",
";",
"readDefaultValueOnForm",
"?",
":",
"boolean",
";",
"validations",
"?",
":",
"FieldConfig",
"<",
"ArrayItem",
"[",
"]",
">",
"[",
"'validations'",
"]",
";",
"children",
":",
"(",
"formFieldArray",
":",
"FormArrayField",
")",
"=>",
"JSX",
".",
"Element",
";",
"}",
"export",
"interface",
"ArrayItem",
"{",
"id",
":",
"number",
";",
"path",
":",
"string",
";",
"isNew",
":",
"boolean",
";",
"}",
"export",
"interface",
"FormArrayField",
"{",
"items",
":",
"ArrayItem",
"[",
"]",
";",
"error",
":",
"string",
"|",
"null",
";",
"addItem",
":",
"(",
")",
"=>",
"void",
";",
"removeItem",
":",
"(",
"id",
":",
"number",
")",
"=>",
"void",
";",
"moveItem",
":",
"(",
"sourceIdx",
":",
"number",
",",
"destinationIdx",
":",
"number",
")",
"=>",
"void",
";",
"form",
":",
"FormHook",
";",
"}",
"/**\n * Use UseArray to dynamically add fields to your form.\n *\n * example:\n * If your form data looks like this:\n *\n * {\n * users: []\n * }\n *\n * and you want to be able to add user objects ({ name: 'john', lastName. 'snow' }) inside\n * the \"users\" array, you would use UseArray to render rows of user objects with 2 fields in each of them (\"name\" and \"lastName\")\n *\n * Look at the README.md for some examples.\n */",
"export",
"const",
"UseArray",
"=",
"(",
"{",
"path",
",",
"initialNumberOfItems",
",",
"validations",
",",
"readDefaultValueOnForm",
"=",
"true",
",",
"children",
",",
"}",
")",
"=>",
"{",
"const",
"isMounted",
"=",
"useRef",
"(",
"false",
")",
";",
"const",
"uniqueId",
"=",
"useRef",
"(",
"0",
")",
";",
"const",
"form",
"=",
"useFormContext",
"(",
")",
";",
"const",
"{",
"getFieldDefaultValue",
"}",
"=",
"form",
";",
"const",
"getNewItemAtIndex",
"=",
"useCallback",
"(",
"(",
"index",
")",
":",
"ArrayItem",
"=>",
"(",
"{",
"id",
":",
"uniqueId",
".",
"current",
"++",
",",
"path",
":",
"`${",
"path",
"}[${",
"index",
"}]`",
",",
"isNew",
":",
"true",
",",
"}",
")",
",",
"[",
"path",
"]",
")",
";",
"const",
"fieldDefaultValue",
"=",
"useMemo",
"<",
"ArrayItem",
"[",
"]",
">",
"(",
"(",
")",
"=>",
"{",
"const",
"defaultValues",
"=",
"readDefaultValueOnForm",
"?",
"(",
"getFieldDefaultValue",
"(",
"path",
")",
"as",
"any",
"[",
"]",
")",
":",
"undefined",
";",
"const",
"getInitialItemsFromValues",
"=",
"(",
"values",
")",
":",
"ArrayItem",
"[",
"]",
"=>",
"values",
".",
"map",
"(",
"(",
"_",
",",
"index",
")",
"=>",
"(",
"{",
"id",
":",
"uniqueId",
".",
"current",
"++",
",",
"path",
":",
"`${",
"path",
"}[${",
"index",
"}]`",
",",
"isNew",
":",
"false",
",",
"}",
")",
")",
";",
"return",
"defaultValues",
"?",
"getInitialItemsFromValues",
"(",
"defaultValues",
")",
":",
"new",
"Array",
"(",
"initialNumberOfItems",
")",
".",
"fill",
"(",
"''",
")",
".",
"map",
"(",
"(",
"_",
",",
"i",
")",
"=>",
"getNewItemAtIndex",
"(",
"i",
")",
")",
";",
"}",
",",
"[",
"path",
",",
"initialNumberOfItems",
",",
"readDefaultValueOnForm",
",",
"getFieldDefaultValue",
",",
"getNewItemAtIndex",
"]",
")",
";",
"const",
"fieldConfigBase",
"=",
"{",
"defaultValue",
":",
"fieldDefaultValue",
",",
"valueChangeDebounceTime",
":",
"0",
",",
"isIncludedInOutput",
":",
"false",
",",
"}",
";",
"const",
"fieldConfig",
"=",
"validations",
"?",
"{",
"validations",
",",
"...",
"fieldConfigBase",
"}",
":",
"fieldConfigBase",
";",
"const",
"field",
"=",
"useField",
"(",
"form",
",",
"path",
",",
"fieldConfig",
")",
";",
"const",
"{",
"setValue",
",",
"value",
",",
"isChangingValue",
",",
"errors",
"}",
"=",
"field",
";",
"const",
"error",
"=",
"useMemo",
"(",
"(",
")",
"=>",
"{",
"const",
"{",
"errorMessage",
"}",
"=",
"getFieldValidityAndErrorMessage",
"(",
"{",
"isChangingValue",
",",
"errors",
"}",
")",
";",
"return",
"errorMessage",
";",
"}",
",",
"[",
"isChangingValue",
",",
"errors",
"]",
")",
";",
"const",
"updatePaths",
"=",
"useCallback",
"(",
"(",
"_rows",
")",
"=>",
"{",
"return",
"_rows",
".",
"map",
"(",
"(",
"row",
",",
"index",
")",
"=>",
"(",
"{",
"...",
"row",
",",
"path",
":",
"`${",
"path",
"}[${",
"index",
"}]`",
",",
"}",
"as",
"ArrayItem",
")",
")",
";",
"}",
",",
"[",
"path",
"]",
")",
";",
"const",
"addItem",
"=",
"useCallback",
"(",
"(",
")",
"=>",
"{",
"setValue",
"(",
"(",
"previousItems",
")",
"=>",
"{",
"const",
"itemIndex",
"=",
"previousItems",
".",
"length",
";",
"return",
"[",
"...",
"previousItems",
",",
"getNewItemAtIndex",
"(",
"itemIndex",
")",
"]",
";",
"}",
")",
";",
"}",
",",
"[",
"setValue",
",",
"getNewItemAtIndex",
"]",
")",
";",
"const",
"removeItem",
"=",
"useCallback",
"(",
"(",
"id",
")",
"=>",
"{",
"setValue",
"(",
"(",
"previousItems",
")",
"=>",
"{",
"const",
"updatedItems",
"=",
"previousItems",
".",
"filter",
"(",
"(",
"item",
")",
"=>",
"item",
".",
"id",
"!==",
"id",
")",
";",
"return",
"updatePaths",
"(",
"updatedItems",
")",
";",
"}",
")",
";",
"}",
",",
"[",
"setValue",
",",
"updatePaths",
"]",
")",
";",
"const",
"moveItem",
"=",
"useCallback",
"(",
"(",
"sourceIdx",
",",
"destinationIdx",
")",
"=>",
"{",
"setValue",
"(",
"(",
"previousItems",
")",
"=>",
"{",
"const",
"nextItems",
"=",
"[",
"...",
"previousItems",
"]",
";",
"const",
"removed",
"=",
"nextItems",
".",
"splice",
"(",
"sourceIdx",
",",
"1",
")",
"[",
"0",
"]",
";",
"nextItems",
".",
"splice",
"(",
"destinationIdx",
",",
"0",
",",
"removed",
")",
";",
"return",
"updatePaths",
"(",
"nextItems",
")",
";",
"}",
")",
";",
"}",
",",
"[",
"setValue",
",",
"updatePaths",
"]",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"if",
"(",
"!",
"isMounted",
".",
"current",
")",
"{",
"return",
";",
"}",
"setValue",
"(",
"(",
"prev",
")",
"=>",
"{",
"return",
"updatePaths",
"(",
"prev",
")",
";",
"}",
")",
";",
"}",
",",
"[",
"path",
",",
"updatePaths",
",",
"setValue",
"]",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"isMounted",
".",
"current",
"=",
"true",
";",
"return",
"(",
")",
"=>",
"{",
"isMounted",
".",
"current",
"=",
"false",
";",
"}",
";",
"}",
",",
"[",
"]",
")",
";",
"return",
"children",
"(",
"{",
"items",
":",
"value",
",",
"error",
",",
"form",
",",
"addItem",
",",
"removeItem",
",",
"moveItem",
"}",
")",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
752 | [
"import",
"React",
"from",
"'react'",
";",
"import",
"{",
"FormData",
"}",
"from",
"'../types'",
";",
"import",
"{",
"useFormData",
"}",
"from",
"'../hooks'",
";",
"interface",
"Props",
"<",
"I",
">",
"{",
"children",
":",
"(",
"formData",
":",
"I",
")",
"=>",
"JSX",
".",
"Element",
"|",
"null",
";",
"pathsToWatch",
"?",
":",
"string",
"|",
"string",
"[",
"]",
";",
"}",
"const",
"FormDataProviderComp",
"=",
"function",
"<",
"I",
"extends",
"FormData",
"=",
"FormData",
">",
"(",
"{",
"children",
",",
"pathsToWatch",
",",
"}",
")",
"{",
"const",
"{",
"0",
":",
"formData",
",",
"2",
":",
"isReady",
"}",
"=",
"useFormData",
"<",
"I",
">",
"(",
"{",
"watch",
":",
"pathsToWatch",
"}",
")",
";",
"if",
"(",
"!",
"isReady",
")",
"{",
"return",
"null",
";",
"}",
"return",
"children",
"(",
"formData",
")",
";",
"}",
";",
"export",
"const",
"FormDataProvider",
"=",
"React",
".",
"memo",
"(",
"FormDataProviderComp",
")",
"as",
"typeof",
"FormDataProviderComp",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
753 | [
"import",
"React",
"from",
"'react'",
";",
"import",
"{",
"EuiFormRow",
",",
"EuiCheckbox",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"uuid",
"from",
"'uuid'",
";",
"import",
"{",
"FieldHook",
",",
"getFieldValidityAndErrorMessage",
"}",
"from",
"'../../hook_form_lib'",
";",
"interface",
"Props",
"{",
"field",
":",
"FieldHook",
";",
"euiFieldProps",
"?",
":",
"Record",
"<",
"string",
",",
"any",
">",
";",
"idAria",
"?",
":",
"string",
";",
"[",
"key",
"]",
":",
"any",
";",
"}",
"export",
"const",
"CheckBoxField",
"=",
"(",
"{",
"field",
",",
"euiFieldProps",
"=",
"{",
"}",
",",
"idAria",
",",
"...",
"rest",
"}",
")",
"=>",
"{",
"const",
"{",
"isInvalid",
",",
"errorMessage",
"}",
"=",
"getFieldValidityAndErrorMessage",
"(",
"field",
")",
";",
"return",
"(",
"<",
"EuiFormRow",
"helpText",
"=",
"{",
"typeof",
"field",
".",
"helpText",
"===",
"'function'",
"?",
"field",
".",
"helpText",
"(",
")",
":",
"field",
".",
"helpText",
"}",
"error",
"=",
"{",
"errorMessage",
"}",
"isInvalid",
"=",
"{",
"isInvalid",
"}",
"fullWidth",
"describedByIds",
"=",
"{",
"idAria",
"?",
"[",
"idAria",
"]",
":",
"undefined",
"}",
"{",
"...",
"rest",
"}",
">",
"<",
"EuiCheckbox",
"label",
"=",
"{",
"field",
".",
"label",
"}",
"checked",
"=",
"{",
"field",
".",
"value",
"as",
"boolean",
"}",
"onChange",
"=",
"{",
"field",
".",
"onChange",
"}",
"id",
"=",
"{",
"euiFieldProps",
".",
"id",
"||",
"uuid",
"(",
")",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"input\"",
"{",
"...",
"euiFieldProps",
"}",
"/>",
"<",
"/EuiFormRow>);",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
754 | [
"import",
"React",
"from",
"'react'",
";",
"import",
"{",
"i18n",
"}",
"from",
"'@kbn/i18n'",
";",
"import",
"{",
"EuiFormRow",
",",
"EuiComboBox",
",",
"EuiComboBoxOptionOption",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"{",
"FieldHook",
",",
"VALIDATION_TYPES",
",",
"FieldValidateResponse",
"}",
"from",
"'../../hook_form_lib'",
";",
"interface",
"Props",
"{",
"field",
":",
"FieldHook",
";",
"euiFieldProps",
"?",
":",
"Record",
"<",
"string",
",",
"any",
">",
";",
"idAria",
"?",
":",
"string",
";",
"[",
"key",
"]",
":",
"any",
";",
"}",
"export",
"const",
"ComboBoxField",
"=",
"(",
"{",
"field",
",",
"euiFieldProps",
"=",
"{",
"}",
",",
"idAria",
",",
"...",
"rest",
"}",
")",
"=>",
"{",
"const",
"errorMessageField",
"=",
"field",
".",
"getErrorsMessages",
"(",
")",
";",
"const",
"errorMessageArrayItem",
"=",
"field",
".",
"getErrorsMessages",
"(",
"{",
"validationType",
":",
"VALIDATION_TYPES",
".",
"ARRAY_ITEM",
",",
"}",
")",
";",
"const",
"isInvalid",
"=",
"field",
".",
"errors",
".",
"length",
"?",
"errorMessageField",
"!==",
"null",
"||",
"errorMessageArrayItem",
"!==",
"null",
":",
"false",
";",
"const",
"errorMessage",
"=",
"errorMessageField",
"&&",
"errorMessageArrayItem",
"?",
"`${",
"errorMessageField",
"}, ${",
"errorMessageArrayItem",
"}`",
":",
"errorMessageField",
"?",
"errorMessageField",
":",
"errorMessageArrayItem",
";",
"const",
"onCreateComboOption",
"=",
"(",
"value",
")",
"=>",
"{",
"const",
"{",
"isValid",
"}",
"=",
"field",
".",
"validate",
"(",
"{",
"value",
",",
"validationType",
":",
"VALIDATION_TYPES",
".",
"ARRAY_ITEM",
",",
"}",
")",
"as",
"FieldValidateResponse",
";",
"if",
"(",
"!",
"isValid",
")",
"{",
"return",
"false",
";",
"}",
"const",
"newValue",
"=",
"[",
"...",
"(",
"field",
".",
"value",
"as",
"string",
"[",
"]",
")",
",",
"value",
"]",
";",
"field",
".",
"setValue",
"(",
"newValue",
")",
";",
"}",
";",
"const",
"onComboChange",
"=",
"(",
"options",
")",
"=>",
"{",
"field",
".",
"setValue",
"(",
"options",
".",
"map",
"(",
"(",
"option",
")",
"=>",
"option",
".",
"label",
")",
")",
";",
"}",
";",
"const",
"onSearchComboChange",
"=",
"(",
"value",
")",
"=>",
"{",
"if",
"(",
"value",
"!==",
"undefined",
")",
"{",
"field",
".",
"clearErrors",
"(",
"VALIDATION_TYPES",
".",
"ARRAY_ITEM",
")",
";",
"}",
"}",
";",
"return",
"(",
"<",
"EuiFormRow",
"label",
"=",
"{",
"field",
".",
"label",
"}",
"labelAppend",
"=",
"{",
"field",
".",
"labelAppend",
"}",
"helpText",
"=",
"{",
"typeof",
"field",
".",
"helpText",
"===",
"'function'",
"?",
"field",
".",
"helpText",
"(",
")",
":",
"field",
".",
"helpText",
"}",
"error",
"=",
"{",
"errorMessage",
"}",
"isInvalid",
"=",
"{",
"isInvalid",
"}",
"fullWidth",
"describedByIds",
"=",
"{",
"idAria",
"?",
"[",
"idAria",
"]",
":",
"undefined",
"}",
"{",
"...",
"rest",
"}",
">",
"<",
"EuiComboBox",
"noSuggestions",
"placeholder",
"=",
"{",
"i18n",
".",
"translate",
"(",
"'esUi.forms.comboBoxField.placeHolderText'",
",",
"{",
"defaultMessage",
":",
"'Type and then hit \"ENTER\"'",
",",
"}",
")",
"}",
"selectedOptions",
"=",
"{",
"(",
"field",
".",
"value",
"as",
"any",
"[",
"]",
")",
".",
"map",
"(",
"(",
"v",
")",
"=>",
"(",
"{",
"label",
":",
"v",
"}",
")",
")",
"}",
"onCreateOption",
"=",
"{",
"onCreateComboOption",
"}",
"onChange",
"=",
"{",
"onComboChange",
"}",
"onSearchChange",
"=",
"{",
"onSearchComboChange",
"}",
"fullWidth",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"input\"",
"{",
"...",
"euiFieldProps",
"}",
"/>",
"<",
"/EuiFormRow>);",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
755 | [
"import",
"React",
"from",
"'react'",
";",
"import",
"{",
"EuiFormRow",
",",
"EuiSelectable",
",",
"EuiPanel",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"{",
"FieldHook",
",",
"getFieldValidityAndErrorMessage",
"}",
"from",
"'../../hook_form_lib'",
";",
"interface",
"Props",
"{",
"field",
":",
"FieldHook",
";",
"euiFieldProps",
"?",
":",
"Record",
"<",
"string",
",",
"any",
">",
";",
"idAria",
"?",
":",
"string",
";",
"[",
"key",
"]",
":",
"any",
";",
"}",
"export",
"const",
"MultiSelectField",
"=",
"(",
"{",
"field",
",",
"euiFieldProps",
"=",
"{",
"}",
",",
"idAria",
",",
"...",
"rest",
"}",
")",
"=>",
"{",
"const",
"{",
"isInvalid",
",",
"errorMessage",
"}",
"=",
"getFieldValidityAndErrorMessage",
"(",
"field",
")",
";",
"return",
"(",
"<",
"EuiFormRow",
"label",
"=",
"{",
"field",
".",
"label",
"}",
"helpText",
"=",
"{",
"typeof",
"field",
".",
"helpText",
"===",
"'function'",
"?",
"field",
".",
"helpText",
"(",
")",
":",
"field",
".",
"helpText",
"}",
"error",
"=",
"{",
"errorMessage",
"}",
"isInvalid",
"=",
"{",
"isInvalid",
"}",
"fullWidth",
"describedByIds",
"=",
"{",
"idAria",
"?",
"[",
"idAria",
"]",
":",
"undefined",
"}",
"{",
"...",
"rest",
"}",
">",
"<",
"EuiSelectable",
"allowExclusions",
"=",
"{",
"false",
"}",
"height",
"=",
"{",
"300",
"}",
"onChange",
"=",
"{",
"(",
"options",
")",
"=>",
"{",
"field",
".",
"setValue",
"(",
"options",
")",
";",
"}",
"}",
"options",
"=",
"{",
"field",
".",
"value",
"as",
"any",
"[",
"]",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"select\"",
"{",
"...",
"euiFieldProps",
"}",
">",
"{",
"(",
"list",
",",
"search",
")",
"=>",
"(",
"<",
"EuiPanel",
"paddingSize",
"=",
"\"s\"",
"hasShadow",
"=",
"{",
"false",
"}",
">",
"{",
"search",
"}",
"{",
"list",
"}",
"<",
"/EuiPanel>)}",
"<",
"/EuiSelectable>",
"<",
"/EuiFormRow>);",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
756 | [
"import",
"React",
",",
"{",
"useCallback",
"}",
"from",
"'react'",
";",
"import",
"{",
"EuiFormRow",
",",
"EuiRange",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"{",
"FieldHook",
",",
"getFieldValidityAndErrorMessage",
"}",
"from",
"'../../hook_form_lib'",
";",
"interface",
"Props",
"{",
"field",
":",
"FieldHook",
";",
"euiFieldProps",
"?",
":",
"Record",
"<",
"string",
",",
"any",
">",
";",
"idAria",
"?",
":",
"string",
";",
"[",
"key",
"]",
":",
"any",
";",
"}",
"export",
"const",
"RangeField",
"=",
"(",
"{",
"field",
",",
"euiFieldProps",
"=",
"{",
"}",
",",
"idAria",
",",
"...",
"rest",
"}",
")",
"=>",
"{",
"const",
"{",
"isInvalid",
",",
"errorMessage",
"}",
"=",
"getFieldValidityAndErrorMessage",
"(",
"field",
")",
";",
"const",
"{",
"onChange",
":",
"onFieldChange",
"}",
"=",
"field",
";",
"const",
"onChange",
"=",
"useCallback",
"(",
"(",
"e",
")",
"=>",
"{",
"const",
"event",
"=",
"{",
"...",
"e",
",",
"value",
":",
"`${",
"e",
".",
"currentTarget",
".",
"value",
"}`",
"}",
"as",
"unknown",
"as",
"React",
".",
"ChangeEvent",
"<",
"{",
"value",
":",
"string",
";",
"}",
">",
";",
"onFieldChange",
"(",
"event",
")",
";",
"}",
",",
"[",
"onFieldChange",
"]",
")",
";",
"return",
"(",
"<",
"EuiFormRow",
"label",
"=",
"{",
"field",
".",
"label",
"}",
"helpText",
"=",
"{",
"typeof",
"field",
".",
"helpText",
"===",
"'function'",
"?",
"field",
".",
"helpText",
"(",
")",
":",
"field",
".",
"helpText",
"}",
"error",
"=",
"{",
"errorMessage",
"}",
"isInvalid",
"=",
"{",
"isInvalid",
"}",
"fullWidth",
"describedByIds",
"=",
"{",
"idAria",
"?",
"[",
"idAria",
"]",
":",
"undefined",
"}",
"{",
"...",
"rest",
"}",
">",
"<",
"EuiRange",
"value",
"=",
"{",
"field",
".",
"value",
"as",
"number",
"}",
"onChange",
"=",
"{",
"onChange",
"}",
"max",
"=",
"{",
"10",
"}",
"min",
"=",
"{",
"0",
"}",
"showRange",
"showInput",
"fullWidth",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"range\"",
"{",
"...",
"euiFieldProps",
"}",
"/>",
"<",
"/EuiFormRow>);",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
757 | [
"import",
"React",
",",
"{",
"ReactNode",
",",
"OptionHTMLAttributes",
"}",
"from",
"'react'",
";",
"import",
"{",
"EuiFormRow",
",",
"EuiSelect",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"{",
"FieldHook",
",",
"getFieldValidityAndErrorMessage",
"}",
"from",
"'../../hook_form_lib'",
";",
"interface",
"Props",
"{",
"field",
":",
"FieldHook",
";",
"euiFieldProps",
":",
"{",
"options",
":",
"Array",
"<",
"{",
"text",
":",
"string",
"|",
"ReactNode",
";",
"[",
"key",
"]",
":",
"any",
";",
"}",
"&",
"OptionHTMLAttributes",
"<",
"HTMLOptionElement",
">",
">",
";",
"[",
"key",
"]",
":",
"any",
";",
"}",
";",
"idAria",
"?",
":",
"string",
";",
"[",
"key",
"]",
":",
"any",
";",
"}",
"export",
"const",
"SelectField",
"=",
"(",
"{",
"field",
",",
"euiFieldProps",
",",
"idAria",
",",
"...",
"rest",
"}",
")",
"=>",
"{",
"const",
"{",
"isInvalid",
",",
"errorMessage",
"}",
"=",
"getFieldValidityAndErrorMessage",
"(",
"field",
")",
";",
"return",
"(",
"<",
"EuiFormRow",
"label",
"=",
"{",
"field",
".",
"label",
"}",
"helpText",
"=",
"{",
"typeof",
"field",
".",
"helpText",
"===",
"'function'",
"?",
"field",
".",
"helpText",
"(",
")",
":",
"field",
".",
"helpText",
"}",
"error",
"=",
"{",
"errorMessage",
"}",
"isInvalid",
"=",
"{",
"isInvalid",
"}",
"fullWidth",
"describedByIds",
"=",
"{",
"idAria",
"?",
"[",
"idAria",
"]",
":",
"undefined",
"}",
"{",
"...",
"rest",
"}",
">",
"<",
"EuiSelect",
"fullWidth",
"value",
"=",
"{",
"field",
".",
"value",
"as",
"string",
"}",
"onChange",
"=",
"{",
"(",
"e",
")",
"=>",
"{",
"field",
".",
"setValue",
"(",
"e",
".",
"target",
".",
"value",
")",
";",
"}",
"}",
"hasNoInitialSelection",
"=",
"{",
"true",
"}",
"isInvalid",
"=",
"{",
"isInvalid",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"select\"",
"{",
"...",
"euiFieldProps",
"}",
"/>",
"<",
"/EuiFormRow>);",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
758 | [
"import",
"React",
"from",
"'react'",
";",
"import",
"{",
"EuiFormRow",
",",
"EuiSuperSelect",
",",
"EuiSuperSelectProps",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"{",
"FieldHook",
",",
"getFieldValidityAndErrorMessage",
"}",
"from",
"'../../hook_form_lib'",
";",
"interface",
"Props",
"{",
"field",
":",
"FieldHook",
";",
"euiFieldProps",
":",
"{",
"options",
":",
"EuiSuperSelectProps",
"<",
"any",
">",
"[",
"'options'",
"]",
";",
"[",
"key",
"]",
":",
"any",
";",
"}",
";",
"idAria",
"?",
":",
"string",
";",
"[",
"key",
"]",
":",
"any",
";",
"}",
"export",
"const",
"SuperSelectField",
"=",
"(",
"{",
"field",
",",
"euiFieldProps",
"=",
"{",
"options",
":",
"[",
"]",
"}",
",",
"idAria",
",",
"...",
"rest",
"}",
")",
"=>",
"{",
"const",
"{",
"isInvalid",
",",
"errorMessage",
"}",
"=",
"getFieldValidityAndErrorMessage",
"(",
"field",
")",
";",
"return",
"(",
"<",
"EuiFormRow",
"label",
"=",
"{",
"field",
".",
"label",
"}",
"helpText",
"=",
"{",
"typeof",
"field",
".",
"helpText",
"===",
"'function'",
"?",
"field",
".",
"helpText",
"(",
")",
":",
"field",
".",
"helpText",
"}",
"error",
"=",
"{",
"errorMessage",
"}",
"isInvalid",
"=",
"{",
"isInvalid",
"}",
"fullWidth",
"describedByIds",
"=",
"{",
"idAria",
"?",
"[",
"idAria",
"]",
":",
"undefined",
"}",
"{",
"...",
"rest",
"}",
">",
"<",
"EuiSuperSelect",
"fullWidth",
"valueOfSelected",
"=",
"{",
"field",
".",
"value",
"as",
"string",
"}",
"onChange",
"=",
"{",
"(",
"value",
")",
"=>",
"{",
"field",
".",
"setValue",
"(",
"value",
")",
";",
"}",
"}",
"isInvalid",
"=",
"{",
"isInvalid",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"select\"",
"{",
"...",
"euiFieldProps",
"}",
"/>",
"<",
"/EuiFormRow>);",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
759 | [
"import",
"React",
"from",
"'react'",
";",
"import",
"{",
"EuiFormRow",
",",
"EuiSwitch",
",",
"EuiSwitchEvent",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"{",
"FieldHook",
",",
"getFieldValidityAndErrorMessage",
"}",
"from",
"'../../hook_form_lib'",
";",
"interface",
"Props",
"{",
"field",
":",
"FieldHook",
"<",
"boolean",
">",
";",
"euiFieldProps",
"?",
":",
"Record",
"<",
"string",
",",
"any",
">",
";",
"idAria",
"?",
":",
"string",
";",
"[",
"key",
"]",
":",
"any",
";",
"}",
"export",
"const",
"ToggleField",
"=",
"(",
"{",
"field",
",",
"euiFieldProps",
"=",
"{",
"}",
",",
"idAria",
",",
"...",
"rest",
"}",
")",
"=>",
"{",
"const",
"{",
"isInvalid",
",",
"errorMessage",
"}",
"=",
"getFieldValidityAndErrorMessage",
"(",
"field",
")",
";",
"const",
"onChange",
"=",
"(",
"e",
")",
"=>",
"{",
"const",
"event",
"=",
"{",
"...",
"e",
",",
"value",
":",
"`${",
"e",
".",
"target",
".",
"checked",
"}`",
"}",
"as",
"unknown",
"as",
"React",
".",
"ChangeEvent",
"<",
"{",
"value",
":",
"string",
";",
"}",
">",
";",
"field",
".",
"onChange",
"(",
"event",
")",
";",
"}",
";",
"return",
"(",
"<",
"EuiFormRow",
"helpText",
"=",
"{",
"typeof",
"field",
".",
"helpText",
"===",
"'function'",
"?",
"field",
".",
"helpText",
"(",
")",
":",
"field",
".",
"helpText",
"}",
"error",
"=",
"{",
"errorMessage",
"}",
"isInvalid",
"=",
"{",
"isInvalid",
"}",
"fullWidth",
"describedByIds",
"=",
"{",
"idAria",
"?",
"[",
"idAria",
"]",
":",
"undefined",
"}",
"{",
"...",
"rest",
"}",
">",
"<",
"EuiSwitch",
"label",
"=",
"{",
"field",
".",
"label",
"}",
"checked",
"=",
"{",
"field",
".",
"value",
"as",
"boolean",
"}",
"onChange",
"=",
"{",
"onChange",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"input\"",
"{",
"...",
"euiFieldProps",
"}",
"/>",
"<",
"/EuiFormRow>);",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
760 | [
"import",
"React",
",",
"{",
"useCallback",
"}",
"from",
"'react'",
";",
"import",
"{",
"JsonEditor",
",",
"OnJsonEditorUpdateHandler",
"}",
"from",
"'../../../../public'",
";",
"import",
"{",
"FieldHook",
",",
"getFieldValidityAndErrorMessage",
"}",
"from",
"'../../hook_form_lib'",
";",
"interface",
"Props",
"{",
"field",
":",
"FieldHook",
"<",
"any",
",",
"string",
">",
";",
"euiCodeEditorProps",
"?",
":",
"{",
"[",
"key",
"]",
":",
"any",
";",
"}",
";",
"[",
"key",
"]",
":",
"any",
";",
"}",
"export",
"const",
"JsonEditorField",
"=",
"(",
"{",
"field",
",",
"...",
"rest",
"}",
")",
"=>",
"{",
"const",
"{",
"errorMessage",
"}",
"=",
"getFieldValidityAndErrorMessage",
"(",
"field",
")",
";",
"const",
"{",
"label",
",",
"helpText",
",",
"value",
",",
"setValue",
"}",
"=",
"field",
";",
"const",
"onJsonUpdate",
"=",
"useCallback",
"<",
"OnJsonEditorUpdateHandler",
">",
"(",
"(",
"updatedJson",
")",
"=>",
"{",
"setValue",
"(",
"updatedJson",
".",
"data",
".",
"raw",
")",
";",
"}",
",",
"[",
"setValue",
"]",
")",
";",
"return",
"(",
"<",
"JsonEditor",
"label",
"=",
"{",
"label",
"}",
"helpText",
"=",
"{",
"helpText",
"}",
"value",
"=",
"{",
"value",
"}",
"onUpdate",
"=",
"{",
"onJsonUpdate",
"}",
"error",
"=",
"{",
"errorMessage",
"}",
"{",
"...",
"rest",
"}",
"/>);",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
761 | [
"import",
"React",
",",
"{",
"ComponentType",
"}",
"from",
"'react'",
";",
"import",
"{",
"FieldHook",
",",
"FIELD_TYPES",
"}",
"from",
"'../hook_form_lib'",
";",
"interface",
"Props",
"{",
"field",
":",
"FieldHook",
";",
"euiFieldProps",
"?",
":",
"{",
"[",
"key",
"]",
":",
"any",
";",
"}",
";",
"[",
"key",
"]",
":",
"any",
";",
"}",
"import",
"{",
"TextField",
",",
"TextAreaField",
",",
"NumericField",
",",
"CheckBoxField",
",",
"ComboBoxField",
",",
"MultiSelectField",
",",
"RadioGroupField",
",",
"RangeField",
",",
"SelectField",
",",
"SuperSelectField",
",",
"ToggleField",
",",
"JsonEditorField",
",",
"}",
"from",
"'./fields'",
";",
"const",
"mapTypeToFieldComponent",
"=",
"{",
"[",
"FIELD_TYPES",
".",
"TEXT",
"]",
":",
"TextField",
",",
"[",
"FIELD_TYPES",
".",
"TEXTAREA",
"]",
":",
"TextAreaField",
",",
"[",
"FIELD_TYPES",
".",
"NUMBER",
"]",
":",
"NumericField",
",",
"[",
"FIELD_TYPES",
".",
"CHECKBOX",
"]",
":",
"CheckBoxField",
",",
"[",
"FIELD_TYPES",
".",
"COMBO_BOX",
"]",
":",
"ComboBoxField",
",",
"[",
"FIELD_TYPES",
".",
"MULTI_SELECT",
"]",
":",
"MultiSelectField",
",",
"[",
"FIELD_TYPES",
".",
"RADIO_GROUP",
"]",
":",
"RadioGroupField",
",",
"[",
"FIELD_TYPES",
".",
"RANGE",
"]",
":",
"RangeField",
",",
"[",
"FIELD_TYPES",
".",
"SELECT",
"]",
":",
"SelectField",
",",
"[",
"FIELD_TYPES",
".",
"SUPER_SELECT",
"]",
":",
"SuperSelectField",
",",
"[",
"FIELD_TYPES",
".",
"TOGGLE",
"]",
":",
"ToggleField",
",",
"[",
"FIELD_TYPES",
".",
"JSON",
"]",
":",
"JsonEditorField",
",",
"}",
";",
"export",
"const",
"Field",
"=",
"(",
"props",
")",
"=>",
"{",
"const",
"FieldComponent",
"=",
"mapTypeToFieldComponent",
"[",
"props",
".",
"field",
".",
"type",
"]",
"||",
"TextField",
";",
"return",
"<",
"FieldComponent",
"{",
"...",
"props",
"}",
"/",
">",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
32,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
762 | [
"import",
"React",
"from",
"'react'",
";",
"import",
"{",
"EuiDescribedFormGroup",
",",
"EuiTitle",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"{",
"FieldHook",
"}",
"from",
"'../hook_form_lib'",
";",
"import",
"{",
"Field",
"}",
"from",
"'./field'",
";",
"interface",
"Props",
"{",
"title",
":",
"string",
"|",
"JSX",
".",
"Element",
";",
"description",
"?",
":",
"string",
"|",
"JSX",
".",
"Element",
";",
"field",
"?",
":",
"FieldHook",
";",
"euiFieldProps",
"?",
":",
"Record",
"<",
"string",
",",
"any",
">",
";",
"titleTag",
"?",
":",
"'h2'",
"|",
"'h3'",
"|",
"'h4'",
"|",
"'h5'",
"|",
"'h6'",
";",
"children",
"?",
":",
"React",
".",
"ReactNode",
";",
"[",
"key",
"]",
":",
"any",
";",
"}",
"function",
"isTitleString",
"(",
"title",
")",
"{",
"return",
"typeof",
"title",
"===",
"'string'",
"||",
"title",
".",
"type",
".",
"name",
"===",
"'FormattedMessage'",
";",
"}",
"export",
"const",
"FormRow",
"=",
"(",
"{",
"title",
",",
"idAria",
",",
"description",
",",
"field",
",",
"children",
",",
"titleTag",
"=",
"'h4'",
",",
"...",
"rest",
"}",
")",
"=>",
"{",
"let",
"titleWrapped",
";",
"if",
"(",
"isTitleString",
"(",
"title",
")",
")",
"{",
"const",
"titleWithHTag",
"=",
"React",
".",
"createElement",
"(",
"titleTag",
",",
"undefined",
",",
"title",
")",
";",
"titleWrapped",
"=",
"<",
"EuiTitle",
"size",
"=",
"\"s\"",
">",
"{",
"titleWithHTag",
"}",
"<",
"/EuiTitle>;",
"}",
"else",
"{",
"titleWrapped",
"=",
"title",
";",
"}",
"return",
"(",
"<",
"EuiDescribedFormGroup",
"title",
"=",
"{",
"titleWrapped",
"}",
"description",
"=",
"{",
"description",
"}",
"fullWidth",
">",
"{",
"children",
"?",
"children",
":",
"field",
"?",
"<",
"Field",
"field",
"=",
"{",
"field",
"!",
"}",
"{",
"...",
"rest",
"}",
"/> : null}",
"<",
"/EuiDescribedFormGroup>);",
"}",
";",
"param",
"partialProps",
"export",
"const",
"getFormRow",
"=",
"(",
"partialProps",
")",
"=>",
"(",
"props",
")",
"=>",
"{",
"const",
"componentProps",
"=",
"{",
"...",
"partialProps",
",",
"...",
"props",
"}",
"as",
"Props",
";",
"return",
"<",
"FormRow",
"{",
"...",
"componentProps",
"}",
"/",
">",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
763 | [
"import",
"{",
"EuiSelectableOption",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"{",
"SerializerFunc",
"}",
"from",
"'../hook_form_lib'",
";",
"type",
"FuncType",
"=",
"(",
"selectOptions",
":",
"EuiSelectableOption",
"[",
"]",
")",
"=>",
"SerializerFunc",
";",
"export",
"const",
"multiSelectComponent",
"=",
"{",
"selectedValueToOptions",
"(",
"selectOptions",
")",
"{",
"return",
"(",
"defaultFormValue",
")",
"=>",
"{",
"if",
"(",
"!",
"defaultFormValue",
")",
"{",
"return",
"selectOptions",
";",
"}",
"return",
"(",
"selectOptions",
"as",
"EuiSelectableOption",
"[",
"]",
")",
".",
"map",
"(",
"(",
"option",
")",
"=>",
"(",
"{",
"...",
"option",
",",
"checked",
":",
"(",
"defaultFormValue",
"as",
"string",
"[",
"]",
")",
".",
"includes",
"(",
"option",
".",
"label",
")",
"?",
"'on'",
":",
"undefined",
",",
"}",
")",
")",
";",
"}",
";",
"}",
",",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17,
null,
null,
5,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
764 | [
"param",
"value",
"export",
"const",
"toInt",
"=",
"(",
"value",
")",
":",
"number",
"=>",
"parseFloat",
"(",
"value",
")",
";"
] | [
null,
null,
null,
null,
3,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
765 | [
"export",
"const",
"hasMaxLengthArray",
"=",
"(",
"length",
"=",
"5",
")",
"=>",
"(",
"value",
")",
":",
"boolean",
"=>",
"value",
".",
"length",
"<=",
"length",
";"
] | [
null,
null,
8,
null,
null,
3,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
766 | [
"export",
"const",
"hasMinLengthArray",
"=",
"(",
"length",
"=",
"1",
")",
"=>",
"(",
"value",
")",
":",
"boolean",
"=>",
"value",
".",
"length",
">=",
"length",
";"
] | [
null,
null,
8,
null,
null,
3,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
767 | [
"export",
"const",
"isEmptyArray",
"=",
"(",
"value",
")",
":",
"boolean",
"=>",
"value",
".",
"length",
"===",
"0",
";"
] | [
null,
null,
8,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
768 | [
"import",
"{",
"ValidationFunc",
"}",
"from",
"'../../hook_form_lib'",
";",
"import",
"{",
"isEmptyString",
"}",
"from",
"'../../../validators/string'",
";",
"import",
"{",
"isEmptyArray",
"}",
"from",
"'../../../validators/array'",
";",
"import",
"{",
"ERROR_CODE",
"}",
"from",
"'./types'",
";",
"export",
"const",
"emptyField",
"=",
"(",
"message",
")",
"=>",
"(",
"...",
"args",
")",
":",
"ReturnType",
"<",
"ValidationFunc",
"<",
"any",
",",
"ERROR_CODE",
">",
">",
"=>",
"{",
"const",
"[",
"{",
"value",
",",
"path",
"}",
"]",
"=",
"args",
";",
"if",
"(",
"typeof",
"value",
"===",
"'string'",
")",
"{",
"return",
"isEmptyString",
"(",
"value",
")",
"?",
"{",
"code",
":",
"'ERR_FIELD_MISSING'",
",",
"path",
",",
"message",
"}",
":",
"undefined",
";",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"value",
")",
")",
"{",
"return",
"isEmptyArray",
"(",
"value",
")",
"?",
"{",
"code",
":",
"'ERR_FIELD_MISSING'",
",",
"path",
",",
"message",
"}",
":",
"undefined",
";",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
397,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
769 | [
"import",
"{",
"ValidationFunc",
",",
"ValidationError",
"}",
"from",
"'../../hook_form_lib'",
";",
"import",
"{",
"hasMaxLengthString",
"}",
"from",
"'../../../validators/string'",
";",
"import",
"{",
"hasMaxLengthArray",
"}",
"from",
"'../../../validators/array'",
";",
"import",
"{",
"ERROR_CODE",
"}",
"from",
"'./types'",
";",
"export",
"const",
"maxLengthField",
"=",
"(",
"{",
"length",
"=",
"0",
",",
"message",
",",
"}",
")",
"=>",
"(",
"...",
"args",
")",
":",
"ReturnType",
"<",
"ValidationFunc",
"<",
"any",
",",
"ERROR_CODE",
">",
">",
"=>",
"{",
"const",
"[",
"{",
"value",
"}",
"]",
"=",
"args",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"value",
")",
")",
"{",
"return",
"hasMaxLengthArray",
"(",
"length",
")",
"(",
"value",
")",
"?",
"undefined",
":",
"{",
"code",
":",
"'ERR_MAX_LENGTH'",
",",
"length",
",",
"message",
":",
"typeof",
"message",
"===",
"'function'",
"?",
"message",
"(",
"{",
"length",
"}",
")",
":",
"message",
",",
"}",
";",
"}",
"return",
"hasMaxLengthString",
"(",
"length",
")",
"(",
"(",
"value",
"as",
"string",
")",
".",
"trim",
"(",
")",
")",
"?",
"undefined",
":",
"{",
"code",
":",
"'ERR_MAX_LENGTH'",
",",
"length",
",",
"message",
":",
"typeof",
"message",
"===",
"'function'",
"?",
"message",
"(",
"{",
"length",
"}",
")",
":",
"message",
",",
"}",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
770 | [
"/**\n * Output transforms are functions that will be called\n * with the form field value whenever we access the form data object. (with `form.getFormData()`)\n *\n * This allows us to have a different object/array as field `value`\n * from the desired outputed form data.\n *\n * Example:\n * ```ts\n * myField.value = [{ label: 'index_1', isSelected: true }, { label: 'index_2', isSelected: false }]\n * const serializer = (value) => (\n * value.filter(v => v.selected).map(v => v.label)\n * );\n *\n * // When serializing the form data, the following array will be returned\n * form.getFormData() -> { myField: ['index_1'] }\n * ````\n */",
"import",
"{",
"EuiSelectableOption",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"{",
"SerializerFunc",
"}",
"from",
"'../hook_form_lib'",
";",
"export",
"const",
"multiSelectComponent",
"=",
"{",
"param",
"value",
"optionsToSelectedValue",
"(",
"options",
")",
"{",
"return",
"options",
".",
"filter",
"(",
"(",
"option",
")",
"=>",
"option",
".",
"checked",
"===",
"'on'",
")",
".",
"map",
"(",
"(",
"option",
")",
"=>",
"option",
".",
"label",
")",
";",
"}",
",",
"}",
";",
"interface",
"StripEmptyFieldsOptions",
"{",
"types",
"?",
":",
"Array",
"<",
"'string'",
"|",
"'object'",
">",
";",
"recursive",
"?",
":",
"boolean",
";",
"}",
"param",
"object",
"param",
"types",
"param",
"options",
"export",
"const",
"stripEmptyFields",
"=",
"(",
"object",
"?",
",",
"options",
"?",
")",
":",
"{",
"[",
"key",
"]",
":",
"any",
";",
"}",
"=>",
"{",
"if",
"(",
"object",
"===",
"undefined",
")",
"{",
"return",
"{",
"}",
";",
"}",
"const",
"{",
"types",
"=",
"[",
"'string'",
",",
"'object'",
"]",
",",
"recursive",
"=",
"false",
"}",
"=",
"options",
"||",
"{",
"}",
";",
"return",
"Object",
".",
"entries",
"(",
"object",
")",
".",
"reduce",
"(",
"(",
"acc",
",",
"[",
"key",
",",
"value",
"]",
")",
"=>",
"{",
"const",
"type",
"=",
"typeof",
"value",
";",
"const",
"shouldStrip",
"=",
"types",
".",
"includes",
"(",
"type",
"as",
"'string'",
")",
";",
"if",
"(",
"shouldStrip",
"&&",
"type",
"===",
"'string'",
"&&",
"value",
".",
"trim",
"(",
")",
"===",
"''",
")",
"{",
"return",
"acc",
";",
"}",
"else",
"if",
"(",
"type",
"===",
"'object'",
"&&",
"!",
"Array",
".",
"isArray",
"(",
"value",
")",
"&&",
"value",
"!==",
"null",
")",
"{",
"if",
"(",
"Object",
".",
"keys",
"(",
"value",
")",
".",
"length",
"===",
"0",
"&&",
"shouldStrip",
")",
"{",
"return",
"acc",
";",
"}",
"else",
"if",
"(",
"recursive",
")",
"{",
"value",
"=",
"stripEmptyFields",
"(",
"{",
"...",
"value",
"}",
",",
"options",
")",
";",
"}",
"}",
"acc",
"[",
"key",
"]",
"=",
"value",
";",
"return",
"acc",
";",
"}",
",",
"{",
"}",
"as",
"{",
"[",
"key",
"]",
":",
"any",
";",
"}",
")",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17,
null,
null,
null,
null,
5,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
6,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
771 | [
"import",
"{",
"EuiSelectableOption",
"}",
"from",
"'@elastic/eui'",
";",
"import",
"{",
"ValidationFunc",
",",
"ValidationError",
"}",
"from",
"'../../hook_form_lib'",
";",
"import",
"{",
"hasMinLengthArray",
"}",
"from",
"'../../../validators/array'",
";",
"import",
"{",
"multiSelectComponent",
"}",
"from",
"'../serializers'",
";",
"import",
"{",
"ERROR_CODE",
"}",
"from",
"'./types'",
";",
"const",
"{",
"optionsToSelectedValue",
"}",
"=",
"multiSelectComponent",
";",
"param",
"total",
"export",
"const",
"minSelectableSelectionField",
"=",
"(",
"{",
"total",
"=",
"0",
",",
"message",
",",
"}",
")",
"=>",
"(",
"...",
"args",
")",
":",
"ReturnType",
"<",
"ValidationFunc",
"<",
"any",
",",
"ERROR_CODE",
">",
">",
"=>",
"{",
"const",
"[",
"{",
"value",
"}",
"]",
"=",
"args",
";",
"return",
"hasMinLengthArray",
"(",
"total",
")",
"(",
"optionsToSelectedValue",
"(",
"value",
"as",
"EuiSelectableOption",
"[",
"]",
")",
")",
"?",
"undefined",
":",
"{",
"code",
":",
"'ERR_MIN_SELECTION'",
",",
"total",
",",
"message",
":",
"typeof",
"message",
"===",
"'function'",
"?",
"message",
"(",
"{",
"length",
"}",
")",
":",
"message",
",",
"}",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
772 | [
"import",
"{",
"ValidationFunc",
",",
"ValidationError",
"}",
"from",
"'../../hook_form_lib'",
";",
"import",
"{",
"isUrl",
"}",
"from",
"'../../../validators/string'",
";",
"import",
"{",
"ERROR_CODE",
"}",
"from",
"'./types'",
";",
"export",
"const",
"urlField",
"=",
"(",
"message",
")",
"=>",
"(",
"...",
"args",
")",
":",
"ReturnType",
"<",
"ValidationFunc",
"<",
"any",
",",
"ERROR_CODE",
">",
">",
"=>",
"{",
"const",
"[",
"{",
"value",
"}",
"]",
"=",
"args",
";",
"const",
"error",
"=",
"{",
"code",
":",
"'ERR_FIELD_FORMAT'",
",",
"formatType",
":",
"'URL'",
",",
"message",
",",
"}",
";",
"if",
"(",
"typeof",
"value",
"!==",
"'string'",
")",
"{",
"return",
"error",
";",
"}",
"return",
"isUrl",
"(",
"value",
")",
"?",
"undefined",
":",
"error",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
397,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
930,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
773 | [
"import",
"{",
"indices",
"}",
"from",
"'../../../../public'",
";",
"import",
"{",
"ValidationFunc",
"}",
"from",
"'../../hook_form_lib'",
";",
"import",
"{",
"startsWith",
",",
"containsChars",
"}",
"from",
"'../../../validators/string'",
";",
"import",
"{",
"ERROR_CODE",
"}",
"from",
"'./types'",
";",
"export",
"const",
"indexNameField",
"=",
"(",
"i18n",
")",
"=>",
"(",
"...",
"args",
")",
":",
"ReturnType",
"<",
"ValidationFunc",
"<",
"any",
",",
"ERROR_CODE",
">",
">",
"=>",
"{",
"const",
"[",
"{",
"value",
"}",
"]",
"=",
"args",
";",
"if",
"(",
"startsWith",
"(",
"'.'",
")",
"(",
"value",
"as",
"string",
")",
")",
"{",
"return",
"{",
"code",
":",
"'ERR_FIELD_FORMAT'",
",",
"formatType",
":",
"'INDEX_NAME'",
",",
"message",
":",
"i18n",
".",
"translate",
"(",
"'esUi.forms.fieldValidation.indexNameStartsWithDotError'",
",",
"{",
"defaultMessage",
":",
"'The index name cannot start with a dot (.).'",
",",
"}",
")",
",",
"}",
";",
"}",
"const",
"{",
"doesContain",
":",
"doesContainSpaces",
"}",
"=",
"containsChars",
"(",
"' '",
")",
"(",
"value",
"as",
"string",
")",
";",
"if",
"(",
"doesContainSpaces",
")",
"{",
"return",
"{",
"code",
":",
"'ERR_FIELD_FORMAT'",
",",
"formatType",
":",
"'INDEX_NAME'",
",",
"message",
":",
"i18n",
".",
"translate",
"(",
"'esUi.forms.fieldValidation.indexNameSpacesError'",
",",
"{",
"defaultMessage",
":",
"'The index name cannot contain spaces.'",
",",
"}",
")",
",",
"}",
";",
"}",
"const",
"{",
"charsFound",
",",
"doesContain",
"}",
"=",
"containsChars",
"(",
"indices",
".",
"INDEX_ILLEGAL_CHARACTERS_VISIBLE",
")",
"(",
"value",
"as",
"string",
")",
";",
"if",
"(",
"doesContain",
")",
"{",
"return",
"{",
"message",
":",
"i18n",
".",
"translate",
"(",
"'esUi.forms.fieldValidation.indexNameInvalidCharactersError'",
",",
"{",
"defaultMessage",
":",
"'The index name contains the invalid {characterListLength, plural, one {character} other {characters}} { characterList }.'",
",",
"values",
":",
"{",
"characterList",
":",
"charsFound",
".",
"join",
"(",
"' '",
")",
",",
"characterListLength",
":",
"charsFound",
".",
"length",
",",
"}",
",",
"}",
")",
",",
"}",
";",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
397,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
774 | [
"import",
"{",
"ValidationFunc",
",",
"ValidationError",
"}",
"from",
"'../../hook_form_lib'",
";",
"import",
"{",
"containsChars",
"}",
"from",
"'../../../validators/string'",
";",
"import",
"{",
"ERROR_CODE",
"}",
"from",
"'./types'",
";",
"export",
"const",
"containsCharsField",
"=",
"(",
"{",
"message",
",",
"chars",
",",
"}",
")",
"=>",
"(",
"...",
"args",
")",
":",
"ReturnType",
"<",
"ValidationFunc",
"<",
"any",
",",
"ERROR_CODE",
">",
">",
"=>",
"{",
"const",
"[",
"{",
"value",
"}",
"]",
"=",
"args",
";",
"if",
"(",
"typeof",
"value",
"!==",
"'string'",
")",
"{",
"return",
";",
"}",
"const",
"{",
"doesContain",
",",
"charsFound",
"}",
"=",
"containsChars",
"(",
"chars",
")",
"(",
"value",
"as",
"string",
")",
";",
"if",
"(",
"doesContain",
")",
"{",
"return",
"{",
"code",
":",
"'ERR_INVALID_CHARS'",
",",
"charsFound",
",",
"message",
":",
"typeof",
"message",
"===",
"'function'",
"?",
"message",
"(",
"{",
"charsFound",
"}",
")",
":",
"message",
",",
"}",
";",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
775 | [
"import",
"{",
"ValidationFunc",
"}",
"from",
"'../../hook_form_lib'",
";",
"import",
"{",
"containsChars",
"}",
"from",
"'../../../validators/string'",
";",
"import",
"{",
"ERROR_CODE",
"}",
"from",
"'./types'",
";",
"import",
"{",
"indexPatterns",
"}",
"from",
"'../../../../../data/public'",
";",
"export",
"const",
"indexPatternField",
"=",
"(",
"i18n",
")",
"=>",
"(",
"...",
"args",
")",
":",
"ReturnType",
"<",
"ValidationFunc",
"<",
"any",
",",
"ERROR_CODE",
">",
">",
"=>",
"{",
"const",
"[",
"{",
"value",
"}",
"]",
"=",
"args",
";",
"if",
"(",
"typeof",
"value",
"!==",
"'string'",
")",
"{",
"return",
";",
"}",
"const",
"{",
"doesContain",
"}",
"=",
"containsChars",
"(",
"' '",
")",
"(",
"value",
")",
";",
"if",
"(",
"doesContain",
")",
"{",
"return",
"{",
"code",
":",
"'ERR_FIELD_FORMAT'",
",",
"formatType",
":",
"'INDEX_PATTERN'",
",",
"message",
":",
"i18n",
".",
"translate",
"(",
"'esUi.forms.fieldValidation.indexPatternSpacesError'",
",",
"{",
"defaultMessage",
":",
"'The index pattern cannot contain spaces.'",
",",
"}",
")",
",",
"}",
";",
"}",
"const",
"errors",
"=",
"indexPatterns",
".",
"validate",
"(",
"value",
")",
";",
"if",
"(",
"errors",
".",
"ILLEGAL_CHARACTERS",
")",
"{",
"return",
"{",
"code",
":",
"'ERR_FIELD_FORMAT'",
",",
"formatType",
":",
"'INDEX_PATTERN'",
",",
"message",
":",
"i18n",
".",
"translate",
"(",
"'esUi.forms.fieldValidation.indexPatternInvalidCharactersError'",
",",
"{",
"defaultMessage",
":",
"'The index pattern contains the invalid {characterListLength, plural, one {character} other {characters}} { characterList }.'",
",",
"values",
":",
"{",
"characterList",
":",
"errors",
".",
"ILLEGAL_CHARACTERS",
".",
"join",
"(",
"' '",
")",
",",
"characterListLength",
":",
"errors",
".",
"ILLEGAL_CHARACTERS",
".",
"length",
",",
"}",
",",
"}",
")",
",",
"}",
";",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
397,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
776 | [
"import",
"{",
"ValidationFunc",
"}",
"from",
"'../../hook_form_lib'",
";",
"import",
"{",
"isLowerCaseString",
"}",
"from",
"'../../../validators/string'",
";",
"import",
"{",
"ERROR_CODE",
"}",
"from",
"'./types'",
";",
"export",
"const",
"lowerCaseStringField",
"=",
"(",
"message",
")",
"=>",
"(",
"...",
"args",
")",
":",
"ReturnType",
"<",
"ValidationFunc",
"<",
"any",
",",
"ERROR_CODE",
">",
">",
"=>",
"{",
"const",
"[",
"{",
"value",
"}",
"]",
"=",
"args",
";",
"if",
"(",
"typeof",
"value",
"!==",
"'string'",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"isLowerCaseString",
"(",
"value",
")",
")",
"{",
"return",
"{",
"code",
":",
"'ERR_LOWERCASE_STRING'",
",",
"message",
",",
"}",
";",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
397,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
777 | [
"import",
"{",
"ValidationFunc",
"}",
"from",
"'../../hook_form_lib'",
";",
"import",
"{",
"isJSON",
"}",
"from",
"'../../../validators/string'",
";",
"import",
"{",
"ERROR_CODE",
"}",
"from",
"'./types'",
";",
"export",
"const",
"isJsonField",
"=",
"(",
"message",
",",
"{",
"allowEmptyString",
"=",
"false",
"}",
"=",
"{",
"}",
")",
"=>",
"(",
"...",
"args",
")",
":",
"ReturnType",
"<",
"ValidationFunc",
"<",
"any",
",",
"ERROR_CODE",
">",
">",
"=>",
"{",
"const",
"[",
"{",
"value",
"}",
"]",
"=",
"args",
";",
"if",
"(",
"typeof",
"value",
"!==",
"'string'",
"||",
"(",
"allowEmptyString",
"&&",
"value",
".",
"trim",
"(",
")",
"===",
"''",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"isJSON",
"(",
"value",
")",
")",
"{",
"return",
"{",
"code",
":",
"'ERR_JSON_FORMAT'",
",",
"message",
",",
"}",
";",
"}",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
778 | [
"export",
"const",
"isNumberGreaterThan",
"=",
"(",
"than",
",",
"allowEquality",
"=",
"false",
")",
"=>",
"(",
"value",
")",
"=>",
"allowEquality",
"?",
"value",
">=",
"than",
":",
"value",
">",
"than",
";"
] | [
null,
null,
8,
null,
null,
3,
null,
8,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
779 | [
"export",
"const",
"isNumberSmallerThan",
"=",
"(",
"than",
",",
"allowEquality",
"=",
"false",
")",
"=>",
"(",
"value",
")",
"=>",
"allowEquality",
"?",
"value",
"<=",
"than",
":",
"value",
"<",
"than",
";"
] | [
null,
null,
8,
null,
null,
3,
null,
8,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
780 | [
"import",
"{",
"ValidationFunc",
",",
"ValidationError",
"}",
"from",
"'../../hook_form_lib'",
";",
"import",
"{",
"isNumberSmallerThan",
"}",
"from",
"'../../../validators/number'",
";",
"import",
"{",
"ERROR_CODE",
"}",
"from",
"'./types'",
";",
"export",
"const",
"numberSmallerThanField",
"=",
"(",
"{",
"than",
",",
"message",
",",
"allowEquality",
"=",
"false",
",",
"}",
")",
"=>",
"(",
"...",
"args",
")",
":",
"ReturnType",
"<",
"ValidationFunc",
"<",
"any",
",",
"ERROR_CODE",
">",
">",
"=>",
"{",
"const",
"[",
"{",
"value",
"}",
"]",
"=",
"args",
";",
"return",
"isNumberSmallerThan",
"(",
"than",
",",
"allowEquality",
")",
"(",
"value",
"as",
"number",
")",
"?",
"undefined",
":",
"{",
"code",
":",
"'ERR_SMALLER_THAN_NUMBER'",
",",
"than",
",",
"message",
":",
"typeof",
"message",
"===",
"'function'",
"?",
"message",
"(",
"{",
"than",
"}",
")",
":",
"message",
",",
"}",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
781 | [
"import",
"*",
"as",
"fieldValidatorsImport",
"from",
"'./field_validators'",
";",
"import",
"*",
"as",
"fieldFormattersImport",
"from",
"'./field_formatters'",
";",
"import",
"*",
"as",
"serializersImport",
"from",
"'./serializers'",
";",
"import",
"*",
"as",
"deserializersImport",
"from",
"'./de_serializers'",
";",
"export",
"const",
"fieldValidators",
"=",
"fieldValidatorsImport",
";",
"export",
"const",
"fieldFormatters",
"=",
"fieldFormattersImport",
";",
"export",
"const",
"deserializers",
"=",
"deserializersImport",
";",
"export",
"const",
"serializers",
"=",
"serializersImport",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
8,
null,
null,
null
] |
782 | [
"import",
"{",
"stripEmptyFields",
"}",
"from",
"'./serializers'",
";",
"describe",
"(",
"'Serializers'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'stripEmptyFields()'",
",",
"(",
")",
"=>",
"{",
"let",
"object",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"object",
"=",
"{",
"a",
":",
"''",
",",
"b",
":",
"' '",
",",
"c",
":",
"'0'",
",",
"d",
":",
"0",
",",
"e",
":",
"false",
",",
"f",
":",
"null",
",",
"g",
":",
"[",
"]",
",",
"h",
":",
"{",
"}",
",",
"i",
":",
"{",
"a",
":",
"''",
",",
"b",
":",
"{",
"}",
",",
"c",
":",
"null",
",",
"d",
":",
"123",
",",
"}",
",",
"}",
";",
"}",
")",
";",
"test",
"(",
"'should not remove empty string or empty object in child objects (not recursively = default)'",
",",
"(",
")",
"=>",
"{",
"const",
"expected",
"=",
"{",
"c",
":",
"object",
".",
"c",
",",
"d",
":",
"object",
".",
"d",
",",
"e",
":",
"object",
".",
"e",
",",
"f",
":",
"object",
".",
"f",
",",
"g",
":",
"object",
".",
"g",
",",
"i",
":",
"object",
".",
"i",
",",
"}",
";",
"expect",
"(",
"stripEmptyFields",
"(",
"object",
")",
")",
".",
"toEqual",
"(",
"expected",
")",
";",
"}",
")",
";",
"test",
"(",
"'should remove all empty string and empty object (recursively)'",
",",
"(",
")",
"=>",
"{",
"const",
"expected",
"=",
"{",
"c",
":",
"object",
".",
"c",
",",
"d",
":",
"object",
".",
"d",
",",
"e",
":",
"object",
".",
"e",
",",
"f",
":",
"object",
".",
"f",
",",
"g",
":",
"object",
".",
"g",
",",
"i",
":",
"{",
"c",
":",
"object",
".",
"i",
".",
"c",
",",
"d",
":",
"object",
".",
"i",
".",
"d",
",",
"}",
",",
"}",
";",
"expect",
"(",
"stripEmptyFields",
"(",
"object",
",",
"{",
"recursive",
":",
"true",
"}",
")",
")",
".",
"toEqual",
"(",
"expected",
")",
";",
"}",
")",
";",
"test",
"(",
"'should only remove empty string (recursively)'",
",",
"(",
")",
"=>",
"{",
"const",
"expected",
"=",
"{",
"a",
":",
"object",
".",
"a",
",",
"b",
":",
"object",
".",
"b",
",",
"c",
":",
"object",
".",
"c",
",",
"d",
":",
"object",
".",
"d",
",",
"e",
":",
"object",
".",
"e",
",",
"f",
":",
"object",
".",
"f",
",",
"g",
":",
"object",
".",
"g",
",",
"i",
":",
"{",
"a",
":",
"object",
".",
"i",
".",
"a",
",",
"c",
":",
"object",
".",
"i",
".",
"c",
",",
"d",
":",
"object",
".",
"i",
".",
"d",
",",
"}",
",",
"}",
";",
"expect",
"(",
"stripEmptyFields",
"(",
"object",
",",
"{",
"recursive",
":",
"true",
",",
"types",
":",
"[",
"'object'",
"]",
"}",
")",
")",
".",
"toEqual",
"(",
"expected",
")",
";",
"}",
")",
";",
"test",
"(",
"'should only remove empty objects (recursively)'",
",",
"(",
")",
"=>",
"{",
"const",
"expected",
"=",
"{",
"c",
":",
"object",
".",
"c",
",",
"d",
":",
"object",
".",
"d",
",",
"e",
":",
"object",
".",
"e",
",",
"f",
":",
"object",
".",
"f",
",",
"g",
":",
"object",
".",
"g",
",",
"h",
":",
"object",
".",
"h",
",",
"i",
":",
"{",
"b",
":",
"object",
".",
"i",
".",
"b",
",",
"c",
":",
"object",
".",
"i",
".",
"c",
",",
"d",
":",
"object",
".",
"i",
".",
"d",
",",
"}",
",",
"}",
";",
"expect",
"(",
"stripEmptyFields",
"(",
"object",
",",
"{",
"recursive",
":",
"true",
",",
"types",
":",
"[",
"'string'",
"]",
"}",
")",
")",
".",
"toEqual",
"(",
"expected",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
783 | [
"import",
"React",
",",
"{",
"useState",
"}",
"from",
"'react'",
";",
"import",
"{",
"act",
"}",
"from",
"'react-dom/test-utils'",
";",
"import",
"{",
"registerTestBed",
",",
"TestBed",
"}",
"from",
"'../shared_imports'",
";",
"import",
"{",
"OnUpdateHandler",
"}",
"from",
"'../types'",
";",
"import",
"{",
"useForm",
"}",
"from",
"'../hooks/use_form'",
";",
"import",
"{",
"Form",
"}",
"from",
"'./form'",
";",
"import",
"{",
"UseField",
"}",
"from",
"'./use_field'",
";",
"import",
"{",
"FormDataProvider",
"}",
"from",
"'./form_data_provider'",
";",
"describe",
"(",
"'<FormDataProvider />'",
",",
"(",
")",
"=>",
"{",
"test",
"(",
"'should listen to changes in the form data and re-render the children with the updated data'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"onFormData",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"const",
"TestComp",
"=",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"name\"",
"defaultValue",
"=",
"\"Initial value\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"nameField\"",
"/",
">",
"<",
"FormDataProvider",
">",
"{",
"(",
"formData",
")",
"=>",
"{",
"onFormData",
"(",
"formData",
")",
";",
"return",
"null",
";",
"}",
"}",
"<",
"/FormDataProvider>",
"{",
"}",
"<",
"UseField",
"path",
"=",
"\"lastName\"",
"defaultValue",
"=",
"\"Initial value\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"lastNameField\"",
"/",
">",
"<",
"/Form>);",
"}",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"setup",
"(",
")",
"as",
"TestBed",
";",
"expect",
"(",
"onFormData",
".",
"mock",
".",
"calls",
".",
"length",
")",
".",
"toBe",
"(",
"1",
")",
";",
"const",
"[",
"formDataInitial",
"]",
"=",
"onFormData",
".",
"mock",
".",
"calls",
"[",
"onFormData",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
"as",
"Parameters",
"<",
"OnUpdateHandler",
">",
";",
"expect",
"(",
"formDataInitial",
")",
".",
"toEqual",
"(",
"{",
"name",
":",
"'Initial value'",
",",
"lastName",
":",
"'Initial value'",
",",
"}",
")",
";",
"onFormData",
".",
"mockReset",
"(",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'nameField'",
",",
"'updated value'",
")",
";",
"setInputValue",
"(",
"'lastNameField'",
",",
"'updated value'",
")",
";",
"}",
")",
";",
"expect",
"(",
"onFormData",
")",
".",
"toBeCalledTimes",
"(",
"2",
")",
";",
"const",
"[",
"formDataUpdated",
"]",
"=",
"onFormData",
".",
"mock",
".",
"calls",
"[",
"onFormData",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
"as",
"Parameters",
"<",
"OnUpdateHandler",
">",
";",
"expect",
"(",
"formDataUpdated",
")",
".",
"toEqual",
"(",
"{",
"name",
":",
"'updated value'",
",",
"lastName",
":",
"'updated value'",
",",
"}",
")",
";",
"}",
")",
";",
"test",
"(",
"'should subscribe to the latest updated form data when mounting late'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"onFormData",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"const",
"TestComp",
"=",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
")",
";",
"const",
"[",
"isOn",
",",
"setIsOn",
"]",
"=",
"useState",
"(",
"false",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"name\"",
"defaultValue",
"=",
"\"Initial value\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"nameField\"",
"/",
">",
"<",
"button",
"onClick",
"=",
"{",
"(",
")",
"=>",
"setIsOn",
"(",
"true",
")",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"btn\"",
">",
"Toggle",
"On",
"<",
"/button>",
"{",
"isOn",
"&&",
"(",
"<",
"FormDataProvider",
">",
"{",
"(",
"formData",
")",
"=>",
"{",
"onFormData",
"(",
"formData",
")",
";",
"return",
"null",
";",
"}",
"}",
"<",
"/FormDataProvider>)}",
"<",
"/Form>);",
"}",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"find",
",",
"}",
"=",
"setup",
"(",
")",
"as",
"TestBed",
";",
"expect",
"(",
"onFormData",
")",
".",
"toBeCalledTimes",
"(",
"0",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'nameField'",
",",
"'updated value'",
")",
";",
"}",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"find",
"(",
"'btn'",
")",
".",
"simulate",
"(",
"'click'",
")",
".",
"update",
"(",
")",
";",
"}",
")",
";",
"expect",
"(",
"onFormData",
".",
"mock",
".",
"calls",
".",
"length",
")",
".",
"toBe",
"(",
"2",
")",
";",
"const",
"[",
"formDataUpdated",
"]",
"=",
"onFormData",
".",
"mock",
".",
"calls",
"[",
"onFormData",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
"as",
"Parameters",
"<",
"OnUpdateHandler",
">",
";",
"expect",
"(",
"formDataUpdated",
")",
".",
"toEqual",
"(",
"{",
"name",
":",
"'updated value'",
",",
"}",
")",
";",
"}",
")",
";",
"test",
"(",
"'props.pathsToWatch (string): should not re-render the children when the field that changed is not the one provided'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"onFormData",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"const",
"TestComp",
"=",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"name\"",
"defaultValue",
"=",
"\"Initial value\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"nameField\"",
"/",
">",
"<",
"UseField",
"path",
"=",
"\"lastName\"",
"defaultValue",
"=",
"\"Initial value\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"lastNameField\"",
"/",
">",
"<",
"FormDataProvider",
"pathsToWatch",
"=",
"\"name\"",
">",
"{",
"(",
"formData",
")",
"=>",
"{",
"onFormData",
"(",
"formData",
")",
";",
"return",
"null",
";",
"}",
"}",
"<",
"/FormDataProvider>",
"<",
"/Form>);",
"}",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"setup",
"(",
")",
"as",
"TestBed",
";",
"onFormData",
".",
"mockReset",
"(",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'lastNameField'",
",",
"'updated value'",
")",
";",
"}",
")",
";",
"expect",
"(",
"onFormData",
")",
".",
"toBeCalledTimes",
"(",
"0",
")",
";",
"}",
")",
";",
"test",
"(",
"'props.pathsToWatch (Array<string>): should not re-render the children when the field that changed is not in the watch list'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"onFormData",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"const",
"TestComp",
"=",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"name\"",
"defaultValue",
"=",
"\"Initial value\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"nameField\"",
"/",
">",
"<",
"UseField",
"path",
"=",
"\"lastName\"",
"defaultValue",
"=",
"\"Initial value\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"lastNameField\"",
"/",
">",
"<",
"UseField",
"path",
"=",
"\"company\"",
"defaultValue",
"=",
"\"Initial value\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"companyField\"",
"/",
">",
"<",
"FormDataProvider",
"pathsToWatch",
"=",
"{",
"[",
"'name'",
",",
"'lastName'",
"]",
"}",
">",
"{",
"(",
"formData",
")",
"=>",
"{",
"onFormData",
"(",
"formData",
")",
";",
"return",
"null",
";",
"}",
"}",
"<",
"/FormDataProvider>",
"<",
"/Form>);",
"}",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"setup",
"(",
")",
"as",
"TestBed",
";",
"onFormData",
".",
"mockReset",
"(",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'companyField'",
",",
"'updated value'",
")",
";",
"}",
")",
";",
"expect",
"(",
"onFormData",
")",
".",
"toBeCalledTimes",
"(",
"0",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'nameField'",
",",
"'updated value'",
")",
";",
"}",
")",
";",
"expect",
"(",
"onFormData",
")",
".",
"toBeCalledTimes",
"(",
"1",
")",
";",
"onFormData",
".",
"mockReset",
"(",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'lastNameField'",
",",
"'updated value'",
")",
";",
"}",
")",
";",
"expect",
"(",
"onFormData",
".",
"mock",
".",
"calls",
".",
"length",
")",
".",
"toBe",
"(",
"2",
")",
";",
"const",
"[",
"formData",
"]",
"=",
"onFormData",
".",
"mock",
".",
"calls",
"[",
"onFormData",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
"as",
"Parameters",
"<",
"OnUpdateHandler",
">",
";",
"expect",
"(",
"formData",
")",
".",
"toEqual",
"(",
"{",
"name",
":",
"'updated value'",
",",
"lastName",
":",
"'updated value'",
",",
"company",
":",
"'updated value'",
",",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
784 | [
"import",
"React",
",",
"{",
"useEffect",
",",
"FunctionComponent",
",",
"useState",
",",
"useCallback",
"}",
"from",
"'react'",
";",
"import",
"{",
"act",
"}",
"from",
"'react-dom/test-utils'",
";",
"import",
"{",
"first",
"}",
"from",
"'rxjs/operators'",
";",
"import",
"{",
"registerTestBed",
",",
"TestBed",
"}",
"from",
"'../shared_imports'",
";",
"import",
"{",
"FormHook",
",",
"OnUpdateHandler",
",",
"FieldConfig",
",",
"FieldHook",
"}",
"from",
"'../types'",
";",
"import",
"{",
"useForm",
"}",
"from",
"'../hooks/use_form'",
";",
"import",
"{",
"useBehaviorSubject",
"}",
"from",
"'../hooks/utils/use_behavior_subject'",
";",
"import",
"{",
"Form",
"}",
"from",
"'./form'",
";",
"import",
"{",
"UseField",
"}",
"from",
"'./use_field'",
";",
"describe",
"(",
"'<UseField />'",
",",
"(",
")",
"=>",
"{",
"beforeAll",
"(",
"(",
")",
"=>",
"{",
"jest",
".",
"useFakeTimers",
"(",
")",
";",
"}",
")",
";",
"afterAll",
"(",
"(",
")",
"=>",
"{",
"jest",
".",
"useRealTimers",
"(",
")",
";",
"}",
")",
";",
"test",
"(",
"'should read the default value from the prop and fallback to the config object'",
",",
"(",
")",
"=>",
"{",
"const",
"onFormData",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"const",
"TestComp",
"=",
"(",
"{",
"onData",
"}",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
")",
";",
"const",
"{",
"subscribe",
"}",
"=",
"form",
";",
"useEffect",
"(",
"(",
")",
"=>",
"subscribe",
"(",
"onData",
")",
".",
"unsubscribe",
",",
"[",
"subscribe",
",",
"onData",
"]",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"name\"",
"config",
"=",
"{",
"{",
"defaultValue",
":",
"'John'",
"}",
"}",
"/>",
"<",
"UseField",
"path",
"=",
"\"lastName\"",
"defaultValue",
"=",
"\"Snow\"",
"config",
"=",
"{",
"{",
"defaultValue",
":",
"'Will be Overridden'",
"}",
"}",
"/>",
"<",
"/Form>);",
"}",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"defaultProps",
":",
"{",
"onData",
":",
"onFormData",
"}",
",",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"setup",
"(",
")",
";",
"const",
"[",
"{",
"data",
"}",
"]",
"=",
"onFormData",
".",
"mock",
".",
"calls",
"[",
"onFormData",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
"as",
"Parameters",
"<",
"OnUpdateHandler",
">",
";",
"expect",
"(",
"data",
".",
"internal",
")",
".",
"toEqual",
"(",
"{",
"name",
":",
"'John'",
",",
"lastName",
":",
"'Snow'",
",",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'state'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'isPristine, isDirty, isModified'",
",",
"(",
")",
"=>",
"{",
"const",
"ObjectField",
"=",
"(",
"{",
"field",
":",
"{",
"setValue",
"}",
"}",
")",
"=>",
"{",
"const",
"onFieldChange",
"=",
"(",
"e",
")",
"=>",
"{",
"setValue",
"(",
"JSON",
".",
"parse",
"(",
"e",
".",
"target",
".",
"value",
")",
")",
";",
"}",
";",
"return",
"<",
"input",
"onChange",
"=",
"{",
"onFieldChange",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"testField\"",
"/",
">",
";",
"}",
";",
"interface",
"FieldState",
"{",
"isModified",
":",
"boolean",
";",
"isDirty",
":",
"boolean",
";",
"isPristine",
":",
"boolean",
";",
"value",
":",
"unknown",
";",
"}",
"const",
"getChildrenFunc",
"=",
"(",
"onStateChange",
",",
"Component",
"?",
")",
"=>",
"{",
"const",
"childrenFunc",
"=",
"(",
"field",
")",
"=>",
"{",
"const",
"{",
"onChange",
",",
"isModified",
",",
"isPristine",
",",
"isDirty",
",",
"value",
"}",
"=",
"field",
";",
"onStateChange",
"(",
"{",
"isModified",
",",
"isPristine",
",",
"isDirty",
",",
"value",
"}",
")",
";",
"return",
"Component",
"?",
"(",
"<",
"Component",
"field",
"=",
"{",
"field",
"}",
"/",
">",
")",
":",
"(",
"<",
"input",
"onChange",
"=",
"{",
"onChange",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"testField\"",
"/",
">",
")",
";",
"}",
";",
"return",
"childrenFunc",
";",
"}",
";",
"interface",
"Props",
"{",
"fieldProps",
":",
"Record",
"<",
"string",
",",
"any",
">",
";",
"}",
"const",
"TestComp",
"=",
"(",
"{",
"fieldProps",
"}",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"name\"",
"{",
"...",
"fieldProps",
"}",
"/>",
"<",
"/Form>);",
"}",
";",
"const",
"onStateChangeSpy",
"=",
"jest",
".",
"fn",
"<",
"void",
",",
"[",
"FieldState",
"]",
">",
"(",
")",
";",
"const",
"lastFieldState",
"=",
"(",
")",
":",
"FieldState",
"=>",
"onStateChangeSpy",
".",
"mock",
".",
"calls",
"[",
"onStateChangeSpy",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
"[",
"0",
"]",
";",
"const",
"toString",
"=",
"(",
"value",
")",
":",
"string",
"=>",
"typeof",
"value",
"===",
"'string'",
"?",
"value",
":",
"JSON",
".",
"stringify",
"(",
"value",
")",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"defaultProps",
":",
"{",
"onStateChangeSpy",
"}",
",",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"[",
"{",
"description",
":",
"'should update the state for field without default values'",
",",
"initialValue",
":",
"''",
",",
"changedValue",
":",
"'changed'",
",",
"fieldProps",
":",
"{",
"children",
":",
"getChildrenFunc",
"(",
"onStateChangeSpy",
")",
"}",
",",
"}",
",",
"{",
"description",
":",
"'should update the state for field with default value in their config'",
",",
"initialValue",
":",
"'initialValue'",
",",
"changedValue",
":",
"'changed'",
",",
"fieldProps",
":",
"{",
"children",
":",
"getChildrenFunc",
"(",
"onStateChangeSpy",
")",
",",
"config",
":",
"{",
"defaultValue",
":",
"'initialValue'",
"}",
",",
"}",
",",
"}",
",",
"{",
"description",
":",
"'should update the state for field with default value passed through props'",
",",
"initialValue",
":",
"'initialValue'",
",",
"changedValue",
":",
"'changed'",
",",
"fieldProps",
":",
"{",
"children",
":",
"getChildrenFunc",
"(",
"onStateChangeSpy",
")",
",",
"defaultValue",
":",
"'initialValue'",
",",
"}",
",",
"}",
",",
"{",
"description",
":",
"'should update the state for field with object field type'",
",",
"initialValue",
":",
"{",
"initial",
":",
"'value'",
"}",
",",
"changedValue",
":",
"{",
"foo",
":",
"'bar'",
"}",
",",
"fieldProps",
":",
"{",
"children",
":",
"getChildrenFunc",
"(",
"onStateChangeSpy",
",",
"ObjectField",
")",
",",
"defaultValue",
":",
"{",
"initial",
":",
"'value'",
"}",
",",
"}",
",",
"}",
",",
"]",
".",
"forEach",
"(",
"(",
"{",
"description",
",",
"fieldProps",
",",
"initialValue",
",",
"changedValue",
"}",
")",
"=>",
"{",
"test",
"(",
"description",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"await",
"setup",
"(",
"{",
"fieldProps",
"}",
")",
";",
"expect",
"(",
"lastFieldState",
"(",
")",
")",
".",
"toEqual",
"(",
"{",
"isPristine",
":",
"true",
",",
"isDirty",
":",
"false",
",",
"isModified",
":",
"false",
",",
"value",
":",
"initialValue",
",",
"}",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"form",
".",
"setInputValue",
"(",
"'testField'",
",",
"toString",
"(",
"changedValue",
")",
")",
";",
"}",
")",
";",
"expect",
"(",
"lastFieldState",
"(",
")",
")",
".",
"toEqual",
"(",
"{",
"isPristine",
":",
"false",
",",
"isDirty",
":",
"true",
",",
"isModified",
":",
"true",
",",
"value",
":",
"changedValue",
",",
"}",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"form",
".",
"setInputValue",
"(",
"'testField'",
",",
"toString",
"(",
"initialValue",
")",
")",
";",
"}",
")",
";",
"expect",
"(",
"lastFieldState",
"(",
")",
")",
".",
"toEqual",
"(",
"{",
"isPristine",
":",
"false",
",",
"isDirty",
":",
"true",
",",
"isModified",
":",
"false",
",",
"value",
":",
"initialValue",
",",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'validation'",
",",
"(",
")",
"=>",
"{",
"let",
"formHook",
"=",
"null",
";",
"let",
"fieldHook",
"=",
"null",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"formHook",
"=",
"null",
";",
"fieldHook",
"=",
"null",
";",
"}",
")",
";",
"const",
"onFormHook",
"=",
"(",
"form",
")",
"=>",
"{",
"formHook",
"=",
"form",
";",
"}",
";",
"const",
"onFieldHook",
"=",
"(",
"field",
")",
"=>",
"{",
"fieldHook",
"=",
"field",
";",
"}",
";",
"const",
"getTestComp",
"=",
"(",
"fieldConfig",
")",
"=>",
"{",
"const",
"TestComp",
"=",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"<",
"any",
">",
"(",
")",
";",
"const",
"[",
"isFieldActive",
",",
"setIsFieldActive",
"]",
"=",
"useState",
"(",
"true",
")",
";",
"const",
"unmountField",
"=",
"(",
")",
"=>",
"{",
"setIsFieldActive",
"(",
"false",
")",
";",
"}",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"onFormHook",
"(",
"form",
")",
";",
"}",
",",
"[",
"form",
"]",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"{",
"isFieldActive",
"&&",
"(",
"<",
"UseField",
"path",
"=",
"\"name\"",
"config",
"=",
"{",
"fieldConfig",
"}",
">",
"{",
"(",
"field",
")",
"=>",
"{",
"onFieldHook",
"(",
"field",
")",
";",
"return",
"(",
"<",
"input",
"value",
"=",
"{",
"field",
".",
"value",
"as",
"string",
"}",
"onChange",
"=",
"{",
"field",
".",
"onChange",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"myField\"",
"/",
">",
")",
";",
"}",
"}",
"<",
"/UseField>)}",
"<",
"button",
"onClick",
"=",
"{",
"unmountField",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"unmountFieldBtn\"",
">",
"Unmount",
"field",
"<",
"/button>",
"<",
"/Form>);",
"}",
";",
"return",
"TestComp",
";",
"}",
";",
"const",
"setup",
"=",
"(",
"fieldConfig",
")",
"=>",
"{",
"return",
"registerTestBed",
"(",
"getTestComp",
"(",
"fieldConfig",
")",
",",
"{",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
"(",
")",
"as",
"TestBed",
";",
"}",
";",
"test",
"(",
"'should update the form validity whenever the field value changes'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"fieldConfig",
"=",
"{",
"defaultValue",
":",
"''",
",",
"validations",
":",
"[",
"{",
"validator",
":",
"(",
"{",
"value",
"}",
")",
"=>",
"{",
"if",
"(",
"(",
"value",
"as",
"string",
")",
".",
"trim",
"(",
")",
"===",
"''",
")",
"{",
"return",
"{",
"message",
":",
"'Error: field is empty.'",
"}",
";",
"}",
"}",
",",
"}",
",",
"]",
",",
"}",
";",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"setup",
"(",
"fieldConfig",
")",
";",
"if",
"(",
"formHook",
"===",
"null",
")",
"{",
"throw",
"new",
"Error",
"(",
"'FormHook object has not been set.'",
")",
";",
"}",
"let",
"{",
"isValid",
"}",
"=",
"formHook",
";",
"expect",
"(",
"isValid",
")",
".",
"toBeUndefined",
"(",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"await",
"formHook",
"!",
".",
"validate",
"(",
")",
";",
"}",
")",
";",
"(",
"{",
"isValid",
"}",
"=",
"formHook",
")",
";",
"expect",
"(",
"isValid",
")",
".",
"toBe",
"(",
"false",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'myField'",
",",
"'changedValue'",
")",
";",
"}",
")",
";",
"(",
"{",
"isValid",
"}",
"=",
"formHook",
")",
";",
"expect",
"(",
"isValid",
")",
".",
"toBe",
"(",
"true",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'myField'",
",",
"''",
")",
";",
"}",
")",
";",
"(",
"{",
"isValid",
"}",
"=",
"formHook",
")",
";",
"expect",
"(",
"isValid",
")",
".",
"toBe",
"(",
"false",
")",
";",
"}",
")",
";",
"test",
"(",
"'should not update the state if the field has unmounted while validating'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"fieldConfig",
"=",
"{",
"validations",
":",
"[",
"{",
"validator",
":",
"(",
")",
"=>",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
")",
"=>",
"{",
"setTimeout",
"(",
"(",
")",
"=>",
"{",
"resolve",
"(",
"{",
"message",
":",
"'Invalid field'",
"}",
")",
";",
"}",
",",
"5000",
")",
";",
"}",
")",
";",
"}",
",",
"}",
",",
"]",
",",
"}",
";",
"const",
"{",
"find",
",",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"setup",
"(",
"fieldConfig",
")",
";",
"expect",
"(",
"fieldHook",
"?.",
"isValidating",
")",
".",
"toBe",
"(",
"false",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'myField'",
",",
"'changedValue'",
")",
";",
"}",
")",
";",
"expect",
"(",
"fieldHook",
"?.",
"isValidating",
")",
".",
"toBe",
"(",
"true",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"find",
"(",
"'unmountFieldBtn'",
")",
".",
"simulate",
"(",
"'click'",
")",
";",
"}",
")",
";",
"const",
"originalConsoleError",
"=",
"console",
".",
"error",
";",
"const",
"spyConsoleError",
"=",
"jest",
".",
"fn",
"(",
"(",
"message",
")",
"=>",
"{",
"originalConsoleError",
"(",
"message",
")",
";",
"}",
")",
";",
"console",
".",
"error",
"=",
"spyConsoleError",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"jest",
".",
"advanceTimersByTime",
"(",
"5000",
")",
";",
"}",
")",
";",
"expect",
"(",
"spyConsoleError",
".",
"mock",
".",
"calls",
".",
"length",
")",
".",
"toBe",
"(",
"0",
")",
";",
"console",
".",
"error",
"=",
"originalConsoleError",
";",
"}",
")",
";",
"describe",
"(",
"'dynamic data'",
",",
"(",
")",
"=>",
"{",
"let",
"nameFieldHook",
"=",
"null",
";",
"let",
"lastNameFieldHook",
"=",
"null",
";",
"const",
"schema",
"=",
"{",
"name",
":",
"{",
"validations",
":",
"[",
"{",
"validator",
":",
"async",
"(",
"{",
"customData",
":",
"{",
"provider",
"}",
"}",
")",
"=>",
"{",
"const",
"dynamicData",
"=",
"await",
"provider",
"(",
")",
";",
"if",
"(",
"dynamicData",
"===",
"'bad'",
")",
"{",
"return",
"{",
"message",
":",
"'Invalid dynamic data'",
",",
"}",
";",
"}",
"}",
",",
"}",
",",
"]",
",",
"}",
"as",
"FieldConfig",
",",
"lastName",
":",
"{",
"validations",
":",
"[",
"{",
"validator",
":",
"(",
"{",
"customData",
":",
"{",
"value",
":",
"validationData",
"}",
"}",
")",
"=>",
"{",
"if",
"(",
"validationData",
"===",
"'bad'",
")",
"{",
"return",
"{",
"message",
":",
"`Invalid dynamic data: ${",
"validationData",
"}`",
",",
"}",
";",
"}",
"}",
",",
"}",
",",
"]",
",",
"}",
"as",
"FieldConfig",
",",
"}",
";",
"const",
"onNameFieldHook",
"=",
"(",
"field",
")",
"=>",
"{",
"nameFieldHook",
"=",
"field",
";",
"}",
";",
"const",
"onLastNameFieldHook",
"=",
"(",
"field",
")",
"=>",
"{",
"lastNameFieldHook",
"=",
"field",
";",
"}",
";",
"interface",
"DynamicValidationDataProps",
"{",
"validationData",
"?",
":",
"unknown",
";",
"}",
"const",
"TestComp",
"=",
"(",
"{",
"validationData",
"}",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
"{",
"schema",
"}",
")",
";",
"const",
"[",
"validationData$",
",",
"next",
"]",
"=",
"useBehaviorSubject",
"<",
"string",
"|",
"undefined",
">",
"(",
"undefined",
")",
";",
"const",
"validationDataProvider",
"=",
"useCallback",
"(",
"async",
"(",
")",
"=>",
"{",
"const",
"data",
"=",
"await",
"validationData$",
".",
"pipe",
"(",
"first",
"(",
"(",
"value",
")",
"=>",
"value",
"!==",
"undefined",
")",
")",
".",
"toPromise",
"(",
")",
";",
"next",
"(",
"undefined",
")",
";",
"return",
"data",
";",
"}",
",",
"[",
"validationData$",
",",
"next",
"]",
")",
";",
"const",
"setInvalidDynamicData",
"=",
"(",
")",
"=>",
"{",
"next",
"(",
"'bad'",
")",
";",
"}",
";",
"const",
"setValidDynamicData",
"=",
"(",
")",
"=>",
"{",
"next",
"(",
"'good'",
")",
";",
"}",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
">",
"{",
"}",
"<",
"UseField",
"<",
"string",
">",
"path",
"=",
"\"name\"",
"validationDataProvider",
"=",
"{",
"validationDataProvider",
"}",
">",
"{",
"(",
"field",
")",
"=>",
"{",
"onNameFieldHook",
"(",
"field",
")",
";",
"return",
"(",
"<",
"input",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"nameField\"",
"value",
"=",
"{",
"field",
".",
"value",
"}",
"onChange",
"=",
"{",
"field",
".",
"onChange",
"}",
"/",
">",
")",
";",
"}",
"}",
"<",
"/UseField>",
"{",
"}",
"<",
"UseField",
"<",
"string",
">",
"path",
"=",
"\"lastName\"",
"validationData",
"=",
"{",
"validationData",
"}",
">",
"{",
"(",
"field",
")",
"=>",
"{",
"onLastNameFieldHook",
"(",
"field",
")",
";",
"return",
"(",
"<",
"input",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"lastNameField\"",
"value",
"=",
"{",
"field",
".",
"value",
"}",
"onChange",
"=",
"{",
"field",
".",
"onChange",
"}",
"/",
">",
")",
";",
"}",
"}",
"<",
"/UseField>",
"<",
"button",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"setValidValueBtn\"",
"onClick",
"=",
"{",
"setValidDynamicData",
"}",
">",
"Update",
"dynamic",
"data",
"(",
"valid",
")",
"<",
"/button>",
"<",
"button",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"setInvalidValueBtn\"",
"onClick",
"=",
"{",
"setInvalidDynamicData",
"}",
">",
"Update",
"dynamic",
"data",
"(",
"invalid",
")",
"<",
"/button>",
"<",
"/>",
"<",
"/Form>);",
"}",
";",
"const",
"setupDynamicData",
"=",
"(",
"defaultProps",
"?",
")",
"=>",
"{",
"return",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"defaultProps",
",",
"}",
")",
"(",
")",
"as",
"TestBed",
";",
"}",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"nameFieldHook",
"=",
"null",
";",
"}",
")",
";",
"test",
"(",
"'it should access dynamic data provided **after** the field value changed'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
",",
"find",
"}",
"=",
"setupDynamicData",
"(",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"form",
".",
"setInputValue",
"(",
"'nameField'",
",",
"'newValue'",
")",
";",
"}",
")",
";",
"expect",
"(",
"nameFieldHook",
"?.",
"isValidating",
")",
".",
"toBe",
"(",
"true",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"jest",
".",
"advanceTimersByTime",
"(",
"10000",
")",
";",
"}",
")",
";",
"expect",
"(",
"nameFieldHook",
"?.",
"isValidating",
")",
".",
"toBe",
"(",
"true",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"find",
"(",
"'setValidValueBtn'",
")",
".",
"simulate",
"(",
"'click'",
")",
";",
"}",
")",
";",
"expect",
"(",
"nameFieldHook",
"?.",
"isValidating",
")",
".",
"toBe",
"(",
"false",
")",
";",
"expect",
"(",
"nameFieldHook",
"?.",
"isValid",
")",
".",
"toBe",
"(",
"true",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"form",
".",
"setInputValue",
"(",
"'nameField'",
",",
"'anotherValue'",
")",
";",
"}",
")",
";",
"expect",
"(",
"nameFieldHook",
"?.",
"isValidating",
")",
".",
"toBe",
"(",
"true",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"find",
"(",
"'setInvalidValueBtn'",
")",
".",
"simulate",
"(",
"'click'",
")",
";",
"}",
")",
";",
"expect",
"(",
"nameFieldHook",
"?.",
"isValidating",
")",
".",
"toBe",
"(",
"false",
")",
";",
"expect",
"(",
"nameFieldHook",
"?.",
"isValid",
")",
".",
"toBe",
"(",
"false",
")",
";",
"expect",
"(",
"nameFieldHook",
"?.",
"getErrorsMessages",
"(",
")",
")",
".",
"toBe",
"(",
"'Invalid dynamic data'",
")",
";",
"}",
")",
";",
"test",
"(",
"'it should access dynamic data provided through props'",
",",
"async",
"(",
")",
"=>",
"{",
"let",
"{",
"form",
"}",
"=",
"setupDynamicData",
"(",
"{",
"validationData",
":",
"'good'",
"}",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"form",
".",
"setInputValue",
"(",
"'lastNameField'",
",",
"'newValue'",
")",
";",
"}",
")",
";",
"expect",
"(",
"lastNameFieldHook",
"?.",
"isValidating",
")",
".",
"toBe",
"(",
"false",
")",
";",
"expect",
"(",
"lastNameFieldHook",
"?.",
"isValid",
")",
".",
"toBe",
"(",
"true",
")",
";",
"(",
"{",
"form",
"}",
"=",
"setupDynamicData",
"(",
"{",
"validationData",
":",
"'bad'",
"}",
")",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"form",
".",
"setInputValue",
"(",
"'lastNameField'",
",",
"'newValue'",
")",
";",
"}",
")",
";",
"expect",
"(",
"lastNameFieldHook",
"?.",
"isValidating",
")",
".",
"toBe",
"(",
"false",
")",
";",
"expect",
"(",
"lastNameFieldHook",
"?.",
"isValid",
")",
".",
"toBe",
"(",
"false",
")",
";",
"expect",
"(",
"lastNameFieldHook",
"?.",
"getErrorsMessages",
"(",
")",
")",
".",
"toBe",
"(",
"'Invalid dynamic data: bad'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'serializer(), deserializer(), formatter()'",
",",
"(",
")",
"=>",
"{",
"interface",
"MyForm",
"{",
"name",
":",
"string",
";",
"}",
"const",
"serializer",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"const",
"deserializer",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"const",
"formatter",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"const",
"fieldConfig",
"=",
"{",
"defaultValue",
":",
"''",
",",
"serializer",
",",
"deserializer",
",",
"formatters",
":",
"[",
"formatter",
"]",
",",
"}",
";",
"let",
"formHook",
"=",
"null",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"formHook",
"=",
"null",
";",
"serializer",
".",
"mockReset",
"(",
")",
".",
"mockImplementation",
"(",
"(",
"value",
")",
"=>",
"`${",
"value",
"}-serialized`",
")",
";",
"deserializer",
".",
"mockReset",
"(",
")",
".",
"mockImplementation",
"(",
"(",
"value",
")",
"=>",
"`${",
"value",
"}-deserialized`",
")",
";",
"formatter",
".",
"mockReset",
"(",
")",
".",
"mockImplementation",
"(",
"(",
"value",
")",
"=>",
"value",
".",
"toUpperCase",
"(",
")",
")",
";",
"}",
")",
";",
"const",
"onFormHook",
"=",
"(",
"_form",
")",
"=>",
"{",
"formHook",
"=",
"_form",
";",
"}",
";",
"const",
"TestComp",
"=",
"(",
"{",
"onForm",
"}",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"<",
"MyForm",
">",
"(",
"{",
"defaultValue",
":",
"{",
"name",
":",
"'John'",
"}",
"}",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"onForm",
"(",
"form",
")",
";",
"}",
",",
"[",
"onForm",
",",
"form",
"]",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"name\"",
"config",
"=",
"{",
"fieldConfig",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"myField\"",
"/",
">",
"<",
"/Form>);",
"}",
";",
"test",
"(",
"'should call each handler at expected lifecycle'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"defaultProps",
":",
"{",
"onForm",
":",
"onFormHook",
"}",
",",
"}",
")",
";",
"const",
"testBed",
"=",
"setup",
"(",
")",
"as",
"TestBed",
";",
"if",
"(",
"!",
"formHook",
")",
"{",
"throw",
"new",
"Error",
"(",
"`formHook is not defined. Use the onForm() prop to update the reference to the form hook.`",
")",
";",
"}",
"const",
"{",
"form",
"}",
"=",
"testBed",
";",
"expect",
"(",
"deserializer",
")",
".",
"toBeCalled",
"(",
")",
";",
"expect",
"(",
"serializer",
")",
".",
"not",
".",
"toBeCalled",
"(",
")",
";",
"expect",
"(",
"formatter",
")",
".",
"not",
".",
"toBeCalled",
"(",
")",
";",
"const",
"internalFormData",
"=",
"formHook",
".",
"__getFormData$",
"(",
")",
".",
"value",
";",
"expect",
"(",
"internalFormData",
".",
"name",
")",
".",
"toEqual",
"(",
"'John-deserialized'",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"form",
".",
"setInputValue",
"(",
"'myField'",
",",
"'Mike'",
")",
";",
"}",
")",
";",
"expect",
"(",
"formatter",
")",
".",
"toBeCalled",
"(",
")",
";",
"expect",
"(",
"serializer",
")",
".",
"not",
".",
"toBeCalled",
"(",
")",
";",
"const",
"outputtedFormData",
"=",
"formHook",
".",
"getFormData",
"(",
")",
";",
"expect",
"(",
"serializer",
")",
".",
"toBeCalled",
"(",
")",
";",
"expect",
"(",
"outputtedFormData",
".",
"name",
")",
".",
"toEqual",
"(",
"'MIKE-serialized'",
")",
";",
"serializer",
".",
"mockReset",
"(",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"formHook",
"!",
".",
"reset",
"(",
")",
";",
"}",
")",
";",
"expect",
"(",
"serializer",
")",
".",
"not",
".",
"toBeCalled",
"(",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'custom components'",
",",
"(",
")",
"=>",
"{",
"interface",
"MyForm",
"{",
"name",
":",
"string",
";",
"}",
"let",
"formHook",
"=",
"null",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"formHook",
"=",
"null",
";",
"}",
")",
";",
"const",
"onFormHook",
"=",
"(",
"_form",
")",
"=>",
"{",
"formHook",
"=",
"_form",
";",
"}",
";",
"const",
"TestComp",
"=",
"(",
"{",
"component",
",",
"onForm",
",",
"}",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"<",
"MyForm",
">",
"(",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"onForm",
"(",
"form",
")",
";",
"}",
",",
"[",
"onForm",
",",
"form",
"]",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"name\"",
"defaultValue",
"=",
"\"myName\"",
"component",
"=",
"{",
"component",
"}",
"/",
">",
"<",
"/Form>);",
"}",
";",
"it",
"(",
"'allows function components'",
",",
"(",
")",
"=>",
"{",
"const",
"Component",
"=",
"(",
")",
"=>",
"<",
"textarea",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"function-component\"",
"/",
">",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"defaultProps",
":",
"{",
"onForm",
":",
"onFormHook",
",",
"component",
":",
"Component",
"}",
",",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"const",
"testBed",
"=",
"setup",
"(",
")",
"as",
"TestBed",
";",
"expect",
"(",
"testBed",
".",
"exists",
"(",
"'function-component'",
")",
")",
".",
"toEqual",
"(",
"true",
")",
";",
"expect",
"(",
"formHook",
"?.",
"getFormData",
"(",
")",
")",
".",
"toEqual",
"(",
"{",
"name",
":",
"'myName'",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'allows memoized function components'",
",",
"(",
")",
"=>",
"{",
"const",
"Component",
"=",
"React",
".",
"memo",
"(",
"(",
")",
"=>",
"<",
"textarea",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"memoized-component\"",
"/",
">",
")",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"defaultProps",
":",
"{",
"onForm",
":",
"onFormHook",
",",
"component",
":",
"Component",
"}",
",",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"const",
"testBed",
"=",
"setup",
"(",
")",
"as",
"TestBed",
";",
"expect",
"(",
"testBed",
".",
"exists",
"(",
"'memoized-component'",
")",
")",
".",
"toEqual",
"(",
"true",
")",
";",
"expect",
"(",
"formHook",
"?.",
"getFormData",
"(",
")",
")",
".",
"toEqual",
"(",
"{",
"name",
":",
"'myName'",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'change handlers'",
",",
"(",
")",
"=>",
"{",
"const",
"onError",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"jest",
".",
"resetAllMocks",
"(",
")",
";",
"}",
")",
";",
"const",
"getTestComp",
"=",
"(",
"fieldConfig",
")",
"=>",
"{",
"const",
"TestComp",
"=",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"<",
"any",
">",
"(",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"name\"",
"config",
"=",
"{",
"fieldConfig",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"myField\"",
"onError",
"=",
"{",
"onError",
"}",
"/",
">",
"<",
"/Form>);",
"}",
";",
"return",
"TestComp",
";",
"}",
";",
"const",
"setup",
"=",
"(",
"fieldConfig",
")",
"=>",
"{",
"return",
"registerTestBed",
"(",
"getTestComp",
"(",
"fieldConfig",
")",
",",
"{",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
"(",
")",
"as",
"TestBed",
";",
"}",
";",
"it",
"(",
"'calls onError when validation state changes'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"setup",
"(",
"{",
"validations",
":",
"[",
"{",
"validator",
":",
"(",
"{",
"value",
"}",
")",
"=>",
"(",
"value",
"===",
"'1'",
"?",
"undefined",
":",
"{",
"message",
":",
"'oops!'",
"}",
")",
",",
"}",
",",
"]",
",",
"}",
")",
";",
"expect",
"(",
"onError",
")",
".",
"toBeCalledTimes",
"(",
"0",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'myField'",
",",
"'0'",
")",
";",
"}",
")",
";",
"expect",
"(",
"onError",
")",
".",
"toBeCalledTimes",
"(",
"1",
")",
";",
"expect",
"(",
"onError",
")",
".",
"toBeCalledWith",
"(",
"[",
"'oops!'",
"]",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'myField'",
",",
"'1'",
")",
";",
"}",
")",
";",
"expect",
"(",
"onError",
")",
".",
"toBeCalledTimes",
"(",
"2",
")",
";",
"expect",
"(",
"onError",
")",
".",
"toBeCalledWith",
"(",
"null",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
785 | [
"import",
"{",
"act",
"}",
"from",
"'react-dom/test-utils'",
";",
"import",
"{",
"registerTestBed",
"}",
"from",
"'../shared_imports'",
";",
"import",
"{",
"Form",
",",
"UseField",
"}",
"from",
"'../components'",
";",
"import",
"React",
"from",
"'react'",
";",
"import",
"{",
"useForm",
"}",
"from",
"'.'",
";",
"import",
"{",
"emptyField",
"}",
"from",
"'../../helpers/field_validators'",
";",
"import",
"{",
"FieldHook",
",",
"FieldValidateResponse",
",",
"VALIDATION_TYPES",
"}",
"from",
"'..'",
";",
"describe",
"(",
"'useField() hook'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'field.validate()'",
",",
"(",
")",
"=>",
"{",
"const",
"EMPTY_VALUE",
"=",
"' '",
";",
"test",
"(",
"'It should not invalidate a field with arrayItem validation when isBlocking is false'",
",",
"async",
"(",
")",
"=>",
"{",
"let",
"fieldHook",
";",
"const",
"TestField",
"=",
"(",
"{",
"field",
"}",
")",
"=>",
"{",
"fieldHook",
"=",
"field",
";",
"return",
"null",
";",
"}",
";",
"const",
"TestForm",
"=",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"test-path\"",
"component",
"=",
"{",
"TestField",
"}",
"config",
"=",
"{",
"{",
"validations",
":",
"[",
"{",
"validator",
":",
"emptyField",
"(",
"'error-message'",
")",
",",
"type",
":",
"VALIDATION_TYPES",
".",
"ARRAY_ITEM",
",",
"isBlocking",
":",
"false",
",",
"}",
",",
"]",
",",
"}",
"}",
"/>",
"<",
"/Form>);",
"}",
";",
"registerTestBed",
"(",
"TestForm",
")",
"(",
")",
";",
"let",
"validateResponse",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"validateResponse",
"=",
"await",
"fieldHook",
"!",
".",
"validate",
"(",
"{",
"value",
":",
"EMPTY_VALUE",
",",
"validationType",
":",
"VALIDATION_TYPES",
".",
"ARRAY_ITEM",
",",
"}",
")",
";",
"}",
")",
";",
"expect",
"(",
"validateResponse",
"!",
")",
".",
"toEqual",
"(",
"{",
"isValid",
":",
"false",
",",
"errors",
":",
"[",
"{",
"code",
":",
"'ERR_FIELD_MISSING'",
",",
"path",
":",
"'test-path'",
",",
"message",
":",
"'error-message'",
",",
"__isBlocking__",
":",
"false",
",",
"validationType",
":",
"'arrayItem'",
",",
"}",
",",
"]",
",",
"}",
")",
";",
"expect",
"(",
"fieldHook",
"!",
".",
"isValid",
")",
".",
"toBe",
"(",
"true",
")",
";",
"}",
")",
";",
"test",
"(",
"'It should invalidate an arrayItem field when isBlocking is true'",
",",
"async",
"(",
")",
"=>",
"{",
"let",
"fieldHook",
";",
"const",
"TestField",
"=",
"(",
"{",
"field",
"}",
")",
"=>",
"{",
"fieldHook",
"=",
"field",
";",
"return",
"null",
";",
"}",
";",
"const",
"TestForm",
"=",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"test-path\"",
"component",
"=",
"{",
"TestField",
"}",
"config",
"=",
"{",
"{",
"validations",
":",
"[",
"{",
"validator",
":",
"emptyField",
"(",
"'error-message'",
")",
",",
"type",
":",
"VALIDATION_TYPES",
".",
"ARRAY_ITEM",
",",
"isBlocking",
":",
"true",
",",
"}",
",",
"]",
",",
"}",
"}",
"/>",
"<",
"/Form>);",
"}",
";",
"registerTestBed",
"(",
"TestForm",
")",
"(",
")",
";",
"let",
"validateResponse",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"validateResponse",
"=",
"await",
"fieldHook",
"!",
".",
"validate",
"(",
"{",
"value",
":",
"EMPTY_VALUE",
",",
"validationType",
":",
"VALIDATION_TYPES",
".",
"ARRAY_ITEM",
",",
"}",
")",
";",
"}",
")",
";",
"expect",
"(",
"validateResponse",
"!",
")",
".",
"toEqual",
"(",
"{",
"isValid",
":",
"false",
",",
"errors",
":",
"[",
"{",
"code",
":",
"'ERR_FIELD_MISSING'",
",",
"path",
":",
"'test-path'",
",",
"message",
":",
"'error-message'",
",",
"__isBlocking__",
":",
"true",
",",
"validationType",
":",
"'arrayItem'",
",",
"}",
",",
"]",
",",
"}",
")",
";",
"expect",
"(",
"fieldHook",
"!",
".",
"isValid",
")",
".",
"toBe",
"(",
"false",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
21735,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
786 | [
"import",
"React",
",",
"{",
"useEffect",
"}",
"from",
"'react'",
";",
"import",
"{",
"act",
"}",
"from",
"'react-dom/test-utils'",
";",
"import",
"{",
"registerTestBed",
",",
"getRandomString",
",",
"TestBed",
"}",
"from",
"'../shared_imports'",
";",
"import",
"{",
"emptyField",
"}",
"from",
"'../../helpers/field_validators'",
";",
"import",
"{",
"Form",
",",
"UseField",
"}",
"from",
"'../components'",
";",
"import",
"{",
"FormSubmitHandler",
",",
"OnUpdateHandler",
",",
"FormHook",
",",
"ValidationFunc",
",",
"FieldConfig",
",",
"VALIDATION_TYPES",
",",
"}",
"from",
"'..'",
";",
"import",
"{",
"useForm",
"}",
"from",
"'./use_form'",
";",
"interface",
"MyForm",
"{",
"username",
":",
"string",
";",
"}",
"interface",
"Props",
"{",
"onData",
":",
"FormSubmitHandler",
"<",
"MyForm",
">",
";",
"}",
"let",
"formHook",
"=",
"null",
";",
"const",
"onFormHook",
"=",
"(",
"_form",
")",
"=>",
"{",
"formHook",
"=",
"_form",
";",
"}",
";",
"describe",
"(",
"'useForm() hook'",
",",
"(",
")",
"=>",
"{",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"formHook",
"=",
"null",
";",
"}",
")",
";",
"describe",
"(",
"'form.submit() & config.onSubmit()'",
",",
"(",
")",
"=>",
"{",
"const",
"onFormData",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"afterEach",
"(",
"(",
")",
"=>",
"{",
"onFormData",
".",
"mockReset",
"(",
")",
";",
"}",
")",
";",
"test",
"(",
"'should receive the form data and the validity of the form'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"TestComp",
"=",
"(",
"{",
"onData",
"}",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"<",
"MyForm",
">",
"(",
"{",
"onSubmit",
":",
"onData",
"}",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"username\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"usernameField\"",
"/",
">",
"<",
"button",
"type",
"=",
"\"button\"",
"onClick",
"=",
"{",
"form",
".",
"submit",
"}",
"/",
">",
"<",
"/Form>);",
"}",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"defaultProps",
":",
"{",
"onData",
":",
"onFormData",
"}",
",",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"const",
"{",
"component",
",",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"setup",
"(",
")",
"as",
"TestBed",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'usernameField'",
",",
"'John'",
")",
";",
"component",
".",
"find",
"(",
"'button'",
")",
".",
"simulate",
"(",
"'click'",
")",
";",
"}",
")",
";",
"const",
"[",
"formData",
",",
"isValid",
"]",
"=",
"onFormData",
".",
"mock",
".",
"calls",
"[",
"onFormData",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
";",
"expect",
"(",
"formData",
")",
".",
"toEqual",
"(",
"{",
"username",
":",
"'John'",
"}",
")",
";",
"expect",
"(",
"isValid",
")",
".",
"toBe",
"(",
"true",
")",
";",
"}",
")",
";",
"test",
"(",
"'should build complex data object'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"TestComp",
"=",
"(",
"{",
"onData",
"}",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"<",
"MyForm",
">",
"(",
"{",
"onSubmit",
":",
"onData",
"}",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"address.country.code\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"countryCodeField\"",
"/",
">",
"<",
"UseField",
"path",
"=",
"\"address.notes[0]\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"addressNote1Field\"",
"/",
">",
"<",
"UseField",
"path",
"=",
"\"tags[0]\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"tagField1\"",
"/",
">",
"<",
"UseField",
"path",
"=",
"\"tags[1]\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"tagField2\"",
"/",
">",
"<",
"button",
"type",
"=",
"\"button\"",
"onClick",
"=",
"{",
"form",
".",
"submit",
"}",
"/",
">",
"<",
"/Form>);",
"}",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"defaultProps",
":",
"{",
"onData",
":",
"onFormData",
"}",
",",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"const",
"{",
"component",
",",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"setup",
"(",
")",
"as",
"TestBed",
";",
"const",
"expectedData",
"=",
"{",
"address",
":",
"{",
"country",
":",
"{",
"code",
":",
"'BE'",
",",
"}",
",",
"notes",
":",
"[",
"'Some description.'",
"]",
",",
"}",
",",
"tags",
":",
"[",
"'Belgium'",
",",
"'Europe'",
"]",
",",
"}",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'countryCodeField'",
",",
"expectedData",
".",
"address",
".",
"country",
".",
"code",
")",
";",
"setInputValue",
"(",
"'addressNote1Field'",
",",
"expectedData",
".",
"address",
".",
"notes",
"[",
"0",
"]",
")",
";",
"setInputValue",
"(",
"'tagField1'",
",",
"expectedData",
".",
"tags",
"[",
"0",
"]",
")",
";",
"setInputValue",
"(",
"'tagField2'",
",",
"expectedData",
".",
"tags",
"[",
"1",
"]",
")",
";",
"component",
".",
"find",
"(",
"'button'",
")",
".",
"simulate",
"(",
"'click'",
")",
";",
"}",
")",
";",
"const",
"[",
"formData",
"]",
"=",
"onFormData",
".",
"mock",
".",
"calls",
"[",
"onFormData",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
";",
"expect",
"(",
"formData",
")",
".",
"toEqual",
"(",
"expectedData",
")",
";",
"}",
")",
";",
"test",
"(",
"'should not build the object if the form is not valid'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"TestComp",
"=",
"(",
"{",
"onForm",
"}",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"<",
"MyForm",
">",
"(",
"{",
"defaultValue",
":",
"{",
"username",
":",
"'initialValue'",
"}",
"}",
")",
";",
"const",
"validator",
"=",
"(",
"{",
"value",
"}",
")",
"=>",
"{",
"if",
"(",
"value",
"===",
"'wrongValue'",
")",
"{",
"return",
"{",
"message",
":",
"'Error on the field'",
"}",
";",
"}",
"}",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"onForm",
"(",
"form",
")",
";",
"}",
",",
"[",
"onForm",
",",
"form",
"]",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"username\"",
"config",
"=",
"{",
"{",
"validations",
":",
"[",
"{",
"validator",
"}",
"]",
"}",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"myField\"",
"/",
">",
"<",
"/Form>);",
"}",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"defaultProps",
":",
"{",
"onForm",
":",
"onFormHook",
"}",
",",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"setup",
"(",
")",
"as",
"TestBed",
";",
"if",
"(",
"!",
"formHook",
")",
"{",
"throw",
"new",
"Error",
"(",
"`formHook is not defined. Use the onForm() prop to update the reference to the form hook.`",
")",
";",
"}",
"let",
"data",
";",
"let",
"isValid",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"(",
"{",
"data",
",",
"isValid",
"}",
"=",
"await",
"formHook",
"!",
".",
"submit",
"(",
")",
")",
";",
"}",
")",
";",
"expect",
"(",
"isValid",
")",
".",
"toBe",
"(",
"true",
")",
";",
"expect",
"(",
"data",
")",
".",
"toEqual",
"(",
"{",
"username",
":",
"'initialValue'",
"}",
")",
";",
"setInputValue",
"(",
"'myField'",
",",
"'wrongValue'",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"(",
"{",
"data",
",",
"isValid",
"}",
"=",
"await",
"formHook",
"!",
".",
"submit",
"(",
")",
")",
";",
"}",
")",
";",
"expect",
"(",
"isValid",
")",
".",
"toBe",
"(",
"false",
")",
";",
"expect",
"(",
"data",
")",
".",
"toEqual",
"(",
"{",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'form.subscribe()'",
",",
"(",
")",
"=>",
"{",
"const",
"onFormData",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"afterEach",
"(",
"(",
")",
"=>",
"{",
"onFormData",
".",
"mockReset",
"(",
")",
";",
"}",
")",
";",
"test",
"(",
"'should allow subscribing to the form data changes and provide a handler to build the form data'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"TestComp",
"=",
"(",
"{",
"onData",
"}",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
"{",
"serializer",
":",
"(",
"value",
")",
"=>",
"(",
"{",
"user",
":",
"{",
"name",
":",
"value",
".",
"user",
".",
"name",
".",
"toUpperCase",
"(",
")",
",",
"}",
",",
"}",
")",
",",
"}",
")",
";",
"const",
"{",
"subscribe",
"}",
"=",
"form",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"const",
"subscription",
"=",
"subscribe",
"(",
"onData",
")",
";",
"return",
"subscription",
".",
"unsubscribe",
";",
"}",
",",
"[",
"subscribe",
",",
"onData",
"]",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"user.name\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"usernameField\"",
"/",
">",
"<",
"/Form>);",
"}",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"defaultProps",
":",
"{",
"onData",
":",
"onFormData",
"}",
",",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"setup",
"(",
")",
"as",
"TestBed",
";",
"let",
"[",
"{",
"data",
",",
"isValid",
"}",
"]",
"=",
"onFormData",
".",
"mock",
".",
"calls",
"[",
"onFormData",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
"as",
"Parameters",
"<",
"OnUpdateHandler",
">",
";",
"expect",
"(",
"isValid",
")",
".",
"toBeUndefined",
"(",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'usernameField'",
",",
"'John'",
")",
";",
"}",
")",
";",
"[",
"{",
"data",
",",
"isValid",
"}",
"]",
"=",
"onFormData",
".",
"mock",
".",
"calls",
"[",
"onFormData",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
"as",
"Parameters",
"<",
"OnUpdateHandler",
">",
";",
"expect",
"(",
"data",
".",
"internal",
")",
".",
"toEqual",
"(",
"{",
"user",
":",
"{",
"name",
":",
"'John'",
"}",
"}",
")",
";",
"expect",
"(",
"data",
".",
"format",
"(",
")",
")",
".",
"toEqual",
"(",
"{",
"user",
":",
"{",
"name",
":",
"'JOHN'",
"}",
"}",
")",
";",
"expect",
"(",
"isValid",
")",
".",
"toBe",
"(",
"true",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'config.defaultValue'",
",",
"(",
")",
"=>",
"{",
"const",
"onFormData",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"afterEach",
"(",
"(",
")",
"=>",
"{",
"onFormData",
".",
"mockReset",
"(",
")",
";",
"}",
")",
";",
"test",
"(",
"'should set the default value of a field '",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"defaultValue",
"=",
"{",
"title",
":",
"getRandomString",
"(",
")",
",",
"subTitle",
":",
"getRandomString",
"(",
")",
",",
"user",
":",
"{",
"name",
":",
"getRandomString",
"(",
")",
"}",
",",
"unknown",
":",
"'Should be stripped'",
",",
"}",
";",
"const",
"TestComp",
"=",
"(",
"{",
"onData",
"}",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
"{",
"defaultValue",
"}",
")",
";",
"const",
"{",
"subscribe",
"}",
"=",
"form",
";",
"useEffect",
"(",
"(",
")",
"=>",
"subscribe",
"(",
"onData",
")",
".",
"unsubscribe",
",",
"[",
"subscribe",
",",
"onData",
"]",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"user.name\"",
"/",
">",
"<",
"UseField",
"path",
"=",
"\"title\"",
"/",
">",
"<",
"UseField",
"path",
"=",
"\"subTitle\"",
"defaultValue",
"=",
"\"hasBeenOverridden\"",
"/",
">",
"<",
"/Form>);",
"}",
";",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"defaultProps",
":",
"{",
"onData",
":",
"onFormData",
"}",
",",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
"(",
")",
";",
"expect",
"(",
"onFormData",
".",
"mock",
".",
"calls",
".",
"length",
")",
".",
"toBe",
"(",
"1",
")",
";",
"const",
"[",
"{",
"data",
"}",
"]",
"=",
"onFormData",
".",
"mock",
".",
"calls",
"[",
"onFormData",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
"as",
"Parameters",
"<",
"OnUpdateHandler",
">",
";",
"expect",
"(",
"data",
".",
"internal",
")",
".",
"toEqual",
"(",
"{",
"title",
":",
"defaultValue",
".",
"title",
",",
"subTitle",
":",
"'hasBeenOverridden'",
",",
"user",
":",
"{",
"name",
":",
"defaultValue",
".",
"user",
".",
"name",
",",
"}",
",",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'form.reset()'",
",",
"(",
")",
"=>",
"{",
"const",
"defaultValue",
"=",
"{",
"username",
":",
"'defaultValue'",
",",
"deeply",
":",
"{",
"nested",
":",
"{",
"value",
":",
"'defaultValue'",
"}",
"}",
",",
"}",
";",
"type",
"RestFormTest",
"=",
"typeof",
"defaultValue",
";",
"const",
"TestComp",
"=",
"(",
"{",
"onForm",
"}",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"<",
"RestFormTest",
">",
"(",
"{",
"defaultValue",
",",
"options",
":",
"{",
"stripEmptyFields",
":",
"false",
"}",
",",
"}",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"onForm",
"(",
"form",
")",
";",
"}",
",",
"[",
"onForm",
",",
"form",
"]",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"username\"",
"config",
"=",
"{",
"{",
"defaultValue",
":",
"'configDefaultValue'",
"}",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"userNameField\"",
"/",
">",
"<",
"UseField",
"path",
"=",
"\"city\"",
"config",
"=",
"{",
"{",
"defaultValue",
":",
"'configDefaultValue'",
"}",
"}",
"defaultValue",
"=",
"\"inlineDefaultValue\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"cityField\"",
"/",
">",
"<",
"UseField",
"path",
"=",
"\"deeply.nested.value\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"deeplyNestedField\"",
"/",
">",
"<",
"/Form>);",
"}",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"defaultProps",
":",
"{",
"onForm",
":",
"onFormHook",
"}",
",",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"test",
"(",
"'should put back the defaultValue for each field'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"setup",
"(",
")",
"as",
"TestBed",
";",
"if",
"(",
"!",
"formHook",
")",
"{",
"throw",
"new",
"Error",
"(",
"`formHook is not defined. Use the onForm() prop to update the reference to the form hook.`",
")",
";",
"}",
"let",
"formData",
"=",
"{",
"}",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"formData",
"=",
"formHook",
"!",
".",
"getFormData",
"(",
")",
";",
"}",
")",
";",
"expect",
"(",
"formData",
")",
".",
"toEqual",
"(",
"{",
"username",
":",
"'defaultValue'",
",",
"city",
":",
"'inlineDefaultValue'",
",",
"deeply",
":",
"{",
"nested",
":",
"{",
"value",
":",
"'defaultValue'",
"}",
"}",
",",
"}",
")",
";",
"setInputValue",
"(",
"'userNameField'",
",",
"'changedValue'",
")",
";",
"setInputValue",
"(",
"'cityField'",
",",
"'changedValue'",
")",
";",
"setInputValue",
"(",
"'deeplyNestedField'",
",",
"'changedValue'",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"formData",
"=",
"formHook",
"!",
".",
"getFormData",
"(",
")",
";",
"}",
")",
";",
"expect",
"(",
"formData",
")",
".",
"toEqual",
"(",
"{",
"username",
":",
"'changedValue'",
",",
"city",
":",
"'changedValue'",
",",
"deeply",
":",
"{",
"nested",
":",
"{",
"value",
":",
"'changedValue'",
"}",
"}",
",",
"}",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"formHook",
"!",
".",
"reset",
"(",
")",
";",
"}",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"formData",
"=",
"formHook",
"!",
".",
"getFormData",
"(",
")",
";",
"}",
")",
";",
"expect",
"(",
"formData",
")",
".",
"toEqual",
"(",
"{",
"username",
":",
"'defaultValue'",
",",
"city",
":",
"'inlineDefaultValue'",
",",
"deeply",
":",
"{",
"nested",
":",
"{",
"value",
":",
"'defaultValue'",
"}",
"}",
",",
"}",
")",
";",
"}",
")",
";",
"test",
"(",
"'should allow to pass a new \"defaultValue\" object for the fields'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"setup",
"(",
")",
"as",
"TestBed",
";",
"if",
"(",
"!",
"formHook",
")",
"{",
"throw",
"new",
"Error",
"(",
"`formHook is not defined. Use the onForm() prop to update the reference to the form hook.`",
")",
";",
"}",
"setInputValue",
"(",
"'userNameField'",
",",
"'changedValue'",
")",
";",
"setInputValue",
"(",
"'cityField'",
",",
"'changedValue'",
")",
";",
"setInputValue",
"(",
"'deeplyNestedField'",
",",
"'changedValue'",
")",
";",
"let",
"formData",
"=",
"{",
"}",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"formHook",
"!",
".",
"reset",
"(",
"{",
"defaultValue",
":",
"{",
"city",
":",
"(",
")",
"=>",
"'newDefaultValue'",
",",
"deeply",
":",
"{",
"nested",
":",
"{",
"value",
":",
"'newDefaultValue'",
"}",
"}",
",",
"}",
",",
"}",
")",
";",
"}",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"formData",
"=",
"formHook",
"!",
".",
"getFormData",
"(",
")",
";",
"}",
")",
";",
"expect",
"(",
"formData",
")",
".",
"toEqual",
"(",
"{",
"username",
":",
"'configDefaultValue'",
",",
"city",
":",
"'newDefaultValue'",
",",
"deeply",
":",
"{",
"nested",
":",
"{",
"value",
":",
"'newDefaultValue'",
"}",
"}",
",",
"}",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"formHook",
"!",
".",
"reset",
"(",
"{",
"defaultValue",
":",
"{",
"}",
",",
"}",
")",
";",
"}",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"formData",
"=",
"formHook",
"!",
".",
"getFormData",
"(",
")",
";",
"}",
")",
";",
"expect",
"(",
"formData",
")",
".",
"toEqual",
"(",
"{",
"username",
":",
"'configDefaultValue'",
",",
"city",
":",
"'configDefaultValue'",
",",
"deeply",
":",
"{",
"nested",
":",
"{",
"value",
":",
"''",
"}",
"}",
",",
"}",
")",
";",
"}",
")",
";",
"test",
"(",
"'should not validate the fields after resetting its value (form validity should be undefined)'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"fieldConfig",
"=",
"{",
"defaultValue",
":",
"''",
",",
"validations",
":",
"[",
"{",
"validator",
":",
"(",
"{",
"value",
"}",
")",
"=>",
"{",
"if",
"(",
"(",
"value",
"as",
"string",
")",
".",
"trim",
"(",
")",
"===",
"''",
")",
"{",
"return",
"{",
"message",
":",
"'Error: empty string'",
"}",
";",
"}",
"}",
",",
"}",
",",
"]",
",",
"}",
";",
"const",
"TestResetComp",
"=",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"formHook",
"=",
"form",
";",
"}",
",",
"[",
"form",
"]",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"username\"",
"config",
"=",
"{",
"fieldConfig",
"}",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"myField\"",
"/",
">",
"<",
"/Form>);",
"}",
";",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"registerTestBed",
"(",
"TestResetComp",
",",
"{",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
"(",
")",
"as",
"TestBed",
";",
"let",
"{",
"isValid",
"}",
"=",
"formHook",
"!",
";",
"expect",
"(",
"isValid",
")",
".",
"toBeUndefined",
"(",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'myField'",
",",
"'changedValue'",
")",
";",
"}",
")",
";",
"(",
"{",
"isValid",
"}",
"=",
"formHook",
"!",
")",
";",
"expect",
"(",
"isValid",
")",
".",
"toBe",
"(",
"true",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"formHook",
"!",
".",
"reset",
"(",
")",
";",
"}",
")",
";",
"(",
"{",
"isValid",
"}",
"=",
"formHook",
"!",
")",
";",
"expect",
"(",
"isValid",
")",
".",
"toBeUndefined",
"(",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'form.validate()'",
",",
"(",
")",
"=>",
"{",
"test",
"(",
"'should not invalidate a field with arrayItem validation when validating a form'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"TestComp",
"=",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
")",
";",
"formHook",
"=",
"form",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"test-path\"",
"config",
"=",
"{",
"{",
"validations",
":",
"[",
"{",
"validator",
":",
"emptyField",
"(",
"'error-message'",
")",
",",
"type",
":",
"VALIDATION_TYPES",
".",
"ARRAY_ITEM",
",",
"isBlocking",
":",
"false",
",",
"}",
",",
"]",
",",
"}",
"}",
"/>",
"<",
"/Form>);",
"}",
";",
"registerTestBed",
"(",
"TestComp",
")",
"(",
")",
";",
"let",
"isValid",
"=",
"false",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"isValid",
"=",
"await",
"formHook",
"!",
".",
"validate",
"(",
")",
";",
"}",
")",
";",
"expect",
"(",
"isValid",
")",
".",
"toBe",
"(",
"true",
")",
";",
"}",
")",
";",
"test",
"(",
"'should invalidate a field with a blocking arrayItem validation when validating a form'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"TestComp",
"=",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
")",
";",
"formHook",
"=",
"form",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"test-path\"",
"config",
"=",
"{",
"{",
"validations",
":",
"[",
"{",
"validator",
":",
"emptyField",
"(",
"'error-message'",
")",
",",
"type",
":",
"VALIDATION_TYPES",
".",
"ARRAY_ITEM",
",",
"isBlocking",
":",
"true",
",",
"}",
",",
"]",
",",
"}",
"}",
"/>",
"<",
"/Form>);",
"}",
";",
"registerTestBed",
"(",
"TestComp",
")",
"(",
")",
";",
"let",
"isValid",
"=",
"false",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"isValid",
"=",
"await",
"formHook",
"!",
".",
"validate",
"(",
")",
";",
"}",
")",
";",
"expect",
"(",
"isValid",
")",
".",
"toBe",
"(",
"false",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'form.getErrors()'",
",",
"(",
")",
"=>",
"{",
"test",
"(",
"'should return the errors in the form'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"TestComp",
"=",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
")",
";",
"formHook",
"=",
"form",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"field1\"",
"config",
"=",
"{",
"{",
"validations",
":",
"[",
"{",
"validator",
":",
"emptyField",
"(",
"'Field1 can not be empty'",
")",
",",
"}",
",",
"]",
",",
"}",
"}",
"/>",
"<",
"UseField",
"path",
"=",
"\"field2\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"field2\"",
"config",
"=",
"{",
"{",
"validations",
":",
"[",
"{",
"validator",
":",
"(",
"{",
"value",
"}",
")",
"=>",
"{",
"if",
"(",
"value",
"===",
"'bad'",
")",
"{",
"return",
"{",
"message",
":",
"'Field2 is invalid'",
",",
"}",
";",
"}",
"}",
",",
"}",
",",
"]",
",",
"}",
"}",
"/>",
"<",
"/Form>);",
"}",
";",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"registerTestBed",
"(",
"TestComp",
")",
"(",
")",
"as",
"TestBed",
";",
"let",
"errors",
"=",
"formHook",
"!",
".",
"getErrors",
"(",
")",
";",
"expect",
"(",
"errors",
")",
".",
"toEqual",
"(",
"[",
"]",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"await",
"formHook",
"!",
".",
"submit",
"(",
")",
";",
"}",
")",
";",
"errors",
"=",
"formHook",
"!",
".",
"getErrors",
"(",
")",
";",
"expect",
"(",
"errors",
")",
".",
"toEqual",
"(",
"[",
"'Field1 can not be empty'",
"]",
")",
";",
"await",
"setInputValue",
"(",
"'field2'",
",",
"'bad'",
")",
";",
"errors",
"=",
"formHook",
"!",
".",
"getErrors",
"(",
")",
";",
"expect",
"(",
"errors",
")",
".",
"toEqual",
"(",
"[",
"'Field1 can not be empty'",
",",
"'Field2 is invalid'",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
18792,
null,
null,
null,
null,
4,
null,
null,
18792,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
787 | [
"import",
"React",
",",
"{",
"useEffect",
",",
"useRef",
"}",
"from",
"'react'",
";",
"import",
"{",
"act",
"}",
"from",
"'react-dom/test-utils'",
";",
"import",
"{",
"registerTestBed",
",",
"TestBed",
"}",
"from",
"'../shared_imports'",
";",
"import",
"{",
"Form",
",",
"UseField",
"}",
"from",
"'../components'",
";",
"import",
"{",
"useForm",
"}",
"from",
"'./use_form'",
";",
"import",
"{",
"useFormData",
",",
"HookReturn",
"}",
"from",
"'./use_form_data'",
";",
"interface",
"Props",
"<",
"T",
"extends",
"object",
">",
"{",
"onHookValueChange",
"(",
"data",
")",
":",
"void",
";",
"watch",
"?",
":",
"string",
"|",
"string",
"[",
"]",
";",
"}",
"interface",
"Form1",
"{",
"title",
":",
"string",
";",
"}",
"interface",
"Form2",
"{",
"user",
":",
"{",
"firstName",
":",
"string",
";",
"lastName",
":",
"string",
";",
"}",
";",
"}",
"interface",
"Form3",
"{",
"title",
":",
"string",
";",
"subTitle",
":",
"string",
";",
"}",
"describe",
"(",
"'useFormData() hook'",
",",
"(",
")",
"=>",
"{",
"const",
"HookListenerComp",
"=",
"function",
"<",
"T",
"extends",
"object",
">",
"(",
"{",
"onHookValueChange",
",",
"watch",
"}",
")",
"{",
"const",
"hookValue",
"=",
"useFormData",
"<",
"T",
">",
"(",
"{",
"watch",
"}",
")",
";",
"const",
"isMounted",
"=",
"useRef",
"(",
"false",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"if",
"(",
"isMounted",
".",
"current",
")",
"{",
"onHookValueChange",
"(",
"hookValue",
")",
";",
"}",
"isMounted",
".",
"current",
"=",
"true",
";",
"}",
",",
"[",
"hookValue",
",",
"onHookValueChange",
"]",
")",
";",
"return",
"null",
";",
"}",
";",
"const",
"HookListener",
"=",
"React",
".",
"memo",
"(",
"HookListenerComp",
")",
";",
"describe",
"(",
"'form data updates'",
",",
"(",
")",
"=>",
"{",
"let",
"testBed",
";",
"let",
"onChangeSpy",
";",
"const",
"getLastMockValue",
"=",
"(",
")",
"=>",
"{",
"return",
"onChangeSpy",
".",
"mock",
".",
"calls",
"[",
"onChangeSpy",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
"[",
"0",
"]",
"as",
"HookReturn",
"<",
"Form1",
">",
";",
"}",
";",
"const",
"TestComp",
"=",
"(",
"props",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"<",
"Form1",
">",
"(",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"title\"",
"defaultValue",
"=",
"\"titleInitialValue\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"titleField\"",
"/",
">",
"<",
"HookListener",
"{",
"...",
"props",
"}",
"/",
">",
"<",
"/Form>);",
"}",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"onChangeSpy",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"testBed",
"=",
"setup",
"(",
"{",
"onHookValueChange",
":",
"onChangeSpy",
"}",
")",
"as",
"TestBed",
";",
"}",
")",
";",
"test",
"(",
"'should return the form data'",
",",
"(",
")",
"=>",
"{",
"expect",
"(",
"onChangeSpy",
")",
".",
"toBeCalledTimes",
"(",
"1",
")",
";",
"const",
"[",
"data",
"]",
"=",
"getLastMockValue",
"(",
")",
";",
"expect",
"(",
"data",
")",
".",
"toEqual",
"(",
"{",
"title",
":",
"'titleInitialValue'",
"}",
")",
";",
"}",
")",
";",
"test",
"(",
"'should listen to field changes'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"testBed",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'titleField'",
",",
"'titleChanged'",
")",
";",
"}",
")",
";",
"expect",
"(",
"onChangeSpy",
")",
".",
"toBeCalledTimes",
"(",
"2",
")",
";",
"const",
"[",
"data",
"]",
"=",
"getLastMockValue",
"(",
")",
";",
"expect",
"(",
"data",
")",
".",
"toEqual",
"(",
"{",
"title",
":",
"'titleChanged'",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'format form data'",
",",
"(",
")",
"=>",
"{",
"let",
"onChangeSpy",
";",
"const",
"getLastMockValue",
"=",
"(",
")",
"=>",
"{",
"return",
"onChangeSpy",
".",
"mock",
".",
"calls",
"[",
"onChangeSpy",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
"[",
"0",
"]",
"as",
"HookReturn",
"<",
"Form2",
">",
";",
"}",
";",
"const",
"TestComp",
"=",
"(",
"props",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"<",
"Form2",
">",
"(",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"user.firstName\"",
"defaultValue",
"=",
"\"John\"",
"/",
">",
"<",
"UseField",
"path",
"=",
"\"user.lastName\"",
"defaultValue",
"=",
"\"Snow\"",
"/",
">",
"<",
"HookListener",
"{",
"...",
"props",
"}",
"/",
">",
"<",
"/Form>);",
"}",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"onChangeSpy",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"setup",
"(",
"{",
"onHookValueChange",
":",
"onChangeSpy",
"}",
")",
";",
"}",
")",
";",
"test",
"(",
"'should expose a handler to build the form data'",
",",
"(",
")",
"=>",
"{",
"const",
"[",
"formData",
"]",
"=",
"getLastMockValue",
"(",
")",
";",
"expect",
"(",
"formData",
")",
".",
"toEqual",
"(",
"{",
"user",
":",
"{",
"firstName",
":",
"'John'",
",",
"lastName",
":",
"'Snow'",
",",
"}",
",",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'options'",
",",
"(",
")",
"=>",
"{",
"describe",
"(",
"'watch'",
",",
"(",
")",
"=>",
"{",
"let",
"testBed",
";",
"let",
"onChangeSpy",
";",
"const",
"getLastMockValue",
"=",
"(",
")",
"=>",
"{",
"return",
"onChangeSpy",
".",
"mock",
".",
"calls",
"[",
"onChangeSpy",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
"[",
"0",
"]",
"as",
"HookReturn",
"<",
"Form3",
">",
";",
"}",
";",
"const",
"TestComp",
"=",
"(",
"props",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"<",
"Form3",
">",
"(",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"title\"",
"defaultValue",
"=",
"\"titleInitialValue\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"titleField\"",
"/",
">",
"<",
"HookListenerComp",
"{",
"...",
"props",
"}",
"/",
">",
"<",
"UseField",
"path",
"=",
"\"subTitle\"",
"defaultValue",
"=",
"\"subTitleInitialValue\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"subTitleField\"",
"/",
">",
"<",
"/Form>);",
"}",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"onChangeSpy",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"testBed",
"=",
"setup",
"(",
"{",
"watch",
":",
"'title'",
",",
"onHookValueChange",
":",
"onChangeSpy",
"}",
")",
"as",
"TestBed",
";",
"}",
")",
";",
"test",
"(",
"'should not listen to changes on fields we are not interested in'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"testBed",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'subTitleField'",
",",
"'subTitleChanged'",
")",
";",
"setInputValue",
"(",
"'titleField'",
",",
"'titleChanged'",
")",
";",
"}",
")",
";",
"const",
"[",
"data",
"]",
"=",
"getLastMockValue",
"(",
")",
";",
"expect",
"(",
"data",
")",
".",
"toEqual",
"(",
"{",
"title",
":",
"'titleChanged'",
",",
"subTitle",
":",
"'subTitleInitialValue'",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'form'",
",",
"(",
")",
"=>",
"{",
"let",
"testBed",
";",
"let",
"onChangeSpy",
";",
"const",
"getLastMockValue",
"=",
"(",
")",
"=>",
"{",
"return",
"onChangeSpy",
".",
"mock",
".",
"calls",
"[",
"onChangeSpy",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
"[",
"0",
"]",
"as",
"HookReturn",
";",
"}",
";",
"const",
"TestComp",
"=",
"(",
"{",
"onHookValueChange",
"}",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
")",
";",
"const",
"hookValue",
"=",
"useFormData",
"<",
"Form1",
">",
"(",
"{",
"form",
"}",
")",
";",
"useEffect",
"(",
"(",
")",
"=>",
"{",
"onHookValueChange",
"(",
"hookValue",
")",
";",
"}",
",",
"[",
"hookValue",
",",
"onHookValueChange",
"]",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"title\"",
"defaultValue",
"=",
"\"titleInitialValue\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"titleField\"",
"/",
">",
"<",
"/Form>);",
"}",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"onChangeSpy",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"testBed",
"=",
"setup",
"(",
"{",
"onHookValueChange",
":",
"onChangeSpy",
"}",
")",
"as",
"TestBed",
";",
"}",
")",
";",
"test",
"(",
"'should allow a form to be provided when the hook is called outside of the FormDataContext'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"testBed",
";",
"const",
"[",
"initialData",
"]",
"=",
"getLastMockValue",
"(",
")",
";",
"expect",
"(",
"initialData",
")",
".",
"toEqual",
"(",
"{",
"title",
":",
"'titleInitialValue'",
"}",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'titleField'",
",",
"'titleChanged'",
")",
";",
"}",
")",
";",
"const",
"[",
"updatedData",
"]",
"=",
"getLastMockValue",
"(",
")",
";",
"expect",
"(",
"updatedData",
")",
".",
"toEqual",
"(",
"{",
"title",
":",
"'titleChanged'",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'onChange'",
",",
"(",
")",
"=>",
"{",
"let",
"testBed",
";",
"let",
"onChangeSpy",
";",
"let",
"validationSpy",
";",
"const",
"TestComp",
"=",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
")",
";",
"useFormData",
"<",
"Form1",
">",
"(",
"{",
"form",
",",
"onChange",
":",
"onChangeSpy",
"}",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"<",
"UseField",
"path",
"=",
"\"title\"",
"defaultValue",
"=",
"\"titleInitialValue\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"titleField\"",
"config",
"=",
"{",
"{",
"validations",
":",
"[",
"{",
"validator",
":",
"(",
")",
"=>",
"{",
"validationSpy",
"(",
")",
";",
"}",
",",
"}",
",",
"]",
",",
"}",
"}",
"/>",
"<",
"/Form>);",
"}",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"onChangeSpy",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"validationSpy",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"testBed",
"=",
"setup",
"(",
"{",
"watch",
":",
"'title'",
"}",
")",
"as",
"TestBed",
";",
"}",
")",
";",
"test",
"(",
"'should call onChange handler _before_ running the validations'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
":",
"{",
"setInputValue",
"}",
",",
"}",
"=",
"testBed",
";",
"onChangeSpy",
".",
"mockReset",
"(",
")",
";",
"validationSpy",
".",
"mockReset",
"(",
")",
";",
"expect",
"(",
"onChangeSpy",
")",
".",
"not",
".",
"toHaveBeenCalled",
"(",
")",
";",
"expect",
"(",
"validationSpy",
")",
".",
"not",
".",
"toHaveBeenCalled",
"(",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"setInputValue",
"(",
"'titleField'",
",",
"'titleChanged'",
")",
";",
"}",
")",
";",
"expect",
"(",
"onChangeSpy",
")",
".",
"toHaveBeenCalled",
"(",
")",
";",
"expect",
"(",
"validationSpy",
")",
".",
"toHaveBeenCalled",
"(",
")",
";",
"const",
"onChangeCallOrder",
"=",
"onChangeSpy",
".",
"mock",
".",
"invocationCallOrder",
"[",
"0",
"]",
";",
"const",
"validationCallOrder",
"=",
"validationSpy",
".",
"mock",
".",
"invocationCallOrder",
"[",
"0",
"]",
";",
"expect",
"(",
"onChangeCallOrder",
")",
".",
"toBeLessThan",
"(",
"validationCallOrder",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
46485,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
788 | [
"import",
"React",
",",
"{",
"useState",
"}",
"from",
"'react'",
";",
"import",
"{",
"act",
"}",
"from",
"'react-dom/test-utils'",
";",
"import",
"{",
"registerTestBed",
"}",
"from",
"'../shared_imports'",
";",
"import",
"{",
"useForm",
"}",
"from",
"'./use_form'",
";",
"import",
"{",
"useFormIsModified",
"}",
"from",
"'./use_form_is_modified'",
";",
"import",
"{",
"Form",
"}",
"from",
"'../components/form'",
";",
"import",
"{",
"UseField",
"}",
"from",
"'../components/use_field'",
";",
"describe",
"(",
"'useFormIsModified()'",
",",
"(",
")",
"=>",
"{",
"interface",
"Props",
"{",
"onIsModifiedChange",
":",
"(",
"isModified",
":",
"boolean",
")",
"=>",
"void",
";",
"discard",
"?",
":",
"string",
"[",
"]",
";",
"}",
"const",
"formDefaultValue",
"=",
"{",
"user",
":",
"{",
"name",
":",
"'initialValue'",
",",
"}",
",",
"toDiscard",
":",
"'initialValue'",
",",
"}",
";",
"const",
"TestComp",
"=",
"(",
"{",
"onIsModifiedChange",
",",
"discard",
"=",
"[",
"]",
"}",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"useForm",
"(",
"{",
"defaultValue",
":",
"formDefaultValue",
"}",
")",
";",
"const",
"isModified",
"=",
"useFormIsModified",
"(",
"{",
"form",
",",
"discard",
"}",
")",
";",
"const",
"[",
"isNameVisible",
",",
"setIsNameVisible",
"]",
"=",
"useState",
"(",
"true",
")",
";",
"const",
"[",
"isLastNameVisible",
",",
"setIsLastNameVisible",
"]",
"=",
"useState",
"(",
"true",
")",
";",
"onIsModifiedChange",
"(",
"isModified",
")",
";",
"return",
"(",
"<",
"Form",
"form",
"=",
"{",
"form",
"}",
">",
"{",
"isNameVisible",
"&&",
"<",
"UseField",
"path",
"=",
"\"user.name\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"nameField\"",
"/",
">",
"}",
"{",
"isLastNameVisible",
"&&",
"<",
"UseField",
"path",
"=",
"\"user.lastName\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"lastNameField\"",
"/",
">",
"}",
"<",
"UseField",
"path",
"=",
"\"toDiscard\"",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"toDiscardField\"",
"/",
">",
"<",
"button",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"hideNameButton\"",
"onClick",
"=",
"{",
"(",
")",
"=>",
"setIsNameVisible",
"(",
"(",
"prev",
")",
"=>",
"!",
"prev",
")",
"}",
">",
"Toggle",
"show",
"/",
"hide",
"name",
"<",
"/button>",
"<",
"button",
"data",
"-",
"test",
"-",
"subj",
"=",
"\"hideLastNameButton\"",
"onClick",
"=",
"{",
"(",
")",
"=>",
"setIsLastNameVisible",
"(",
"(",
"prev",
")",
"=>",
"!",
"prev",
")",
"}",
">",
"Toggle",
"show",
"/",
"hide",
"lastname",
"<",
"/button>",
"<",
"/Form>);",
"}",
";",
"const",
"onIsModifiedChange",
"=",
"jest",
".",
"fn",
"(",
")",
";",
"const",
"isFormModified",
"=",
"(",
")",
"=>",
"onIsModifiedChange",
".",
"mock",
".",
"calls",
"[",
"onIsModifiedChange",
".",
"mock",
".",
"calls",
".",
"length",
"-",
"1",
"]",
"[",
"0",
"]",
";",
"const",
"setup",
"=",
"registerTestBed",
"(",
"TestComp",
",",
"{",
"defaultProps",
":",
"{",
"onIsModifiedChange",
"}",
",",
"memoryRouter",
":",
"{",
"wrapComponent",
":",
"false",
"}",
",",
"}",
")",
";",
"test",
"(",
"'should return true **only** when the field value differs from its initial value'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"await",
"setup",
"(",
")",
";",
"expect",
"(",
"isFormModified",
"(",
")",
")",
".",
"toBe",
"(",
"false",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"form",
".",
"setInputValue",
"(",
"'nameField'",
",",
"'changed'",
")",
";",
"}",
")",
";",
"expect",
"(",
"isFormModified",
"(",
")",
")",
".",
"toBe",
"(",
"true",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"form",
".",
"setInputValue",
"(",
"'nameField'",
",",
"'initialValue'",
")",
";",
"}",
")",
";",
"expect",
"(",
"isFormModified",
"(",
")",
")",
".",
"toBe",
"(",
"false",
")",
";",
"}",
")",
";",
"test",
"(",
"'should accepts a list of field to discard'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"form",
"}",
"=",
"await",
"setup",
"(",
"{",
"discard",
":",
"[",
"'toDiscard'",
"]",
"}",
")",
";",
"expect",
"(",
"isFormModified",
"(",
")",
")",
".",
"toBe",
"(",
"false",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"form",
".",
"setInputValue",
"(",
"'toDiscardField'",
",",
"'changed'",
")",
";",
"}",
")",
";",
"expect",
"(",
"isFormModified",
"(",
")",
")",
".",
"toBe",
"(",
"false",
")",
";",
"}",
")",
";",
"test",
"(",
"'should take into account if a field is removed from the DOM **and** it existed on the form \"defaultValue\"'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"{",
"find",
"}",
"=",
"await",
"setup",
"(",
")",
";",
"expect",
"(",
"isFormModified",
"(",
")",
")",
".",
"toBe",
"(",
"false",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"find",
"(",
"'hideNameButton'",
")",
".",
"simulate",
"(",
"'click'",
")",
";",
"}",
")",
";",
"expect",
"(",
"isFormModified",
"(",
")",
")",
".",
"toBe",
"(",
"true",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"find",
"(",
"'hideNameButton'",
")",
".",
"simulate",
"(",
"'click'",
")",
";",
"}",
")",
";",
"expect",
"(",
"isFormModified",
"(",
")",
")",
".",
"toBe",
"(",
"false",
")",
";",
"await",
"act",
"(",
"async",
"(",
")",
"=>",
"{",
"find",
"(",
"'hideLastNameButton'",
")",
".",
"simulate",
"(",
"'click'",
")",
";",
"}",
")",
";",
"expect",
"(",
"isFormModified",
"(",
")",
")",
".",
"toBe",
"(",
"false",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
789 | [
"function",
"createChartType",
"(",
"{",
"title",
",",
"...",
"obj",
"}",
")",
"{",
"return",
"{",
"title",
",",
"name",
":",
"titleToName",
"(",
"title",
")",
",",
"dimLabels",
":",
"[",
"'Group by'",
",",
"'Name'",
",",
"'Value'",
",",
"null",
"]",
",",
"...",
"obj",
"}",
";",
"function",
"titleToName",
"(",
"s",
")",
"{",
"return",
"s",
".",
"toLowerCase",
"(",
")",
".",
"replace",
"(",
"/\\ /g",
",",
"'-'",
")",
";",
"}",
"}",
"export",
"const",
"chartTypes",
"=",
"[",
"createChartType",
"(",
"{",
"title",
":",
"'Bar Vertical 2D'",
"}",
")",
",",
"createChartType",
"(",
"{",
"title",
":",
"'Bar Horizontal 2D'",
"}",
")",
",",
"createChartType",
"(",
"{",
"title",
":",
"'Bar Vertical Stacked'",
"}",
")",
",",
"createChartType",
"(",
"{",
"title",
":",
"'Bar Vertical Normalized'",
"}",
")",
",",
"createChartType",
"(",
"{",
"title",
":",
"'Bar Horizontal Normalized'",
"}",
")",
",",
"createChartType",
"(",
"{",
"title",
":",
"'Polar Chart'",
",",
"dimLabels",
":",
"[",
"'Group by'",
",",
"'Angle Values'",
",",
"'Radius Values'",
",",
"null",
"]",
"}",
")",
",",
"createChartType",
"(",
"{",
"title",
":",
"'Line Chart'",
",",
"dimLabels",
":",
"[",
"'Group by'",
",",
"'x-Values'",
",",
"'y-Values'",
",",
"null",
"]",
"}",
")",
",",
"createChartType",
"(",
"{",
"title",
":",
"'Heat Map'",
",",
"dimLabels",
":",
"[",
"'x-Category'",
",",
"'y-Category'",
",",
"'Color'",
",",
"null",
"]",
"}",
")",
",",
"createChartType",
"(",
"{",
"title",
":",
"'Bubble Chart'",
",",
"dimLabels",
":",
"[",
"'GroupBy'",
",",
"'x-Values'",
",",
"'y-Values'",
",",
"'Radius'",
"]",
"}",
")",
"]",
";"
] | [
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
790 | [
"export",
"const",
"gapminder",
"=",
"`\ncountry\tyear\tgdpPercap\tlifeExp\tpop\tcontinent\nAustralia\t1952\t10039.59564\t69.12\t8691212\tOceania\nAustralia\t1957\t10949.64959\t70.33\t9712569\tOceania\nAustralia\t1962\t12217.22686\t70.93\t10794968\tOceania\nAustralia\t1967\t14526.12465\t71.1\t11872264\tOceania\nAustralia\t1972\t16788.62948\t71.93\t13177000\tOceania\nAustralia\t1977\t18334.19751\t73.49\t14074100\tOceania\nAustralia\t1982\t19477.00928\t74.74\t15184200\tOceania\nAustralia\t1987\t21888.88903\t76.32\t16257249\tOceania\nAustralia\t1992\t23424.76683\t77.56\t17481977\tOceania\nAustralia\t1997\t26997.93657\t78.83\t18565243\tOceania\nAustralia\t2002\t30687.75473\t80.37\t19546792\tOceania\nAustralia\t2007\t34435.36744\t81.235\t20434176\tOceania\nCanada\t1952\t11367.16112\t68.75\t14785584\tAmericas\nCanada\t1957\t12489.95006\t69.96\t17010154\tAmericas\nCanada\t1962\t13462.48555\t71.3\t18985849\tAmericas\nCanada\t1967\t16076.58803\t72.13\t20819767\tAmericas\nCanada\t1972\t18970.57086\t72.88\t22284500\tAmericas\nCanada\t1977\t22090.88306\t74.21\t23796400\tAmericas\nCanada\t1982\t22898.79214\t75.76\t25201900\tAmericas\nCanada\t1987\t26626.51503\t76.86\t26549700\tAmericas\nCanada\t1992\t26342.88426\t77.95\t28523502\tAmericas\nCanada\t1997\t28954.92589\t78.61\t30305843\tAmericas\nCanada\t2002\t33328.96507\t79.77\t31902268\tAmericas\nCanada\t2007\t36319.23501\t80.653\t33390141\tAmericas\nChina\t1952\t400.4486107\t44\t556263528\tAsia\nChina\t1957\t575.9870009\t50.54896\t637408000\tAsia\nChina\t1962\t487.6740183\t44.50136\t665770000\tAsia\nChina\t1967\t612.7056934\t58.38112\t754550000\tAsia\nChina\t1972\t676.9000921\t63.11888\t862030000\tAsia\nChina\t1977\t741.2374699\t63.96736\t943455000\tAsia\nChina\t1982\t962.4213805\t65.525\t1000281000\tAsia\nChina\t1987\t1378.904018\t67.274\t1084035000\tAsia\nChina\t1992\t1655.784158\t68.69\t1164970000\tAsia\nChina\t1997\t2289.234136\t70.426\t1230075000\tAsia\nChina\t2002\t3119.280896\t72.028\t1280400000\tAsia\nChina\t2007\t4959.114854\t72.961\t1318683096\tAsia\nFrance\t1952\t7029.809327\t67.41\t42459667\tEurope\nFrance\t1957\t8662.834898\t68.93\t44310863\tEurope\nFrance\t1962\t10560.48553\t70.51\t47124000\tEurope\nFrance\t1967\t12999.91766\t71.55\t49569000\tEurope\nFrance\t1972\t16107.19171\t72.38\t51732000\tEurope\nFrance\t1977\t18292.63514\t73.83\t53165019\tEurope\nFrance\t1982\t20293.89746\t74.89\t54433565\tEurope\nFrance\t1987\t22066.44214\t76.34\t55630100\tEurope\nFrance\t1992\t24703.79615\t77.46\t57374179\tEurope\nFrance\t1997\t25889.78487\t78.64\t58623428\tEurope\nFrance\t2002\t28926.03234\t79.59\t59925035\tEurope\nFrance\t2007\t30470.0167\t80.657\t61083916\tEurope\nGermany\t1952\t7144.114393\t67.5\t69145952\tEurope\nGermany\t1957\t10187.82665\t69.1\t71019069\tEurope\nGermany\t1962\t12902.46291\t70.3\t73739117\tEurope\nGermany\t1967\t14745.62561\t70.8\t76368453\tEurope\nGermany\t1972\t18016.18027\t71\t78717088\tEurope\nGermany\t1977\t20512.92123\t72.5\t78160773\tEurope\nGermany\t1982\t22031.53274\t73.8\t78335266\tEurope\nGermany\t1987\t24639.18566\t74.847\t77718298\tEurope\nGermany\t1992\t26505.30317\t76.07\t80597764\tEurope\nGermany\t1997\t27788.88416\t77.34\t82011073\tEurope\nGermany\t2002\t30035.80198\t78.67\t82350671\tEurope\nGermany\t2007\t32170.37442\t79.406\t82400996\tEurope\nJapan\t1952\t3216.956347\t63.03\t86459025\tAsia\nJapan\t1957\t4317.694365\t65.5\t91563009\tAsia\nJapan\t1962\t6576.649461\t68.73\t95831757\tAsia\nJapan\t1967\t9847.788607\t71.43\t100825279\tAsia\nJapan\t1972\t14778.78636\t73.42\t107188273\tAsia\nJapan\t1977\t16610.37701\t75.38\t113872473\tAsia\nJapan\t1982\t19384.10571\t77.11\t118454974\tAsia\nJapan\t1987\t22375.94189\t78.67\t122091325\tAsia\nJapan\t1992\t26824.89511\t79.36\t124329269\tAsia\nJapan\t1997\t28816.58499\t80.69\t125956499\tAsia\nJapan\t2002\t28604.5919\t82\t127065841\tAsia\nJapan\t2007\t31656.06806\t82.603\t127467972\tAsia\nMexico\t1952\t3478.125529\t50.789\t30144317\tAmericas\nMexico\t1957\t4131.546641\t55.19\t35015548\tAmericas\nMexico\t1962\t4581.609385\t58.299\t41121485\tAmericas\nMexico\t1967\t5754.733883\t60.11\t47995559\tAmericas\nMexico\t1972\t6809.40669\t62.361\t55984294\tAmericas\nMexico\t1977\t7674.929108\t65.032\t63759976\tAmericas\nMexico\t1982\t9611.147541\t67.405\t71640904\tAmericas\nMexico\t1987\t8688.156003\t69.498\t80122492\tAmericas\nMexico\t1992\t9472.384295\t71.455\t88111030\tAmericas\nMexico\t1997\t9767.29753\t73.67\t95895146\tAmericas\nMexico\t2002\t10742.44053\t74.902\t102479927\tAmericas\nMexico\t2007\t11977.57496\t76.195\t108700891\tAmericas\nSpain\t1952\t3834.034742\t64.94\t28549870\tEurope\nSpain\t1957\t4564.80241\t66.66\t29841614\tEurope\nSpain\t1962\t5693.843879\t69.69\t31158061\tEurope\nSpain\t1967\t7993.512294\t71.44\t32850275\tEurope\nSpain\t1972\t10638.75131\t73.06\t34513161\tEurope\nSpain\t1977\t13236.92117\t74.39\t36439000\tEurope\nSpain\t1982\t13926.16997\t76.3\t37983310\tEurope\nSpain\t1987\t15764.98313\t76.9\t38880702\tEurope\nSpain\t1992\t18603.06452\t77.57\t39549438\tEurope\nSpain\t1997\t20445.29896\t78.77\t39855442\tEurope\nSpain\t2002\t24835.47166\t79.78\t40152517\tEurope\nSpain\t2007\t28821.0637\t80.941\t40448191\tEurope\nUnited Kingdom\t1952\t9979.508487\t69.18\t50430000\tEurope\nUnited Kingdom\t1957\t11283.17795\t70.42\t51430000\tEurope\nUnited Kingdom\t1962\t12477.17707\t70.76\t53292000\tEurope\nUnited Kingdom\t1967\t14142.85089\t71.36\t54959000\tEurope\nUnited Kingdom\t1972\t15895.11641\t72.01\t56079000\tEurope\nUnited Kingdom\t1977\t17428.74846\t72.76\t56179000\tEurope\nUnited Kingdom\t1982\t18232.42452\t74.04\t56339704\tEurope\nUnited Kingdom\t1987\t21664.78767\t75.007\t56981620\tEurope\nUnited Kingdom\t1992\t22705.09254\t76.42\t57866349\tEurope\nUnited Kingdom\t1997\t26074.53136\t77.218\t58808266\tEurope\nUnited Kingdom\t2002\t29478.99919\t78.471\t59912431\tEurope\nUnited Kingdom\t2007\t33203.26128\t79.425\t60776238\tEurope\nUnited States\t1952\t13990.48208\t68.44\t157553000\tAmericas\nUnited States\t1957\t14847.12712\t69.49\t171984000\tAmericas\nUnited States\t1962\t16173.14586\t70.21\t186538000\tAmericas\nUnited States\t1967\t19530.36557\t70.76\t198712000\tAmericas\nUnited States\t1972\t21806.03594\t71.34\t209896000\tAmericas\nUnited States\t1977\t24072.63213\t73.38\t220239000\tAmericas\nUnited States\t1982\t25009.55914\t74.65\t232187835\tAmericas\nUnited States\t1987\t29884.35041\t75.02\t242803533\tAmericas\nUnited States\t1992\t32003.93224\t76.09\t256894189\tAmericas\nUnited States\t1997\t35767.43303\t76.81\t272911760\tAmericas\nUnited States\t2002\t39097.09955\t77.31\t287675526\tAmericas\nUnited States\t2007\t42951.65309\t78.242\t301139947\tAmericas`",
".",
"trim",
"(",
")",
";"
] | [
null,
null,
2,
null,
null,
null,
null,
null,
null,
null
] |
791 | [
"import",
"{",
"Component",
",",
"ViewEncapsulation",
",",
"OnInit",
"}",
"from",
"'@angular/core'",
";",
"import",
"{",
"colorSets",
"}",
"from",
"'@swimlane/ngx-charts/release/utils/color-sets'",
";",
"import",
"*",
"as",
"shape",
"from",
"'d3-shape'",
";",
"import",
"*",
"as",
"dsv",
"from",
"'d3-dsv'",
";",
"import",
"{",
"nest",
"}",
"from",
"'d3-collection'",
";",
"import",
"*",
"as",
"babyparse",
"from",
"'babyparse'",
";",
"import",
"SvgSaver",
"from",
"'svgsaver'",
";",
"import",
"chroma",
"from",
"'chroma-js'",
";",
"import",
"{",
"chartTypes",
"}",
"from",
"'./chartTypes'",
";",
"import",
"{",
"gapminder",
"}",
"from",
"'./data'",
";",
"const",
"defaultOptions",
"=",
"{",
"view",
":",
"[",
"1000",
",",
"600",
"]",
",",
"colorScheme",
":",
"colorSets",
".",
"find",
"(",
"s",
"=>",
"s",
".",
"name",
"===",
"'cool'",
")",
",",
"schemeType",
":",
"'ordinal'",
",",
"showLegend",
":",
"true",
",",
"legendTitle",
":",
"'Legend'",
",",
"gradient",
":",
"false",
",",
"showXAxis",
":",
"true",
",",
"showYAxis",
":",
"true",
",",
"showXAxisLabel",
":",
"true",
",",
"showYAxisLabel",
":",
"true",
",",
"yAxisLabel",
":",
"''",
",",
"xAxisLabel",
":",
"''",
",",
"autoScale",
":",
"true",
",",
"showGridLines",
":",
"true",
",",
"rangeFillOpacity",
":",
"0.5",
",",
"roundDomains",
":",
"false",
",",
"tooltipDisabled",
":",
"false",
",",
"showSeriesOnHover",
":",
"true",
",",
"curve",
":",
"shape",
".",
"curveLinear",
",",
"curveClosed",
":",
"shape",
".",
"curveCardinalClosed",
"}",
";",
"const",
"curves",
"=",
"{",
"'Basis'",
":",
"shape",
".",
"curveBasis",
",",
"'Basis Closed'",
":",
"shape",
".",
"curveBasisClosed",
",",
"'Bundle'",
":",
"shape",
".",
"curveBundle",
".",
"beta",
"(",
"1",
")",
",",
"'Cardinal'",
":",
"shape",
".",
"curveCardinal",
",",
"'Cardinal Closed'",
":",
"shape",
".",
"curveCardinalClosed",
",",
"'Catmull Rom'",
":",
"shape",
".",
"curveCatmullRom",
",",
"'Catmull Rom Closed'",
":",
"shape",
".",
"curveCatmullRomClosed",
",",
"'Linear'",
":",
"shape",
".",
"curveLinear",
",",
"'Linear Closed'",
":",
"shape",
".",
"curveLinearClosed",
",",
"'Monotone X'",
":",
"shape",
".",
"curveMonotoneX",
",",
"'Monotone Y'",
":",
"shape",
".",
"curveMonotoneY",
",",
"'Natural'",
":",
"shape",
".",
"curveNatural",
",",
"'Step'",
":",
"shape",
".",
"curveStep",
",",
"'Step After'",
":",
"shape",
".",
"curveStepAfter",
",",
"'Step Before'",
":",
"shape",
".",
"curveStepBefore",
",",
"'default'",
":",
"shape",
".",
"curveLinear",
"}",
";",
"@",
"Component",
"(",
"{",
"selector",
":",
"'app-root'",
",",
"templateUrl",
":",
"'./app.component.html'",
",",
"styleUrls",
":",
"[",
"'../../node_modules/@swimlane/ngx-ui/release/index.css'",
",",
"'./app.component.scss'",
"]",
",",
"encapsulation",
":",
"ViewEncapsulation",
".",
"None",
"}",
")",
"export",
"class",
"AppComponent",
"implements",
"OnInit",
"{",
"chartTypes",
"=",
"chartTypes",
";",
"data",
":",
"any",
"[",
"]",
";",
"rawData",
":",
"any",
"[",
"]",
";",
"headerValues",
":",
"any",
"[",
"]",
";",
"errors",
":",
"any",
"[",
"]",
";",
"chartType",
":",
"any",
";",
"theme",
":",
"string",
";",
"dataDims",
":",
"string",
"[",
"]",
";",
"chartOptions",
":",
"any",
";",
"colors",
":",
"string",
";",
"colorsRight",
":",
"string",
";",
"steps",
":",
"number",
";",
"bezier",
":",
"boolean",
";",
"lightness",
":",
"boolean",
";",
"bezierRight",
":",
"boolean",
";",
"lightnessRight",
":",
"boolean",
";",
"diverging",
":",
"boolean",
";",
"_dataText",
":",
"string",
";",
"get",
"dataText",
"(",
")",
"{",
"return",
"this",
".",
"_dataText",
"||",
"' '",
";",
"}",
"set",
"dataText",
"(",
"value",
")",
"{",
"this",
".",
"updateData",
"(",
"value",
")",
";",
"}",
"get",
"hasValidData",
"(",
")",
"{",
"return",
"this",
".",
"_dataText",
".",
"length",
">",
"0",
"&&",
"this",
".",
"errors",
".",
"length",
"===",
"0",
";",
"}",
"get",
"hasChartSelected",
"(",
")",
"{",
"return",
"this",
".",
"hasValidData",
"&&",
"this",
".",
"chartType",
"&&",
"this",
".",
"chartType",
".",
"name",
";",
"}",
"get",
"hasValidDimensions",
"(",
")",
"{",
"return",
"this",
".",
"hasChartSelected",
"&&",
"!",
"this",
".",
"chartType",
".",
"dimLabels",
".",
"some",
"(",
"(",
"l",
",",
"i",
")",
"=>",
"l",
"?",
"!",
"this",
".",
"dataDims",
"[",
"i",
"]",
":",
"false",
")",
";",
"}",
"editorConfig",
"=",
"{",
"lineNumbers",
":",
"true",
",",
"theme",
":",
"'dracula'",
",",
"mode",
":",
"{",
"name",
":",
"'json'",
"}",
"}",
";",
"svgSaver",
"=",
"new",
"SvgSaver",
"(",
")",
";",
"ngOnInit",
"(",
")",
"{",
"this",
".",
"clearAll",
"(",
")",
";",
"}",
"useExample",
"(",
")",
"{",
"this",
".",
"clear",
"(",
")",
";",
"this",
".",
"dataText",
"=",
"gapminder",
";",
"this",
".",
"updateData",
"(",
")",
";",
"this",
".",
"chartType",
"=",
"chartTypes",
"[",
"0",
"]",
";",
"this",
".",
"dataDims",
"=",
"[",
"5",
",",
"0",
",",
"3",
",",
"3",
"]",
".",
"map",
"(",
"i",
"=>",
"this",
".",
"headerValues",
"[",
"i",
"]",
".",
"name",
")",
";",
"}",
"clear",
"(",
")",
"{",
"this",
".",
"headerValues",
"=",
"[",
"]",
";",
"this",
".",
"rawData",
"=",
"[",
"]",
";",
"this",
".",
"dataDims",
"=",
"[",
"null",
",",
"null",
",",
"null",
",",
"null",
"]",
";",
"return",
"this",
".",
"data",
"=",
"[",
"]",
";",
"}",
"clearAll",
"(",
")",
"{",
"this",
".",
"clear",
"(",
")",
";",
"this",
".",
"dataText",
"=",
"''",
";",
"this",
".",
"chartType",
"=",
"null",
";",
"this",
".",
"theme",
"=",
"'light'",
";",
"this",
".",
"colors",
"=",
"'#a8385d,#7aa3e5,#a27ea8,#aae3f5,#adcded,#a95963,#8796c0,#7ed3ed,#50abcc,#ad6886'",
";",
"this",
".",
"colorsRight",
"=",
"'darkred, deeppink, orange, lightyellow'",
";",
"this",
".",
"steps",
"=",
"10",
";",
"this",
".",
"bezier",
"=",
"false",
";",
"this",
".",
"lightness",
"=",
"false",
";",
"this",
".",
"bezierRight",
"=",
"false",
";",
"this",
".",
"lightnessRight",
"=",
"false",
";",
"this",
".",
"bezier",
"=",
"false",
";",
"this",
".",
"lightness",
"=",
"false",
";",
"this",
".",
"chartOptions",
"=",
"{",
"...",
"defaultOptions",
"}",
";",
"return",
"this",
".",
"updateColorScheme",
"(",
")",
";",
"}",
"processData",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"hasValidDimensions",
")",
"{",
"return",
";",
"}",
"const",
"key$",
"=",
"d",
"=>",
"d",
"[",
"this",
".",
"dataDims",
"[",
"0",
"]",
"]",
";",
"const",
"name$",
"=",
"d",
"=>",
"d",
"[",
"this",
".",
"dataDims",
"[",
"1",
"]",
"]",
";",
"const",
"value$",
"=",
"d",
"=>",
"d",
"[",
"this",
".",
"dataDims",
"[",
"2",
"]",
"]",
";",
"const",
"value2$",
"=",
"d",
"=>",
"d",
"[",
"this",
".",
"dataDims",
"[",
"3",
"]",
"]",
";",
"return",
"this",
".",
"data",
"=",
"nest",
"(",
")",
".",
"key",
"(",
"key$",
")",
".",
"entries",
"(",
"this",
".",
"rawData",
")",
".",
"map",
"(",
"series",
")",
";",
"function",
"series",
"(",
"d",
")",
"{",
"return",
"{",
"name",
":",
"d",
".",
"key",
",",
"series",
":",
"d",
".",
"values",
".",
"map",
"(",
"seriesPoints",
")",
"}",
";",
"}",
"function",
"seriesPoints",
"(",
"d",
")",
"{",
"return",
"{",
"name",
":",
"name$",
"(",
"d",
")",
",",
"value",
":",
"value$",
"(",
"d",
")",
",",
"x",
":",
"name$",
"(",
"d",
")",
",",
"y",
":",
"value$",
"(",
"d",
")",
",",
"r",
":",
"value2$",
"(",
"d",
")",
"}",
";",
"}",
"}",
"updateData",
"(",
"value",
"=",
"this",
".",
"_dataText",
")",
"{",
"this",
".",
"_dataText",
"=",
"value",
";",
"const",
"parsed",
"=",
"babyparse",
".",
"parse",
"(",
"this",
".",
"_dataText",
",",
"{",
"header",
":",
"true",
",",
"dynamicTyping",
":",
"true",
"}",
")",
";",
"this",
".",
"errors",
"=",
"parsed",
".",
"errors",
";",
"if",
"(",
"this",
".",
"errors",
".",
"length",
")",
"{",
"return",
"this",
".",
"clear",
"(",
")",
";",
"}",
"this",
".",
"rawData",
"=",
"parsed",
".",
"data",
";",
"const",
"headerValues",
"=",
"parsed",
".",
"meta",
".",
"fields",
".",
"map",
"(",
"d",
"=>",
"(",
"{",
"name",
":",
"d",
",",
"type",
":",
"typeof",
"parsed",
".",
"data",
"[",
"0",
"]",
"[",
"d",
"]",
"}",
")",
")",
";",
"if",
"(",
"JSON",
".",
"stringify",
"(",
"headerValues",
")",
"!==",
"JSON",
".",
"stringify",
"(",
"this",
".",
"headerValues",
")",
")",
"{",
"this",
".",
"headerValues",
"=",
"headerValues",
".",
"slice",
"(",
")",
";",
"this",
".",
"dataDims",
"=",
"[",
"null",
",",
"null",
",",
"null",
",",
"null",
"]",
";",
"this",
".",
"data",
"=",
"[",
"]",
";",
"}",
"else",
"{",
"this",
".",
"processData",
"(",
")",
";",
"}",
"}",
"updateColorScheme",
"(",
")",
"{",
"const",
"domain",
"=",
"this",
".",
"diverging",
"?",
"this",
".",
"updateColorSchemeDiv",
"(",
")",
":",
"this",
".",
"updateColorSchemeSeq",
"(",
")",
";",
"this",
".",
"chartOptions",
".",
"colorScheme",
"=",
"{",
"...",
"this",
".",
"chartOptions",
".",
"colorScheme",
",",
"domain",
"}",
";",
"}",
"updateColorSchemeSeq",
"(",
")",
"{",
"const",
"cs",
"=",
"getColorScale",
"(",
"this",
".",
"colors",
",",
"this",
".",
"bezier",
",",
"this",
".",
"lightness",
")",
";",
"return",
"cs",
".",
"colors",
"(",
"this",
".",
"steps",
")",
";",
"}",
"updateColorSchemeDiv",
"(",
")",
"{",
"const",
"domainL",
"=",
"getColorScale",
"(",
"this",
".",
"colors",
",",
"this",
".",
"bezier",
",",
"this",
".",
"lightness",
")",
".",
"colors",
"(",
"this",
".",
"steps",
")",
";",
"const",
"domainR",
"=",
"getColorScale",
"(",
"this",
".",
"colorsRight",
",",
"this",
".",
"bezierRight",
",",
"this",
".",
"lightnessRight",
")",
".",
"colors",
"(",
"this",
".",
"steps",
")",
";",
"if",
"(",
"domainL",
"[",
"domainL",
".",
"length",
"-",
"1",
"]",
"===",
"domainR",
"[",
"0",
"]",
")",
"{",
"domainL",
".",
"pop",
"(",
")",
";",
"}",
"const",
"cs",
"=",
"chroma",
".",
"scale",
"(",
"[",
"...",
"domainL",
",",
"...",
"domainR",
"]",
")",
";",
"return",
"cs",
".",
"colors",
"(",
"this",
".",
"steps",
")",
";",
"}",
"}",
"function",
"clean",
"(",
"s",
")",
"{",
"return",
"s",
".",
"trim",
"(",
")",
".",
"replace",
"(",
"/(, *| +)/g",
",",
"','",
")",
".",
"replace",
"(",
"/['\"]/g",
",",
"''",
")",
".",
"split",
"(",
"','",
")",
";",
"}",
"function",
"getColorScale",
"(",
"colors",
",",
"bezier",
",",
"lightness",
")",
"{",
"const",
"cleanColors",
"=",
"clean",
"(",
"colors",
")",
";",
"const",
"scale",
"=",
"bezier",
"?",
"chroma",
".",
"bezier",
"(",
"cleanColors",
".",
"slice",
"(",
"0",
",",
"5",
")",
")",
".",
"scale",
"(",
")",
":",
"chroma",
".",
"scale",
"(",
"cleanColors",
")",
";",
"return",
"scale",
".",
"mode",
"(",
"'lab'",
")",
".",
"correctLightness",
"(",
"lightness",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
8,
null,
8,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
792 | [
"export",
"const",
"environment",
"=",
"{",
"production",
":",
"false",
"}",
";"
] | [
null,
null,
6,
null,
null,
null,
null,
null,
null,
null
] |
793 | [
"export",
"const",
"environment",
"=",
"{",
"production",
":",
"true",
"}",
";"
] | [
null,
null,
6,
null,
null,
null,
null,
null,
null,
null
] |
794 | [
"import",
"*",
"as",
"React",
"from",
"'react'",
";",
"export",
"type",
"IMaskProps",
"<",
"T",
"extends",
"object",
">",
"=",
"{",
"[",
"K",
"in",
"keyof",
"T",
"]",
"?",
":",
"T",
"[",
"K",
"]",
";",
"}",
";",
"export",
"type",
"IRulesProps",
"<",
"T",
"extends",
"object",
">",
"=",
"{",
"[",
"K",
"in",
"keyof",
"T",
"]",
":",
"(",
"value1",
":",
"T",
"[",
"K",
"]",
",",
"value2",
":",
"T",
"[",
"K",
"]",
",",
"name",
":",
"string",
")",
"=>",
"boolean",
";",
"}",
";",
"export",
"type",
"IMaskChildren",
"<",
"T",
">",
"=",
"{",
"bits",
"?",
":",
"Partial",
"<",
"T",
">",
";",
"}",
";",
"export",
"type",
"IReadChildren",
"<",
"T",
">",
"=",
"{",
"children",
":",
"(",
"match",
":",
"boolean",
",",
"flags",
":",
"T",
")",
"=>",
"React",
".",
"ReactNode",
";",
"}",
";",
"export",
"type",
"IChildren",
"<",
"T",
">",
"=",
"{",
"bits",
"?",
":",
"Partial",
"<",
"T",
">",
";",
"}",
";",
"export",
"type",
"ContextType",
"<",
"Bits",
"extends",
"object",
">",
"=",
"{",
"bits",
":",
"Partial",
"<",
"Bits",
">",
";",
"rules",
":",
"Partial",
"<",
"IRulesProps",
"<",
"Bits",
">",
">",
";",
"}",
";",
"export",
"type",
"ProviderType",
"<",
"Bits",
"extends",
"object",
">",
"=",
"{",
"bits",
":",
"Partial",
"<",
"Bits",
">",
";",
"rules",
"?",
":",
"Partial",
"<",
"IRulesProps",
"<",
"Bits",
">",
">",
";",
"}",
";",
"export",
"type",
"CaseProps",
"<",
"Bits",
"extends",
"object",
">",
"=",
"IMaskProps",
"<",
"Bits",
">",
"&",
"IMaskChildren",
"<",
"Bits",
">",
";",
"export",
"type",
"ReadProps",
"<",
"Bits",
"extends",
"object",
">",
"=",
"IMaskProps",
"<",
"Bits",
">",
"&",
"IMaskChildren",
"<",
"Bits",
">",
"&",
"IReadChildren",
"<",
"Bits",
">",
";",
"export",
"type",
"SwitchProps",
"<",
"Bits",
"extends",
"object",
">",
"=",
"{",
"bits",
"?",
":",
"Partial",
"<",
"Bits",
">",
";",
"}",
";",
"export",
"type",
"MaskPack",
"<",
"Bits",
"extends",
"object",
">",
"=",
"{",
"Provider",
":",
"React",
".",
"SFC",
"<",
"ProviderType",
"<",
"Bits",
">",
">",
";",
"Switch",
":",
"React",
".",
"SFC",
"<",
"SwitchProps",
"<",
"Bits",
">",
">",
";",
"Case",
":",
"React",
".",
"SFC",
"<",
"CaseProps",
"<",
"Bits",
">",
">",
";",
"Read",
":",
"React",
".",
"SFC",
"<",
"ReadProps",
"<",
"Bits",
">",
">",
";",
"Default",
":",
"React",
".",
"SFC",
"<",
"any",
">",
";",
"}",
";",
"const",
"defaultComparator",
"=",
"(",
"a",
",",
"b",
")",
"=>",
"a",
"===",
"b",
";",
"const",
"match",
"=",
"(",
"bits",
",",
"mask",
")",
":",
"boolean",
"=>",
"(",
"Object",
".",
"keys",
"(",
"mask",
")",
".",
"every",
"(",
"key",
"=>",
"(",
"bits",
".",
"rules",
"[",
"key",
"]",
"||",
"defaultComparator",
")",
"(",
"mask",
"[",
"key",
"]",
",",
"bits",
".",
"bits",
"[",
"key",
"]",
",",
"key",
")",
")",
")",
";",
"function",
"find",
"<",
"T",
">",
"(",
"array",
",",
"predicate",
")",
"{",
"return",
"(",
"array",
")",
".",
"filter",
"(",
"predicate",
")",
"[",
"0",
"]",
";",
"}",
"const",
"merge",
"=",
"(",
"a",
",",
"key",
",",
"c",
")",
"=>",
"(",
"{",
"...",
"(",
"a",
"[",
"key",
"]",
")",
",",
"...",
"c",
"}",
")",
";",
"const",
"getProps",
"=",
"(",
"{",
"bits",
",",
"children",
",",
"...",
"mask",
"}",
")",
"=>",
"mask",
";",
"function",
"createMaskedProvider",
"<",
"Bits",
"extends",
"object",
">",
"(",
"initial",
",",
"rules",
"=",
"{",
"}",
")",
"{",
"const",
"context",
"=",
"React",
".",
"createContext",
"<",
"ContextType",
"<",
"Bits",
">",
">",
"(",
"{",
"bits",
":",
"initial",
",",
"rules",
":",
"rules",
"}",
")",
";",
"const",
"{",
"Consumer",
"}",
"=",
"context",
";",
"const",
"empty",
"=",
"{",
"value",
":",
"{",
"}",
",",
"rules",
":",
"{",
"}",
"}",
";",
"const",
"Provider",
"=",
"(",
"{",
"bits",
",",
"rules",
"=",
"{",
"}",
",",
"children",
"}",
")",
"=>",
"(",
"<",
"Consumer",
">",
"{",
"(",
"value",
"=",
"empty",
")",
"=>",
"<",
"context",
".",
"Provider",
"value",
"=",
"{",
"{",
"bits",
":",
"merge",
"(",
"value",
",",
"'value'",
",",
"bits",
")",
",",
"rules",
":",
"merge",
"(",
"value",
",",
"'rules'",
",",
"rules",
")",
",",
"}",
"}",
">",
"{",
"children",
"}",
"<",
"/context.Provider>}",
"<",
"/Consumer>);",
"const",
"Case",
"=",
"(",
"props",
")",
"=>",
"{",
"const",
"{",
"bits",
",",
"children",
"}",
"=",
"props",
";",
"const",
"mask",
"=",
"getProps",
"(",
"props",
")",
";",
"if",
"(",
"bits",
")",
"{",
"return",
"(",
"match",
"(",
"{",
"bits",
",",
"rules",
":",
"{",
"}",
"}",
",",
"mask",
")",
"?",
"children",
":",
"null",
")",
"as",
"any",
";",
"}",
"return",
"(",
"<",
"Consumer",
">",
"{",
"value",
"=>",
"match",
"(",
"value",
",",
"mask",
")",
"?",
"children",
":",
"null",
"}",
"<",
"/Consumer>);",
"}",
";",
"const",
"Read",
"=",
"(",
"props",
")",
"=>",
"{",
"const",
"{",
"bits",
",",
"children",
"}",
"=",
"props",
";",
"const",
"mask",
"=",
"getProps",
"(",
"props",
")",
";",
"if",
"(",
"bits",
")",
"{",
"return",
"children",
"(",
"match",
"(",
"{",
"bits",
",",
"rules",
":",
"{",
"}",
"}",
",",
"mask",
")",
",",
"bits",
"as",
"Bits",
")",
"as",
"any",
";",
"}",
"return",
"(",
"<",
"Consumer",
">",
"{",
"value",
"=>",
"children",
"(",
"match",
"(",
"value",
",",
"mask",
")",
",",
"value",
".",
"bits",
"as",
"Bits",
")",
"}",
"<",
"/Consumer>);",
"}",
";",
"const",
"Default",
"=",
"(",
"{",
"children",
"}",
")",
"=>",
"(",
"children",
"as",
"any",
")",
";",
"const",
"CaseType",
"=",
"(",
"<",
"Case",
"/>).type;",
"const",
"DefaultType",
"=",
"(",
"<",
"Default",
"/>).type;",
"const",
"pickCase",
"=",
"(",
"mask",
",",
"children",
")",
"=>",
"(",
"find",
"(",
"children",
",",
"child",
"=>",
"typeof",
"child",
"===",
"'object'",
"&&",
"CaseType",
"===",
"child",
".",
"type",
"&&",
"match",
"(",
"mask",
",",
"getProps",
"(",
"child",
".",
"props",
")",
")",
")",
"||",
"find",
"(",
"children",
",",
"child",
"=>",
"typeof",
"child",
"===",
"'object'",
"&&",
"DefaultType",
"===",
"child",
".",
"type",
")",
"||",
"null",
")",
";",
"const",
"Switch",
"=",
"(",
"{",
"children",
",",
"bits",
"}",
")",
"=>",
"(",
"bits",
"?",
"pickCase",
"(",
"{",
"values",
":",
"bits",
"}",
",",
"React",
".",
"Children",
".",
"toArray",
"(",
"children",
")",
")",
"as",
"any",
":",
"(",
"<",
"Consumer",
">",
"{",
"mask",
"=>",
"pickCase",
"(",
"mask",
",",
"React",
".",
"Children",
".",
"toArray",
"(",
"children",
")",
")",
"}",
"<",
"/Consumer>));",
"return",
"{",
"Provider",
",",
"Switch",
",",
"Case",
",",
"Read",
",",
"Default",
"}",
";",
"}",
"export",
"default",
"createMaskedProvider",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
1877,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11,
null,
null,
null,
null,
5,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
795 | [
"import",
"*",
"as",
"React",
"from",
"'react'",
";",
"export",
"interface",
"ICatchState",
"{",
"caught",
":",
"number",
";",
"pending",
":",
"boolean",
"[",
"]",
";",
"resolved",
":",
"any",
"[",
"]",
";",
"rejected",
":",
"boolean",
"[",
"]",
";",
"throw",
":",
"any",
";",
"catched",
":",
"any",
";",
"}",
"export",
"interface",
"IChildrenProps",
"{",
"caught",
":",
"number",
";",
"pending",
":",
"boolean",
";",
"rejected",
":",
"boolean",
";",
"resolved",
":",
"boolean",
";",
"results",
":",
"any",
"[",
"]",
";",
"}",
"export",
"interface",
"ICatchProps",
"{",
"onCatch",
"?",
":",
"(",
"event",
":",
"any",
")",
"=>",
"any",
";",
"children",
":",
"(",
"state",
":",
"IChildrenProps",
")",
"=>",
"React",
".",
"ReactNode",
";",
"}",
"function",
"replaceIn",
"<",
"T",
">",
"(",
"a",
",",
"index",
",",
"newValue",
")",
"{",
"const",
"b",
"=",
"[",
"...",
"a",
"]",
";",
"b",
".",
"splice",
"(",
"index",
",",
"1",
",",
"newValue",
")",
";",
"return",
"b",
";",
"}",
"const",
"resolvedMagically",
"=",
"{",
"}",
";",
"const",
"isResolved",
"=",
"(",
"a",
")",
"=>",
"a",
"!==",
"undefined",
";",
"export",
"class",
"Catcher",
"extends",
"React",
".",
"Component",
"<",
"ICatchProps",
",",
"ICatchState",
">",
"{",
"state",
"=",
"{",
"caught",
":",
"0",
",",
"pending",
":",
"[",
"]",
"as",
"any",
",",
"resolved",
":",
"[",
"]",
"as",
"any",
",",
"rejected",
":",
"[",
"]",
"as",
"any",
",",
"throw",
":",
"undefined",
"as",
"any",
",",
"catched",
":",
"undefined",
"as",
"any",
",",
"}",
";",
"componentDidUpdate",
"(",
"_",
",",
"oldState",
")",
"{",
"if",
"(",
"oldState",
".",
"throw",
"!==",
"this",
".",
"state",
".",
"throw",
")",
"{",
"throw",
"this",
".",
"state",
".",
"throw",
";",
"}",
"if",
"(",
"oldState",
".",
"catched",
"!==",
"this",
".",
"state",
".",
"catched",
")",
"{",
"if",
"(",
"this",
".",
"props",
".",
"onCatch",
")",
"{",
"this",
".",
"props",
".",
"onCatch",
"(",
"this",
".",
"state",
".",
"catched",
")",
";",
"}",
"}",
"}",
"static",
"getDerivedStateFromError",
"(",
")",
"{",
"return",
"null",
";",
"}",
"componentDidCatch",
"(",
"error",
")",
"{",
"if",
"(",
"'then'",
"in",
"error",
")",
"{",
"this",
".",
"setState",
"(",
"{",
"catched",
":",
"error",
"}",
")",
";",
"this",
".",
"setState",
"(",
"state",
"=>",
"{",
"const",
"id",
"=",
"state",
".",
"caught",
";",
"error",
".",
"then",
"(",
"(",
"value",
")",
"=>",
"this",
".",
"setState",
"(",
"(",
"{",
"resolved",
",",
"pending",
"}",
")",
"=>",
"(",
"{",
"resolved",
":",
"replaceIn",
"(",
"resolved",
",",
"id",
",",
"value",
"===",
"undefined",
"?",
"resolvedMagically",
":",
"value",
")",
",",
"pending",
":",
"replaceIn",
"(",
"pending",
",",
"id",
",",
"false",
")",
"}",
")",
")",
")",
".",
"catch",
"(",
"(",
")",
"=>",
"this",
".",
"setState",
"(",
"(",
"{",
"rejected",
",",
"pending",
"}",
")",
"=>",
"(",
"{",
"rejected",
":",
"replaceIn",
"(",
"rejected",
",",
"id",
",",
"true",
")",
",",
"pending",
":",
"replaceIn",
"(",
"pending",
",",
"id",
",",
"false",
")",
"}",
")",
")",
")",
";",
"return",
"{",
"caught",
":",
"id",
"+",
"1",
",",
"pending",
":",
"[",
"...",
"state",
".",
"pending",
",",
"true",
"]",
",",
"resolved",
":",
"[",
"...",
"state",
".",
"resolved",
",",
"undefined",
"]",
",",
"rejected",
":",
"[",
"...",
"state",
".",
"rejected",
",",
"false",
"]",
",",
"}",
";",
"}",
")",
";",
"}",
"else",
"{",
"this",
".",
"setState",
"(",
"{",
"throw",
":",
"error",
"}",
")",
";",
"}",
"}",
"render",
"(",
")",
"{",
"const",
"{",
"caught",
",",
"pending",
",",
"rejected",
",",
"resolved",
"}",
"=",
"this",
".",
"state",
";",
"return",
"this",
".",
"props",
".",
"children",
"(",
"{",
"caught",
",",
"pending",
":",
"pending",
".",
"some",
"(",
"Boolean",
")",
",",
"rejected",
":",
"rejected",
".",
"some",
"(",
"Boolean",
")",
",",
"resolved",
":",
"resolved",
".",
"some",
"(",
"isResolved",
")",
",",
"results",
":",
"resolved",
"}",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
5,
null,
3,
null,
11,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
51,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
194,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
796 | [
"import",
"*",
"as",
"React",
"from",
"'react'",
";",
"export",
"type",
"ErrorThrower",
"=",
"(",
"error",
":",
"any",
")",
"=>",
"any",
";",
"export",
"interface",
"IThrowProps",
"{",
"when",
"?",
":",
"boolean",
";",
"what",
"?",
":",
"any",
";",
"children",
"?",
":",
"(",
"thrower",
":",
"ErrorThrower",
")",
"=>",
"React",
".",
"ReactNode",
";",
"}",
"interface",
"IThrowState",
"{",
"throwed",
":",
"any",
";",
"}",
"export",
"class",
"Throw",
"extends",
"React",
".",
"Component",
"<",
"IThrowProps",
",",
"IThrowState",
">",
"{",
"state",
"=",
"{",
"throwed",
":",
"undefined",
"as",
"any",
"}",
";",
"componentDidMount",
"(",
")",
"{",
"this",
".",
"componentDidUpdate",
"(",
"{",
"}",
"as",
"any",
",",
"{",
"}",
"as",
"any",
")",
";",
"}",
"componentDidUpdate",
"(",
"oldProps",
",",
"oldState",
")",
"{",
"if",
"(",
"this",
".",
"props",
".",
"when",
"!==",
"oldProps",
".",
"when",
")",
"{",
"throw",
"Promise",
".",
"resolve",
"(",
"this",
".",
"props",
".",
"what",
")",
";",
"}",
"if",
"(",
"oldState",
".",
"throwed",
"!==",
"this",
".",
"state",
".",
"throwed",
")",
"{",
"throw",
"Promise",
".",
"resolve",
"(",
"this",
".",
"state",
".",
"throwed",
")",
";",
"}",
"}",
"shouldComponentUpdate",
"(",
"props",
",",
"oldState",
")",
"{",
"return",
"!",
"(",
"'when'",
"in",
"this",
".",
"props",
")",
"||",
"this",
".",
"props",
".",
"when",
"!==",
"props",
".",
"when",
"||",
"this",
".",
"state",
".",
"throwed",
"!==",
"oldState",
".",
"throwed",
";",
"}",
"thrower",
":",
"ErrorThrower",
"=",
"(",
"event",
")",
"=>",
"{",
"this",
".",
"setState",
"(",
"{",
"throwed",
":",
"event",
"}",
")",
";",
"}",
";",
"render",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"props",
".",
"children",
")",
"{",
"return",
"null",
";",
"}",
"return",
"this",
".",
"props",
".",
"children",
"!",
"(",
"this",
".",
"thrower",
")",
"||",
"null",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
0,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
0,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
797 | [
"import",
"*",
"as",
"React",
"from",
"'react'",
";",
"export",
"interface",
"ITriggerProps",
"{",
"when",
":",
"boolean",
";",
"then",
":",
"(",
")",
"=>",
"any",
";",
"finally",
"?",
":",
"(",
")",
"=>",
"any",
";",
"async",
"?",
":",
"boolean",
";",
"delay",
"?",
":",
"number",
";",
"}",
"export",
"class",
"Trigger",
"extends",
"React",
".",
"Component",
"<",
"ITriggerProps",
">",
"{",
"private",
"_timeout",
":",
"number",
"=",
"0",
";",
"componentDidMount",
"(",
")",
"{",
"this",
".",
"componentDidUpdate",
"(",
")",
";",
"}",
"componentDidUpdate",
"(",
")",
"{",
"this",
".",
"props",
".",
"when",
"?",
"this",
".",
"trigger",
"(",
")",
":",
"this",
".",
"clearTrigger",
"(",
")",
";",
"}",
"componentWillUnmount",
"(",
")",
"{",
"this",
".",
"props",
".",
"finally",
"&&",
"this",
".",
"props",
".",
"finally",
"(",
")",
";",
"this",
".",
"clearTrigger",
"(",
")",
";",
"}",
"shouldComponentUpdate",
"(",
"props",
")",
"{",
"return",
"this",
".",
"props",
".",
"when",
"!==",
"props",
".",
"when",
";",
"}",
"trigger",
"(",
")",
"{",
"const",
"{",
"async",
",",
"delay",
"}",
"=",
"this",
".",
"props",
";",
"if",
"(",
"async",
")",
"{",
"Promise",
".",
"resolve",
"(",
")",
".",
"then",
"(",
"this",
".",
"props",
".",
"then",
")",
";",
"}",
"else",
"if",
"(",
"delay",
")",
"{",
"this",
".",
"_timeout",
"=",
"window",
".",
"setTimeout",
"(",
"(",
")",
"=>",
"{",
"this",
".",
"props",
".",
"then",
"(",
")",
";",
"}",
",",
"delay",
")",
";",
"}",
"else",
"{",
"this",
".",
"props",
".",
"then",
"(",
")",
";",
"}",
"}",
"clearTrigger",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_timeout",
")",
"{",
"window",
".",
"clearTimeout",
"(",
"this",
".",
"_timeout",
")",
";",
"this",
".",
"_timeout",
"=",
"0",
";",
"}",
"}",
"render",
"(",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
225,
null,
null,
null,
null,
null,
null,
null,
null
] |
798 | [
"import",
"*",
"as",
"React",
"from",
"'react'",
";",
"export",
"interface",
"Hash",
"{",
"[",
"key",
"]",
":",
"any",
";",
"}",
"export",
"type",
"IMergeProps",
"<",
"T",
">",
"=",
"{",
"[",
"key",
"]",
":",
"T",
";",
"}",
";",
"export",
"type",
"IMergeRender",
"<",
"T",
">",
"=",
"{",
"input",
":",
"IMergeProps",
"<",
"T",
">",
";",
"shallowEqual",
"?",
":",
"boolean",
";",
"filter",
"?",
":",
"(",
"value",
":",
"T",
")",
"=>",
"boolean",
";",
"children",
":",
"(",
"value",
":",
"T",
",",
"real",
":",
"T",
",",
"key",
":",
"string",
")",
"=>",
"React",
".",
"ReactNode",
";",
"}",
";",
"type",
"IMergeState",
"<",
"T",
">",
"=",
"{",
"activeKey",
":",
"string",
";",
"value",
":",
"T",
";",
"values",
":",
"IMergeProps",
"<",
"T",
">",
";",
"}",
";",
"const",
"keyChangedKey",
"=",
"(",
"props",
",",
"values",
",",
"shallow",
")",
"=>",
"{",
"const",
"keys",
"=",
"Object",
".",
"keys",
"(",
"props",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"{",
"const",
"key",
"=",
"keys",
"[",
"i",
"]",
";",
"if",
"(",
"props",
"[",
"key",
"]",
"!==",
"values",
"[",
"key",
"]",
")",
"{",
"if",
"(",
"shallow",
"&&",
"typeof",
"props",
"[",
"key",
"]",
"===",
"'object'",
")",
"{",
"if",
"(",
"keyChangedKey",
"(",
"props",
"[",
"key",
"]",
",",
"values",
"[",
"key",
"]",
",",
"false",
")",
")",
"{",
"return",
"key",
";",
"}",
"}",
"else",
"{",
"return",
"key",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}",
";",
"export",
"class",
"LatestSource",
"<",
"T",
">",
"extends",
"React",
".",
"Component",
"<",
"IMergeRender",
"<",
"T",
">",
",",
"IMergeState",
"<",
"T",
">",
">",
"{",
"state",
"=",
"this",
".",
"initState",
"(",
")",
";",
"static",
"getDerivedStateFromProps",
"(",
"props",
",",
"state",
")",
"{",
"const",
"values",
"=",
"props",
".",
"input",
";",
"const",
"key",
"=",
"keyChangedKey",
"(",
"values",
",",
"state",
".",
"values",
",",
"!",
"!",
"props",
".",
"shallowEqual",
")",
";",
"if",
"(",
"key",
")",
"{",
"return",
"{",
"values",
",",
"value",
":",
"(",
"!",
"props",
".",
"filter",
"||",
"props",
".",
"filter",
"(",
"values",
"[",
"key",
"]",
")",
")",
"?",
"values",
"[",
"key",
"]",
":",
"state",
".",
"value",
",",
"activeKey",
":",
"key",
"}",
";",
"}",
"return",
"null",
";",
"}",
"initState",
"(",
")",
"{",
"const",
"{",
"input",
",",
"filter",
"}",
"=",
"this",
".",
"props",
";",
"const",
"values",
"=",
"input",
";",
"const",
"keys",
"=",
"Object",
".",
"keys",
"(",
"values",
")",
";",
"let",
"activeKey",
"=",
"keys",
"[",
"0",
"]",
";",
"if",
"(",
"filter",
")",
"{",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"filter",
"(",
"values",
"[",
"keys",
"[",
"i",
"]",
"]",
")",
")",
"{",
"activeKey",
"=",
"keys",
"[",
"i",
"]",
";",
"break",
";",
"}",
"}",
"}",
"return",
"{",
"activeKey",
",",
"values",
",",
"value",
":",
"values",
"[",
"activeKey",
"]",
"}",
";",
"}",
"render",
"(",
")",
"{",
"const",
"{",
"value",
",",
"values",
",",
"activeKey",
"}",
"=",
"this",
".",
"state",
";",
"return",
"this",
".",
"props",
".",
"children",
"(",
"value",
",",
"values",
"[",
"activeKey",
"]",
",",
"activeKey",
")",
";",
"}",
"}",
"export",
"type",
"IGhostRender",
"<",
"T",
">",
"=",
"{",
"input",
":",
"T",
";",
"shallowEqual",
"?",
":",
"boolean",
";",
"filter",
"?",
":",
"(",
"value",
":",
"T",
")",
"=>",
"boolean",
";",
"children",
":",
"(",
"value",
":",
"T",
",",
"real",
":",
"T",
")",
"=>",
"React",
".",
"ReactNode",
";",
"}",
";",
"export",
"class",
"GhostValue",
"<",
"T",
">",
"extends",
"React",
".",
"Component",
"<",
"IGhostRender",
"<",
"T",
">",
">",
"{",
"render",
"(",
")",
"{",
"const",
"{",
"input",
",",
"...",
"props",
"}",
"=",
"this",
".",
"props",
";",
"return",
"<",
"LatestSource",
"input",
"=",
"{",
"{",
"0",
":",
"input",
"}",
"}",
"{",
"...",
"props",
"}",
"/>;",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
422,
null,
422,
null,
8,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
0,
null,
0,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
194,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
9,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
799 | [
"import",
"*",
"as",
"React",
"from",
"'react'",
";",
"export",
"interface",
"IRevalueProps",
"<",
"T",
">",
"{",
"value",
":",
"T",
";",
"children",
":",
"(",
"v",
":",
"T",
")",
"=>",
"React",
".",
"ReactNode",
";",
"}",
"export",
"class",
"Revalue",
"<",
"T",
">",
"extends",
"React",
".",
"Component",
"<",
"IRevalueProps",
"<",
"T",
">",
">",
"{",
"render",
"(",
")",
"{",
"return",
"this",
".",
"props",
".",
"children",
"(",
"this",
".",
"props",
".",
"value",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
194,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |