'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-58ea899e.js');
const requiredFieldRule = require('./required-field-rule-d73c1d8c.js');
const component = require('./component-1e352960.js');
const breakpoints = require('./breakpoints-1cc2c4c6.js');
const globalSlimmerRegistry = require('./global-slimmer-registry-b3bce7e0.js');
const ui = require('./ui-3727d685.js');
const responsiveFormatFacade = require('./responsive-format-facade-2fa87e82.js');
const domNodeSubjectObserverFactory = require('./dom-node-subject-observer-factory-ba6a95f3.js');
const vegaEventId = require('./vega-event-id-f95480b7.js');
const componentUsageRuntimeMetrics = require('./component-usage-runtime-metrics-4572c5b7.js');
const vegaInternalEventId = require('./vega-internal-event-id-e138d4d6.js');
const array = require('./array-249289f2.js');
const changeManager = require('./change-manager-a297e4d2.js');
const staticSubjectTitle = require('./static-subject-title-5829a298.js');
const accessibility = require('./accessibility-88f8af84.js');
const chevronUp = require('./chevron-up-21465cf7.js');
const chevronDown = require('./chevron-down-9847bf78.js');
const internalIconManager = require('./internal-icon-manager-c989189a.js');
const index$1 = require('./index-592b4052.js');
const formFieldControllerSlimmer = require('./form-field-controller-slimmer-44091874.js');
const pageResizeObserverSlimmer = require('./page-resize-observer-slimmer-273d62ef.js');
const eventEmitSlimmer = require('./event-emit-slimmer-73c42d7e.js');
const childNodesEventPreventSlimmer = require('./child-nodes-event-prevent-slimmer-1f212162.js');
const typeGuard = require('./type-guard-c1195e50.js');
const mutationObserverSlimmer = require('./mutation-observer-slimmer-749d5020.js');
const mutationObserverFilters = require('./mutation-observer-filters-38cebc6d.js');
const translationSlimmer = require('./translation-slimmer-a4a7f0eb.js');
const remoteInvocationRegistry = require('./remote-invocation-registry-fc22fdd0.js');
const internalFormFieldValidationRule_abstract = require('./internal-form-field-validation-rule.abstract-07cdff46.js');
const internalTranslationController = require('./internal-translation-controller-f0da24b2.js');
require('./ui-32120990.js');
require('./breakpoints-ebde4837.js');
require('./number-4816603d.js');
require('./pixel-98f2a10c.js');
require('./feature-flag-controller-9129ef52.js');
require('./index-f054eb5d.js');
require('./observer-f49483e8.js');
require('./icon-manager-c12c6ea9.js');
require('./create-public-api-runtime-metrics-slimmer-9cb09fb2.js');
require('./dynamic-slimmer-f31fdfd7.js');
require('./misc-3d30df91.js');
require('./try-get-document-c0ebd39a.js');
require('./string-39438062.js');
require('./sub-state-observer-slimmer-aa93ab4f.js');
require('./internal-vega-event-manager-063c17cb.js');
require('./vega-env-manager-23b8b23c.js');
require('./typography-4560e7f1.js');

