import templateOnly from '@ember/component/template-only';
import { setComponentTemplate } from '@ember/component';
import { precompileTemplate } from '@ember/template-compilation';
import { hash } from '@ember/helper';
import { and, eq } from 'ember-truth-helpers';
import argOrDefault from '../helpers/arg-or-default.js';
import castTo from '../helpers/cast-to.js';
import inlineStyles from '../helpers/inline-styles.js';
import simpleStyle from '../modifiers/simple-style.js';
import EuiFieldNumber from './eui-field-number.js';

const EuiRangeInput = setComponentTemplate(precompileTemplate(`
  {{#let
    (and (argOrDefault @isPrependProvided true) (has-block "prepend"))
    (and (argOrDefault @isAppendProvided true) (has-block "append"))
    as |hasAppend hasPrepend|
  }}
    <EuiFieldNumber
      class="euiRangeInput euiRangeInput--{{argOrDefault @side 'max'}}"
      name={{@name}}
      min={{castTo @min to="number"}}
      max={{castTo @max to="number"}}
      @step={{@step}}
      {{!@glint-expect-error}}
      @value={{if (eq @value "") "" (castTo @value to="number")}}
      @disabled={{@disabled}}
      @compressed={{@compressed}}
      @fullWidth={{@fullWidth}}
      @controlOnly={{@controlOnly}}
      @isPrependProvided={{hasAppend}}
      @isAppendProvided={{hasPrepend}}
      @isInvalid={{@isInvalid}}
      ...attributes
      {{simpleStyle
        (inlineStyles
          componentName="EuiRangeInput"
          componentArgs=(hash
            autoSize=(argOrDefault @autoSize true)
            digitTolerance=@digitTolerance
          )
        )
      }}
    >
      <:prepend as |classes|>
        {{yield classes to="prepend"}}
      </:prepend>
      <:append as |classes|>
        {{yield classes to="append"}}
      </:append>
    </EuiFieldNumber>
  {{/let}}
`, {
  strictMode: true,
  scope: () => ({
    and,
    argOrDefault,
    EuiFieldNumber,
    castTo,
    eq,
    simpleStyle,
    inlineStyles,
    hash
  })
}), templateOnly("eui-range-input", "EuiRangeInput"));

export { EuiRangeInput as default };
//# sourceMappingURL=eui-range-input.js.map
