var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { MapToComponentField, MapToComponentMethod, VegaSlimmer } from 'vega-slimmer/core';
import { h } from '@stencil/core';
import domNodeSubjectFactory from '../../../../helpers/change-manager/subject/dom-node-subject/dom-node-subject-factory';
import { VegaInputSelectRenderPrefixIconInternalOverridden } from '../../../../helpers/event-manager/event-id/vega-internal-event-id';
import remoteInvocationRegistry from '../../../../helpers/remote-invocation/remote-invocation-registry';
/** Manager remote invocation */
export class VegaInputSelectPrefixIconRenderer extends VegaSlimmer {
  /**
   * Component lifecycle - connectedCallback
   */
  connectedCallback() {
    this.remotePhoneNumberPrefixIconRenderSubject =
      domNodeSubjectFactory.getSubjectFromParentNodeByEventId(this.host, VegaInputSelectRenderPrefixIconInternalOverridden);
  }
  /**
   * Call the render function in input-phone-number.
   *
   * @param {unknown[]} args - arguments of remote search function
   * @returns {Nullable<HTMLVegaFlagIconElement>} - returned vega-flag-icon.
   */
  callRemotePrefixIconRender(...args) {
    if (this.remotePhoneNumberPrefixIconRenderSubject) {
      const renderResult = remoteInvocationRegistry.call(this.remotePhoneNumberPrefixIconRenderSubject, ...args);
      if (renderResult)
        return renderResult;
    }
    return null;
  }
  render() {
    const renderResult = this.callRemotePrefixIconRender(this.prefixIcon);
    return (this.prefixIcon && (h("div", { class: "vega-input-select-prefix-icon" }, renderResult ? (renderResult) : (h("vega-icon", { icon: this.prefixIcon, size: "size-16" })))));
  }
}
__decorate([
  MapToComponentField()
], VegaInputSelectPrefixIconRenderer.prototype, "host", void 0);
__decorate([
  MapToComponentField()
], VegaInputSelectPrefixIconRenderer.prototype, "prefixIcon", void 0);
__decorate([
  MapToComponentMethod('connectedCallback')
], VegaInputSelectPrefixIconRenderer.prototype, "connectedCallback", null);
