@open-resource-discovery/metadata-renderer 0.0.0 → 1.0.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 (72) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +94 -1
  3. package/dist/a2a/index.d.ts +9 -0
  4. package/dist/a2a.js +2 -0
  5. package/dist/asyncApi/asyncapi-browser.d.ts +3 -0
  6. package/dist/asyncApi/customAttributes/attributeLink.d.ts +3 -0
  7. package/dist/asyncApi/customAttributes/autoDiscover.d.ts +4 -0
  8. package/dist/asyncApi/customAttributes/buildExtensionsConfig.d.ts +5 -0
  9. package/dist/asyncApi/customAttributes/context.d.ts +7 -0
  10. package/dist/asyncApi/customAttributes/genericRenderer.d.ts +4 -0
  11. package/dist/asyncApi/customAttributes/sapPreset.d.ts +2 -0
  12. package/dist/asyncApi/customAttributes/stateInfo.d.ts +3 -0
  13. package/dist/asyncApi/customAttributes/styles.d.ts +2 -0
  14. package/dist/asyncApi/customAttributes/types.d.ts +32 -0
  15. package/dist/asyncApi/index.d.ts +12 -0
  16. package/dist/asyncapi.js +2 -0
  17. package/dist/chunks/a2a-B5lkgqLU.js +29 -0
  18. package/dist/chunks/asyncApi-K0uQpQwz.js +641 -0
  19. package/dist/chunks/csn-D4GBs8tC.js +548 -0
  20. package/dist/chunks/mcp-qA5sYRAN.js +29 -0
  21. package/dist/chunks/openApi-Ccp9Pa_k.js +1092 -0
  22. package/dist/chunks/utils-BC3WF3-9.js +77 -0
  23. package/dist/core/ShadowRoot.d.ts +6 -0
  24. package/dist/core/index.d.ts +11 -0
  25. package/dist/core/utils.d.ts +7 -0
  26. package/dist/core/utils.test.d.ts +1 -0
  27. package/dist/csn/customAttributes/genericRenderer.d.ts +2 -0
  28. package/dist/csn/customAttributes/postProcess.d.ts +5 -0
  29. package/dist/csn/customAttributes/sapPreset.d.ts +2 -0
  30. package/dist/csn/customAttributes/types.d.ts +28 -0
  31. package/dist/csn/index.d.ts +12 -0
  32. package/dist/csn/styles.d.ts +2 -0
  33. package/dist/csn.js +2 -0
  34. package/dist/entries/a2a.d.ts +2 -0
  35. package/dist/entries/asyncapi.d.ts +2 -0
  36. package/dist/entries/csn.d.ts +2 -0
  37. package/dist/entries/mcp.d.ts +2 -0
  38. package/dist/entries/openapi.d.ts +2 -0
  39. package/dist/favicon.ico +0 -0
  40. package/dist/favicon.svg +29 -0
  41. package/dist/index.css +210782 -0
  42. package/dist/index.d.ts +23 -0
  43. package/dist/index.js +166 -0
  44. package/dist/mcp/index.d.ts +8 -0
  45. package/dist/mcp.js +2 -0
  46. package/dist/openApi/customAttributes/attributeLink.d.ts +3 -0
  47. package/dist/openApi/customAttributes/autoDiscover.d.ts +15 -0
  48. package/dist/openApi/customAttributes/genericRenderer.d.ts +3 -0
  49. package/dist/openApi/customAttributes/sapAttributes/operation/deprecatedOperation.d.ts +10 -0
  50. package/dist/openApi/customAttributes/sapAttributes/root/extOverview.d.ts +2 -0
  51. package/dist/openApi/customAttributes/sapAttributes/root/extensible.d.ts +10 -0
  52. package/dist/openApi/customAttributes/sapAttributes/root/ordId.d.ts +6 -0
  53. package/dist/openApi/customAttributes/sapAttributes/root/stateInfo.d.ts +11 -0
  54. package/dist/openApi/customAttributes/sapAttributes/root/typeCheckXxtOverview.d.ts +10 -0
  55. package/dist/openApi/customAttributes/sapAttributes/root/typeCheckXxtOverview.spec.d.ts +1 -0
  56. package/dist/openApi/customAttributes/sapAttributes/sapPreset.d.ts +2 -0
  57. package/dist/openApi/customAttributes/sapAttributes/schema/odmEntityName.d.ts +6 -0
  58. package/dist/openApi/customAttributes/sapAttributes/schema/odmSemanticKey.d.ts +10 -0
  59. package/dist/openApi/customAttributes/types.d.ts +31 -0
  60. package/dist/openApi/index.d.ts +10 -0
  61. package/dist/openApi/styles.d.ts +2 -0
  62. package/dist/openApi/utils/context.d.ts +7 -0
  63. package/dist/openApi/utils/context.test.d.ts +1 -0
  64. package/dist/openApi/utils/plugins.d.ts +3 -0
  65. package/dist/openApi/utils/scalarTheme.d.ts +11 -0
  66. package/dist/openapi.js +2 -0
  67. package/dist/styles.d.ts +0 -0
  68. package/dist/styles.js +4 -0
  69. package/dist/theme-builder.d.ts +28 -0
  70. package/dist/types.d.ts +48 -0
  71. package/dist/vendor.d.ts +2 -0
  72. package/package.json +135 -3
