/*!
 * KoliBri - The accessible HTML-Standard
 */
import { h, r as registerInstance, g as getElement } from './index-Brmny3Vg.js';
import { _ as __decorate } from './tslib.es6-QNbPBOk5.js';
import { c as clsx } from './clsx-COFh-Vc8.js';
import { b as watchValidator, s as setState, h as deprecatedHint } from './common-DEEjER7G.js';
import { F as FormFieldStateWrapper } from './FormFieldStateWrapper-DCXQnRBu.js';
import { I as InputIconController, a as InputContainerStateWrapperFc } from './controller-icon-ClFIXmW5.js';
import { I as InputStateWrapper } from './InputStateWrapper-DA1rfFPc.js';
import { c as createUniqueId } from './dev.utils-HhhlYW_9.js';
import { d as delegateFocus, a as delegateClick, c as createCtaRef } from './element-interaction-C5-6aPzz.js';
import { p as propagateSubmitEventToForm } from './controller-D0y9uwX0.js';
import { v as validateAutoComplete } from './auto-complete-CrQJr3SH.js';
import { v as validateReadOnly } from './read-only-DyuIPHMt.js';
import { v as validateRequired } from './required-DAsW5lI1.js';
import { v as validateSuggestions } from './suggestions-Cnn1r8zc.js';
import './access-and-short-key-CnWGdP5U.js';
import './disabled-CtaJsBT2.js';
import './hide-label-CWFMK5Iz.js';
import './label-Cg7TG_7b.js';
import './tooltip-align-DzHPWEpv.js';
import './align-ChLoh-Dq.js';
import './variant-class-name-CkfE8oGZ.js';
import './events-BhfZTW2e.js';
import './associated.controller-D55JWKjs.js';
import './bootstrap-UOb6OarC.js';
import './component-names-Dy77vq43.js';
import './i18n-B2d_exHc.js';
import './_Uint8Array-kJHDjtoP.js';
import './isArray-CcrBs4JM.js';
import './variant-quote-BMV8GZX8.js';
import './normalizers-pgU77mXp.js';
import './component-DTx6ZVqq.js';
import './component-CQaxTS4u.js';
import './bem-registry-B9CzNnO1.js';
import './component-DHo2YdSx.js';
import './controller-oT8Y98Yc.js';
import './align-floating-elements-DTTpkCAK.js';
import './tooltip-open-tracking-D3tCiiGP.js';
import './label-DPd4-fag.js';
import './base-controller-CXhqh4cR.js';
import './i18n-CaL2ODdQ.js';
import './Alert-COvq80W3.js';
import './Heading-Hh3eykel.js';
import './icons-DOGnS2Iv.js';
import './Input-Chj5JCQv.js';
import './element-focus-BQXzaLL9.js';

const inputDateTypeOptions = ['date', 'datetime-local', 'month', 'time', 'week'];
const isInputDateTypePropType = (value) => {
    return typeof value === 'string' && inputDateTypeOptions.includes(value);
};
const validateTypeInputDate = (component, value) => {
    watchValidator(component, '_type', isInputDateTypePropType, new Set(inputDateTypeOptions), value);
};

