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/walletPassGallery/index.tsx
var walletPassGallery_exports = {};
__export(walletPassGallery_exports, {
  default: () => walletPassGallery_default
});
module.exports = __toCommonJS(walletPassGallery_exports);
var import_react = __toESM(require("react"));
var import_classnames = __toESM(require("classnames"));
var import_ahooks = require("ahooks");
var import_antd = require("antd");
var import_materials = require("@pisell/materials");
var import_utils = require("@pisell/utils");
var import_serve = require("./serve");
var import_locales = __toESM(require("./locales"));
var import_utils2 = require("../../utils");
var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
var import_passList = __toESM(require("./components/passList"));
var import_passDetail = __toESM(require("./components/passDetail"));
var import_tempHolderSelector = __toESM(require("../../components/walletList/tempHolderSelector"));
var import_index = require("./index.less");
var { Title } = import_antd.Typography;
var KEYS = {
  available: "available",
  unavailable: "unavailable"
};
var ARow = import_antd.Row;
var ACol = import_antd.Col;
var TAGS = [
  "gift_card",
  "point_card",
  "product_discount_card",
  "good_pass",
  "product_voucher"
];
var WalletPassGallery = (props) => {
  var _a, _b, _c, _d, _e, _f, _g;
  const { hideAddButton, hideTitle, customer, platform: platformProp } = props;
  const [activeKey, setActiveKey] = (0, import_react.useState)("available");
  const [currentItemId, setCurrentItemId] = (0, import_react.useState)(void 0);
  const [isOpenAddModal, setIsOpenAddModal] = (0, import_react.useState)(false);
  const [currentUnbindItem, setCurrentUnbindItem] = (0, import_react.useState)(null);
  const [editHolderData, setEditHolderData] = (0, import_react.useState)(null);
  const [updateHolderLoading, setUpdateHolderLoading] = (0, import_react.useState)(false);
  const context = (0, import_useEngineContext.default)();
  const utils = ((_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils) || {};
  const { apiPrefix } = ((_b = context.appHelper) == null ? void 0 : _b.constants) || { apiPrefix: "/h5" };
  const { isTerminal, isApp, interaction } = utils;
  const isTerminalEnv = (typeof isTerminal === "function" ? isTerminal() : !!isTerminal) || (isApp == null ? void 0 : isApp());
  const platform = (0, import_react.useMemo)(() => {
    if (platformProp) return platformProp;
    if (utils.isMobile) {
      return utils.isMobile() ? "h5" : "pc";
    }
    if (typeof window !== "undefined") {
      return window.innerWidth <= 768 ? "h5" : "pc";
    }
    return "pc";
  }, [utils, platformProp]);
  import_utils.locales.init(import_locales.default, ((_d = (_c = context == null ? void 0 : context.engine) == null ? void 0 : _c.props) == null ? void 0 : _d.locale) || "en");
  import_utils2.request.setRequest(utils == null ? void 0 : utils.request);
  const _getWalletDetail = (0, import_ahooks.useRequest)(import_serve.getWalletDetail, {
    manual: true
  });
  const _getAvailableList = (0, import_ahooks.useInfiniteScroll)(
    async (d) => {
      const _searchParams = new URLSearchParams(window.location.search);
      const walletId = _searchParams.get("id");
      const holderId = _searchParams.get("holder_id");
      const res = await (0, import_serve.getWalletPassList)(
        {
          available: 1,
          num: 20,
          skip: (d == null ? void 0 : d.nextId) || 1,
          tags: TAGS,
          filter_wallet_id: walletId || void 0,
          filter_holder_id: holderId || void 0,
          with: ["customScheduleSnapshot", "holder.detail"],
          customer_id: customer == null ? void 0 : customer.id,
          limit_status: "enable"
        },
        {
          apiPrefix
        }
      );
      return {
        list: (res == null ? void 0 : res.list) || [],
        count: (res == null ? void 0 : res.count) || 0,
        nextId: (res == null ? void 0 : res.skip) || 1
      };
    },
    {
      manual: true,
      onSuccess: (data) => {
      },
      isNoMore: (d) => {
        if (!(d == null ? void 0 : d.list)) return false;
        return d.list.length >= (d.count || 0);
      }
    }
  );
  const _getUnavailableList = (0, import_ahooks.useInfiniteScroll)(
    async (d) => {
      const _searchParams = new URLSearchParams(window.location.search);
      const walletId = _searchParams.get("id");
      const holderId = _searchParams.get("holder_id");
      const res = await (0, import_serve.getWalletPassList)(
        {
          available: 0,
          num: 20,
          skip: (d == null ? void 0 : d.nextId) || 1,
          tags: TAGS,
          filter_wallet_id: walletId || void 0,
          filter_holder_id: holderId || void 0,
          with: ["customScheduleSnapshot", "holder.detail"],
          customer_id: customer == null ? void 0 : customer.id,
          limit_status: "enable"
        },
        {
          apiPrefix
        }
      );
      return {
        list: (res == null ? void 0 : res.list) || [],
        count: (res == null ? void 0 : res.count) || 0,
        nextId: (res == null ? void 0 : res.skip) || 1
      };
    },
    {
      manual: true,
      isNoMore: (d) => {
        if (!(d == null ? void 0 : d.list)) return false;
        return d.list.length >= (d.count || 0);
      }
    }
  );
  (0, import_react.useEffect)(() => {
    const walletId = new URLSearchParams(window.location.search).get("id");
    const passId = new URLSearchParams(window.location.search).get(
      "wallet_pass_detail_id"
    );
    if (walletId) {
      _getWalletDetail.runAsync(walletId);
    }
    const req1 = _getAvailableList.reloadAsync();
    const req2 = _getUnavailableList.reloadAsync();
    let req3 = passId ? (0, import_serve.getWalletPassDetail)(passId, {
      with: ["holder.detail"]
    }) : Promise.resolve();
    Promise.all([req1, req2, req3]).then(([data1, data2, data3]) => {
      var _a2, _b2, _c2, _d2, _e2;
      if (platform !== "h5") {
        const list1 = (data1 == null ? void 0 : data1.list) || [];
        const list2 = (data2 == null ? void 0 : data2.list) || [];
        if (passId) {
          const matchedInList1 = list1.find(
            (item) => String(item.id) === passId
          );
          const matchedInList2 = list2.find(
            (item) => String(item.id) === passId
          );
          if (matchedInList1 || matchedInList2) {
            setCurrentItemId(Number(passId));
            if (matchedInList2) {
              setActiveKey("unavailable");
            }
          } else {
            if (data3) {
              if (data3.unified_available_status === 1) {
                _getAvailableList.mutate((data) => ({
                  ...data,
                  list: [data3, ...(data == null ? void 0 : data.list) || []]
                }));
                setCurrentItemId(data3.id);
              } else {
                _getUnavailableList.mutate((data) => ({
                  ...data,
                  list: [data3, ...(data == null ? void 0 : data.list) || []]
                }));
                setCurrentItemId(data3.id);
                setActiveKey("unavailable");
              }
            } else {
              const firstAvailable = list1[0];
              if (firstAvailable) {
                setCurrentItemId(firstAvailable.id);
              } else {
                const firstUnavailable = list2[0];
                if (firstUnavailable) {
                  setCurrentItemId(firstUnavailable.id);
                  setActiveKey("unavailable");
                }
              }
            }
          }
          if (data3 && ((_a2 = data3.holder) == null ? void 0 : _a2.holder_type) === "form" && !((_b2 = data3.holder) == null ? void 0 : _b2.holder_id)) {
            setEditHolderData({
              wallet_pass_detail_id: passId,
              customer_id: (_c2 = data3.holder) == null ? void 0 : _c2.customer_id,
              form_id: (_e2 = (_d2 = data3.holder) == null ? void 0 : _d2.metadata) == null ? void 0 : _e2.custom_id
            });
          }
        } else {
          const firstAvailable = list1[0];
          if (firstAvailable) {
            setCurrentItemId(firstAvailable.id);
          } else {
            const firstUnavailable = list2[0];
            if (firstUnavailable) {
              setCurrentItemId(firstUnavailable.id);
              setActiveKey("unavailable");
            }
          }
        }
      }
    });
  }, [customer]);
  (0, import_react.useEffect)(() => {
    var _a2, _b2;
    (_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.mountFunction) == null ? void 0 : _b2.call(_a2, "customer", "new", () => {
      try {
        _getAvailableList.reloadAsync();
        _getUnavailableList.reloadAsync();
      } catch (err) {
        console.error(err);
      }
    });
  }, []);
  const listReload = () => {
    _getAvailableList.reloadAsync();
    _getUnavailableList.reloadAsync();
  };
  const _getUnbindList = (0, import_ahooks.useRequest)(import_serve.getUnbindList, {
    manual: true,
    onSuccess: (data) => {
      if (data == null ? void 0 : data.length) {
        setCurrentUnbindItem(data[0]);
      } else {
        setCurrentUnbindItem(null);
        (0, import_materials.PisellToast)({
          content: import_utils.locales.getText("wallet-pass-gallery.searchNoFound"),
          duration: 2
        });
      }
    },
    onError: (e) => {
      console.log("get unbind list error", e);
      setCurrentUnbindItem(null);
      (0, import_materials.PisellToast)({
        content: import_utils.locales.getText("wallet-pass-gallery.searchNoFound"),
        duration: 2
      });
    }
  });
  (0, import_react.useEffect)(() => {
    document.body.id = "body";
  }, []);
  const _avaliable = (0, import_react.useMemo)(() => {
    var _a2;
    return ((_a2 = _getAvailableList.data) == null ? void 0 : _a2.list) || [];
  }, [_getAvailableList.data]);
  const _unavailable = (0, import_react.useMemo)(() => {
    var _a2;
    return ((_a2 = _getUnavailableList.data) == null ? void 0 : _a2.list) || [];
  }, [_getUnavailableList.data]);
  const _handleTabChange = (key) => {
    var _a2, _b2;
    setActiveKey(key);
    if (platform === "h5") {
      setCurrentItemId(void 0);
      return;
    }
    const newId = key === KEYS.unavailable ? (_a2 = _unavailable[0]) == null ? void 0 : _a2.id : (_b2 = _avaliable[0]) == null ? void 0 : _b2.id;
    setCurrentItemId(newId);
  };
  const handleAddClick = () => {
    var _a2, _b2;
    if (isTerminalEnv) {
      (_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.postMessageToApp) == null ? void 0 : _b2.call(_a2, {
        module: "customer",
        key: "new",
        data: {
          customer_id: String((customer == null ? void 0 : customer.id) || "")
        }
      });
      return;
    }
    setIsOpenAddModal(true);
  };
  const _resetSearchState = () => {
    setCurrentUnbindItem(null);
    _getUnbindList.mutate([]);
  };
  const _handleCardClick = (id) => {
    setCurrentItemId(id);
  };
  const _handleSearchByCode = async (code) => {
    if (!code || !code.trim()) {
      _resetSearchState();
      return;
    }
    try {
      await _getUnbindList.run({
        code
      });
    } catch (error) {
      _resetSearchState();
      (0, import_materials.PisellToast)({
        content: import_utils.locales.getText("wallet-pass-gallery.searchNoFound"),
        duration: 2
      });
    }
  };
  const _handleBind = async () => {
    if (!(currentUnbindItem == null ? void 0 : currentUnbindItem.code)) return;
    try {
      const data = await (0, import_serve.bindCodeToCustomer)({
        code: currentUnbindItem.code
      });
      console.log("bind result", data);
      if (data) {
        (0, import_materials.PisellToast)({
          content: import_utils.locales.getText("wallet-pass-gallery.addSuccess"),
          duration: 2
        });
        _getAvailableList.reloadAsync();
        _getUnavailableList.reloadAsync();
      }
      setIsOpenAddModal(false);
      _resetSearchState();
    } catch (error) {
      (0, import_materials.PisellToast)({
        content: import_utils.locales.getText("wallet-pass-gallery.addError"),
        duration: 2
      });
    }
  };
  const _handleHolderChange = (passId, holder) => {
    if (_avaliable.find((item) => item.id === passId)) {
      _getAvailableList.mutate((data) => {
        const newList = data.list.map(
          (item) => item.id === passId ? { ...item, holder } : item
        );
        return {
          ...data,
          list: newList
        };
      });
    } else if (_unavailable.find((item) => item.id === passId)) {
      _getUnavailableList.mutate((data) => {
        const newList = data.list.map(
          (item) => item.id === passId ? { ...item, holder } : item
        );
        return {
          ...data,
          list: newList
        };
      });
    } else {
      console.log("pass not found", passId);
    }
  };
  const _handleBindHolder = async (holderId) => {
    setUpdateHolderLoading(true);
    const { wallet_pass_detail_id: passId } = editHolderData;
    try {
      const res = await (0, import_serve.updateWalletPassHolder)(passId, {
        holder_type: "form",
        holder_id: holderId
      });
      setEditHolderData(null);
      if (holderId) {
        if (res) {
          _handleHolderChange == null ? void 0 : _handleHolderChange(Number(passId), res);
        }
      } else {
        _handleHolderChange == null ? void 0 : _handleHolderChange(Number(passId), null);
      }
    } catch (error) {
      console.error("Error updating wallet pass holder:", error);
    } finally {
      setUpdateHolderLoading(false);
    }
  };
  const _currentItem = (0, import_react.useMemo)(() => {
    if (!currentItemId) return null;
    const found1 = _avaliable.find(
      (item) => item.id === currentItemId
    );
    if (found1) return found1;
    const found2 = _unavailable.find(
      (item) => item.id === currentItemId
    );
    return found2;
  }, [currentItemId, _avaliable, _unavailable]);
  const _pcTitle = /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-wallet-pass-gallery_title" }, hideTitle ? null : /* @__PURE__ */ import_react.default.createElement(Title, null, ((_g = utils == null ? void 0 : utils.translation) == null ? void 0 : _g.call(utils, (_f = (_e = _getWalletDetail.data) == null ? void 0 : _e.data) == null ? void 0 : _f.name)) || import_utils.locales.getText("wallet-pass-gallery.wallet")));
  const renderAvaliableList = () => {
    if (platform === "h5") {
      return /* @__PURE__ */ import_react.default.createElement(
        import_passList.default,
        {
          onLoadMore: () => _getAvailableList.loadMoreAsync(),
          loading: _getAvailableList.loadingMore,
          hasMore: !_getAvailableList.noMore,
          dataSource: _avaliable,
          value: currentItemId,
          onChange: _handleCardClick,
          onEditHolder: setEditHolderData
        }
      );
    }
    return /* @__PURE__ */ import_react.default.createElement(ARow, { gutter: 20, wrap: false }, /* @__PURE__ */ import_react.default.createElement(ACol, { flex: "367px" }, /* @__PURE__ */ import_react.default.createElement(
      import_passList.default,
      {
        onLoadMore: () => _getAvailableList.loadMoreAsync(),
        loading: _getAvailableList.loadingMore,
        hasMore: !_getAvailableList.noMore,
        dataSource: _avaliable,
        value: currentItemId,
        onChange: _handleCardClick,
        onEditHolder: setEditHolderData
      }
    )), /* @__PURE__ */ import_react.default.createElement(ACol, { flex: "auto" }, /* @__PURE__ */ import_react.default.createElement(
      import_passDetail.default,
      {
        dataSource: _currentItem,
        platform,
        onListRefresh: listReload
      }
    )));
  };
  const renderUnavailableList = () => {
    if (platform === "h5") {
      return /* @__PURE__ */ import_react.default.createElement(
        import_passList.default,
        {
          onLoadMore: () => _getUnavailableList.loadMoreAsync(),
          hasMore: !_getUnavailableList.noMore,
          loading: _getUnavailableList.loadingMore,
          dataSource: _unavailable,
          value: currentItemId,
          onChange: _handleCardClick,
          onEditHolder: setEditHolderData
        }
      );
    }
    return /* @__PURE__ */ import_react.default.createElement(ARow, { gutter: 20, wrap: false }, /* @__PURE__ */ import_react.default.createElement(ACol, { flex: "367px" }, /* @__PURE__ */ import_react.default.createElement(
      import_passList.default,
      {
        onLoadMore: () => _getUnavailableList.loadMoreAsync(),
        hasMore: !_getUnavailableList.noMore,
        loading: _getUnavailableList.loadingMore,
        dataSource: _unavailable,
        value: currentItemId,
        onChange: _handleCardClick,
        onEditHolder: setEditHolderData
      }
    )), /* @__PURE__ */ import_react.default.createElement(ACol, { flex: "auto" }, /* @__PURE__ */ import_react.default.createElement(
      import_passDetail.default,
      {
        dataSource: _currentItem,
        platform,
        onListRefresh: listReload
      }
    )));
  };
  const renderTabBar = (props2, DefaultTabBar) => {
    return /* @__PURE__ */ import_react.default.createElement("div", { style: { zIndex: 99, position: "sticky", top: 0 } }, /* @__PURE__ */ import_react.default.createElement(DefaultTabBar, { ...props2, style: { background: "white" } }));
  };
  const renderContent = () => {
    var _a2, _b2;
    return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-wallet-pass-gallery_content" }, /* @__PURE__ */ import_react.default.createElement(
      import_materials.Tabs,
      {
        defaultActiveKey: "available",
        activeKey,
        type: "line",
        onChange: _handleTabChange,
        renderTabBar: platform === "h5" ? renderTabBar : void 0,
        items: [
          {
            key: KEYS.available,
            label: import_utils.locales.getText("wallet-pass-gallery.available"),
            children: renderAvaliableList(),
            badge: ((_a2 = _getAvailableList.data) == null ? void 0 : _a2.count) || 0
          },
          {
            key: KEYS.unavailable,
            label: import_utils.locales.getText("wallet-pass-gallery.unavailable"),
            children: renderUnavailableList(),
            badge: ((_b2 = _getUnavailableList.data) == null ? void 0 : _b2.count) || 0
          }
        ],
        tabBarExtraContent: platform === "pc" && !hideAddButton ? /* @__PURE__ */ import_react.default.createElement(
          import_antd.Button,
          {
            icon: /* @__PURE__ */ import_react.default.createElement(import_materials.Icon, { type: "pisell2-plus" }),
            size: "large",
            onClick: handleAddClick
          },
          import_utils.locales.getText("wallet-pass-gallery.add")
        ) : null
      }
    ));
  };
  const renderPcContent = () => {
    return /* @__PURE__ */ import_react.default.createElement("div", null, _pcTitle, renderContent());
  };
  const renderSearchCard = (item, index) => {
    const {
      id,
      product_name = "",
      balance = 0,
      code = "",
      encoded = "",
      expire_date = "",
      shop,
      limit_status,
      product_cover = "",
      unified_available_status,
      unified_messages = {},
      par_value = "",
      tag = "",
      ...rest
    } = item;
    const { title = "" } = unified_messages;
    const { name = "" } = shop;
    const isActive = id === (currentUnbindItem == null ? void 0 : currentUnbindItem.id) && platform === "pc";
    const isDisabled = unified_available_status === 0;
    const isDiscountCard = tag === "product_discount_card";
    const getBalanceTitle = () => {
      if (tag === "point_card") {
        return import_utils.locales.getText("wallet-pass-gallery.points");
      } else if (tag === "good_pass") {
        return import_utils.locales.getText("wallet-pass-gallery.goodPass");
      }
      return void 0;
    };
    return /* @__PURE__ */ import_react.default.createElement(
      import_materials.PisellWalletPassCard,
      {
        ...rest,
        id,
        type: tag,
        key: id,
        balanceTitle: getBalanceTitle(),
        showDetail: false,
        showRedeem: false,
        showQrCode: false,
        cover: product_cover,
        disabled: isDisabled,
        showDisabledReason: isDisabled,
        disabledReason: title,
        propStyle: { marginBottom: 10 },
        showBalanceSymbol: !["point_card", "good_pass"].includes(tag),
        showBalance: tag !== "product_discount_card",
        active: isActive,
        name: product_name,
        qrCode: code,
        storeName: name,
        balance: Number(balance),
        code: encoded,
        discount: Number(par_value),
        showDiscount: isDiscountCard,
        validDate: expire_date,
        onClick: () => setCurrentUnbindItem(item),
        style: {
          cursor: "pointer",
          width: "100%",
          marginTop: 8
        }
      }
    );
  };
  const renderH5Content = () => {
    var _a2, _b2, _c2, _d2;
    const _walletBar = !((_a2 = utils == null ? void 0 : utils.isApp) == null ? void 0 : _a2.call(utils)) && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-wallet-pass-gallery-bar" }, /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: "pisell-wallet-pass-gallery-header-bar-arrow",
        onClick: () => {
          history.back();
        }
      },
      /* @__PURE__ */ import_react.default.createElement(import_materials.Icon, { type: "pisell2-chevron-left" })
    ), /* @__PURE__ */ import_react.default.createElement("span", { className: "header-title" }, ((_d2 = utils == null ? void 0 : utils.translation) == null ? void 0 : _d2.call(utils, (_c2 = (_b2 = _getWalletDetail.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.name)) || import_utils.locales.getText("wallet-pass-gallery.wallet")));
    return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, _walletBar, renderContent(), hideAddButton ? null : /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        style: {
          padding: 24
        }
      },
      /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { size: "large", onClick: handleAddClick, block: true }, import_utils.locales.getText("wallet-pass-gallery.button.add"))
    ), /* @__PURE__ */ import_react.default.createElement(
      import_materials.PisellModal,
      {
        zIndex: 997,
        destroyOnClose: true,
        platform,
        visible: !!_currentItem,
        onCancel: () => setCurrentItemId(""),
        footer: null,
        title: import_utils.locales.getText("wallet-pass-gallery.details")
      },
      /* @__PURE__ */ import_react.default.createElement(
        import_passDetail.default,
        {
          dataSource: _currentItem,
          platform,
          onListRefresh: listReload
        }
      )
    ));
  };
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      className: (0, import_classnames.default)(
        "pisell-wallet-pass-gallery",
        `pisell-wallet-pass-gallery-${platform}`
      )
    },
    platform === "pc" ? renderPcContent() : renderH5Content()
  ), /* @__PURE__ */ import_react.default.createElement(
    import_materials.PisellModal,
    {
      title: import_utils.locales.getText("wallet-pass-gallery.add"),
      platform: platform === "pc" ? "pc" : "h5",
      mobileModalHeight: "auto",
      open: isOpenAddModal,
      onCancel: () => setIsOpenAddModal(false),
      cancelVisible: false,
      destroyOnClose: true,
      okText: import_utils.locales.getText("wallet-pass-gallery.confirm"),
      okButtonProps: { disabled: !(currentUnbindItem == null ? void 0 : currentUnbindItem.code) },
      onOk: _handleBind
    },
    /* @__PURE__ */ import_react.default.createElement("div", { style: { margin: "24px 0" } }, /* @__PURE__ */ import_react.default.createElement(
      import_materials.PisellInformationEntry,
      {
        title: import_utils.locales.getText("wallet-pass-gallery.addModalTitle"),
        entryModes: [
          {
            type: "scanCode",
            name: import_utils.locales.getText("wallet-pass-gallery.scanBarQrCode")
          },
          {
            type: "input",
            name: import_utils.locales.getText("wallet-pass-gallery.enterCodes")
          }
        ],
        searchDescribe: import_utils.locales.getText(
          "wallet-pass-gallery.searchDescribe"
        ),
        onChange: _handleSearchByCode,
        onChangeType: _resetSearchState
      }
    ), (_getUnbindList.data || []).map(renderSearchCard))
  ), !!editHolderData && /* @__PURE__ */ import_react.default.createElement(
    import_tempHolderSelector.default,
    {
      visible: true,
      onCancel: () => {
        setEditHolderData(null);
      },
      onConfirm: _handleBindHolder,
      confirmLoading: updateHolderLoading,
      formId: editHolderData == null ? void 0 : editHolderData.form_id,
      customerId: editHolderData == null ? void 0 : editHolderData.customer_id,
      value: editHolderData == null ? void 0 : editHolderData.holder_id
    }
  ));
};
var walletPassGallery_default = WalletPassGallery;