@@ -0,0 +1,1092 @@
1
+ import { i as loadObject } from "./utils-BC3WF3-9.js";
2
+ /* empty css */
3
+ import { createElement, useEffect, useId, useMemo, useRef, useState } from "react";
4
+ import { ApiReferenceReact } from "@scalar/api-reference-react";
5
+ import Markdown from "react-markdown";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { ReactRenderer } from "@scalar/react-renderer";
8
+ //#region src/lib/openApi/utils/context.ts
9
+ var openApiContext = {
10
+ version: "",
11
+ configs: [],
12
+ getDocumentationUrl(attributeName) {
13
+ return (this.configs.find((c) => c.extensions?.[attributeName]) ?? this.configs.find((c) => c.prefixStartsWith && attributeName.startsWith(c.prefixStartsWith)))?.documentationUrl?.(attributeName, { version: this.version });
14
+ }
15
+ };
16
+ var getVersion = (content) => {
17
+ const parsedContent = loadObject(content);
18
+ if (!parsedContent) return "";
19
+ if ("openapi" in parsedContent && parsedContent.openapi && typeof parsedContent.openapi === "string") return parsedContent.openapi.substring(0, 3);
20
+ if ("swagger" in parsedContent && parsedContent.swagger && typeof parsedContent.swagger === "string") return "2.0";
21
+ return "";
22
+ };
23
+ //#endregion
24
+ //#region src/lib/openApi/customAttributes/autoDiscover.ts
25
+ var HTTP_METHODS = [
26
+ "get",
27
+ "put",
28
+ "post",
29
+ "delete",
30
+ "options",
31
+ "head",
32
+ "patch",
33
+ "trace"
34
+ ];
35
+ function discoverAttributeNames(doc, prefix) {
36
+ const names = /* @__PURE__ */ new Set();
37
+ for (const key of Object.keys(doc)) if (key.startsWith(prefix)) names.add(key);
38
+ const paths = doc.paths;
39
+ if (paths) for (const pathItem of Object.values(paths)) {
40
+ if (!pathItem || typeof pathItem !== "object") continue;
41
+ for (const method of HTTP_METHODS) {
42
+ const op = pathItem[method];
43
+ if (!op || typeof op !== "object") continue;
44
+ for (const key of Object.keys(op)) if (key.startsWith(prefix)) names.add(key);
45
+ }
46
+ }
47
+ const schemas = doc.components?.schemas;
48
+ if (schemas) for (const schema of Object.values(schemas)) {
49
+ if (!schema || typeof schema !== "object") continue;
50
+ const s = schema;
51
+ for (const key of Object.keys(s)) if (key.startsWith(prefix)) names.add(key);
52
+ const properties = s.properties;
53
+ if (properties) for (const prop of Object.values(properties)) {
54
+ if (!prop || typeof prop !== "object") continue;
55
+ for (const key of Object.keys(prop)) if (key.startsWith(prefix)) names.add(key);
56
+ }
57
+ }
58
+ return [...names];
59
+ }
60
+ /**
61
+ * Synthetic property key injected into schema.properties so Scalar calls SpecificationExtension on it.
62
+ * The value is the full schema object; our extension component reads any x-* fields from it.
63
+ */
64
+ var SCHEMA_ATTRS_KEY = "x-sap-schema-attrs";
65
+ /**
66
+ * Clone doc and inject a synthetic property into every schema object that carries
67
+ * at least one key matching the given prefix. Scalar only calls SpecificationExtension
68
+ * on property-level schemas, so this is the only way to render schema-level x-* fields.
69
+ */
70
+ function injectSchemaExtensions(doc, prefixes) {
71
+ const schemas = doc.components?.schemas;
72
+ if (!schemas) return doc;
73
+ const patchedSchemas = {};
74
+ let anyPatched = false;
75
+ for (const [name, schema] of Object.entries(schemas)) {
76
+ if (!schema || typeof schema !== "object") {
77
+ patchedSchemas[name] = schema;
78
+ continue;
79
+ }
80
+ const s = schema;
81
+ const xFields = {};
82
+ for (const [k, v] of Object.entries(s)) if (prefixes.some((p) => k.startsWith(p))) xFields[k] = v;
83
+ if (Object.keys(xFields).length === 0) {
84
+ patchedSchemas[name] = schema;
85
+ continue;
86
+ }
87
+ anyPatched = true;
88
+ patchedSchemas[name] = {
89
+ ...s,
90
+ properties: {
91
+ [SCHEMA_ATTRS_KEY]: { [SCHEMA_ATTRS_KEY]: xFields },
92
+ ...s.properties
93
+ }
94
+ };
95
+ }
96
+ if (!anyPatched) return doc;
97
+ return {
98
+ ...doc,
99
+ components: {
100
+ ...doc.components,
101
+ schemas: patchedSchemas
102
+ }
103
+ };
104
+ }
105
+ function extractCustomAttributeValues(doc, prefix) {
106
+ const result = [];
107
+ for (const [k, v] of Object.entries(doc)) if (k.startsWith(prefix)) result.push([k, v]);
108
+ const paths = doc.paths;
109
+ if (paths) for (const [path, pathItem] of Object.entries(paths)) {
110
+ if (!pathItem || typeof pathItem !== "object") continue;
111
+ for (const method of HTTP_METHODS) {
112
+ const op = pathItem[method];
113
+ if (!op || typeof op !== "object") continue;
114
+ for (const [k, v] of Object.entries(op)) if (k.startsWith(prefix)) result.push([`paths.${path}.${method}.${k}`, v]);
115
+ }
116
+ }
117
+ const schemas = doc.components?.schemas;
118
+ if (schemas) for (const [schemaName, schema] of Object.entries(schemas)) {
119
+ if (!schema || typeof schema !== "object") continue;
120
+ const s = schema;
121
+ for (const [k, v] of Object.entries(s)) if (k.startsWith(prefix)) result.push([`components.schemas.${schemaName}.${k}`, v]);
122
+ const properties = s.properties;
123
+ if (properties) for (const [propName, prop] of Object.entries(properties)) {
124
+ if (!prop || typeof prop !== "object") continue;
125
+ for (const [k, v] of Object.entries(prop)) if (k.startsWith(prefix)) result.push([`components.schemas.${schemaName}.properties.${propName}.${k}`, v]);
126
+ }
127
+ }
128
+ return result;
129
+ }
130
+ //#endregion
131
+ //#region src/lib/openApi/customAttributes/attributeLink.tsx
132
+ function attributeLink({ attributeName }) {
133
+ const href = openApiContext.getDocumentationUrl(attributeName);
134
+ if (!href) return null;
135
+ return /* @__PURE__ */ jsx("a", {
136
+ href,
137
+ style: { marginLeft: 4 },
138
+ target: "_blank",
139
+ rel: "noreferrer",
140
+ title: "View in OpenAPI Specification",
141
+ children: /* @__PURE__ */ jsx("svg", {
142
+ width: "16",
143
+ height: "16",
144
+ viewBox: "0 0 16 16",
145
+ fill: "currentColor",
146
+ children: /* @__PURE__ */ jsx("path", { d: "M10.604 1h4.146a.25.25 0 01.25.25v4.146a.25.25 0 01-.427.177L13.03 4.03 9.28 7.78a.75.75 0 01-1.06-1.06l3.75-3.75-1.543-1.543A.25.25 0 0110.604 1zM3.75 2A1.75 1.75 0 002 3.75v8.5c0 .966.784 1.75 1.75 1.75h8.5A1.75 1.75 0 0014 12.25v-3.5a.75.75 0 00-1.5 0v3.5a.25.25 0 01-.25.25h-8.5a.25.25 0 01-.25-.25v-8.5a.25.25 0 01.25-.25h3.5a.75.75 0 000-1.5h-3.5z" })
147
+ })
148
+ });
149
+ }
150
+ //#endregion
151
+ //#region src/lib/openApi/customAttributes/genericRenderer.tsx
152
+ function autoLabel(fieldName, prefix) {
153
+ let name = fieldName;
154
+ if (prefix && name.startsWith(prefix)) name = name.slice(prefix.length);
155
+ return name.split("-").filter(Boolean).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
156
+ }
157
+ function kebabToCamel(str) {
158
+ return str.replace(/-./g, (x) => x[1].toUpperCase());
159
+ }
160
+ function getValueKey(fieldName) {
161
+ return kebabToCamel(fieldName);
162
+ }
163
+ function extractValue(data, fieldName) {
164
+ if (!data || typeof data !== "object") return void 0;
165
+ return data[getValueKey(fieldName)];
166
+ }
167
+ function Label({ name, label }) {
168
+ return /* @__PURE__ */ jsxs("div", {
169
+ className: "sap-api-label",
170
+ children: [
171
+ label,
172
+ " ",
173
+ /* @__PURE__ */ jsx(attributeLink, { attributeName: name })
174
+ ]
175
+ });
176
+ }
177
+ function StringRenderer(props) {
178
+ const link = props.valueLinks?.[props.value];
179
+ return /* @__PURE__ */ jsxs("div", {
180
+ className: "sap-api-container",
181
+ children: [/* @__PURE__ */ jsx(Label, {
182
+ name: props.name,
183
+ label: props.label
184
+ }), /* @__PURE__ */ jsx("p", {
185
+ className: "sap-api-value",
186
+ children: link ? /* @__PURE__ */ jsx("a", {
187
+ href: link,
188
+ rel: "noreferrer noopener",
189
+ target: "_blank",
190
+ className: "sap-api-link",
191
+ children: props.value
192
+ }) : props.value
193
+ })]
194
+ });
195
+ }
196
+ function BooleanRenderer(props) {
197
+ return /* @__PURE__ */ jsxs("div", {
198
+ className: "sap-api-container",
199
+ children: [/* @__PURE__ */ jsx(Label, {
200
+ name: props.name,
201
+ label: props.label
202
+ }), /* @__PURE__ */ jsx("p", {
203
+ className: "sap-api-value",
204
+ children: props.value ? "Yes" : "No"
205
+ })]
206
+ });
207
+ }
208
+ function NumberRenderer(props) {
209
+ return /* @__PURE__ */ jsxs("div", {
210
+ className: "sap-api-container",
211
+ children: [/* @__PURE__ */ jsx(Label, {
212
+ name: props.name,
213
+ label: props.label
214
+ }), /* @__PURE__ */ jsx("p", {
215
+ className: "sap-api-value",
216
+ children: props.value
217
+ })]
218
+ });
219
+ }
220
+ function ArrayRenderer(props) {
221
+ return /* @__PURE__ */ jsxs("div", {
222
+ className: "sap-api-container",
223
+ children: [/* @__PURE__ */ jsx(Label, {
224
+ name: props.name,
225
+ label: props.label
226
+ }), /* @__PURE__ */ jsx("div", {
227
+ className: "sap-api-value",
228
+ children: /* @__PURE__ */ jsx("ul", {
229
+ className: "sap-api-list",
230
+ children: props.value.map((item, i) => /* @__PURE__ */ jsx("li", { children: renderObjectValue(item) }, i))
231
+ })
232
+ })]
233
+ });
234
+ }
235
+ function renderObjectValue(val) {
236
+ if (val === null || val === void 0) return /* @__PURE__ */ jsx("span", {
237
+ className: "sap-api-placeholder",
238
+ children: "—"
239
+ });
240
+ if (typeof val === "boolean") return /* @__PURE__ */ jsx("span", { children: val ? "Yes" : "No" });
241
+ if (typeof val === "number") return /* @__PURE__ */ jsx("span", { children: val });
242
+ if (Array.isArray(val)) return /* @__PURE__ */ jsx("ul", {
243
+ className: "sap-api-list",
244
+ children: val.map((item, i) => /* @__PURE__ */ jsx("li", { children: renderObjectValue(item) }, i))
245
+ });
246
+ if (typeof val === "object") return /* @__PURE__ */ jsx("dl", {
247
+ className: "sap-api-obj",
248
+ children: Object.entries(val).map(([k, v]) => /* @__PURE__ */ jsxs("div", {
249
+ className: "sap-api-obj-row",
250
+ children: [
251
+ /* @__PURE__ */ jsxs("dt", {
252
+ className: "sap-api-obj-key",
253
+ children: [k, ":"]
254
+ }),
255
+ " ",
256
+ /* @__PURE__ */ jsx("dd", {
257
+ className: "sap-api-obj-val",
258
+ children: renderObjectValue(v)
259
+ })
260
+ ]
261
+ }, k))
262
+ });
263
+ const str = String(val);
264
+ return /[*_`[\]#]/.test(str) ? /* @__PURE__ */ jsx(Markdown, { children: str }) : /* @__PURE__ */ jsx("span", { children: str });
265
+ }
266
+ function ObjectRenderer(props) {
267
+ return /* @__PURE__ */ jsxs("div", {
268
+ className: "sap-api-container",
269
+ children: [/* @__PURE__ */ jsx(Label, {
270
+ name: props.name,
271
+ label: props.label
272
+ }), /* @__PURE__ */ jsx("div", {
273
+ className: "sap-api-value",
274
+ children: renderObjectValue(props.value)
275
+ })]
276
+ });
277
+ }
278
+ function LinkRenderer(props) {
279
+ const href = props.callback(props.value);
280
+ return /* @__PURE__ */ jsxs("div", {
281
+ className: "sap-api-container",
282
+ children: [/* @__PURE__ */ jsx(Label, {
283
+ name: props.name,
284
+ label: props.label
285
+ }), /* @__PURE__ */ jsx("p", {
286
+ className: "sap-api-value",
287
+ children: href ? /* @__PURE__ */ jsx("a", {
288
+ href,
289
+ rel: "noreferrer noopener",
290
+ target: "_blank",
291
+ className: "sap-api-link",
292
+ children: String(props.value)
293
+ }) : String(props.value)
294
+ })]
295
+ });
296
+ }
297
+ function buildGenericRenderer(fieldName, def, config) {
298
+ if (def && "component" in def) return def.component;
299
+ return (data) => {
300
+ const value = extractValue(data, fieldName);
301
+ if (value === void 0 || value === null) return null;
302
+ const label = def && "label" in def && def.label ? def.label : autoLabel(fieldName, config.prefixStartsWith);
303
+ if (def?.type === "link" && "callback" in def) return /* @__PURE__ */ jsx(LinkRenderer, {
304
+ name: fieldName,
305
+ label,
306
+ value,
307
+ callback: def.callback
308
+ });
309
+ if (def?.type === "boolean" || typeof value === "boolean") return /* @__PURE__ */ jsx(BooleanRenderer, {
310
+ name: fieldName,
311
+ label,
312
+ value: Boolean(value)
313
+ });
314
+ if (def?.type === "number" || typeof value === "number") return /* @__PURE__ */ jsx(NumberRenderer, {
315
+ name: fieldName,
316
+ label,
317
+ value
318
+ });
319
+ if (def?.type === "array" || Array.isArray(value)) {
320
+ if (!Array.isArray(value)) return null;
321
+ return /* @__PURE__ */ jsx(ArrayRenderer, {
322
+ name: fieldName,
323
+ label,
324
+ value
325
+ });
326
+ }
327
+ if (def?.type === "object" || typeof value === "object") return /* @__PURE__ */ jsx(ObjectRenderer, {
328
+ name: fieldName,
329
+ label,
330
+ value
331
+ });
332
+ const valueLinks = def && "valueLinks" in def ? def.valueLinks : void 0;
333
+ return /* @__PURE__ */ jsx(StringRenderer, {
334
+ name: fieldName,
335
+ label,
336
+ value: String(value),
337
+ valueLinks
338
+ });
339
+ };
340
+ }
341
+ //#endregion
342
+ //#region src/lib/openApi/utils/plugins.ts
343
+ function camelCaseKeys(obj) {
344
+ const result = {};
345
+ for (const [k, v] of Object.entries(obj)) {
346
+ const camelKey = k.replace(/-./g, (x) => x[1].toUpperCase());
347
+ result[camelKey] = v;
348
+ }
349
+ return result;
350
+ }
351
+ function buildSchemaAttrsRenderer(configs) {
352
+ return (data) => {
353
+ if (!data || typeof data !== "object") return null;
354
+ const outer = data;
355
+ const xFields = outer["xSapSchemaAttrs"] ?? outer["x-sap-schema-attrs"];
356
+ if (!xFields || typeof xFields !== "object") return null;
357
+ const camelData = camelCaseKeys(xFields);
358
+ const renderers = [];
359
+ for (const key of Object.keys(xFields)) {
360
+ if (!key.startsWith("x-")) continue;
361
+ const matchingConfig = configs.find((c) => c.extensions?.[key]) ?? configs.find((c) => c.prefixStartsWith && key.startsWith(c.prefixStartsWith));
362
+ if (!matchingConfig) continue;
363
+ const def = matchingConfig.extensions?.[key];
364
+ const el = buildGenericRenderer(key, def, matchingConfig)(camelData);
365
+ if (el) renderers.push(el);
366
+ }
367
+ if (renderers.length === 0) return null;
368
+ return createElement("div", { className: "sap-schema-attrs-block" }, ...renderers);
369
+ };
370
+ }
371
+ function buildCustomAttributesPlugin(doc, configs) {
372
+ const allNames = /* @__PURE__ */ new Set();
373
+ for (const config of configs) {
374
+ if (config.extensions) for (const name of Object.keys(config.extensions)) allNames.add(name);
375
+ if (config.prefixStartsWith && doc) for (const name of discoverAttributeNames(doc, config.prefixStartsWith)) allNames.add(name);
376
+ }
377
+ const extensions = [...allNames].map((name) => {
378
+ const matchingConfig = configs.find((c) => c.extensions?.[name]) ?? configs.find((c) => c.prefixStartsWith && name.startsWith(c.prefixStartsWith)) ?? configs[0];
379
+ const def = matchingConfig?.extensions?.[name];
380
+ return {
381
+ name,
382
+ component: buildGenericRenderer(name, def, matchingConfig ?? {}),
383
+ renderer: ReactRenderer
384
+ };
385
+ });
386
+ extensions.push({
387
+ name: SCHEMA_ATTRS_KEY,
388
+ component: buildSchemaAttrsRenderer(configs),
389
+ renderer: ReactRenderer
390
+ });
391
+ return () => ({
392
+ name: "custom-attributes-plugin",
393
+ extensions
394
+ });
395
+ }
396
+ //#endregion
397
+ //#region src/lib/openApi/utils/scalarTheme.ts
398
+ var SCALAR_MAP = {
399
+ "--ord-background": ["--scalar-background-1"],
400
+ "--ord-foreground": ["--scalar-color-1"],
401
+ "--ord-secondary": ["--scalar-background-2"],
402
+ "--ord-secondary-foreground": ["--scalar-color-2"],
403
+ "--ord-muted": ["--scalar-background-3"],
404
+ "--ord-muted-foreground": ["--scalar-color-3"],
405
+ "--ord-primary": [
406
+ "--scalar-color-accent",
407
+ "--scalar-button-1",
408
+ "--scalar-link-color",
409
+ "--scalar-button-1-hover",
410
+ "--scalar-link-color-hover"
411
+ ],
412
+ "--ord-primary-foreground": ["--scalar-button-1-color"],
413
+ "--ord-border": ["--scalar-border-color"],
414
+ "--ord-destructive": ["--scalar-color-red", "--scalar-color-danger"],
415
+ "--ord-success": ["--scalar-color-green"],
416
+ "--ord-warning": ["--scalar-color-orange"],
417
+ "--ord-radius": ["--scalar-radius", "--scalar-radius-lg"]
418
+ };
419
+ var SCALAR_SIDEBAR_MAP = {
420
+ "--ord-sidebar": ["--scalar-sidebar-background-1"],
421
+ "--ord-sidebar-foreground": ["--scalar-sidebar-color-1"],
422
+ "--ord-sidebar-primary": ["--scalar-sidebar-background-2"],
423
+ "--ord-sidebar-primary-foreground": ["--scalar-sidebar-color-2", "--scalar-sidebar-search-color"],
424
+ "--ord-sidebar-accent": [
425
+ "--scalar-sidebar-item-active-background",
426
+ "--scalar-sidebar-item-hover-background",
427
+ "--scalar-sidebar-search-background"
428
+ ],
429
+ "--ord-sidebar-accent-foreground": ["--scalar-sidebar-color-active", "--scalar-sidebar-item-hover-color"],
430
+ "--ord-sidebar-border": ["--scalar-sidebar-border-color", "--scalar-sidebar-search-border-color"]
431
+ };
432
+ function formatValue(name, value) {
433
+ if (name === "--ord-radius") return `${value}px`;
434
+ return value;
435
+ }
436
+ var scalarAdapter = {
437
+ selector: ".scalar-app",
438
+ map(canonical) {
439
+ const out = {};
440
+ for (const [name, value] of Object.entries(canonical)) {
441
+ const targets = SCALAR_MAP[name];
442
+ if (!targets) continue;
443
+ const formatted = formatValue(name, value);
444
+ for (const target of targets) out[target] = formatted;
445
+ }
446
+ return out;
447
+ }
448
+ };
449
+ var scalarSidebarAdapter = {
450
+ selector: ".scalar-app .t-doc__sidebar",
451
+ map(canonical) {
452
+ const out = {};
453
+ for (const [name, value] of Object.entries(canonical)) {
454
+ const targets = SCALAR_SIDEBAR_MAP[name];
455
+ if (!targets) continue;
456
+ for (const target of targets) out[target] = value;
457
+ }
458
+ return out;
459
+ }
460
+ };
461
+ var scalarModeAdapter = {
462
+ selector: ".scalar-app .dark-mode, .scalar-app.dark-mode, .scalar-app .light-mode, .scalar-app.light-mode",
463
+ map(canonical) {
464
+ const out = {};
465
+ for (const [name, value] of Object.entries(canonical)) {
466
+ const targets = SCALAR_MAP[name];
467
+ if (!targets) continue;
468
+ const formatted = formatValue(name, value);
469
+ for (const target of targets) out[target] = formatted;
470
+ }
471
+ return out;
472
+ }
473
+ };
474
+ var SCALAR_HLJS_VARS = [
475
+ "--ord-hljs-attr",
476
+ "--ord-hljs-string",
477
+ "--ord-hljs-number",
478
+ "--ord-hljs-function",
479
+ "--ord-hljs-literal",
480
+ "--ord-hljs-punctuation",
481
+ "--ord-hljs-keyword",
482
+ "--ord-hljs-comment"
483
+ ];
484
+ var scalarHljsAdapter = {
485
+ selector: ".scalar-app",
486
+ map(canonical) {
487
+ const out = {};
488
+ for (const name of SCALAR_HLJS_VARS) if (name in canonical) out[name] = canonical[name];
489
+ return out;
490
+ }
491
+ };
492
+ var scalarTeleportAdapter = {
493
+ selector: ".scalar-app, #headlessui-portal-root",
494
+ map(canonical) {
495
+ const out = {};
496
+ for (const [name, value] of Object.entries(canonical)) {
497
+ const targets = SCALAR_MAP[name];
498
+ if (!targets) continue;
499
+ const formatted = formatValue(name, value);
500
+ for (const target of targets) out[target] = formatted;
501
+ }
502
+ return out;
503
+ }
504
+ };
505
+ function buildScalarThemeStyles(id, theme) {
506
+ const scope = `[data-renderer-id="${id}"]`;
507
+ return [[
508
+ scalarAdapter,
509
+ scalarSidebarAdapter,
510
+ scalarModeAdapter,
511
+ scalarHljsAdapter
512
+ ].map((adapter) => {
513
+ const mapped = adapter.map(theme);
514
+ const decls = Object.entries(mapped).map(([k, v]) => ` ${k}: ${v};`).join("\n");
515
+ if (!decls) return "";
516
+ return `${scope} ${adapter.selector} {\n${decls}\n}`;
517
+ }).filter(Boolean).join("\n\n"), (() => {
518
+ const mapped = scalarTeleportAdapter.map(theme);
519
+ const decls = Object.entries(mapped).map(([k, v]) => ` ${k}: ${v};`).join("\n");
520
+ if (!decls) return "";
521
+ return `${scalarTeleportAdapter.selector} {\n${decls}\n}`;
522
+ })()].filter(Boolean).join("\n\n");
523
+ }
524
+ //#endregion
525
+ //#region src/lib/openApi/customAttributes/sapAttributes/root/typeCheckXxtOverview.ts
526
+ function typeCheckExSapExtOverviewExSapExtOverview(obj) {
527
+ if (typeof obj !== "object" || obj === null) return false;
528
+ if (!("xSapExtOverview" in obj) || !Array.isArray(obj.xSapExtOverview)) return false;
529
+ return obj.xSapExtOverview.every((xSapExtOverview) => {
530
+ if (typeof xSapExtOverview !== "object" || xSapExtOverview === null) return false;
531
+ if (!("name" in xSapExtOverview) || !("values" in xSapExtOverview)) return false;
532
+ if (typeof xSapExtOverview.name !== "string") return false;
533
+ if (typeof xSapExtOverview.values === "string") return true;
534
+ if (!Array.isArray(xSapExtOverview.values)) return false;
535
+ if (xSapExtOverview.values.every((value) => typeof value === "string")) return true;
536
+ return xSapExtOverview.values.every((value) => {
537
+ if (typeof value !== "object" || value === null) return false;
538
+ if (!("text" in value) || typeof value.text !== "string") return false;
539
+ return "format" in value && (value.format === "plain" || value.format === "markdown");
540
+ });
541
+ });
542
+ }
543
+ //#endregion
544
+ //#region src/lib/openApi/customAttributes/sapAttributes/root/extOverview.tsx
545
+ function extOverview(props) {
546
+ if (!typeCheckExSapExtOverviewExSapExtOverview(props)) return null;
547
+ const { xSapExtOverview } = props;
548
+ return /* @__PURE__ */ jsxs("div", {
549
+ className: "sap-api-container",
550
+ children: [/* @__PURE__ */ jsxs("div", {
551
+ className: "sap-api-label sap-api-label--root",
552
+ children: ["SAP Extensibility Overview ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-ext-overview" })]
553
+ }), /* @__PURE__ */ jsx("div", {
554
+ className: "sap-api-value sap-api-value--root",
555
+ children: xSapExtOverview.map((extension) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: extension.name }), /* @__PURE__ */ jsx("ul", {
556
+ className: "sap-api-list",
557
+ children: typeof extension.values === "string" ? /* @__PURE__ */ jsx("li", { children: extension.values }) : extension.values.map((value) => typeof value === "string" ? /* @__PURE__ */ jsx("li", { children: value }, value) : /* @__PURE__ */ jsx("li", { children: value.format === "plain" ? value.text : /* @__PURE__ */ jsx(Markdown, { children: value.text }) }, value.text))
558
+ })] }, extension.name))
559
+ })]
560
+ });
561
+ }
562
+ //#endregion
563
+ //#region src/lib/openApi/customAttributes/sapAttributes/root/stateInfo.tsx
564
+ var background = {
565
+ ACTIVE: "color-mix(in srgb, var(--scalar-color-green) 15%, transparent)",
566
+ BETA: "color-mix(in srgb, var(--scalar-color-blue) 15%, transparent)",
567
+ DEPRECATED: "color-mix(in srgb, var(--scalar-color-orange) 15%, transparent)",
568
+ DECOMMISSIONED: "color-mix(in srgb, var(--scalar-color-red) 15%, transparent)"
569
+ };
570
+ var color = {
571
+ ACTIVE: "var(--scalar-color-green)",
572
+ BETA: "var(--scalar-color-blue)",
573
+ DEPRECATED: "var(--scalar-color-orange)",
574
+ DECOMMISSIONED: "var(--scalar-color-red)"
575
+ };
576
+ function StateInfo({ xSapStateInfo }) {
577
+ if (!xSapStateInfo) return null;
578
+ const status = xSapStateInfo.state?.toUpperCase();
579
+ const badge = /* @__PURE__ */ jsx("span", {
580
+ style: {
581
+ display: "inline-block",
582
+ borderRadius: "10px",
583
+ padding: "0 6px",
584
+ background: background[status] || "",
585
+ color: color[status] || ""
586
+ },
587
+ children: status
588
+ });
589
+ const dateFormatter = new Intl.DateTimeFormat("en-GB", { dateStyle: "long" });
590
+ const formatDate = (d) => {
591
+ const parsed = new Date(d);
592
+ return isNaN(parsed.getTime()) ? d : dateFormatter.format(parsed);
593
+ };
594
+ return /* @__PURE__ */ jsxs("div", {
595
+ className: "sap-api-container",
596
+ children: [/* @__PURE__ */ jsxs("div", {
597
+ className: "sap-api-label",
598
+ children: ["API State ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-stateInfo" })]
599
+ }), /* @__PURE__ */ jsxs("div", {
600
+ className: "sap-api-value",
601
+ children: [
602
+ badge,
603
+ xSapStateInfo.deprecationDate && /* @__PURE__ */ jsxs("div", { children: ["Deprecated on ", formatDate(xSapStateInfo.deprecationDate)] }),
604
+ xSapStateInfo.decommissionedDate && /* @__PURE__ */ jsxs("div", { children: ["Decommissioned on ", formatDate(xSapStateInfo.decommissionedDate)] }),
605
+ xSapStateInfo.successorApi && /* @__PURE__ */ jsxs("div", { children: ["Successor API: ", /* @__PURE__ */ jsx("a", {
606
+ href: xSapStateInfo.successorApi,
607
+ target: "_blank",
608
+ rel: "noreferrer",
609
+ className: "sap-api-link",
610
+ children: xSapStateInfo.successorApi
611
+ })] })
612
+ ]
613
+ })]
614
+ });
615
+ }
616
+ //#endregion
617
+ //#region src/lib/openApi/customAttributes/sapAttributes/root/ordId.tsx
618
+ function CopyIcon() {
619
+ return /* @__PURE__ */ jsxs("svg", {
620
+ viewBox: "0 0 24 24",
621
+ width: "1em",
622
+ height: "1em",
623
+ fill: "none",
624
+ stroke: "currentColor",
625
+ strokeWidth: "2",
626
+ "aria-hidden": "true",
627
+ children: [/* @__PURE__ */ jsx("rect", {
628
+ x: "9",
629
+ y: "9",
630
+ width: "13",
631
+ height: "13",
632
+ rx: "2"
633
+ }), /* @__PURE__ */ jsx("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })]
634
+ });
635
+ }
636
+ function CheckIcon() {
637
+ return /* @__PURE__ */ jsx("svg", {
638
+ viewBox: "0 0 24 24",
639
+ width: "1em",
640
+ height: "1em",
641
+ fill: "none",
642
+ stroke: "currentColor",
643
+ strokeWidth: "2",
644
+ "aria-hidden": "true",
645
+ children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
646
+ });
647
+ }
648
+ function ordId({ xSapOrdId }) {
649
+ const [copied, setCopied] = useState(false);
650
+ if (!xSapOrdId) return null;
651
+ const copy = () => {
652
+ navigator.clipboard?.writeText(xSapOrdId).then(() => {
653
+ setCopied(true);
654
+ setTimeout(() => setCopied(false), 1500);
655
+ });
656
+ };
657
+ return /* @__PURE__ */ jsxs("div", {
658
+ className: "sap-api-container",
659
+ children: [/* @__PURE__ */ jsxs("div", {
660
+ className: "sap-api-label",
661
+ children: ["ORD ID ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-ord-id" })]
662
+ }), /* @__PURE__ */ jsxs("div", {
663
+ className: "sap-api-value sap-api-ord-id",
664
+ children: [/* @__PURE__ */ jsx("span", {
665
+ className: "sap-api-ord-id-text",
666
+ children: xSapOrdId
667
+ }), /* @__PURE__ */ jsx("button", {
668
+ type: "button",
669
+ className: "sap-api-copy-btn",
670
+ onClick: copy,
671
+ "aria-label": "Copy ORD ID",
672
+ title: copied ? "Copied" : "Copy",
673
+ children: copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {})
674
+ })]
675
+ })]
676
+ });
677
+ }
678
+ //#endregion
679
+ //#region src/lib/openApi/customAttributes/sapAttributes/operation/deprecatedOperation.tsx
680
+ function deprecatedOperation({ xSapDeprecatedOperation }) {
681
+ const deprecationDate = new Intl.DateTimeFormat("en-GB", { dateStyle: "long" }).format(new Date(xSapDeprecatedOperation.deprecationDate));
682
+ return /* @__PURE__ */ jsxs("div", {
683
+ className: "sap-api-container",
684
+ children: [/* @__PURE__ */ jsxs("div", {
685
+ className: "sap-api-label",
686
+ children: ["SAP Deprecated Operation ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-deprecated-operation" })]
687
+ }), /* @__PURE__ */ jsxs("div", {
688
+ className: "sap-api-value",
689
+ children: [
690
+ "Deprecated on ",
691
+ deprecationDate,
692
+ " ",
693
+ /* @__PURE__ */ jsx("br", {}),
694
+ !xSapDeprecatedOperation.successorOperationRef && !xSapDeprecatedOperation.successorOperationId ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
695
+ " Successor ",
696
+ xSapDeprecatedOperation.successorOperationRef ? /* @__PURE__ */ jsx("a", {
697
+ href: xSapDeprecatedOperation.successorOperationRef,
698
+ rel: "noreferrer, noopener",
699
+ children: xSapDeprecatedOperation.successorOperationRef
700
+ }) : null,
701
+ xSapDeprecatedOperation.successorOperationId ? /* @__PURE__ */ jsx("span", { children: xSapDeprecatedOperation.successorOperationId }) : null
702
+ ] })
703
+ ]
704
+ })]
705
+ });
706
+ }
707
+ //#endregion
708
+ //#region src/lib/openApi/customAttributes/sapAttributes/schema/odmEntityName.tsx
709
+ function odmEntityName({ xSapOdmEntityName }) {
710
+ return /* @__PURE__ */ jsxs("div", {
711
+ className: "sap-api-container",
712
+ children: [/* @__PURE__ */ jsxs("div", {
713
+ className: "sap-api-label",
714
+ children: ["ODM entity name ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-odm-entity-name" })]
715
+ }), /* @__PURE__ */ jsx("div", {
716
+ className: "sap-api-value",
717
+ children: xSapOdmEntityName
718
+ })]
719
+ });
720
+ }
721
+ //#endregion
722
+ //#region src/lib/openApi/customAttributes/sapAttributes/schema/odmSemanticKey.tsx
723
+ function odmSemanticKey({ xSapOdmSemanticKey }) {
724
+ return /* @__PURE__ */ jsxs("div", {
725
+ className: "sap-api-container",
726
+ children: [/* @__PURE__ */ jsxs("div", {
727
+ className: "sap-api-label",
728
+ children: ["ODM Semantic Key ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-odm-semantic-key" })]
729
+ }), /* @__PURE__ */ jsx("div", {
730
+ className: "sap-api-value",
731
+ children: xSapOdmSemanticKey.map((entry) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: entry.name }), /* @__PURE__ */ jsx("ul", {
732
+ className: "sap-api-list",
733
+ children: entry.values.map((v) => /* @__PURE__ */ jsx("li", { children: v }, v))
734
+ })] }, entry.name))
735
+ })]
736
+ });
737
+ }
738
+ //#endregion
739
+ //#region src/lib/openApi/customAttributes/sapAttributes/sapPreset.ts
740
+ function component(fn) {
741
+ return { component: fn };
742
+ }
743
+ var sapOpenApiAttributesConfig = {
744
+ prefixStartsWith: "x-sap-",
745
+ documentationUrl: (name, { version }) => `https://github.com/SAP/openapi-specification/tree/main/sap-schemas/v${version}#${name}`,
746
+ extensions: {
747
+ "x-sap-compliance-level": {
748
+ type: "link",
749
+ label: "SAP Compliance Level",
750
+ callback: (v) => {
751
+ return {
752
+ "sap:base:v1": "https://github.com/open-resource-discovery/specification/blob/main/docs/spec-extensions/policy-levels/sap-base-v1.md",
753
+ "sap:core:v1": "https://github.com/open-resource-discovery/specification/blob/main/docs/spec-extensions/policy-levels/sap-core-v1.md",
754
+ "sap:core:v2": "https://github.com/open-resource-discovery/specification/blob/main/docs/spec-extensions/policy-levels/sap-core-v1.md"
755
+ }[String(v)];
756
+ }
757
+ },
758
+ "x-sap-shortText": {
759
+ type: "string",
760
+ label: "SAP Short Text"
761
+ },
762
+ "x-sap-software-min-version": {
763
+ type: "string",
764
+ label: "SAP Software Version"
765
+ },
766
+ "x-sap-api-type": {
767
+ type: "string",
768
+ label: "SAP API Type"
769
+ },
770
+ "x-sap-direction": {
771
+ type: "string",
772
+ label: "SAP Direction"
773
+ },
774
+ "x-sap-ord-id": component(ordId),
775
+ "x-sap-operation-intent": {
776
+ type: "string",
777
+ label: "SAP Operation Intent"
778
+ },
779
+ "x-sap-odm-oid": {
780
+ type: "string",
781
+ label: "ODM OID"
782
+ },
783
+ "x-sap-odm-oid-reference-entity-name": {
784
+ type: "string",
785
+ label: "ODM OID Reference Entity Name"
786
+ },
787
+ "x-sap-precision": {
788
+ type: "number",
789
+ label: "SAP Precision"
790
+ },
791
+ "x-sap-scale": {
792
+ type: "number",
793
+ label: "SAP Scale"
794
+ },
795
+ "x-sap-root-entity": {
796
+ type: "boolean",
797
+ label: "SAP Root Entity"
798
+ },
799
+ "x-sap-dpp-entity-semantics": {
800
+ type: "string",
801
+ label: "SAP DPP: Entity Semantics"
802
+ },
803
+ "x-sap-dpp-data-subject-role": {
804
+ type: "string",
805
+ label: "SAP DPP: Data Subject Role"
806
+ },
807
+ "x-sap-dpp-data-subject-role-description": {
808
+ type: "string",
809
+ label: "SAP DPP: Data Subject Role Description"
810
+ },
811
+ "x-sap-dpp-field-semantics": {
812
+ type: "string",
813
+ label: "SAP DPP: Field Semantics"
814
+ },
815
+ "x-sap-dpp-is-potentially-personal": {
816
+ type: "boolean",
817
+ label: "SAP DPP: Potentially Personal"
818
+ },
819
+ "x-sap-dpp-is-potentially-sensitive": {
820
+ type: "boolean",
821
+ label: "SAP DPP: Potentially Sensitive"
822
+ },
823
+ "x-sap-ext-overview": component(extOverview),
824
+ "x-sap-stateInfo": component(StateInfo),
825
+ "x-sap-extensible": {
826
+ type: "object",
827
+ label: "SAP Extensible"
828
+ },
829
+ "x-sap-deprecated-operation": component(deprecatedOperation),
830
+ "x-sap-odm-entity-name": component(odmEntityName),
831
+ "x-sap-odm-semantic-key": component(odmSemanticKey)
832
+ }
833
+ };
834
+ //#endregion
835
+ //#region src/lib/openApi/styles.ts
836
+ var styles_default = `
837
+ .sap-api-container {
838
+ display: flex;
839
+ flex-wrap: wrap;
840
+ container-type: inline-size;
841
+ border: var(--scalar-border-width) solid var(--scalar-border-color);
842
+ border-radius: var(--scalar-radius-lg);
843
+ margin-top: 8px;
844
+ font-size: var(--scalar-small);
845
+ line-height: var(--scalar-line-height-3);
846
+ overflow: hidden;
847
+ }
848
+
849
+ .sap-api-label {
850
+ color: var(--scalar-color-1);
851
+ width: 30%;
852
+ min-width: 20ch;
853
+ flex-shrink: 0;
854
+ background: var(--scalar-background-2);
855
+ padding: 6px 9px 6px 12px;
856
+ border-right: var(--scalar-border-width) solid var(--scalar-border-color);
857
+ display: flex;
858
+ align-items: flex-start;
859
+ justify-content: space-between;
860
+ font-weight: 500;
861
+ }
862
+
863
+ .sap-api-label--root {
864
+ min-width: 20ch;
865
+ }
866
+
867
+ .sap-api-value {
868
+ color: var(--scalar-color-2);
869
+ padding: 8px;
870
+ flex: 1 1 0;
871
+ min-width: 0;
872
+ }
873
+
874
+ .sap-api-value--root {
875
+ flex: 1 1 0;
876
+ min-width: 0;
877
+ }
878
+
879
+ .sap-api-list {
880
+ margin: 0 2ch;
881
+ list-style: disc;
882
+ }
883
+
884
+ .sap-api-link {
885
+ text-decoration: none;
886
+ color: var(--scalar-link-color);
887
+ transition: color 0.1s ease-in-out;
888
+ cursor: pointer;
889
+ }
890
+
891
+ .sap-api-ord-id {
892
+ display: flex;
893
+ align-items: flex-start;
894
+ gap: 8px;
895
+ }
896
+
897
+ .sap-api-ord-id-text {
898
+ flex: 1 1 auto;
899
+ min-width: 0;
900
+ word-break: break-all;
901
+ }
902
+
903
+ .sap-api-copy-btn {
904
+ flex-shrink: 0;
905
+ cursor: pointer;
906
+ display: inline-flex;
907
+ align-items: center;
908
+ justify-content: center;
909
+ font-size: 1em;
910
+ line-height: 1;
911
+ padding: 4px;
912
+ color: var(--scalar-color-2);
913
+ background: var(--scalar-background-2);
914
+ border: var(--scalar-border-width) solid var(--scalar-border-color);
915
+ border-radius: var(--scalar-radius);
916
+ transition: background 0.1s ease-in-out, color 0.1s ease-in-out;
917
+ }
918
+
919
+ .sap-api-copy-btn:hover {
920
+ background: var(--scalar-background-3);
921
+ color: var(--scalar-color-1);
922
+ }
923
+
924
+ .sap-api-placeholder {
925
+ color: #999;
926
+ }
927
+
928
+ .sap-api-obj {
929
+ margin: 0;
930
+ padding-left: 12px;
931
+ }
932
+
933
+ .sap-api-obj-row {
934
+ margin-bottom: 4px;
935
+ }
936
+
937
+ .sap-api-obj-key {
938
+ font-weight: 600;
939
+ display: inline;
940
+ }
941
+
942
+ .sap-api-obj-val {
943
+ display: inline;
944
+ margin: 0;
945
+ }
946
+
947
+ /* Width-adaptive rows: react to the row's own available width (container-type above).
948
+ When the row is narrow, label and value wrap onto separate lines (label above value). */
949
+ @container (max-width: 420px) {
950
+ .sap-api-label,
951
+ .sap-api-label--root {
952
+ flex-basis: 100%;
953
+ width: 100%;
954
+ min-width: 0;
955
+ border-right: none;
956
+ border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);
957
+ }
958
+ .sap-api-value,
959
+ .sap-api-value--root {
960
+ flex-basis: 100%;
961
+ width: 100%;
962
+ }
963
+ }
964
+
965
+ a {
966
+ text-decoration: none;
967
+ color: var(--sapLinkColor);
968
+ transition: color 0.1s ease-in-out;
969
+ cursor: pointer;
970
+ }
971
+ a:hover {
972
+ text-decoration: underline;
973
+ }
974
+
975
+ /* Keyboard key: use Scalar background instead of Infima colors */
976
+ .scalar-app kbd {
977
+ background: var(--scalar-background-1);
978
+ color: var(--scalar-color-1);
979
+ border: 1px solid var(--scalar-border-color);
980
+ }
981
+
982
+ /* Syntax highlighting — override --scalar-color-* with ThemeEditor --ord-hljs-* tokens */
983
+ .scalar-app .hljs-attr,
984
+ .scalar-app .hljs-attribute { color: var(--ord-hljs-attr); }
985
+
986
+ .scalar-app .hljs-string,
987
+ .scalar-app .hljs-regexp,
988
+ .scalar-app .hljs-subst,
989
+ .scalar-app .hljs-doctag,
990
+ .scalar-app .hljs-bullet,
991
+ .scalar-app .hljs-link,
992
+ .scalar-app .hljs-meta,
993
+ .scalar-app .hljs-symbol { color: var(--ord-hljs-string); }
994
+
995
+ .scalar-app .hljs-number,
996
+ .scalar-app .hljs-selector-attr,
997
+ .scalar-app .hljs-selector-pseudo,
998
+ .scalar-app .hljs-built_in { color: var(--ord-hljs-number); }
999
+
1000
+ .scalar-app .hljs-title.function_ { color: var(--ord-hljs-function); }
1001
+
1002
+ .scalar-app .hljs-addition,
1003
+ .scalar-app .hljs-literal,
1004
+ .scalar-app .hljs-selector-tag,
1005
+ .scalar-app .hljs-type { color: var(--ord-hljs-literal); }
1006
+
1007
+ .scalar-app .hljs-keyword { color: var(--ord-hljs-keyword); }
1008
+
1009
+ .scalar-app .hljs-comment,
1010
+ .scalar-app .hljs-quote { color: var(--ord-hljs-comment); }
1011
+
1012
+ .scalar-app .hljs-punctuation { color: var(--ord-hljs-punctuation); }
1013
+
1014
+ /* Hide the "x-sap-schema-attrs" property heading row — the row exists only to
1015
+ carry schema-level extension components; the key name should not be visible. */
1016
+ .scalar-app .property:has(.sap-schema-attrs-block) {
1017
+ padding-top: 2px;
1018
+ }
1019
+ .scalar-app .property:has(.sap-schema-attrs-block) .property-heading {
1020
+ display: none;
1021
+ }
1022
+
1023
+ /* Override Scalar's sidebar height variable so the <aside> uses our measured container height
1024
+ instead of Scalar's default 100dvh (which breaks when embedded in Docusaurus/non-fullscreen). */
1025
+ .scalar-app {
1026
+ --refs-sidebar-height: calc(var(--scalar-container-height, 100dvh) - var(--refs-header-height, 0px));
1027
+ }
1028
+ `;
1029
+ //#endregion
1030
+ //#region src/lib/openApi/index.tsx
1031
+ function OpenApiRenderer({ content, showCustomAttributes = true, customAttributes, className, theme }) {
1032
+ const id = useId();
1033
+ const containerRef = useRef(null);
1034
+ const isDark = className?.split(/\s+/).includes("dark") ?? false;
1035
+ const activeConfigs = customAttributes ?? [sapOpenApiAttributesConfig];
1036
+ useEffect(() => {
1037
+ const el = containerRef.current;
1038
+ if (!el) return;
1039
+ const ro = new ResizeObserver(([entry]) => {
1040
+ el.style.setProperty("--scalar-container-height", `${entry.contentRect.height}px`);
1041
+ });
1042
+ ro.observe(el);
1043
+ return () => {
1044
+ ro.disconnect();
1045
+ if (window.location.hash) history.replaceState(null, "", window.location.pathname + window.location.search);
1046
+ };
1047
+ }, []);
1048
+ const customAttributesKey = useMemo(() => {
1049
+ if (!showCustomAttributes) return "";
1050
+ const parsed = loadObject(content);
1051
+ if (!parsed) return "";
1052
+ return activeConfigs.flatMap((config) => extractCustomAttributeValues(parsed, config.prefixStartsWith ?? "").map(([k, v]) => `${k}=${JSON.stringify(v)}`)).join("|");
1053
+ }, [
1054
+ content,
1055
+ showCustomAttributes,
1056
+ activeConfigs
1057
+ ]);
1058
+ const configuration = useMemo(() => {
1059
+ openApiContext.version = getVersion(content);
1060
+ openApiContext.configs = showCustomAttributes ? activeConfigs : [];
1061
+ const parsed = loadObject(content);
1062
+ const prefixes = activeConfigs.map((c) => c.prefixStartsWith).filter(Boolean);
1063
+ return {
1064
+ content: showCustomAttributes && parsed && prefixes.length ? injectSchemaExtensions(parsed, prefixes) : parsed ?? content,
1065
+ plugins: showCustomAttributes ? [buildCustomAttributesPlugin(parsed, activeConfigs)] : [],
1066
+ forceDarkModeState: isDark ? "dark" : "light",
1067
+ hideDarkModeToggle: true,
1068
+ hideClientButton: true,
1069
+ showDeveloperTools: "never"
1070
+ };
1071
+ }, [
1072
+ content,
1073
+ isDark,
1074
+ showCustomAttributes,
1075
+ activeConfigs
1076
+ ]);
1077
+ return /* @__PURE__ */ jsxs("div", {
1078
+ ref: containerRef,
1079
+ "data-renderer-id": id,
1080
+ style: {
1081
+ height: "100%",
1082
+ ...theme
1083
+ },
1084
+ children: [
1085
+ /* @__PURE__ */ jsx("style", { children: styles_default }),
1086
+ theme && /* @__PURE__ */ jsx("style", { children: buildScalarThemeStyles(id, theme) }),
1087
+ /* @__PURE__ */ jsx(ApiReferenceReact, { configuration }, `${isDark ? "dark" : "light"}-${showCustomAttributes}-${customAttributesKey}`)
1088
+ ]
1089
+ });
1090
+ }
1091
+ //#endregion
1092
+ export { sapOpenApiAttributesConfig as n, OpenApiRenderer as t };