class InputDateController extends InputIconController {
    constructor(component, name, host) {
        super(component, name, host);
        this.validateIso8601 = (propName, value, afterPatch) => {
            return watchValidator(this.component, propName, (value) => value === undefined || value === null || value === '' || this.validateDateString(value), new Set(['Date', 'string{ISO-8601}']), InputDateController.tryParseToString(value, this.component._type, this.component._step), {
                hooks: {
                    afterPatch: (value) => {
                        if (typeof value === 'string' && afterPatch) {
                            afterPatch(value);
                        }
                    },
                },
            });
        };
        this.component = component;
    }
    validateAutoComplete(value) {
        validateAutoComplete(this.component, value);
    }
    validateSuggestions(value) {
        validateSuggestions(this.component, value);
    }
    static tryParseToString(value, type, step) {
        if (typeof value === 'string' || value === null) {
            return value;
        }
        if (typeof value === 'object' && value instanceof Date) {
            const formattedYear = value.getFullYear();
            const formattedMonth = String(value.getMonth() + 1).padStart(2, '0');
            const formattedDay = String(value.getDate()).padStart(2, '0');
            const formattedHours = String(value.getHours()).padStart(2, '0');
            const formattedMinutes = String(value.getMinutes()).padStart(2, '0');
            const formattedSeconds = String(value.getSeconds()).padStart(2, '0');
            const formattedDate = [formattedYear, formattedMonth, formattedDay].join('-');
            const formattedTimeWithSeconds = [formattedHours, formattedMinutes, formattedSeconds].join(':');
            switch (type) {
                case 'date':
                    return formattedDate;
                case 'datetime-local':
                    return `${formattedDate}T${formattedTimeWithSeconds}`;
                case 'month':
                    return `${formattedYear}-${formattedMonth}`;
                case 'time':
                    if (step === undefined || String(step) === '60') {
                        return `${formattedHours}:${formattedMinutes}`;
                    }
                    else {
                        return formattedTimeWithSeconds;
                    }
                case 'week':
                    return `${formattedYear}-W${this.getWeekNumberOfDate(value)}`;
            }
        }
    }
    static getWeekNumberOfDate(date) {
        const copiedDate = new Date(date);
        const nDay = (copiedDate.getDay() + 6) % 7;
        copiedDate.setDate(copiedDate.getDate() - nDay + 3);
        const n1stThursday = copiedDate.valueOf();
        copiedDate.setMonth(0, 1);
        if (copiedDate.getDay() !== 4) {
            copiedDate.setMonth(0, 1 + ((4 - copiedDate.getDay() + 7) % 7));
        }
        const dayOfYear = 1 + Math.ceil((n1stThursday - copiedDate.valueOf()) / 604800000);
        return dayOfYear.toString().padStart(2, '0');
    }
    validateDateString(value) {
        switch (this.component._type) {
            case 'date':
                return InputDateController.isoDateRegex.test(value);
            case 'datetime-local':
                return InputDateController.isoLocalDateTimeRegex.test(value);
            case 'month':
                return InputDateController.isoMonthRegex.test(value);
            case 'time':
                return InputDateController.isoTimeRegex.test(value);
            case 'week':
                return InputDateController.isoWeekRegex.test(value);
            default:
                return false;
        }
    }
    onBlur(event) {
        super.onBlur(event);
        if (!!event.target.value !== !!this.component._value) {
            this.component._value = event.target.value;
        }
    }
    validateMax(value) {
        this.validateIso8601('_max', value);
    }
    validateMin(value) {
        this.validateIso8601('_min', value);
    }
    validateOn(value) {
        setState(this.component, '_on', Object.assign(Object.assign({}, value), { onChange: (e, v) => {
                if (!!v !== !!this.component._value) {
                    this.component._value = v;
                }
                if (value === null || value === void 0 ? void 0 : value.onChange) {
                    value.onChange(e, v);
                }
            } }));
    }
    validateReadOnly(value) {
        validateReadOnly(this.component, value);
    }
    validateRequired(value) {
        validateRequired(this.component, value);
    }
    validateStep(value) {
        this.validateNumber('_step', value);
    }
    validateType(value) {
        validateTypeInputDate(this.component, value);
    }
    validateValue(value) {
        this.validateValueEx(value);
    }
    validateValueEx(value, afterPatch) {
        this.validateIso8601('_value', value, afterPatch);
        this.setFormAssociatedValue(this.component.state._value);
    }
    componentWillLoad() {
        super.componentWillLoad();
        this.validateAutoComplete(this.component._autoComplete);
        this.validateMax(this.component._max);
        this.validateMin(this.component._min);
        this.validateLabel(this.component._label);
        this.validateSuggestions(this.component._suggestions);
        this.validateOn(this.component._on);
        this.validateReadOnly(this.component._readOnly);
        this.validateRequired(this.component._required);
        this.validateStep(this.component._step);
        this.validateType(this.component._type);
        this.validateValue(this.component._value);
    }
}
InputDateController.isoDateRegex = /^\d{4}-([0]\d|1[0-2])-([0-2]\d|3[01])/;
InputDateController.isoLocalDateTimeRegex = /^\d{4}-([0]\d|1[0-2])-([0-2]\d|3[01])[T ][0-2]\d:[0-5]\d(:[0-5]\d(?:\.\d+)?)?/;
InputDateController.isoMonthRegex = /^\d{4}-([0]\d|1[0-2])/;
InputDateController.isoTimeRegex = /^[0-2]\d:[0-5]\d(:[0-5]\d(?:\.\d+)?)?/;
InputDateController.isoWeekRegex = /^\d{4}-W(?:[0-4]\d|5[0-3])$/;

