@digi-frontend/dgate-api-documentation 4.0.4 → 4.0.5

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.
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import { create } from "zustand";
2
2
  import { devtools } from "zustand/middleware";
3
3
  import { immer } from "zustand/middleware/immer";
4
- import { useEffect, useMemo, useRef, useState } from "react";
5
- import { Alert, Breadcrumb, Button, Card, Col, Divider, Drawer, Empty, Flex, Form, Grid, Input, Modal, Pagination, Row, Select, Switch, Table, Tabs, Tag, Tooltip, Tree, Typography, message, theme } from "antd";
4
+ import { useEffect, useId, useMemo, useRef, useState } from "react";
5
+ import { Alert, Breadcrumb, Button, Card, Col, Divider, Drawer, Empty, Flex, Form, Grid, Input, Menu, Modal, Pagination, Row, Select, Switch, Table, Tabs, Tag, Tooltip, Tree, Typography, message, theme } from "antd";
6
6
  import { useStyleRegister } from "@ant-design/cssinjs";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
8
  import Text from "antd/es/typography/Text.js";
9
- import { AppstoreOutlined, BarsOutlined, CheckCircleOutlined, DownOutlined, EditOutlined, ExclamationCircleFilled, EyeOutlined, InfoCircleOutlined, LeftOutlined, MinusSquareOutlined, PlusOutlined, PlusSquareOutlined, RightOutlined, SafetyOutlined, SearchOutlined, UpCircleOutlined } from "@ant-design/icons";
9
+ import { AppstoreOutlined, BarsOutlined, CheckCircleOutlined, CloseCircleOutlined, DownOutlined, EditOutlined, ExclamationCircleFilled, ExclamationCircleOutlined, EyeOutlined, InfoCircleOutlined, LeftOutlined, MinusSquareOutlined, PlusOutlined, PlusSquareOutlined, RightOutlined, SafetyOutlined, SearchOutlined, TagOutlined, UpCircleOutlined } from "@ant-design/icons";
10
10
  import { Resizable } from "re-resizable";
11
11
  import Title from "antd/es/typography/Title.js";
12
12
  import { Light } from "react-syntax-highlighter";
@@ -1069,8 +1069,8 @@ const Sidebar$1 = ({ searchValue, setSearchValue }) => {
1069
1069
  };
1070
1070
  return wrapSSR(/* @__PURE__ */ jsx(Resizable, {
1071
1071
  as: "aside",
1072
- minWidth: 300,
1073
- maxWidth: 386,
1072
+ minWidth: 240,
1073
+ maxWidth: 240,
1074
1074
  enable: {
1075
1075
  top: false,
1076
1076
  right: true,
@@ -1082,7 +1082,7 @@ const Sidebar$1 = ({ searchValue, setSearchValue }) => {
1082
1082
  topLeft: false
1083
1083
  },
1084
1084
  defaultSize: {
1085
- width: 333,
1085
+ width: 240,
1086
1086
  height: "100%"
1087
1087
  },
1088
1088
  className: cx("sider"),
@@ -1732,7 +1732,7 @@ const requestColumns$1 = [
1732
1732
  }
1733
1733
  ];
1734
1734
  const responseColumns$1 = [...requestColumns$1];
1735
- const buildRequestData$1 = (params) => [...params].sort((a, b) => a.required === b.required ? 0 : a.required ? -1 : 1).map((p, index) => {
1735
+ const buildRequestData$1 = (params, colors) => [...params].sort((a, b) => a.required === b.required ? 0 : a.required ? -1 : 1).map((p, index) => {
1736
1736
  let typeLabel = p.schema?.type;
1737
1737
  if (p.schema?.type === "array" && p.schema?.items?.type) typeLabel = `${p.schema.type}_${p.schema.items.type}`;
1738
1738
  return {
@@ -1741,17 +1741,17 @@ const buildRequestData$1 = (params) => [...params].sort((a, b) => a.required ===
1741
1741
  p.name,
1742
1742
  typeLabel && /* @__PURE__ */ jsx("span", {
1743
1743
  style: {
1744
- color: "rgba(0,0,0,0.45)",
1744
+ color: colors.typeLabel,
1745
1745
  marginLeft: "0.25rem",
1746
1746
  marginRight: "0.25rem"
1747
1747
  },
1748
1748
  children: typeLabel
1749
1749
  }),
1750
1750
  p.required ? /* @__PURE__ */ jsx("span", {
1751
- style: { color: "red" },
1751
+ style: { color: colors.required },
1752
1752
  children: "*"
1753
1753
  }) : /* @__PURE__ */ jsx("span", {
1754
- style: { color: "#52C41A" },
1754
+ style: { color: colors.optional },
1755
1755
  children: "Optional"
1756
1756
  })
1757
1757
  ] }),
@@ -1759,7 +1759,7 @@ const buildRequestData$1 = (params) => [...params].sort((a, b) => a.required ===
1759
1759
  enum: p.schema?.enum ? p.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
1760
1760
  };
1761
1761
  });
1762
- const buildHeaderData$1 = (headers) => {
1762
+ const buildHeaderData$1 = (headers, colors) => {
1763
1763
  if (!headers) return [];
1764
1764
  return Object.entries(headers).sort(([, a], [, b]) => a.required === b.required ? 0 : a.required ? -1 : 1).map(([name, header], idx) => {
1765
1765
  let typeLabel = header.schema?.type;
@@ -1770,17 +1770,17 @@ const buildHeaderData$1 = (headers) => {
1770
1770
  name,
1771
1771
  typeLabel && /* @__PURE__ */ jsx("span", {
1772
1772
  style: {
1773
- color: "rgba(0,0,0,0.45)",
1773
+ color: colors.typeLabel,
1774
1774
  marginLeft: "0.25rem",
1775
1775
  marginRight: "0.25rem"
1776
1776
  },
1777
1777
  children: typeLabel
1778
1778
  }),
1779
1779
  header.required ? /* @__PURE__ */ jsx("span", {
1780
- style: { color: "red" },
1780
+ style: { color: colors.required },
1781
1781
  children: "*"
1782
1782
  }) : /* @__PURE__ */ jsx("span", {
1783
- style: { color: "#52C41A" },
1783
+ style: { color: colors.optional },
1784
1784
  children: "Optional"
1785
1785
  })
1786
1786
  ] }, idx),
@@ -1793,7 +1793,7 @@ const EndpointPage$1 = () => {
1793
1793
  const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent, setFocusedTag } = useStore(({ view }) => view);
1794
1794
  const [endpointTooltip, setEndpointTooltip] = useState("Copy endpoint");
1795
1795
  const [selectedServer, setSelectedServer] = useState(0);
1796
- const { cx } = useStyle("EndpointPage", (token, scope) => ({
1796
+ const { cx, token } = useStyle("EndpointPage", (token, scope) => ({
1797
1797
  [scope("docs-endpoint-container")]: {
1798
1798
  display: "flex",
1799
1799
  flexDirection: "column",
@@ -1823,12 +1823,19 @@ const EndpointPage$1 = () => {
1823
1823
  padding: "0px 0.75rem 0.75rem 0.75rem",
1824
1824
  ".ant-tabs-tab": { paddingTop: "0" }
1825
1825
  }
1826
- }
1826
+ },
1827
+ [scope("row-odd")]: { "& > td": { background: `${token.colorBgLayout} !important` } },
1828
+ [scope("row-even")]: { "& > td": { background: `${token.colorBgContainer} !important` } }
1827
1829
  }));
1828
1830
  const methodStyle = methodColors$1[selectedEndpoint?.method];
1829
- const headerParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || []);
1830
- const pathParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || []);
1831
- const queryParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || []);
1831
+ const paramColors = {
1832
+ typeLabel: token.colorTextQuaternary,
1833
+ required: token.colorError,
1834
+ optional: token.colorSuccess
1835
+ };
1836
+ const headerParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || [], paramColors);
1837
+ const pathParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || [], paramColors);
1838
+ const queryParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || [], paramColors);
1832
1839
  const requestTabs = [
1833
1840
  {
1834
1841
  key: "header",
@@ -1838,7 +1845,8 @@ const EndpointPage$1 = () => {
1838
1845
  dataSource: headerParams,
1839
1846
  pagination: false,
1840
1847
  bordered: true,
1841
- size: "small"
1848
+ size: "small",
1849
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-odd" : "row-even")
1842
1850
  })
1843
1851
  },
1844
1852
  {
@@ -1849,7 +1857,8 @@ const EndpointPage$1 = () => {
1849
1857
  dataSource: pathParams,
1850
1858
  pagination: false,
1851
1859
  bordered: true,
1852
- size: "small"
1860
+ size: "small",
1861
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-odd" : "row-even")
1853
1862
  })
1854
1863
  },
1855
1864
  {
@@ -1860,12 +1869,13 @@ const EndpointPage$1 = () => {
1860
1869
  dataSource: queryParams,
1861
1870
  pagination: false,
1862
1871
  bordered: true,
1863
- size: "small"
1872
+ size: "small",
1873
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-odd" : "row-even")
1864
1874
  })
1865
1875
  }
1866
1876
  ].filter((t) => t !== null);
1867
1877
  const responseHeaders = (selectedEndpoint?.responses?.[selectedStatusCode || 200])?.headers;
1868
- const responseHeaderData = buildHeaderData$1(responseHeaders);
1878
+ const responseHeaderData = buildHeaderData$1(responseHeaders, paramColors);
1869
1879
  selectedApi?.servers?.map((server, index) => ({
1870
1880
  value: index,
1871
1881
  label: `${server.url}${selectedEndpoint?.path || ""}`
@@ -1909,7 +1919,7 @@ const EndpointPage$1 = () => {
1909
1919
  display: "flex",
1910
1920
  flexDirection: "row",
1911
1921
  alignItems: "center",
1912
- color: "rgba(0,0,0,0.45)",
1922
+ color: token.colorTextQuaternary,
1913
1923
  gap: "0.25rem"
1914
1924
  },
1915
1925
  children: /* @__PURE__ */ jsx("span", { children: selectedEndpoint?.tagName || "default" })
@@ -1974,7 +1984,8 @@ const EndpointPage$1 = () => {
1974
1984
  dataSource: responseHeaderData,
1975
1985
  pagination: false,
1976
1986
  bordered: true,
1977
- size: "small"
1987
+ size: "small",
1988
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-odd" : "row-even")
1978
1989
  })
1979
1990
  })
1980
1991
  ]
@@ -2099,7 +2110,7 @@ const MainContent$1 = ({ searchEnabled, handleResetSearch, handleVisitLandingPag
2099
2110
  //#region src/view/components/ApiPage/components/ApiDocumentationBar.tsx
2100
2111
  const { useBreakpoint: useBreakpoint$4 } = Grid;
2101
2112
  const { Title: Title$2 } = Typography;
2102
- const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, hasChanges = false, switcherNode }) => {
2113
+ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, hasChanges = false, hasErrors = false, switcherNode }) => {
2103
2114
  const isMobile = !useBreakpoint$4().md;
2104
2115
  const { wrapSSR, cx, token } = useStyle("ApiDocumentationBar", (token, scope) => ({
2105
2116
  [scope("root")]: {
@@ -2235,7 +2246,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
2235
2246
  }), /* @__PURE__ */ jsx(Button, {
2236
2247
  size: "large",
2237
2248
  type: "primary",
2238
- disabled: !hasChanges,
2249
+ disabled: !hasChanges || hasErrors,
2239
2250
  onClick: onSave,
2240
2251
  children: "Save"
2241
2252
  })]
@@ -2293,7 +2304,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
2293
2304
  }), /* @__PURE__ */ jsx(Button, {
2294
2305
  size: "large",
2295
2306
  type: "primary",
2296
- disabled: !hasChanges,
2307
+ disabled: !hasChanges || hasErrors,
2297
2308
  onClick: onSave,
2298
2309
  children: "Save & Publish Changes"
2299
2310
  })]
@@ -2304,14 +2315,16 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
2304
2315
  //#endregion
2305
2316
  //#region src/view/components/ApiPage/components/GeneralSection.tsx
2306
2317
  const { useBreakpoint: useBreakpoint$3 } = Grid;
