import {TypedSopNode} from "./_Base";
import {NodeContext as NodeContext2} from "../../poly/NodeContext";
import {NodeParamsConfig, ParamConfig} from "../utils/params/ParamsConfig";
class ObjectMergeSopParamsConfig extends NodeParamsConfig {
  constructor() {
    super(...arguments);
    this.geometry = ParamConfig.OPERATOR_PATH("", {
      nodeSelection: {
        context: NodeContext2.SOP
      }
    });
  }
}
const ParamsConfig2 = new ObjectMergeSopParamsConfig();
export class ObjectMergeSopNode extends TypedSopNode {
  constructor() {
    super(...arguments);
    this.params_config = ParamsConfig2;
  }
  static type() {
    return "objectMerge";
  }
  initializeNode() {
  }
  async cook(input_containers) {
    const geometry_node = this.p.geometry.found_node();
    if (geometry_node) {
      if (geometry_node.nodeContext() == NodeContext2.SOP) {
        const container = await geometry_node.requestContainer();
        this.import_input(geometry_node, container);
      } else {
        this.states.error.set("found node is not a geometry");
      }
    } else {
      this.states.error.set(`node not found at path '${this.pv.geometry}'`);
    }
  }
  import_input(geometry_node, container) {
    let core_group;
    if ((core_group = container.coreContentCloned()) != null) {
      this.setCoreGroup(core_group);
    } else {
      this.states.error.set("invalid target");
    }
  }
}