const defaultStyleCss = "@charset \"UTF-8\";\n/*\n* This file defines the layer order for all CSS layers used in KoliBri.\n* The order is important as it determines the cascade priority.\n*\n* Layer order (lowest to highest priority):\n* 1. kol-a11y - Accessibility defaults and requirements\n* 2. kol-global - Global component styles and resets\n* 3. kol-component - Component-specific styles\n* 4. kol-theme-global - Theme-specific global styles\n* 5. kol-theme-component - Theme-specific component styles\n*/\n@layer kol-a11y, kol-global, kol-component, kol-theme-global, kol-theme-component;\n/* forward the rem function */\n/*\n * This file contains all rules for accessibility.\n */\n@layer kol-a11y {\n  :host {\n    /*\n                   * Minimum size of interactive elements.\n                   */\n    --a11y-min-size: calc(44 * 1rem / var(--kolibri-root-font-size, 16));\n    /*\n     * No element should be used without verifying the contrast ratio of its background and font colors.\n     * By initially setting the background color to white and the font color to black,\n     * the contrast ratio is ensured and explicit adjustment is forced.\n     */\n    color: black;\n    background-color: white;\n    /*\n     * Verdana is an accessible font that can be used without requiring additional loading time.\n     */\n    font-family: Verdana;\n    /*\n     * Letter spacing is required for all texts.\n     */\n    letter-spacing: inherit;\n    /*\n     * Word spacing is required for all texts.\n     */\n    word-spacing: inherit;\n    /*\n     * Text should be aligned left by default to provide a predictable starting point.\n     */\n    text-align: left;\n  }\n  * {\n    /*\n     * This rule enables the word dividing for all texts. That is important for high zoom levels.\n     */\n    hyphens: auto;\n    /*\n     * This rule enables the word dividing for all texts. That is important for high zoom levels.\n     */\n    word-break: break-word;\n  }\n  /*\n   * All interactive elements should have a minimum size of to-rem(44).\n   */\n  /* input:not([type='checkbox'], [type='radio'], [type='range']), */\n  /* option, */\n  /* select, */\n  /* textarea, */\n  button,\n  .kol-input .input {\n    min-width: var(--a11y-min-size);\n    min-height: var(--a11y-min-size);\n  }\n  /*\n   * Some interactive elements should not inherit the font-family and font-size.\n   */\n  a,\n  button,\n  h1,\n  h2,\n  h3,\n  h4,\n  h5,\n  h6,\n  input,\n  option,\n  select,\n  textarea {\n    /*\n     * All elements should inherit the text color from his parent element.\n     */\n    color: inherit;\n    /*\n     * All elements should inherit the font family from his parent element.\n     */\n    font-family: inherit;\n    /*\n     * All elements should inherit the font size from his parent element.\n     */\n    font-size: inherit;\n    /*\n     * Letter spacing is required for all texts.\n     */\n    letter-spacing: inherit;\n    /*\n     * Word spacing is required for all texts.\n     */\n    word-spacing: inherit;\n  }\n  /**\n  * Sometimes we need the semantic element for accessibility reasons,\n  * but we don't want to show it.\n  *\n  * - https://www.a11yproject.com/posts/how-to-hide-content/\n  */\n  .visually-hidden {\n    position: fixed;\n    top: 0;\n    left: 0;\n    width: 1px;\n    height: 1px;\n    overflow: hidden;\n    white-space: nowrap;\n    clip-path: inset(50%);\n  }\n}\n@layer kol-global {\n  /*\n   * Dieses CSS stellt sicher, dass der Standard-Style\n   * von A und Button resettet werden.\n   */\n  :is(a, button) {\n    background-color: transparent;\n    width: 100%;\n    margin: 0;\n    padding: 0;\n    border: none;\n    /* 100% needed for custom width from outside */\n  }\n  /*\n   * Ensure elements with hidden attribute to be actually not visible\n   * @see https://meowni.ca/hidden.is.a.lie.html\n   */\n  [hidden] {\n    display: none !important;\n  }\n  .badge-text-hint {\n    color: black;\n    background-color: white;\n  }\n}\n@layer kol-global {\n  :host {\n    /*\n     * The max-width is needed to prevent the table from overflowing the\n     * parent node, if the table is wider than the parent node.\n     */\n    max-width: 100%;\n    font-size: calc(16 * 1rem / var(--kolibri-root-font-size, 16));\n  }\n  * {\n    /*\n     * We prefer to box-sizing: border-box for all elements.\n     */\n    box-sizing: border-box;\n  }\n  .kol-span {\n    /* KolSpan is a layout component with icons in all directions and a label text in the middle. */\n    display: flex;\n    flex-flow: column;\n    align-items: center;\n    justify-content: center;\n    /* The sub span in KolSpan is the horizontal span with icon left and right and the label text in the middle. */\n  }\n  .kol-span__container {\n    display: flex;\n    align-items: center;\n  }\n  a,\n  button {\n    cursor: pointer;\n  }\n  .kol-span .kol-span__label--hide-label .kol-span__label {\n    display: none;\n  }\n  /* Reset browser agent style. */\n  button:disabled {\n    color: unset;\n  }\n  .disabled label,\n  .disabled:focus-within label,\n  [aria-disabled=true],\n  [aria-disabled=true]:focus,\n  [disabled],\n  [disabled]:focus {\n    outline: none;\n    cursor: not-allowed;\n  }\n  [aria-disabled=true]:focus .kol-span,\n  [disabled]:focus .kol-span {\n    outline: none !important;\n  }\n  .hastooltip {\n    z-index: 900 !important;\n  }\n}\n@layer kol-component {\n  :host {\n    display: block;\n  }\n}\n@font-face {\n  font-family: \"kolicons\";\n  src: url(\"kolicons.eot?t=1780914078349\"); /* IE9*/\n  src: url(\"kolicons.eot?t=1780914078349#iefix\") format(\"embedded-opentype\"), url(\"kolicons.woff2?t=1780914078349\") format(\"woff2\"), url(\"kolicons.woff?t=1780914078349\") format(\"woff\"), url(\"kolicons.ttf?t=1780914078349\") format(\"truetype\"), url(\"kolicons.svg?t=1780914078349#kolicons\") format(\"svg\"); /* iOS 4.1- */\n}\n@layer kol-component {\n  [class^=kolicon-], [class*=\" kolicon-\"] {\n    font-family: \"kolicons\";\n    font-style: normal;\n    font-weight: 400;\n    line-height: 1em;\n    -webkit-font-smoothing: antialiased;\n    -moz-osx-font-smoothing: grayscale;\n  }\n  .kolicon-alert-error::before {\n    content: \"\\ea01\";\n  }\n  .kolicon-alert-info::before {\n    content: \"\\ea02\";\n  }\n  .kolicon-alert-success::before {\n    content: \"\\ea03\";\n  }\n  .kolicon-alert-warning::before {\n    content: \"\\ea04\";\n  }\n  .kolicon-check::before {\n    content: \"\\ea05\";\n  }\n  .kolicon-chevron-double-left::before {\n    content: \"\\ea06\";\n  }\n  .kolicon-chevron-double-right::before {\n    content: \"\\ea07\";\n  }\n  .kolicon-chevron-down::before {\n    content: \"\\ea08\";\n  }\n  .kolicon-chevron-left::before {\n    content: \"\\ea09\";\n  }\n  .kolicon-chevron-right::before {\n    content: \"\\ea0a\";\n  }\n  .kolicon-chevron-up::before {\n    content: \"\\ea0b\";\n  }\n  .kolicon-cogwheel::before {\n    content: \"\\ea0c\";\n  }\n  .kolicon-cross::before {\n    content: \"\\ea0d\";\n  }\n  .kolicon-eye-closed::before {\n    content: \"\\ea0e\";\n  }\n  .kolicon-eye::before {\n    content: \"\\ea0f\";\n  }\n  .kolicon-house::before {\n    content: \"\\ea10\";\n  }\n  .kolicon-kolibri::before {\n    content: \"\\ea11\";\n  }\n  .kolicon-link-external::before {\n    content: \"\\ea12\";\n  }\n  .kolicon-link::before {\n    content: \"\\ea13\";\n  }\n  .kolicon-minus::before {\n    content: \"\\ea14\";\n  }\n  .kolicon-plus::before {\n    content: \"\\ea15\";\n  }\n  .kolicon-settings::before {\n    content: \"\\ea16\";\n  }\n  .kolicon-sort-asc::before {\n    content: \"\\ea17\";\n  }\n  .kolicon-sort-desc::before {\n    content: \"\\ea18\";\n  }\n  .kolicon-sort-neutral::before {\n    content: \"\\ea19\";\n  }\n  .kolicon-up::before {\n    content: \"\\ea1a\";\n  }\n  .kolicon-version::before {\n    content: \"\\ea1b\";\n  }\n}\n@layer kol-component {\n  .kol-icon {\n    color: inherit;\n    display: inline-block;\n    font-size: inherit;\n    font-weight: inherit;\n    line-height: inherit;\n  }\n  .kol-tooltip {\n    display: contents;\n  }\n  .kol-tooltip__floating {\n    opacity: 0;\n    display: none;\n    position: fixed;\n    /* Avoid layout interference - see https://floating-ui.com/docs/computePosition */\n    top: 0;\n    left: 0;\n    /* Can be used to specify the tooltip-width from the outside. Unset by default.  */\n    width: var(--kol-tooltip-width, max-content);\n    min-width: calc(8 * 1rem / var(--kolibri-root-font-size, 16));\n    max-width: 90vw;\n    max-height: 90vh;\n    animation-direction: normal;\n    /* Can be used to specify the animation duration from the outside. 250ms by default. */\n    animation-duration: var(--kolibri-tooltip-animation-duration, 250ms);\n    animation-fill-mode: forwards;\n    animation-iteration-count: 1;\n    animation-timing-function: ease-in;\n  }\n  .kol-tooltip__floating.hide {\n    animation-name: hideTooltip;\n  }\n  .kol-tooltip__floating.show {\n    animation-name: showTooltip;\n  }\n  .kol-tooltip__arrow {\n    transform: rotate(45deg);\n    color: black;\n    background-color: white;\n    position: absolute;\n    z-index: 999;\n    width: calc(10 * 1rem / var(--kolibri-root-font-size, 16));\n    height: calc(10 * 1rem / var(--kolibri-root-font-size, 16));\n  }\n  .kol-tooltip__content {\n    color: black;\n    background-color: white;\n    position: relative;\n    z-index: 1000;\n  }\n  @keyframes hideTooltip {\n    0% {\n      opacity: 1;\n    }\n    100% {\n      opacity: 0;\n      display: none;\n    }\n  }\n  @keyframes showTooltip {\n    0% {\n      opacity: 0;\n    }\n    100% {\n      opacity: 1;\n    }\n  }\n}\n@layer kol-component {\n  .kol-alert .kol-icon {\n    color: inherit;\n    display: inline-block;\n    font-size: inherit;\n    font-weight: inherit;\n    line-height: inherit;\n  }\n  .kol-alert :host {\n    display: inline-block;\n  }\n  .kol-alert .kol-button {\n    display: flex;\n    min-height: var(--a11y-min-size);\n    font-style: calc(16 * 1rem / var(--kolibri-root-font-size, 16));\n    text-decoration-line: none;\n  }\n  .kol-alert .kol-button::before {\n    /* Render zero-width character as first element to set the baseline correctly. */\n    content: \"​\";\n  }\n  .kol-alert .kol-button__text {\n    flex: 1 0 100%;\n  }\n  .kol-alert {\n    display: grid;\n  }\n  .kol-alert__container {\n    display: flex;\n    place-items: center;\n  }\n  .kol-alert__container-content {\n    flex-grow: 1;\n  }\n  .kol-alert__closer {\n    /* Visible with forced colors */\n    outline: transparent solid calc(1 * 1rem / var(--kolibri-root-font-size, 16));\n  }\n  .kol-form-field {\n    display: grid;\n  }\n  .kol-form-field:not(.kol-form-field--disabled) .kol-form-field__label {\n    cursor: pointer;\n  }\n  .kol-form-field__label-text {\n    flex-flow: row;\n    align-items: flex-start;\n    justify-content: flex-start;\n  }\n  .kol-form-field--required .kol-form-field__label-text:has(.kol-span__slot[hidden])::after,\n  .kol-form-field--required .kol-tooltip__content .kol-span__label::after {\n    content: \"*\"/\"\";\n  }\n  .kol-input-container {\n    background-color: transparent;\n    display: grid;\n    position: relative;\n    width: 100%;\n    min-width: var(--a11y-min-size);\n    min-height: var(--a11y-min-size);\n    align-items: center;\n    grid-template-columns: 1fr;\n  }\n  .kol-input-container:has(> .kol-input-container__adornment--start) {\n    grid-template-columns: auto 1fr auto;\n  }\n  .kol-input-container__container {\n    position: relative;\n    z-index: 1;\n  }\n  .kol-input-container__adornment {\n    display: flex;\n    align-items: center;\n  }\n  .kol-input-container__adornment .kol-icon {\n    display: grid;\n    min-height: var(--a11y-min-size);\n    place-items: center;\n  }\n  .kol-input {\n    background-color: transparent;\n    width: 100%;\n    min-width: var(--a11y-min-size);\n  }\n  .kol-input:focus {\n    outline: none;\n  }\n  /**\n   * Workaround for detecting focus state of the native date input's calendar icon.\n   * The `:focus-visible` pseudo class does not work on the icon itself, but only on the input element.\n   * By using the `content` property we can detect whether the icon is focused by inspecting the computed style in JS.\n   * This should be replaced once native focus detection for the icon is available.\n   */\n  :host input[type=date],\n  :host input[type=datetime-local],\n  :host input[type=month],\n  :host input[type=time],\n  :host input[type=week] {\n    content: \"native-icon-focused\";\n  }\n  :host input[type=date]:focus-visible,\n  :host input[type=datetime-local]:focus-visible,\n  :host input[type=month]:focus-visible,\n  :host input[type=time]:focus-visible,\n  :host input[type=week]:focus-visible {\n    content: \"native-icon-not-focused\";\n  }\n  .kol-input {\n    cursor: text;\n  }\n  .kol-input::-webkit-calendar-picker-indicator {\n    cursor: pointer;\n  }\n}";

