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/plus/pisellReservation/floorRoomCard/views/RoomCardBodyView.tsx
var RoomCardBodyView_exports = {};
__export(RoomCardBodyView_exports, {
  RoomCardBodyView: () => RoomCardBodyView,
  RoomCardNextBookingStrip: () => RoomCardNextBookingStrip
});
module.exports = __toCommonJS(RoomCardBodyView_exports);
var import_react = __toESM(require("react"));
var import_classnames = __toESM(require("classnames"));
var import_RoomCardIcons = require("./RoomCardIcons");
function ScrollMiddle(props) {
  const outerRef = (0, import_react.useRef)(null);
  const innerRef = (0, import_react.useRef)(null);
  const [scrollDist, setScrollDist] = (0, import_react.useState)(0);
  (0, import_react.useLayoutEffect)(() => {
    const outer = outerRef.current;
    const inner = innerRef.current;
    if (outer && inner) {
      const diff = inner.scrollWidth - outer.clientWidth;
      setScrollDist(diff > 0 ? diff + 20 : 0);
    }
  }, [props.children]);
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "rc-compact__middle", ref: outerRef }, /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      className: (0, import_classnames.default)(
        "rc-compact__scroll",
        scrollDist > 0 && "rc-compact__scroll--animate"
      ),
      ref: innerRef,
      style: scrollDist > 0 ? { "--scroll-dist": `-${scrollDist}px` } : void 0
    },
    props.children
  ));
}
function ProgressBarView(props) {
  const { isTimeout } = props;
  const clamped = Math.min(100, Math.max(0, props.percent));
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "rc-progress" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "rc-progress__bar" }, /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      className: (0, import_classnames.default)(
        "rc-progress__fill",
        isTimeout && "rc-progress__fill--warn"
      ),
      style: { width: `${clamped}%` }
    }
  )));
}
function PaymentStampView(props) {
  const stampCls = props.variant === "paid" ? "rc-stamp--paid" : "rc-stamp--unpaid";
  return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("rc-stamp", stampCls) }, /* @__PURE__ */ import_react.default.createElement("span", null, props.label));
}
function RoomCardNextBookingStrip(props) {
  const { nextLabel, guestLine, timeRange } = props;
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "rc-next" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-next__label" }, nextLabel), guestLine ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-next__sep" }, "·"), /* @__PURE__ */ import_react.default.createElement("span", null, guestLine)) : null, /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-next__sep" }, "·"), /* @__PURE__ */ import_react.default.createElement("span", null, timeRange));
}
function RoomCardBodyView(props) {
  const { model, scrollSurfaceHandlers, nextBookingPrefix } = props;
  const {
    checkoutDomKey,
    contactName,
    contactPhoneMasked,
    showContactPhone,
    guestNameCompact,
    timeLabel,
    partySize,
    countdown,
    reservedLateOverrun,
    occupiedTimeoutOverrun,
    paymentAmountClass,
    paymentBadgeClass,
    paymentBadgeText,
    paymentStampText,
    paymentStampVariant,
    amountDisplay,
    showLargeAmountRow,
    showProgress,
    showPaymentStamp,
    showAmountInlineBadge,
    showCompactCommerceRow,
    itemsCountLabel,
    itemsCountInsideScroll,
    progressPercent,
    progressIsTimeout,
    nextGuestLine,
    nextTimeRange
  } = model;
  const showContact = contactName || showContactPhone && contactPhoneMasked;
  if (model.layout === "compact") {
    return /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: "rc-compact",
        "data-pisell-floor-checkout-booking": checkoutDomKey
      },
      /* @__PURE__ */ import_react.default.createElement("div", { className: "rc-compact__row" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "rc-compact__left" }, guestNameCompact ? /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-compact__name" }, guestNameCompact) : null), /* @__PURE__ */ import_react.default.createElement(ScrollMiddle, null, /* @__PURE__ */ import_react.default.createElement("span", null, /* @__PURE__ */ import_react.default.createElement(import_RoomCardIcons.IconClock, null), timeLabel), /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ import_react.default.createElement("span", null, /* @__PURE__ */ import_react.default.createElement(import_RoomCardIcons.IconUsers, null), partySize), countdown ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-highlight--info" }, /* @__PURE__ */ import_react.default.createElement(import_RoomCardIcons.IconClock, null), countdown)) : null, reservedLateOverrun ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-highlight--danger" }, /* @__PURE__ */ import_react.default.createElement(import_RoomCardIcons.IconWarn, null), reservedLateOverrun)) : null, occupiedTimeoutOverrun ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-highlight--overtime" }, /* @__PURE__ */ import_react.default.createElement(import_RoomCardIcons.IconWarn, null), occupiedTimeoutOverrun)) : null, itemsCountInsideScroll ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ import_react.default.createElement(
        "span",
        {
          className: (0, import_classnames.default)(
            "rc-compact__items-count",
            "rc-compact__items-count--in-scroll"
          )
        },
        itemsCountLabel
      )) : null), showCompactCommerceRow ? /* @__PURE__ */ import_react.default.createElement("div", { className: "rc-compact__right" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "rc-compact__right-stack" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "rc-compact__pay-row" }, /* @__PURE__ */ import_react.default.createElement(
        "span",
        {
          className: (0, import_classnames.default)(
            "rc-compact__amount",
            "rc-amount__main",
            paymentAmountClass
          )
        },
        /* @__PURE__ */ import_react.default.createElement(import_RoomCardIcons.IconMoney, null),
        amountDisplay
      ), /* @__PURE__ */ import_react.default.createElement(
        "span",
        {
          className: (0, import_classnames.default)(
            "rc-compact__badge",
            paymentBadgeClass
          )
        },
        paymentBadgeText
      )), itemsCountInsideScroll ? null : /* @__PURE__ */ import_react.default.createElement("div", { className: "rc-compact__items-count" }, itemsCountLabel))) : null),
      /* @__PURE__ */ import_react.default.createElement("div", { style: { flex: 1 } }),
      /* @__PURE__ */ import_react.default.createElement(
        ProgressBarView,
        {
          percent: progressPercent,
          isTimeout: progressIsTimeout
        }
      )
    );
  }
  return /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      className: "rc-body",
      "data-pisell-floor-checkout-booking": checkoutDomKey,
      "data-pisell-floor-room-scroll-surface": "",
      ...scrollSurfaceHandlers
    },
    showContact ? /* @__PURE__ */ import_react.default.createElement("div", { className: "rc-contact" }, contactName ? /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-contact__name" }, contactName) : null, showContactPhone && contactPhoneMasked ? /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-contact__phone" }, contactPhoneMasked) : null) : null,
    /* @__PURE__ */ import_react.default.createElement("div", { className: "rc-time-row" }, /* @__PURE__ */ import_react.default.createElement("span", null, /* @__PURE__ */ import_react.default.createElement(import_RoomCardIcons.IconClock, null), timeLabel), /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ import_react.default.createElement("span", null, /* @__PURE__ */ import_react.default.createElement(import_RoomCardIcons.IconUsers, null), partySize), countdown ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-highlight--info" }, /* @__PURE__ */ import_react.default.createElement(import_RoomCardIcons.IconClock, null), countdown)) : null, reservedLateOverrun ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-highlight--danger" }, /* @__PURE__ */ import_react.default.createElement(import_RoomCardIcons.IconWarn, null), reservedLateOverrun)) : null, occupiedTimeoutOverrun ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-highlight--overtime" }, /* @__PURE__ */ import_react.default.createElement(import_RoomCardIcons.IconWarn, null), occupiedTimeoutOverrun)) : null),
    showLargeAmountRow ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: (0, import_classnames.default)(
          "rc-amount",
          showAmountInlineBadge && "rc-amount--with-badge",
          paymentAmountClass
        )
      },
      /* @__PURE__ */ import_react.default.createElement("span", { className: "rc-amount__main" }, /* @__PURE__ */ import_react.default.createElement(import_RoomCardIcons.IconMoney, null), amountDisplay),
      showAmountInlineBadge ? /* @__PURE__ */ import_react.default.createElement(
        "span",
        {
          className: (0, import_classnames.default)("rc-compact__badge", paymentBadgeClass)
        },
        paymentBadgeText
      ) : null
    ), /* @__PURE__ */ import_react.default.createElement("div", { className: "rc-items-count" }, itemsCountLabel)) : null,
    /* @__PURE__ */ import_react.default.createElement("div", { style: { flex: 1 } }),
    showProgress ? /* @__PURE__ */ import_react.default.createElement(
      ProgressBarView,
      {
        percent: progressPercent,
        isTimeout: progressIsTimeout
      }
    ) : null,
    showPaymentStamp ? /* @__PURE__ */ import_react.default.createElement(
      PaymentStampView,
      {
        variant: paymentStampVariant,
        label: paymentStampText
      }
    ) : null,
    nextTimeRange != null ? /* @__PURE__ */ import_react.default.createElement(
      RoomCardNextBookingStrip,
      {
        nextLabel: nextBookingPrefix,
        guestLine: nextGuestLine,
        timeRange: nextTimeRange
      }
    ) : null
  );
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  RoomCardBodyView,
  RoomCardNextBookingStrip
});
