"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const basicDateTable = require("../props/basic-date-table.js");
const useBasicDateTable = require("../composables/use-basic-date-table.js");
const basicCellRender = require("./basic-cell-render.js");
const Vue = require("vue");
const _hoisted_1 = ["aria-label"];
const _hoisted_2 = ["aria-label"];
const _hoisted_3 = [
  "aria-current",
  "aria-selected",
  "tabindex",
  "aria-disabled"
];
var basic_date_table_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  __name: "basic-date-table",
  props: basicDateTable.basicDateTableProps,
  emits: basicDateTable.basicDateTableEmits,
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const { WEEKS, rows, tbodyRef, currentCellRef, focus, isCurrent, isWeekActive, isSelectedCell, handlePickDate, handleMouseUp, handleMouseDown, handleMouseMove, handleFocus } = useBasicDateTable.useBasicDateTable(props, __emit);
    const { tableLabel, tableKls, getCellClasses, getRowKls, weekHeaderClass, t } = useBasicDateTable.useBasicDateTableDOM(props, {
      isCurrent,
      isWeekActive
    });
    let isUnmounting = false;
    Vue.onBeforeUnmount(() => {
      isUnmounting = true;
    });
    __expose({ focus });
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createElementBlock("table", {
        "aria-label": Vue.unref(tableLabel),
        class: Vue.normalizeClass(Vue.unref(tableKls)),
        cellspacing: "0",
        cellpadding: "0",
        role: "grid",
        onClick: _cache[1] || (_cache[1] = (...args) => Vue.unref(handlePickDate) && Vue.unref(handlePickDate)(...args)),
        onMousemove: _cache[2] || (_cache[2] = (...args) => Vue.unref(handleMouseMove) && Vue.unref(handleMouseMove)(...args)),
        onMousedown: _cache[3] || (_cache[3] = (...args) => Vue.unref(handleMouseDown) && Vue.unref(handleMouseDown)(...args)),
        onMouseup: _cache[4] || (_cache[4] = (...args) => Vue.unref(handleMouseUp) && Vue.unref(handleMouseUp)(...args))
      }, [Vue.createElementVNode("tbody", {
        ref_key: "tbodyRef",
        ref: tbodyRef
      }, [Vue.createElementVNode("tr", null, [_ctx.showWeekNumber ? (Vue.openBlock(), Vue.createElementBlock("th", {
        key: 0,
        scope: "col",
        class: Vue.normalizeClass(Vue.unref(weekHeaderClass))
      }, null, 2)) : Vue.createCommentVNode("v-if", true), (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(WEEKS), (week, key) => {
        return Vue.openBlock(), Vue.createElementBlock("th", {
          key,
          "aria-label": Vue.unref(t)("el.datepicker.weeksFull." + week),
          scope: "col"
        }, Vue.toDisplayString(Vue.unref(t)("el.datepicker.weeks." + week)), 9, _hoisted_2);
      }), 128))]), (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(rows), (row, rowKey) => {
        return Vue.openBlock(), Vue.createElementBlock("tr", {
          key: rowKey,
          class: Vue.normalizeClass(Vue.unref(getRowKls)(_ctx.showWeekNumber ? row[2] : row[1]))
        }, [(Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(row, (cell, columnKey) => {
          return Vue.openBlock(), Vue.createElementBlock("td", {
            key: `${rowKey}.${columnKey}`,
            ref_for: true,
            ref: (el) => !Vue.unref(isUnmounting) && Vue.unref(isSelectedCell)(cell) && (currentCellRef.value = el),
            class: Vue.normalizeClass(Vue.unref(getCellClasses)(cell)),
            "aria-current": cell.isCurrent ? "date" : void 0,
            "aria-selected": cell.isCurrent,
            tabindex: _ctx.disabled ? void 0 : Vue.unref(isSelectedCell)(cell) ? 0 : -1,
            "aria-disabled": _ctx.disabled,
            onFocus: _cache[0] || (_cache[0] = (...args) => Vue.unref(handleFocus) && Vue.unref(handleFocus)(...args))
          }, [Vue.createVNode(Vue.unref(basicCellRender.default), { cell }, null, 8, ["cell"])], 42, _hoisted_3);
        }), 128))], 2);
      }), 128))], 512)], 42, _hoisted_1);
    };
  }
});
exports.default = basic_date_table_vue_vue_type_script_setup_true_lang_default;