const KolInputDate = class {
    async getValue() {
        var _a;
        return this.ctaRef.el && this.remapValue((_a = this.ctaRef.el) === null || _a === void 0 ? void 0 : _a.value);
    }
    async focus(options) { }
    async click() { }
    async reset() {
        this.state = Object.assign(Object.assign({}, this.state), { _value: null });
        this.controller.setFormAssociatedValue('');
        if (this.ctaRef.el) {
            this.ctaRef.el.value = '';
        }
    }
    setInitialValueType(value) {
        if (value instanceof Date) {
            this._initialValueType = 'Date';
        }
        else if (typeof value === 'string') {
            this._initialValueType = 'String';
        }
        else {
            this._initialValueType = null;
        }
    }
    remapValue(newValue) {
        if (newValue === '') {
            return null;
        }
        return this._initialValueType === 'Date' ? new Date(newValue) : newValue;
    }
    getFormFieldProps() {
        return {
            state: this.state,
            class: clsx('kol-input-date', this.state._type, {
                'has-value': this.state._hasValue,
            }),
            tooltipAlign: this._tooltipAlign,
            alert: this.showAsAlert(),
        };
    }
    getInputProps() {
        return Object.assign(Object.assign({ ref: this.ctaRef, state: this.state }, this.controller.onFacade), { onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeyDown, onChange: this.onChange, onInput: this.onInput });
    }
    render() {
        return (h(FormFieldStateWrapper, Object.assign({ key: '93d465e1a82a0aaa77f65d4df492f12b2df7db9a' }, this.getFormFieldProps()), h(InputContainerStateWrapperFc, { key: 'f559bef6d0f7bba27a8b5d6727c47e0beb0d0aaa', state: this.state }, h(InputStateWrapper, Object.assign({ key: '589a1dd77b7bcb1943c7cc0ec1dae3d5269c974d' }, this.getInputProps())))));
    }
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.ctaRef = createCtaRef();
        this._initialValueType = null;
        this.onBlur = (event) => {
            this.controller.onFacade.onBlur(event);
            this.inputHasFocus = false;
        };
        this.onFocus = (event) => {
            this.controller.onFacade.onFocus(event);
            this.inputHasFocus = true;
        };
        this.onChange = (event) => {
            const newValue = event.target.value;
            const remappedValue = this.remapValue(newValue);
            this.controller.onFacade.onChange(event, remappedValue);
        };
        this.onInput = (event) => {
            const newValue = event.target.value;
            const remappedValue = this.remapValue(newValue);
            this._value = remappedValue;
            this.controller.onFacade.onInput(event, true, remappedValue);
        };
        this.isNativeCalendarIconFocused = () => {
            if (!this.ctaRef.el || typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
                return false;
            }
            const computedStyle = window.getComputedStyle(this.ctaRef.el);
            return computedStyle.content.includes('native-icon-focused');
        };
        this.onKeyDown = (event) => {
            this.controller.onFacade.onKeyDown(event);
            if ((event.code === 'Enter' || event.code === 'NumpadEnter') && !this.isNativeCalendarIconFocused()) {
                propagateSubmitEventToForm({
                    form: this.host});
            }
            if (this.state._readOnly && event.code === 'Space') {
                event.preventDefault();
            }
        };
        this._autoComplete = 'off';
        this._disabled = false;
        this._hideMsg = false;
        this._hideLabel = false;
        this._hint = '';
        this._readOnly = false;
        this._required = false;
        this._tooltipAlign = 'top';
        this._touched = false;
        this._type = 'date';
        this.state = {
            _hasValue: false,
            _hideMsg: false,
            _id: createUniqueId('input-date'),
            _label: '',
            _suggestions: [],
            _type: 'datetime-local',
        };
        this.inputHasFocus = false;
        this.controller = new InputDateController(this, 'date', this.host);
    }
    showAsAlert() {
        return Boolean(this.state._touched) && !this.inputHasFocus;
    }
    validateAccessKey(value) {
        this.controller.validateAccessKey(value);
    }
    validateAutoComplete(value) {
        this.controller.validateAutoComplete(value);
    }
    validateDisabled(value) {
        this.controller.validateDisabled(value);
    }
    validateHideMsg(value) {
        this.controller.validateHideMsg(value);
    }
    validateHideLabel(value) {
        this.controller.validateHideLabel(value);
    }
    validateHint(value) {
        this.controller.validateHint(value);
    }
    validateIcons(value) {
        this.controller.validateIcons(value);
    }
    validateLabel(value) {
        this.controller.validateLabel(value);
    }
    validateMax(value) {
        this.controller.validateMax(value);
    }
    validateMin(value) {
        this.controller.validateMin(value);
    }
    validateMsg(value) {
        this.controller.validateMsg(value);
    }
    validateName(value) {
        this.controller.validateName(value);
    }
    validateOn(value) {
        this.controller.validateOn(value);
    }
    validateReadOnly(value) {
        this.controller.validateReadOnly(value);
    }
    validateRequired(value) {
        this.controller.validateRequired(value);
    }
    validateShortKey(value) {
        this.controller.validateShortKey(value);
    }
    validateSmartButton(value) {
        this.controller.validateSmartButton(value);
    }
    validateSuggestions(value) {
        this.controller.validateSuggestions(value);
    }
    validateStep(value) {
        this.controller.validateStep(value);
    }
    validateSyncValueBySelector(value) {
        this.controller.validateSyncValueBySelector(value);
    }
    validateTouched(value) {
        this.controller.validateTouched(value);
    }
    validateType(value) {
        this.controller.validateType(value);
    }
    validateValue(value) {
        if (value instanceof Date) {
            deprecatedHint('Date type will be removed in v3. Use `Iso8601` instead.');
        }
        this.controller.validateValueEx(value);
        if (value !== undefined && value !== null) {
            this.setInitialValueType(value);
        }
    }
    validateVariant(value) {
        this.controller.validateVariant(value);
    }
    componentWillLoad() {
        if (this._value !== undefined)
            this.setInitialValueType(this._value);
        this._touched = this._touched === true;
        this.controller.componentWillLoad();
        this.state._hasValue = !!this.state._value;
        this.controller.addValueChangeListener((v) => (this.state._hasValue = !!v));
    }
    get host() { return getElement(this); }
    static get watchers() { return {
        "_accessKey": ["validateAccessKey"],
        "_autoComplete": ["validateAutoComplete"],
        "_disabled": ["validateDisabled"],
        "_hideMsg": ["validateHideMsg"],
        "_hideLabel": ["validateHideLabel"],
        "_hint": ["validateHint"],
        "_icons": ["validateIcons"],
        "_label": ["validateLabel"],
        "_max": ["validateMax"],
        "_min": ["validateMin"],
        "_msg": ["validateMsg"],
        "_name": ["validateName"],
        "_on": ["validateOn"],
        "_readOnly": ["validateReadOnly"],
        "_required": ["validateRequired"],
        "_shortKey": ["validateShortKey"],
        "_smartButton": ["validateSmartButton"],
        "_suggestions": ["validateSuggestions"],
        "_step": ["validateStep"],
        "_syncValueBySelector": ["validateSyncValueBySelector"],
        "_touched": ["validateTouched"],
        "_type": ["validateType"],
        "_value": ["validateValue"],
        "_variant": ["validateVariant"]
    }; }
};
__decorate([
    delegateFocus('ctaRef')
], KolInputDate.prototype, "focus", null);
__decorate([
    delegateClick('ctaRef')
], KolInputDate.prototype, "click", null);
KolInputDate.style = {
    default: defaultStyleCss
};

export { KolInputDate as kol_input_date };
//# sourceMappingURL=kol-input-date.entry.js.map
