import { Type } from "@sinclair/typebox";
import { aw as string, ax as boolean, ai as StringEnum, ay as imageRef, az as queryUseRef, aA as colorPresetRef, aB as backgroundRef, aC as manifest, aD as manifest$1, aE as querySchema, aj as toLLMSchema, $ as manifests } from "./use-editor.CurXdZnZ.js";
import "lodash-es";
import { useMemo } from "react";
/*! Upstart.gg - Copyright (C) 2024 Flippable - https://github.com/upstart-gg/upstart/blob/main/LICENSE */
function datetime(title = "Date and Time", options) {
  return Type.String({
    title,
    format: "date-time",
    "ui:field": "datetime",
    examples: ["2023-03-15T12:00:00Z"],
    ...options
  });
}
/*! Upstart.gg - Copyright (C) 2024 Flippable - https://github.com/upstart-gg/upstart/blob/main/LICENSE */
var pageAttributesSchema = Type.Object(
  {
    backgroundImage: Type.Optional(backgroundRef()),
    colorPreset: Type.Optional(
      colorPresetRef({
        examples: [
          { color: "base-100" },
          { color: "primary-500" },
          { color: "accent-100", gradientDirection: "bg-gradient-to-r" }
        ]
      })
    ),
    tags: Type.Optional(
      Type.Array(string("Tag"), {
        title: "Tags",
        description: "Use tags to organize, group and filter pages in navigation elements and in the dashboard. By default, the navbar element display pages having the 'navbar' tag, while the sidebar displays the pages with the tag 'sidebar'.",
        "ui:field": "tags",
        examples: [["navbar", "navbar"], ["navbar", "sidebar"], ["sidebar"]]
      })
    ),
    path: string("URL path", {
      default: "/",
      description: "The URL path of the page. Use placeholders like :id or :slug for dynamic paths.",
      "ai:instructions": "Never put language codes in the path.",
      "ui:field": "path",
      pattern: "^/[a-z0-9-:/]*$",
      examples: ["/", "/about", "/products/:id"]
    }),
    queries: Type.Optional(
      Type.Array(queryUseRef(), {
        title: "Page Queries",
        description: "List of queries to use in this page. All listed queries will be executed when the page loads.",
        "ai:instructions": "Reference Query IDs to use at the page level.",
        "ui:field": "page-queries",
        maxItems: 5
      })
    ),
    title: string("Title", {
      default: "Untitled",
      "ui:group": "meta",
      "ui:group:title": "Meta tags",
      description: "The title of the page. Appears in the browser tab and search results",
      "ui:placeholder": "Page title"
    }),
    description: string("Description", {
      "ui:widget": "textarea",
      "ui:group": "meta",
      "ui:group:title": "Meta tags",
      description: "A short description of the page. Used by search engines",
      "ui:multiline": true,
      "ui:textarea-class": "h-24",
      default: "",
      "ui:placeholder": "A brief description of the page"
    }),
    keywords: string("Keywords", {
      "ui:group": "meta",
      "ui:group:title": "Meta tags",
      description: "Keywords related to the page. Used by search engines",
      "ui:multiline": true,
      default: "",
      "ui:placeholder": "keyword1, keyword2, keyword3"
    }),
    ogImage: Type.Optional(
      imageRef({
        title: "Social share image",
        description: "Image shown when this page is shared on social media",
        "ui:group": "meta",
        "ai:hidden": true,
        "ui:no-object-options": true,
        "ui:no-alt-text": true,
        "ui:show-img-search": false,
        "ui:no-dynamic": true,
        "ui:placeholder": "https://example.com/image.jpg"
      })
    ),
    robotsIndexing: Type.Optional(
      boolean("Allow search engines to index this page", true, {
        description: "Disabling this will prevent search engines from indexing this page",
        "ai:hidden": true,
        "ui:group": "meta"
      })
    ),
    language: Type.Optional(
      StringEnum(
        [
          "ar",
          "zh",
          "cs",
          "nl",
          "en",
          "fr",
          "de",
          "he",
          "hi",
          "it",
          "ja",
          "ko",
          "fa",
          "pl",
          "pt",
          "ru",
          "es",
          "tr",
          "vi"
        ],
        {
          "ai:hidden": true,
          "ui:group": "meta",
          title: "Language",
          default: "en",
          description: "Overrides the site language for this page. Leave blank to use the site default language.",
          enumNames: [
            "Arabic",
            "Chinese",
            "Czech",
            "Dutch",
            "English",
            "French",
            "German",
            "Hebrew",
            "Hindi",
            "Italian",
            "Japanese",
            "Korean",
            "Persian",
            "Polish",
            "Portuguese",
            "Russian",
            "Spanish",
            "Turkish",
            "Vietnamese"
          ]
        }
      )
    ),
    additionalTags: Type.Optional(
      Type.Object(
        {
          headTags: Type.Optional(
            Type.String({
              title: "Head script tags",
              description: "Add custom tags to the <head> of your site. Useful for analytics tags, custom scripts, etc.",
              "ai:instructions": "Don't include meta tags here, they are automatically generated.",
              "ui:multiline": true,
              "ui:textarea-class": "h-40 !font-mono",
              "ui:placeholder": "<script src='https://example.com/script.js'><\/script>",
              "ui:premium": true,
              "ui:textarea-font-size": "1",
              "ui:no-dynamic": true
            })
          ),
          bodyTags: Type.Optional(
            Type.String({
              title: "Body script tags",
              description: "Add custom tags to the <body> of your site. Useful for analytics tags, custom scripts, etc.",
              "ui:multiline": true,
              "ui:premium": true,
              "ui:textarea-class": "h-40 !font-mono",
              "ui:textarea-font-size": "1",
              "ui:placeholder": "<script src='https://example.com/script.js'><\/script>",
              "ui:no-dynamic": true
            })
          )
        },
        { "ui:group": "meta" }
      )
    ),
    noNavbar: Type.Optional(boolean("Hide navbar", false, { "ui:group": "layout" })),
    noFooter: Type.Optional(boolean("Hide footer", false, { "ui:group": "layout" })),
    lastUpdated: Type.Optional(
      datetime("Last updated", {
        "ui:hidden": true,
        "ai:hidden": true
      })
    )
  },
  {
    "ui:groups": {
      meta: "SEO & Meta tags",
      layout: "Layout"
    }
  }
);
Type.Array(queryUseRef(), {
  title: "Page Queries",
  description: `List of page queries in use in this page. All listed queries will be executed when the page loads. Aliases must be unique and camelCase'd.
The queryId must reference an existing site query ID.`,
  examples: [
    { queryId: "get-latest-posts", alias: "latestPosts" },
    {
      queryId: "get-user-profile",
      alias: "userProfile",
      params: [{ field: "userId", op: "eq", value: ":slug" }]
    },
    {
      queryId: "list-featured-products",
      alias: "featuredProducts"
    },
    {
      queryId: "get-event-by-slug",
      alias: "eventBySlug",
      params: [{ field: "$slug", op: "eq", value: ":slug" }]
    }
  ]
});
var siteAttributesSchema = Type.Object(
  {
    language: StringEnum(
      [
        "ar",
        "zh",
        "cs",
        "nl",
        "en",
        "fr",
        "de",
        "he",
        "hi",
        "it",
        "ja",
        "ko",
        "fa",
        "pl",
        "pt",
        "ru",
        "es",
        "tr",
        "vi"
      ],
      {
        title: "Site language",
        default: "en",
        enumNames: [
          "Arabic",
          "Chinese",
          "Czech",
          "Dutch",
          "English",
          "French",
          "German",
          "Hebrew",
          "Hindi",
          "Italian",
          "Japanese",
          "Korean",
          "Persian",
          "Polish",
          "Portuguese",
          "Russian",
          "Spanish",
          "Turkish",
          "Vietnamese"
        ],
        "ai:instructions": "Choose a value based on the site description. If the site is in multiple languages, use 'en'."
      }
    ),
    backgroundImage: Type.Optional(backgroundRef()),
    colorPreset: Type.Optional(
      colorPresetRef({
        examples: [
          { color: "base-100" },
          { color: "primary-500" },
          { color: "secondary-400" },
          { color: "neutral-400" },
          { color: "accent-200-gradient", gradientDirection: "bg-gradient-to-r" },
          { color: "neutral-800-gradient", gradientDirection: "bg-gradient-to-t" }
        ]
      })
    ),
    queries: Type.Optional(
      Type.Array(querySchema, {
        title: "Site Queries",
        "ui:field": "site-queries",
        description: "List of all queries available in this site. These can be used in any page.",
        "ai:instructions": "This is where queries are first defined. They are then referenced in pages attributes (in the 'queries' field) to use them."
      })
    ),
    navbar: Type.Optional(
      Type.Composite([manifest$1.props], {
        title: "Navbar",
        "ui:group": "navbar"
      })
    ),
    footer: Type.Optional(
      Type.Composite([manifest.props], {
        title: "Footer",
        "ui:group": "footer"
        // "ui:hidden": true, // Hidden in attributes panel. Users will have to click the brick to configure it, even if the configuration applies globally, so they have the same editing experience
      })
    ),
    ogImage: Type.Optional(
      imageRef({
        title: "Social share image",
        description: "Image shown when this site is shared on social media",
        "ai:hidden": true,
        "ui:group": "meta",
        "ui:no-object-options": true,
        "ui:no-alt-text": true,
        "ui:show-img-search": false,
        "ui:no-dynamic": true
      })
    ),
    robotsIndexing: Type.Optional(
      boolean("Allow search engines to index this site", true, {
        description: "Disabling this will prevent search engines from indexing this site entirely",
        "ai:hidden": true,
        "ui:group": "meta"
      })
    ),
    headTags: Type.Optional(
      Type.String({
        title: "Head script tags",
        description: "Add custom tags to the <head> of your site. Useful for analytics tags, custom scripts, etc.",
        "ai:hidden": true,
        "ui:multiline": true,
        "ui:textarea-class": "h-40 !font-mono",
        "ui:placeholder": "<script src='https://example.com/script.js'><\/script>",
        "ui:premium": true,
        "ui:textarea-font-size": "1",
        "ui:group": "external",
        "ui:no-dynamic": true
      })
    ),
    bodyTags: Type.Optional(
      Type.String({
        title: "Body script tags",
        description: "Add custom tags to the <body> of your site. Useful for analytics tags, custom scripts, etc.",
        "ai:hidden": true,
        "ui:multiline": true,
        "ui:premium": true,
        "ui:textarea-class": "h-40 !font-mono",
        "ui:textarea-font-size": "1",
        "ui:placeholder": "<script src='https://example.com/script.js'><\/script>",
        "ui:group": "external",
        "ui:no-dynamic": true
      })
    )
  },
  {
    "ui:groups": {
      meta: "SEO & Meta tags",
      layout: "Layout",
      navbar: "Navbar",
      footer: "Footer",
      external: "External scripts"
    }
  }
);
Type.Omit(siteAttributesSchema, ["queries"]);
Type.Omit(pageAttributesSchema, ["queries"]);
var siteQueriesSchema = Type.Array(querySchema);
toLLMSchema(siteQueriesSchema);
function useBrickManifest(brickType) {
  return useMemo(() => manifests[brickType], [brickType]);
}
export {
  pageAttributesSchema as p,
  siteAttributesSchema as s,
  useBrickManifest as u
};
//# sourceMappingURL=use-brick-manifest.CIMdNZSk.js.map
