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/components/blockTimeModal/demo.tsx
var demo_exports = {};
__export(demo_exports, {
  default: () => demo_default
});
module.exports = __toCommonJS(demo_exports);
var import_react = __toESM(require("react"));
var import_dayjs = __toESM(require("dayjs"));
var import_index = __toESM(require("./index"));
var resources = [
  { id: 101, name: "Court A" },
  { id: 102, name: "Court B" },
  { id: 103, name: "Court C" }
];
var demo_default = () => {
  const [latestResult, setLatestResult] = (0, import_react.useState)(null);
  const [latestReject, setLatestReject] = (0, import_react.useState)(null);
  const [activeScenario, setActiveScenario] = (0, import_react.useState)("");
  const scenarios = (0, import_react.useMemo)(
    () => [
      {
        key: "default-dark",
        title: "Default dark",
        description: "最基础的打开方式，预填标题、场地和时间范围。",
        buildOptions: () => ({
          resources,
          theme: "dark",
          initialName: "Court maintenance",
          initialNote: "Net replacement",
          initialResourceId: 101,
          initialTimeRange: [
            (0, import_dayjs.default)("2026-04-18 09:00", "YYYY-MM-DD HH:mm"),
            (0, import_dayjs.default)("2026-04-18 11:00", "YYYY-MM-DD HH:mm")
          ],
          minuteStep: 30
        })
      },
      {
        key: "light-theme",
        title: "Light theme",
        description: "浅色主题展示，方便确认两套视觉风格是否正常。",
        buildOptions: () => ({
          resources,
          theme: "light",
          initialName: "Private training hold",
          initialNote: "",
          initialResourceId: 102,
          initialTimeRange: [
            (0, import_dayjs.default)("2026-04-18 13:30", "YYYY-MM-DD HH:mm"),
            (0, import_dayjs.default)("2026-04-18 15:00", "YYYY-MM-DD HH:mm")
          ],
          minuteStep: 30
        })
      },
      {
        key: "async-submit",
        title: "Async submit",
        description: "模拟异步提交，检查 loading 和 resolve 结果。",
        buildOptions: () => ({
          resources,
          theme: "dark",
          initialName: "Tournament setup",
          initialNote: "Reserve for event crew",
          initialResourceId: 103,
          initialTimeRange: [
            (0, import_dayjs.default)("2026-04-19 08:00", "YYYY-MM-DD HH:mm"),
            (0, import_dayjs.default)("2026-04-19 10:00", "YYYY-MM-DD HH:mm")
          ],
          minuteStep: 60,
          onSubmit: async ({ submitPayload }) => {
            await new Promise((resolve) => {
              window.setTimeout(resolve, 600);
            });
            return {
              ok: true,
              received: submitPayload
            };
          }
        })
      }
    ],
    []
  );
  const openScenario = async (scenario) => {
    setActiveScenario(scenario.title);
    setLatestResult(null);
    setLatestReject(null);
    try {
      const result = await import_index.default.open(scenario.buildOptions());
      setLatestResult(result);
    } catch (error) {
      setLatestReject(error);
    }
  };
  return /* @__PURE__ */ import_react.default.createElement("div", { style: { padding: 24, background: "#f8fafc" } }, /* @__PURE__ */ import_react.default.createElement("div", { style: { marginBottom: 8, fontSize: 18, fontWeight: 600 } }, "BlockTimeModal Demo"), /* @__PURE__ */ import_react.default.createElement("div", { style: { marginBottom: 20, color: "#64748b", fontSize: 14 } }, "用几个最小场景快速验证打开、主题、提交流程是否正常。"), /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      style: {
        display: "grid",
        gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))",
        gap: 12
      }
    },
    scenarios.map((scenario) => /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        key: scenario.key,
        style: {
          padding: 16,
          border: "1px solid #e2e8f0",
          borderRadius: 12,
          background: "#ffffff"
        }
      },
      /* @__PURE__ */ import_react.default.createElement("div", { style: { marginBottom: 8, fontSize: 15, fontWeight: 600 } }, scenario.title),
      /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          style: {
            minHeight: 40,
            marginBottom: 12,
            color: "#64748b",
            fontSize: 13,
            lineHeight: 1.5
          }
        },
        scenario.description
      ),
      /* @__PURE__ */ import_react.default.createElement(
        "button",
        {
          type: "button",
          onClick: () => void openScenario(scenario),
          style: {
            width: "100%",
            padding: "10px 16px",
            border: "none",
            borderRadius: 8,
            background: "#7c3aed",
            color: "#ffffff",
            cursor: "pointer"
          }
        },
        "Open ",
        scenario.title
      )
    ))
  ), /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      style: {
        marginTop: 20,
        padding: 16,
        border: "1px solid #e5e7eb",
        borderRadius: 12,
        background: "#ffffff",
        whiteSpace: "pre-wrap",
        fontSize: 13,
        lineHeight: 1.6
      }
    },
    /* @__PURE__ */ import_react.default.createElement("div", { style: { marginBottom: 8, fontWeight: 600 } }, "Resources"),
    /* @__PURE__ */ import_react.default.createElement("div", null, JSON.stringify(resources, null, 2))
  ), activeScenario && /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      style: {
        marginTop: 16,
        padding: 12,
        borderRadius: 12,
        background: "#ede9fe",
        color: "#5b21b6",
        fontSize: 13,
        fontWeight: 600
      }
    },
    "Last opened scenario: ",
    activeScenario
  ), latestResult && /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      style: {
        marginTop: 16,
        padding: 16,
        border: "1px solid #d1fae5",
        borderRadius: 12,
        background: "#ecfdf5",
        whiteSpace: "pre-wrap",
        fontSize: 13,
        lineHeight: 1.6
      }
    },
    /* @__PURE__ */ import_react.default.createElement("div", { style: { marginBottom: 8, fontWeight: 600 } }, "Resolved result"),
    /* @__PURE__ */ import_react.default.createElement("div", null, JSON.stringify(latestResult, null, 2))
  ), latestReject && /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      style: {
        marginTop: 16,
        padding: 16,
        border: "1px solid #fecaca",
        borderRadius: 12,
        background: "#fef2f2",
        whiteSpace: "pre-wrap",
        fontSize: 13,
        lineHeight: 1.6
      }
    },
    /* @__PURE__ */ import_react.default.createElement("div", { style: { marginBottom: 8, fontWeight: 600 } }, "Rejected reason"),
    /* @__PURE__ */ import_react.default.createElement("div", null, JSON.stringify(latestReject, null, 2))
  ));
};
