import templateOnly from '@ember/component/template-only';
import { setComponentTemplate } from '@ember/component';
import { precompileTemplate } from '@ember/template-compilation';
import { fn } from '@ember/helper';
import { on } from '@ember/modifier';
import EuiCheckbox from '../eui-checkbox.js';

const handleChange = (node, replaceNode) => {
  const {
    position,
    lead,
    isChecked,
    label
  } = node;
  replaceNode(position, `${lead}[${isChecked ? ' ' : 'x'}]${label}`);
};
const EuiMarkdownFormatMarkdownCheckboxComponent = setComponentTemplate(precompileTemplate(`
    <EuiCheckbox
      @checked={{@node.isChecked}}
      {{on "change" (fn handleChange @node @replaceNode)}}
      ...attributes
    >
      <:label>
        {{@node.content}}
      </:label>
    </EuiCheckbox>
  `, {
  strictMode: true,
  scope: () => ({
    EuiCheckbox,
    on,
    fn,
    handleChange
  })
}), templateOnly("markdown-checkbox", "EuiMarkdownFormatMarkdownCheckboxComponent"));

export { EuiMarkdownFormatMarkdownCheckboxComponent as default };
//# sourceMappingURL=markdown-checkbox.js.map
