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/scanOrder/components/Content/index.tsx
var Content_exports = {};
__export(Content_exports, {
  default: () => Content
});
module.exports = __toCommonJS(Content_exports);
var import_react = __toESM(require("react"));
var import_utils = require("@pisell/utils");
var import_antd = require("antd");
var import_materials = require("@pisell/materials");
var import_context = require("../../context");
var import_Header = __toESM(require("../Header"));
var import_Footer = __toESM(require("../Footer"));
var import_Menu = __toESM(require("../Menu"));
var import_Cart = __toESM(require("../Cart"));
var import_ErrorState = __toESM(require("../ErrorState"));
var import_Initializing = __toESM(require("../Initializing"));
var import_hooks = require("../../hooks");
var import_Check = __toESM(require("../Check"));
var import_PolicyModal = __toESM(require("../../../appointmentBooking/deposit/components/PolicyModal"));
var import_useComponents = __toESM(require("../../../../hooks/useComponents"));
var import_index = require("./index.less");
function extractEntryPaxNumber(payload) {
  if (payload == null) return null;
  if (typeof payload === "number" && Number.isFinite(payload) && payload >= 1) {
    return Math.floor(payload);
  }
  if (typeof payload === "string") {
    const n = Number(payload);
    if (Number.isFinite(n) && n >= 1) return Math.floor(n);
  }
  if (typeof payload === "object") {
    const o = payload;
    for (const k of ["entryPaxNumber", "pax", "num", "count", "value"]) {
      const v = o[k];
      if (typeof v === "number" && Number.isFinite(v) && v >= 1) return Math.floor(v);
      if (typeof v === "string") {
        const n = Number(v);
        if (Number.isFinite(n) && n >= 1) return Math.floor(n);
      }
    }
  }
  return null;
}
function ReadyState() {
  var _a, _b, _c, _d, _e;
  const {
    currentStep,
    prevStep,
    goToStep,
    runModuleAction,
    entryContext,
    viewModel,
    refreshViewModel,
    footerActionText,
    setFooterActionText,
    cartValidation,
    setTableName,
    entryMode,
    setEntryMode,
    submitDisabledTips,
    setSubmitDisabledTips,
    scanOrderModule,
    isCacheHydrated,
    markGate,
    isGatePassed,
    resumeStep,
    consumeResumeStep
  } = (0, import_context.useScanOrderContext)();
  const { isLogin, openLoginModal } = (0, import_hooks.useScanOrderLogin)();
  const utils = (0, import_hooks.contextUtils)();
  const [FormCard] = (0, import_useComponents.default)({
    components: ["FormCard"]
  });
  const formModalRef = (0, import_react.useRef)(null);
  const [formSubmitting, setFormSubmitting] = (0, import_react.useState)(false);
  const [policyModal, setPolicyModal] = (0, import_react.useState)({
    open: false,
    content: null
  });
  const [formModal, setFormModal] = (0, import_react.useState)({
    open: false,
    content: null
  });
  const [pendingFormPayload, setPendingFormPayload] = (0, import_react.useState)(null);
  const [productList, setProductList] = (0, import_react.useState)([]);
  const [isProductListLoading, setIsProductListLoading] = (0, import_react.useState)(false);
  const productListLoadedRef = (0, import_react.useRef)(false);
  const productListPromiseRef = (0, import_react.useRef)(null);
  const ensureProductListLoaded = (0, import_react.useCallback)(async () => {
    if (productListLoadedRef.current) return;
    if (productListPromiseRef.current) {
      await productListPromiseRef.current.catch(() => {
      });
      return;
    }
    const request = (async () => {
      setIsProductListLoading(true);
      try {
        const res = await runModuleAction("getProductList");
        if (Array.isArray(res)) {
          productListLoadedRef.current = true;
          setProductList(res);
          return;
        }
        import_antd.Modal.confirm({
          title: res == null ? void 0 : res.message,
          okText: String(import_utils.locales.getText("pisell2.event.confirm") || "OK"),
          cancelButtonProps: { style: { display: "none" } },
          maskClosable: false,
          onOk: () => {
            location.replace("/");
          }
        });
      } catch (error) {
        console.warn("[scanOrder] getProductList failed", error);
      } finally {
        setIsProductListLoading(false);
        productListPromiseRef.current = null;
      }
    })();
    productListPromiseRef.current = request;
    await request;
  }, [runModuleAction]);
  const requestEntryPaxRef = (0, import_react.useRef)(0);
  const requestPaxMinRef = (0, import_react.useRef)(1);
  const requestPaxMaxRef = (0, import_react.useRef)(1);
  const tableFormRecordRef = (0, import_react.useRef)(null);
  const entryPaxModalWasPresentedRef = (0, import_react.useRef)(false);
  const getLocalizedName = (nameMap) => {
    if (!nameMap) return "";
    const currentLocale = import_utils.locales.getLocale();
    const localized = nameMap[currentLocale];
    if (typeof localized === "string" && localized) return localized;
    const original = nameMap.original;
    if (typeof original === "string" && original) return original;
    return "";
  };
  const resolveLocalizedText = (value) => {
    if (value == null) return "";
    if (typeof value === "string") return value;
    if (typeof value !== "object") return String(value);
    return getLocalizedName(value);
  };
  const normalizeFormPayload = (formPayload, partyroomBookingPayload) => {
    const sourcePayload = formPayload ?? partyroomBookingPayload;
    if (!sourcePayload) return null;
    const isPrimitivePayload = typeof sourcePayload === "number" || typeof sourcePayload === "string";
    const rawId = isPrimitivePayload ? sourcePayload : (sourcePayload == null ? void 0 : sourcePayload.id) ?? (sourcePayload == null ? void 0 : sourcePayload.form_id) ?? (sourcePayload == null ? void 0 : sourcePayload.resource_form_id) ?? (sourcePayload == null ? void 0 : sourcePayload.partyroom_booking);
    const formId = Number(rawId);
    if (Number.isNaN(formId) || formId <= 0) return null;
    const sourceDetail = typeof sourcePayload === "object" && sourcePayload !== null ? sourcePayload : {};
    return {
      id: formId,
      title: sourceDetail == null ? void 0 : sourceDetail.title,
      defaultValues: (sourceDetail == null ? void 0 : sourceDetail.defaultValues) || {},
      setting: sourceDetail == null ? void 0 : sourceDetail.setting
    };
  };
  const app = (_a = utils == null ? void 0 : utils.getApp) == null ? void 0 : _a.call(utils);
  const navigateToHome = () => {
    var _a2, _b2;
    if ((_a2 = app == null ? void 0 : app.history) == null ? void 0 : _a2.replace) {
      app.history.replace("/");
    } else if ((_b2 = app == null ? void 0 : app.history) == null ? void 0 : _b2.push) {
      app.history.push("/");
    } else {
      location.replace("/");
    }
  };
  const requestEntryPaxModal = () => new Promise((resolve) => {
    var _a2;
    if (typeof (utils == null ? void 0 : utils.action) !== "function") {
      resolve(null);
      return;
    }
    utils.action({
      type: "pisell1.handlePaxModal",
      data: {
        tableName: getLocalizedName((_a2 = tableFormRecordRef.current) == null ? void 0 : _a2.name),
        requestPaxMin: requestPaxMinRef.current,
        requestPaxMax: requestPaxMaxRef.current
      },
      callback: (result) => {
        resolve(extractEntryPaxNumber(result));
      }
    });
  });
  const handleOrderDetail = (order_id) => {
    var _a2, _b2;
    const link = `/order/details?id=${order_id}`;
    if ((_a2 = app == null ? void 0 : app.history) == null ? void 0 : _a2.replace) {
      app.history.replace(link);
    } else if ((_b2 = app == null ? void 0 : app.history) == null ? void 0 : _b2.push) {
      app.history.push(link);
    } else {
      location.replace(link);
    }
  };
  const handleBack = () => {
    if (currentStep !== "product") {
      prevStep();
      return;
    }
    if (entryMode === "additional_order" && (entryContext == null ? void 0 : entryContext.order_id)) {
      handleOrderDetail(entryContext.order_id);
      return;
    }
    if (entryPaxModalWasPresentedRef.current) {
      void (async () => {
        const pax = await requestEntryPaxModal();
        if (pax == null) {
          navigateToHome();
          return;
        }
        try {
          await runModuleAction("setEntryPaxNumber", pax);
          await refreshViewModel();
        } catch (error) {
          console.warn("[scanOrder] setEntryPaxNumber on back pax confirm failed", error);
        }
      })();
      return;
    }
    navigateToHome();
  };
  const enterProductStep = async () => {
    try {
      await runModuleAction("applyItemRulePrefill");
      await refreshViewModel();
    } catch (error) {
      console.warn("[scanOrder] applyItemRulePrefill failed", error);
    } finally {
      const target = resumeStep === "check" ? "check" : "product";
      if (resumeStep) consumeResumeStep();
      goToStep(target);
    }
  };
  const runEntryPaxGateThenEnterProduct = async () => {
    if (entryMode === "additional_order") {
      await enterProductStep();
      return;
    }
    if (requestEntryPaxRef.current !== 1) {
      await enterProductStep();
      return;
    }
    if (isGatePassed("paxEntered")) {
      await enterProductStep();
      return;
    }
    entryPaxModalWasPresentedRef.current = true;
    const pax = await requestEntryPaxModal();
    if (pax == null) {
      navigateToHome();
      return;
    }
    try {
      await runModuleAction("setEntryPaxNumber", pax);
      markGate("paxEntered");
    } catch (error) {
      console.warn("[scanOrder] setOtherParams failed", error);
    }
    await enterProductStep();
  };
  const closePolicyAndBack = () => {
    setPolicyModal({
      open: false,
      content: null
    });
    location.replace("/");
  };
  const openFormModal = (payload) => {
    if (!payload) return;
    setFormSubmitting(false);
    setFormModal({
      open: true,
      content: payload
    });
  };
  const closeFormModalAndBack = () => {
    setFormSubmitting(false);
    setFormModal({
      open: false,
      content: null
    });
    setPendingFormPayload(null);
    location.replace("/");
  };
  const handleFormSubmit = (status) => {
    setFormSubmitting(false);
    if (status !== "success") return;
    setFormModal({
      open: false,
      content: null
    });
    setPendingFormPayload(null);
    markGate("formSubmitted");
    void runEntryPaxGateThenEnterProduct();
  };
  const handleFormConfirm = () => {
    var _a2, _b2;
    if (formSubmitting) return;
    setFormSubmitting(true);
    (_b2 = (_a2 = formModalRef.current) == null ? void 0 : _a2.submit) == null ? void 0 : _b2.call(_a2);
  };
  const confirmPolicyAndContinue = () => {
    setPolicyModal({
      open: false,
      content: null
    });
    markGate("policyAccepted");
    if (pendingFormPayload && !isGatePassed("formSubmitted")) {
      openFormModal(pendingFormPayload);
      return;
    }
    void runEntryPaxGateThenEnterProduct();
  };
  const depositProtocolRequest = (id) => {
    var _a2, _b2;
    return (_b2 = (_a2 = utils == null ? void 0 : utils.request) == null ? void 0 : _a2.get) == null ? void 0 : _b2.call(_a2, `/h5/shop-policy/${id}`, {});
  };
  (0, import_react.useEffect)(() => {
    const checkResourceAvailable = async () => {
      var _a2;
      const hasOrderId = !!(entryContext == null ? void 0 : entryContext.order_id);
      const {
        mode,
        order_id,
        errorTips,
        policy,
        form,
        partyroom_booking,
        requestEntryPax,
        requestPaxMin,
        requestPaxMax,
        table_form_record
      } = await runModuleAction(
        "checkResourceAvailable",
        entryContext == null ? void 0 : entryContext.resource_id,
        hasOrderId
      );
      requestEntryPaxRef.current = Number(requestEntryPax) === 1 ? 1 : 0;
      requestPaxMinRef.current = Number(requestPaxMin) || 1;
      requestPaxMaxRef.current = Number(requestPaxMax) || 1;
      tableFormRecordRef.current = table_form_record || {};
      setTableName(getLocalizedName(table_form_record == null ? void 0 : table_form_record.name));
      const normalizedFormPayload = normalizeFormPayload(form, partyroom_booking);
      const isAdditionalOrder = mode === "additional_order" || mode === "additional_order_with_code";
      setEntryMode(isAdditionalOrder ? "additional_order" : "default");
      if (mode === "idle") {
        const normalizedPolicyPayload = typeof policy === "object" && policy !== null ? policy : { id: policy };
        if ((normalizedPolicyPayload == null ? void 0 : normalizedPolicyPayload.id) && !isGatePassed("policyAccepted")) {
          setPendingFormPayload(normalizedFormPayload);
          setPolicyModal({
            open: true,
            content: normalizedPolicyPayload
          });
          return;
        }
        if (normalizedFormPayload && !isGatePassed("formSubmitted")) {
          openFormModal(normalizedFormPayload);
          return;
        }
        await runEntryPaxGateThenEnterProduct();
      } else if (isAdditionalOrder) {
        await enterProductStep();
      } else if (mode === "submit_disabled") {
        const tips = resolveLocalizedText(errorTips) || String(import_utils.locales.getText("pisell2.scan.order.submit.disabled.default") || "");
        setSubmitDisabledTips(tips);
        await enterProductStep();
      } else if (mode === "resource_busy") {
        if (!isLogin) {
          (_a2 = scanOrderModule == null ? void 0 : scanOrderModule.setUIState) == null ? void 0 : _a2.call(scanOrderModule, "pendingStep", currentStep);
          openLoginModal({
            callback: (status) => {
              var _a3, _b2;
              if (status === "success") {
                (_a3 = scanOrderModule == null ? void 0 : scanOrderModule.deleteUIState) == null ? void 0 : _a3.call(scanOrderModule, "pendingStep");
                handleOrderDetail(order_id);
                return;
              }
              (_b2 = scanOrderModule == null ? void 0 : scanOrderModule.deleteUIState) == null ? void 0 : _b2.call(scanOrderModule, "pendingStep");
              location.replace("/");
            }
          });
        } else {
          handleOrderDetail(order_id);
        }
      } else {
        let content = resolveLocalizedText(errorTips);
        if (!content) {
          if (mode === "resource_block") {
            content = String(
              import_utils.locales.getText("pisell2.scan.order.resource.status.exception") || ""
            );
          } else {
            content = String(
              import_utils.locales.getText("pisell2.scan.order.store.status.exception") || ""
            );
          }
        }
        import_antd.Modal.info({
          title: import_utils.locales.getText("pisell2.scan.order.step.error"),
          content: resolveLocalizedText(content).trim(),
          okText: String(import_utils.locales.getText("pisell2.event.confirm") || "OK"),
          maskClosable: false,
          onOk: () => {
            location.replace("/");
          }
        });
      }
    };
    if (!isCacheHydrated) return;
    checkResourceAvailable();
  }, [isCacheHydrated]);
  (0, import_react.useEffect)(() => {
    window.scrollTo({
      top: 0,
      behavior: "smooth"
    });
  }, [currentStep]);
  (0, import_react.useEffect)(() => {
    if (currentStep === "product") {
      const nextActionText = (cartValidation == null ? void 0 : cartValidation.passed) === true ? String(import_utils.locales.getText("pisell2.event.continue") || "下一步") : String(import_utils.locales.getText("pisell2.scan.order.action.select.required") || "");
      setFooterActionText(
        nextActionText
      );
      return;
    }
    if (currentStep === "check") {
      setFooterActionText(String(import_utils.locales.getText("pisell2.event.checkout") || ""));
      return;
    }
  }, [currentStep, cartValidation == null ? void 0 : cartValidation.passed]);
  const stepRegistry = {
    init: /* @__PURE__ */ import_react.default.createElement(import_Initializing.default, null),
    product: /* @__PURE__ */ import_react.default.createElement(
      import_Menu.default,
      {
        onCheckout: () => goToStep("check"),
        productList,
        isProductListLoading,
        onEnsureProductList: ensureProductListLoaded
      }
    ),
    check: /* @__PURE__ */ import_react.default.createElement(import_Check.default, null),
    error: /* @__PURE__ */ import_react.default.createElement(import_ErrorState.default, { message: import_utils.locales.getText("pisell2.scan.order.store.status.exception") })
  };
  const getFirstFailedProductIds = () => {
    const firstFailure = Array.isArray(cartValidation == null ? void 0 : cartValidation.failures) ? cartValidation.failures[0] : null;
    const targets = Array.isArray(firstFailure == null ? void 0 : firstFailure.targets) ? firstFailure.targets : [];
    const ids = [];
    const seen = /* @__PURE__ */ new Set();
    for (const target of targets) {
      const id = Number(target == null ? void 0 : target.product_id);
      if (Number.isFinite(id) && id > 0 && !seen.has(id)) {
        seen.add(id);
        ids.push(id);
      }
    }
    return ids;
  };
  const scrollAndHighlightProductsByIds = (productIds) => {
    if (!(productIds == null ? void 0 : productIds.length)) return false;
    let scrolled = false;
    let highlighted = false;
    for (const productId of productIds) {
      const failedProductElement = document.querySelector(
        `[data-product-id="${String(productId)}"]`
      );
      if (!failedProductElement) continue;
      failedProductElement.classList.remove("highlight-product-item");
      if (!scrolled) {
        failedProductElement.scrollIntoView({
          behavior: "smooth",
          block: "center"
        });
        scrolled = true;
      }
      void failedProductElement.offsetWidth;
      failedProductElement.classList.add("highlight-product-item");
      setTimeout(() => {
        failedProductElement.classList.remove("highlight-product-item");
      }, 3e3);
      highlighted = true;
    }
    return highlighted;
  };
  const gotoCheckOrder = async () => {
    var _a2;
    if (submitDisabledTips) {
      import_antd.message.warning(submitDisabledTips, 2);
      return;
    }
    const firstFailure = Array.isArray(cartValidation == null ? void 0 : cartValidation.failures) ? cartValidation.failures[0] : null;
    if ((cartValidation == null ? void 0 : cartValidation.passed) === false) {
      const failedProductIds = getFirstFailedProductIds();
      if (failedProductIds.length) {
        scrollAndHighlightProductsByIds(failedProductIds);
      }
      const failureTips = String((firstFailure == null ? void 0 : firstFailure.validationMessage) || "").trim();
      import_antd.message.warning(failureTips, 2);
      return;
    }
    const otherParams = await runModuleAction("getOtherParams");
    console.log("otherParams >>>>> ", otherParams);
    const dineInConfig = (otherParams == null ? void 0 : otherParams.dineInConfig) ?? {};
    const isPauseOrder = dineInConfig == null ? void 0 : dineInConfig["availability.paused"];
    if (isPauseOrder) {
      import_antd.Modal.info({
        title: String(import_utils.locales.getText("pisell2.scan.order.step.error") || ""),
        content: (dineInConfig == null ? void 0 : dineInConfig["availability.pause_message"]) ?? "",
        okText: String(import_utils.locales.getText("pisell2.event.confirm") || "OK"),
        onOk: () => {
          location.replace("/");
        }
      });
      return;
    }
    if (!isLogin) {
      (_a2 = scanOrderModule == null ? void 0 : scanOrderModule.setUIState) == null ? void 0 : _a2.call(scanOrderModule, "pendingStep", "check");
      openLoginModal({
        callback: (status) => {
          var _a3;
          (_a3 = scanOrderModule == null ? void 0 : scanOrderModule.deleteUIState) == null ? void 0 : _a3.call(scanOrderModule, "pendingStep");
          if (status === "success") goToStep("check");
        }
      });
      return;
    }
    goToStep("check");
  };
  const isMobileView = (0, import_utils.isMobile)();
  const isShowFooter = (0, import_react.useMemo)(() => {
    if (!isMobileView) return false;
    return currentStep === "product";
  }, [currentStep, isMobileView]);
  const isShowDesktopCart = (0, import_react.useMemo)(() => {
    if (isMobileView) return false;
    return currentStep === "product";
  }, [currentStep, isMobileView]);
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_Header.default, { currentStep, onBack: handleBack }), /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      className: `pisell-scan-order-content-wrap ${isMobileView ? "pisell-scan-order-content-mobile-wrap" : ""}`,
      "data-cart-validation-passed": String(cartValidation == null ? void 0 : cartValidation.passed)
    },
    /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-content-left" }, stepRegistry[currentStep]),
    isShowDesktopCart ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-content-right" }, /* @__PURE__ */ import_react.default.createElement(
      import_Cart.default,
      {
        embedded: true,
        open: true,
        onCancel: () => {
        },
        onNext: gotoCheckOrder,
        items: (viewModel == null ? void 0 : viewModel.cartItems) || [],
        summary: (viewModel == null ? void 0 : viewModel.summary) || {},
        disabled: !!submitDisabledTips
      }
    )) : null
  ), isShowFooter ? /* @__PURE__ */ import_react.default.createElement(
    import_Footer.default,
    {
      cartItems: (viewModel == null ? void 0 : viewModel.cartItems) || [],
      summary: (viewModel == null ? void 0 : viewModel.summary) || {},
      actionText: footerActionText,
      onAction: () => gotoCheckOrder(),
      disabled: !!submitDisabledTips
    }
  ) : null, policyModal.open ? /* @__PURE__ */ import_react.default.createElement(
    import_PolicyModal.default,
    {
      open: policyModal.open,
      onCancel: closePolicyAndBack,
      onConfirm: confirmPolicyAndContinue,
      item: policyModal.content,
      isHideCheckout: false,
      depositProtocolRequest
    }
  ) : null, formModal.open ? /* @__PURE__ */ import_react.default.createElement(
    import_materials.PisellModal,
    {
      open: formModal.open,
      platform: isMobileView ? "h5" : "pc",
      onCancel: closeFormModalAndBack,
      title: ((_b = formModal.content) == null ? void 0 : _b.title) || import_utils.locales.getText("pisell2.appointment.fill-form") || "填写信息",
      mobileModalHeight: "90vh",
      width: isMobileView ? "100%" : 900,
      className: "pisell-scan-order-form-modal",
      footer: /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-form-modal-footer" }, /* @__PURE__ */ import_react.default.createElement(
        import_materials.Button,
        {
          type: "primary",
          size: "large",
          loading: formSubmitting,
          onClick: handleFormConfirm,
          className: "pisell-scan-order-form-modal-confirm-btn"
        },
        String(import_utils.locales.getText("pisell2.event.confirm") || "Confirm")
      ))
    },
    /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-form-modal-body" }, FormCard ? /* @__PURE__ */ import_react.default.createElement(
      FormCard,
      {
        id: ((_c = formModal.content) == null ? void 0 : _c.id) || 0,
        ref: formModalRef,
        isGetLastData: false,
        setting: ((_d = formModal.content) == null ? void 0 : _d.setting) || { isHidden: 1 },
        formWrapStyle: { padding: "16px" },
        isV2API: true,
        isShowSkeleton: true,
        onSubmit: (status) => {
          handleFormSubmit(status);
        },
        onFinishFailed: () => {
          setFormSubmitting(false);
        },
        onFormValueChange: () => {
        },
        defaultValues: ((_e = formModal.content) == null ? void 0 : _e.defaultValues) || {},
        isClearData: false
      }
    ) : null)
  ) : null);
}
function Content() {
  const { isLoading, errorMessage } = (0, import_context.useScanOrderContext)();
  if (isLoading) {
    return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-loading" }, "Loading...");
  }
  if (errorMessage) {
    return /* @__PURE__ */ import_react.default.createElement(
      import_ErrorState.default,
      {
        message: errorMessage,
        onRetry: () => {
          window.location.reload();
        }
      }
    );
  }
  return /* @__PURE__ */ import_react.default.createElement(ReadyState, null);
}
