var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/ticketBooking/components/bookingDataPanel/index.tsx
var bookingDataPanel_exports = {};
__export(bookingDataPanel_exports, {
  default: () => bookingDataPanel_default
});
module.exports = __toCommonJS(bookingDataPanel_exports);
var import_react = __toESM(require("react"));
var import_materials = require("@pisell/materials");
var import_utils = require("@pisell/utils");
var import_icons = require("@ant-design/icons");
var import_bookingDashboard = __toESM(require("./bookingDashboard"));
var import_bookingList = __toESM(require("./bookingList"));
var import_materials2 = require("@pisell/materials");
var import_index = require("./index.less");
var BookingDataPanel = (0, import_react.forwardRef)((props, ref) => {
  const { currentDate, onBookingClick, bookingId, isVisible = true } = props;
  const Toast = (0, import_materials2.useToast)();
  const bookingListRef = (0, import_react.useRef)(null);
  const bookingDashboardRef = (0, import_react.useRef)(null);
  const bookingTimeStartBetween = (0, import_react.useMemo)(() => {
    return [`${currentDate} 00:00:00`, `${currentDate} 23:59:59`];
  }, [currentDate]);
  const items = (0, import_react.useMemo)(() => {
    return [
      {
        label: import_utils.locales.getText("pisell2.ticket-booking.dashboard"),
        key: "data-board",
        children: /* @__PURE__ */ import_react.default.createElement(
          import_bookingDashboard.default,
          {
            bookingTimeStartBetween,
            isVisible,
            ref: bookingDashboardRef
          }
        )
      },
      {
        label: import_utils.locales.getText("pisell2.ticket-booking.booking-list"),
        key: "booking-list",
        children: /* @__PURE__ */ import_react.default.createElement(
          import_bookingList.default,
          {
            bookingTimeStartBetween,
            onBookingClick,
            bookingId,
            ref: bookingListRef
          }
        )
      }
    ];
  }, [currentDate, bookingId, isVisible]);
  (0, import_react.useImperativeHandle)(ref, () => ({
    refresh: () => {
      var _a, _b;
      (_a = bookingListRef.current) == null ? void 0 : _a.refresh();
      (_b = bookingDashboardRef.current) == null ? void 0 : _b.refresh();
    }
  }));
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-ticket-booking-data-panel" }, /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      className: "pisell-ticket-booking-data-panel-mask",
      style: { display: bookingId ? "block" : "none" },
      onClick: () => {
        onBookingClick({});
      }
    }
  ), /* @__PURE__ */ import_react.default.createElement(
    import_materials.Tabs,
    {
      type: "line",
      items,
      tabBarExtraContent: /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          className: "pisell-ticket-booking-data-panel-tab-extra",
          onClick: () => {
            var _a, _b, _c;
            (_a = bookingListRef.current) == null ? void 0 : _a.refresh();
            (_b = bookingDashboardRef.current) == null ? void 0 : _b.refresh();
            (_c = Toast == null ? void 0 : Toast.success) == null ? void 0 : _c.call(Toast, import_utils.locales.getText("pisell2.ticket-booking.refresh-success"));
          }
        },
        /* @__PURE__ */ import_react.default.createElement(import_icons.SyncOutlined, null)
      ),
      tabBarStyle: {
        margin: "0 0 0 16px",
        height: "40px"
      }
    }
  ));
});
var bookingDataPanel_default = BookingDataPanel;
