import { x as c, i as p, r as m, e as f } from "./query-assigned-elements-D930kELM.mjs";
import { b as d } from "./tslib.es6-CJ7TUrOc.mjs";
import { T as x, l as $, s as b, a as C } from "./textfield-CTlapGQ5.mjs";
import { n as h } from "./property-DJzm_oB9.mjs";
import { i as g } from "./query-CDOd1Kwm.mjs";
import { o as y } from "./class-map-DPUylGZM.mjs";
import { l as s } from "./if-defined-DGrxuPYz.mjs";
/**
 * @license
 * Copyright 2019 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
const v = {
  fromAttribute(e) {
    return e === null ? !1 : e === "" ? !0 : e;
  },
  toAttribute(e) {
    return typeof e == "boolean" ? e ? "" : null : e;
  }
};
class a extends x {
  constructor() {
    super(...arguments), this.rows = 2, this.cols = 20, this.charCounter = !1;
  }
  /** @soyTemplate */
  render() {
    const r = this.charCounter && this.maxLength !== -1, n = r && this.charCounter === "internal", i = r && !n, t = !!this.helper || !!this.validationMessage || i, l = {
      "mdc-text-field--disabled": this.disabled,
      "mdc-text-field--no-label": !this.label,
      "mdc-text-field--filled": !this.outlined,
      "mdc-text-field--outlined": this.outlined,
      "mdc-text-field--end-aligned": this.endAligned,
      "mdc-text-field--with-internal-counter": n
    };
    return c`
      <label class="mdc-text-field mdc-text-field--textarea ${y(l)}">
        ${this.renderRipple()}
        ${this.outlined ? this.renderOutline() : this.renderLabel()}
        ${this.renderInput()}
        ${this.renderCharCounter(n)}
        ${this.renderLineRipple()}
      </label>
      ${this.renderHelperText(t, i)}
    `;
  }
  /** @soyTemplate */
  renderInput() {
    const r = this.label ? "label" : void 0, n = this.minLength === -1 ? void 0 : this.minLength, i = this.maxLength === -1 ? void 0 : this.maxLength, t = this.autocapitalize ? this.autocapitalize : void 0;
    return c`
      <textarea
          aria-labelledby=${s(r)}
          class="mdc-text-field__input"
          .value="${$(this.value)}"
          rows="${this.rows}"
          cols="${this.cols}"
          ?disabled="${this.disabled}"
          placeholder="${this.placeholder}"
          ?required="${this.required}"
          ?readonly="${this.readOnly}"
          minlength="${s(n)}"
          maxlength="${s(i)}"
          name="${s(this.name === "" ? void 0 : this.name)}"
          inputmode="${s(this.inputMode)}"
          autocapitalize="${s(t)}"
          @input="${this.handleInputChange}"
          @blur="${this.onInputBlur}">
      </textarea>`;
  }
}
d([
  g("textarea")
], a.prototype, "formElement", void 0);
d([
  h({ type: Number })
], a.prototype, "rows", void 0);
d([
  h({ type: Number })
], a.prototype, "cols", void 0);
d([
  h({ converter: v })
], a.prototype, "charCounter", void 0);
/**
 * @license
 * Copyright 2021 Google LLC
 * SPDX-LIcense-Identifier: Apache-2.0
 */
const O = p`.mdc-text-field{height:100%}.mdc-text-field__input{resize:none}`;
var _ = Object.getOwnPropertyDescriptor, L = (e, r, n, i) => {
  for (var t = i > 1 ? void 0 : i ? _(r, n) : r, l = e.length - 1, u; l >= 0; l--)
    (u = e[l]) && (t = u(t) || t);
  return t;
};
let o = class extends a {
};
o.styles = [b, O, p`${m(C)}`];
o = L([
  f("cv-textarea")
], o);
const B = o;
export {
  o as CovalentTextArea,
  B as default
};
