sanity-plugin-seofields 1.7.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +440 -29
  2. package/dist/SchemaOrgJsonLdPreview-DJLkIPq4.d.cts +78 -0
  3. package/dist/SchemaOrgJsonLdPreview-DJLkIPq4.d.ts +78 -0
  4. package/dist/SeoHealthTool-2COI27KI.cjs +8 -0
  5. package/dist/SeoHealthTool-2COI27KI.cjs.map +1 -0
  6. package/dist/SeoHealthTool-CWI3KB2V.js +8 -0
  7. package/dist/SeoHealthTool-CWI3KB2V.js.map +1 -0
  8. package/dist/{SeoPreview-WYH7NYNM.cjs → SeoPreview-LMZAWWOE.cjs} +35 -38
  9. package/dist/SeoPreview-LMZAWWOE.cjs.map +1 -0
  10. package/dist/{SeoPreview-KEGGQSPJ.js → SeoPreview-UNQBKTQO.js} +14 -11
  11. package/dist/SeoPreview-UNQBKTQO.js.map +1 -0
  12. package/dist/chunk-3OK3S2F7.cjs +673 -0
  13. package/dist/chunk-3OK3S2F7.cjs.map +1 -0
  14. package/dist/{chunk-GWPOJSGW.cjs → chunk-5XTQRILL.cjs} +1022 -307
  15. package/dist/chunk-5XTQRILL.cjs.map +1 -0
  16. package/dist/{chunk-2NMEKWO5.js → chunk-7N4MLTMR.js} +8 -15
  17. package/dist/chunk-7N4MLTMR.js.map +1 -0
  18. package/dist/{chunk-S367Y35J.cjs → chunk-A57XNQC7.cjs} +9 -20
  19. package/dist/chunk-A57XNQC7.cjs.map +1 -0
  20. package/dist/chunk-BWLJDK5J.js +624 -0
  21. package/dist/chunk-BWLJDK5J.js.map +1 -0
  22. package/dist/chunk-FUUWBQE2.cjs +195 -0
  23. package/dist/chunk-FUUWBQE2.cjs.map +1 -0
  24. package/dist/{chunk-ZBHLMQTS.cjs → chunk-HHO2AKAP.js} +44 -17
  25. package/dist/chunk-HHO2AKAP.js.map +1 -0
  26. package/dist/chunk-KIEO6QG3.js +195 -0
  27. package/dist/chunk-KIEO6QG3.js.map +1 -0
  28. package/dist/chunk-R2U7JF7U.cjs +624 -0
  29. package/dist/chunk-R2U7JF7U.cjs.map +1 -0
  30. package/dist/{chunk-HRKRV2X7.js → chunk-XZKQWV2H.js} +974 -148
  31. package/dist/chunk-XZKQWV2H.js.map +1 -0
  32. package/dist/{chunk-HDZZQCH7.js → chunk-Y46ACXM4.cjs} +45 -5
  33. package/dist/chunk-Y46ACXM4.cjs.map +1 -0
  34. package/dist/chunk-Z5AOUU4H.js +673 -0
  35. package/dist/chunk-Z5AOUU4H.js.map +1 -0
  36. package/dist/cli.js +27 -27
  37. package/dist/{component-DQ4KuQQD.d.ts → component-CjT1hvxh.d.ts} +3 -27
  38. package/dist/{component-D1sBm6ts.d.cts → component-WYh0z8as.d.cts} +3 -27
  39. package/dist/define-cli.cjs +2 -4
  40. package/dist/define-cli.cjs.map +1 -1
  41. package/dist/define-cli.js +4 -4
  42. package/dist/define-cli.js.map +1 -1
  43. package/dist/head.cjs +14 -0
  44. package/dist/head.cjs.map +1 -0
  45. package/dist/head.d.cts +254 -0
  46. package/dist/head.d.ts +254 -0
  47. package/dist/head.js +14 -0
  48. package/dist/head.js.map +1 -0
  49. package/dist/index.cjs +1797 -230
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.d.cts +11 -598
  52. package/dist/index.d.ts +11 -598
  53. package/dist/index.js +1777 -197
  54. package/dist/index.js.map +1 -1
  55. package/dist/next.cjs +210 -447
  56. package/dist/next.cjs.map +1 -1
  57. package/dist/next.d.cts +8 -200
  58. package/dist/next.d.ts +8 -200
  59. package/dist/next.js +200 -124
  60. package/dist/next.js.map +1 -1
  61. package/dist/plugin-DQdThyxG.d.ts +449 -0
  62. package/dist/plugin-DoGeZP79.d.cts +449 -0
  63. package/dist/schema/next.cjs +173 -319
  64. package/dist/schema/next.cjs.map +1 -1
  65. package/dist/schema/next.d.cts +4 -4
  66. package/dist/schema/next.d.ts +4 -4
  67. package/dist/schema/next.js +172 -8
  68. package/dist/schema/next.js.map +1 -1
  69. package/dist/schema.cjs +390 -489
  70. package/dist/schema.cjs.map +1 -1
  71. package/dist/schema.d.cts +26 -16
  72. package/dist/schema.d.ts +26 -16
  73. package/dist/schema.js +236 -13
  74. package/dist/schema.js.map +1 -1
  75. package/dist/server.cjs +149 -0
  76. package/dist/server.cjs.map +1 -0
  77. package/dist/server.d.cts +102 -0
  78. package/dist/server.d.ts +102 -0
  79. package/dist/server.js +149 -0
  80. package/dist/server.js.map +1 -0
  81. package/dist/{types-CeBULNFF.d.ts → types-BAdN1RMu.d.ts} +2 -2
  82. package/dist/{types-_wBLg6RV.d.cts → types-C5i3KMgs.d.cts} +2 -2
  83. package/dist/{types-9_wbCIi9.d.ts → types-DP-DiW6f.d.cts} +29 -2
  84. package/dist/{types-Bb49oRBV.d.cts → types-DRLUGLtX.d.ts} +29 -2
  85. package/dist/{types-B91ena4g.d.cts → types-DxlPXihz.d.cts} +8 -1
  86. package/dist/{types-B91ena4g.d.ts → types-DxlPXihz.d.ts} +8 -1
  87. package/package.json +25 -3
  88. package/dist/SeoHealthDashboard-IP5BJ322.cjs +0 -10
  89. package/dist/SeoHealthDashboard-IP5BJ322.cjs.map +0 -1
  90. package/dist/SeoHealthDashboard-PTUEVYZL.js +0 -4
  91. package/dist/SeoHealthDashboard-PTUEVYZL.js.map +0 -1
  92. package/dist/SeoHealthTool-CZZRMWQK.cjs +0 -14
  93. package/dist/SeoHealthTool-CZZRMWQK.cjs.map +0 -1
  94. package/dist/SeoHealthTool-IULT4G25.js +0 -12
  95. package/dist/SeoHealthTool-IULT4G25.js.map +0 -1
  96. package/dist/SeoPreview-KEGGQSPJ.js.map +0 -1
  97. package/dist/SeoPreview-WYH7NYNM.cjs.map +0 -1
  98. package/dist/chunk-2NMEKWO5.js.map +0 -1
  99. package/dist/chunk-5YRH47VQ.cjs +0 -2167
  100. package/dist/chunk-5YRH47VQ.cjs.map +0 -1
  101. package/dist/chunk-ARELX3GK.cjs +0 -689
  102. package/dist/chunk-ARELX3GK.cjs.map +0 -1
  103. package/dist/chunk-AW7OKBQQ.js +0 -2161
  104. package/dist/chunk-AW7OKBQQ.js.map +0 -1
  105. package/dist/chunk-FONJYVF2.js +0 -610
  106. package/dist/chunk-FONJYVF2.js.map +0 -1
  107. package/dist/chunk-GWPOJSGW.cjs.map +0 -1
  108. package/dist/chunk-HDZZQCH7.js.map +0 -1
  109. package/dist/chunk-HRKRV2X7.js.map +0 -1
  110. package/dist/chunk-S367Y35J.cjs.map +0 -1
  111. package/dist/chunk-ZBHLMQTS.cjs.map +0 -1
@@ -1,8 +1,7 @@
1
- 'use strict';
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var chunkS367Y35J_cjs = require('./chunk-S367Y35J.cjs');
4
- var sanity = require('sanity');
5
- var icons = require('@sanity/icons');
3
+
4
+ var _chunkA57XNQC7cjs = require('./chunk-A57XNQC7.cjs');
6
5
 
7
6
  // src/schema/_shared.ts
