/*!
 * Copyright (c) Microsoft. All rights reserved.
 * Licensed under the MIT license. See LICENSE file in the project.
 */ import { jsx as _jsx } from "react/jsx-runtime";
import { memo, useEffect } from 'react';
import { EncodeDecodeBase } from './EncodeDecode.base.js';
import { useCodebookContent } from './EncodeDecode.hooks.js';
/*
 *
 * Input table is expected to be edited elsewhere and configured as the step input.
 */ export const EncodeDecode = /*#__PURE__*/ memo(function EncodeDecode({ step , onChange , metadata  }) {
    const codebook = useCodebookContent(metadata);
    useEffect(()=>{
        if (metadata != null && onChange != null) {
            if (step.args.codebook == null && codebook != null) {
                onChange({
                    ...step,
                    args: {
                        ...step.args,
                        codebook: codebook
                    }
                });
            }
        }
    }, [
        metadata,
        onChange,
        step,
        codebook
    ]);
    return /*#__PURE__*/ _jsx(EncodeDecodeBase, {
        step: step,
        onChange: onChange
    });
});
