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 { Component, Element, Host, Prop, Watch, h, Event } from '@stencil/core';
import { sanitizeVegaComponent } from '../../utils/component';
import { InjectVegaGlobalSlimmer, InjectVegaSlimmer, methodPlaceholder, } from 'vega-slimmer/core';
import { VegaInputRangeRenderer } from './slimmers/renderers/vega-input-range-renderer';
import { createEventEmitSlimmer, } from '../../helpers/event-manager/slimmers/event-emit-slimmer';
import { VegaChange } from '../../helpers/event-manager/event-id/vega-event-id';
import { FormFieldControllerSlimmer } from '../../helpers/slimmers/form-field-controller-slimmer';
import { VegaInputRangeValueController } from './slimmers/controllers/vega-input-range-value-controller';
import { VegaInputRangeInputRenderer } from './slimmers/renderers/vega-input-range-input-renderer';
import { ChildNodesEventPreventSlimmer } from '../../helpers/event-manager/slimmers/child-nodes-event-prevent-slimmer';
import { InputRangeRequiredRule } from '../../helpers/validator/rules/input-range-required-rule';
import { InputRangeMinAndMaxRule } from '../../helpers/validator/rules/input-range-min-and-max-rule';
import { VegaInputRangeClearIconRenderer } from './slimmers/renderers/vega-input-range-clear-icon-renderer';
import { VegaComponentUsageRuntimeMetricsSlimmer } from '../../helpers/slimmers/component-usage-runtime-metrics';
import { TranslationSlimmer } from '../../helpers/slimmers/translation';
/**
 * @vegaVersion 2.2.0
 */
