"use strict";

exports.__esModule = true;
exports.default = void 0;

var _h2xPluginJsx = require("h2x-plugin-jsx");

const expandProps = (position = 'end') => () => ({
  visitor: {
    JSXElement: {
      enter(path) {
        if (path.node.name === 'svg' && !path.node.attributes.some(attr => attr && attr.name === 'props')) {
          const props = new _h2xPluginJsx.JSXAttribute();
          props.name = 'props';
          props.spread = true;

          if (position === 'start') {
            path.node.attributes = [props, ...path.node.attributes];
            path.replace(path.node);
          }

          if (position === 'end') {
            path.node.attributes = [...path.node.attributes, props];
            path.replace(path.node);
          }
        }
      }

    }
  }
});

var _default = expandProps;
exports.default = _default;