8
7
  var imageObjectInnerFields = [
@@ -723,7 +722,7 @@ function inLanguageField(opts = {}) {
723
722
  }
724
723
  function nameField(opts = {}) {
725
724
  var _a, _b;
726
- return chunkS367Y35J_cjs.__spreadValues({
725
+ return _chunkA57XNQC7cjs.__spreadValues.call(void 0, {
727
726
  name: "name",
728
727
  title: (_a = opts.title) != null ? _a : "Name",
729
728
  type: "string",
@@ -750,7 +749,7 @@ function potentialActionSearch(opts = {}) {
750
749
  }
751
750
  function descriptionField(opts = {}) {
752
751
  var _a, _b;
753
- return chunkS367Y35J_cjs.__spreadValues({
752
+ return _chunkA57XNQC7cjs.__spreadValues.call(void 0, {
754
753
  name: "description",
755
754
  title: (_a = opts.title) != null ? _a : "Description",
756
755
  type: "text",
@@ -760,7 +759,7 @@ function descriptionField(opts = {}) {
760
759
  }
761
760
  function urlField(opts = {}) {
762
761
  var _a, _b;
763
- return chunkS367Y35J_cjs.__spreadValues({
762
+ return _chunkA57XNQC7cjs.__spreadValues.call(void 0, {
764
763
  name: "url",
765
764
  title: (_a = opts.title) != null ? _a : "URL",
766
765
  type: "url",
@@ -770,7 +769,7 @@ function urlField(opts = {}) {
770
769
  }
771
770
  function headlineField(opts = {}) {
772
771
  var _a, _b;
773
- return chunkS367Y35J_cjs.__spreadValues({
772
+ return _chunkA57XNQC7cjs.__spreadValues.call(void 0, {
774
773
  name: "headline",
775
774
  title: (_a = opts.title) != null ? _a : "Headline",
776
775
  type: "string",
@@ -779,7 +778,7 @@ function headlineField(opts = {}) {
779
778
  }
780
779
  function datePublishedField(opts = {}) {
781
780
  var _a, _b, _c, _d;
782
- return chunkS367Y35J_cjs.__spreadValues({
781
+ return _chunkA57XNQC7cjs.__spreadValues.call(void 0, {
783
782
  name: (_a = opts.name) != null ? _a : "datePublished",
784
783
  title: (_b = opts.title) != null ? _b : "Date Published",
785
784
  type: (_c = opts.dateType) != null ? _c : "date",
@@ -1064,10 +1063,10 @@ function resolvePolymorphicPersonOrOrg(input) {
1064
1063
  const obj = input;
1065
1064
  const variant = obj.variant;
1066
1065
  if (variant === "person" && obj.person && typeof obj.person === "object") {
1067
- return chunkS367Y35J_cjs.__spreadValues({ "@type": "Person" }, stripEmpty(obj.person));
1066
+ return _chunkA57XNQC7cjs.__spreadValues.call(void 0, { "@type": "Person" }, stripEmpty(obj.person));
1068
1067
  }
1069
1068
  if (variant === "organization" && obj.organization && typeof obj.organization === "object") {
1070
- return chunkS367Y35J_cjs.__spreadValues({ "@type": "Organization" }, stripEmpty(obj.organization));
1069
+ return _chunkA57XNQC7cjs.__spreadValues.call(void 0, { "@type": "Organization" }, stripEmpty(obj.organization));
1071
1070
  }
1072
1071
  return null;
1073
1072
  }
@@ -1083,7 +1082,7 @@ function stripEmpty(obj, exclude = []) {
1083
1082
  }
1084
1083
  function issnField(opts = {}) {
1085
1084
  var _a, _b;
1086
- return chunkS367Y35J_cjs.__spreadValues({
1085
+ return _chunkA57XNQC7cjs.__spreadValues.call(void 0, {
1087
1086
  name: "issn",
1088
1087
  title: (_a = opts.title) != null ? _a : "ISSN",
1089
1088
  type: "string",
@@ -1092,7 +1091,7 @@ function issnField(opts = {}) {
1092
1091
  }
1093
1092
  function licenseUrlField(opts = {}) {
1094
1093
  var _a, _b;
1095
- return chunkS367Y35J_cjs.__spreadValues({
1094
+ return _chunkA57XNQC7cjs.__spreadValues.call(void 0, {
1096
1095
  name: "license",
1097
1096
  title: (_a = opts.title) != null ? _a : "License URL",
1098
1097
  type: "url",
@@ -1100,148 +1099,8 @@ function licenseUrlField(opts = {}) {
1100
1099
  urlValidation: { schemes: ["http", "https"] }
1101
1100
  }, opts.required ? { required: opts.required } : {});
1102
1101
  }
1103
- function buildField(fieldDef, validation) {
1104
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
1105
- if (fieldDef.type === "select" && ((_a = fieldDef.variants) == null ? void 0 : _a.length)) {
1106
- const variants = fieldDef.variants;
1107
- const defaultVariant = (_b = fieldDef.defaultVariant) != null ? _b : variants[0].value;
1108
- const innerFields = [
1109
- {
1110
- name: "variant",
1111
- title: "Type",
1112
- type: "string",
1113
- description: "Choose how to provide this value.",
1114
- initialValue: defaultVariant,
1115
- options: variants.map((v) => ({ title: v.title, value: v.value })),
1116
- layout: "radio"
1117
- },
1118
- ...variants.map((v) => {
1119
- if (v.fields.length === 1 && v.fields[0].name === v.value) {
1120
- return v.fields[0];
1121
- }
1122
- return {
1123
- name: v.value,
1124
- title: v.title,
1125
- type: "object",
1126
- jsonLdType: v.jsonLdType,
1127
- fields: v.fields
1128
- };
1129
- })
1130
- ];
1131
- const base2 = {
1132
- name: fieldDef.name,
1133
- title: fieldDef.title,
1134
- type: "object",
1135
- fields: innerFields.map((child) => {
1136
- const built = buildField(child, validation);
1137
- if (child.name !== "variant") {
1138
- const dv = defaultVariant;
1139
- built.hidden = ({ parent }) => {
1140
- var _a2;
1141
- return ((_a2 = parent == null ? void 0 : parent.variant) != null ? _a2 : dv) !== child.name;
1142
- };
1143
- }
1144
- return built;
1145
- })
1146
- };
1147
- if (fieldDef.description) base2.description = fieldDef.description;
1148
- return sanity.defineField(base2);
1149
- }
1150
- if (fieldDef.type === "copyrightYear") {
1151
- const base2 = {
1152
- name: fieldDef.name,
1153
- title: fieldDef.title,
1154
- type: "object",
1155
- description: (_c = fieldDef.description) != null ? _c : 'Copyright year. Toggle "Use current year" to emit the current year dynamically.',
1156
- fields: [
1157
- sanity.defineField({
1158
- name: "useDynamicYear",
1159
- title: "Use current year (dynamic)",
1160
- type: "boolean",
1161
- initialValue: false
1162
- }),
1163
- sanity.defineField({
1164
- name: "year",
1165
- title: "Static year",
1166
- type: "number",
1167
- hidden: ({ parent }) => (parent == null ? void 0 : parent.useDynamicYear) === true
1168
- })
1169
- ]
1170
- };
1171
- return sanity.defineField(base2);
1172
- }
1173
- const base = {
1174
- name: fieldDef.name,
1175
- title: fieldDef.title,
1176
- type: fieldDef.type
1177
- };
1178
- if (fieldDef.description) base.description = fieldDef.description;
1179
- if (fieldDef.initialValue !== void 0) base.initialValue = fieldDef.initialValue;
1180
- if (fieldDef.rows) base.rows = fieldDef.rows;
1181
- if (fieldDef.options) {
1182
- base.options = chunkS367Y35J_cjs.__spreadValues({ list: fieldDef.options }, fieldDef.layout && { layout: fieldDef.layout });
1183
- }
1184
- if (fieldDef.type === "array" && ((_d = fieldDef.fields) == null ? void 0 : _d.length) && !fieldDef.of) {
1185
- base.of = [
1186
- {
1187
- type: "object",
1188
- fields: fieldDef.fields.map((child) => buildField(child, validation))
1189
- }
1190
- ];
1191
- } else if (fieldDef.of) {
1192
- base.of = fieldDef.of;
1193
- }
1194
- if (fieldDef.type !== "array" && ((_e = fieldDef.fields) == null ? void 0 : _e.length)) {
1195
- base.fields = fieldDef.fields.map((child) => buildField(child, validation));
1196
- }
1197
- if (fieldDef.type === "url" && (fieldDef.required || fieldDef.urlValidation)) {
1198
- const required = fieldDef.required;
1199
- const requiredMsg = required ? (_f = validation == null ? void 0 : validation[required.key]) != null ? _f : required.message : void 0;
1200
- const schemes = (_h = (_g = fieldDef.urlValidation) == null ? void 0 : _g.schemes) != null ? _h : ["http", "https"];
1201
- const allowRelative = (_j = (_i = fieldDef.urlValidation) == null ? void 0 : _i.allowRelative) != null ? _j : false;
1202
- base.validation = (Rule) => {
1203
- const checks = [];
1204
- if (requiredMsg) checks.push(Rule.required().error(requiredMsg));
1205
- checks.push(
1206
- Rule.uri({ scheme: schemes, allowRelative }).error(
1207
- `Must be a valid URL (${schemes.join(", ")}).`
1208
- )
1209
- );
1210
- return checks;
1211
- };
1212
- } else if (fieldDef.required) {
1213
- const msg = (_k = validation == null ? void 0 : validation[fieldDef.required.key]) != null ? _k : fieldDef.required.message;
1214
- base.validation = (Rule) => Rule.required().error(msg);
1215
- }
1216
- return sanity.defineField(base);
1217
- }
1218
- function mapNameToSameValue(...items) {
1219
- return items.reduce(
1220
- (acc, item) => {
1221
- acc[item.name] = item.name;
1222
- return acc;
1223
- },
1224
- {}
1225
- );
1226
- }
1227
- function generateSchemaType(def, config = {}) {
1228
- return sanity.defineType(chunkS367Y35J_cjs.__spreadProps(chunkS367Y35J_cjs.__spreadValues({
1229
- name: def.name,
1230
- title: def.title,
1231
- type: "object"
1232
- }, def.icon && { icon: def.icon }), {
1233
- fields: def.fields.map((f) => buildField(f, config.validation)),
1234
- preview: {
1235
- select: mapNameToSameValue(...def.fields),
1236
- prepare(selection) {
1237
- return chunkS367Y35J_cjs.__spreadValues({
1238
- title: def.title,
1239
- subtitle: (def == null ? void 0 : def.customPrepareSubtitle) ? def.customPrepareSubtitle(selection) : `@type: ${def.title}`
1240
- }, def.icon && { media: def.icon });
1241
- }
1242
- }
1243
- }));
1244
- }
1102
+
1103
+ // src/schema/jsonLd.ts
1245
1104
  var SANITY_INTERNAL_KEYS = /* @__PURE__ */ new Set([
1246
1105
  "_key",
1247
1106
  "_type",
@@ -1335,64 +1194,261 @@ function buildGenericJsonLd(schemaType, data, fieldDefs, requiredFields = []) {
1335
1194
  if (!data[req]) return null;
1336
1195
  }
1337
1196
  const body = buildNestedJsonLd(data, fieldDefs);
1338
- return chunkS367Y35J_cjs.__spreadValues({
1197
+ return _chunkA57XNQC7cjs.__spreadValues.call(void 0, {
1339
1198
  "@context": "https://schema.org",
1340
1199
  "@type": schemaType
1341
1200
  }, body);
1342
1201
  }
1202
+
1203
+ // src/schema/generator.ts
1204
+ var _sanity = require('sanity');
1205
+
1206
+ // src/schema/components/SchemaOrgJsonLdPreview.tsx
1207
+ var _ui = require('@sanity/ui');
1208
+ var _react = require('react');
1209
+
1210
+
1211
+ // src/utils/syntaxHighlight.ts
1212
+ var LIGHT = {
1213
+ default: "#24292f",
1214
+ punctuation: "#57606a",
1215
+ tag: "#1a7f37",
1216
+ // HTML tag names — vivid green
1217
+ attr: "#8250df",
1218
+ // HTML attribute names / JSON keys — vivid purple
1219
+ string: "#cf222e",
1220
+ // Attribute values / JSON string values — vivid red
1221
+ number: "#953800",
1222
+ // Numbers — orange-brown
1223
+ keyword: "#0969da"
1224
+ // true / false / null — vivid blue
1225
+ };
1226
+ var DARK = {
1227
+ default: "#cdd9e5",
1228
+ punctuation: "#768390",
1229
+ tag: "#57ab5a",
1230
+ // vivid green
1231
+ attr: "#dcbdfb",
1232
+ // vivid purple
1233
+ string: "#ff9492",
1234
+ // vivid red/pink
1235
+ number: "#ffa657",
1236
+ // orange
1237
+ keyword: "#6cb6ff"
1238
+ // vivid blue
1239
+ };
1240
+ function getColors(scheme) {
1241
+ return scheme === "dark" ? DARK : LIGHT;
1242
+ }
1243
+ function merge(tokens) {
1244
+ const out = [];
1245
+ for (const t of tokens) {
1246
+ const last = out[out.length - 1];
1247
+ if (last && last.color === t.color) {
1248
+ last.text += t.text;
1249
+ } else {
1250
+ out.push({ text: t.text, color: t.color });
1251
+ }
1252
+ }
1253
+ return out;
1254
+ }
1255
+ function parseAttrToken(code, pos, tokens, C) {
1256
+ const ch = code[pos];
1257
+ if (ch === " " || ch === " ") {
1258
+ tokens.push({ text: ch, color: C.default });
1259
+ return pos + 1;
1260
+ }
1261
+ if (ch === "/" || ch === "=") {
1262
+ tokens.push({ text: ch, color: C.punctuation });
1263
+ return pos + 1;
1264
+ }
1265
+ if (ch === '"' || ch === "'") {
1266
+ const end = ch;
1267
+ let i2 = pos + 1;
1268
+ while (i2 < code.length && code[i2] !== end) i2++;
1269
+ if (i2 < code.length) i2++;
1270
+ tokens.push({ text: code.slice(pos, i2), color: C.string });
1271
+ return i2;
1272
+ }
1273
+ let i = pos;
1274
+ while (i < code.length && code[i] !== "=" && code[i] !== " " && code[i] !== ">" && code[i] !== "/" && code[i] !== " ")
1275
+ i++;
1276
+ if (i > pos) tokens.push({ text: code.slice(pos, i), color: C.attr });
1277
+ return i;
1278
+ }
1279
+ function parseTag(code, pos, tokens, C) {
1280
+ tokens.push({ text: "<", color: C.punctuation });
1281
+ let i = pos + 1;
1282
+ if (i < code.length && code[i] === "/") {
1283
+ tokens.push({ text: "/", color: C.punctuation });
1284
+ i++;
1285
+ }
1286
+ const nameStart = i;
1287
+ while (i < code.length && code[i] !== " " && code[i] !== ">" && code[i] !== "/") i++;
1288
+ if (i > nameStart) tokens.push({ text: code.slice(nameStart, i), color: C.tag });
1289
+ while (i < code.length && code[i] !== ">") {
1290
+ i = parseAttrToken(code, i, tokens, C);
1291
+ }
1292
+ if (i < code.length && code[i] === ">") {
1293
+ tokens.push({ text: ">", color: C.punctuation });
1294
+ i++;
1295
+ }
1296
+ return i;
1297
+ }
1298
+ function tokenizeHtml(code, scheme = "light") {
1299
+ const C = getColors(scheme);
1300
+ const tokens = [];
1301
+ let i = 0;
1302
+ while (i < code.length) {
1303
+ if (code[i] === "<") {
1304
+ i = parseTag(code, i, tokens, C);
1305
+ } else if (code[i] === "\n") {
1306
+ tokens.push({ text: "\n", color: C.default });
1307
+ i++;
1308
+ } else {
1309
+ const start = i;
1310
+ while (i < code.length && code[i] !== "<" && code[i] !== "\n") i++;
1311
+ if (i > start) tokens.push({ text: code.slice(start, i), color: C.default });
1312
+ }
1313
+ }
1314
+ return merge(tokens);
1315
+ }
1316
+ function tokenizeJson(code, scheme = "light") {
1317
+ const C = getColors(scheme);
1318
+ const tokens = [];
1319
+ let i = 0;
1320
+ while (i < code.length) {
1321
+ const ch = code[i];
1322
+ if (ch === "\n") {
1323
+ tokens.push({ text: "\n", color: C.default });
1324
+ i++;
1325
+ } else if (ch === " " || ch === " ") {
1326
+ tokens.push({ text: ch, color: C.default });
1327
+ i++;
1328
+ } else if ("{}[]:,".includes(ch)) {
1329
+ tokens.push({ text: ch, color: C.punctuation });
1330
+ i++;
1331
+ } else if (ch === '"') {
1332
+ const start = i++;
1333
+ while (i < code.length) {
1334
+ if (code[i] === "\\") {
1335
+ i += 2;
1336
+ continue;
1337
+ }
1338
+ if (code[i] === '"') {
1339
+ i++;
1340
+ break;
1341
+ }
1342
+ i++;
1343
+ }
1344
+ const str = code.slice(start, i);
1345
+ let j = i;
1346
+ while (j < code.length && (code[j] === " " || code[j] === " ")) j++;
1347
+ tokens.push({ text: str, color: j < code.length && code[j] === ":" ? C.attr : C.string });
1348
+ } else if (code.slice(i, i + 4) === "null") {
1349
+ tokens.push({ text: "null", color: C.keyword });
1350
+ i += 4;
1351
+ } else if (code.slice(i, i + 4) === "true") {
1352
+ tokens.push({ text: "true", color: C.keyword });
1353
+ i += 4;
1354
+ } else if (code.slice(i, i + 5) === "false") {
1355
+ tokens.push({ text: "false", color: C.keyword });
1356
+ i += 5;
1357
+ } else if (ch === "-" || ch >= "0" && ch <= "9") {
1358
+ const start = i;
1359
+ if (ch === "-") i++;
1360
+ while (i < code.length && /[\d.eE+-]/.test(code[i])) i++;
1361
+ tokens.push({ text: code.slice(start, i), color: C.number });
1362
+ } else {
1363
+ tokens.push({ text: ch, color: C.default });
1364
+ i++;
1365
+ }
1366
+ }
1367
+ return merge(tokens);
1368
+ }
1369
+
1370
+ // src/schema/icons.ts
1371
+
1372
+
1373
+
1374
+
1375
+
1376
+
1377
+
1378
+
1379
+
1380
+
1381
+
1382
+
1383
+
1384
+
1385
+
1386
+
1387
+
1388
+
1389
+
1390
+
1391
+
1392
+
1393
+
1394
+
1395
+
1396
+
1397
+
1398
+ var _icons = require('@sanity/icons');
1343
1399
  var SchemaOrgIcons = {
1344
1400
  // Website & WebPage
1345
- website: icons.EarthGlobeIcon,
1346
- webPage: icons.DocumentTextIcon,
1401
+ website: _icons.EarthGlobeIcon,
1402
+ webPage: _icons.DocumentTextIcon,
1347
1403
  // Organization & Business
1348
- organization: icons.ComponentIcon,
1349
- localBusiness: icons.HomeIcon,
1350
- brand: icons.SparkleIcon,
1404
+ organization: _icons.ComponentIcon,
1405
+ localBusiness: _icons.HomeIcon,
1406
+ brand: _icons.SparkleIcon,
1351
1407
  // People
1352
- person: icons.UserIcon,
1408
+ person: _icons.UserIcon,
1353
1409
  // Navigation
1354
- breadcrumbList: icons.LinkIcon,
1410
+ breadcrumbList: _icons.LinkIcon,
1355
1411
  // Media
1356
- imageObject: icons.ImageIcon,
1357
- videoObject: icons.VideoIcon,
1412
+ imageObject: _icons.ImageIcon,
1413
+ videoObject: _icons.VideoIcon,
1358
1414
  // Content
1359
- article: icons.DocumentTextIcon,
1360
- blogPosting: icons.BookIcon,
1361
- faqPage: icons.HelpCircleIcon,
1362
- howTo: icons.ListIcon,
1363
- recipe: icons.BookIcon,
1364
- socialMediaPosting: icons.CommentIcon,
1415
+ article: _icons.DocumentTextIcon,
1416
+ blogPosting: _icons.BookIcon,
1417
+ faqPage: _icons.HelpCircleIcon,
1418
+ howTo: _icons.ListIcon,
1419
+ recipe: _icons.BookIcon,
1420
+ socialMediaPosting: _icons.CommentIcon,
1365
1421
  // Commerce
1366
- product: icons.PackageIcon,
1367
- offer: icons.TagIcon,
1368
- aggregateRating: icons.BarChartIcon,
1369
- review: icons.HeartFilledIcon,
1370
- service: icons.RobotIcon,
1422
+ product: _icons.PackageIcon,
1423
+ offer: _icons.TagIcon,
1424
+ aggregateRating: _icons.BarChartIcon,
1425
+ review: _icons.HeartFilledIcon,
1426
+ service: _icons.RobotIcon,
1371
1427
  // Location
1372
- postalAddress: icons.MarkerIcon,
1373
- place: icons.MarkerIcon,
1374
- event: icons.CalendarIcon,
1428
+ postalAddress: _icons.MarkerIcon,
1429
+ place: _icons.MarkerIcon,
1430
+ event: _icons.CalendarIcon,
1375
1431
  // Contact
1376
- contactPoint: icons.ApiIcon,
1432
+ contactPoint: _icons.ApiIcon,
1377
1433
  // Software
1378
- softwareApplication: icons.CodeBlockIcon,
1379
- webApplication: icons.DesktopIcon,
1434
+ softwareApplication: _icons.CodeBlockIcon,
1435
+ webApplication: _icons.DesktopIcon,
1380
1436
  // Education
1381
- course: icons.BookIcon,
1437
+ course: _icons.BookIcon,
1382
1438
  // Legal & geographic
1383
- legalService: icons.MasterDetailIcon,
1384
- country: icons.EarthGlobeIcon,
1439
+ legalService: _icons.MasterDetailIcon,
1440
+ country: _icons.EarthGlobeIcon,
1385
1441
  // New types
1386
- jobPosting: icons.ClipboardIcon,
1387
- restaurant: icons.HomeIcon,
1388
- movie: icons.PlayIcon,
1389
- book: icons.BookIcon,
1390
- newsArticle: icons.DocumentTextIcon,
1391
- opinionNewsArticle: icons.DocumentTextIcon,
1392
- itemList: icons.ListIcon,
1393
- profilePage: icons.UserIcon,
1394
- musicRecording: icons.PlayIcon,
1395
- musicAlbum: icons.PackageIcon
1442
+ jobPosting: _icons.ClipboardIcon,
1443
+ restaurant: _icons.HomeIcon,
1444
+ movie: _icons.PlayIcon,
1445
+ book: _icons.BookIcon,
1446
+ newsArticle: _icons.DocumentTextIcon,
1447
+ opinionNewsArticle: _icons.DocumentTextIcon,
1448
+ itemList: _icons.ListIcon,
1449
+ profilePage: _icons.UserIcon,
1450
+ musicRecording: _icons.PlayIcon,
1451
+ musicAlbum: _icons.PackageIcon
1396
1452
  };
1397
1453
 
1398
1454
  // src/schema/aggregateRating/schema.ts
@@ -2983,6 +3039,61 @@ function schemaOrgOpinionNewsArticle(config = {}) {
2983
3039
  );
2984
3040
  }
2985
3041
 
3042
+ // src/schema/utils.ts
3043
+ function escapeJsonForScript(json) {
3044
+ return json.replace(/</g, "\\u003C").replace(/>/g, "\\u003E").replace(/&/g, "\\u0026").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
3045
+ }
3046
+
3047
+ // src/schema/SchemaOrgScript.tsx
3048
+ var _jsxruntime = require('react/jsx-runtime');
3049
+ function SchemaOrgScript({
3050
+ jsonLd
3051
+ }) {
3052
+ if (!jsonLd) return null;
3053
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3054
+ "script",
3055
+ {
3056
+ type: "application/ld+json",
3057
+ dangerouslySetInnerHTML: { __html: escapeJsonForScript(JSON.stringify(jsonLd)) }
3058
+ }
3059
+ );
3060
+ }
3061
+
3062
+ // src/schema/organization/component.tsx
3063
+
3064
+ function buildOrganizationJsonLd(data, imageUrlResolver) {
3065
+ var _a, _b;
3066
+ if (!(data == null ? void 0 : data.name) || !(data == null ? void 0 : data.url)) return null;
3067
+ const jsonLd = {
3068
+ "@context": "https://schema.org",
3069
+ "@type": "Organization",
3070
+ name: data.name,
3071
+ url: data.url
3072
+ };
3073
+ const logoUrl = data.logoUrl || (data.logo && imageUrlResolver ? imageUrlResolver(data.logo) : void 0);
3074
+ if (logoUrl) jsonLd.logo = logoUrl;
3075
+ if (data.description) jsonLd.description = data.description;
3076
+ if (data.sameAs) jsonLd.sameAs = data.sameAs;
3077
+ if ((_a = data.contactPoint) == null ? void 0 : _a.contactType) {
3078
+ const cp = {
3079
+ "@type": "ContactPoint",
3080
+ contactType: data.contactPoint.contactType
3081
+ };
3082
+ if (data.contactPoint.email) cp.email = data.contactPoint.email;
3083
+ if ((_b = data.contactPoint.availableLanguage) == null ? void 0 : _b.length) {
3084
+ cp.availableLanguage = data.contactPoint.availableLanguage;
3085
+ }
3086
+ jsonLd.contactPoint = cp;
3087
+ }
3088
+ return jsonLd;
3089
+ }
3090
+ function OrganizationSchema({
3091
+ data,
3092
+ imageUrlResolver
3093
+ }) {
3094
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SchemaOrgScript, { jsonLd: buildOrganizationJsonLd(data, imageUrlResolver) });
3095
+ }
3096
+
2986
3097
  // src/schema/person/schema.ts
2987
3098
  var personFields = [
2988
3099
  nameField({
@@ -4011,115 +4122,719 @@ function schemaOrgWebPage(config = {}) {
4011
4122
  );
4012
4123
  }
4013
4124
 
4014
- exports.IETF_LANGUAGE_OPTIONS = IETF_LANGUAGE_OPTIONS;
4015
- exports.SchemaOrgIcons = SchemaOrgIcons;
4016
- exports.aggregateRatingFields = aggregateRatingFields;
4017
- exports.articleFields = articleFields;
4018
- exports.blogPostingFields = blogPostingFields;
4019
- exports.bookFields = bookFields;
4020
- exports.brandFields = brandFields;
4021
- exports.breadcrumbListFields = breadcrumbListFields;
4022
- exports.buildGenericJsonLd = buildGenericJsonLd;
4023
- exports.contactPointFields = contactPointFields;
4024
- exports.countryFields = countryFields;
4025
- exports.courseFields = courseFields;
4026
- exports.datePublishedField = datePublishedField;
4027
- exports.descriptionField = descriptionField;
4028
- exports.eventFields = eventFields;
4029
- exports.faqPageFields = faqPageFields;
4030
- exports.generateSchemaType = generateSchemaType;
4031
- exports.headlineField = headlineField;
4032
- exports.howToFields = howToFields;
4033
- exports.imageObjectFields = imageObjectFields;
4034
- exports.inLanguageField = inLanguageField;
4035
- exports.issnField = issnField;
4036
- exports.itemListFields = itemListFields;
4037
- exports.jobPostingFields = jobPostingFields;
4038
- exports.legalServiceFields = legalServiceFields;
4039
- exports.localBusinessFields = localBusinessFields;
4040
- exports.movieFields = movieFields;
4041
- exports.musicAlbumFields = musicAlbumFields;
4042
- exports.musicRecordingFields = musicRecordingFields;
4043
- exports.nameField = nameField;
4044
- exports.newsArticleFields = newsArticleFields;
4045
- exports.offerFields = offerFields;
4046
- exports.opinionNewsArticleFields = opinionNewsArticleFields;
4047
- exports.personFields = personFields;
4048
- exports.placeFields = placeFields;
4049
- exports.polymorphicAdditionalType = polymorphicAdditionalType;
4050
- exports.polymorphicArchivedAt = polymorphicArchivedAt;
4051
- exports.polymorphicAuthor = polymorphicAuthor;
4052
- exports.polymorphicCitation = polymorphicCitation;
4053
- exports.polymorphicContentRating = polymorphicContentRating;
4054
- exports.polymorphicContributor = polymorphicContributor;
4055
- exports.polymorphicCopyrightHolder = polymorphicCopyrightHolder;
4056
- exports.polymorphicCreator = polymorphicCreator;
4057
- exports.polymorphicFunder = polymorphicFunder;
4058
- exports.polymorphicGenre = polymorphicGenre;
4059
- exports.polymorphicIdentifier = polymorphicIdentifier;
4060
- exports.polymorphicImage = polymorphicImage;
4061
- exports.polymorphicIsBasedOn = polymorphicIsBasedOn;
4062
- exports.polymorphicIsPartOf = polymorphicIsPartOf;
4063
- exports.polymorphicKeywords = polymorphicKeywords;
4064
- exports.polymorphicLicense = polymorphicLicense;
4065
- exports.polymorphicLocationCreated = polymorphicLocationCreated;
4066
- exports.polymorphicMaintainer = polymorphicMaintainer;
4067
- exports.polymorphicMaterial = polymorphicMaterial;
4068
- exports.polymorphicOwner = polymorphicOwner;
4069
- exports.polymorphicPublisher = polymorphicPublisher;
4070
- exports.postalAddressFields = postalAddressFields;
4071
- exports.potentialActionSearch = potentialActionSearch;
4072
- exports.productFields = productFields;
4073
- exports.profilePageFields = profilePageFields;
4074
- exports.recipeFields = recipeFields;
4075
- exports.resolvePolymorphicPersonOrOrg = resolvePolymorphicPersonOrOrg;
4076
- exports.restaurantFields = restaurantFields;
4077
- exports.reviewFields = reviewFields;
4078
- exports.schemaOrgAggregateRating = schemaOrgAggregateRating;
4079
- exports.schemaOrgArticle = schemaOrgArticle;
4080
- exports.schemaOrgBlogPosting = schemaOrgBlogPosting;
4081
- exports.schemaOrgBook = schemaOrgBook;
4082
- exports.schemaOrgBrand = schemaOrgBrand;
4083
- exports.schemaOrgBreadcrumbList = schemaOrgBreadcrumbList;
4084
- exports.schemaOrgContactPoint = schemaOrgContactPoint;
4085
- exports.schemaOrgCountry = schemaOrgCountry;
4086
- exports.schemaOrgCourse = schemaOrgCourse;
4087
- exports.schemaOrgEvent = schemaOrgEvent;
4088
- exports.schemaOrgFAQPage = schemaOrgFAQPage;
4089
- exports.schemaOrgHowTo = schemaOrgHowTo;
4090
- exports.schemaOrgImageObject = schemaOrgImageObject;
4091
- exports.schemaOrgItemList = schemaOrgItemList;
4092
- exports.schemaOrgJobPosting = schemaOrgJobPosting;
4093
- exports.schemaOrgLegalService = schemaOrgLegalService;
4094
- exports.schemaOrgLocalBusiness = schemaOrgLocalBusiness;
4095
- exports.schemaOrgMovie = schemaOrgMovie;
4096
- exports.schemaOrgMusicAlbum = schemaOrgMusicAlbum;
4097
- exports.schemaOrgMusicRecording = schemaOrgMusicRecording;
4098
- exports.schemaOrgNewsArticle = schemaOrgNewsArticle;
4099
- exports.schemaOrgOffer = schemaOrgOffer;
4100
- exports.schemaOrgOpinionNewsArticle = schemaOrgOpinionNewsArticle;
4101
- exports.schemaOrgPerson = schemaOrgPerson;
4102
- exports.schemaOrgPlace = schemaOrgPlace;
4103
- exports.schemaOrgPostalAddress = schemaOrgPostalAddress;
4104
- exports.schemaOrgProduct = schemaOrgProduct;
4105
- exports.schemaOrgProfilePage = schemaOrgProfilePage;
4106
- exports.schemaOrgRecipe = schemaOrgRecipe;
4107
- exports.schemaOrgRestaurant = schemaOrgRestaurant;
4108
- exports.schemaOrgReview = schemaOrgReview;
4109
- exports.schemaOrgService = schemaOrgService;
4110
- exports.schemaOrgSocialMediaPosting = schemaOrgSocialMediaPosting;
4111
- exports.schemaOrgSoftwareApplication = schemaOrgSoftwareApplication;
4112
- exports.schemaOrgVideoObject = schemaOrgVideoObject;
4113
- exports.schemaOrgWebApplication = schemaOrgWebApplication;
4114
- exports.schemaOrgWebPage = schemaOrgWebPage;
4115
- exports.serviceFields = serviceFields;
4116
- exports.socialMediaPostingFields = socialMediaPostingFields;
4117
- exports.softwareApplicationFields = softwareApplicationFields;
4118
- exports.urlField = urlField;
4119
- exports.videoObjectFields = videoObjectFields;
4120
- exports.webApplicationFields = webApplicationFields;
4121
- exports.webPageFields = webPageFields;
4122
- exports.withCreativeWorkCommons = withCreativeWorkCommons;
4123
- exports.withThingCommons = withThingCommons;
4124
- //# sourceMappingURL=chunk-GWPOJSGW.cjs.map
4125
- //# sourceMappingURL=chunk-GWPOJSGW.cjs.map
4125
+ // src/schema/website/component.tsx
4126
+
4127
+ function buildWebsiteJsonLd(data) {
4128
+ if (!(data == null ? void 0 : data.name) || !(data == null ? void 0 : data.url)) return null;
4129
+ const jsonLd = {
4130
+ "@context": "https://schema.org",
4131
+ "@type": "WebSite",
4132
+ name: data.name,
4133
+ url: data.url
4134
+ };
4135
+ if (data.description) jsonLd.description = data.description;
4136
+ if (data.inLanguage) jsonLd.inLanguage = data.inLanguage;
4137
+ const publisher = resolvePolymorphicPersonOrOrg(data.publisher);
4138
+ if (publisher) jsonLd.publisher = publisher;
4139
+ return jsonLd;
4140
+ }
4141
+ function WebsiteSchema({ data }) {
4142
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SchemaOrgScript, { jsonLd: buildWebsiteJsonLd(data) });
4143
+ }
4144
+
4145
+ // src/schema/SchemaOrgScripts.tsx
4146
+
4147
+ var GENERIC_TYPES = {
4148
+ schemaOrgWebPage: { schemaType: "WebPage", fields: webPageFields, requiredFields: ["name"] },
4149
+ schemaOrgPerson: { schemaType: "Person", fields: personFields, requiredFields: ["name"] },
4150
+ schemaOrgBreadcrumbList: {
4151
+ schemaType: "BreadcrumbList",
4152
+ fields: breadcrumbListFields,
4153
+ requiredFields: []
4154
+ },
4155
+ schemaOrgImageObject: {
4156
+ schemaType: "ImageObject",
4157
+ fields: imageObjectFields,
4158
+ requiredFields: ["url"]
4159
+ },
4160
+ schemaOrgArticle: { schemaType: "Article", fields: articleFields, requiredFields: ["headline"] },
4161
+ schemaOrgBlogPosting: {
4162
+ schemaType: "BlogPosting",
4163
+ fields: blogPostingFields,
4164
+ requiredFields: ["headline"]
4165
+ },
4166
+ schemaOrgFAQPage: { schemaType: "FAQPage", fields: faqPageFields, requiredFields: [] },
4167
+ schemaOrgHowTo: { schemaType: "HowTo", fields: howToFields, requiredFields: ["name"] },
4168
+ schemaOrgProduct: { schemaType: "Product", fields: productFields, requiredFields: ["name"] },
4169
+ schemaOrgOffer: { schemaType: "Offer", fields: offerFields, requiredFields: ["price"] },
4170
+ schemaOrgAggregateRating: {
4171
+ schemaType: "AggregateRating",
4172
+ fields: aggregateRatingFields,
4173
+ requiredFields: ["ratingValue"]
4174
+ },
4175
+ schemaOrgReview: { schemaType: "Review", fields: reviewFields, requiredFields: [] },
4176
+ schemaOrgBrand: { schemaType: "Brand", fields: brandFields, requiredFields: ["name"] },
4177
+ schemaOrgLocalBusiness: {
4178
+ schemaType: "LocalBusiness",
4179
+ fields: localBusinessFields,
4180
+ requiredFields: ["name"]
4181
+ },
4182
+ schemaOrgPostalAddress: {
4183
+ schemaType: "PostalAddress",
4184
+ fields: postalAddressFields,
4185
+ requiredFields: []
4186
+ },
4187
+ schemaOrgContactPoint: {
4188
+ schemaType: "ContactPoint",
4189
+ fields: contactPointFields,
4190
+ requiredFields: []
4191
+ },
4192
+ schemaOrgSoftwareApplication: {
4193
+ schemaType: "SoftwareApplication",
4194
+ fields: softwareApplicationFields,
4195
+ requiredFields: ["name"]
4196
+ },
4197
+ schemaOrgWebApplication: {
4198
+ schemaType: "WebApplication",
4199
+ fields: webApplicationFields,
4200
+ requiredFields: ["name"]
4201
+ },
4202
+ schemaOrgEvent: { schemaType: "Event", fields: eventFields, requiredFields: ["name"] },
4203
+ schemaOrgPlace: { schemaType: "Place", fields: placeFields, requiredFields: ["name"] },
4204
+ schemaOrgVideoObject: {
4205
+ schemaType: "VideoObject",
4206
+ fields: videoObjectFields,
4207
+ requiredFields: ["name"]
4208
+ },
4209
+ schemaOrgCourse: { schemaType: "Course", fields: courseFields, requiredFields: ["name"] },
4210
+ schemaOrgLegalService: {
4211
+ schemaType: "LegalService",
4212
+ fields: legalServiceFields,
4213
+ requiredFields: ["name"]
4214
+ },
4215
+ schemaOrgCountry: { schemaType: "Country", fields: countryFields, requiredFields: ["name"] },
4216
+ schemaOrgBook: { schemaType: "Book", fields: bookFields, requiredFields: ["name"] },
4217
+ schemaOrgItemList: {
4218
+ schemaType: "ItemList",
4219
+ fields: itemListFields,
4220
+ requiredFields: ["name"]
4221
+ },
4222
+ schemaOrgJobPosting: {
4223
+ schemaType: "JobPosting",
4224
+ fields: jobPostingFields,
4225
+ requiredFields: ["title"]
4226
+ },
4227
+ schemaOrgMovie: { schemaType: "Movie", fields: movieFields, requiredFields: ["name"] },
4228
+ schemaOrgMusicAlbum: {
4229
+ schemaType: "MusicAlbum",
4230
+ fields: musicAlbumFields,
4231
+ requiredFields: ["name"]
4232
+ },
4233
+ schemaOrgMusicRecording: {
4234
+ schemaType: "MusicRecording",
4235
+ fields: musicRecordingFields,
4236
+ requiredFields: ["name"]
4237
+ },
4238
+ schemaOrgNewsArticle: {
4239
+ schemaType: "NewsArticle",
4240
+ fields: newsArticleFields,
4241
+ requiredFields: ["headline"]
4242
+ },
4243
+ schemaOrgOpinionNewsArticle: {
4244
+ schemaType: "OpinionNewsArticle",
4245
+ fields: opinionNewsArticleFields,
4246
+ requiredFields: ["headline"]
4247
+ },
4248
+ schemaOrgProfilePage: {
4249
+ schemaType: "ProfilePage",
4250
+ fields: profilePageFields,
4251
+ requiredFields: ["name"]
4252
+ },
4253
+ schemaOrgRecipe: { schemaType: "Recipe", fields: recipeFields, requiredFields: ["name"] },
4254
+ schemaOrgRestaurant: {
4255
+ schemaType: "Restaurant",
4256
+ fields: restaurantFields,
4257
+ requiredFields: ["name"]
4258
+ },
4259
+ schemaOrgService: { schemaType: "Service", fields: serviceFields, requiredFields: ["name"] },
4260
+ schemaOrgSocialMediaPosting: {
4261
+ schemaType: "SocialMediaPosting",
4262
+ fields: socialMediaPostingFields,
4263
+ requiredFields: ["headline"]
4264
+ }
4265
+ };
4266
+ function buildSchemaOrgJsonLd(item) {
4267
+ const type = item._type;
4268
+ if (!type) return null;
4269
+ if (type === "schemaOrgWebsite") {
4270
+ return buildWebsiteJsonLd(item);
4271
+ }
4272
+ if (type === "schemaOrgOrganization") {
4273
+ return buildOrganizationJsonLd(item);
4274
+ }
4275
+ const entry = GENERIC_TYPES[type];
4276
+ if (!entry) return null;
4277
+ return buildGenericJsonLd(entry.schemaType, item, entry.fields, entry.requiredFields);
4278
+ }
4279
+ function buildSchemaOrgJsonLds(data) {
4280
+ if (!(data == null ? void 0 : data.length)) return [];
4281
+ return data.map((item) => buildSchemaOrgJsonLd(item)).filter((jsonLd) => jsonLd !== null);
4282
+ }
4283
+ function SchemaOrgScripts({ data }) {
4284
+ if (!(data == null ? void 0 : data.length)) return null;
4285
+ const scripts = buildSchemaOrgJsonLds(data);
4286
+ if (!scripts.length) return null;
4287
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: scripts.map((jsonLd, idx) => (
4288
+ // static server-rendered scripts — order is stable, index key is safe
4289
+ // eslint-disable-next-line react/no-array-index-key
4290
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SchemaOrgScript, { jsonLd }, `${idx}-${jsonLd["@type"]}`)
4291
+ )) });
4292
+ }
4293
+
4294
+ // src/schema/components/SchemaOrgJsonLdPreview.tsx
4295
+
4296
+ function normalizeDocument(document) {
4297
+ var _a, _b;
4298
+ if (!document) return {};
4299
+ if ("displayed" in document || "draft" in document || "published" in document) {
4300
+ const viewDocument = document;
4301
+ const resolved = (_b = (_a = viewDocument.displayed) != null ? _a : viewDocument.draft) != null ? _b : viewDocument.published;
4302
+ if (resolved) return resolved;
4303
+ return {};
4304
+ }
4305
+ return document;
4306
+ }
4307
+ function getPathValue(source, path) {
4308
+ return path.split(".").reduce((current, part) => {
4309
+ if (!current || typeof current !== "object") return void 0;
4310
+ return current[part];
4311
+ }, source);
4312
+ }
4313
+ function resolveSlug(document, slugField) {
4314
+ const raw = getPathValue(document, slugField);
4315
+ if (typeof raw === "string") return raw;
4316
+ if (raw && typeof raw === "object" && "current" in raw) {
4317
+ const current = raw.current;
4318
+ return typeof current === "string" ? current : "";
4319
+ }
4320
+ return "";
4321
+ }
4322
+ function normalizePathSegment(value) {
4323
+ return value.replace(/^\/+|\/+$/g, "");
4324
+ }
4325
+ function resolveDocumentUrl(document, options) {
4326
+ if (options.urlBuilder) return options.urlBuilder(document);
4327
+ const baseUrl = (options.baseUrl || "https://www.example.com").replace(/\/+$/, "");
4328
+ const slug = normalizePathSegment(resolveSlug(document, options.slugField || "slug"));
4329
+ const prefix = typeof options.pathPrefix === "function" ? options.pathPrefix(document) : options.pathPrefix || "";
4330
+ const prefixSegment = normalizePathSegment(prefix);
4331
+ const path = [prefixSegment, slug].filter(Boolean).join("/");
4332
+ return path ? `${baseUrl}/${path}` : baseUrl;
4333
+ }
4334
+ function isSafeGroqPath(path) {
4335
+ return /^[A-Za-z0-9_.]+$/.test(path);
4336
+ }
4337
+ function buildDefaultSlugQuery(slugField, titleField) {
4338
+ if (!isSafeGroqPath(slugField) || !isSafeGroqPath(titleField)) return null;
4339
+ const slugExpression = slugField.endsWith(".current") ? slugField : `${slugField}.current`;
4340
+ return `*[_type == $type && defined(${slugExpression}) && !(_id in path("drafts.**"))] | order(${slugExpression} asc)[0...$limit]{
4341
+ _id,
4342
+ _type,
4343
+ "title": ${titleField},
4344
+ "slug": ${slugExpression}
4345
+ }`;
4346
+ }
4347
+ function normalizeSchemaOrgValue(value, document, schemaOrgField, schemaTypeName) {
4348
+ const raw = value != null ? value : getPathValue(document, schemaOrgField);
4349
+ if (Array.isArray(raw)) {
4350
+ return raw.filter((item) => !!item && typeof item === "object");
4351
+ }
4352
+ if (raw && typeof raw === "object") {
4353
+ const item = raw;
4354
+ return [_chunkA57XNQC7cjs.__spreadValues.call(void 0, _chunkA57XNQC7cjs.__spreadValues.call(void 0, {}, schemaTypeName && !item._type ? { _type: schemaTypeName } : {}), item)];
4355
+ }
4356
+ return [];
4357
+ }
4358
+ function formatJson(value) {
4359
+ return JSON.stringify(value, null, 2);
4360
+ }
4361
+ function JsonLdCodeBlock({
4362
+ jsonLdItems,
4363
+ fieldPreview,
4364
+ scheme
4365
+ }) {
4366
+ const isDark = scheme === "dark";
4367
+ const codeBg = isDark ? "#161b22" : "#f6f8fa";
4368
+ const codeBorder = isDark ? "#30363d" : "#d0d7de";
4369
+ const headerBg = isDark ? "#21262d" : "#f0f2f4";
4370
+ const headerBorder = isDark ? "#30363d" : "#d0d7de";
4371
+ const headerText = isDark ? "#e6edf3" : "#24292f";
4372
+ const [copyLabel, setCopyLabel] = _react.useState.call(void 0, "Copy");
4373
+ const raw = formatJson(jsonLdItems.length === 1 ? jsonLdItems[0] : jsonLdItems);
4374
+ const tokens = _react.useMemo.call(void 0, () => tokenizeJson(raw, scheme), [raw, scheme]);
4375
+ const handleCopy = () => {
4376
+ navigator.clipboard.writeText(raw).then(() => {
4377
+ setCopyLabel("Copied!");
4378
+ setTimeout(() => setCopyLabel("Copy"), 2e3);
4379
+ });
4380
+ };
4381
+ if (!jsonLdItems.length) {
4382
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Card, { border: true, radius: 2, padding: 0, style: { overflow: "hidden" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Box, { padding: 3, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Text, { size: 1, muted: true, children: "Fill the required Schema.org fields to generate JSON-LD." }) }) });
4383
+ }
4384
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { borderRadius: 6, border: `1px solid ${codeBorder}`, overflow: "hidden" }, children: [
4385
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
4386
+ "div",
4387
+ {
4388
+ style: {
4389
+ background: headerBg,
4390
+ borderBottom: `1px solid ${headerBorder}`,
4391
+ padding: "6px 14px",
4392
+ display: "flex",
4393
+ alignItems: "center",
4394
+ justifyContent: "space-between"
4395
+ },
4396
+ children: [
4397
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
4398
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4399
+ "span",
4400
+ {
4401
+ style: {
4402
+ width: 8,
4403
+ height: 8,
4404
+ borderRadius: "50%",
4405
+ background: isDark ? "#388bfd" : "#0550ae",
4406
+ display: "inline-block"
4407
+ }
4408
+ }
4409
+ ),
4410
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { fontSize: 11, color: headerText, fontFamily: "monospace" }, children: "JSON-LD" })
4411
+ ] }),
4412
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4413
+ "button",
4414
+ {
4415
+ type: "button",
4416
+ onClick: handleCopy,
4417
+ style: {
4418
+ background: "none",
4419
+ border: `1px solid ${headerBorder}`,
4420
+ borderRadius: 4,
4421
+ padding: "2px 8px",
4422
+ cursor: "pointer",
4423
+ fontSize: 11,
4424
+ color: headerText
4425
+ },
4426
+ children: copyLabel
4427
+ }
4428
+ )
4429
+ ]
4430
+ }
4431
+ ),
4432
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4433
+ _ui.Box,
4434
+ {
4435
+ as: "pre",
4436
+ padding: 3,
4437
+ style: {
4438
+ margin: 0,
4439
+ maxHeight: fieldPreview ? 360 : 520,
4440
+ overflow: "auto",
4441
+ fontSize: 12,
4442
+ fontFamily: 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',
4443
+ lineHeight: 1.6,
4444
+ whiteSpace: "pre-wrap",
4445
+ wordBreak: "break-word",
4446
+ backgroundColor: codeBg
4447
+ },
4448
+ children: tokens.map((token, idx) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { color: token.color }, children: token.text }, idx))
4449
+ }
4450
+ )
4451
+ ] });
4452
+ }
4453
+ function SchemaOrgJsonLdPreview({
4454
+ value,
4455
+ document,
4456
+ documentId,
4457
+ schemaType,
4458
+ schemaTypeName,
4459
+ fieldPreview = false,
4460
+ baseUrl,
4461
+ slugField = "slug",
4462
+ schemaOrgField = "schemaOrg",
4463
+ pathPrefix,
4464
+ urlBuilder,
4465
+ apiVersion = "2024-01-01",
4466
+ slugQuery,
4467
+ showSlugList,
4468
+ maxSlugItems = 25,
4469
+ titleField = "title"
4470
+ }) {
4471
+ const { scheme } = _sanity.useColorScheme.call(void 0, );
4472
+ const client = _sanity.useClient.call(void 0, { apiVersion });
4473
+ const initialDocument = _react.useMemo.call(void 0, () => normalizeDocument(document), [document]);
4474
+ const [fetchedDocument, setFetchedDocument] = _react.useState.call(void 0, null);
4475
+ const [existingSlugs, setExistingSlugs] = _react.useState.call(void 0, []);
4476
+ const [slugListError, setSlugListError] = _react.useState.call(void 0, "");
4477
+ _react.useEffect.call(void 0, () => {
4478
+ if (initialDocument._id || !documentId) {
4479
+ setFetchedDocument(null);
4480
+ return;
4481
+ }
4482
+ client.fetch(`*[_id == $id][0]`, { id: documentId }).then((result) => setFetchedDocument(result)).catch(() => setFetchedDocument(null));
4483
+ }, [client, documentId, initialDocument._id]);
4484
+ const currentDocument = _react.useMemo.call(void 0,
4485
+ () => _chunkA57XNQC7cjs.__spreadValues.call(void 0, _chunkA57XNQC7cjs.__spreadValues.call(void 0, {}, fetchedDocument != null ? fetchedDocument : initialDocument), schemaType && !(fetchedDocument != null ? fetchedDocument : initialDocument)._type ? { _type: schemaType } : {}),
4486
+ [fetchedDocument, initialDocument, schemaType]
4487
+ );
4488
+ const resolvedUrl = _react.useMemo.call(void 0,
4489
+ () => resolveDocumentUrl(currentDocument, { baseUrl, slugField, pathPrefix, urlBuilder }),
4490
+ [currentDocument, baseUrl, slugField, pathPrefix, urlBuilder]
4491
+ );
4492
+ const items = _react.useMemo.call(void 0,
4493
+ () => normalizeSchemaOrgValue(value, currentDocument, schemaOrgField, schemaTypeName),
4494
+ [value, currentDocument, schemaOrgField, schemaTypeName]
4495
+ );
4496
+ const jsonLdItems = _react.useMemo.call(void 0, () => {
4497
+ if (Array.isArray(value != null ? value : getPathValue(currentDocument, schemaOrgField))) {
4498
+ return buildSchemaOrgJsonLds(items);
4499
+ }
4500
+ return items.map((item) => buildSchemaOrgJsonLd(item)).filter((jsonLd) => jsonLd !== null);
4501
+ }, [currentDocument, items, schemaOrgField, value]);
4502
+ const shouldShowSlugList = showSlugList != null ? showSlugList : !fieldPreview;
4503
+ const documentType = currentDocument._type;
4504
+ _react.useEffect.call(void 0, () => {
4505
+ if (!shouldShowSlugList || !documentType) {
4506
+ setExistingSlugs([]);
4507
+ setSlugListError("");
4508
+ return;
4509
+ }
4510
+ const query = slugQuery != null ? slugQuery : buildDefaultSlugQuery(slugField, titleField);
4511
+ if (!query) {
4512
+ setExistingSlugs([]);
4513
+ setSlugListError("Slug list disabled because slugField/titleField is not a safe GROQ path.");
4514
+ return;
4515
+ }
4516
+ client.fetch(query, { type: documentType, limit: maxSlugItems }).then((result) => {
4517
+ setExistingSlugs(Array.isArray(result) ? result : []);
4518
+ setSlugListError("");
4519
+ }).catch(() => {
4520
+ setExistingSlugs([]);
4521
+ setSlugListError("Could not fetch existing slugs.");
4522
+ });
4523
+ }, [client, documentType, maxSlugItems, shouldShowSlugList, slugField, slugQuery, titleField]);
4524
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Card, { border: true, radius: 2, padding: 3, tone: "transparent", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _ui.Stack, { space: 3, children: [
4525
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _ui.Flex, { align: "center", justify: "space-between", gap: 3, children: [
4526
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Text, { size: 1, weight: "semibold", children: "Live JSON-LD Preview" }),
4527
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Text, { size: 0, muted: true, children: jsonLdItems.length ? `${jsonLdItems.length} item${jsonLdItems.length > 1 ? "s" : ""}` : "No output" })
4528
+ ] }),
4529
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Card, { border: true, radius: 2, padding: 3, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _ui.Stack, { space: 2, children: [
4530
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Text, { size: 0, muted: true, children: "Resolved document URL" }),
4531
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Text, { size: 1, style: { wordBreak: "break-word" }, children: resolvedUrl })
4532
+ ] }) }),
4533
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, JsonLdCodeBlock, { jsonLdItems, fieldPreview, scheme }),
4534
+ shouldShowSlugList && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Card, { border: true, radius: 2, padding: 3, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _ui.Stack, { space: 3, children: [
4535
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _ui.Text, { size: 1, weight: "semibold", children: [
4536
+ "Existing slugs",
4537
+ documentType ? ` for ${documentType}` : ""
4538
+ ] }),
4539
+ slugListError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Text, { size: 1, muted: true, children: slugListError }),
4540
+ !slugListError && existingSlugs.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Stack, { space: 2, children: existingSlugs.map((item) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _ui.Flex, { align: "center", justify: "space-between", gap: 3, children: [
4541
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Text, { size: 1, style: { minWidth: 0 }, children: item.title || item.slug || item._id }),
4542
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Text, { size: 0, muted: true, style: { wordBreak: "break-word", textAlign: "right" }, children: item.slug })
4543
+ ] }, item._id)) }),
4544
+ !slugListError && existingSlugs.length === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Text, { size: 1, muted: true, children: "No existing slugs found." })
4545
+ ] }) })
4546
+ ] }) });
4547
+ }
4548
+ function SchemaOrgJsonLdPreviewInput(props) {
4549
+ var _a, _b;
4550
+ const { renderDefault, schemaType } = props;
4551
+ const rootDocument = (_a = _sanity.useFormValue.call(void 0, [])) != null ? _a : {};
4552
+ const options = (_b = schemaType.options) == null ? void 0 : _b.schemaOrgJsonLdPreview;
4553
+ const value = props.value;
4554
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _ui.Stack, { space: 3, children: [
4555
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4556
+ SchemaOrgJsonLdPreview,
4557
+ _chunkA57XNQC7cjs.__spreadProps.call(void 0, _chunkA57XNQC7cjs.__spreadValues.call(void 0, {}, options), {
4558
+ value: value != null ? value : null,
4559
+ document: rootDocument,
4560
+ schemaTypeName: schemaType.name,
4561
+ fieldPreview: true
4562
+ })
4563
+ ),
4564
+ renderDefault(props)
4565
+ ] });
4566
+ }
4567
+
4568
+ // src/schema/generator.ts
4569
+ function buildField(fieldDef, validation) {
4570
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
4571
+ if (fieldDef.type === "select" && ((_a = fieldDef.variants) == null ? void 0 : _a.length)) {
4572
+ const variants = fieldDef.variants;
4573
+ const defaultVariant = (_b = fieldDef.defaultVariant) != null ? _b : variants[0].value;
4574
+ const innerFields = [
4575
+ {
4576
+ name: "variant",
4577
+ title: "Type",
4578
+ type: "string",
4579
+ description: "Choose how to provide this value.",
4580
+ initialValue: defaultVariant,
4581
+ options: variants.map((v) => ({ title: v.title, value: v.value })),
4582
+ layout: "radio"
4583
+ },
4584
+ ...variants.map((v) => {
4585
+ if (v.fields.length === 1 && v.fields[0].name === v.value) {
4586
+ return v.fields[0];
4587
+ }
4588
+ return {
4589
+ name: v.value,
4590
+ title: v.title,
4591
+ type: "object",
4592
+ jsonLdType: v.jsonLdType,
4593
+ fields: v.fields
4594
+ };
4595
+ })
4596
+ ];
4597
+ const base2 = {
4598
+ name: fieldDef.name,
4599
+ title: fieldDef.title,
4600
+ type: "object",
4601
+ fields: innerFields.map((child) => {
4602
+ const built = buildField(child, validation);
4603
+ if (child.name !== "variant") {
4604
+ const dv = defaultVariant;
4605
+ built.hidden = ({ parent }) => {
4606
+ var _a2;
4607
+ return ((_a2 = parent == null ? void 0 : parent.variant) != null ? _a2 : dv) !== child.name;
4608
+ };
4609
+ }
4610
+ return built;
4611
+ })
4612
+ };
4613
+ if (fieldDef.description) base2.description = fieldDef.description;
4614
+ return _sanity.defineField.call(void 0, base2);
4615
+ }
4616
+ if (fieldDef.type === "copyrightYear") {
4617
+ const base2 = {
4618
+ name: fieldDef.name,
4619
+ title: fieldDef.title,
4620
+ type: "object",
4621
+ description: (_c = fieldDef.description) != null ? _c : 'Copyright year. Toggle "Use current year" to emit the current year dynamically.',
4622
+ fields: [
4623
+ _sanity.defineField.call(void 0, {
4624
+ name: "useDynamicYear",
4625
+ title: "Use current year (dynamic)",
4626
+ type: "boolean",
4627
+ initialValue: false
4628
+ }),
4629
+ _sanity.defineField.call(void 0, {
4630
+ name: "year",
4631
+ title: "Static year",
4632
+ type: "number",
4633
+ hidden: ({ parent }) => (parent == null ? void 0 : parent.useDynamicYear) === true
4634
+ })
4635
+ ]
4636
+ };
4637
+ return _sanity.defineField.call(void 0, base2);
4638
+ }
4639
+ const base = {
4640
+ name: fieldDef.name,
4641
+ title: fieldDef.title,
4642
+ type: fieldDef.type
4643
+ };
4644
+ if (fieldDef.description) base.description = fieldDef.description;
4645
+ if (fieldDef.initialValue !== void 0) base.initialValue = fieldDef.initialValue;
4646
+ if (fieldDef.rows) base.rows = fieldDef.rows;
4647
+ if (fieldDef.options) {
4648
+ base.options = _chunkA57XNQC7cjs.__spreadValues.call(void 0, { list: fieldDef.options }, fieldDef.layout && { layout: fieldDef.layout });
4649
+ }
4650
+ if (fieldDef.type === "array" && ((_d = fieldDef.fields) == null ? void 0 : _d.length) && !fieldDef.of) {
4651
+ base.of = [
4652
+ {
4653
+ type: "object",
4654
+ fields: fieldDef.fields.map((child) => buildField(child, validation))
4655
+ }
4656
+ ];
4657
+ } else if (fieldDef.of) {
4658
+ base.of = fieldDef.of;
4659
+ }
4660
+ if (fieldDef.type !== "array" && ((_e = fieldDef.fields) == null ? void 0 : _e.length)) {
4661
+ base.fields = fieldDef.fields.map((child) => buildField(child, validation));
4662
+ }
4663
+ if (fieldDef.type === "url" && (fieldDef.required || fieldDef.urlValidation)) {
4664
+ const required = fieldDef.required;
4665
+ const requiredMsg = required ? (_f = validation == null ? void 0 : validation[required.key]) != null ? _f : required.message : void 0;
4666
+ const schemes = (_h = (_g = fieldDef.urlValidation) == null ? void 0 : _g.schemes) != null ? _h : ["http", "https"];
4667
+ const allowRelative = (_j = (_i = fieldDef.urlValidation) == null ? void 0 : _i.allowRelative) != null ? _j : false;
4668
+ base.validation = (Rule) => {
4669
+ const checks = [];
4670
+ if (requiredMsg) checks.push(Rule.required().error(requiredMsg));
4671
+ checks.push(
4672
+ Rule.uri({ scheme: schemes, allowRelative }).error(
4673
+ `Must be a valid URL (${schemes.join(", ")}).`
4674
+ )
4675
+ );
4676
+ return checks;
4677
+ };
4678
+ } else if (fieldDef.required) {
4679
+ const msg = (_k = validation == null ? void 0 : validation[fieldDef.required.key]) != null ? _k : fieldDef.required.message;
4680
+ base.validation = (Rule) => Rule.required().error(msg);
4681
+ }
4682
+ return _sanity.defineField.call(void 0, base);
4683
+ }
4684
+ function mapNameToSameValue(...items) {
4685
+ return items.reduce(
4686
+ (acc, item) => {
4687
+ acc[item.name] = item.name;
4688
+ return acc;
4689
+ },
4690
+ {}
4691
+ );
4692
+ }
4693
+ function generateSchemaType(def, config = {}) {
4694
+ const previewOptions = config.jsonLdPreview;
4695
+ const previewEnabled = previewOptions !== false;
4696
+ const previewConfig = typeof previewOptions === "object" ? previewOptions : void 0;
4697
+ return _sanity.defineType.call(void 0, _chunkA57XNQC7cjs.__spreadProps.call(void 0, _chunkA57XNQC7cjs.__spreadValues.call(void 0, _chunkA57XNQC7cjs.__spreadValues.call(void 0, {
4698
+ name: def.name,
4699
+ title: def.title,
4700
+ type: "object"
4701
+ }, def.icon && { icon: def.icon }), previewEnabled && {
4702
+ components: { input: SchemaOrgJsonLdPreviewInput },
4703
+ options: { schemaOrgJsonLdPreview: previewConfig }
4704
+ }), {
4705
+ fields: def.fields.map((f) => buildField(f, config.validation)),
4706
+ preview: {
4707
+ select: mapNameToSameValue(...def.fields),
4708
+ prepare(selection) {
4709
+ return _chunkA57XNQC7cjs.__spreadValues.call(void 0, {
4710
+ title: def.title,
4711
+ subtitle: (def == null ? void 0 : def.customPrepareSubtitle) ? def.customPrepareSubtitle(selection) : `@type: ${def.title}`
4712
+ }, def.icon && { media: def.icon });
4713
+ }
4714
+ }
4715
+ }));
4716
+ }
4717
+
4718
+
4719
+
4720
+
4721
+
4722
+
4723
+
4724
+
4725
+
4726
+
4727
+
4728
+
4729
+
4730
+
4731
+
4732
+
4733
+
4734
+
4735
+
4736
+
4737
+
4738
+
4739
+
4740
+
4741
+
4742
+
4743
+
4744
+
4745
+
4746
+
4747
+
4748
+
4749
+
4750
+
4751
+
4752
+
4753
+
4754
+
4755
+
4756
+
4757
+
4758
+
4759
+
4760
+
4761
+
4762
+
4763
+
4764
+
4765
+
4766
+
4767
+
4768
+
4769
+
4770
+
4771
+
4772
+
4773
+
4774
+
4775
+
4776
+
4777
+
4778
+
4779
+
4780
+
4781
+
4782
+
4783
+
4784
+
4785
+
4786
+
4787
+
4788
+
4789
+
4790
+
4791
+
4792
+
4793
+
4794
+
4795
+
4796
+
4797
+
4798
+
4799
+
4800
+
4801
+
4802
+
4803
+
4804
+
4805
+
4806
+
4807
+
4808
+
4809
+
4810
+
4811
+
4812
+
4813
+
4814
+
4815
+
4816
+
4817
+
4818
+
4819
+
4820
+
4821
+
4822
+
4823
+
4824
+
4825
+
4826
+
4827
+
4828
+
4829
+
4830
+
4831
+
4832
+
4833
+
4834
+
4835
+
4836
+
4837
+
4838
+
4839
+ exports.tokenizeHtml = tokenizeHtml; exports.polymorphicImage = polymorphicImage; exports.polymorphicAuthor = polymorphicAuthor; exports.polymorphicPublisher = polymorphicPublisher; exports.polymorphicGenre = polymorphicGenre; exports.polymorphicKeywords = polymorphicKeywords; exports.polymorphicAdditionalType = polymorphicAdditionalType; exports.polymorphicContributor = polymorphicContributor; exports.polymorphicCreator = polymorphicCreator; exports.polymorphicMaintainer = polymorphicMaintainer; exports.polymorphicFunder = polymorphicFunder; exports.polymorphicCopyrightHolder = polymorphicCopyrightHolder; exports.polymorphicIdentifier = polymorphicIdentifier; exports.polymorphicOwner = polymorphicOwner; exports.polymorphicCitation = polymorphicCitation; exports.polymorphicContentRating = polymorphicContentRating; exports.polymorphicArchivedAt = polymorphicArchivedAt; exports.polymorphicIsBasedOn = polymorphicIsBasedOn; exports.polymorphicIsPartOf = polymorphicIsPartOf; exports.polymorphicLicense = polymorphicLicense; exports.polymorphicLocationCreated = polymorphicLocationCreated; exports.polymorphicMaterial = polymorphicMaterial; exports.IETF_LANGUAGE_OPTIONS = IETF_LANGUAGE_OPTIONS; exports.inLanguageField = inLanguageField; exports.nameField = nameField; exports.potentialActionSearch = potentialActionSearch; exports.descriptionField = descriptionField; exports.urlField = urlField; exports.headlineField = headlineField; exports.datePublishedField = datePublishedField; exports.withThingCommons = withThingCommons; exports.withCreativeWorkCommons = withCreativeWorkCommons; exports.issnField = issnField; exports.buildGenericJsonLd = buildGenericJsonLd; exports.generateSchemaType = generateSchemaType; exports.SchemaOrgIcons = SchemaOrgIcons; exports.aggregateRatingFields = aggregateRatingFields; exports.schemaOrgAggregateRating = schemaOrgAggregateRating; exports.articleFields = articleFields; exports.schemaOrgArticle = schemaOrgArticle; exports.blogPostingFields = blogPostingFields; exports.schemaOrgBlogPosting = schemaOrgBlogPosting; exports.bookFields = bookFields; exports.schemaOrgBook = schemaOrgBook; exports.brandFields = brandFields; exports.schemaOrgBrand = schemaOrgBrand; exports.breadcrumbListFields = breadcrumbListFields; exports.schemaOrgBreadcrumbList = schemaOrgBreadcrumbList; exports.contactPointFields = contactPointFields; exports.schemaOrgContactPoint = schemaOrgContactPoint; exports.countryFields = countryFields; exports.schemaOrgCountry = schemaOrgCountry; exports.courseFields = courseFields; exports.schemaOrgCourse = schemaOrgCourse; exports.eventFields = eventFields; exports.schemaOrgEvent = schemaOrgEvent; exports.faqPageFields = faqPageFields; exports.schemaOrgFAQPage = schemaOrgFAQPage; exports.howToFields = howToFields; exports.schemaOrgHowTo = schemaOrgHowTo; exports.imageObjectFields = imageObjectFields; exports.schemaOrgImageObject = schemaOrgImageObject; exports.itemListFields = itemListFields; exports.schemaOrgItemList = schemaOrgItemList; exports.jobPostingFields = jobPostingFields; exports.schemaOrgJobPosting = schemaOrgJobPosting; exports.legalServiceFields = legalServiceFields; exports.schemaOrgLegalService = schemaOrgLegalService; exports.localBusinessFields = localBusinessFields; exports.schemaOrgLocalBusiness = schemaOrgLocalBusiness; exports.movieFields = movieFields; exports.schemaOrgMovie = schemaOrgMovie; exports.musicAlbumFields = musicAlbumFields; exports.schemaOrgMusicAlbum = schemaOrgMusicAlbum; exports.musicRecordingFields = musicRecordingFields; exports.schemaOrgMusicRecording = schemaOrgMusicRecording; exports.newsArticleFields = newsArticleFields; exports.schemaOrgNewsArticle = schemaOrgNewsArticle; exports.offerFields = offerFields; exports.schemaOrgOffer = schemaOrgOffer; exports.opinionNewsArticleFields = opinionNewsArticleFields; exports.schemaOrgOpinionNewsArticle = schemaOrgOpinionNewsArticle; exports.SchemaOrgScript = SchemaOrgScript; exports.buildOrganizationJsonLd = buildOrganizationJsonLd; exports.OrganizationSchema = OrganizationSchema; exports.personFields = personFields; exports.schemaOrgPerson = schemaOrgPerson; exports.placeFields = placeFields; exports.schemaOrgPlace = schemaOrgPlace; exports.postalAddressFields = postalAddressFields; exports.schemaOrgPostalAddress = schemaOrgPostalAddress; exports.productFields = productFields; exports.schemaOrgProduct = schemaOrgProduct; exports.profilePageFields = profilePageFields; exports.schemaOrgProfilePage = schemaOrgProfilePage; exports.recipeFields = recipeFields; exports.schemaOrgRecipe = schemaOrgRecipe; exports.restaurantFields = restaurantFields; exports.schemaOrgRestaurant = schemaOrgRestaurant; exports.reviewFields = reviewFields; exports.schemaOrgReview = schemaOrgReview; exports.serviceFields = serviceFields; exports.schemaOrgService = schemaOrgService; exports.socialMediaPostingFields = socialMediaPostingFields; exports.schemaOrgSocialMediaPosting = schemaOrgSocialMediaPosting; exports.softwareApplicationFields = softwareApplicationFields; exports.schemaOrgSoftwareApplication = schemaOrgSoftwareApplication; exports.videoObjectFields = videoObjectFields; exports.schemaOrgVideoObject = schemaOrgVideoObject; exports.webApplicationFields = webApplicationFields; exports.schemaOrgWebApplication = schemaOrgWebApplication; exports.webPageFields = webPageFields; exports.schemaOrgWebPage = schemaOrgWebPage; exports.buildWebsiteJsonLd = buildWebsiteJsonLd; exports.WebsiteSchema = WebsiteSchema; exports.buildSchemaOrgJsonLd = buildSchemaOrgJsonLd; exports.buildSchemaOrgJsonLds = buildSchemaOrgJsonLds; exports.SchemaOrgScripts = SchemaOrgScripts; exports.SchemaOrgJsonLdPreview = SchemaOrgJsonLdPreview; exports.SchemaOrgJsonLdPreviewInput = SchemaOrgJsonLdPreviewInput;
4840
+ //# sourceMappingURL=chunk-5XTQRILL.cjs.map