"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var element_data_exports = {};
__export(element_data_exports, {
  createMakeswiftComponentSnapshot: () => createMakeswiftComponentSnapshot,
  createMakeswiftPageSnapshot: () => createMakeswiftPageSnapshot,
  createRootComponent: () => createRootComponent
});
module.exports = __toCommonJS(element_data_exports);
var import_crypto = require("crypto");
var import_react = require("../../api/react");
var import_constants = require("../../components/builtin/constants");
function createRootComponent(elements, rootId) {
  return {
    key: rootId ?? (0, import_crypto.randomUUID)(),
    type: import_constants.MakeswiftComponentType.Root,
    props: {
      children: {
        columns: [
          {
            deviceId: "desktop",
            value: {
              count: 12,
              spans: elements?.map(() => [12])
            }
          }
        ],
        elements
      }
    }
  };
}
const isDocument = (elementDataOrDocument) => "snippets" in elementDataOrDocument || "fonts" in elementDataOrDocument || "meta" in elementDataOrDocument || "seo" in elementDataOrDocument;
function createMakeswiftPageSnapshot(elementDataOrDocument, {
  cacheData = {},
  locale = null
} = {}) {
  return {
    document: isDocument(elementDataOrDocument) ? elementDataOrDocument : {
      id: "test-page-id",
      site: { id: "test-site-id" },
      data: elementDataOrDocument,
      snippets: [],
      fonts: [],
      meta: {},
      seo: {},
      localizedPages: [],
      locale
    },
    cacheData: {
      ...import_react.CacheData.empty(),
      ...cacheData
    }
  };
}
function createMakeswiftComponentSnapshot(elementData, {
  cacheData = {},
  locale = null
} = {}) {
  return {
    key: (0, import_crypto.randomUUID)(),
    document: {
      id: "test-component-id",
      name: "Test Component Document",
      siteId: "test-site-id",
      data: elementData,
      inheritsFromParent: false,
      locale
    },
    meta: {
      allowLocaleFallback: false,
      requestedLocale: locale
    },
    cacheData: {
      ...import_react.CacheData.empty(),
      ...cacheData
    }
  };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  createMakeswiftComponentSnapshot,
  createMakeswiftPageSnapshot,
  createRootComponent
});
//# sourceMappingURL=element-data.js.map