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/salesSdk/demo/components/DemoTabCreate.tsx
var DemoTabCreate_exports = {};
__export(DemoTabCreate_exports, {
  DemoTabCreate: () => DemoTabCreate
});
module.exports = __toCommonJS(DemoTabCreate_exports);
var import_react = __toESM(require("react"));
var import_useSalesSdk = require("../../hooks/useSalesSdk");
var import_useSalesSdkCart = require("../../hooks/useSalesSdkCart");
var import_useSalesSdkCustomer = require("../../hooks/useSalesSdkCustomer");
var import_useSalesSdkSummary = require("../../hooks/useSalesSdkSummary");
var import_useSalesSdkProducts = require("../../hooks/useSalesSdkProducts");
var import_selectors = require("../../selectors");
var import_fixtures = require("../fixtures");
var import_RawSnapshotPanel = require("./RawSnapshotPanel");
var import_DemoAdvancedConfig = require("./DemoAdvancedConfig");
var import_DemoStepRunner = require("./DemoStepRunner");
var import_buildSteps = require("./buildSteps");
var DemoTabCreate = () => {
  const sales = (0, import_useSalesSdk.useSalesSdk)();
  const customer = (0, import_useSalesSdkCustomer.useSalesSdkCustomer)();
  const products = (0, import_useSalesSdkProducts.useSalesSdkProducts)();
  const cart = (0, import_useSalesSdkCart.useSalesSdkCart)();
  const summaryState = (0, import_useSalesSdkSummary.useSalesSdkSummary)();
  const [override, setOverride] = (0, import_react.useState)({});
  const fixture = (0, import_react.useMemo)(() => (0, import_fixtures.mergeMutableFixture)(import_fixtures.FIXTURE_CREATE, override), [override]);
  const steps = (0, import_react.useMemo)(
    () => (0, import_buildSteps.buildCreateSteps)({ sales, customer, products, cart }, fixture),
    [sales, customer, products, cart, fixture]
  );
  const summary = (0, import_selectors.deriveSummary)(summaryState.summary);
  return /* @__PURE__ */ import_react.default.createElement("section", { className: "sales-sdk-demo__tab" }, /* @__PURE__ */ import_react.default.createElement("header", { className: "sales-sdk-demo__panel sales-sdk-demo__panel--warn" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "sales-sdk-demo__section-title" }, /* @__PURE__ */ import_react.default.createElement("h3", null, "新建订单一键流程"), /* @__PURE__ */ import_react.default.createElement("span", null, "status: ", sales.status, " / ready: ", sales.isReady ? "yes" : "no")), /* @__PURE__ */ import_react.default.createElement("p", { className: "sales-sdk-demo__hint" }, "注意：此 Tab 会调用真实 OS 接口（createNew / addProduct / submit）。submit 会弹二次确认，其它步骤直接执行。")), /* @__PURE__ */ import_react.default.createElement(import_DemoAdvancedConfig.DemoAdvancedConfig, { variant: "create", value: override, onChange: setOverride }), /* @__PURE__ */ import_react.default.createElement(import_DemoStepRunner.DemoStepRunner, { title: "步骤序列（点一键串行执行 / 也可单步）", steps }), sales.error ? /* @__PURE__ */ import_react.default.createElement("section", { className: "sales-sdk-demo__panel sales-sdk-demo__panel--error" }, /* @__PURE__ */ import_react.default.createElement("h3", null, "SDK Error"), /* @__PURE__ */ import_react.default.createElement("pre", null, sales.error.message)) : null, /* @__PURE__ */ import_react.default.createElement(
    import_RawSnapshotPanel.RawSnapshotPanel,
    {
      sales,
      cart,
      customer,
      summary: summaryState.summary,
      products: products.products
    }
  ));
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  DemoTabCreate
});