export class VegaInputRange {
  constructor() {
    this.globalSlimmers = {};
    this.translationSlimmer = new TranslationSlimmer();
    this.formFieldController = new FormFieldControllerSlimmer({
      propertyRules: [
        {
          propertyName: 'required',
          ruleFactory: (isRequired) => (isRequired ? new InputRangeRequiredRule() : null),
        },
        {
          propertyName: 'min',
          ruleFactory: (min, max) => new InputRangeMinAndMaxRule({ minValue: min, maxValue: max }),
          dependence: 'max',
        },
        {
          propertyName: 'max',
          ruleFactory: (max, min) => new InputRangeMinAndMaxRule({ minValue: min, maxValue: max }),
          dependence: 'min',
        },
      ],
      validationRulesName: 'validationRules',
      defaultValue: ['', ''],
      attributeGetter: (propertyName) => this[propertyName],
      inputContainerGetter: () => this.inputRangeRenderer.getInputRangeContainerRef(),
      touchableAreaGetter: () => [
        this.inputRangeInputRenderer.getInputRefByIndex(0),
        this.inputRangeInputRenderer.getInputRefByIndex(1),
      ],
    });
    this.inputRangeInputRenderer = new VegaInputRangeInputRenderer();
    this.clearIconRenderer = new VegaInputRangeClearIconRenderer();
    this.inputRangeRenderer = new VegaInputRangeRenderer();
    this.valueController = new VegaInputRangeValueController();
    this.inputChangeEventPrevent = new ChildNodesEventPreventSlimmer([VegaChange], () => this.inputRangeRenderer.getInputRangeContainerRef());
    this.changeEventEmitter = createEventEmitSlimmer(VegaInputRange, VegaChange);
    this.vegaComponentUsageRuntimeMetricsSlimmer = new VegaComponentUsageRuntimeMetricsSlimmer();
    /**
     * Specifies the label or title for the input range.
     *
     * It provides descriptive text that helps identify the
     *    purpose or content expected in the input field.
     *
     * @vegaVersion 2.2.0
     */
    this.label = '';
    /**
     * Represents a pre-set or default value for the input field.
     *
     * It allows you to initialize the field with a specific value,
     *    which is displayed to the user when the input is
     *    initially rendered.
     *
     * If the value is too long, it may be truncated with
     *    an ellipsis for visual presentation.
     *
     * @vegaVersion 2.2.0
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.value = ['', ''];
    /**
     * Determines whether the clear icon should be displayed.
     *
     * @vegaVersion 2.2.0
     */
    this.showClearIcon = true;
    /**
     * Sets the minimum allowable numeric value for the input value.
     *
     * @vegaVersion 2.2.0
     */
    this.min = null;
    /**
     * Sets the maximum allowable numeric value for the input value.
     *
     * @vegaVersion 2.2.0
     */
    this.max = null;
    /**
     * Determines whether the input range is required.
     *
     * @vegaVersion 2.2.0
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.required = false;
    /**
     * Indicates whether the current value in the field is considered valid
     *    based on the defined validation rules.
     *
     * @vegaVersion 2.2.0
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.isValid = null;
    /**
     * Determines whether the input field should undergo automatic validation
     *    during the user's input.
     *
     * @vegaVersion 2.2.0
     */
    this.autoValidation = true;
    /**
     * Defines custom validation rules for the input field.
     *
     * @vegaVersion 2.2.0
     */
    this.validationRules = [];
    /**
     * Defines the size of the input range,
     *    specifying its width or length.
     *
     * @vegaVersion 2.2.0
     */
    this.size = 'default';
    /**
     * Specifies a placeholder string that displays as a temporary hint
     *    or example inside the input field.
     *
     * It indicates the expected format or pattern of the input.
     *
     * @vegaVersion 2.2.0
     */
    this.placeholder = ['Minimum', 'Maximum'];
    /**
     * Determines whether the input range is disabled.
     *
     * @vegaVersion 2.2.0
     */
    this.disabled = false;
    /**
     * Provides a supplementary prompt message that assists users in
     *    understanding the expected value for the input field.
     *
     * @vegaVersion 2.2.0
     */
    this.hint = '';
    /**
     * Determines the arrangement and appearance of
     *    the label and input areas.
     *
     * @vegaVersion 2.2.0
     */
    this.stack = 'vertical';
  }
  /**
   * The input range component is embedded in other components.
   *
   * If modifying the input value does not meet the requirements
   *    of other components, such as limiting the maximum value, etc.,
   *    you need to modify the value of the input range component and
   *    display it in real time.
   *
   * Since the value of `inputRef` retains the old value,
   *    it needs to be updated manually when a value changes.
   *
   * @param {InputRangeValueType} newValue - The `newValue` parameter represents the new value of the input range.
   * @param {InputRangeValueType} oldValue - The `oldValue` parameter represents the previous value of the input range before it was changed to the `newValue`.
   */
  watchValue(newValue, oldValue) {
    methodPlaceholder(newValue, oldValue);
  }
  watchValidationRules() {
    methodPlaceholder();
  }
  render() {
    return sanitizeVegaComponent(h(Host, { class: { disabled: this.disabled } }, this.inputRangeRenderer.render()), this.host);
  }
  static get is() { return "vega-input-range"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() { return {
    "$": ["./vega-input-range.scss"]
  }; }
  static get styleUrls() { return {
    "$": ["vega-input-range.css"]
  }; }
  static get properties() { return {
    "label": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "Specifies the label or title for the input range.\n\nIt provides descriptive text that helps identify the\n   purpose or content expected in the input field."
      },
      "attribute": "label",
      "reflect": false,
      "defaultValue": "''"
    },
    "value": {
      "type": "unknown",
      "mutable": true,
      "complexType": {
        "original": "InputRangeValueType",
        "resolved": "string[]",
        "references": {
          "InputRangeValueType": {
            "location": "import",
            "path": "./types"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "Represents a pre-set or default value for the input field.\n\nIt allows you to initialize the field with a specific value,\n   which is displayed to the user when the input is\n   initially rendered.\n\nIf the value is too long, it may be truncated with\n   an ellipsis for visual presentation."
      },
      "defaultValue": "['', '']"
    },
    "prefixIcon": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "Specifies an icon or symbol that appears before the input range,\n   providing visual context or enhancing the aesthetic appearance\n   of the input."
      },
      "attribute": "prefix-icon",
      "reflect": true
    },
    "showClearIcon": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "Determines whether the clear icon should be displayed."
      },
      "attribute": "show-clear-icon",
      "reflect": false,
      "defaultValue": "true"
    },
    "min": {
      "type": "number",
      "mutable": false,
      "complexType": {
        "original": "number",
        "resolved": "number",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "Sets the minimum allowable numeric value for the input value."
      },
      "attribute": "min",
      "reflect": true,
      "defaultValue": "null"
    },
    "max": {
      "type": "number",
      "mutable": false,
      "complexType": {
        "original": "number",
        "resolved": "number",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "Sets the maximum allowable numeric value for the input value."
      },
      "attribute": "max",
      "reflect": true,
      "defaultValue": "null"
    },
    "required": {
      "type": "boolean",
      "mutable": true,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "Determines whether the input range is required."
      },
      "attribute": "required",
      "reflect": true,
      "defaultValue": "false"
    },
    "isValid": {
      "type": "boolean",
      "mutable": true,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "Indicates whether the current value in the field is considered valid\n   based on the defined validation rules."
      },
      "attribute": "is-valid",
      "reflect": true,
      "defaultValue": "null"
    },
    "autoValidation": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "Determines whether the input field should undergo automatic validation\n   during the user's input."
      },
      "attribute": "auto-validation",
      "reflect": true,
      "defaultValue": "true"
    },
    "validationRules": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "FormFieldValidationRule<unknown>[]",
        "resolved": "FormFieldValidationRule<unknown>[]",
        "references": {
          "FormFieldValidationRule": {
            "location": "import",
            "path": "../../helpers/validator/rules/form-field-validation-rule"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "Defines custom validation rules for the input field."
      },
      "defaultValue": "[]"
    },
    "size": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "'default' | 'small'",
        "resolved": "\"default\" | \"small\"",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "Defines the size of the input range,\n   specifying its width or length."
      },
      "attribute": "size",
      "reflect": false,
      "defaultValue": "'default'"
    },
    "placeholder": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "[string, string]",
        "resolved": "[string, string]",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "Specifies a placeholder string that displays as a temporary hint\n   or example inside the input field.\n\nIt indicates the expected format or pattern of the input."
      },
      "defaultValue": "['Minimum', 'Maximum']"
    },
    "disabled": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "Determines whether the input range is disabled."
      },
      "attribute": "disabled",
      "reflect": true,
      "defaultValue": "false"
    },
    "hint": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "Provides a supplementary prompt message that assists users in\n   understanding the expected value for the input field."
      },
      "attribute": "hint",
      "reflect": false,
      "defaultValue": "''"
    },
    "stack": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "InputRangeStackType",
        "resolved": "\"horizontal\" | \"vertical\"",
        "references": {
          "InputRangeStackType": {
            "location": "import",
            "path": "./types"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "Determines the arrangement and appearance of\n   the label and input areas."
      },
      "attribute": "stack",
      "reflect": false,
      "defaultValue": "'vertical'"
    }
  }; }
  static get events() { return [{
      "method": "vegaChange",
      "name": "vegaChange",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "An event emitter notifying a value change."
      },
      "complexType": {
        "original": "[number, number]",
        "resolved": "[number, number]",
        "references": {}
      }
    }, {
      "method": "change",
      "name": "change",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [{
            "name": "eventSemantics",
            "text": "namespace:native"
          }, {
            "name": "vegaVersion",
            "text": "2.2.0"
          }],
        "text": "An event emitter notifying a value change."
      },
      "complexType": {
        "original": "[number, number]",
        "resolved": "[number, number]",
        "references": {}
      }
    }]; }
  static get elementRef() { return "host"; }
  static get watchers() { return [{
      "propName": "value",
      "methodName": "watchValue"
    }, {
      "propName": "validationRules",
      "methodName": "watchValidationRules"
    }]; }
}
__decorate([
  InjectVegaGlobalSlimmer()
], VegaInputRange.prototype, "globalSlimmers", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaInputRange.prototype, "translationSlimmer", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaInputRange.prototype, "formFieldController", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaInputRange.prototype, "inputRangeInputRenderer", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaInputRange.prototype, "clearIconRenderer", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaInputRange.prototype, "inputRangeRenderer", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaInputRange.prototype, "valueController", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaInputRange.prototype, "inputChangeEventPrevent", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaInputRange.prototype, "changeEventEmitter", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaInputRange.prototype, "vegaComponentUsageRuntimeMetricsSlimmer", void 0);