var __decorate$9 = (undefined && undefined.__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;
};
/** The `VegaInputSelectRenderer` class is a TypeScript React component that renders a select input field with various properties and methods. */
class VegaInputSelectRenderer extends globalSlimmerRegistry.VegaSlimmer {
  constructor() {
    super(...arguments);
    this.renderErrorMessage = () => {
      return index.h("div", { class: "vega-input-select-error-message" });
    };
    this.renderHelpMessage = () => {
      return index.h("div", { class: "vega-input-select-hint" }, this.hint);
    };
    this.handleLabelButtonClick = () => {
      this.labelButtonClickEventEmitter.emit();
    };
  }
  render() {
    return (index.h(index.Host, { class: ui.arrayToClassString([
        this.disabled ? 'vega-input-select-disabled' : '',
        responsiveFormatFacade.ResponsiveFormatFacade.formatCustom(this.size),
      ]) },
      this.renderLabel(),
      this.dropdownRenderer.render(),
      this.renderErrorMessage(),
      this.hint && this.renderHelpMessage()));
  }
  renderLabel() {
    return (this.label && (index.h("vega-field-label", { "is-field-required": this.required, disabled: this.disabled, label: this.label, suffixButtonConfig: this.labelSuffixButtonConfig, ref: (node) => {
        domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(node, vegaEventId.VegaLabelButtonClick, this.handleLabelButtonClick);
      } })));
  }
}
__decorate$9([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectRenderer.prototype, "disabled", void 0);
__decorate$9([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectRenderer.prototype, "size", void 0);
__decorate$9([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectRenderer.prototype, "hint", void 0);
__decorate$9([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectRenderer.prototype, "label", void 0);
__decorate$9([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectRenderer.prototype, "required", void 0);
__decorate$9([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectRenderer.prototype, "labelSuffixButtonConfig", void 0);
__decorate$9([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectRenderer.prototype, "labelButtonClickEventEmitter", void 0);
__decorate$9([
  globalSlimmerRegistry.MapToComponentField({ componentFieldName: 'vegaInputSelectDropdownRenderer' })
], VegaInputSelectRenderer.prototype, "dropdownRenderer", void 0);

var __decorate$8 = (undefined && undefined.__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;
};
/** The `VegaInputSelectDropdownController` class is a TypeScript React component that controls the behavior of a dropdown select input. */
class VegaInputSelectDropdownController extends globalSlimmerRegistry.VegaSlimmer {
  constructor() {
    super(...arguments);
    /** The `onDropdownShow` function is setting the `isDropdownShow` property of the`VegaInputSelectDropdownController` class to `true`. This function is called when the dropdown select input is shown. */
    this.onDropdownShow = () => {
      this.isDropdownShow = true;
    };
    /** The `onDropdownHide` function is setting the `isDropdownShow` property of the `VegaInputSelectDropdownController` class to `false`. This function is called when the dropdown select input is hidden. */
    this.onDropdownHide = () => {
      this.isDropdownShow = false;
    };
  }
  /**
   * The function `addDropdownObserver` adds event observers to a dropdown element.
   *
   * @param {HTMLElement} dropdownRef - The `dropdownRef` parameter is a reference to the HTML element representing the dropdown component.
   */
  addDropdownObserver(dropdownRef) {
    domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(dropdownRef, vegaEventId.VegaDropdownShow, (payload) => {
      this.onDropdownShow();
      this.showEventEmitter.emit(payload.detail);
    });
    domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(dropdownRef, vegaEventId.VegaDropdownHide, (payload) => {
      this.onDropdownHide();
      this.hideEventEmitter.emit(payload.detail);
    });
    domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(dropdownRef, vegaEventId.VegaDropdownClick, async (payload) => {
      this.vegaInputSelectValueController.setValue(await payload.host.getSelection());
    });
    domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(dropdownRef, vegaEventId.VegaDropdownSearch, (payload) => {
      this.searchEventEmitter.emit(payload.detail);
    });
    domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(dropdownRef, vegaEventId.VegaSearchTrigger, (payload) => {
      this.searchTriggerEventEmitter.emit(payload.detail);
    });
    domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(dropdownRef, vegaInternalEventId.VegaInternalDropdownTemplateItemsChange, 
    /*
     * The below method is e2e-test covered in
     * @see{module:vega-input-select-template-single-select-e2e}
     * @see{module:vega-input-select-template-multiple-select-e2e}
     */
    /* istanbul ignore next */
    (payload) => {
      const addedItems = Array.from(payload)
        .filter((item) => !this.source.find((sourceItem) => sourceItem.id === item.itemKey))
        .map((item) => ({
        id: item.itemKey,
        displayName: item.label,
      }));
      this.sourceController.appendSourceItems(addedItems);
    });
    domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(dropdownRef, vegaEventId.VegaReset, async () => {
      this.vegaInputSelectValueController.setValue(this.selectType === 'multiple' ? [] : '');
    });
  }
}
__decorate$8([
  globalSlimmerRegistry.MapToComponentField({ writable: true })
], VegaInputSelectDropdownController.prototype, "isDropdownShow", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownController.prototype, "vegaSearch", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownController.prototype, "searchEventEmitter", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownController.prototype, "searchTriggerEventEmitter", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownController.prototype, "vegaInputSelectValueController", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownController.prototype, "sourceController", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownController.prototype, "source", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownController.prototype, "showEventEmitter", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownController.prototype, "hideEventEmitter", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownController.prototype, "selectType", void 0);

var __decorate$7 = (undefined && undefined.__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;
};
/** The `VegaInputSelectValueController` class is a TypeScript React component that handles the value and change events for an input select component. */
class VegaInputSelectValueController extends globalSlimmerRegistry.VegaSlimmer {
  constructor() {
    super(...arguments);
    /**
     * handle the value change when the component watchValue call
     *
     * @param {SelectValueType<SelectType>} newValue the new value
     * @param {SelectValueType<SelectType>} oldValue the old value
     */
    this.handleValueChange = (newValue, oldValue) => {
      if (this.selectType === 'multiple') {
        newValue = newValue;
        oldValue = oldValue;
        let validValue;
        if (newValue) {
          validValue = !this.vegaDropdownProps.preserveValueIfNotInSource
            ? newValue.filter((value) => this.sourceController.getItem(value))
            : newValue;
        }
        else {
          validValue = [];
        }
        if (!array.isArrayEqual(validValue, oldValue, true)) {
          this.setValue(validValue);
          this.changeEventEmitter.emit(validValue);
          changeManager.ChangeManager.notify(staticSubjectTitle.FORM_ELEMENT_VALUE_CHANGE, {
            host: this.host,
            detail: validValue,
          });
        }
        else if (!array.isArrayEqual(validValue, newValue, true)) {
          this.setValue(validValue);
        }
      }
      else {
        if (newValue !== oldValue) {
          const sourceItem = this.sourceController.getItem(newValue);
          if (!this.vegaDropdownProps.preserveValueIfNotInSource) {
            this.setValue(sourceItem ? sourceItem.id : '');
          }
          else {
            this.setValue(newValue);
          }
          this.changeEventEmitter.emit(this.value);
          changeManager.ChangeManager.notify(staticSubjectTitle.FORM_ELEMENT_VALUE_CHANGE, {
            host: this.host,
            detail: this.value,
          });
        }
      }
    };
  }
  /**
   * The function sets the value of a select input if it passes a value guard check.
   *
   * @param {unknown} value - The `value` parameter is the value that you want to set for the `value` property. It
   * can be of any type that extends the `SelectType` type.
   */
  setValue(value) {
    if (this.valueGuard(value)) {
      this.value = value;
      this.vegaInputSelectItemController.setSelectedItem();
    }
  }
  /**
   * The function `valueGuard` checks if the input value is valid based on the select type.
   *
   * @param {SelectValueType<SelectType>} value - The `value` parameter is of type `SelectValueType<SelectType>`.
   * @returns {boolean} a boolean value.
   */
  valueGuard(value) {
    switch (this.selectType) {
      case 'single':
        return value === null || typeof value === 'string';
      case 'multiple':
        return Array.isArray(value) && value.every((item) => typeof item === 'string');
      default:
        globalSlimmerRegistry.LogUtility.warn(`Invalid input select value ${value} for ${this.selectType} mode`);
        return false;
    }
  }
}
__decorate$7([
  globalSlimmerRegistry.MapToComponentField({ writable: true })
], VegaInputSelectValueController.prototype, "value", void 0);
__decorate$7([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectValueController.prototype, "selectType", void 0);
__decorate$7([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectValueController.prototype, "changeEventEmitter", void 0);
__decorate$7([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectValueController.prototype, "host", void 0);
__decorate$7([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectValueController.prototype, "sourceController", void 0);
__decorate$7([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectValueController.prototype, "vegaInputSelectItemController", void 0);
__decorate$7([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectValueController.prototype, "vegaDropdownProps", void 0);
__decorate$7([
  globalSlimmerRegistry.MapToComponentMethod('watchValue')
], VegaInputSelectValueController.prototype, "handleValueChange", void 0);

var __decorate$6 = (undefined && undefined.__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;
};
/** The `VegaInputSelectItemController` class is a TypeScript React component that controls the state of selected item. */
class VegaInputSelectItemController extends globalSlimmerRegistry.VegaSlimmer {
  /**
   * Set initial the value of selected item
   */
  componentWillLoad() {
    this.setSelectedItem();
  }
  /**
   * Reset the value of selected item based on select type
   */
  watchSelectType() {
    if (this.selectType === 'multiple') {
      this.selectedItem = [];
      this.vegaInputSelectValueController.setValue([]);
    }
    else {
      this.selectedItem = null;
      this.vegaInputSelectValueController.setValue('');
    }
  }
  /**
   * Synchronizes the controller's selectedItem with the current value and the source data.
   */
  setSelectedItem() {
    var _a;
    if (this.selectType === 'multiple') {
      const updatedItem = this.value.map((itemValue) => this.sourceController.getItem(itemValue));
      const originalItem = this.selectedItem
        ? this.selectedItem.filter((item) => this.value.includes(item === null || item === void 0 ? void 0 : item.id))
        : [];
      this.selectedItem = this.updateSelectedItemUnderMultiple(originalItem, updatedItem);
    }
    else {
      const updatedItem = this.sourceController.getItem(this.value);
      if (!this.value || this.value !== ((_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.id)) {
        this.selectedItem = null;
      }
      if (updatedItem) {
        this.selectedItem = updatedItem;
      }
    }
  }
  /**
   * Updates the selected items array under multiple selection mode.
   *
   * @param {SelectSourceItem[]} originalItem - the original selected items array.
   * @param {SelectSourceItem[]} updatedItem - the updated selected items array.
   * @returns {SelectSourceItem[]} The updated selected items array.
   */
  updateSelectedItemUnderMultiple(originalItem, updatedItem) {
    const map = new Map(originalItem.map((obj) => [obj.id, obj]));
    // Iterate through array2 and update the Map
    updatedItem.forEach((item) => {
      // If id exists, it replaces the old object; if not, it adds it
      map.set(item === null || item === void 0 ? void 0 : item.id, item);
    });
    // Convert the Map values back into a standard array
    return Array.from(map.values());
  }
}
__decorate$6([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectItemController.prototype, "value", void 0);
__decorate$6([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectItemController.prototype, "selectType", void 0);
__decorate$6([
  globalSlimmerRegistry.MapToComponentField({ writable: true })
], VegaInputSelectItemController.prototype, "selectedItem", void 0);
__decorate$6([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectItemController.prototype, "sourceController", void 0);
__decorate$6([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectItemController.prototype, "vegaInputSelectValueController", void 0);
__decorate$6([
  globalSlimmerRegistry.MapToComponentMethod('componentWillLoad')
], VegaInputSelectItemController.prototype, "componentWillLoad", null);
__decorate$6([
  globalSlimmerRegistry.MapToComponentMethod('watchSelectType')
], VegaInputSelectItemController.prototype, "watchSelectType", null);

var __decorate$5 = (undefined && undefined.__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;
};
/** The `VegaInputSelectDropdownRenderer` class is a TypeScript React component that renders a dropdown select input with various customization options. */
class VegaInputSelectDropdownRenderer extends globalSlimmerRegistry.VegaSlimmer {
  constructor() {
    super(...arguments);
    this.renderContainer = () => {
      return (index.h("div", { role: 'button', class: "vega-input-select-container", ref: (ref) => (this.inputSelectContainer = ref), tabIndex: 0, "aria-disabled": `${this.disabled}`, onKeyDown: accessibility.createEnterKeyHandlerToTriggerClick(), onBlur: this.preventBlur, part: "select-container" },
        this.renderPrefixIcon(),
        this.renderSelectContainer(),
        this.renderToggleIcon()));
    };
    this.renderPrefixIcon = () => {
      return this.vegaInputSelectPrefixIconRenderer.render();
    };
    this.renderToggleIcon = () => {
      return (index.h("div", { class: "vega-input-select-toggle-icon", part: "toggle-icon-container" },
        index.h("vega-icon", { part: "toggle-icon", icon: internalIconManager.VegaInternalIconManager.getIconKey(this.isDropdownShow ? 'chevron-up' : 'chevron-down') })));
    };
    /* istanbul ignore next */
    this.renderSelectContainer = () => {
      var _a, _b;
      if (typeof this.selectedLabel !== 'function') {
        if (!((_a = this.selectedLabel) === null || _a === void 0 ? void 0 : _a.single)) {
          this.selectedLabel.single = (_value, selectedItem) => selectedItem.displayName;
        }
        if (!((_b = this.selectedLabel) === null || _b === void 0 ? void 0 : _b.multiple)) {
          this.selectedLabel.multiple = (value) => `${value.length} Selected`;
        }
      }
      return (index.h("div", { class: "vega-input-select-select-container" },
        index.h("div", { class: "vega-input-select-selected-box" }, this.selectType === 'multiple'
          ? this.renderMultipleSelected()
          : this.renderSingleSelected())));
    };
    this.renderMultipleSelected = () => {
      if (this.value.length > 0) {
        const selectedLabelStr = typeof this.selectedLabel == 'function'
          ? this.selectedLabel(this.value)
          : // eslint-disable-next-line  @typescript-eslint/no-non-null-assertion
            this.selectedLabel.multiple(this.value, this.selectedItem);
        return (index.h("span", { class: "vega-input-select-selected" },
          index.h("vega-text", { overflow: "ellipsis", tooltip: this.getSelectedLabelTooltipProps(), key: selectedLabelStr }, selectedLabelStr)));
      }
      else {
        return (index.h("div", { class: "vega-input-select-placeholder" }, this.translationSlimmer.t(this.placeholder)));
      }
    };
    this.renderSingleSelected = () => {
      var _a, _b;
      const selectedSourceItemItem = this.selectedItem;
      if (selectedSourceItemItem === null || selectedSourceItemItem === void 0 ? void 0 : selectedSourceItemItem.displayName) {
        selectedSourceItemItem.displayName = index$1.htmlSanitizer.sanitize(selectedSourceItemItem.displayName, index$1.labelSanitizeStrategy);
      }
      const selectedLabelStr = (_b = (_a = this.selectedLabel).single) === null || _b === void 0 ? void 0 : _b.call(_a, this.value, selectedSourceItemItem);
      if ((typeof this.selectedLabel == 'function' && this.selectedItem) ||
        (typeof this.selectedLabel != 'function' && selectedLabelStr)) {
        if (typeof this.selectedLabel == 'function') {
          return (index.h("span", { class: "vega-input-select-selected", part: "selected-box" },
            index.h("vega-text", { overflow: "ellipsis", tooltip: this.getSelectedLabelTooltipProps(), key: 
              // eslint-disable-next-line  @typescript-eslint/no-non-null-assertion
              selectedSourceItemItem.displayName }, 
            // eslint-disable-next-line  @typescript-eslint/no-non-null-assertion
            selectedSourceItemItem.displayName)));
        }
        else {
          return (index.h("span", { class: "vega-input-select-selected", part: "selected-box" },
            index.h("vega-text", { overflow: "ellipsis", tooltip: this.getSelectedLabelTooltipProps(), key: selectedLabelStr }, selectedLabelStr)));
        }
      }
      else {
        return (index.h("div", { class: "vega-input-select-placeholder", part: "placeholder" }, this.translationSlimmer.t(this.placeholder)));
      }
    };
    this.getVegaDropdownProperties = () => {
      const dropdownProperties = Object.assign({ searchable: true, caseSensitive: false }, this.vegaDropdownProps);
      if (this.dropdownItemTooltipProps && Object.keys(this.dropdownItemTooltipProps).length > 0) {
        dropdownProperties.itemTooltipProps = this.dropdownItemTooltipProps;
      }
      return dropdownProperties;
    };
    this.getSelectedLabelTooltipProps = () => {
      return Object.assign({ placement: 'bottom' }, this.selectedLabelTooltipProps);
    };
  }
  watchVegaDropdownProps() {
    if (this.vegaDropdownProps && this.vegaDropdownProps.preserveValueIfNotInSource !== undefined) {
      this.dropdown.preserveValueIfNotInSource = this.vegaDropdownProps.preserveValueIfNotInSource;
      this.dropdown.selectedSourceKey = this.value;
    }
  }
  show() {
    return this.dropdown.show();
  }
  hide() {
    return this.dropdown.hide();
  }
  getDropdownRef() {
    return this.dropdown;
  }
  getInputSelectContainerRef() {
    return this.inputSelectContainer;
  }
  getItemsSlotRef() {
    return this.itemsSlotRef;
  }
  render() {
    return (index.h("vega-dropdown", Object.assign({ trigger: "click", source: this.getDropdownSource(), selectType: this.selectType, selectedSourceKey: this.value, matchTargetWidth: true }, this.getVegaDropdownProperties(), { ref: (ref) => {
        this.dropdown = ref;
        this.vegaInputSelectDropdownController.addDropdownObserver(ref);
      }, isLazyLoading: this.isLazyLoading }),
      this.renderContainer(),
      this.renderItemsSlot()));
  }
  renderItemsSlot() {
    return (this.host.querySelector('[slot=items]') && (index.h("div", { slot: "items", ref: (ref) => {
        this.itemsSlotRef = ref;
      } })));
  }
  /*
   * The below method is e2e-test covered in
   * @see{module:vega-input-select-keyboard-control-e2e}
   */
  /* istanbul ignore next */
  preventBlur(e) {
    e.stopImmediatePropagation();
  }
  getDropdownSource() {
    return this.source.map((item) => ({
      key: item.id,
      label: item.displayName,
    }));
  }
}
(() => {
  internalIconManager.VegaInternalIconManager.register({
    'chevron-up': chevronUp.chevronUp,
    'chevron-down': chevronDown.chevronDown,
  });
})();
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "value", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "source", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "host", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "selectType", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "isDropdownShow", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "vegaDropdownProps", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "placeholder", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "selectedLabel", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "isLazyLoading", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "vegaInputSelectDropdownController", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "vegaInputSelectPrefixIconRenderer", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "translationSlimmer", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "disabled", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "selectedItem", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "selectedLabelTooltipProps", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectDropdownRenderer.prototype, "dropdownItemTooltipProps", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentMethod('watchVegaDropdownProps')
], VegaInputSelectDropdownRenderer.prototype, "watchVegaDropdownProps", null);

var __decorate$4 = (undefined && undefined.__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;
};
/**
 * VegaInputSelectLazyLoadController
 */
class VegaInputSelectLazyLoadController extends globalSlimmerRegistry.VegaSlimmer {
  constructor() {
    super(...arguments);
    this.hasMore = true;
  }
  /**
   * Observer scroll to bottom on vegaVirtualScroll
   */
  componentDidLoad() {
    const virtualScroll = this.getVirtualScroll();
    if (virtualScroll) {
      domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(virtualScroll, vegaInternalEventId.VegaInternalVirtualScrollToBottom, this.onScrollToBottom.bind(this));
    }
  }
  /* istanbul ignore next */
  /**
   * Get virtualScroll
   *
   * @returns {Nullable<HTMLElement>} - virtualScroll
   */
  getVirtualScroll() {
    var _a, _b, _c;
    return (_c = (_b = (_a = this.vegaInputSelectDropdownRenderer
      .getDropdownRef()
      .shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('vega-dropdown-content-box')) === null || _b === void 0 ? void 0 : _b.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('vega-virtual-scroll');
  }
  /**
   * The function `onScrollToBottom` logs a message and emits an event if lazy loading is enabled.
   *
   * @param {VegaVirtualScrollToBottomEvent} payload - payload
   */
  async onScrollToBottom(payload) {
    if (this.sourceLazyLoadCallback && this.hasMore) {
      this.isLazyLoading = true;
      const response = await this.sourceLazyLoadCallback(payload.endIndex);
      this.hasMore = response.hasMore;
      if (response.items.length > 0) {
        this.sourceController.appendSourceItems(response.items);
      }
      this.isLazyLoading = false;
    }
  }
}
__decorate$4([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectLazyLoadController.prototype, "sourceLazyLoadCallback", void 0);
__decorate$4([
  globalSlimmerRegistry.MapToComponentField({ writable: true })
], VegaInputSelectLazyLoadController.prototype, "isLazyLoading", void 0);
__decorate$4([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectLazyLoadController.prototype, "sourceController", void 0);
__decorate$4([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectLazyLoadController.prototype, "vegaInputSelectDropdownRenderer", void 0);
__decorate$4([
  globalSlimmerRegistry.MapToComponentMethod('componentDidLoad')
], VegaInputSelectLazyLoadController.prototype, "componentDidLoad", null);

const VegaInputSelectRuntimeMetricsPayloadDefinition = [
  {
    payloadKey: 'AUTO_VALIDATION_IS_TRUE',
    payloadDescription: "Specifies whether the system should automatically carry out validation checks on the user's selection in real-time, ensuring that the input adheres to predefined criteria before submission or proceeding further",
    /**
     * The function checks if the `autoValidation` property of the `host` element is equal to 'true'.
     * If it is, the function will return `true`.
     *
     * @param {HTMLElement} host - The element to check
     * @returns {boolean} A boolean value
     */
    payloadValue: (host) => host.autoValidation === true,
  },
  {
    payloadKey: 'AUTO_VALIDATION_IS_FALSE',
    payloadDescription: "Specifies whether the system should automatically carry out validation checks on the user's selection in real-time, ensuring that the input adheres to predefined criteria before submission or proceeding further",
    /**
     * The function checks if the `autoValidation` property of the `host` element is equal to 'false'.
     * If it is, the function will return `true`.
     *
     * @param {HTMLElement} host - The element to check
     * @returns {boolean} A boolean value
     */
    payloadValue: (host) => host.autoValidation === false,
  },
  {
    payloadKey: 'IS_USING_TEMPLATE',
    payloadDescription: 'Contains the data records to be rendered and displayed within the input select',
    /**
     * The function checks if the length `source` property of the `host` element is equal to '0'.
     * If it is, the function will return `true`.
     *
     * @param {HTMLElement} host - The element to check
     * @returns {boolean} A boolean value
     */
    payloadValue: (host) => host.source.length === 0,
  },
  {
    payloadKey: 'IS_USING_DATA_SOURCE',
    payloadDescription: 'Contains the data records to be rendered and displayed within the input select',
    /**
     * The function checks if the length `source` property of the `host` element is greater than to '0'.
     * If it is, the function will return `true`.
     *
     * @param {HTMLElement} host - The element to check
     * @returns {boolean} A boolean value
     */
    payloadValue: (host) => host.source.length > 0,
  },
];

var __decorate$3 = (undefined && undefined.__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;
};
/**
 * The `VegaInputSelectSourceController` class manages the source data for
 * a dropdown input component in TypeScript.
 */
class VegaInputSelectSourceController extends globalSlimmerRegistry.VegaSlimmer {
  constructor() {
    super(...arguments);
    /**
     * convert the dropdown source when the component watchSource call
     */
    this.handleSourceChange = () => {
      this.host.dataset.source = JSON.stringify(this.source);
      this.source = typeGuard.isArrayOfType(this.source, typeGuard.isSelectSourceItemType) ? this.source : [];
      this.vegaInputSelectItemController.setSelectedItem();
    };
  }
  /**
   * Append items to source
   *
   * @param {SelectSourceItem[]} items - Appendable items
   */
  appendSourceItems(items) {
    this.source = [...this.source, ...items];
  }
  /**
   * This TypeScript function retrieves an item from a source array based on its ID.
   *
   * @param {SelectValueType<SelectType>} id - The `id` parameter in the `getItem` function is of type `SelectValueType<SelectType>`,
   * which means it can accept a value that corresponds to the `SelectType` defined in the function.
   * @returns { Nullable<SelectSourceItem>} The `getItem` function is returning a `SelectSourceItem` object that matches the provided
   * `id`, or `null` if no matching item is found in the `source` array.
   */
  getItem(id) {
    return this.source.find((item) => item.id === id);
  }
}
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectSourceController.prototype, "host", void 0);
__decorate$3([
  globalSlimmerRegistry.MapToComponentField({ writable: true })
], VegaInputSelectSourceController.prototype, "source", void 0);
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectSourceController.prototype, "vegaInputSelectItemController", void 0);
__decorate$3([
  globalSlimmerRegistry.MapToComponentMethod('watchSource')
], VegaInputSelectSourceController.prototype, "handleSourceChange", void 0);

var __decorate$2 = (undefined && undefined.__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;
};
/**
 * The class `VegaInputSelectItemsSlotController` extends `VegaSlimmer` and manages
 * appending host items to a dropdown element.
 */
class VegaInputSelectItemsSlotController extends globalSlimmerRegistry.VegaSlimmer {
  constructor() {
    super(...arguments);
    this.mutationObserver = new mutationObserverSlimmer.MutationObserverSlimmer({
      mutationFilter: mutationObserverFilters.TagNameMutationFilter('VEGA-DROPDOWN-ITEM'),
      options: {
        childList: true,
        subtree: true,
      },
      callback: 
      /*
       * The below method is e2e-test covered in
       * @see{module:vega-input-select-template-slot-change-e2e}
       */
      /* istanbul ignore next */
      // eslint-disable-next-line jsdoc/require-jsdoc
      () => this.appendHostItemsToDropdown(),
    });
  }
  /**
   * Component lifecycle - [componentDidLoad]
   */
  componentDidLoad() {
    this.appendHostItemsToDropdown();
  }
  /**
   * The function appends host items to a dropdown element.
   */
  appendHostItemsToDropdown() {
    const items = this.host.querySelector('[slot=items]');
    const itemsSlotRef = this.vegaInputSelectDropdownRenderer.getItemsSlotRef();
    if (items && itemsSlotRef) {
      itemsSlotRef.remove();
      this.vegaInputSelectDropdownRenderer.getDropdownRef().append(items);
    }
  }
}
__decorate$2([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelectItemsSlotController.prototype, "mutationObserver", void 0);
__decorate$2([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectItemsSlotController.prototype, "host", void 0);
__decorate$2([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectItemsSlotController.prototype, "vegaInputSelectDropdownRenderer", void 0);
__decorate$2([
  globalSlimmerRegistry.MapToComponentMethod('componentDidLoad')
], VegaInputSelectItemsSlotController.prototype, "componentDidLoad", null);

var __decorate$1 = (undefined && undefined.__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;
};
/** Manager remote invocation */
class VegaInputSelectPrefixIconRenderer extends globalSlimmerRegistry.VegaSlimmer {
  /**
   * Component lifecycle - connectedCallback
   */
  connectedCallback() {
    this.remotePhoneNumberPrefixIconRenderSubject =
      domNodeSubjectObserverFactory.domNodeSubjectFactory.getSubjectFromParentNodeByEventId(this.host, vegaInternalEventId.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.remoteInvocationRegistry.call(this.remotePhoneNumberPrefixIconRenderSubject, ...args);
      if (renderResult)
        return renderResult;
    }
    return null;
  }
  render() {
    const renderResult = this.callRemotePrefixIconRender(this.prefixIcon);
    return (this.prefixIcon && (index.h("div", { class: "vega-input-select-prefix-icon" }, renderResult ? (renderResult) : (index.h("vega-icon", { icon: this.prefixIcon, size: "size-16" })))));
  }
}
__decorate$1([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectPrefixIconRenderer.prototype, "host", void 0);
__decorate$1([
  globalSlimmerRegistry.MapToComponentField()
], VegaInputSelectPrefixIconRenderer.prototype, "prefixIcon", void 0);
__decorate$1([
  globalSlimmerRegistry.MapToComponentMethod('connectedCallback')
], VegaInputSelectPrefixIconRenderer.prototype, "connectedCallback", null);

/**
 * A rule that checks if the value exists in the source or not
 *
 * @augments {InternalFormFieldValidationRule<SelectValueType<SelectType>>}
 */
class InputSelectValueInSourceRule extends internalFormFieldValidationRule_abstract.InternalFormFieldValidationRule {
  /**
   * It creates a new instance of the class with the given config.
   *
   * @param {() => SelectSourceItem[]} inputSelectSourceGetter - The input select source getter function
   */
  constructor(inputSelectSourceGetter) {
    super();
    this.inputSelectSourceGetter = inputSelectSourceGetter;
    /**
     * Generate an invalid result
     *
     * @param {string} message Error message
     * @returns {EvaluateResultTranslation} invalid validation result
     */
    this.invalidResult = (message) => ({
      isValid: false,
      message,
    });
    /**
     * Generate a valid result
     *
     * @returns {EvaluateResultTranslation} invalid validation result
     */
    this.validResult = () => ({
      isValid: true,
      message: '',
    });
  }
  /**
   * If the input is accepted and the status is not disabled and visible, then return true
   *
   * @param {unknown} input - The input to be evaluated.
   * @param {FormFieldStatusMeta} [status] - FormFieldStatusMeta
   * @returns {boolean} A boolean value.
   */
  canEvaluate(input, status) {
    return status
      ? this.isAcceptedInputType(input) && !status.disabled && status.visible
      : this.isAcceptedInputType(input);
  }
  /**
   * check if the value exists in the source
   *
   * @param {SelectValueType<SelectType>} input - The input to be evaluated.
   * @returns {EvaluateResultTranslation} - The result of the evaluation.
   */
  evaluate(input) {
    if (typeof input === 'string' &&
      !this.inputSelectSourceGetter().find((item) => item.id === input)) {
      return this.invalidResult(`The value does not exist in the source`);
    }
    else if (Array.isArray(input) &&
      !input.every((value) => this.inputSelectSourceGetter().find((item) => item.id === value))) {
      return this.invalidResult(`There are values that do not exist in the source`);
    }
    return this.validResult();
  }
  /**
   * If the field is not disabled, visible, and has been touched or modified, then show the error
   *
   * @param {FormFieldStatusMeta} status - FormFieldStatusMeta
   * @returns {boolean} A boolean value.
   */
  shouldShowError(status) {
    return !status.disabled && status.visible && (status.touched || status.modified);
  }
  /**
   * It returns true if the input is a string or an array of two strings, and each string is a valid string
   *
   * @param {unknown} input - The input value to be validated.
   * @returns {boolean} A boolean value.
   */
  isAcceptedInputType(input) {
    return ((typeof input === 'string' ||
      (Array.isArray(input) && input.every((item) => typeof item === 'string'))) &&
      input.length > 0);
  }
}

const vegaInputSelectCss = ":host{display:inline-block;width:100%;min-width:0px;text-align:left;line-height:normal}:host(.default) .vega-input-select-container{padding-left:16px;padding-right:16px;padding-top:12px;padding-bottom:12px}:host(.small) .vega-input-select-container{padding-left:12px;padding-right:12px;padding-top:8px;padding-bottom:8px}vega-field-label{margin-bottom:8px}:host .vega-input-select-container{border:1px solid rgba(var(--v-border-input-field, 171, 198, 216, 1));background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));border-radius:8px;gap:8px;display:block;display:flex;align-items:center;cursor:pointer}:host .vega-input-select-container:hover{border:1px solid rgba(var(--v-border-input-field-hover, 115, 160, 190, 1))}:host .vega-input-select-container:focus{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-focus, 19, 98, 226, 1))}:host .error .vega-input-select-container{border:1px solid rgba(var(--v-border-input-field-danger, 230, 50, 87, 1))}:host .error .vega-input-select-container:hover{border:1px solid rgba(var(--v-border-input-field-danger-hover, 255, 87, 114, 1))}:host .error .vega-input-select-container:focus{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-danger-focus, 233, 71, 104, 1))}:host(.vega-input-select-disabled) vega-dropdown{pointer-events:none}:host(.vega-input-select-disabled) .vega-input-select-container{border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1));background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));--tw-shadow:0 0 #0000;box-shadow:rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px}:host(.vega-input-select-disabled) .vega-input-select-container:hover{border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}:host(.vega-input-select-disabled) vega-icon{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}:host .vega-input-select-select-container{flex-grow:1;min-width:0px}:host .vega-input-select-selected{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px;color:rgba(var(--v-text-primary, 32, 54, 69, 1));display:block;min-height:24px}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-input-select-selected{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-input-select-selected{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-input-select-selected{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}:host(.vega-input-select-disabled) .vega-input-select-selected{color:rgba(var(--v-text-input-disabled, 107, 116, 125, 1))}:host .vega-input-select-placeholder{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px;color:rgba(var(--v-text-input-placeholder, 176, 180, 181, 1));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-height:24px}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-input-select-placeholder{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-input-select-placeholder{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-input-select-placeholder{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}:host .vega-input-select-prefix-icon{text-align:center;color:rgba(var(--v-text-secondary, 107, 116, 125, 1));font-size:0px}:host .vega-input-select-toggle-icon{width:16px;height:16px;color:rgba(var(--v-text-link, 19, 98, 226, 1))}:host .vega-error{display:inline-block;padding-left:8px;padding-right:8px;padding-top:12px;font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .vega-hidden{display:none}:host .vega-input-select-hint{padding-left:8px;padding-right:8px;padding-top:12px;font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-secondary, 107, 116, 125, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-input-select-hint{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-input-select-hint{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-input-select-hint{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host vega-dropdown{display:block}";

var __decorate = (undefined && undefined.__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;
};
const VegaInputSelect = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.vegaChange = index.createEvent(this, "vegaChange", 7);
    this.change = index.createEvent(this, "change", 7);
    this.vegaSearch = index.createEvent(this, "vegaSearch", 7);
    this.search = index.createEvent(this, "search", 7);
    this.vegaSearchTrigger = index.createEvent(this, "vegaSearchTrigger", 7);
    this.searchTrigger = index.createEvent(this, "searchTrigger", 7);
    this.vegaShow = index.createEvent(this, "vegaShow", 7);
    this.vegaHide = index.createEvent(this, "vegaHide", 7);
    this.vegaLabelButtonClick = index.createEvent(this, "vegaLabelButtonClick", 7);
    this.labelButtonClick = index.createEvent(this, "labelButtonClick", 7);
    this.globalSlimmers = {};
    this.translationSlimmer = new translationSlimmer.TranslationSlimmer();
    this.sourceController = new VegaInputSelectSourceController();
    this.vegaInputSelectRenderer = new VegaInputSelectRenderer();
    this.vegaInputSelectPrefixIconRenderer = new VegaInputSelectPrefixIconRenderer();
    this.vegaInputSelectDropdownController = new VegaInputSelectDropdownController();
    this.vegaInputSelectValueController = new VegaInputSelectValueController();
    this.vegaInputSelectDropdownRenderer = new VegaInputSelectDropdownRenderer();
    this.vegaInputSelectItemsSlotController = new VegaInputSelectItemsSlotController();
    this.vegaInputSelectItemController = new VegaInputSelectItemController();
    this.formFieldControllerSlimmer = new formFieldControllerSlimmer.FormFieldControllerSlimmer({
      propertyRules: [
        {
          propertyName: 'required',
          ruleFactory: (isRequired) => (isRequired ? new requiredFieldRule.RequiredFieldRule() : null),
        },
        {
          propertyName: 'data-source',
          ruleFactory: () => {
            return new InputSelectValueInSourceRule(() => this.source);
          },
        },
      ],
      validationRulesName: 'validationRules',
      defaultValue: (target) => (target.selectType === 'multiple' ? [] : ''),
      attributeGetter: (propertyName) => this[propertyName],
      inputContainerGetter: () => this.vegaInputSelectDropdownRenderer.getDropdownRef(),
      touchableAreaGetter: () => [this.vegaInputSelectDropdownRenderer.getInputSelectContainerRef()],
    });
    this.pageResizeObserverSlimmer = new pageResizeObserverSlimmer.PageResizeObserverSlimmer();
    this.lazyLoadController = new VegaInputSelectLazyLoadController();
    this.changeEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaInputSelect, vegaEventId.VegaChange);
    this.searchEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaInputSelect, vegaEventId.VegaSearch);
    this.searchTriggerEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaInputSelect, vegaEventId.VegaSearchTrigger);
    this.showEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaInputSelect, vegaEventId.VegaShow);
    this.hideEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaInputSelect, vegaEventId.VegaHide);
    this.labelButtonClickEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaInputSelect, vegaEventId.VegaLabelButtonClick);
    this.eventPrevent = new childNodesEventPreventSlimmer.ChildNodesEventPreventSlimmer([vegaEventId.VegaSearch, vegaEventId.VegaSearchTrigger, vegaEventId.VegaShow, vegaEventId.VegaHide], () => this.host, true);
    this.vegaComponentUsageRuntimeMetricsSlimmer = new componentUsageRuntimeMetrics.VegaComponentUsageRuntimeMetricsSlimmer(VegaInputSelectRuntimeMetricsPayloadDefinition);
    this.isDropdownShow = false;
    this.currentBreakpoint = breakpoints.getCurrentBreakpoint();
    this.isLazyLoading = false;
    /**
     * Specifies the label or title for the input field.
     *
     * It provides descriptive text that helps identify the purpose or
     *    content expected in the input select field.
     *
     * @vegaVersion 1.3.0
     */
    this.label = '';
    /**
     * Specifies the properties for the suffix button associated with the input.
     *
     * It provides essential information and functionality
     *  related to the suffix button's role and behavior.
     *
     * @vegaVersion 2.68.0
     */
    this.labelSuffixButtonConfig = null;
    /**
     * Determines whether the input select field is required.
     *
     * @vegaVersion 1.0.7
     */
    this.required = false;
    /**
     * Allows customization of the text displayed within the
     *    select field when single or multiple items are selected.
     *    The default format for the selected label is
     *    `{0} Selected` for multiple mode only.
     *
     *	To enable all modes, use the `SelectedLabelTypeForAllModes` type.
     * 		For single mode, the default format is the `displayName` of the selected item if not set
     * 		For multiple mode, the default format is `{0} Selected` if not set
     *
     * @vegaVersion 1.35.0
     */
    this.selectedLabel = (value) => internalTranslationController.VegaInternalTranslation.t(`{0} Selected`, value.length);
    /**
     * Controls the selection capabilities of the associated dropdown menu.
     *
     * @vegaVersion 1.35.0
     */
    this.selectType = 'single';
    /**
     * Specifies the dataset used to populate the options
     *    available in the select input dropdown menu.
     *
     * @vegaVersion 1.0.7
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.source = [];
    /**
     * Specifies the ID of the item selected from the source data
     *    in the dropdown menu.
     *
     * The ID should be unique within the source collection to
     *    correctly associate the chosen option with its
     *    corresponding data entry.
     *
     * @vegaVersion 1.0.7
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.value = this.selectType === 'multiple' ? [] : '';
    /**
     * Indicates the current validation status of the user's selection
     *    from the dropdown menu.
     *
     * @vegaVersion 1.3.0
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.isValid = null;
    /**
     * Specifies whether the system should automatically carry out
     *    validation checks on the user's selection in real-time,
     *    ensuring that the input adheres to predefined criteria before
     *    submission or proceeding further.
     *
     * @vegaVersion 1.0.11
     */
    this.autoValidation = true;
    /**
     * Allows setting custom criteria or constraints that
     *    the user's selection in the dropdown menu must
     *    comply with.
     *
     * @vegaVersion 1.0.11
     */
    this.validationRules = [];
    /**
     * Specifies whether the input select field is disabled.
     *
     * @vegaVersion 1.3.0
     */
    this.disabled = false;
    /**
     * Specifies a placeholder string that displays as a temporary hint or
     *    example inside the input select field.
     *
     * It indicates the expected format or pattern of the input.
     *
     * @vegaVersion 1.0.7
     */
    this.placeholder = 'Please select';
    /**
     * Provides partial properties for the `vega-dropdown` component used
     *    in the input select element.
     *
     * You can specify custom properties and their corresponding values as needed.
     *
     * @vegaVersion 1.3.0
     */
    this.vegaDropdownProps = {};
    /**
     * Provides tooltip configuration for the selected label text.
     *
     * Use this to control tooltip placement, width, and other display properties.
     *
     * @vegaVersion 2.82.0
     */
    this.selectedLabelTooltipProps = {};
    /**
     * Provides tooltip configuration for dropdown items.
     *
     * Use this to control tooltip placement and width for long item labels.
     *
     * @vegaVersion 2.82.0
     */
    this.dropdownItemTooltipProps = {};
    /**
     * Defines the size of the input select field.
     *
     * @vegaVersion 1.18.0
     */
    this.size = 'default';
  }
  watchSelectType() {
  }
  watchSource() {
  }
  watchValue(newValue, oldValue) {
  }
  watchValidationRules() {
  }
  watchVegaDropdownProps() {
  }
  watchSelectedLabelTooltipProps() {
  }
  watchDropdownItemTooltipProps() {
  }
  componentWillLoad() {
  }
  /**
   * Invoke this method to close the select dropdown and clear
   *    the dropdown element reference.
   *
   * @vegaVersion 1.0.7
   */
  async doClose() {
    await this.vegaInputSelectDropdownRenderer.hide();
  }
  /**
   * Invoke this method to open the select dropdown.
   *
   * @vegaVersion 1.0.7
   */
  async doOpen() {
    await this.vegaInputSelectDropdownRenderer.show();
  }
  /**
   * Invoke this method to change the ID of the select source item.
   *
   * @vegaVersion 1.0.7
   */
  async doChange(value) {
    this.vegaInputSelectValueController.setValue(value);
  }
  render() {
    return component.sanitizeVegaComponent(this.vegaInputSelectRenderer.render(), this.host);
  }
  get host() { return index.getElement(this); }
  static get watchers() { return {
    "selectType": ["watchSelectType"],
    "source": ["watchSource"],
    "value": ["watchValue"],
    "validationRules": ["watchValidationRules"],
    "vegaDropdownProps": ["watchVegaDropdownProps"],
    "selectedLabelTooltipProps": ["watchSelectedLabelTooltipProps"],
    "dropdownItemTooltipProps": ["watchDropdownItemTooltipProps"]
  }; }
};
__decorate([
  componentUsageRuntimeMetrics.InjectVegaGlobalSlimmer()
], VegaInputSelect.prototype, "globalSlimmers", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "translationSlimmer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "sourceController", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "vegaInputSelectRenderer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "vegaInputSelectPrefixIconRenderer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "vegaInputSelectDropdownController", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "vegaInputSelectValueController", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "vegaInputSelectDropdownRenderer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "vegaInputSelectItemsSlotController", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "vegaInputSelectItemController", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "formFieldControllerSlimmer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "pageResizeObserverSlimmer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "lazyLoadController", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "changeEventEmitter", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "searchEventEmitter", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "searchTriggerEventEmitter", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "showEventEmitter", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "hideEventEmitter", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "labelButtonClickEventEmitter", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "eventPrevent", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaInputSelect.prototype, "vegaComponentUsageRuntimeMetricsSlimmer", void 0);
VegaInputSelect.style = vegaInputSelectCss;

exports.vega_input_select = VegaInputSelect;