2307
- const GeneralSection = ({ apiName, authType, version, description, onApiNameChange, onDescriptionChange, collapsed = false, onToggleCollapse, onChangeDetected }) => {
2318
+ const GeneralSection = ({ apiName, authType, version, description, onApiNameChange, onDescriptionChange, onChangeDetected, collapsed, onToggleCollapse, apiNameError, descriptionError }) => {
2308
2319
  const isMobile = !useBreakpoint$3().md;
2309
2320
  const { wrapSSR, cx, token } = useStyle("GeneralSection", (token, scope) => ({
2310
2321
  [scope("root")]: {
2311
2322
  display: "flex",
2312
2323
  flexDirection: "column",
2313
- borderRadius: token.borderRadius,
2314
- overflow: "hidden",
2324
+ gap: token.margin,
2325
+ padding: `${token.marginLG}px ${token.marginLG}px 48px`,
2326
+ background: token.colorBgElevated,
2327
+ borderRadius: token.borderRadiusLG,
2315
2328
  width: "100%"
2316
2329
  },
2317
2330
  [scope("head")]: {
@@ -2325,15 +2338,20 @@ const GeneralSection = ({ apiName, authType, version, description, onApiNameChan
2325
2338
  [scope("body")]: {
2326
2339
  display: "flex",
2327
2340
  flexDirection: "column",
2328
- gap: token.paddingLG,
2341
+ gap: token.margin,
2329
2342
  padding: token.paddingLG,
2330
- paddingBottom: token.paddingXXL ?? 48,
2331
2343
  background: token.colorBgElevated,
2332
2344
  borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
2333
2345
  },
2346
+ [scope("fields")]: {
2347
+ display: "flex",
2348
+ flexDirection: "column",
2349
+ gap: token.margin,
2350
+ width: "100%"
2351
+ },
2334
2352
  [scope("row")]: {
2335
2353
  display: "flex",
2336
- gap: token.paddingLG,
2354
+ gap: token.margin,
2337
2355
  width: "100%"
2338
2356
  },
2339
2357
  [scope("field")]: {
@@ -2352,108 +2370,91 @@ const GeneralSection = ({ apiName, authType, version, description, onApiNameChan
2352
2370
  paddingBottom: token.paddingXS,
2353
2371
  lineHeight: "22px"
2354
2372
  },
2355
- [scope("label-required")]: {
2373
+ [scope("required")]: {
2356
2374
  color: token.colorError,
2357
2375
  fontSize: token.fontSize
2358
- },
2359
- [scope("count")]: {
2360
- alignSelf: "flex-end",
2361
- fontSize: token.fontSize,
2362
- color: token.colorTextDescription,
2363
- marginTop: token.marginXXS
2364
2376
  }
2365
2377
  }));
2366
- return wrapSSR(/* @__PURE__ */ jsxs("div", {
2367
- className: cx("root"),
2368
- children: [/* @__PURE__ */ jsxs("div", {
2369
- className: cx("head"),
2370
- children: [/* @__PURE__ */ jsx(Title, {
2371
- level: 4,
2372
- style: {
2373
- margin: 0,
2374
- color: token.colorTextHeading
2375
- },
2376
- children: "General"
2377
- }), /* @__PURE__ */ jsx(Button, {
2378
- type: "text",
2379
- size: "large",
2380
- icon: /* @__PURE__ */ jsx(UpCircleOutlined, { style: { fontSize: 18 } }),
2381
- onClick: onToggleCollapse,
2382
- style: {
2383
- transform: collapsed ? "rotate(180deg)" : "rotate(0deg)",
2384
- transition: "transform 0.2s"
2385
- }
2386
- })]
2387
- }), !collapsed && /* @__PURE__ */ jsxs("div", {
2388
- className: cx("body"),
2389
- style: isMobile ? {
2390
- padding: token.paddingMD,
2391
- paddingBottom: token.paddingXXL ?? 48
2392
- } : void 0,
2393
- children: [/* @__PURE__ */ jsxs("div", {
2378
+ const fieldsContent = /* @__PURE__ */ jsxs("div", {
2379
+ className: cx("fields"),
2380
+ children: [
2381
+ /* @__PURE__ */ jsxs("div", {
2382
+ className: cx("field"),
2383
+ children: [/* @__PURE__ */ jsxs("div", {
2384
+ className: cx("label"),
2385
+ children: [/* @__PURE__ */ jsx("span", { children: "API Name" }), /* @__PURE__ */ jsx("span", {
2386
+ className: cx("required"),
2387
+ children: "*"
2388
+ })]
2389
+ }), /* @__PURE__ */ jsx(Input, {
2390
+ size: "large",
2391
+ value: apiName,
2392
+ status: apiNameError ? "error" : void 0,
2393
+ suffix: apiNameError ? /* @__PURE__ */ jsx(CloseCircleOutlined, {
2394
+ style: {
2395
+ color: token.colorError,
2396
+ cursor: "pointer"
2397
+ },
2398
+ onClick: () => {
2399
+ onApiNameChange("");
2400
+ onChangeDetected?.();
2401
+ }
2402
+ }) : void 0,
2403
+ onChange: (e) => {
2404
+ onApiNameChange(e.target.value);
2405
+ onChangeDetected?.();
2406
+ },
2407
+ maxLength: 100,
2408
+ showCount: true
2409
+ })]
2410
+ }),
2411
+ /* @__PURE__ */ jsxs("div", {
2394
2412
  className: cx("row"),
2395
2413
  style: isMobile ? { flexDirection: "column" } : void 0,
2396
- children: [
2397
- /* @__PURE__ */ jsxs("div", {
2398
- className: cx("field"),
2399
- children: [/* @__PURE__ */ jsxs("div", {
2400
- className: cx("label"),
2401
- children: [/* @__PURE__ */ jsx("span", { children: "API Name" }), /* @__PURE__ */ jsx("span", {
2402
- className: cx("label-required"),
2403
- children: "*"
2404
- })]
2405
- }), /* @__PURE__ */ jsx(Input, {
2406
- size: "large",
2407
- value: apiName,
2408
- onChange: (e) => {
2409
- onApiNameChange(e.target.value);
2410
- onChangeDetected?.();
2411
- },
2412
- maxLength: 35,
2413
- showCount: true
2414
- })]
2415
- }),
2416
- /* @__PURE__ */ jsxs("div", {
2417
- className: cx("field"),
2418
- children: [/* @__PURE__ */ jsxs("div", {
2419
- className: cx("label"),
2420
- children: [/* @__PURE__ */ jsx("span", { children: "Authentication Type" }), /* @__PURE__ */ jsx("span", {
2421
- className: cx("label-required"),
2422
- children: "*"
2423
- })]
2424
- }), /* @__PURE__ */ jsx(Input, {
2425
- size: "large",
2426
- value: authType,
2427
- disabled: true
2414
+ children: [/* @__PURE__ */ jsxs("div", {
2415
+ className: cx("field"),
2416
+ style: isMobile ? void 0 : {
2417
+ flex: "none",
2418
+ width: 436
2419
+ },
2420
+ children: [/* @__PURE__ */ jsxs("div", {
2421
+ className: cx("label"),
2422
+ children: [/* @__PURE__ */ jsx("span", { children: "Authentication Type" }), /* @__PURE__ */ jsx("span", {
2423
+ className: cx("required"),
2424
+ children: "*"
2428
2425
  })]
2429
- }),
2430
- /* @__PURE__ */ jsxs("div", {
2431
- className: cx("field"),
2432
- children: [/* @__PURE__ */ jsxs("div", {
2433
- className: cx("label"),
2434
- children: [/* @__PURE__ */ jsx("span", { children: "Version" }), /* @__PURE__ */ jsx("span", {
2435
- className: cx("label-required"),
2436
- children: "*"
2437
- })]
2438
- }), /* @__PURE__ */ jsx(Input, {
2439
- size: "large",
2440
- value: version,
2441
- disabled: true
2426
+ }), /* @__PURE__ */ jsx(Input, {
2427
+ size: "large",
2428
+ value: authType,
2429
+ disabled: true
2430
+ })]
2431
+ }), /* @__PURE__ */ jsxs("div", {
2432
+ className: cx("field"),
2433
+ children: [/* @__PURE__ */ jsxs("div", {
2434
+ className: cx("label"),
2435
+ children: [/* @__PURE__ */ jsx("span", { children: "Version" }), /* @__PURE__ */ jsx("span", {
2436
+ className: cx("required"),
2437
+ children: "*"
2442
2438
  })]
2443
- })
2444
- ]
2445
- }), /* @__PURE__ */ jsxs("div", {
2439
+ }), /* @__PURE__ */ jsx(Input, {
2440
+ size: "large",
2441
+ value: version,
2442
+ disabled: true
2443
+ })]
2444
+ })]
2445
+ }),
2446
+ /* @__PURE__ */ jsxs("div", {
2446
2447
  className: cx("field"),
2447
- style: { width: "100%" },
2448
2448
  children: [/* @__PURE__ */ jsxs("div", {
2449
2449
  className: cx("label"),
2450
2450
  children: [/* @__PURE__ */ jsx("span", { children: "Description" }), /* @__PURE__ */ jsx("span", {
2451
- className: cx("label-required"),
2451
+ className: cx("required"),
2452
2452
  children: "*"
2453
2453
  })]
2454
2454
  }), /* @__PURE__ */ jsx(Input.TextArea, {
2455
2455
  size: "large",
2456
2456
  value: description,
2457
+ status: descriptionError ? "error" : void 0,
2457
2458
  onChange: (e) => {
2458
2459
  onDescriptionChange(e.target.value);
2459
2460
  onChangeDetected?.();
@@ -2465,64 +2466,138 @@ const GeneralSection = ({ apiName, authType, version, description, onApiNameChan
2465
2466
  resize: "vertical"
2466
2467
  }
2467
2468
  })]
2469
+ })
2470
+ ]
2471
+ });
2472
+ return wrapSSR(isMobile ? /* @__PURE__ */ jsxs("div", {
2473
+ style: { width: "100%" },
2474
+ children: [/* @__PURE__ */ jsxs("div", {
2475
+ className: cx("head"),
2476
+ children: [/* @__PURE__ */ jsx(Title, {
2477
+ level: 4,
2478
+ style: {
2479
+ margin: 0,
2480
+ color: token.colorTextHeading
2481
+ },
2482
+ children: "General"
2483
+ }), /* @__PURE__ */ jsx(Button, {
2484
+ type: "text",
2485
+ size: "large",
2486
+ icon: /* @__PURE__ */ jsx(UpCircleOutlined, { style: { fontSize: 18 } }),
2487
+ onClick: onToggleCollapse,
2488
+ style: {
2489
+ transform: collapsed ? "rotate(180deg)" : "rotate(0deg)",
2490
+ transition: "transform 0.2s"
2491
+ }
2468
2492
  })]
2493
+ }), !collapsed && /* @__PURE__ */ jsx("div", {
2494
+ className: cx("body"),
2495
+ children: fieldsContent
2469
2496
  })]
2497
+ }) : /* @__PURE__ */ jsxs("div", {
2498
+ className: cx("root"),
2499
+ children: [/* @__PURE__ */ jsx(Title, {
2500
+ level: 4,
2501
+ style: {
2502
+ margin: 0,
2503
+ color: token.colorTextHeading
2504
+ },
2505
+ children: "General"
2506
+ }), fieldsContent]
2470
2507
  }));
2471
2508
  };
2472
2509
  //#endregion
2473
2510
  //#region src/assets/trash.tsx
2474
- const Trash = (props) => /* @__PURE__ */ jsxs("svg", {
2475
- viewBox: "0 0 40 40",
2511
+ const Trash = (props) => {
2512
+ const maskId = `trash-mask-${useId()}`;
2513
+ return /* @__PURE__ */ jsxs("svg", {
2514
+ viewBox: "0 0 40 40",
2515
+ fill: "none",
2516
+ xmlns: "http://www.w3.org/2000/svg",
2517
+ ...props,
2518
+ children: [
2519
+ /* @__PURE__ */ jsx("mask", {
2520
+ id: maskId,
2521
+ fill: "white",
2522
+ children: /* @__PURE__ */ jsx("path", { d: "M0 8C0 3.58172 3.58172 0 8 0H32C36.4183 0 40 3.58172 40 8V32C40 36.4183 36.4183 40 32 40H8C3.58172 40 0 36.4183 0 32V8Z" })
2523
+ }),
2524
+ /* @__PURE__ */ jsx("path", {
2525
+ d: "M8 0V1H32V0V-1H8V0ZM40 8H39V32H40H41V8H40ZM32 40V39H8V40V41H32V40ZM0 32H1V8H0H-1V32H0ZM8 40V39C4.13401 39 1 35.866 1 32H0H-1C-1 36.9706 3.02944 41 8 41V40ZM40 32H39C39 35.866 35.866 39 32 39V40V41C36.9706 41 41 36.9706 41 32H40ZM32 0V1C35.866 1 39 4.13401 39 8H40H41C41 3.02944 36.9706 -1 32 -1V0ZM8 0V-1C3.02944 -1 -1 3.02944 -1 8H0H1C1 4.13401 4.13401 1 8 1V0Z",
2526
+ fill: "currentColor",
2527
+ mask: `url(#${maskId})`
2528
+ }),
2529
+ /* @__PURE__ */ jsx("path", {
2530
+ d: "M26.75 15.4844C24.2525 15.2369 21.74 15.1094 19.235 15.1094C17.75 15.1094 16.265 15.1844 14.78 15.3344L13.25 15.4844",
2531
+ fill: "currentColor"
2532
+ }),
2533
+ /* @__PURE__ */ jsx("path", {
2534
+ d: "M26.75 15.4844C24.2525 15.2369 21.74 15.1094 19.235 15.1094C17.75 15.1094 16.265 15.1844 14.78 15.3344L13.25 15.4844",
2535
+ stroke: "currentColor",
2536
+ strokeWidth: "1.5",
2537
+ strokeLinecap: "round",
2538
+ strokeLinejoin: "round"
2539
+ }),
2540
+ /* @__PURE__ */ jsx("path", {
2541
+ d: "M17.375 14.7275L17.54 13.745C17.66 13.0325 17.75 12.5 19.0175 12.5H20.9825C22.25 12.5 22.3475 13.0625 22.46 13.7525L22.625 14.7275",
2542
+ stroke: "currentColor",
2543
+ strokeWidth: "1.5",
2544
+ strokeLinecap: "round",
2545
+ strokeLinejoin: "round"
2546
+ }),
2547
+ /* @__PURE__ */ jsx("path", {
2548
+ d: "M25.1373 17.8555L24.6498 25.408C24.5673 26.5855 24.4998 27.5005 22.4073 27.5005H17.5923C15.4998 27.5005 15.4323 26.5855 15.3498 25.408L14.8623 17.8555",
2549
+ stroke: "currentColor",
2550
+ strokeWidth: "1.5",
2551
+ strokeLinecap: "round",
2552
+ strokeLinejoin: "round"
2553
+ }),
2554
+ /* @__PURE__ */ jsx("path", {
2555
+ d: "M18.7476 23.375H21.2451",
2556
+ stroke: "currentColor",
2557
+ strokeWidth: "1.5",
2558
+ strokeLinecap: "round",
2559
+ strokeLinejoin: "round"
2560
+ }),
2561
+ /* @__PURE__ */ jsx("path", {
2562
+ d: "M18.125 20.375H21.875",
2563
+ stroke: "currentColor",
2564
+ strokeWidth: "1.5",
2565
+ strokeLinecap: "round",
2566
+ strokeLinejoin: "round"
2567
+ })
2568
+ ]
2569
+ });
2570
+ };
2571
+ //#endregion
2572
+ //#region src/assets/icons/editTag.tsx
2573
+ const EditTag = (props) => /* @__PURE__ */ jsxs("svg", {
2574
+ width: "18",
2575
+ height: "18",
2576
+ viewBox: "0 0 18 18",
2476
2577
  fill: "none",
2477
2578
  xmlns: "http://www.w3.org/2000/svg",
2478
2579
  ...props,
2479
2580
  children: [
2480
- /* @__PURE__ */ jsx("mask", {
2481
- id: "path-1-inside-1_17984_239034",
2482
- fill: "white",
2483
- children: /* @__PURE__ */ jsx("path", { d: "M0 8C0 3.58172 3.58172 0 8 0H32C36.4183 0 40 3.58172 40 8V32C40 36.4183 36.4183 40 32 40H8C3.58172 40 0 36.4183 0 32V8Z" })
2484
- }),
2485
- /* @__PURE__ */ jsx("path", {
2486
- d: "M8 0V1H32V0V-1H8V0ZM40 8H39V32H40H41V8H40ZM32 40V39H8V40V41H32V40ZM0 32H1V8H0H-1V32H0ZM8 40V39C4.13401 39 1 35.866 1 32H0H-1C-1 36.9706 3.02944 41 8 41V40ZM40 32H39C39 35.866 35.866 39 32 39V40V41C36.9706 41 41 36.9706 41 32H40ZM32 0V1C35.866 1 39 4.13401 39 8H40H41C41 3.02944 36.9706 -1 32 -1V0ZM8 0V-1C3.02944 -1 -1 3.02944 -1 8H0H1C1 4.13401 4.13401 1 8 1V0Z",
2487
- fill: "#FF4D4F",
2488
- mask: "url(#path-1-inside-1_17984_239034)"
2489
- }),
2490
- /* @__PURE__ */ jsx("path", {
2491
- d: "M26.75 15.4844C24.2525 15.2369 21.74 15.1094 19.235 15.1094C17.75 15.1094 16.265 15.1844 14.78 15.3344L13.25 15.4844",
2492
- fill: "#FF4D4F"
2493
- }),
2494
- /* @__PURE__ */ jsx("path", {
2495
- d: "M26.75 15.4844C24.2525 15.2369 21.74 15.1094 19.235 15.1094C17.75 15.1094 16.265 15.1844 14.78 15.3344L13.25 15.4844",
2496
- stroke: "#FF4D4F",
2497
- strokeWidth: "1.5",
2498
- strokeLinecap: "round",
2499
- strokeLinejoin: "round"
2500
- }),
2501
- /* @__PURE__ */ jsx("path", {
2502
- d: "M17.375 14.7275L17.54 13.745C17.66 13.0325 17.75 12.5 19.0175 12.5H20.9825C22.25 12.5 22.3475 13.0625 22.46 13.7525L22.625 14.7275",
2503
- stroke: "#FF4D4F",
2504
- strokeWidth: "1.5",
2505
- strokeLinecap: "round",
2506
- strokeLinejoin: "round"
2507
- }),
2508
2581
  /* @__PURE__ */ jsx("path", {
2509
- d: "M25.1373 17.8555L24.6498 25.408C24.5673 26.5855 24.4998 27.5005 22.4073 27.5005H17.5923C15.4998 27.5005 15.4323 26.5855 15.3498 25.408L14.8623 17.8555",
2510
- stroke: "#FF4D4F",
2582
+ d: "M8.25 1.5H6.75C3 1.5 1.5 3 1.5 6.75V11.25C1.5 15 3 16.5 6.75 16.5H11.25C15 16.5 16.5 15 16.5 11.25V9.75",
2583
+ stroke: "currentColor",
2511
2584
  strokeWidth: "1.5",
2512
2585
  strokeLinecap: "round",
2513
2586
  strokeLinejoin: "round"
2514
2587
  }),
2515
2588
  /* @__PURE__ */ jsx("path", {
2516
- d: "M18.7476 23.375H21.2451",
2517
- stroke: "#FF4D4F",
2589
+ d: "M12.0299 2.26592L6.11991 8.17592C5.89491 8.40092 5.66991 8.84342 5.62491 9.16592L5.30241 11.4234C5.18241 12.2409 5.75991 12.8109 6.57741 12.6984L8.83491 12.3759C9.14991 12.3309 9.59241 12.1059 9.82491 11.8809L15.7349 5.97092C16.7549 4.95092 17.2349 3.76592 15.7349 2.26592C14.2349 0.765922 13.0499 1.24592 12.0299 2.26592Z",
2590
+ stroke: "currentColor",
2518
2591
  strokeWidth: "1.5",
2592
+ strokeMiterlimit: "10",
2519
2593
  strokeLinecap: "round",
2520
2594
  strokeLinejoin: "round"
2521
2595
  }),
2522
2596
  /* @__PURE__ */ jsx("path", {
2523
- d: "M18.125 20.375H21.875",
2524
- stroke: "#FF4D4F",
2597
+ d: "M11.1826 3.11328C11.6851 4.90578 13.0876 6.30828 14.8876 6.81828",
2598
+ stroke: "currentColor",
2525
2599
  strokeWidth: "1.5",
2600
+ strokeMiterlimit: "10",
2526
2601
  strokeLinecap: "round",
2527
2602
  strokeLinejoin: "round"
2528
2603
  })
@@ -3174,7 +3249,8 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
3174
3249
  //#endregion
3175
3250
  //#region src/view/components/ApiPage/components/EndpointsSection.tsx
3176
3251
  const { useBreakpoint: useBreakpoint$2 } = Grid;
3177
- const PAGE_SIZE = 5;
3252
+ const PAGE_SIZE = 4;
3253
+ const VIEW_PAGE_SIZE = 4;
3178
3254
  const getStatusCodeColor = (code, token) => {
3179
3255
  const n = parseInt(code, 10);
3180
3256
  if (n >= 400 && n < 500) return {
@@ -3194,8 +3270,24 @@ const buildViewParamRows = (params) => params.map((p, idx) => ({
3194
3270
  description: p.description ?? "",
3195
3271
  enum: p.enum ?? []
3196
3272
  }));
3197
- const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse, endpointNames, endpointDescs, endpointTags, availableTags, onEndpointNameChange, onEndpointDescChange, onEndpointTagsChange, endpointParams, onAddParameter, onEditParameter, onDeleteParameter, endpointResponseParams, onAddResponseParameter, onEditResponseParameter, onDeleteResponseParameter, mode = "edit" }) => {
3273
+ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse, endpointNames, endpointDescs, endpointTags, availableTags, onEndpointNameChange, onEndpointDescChange, onEndpointTagsChange, endpointParams, onAddParameter, onEditParameter, onDeleteParameter, endpointResponseParams, onAddResponseParameter, onEditResponseParameter, onDeleteResponseParameter, mode = "edit", selectedEndpointKey }) => {
3198
3274
  const [expandedId, setExpandedId] = useState(null);
3275
+ const [activeTab, setActiveTab] = useState("general");
3276
+ useEffect(() => {
3277
+ setActiveTab("general");
3278
+ }, [selectedEndpointKey]);
3279
+ useEffect(() => {
3280
+ if (!selectedEndpointKey) return;
3281
+ if (selectedStatusCodes[selectedEndpointKey]) return;
3282
+ const ep = Object.values(endpointsByTag).flat().find((e) => e.id === selectedEndpointKey);
3283
+ if (!ep) return;
3284
+ const keys = Object.keys(ep.responses ?? {});
3285
+ const defaultCode = keys.includes("200") ? "200" : keys[0];
3286
+ if (defaultCode) setSelectedStatusCodes((prev) => ({
3287
+ ...prev,
3288
+ [selectedEndpointKey]: defaultCode
3289
+ }));
3290
+ }, [selectedEndpointKey]);
3199
3291
  const [paramDrawerOpen, setParamDrawerOpen] = useState(false);
3200
3292
  const [paramDrawerEndpointId, setParamDrawerEndpointId] = useState(null);
3201
3293
  const [paramDrawerMode, setParamDrawerMode] = useState("add");
@@ -3242,10 +3334,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3242
3334
  [scope("root")]: {
3243
3335
  display: "flex",
3244
3336
  flexDirection: "column",
3245
- borderRadius: token.borderRadius,
3246
- overflow: "hidden",
3247
3337
  width: "100%",
3248
- flexShrink: 0
3338
+ flexShrink: 0,
3339
+ "& .ant-tabs-content-holder": {
3340
+ background: token.colorBgElevated,
3341
+ borderRadius: token.borderRadiusLG,
3342
+ padding: `${token.paddingLG}px ${token.paddingLG}px 48px`
3343
+ }
3249
3344
  },
3250
3345
  [scope("head")]: {
3251
3346
  display: "flex",
@@ -3294,15 +3389,12 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3294
3389
  display: "flex",
3295
3390
  alignItems: "center",
3296
3391
  justifyContent: "center",
3297
- width: 64,
3298
- padding: `0 ${token.paddingXS}px`,
3392
+ padding: "0 15px",
3299
3393
  borderRadius: token.borderRadius,
3300
- border: "1px solid",
3301
3394
  fontSize: token.fontSize,
3302
3395
  fontWeight: 400,
3303
3396
  lineHeight: "22px",
3304
- whiteSpace: "nowrap",
3305
- alignSelf: "stretch"
3397
+ whiteSpace: "nowrap"
3306
3398
  },
3307
3399
  [scope("endpoint-path")]: {
3308
3400
  fontSize: token.fontSizeLG,
@@ -3383,7 +3475,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3383
3475
  overflow: "hidden"
3384
3476
  },
3385
3477
  [scope("code-area")]: {
3386
- background: "#1d2856",
3478
+ background: token.colorBgSpotlight,
3387
3479
  padding: "10px 12px",
3388
3480
  fontFamily: "Cairo, sans-serif",
3389
3481
  fontSize: 14,
@@ -3395,7 +3487,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3395
3487
  display: "block"
3396
3488
  },
3397
3489
  [scope("code-footer")]: {
3398
- background: "#161d40",
3490
+ background: token.colorBgSpotlight,
3399
3491
  padding: 12,
3400
3492
  borderBottomLeftRadius: 8,
3401
3493
  borderBottomRightRadius: 8,
@@ -3552,26 +3644,36 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3552
3644
  gap: 8
3553
3645
  },
3554
3646
  [scope("param-edit-btn")]: {
3555
- width: 32,
3556
- height: 32,
3647
+ width: 40,
3648
+ height: 40,
3557
3649
  padding: 0,
3650
+ lineHeight: 1,
3558
3651
  display: "flex",
3559
3652
  alignItems: "center",
3560
3653
  justifyContent: "center",
3561
- borderColor: token.colorPrimary,
3654
+ borderRadius: 8,
3655
+ borderColor: "#D9D9D9",
3656
+ background: "#FFF !important",
3657
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.02) !important",
3562
3658
  color: token.colorPrimary,
3659
+ "& .ant-btn-icon": {
3660
+ display: "flex",
3661
+ alignItems: "center",
3662
+ justifyContent: "center"
3663
+ },
3563
3664
  "&:hover": {
3564
3665
  borderColor: `${token.colorPrimary} !important`,
3565
3666
  color: `${token.colorPrimary} !important`
3566
3667
  }
3567
3668
  },
3568
3669
  [scope("param-delete-btn")]: {
3569
- width: 32,
3570
- height: 32,
3670
+ width: 40,
3671
+ height: 40,
3571
3672
  padding: 0,
3572
3673
  display: "flex",
3573
3674
  alignItems: "center",
3574
- justifyContent: "center"
3675
+ justifyContent: "center",
3676
+ "& svg path[mask]": { display: "none" }
3575
3677
  },
3576
3678
  [".delete-param-confirm-modal .ant-modal-container"]: {
3577
3679
  "--ant-modal-content-padding": "0px !important",
@@ -3895,46 +3997,1172 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3895
3997
  }
3896
3998
  }
3897
3999
  ];
3898
- return wrapSSR(/* @__PURE__ */ jsxs("div", {
3899
- className: cx("root"),
3900
- children: [
3901
- /* @__PURE__ */ jsxs("div", {
3902
- className: cx("head"),
3903
- children: [/* @__PURE__ */ jsx(Title, {
4000
+ if (selectedEndpointKey) {
4001
+ const ep = Object.values(endpointsByTag).flat().find((e) => e.id === selectedEndpointKey);
4002
+ if (!ep) return wrapSSR(/* @__PURE__ */ jsx("div", {}));
4003
+ const methodColor = methodColors$1[ep.method];
4004
+ const epHeader = /* @__PURE__ */ jsxs("div", {
4005
+ style: {
4006
+ display: "flex",
4007
+ alignItems: "center",
4008
+ gap: token.marginXS,
4009
+ marginBottom: token.marginLG
4010
+ },
4011
+ children: [/* @__PURE__ */ jsx("span", {
4012
+ className: cx("method-badge"),
4013
+ style: {
4014
+ color: methodColor?.color,
4015
+ backgroundColor: methodColor?.bg ?? "transparent"
4016
+ },
4017
+ children: ep.method
4018
+ }), /* @__PURE__ */ jsx(Tooltip, {
4019
+ title: ep.path,
4020
+ children: /* @__PURE__ */ jsx(Title, {
3904
4021
  level: 4,
3905
4022
  style: {
3906
4023
  margin: 0,
3907
4024
  color: token.colorTextHeading
3908
4025
  },
3909
- children: "Endpoints"
3910
- }), /* @__PURE__ */ jsx(Button, {
3911
- type: "text",
3912
- size: "large",
3913
- icon: /* @__PURE__ */ jsx(UpCircleOutlined, { style: { fontSize: 18 } }),
3914
- onClick: onToggleCollapse,
3915
- style: {
3916
- transform: collapsed ? "rotate(180deg)" : "rotate(0deg)",
3917
- transition: "transform 0.2s"
3918
- }
3919
- })]
3920
- }),
3921
- !collapsed && /* @__PURE__ */ jsx("div", {
3922
- className: cx("body"),
3923
- children: Object.values(endpointsByTag).flat().map((ep) => {
3924
- const isExpanded = expandedId === ep.id;
3925
- const methodColor = methodColors$1[ep.method];
3926
- return /* @__PURE__ */ jsxs("div", { children: [
3927
- /* @__PURE__ */ jsxs("div", {
3928
- className: cx("endpoint-row"),
3929
- children: [/* @__PURE__ */ jsxs("div", {
3930
- className: cx("endpoint-card", isExpanded ? "endpoint-card-active" : ""),
3931
- onClick: () => handleEndpointClick(ep),
3932
- children: [/* @__PURE__ */ jsx("span", {
3933
- className: cx("method-badge"),
3934
- style: {
3935
- color: isExpanded ? "#ffffff" : methodColor?.color,
3936
- borderColor: methodColor?.color,
3937
- backgroundColor: isExpanded ? methodColor?.color : "transparent"
4026
+ children: ep.path
4027
+ })
4028
+ })]
4029
+ });
4030
+ return wrapSSR(/* @__PURE__ */ jsxs("div", {
4031
+ className: cx("root"),
4032
+ children: [
4033
+ /* @__PURE__ */ jsx(Tabs, {
4034
+ activeKey: activeTab,
4035
+ onChange: setActiveTab,
4036
+ tabBarStyle: {
4037
+ background: "transparent",
4038
+ padding: "0 16px",
4039
+ marginBottom: 16
4040
+ },
4041
+ tabBarGutter: 32,
4042
+ style: { borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px` },
4043
+ items: [
4044
+ {
4045
+ key: "general",
4046
+ label: "General",
4047
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [epHeader, /* @__PURE__ */ jsxs("div", {
4048
+ style: {
4049
+ display: "flex",
4050
+ flexDirection: "column",
4051
+ gap: token.paddingLG
4052
+ },
4053
+ children: [/* @__PURE__ */ jsxs("div", {
4054
+ className: cx("form-row"),
4055
+ style: isMobile ? { flexDirection: "column" } : void 0,
4056
+ children: [/* @__PURE__ */ jsxs("div", {
4057
+ className: cx("form-field"),
4058
+ children: [/* @__PURE__ */ jsxs("div", {
4059
+ className: cx("field-label"),
4060
+ children: [/* @__PURE__ */ jsx("span", { children: "Endpoint Name" }), /* @__PURE__ */ jsx("span", {
4061
+ className: cx("label-required"),
4062
+ children: "*"
4063
+ })]
4064
+ }), /* @__PURE__ */ jsx(Input, {
4065
+ size: "large",
4066
+ value: endpointNames[ep.id] ?? ep.summary ?? "",
4067
+ onChange: (e) => onEndpointNameChange(ep.id, e.target.value),
4068
+ maxLength: 100,
4069
+ showCount: true
4070
+ })]
4071
+ }), /* @__PURE__ */ jsxs("div", {
4072
+ className: cx("form-field"),
4073
+ children: [/* @__PURE__ */ jsx("div", {
4074
+ className: cx("field-label"),
4075
+ children: /* @__PURE__ */ jsx("span", { children: "Endpoint Tag" })
4076
+ }), /* @__PURE__ */ jsx(Select, {
4077
+ mode: "multiple",
4078
+ size: "large",
4079
+ style: { width: "100%" },
4080
+ placeholder: "Select",
4081
+ value: endpointTags[ep.id] ?? ep.tags ?? [],
4082
+ options: availableTags.map((t) => ({
4083
+ label: t,
4084
+ value: t
4085
+ })),
4086
+ onChange: (val) => onEndpointTagsChange(ep.id, val)
4087
+ })]
4088
+ })]
4089
+ }), /* @__PURE__ */ jsxs("div", {
4090
+ className: cx("form-field"),
4091
+ style: { width: "100%" },
4092
+ children: [/* @__PURE__ */ jsxs("div", {
4093
+ className: cx("field-label"),
4094
+ children: [/* @__PURE__ */ jsx("span", { children: "Description" }), /* @__PURE__ */ jsx("span", {
4095
+ className: cx("label-optional"),
4096
+ children: "(optional)"
4097
+ })]
4098
+ }), /* @__PURE__ */ jsx(Input.TextArea, {
4099
+ value: endpointDescs[ep.id] ?? ep.description ?? "",
4100
+ onChange: (e) => onEndpointDescChange(ep.id, e.target.value),
4101
+ maxLength: 500,
4102
+ showCount: true,
4103
+ style: {
4104
+ height: 52,
4105
+ resize: "vertical"
4106
+ }
4107
+ })]
4108
+ })]
4109
+ })] })
4110
+ },
4111
+ {
4112
+ key: "request",
4113
+ label: "Request",
4114
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [epHeader, /* @__PURE__ */ jsxs("div", {
4115
+ className: cx("form-field"),
4116
+ style: { width: "100%" },
4117
+ children: [
4118
+ /* @__PURE__ */ jsx("div", {
4119
+ className: cx("section-header"),
4120
+ children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4121
+ style: {
4122
+ display: "flex",
4123
+ alignItems: "center",
4124
+ gap: token.marginMD
4125
+ },
4126
+ children: [/* @__PURE__ */ jsx("span", {
4127
+ className: cx("section-title"),
4128
+ children: "Request Details"
4129
+ }), /* @__PURE__ */ jsx(Button, {
4130
+ ghost: true,
4131
+ type: "primary",
4132
+ icon: /* @__PURE__ */ jsx(SearchOutlined, {}),
4133
+ size: "large",
4134
+ style: {
4135
+ width: 40,
4136
+ height: 40,
4137
+ padding: 0
4138
+ },
4139
+ disabled: (endpointParams[ep.id] ?? []).length === 0,
4140
+ onClick: () => setShowRequestSearch((prev) => ({
4141
+ ...prev,
4142
+ [ep.id]: !prev[ep.id]
4143
+ }))
4144
+ })]
4145
+ }), /* @__PURE__ */ jsx(Button, {
4146
+ ghost: true,
4147
+ type: "primary",
4148
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
4149
+ onClick: () => {
4150
+ setDrawerSource("request");
4151
+ setParamDrawerMode("add");
4152
+ setEditParamIdx(null);
4153
+ setParamDrawerEndpointId(ep.id);
4154
+ setParamDrawerOpen(true);
4155
+ },
4156
+ children: "Add Parameter"
4157
+ })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4158
+ style: {
4159
+ display: "flex",
4160
+ alignItems: "center",
4161
+ gap: 24
4162
+ },
4163
+ children: [/* @__PURE__ */ jsx("span", {
4164
+ className: cx("section-title"),
4165
+ children: "Request Details"
4166
+ }), /* @__PURE__ */ jsx(Input.Search, {
4167
+ placeholder: "Search by parameter name",
4168
+ style: { width: 310 },
4169
+ disabled: (endpointParams[ep.id] ?? []).length === 0,
4170
+ value: requestSearches[ep.id] ?? "",
4171
+ onChange: (e) => {
4172
+ const val = e.target.value;
4173
+ setRequestSearches((prev) => ({
4174
+ ...prev,
4175
+ [ep.id]: val
4176
+ }));
4177
+ setRequestPages((prev) => new Map(prev).set(ep.id, 1));
4178
+ },
4179
+ allowClear: true
4180
+ })]
4181
+ }), /* @__PURE__ */ jsx(Button, {
4182
+ ghost: true,
4183
+ type: "primary",
4184
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
4185
+ onClick: () => {
4186
+ setDrawerSource("request");
4187
+ setParamDrawerMode("add");
4188
+ setEditParamIdx(null);
4189
+ setParamDrawerEndpointId(ep.id);
4190
+ setParamDrawerOpen(true);
4191
+ },
4192
+ children: "Add Parameter"
4193
+ })] })
4194
+ }),
4195
+ isMobile && showRequestSearch[ep.id] && /* @__PURE__ */ jsx(Input.Search, {
4196
+ placeholder: "Search by parameter name",
4197
+ style: {
4198
+ width: "100%",
4199
+ marginTop: 8
4200
+ },
4201
+ disabled: (endpointParams[ep.id] ?? []).length === 0,
4202
+ value: requestSearches[ep.id] ?? "",
4203
+ onChange: (e) => {
4204
+ const val = e.target.value;
4205
+ setRequestSearches((prev) => ({
4206
+ ...prev,
4207
+ [ep.id]: val
4208
+ }));
4209
+ setRequestPages((prev) => new Map(prev).set(ep.id, 1));
4210
+ },
4211
+ allowClear: true,
4212
+ autoFocus: true
4213
+ }),
4214
+ (endpointParams[ep.id] ?? []).length === 0 ? /* @__PURE__ */ jsx("div", {
4215
+ className: cx("empty-wrapper"),
4216
+ children: /* @__PURE__ */ jsx(Empty, {
4217
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
4218
+ imageStyle: {
4219
+ width: 184,
4220
+ height: 117
4221
+ },
4222
+ description: /* @__PURE__ */ jsx("span", {
4223
+ className: cx("empty-description"),
4224
+ children: "No Data"
4225
+ })
4226
+ })
4227
+ }) : (() => {
4228
+ const reqSearch = (debouncedRequestSearches[ep.id] ?? "").toLowerCase();
4229
+ const allReqParams = (endpointParams[ep.id] ?? []).filter((p) => p.name.toLowerCase().includes(reqSearch));
4230
+ if (allReqParams.length === 0) return /* @__PURE__ */ jsx("div", {
4231
+ className: cx("empty-wrapper"),
4232
+ children: /* @__PURE__ */ jsx(Empty, {
4233
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
4234
+ imageStyle: {
4235
+ width: 184,
4236
+ height: 117
4237
+ },
4238
+ description: /* @__PURE__ */ jsx("span", {
4239
+ className: cx("empty-description"),
4240
+ children: "No Data"
4241
+ })
4242
+ })
4243
+ });
4244
+ const reqPage = requestPages.get(ep.id) ?? 1;
4245
+ const pagedReqParams = allReqParams.slice((reqPage - 1) * PAGE_SIZE, reqPage * PAGE_SIZE);
4246
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
4247
+ className: cx("param-list"),
4248
+ style: { marginTop: token.margin },
4249
+ children: pagedReqParams.map((param, i) => {
4250
+ const idx = (reqPage - 1) * PAGE_SIZE + i;
4251
+ return /* @__PURE__ */ jsx("div", {
4252
+ className: cx("param-item-row"),
4253
+ children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4254
+ style: {
4255
+ display: "flex",
4256
+ alignItems: "center",
4257
+ gap: 24,
4258
+ flex: 1,
4259
+ minWidth: 0
4260
+ },
4261
+ children: [/* @__PURE__ */ jsxs("div", {
4262
+ className: cx("param-detail-cell"),
4263
+ children: [/* @__PURE__ */ jsx("span", {
4264
+ className: cx("param-detail-label"),
4265
+ children: "Parameter Name"
4266
+ }), /* @__PURE__ */ jsx("span", {
4267
+ className: cx("param-detail-value"),
4268
+ children: param.name
4269
+ })]
4270
+ }), /* @__PURE__ */ jsxs("div", {
4271
+ className: cx("param-detail-cell"),
4272
+ style: {
4273
+ flex: 1,
4274
+ minWidth: 0
4275
+ },
4276
+ children: [/* @__PURE__ */ jsx("span", {
4277
+ className: cx("param-detail-label"),
4278
+ children: "Parameter In"
4279
+ }), /* @__PURE__ */ jsx("span", {
4280
+ className: cx("param-detail-value"),
4281
+ children: param.in
4282
+ })]
4283
+ })]
4284
+ }), /* @__PURE__ */ jsxs("div", {
4285
+ style: {
4286
+ display: "flex",
4287
+ alignItems: "center",
4288
+ gap: token.margin,
4289
+ background: token.colorFillTertiary,
4290
+ borderRadius: token.borderRadius,
4291
+ padding: `0 ${token.marginSM}px`,
4292
+ height: 50,
4293
+ flexShrink: 0
4294
+ },
4295
+ children: [/* @__PURE__ */ jsx(Button, {
4296
+ danger: true,
4297
+ icon: /* @__PURE__ */ jsx(Trash, {
4298
+ width: 32,
4299
+ height: 32
4300
+ }),
4301
+ style: {
4302
+ padding: 0,
4303
+ lineHeight: 1,
4304
+ width: 40,
4305
+ height: 40
4306
+ },
4307
+ className: cx("param-delete-btn"),
4308
+ onClick: () => setDeleteParamModal({
4309
+ open: true,
4310
+ endpointId: ep.id,
4311
+ idx,
4312
+ name: param.name,
4313
+ source: "request"
4314
+ })
4315
+ }), /* @__PURE__ */ jsx(Button, {
4316
+ ghost: true,
4317
+ icon: /* @__PURE__ */ jsx(EditTag, {
4318
+ width: 18,
4319
+ height: 18
4320
+ }),
4321
+ style: {
4322
+ width: 40,
4323
+ height: 40,
4324
+ padding: 0,
4325
+ lineHeight: 1
4326
+ },
4327
+ className: cx("param-edit-btn"),
4328
+ onClick: () => {
4329
+ setDrawerSource("request");
4330
+ setParamDrawerMode("edit");
4331
+ setEditParamIdx(idx);
4332
+ setParamDrawerEndpointId(ep.id);
4333
+ setParamDrawerOpen(true);
4334
+ }
4335
+ })]
4336
+ })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4337
+ className: cx("param-details"),
4338
+ children: [
4339
+ /* @__PURE__ */ jsxs("div", {
4340
+ className: cx("param-detail-cell"),
4341
+ children: [/* @__PURE__ */ jsx("span", {
4342
+ className: cx("param-detail-label"),
4343
+ children: "Parameter Name"
4344
+ }), /* @__PURE__ */ jsx("span", {
4345
+ className: cx("param-detail-value"),
4346
+ children: param.name
4347
+ })]
4348
+ }),
4349
+ /* @__PURE__ */ jsxs("div", {
4350
+ className: cx("param-detail-cell"),
4351
+ children: [/* @__PURE__ */ jsx("span", {
4352
+ className: cx("param-detail-label"),
4353
+ children: "Parameter In"
4354
+ }), /* @__PURE__ */ jsx("span", {
4355
+ className: cx("param-detail-value"),
4356
+ children: param.in
4357
+ })]
4358
+ }),
4359
+ /* @__PURE__ */ jsxs("div", {
4360
+ className: cx("param-detail-cell"),
4361
+ children: [/* @__PURE__ */ jsx("span", {
4362
+ className: cx("param-detail-label"),
4363
+ children: "Parameter Type"
4364
+ }), /* @__PURE__ */ jsx("span", {
4365
+ className: cx("param-detail-value"),
4366
+ children: param.type
4367
+ })]
4368
+ }),
4369
+ /* @__PURE__ */ jsxs("div", {
4370
+ className: cx("param-detail-cell"),
4371
+ children: [/* @__PURE__ */ jsx("span", {
4372
+ className: cx("param-detail-label"),
4373
+ children: "Enum"
4374
+ }), param.enum && param.enum.length > 0 ? /* @__PURE__ */ jsxs("span", {
4375
+ className: cx("param-enum-container"),
4376
+ children: [/* @__PURE__ */ jsx("span", {
4377
+ className: cx("param-enum-tag"),
4378
+ children: param.enum[0]
4379
+ }), param.enum.length > 1 && /* @__PURE__ */ jsx(Tooltip, {
4380
+ title: /* @__PURE__ */ jsx("ul", {
4381
+ style: {
4382
+ margin: 0,
4383
+ paddingLeft: 16
4384
+ },
4385
+ children: param.enum.map((e) => /* @__PURE__ */ jsx("li", { children: e }, e))
4386
+ }),
4387
+ placement: "bottom",
4388
+ children: /* @__PURE__ */ jsxs("span", {
4389
+ className: cx("param-enum-pill"),
4390
+ children: ["+", param.enum.length - 1]
4391
+ })
4392
+ })]
4393
+ }) : /* @__PURE__ */ jsx("span", {
4394
+ className: cx("param-detail-value"),
4395
+ children: "—"
4396
+ })]
4397
+ }),
4398
+ /* @__PURE__ */ jsxs("div", {
4399
+ className: cx("param-detail-cell"),
4400
+ children: [/* @__PURE__ */ jsx("span", {
4401
+ className: cx("param-detail-label"),
4402
+ children: "Required?"
4403
+ }), /* @__PURE__ */ jsx("span", {
4404
+ className: cx("param-detail-value"),
4405
+ children: param.required ? "Yes" : "No"
4406
+ })]
4407
+ }),
4408
+ /* @__PURE__ */ jsxs("div", {
4409
+ className: cx("param-detail-cell"),
4410
+ children: [/* @__PURE__ */ jsx("span", {
4411
+ className: cx("param-detail-label"),
4412
+ children: "Description"
4413
+ }), /* @__PURE__ */ jsx("span", {
4414
+ className: cx("param-detail-value", "param-detail-value--ellipsis"),
4415
+ children: param.description || "—"
4416
+ })]
4417
+ })
4418
+ ]
4419
+ }), /* @__PURE__ */ jsxs("div", {
4420
+ className: cx("param-actions"),
4421
+ children: [/* @__PURE__ */ jsx(Button, {
4422
+ danger: true,
4423
+ icon: /* @__PURE__ */ jsx(Trash, {
4424
+ width: 32,
4425
+ height: 32
4426
+ }),
4427
+ style: {
4428
+ padding: 0,
4429
+ lineHeight: 1,
4430
+ width: 40,
4431
+ height: 40
4432
+ },
4433
+ className: cx("param-delete-btn"),
4434
+ onClick: () => setDeleteParamModal({
4435
+ open: true,
4436
+ endpointId: ep.id,
4437
+ idx,
4438
+ name: param.name,
4439
+ source: "request"
4440
+ })
4441
+ }), /* @__PURE__ */ jsx(Button, {
4442
+ ghost: true,
4443
+ icon: /* @__PURE__ */ jsx(EditTag, {
4444
+ width: 18,
4445
+ height: 18
4446
+ }),
4447
+ style: {
4448
+ width: 40,
4449
+ height: 40,
4450
+ padding: 0,
4451
+ lineHeight: 1
4452
+ },
4453
+ className: cx("param-edit-btn"),
4454
+ onClick: () => {
4455
+ setDrawerSource("request");
4456
+ setParamDrawerMode("edit");
4457
+ setEditParamIdx(idx);
4458
+ setParamDrawerEndpointId(ep.id);
4459
+ setParamDrawerOpen(true);
4460
+ }
4461
+ })]
4462
+ })] })
4463
+ }, idx);
4464
+ })
4465
+ }), allReqParams.length > PAGE_SIZE && /* @__PURE__ */ jsx(Pagination, {
4466
+ current: reqPage,
4467
+ pageSize: PAGE_SIZE,
4468
+ total: allReqParams.length,
4469
+ onChange: (page) => setRequestPages((prev) => new Map(prev).set(ep.id, page)),
4470
+ showSizeChanger: false,
4471
+ className: cx("pagination")
4472
+ })] });
4473
+ })(),
4474
+ /* @__PURE__ */ jsxs("div", {
4475
+ className: cx("param-row"),
4476
+ style: { marginTop: token.margin },
4477
+ onClick: () => toggleRequestPanel(ep.id),
4478
+ children: [/* @__PURE__ */ jsx(DownOutlined, { className: cx("param-row-icon", openRequestPanels.has(ep.id) ? "param-row-icon--open" : "") }), /* @__PURE__ */ jsxs("span", {
4479
+ style: { fontSize: token.fontSize },
4480
+ children: ["Request ", /* @__PURE__ */ jsx("span", {
4481
+ style: { color: token.colorError },
4482
+ children: "*"
4483
+ })]
4484
+ })]
4485
+ }),
4486
+ openRequestPanels.has(ep.id) && /* @__PURE__ */ jsxs("div", {
4487
+ className: cx("code-panel"),
4488
+ children: [/* @__PURE__ */ jsx("code", {
4489
+ className: cx("code-area"),
4490
+ children: JSON.stringify((endpointParams[ep.id] ?? []).map((p) => ({
4491
+ name: p.name,
4492
+ in: p.in,
4493
+ type: p.type,
4494
+ required: p.required,
4495
+ ...p.description ? { description: p.description } : {},
4496
+ ...p.enum && p.enum.length > 0 ? { enum: p.enum } : {}
4497
+ })), null, 2)
4498
+ }), /* @__PURE__ */ jsxs("div", {
4499
+ className: cx("code-footer"),
4500
+ children: [/* @__PURE__ */ jsx(Button, {
4501
+ ghost: true,
4502
+ size: "small",
4503
+ className: cx("code-btn"),
4504
+ children: "Validate"
4505
+ }), /* @__PURE__ */ jsx(Button, {
4506
+ ghost: true,
4507
+ size: "small",
4508
+ className: cx("code-btn"),
4509
+ children: "Beautify"
4510
+ })]
4511
+ })]
4512
+ })
4513
+ ]
4514
+ })] })
4515
+ },
4516
+ {
4517
+ key: "response",
4518
+ label: "Response",
4519
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [epHeader, /* @__PURE__ */ jsxs("div", {
4520
+ className: cx("form-field"),
4521
+ style: { width: "100%" },
4522
+ children: [
4523
+ /* @__PURE__ */ jsx("div", {
4524
+ className: cx("section-header"),
4525
+ children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4526
+ style: {
4527
+ display: "flex",
4528
+ alignItems: "center",
4529
+ gap: token.marginMD
4530
+ },
4531
+ children: [/* @__PURE__ */ jsx("span", {
4532
+ className: cx("section-title"),
4533
+ children: "Response Details"
4534
+ }), /* @__PURE__ */ jsx(Button, {
4535
+ ghost: true,
4536
+ type: "primary",
4537
+ icon: /* @__PURE__ */ jsx(SearchOutlined, {}),
4538
+ size: "large",
4539
+ style: {
4540
+ width: 40,
4541
+ height: 40,
4542
+ padding: 0
4543
+ },
4544
+ disabled: (endpointResponseParams[ep.id] ?? []).length === 0,
4545
+ onClick: () => setShowResponseSearch((prev) => ({
4546
+ ...prev,
4547
+ [ep.id]: !prev[ep.id]
4548
+ }))
4549
+ })]
4550
+ }), /* @__PURE__ */ jsx(Button, {
4551
+ ghost: true,
4552
+ type: "primary",
4553
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
4554
+ onClick: () => {
4555
+ setDrawerSource("response");
4556
+ setParamDrawerMode("add");
4557
+ setEditParamIdx(null);
4558
+ setParamDrawerEndpointId(ep.id);
4559
+ setParamDrawerOpen(true);
4560
+ },
4561
+ children: "Add Parameter"
4562
+ })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4563
+ style: {
4564
+ display: "flex",
4565
+ alignItems: "center",
4566
+ gap: 24
4567
+ },
4568
+ children: [/* @__PURE__ */ jsx("span", {
4569
+ className: cx("section-title"),
4570
+ children: "Response Details"
4571
+ }), /* @__PURE__ */ jsxs("div", {
4572
+ className: cx("response-controls"),
4573
+ children: [/* @__PURE__ */ jsx(Input.Search, {
4574
+ placeholder: "Search by parameter name",
4575
+ style: { width: 310 },
4576
+ disabled: (endpointResponseParams[ep.id] ?? []).length === 0,
4577
+ value: responseSearches[ep.id] ?? "",
4578
+ onChange: (e) => {
4579
+ const val = e.target.value;
4580
+ setResponseSearches((prev) => ({
4581
+ ...prev,
4582
+ [ep.id]: val
4583
+ }));
4584
+ setResponsePages((prev) => new Map(prev).set(ep.id, 1));
4585
+ },
4586
+ allowClear: true
4587
+ }), /* @__PURE__ */ jsx(Tooltip, {
4588
+ title: selectedStatusCodes[ep.id] ? "Filled" : void 0,
4589
+ placement: "bottom",
4590
+ children: /* @__PURE__ */ jsx(Select, {
4591
+ className: cx("status-select"),
4592
+ popupClassName: "status-code-dropdown",
4593
+ value: selectedStatusCodes[ep.id] ?? void 0,
4594
+ onChange: (val) => setSelectedStatusCodes((prev) => ({
4595
+ ...prev,
4596
+ [ep.id]: val
4597
+ })),
4598
+ options: Object.keys(ep.responses ?? {}).map((code) => ({
4599
+ value: code,
4600
+ label: /* @__PURE__ */ jsxs("span", {
4601
+ className: cx("status-label"),
4602
+ children: [/* @__PURE__ */ jsx("span", {
4603
+ className: cx("status-dot"),
4604
+ style: { background: getStatusCodeColor(code, antdToken).dot }
4605
+ }), /* @__PURE__ */ jsx("span", {
4606
+ style: { color: getStatusCodeColor(code, antdToken).text },
4607
+ children: code
4608
+ })]
4609
+ })
4610
+ })),
4611
+ optionRender: (option) => {
4612
+ const code = option.value;
4613
+ const { dot, text } = getStatusCodeColor(code, antdToken);
4614
+ const isSelected = selectedStatusCodes[ep.id] === code;
4615
+ return /* @__PURE__ */ jsx(Tooltip, {
4616
+ title: "Filled",
4617
+ placement: "bottom",
4618
+ children: /* @__PURE__ */ jsxs("span", {
4619
+ className: cx("status-option-content"),
4620
+ children: [
4621
+ /* @__PURE__ */ jsx("span", {
4622
+ className: cx("status-dot"),
4623
+ style: { background: dot }
4624
+ }),
4625
+ /* @__PURE__ */ jsx("span", {
4626
+ style: { color: text },
4627
+ children: code
4628
+ }),
4629
+ isSelected && /* @__PURE__ */ jsx(CheckCircleOutlined, {
4630
+ className: cx("status-checkmark"),
4631
+ style: { color: text }
4632
+ })
4633
+ ]
4634
+ })
4635
+ });
4636
+ }
4637
+ })
4638
+ })]
4639
+ })]
4640
+ }), /* @__PURE__ */ jsx(Button, {
4641
+ ghost: true,
4642
+ type: "primary",
4643
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
4644
+ onClick: () => {
4645
+ setDrawerSource("response");
4646
+ setParamDrawerMode("add");
4647
+ setEditParamIdx(null);
4648
+ setParamDrawerEndpointId(ep.id);
4649
+ setParamDrawerOpen(true);
4650
+ },
4651
+ children: "Add Parameter"
4652
+ })] })
4653
+ }),
4654
+ isMobile && showResponseSearch[ep.id] && /* @__PURE__ */ jsx(Input.Search, {
4655
+ placeholder: "Search by parameter name",
4656
+ style: {
4657
+ width: "100%",
4658
+ marginTop: 8
4659
+ },
4660
+ disabled: (endpointResponseParams[ep.id] ?? []).length === 0,
4661
+ value: responseSearches[ep.id] ?? "",
4662
+ onChange: (e) => {
4663
+ const val = e.target.value;
4664
+ setResponseSearches((prev) => ({
4665
+ ...prev,
4666
+ [ep.id]: val
4667
+ }));
4668
+ setResponsePages((prev) => new Map(prev).set(ep.id, 1));
4669
+ },
4670
+ allowClear: true,
4671
+ autoFocus: true
4672
+ }),
4673
+ (endpointResponseParams[ep.id] ?? []).length === 0 ? /* @__PURE__ */ jsx("div", {
4674
+ className: cx("empty-wrapper"),
4675
+ children: /* @__PURE__ */ jsx(Empty, {
4676
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
4677
+ imageStyle: {
4678
+ width: 184,
4679
+ height: 117
4680
+ },
4681
+ description: /* @__PURE__ */ jsx("span", {
4682
+ className: cx("empty-description"),
4683
+ children: "No Data"
4684
+ })
4685
+ })
4686
+ }) : (() => {
4687
+ const resSearch = (debouncedResponseSearches[ep.id] ?? "").toLowerCase();
4688
+ const allResParams = (endpointResponseParams[ep.id] ?? []).filter((p) => p.name.toLowerCase().includes(resSearch));
4689
+ if (allResParams.length === 0) return /* @__PURE__ */ jsx("div", {
4690
+ className: cx("empty-wrapper"),
4691
+ children: /* @__PURE__ */ jsx(Empty, {
4692
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
4693
+ imageStyle: {
4694
+ width: 184,
4695
+ height: 117
4696
+ },
4697
+ description: /* @__PURE__ */ jsx("span", {
4698
+ className: cx("empty-description"),
4699
+ children: "No Data"
4700
+ })
4701
+ })
4702
+ });
4703
+ const resPage = responsePages.get(ep.id) ?? 1;
4704
+ const pagedResParams = allResParams.slice((resPage - 1) * PAGE_SIZE, resPage * PAGE_SIZE);
4705
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
4706
+ className: cx("param-list"),
4707
+ style: { marginTop: token.margin },
4708
+ children: pagedResParams.map((param, i) => {
4709
+ const idx = (resPage - 1) * PAGE_SIZE + i;
4710
+ return /* @__PURE__ */ jsx("div", {
4711
+ className: cx("param-item-row"),
4712
+ children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4713
+ style: {
4714
+ display: "flex",
4715
+ alignItems: "center",
4716
+ gap: 24,
4717
+ flex: 1,
4718
+ minWidth: 0
4719
+ },
4720
+ children: [/* @__PURE__ */ jsxs("div", {
4721
+ className: cx("param-detail-cell"),
4722
+ children: [/* @__PURE__ */ jsx("span", {
4723
+ className: cx("param-detail-label"),
4724
+ children: "Parameter Name"
4725
+ }), /* @__PURE__ */ jsx("span", {
4726
+ className: cx("param-detail-value"),
4727
+ children: param.name
4728
+ })]
4729
+ }), /* @__PURE__ */ jsxs("div", {
4730
+ className: cx("param-detail-cell"),
4731
+ style: {
4732
+ flex: 1,
4733
+ minWidth: 0
4734
+ },
4735
+ children: [/* @__PURE__ */ jsx("span", {
4736
+ className: cx("param-detail-label"),
4737
+ children: "Parameter In"
4738
+ }), /* @__PURE__ */ jsx("span", {
4739
+ className: cx("param-detail-value"),
4740
+ children: param.in
4741
+ })]
4742
+ })]
4743
+ }), /* @__PURE__ */ jsxs("div", {
4744
+ style: {
4745
+ display: "flex",
4746
+ alignItems: "center",
4747
+ gap: token.margin,
4748
+ background: token.colorFillTertiary,
4749
+ borderRadius: token.borderRadius,
4750
+ padding: `0 ${token.marginSM}px`,
4751
+ height: 50,
4752
+ flexShrink: 0
4753
+ },
4754
+ children: [/* @__PURE__ */ jsx(Button, {
4755
+ danger: true,
4756
+ icon: /* @__PURE__ */ jsx(Trash, {
4757
+ width: 32,
4758
+ height: 32
4759
+ }),
4760
+ style: {
4761
+ padding: 0,
4762
+ lineHeight: 1,
4763
+ width: 40,
4764
+ height: 40
4765
+ },
4766
+ className: cx("param-delete-btn"),
4767
+ onClick: () => setDeleteParamModal({
4768
+ open: true,
4769
+ endpointId: ep.id,
4770
+ idx,
4771
+ name: param.name,
4772
+ source: "response"
4773
+ })
4774
+ }), /* @__PURE__ */ jsx(Button, {
4775
+ ghost: true,
4776
+ icon: /* @__PURE__ */ jsx(EditTag, {
4777
+ width: 18,
4778
+ height: 18
4779
+ }),
4780
+ style: {
4781
+ width: 40,
4782
+ height: 40,
4783
+ padding: 0,
4784
+ lineHeight: 1
4785
+ },
4786
+ className: cx("param-edit-btn"),
4787
+ onClick: () => {
4788
+ setDrawerSource("response");
4789
+ setParamDrawerMode("edit");
4790
+ setEditParamIdx(idx);
4791
+ setParamDrawerEndpointId(ep.id);
4792
+ setParamDrawerOpen(true);
4793
+ }
4794
+ })]
4795
+ })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4796
+ className: cx("param-details"),
4797
+ children: [
4798
+ /* @__PURE__ */ jsxs("div", {
4799
+ className: cx("param-detail-cell"),
4800
+ children: [/* @__PURE__ */ jsx("span", {
4801
+ className: cx("param-detail-label"),
4802
+ children: "Parameter Name"
4803
+ }), /* @__PURE__ */ jsx("span", {
4804
+ className: cx("param-detail-value"),
4805
+ children: param.name
4806
+ })]
4807
+ }),
4808
+ /* @__PURE__ */ jsxs("div", {
4809
+ className: cx("param-detail-cell"),
4810
+ children: [/* @__PURE__ */ jsx("span", {
4811
+ className: cx("param-detail-label"),
4812
+ children: "Parameter In"
4813
+ }), /* @__PURE__ */ jsx("span", {
4814
+ className: cx("param-detail-value"),
4815
+ children: param.in
4816
+ })]
4817
+ }),
4818
+ /* @__PURE__ */ jsxs("div", {
4819
+ className: cx("param-detail-cell"),
4820
+ children: [/* @__PURE__ */ jsx("span", {
4821
+ className: cx("param-detail-label"),
4822
+ children: "Parameter Type"
4823
+ }), /* @__PURE__ */ jsx("span", {
4824
+ className: cx("param-detail-value"),
4825
+ children: param.type
4826
+ })]
4827
+ }),
4828
+ /* @__PURE__ */ jsxs("div", {
4829
+ className: cx("param-detail-cell"),
4830
+ children: [/* @__PURE__ */ jsx("span", {
4831
+ className: cx("param-detail-label"),
4832
+ children: "Enum"
4833
+ }), param.enum && param.enum.length > 0 ? /* @__PURE__ */ jsxs("span", {
4834
+ className: cx("param-enum-container"),
4835
+ children: [/* @__PURE__ */ jsx("span", {
4836
+ className: cx("param-enum-tag"),
4837
+ children: param.enum[0]
4838
+ }), param.enum.length > 1 && /* @__PURE__ */ jsx(Tooltip, {
4839
+ title: /* @__PURE__ */ jsx("ul", {
4840
+ style: {
4841
+ margin: 0,
4842
+ paddingLeft: 16
4843
+ },
4844
+ children: param.enum.map((e) => /* @__PURE__ */ jsx("li", { children: e }, e))
4845
+ }),
4846
+ placement: "bottom",
4847
+ children: /* @__PURE__ */ jsxs("span", {
4848
+ className: cx("param-enum-pill"),
4849
+ children: ["+", param.enum.length - 1]
4850
+ })
4851
+ })]
4852
+ }) : /* @__PURE__ */ jsx("span", {
4853
+ className: cx("param-detail-value"),
4854
+ children: "—"
4855
+ })]
4856
+ }),
4857
+ /* @__PURE__ */ jsxs("div", {
4858
+ className: cx("param-detail-cell"),
4859
+ children: [/* @__PURE__ */ jsx("span", {
4860
+ className: cx("param-detail-label"),
4861
+ children: "Required?"
4862
+ }), /* @__PURE__ */ jsx("span", {
4863
+ className: cx("param-detail-value"),
4864
+ children: param.required ? "Yes" : "No"
4865
+ })]
4866
+ }),
4867
+ /* @__PURE__ */ jsxs("div", {
4868
+ className: cx("param-detail-cell"),
4869
+ children: [/* @__PURE__ */ jsx("span", {
4870
+ className: cx("param-detail-label"),
4871
+ children: "Description"
4872
+ }), /* @__PURE__ */ jsx("span", {
4873
+ className: cx("param-detail-value", "param-detail-value--ellipsis"),
4874
+ children: param.description || "—"
4875
+ })]
4876
+ })
4877
+ ]
4878
+ }), /* @__PURE__ */ jsxs("div", {
4879
+ className: cx("param-actions"),
4880
+ children: [/* @__PURE__ */ jsx(Button, {
4881
+ danger: true,
4882
+ icon: /* @__PURE__ */ jsx(Trash, {
4883
+ width: 32,
4884
+ height: 32
4885
+ }),
4886
+ style: {
4887
+ padding: 0,
4888
+ lineHeight: 1,
4889
+ width: 40,
4890
+ height: 40
4891
+ },
4892
+ className: cx("param-delete-btn"),
4893
+ onClick: () => setDeleteParamModal({
4894
+ open: true,
4895
+ endpointId: ep.id,
4896
+ idx,
4897
+ name: param.name,
4898
+ source: "response"
4899
+ })
4900
+ }), /* @__PURE__ */ jsx(Button, {
4901
+ ghost: true,
4902
+ icon: /* @__PURE__ */ jsx(EditTag, {
4903
+ width: 18,
4904
+ height: 18
4905
+ }),
4906
+ style: {
4907
+ width: 40,
4908
+ height: 40,
4909
+ padding: 0,
4910
+ lineHeight: 1
4911
+ },
4912
+ className: cx("param-edit-btn"),
4913
+ onClick: () => {
4914
+ setDrawerSource("response");
4915
+ setParamDrawerMode("edit");
4916
+ setEditParamIdx(idx);
4917
+ setParamDrawerEndpointId(ep.id);
4918
+ setParamDrawerOpen(true);
4919
+ }
4920
+ })]
4921
+ })] })
4922
+ }, idx);
4923
+ })
4924
+ }), allResParams.length > PAGE_SIZE && /* @__PURE__ */ jsx(Pagination, {
4925
+ current: resPage,
4926
+ pageSize: PAGE_SIZE,
4927
+ total: allResParams.length,
4928
+ onChange: (page) => setResponsePages((prev) => new Map(prev).set(ep.id, page)),
4929
+ showSizeChanger: false,
4930
+ className: cx("pagination")
4931
+ })] });
4932
+ })(),
4933
+ /* @__PURE__ */ jsxs("div", {
4934
+ className: cx("param-row"),
4935
+ style: { marginTop: token.margin },
4936
+ onClick: () => toggleResponsePanel(ep.id),
4937
+ children: [
4938
+ /* @__PURE__ */ jsx(DownOutlined, { className: cx("param-row-icon", openResponsePanels.has(ep.id) ? "param-row-icon--open" : "") }),
4939
+ /* @__PURE__ */ jsxs("span", {
4940
+ style: { fontSize: token.fontSize },
4941
+ children: ["Response ", /* @__PURE__ */ jsx("span", {
4942
+ style: { color: token.colorError },
4943
+ children: "*"
4944
+ })]
4945
+ }),
4946
+ /* @__PURE__ */ jsx(InfoCircle, { style: {
4947
+ width: 24,
4948
+ height: 24
4949
+ } })
4950
+ ]
4951
+ }),
4952
+ openResponsePanels.has(ep.id) && /* @__PURE__ */ jsxs("div", {
4953
+ className: cx("code-panel"),
4954
+ children: [/* @__PURE__ */ jsx("code", {
4955
+ className: cx("code-area"),
4956
+ children: JSON.stringify((endpointResponseParams[ep.id] ?? []).map((p) => ({
4957
+ name: p.name,
4958
+ in: p.in,
4959
+ type: p.type,
4960
+ required: p.required,
4961
+ ...p.description ? { description: p.description } : {},
4962
+ ...p.enum && p.enum.length > 0 ? { enum: p.enum } : {}
4963
+ })), null, 2)
4964
+ }), /* @__PURE__ */ jsxs("div", {
4965
+ className: cx("code-footer"),
4966
+ children: [/* @__PURE__ */ jsx(Button, {
4967
+ ghost: true,
4968
+ size: "small",
4969
+ className: cx("code-btn"),
4970
+ children: "Validate"
4971
+ }), /* @__PURE__ */ jsx(Button, {
4972
+ ghost: true,
4973
+ size: "small",
4974
+ className: cx("code-btn"),
4975
+ children: "Beautify"
4976
+ })]
4977
+ })]
4978
+ })
4979
+ ]
4980
+ })] })
4981
+ }
4982
+ ]
4983
+ }),
4984
+ /* @__PURE__ */ jsxs(Modal, {
4985
+ open: deleteParamModal.open,
4986
+ onCancel: () => setDeleteParamModal({
4987
+ open: false,
4988
+ endpointId: "",
4989
+ idx: -1,
4990
+ name: "",
4991
+ source: "request"
4992
+ }),
4993
+ centered: true,
4994
+ title: null,
4995
+ footer: null,
4996
+ closable: false,
4997
+ width: 520,
4998
+ className: "delete-param-confirm-modal",
4999
+ styles: {
5000
+ content: {
5001
+ padding: 0,
5002
+ borderRadius: 8,
5003
+ overflow: "hidden"
5004
+ },
5005
+ body: {
5006
+ padding: 0,
5007
+ margin: 0
5008
+ }
5009
+ },
5010
+ children: [
5011
+ /* @__PURE__ */ jsxs("div", {
5012
+ className: cx("deleteModalHead"),
5013
+ children: [/* @__PURE__ */ jsxs("span", {
5014
+ className: cx("deleteModalTitle"),
5015
+ children: [
5016
+ "Delete ",
5017
+ deleteParamModal.name,
5018
+ " parameter"
5019
+ ]
5020
+ }), /* @__PURE__ */ jsx("button", {
5021
+ className: cx("deleteModalCloseBtn"),
5022
+ onClick: () => setDeleteParamModal({
5023
+ open: false,
5024
+ endpointId: "",
5025
+ idx: -1,
5026
+ name: "",
5027
+ source: "request"
5028
+ }),
5029
+ "aria-label": "Close",
5030
+ children: "×"
5031
+ })]
5032
+ }),
5033
+ /* @__PURE__ */ jsx("div", {
5034
+ className: cx("deleteModalContent"),
5035
+ children: /* @__PURE__ */ jsxs("span", {
5036
+ className: cx("deleteModalContentText"),
5037
+ children: [
5038
+ "Are you sure you want to delete ",
5039
+ deleteParamModal.name,
5040
+ " parameter?"
5041
+ ]
5042
+ })
5043
+ }),
5044
+ /* @__PURE__ */ jsxs("div", {
5045
+ className: cx("deleteModalFooter"),
5046
+ children: [/* @__PURE__ */ jsx(Button, {
5047
+ size: "middle",
5048
+ onClick: () => setDeleteParamModal({
5049
+ open: false,
5050
+ endpointId: "",
5051
+ idx: -1,
5052
+ name: "",
5053
+ source: "request"
5054
+ }),
5055
+ style: {
5056
+ borderRadius: 8,
5057
+ height: 32,
5058
+ paddingInline: 15
5059
+ },
5060
+ children: "Cancel"
5061
+ }), /* @__PURE__ */ jsx(Button, {
5062
+ type: "primary",
5063
+ danger: true,
5064
+ size: "middle",
5065
+ style: {
5066
+ borderRadius: 8,
5067
+ height: 32,
5068
+ paddingInline: 16
5069
+ },
5070
+ onClick: () => {
5071
+ const epId = deleteParamModal.endpointId;
5072
+ if (deleteParamModal.source === "response") {
5073
+ const total = (endpointResponseParams[epId] ?? []).length - 1;
5074
+ const maxPage = Math.max(1, Math.ceil(total / PAGE_SIZE));
5075
+ if ((responsePages.get(epId) ?? 1) > maxPage) setResponsePages((prev) => new Map(prev).set(epId, 1));
5076
+ onDeleteResponseParameter?.(epId, deleteParamModal.idx);
5077
+ } else {
5078
+ const total = (endpointParams[epId] ?? []).length - 1;
5079
+ const maxPage = Math.max(1, Math.ceil(total / PAGE_SIZE));
5080
+ if ((requestPages.get(epId) ?? 1) > maxPage) setRequestPages((prev) => new Map(prev).set(epId, 1));
5081
+ onDeleteParameter?.(epId, deleteParamModal.idx);
5082
+ }
5083
+ setDeleteParamModal({
5084
+ open: false,
5085
+ endpointId: "",
5086
+ idx: -1,
5087
+ name: "",
5088
+ source: "request"
5089
+ });
5090
+ },
5091
+ children: "Yes, Delete"
5092
+ })]
5093
+ })
5094
+ ]
5095
+ }),
5096
+ /* @__PURE__ */ jsx(AddParameterDrawer, {
5097
+ open: paramDrawerOpen,
5098
+ mode: paramDrawerMode,
5099
+ initialValues: paramDrawerMode === "edit" && paramDrawerEndpointId && editParamIdx !== null ? drawerSource === "response" ? endpointResponseParams[paramDrawerEndpointId]?.[editParamIdx] : endpointParams[paramDrawerEndpointId]?.[editParamIdx] : void 0,
5100
+ onClose: () => {
5101
+ setParamDrawerOpen(false);
5102
+ setParamDrawerEndpointId(null);
5103
+ setParamDrawerMode("add");
5104
+ setEditParamIdx(null);
5105
+ },
5106
+ onAdd: (param) => {
5107
+ if (paramDrawerEndpointId) if (drawerSource === "response") onAddResponseParameter?.(paramDrawerEndpointId, param);
5108
+ else onAddParameter?.(paramDrawerEndpointId, param);
5109
+ setParamDrawerOpen(false);
5110
+ setParamDrawerEndpointId(null);
5111
+ setParamDrawerMode("add");
5112
+ setEditParamIdx(null);
5113
+ },
5114
+ onEdit: (param) => {
5115
+ if (paramDrawerEndpointId && editParamIdx !== null) if (drawerSource === "response") onEditResponseParameter?.(paramDrawerEndpointId, editParamIdx, param);
5116
+ else onEditParameter?.(paramDrawerEndpointId, editParamIdx, param);
5117
+ setParamDrawerOpen(false);
5118
+ setParamDrawerEndpointId(null);
5119
+ setParamDrawerMode("add");
5120
+ setEditParamIdx(null);
5121
+ }
5122
+ })
5123
+ ]
5124
+ }));
5125
+ }
5126
+ return wrapSSR(/* @__PURE__ */ jsxs("div", {
5127
+ className: cx("root"),
5128
+ children: [
5129
+ /* @__PURE__ */ jsxs("div", {
5130
+ className: cx("head"),
5131
+ children: [/* @__PURE__ */ jsx(Title, {
5132
+ level: 4,
5133
+ style: {
5134
+ margin: 0,
5135
+ color: token.colorTextHeading
5136
+ },
5137
+ children: "Endpoints"
5138
+ }), /* @__PURE__ */ jsx(Button, {
5139
+ type: "text",
5140
+ size: "large",
5141
+ icon: /* @__PURE__ */ jsx(UpCircleOutlined, { style: { fontSize: 18 } }),
5142
+ onClick: onToggleCollapse,
5143
+ style: {
5144
+ transform: collapsed ? "rotate(180deg)" : "rotate(0deg)",
5145
+ transition: "transform 0.2s"
5146
+ }
5147
+ })]
5148
+ }),
5149
+ !collapsed && /* @__PURE__ */ jsx("div", {
5150
+ className: cx("body"),
5151
+ children: Object.values(endpointsByTag).flat().map((ep) => {
5152
+ const isExpanded = expandedId === ep.id;
5153
+ const methodColor = methodColors$1[ep.method];
5154
+ return /* @__PURE__ */ jsxs("div", { children: [
5155
+ /* @__PURE__ */ jsxs("div", {
5156
+ className: cx("endpoint-row"),
5157
+ children: [/* @__PURE__ */ jsxs("div", {
5158
+ className: cx("endpoint-card", isExpanded ? "endpoint-card-active" : ""),
5159
+ onClick: () => handleEndpointClick(ep),
5160
+ children: [/* @__PURE__ */ jsx("span", {
5161
+ className: cx("method-badge"),
5162
+ style: {
5163
+ color: isExpanded ? "#ffffff" : methodColor?.color,
5164
+ borderColor: methodColor?.color,
5165
+ backgroundColor: isExpanded ? methodColor?.color : "transparent"
3938
5166
  },
3939
5167
  children: ep.method
3940
5168
  }), /* @__PURE__ */ jsx(Tooltip, {
@@ -3966,49 +5194,95 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3966
5194
  className: cx("view-params-title"),
3967
5195
  children: "Request"
3968
5196
  })
3969
- }), /* @__PURE__ */ jsx(Table, {
3970
- dataSource: buildViewParamRows(endpointParams[ep.id] ?? []),
3971
- columns: viewParamColumns,
3972
- pagination: false,
3973
- rowClassName: (_, idx) => cx(idx % 2 === 0 ? "view-row-odd" : "view-row-even"),
3974
- size: "small",
3975
- bordered: true
3976
- })]
5197
+ }), (() => {
5198
+ const allVReqRows = buildViewParamRows(endpointParams[ep.id] ?? []);
5199
+ const vReqPage = requestPages.get(ep.id) ?? 1;
5200
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Table, {
5201
+ dataSource: allVReqRows.slice((vReqPage - 1) * VIEW_PAGE_SIZE, vReqPage * VIEW_PAGE_SIZE),
5202
+ columns: viewParamColumns,
5203
+ pagination: false,
5204
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "view-row-odd" : "view-row-even"),
5205
+ size: "small",
5206
+ bordered: true
5207
+ }), allVReqRows.length > VIEW_PAGE_SIZE && /* @__PURE__ */ jsx("div", {
5208
+ style: { paddingBottom: 12 },
5209
+ children: /* @__PURE__ */ jsx(Pagination, {
5210
+ current: vReqPage,
5211
+ pageSize: VIEW_PAGE_SIZE,
5212
+ total: allVReqRows.length,
5213
+ onChange: (page) => setRequestPages((prev) => new Map(prev).set(ep.id, page)),
5214
+ showSizeChanger: false,
5215
+ className: cx("pagination")
5216
+ })
5217
+ })] });
5218
+ })()]
3977
5219
  }), /* @__PURE__ */ jsxs("div", {
3978
5220
  className: cx("view-params-card"),
3979
- children: [/* @__PURE__ */ jsxs("div", {
3980
- className: cx("view-params-header"),
3981
- children: [/* @__PURE__ */ jsx("span", {
3982
- className: cx("view-params-title"),
3983
- children: "Response"
3984
- }), /* @__PURE__ */ jsx(Select, {
3985
- className: cx("view-status-select-sm"),
3986
- popupClassName: "status-code-dropdown",
3987
- value: selectedStatusCodes[ep.id] ?? (Object.keys(ep.responses ?? {}).includes("200") ? "200" : Object.keys(ep.responses ?? {})[0]),
3988
- onChange: (val) => setSelectedStatusCodes((prev) => ({
3989
- ...prev,
3990
- [ep.id]: val
3991
- })),
3992
- options: Object.keys(ep.responses ?? {}).map((code) => ({
3993
- value: code,
3994
- label: /* @__PURE__ */ jsxs("span", {
3995
- className: cx("status-label"),
3996
- children: [/* @__PURE__ */ jsx("span", {
3997
- className: cx("status-dot"),
3998
- style: { background: getStatusCodeColor(code, antdToken).dot }
3999
- }), /* @__PURE__ */ jsx("span", { children: code })]
5221
+ children: [
5222
+ /* @__PURE__ */ jsxs("div", {
5223
+ className: cx("view-params-header"),
5224
+ children: [/* @__PURE__ */ jsx("span", {
5225
+ className: cx("view-params-title"),
5226
+ children: "Response"
5227
+ }), /* @__PURE__ */ jsx(Select, {
5228
+ className: cx("view-status-select-sm"),
5229
+ popupClassName: "status-code-dropdown",
5230
+ value: selectedStatusCodes[ep.id] ?? (Object.keys(ep.responses ?? {}).includes("200") ? "200" : Object.keys(ep.responses ?? {})[0]),
5231
+ onChange: (val) => setSelectedStatusCodes((prev) => ({
5232
+ ...prev,
5233
+ [ep.id]: val
5234
+ })),
5235
+ options: Object.keys(ep.responses ?? {}).map((code) => ({
5236
+ value: code,
5237
+ label: /* @__PURE__ */ jsxs("span", {
5238
+ className: cx("status-label"),
5239
+ children: [/* @__PURE__ */ jsx("span", {
5240
+ className: cx("status-dot"),
5241
+ style: { background: getStatusCodeColor(code, antdToken).dot }
5242
+ }), /* @__PURE__ */ jsx("span", { children: code })]
5243
+ })
5244
+ })),
5245
+ size: "middle"
5246
+ })]
5247
+ }),
5248
+ (() => {
5249
+ const allVResRows = buildViewParamRows(endpointResponseParams[ep.id] ?? []);
5250
+ const vResPage = responsePages.get(ep.id) ?? 1;
5251
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Table, {
5252
+ dataSource: allVResRows.slice((vResPage - 1) * VIEW_PAGE_SIZE, vResPage * VIEW_PAGE_SIZE),
5253
+ columns: viewParamColumns,
5254
+ pagination: false,
5255
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "view-row-odd" : "view-row-even"),
5256
+ size: "small",
5257
+ bordered: true
5258
+ }), allVResRows.length > VIEW_PAGE_SIZE && /* @__PURE__ */ jsx("div", {
5259
+ style: { paddingBottom: 12 },
5260
+ children: /* @__PURE__ */ jsx(Pagination, {
5261
+ current: vResPage,
5262
+ pageSize: VIEW_PAGE_SIZE,
5263
+ total: allVResRows.length,
5264
+ onChange: (page) => setResponsePages((prev) => new Map(prev).set(ep.id, page)),
5265
+ showSizeChanger: false,
5266
+ className: cx("pagination")
4000
5267
  })
4001
- })),
4002
- size: "middle"
4003
- })]
4004
- }), /* @__PURE__ */ jsx(Table, {
4005
- dataSource: buildViewParamRows(endpointResponseParams[ep.id] ?? []),
4006
- columns: viewParamColumns,
4007
- pagination: false,
4008
- rowClassName: (_, idx) => cx(idx % 2 === 0 ? "view-row-odd" : "view-row-even"),
4009
- size: "small",
4010
- bordered: true
4011
- })]
5268
+ })] });
5269
+ })(),
5270
+ (() => {
5271
+ const selectedCode = selectedStatusCodes[ep.id] ?? (Object.keys(ep.responses ?? {}).includes("200") ? "200" : Object.keys(ep.responses ?? {})[0]);
5272
+ const responseContent = ep.responses?.[selectedCode]?.content;
5273
+ if (!responseContent) return null;
5274
+ const schema = Object.values(responseContent)[0]?.schema;
5275
+ if (!schema) return null;
5276
+ return /* @__PURE__ */ jsx("div", {
5277
+ className: cx("code-panel"),
5278
+ style: { marginTop: token.marginSM },
5279
+ children: /* @__PURE__ */ jsx("code", {
5280
+ className: cx("code-area"),
5281
+ children: JSON.stringify(schema, null, 2)
5282
+ })
5283
+ });
5284
+ })()
5285
+ ]
4012
5286
  })]
4013
5287
  }),
4014
5288
  isExpanded && mode !== "view" && /* @__PURE__ */ jsxs("div", {
@@ -4028,7 +5302,9 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4028
5302
  }), /* @__PURE__ */ jsx(Input, {
4029
5303
  size: "large",
4030
5304
  value: endpointNames[ep.id] ?? ep.summary ?? "",
4031
- onChange: (e) => onEndpointNameChange(ep.id, e.target.value)
5305
+ onChange: (e) => onEndpointNameChange(ep.id, e.target.value),
5306
+ maxLength: 100,
5307
+ showCount: true
4032
5308
  })]
4033
5309
  }), /* @__PURE__ */ jsxs("div", {
4034
5310
  className: cx("form-field"),
@@ -4261,9 +5537,8 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4261
5537
  style: {
4262
5538
  padding: 0,
4263
5539
  lineHeight: 1,
4264
- width: 32,
4265
- height: 32,
4266
- fontSize: 20
5540
+ width: 40,
5541
+ height: 40
4267
5542
  },
4268
5543
  className: cx("param-delete-btn"),
4269
5544
  onClick: () => setDeleteParamModal({
@@ -4275,7 +5550,16 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4275
5550
  })
4276
5551
  }), /* @__PURE__ */ jsx(Button, {
4277
5552
  ghost: true,
4278
- icon: /* @__PURE__ */ jsx(EditOutlined, {}),
5553
+ icon: /* @__PURE__ */ jsx(EditTag, {
5554
+ width: 18,
5555
+ height: 18
5556
+ }),
5557
+ style: {
5558
+ width: 40,
5559
+ height: 40,
5560
+ padding: 0,
5561
+ lineHeight: 1
5562
+ },
4279
5563
  className: cx("param-edit-btn"),
4280
5564
  onClick: () => {
4281
5565
  setDrawerSource("request");
@@ -4372,14 +5656,15 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4372
5656
  className: cx("param-actions"),
4373
5657
  children: [/* @__PURE__ */ jsx(Button, {
4374
5658
  danger: true,
4375
- type: "text",
4376
5659
  icon: /* @__PURE__ */ jsx(Trash, {
4377
- height: 32,
4378
- width: 32
5660
+ width: 32,
5661
+ height: 32
4379
5662
  }),
4380
5663
  style: {
4381
5664
  padding: 0,
4382
- lineHeight: 1
5665
+ lineHeight: 1,
5666
+ width: 40,
5667
+ height: 40
4383
5668
  },
4384
5669
  className: cx("param-delete-btn"),
4385
5670
  onClick: () => setDeleteParamModal({
@@ -4391,7 +5676,16 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4391
5676
  })
4392
5677
  }), /* @__PURE__ */ jsx(Button, {
4393
5678
  ghost: true,
4394
- icon: /* @__PURE__ */ jsx(EditOutlined, {}),
5679
+ icon: /* @__PURE__ */ jsx(EditTag, {
5680
+ width: 18,
5681
+ height: 18
5682
+ }),
5683
+ style: {
5684
+ width: 40,
5685
+ height: 40,
5686
+ padding: 0,
5687
+ lineHeight: 1
5688
+ },
4395
5689
  className: cx("param-edit-btn"),
4396
5690
  onClick: () => {
4397
5691
  setDrawerSource("request");
@@ -4700,9 +5994,8 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4700
5994
  style: {
4701
5995
  padding: 0,
4702
5996
  lineHeight: 1,
4703
- width: 32,
4704
- height: 32,
4705
- fontSize: 20
5997
+ width: 40,
5998
+ height: 40
4706
5999
  },
4707
6000
  className: cx("param-delete-btn"),
4708
6001
  onClick: () => setDeleteParamModal({
@@ -4714,7 +6007,16 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4714
6007
  })
4715
6008
  }), /* @__PURE__ */ jsx(Button, {
4716
6009
  ghost: true,
4717
- icon: /* @__PURE__ */ jsx(EditOutlined, {}),
6010
+ icon: /* @__PURE__ */ jsx(EditTag, {
6011
+ width: 18,
6012
+ height: 18
6013
+ }),
6014
+ style: {
6015
+ width: 40,
6016
+ height: 40,
6017
+ padding: 0,
6018
+ lineHeight: 1
6019
+ },
4718
6020
  className: cx("param-edit-btn"),
4719
6021
  onClick: () => {
4720
6022
  setDrawerSource("response");
@@ -4811,7 +6113,16 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4811
6113
  className: cx("param-actions"),
4812
6114
  children: [/* @__PURE__ */ jsx(Button, {
4813
6115
  ghost: true,
4814
- icon: /* @__PURE__ */ jsx(EditOutlined, {}),
6116
+ icon: /* @__PURE__ */ jsx(EditTag, {
6117
+ width: 18,
6118
+ height: 18
6119
+ }),
6120
+ style: {
6121
+ width: 40,
6122
+ height: 40,
6123
+ padding: 0,
6124
+ lineHeight: 1
6125
+ },
4815
6126
  className: cx("param-edit-btn"),
4816
6127
  onClick: () => {
4817
6128
  setDrawerSource("response");
@@ -4822,14 +6133,15 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4822
6133
  }
4823
6134
  }), /* @__PURE__ */ jsx(Button, {
4824
6135
  danger: true,
4825
- type: "text",
4826
6136
  icon: /* @__PURE__ */ jsx(Trash, {
4827
- height: 18,
4828
- width: 18
6137
+ width: 32,
6138
+ height: 32
4829
6139
  }),
4830
6140
  style: {
4831
6141
  padding: 0,
4832
- lineHeight: 1
6142
+ lineHeight: 1,
6143
+ width: 40,
6144
+ height: 40
4833
6145
  },
4834
6146
  className: cx("param-delete-btn"),
4835
6147
  onClick: () => setDeleteParamModal({
@@ -5070,7 +6382,7 @@ const UnsavedChangesBanner = ({ onClose }) => {
5070
6382
  children: /* @__PURE__ */ jsx(Alert, {
5071
6383
  className: cx("alert"),
5072
6384
  type: "warning",
5073
- message: "There are changes you made may not be saved",
6385
+ message: "There are changes you made that may not be saved",
5074
6386
  closable: true,
5075
6387
  onClose,
5076
6388
  icon: /* @__PURE__ */ jsx(ExclamationCircleFilled, {}),
@@ -5081,57 +6393,50 @@ const UnsavedChangesBanner = ({ onClose }) => {
5081
6393
  //#endregion
5082
6394
  //#region src/view/components/ApiPage/components/TagsSection.tsx
5083
6395
  const { useBreakpoint: useBreakpoint$1 } = Grid;
5084
- const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEditTag, onDeleteTag }) => {
6396
+ const TAGS_PAGE_SIZE = 8;
6397
+ const TagsSection = ({ tags, collapsed, onToggleCollapse, onAddTag, onEditTag, onDeleteTag }) => {
5085
6398
  const isMobile = !useBreakpoint$1().md;
6399
+ const [currentPage, setCurrentPage] = useState(1);
6400
+ const sortedTags = [...tags].sort((a, b) => a.isDefault === b.isDefault ? 0 : a.isDefault ? -1 : 1);
6401
+ const maxPage = Math.max(1, Math.ceil(tags.length / TAGS_PAGE_SIZE));
6402
+ const safePage = Math.min(currentPage, maxPage);
6403
+ const paginatedTags = sortedTags.slice((safePage - 1) * TAGS_PAGE_SIZE, safePage * TAGS_PAGE_SIZE);
5086
6404
  const { wrapSSR, cx, token } = useStyle("TagsSection", (token, scope) => ({
5087
6405
  [scope("root")]: {
5088
6406
  display: "flex",
5089
6407
  flexDirection: "column",
5090
- borderRadius: token.borderRadius,
5091
- overflow: "hidden",
5092
- width: "100%",
5093
- flexShrink: 0
6408
+ gap: token.margin,
6409
+ padding: token.marginLG,
6410
+ background: token.colorBgElevated,
6411
+ borderRadius: token.borderRadiusLG,
6412
+ width: "100%"
5094
6413
  },
5095
6414
  [scope("head")]: {
5096
6415
  display: "flex",
5097
6416
  alignItems: "center",
5098
6417
  justifyContent: "space-between",
5099
- padding: `${token.paddingXS}px ${token.paddingLG}px`,
5100
- background: token.colorPrimaryBg,
5101
- borderRadius: `${token.borderRadius}px ${token.borderRadius}px 0 0`
5102
- },
5103
- [scope("head-actions")]: {
5104
- display: "flex",
5105
- alignItems: "center",
5106
- gap: token.margin
6418
+ width: "100%"
5107
6419
  },
5108
- [scope("body")]: {
6420
+ [scope("tags-list")]: {
5109
6421
  display: "flex",
5110
6422
  flexDirection: "column",
5111
- gap: 0,
5112
- padding: token.paddingLG,
5113
- background: token.colorBgElevated,
5114
- borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
6423
+ width: "100%"
5115
6424
  },
5116
6425
  [scope("tag-row")]: {
5117
6426
  display: "flex",
5118
6427
  alignItems: "center",
5119
6428
  justifyContent: "space-between",
5120
- height: 50,
5121
- paddingTop: token.controlHeightLG,
5122
- paddingBottom: token.controlHeightLG,
5123
- paddingRight: token.paddingLG,
5124
- borderBottom: `1px solid ${token.colorBorder}`,
5125
- width: "100%"
5126
- },
5127
- [scope("tag-row-last")]: {
5128
- borderBottom: "none",
5129
- paddingBottom: token.marginLG
6429
+ minHeight: 50,
6430
+ paddingTop: 12,
6431
+ paddingBottom: 12,
6432
+ width: "100%",
6433
+ borderBottom: `1px solid ${token.colorBorder}`
5130
6434
  },
6435
+ [scope("tag-row-last")]: { borderBottom: "none" },
5131
6436
  [scope("tag-info")]: {
5132
6437
  display: "flex",
5133
6438
  alignItems: "center",
5134
- gap: 32,
6439
+ gap: token.marginXL,
5135
6440
  flex: 1,
5136
6441
  minWidth: 0
5137
6442
  },
@@ -5167,32 +6472,13 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
5167
6472
  alignItems: "center",
5168
6473
  gap: token.margin
5169
6474
  },
5170
- [scope("btn-delete")]: {
5171
- width: 40,
5172
- height: 40,
5173
- border: `1px solid ${token.colorError}`,
5174
- borderRadius: token.borderRadius,
5175
- display: "flex",
5176
- alignItems: "center",
5177
- justifyContent: "center"
5178
- },
5179
- [scope("btn-edit")]: {
5180
- width: 40,
5181
- height: 40,
5182
- border: `1px solid ${token.colorBorder}`,
5183
- borderRadius: token.borderRadius,
5184
- background: token.colorBgContainer,
5185
- boxShadow: "0px 2px 0px 0px rgba(0,0,0,0.02)",
5186
- display: "flex",
5187
- alignItems: "center",
5188
- justifyContent: "center"
5189
- },
5190
6475
  [scope("tag-row-mobile")]: {
5191
6476
  display: "flex",
5192
6477
  flexDirection: "row",
5193
6478
  alignItems: "flex-start",
5194
6479
  justifyContent: "space-between",
5195
6480
  gap: 8,
6481
+ paddingTop: 12,
5196
6482
  paddingBottom: token.margin,
5197
6483
  borderBottom: `1px solid ${token.colorBorder}`,
5198
6484
  width: "100%",
@@ -5222,16 +6508,176 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
5222
6508
  display: "flex",
5223
6509
  flexDirection: "column",
5224
6510
  gap: 0,
5225
- padding: token.paddingMD,
5226
- background: token.colorBgElevated,
5227
- borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`,
5228
6511
  overflowX: "auto"
6512
+ },
6513
+ [scope("head-collapse")]: {
6514
+ display: "flex",
6515
+ alignItems: "center",
6516
+ justifyContent: "space-between",
6517
+ padding: `${token.paddingXS}px ${token.paddingLG}px`,
6518
+ background: token.colorPrimaryBg,
6519
+ borderRadius: `${token.borderRadius}px ${token.borderRadius}px 0 0`
6520
+ },
6521
+ [scope("body-collapse")]: {
6522
+ display: "flex",
6523
+ flexDirection: "column",
6524
+ gap: token.margin,
6525
+ padding: token.paddingLG,
6526
+ background: token.colorBgElevated,
6527
+ borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
6528
+ },
6529
+ [scope("pagination")]: {
6530
+ display: "flex",
6531
+ justifyContent: "center",
6532
+ marginTop: token.marginMD,
6533
+ ".ant-pagination-item-active": {
6534
+ backgroundColor: token.colorBgContainer,
6535
+ borderColor: token.colorPrimary,
6536
+ borderRadius: token.borderRadius,
6537
+ display: "flex",
6538
+ alignItems: "center",
6539
+ justifyContent: "center",
6540
+ a: {
6541
+ color: token.colorPrimary,
6542
+ fontWeight: token.fontWeightStrong,
6543
+ fontSize: token.fontSize,
6544
+ lineHeight: "22px",
6545
+ display: "flex",
6546
+ alignItems: "center",
6547
+ justifyContent: "center",
6548
+ height: "100%"
6549
+ }
6550
+ },
6551
+ ".ant-pagination-item": {
6552
+ borderRadius: token.borderRadius,
6553
+ minWidth: 32,
6554
+ height: 32,
6555
+ lineHeight: "32px",
6556
+ a: {
6557
+ color: token.colorText,
6558
+ fontWeight: 400,
6559
+ fontSize: token.fontSize
6560
+ }
6561
+ },
6562
+ ".ant-pagination-prev .ant-pagination-item-link, .ant-pagination-next .ant-pagination-item-link": {
6563
+ borderRadius: token.borderRadius,
6564
+ width: 32,
6565
+ height: 32,
6566
+ display: "flex",
6567
+ alignItems: "center",
6568
+ justifyContent: "center",
6569
+ border: "none",
6570
+ background: "transparent"
6571
+ }
5229
6572
  }
5230
6573
  }));
5231
- return wrapSSR(/* @__PURE__ */ jsxs("div", {
5232
- className: cx("root"),
6574
+ const mobileTagsList = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
6575
+ className: cx("body-mobile"),
6576
+ children: paginatedTags.map((tag, index) => {
6577
+ return /* @__PURE__ */ jsxs("div", {
6578
+ className: cx("tag-row-mobile", index === paginatedTags.length - 1 ? "tag-row-mobile-last" : ""),
6579
+ children: [/* @__PURE__ */ jsxs("div", {
6580
+ className: cx("tag-info-mobile"),
6581
+ children: [/* @__PURE__ */ jsxs("div", {
6582
+ className: cx("tag-col-mobile"),
6583
+ children: [/* @__PURE__ */ jsx("span", {
6584
+ className: cx("col-label"),
6585
+ style: {
6586
+ fontSize: token.fontSize,
6587
+ lineHeight: "20px"
6588
+ },
6589
+ children: "Tag Name:"
6590
+ }), /* @__PURE__ */ jsx("span", {
6591
+ className: cx("col-value"),
6592
+ style: {
6593
+ fontSize: token.fontSize,
6594
+ lineHeight: "20px",
6595
+ overflow: "hidden",
6596
+ textOverflow: "ellipsis",
6597
+ whiteSpace: "nowrap"
6598
+ },
6599
+ children: tag.name
6600
+ })]
6601
+ }), /* @__PURE__ */ jsxs("div", {
6602
+ className: cx("tag-col-mobile"),
6603
+ children: [/* @__PURE__ */ jsx("span", {
6604
+ className: cx("col-label"),
6605
+ style: {
6606
+ fontSize: token.fontSize,
6607
+ lineHeight: "20px"
6608
+ },
6609
+ children: "Description:"
6610
+ }), /* @__PURE__ */ jsx(Tooltip, {
6611
+ title: tag.description && tag.description.length > 20 ? tag.description : "",
6612
+ children: /* @__PURE__ */ jsx("span", {
6613
+ className: cx("col-value"),
6614
+ style: {
6615
+ fontSize: token.fontSize,
6616
+ lineHeight: "20px",
6617
+ overflow: "hidden",
6618
+ textOverflow: "ellipsis",
6619
+ whiteSpace: "nowrap",
6620
+ maxWidth: 140,
6621
+ display: "block"
6622
+ },
6623
+ children: tag.description ?? "-"
6624
+ })
6625
+ })]
6626
+ })]
6627
+ }), /* @__PURE__ */ jsxs("div", {
6628
+ className: cx("tag-actions"),
6629
+ style: {
6630
+ paddingTop: 6,
6631
+ flexShrink: 0
6632
+ },
6633
+ children: [/* @__PURE__ */ jsx(Tooltip, {
6634
+ title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
6635
+ children: /* @__PURE__ */ jsx(Button, {
6636
+ danger: true,
6637
+ type: "text",
6638
+ icon: /* @__PURE__ */ jsx(Trash, {
6639
+ width: 32,
6640
+ height: 32
6641
+ }),
6642
+ disabled: tag.isDefault,
6643
+ onClick: () => !tag.isDefault && onDeleteTag?.(tag.name),
6644
+ style: {
6645
+ width: 40,
6646
+ height: 40,
6647
+ padding: 0,
6648
+ lineHeight: 1
6649
+ }
6650
+ })
6651
+ }), /* @__PURE__ */ jsx(Tooltip, {
6652
+ title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
6653
+ children: /* @__PURE__ */ jsx(Button, {
6654
+ icon: /* @__PURE__ */ jsx(EditTag, {}),
6655
+ disabled: tag.isDefault,
6656
+ onClick: () => !tag.isDefault && onEditTag?.(tag),
6657
+ style: {
6658
+ width: 32,
6659
+ height: 32,
6660
+ padding: 0,
6661
+ lineHeight: 1,
6662
+ ...!tag.isDefault && { color: "#A146B3" }
6663
+ }
6664
+ })
6665
+ })]
6666
+ })]
6667
+ }, tag.name);
6668
+ })
6669
+ }), tags.length > TAGS_PAGE_SIZE && /* @__PURE__ */ jsx(Pagination, {
6670
+ current: safePage,
6671
+ pageSize: TAGS_PAGE_SIZE,
6672
+ total: tags.length,
6673
+ onChange: setCurrentPage,
6674
+ showSizeChanger: false,
6675
+ className: cx("pagination")
6676
+ })] });
6677
+ return wrapSSR(isMobile ? /* @__PURE__ */ jsxs("div", {
6678
+ style: { width: "100%" },
5233
6679
  children: [/* @__PURE__ */ jsxs("div", {
5234
- className: cx("head"),
6680
+ className: cx("head-collapse"),
5235
6681
  children: [/* @__PURE__ */ jsx(Title, {
5236
6682
  level: 4,
5237
6683
  style: {
@@ -5240,7 +6686,11 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
5240
6686
  },
5241
6687
  children: "Tags"
5242
6688
  }), /* @__PURE__ */ jsxs("div", {
5243
- className: cx("head-actions"),
6689
+ style: {
6690
+ display: "flex",
6691
+ alignItems: "center",
6692
+ gap: token.marginXS
6693
+ },
5244
6694
  children: [/* @__PURE__ */ jsx(Button, {
5245
6695
  ghost: true,
5246
6696
  type: "primary",
@@ -5259,208 +6709,149 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
5259
6709
  }
5260
6710
  })]
5261
6711
  })]
5262
- }), !collapsed && (isMobile ? /* @__PURE__ */ jsx("div", {
5263
- className: cx("body-mobile"),
5264
- children: tags.map((tag, index) => {
5265
- return /* @__PURE__ */ jsxs("div", {
5266
- className: cx("tag-row-mobile", index === tags.length - 1 ? "tag-row-mobile-last" : ""),
5267
- children: [/* @__PURE__ */ jsxs("div", {
5268
- className: cx("tag-info-mobile"),
6712
+ }), !collapsed && /* @__PURE__ */ jsx("div", {
6713
+ className: cx("body-collapse"),
6714
+ children: mobileTagsList
6715
+ })]
6716
+ }) : /* @__PURE__ */ jsxs("div", {
6717
+ className: cx("root"),
6718
+ children: [
6719
+ /* @__PURE__ */ jsxs("div", {
6720
+ className: cx("head"),
6721
+ children: [/* @__PURE__ */ jsx(Title, {
6722
+ level: 4,
6723
+ style: {
6724
+ margin: 0,
6725
+ color: token.colorTextHeading
6726
+ },
6727
+ children: "Tags"
6728
+ }), /* @__PURE__ */ jsx(Button, {
6729
+ ghost: true,
6730
+ type: "primary",
6731
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
6732
+ onClick: onAddTag,
6733
+ style: { borderRadius: token.borderRadius },
6734
+ children: "Add Tag"
6735
+ })]
6736
+ }),
6737
+ /* @__PURE__ */ jsx("div", {
6738
+ className: cx("tags-list"),
6739
+ children: paginatedTags.map((tag, index) => {
6740
+ return /* @__PURE__ */ jsxs("div", {
6741
+ className: cx("tag-row", index === paginatedTags.length - 1 ? "tag-row-last" : ""),
5269
6742
  children: [/* @__PURE__ */ jsxs("div", {
5270
- className: cx("tag-col-mobile"),
5271
- children: [/* @__PURE__ */ jsx("span", {
5272
- className: cx("col-label"),
5273
- style: {
5274
- fontSize: token.fontSize,
5275
- lineHeight: "20px"
5276
- },
5277
- children: "Tag Name:"
5278
- }), /* @__PURE__ */ jsx("span", {
5279
- className: cx("col-value"),
5280
- style: {
5281
- fontSize: token.fontSize,
5282
- lineHeight: "20px",
5283
- overflow: "hidden",
5284
- textOverflow: "ellipsis",
5285
- whiteSpace: "nowrap"
5286
- },
5287
- children: tag.name
5288
- })]
6743
+ className: cx("tag-info"),
6744
+ children: [
6745
+ /* @__PURE__ */ jsxs("div", {
6746
+ className: cx("tag-col"),
6747
+ style: { width: 200 },
6748
+ children: [/* @__PURE__ */ jsx("span", {
6749
+ className: cx("col-label"),
6750
+ children: "Tag Name"
6751
+ }), /* @__PURE__ */ jsx("span", {
6752
+ className: cx("col-value"),
6753
+ children: tag.name
6754
+ })]
6755
+ }),
6756
+ /* @__PURE__ */ jsxs("div", {
6757
+ className: cx("tag-col"),
6758
+ style: { width: 280 },
6759
+ children: [/* @__PURE__ */ jsx("span", {
6760
+ className: cx("col-label"),
6761
+ children: "Description"
6762
+ }), /* @__PURE__ */ jsx(Tooltip, {
6763
+ title: tag.description && tag.description.length > 30 ? tag.description : "",
6764
+ children: /* @__PURE__ */ jsx("span", {
6765
+ className: cx("col-value"),
6766
+ style: {
6767
+ overflow: "hidden",
6768
+ textOverflow: "ellipsis",
6769
+ whiteSpace: "nowrap",
6770
+ maxWidth: 280,
6771
+ display: "block"
6772
+ },
6773
+ children: tag.description ?? "-"
6774
+ })
6775
+ })]
6776
+ }),
6777
+ /* @__PURE__ */ jsxs("div", {
6778
+ className: cx("tag-col"),
6779
+ style: {
6780
+ flex: 1,
6781
+ minWidth: 0
6782
+ },
6783
+ children: [/* @__PURE__ */ jsx("span", {
6784
+ className: cx("col-label"),
6785
+ children: "External Docs"
6786
+ }), tag.externalDocsUrl ? /* @__PURE__ */ jsx(Tooltip, {
6787
+ title: tag.externalDocsUrl.length > 25 ? tag.externalDocsUrl : "",
6788
+ children: /* @__PURE__ */ jsx("a", {
6789
+ href: tag.externalDocsUrl,
6790
+ target: "_blank",
6791
+ rel: "noreferrer",
6792
+ className: cx("col-value-link"),
6793
+ style: {
6794
+ overflow: "hidden",
6795
+ textOverflow: "ellipsis",
6796
+ whiteSpace: "nowrap",
6797
+ display: "block"
6798
+ },
6799
+ children: tag.externalDocsUrl
6800
+ })
6801
+ }) : /* @__PURE__ */ jsx("span", {
6802
+ className: cx("col-value"),
6803
+ children: "-"
6804
+ })]
6805
+ })
6806
+ ]
5289
6807
  }), /* @__PURE__ */ jsxs("div", {
5290
- className: cx("tag-col-mobile"),
5291
- children: [/* @__PURE__ */ jsx("span", {
5292
- className: cx("col-label"),
5293
- style: {
5294
- fontSize: token.fontSize,
5295
- lineHeight: "20px"
5296
- },
5297
- children: "Description:"
6808
+ className: cx("tag-actions"),
6809
+ children: [/* @__PURE__ */ jsx(Tooltip, {
6810
+ title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
6811
+ children: /* @__PURE__ */ jsx(Button, {
6812
+ danger: true,
6813
+ type: "text",
6814
+ icon: /* @__PURE__ */ jsx(Trash, {
6815
+ width: 32,
6816
+ height: 32
6817
+ }),
6818
+ disabled: tag.isDefault,
6819
+ onClick: () => !tag.isDefault && onDeleteTag?.(tag.name),
6820
+ style: {
6821
+ width: 40,
6822
+ height: 40,
6823
+ padding: 0,
6824
+ lineHeight: 1
6825
+ }
6826
+ })
5298
6827
  }), /* @__PURE__ */ jsx(Tooltip, {
5299
- title: tag.description && tag.description.length > 20 ? tag.description : "",
5300
- children: /* @__PURE__ */ jsx("span", {
5301
- className: cx("col-value"),
6828
+ title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
6829
+ children: /* @__PURE__ */ jsx(Button, {
6830
+ icon: /* @__PURE__ */ jsx(EditTag, {}),
6831
+ disabled: tag.isDefault,
6832
+ onClick: () => !tag.isDefault && onEditTag?.(tag),
5302
6833
  style: {
5303
- fontSize: token.fontSize,
5304
- lineHeight: "20px",
5305
- overflow: "hidden",
5306
- textOverflow: "ellipsis",
5307
- whiteSpace: "nowrap",
5308
- maxWidth: 140,
5309
- display: "block"
5310
- },
5311
- children: tag.description ?? "-"
6834
+ width: 32,
6835
+ height: 32,
6836
+ padding: 0,
6837
+ lineHeight: 1,
6838
+ ...!tag.isDefault && { color: "#A146B3" }
6839
+ }
5312
6840
  })
5313
6841
  })]
5314
6842
  })]
5315
- }), /* @__PURE__ */ jsxs("div", {
5316
- className: cx("tag-actions"),
5317
- style: {
5318
- paddingTop: 6,
5319
- flexShrink: 0
5320
- },
5321
- children: [/* @__PURE__ */ jsx(Tooltip, {
5322
- title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
5323
- children: /* @__PURE__ */ jsx(Button, {
5324
- danger: true,
5325
- type: "text",
5326
- icon: /* @__PURE__ */ jsx(Trash, {
5327
- width: 32,
5328
- height: 32
5329
- }),
5330
- disabled: tag.isDefault,
5331
- onClick: () => !tag.isDefault && onDeleteTag?.(tag.name),
5332
- style: {
5333
- width: 40,
5334
- height: 40,
5335
- padding: 0,
5336
- lineHeight: 1
5337
- }
5338
- })
5339
- }), /* @__PURE__ */ jsx(Tooltip, {
5340
- title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
5341
- children: /* @__PURE__ */ jsx(Button, {
5342
- icon: /* @__PURE__ */ jsx(EditOutlined, { style: { fontSize: 18 } }),
5343
- disabled: tag.isDefault,
5344
- onClick: () => !tag.isDefault && onEditTag?.(tag),
5345
- style: {
5346
- width: 32,
5347
- height: 32,
5348
- padding: 0,
5349
- lineHeight: 1
5350
- }
5351
- })
5352
- })]
5353
- })]
5354
- }, tag.name);
5355
- })
5356
- }) : /* @__PURE__ */ jsx("div", {
5357
- className: cx("body"),
5358
- children: tags.map((tag, index) => {
5359
- return /* @__PURE__ */ jsxs("div", {
5360
- className: cx("tag-row", index === tags.length - 1 ? "tag-row-last" : ""),
5361
- children: [/* @__PURE__ */ jsxs("div", {
5362
- className: cx("tag-info"),
5363
- children: [
5364
- /* @__PURE__ */ jsxs("div", {
5365
- className: cx("tag-col"),
5366
- style: { width: 200 },
5367
- children: [/* @__PURE__ */ jsx("span", {
5368
- className: cx("col-label"),
5369
- children: "Tag Name"
5370
- }), /* @__PURE__ */ jsx("span", {
5371
- className: cx("col-value"),
5372
- children: tag.name
5373
- })]
5374
- }),
5375
- /* @__PURE__ */ jsxs("div", {
5376
- className: cx("tag-col"),
5377
- style: { width: 280 },
5378
- children: [/* @__PURE__ */ jsx("span", {
5379
- className: cx("col-label"),
5380
- children: "Description"
5381
- }), /* @__PURE__ */ jsx(Tooltip, {
5382
- title: tag.description && tag.description.length > 30 ? tag.description : "",
5383
- children: /* @__PURE__ */ jsx("span", {
5384
- className: cx("col-value"),
5385
- style: {
5386
- overflow: "hidden",
5387
- textOverflow: "ellipsis",
5388
- whiteSpace: "nowrap",
5389
- maxWidth: 280,
5390
- display: "block"
5391
- },
5392
- children: tag.description ?? "-"
5393
- })
5394
- })]
5395
- }),
5396
- /* @__PURE__ */ jsxs("div", {
5397
- className: cx("tag-col"),
5398
- style: {
5399
- flex: 1,
5400
- minWidth: 0
5401
- },
5402
- children: [/* @__PURE__ */ jsx("span", {
5403
- className: cx("col-label"),
5404
- children: "External Docs"
5405
- }), tag.externalDocsUrl ? /* @__PURE__ */ jsx(Tooltip, {
5406
- title: tag.externalDocsUrl.length > 25 ? tag.externalDocsUrl : "",
5407
- children: /* @__PURE__ */ jsx("a", {
5408
- href: tag.externalDocsUrl,
5409
- target: "_blank",
5410
- rel: "noreferrer",
5411
- className: cx("col-value-link"),
5412
- style: {
5413
- overflow: "hidden",
5414
- textOverflow: "ellipsis",
5415
- whiteSpace: "nowrap",
5416
- display: "block"
5417
- },
5418
- children: tag.externalDocsUrl
5419
- })
5420
- }) : /* @__PURE__ */ jsx("span", {
5421
- className: cx("col-value"),
5422
- children: "-"
5423
- })]
5424
- })
5425
- ]
5426
- }), /* @__PURE__ */ jsxs("div", {
5427
- className: cx("tag-actions"),
5428
- children: [/* @__PURE__ */ jsx(Tooltip, {
5429
- title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
5430
- children: /* @__PURE__ */ jsx(Button, {
5431
- danger: true,
5432
- type: "text",
5433
- icon: /* @__PURE__ */ jsx(Trash, {
5434
- width: 32,
5435
- height: 32
5436
- }),
5437
- disabled: tag.isDefault,
5438
- onClick: () => !tag.isDefault && onDeleteTag?.(tag.name),
5439
- style: {
5440
- width: 40,
5441
- height: 40,
5442
- padding: 0,
5443
- lineHeight: 1
5444
- }
5445
- })
5446
- }), /* @__PURE__ */ jsx(Tooltip, {
5447
- title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
5448
- children: /* @__PURE__ */ jsx(Button, {
5449
- icon: /* @__PURE__ */ jsx(EditOutlined, { style: { fontSize: 18 } }),
5450
- disabled: tag.isDefault,
5451
- onClick: () => !tag.isDefault && onEditTag?.(tag),
5452
- style: {
5453
- width: 32,
5454
- height: 32,
5455
- padding: 0,
5456
- lineHeight: 1
5457
- }
5458
- })
5459
- })]
5460
- })]
5461
- }, tag.name);
6843
+ }, tag.name);
6844
+ })
6845
+ }),
6846
+ tags.length > TAGS_PAGE_SIZE && /* @__PURE__ */ jsx(Pagination, {
6847
+ current: safePage,
6848
+ pageSize: TAGS_PAGE_SIZE,
6849
+ total: tags.length,
6850
+ onChange: setCurrentPage,
6851
+ showSizeChanger: false,
6852
+ className: cx("pagination")
5462
6853
  })
5463
- }))]
6854
+ ]
5464
6855
  }));
5465
6856
  };
5466
6857
  //#endregion
@@ -5604,13 +6995,6 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
5604
6995
  if (open && mode === "edit" && initialValues) form.setFieldsValue(initialValues);
5605
6996
  if (!open) form.resetFields();
5606
6997
  }, [open]);
5607
- useEffect(() => {
5608
- if (!extDocsDesc?.trim()) form.setFields([{
5609
- name: "externalDocsLink",
5610
- value: void 0,
5611
- errors: []
5612
- }]);
5613
- }, [extDocsDesc]);
5614
6998
  useEffect(() => {
5615
6999
  if (extDocsDesc?.trim()) form.validateFields(["externalDocsLink"]).catch(() => {});
5616
7000
  }, [extDocsLink, extDocsDesc]);
@@ -5766,7 +7150,14 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
5766
7150
  children: /* @__PURE__ */ jsx(Input, {
5767
7151
  showCount: true,
5768
7152
  maxLength: 25,
5769
- placeholder: "Describe External Docs"
7153
+ placeholder: "Describe External Docs",
7154
+ onChange: (e) => {
7155
+ if (!e.target.value?.trim()) form.setFields([{
7156
+ name: "externalDocsLink",
7157
+ value: void 0,
7158
+ errors: []
7159
+ }]);
7160
+ }
5770
7161
  })
5771
7162
  }),
5772
7163
  /* @__PURE__ */ jsx(Form.Item, {
@@ -5791,19 +7182,11 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
5791
7182
  return Promise.reject(/* @__PURE__ */ new Error("Please enter a valid URL"));
5792
7183
  }
5793
7184
  } }],
5794
- children: /* @__PURE__ */ jsx(Tooltip, {
5795
- title: !isLinkEnabled ? "You need to add the External Docs Description first." : "",
5796
- color: "rgba(0,0,0,0.85)",
5797
- placement: "topLeft",
5798
- children: /* @__PURE__ */ jsx(Input, {
5799
- showCount: true,
5800
- maxLength: 512,
5801
- placeholder: "External Docs Link",
5802
- disabled: !isLinkEnabled,
5803
- onChange: (e) => {
5804
- form.setFieldValue("externalDocsLink", e.target.value);
5805
- }
5806
- })
7185
+ children: /* @__PURE__ */ jsx(Input, {
7186
+ showCount: true,
7187
+ maxLength: 500,
7188
+ placeholder: "External Docs Link",
7189
+ disabled: !isLinkEnabled
5807
7190
  })
5808
7191
  })
5809
7192
  ]
@@ -5880,6 +7263,251 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
5880
7263
  })
5881
7264
  ] }));
5882
7265
  };
7266
+ //#endregion
7267
+ //#region src/assets/icons/restApi.tsx
7268
+ const RestApiIcon = (props) => /* @__PURE__ */ jsxs("svg", {
7269
+ width: "16",
7270
+ height: "16",
7271
+ viewBox: "0 0 16 16",
7272
+ fill: "none",
7273
+ xmlns: "http://www.w3.org/2000/svg",
7274
+ ...props,
7275
+ children: [/* @__PURE__ */ jsxs("g", {
7276
+ clipPath: "url(#restapi-clip)",
7277
+ children: [
7278
+ /* @__PURE__ */ jsx("path", {
7279
+ d: "M14.4059 7.73805H13.2601V7.23565C13.2601 7.11607 13.1787 7.01187 13.0626 6.98294L12.2915 6.79083L11.8883 5.81794L12.2975 5.13716C12.3591 5.03469 12.343 4.90341 12.2585 4.81888L11.1795 3.73987C11.0949 3.65531 10.9636 3.63922 10.8612 3.70081L10.1804 4.11003L9.20745 3.70685L9.01534 2.9357C8.98644 2.81966 8.88222 2.73823 8.76264 2.73823H8.26032V1.59245C8.26032 1.44862 8.14373 1.33203 7.9999 1.33203C7.85607 1.33203 7.73949 1.44862 7.73949 1.59245V2.73823H7.23709C7.11751 2.73823 7.01331 2.81966 6.98438 2.9357L6.79227 3.70685L5.81938 4.11003L5.1386 3.70081C5.03607 3.63919 4.90485 3.65529 4.82032 3.73987L3.74131 4.81888C3.65675 4.90344 3.64066 5.03471 3.70225 5.13716L4.11146 5.81794L3.70829 6.79083L2.93714 6.98294C2.8211 7.01185 2.73967 7.11607 2.73967 7.23565V7.73805H1.59391C1.45008 7.73805 1.3335 7.85463 1.3335 7.99846C1.3335 8.14226 1.45008 8.25888 1.59391 8.25888H2.73969V8.76128C2.73969 8.88086 2.82113 8.98508 2.93717 9.01396L3.70831 9.20609L4.11149 10.179L3.70225 10.8598C3.64063 10.9623 3.65675 11.0935 3.74131 11.1781L4.82032 12.2571C4.90488 12.3416 5.03615 12.3577 5.13865 12.2961L5.81941 11.8869L6.79232 12.2901L6.98443 13.0612C7.01334 13.1773 7.11756 13.2587 7.23714 13.2587H7.73951V14.4045C7.73951 14.5483 7.8561 14.6649 7.99993 14.6649C8.14376 14.6649 8.26034 14.5483 8.26034 14.4045V13.2587H8.76274C8.88232 13.2587 8.98652 13.1773 9.01545 13.0612L9.20756 12.2901L10.1805 11.8869L10.8612 12.2961C10.9637 12.3577 11.095 12.3416 11.1796 12.2571L12.2586 11.1781C12.3431 11.0935 12.3592 10.9622 12.2976 10.8598L11.8884 10.179L12.2916 9.20609L13.0627 9.01396C13.1788 8.98508 13.2602 8.88086 13.2602 8.76128V8.25888H14.406C14.5498 8.25888 14.6664 8.14226 14.6664 7.99846C14.6663 7.85463 14.5497 7.73805 14.4059 7.73805ZM12.7393 8.55779L12.0382 8.73247C11.9581 8.75245 11.8922 8.80919 11.8606 8.88547L11.3569 10.1009C11.3253 10.1772 11.3318 10.264 11.3743 10.3348L11.7463 10.9537L10.9551 11.7449L10.3362 11.3729C10.2654 11.3303 10.1786 11.3239 10.1023 11.3555L8.88686 11.8592C8.81058 11.8909 8.75383 11.9567 8.73386 12.0369L8.5592 12.7379H7.44055L7.26589 12.0369C7.24592 11.9567 7.18917 11.8909 7.1129 11.8592L5.89743 11.3555C5.82113 11.3239 5.73435 11.3303 5.66355 11.3729L5.04464 11.7449L4.25342 10.9537L4.62545 10.3348C4.668 10.264 4.67443 10.1772 4.64282 10.1009L4.13912 8.88547C4.10751 8.80919 4.04159 8.75245 3.96149 8.73247L3.26045 8.55779V7.43914L3.96152 7.26448C4.04162 7.2445 4.10753 7.18776 4.13915 7.11148L4.64284 5.89602C4.67446 5.81971 4.668 5.73294 4.62548 5.66216L4.25344 5.04325L5.04467 4.25203L5.66357 4.62406C5.73435 4.66661 5.82113 4.67307 5.89743 4.64143L7.1129 4.13773C7.18917 4.10612 7.24592 4.04021 7.26589 3.9601L7.44055 3.25904H8.5592L8.73386 3.9601C8.75383 4.04021 8.81058 4.10612 8.88686 4.13773L10.1023 4.64143C10.1787 4.67305 10.2654 4.66659 10.3362 4.62406L10.9551 4.25203L11.7463 5.04325L11.3743 5.66216C11.3317 5.73294 11.3253 5.81971 11.3569 5.89602L11.8606 7.11148C11.8922 7.18776 11.9581 7.2445 12.0382 7.26448L12.7393 7.43914V8.55779Z",
7280
+ fill: "currentColor"
7281
+ }),
7282
+ /* @__PURE__ */ jsx("path", {
7283
+ d: "M9.14809 4.86755C9.01309 4.81807 8.86346 4.88729 8.8139 5.02229C8.76434 5.15731 8.83364 5.30692 8.96864 5.35648C10.0712 5.76114 10.8121 6.82252 10.8121 7.99757C10.8121 9.54835 9.55041 10.81 7.99965 10.81C6.4489 10.81 5.18729 9.54833 5.18729 7.99755C5.18729 6.88567 5.84426 5.87593 6.86098 5.42515C6.99247 5.36687 7.05179 5.21302 6.99348 5.08156C6.9352 4.9501 6.78132 4.89075 6.64989 4.94906C5.44505 5.48325 4.6665 6.67987 4.6665 7.99755C4.6665 9.83546 6.16176 11.3308 7.99971 11.3308C9.83765 11.3308 11.3329 9.83546 11.3329 7.99755C11.3329 6.605 10.4549 5.34713 9.14809 4.86755Z",
7284
+ fill: "currentColor"
7285
+ }),
7286
+ /* @__PURE__ */ jsx("path", {
7287
+ d: "M8.01348 4.66409L7.99967 4.66406C7.85585 4.66406 7.73926 4.78065 7.73926 4.92448C7.73926 5.06831 7.85585 5.1849 7.99967 5.1849L8.01194 5.18492C8.0122 5.18492 8.01246 5.18492 8.01272 5.18492C8.15618 5.18492 8.2727 5.06883 8.27314 4.92526C8.27355 4.78143 8.1573 4.6645 8.01348 4.66409Z",
7288
+ fill: "currentColor"
7289
+ }),
7290
+ /* @__PURE__ */ jsx("path", {
7291
+ d: "M9.81413 6.96094C9.6703 6.96094 9.55371 7.07753 9.55371 7.22135V8.73919C9.55371 8.883 9.6703 8.99961 9.81413 8.99961C9.95796 8.99961 10.0745 8.883 10.0745 8.73919V7.22133C10.0745 7.0775 9.95796 6.96094 9.81413 6.96094Z",
7292
+ fill: "currentColor"
7293
+ }),
7294
+ /* @__PURE__ */ jsx("path", {
7295
+ d: "M8.55132 6.96094H8.01481C7.87098 6.96094 7.75439 7.07753 7.75439 7.22135V7.74057V8.09581V8.73917C7.75439 8.88297 7.87098 8.99958 8.01481 8.99958C8.15864 8.99958 8.27523 8.88297 8.27523 8.73917V8.35622H8.55135C8.91463 8.35622 9.2102 8.06063 9.2102 7.69737V7.61979C9.21018 7.25648 8.91463 6.96094 8.55132 6.96094ZM8.68937 7.69734C8.68937 7.77346 8.62744 7.83539 8.55132 7.83539H8.2752V7.74055V7.48172H8.55132C8.62744 7.48172 8.68937 7.54365 8.68937 7.61977V7.69734Z",
7296
+ fill: "currentColor"
7297
+ }),
7298
+ /* @__PURE__ */ jsx("path", {
7299
+ d: "M7.47523 8.67635L6.80685 7.1187C6.76581 7.02297 6.67169 6.96094 6.56755 6.96094C6.46341 6.96094 6.3693 7.02297 6.32823 7.11867L5.65984 8.67633C5.60312 8.80849 5.6643 8.96161 5.79648 9.01831C5.92867 9.075 6.08177 9.01385 6.13849 8.88169L6.56755 7.88172L6.99664 8.88169C7.03898 8.98039 7.13508 9.0395 7.23607 9.0395C7.27031 9.0395 7.30515 9.03268 7.33862 9.01833C7.47078 8.96164 7.53195 8.80852 7.47523 8.67635Z",
7300
+ fill: "currentColor"
7301
+ }),
7302
+ /* @__PURE__ */ jsx("path", {
7303
+ d: "M13.7813 1.33203C13.2931 1.33203 12.896 1.72919 12.896 2.21742C12.896 2.3668 12.9333 2.50755 12.9989 2.63107L12.0025 3.62737C11.9008 3.72906 11.9008 3.89396 12.0025 3.99565C12.0534 4.04648 12.1201 4.0719 12.1867 4.0719C12.2533 4.0719 12.32 4.04648 12.3708 3.99562L13.367 2.99951C13.4907 3.06531 13.6317 3.10279 13.7813 3.10279C14.2695 3.10279 14.6667 2.70562 14.6667 2.2174C14.6667 1.72917 14.2696 1.33203 13.7813 1.33203Z",
7304
+ fill: "currentColor"
7305
+ }),
7306
+ /* @__PURE__ */ jsx("path", {
7307
+ d: "M3.99712 12.002C3.89542 11.9004 3.73053 11.9004 3.62886 12.002L2.6329 12.998C2.50925 12.9323 2.36837 12.8949 2.21889 12.8949C1.73066 12.8949 1.3335 13.2921 1.3335 13.7803C1.3335 14.2685 1.73066 14.6657 2.21889 14.6657C2.70712 14.6657 3.10428 14.2685 3.10428 13.7803C3.10428 13.6308 3.06688 13.4899 3.00118 13.3663L3.99714 12.3703C4.09881 12.2686 4.09881 12.1037 3.99712 12.002Z",
7308
+ fill: "currentColor"
7309
+ }),
7310
+ /* @__PURE__ */ jsx("path", {
7311
+ d: "M12.3711 12.0021C12.3224 11.9536 12.2552 11.9258 12.1867 11.9258C12.1182 11.9258 12.051 11.9536 12.0026 12.0021C11.9541 12.0505 11.9263 12.1177 11.9263 12.1862C11.9263 12.2547 11.9541 12.3219 12.0026 12.3703C12.051 12.4187 12.1182 12.4466 12.1867 12.4466C12.2554 12.4466 12.3224 12.4187 12.3711 12.3703C12.4195 12.3219 12.4471 12.2549 12.4471 12.1862C12.4471 12.1177 12.4195 12.0505 12.3711 12.0021Z",
7312
+ fill: "currentColor"
7313
+ }),
7314
+ /* @__PURE__ */ jsx("path", {
7315
+ d: "M13.7813 12.8934C13.6316 12.8934 13.4906 12.9308 13.3669 12.9967L12.927 12.5567C12.8253 12.4551 12.6604 12.455 12.5587 12.5567C12.457 12.6584 12.457 12.8233 12.5587 12.925L12.9988 13.3651C12.9332 13.4887 12.8959 13.6294 12.8959 13.7788C12.8959 14.267 13.2931 14.6642 13.7813 14.6642C14.2695 14.6642 14.6666 14.267 14.6666 13.7788C14.6666 13.2905 14.2695 12.8934 13.7813 12.8934Z",
7316
+ fill: "currentColor"
7317
+ }),
7318
+ /* @__PURE__ */ jsx("path", {
7319
+ d: "M3.99712 3.62737L3.00118 2.63143C3.06688 2.50779 3.10428 2.3669 3.10428 2.21742C3.10428 1.72922 2.70712 1.33203 2.21889 1.33203C1.73066 1.33203 1.3335 1.72919 1.3335 2.21742C1.3335 2.70565 1.73066 3.10281 2.21889 3.10281C2.36839 3.10281 2.50928 3.06542 2.6329 2.99971L3.62886 3.99565C3.67972 4.04651 3.74636 4.07193 3.813 4.07193C3.87964 4.07193 3.94631 4.04651 3.99714 3.99565C4.09881 3.89396 4.09881 3.72906 3.99712 3.62737Z",
7320
+ fill: "currentColor"
7321
+ })
7322
+ ]
7323
+ }), /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", {
7324
+ id: "restapi-clip",
7325
+ children: /* @__PURE__ */ jsx("rect", {
7326
+ width: "13.3333",
7327
+ height: "13.3333",
7328
+ fill: "white",
7329
+ transform: "translate(1.3335 1.33203)"
7330
+ })
7331
+ }) })]
7332
+ });
7333
+ //#endregion
7334
+ //#region src/view/components/EditModeSidebar/index.tsx
7335
+ const EditModeSidebar = ({ selectedItem, onSelectItem, endpoints, hasGeneralError, hasSaveErrors }) => {
7336
+ const { wrapSSR, cx, token } = useStyle("EditModeSidebar", (token, scope) => ({
7337
+ [scope("root")]: {
7338
+ display: "flex",
7339
+ flexDirection: "column",
7340
+ gap: token.marginXS,
7341
+ padding: token.padding,
7342
+ backgroundColor: token.colorBgContainer,
7343
+ borderRadius: token.borderRadius,
7344
+ width: 320,
7345
+ minWidth: 320,
7346
+ flexShrink: 0,
7347
+ overflowY: "auto"
7348
+ },
7349
+ [scope("spec-icon")]: {
7350
+ fontSize: 16,
7351
+ color: token.colorTextSecondary,
7352
+ flexShrink: 0,
7353
+ display: "flex",
7354
+ alignItems: "center"
7355
+ },
7356
+ [scope("spec-label")]: {
7357
+ fontSize: token.fontSize,
7358
+ fontWeight: 400,
7359
+ color: token.colorText,
7360
+ lineHeight: "22px"
7361
+ },
7362
+ [scope("badge")]: {
7363
+ minWidth: "3.75rem",
7364
+ textAlign: "center",
7365
+ border: "none"
7366
+ },
7367
+ [scope("path")]: {
7368
+ fontSize: token.fontSize,
7369
+ fontWeight: 400,
7370
+ lineHeight: "22px",
7371
+ whiteSpace: "nowrap",
7372
+ overflow: "hidden",
7373
+ textOverflow: "ellipsis",
7374
+ flex: 1
7375
+ },
7376
+ [`${scope("root")} .ant-menu`]: {
7377
+ background: "transparent",
7378
+ border: "none",
7379
+ paddingInline: 0
7380
+ },
7381
+ [`${scope("root")} .ant-menu-item`]: {
7382
+ padding: `${token.paddingXS}px ${token.paddingLG}px`,
7383
+ borderRadius: token.borderRadius,
7384
+ height: "auto",
7385
+ lineHeight: "22px",
7386
+ display: "flex",
7387
+ alignItems: "center",
7388
+ gap: 12,
7389
+ marginInline: 0,
7390
+ marginBlock: 0,
7391
+ width: "100%",
7392
+ transition: "background-color 0.15s"
7393
+ },
7394
+ [`${scope("root")} .ant-menu-item:not(.ant-menu-item-selected):hover`]: { backgroundColor: token.colorFillTertiary },
7395
+ [`${scope("root")} .ant-menu-item-selected`]: { backgroundColor: token.colorPrimaryBg },
7396
+ [`${scope("root")} .ant-menu-item.error-active.ant-menu-item-selected`]: { backgroundColor: token.colorErrorBg },
7397
+ [`${scope("root")} .ant-menu-item-group-title`]: {
7398
+ fontSize: token.fontSize,
7399
+ fontWeight: 400,
7400
+ color: token.colorTextTertiary,
7401
+ lineHeight: "22px",
7402
+ paddingInline: 0,
7403
+ paddingTop: 0,
7404
+ paddingBottom: token.marginXXS,
7405
+ userSelect: "none"
7406
+ },
7407
+ [`${scope("root")} .ant-menu-item-group + .ant-menu-item-group`]: { marginTop: token.marginXS },
7408
+ [`${scope("spec-item")}:not(:last-child)`]: { marginBottom: token.marginXS },
7409
+ [`${scope("root")} .ant-menu-title-content`]: {
7410
+ overflow: "hidden",
7411
+ display: "flex",
7412
+ flex: 1,
7413
+ alignItems: "center",
7414
+ minWidth: 0,
7415
+ gap: 12
7416
+ },
7417
+ [`${scope("root")} .ant-menu-item-selected ${scope("spec-label")}`]: { color: token.colorPrimary }
7418
+ }));
7419
+ const selectedKeys = selectedItem.type === "endpoint" ? [selectedItem.key] : [selectedItem.type];
7420
+ const items = [{
7421
+ type: "group",
7422
+ label: "Specifications",
7423
+ children: [
7424
+ hasSaveErrors && {
7425
+ key: "errors",
7426
+ className: `${cx("spec-item")} error-active`,
7427
+ icon: /* @__PURE__ */ jsx("span", {
7428
+ className: cx("spec-icon"),
7429
+ style: { color: token.colorError },
7430
+ children: /* @__PURE__ */ jsx(ExclamationCircleOutlined, {})
7431
+ }),
7432
+ label: /* @__PURE__ */ jsx("span", {
7433
+ className: cx("spec-label"),
7434
+ style: { color: token.colorError },
7435
+ children: "Errors"
7436
+ })
7437
+ },
7438
+ {
7439
+ key: "general",
7440
+ className: cx("spec-item"),
7441
+ icon: /* @__PURE__ */ jsx("span", {
7442
+ className: cx("spec-icon"),
7443
+ style: hasGeneralError ? { color: token.colorError } : void 0,
7444
+ children: /* @__PURE__ */ jsx(RestApiIcon, {})
7445
+ }),
7446
+ label: /* @__PURE__ */ jsx("span", {
7447
+ className: cx("spec-label"),
7448
+ style: hasGeneralError ? { color: token.colorError } : void 0,
7449
+ children: "General"
7450
+ })
7451
+ },
7452
+ {
7453
+ key: "tags",
7454
+ className: cx("spec-item"),
7455
+ icon: /* @__PURE__ */ jsx("span", {
7456
+ className: cx("spec-icon"),
7457
+ children: /* @__PURE__ */ jsx(TagOutlined, {})
7458
+ }),
7459
+ label: /* @__PURE__ */ jsx("span", {
7460
+ className: cx("spec-label"),
7461
+ children: "Tags"
7462
+ })
7463
+ }
7464
+ ].filter(Boolean)
7465
+ }, {
7466
+ type: "group",
7467
+ label: "Endpoints",
7468
+ children: endpoints.map((ep) => {
7469
+ const colors = methodColors$1[ep.method];
7470
+ return {
7471
+ key: ep.id,
7472
+ label: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Tag, {
7473
+ className: cx("badge"),
7474
+ style: {
7475
+ backgroundColor: colors?.bg,
7476
+ color: colors?.color,
7477
+ border: "none"
7478
+ },
7479
+ children: ep.method
7480
+ }), /* @__PURE__ */ jsx("span", {
7481
+ className: cx("path"),
7482
+ style: { color: selectedItem.type === "endpoint" && selectedItem.key === ep.id ? token.colorPrimary : token.colorText },
7483
+ children: ep.path
7484
+ })] })
7485
+ };
7486
+ })
7487
+ }];
7488
+ const handleMenuClick = ({ key }) => {
7489
+ if (key === "errors") onSelectItem({ type: "errors" });
7490
+ else if (key === "general") onSelectItem({ type: "general" });
7491
+ else if (key === "tags") onSelectItem({ type: "tags" });
7492
+ else onSelectItem({
7493
+ type: "endpoint",
7494
+ key
7495
+ });
7496
+ };
7497
+ return wrapSSR(/* @__PURE__ */ jsx("div", {
7498
+ className: cx("root"),
7499
+ children: /* @__PURE__ */ jsx(Menu, {
7500
+ mode: "inline",
7501
+ selectedKeys,
7502
+ items,
7503
+ onClick: handleMenuClick,
7504
+ style: {
7505
+ background: "transparent",
7506
+ border: "none"
7507
+ }
7508
+ })
7509
+ }));
7510
+ };
5883
7511
  token.colorPrimary, token.colorSuccess, token.colorError, token.colorWarning, token["volcano.5"], token["geekblue.6"], token["purple.5"], token["volcano.4"];
5884
7512
  const darkerMethodColors = {
5885
7513
  GET: {
@@ -6321,10 +7949,7 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
6321
7949
  });
6322
7950
  if (isMobile) return wrapSSR(/* @__PURE__ */ jsx("aside", {
6323
7951
  className: cx("sider"),
6324
- style: {
6325
- width: "100%",
6326
- height: "100%"
6327
- },
7952
+ style: { height: "100%" },
6328
7953
  children: inner
6329
7954
  }));
6330
7955
  return wrapSSR(/* @__PURE__ */ jsx(Resizable, {
@@ -6352,6 +7977,47 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
6352
7977
  //#endregion
6353
7978
  //#region src/view/console/EndpointPage/EndpointPage.tsx
6354
7979
  const { Title: Title$1, Paragraph } = Typography;
7980
+ const MAX_VISIBLE_ENUMS = 2;
7981
+ const renderEnumTags = (enums, token) => {
7982
+ const tagStyle = {
7983
+ background: token.colorFillAlter,
7984
+ border: `1px solid ${token.colorBorder}`,
7985
+ borderRadius: token.borderRadiusSM
7986
+ };
7987
+ if (enums.length <= MAX_VISIBLE_ENUMS) return /* @__PURE__ */ jsx("span", {
7988
+ style: {
7989
+ display: "flex",
7990
+ flexWrap: "wrap",
7991
+ gap: token.marginXXS
7992
+ },
7993
+ children: enums.map((e) => /* @__PURE__ */ jsx(Tag, {
7994
+ style: tagStyle,
7995
+ children: e
7996
+ }, e))
7997
+ });
7998
+ const visible = enums.slice(0, MAX_VISIBLE_ENUMS);
7999
+ const hidden = enums.slice(MAX_VISIBLE_ENUMS);
8000
+ return /* @__PURE__ */ jsxs("span", {
8001
+ style: {
8002
+ display: "flex",
8003
+ flexWrap: "wrap",
8004
+ gap: token.marginXXS
8005
+ },
8006
+ children: [visible.map((e) => /* @__PURE__ */ jsx(Tag, {
8007
+ style: tagStyle,
8008
+ children: e
8009
+ }, e)), /* @__PURE__ */ jsx(Tooltip, {
8010
+ title: hidden.join(", "),
8011
+ children: /* @__PURE__ */ jsxs(Tag, {
8012
+ style: {
8013
+ ...tagStyle,
8014
+ cursor: "pointer"
8015
+ },
8016
+ children: ["+", hidden.length]
8017
+ })
8018
+ })]
8019
+ });
8020
+ };
6355
8021
  const requestColumns = [
6356
8022
  {
6357
8023
  title: "Parameter",
@@ -6394,7 +8060,7 @@ const buildRequestData = (params, token) => [...params].sort((a, b) => a.require
6394
8060
  })
6395
8061
  ] }),
6396
8062
  desc: p.description || "--",
6397
- enum: p.schema?.enum ? p.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
8063
+ enum: p.schema?.enum ? renderEnumTags(p.schema.enum, token) : "--"
6398
8064
  };
6399
8065
  });
6400
8066
  const buildHeaderData = (headers, token) => {
@@ -6423,7 +8089,7 @@ const buildHeaderData = (headers, token) => {
6423
8089
  })
6424
8090
  ] }, idx),
6425
8091
  desc: header.description || "--",
6426
- enum: header.schema?.enum ? header.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
8092
+ enum: header.schema?.enum ? renderEnumTags(header.schema.enum, token) : "--"
6427
8093
  };
6428
8094
  });
6429
8095
  };
@@ -6455,7 +8121,7 @@ const buildRequestBodyData = (requestBody, token) => {
6455
8121
  })
6456
8122
  ] }),
6457
8123
  desc: prop.description || "--",
6458
- enum: prop.enum ? prop.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
8124
+ enum: prop.enum ? renderEnumTags(prop.enum, token) : "--"
6459
8125
  }));
6460
8126
  };
6461
8127
  const EndpointPage = () => {
@@ -6497,8 +8163,7 @@ const EndpointPage = () => {
6497
8163
  ".ant-tabs-tab": { paddingTop: "0" }
6498
8164
  },
6499
8165
  "& .ant-table": { backgroundColor: `${token.colorBgBase} !important` },
6500
- "& .ant-table-thead > tr > th": { backgroundColor: `${token.colorBgBase} !important` },
6501
- "& .ant-table-tbody > tr > td": { backgroundColor: `${token.colorBgBase} !important` }
8166
+ "& .ant-table-thead > tr > th": { backgroundColor: `${token.colorBgBase} !important` }
6502
8167
  },
6503
8168
  [scope("row-odd")]: { "& > td": { background: `${token.colorBgElevated} !important` } },
6504
8169
  [scope("row-even")]: { "& > td": { background: `${token.colorBgLayout} !important` } }
@@ -6710,10 +8375,7 @@ const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage
6710
8375
  const { focusedContent, transformedData } = useStore(({ view }) => view);
6711
8376
  const { wrapSSR, cx, token } = useStyle("MainContent", (token, scope) => ({
6712
8377
  [scope("inner-doc-container")]: {
6713
- flex: 1,
6714
8378
  minWidth: 0,
6715
- height: "100%",
6716
- overflow: "auto",
6717
8379
  borderRadius: token.borderRadius,
6718
8380
  padding: token.paddingXL
6719
8381
  },
@@ -6819,13 +8481,7 @@ const Codebox$1 = ({ code, language, wrapLongLines }) => {
6819
8481
  const [appTheme] = useState("DARK");
6820
8482
  const { token, theme: themeConfig } = theme.useToken();
6821
8483
  const bodyBg = themeConfig.id == 1 ? token.colorBgContainer : "#1d2856";
6822
- const { cx } = useStyle("codeBox", (token, scope) => ({ [scope("codebox")]: {
6823
- borderRadius: token.borderRadius,
6824
- height: "100%",
6825
- maxHeight: "100%",
6826
- overflow: "auto",
6827
- pre: { height: "100%" }
6828
- } }));
8484
+ const { cx } = useStyle("codeBox", (token, scope) => ({ [scope("codebox")]: { borderRadius: token.borderRadius } }));
6829
8485
  return /* @__PURE__ */ jsx("div", {
6830
8486
  className: cx("codebox"),
6831
8487
  children: /* @__PURE__ */ jsx(Light, {
@@ -6837,7 +8493,6 @@ const Codebox$1 = ({ code, language, wrapLongLines }) => {
6837
8493
  customStyle: {
6838
8494
  margin: 0,
6839
8495
  minHeight: "3rem",
6840
- overflowY: "auto",
6841
8496
  padding: "0.75rem 1rem 0.75rem 1.5rem",
6842
8497
  backgroundColor: bodyBg,
6843
8498
  fontSize: "0.75rem"
@@ -7105,6 +8760,18 @@ const transformOpenApiToDocs = (api) => {
7105
8760
  content: resolvedContent
7106
8761
  };
7107
8762
  }
8763
+ if (entry.responses) {
8764
+ const resolvedResponses = {};
8765
+ for (const [code, responseValue] of Object.entries(entry.responses)) if (responseValue.content) {
8766
+ const resolvedContent = {};
8767
+ for (const [contentType, contentValue] of Object.entries(responseValue.content)) resolvedContent[contentType] = { schema: resolveSchema(contentValue.schema, api.components) ?? contentValue.schema };
8768
+ resolvedResponses[code] = {
8769
+ ...responseValue,
8770
+ content: resolvedContent
8771
+ };
8772
+ } else resolvedResponses[code] = responseValue;
8773
+ entry.responses = resolvedResponses;
8774
+ }
7108
8775
  const matchedTags = (methodData.tags ?? []).filter((tag) => validTags.has(tag));
7109
8776
  if (matchedTags.length > 0) matchedTags.forEach((tag) => {
7110
8777
  if (!groupedPathsByTags[tag]) groupedPathsByTags[tag] = [];
@@ -7147,14 +8814,23 @@ const transformOpenApiToDocs = (api) => {
7147
8814
  const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onSave }) => {
7148
8815
  const [searchValue, setSearchValue] = useState("");
7149
8816
  const [mode, setMode] = useState("edit");
7150
- const [hasChanges, setHasChanges] = useState(false);
7151
8817
  const [bannerVisible, setBannerVisible] = useState(false);
7152
8818
  const [resetKey, setResetKey] = useState(0);
7153
- const [generalCollapsed, setGeneralCollapsed] = useState(false);
7154
- const [tagsCollapsed, setTagsCollapsed] = useState(false);
8819
+ const [generalCollapsed, setGeneralCollapsed] = useState(true);
8820
+ const [tagsCollapsed, setTagsCollapsed] = useState(true);
7155
8821
  const [endpointsCollapsed, setEndpointsCollapsed] = useState(false);
8822
+ const [saveConfirmModal, setSaveConfirmModal] = useState(false);
8823
+ const [resetConfirmModal, setResetConfirmModal] = useState(false);
8824
+ const [selectedEditItem, setSelectedEditItem] = useState({ type: "general" });
8825
+ const [errorBoxExpanded, setErrorBoxExpanded] = useState(false);
7156
8826
  const [localApiName, setLocalApiName] = useState("");
8827
+ const [apiNameTouched, setApiNameTouched] = useState(false);
7157
8828
  const [localDescription, setLocalDescription] = useState("");
8829
+ const [descriptionTouched, setDescriptionTouched] = useState(false);
8830
+ const hasApiNameError = apiNameTouched && (!localApiName.trim() || !/^[A-Za-z0-9_-]+$/.test(localApiName.trim()));
8831
+ const hasDescriptionError = descriptionTouched && !localDescription.trim();
8832
+ const hasGeneralError = hasApiNameError || hasDescriptionError;
8833
+ const [saveErrors, setSaveErrors] = useState([]);
7158
8834
  const [selectedUrl, setSelectedUrl] = useState("");
7159
8835
  const [endpointNames, setEndpointNames] = useState({});
7160
8836
  const [endpointDescs, setEndpointDescs] = useState({});
@@ -7176,6 +8852,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7176
8852
  const hasInitializedRef = useRef(false);
7177
8853
  const { useBreakpoint } = Grid;
7178
8854
  const isMobile = !useBreakpoint().md;
8855
+ const allEndpoints = useMemo(() => selectedApi ? Object.values(selectedApi.tags ?? {}).flat() : [], [selectedApi]);
7179
8856
  useEffect(() => {
7180
8857
  return () => {
7181
8858
  resetStore();
@@ -7235,6 +8912,14 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7235
8912
  gap: token.marginLG,
7236
8913
  width: "100%"
7237
8914
  },
8915
+ [scope("content-scroll-area")]: {
8916
+ display: "grid",
8917
+ gridTemplateColumns: "minmax(0, 1fr) auto",
8918
+ flex: 1,
8919
+ gap: token.marginLG,
8920
+ overflow: "auto",
8921
+ minWidth: 0
8922
+ },
7238
8923
  [".delete-tag-confirm-modal .ant-modal-container"]: {
7239
8924
  "--ant-modal-content-padding": "0px !important",
7240
8925
  padding: "0 !important"
@@ -7313,15 +8998,18 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7313
8998
  }, [selectedApi]);
7314
8999
  const tagMetadata = useMemo(() => {
7315
9000
  if (!originalData || !selectedApi) return [];
7316
- const rawFile = originalData.find((f) => Object.keys(f.paths)[0] === selectedApi.contextPath);
7317
- if (!rawFile?.tags) return [];
7318
- return rawFile.tags.map((t) => ({
9001
+ const mapped = originalData.find((f) => Object.keys(f.paths)[0] === selectedApi.contextPath)?.tags?.map((t) => ({
7319
9002
  name: t.name,
7320
9003
  description: t.description,
7321
9004
  externalDocsUrl: t.externalDocs?.url,
7322
9005
  externalDocsDescription: t.externalDocs?.description,
7323
9006
  isDefault: t.name.toLowerCase() === "default"
7324
- }));
9007
+ })) ?? [];
9008
+ if (!mapped.some((t) => t.isDefault) && selectedApi.tags["default"]) mapped.push({
9009
+ name: "default",
9010
+ isDefault: true
9011
+ });
9012
+ return mapped;
7325
9013
  }, [originalData, selectedApi]);
7326
9014
  const initialEndpointResponseParams = useMemo(() => {
7327
9015
  if (!originalData || !selectedApi) return {};
@@ -7388,6 +9076,44 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7388
9076
  setEndpointParams(initialEndpointParams);
7389
9077
  setEndpointResponseParams(initialEndpointResponseParams);
7390
9078
  }, [selectedApi]);
9079
+ const hasChanges = useMemo(() => {
9080
+ if (!selectedApi) return false;
9081
+ if (localApiName !== (selectedApi.title || "")) return true;
9082
+ if (localDescription !== (selectedApi.description || "")) return true;
9083
+ if (JSON.stringify(localTags) !== JSON.stringify(tagMetadata)) return true;
9084
+ for (const [id, name] of Object.entries(endpointNames)) {
9085
+ const ep = allEndpoints.find((e) => e.id === id);
9086
+ if (ep && name !== (ep.summary ?? "")) return true;
9087
+ }
9088
+ for (const [id, desc] of Object.entries(endpointDescs)) {
9089
+ const ep = allEndpoints.find((e) => e.id === id);
9090
+ if (ep && desc !== (ep.description ?? "")) return true;
9091
+ }
9092
+ for (const [id, tags] of Object.entries(endpointTags)) {
9093
+ const ep = allEndpoints.find((e) => e.id === id);
9094
+ if (ep && JSON.stringify(tags) !== JSON.stringify(ep.tags ?? [])) return true;
9095
+ }
9096
+ if (JSON.stringify(endpointParams) !== JSON.stringify(initialEndpointParams)) return true;
9097
+ if (JSON.stringify(endpointResponseParams) !== JSON.stringify(initialEndpointResponseParams)) return true;
9098
+ return false;
9099
+ }, [
9100
+ selectedApi,
9101
+ localApiName,
9102
+ localDescription,
9103
+ localTags,
9104
+ tagMetadata,
9105
+ allEndpoints,
9106
+ endpointNames,
9107
+ endpointDescs,
9108
+ endpointTags,
9109
+ endpointParams,
9110
+ endpointResponseParams,
9111
+ initialEndpointParams,
9112
+ initialEndpointResponseParams
9113
+ ]);
9114
+ useEffect(() => {
9115
+ setBannerVisible(hasChanges);
9116
+ }, [hasChanges]);
7391
9117
  useEffect(() => {
7392
9118
  if (mode !== "view" || !selectedEndpoint) return;
7393
9119
  const epId = selectedEndpoint.id;
@@ -7438,7 +9164,6 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7438
9164
  isDefault: false
7439
9165
  };
7440
9166
  setLocalTags((prev) => [...prev, newTag]);
7441
- setHasChanges(true);
7442
9167
  setBannerVisible(true);
7443
9168
  };
7444
9169
  const handleUpdateTag = (updatedTag) => {
@@ -7450,7 +9175,6 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7450
9175
  externalDocsUrl: updatedTag.externalDocsLink,
7451
9176
  externalDocsDescription: updatedTag.externalDocsDescription
7452
9177
  } : t));
7453
- setHasChanges(true);
7454
9178
  setBannerVisible(true);
7455
9179
  };
7456
9180
  const handleDeleteTagConfirm = () => {
@@ -7460,7 +9184,6 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7460
9184
  open: false,
7461
9185
  tagName: ""
7462
9186
  });
7463
- setHasChanges(true);
7464
9187
  setBannerVisible(true);
7465
9188
  };
7466
9189
  const getEndpointsByTag = () => {
@@ -7480,8 +9203,10 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7480
9203
  return filtered;
7481
9204
  };
7482
9205
  const handleReset = () => {
7483
- setHasChanges(false);
7484
9206
  setBannerVisible(false);
9207
+ setApiNameTouched(false);
9208
+ setDescriptionTouched(false);
9209
+ setSaveErrors([]);
7485
9210
  setLocalApiName(selectedApi?.title ?? "");
7486
9211
  setLocalDescription(selectedApi?.description ?? "");
7487
9212
  setEndpointNames({});
@@ -7490,6 +9215,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7490
9215
  setEndpointParams(initialEndpointParams);
7491
9216
  setEndpointResponseParams(initialEndpointResponseParams);
7492
9217
  setResetKey((prev) => prev + 1);
9218
+ messageApi.success("Changes have been reset successfully.");
7493
9219
  };
7494
9220
  const handleSave = async () => {
7495
9221
  if (!selectedApi || !originalData) return;
@@ -7563,9 +9289,21 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7563
9289
  else delete methodObj["x-response-params"];
7564
9290
  }
7565
9291
  });
7566
- await onSave?.(cloned);
7567
- setHasChanges(false);
7568
- setBannerVisible(false);
9292
+ try {
9293
+ await onSave?.(cloned);
9294
+ setBannerVisible(false);
9295
+ setSaveErrors([]);
9296
+ messageApi.success("Changes have been saved and published successfully.");
9297
+ } catch (err) {
9298
+ let messages = [];
9299
+ if (err && typeof err === "object" && "errors" in err) {
9300
+ const e = err;
9301
+ messages = Array.isArray(e.errors) ? e.errors : [e.errors];
9302
+ } else if (err instanceof Error) messages = err.message.split("\n").filter(Boolean);
9303
+ else messages = [String(err)];
9304
+ setSaveErrors(messages);
9305
+ setSelectedEditItem({ type: "errors" });
9306
+ }
7569
9307
  };
7570
9308
  const handleResetSearch = () => {
7571
9309
  setSearchValue("");
@@ -7577,6 +9315,102 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7577
9315
  }
7578
9316
  window.location.pathname = "/";
7579
9317
  };
9318
+ useEffect(() => {
9319
+ setErrorBoxExpanded(false);
9320
+ }, [selectedEditItem]);
9321
+ const errorBox = saveErrors.length > 0 ? /* @__PURE__ */ jsxs("div", {
9322
+ style: {
9323
+ background: token.colorErrorBg,
9324
+ borderRadius: token.borderRadiusLG,
9325
+ padding: `${token.marginLG}px ${token.marginLG}px 48px`,
9326
+ width: "100%"
9327
+ },
9328
+ children: [
9329
+ /* @__PURE__ */ jsxs("div", {
9330
+ style: {
9331
+ display: "flex",
9332
+ alignItems: "center",
9333
+ gap: token.marginXS
9334
+ },
9335
+ children: [selectedEditItem.type !== "errors" && /* @__PURE__ */ jsx("button", {
9336
+ onClick: () => setErrorBoxExpanded((prev) => !prev),
9337
+ style: {
9338
+ display: "flex",
9339
+ alignItems: "center",
9340
+ background: "transparent",
9341
+ border: "none",
9342
+ cursor: "pointer",
9343
+ padding: 0,
9344
+ lineHeight: 1
9345
+ },
9346
+ "aria-label": "Collapse",
9347
+ children: /* @__PURE__ */ jsx(RightOutlined, { style: {
9348
+ fontSize: 14,
9349
+ color: token.colorError,
9350
+ transform: errorBoxExpanded ? "rotate(90deg)" : "none",
9351
+ transition: "transform 0.2s"
9352
+ } })
9353
+ }), /* @__PURE__ */ jsx(Title, {
9354
+ level: 3,
9355
+ style: {
9356
+ margin: 0,
9357
+ color: token.colorError
9358
+ },
9359
+ children: "Errors"
9360
+ })]
9361
+ }),
9362
+ /* @__PURE__ */ jsx("p", {
9363
+ style: {
9364
+ color: token.colorError,
9365
+ fontSize: 16,
9366
+ lineHeight: "24px",
9367
+ marginTop: token.marginXS,
9368
+ marginBottom: token.marginSM
9369
+ },
9370
+ children: "Failed to update the OpenAPI documentation. Please resolve the following issues:"
9371
+ }),
9372
+ /* @__PURE__ */ jsx(Divider, { style: { margin: `${token.marginSM}px 0` } }),
9373
+ /* @__PURE__ */ jsx("ol", {
9374
+ style: {
9375
+ paddingLeft: token.marginLG,
9376
+ margin: 0
9377
+ },
9378
+ children: saveErrors.map((msg, i) => /* @__PURE__ */ jsx("li", {
9379
+ style: {
9380
+ color: token.colorText,
9381
+ marginBottom: token.marginXS
9382
+ },
9383
+ children: msg
9384
+ }, i))
9385
+ })
9386
+ ]
9387
+ }) : null;
9388
+ const errorBoxCollapsed = saveErrors.length > 0 ? /* @__PURE__ */ jsxs("button", {
9389
+ onClick: () => setErrorBoxExpanded(true),
9390
+ style: {
9391
+ display: "flex",
9392
+ alignItems: "center",
9393
+ gap: token.marginXS,
9394
+ padding: `${token.paddingXS}px ${token.paddingLG}px`,
9395
+ background: token.colorErrorBg,
9396
+ borderRadius: token.borderRadiusLG,
9397
+ border: "none",
9398
+ cursor: "pointer",
9399
+ width: "100%",
9400
+ textAlign: "left"
9401
+ },
9402
+ children: [/* @__PURE__ */ jsx(RightOutlined, { style: {
9403
+ fontSize: 14,
9404
+ color: token.colorError
9405
+ } }), /* @__PURE__ */ jsx("span", {
9406
+ style: {
9407
+ color: token.colorError,
9408
+ fontSize: token.fontSizeLG,
9409
+ fontWeight: 600
9410
+ },
9411
+ children: "Errors"
9412
+ })]
9413
+ }) : null;
7580
9414
  const switcherNode = /* @__PURE__ */ jsxs("div", {
7581
9415
  style: {
7582
9416
  display: "flex",
@@ -7635,158 +9469,321 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7635
9469
  apiName: selectedApi?.title || "API",
7636
9470
  mode,
7637
9471
  onModeChange: setMode,
7638
- onReset: handleReset,
7639
- onSave: handleSave,
9472
+ onReset: () => setResetConfirmModal(true),
9473
+ onSave: () => setSaveConfirmModal(true),
7640
9474
  hasChanges,
9475
+ hasErrors: hasGeneralError,
7641
9476
  switcherNode: isMobile ? switcherNode : void 0
7642
9477
  })
7643
9478
  }),
7644
9479
  bannerVisible && /* @__PURE__ */ jsx(UnsavedChangesBanner, { onClose: () => setBannerVisible(false) }),
7645
- mode === "edit" ? /* @__PURE__ */ jsxs(Fragment, { children: [
7646
- /* @__PURE__ */ jsx("div", {
7647
- className: cx("section"),
7648
- children: /* @__PURE__ */ jsx(GeneralSection, {
7649
- apiName: localApiName,
7650
- authType: selectedApi?.authType || "",
7651
- version: selectedApi?.relatedVersions?.find((v) => v.apiId === selectedApi?.currentVersion)?.version || "",
7652
- description: localDescription,
7653
- onApiNameChange: setLocalApiName,
7654
- onDescriptionChange: setLocalDescription,
7655
- collapsed: generalCollapsed,
7656
- onToggleCollapse: () => setGeneralCollapsed((c) => !c),
7657
- onChangeDetected: () => {
7658
- setHasChanges(true);
7659
- setBannerVisible(true);
7660
- }
7661
- })
7662
- }),
7663
- /* @__PURE__ */ jsx("div", {
7664
- className: cx("section"),
7665
- children: /* @__PURE__ */ jsx(TagsSection, {
7666
- tags: localTags,
7667
- collapsed: tagsCollapsed,
7668
- onToggleCollapse: () => setTagsCollapsed((prev) => !prev),
7669
- onAddTag: () => setTagDrawerState({
7670
- open: true,
7671
- mode: "add"
9480
+ mode === "edit" ? /* @__PURE__ */ jsxs("div", {
9481
+ style: {
9482
+ display: "flex",
9483
+ gap: token.marginLG,
9484
+ flex: 1,
9485
+ minHeight: 0
9486
+ },
9487
+ children: [!isMobile && /* @__PURE__ */ jsx(EditModeSidebar, {
9488
+ selectedItem: selectedEditItem,
9489
+ onSelectItem: setSelectedEditItem,
9490
+ endpoints: allEndpoints,
9491
+ hasGeneralError,
9492
+ hasSaveErrors: saveErrors.length > 0
9493
+ }), /* @__PURE__ */ jsx("div", {
9494
+ style: {
9495
+ display: "flex",
9496
+ flexDirection: "column",
9497
+ gap: token.marginLG,
9498
+ flex: 1,
9499
+ overflow: "auto"
9500
+ },
9501
+ children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [
9502
+ errorBox && /* @__PURE__ */ jsx("div", {
9503
+ className: cx("section"),
9504
+ children: errorBox
7672
9505
  }),
7673
- onEditTag: (tag) => setTagDrawerState({
7674
- open: true,
7675
- mode: "edit",
7676
- initialValues: {
7677
- name: tag.name,
7678
- description: tag.description,
7679
- externalDocsDescription: tag.externalDocsDescription,
7680
- externalDocsLink: tag.externalDocsUrl
7681
- }
9506
+ /* @__PURE__ */ jsx("div", {
9507
+ className: cx("section"),
9508
+ children: /* @__PURE__ */ jsx(GeneralSection, {
9509
+ apiName: localApiName,
9510
+ authType: selectedApi?.authType || "",
9511
+ version: selectedApi?.relatedVersions?.find((v) => v.apiId === selectedApi?.currentVersion)?.version || "",
9512
+ description: localDescription,
9513
+ onApiNameChange: (val) => {
9514
+ setApiNameTouched(true);
9515
+ setLocalApiName(val);
9516
+ },
9517
+ apiNameError: hasApiNameError,
9518
+ onDescriptionChange: (val) => {
9519
+ setDescriptionTouched(true);
9520
+ setLocalDescription(val);
9521
+ },
9522
+ descriptionError: hasDescriptionError,
9523
+ collapsed: generalCollapsed,
9524
+ onToggleCollapse: () => setGeneralCollapsed((c) => !c),
9525
+ onChangeDetected: () => {
9526
+ setBannerVisible(true);
9527
+ }
9528
+ })
9529
+ }),
9530
+ /* @__PURE__ */ jsx("div", {
9531
+ className: cx("section"),
9532
+ children: /* @__PURE__ */ jsx(TagsSection, {
9533
+ tags: localTags,
9534
+ collapsed: tagsCollapsed,
9535
+ onToggleCollapse: () => setTagsCollapsed((prev) => !prev),
9536
+ onAddTag: () => setTagDrawerState({
9537
+ open: true,
9538
+ mode: "add"
9539
+ }),
9540
+ onEditTag: (tag) => setTagDrawerState({
9541
+ open: true,
9542
+ mode: "edit",
9543
+ initialValues: {
9544
+ name: tag.name,
9545
+ description: tag.description,
9546
+ externalDocsDescription: tag.externalDocsDescription,
9547
+ externalDocsLink: tag.externalDocsUrl
9548
+ }
9549
+ }),
9550
+ onDeleteTag: (tagName) => setDeleteTagModal({
9551
+ open: true,
9552
+ tagName
9553
+ })
9554
+ })
7682
9555
  }),
7683
- onDeleteTag: (tagName) => setDeleteTagModal({
7684
- open: true,
7685
- tagName
9556
+ /* @__PURE__ */ jsx("div", {
9557
+ className: cx("section"),
9558
+ children: /* @__PURE__ */ jsx(EndpointsSection, {
9559
+ mode,
9560
+ endpointsByTag: getEndpointsByTag(),
9561
+ collapsed: endpointsCollapsed,
9562
+ onToggleCollapse: () => setEndpointsCollapsed((c) => !c),
9563
+ endpointNames,
9564
+ endpointDescs,
9565
+ endpointTags,
9566
+ availableTags: localTags.map((t) => t.name),
9567
+ onEndpointNameChange: (id, val) => {
9568
+ setEndpointNames((prev) => ({
9569
+ ...prev,
9570
+ [id]: val
9571
+ }));
9572
+ setBannerVisible(true);
9573
+ },
9574
+ onEndpointDescChange: (id, val) => {
9575
+ setEndpointDescs((prev) => ({
9576
+ ...prev,
9577
+ [id]: val
9578
+ }));
9579
+ setBannerVisible(true);
9580
+ },
9581
+ onEndpointTagsChange: (id, val) => {
9582
+ setEndpointTags((prev) => ({
9583
+ ...prev,
9584
+ [id]: val
9585
+ }));
9586
+ setBannerVisible(true);
9587
+ },
9588
+ endpointParams,
9589
+ onAddParameter: (endpointId, param) => {
9590
+ setEndpointParams((prev) => ({
9591
+ ...prev,
9592
+ [endpointId]: [...prev[endpointId] ?? [], param]
9593
+ }));
9594
+ setBannerVisible(true);
9595
+ },
9596
+ onEditParameter: (endpointId, idx, param) => {
9597
+ setEndpointParams((prev) => ({
9598
+ ...prev,
9599
+ [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
9600
+ }));
9601
+ setBannerVisible(true);
9602
+ },
9603
+ onDeleteParameter: (endpointId, idx) => {
9604
+ setEndpointParams((prev) => ({
9605
+ ...prev,
9606
+ [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
9607
+ }));
9608
+ setBannerVisible(true);
9609
+ },
9610
+ endpointResponseParams,
9611
+ onAddResponseParameter: (endpointId, param) => {
9612
+ setEndpointResponseParams((prev) => ({
9613
+ ...prev,
9614
+ [endpointId]: [...prev[endpointId] ?? [], param]
9615
+ }));
9616
+ setBannerVisible(true);
9617
+ },
9618
+ onEditResponseParameter: (endpointId, idx, param) => {
9619
+ setEndpointResponseParams((prev) => ({
9620
+ ...prev,
9621
+ [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
9622
+ }));
9623
+ setBannerVisible(true);
9624
+ },
9625
+ onDeleteResponseParameter: (endpointId, idx) => {
9626
+ setEndpointResponseParams((prev) => ({
9627
+ ...prev,
9628
+ [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
9629
+ }));
9630
+ setBannerVisible(true);
9631
+ }
9632
+ }, resetKey)
7686
9633
  })
7687
- })
7688
- }),
7689
- /* @__PURE__ */ jsx("div", {
7690
- className: cx("section"),
7691
- children: /* @__PURE__ */ jsx(EndpointsSection, {
7692
- mode,
7693
- endpointsByTag: getEndpointsByTag(),
7694
- collapsed: endpointsCollapsed,
7695
- onToggleCollapse: () => setEndpointsCollapsed((c) => !c),
7696
- endpointNames,
7697
- endpointDescs,
7698
- endpointTags,
7699
- availableTags: localTags.map((t) => t.name),
7700
- onEndpointNameChange: (id, val) => {
7701
- setEndpointNames((prev) => ({
7702
- ...prev,
7703
- [id]: val
7704
- }));
7705
- setHasChanges(true);
7706
- setBannerVisible(true);
7707
- },
7708
- onEndpointDescChange: (id, val) => {
7709
- setEndpointDescs((prev) => ({
7710
- ...prev,
7711
- [id]: val
7712
- }));
7713
- setHasChanges(true);
7714
- setBannerVisible(true);
7715
- },
7716
- onEndpointTagsChange: (id, val) => {
7717
- setEndpointTags((prev) => ({
7718
- ...prev,
7719
- [id]: val
7720
- }));
7721
- setHasChanges(true);
7722
- setBannerVisible(true);
7723
- },
7724
- endpointParams,
7725
- onAddParameter: (endpointId, param) => {
7726
- setEndpointParams((prev) => ({
7727
- ...prev,
7728
- [endpointId]: [...prev[endpointId] ?? [], param]
7729
- }));
7730
- setHasChanges(true);
7731
- setBannerVisible(true);
7732
- },
7733
- onEditParameter: (endpointId, idx, param) => {
7734
- setEndpointParams((prev) => ({
7735
- ...prev,
7736
- [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
7737
- }));
7738
- setHasChanges(true);
7739
- setBannerVisible(true);
7740
- },
7741
- onDeleteParameter: (endpointId, idx) => {
7742
- setEndpointParams((prev) => ({
7743
- ...prev,
7744
- [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
7745
- }));
7746
- setHasChanges(true);
7747
- setBannerVisible(true);
7748
- },
7749
- endpointResponseParams,
7750
- onAddResponseParameter: (endpointId, param) => {
7751
- setEndpointResponseParams((prev) => ({
7752
- ...prev,
7753
- [endpointId]: [...prev[endpointId] ?? [], param]
7754
- }));
7755
- setHasChanges(true);
7756
- setBannerVisible(true);
7757
- },
7758
- onEditResponseParameter: (endpointId, idx, param) => {
7759
- setEndpointResponseParams((prev) => ({
7760
- ...prev,
7761
- [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
7762
- }));
7763
- setHasChanges(true);
7764
- setBannerVisible(true);
7765
- },
7766
- onDeleteResponseParameter: (endpointId, idx) => {
7767
- setEndpointResponseParams((prev) => ({
7768
- ...prev,
7769
- [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
7770
- }));
7771
- setHasChanges(true);
7772
- setBannerVisible(true);
7773
- }
7774
- }, resetKey)
7775
- })
7776
- ] }) : /* @__PURE__ */ jsxs("div", {
9634
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
9635
+ selectedEditItem.type === "errors" && errorBox && /* @__PURE__ */ jsx("div", {
9636
+ className: cx("section"),
9637
+ children: errorBox
9638
+ }),
9639
+ selectedEditItem.type !== "errors" && /* @__PURE__ */ jsx(Fragment, { children: errorBoxExpanded && errorBox ? /* @__PURE__ */ jsx("div", {
9640
+ className: cx("section"),
9641
+ children: errorBox
9642
+ }) : errorBoxCollapsed && /* @__PURE__ */ jsx("div", {
9643
+ className: cx("section"),
9644
+ children: errorBoxCollapsed
9645
+ }) }),
9646
+ selectedEditItem.type === "general" && /* @__PURE__ */ jsx("div", {
9647
+ className: cx("section"),
9648
+ children: /* @__PURE__ */ jsx(GeneralSection, {
9649
+ apiName: localApiName,
9650
+ authType: selectedApi?.authType || "",
9651
+ version: selectedApi?.relatedVersions?.find((v) => v.apiId === selectedApi?.currentVersion)?.version || "",
9652
+ description: localDescription,
9653
+ onApiNameChange: (val) => {
9654
+ setApiNameTouched(true);
9655
+ setLocalApiName(val);
9656
+ },
9657
+ apiNameError: hasApiNameError,
9658
+ onDescriptionChange: (val) => {
9659
+ setDescriptionTouched(true);
9660
+ setLocalDescription(val);
9661
+ },
9662
+ descriptionError: hasDescriptionError,
9663
+ collapsed: generalCollapsed,
9664
+ onToggleCollapse: () => setGeneralCollapsed((c) => !c),
9665
+ onChangeDetected: () => {
9666
+ setBannerVisible(true);
9667
+ }
9668
+ })
9669
+ }),
9670
+ selectedEditItem.type === "tags" && /* @__PURE__ */ jsx("div", {
9671
+ className: cx("section"),
9672
+ children: /* @__PURE__ */ jsx(TagsSection, {
9673
+ tags: localTags,
9674
+ collapsed: tagsCollapsed,
9675
+ onToggleCollapse: () => setTagsCollapsed((prev) => !prev),
9676
+ onAddTag: () => setTagDrawerState({
9677
+ open: true,
9678
+ mode: "add"
9679
+ }),
9680
+ onEditTag: (tag) => setTagDrawerState({
9681
+ open: true,
9682
+ mode: "edit",
9683
+ initialValues: {
9684
+ name: tag.name,
9685
+ description: tag.description,
9686
+ externalDocsDescription: tag.externalDocsDescription,
9687
+ externalDocsLink: tag.externalDocsUrl
9688
+ }
9689
+ }),
9690
+ onDeleteTag: (tagName) => setDeleteTagModal({
9691
+ open: true,
9692
+ tagName
9693
+ })
9694
+ })
9695
+ }),
9696
+ selectedEditItem.type === "endpoint" && /* @__PURE__ */ jsx(EndpointsSection, {
9697
+ mode,
9698
+ endpointsByTag: getEndpointsByTag(),
9699
+ selectedEndpointKey: selectedEditItem.key,
9700
+ collapsed: endpointsCollapsed,
9701
+ onToggleCollapse: () => setEndpointsCollapsed((c) => !c),
9702
+ endpointNames,
9703
+ endpointDescs,
9704
+ endpointTags,
9705
+ availableTags: localTags.map((t) => t.name),
9706
+ onEndpointNameChange: (id, val) => {
9707
+ setEndpointNames((prev) => ({
9708
+ ...prev,
9709
+ [id]: val
9710
+ }));
9711
+ setBannerVisible(true);
9712
+ },
9713
+ onEndpointDescChange: (id, val) => {
9714
+ setEndpointDescs((prev) => ({
9715
+ ...prev,
9716
+ [id]: val
9717
+ }));
9718
+ setBannerVisible(true);
9719
+ },
9720
+ onEndpointTagsChange: (id, val) => {
9721
+ setEndpointTags((prev) => ({
9722
+ ...prev,
9723
+ [id]: val
9724
+ }));
9725
+ setBannerVisible(true);
9726
+ },
9727
+ endpointParams,
9728
+ onAddParameter: (endpointId, param) => {
9729
+ setEndpointParams((prev) => ({
9730
+ ...prev,
9731
+ [endpointId]: [...prev[endpointId] ?? [], param]
9732
+ }));
9733
+ setBannerVisible(true);
9734
+ },
9735
+ onEditParameter: (endpointId, idx, param) => {
9736
+ setEndpointParams((prev) => ({
9737
+ ...prev,
9738
+ [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
9739
+ }));
9740
+ setBannerVisible(true);
9741
+ },
9742
+ onDeleteParameter: (endpointId, idx) => {
9743
+ setEndpointParams((prev) => ({
9744
+ ...prev,
9745
+ [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
9746
+ }));
9747
+ setBannerVisible(true);
9748
+ },
9749
+ endpointResponseParams,
9750
+ onAddResponseParameter: (endpointId, param) => {
9751
+ setEndpointResponseParams((prev) => ({
9752
+ ...prev,
9753
+ [endpointId]: [...prev[endpointId] ?? [], param]
9754
+ }));
9755
+ setBannerVisible(true);
9756
+ },
9757
+ onEditResponseParameter: (endpointId, idx, param) => {
9758
+ setEndpointResponseParams((prev) => ({
9759
+ ...prev,
9760
+ [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
9761
+ }));
9762
+ setBannerVisible(true);
9763
+ },
9764
+ onDeleteResponseParameter: (endpointId, idx) => {
9765
+ setEndpointResponseParams((prev) => ({
9766
+ ...prev,
9767
+ [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
9768
+ }));
9769
+ setBannerVisible(true);
9770
+ }
9771
+ }, resetKey)
9772
+ ] })
9773
+ })]
9774
+ }) : /* @__PURE__ */ jsxs("div", {
7777
9775
  className: cx("docs-layout"),
7778
- children: [
7779
- /* @__PURE__ */ jsx(Sidebar, {
7780
- searchValue,
7781
- setSearchValue
7782
- }),
7783
- /* @__PURE__ */ jsx(MainContent, {
9776
+ children: [/* @__PURE__ */ jsx(Sidebar, {
9777
+ searchValue,
9778
+ setSearchValue
9779
+ }), /* @__PURE__ */ jsxs("div", {
9780
+ className: cx("content-scroll-area"),
9781
+ children: [/* @__PURE__ */ jsx(MainContent, {
7784
9782
  handleVisitLandingPage: _handleVisitLandingPage,
7785
9783
  handleResetSearch,
7786
9784
  searchEnabled: !!searchValue
7787
- }),
7788
- !isMobile && focusedContent === "ENDPOINT" && /* @__PURE__ */ jsx(CodeboxSidebar$1, {})
7789
- ]
9785
+ }), !isMobile && focusedContent === "ENDPOINT" && /* @__PURE__ */ jsx(CodeboxSidebar$1, {})]
9786
+ })]
7790
9787
  }),
7791
9788
  /* @__PURE__ */ jsx(AddTagDrawer, {
7792
9789
  open: tagDrawerState.open,
@@ -7799,6 +9796,144 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7799
9796
  onAddTag: handleAddTag,
7800
9797
  onEditTag: handleUpdateTag
7801
9798
  }),
9799
+ /* @__PURE__ */ jsxs(Modal, {
9800
+ open: saveConfirmModal,
9801
+ onCancel: () => setSaveConfirmModal(false),
9802
+ centered: true,
9803
+ title: null,
9804
+ footer: null,
9805
+ closable: false,
9806
+ width: 520,
9807
+ className: "delete-tag-confirm-modal",
9808
+ styles: {
9809
+ content: {
9810
+ padding: 0,
9811
+ borderRadius: 8,
9812
+ overflow: "hidden"
9813
+ },
9814
+ body: {
9815
+ padding: 0,
9816
+ margin: 0
9817
+ }
9818
+ },
9819
+ children: [
9820
+ /* @__PURE__ */ jsxs("div", {
9821
+ className: cx("deleteModalHead"),
9822
+ children: [/* @__PURE__ */ jsx("span", {
9823
+ className: cx("deleteModalTitle"),
9824
+ children: "Save & Publish Changes"
9825
+ }), /* @__PURE__ */ jsx("button", {
9826
+ className: cx("deleteModalCloseBtn"),
9827
+ onClick: () => setSaveConfirmModal(false),
9828
+ "aria-label": "Close",
9829
+ children: "×"
9830
+ })]
9831
+ }),
9832
+ /* @__PURE__ */ jsx("div", {
9833
+ className: cx("deleteModalContent"),
9834
+ children: /* @__PURE__ */ jsx("span", {
9835
+ className: cx("deleteModalContentText"),
9836
+ children: "Are you sure you want to Save & Publish Changes?"
9837
+ })
9838
+ }),
9839
+ /* @__PURE__ */ jsxs("div", {
9840
+ className: cx("deleteModalFooter"),
9841
+ children: [/* @__PURE__ */ jsx(Button, {
9842
+ size: "middle",
9843
+ onClick: () => setSaveConfirmModal(false),
9844
+ style: {
9845
+ borderRadius: 8,
9846
+ height: 32,
9847
+ paddingInline: 15
9848
+ },
9849
+ children: "Cancel"
9850
+ }), /* @__PURE__ */ jsx(Button, {
9851
+ type: "primary",
9852
+ size: "middle",
9853
+ onClick: () => {
9854
+ setSaveConfirmModal(false);
9855
+ handleSave();
9856
+ },
9857
+ style: {
9858
+ borderRadius: 8,
9859
+ height: 32,
9860
+ paddingInline: 16
9861
+ },
9862
+ children: "Yes, Save & Publish"
9863
+ })]
9864
+ })
9865
+ ]
9866
+ }),
9867
+ /* @__PURE__ */ jsxs(Modal, {
9868
+ open: resetConfirmModal,
9869
+ onCancel: () => setResetConfirmModal(false),
9870
+ centered: true,
9871
+ title: null,
9872
+ footer: null,
9873
+ closable: false,
9874
+ width: 520,
9875
+ className: "delete-tag-confirm-modal",
9876
+ styles: {
9877
+ content: {
9878
+ padding: 0,
9879
+ borderRadius: 8,
9880
+ overflow: "hidden"
9881
+ },
9882
+ body: {
9883
+ padding: 0,
9884
+ margin: 0
9885
+ }
9886
+ },
9887
+ children: [
9888
+ /* @__PURE__ */ jsxs("div", {
9889
+ className: cx("deleteModalHead"),
9890
+ children: [/* @__PURE__ */ jsx("span", {
9891
+ className: cx("deleteModalTitle"),
9892
+ children: "Reset changes?"
9893
+ }), /* @__PURE__ */ jsx("button", {
9894
+ className: cx("deleteModalCloseBtn"),
9895
+ onClick: () => setResetConfirmModal(false),
9896
+ "aria-label": "Close",
9897
+ children: "×"
9898
+ })]
9899
+ }),
9900
+ /* @__PURE__ */ jsx("div", {
9901
+ className: cx("deleteModalContent"),
9902
+ children: /* @__PURE__ */ jsx("span", {
9903
+ className: cx("deleteModalContentText"),
9904
+ children: "This will discard your unsaved changes."
9905
+ })
9906
+ }),
9907
+ /* @__PURE__ */ jsxs("div", {
9908
+ className: cx("deleteModalFooter"),
9909
+ children: [/* @__PURE__ */ jsx(Button, {
9910
+ size: "middle",
9911
+ onClick: () => setResetConfirmModal(false),
9912
+ style: {
9913
+ borderRadius: 8,
9914
+ height: 32,
9915
+ paddingInline: 15
9916
+ },
9917
+ children: "Cancel"
9918
+ }), /* @__PURE__ */ jsx(Button, {
9919
+ size: "middle",
9920
+ onClick: () => {
9921
+ setResetConfirmModal(false);
9922
+ handleReset();
9923
+ },
9924
+ style: {
9925
+ borderRadius: 8,
9926
+ height: 32,
9927
+ paddingInline: 16,
9928
+ backgroundColor: "#faad14",
9929
+ borderColor: "#faad14",
9930
+ color: "#fff"
9931
+ },
9932
+ children: "Yes, Reset"
9933
+ })]
9934
+ })
9935
+ ]
9936
+ }),
7802
9937
  /* @__PURE__ */ jsxs(Modal, {
7803
9938
  open: deleteTagModal.open,
7804
9939
  onCancel: () => setDeleteTagModal({