import { NativeSelect } from '@/components/form/NativeSelect'; import { useId } from 'react'; import { useTranslation } from 'react-i18next'; import { Form, Input, InputNumber, Switch } from 'antd'; import { useFormContext, useWatch } from 'react-hook-form'; import { HeaderMapEditor } from '@/components/form'; import { FormField } from '@/components/form/rhf'; const MASQ_PATH = ['streamSettings', 'hysteriaSettings', 'masquerade']; export default function HysteriaFields() { const { t } = useTranslation(); const uid = useId(); const { control, setValue } = useFormContext(); const masq = useWatch({ control, name: 'streamSettings.hysteriaSettings.masquerade' }) as | { type?: string } | undefined; const masqType = useWatch({ control, name: 'streamSettings.hysteriaSettings.masquerade.type', }) as string | undefined; return ( <> setValue( 'streamSettings.hysteriaSettings.masquerade', checked ? { type: '', dir: '', url: '', rewriteHost: false, insecure: false, content: '', headers: {}, statusCode: 0, } : undefined, ) } /> {masq && ( <> {masqType === 'proxy' && ( <> )} {masqType === 'file' && ( )} {masqType === 'string' && ( <> )} )} ); }