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/list/ResponsiveWrapper.tsx
var ResponsiveWrapper_exports = {};
__export(ResponsiveWrapper_exports, {
  createResponsiveConfig: () => createResponsiveConfig,
  default: () => ResponsiveWrapper_default
});
module.exports = __toCommonJS(ResponsiveWrapper_exports);
var import_react = __toESM(require("react"));
var import_List = __toESM(require("./List"));
var import_useDevice = require("./hooks/useDevice");
var ResponsiveWrapper = (props) => {
  const { responsive, children, ...listProps } = props;
  const deviceInfo = (0, import_useDevice.useDevice)();
  console.log("deviceInfo", deviceInfo);
  const finalProps = (0, import_react.useMemo)(() => {
    if (!responsive) {
      const classNames2 = [
        listProps.className,
        `list-device-${deviceInfo.type}`
        // 添加设备类型类名
      ].filter(Boolean).join(" ");
      return {
        ...listProps,
        className: classNames2
      };
    }
    const { pc, pad, mobile } = responsive;
    let deviceSpecificProps = {};
    switch (deviceInfo.type) {
      case "mobile":
        deviceSpecificProps = mobile || {};
        break;
      case "pad":
        deviceSpecificProps = pad || {};
        break;
      case "pc":
        deviceSpecificProps = pc || {};
        break;
      default:
        deviceSpecificProps = {};
    }
    const mergedProps = {
      ...listProps,
      ...deviceSpecificProps
    };
    const classNames = [
      mergedProps.className,
      `list-device-${deviceInfo.type}`
      // 添加设备类型类名
    ].filter(Boolean).join(" ");
    return {
      ...mergedProps,
      className: classNames
    };
  }, [responsive, deviceInfo.type, listProps]);
  const optimizedProps = (0, import_react.useMemo)(() => {
    const props2 = { ...finalProps };
    switch (deviceInfo.type) {
      case "mobile":
        return {
          ...props2,
          // 移动端默认使用垂直布局
          layoutDirection: props2.layoutDirection || "vertical",
          // 移动端默认单列显示
          columns: props2.columns ?? 1,
          // 移动端减少间距
          columnGap: props2.columnGap ?? 8,
          rowGap: props2.rowGap ?? 8,
          // 移动端适合滚动加载
          paginationType: props2.paginationType || "scroll",
          // 移动端默认较小的页面大小
          defaultPageSize: props2.defaultPageSize ?? 10
        };
      case "pad":
        return {
          ...props2,
          // 平板端可以使用2列
          columns: props2.columns ?? 2,
          // 平板端适中的间距
          columnGap: props2.columnGap ?? 12,
          rowGap: props2.rowGap ?? 12,
          // 平板端适合分页或滚动加载
          paginationType: props2.paginationType || "more",
          // 平板端中等的页面大小
          defaultPageSize: props2.defaultPageSize ?? 12
        };
      case "pc":
        return {
          ...props2,
          // PC端可以使用更多列
          columns: props2.columns ?? 3,
          // PC端较大的间距
          columnGap: props2.columnGap ?? 16,
          rowGap: props2.rowGap ?? 16,
          // PC端适合传统分页
          paginationType: props2.paginationType || "pager",
          // PC端较大的页面大小
          defaultPageSize: props2.defaultPageSize ?? 15
        };
      default:
        return props2;
    }
  }, [finalProps, deviceInfo.type]);
  return /* @__PURE__ */ import_react.default.createElement(import_List.default, { ...optimizedProps }, children);
};
var createResponsiveConfig = (overrides) => {
  return {
    pc: overrides == null ? void 0 : overrides.pc,
    pad: overrides == null ? void 0 : overrides.pad,
    mobile: overrides == null ? void 0 : overrides.mobile
  };
};
var ResponsiveWrapper_default = ResponsiveWrapper;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  createResponsiveConfig
});
