@prorobotech/openapi-k8s-toolkit 1.1.0-alpha.11 → 1.1.0-alpha.12
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/openapi-k8s-toolkit.es.js +1122 -828
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +1121 -827
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/api/forms.d.ts +4 -0
- package/dist/types/components/molecules/BlackholeForm/index.d.ts +0 -1
- package/dist/types/components/molecules/BlackholeForm/molecules/index.d.ts +0 -1
- package/dist/types/components/molecules/{BlackholeForm/molecules/YamlEditorSingleton → YamlEditorSingleton}/YamlEditorSingleton.d.ts +1 -1
- package/dist/types/components/molecules/index.d.ts +2 -1
- package/dist/types/components/organisms/DynamicComponents/molecules/Toggler/Toggler.d.ts +6 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/Toggler/index.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/TogglerSegmented/TogglerSegmented.d.ts +6 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/TogglerSegmented/index.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/index.d.ts +2 -0
- package/dist/types/components/organisms/DynamicComponents/types.d.ts +39 -0
- package/package.json +1 -1
- /package/dist/types/components/molecules/{BlackholeForm/molecules/YamlEditorSingleton → YamlEditorSingleton}/index.d.ts +0 -0
- /package/dist/types/components/molecules/{BlackholeForm/molecules/YamlEditorSingleton → YamlEditorSingleton}/styled.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled, { createGlobalStyle } from 'styled-components';
|
|
2
2
|
import K, { useState, useRef, useLayoutEffect, useReducer, useEffect, useCallback, useMemo, Fragment, createContext, useContext, createElement, isValidElement, cloneElement, useInsertionEffect, useSyncExternalStore, memo, Suspense } from 'react';
|
|
3
|
-
import { Input, Tree, Modal, Alert, theme, Select, Tag, Flex, Typography, Breadcrumb, Spin, Menu, Tooltip, Space, Button, Card as Card$1, Row, Col, Tabs, Form, Popover, notification, Dropdown, Table, Slider, InputNumber,
|
|
3
|
+
import { Input, Tree, Modal, Alert, theme, Select, Tag, Flex, Typography, Breadcrumb, Spin, Menu, Tooltip, Space, Button, Card as Card$1, Row, Col, Tabs, Form, Popover, notification, Switch, Segmented, Dropdown, Table, Slider, InputNumber, Result, Progress, Checkbox, Empty } from 'antd';
|
|
4
4
|
import { LoadingOutlined, ExclamationCircleFilled, CloseCircleFilled, CheckCircleFilled, PlusOutlined, ClearOutlined, MinusOutlined, CaretDownOutlined, CaretRightOutlined, InfoCircleOutlined, EyeOutlined, EyeInvisibleOutlined, SearchOutlined, MoreOutlined, CheckOutlined, CloseOutlined, BugOutlined, EllipsisOutlined } from '@ant-design/icons';
|
|
5
5
|
import { useNavigate, Link, useLocation, useParams, useSearchParams } from 'react-router-dom';
|
|
6
6
|
import { useQuery, useQueries, useQueryClient } from '@tanstack/react-query';
|
|
@@ -7887,19 +7887,54 @@ const patchEntryWithReplaceOp = async ({
|
|
|
7887
7887
|
pathToValue,
|
|
7888
7888
|
body
|
|
7889
7889
|
}) => {
|
|
7890
|
-
const
|
|
7890
|
+
const config = {
|
|
7891
|
+
headers: {
|
|
7892
|
+
"Content-Type": "application/json-patch+json"
|
|
7893
|
+
}
|
|
7894
|
+
};
|
|
7895
|
+
const replaceOp = [
|
|
7891
7896
|
{
|
|
7892
7897
|
op: "replace",
|
|
7893
7898
|
path: pathToValue,
|
|
7894
7899
|
value: body
|
|
7895
7900
|
}
|
|
7896
7901
|
];
|
|
7897
|
-
|
|
7898
|
-
|
|
7902
|
+
try {
|
|
7903
|
+
return await axios.patch(endpoint, replaceOp, config);
|
|
7904
|
+
} catch (error) {
|
|
7905
|
+
if (!isAxiosError(error)) {
|
|
7906
|
+
throw error;
|
|
7907
|
+
}
|
|
7908
|
+
const status = error.response?.status;
|
|
7909
|
+
if (status !== 422) {
|
|
7910
|
+
throw error;
|
|
7911
|
+
}
|
|
7912
|
+
const addOp = [
|
|
7913
|
+
{
|
|
7914
|
+
op: "add",
|
|
7915
|
+
path: pathToValue,
|
|
7916
|
+
value: body
|
|
7917
|
+
}
|
|
7918
|
+
];
|
|
7919
|
+
return axios.patch(endpoint, addOp, config);
|
|
7920
|
+
}
|
|
7921
|
+
};
|
|
7922
|
+
const patchEntryWithDeleteOp = async ({
|
|
7923
|
+
endpoint,
|
|
7924
|
+
pathToValue
|
|
7925
|
+
}) => {
|
|
7926
|
+
const config = {
|
|
7899
7927
|
headers: {
|
|
7900
7928
|
"Content-Type": "application/json-patch+json"
|
|
7901
7929
|
}
|
|
7902
|
-
}
|
|
7930
|
+
};
|
|
7931
|
+
const replaceOp = [
|
|
7932
|
+
{
|
|
7933
|
+
op: "remove",
|
|
7934
|
+
path: pathToValue
|
|
7935
|
+
}
|
|
7936
|
+
];
|
|
7937
|
+
return axios.patch(endpoint, replaceOp, config);
|
|
7903
7938
|
};
|
|
7904
7939
|
|
|
7905
7940
|
const DeleteModal = ({ name, onClose, endpoint }) => {
|
|
@@ -38429,6 +38464,263 @@ const OwnerRefs = ({
|
|
|
38429
38464
|
] });
|
|
38430
38465
|
};
|
|
38431
38466
|
|
|
38467
|
+
const Toggler = ({ data, children }) => {
|
|
38468
|
+
const {
|
|
38469
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
38470
|
+
id,
|
|
38471
|
+
reqIndex,
|
|
38472
|
+
jsonPathToValue,
|
|
38473
|
+
criteria,
|
|
38474
|
+
notificationSuccessMessage,
|
|
38475
|
+
notificationSuccessMessageDescription,
|
|
38476
|
+
notificationErrorMessage,
|
|
38477
|
+
notificationErrorMessageDescription,
|
|
38478
|
+
containerStyle,
|
|
38479
|
+
endpoint,
|
|
38480
|
+
pathToValue,
|
|
38481
|
+
valueToSubmit
|
|
38482
|
+
} = data;
|
|
38483
|
+
const [api, contextHolder] = notification.useNotification();
|
|
38484
|
+
const queryClient = useQueryClient();
|
|
38485
|
+
const { data: multiQueryData, isLoading: isMultiQueryLoading, isError: isMultiQueryErrors, errors } = useMultiQuery();
|
|
38486
|
+
const partsOfUrl = usePartsOfUrl();
|
|
38487
|
+
if (isMultiQueryLoading) {
|
|
38488
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
|
|
38489
|
+
}
|
|
38490
|
+
if (isMultiQueryErrors) {
|
|
38491
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
38492
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
|
|
38493
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
|
|
38494
|
+
] });
|
|
38495
|
+
}
|
|
38496
|
+
const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
|
|
38497
|
+
acc[index.toString()] = value;
|
|
38498
|
+
return acc;
|
|
38499
|
+
}, {});
|
|
38500
|
+
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
38501
|
+
if (jsonRoot === void 0) {
|
|
38502
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
|
|
38503
|
+
}
|
|
38504
|
+
const valueToCompare = jp.query(jsonRoot, `$${jsonPathToValue}`)[0];
|
|
38505
|
+
let valueToSwitch = false;
|
|
38506
|
+
if (criteria.type === "forSuccess") {
|
|
38507
|
+
if (criteria.operator === "exists") {
|
|
38508
|
+
valueToSwitch = valueToCompare !== void 0;
|
|
38509
|
+
}
|
|
38510
|
+
if (criteria.operator === "equals") {
|
|
38511
|
+
valueToSwitch = String(valueToCompare) === criteria.valueToCompare;
|
|
38512
|
+
}
|
|
38513
|
+
}
|
|
38514
|
+
if (criteria.type === "forError") {
|
|
38515
|
+
if (criteria.operator === "exists") {
|
|
38516
|
+
valueToSwitch = !valueToCompare;
|
|
38517
|
+
}
|
|
38518
|
+
if (criteria.operator === "equals") {
|
|
38519
|
+
valueToSwitch = String(valueToCompare) !== criteria.valueToCompare;
|
|
38520
|
+
}
|
|
38521
|
+
}
|
|
38522
|
+
const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
|
|
38523
|
+
text: notificationSuccessMessage,
|
|
38524
|
+
replaceValues,
|
|
38525
|
+
multiQueryData
|
|
38526
|
+
}) : "Success";
|
|
38527
|
+
const notificationSuccessMessageDescriptionPrepared = notificationSuccessMessageDescription ? parseAll({
|
|
38528
|
+
text: notificationSuccessMessageDescription,
|
|
38529
|
+
replaceValues,
|
|
38530
|
+
multiQueryData
|
|
38531
|
+
}) : "Success";
|
|
38532
|
+
const notificationErrorMessagePrepared = notificationErrorMessage ? parseAll({
|
|
38533
|
+
text: notificationErrorMessage,
|
|
38534
|
+
replaceValues,
|
|
38535
|
+
multiQueryData
|
|
38536
|
+
}) : "Success";
|
|
38537
|
+
const notificationErrorMessageDescriptionPrepared = notificationErrorMessageDescription ? parseAll({
|
|
38538
|
+
text: notificationErrorMessageDescription,
|
|
38539
|
+
replaceValues,
|
|
38540
|
+
multiQueryData
|
|
38541
|
+
}) : "Success";
|
|
38542
|
+
const openNotificationSuccess = () => {
|
|
38543
|
+
api.success({
|
|
38544
|
+
message: notificationSuccessMessagePrepared,
|
|
38545
|
+
description: notificationSuccessMessageDescriptionPrepared,
|
|
38546
|
+
placement: "bottomRight"
|
|
38547
|
+
});
|
|
38548
|
+
};
|
|
38549
|
+
const openNotificationError = () => {
|
|
38550
|
+
api.error({
|
|
38551
|
+
message: notificationErrorMessagePrepared,
|
|
38552
|
+
description: notificationErrorMessageDescriptionPrepared,
|
|
38553
|
+
placement: "bottomRight"
|
|
38554
|
+
});
|
|
38555
|
+
};
|
|
38556
|
+
const endpointPrepared = endpoint ? parseAll({ text: endpoint, replaceValues, multiQueryData }) : "no-endpoint-provided";
|
|
38557
|
+
const pathToValuePrepared = pathToValue ? parseAll({ text: pathToValue, replaceValues, multiQueryData }) : "no-pathToValue-provided";
|
|
38558
|
+
const toggleOn = () => {
|
|
38559
|
+
patchEntryWithReplaceOp({
|
|
38560
|
+
endpoint: endpointPrepared,
|
|
38561
|
+
pathToValue: pathToValuePrepared,
|
|
38562
|
+
body: valueToSubmit.onValue
|
|
38563
|
+
}).then(() => {
|
|
38564
|
+
queryClient.invalidateQueries({ queryKey: ["multi"] });
|
|
38565
|
+
openNotificationSuccess();
|
|
38566
|
+
}).catch((error) => {
|
|
38567
|
+
openNotificationError();
|
|
38568
|
+
console.error(error);
|
|
38569
|
+
});
|
|
38570
|
+
};
|
|
38571
|
+
const toggleOff = () => {
|
|
38572
|
+
if (valueToSubmit.offValue !== void 0) {
|
|
38573
|
+
patchEntryWithReplaceOp({
|
|
38574
|
+
endpoint: endpointPrepared,
|
|
38575
|
+
pathToValue: pathToValuePrepared,
|
|
38576
|
+
body: valueToSubmit.offValue
|
|
38577
|
+
}).then(() => {
|
|
38578
|
+
queryClient.invalidateQueries({ queryKey: ["multi"] });
|
|
38579
|
+
openNotificationSuccess();
|
|
38580
|
+
}).catch((error) => {
|
|
38581
|
+
openNotificationError();
|
|
38582
|
+
console.error(error);
|
|
38583
|
+
});
|
|
38584
|
+
}
|
|
38585
|
+
if (valueToSubmit.toRemoveWhenOff) {
|
|
38586
|
+
patchEntryWithDeleteOp({
|
|
38587
|
+
endpoint: endpointPrepared,
|
|
38588
|
+
pathToValue: pathToValuePrepared
|
|
38589
|
+
}).then(() => {
|
|
38590
|
+
queryClient.invalidateQueries({ queryKey: ["multi"] });
|
|
38591
|
+
openNotificationSuccess();
|
|
38592
|
+
}).catch((error) => {
|
|
38593
|
+
openNotificationError();
|
|
38594
|
+
console.error(error);
|
|
38595
|
+
});
|
|
38596
|
+
}
|
|
38597
|
+
};
|
|
38598
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
|
|
38599
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
38600
|
+
Switch,
|
|
38601
|
+
{
|
|
38602
|
+
value: valueToSwitch,
|
|
38603
|
+
onChange: (checked) => {
|
|
38604
|
+
if (checked) {
|
|
38605
|
+
toggleOn();
|
|
38606
|
+
} else {
|
|
38607
|
+
toggleOff();
|
|
38608
|
+
}
|
|
38609
|
+
}
|
|
38610
|
+
}
|
|
38611
|
+
),
|
|
38612
|
+
children,
|
|
38613
|
+
contextHolder
|
|
38614
|
+
] });
|
|
38615
|
+
};
|
|
38616
|
+
|
|
38617
|
+
const TogglerSegmented = ({
|
|
38618
|
+
data,
|
|
38619
|
+
children
|
|
38620
|
+
}) => {
|
|
38621
|
+
const {
|
|
38622
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
38623
|
+
id,
|
|
38624
|
+
reqIndex,
|
|
38625
|
+
jsonPathToValue,
|
|
38626
|
+
notificationSuccessMessage,
|
|
38627
|
+
notificationSuccessMessageDescription,
|
|
38628
|
+
notificationErrorMessage,
|
|
38629
|
+
notificationErrorMessageDescription,
|
|
38630
|
+
containerStyle,
|
|
38631
|
+
endpoint,
|
|
38632
|
+
pathToValue,
|
|
38633
|
+
possibleValues,
|
|
38634
|
+
valuesMap
|
|
38635
|
+
} = data;
|
|
38636
|
+
const [api, contextHolder] = notification.useNotification();
|
|
38637
|
+
const queryClient = useQueryClient();
|
|
38638
|
+
const { data: multiQueryData, isLoading: isMultiQueryLoading, isError: isMultiQueryErrors, errors } = useMultiQuery();
|
|
38639
|
+
const partsOfUrl = usePartsOfUrl();
|
|
38640
|
+
if (isMultiQueryLoading) {
|
|
38641
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
|
|
38642
|
+
}
|
|
38643
|
+
if (isMultiQueryErrors) {
|
|
38644
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
38645
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
|
|
38646
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
|
|
38647
|
+
] });
|
|
38648
|
+
}
|
|
38649
|
+
const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
|
|
38650
|
+
acc[index.toString()] = value;
|
|
38651
|
+
return acc;
|
|
38652
|
+
}, {});
|
|
38653
|
+
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
38654
|
+
if (jsonRoot === void 0) {
|
|
38655
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
|
|
38656
|
+
}
|
|
38657
|
+
const valueToCompare = jp.query(jsonRoot, `$${jsonPathToValue}`)[0];
|
|
38658
|
+
const valueToSegmented = valuesMap?.find((el) => el.value === valueToCompare)?.renderedValue;
|
|
38659
|
+
const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
|
|
38660
|
+
text: notificationSuccessMessage,
|
|
38661
|
+
replaceValues,
|
|
38662
|
+
multiQueryData
|
|
38663
|
+
}) : "Success";
|
|
38664
|
+
const notificationSuccessMessageDescriptionPrepared = notificationSuccessMessageDescription ? parseAll({
|
|
38665
|
+
text: notificationSuccessMessageDescription,
|
|
38666
|
+
replaceValues,
|
|
38667
|
+
multiQueryData
|
|
38668
|
+
}) : "Success";
|
|
38669
|
+
const notificationErrorMessagePrepared = notificationErrorMessage ? parseAll({
|
|
38670
|
+
text: notificationErrorMessage,
|
|
38671
|
+
replaceValues,
|
|
38672
|
+
multiQueryData
|
|
38673
|
+
}) : "Success";
|
|
38674
|
+
const notificationErrorMessageDescriptionPrepared = notificationErrorMessageDescription ? parseAll({
|
|
38675
|
+
text: notificationErrorMessageDescription,
|
|
38676
|
+
replaceValues,
|
|
38677
|
+
multiQueryData
|
|
38678
|
+
}) : "Success";
|
|
38679
|
+
const openNotificationSuccess = () => {
|
|
38680
|
+
api.success({
|
|
38681
|
+
message: notificationSuccessMessagePrepared,
|
|
38682
|
+
description: notificationSuccessMessageDescriptionPrepared,
|
|
38683
|
+
placement: "bottomRight"
|
|
38684
|
+
});
|
|
38685
|
+
};
|
|
38686
|
+
const openNotificationError = () => {
|
|
38687
|
+
api.error({
|
|
38688
|
+
message: notificationErrorMessagePrepared,
|
|
38689
|
+
description: notificationErrorMessageDescriptionPrepared,
|
|
38690
|
+
placement: "bottomRight"
|
|
38691
|
+
});
|
|
38692
|
+
};
|
|
38693
|
+
const endpointPrepared = endpoint ? parseAll({ text: endpoint, replaceValues, multiQueryData }) : "no-endpoint-provided";
|
|
38694
|
+
const pathToValuePrepared = pathToValue ? parseAll({ text: pathToValue, replaceValues, multiQueryData }) : "no-pathToValue-provided";
|
|
38695
|
+
const onChange = (renderedValue) => {
|
|
38696
|
+
const valueFromMap = valuesMap?.find((el) => el.renderedValue === renderedValue)?.value;
|
|
38697
|
+
const valueToSend = valueFromMap || renderedValue;
|
|
38698
|
+
patchEntryWithReplaceOp({
|
|
38699
|
+
endpoint: endpointPrepared,
|
|
38700
|
+
pathToValue: pathToValuePrepared,
|
|
38701
|
+
body: valueToSend
|
|
38702
|
+
}).then(() => {
|
|
38703
|
+
queryClient.invalidateQueries({ queryKey: ["multi"] });
|
|
38704
|
+
openNotificationSuccess();
|
|
38705
|
+
}).catch((error) => {
|
|
38706
|
+
openNotificationError();
|
|
38707
|
+
console.error(error);
|
|
38708
|
+
});
|
|
38709
|
+
};
|
|
38710
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
|
|
38711
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
38712
|
+
Segmented,
|
|
38713
|
+
{
|
|
38714
|
+
options: possibleValues,
|
|
38715
|
+
value: valueToSegmented || "~n~e~v~e~r",
|
|
38716
|
+
onChange: (value) => onChange(value)
|
|
38717
|
+
}
|
|
38718
|
+
),
|
|
38719
|
+
children,
|
|
38720
|
+
contextHolder
|
|
38721
|
+
] });
|
|
38722
|
+
};
|
|
38723
|
+
|
|
38432
38724
|
const DynamicComponents = {
|
|
38433
38725
|
DefaultDiv,
|
|
38434
38726
|
antdText: AntdText,
|
|
@@ -38466,7 +38758,9 @@ const DynamicComponents = {
|
|
|
38466
38758
|
SecretBase64Plain,
|
|
38467
38759
|
ResourceBadge,
|
|
38468
38760
|
Events: Events$1,
|
|
38469
|
-
OwnerRefs
|
|
38761
|
+
OwnerRefs,
|
|
38762
|
+
Toggler,
|
|
38763
|
+
TogglerSegmented
|
|
38470
38764
|
};
|
|
38471
38765
|
|
|
38472
38766
|
const prepareUrlsToFetchForDynamicRenderer = ({
|
|
@@ -39211,733 +39505,161 @@ const EnrichedTableProvider = ({
|
|
|
39211
39505
|
);
|
|
39212
39506
|
};
|
|
39213
39507
|
|
|
39214
|
-
|
|
39215
|
-
|
|
39216
|
-
|
|
39217
|
-
|
|
39218
|
-
|
|
39219
|
-
|
|
39220
|
-
|
|
39221
|
-
|
|
39222
|
-
|
|
39223
|
-
|
|
39224
|
-
|
|
39225
|
-
|
|
39226
|
-
/** Used as references for various `Number` constants. */
|
|
39227
|
-
var NAN = 0 / 0;
|
|
39508
|
+
function _defineProperty$1(obj, key, value) {
|
|
39509
|
+
if (key in obj) {
|
|
39510
|
+
Object.defineProperty(obj, key, {
|
|
39511
|
+
value: value,
|
|
39512
|
+
enumerable: true,
|
|
39513
|
+
configurable: true,
|
|
39514
|
+
writable: true
|
|
39515
|
+
});
|
|
39516
|
+
} else {
|
|
39517
|
+
obj[key] = value;
|
|
39518
|
+
}
|
|
39228
39519
|
|
|
39229
|
-
|
|
39230
|
-
|
|
39520
|
+
return obj;
|
|
39521
|
+
}
|
|
39231
39522
|
|
|
39232
|
-
|
|
39233
|
-
var
|
|
39523
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
39524
|
+
var keys = Object.keys(object);
|
|
39234
39525
|
|
|
39235
|
-
|
|
39236
|
-
var
|
|
39526
|
+
if (Object.getOwnPropertySymbols) {
|
|
39527
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
39528
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
39529
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
39530
|
+
});
|
|
39531
|
+
keys.push.apply(keys, symbols);
|
|
39532
|
+
}
|
|
39237
39533
|
|
|
39238
|
-
|
|
39239
|
-
|
|
39534
|
+
return keys;
|
|
39535
|
+
}
|
|
39240
39536
|
|
|
39241
|
-
|
|
39242
|
-
var
|
|
39537
|
+
function _objectSpread2$1(target) {
|
|
39538
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
39539
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
39243
39540
|
|
|
39244
|
-
|
|
39245
|
-
|
|
39541
|
+
if (i % 2) {
|
|
39542
|
+
ownKeys$1(Object(source), true).forEach(function (key) {
|
|
39543
|
+
_defineProperty$1(target, key, source[key]);
|
|
39544
|
+
});
|
|
39545
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
39546
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
39547
|
+
} else {
|
|
39548
|
+
ownKeys$1(Object(source)).forEach(function (key) {
|
|
39549
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
39550
|
+
});
|
|
39551
|
+
}
|
|
39552
|
+
}
|
|
39246
39553
|
|
|
39247
|
-
|
|
39248
|
-
|
|
39554
|
+
return target;
|
|
39555
|
+
}
|
|
39249
39556
|
|
|
39250
|
-
|
|
39251
|
-
|
|
39557
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
39558
|
+
if (source == null) return {};
|
|
39559
|
+
var target = {};
|
|
39560
|
+
var sourceKeys = Object.keys(source);
|
|
39561
|
+
var key, i;
|
|
39252
39562
|
|
|
39253
|
-
|
|
39254
|
-
|
|
39563
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
39564
|
+
key = sourceKeys[i];
|
|
39565
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
39566
|
+
target[key] = source[key];
|
|
39567
|
+
}
|
|
39255
39568
|
|
|
39256
|
-
|
|
39257
|
-
|
|
39569
|
+
return target;
|
|
39570
|
+
}
|
|
39258
39571
|
|
|
39259
|
-
|
|
39260
|
-
|
|
39261
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
39262
|
-
* of values.
|
|
39263
|
-
*/
|
|
39264
|
-
var objectToString = objectProto.toString;
|
|
39572
|
+
function _objectWithoutProperties(source, excluded) {
|
|
39573
|
+
if (source == null) return {};
|
|
39265
39574
|
|
|
39266
|
-
|
|
39267
|
-
var nativeMax = Math.max,
|
|
39268
|
-
nativeMin = Math.min;
|
|
39575
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
39269
39576
|
|
|
39270
|
-
|
|
39271
|
-
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
39272
|
-
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
39273
|
-
*
|
|
39274
|
-
* @static
|
|
39275
|
-
* @memberOf _
|
|
39276
|
-
* @since 2.4.0
|
|
39277
|
-
* @category Date
|
|
39278
|
-
* @returns {number} Returns the timestamp.
|
|
39279
|
-
* @example
|
|
39280
|
-
*
|
|
39281
|
-
* _.defer(function(stamp) {
|
|
39282
|
-
* console.log(_.now() - stamp);
|
|
39283
|
-
* }, _.now());
|
|
39284
|
-
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
39285
|
-
*/
|
|
39286
|
-
var now = function() {
|
|
39287
|
-
return root.Date.now();
|
|
39288
|
-
};
|
|
39577
|
+
var key, i;
|
|
39289
39578
|
|
|
39290
|
-
|
|
39291
|
-
|
|
39292
|
-
* milliseconds have elapsed since the last time the debounced function was
|
|
39293
|
-
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
39294
|
-
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
39295
|
-
* Provide `options` to indicate whether `func` should be invoked on the
|
|
39296
|
-
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
39297
|
-
* with the last arguments provided to the debounced function. Subsequent
|
|
39298
|
-
* calls to the debounced function return the result of the last `func`
|
|
39299
|
-
* invocation.
|
|
39300
|
-
*
|
|
39301
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
39302
|
-
* invoked on the trailing edge of the timeout only if the debounced function
|
|
39303
|
-
* is invoked more than once during the `wait` timeout.
|
|
39304
|
-
*
|
|
39305
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
39306
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
39307
|
-
*
|
|
39308
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
39309
|
-
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
39310
|
-
*
|
|
39311
|
-
* @static
|
|
39312
|
-
* @memberOf _
|
|
39313
|
-
* @since 0.1.0
|
|
39314
|
-
* @category Function
|
|
39315
|
-
* @param {Function} func The function to debounce.
|
|
39316
|
-
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
39317
|
-
* @param {Object} [options={}] The options object.
|
|
39318
|
-
* @param {boolean} [options.leading=false]
|
|
39319
|
-
* Specify invoking on the leading edge of the timeout.
|
|
39320
|
-
* @param {number} [options.maxWait]
|
|
39321
|
-
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
39322
|
-
* @param {boolean} [options.trailing=true]
|
|
39323
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
39324
|
-
* @returns {Function} Returns the new debounced function.
|
|
39325
|
-
* @example
|
|
39326
|
-
*
|
|
39327
|
-
* // Avoid costly calculations while the window size is in flux.
|
|
39328
|
-
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
39329
|
-
*
|
|
39330
|
-
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
39331
|
-
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
39332
|
-
* 'leading': true,
|
|
39333
|
-
* 'trailing': false
|
|
39334
|
-
* }));
|
|
39335
|
-
*
|
|
39336
|
-
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
39337
|
-
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
39338
|
-
* var source = new EventSource('/stream');
|
|
39339
|
-
* jQuery(source).on('message', debounced);
|
|
39340
|
-
*
|
|
39341
|
-
* // Cancel the trailing debounced invocation.
|
|
39342
|
-
* jQuery(window).on('popstate', debounced.cancel);
|
|
39343
|
-
*/
|
|
39344
|
-
function debounce(func, wait, options) {
|
|
39345
|
-
var lastArgs,
|
|
39346
|
-
lastThis,
|
|
39347
|
-
maxWait,
|
|
39348
|
-
result,
|
|
39349
|
-
timerId,
|
|
39350
|
-
lastCallTime,
|
|
39351
|
-
lastInvokeTime = 0,
|
|
39352
|
-
leading = false,
|
|
39353
|
-
maxing = false,
|
|
39354
|
-
trailing = true;
|
|
39579
|
+
if (Object.getOwnPropertySymbols) {
|
|
39580
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
39355
39581
|
|
|
39356
|
-
|
|
39357
|
-
|
|
39358
|
-
|
|
39359
|
-
|
|
39360
|
-
|
|
39361
|
-
|
|
39362
|
-
maxing = 'maxWait' in options;
|
|
39363
|
-
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
39364
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
39582
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
39583
|
+
key = sourceSymbolKeys[i];
|
|
39584
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
39585
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
39586
|
+
target[key] = source[key];
|
|
39587
|
+
}
|
|
39365
39588
|
}
|
|
39366
39589
|
|
|
39367
|
-
|
|
39368
|
-
|
|
39369
|
-
thisArg = lastThis;
|
|
39590
|
+
return target;
|
|
39591
|
+
}
|
|
39370
39592
|
|
|
39371
|
-
|
|
39372
|
-
|
|
39373
|
-
|
|
39374
|
-
return result;
|
|
39375
|
-
}
|
|
39593
|
+
function _slicedToArray(arr, i) {
|
|
39594
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
39595
|
+
}
|
|
39376
39596
|
|
|
39377
|
-
|
|
39378
|
-
|
|
39379
|
-
|
|
39380
|
-
// Start the timer for the trailing edge.
|
|
39381
|
-
timerId = setTimeout(timerExpired, wait);
|
|
39382
|
-
// Invoke the leading edge.
|
|
39383
|
-
return leading ? invokeFunc(time) : result;
|
|
39384
|
-
}
|
|
39597
|
+
function _arrayWithHoles(arr) {
|
|
39598
|
+
if (Array.isArray(arr)) return arr;
|
|
39599
|
+
}
|
|
39385
39600
|
|
|
39386
|
-
|
|
39387
|
-
|
|
39388
|
-
|
|
39389
|
-
|
|
39601
|
+
function _iterableToArrayLimit(arr, i) {
|
|
39602
|
+
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
39603
|
+
var _arr = [];
|
|
39604
|
+
var _n = true;
|
|
39605
|
+
var _d = false;
|
|
39606
|
+
var _e = undefined;
|
|
39390
39607
|
|
|
39391
|
-
|
|
39608
|
+
try {
|
|
39609
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
39610
|
+
_arr.push(_s.value);
|
|
39611
|
+
|
|
39612
|
+
if (i && _arr.length === i) break;
|
|
39613
|
+
}
|
|
39614
|
+
} catch (err) {
|
|
39615
|
+
_d = true;
|
|
39616
|
+
_e = err;
|
|
39617
|
+
} finally {
|
|
39618
|
+
try {
|
|
39619
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
39620
|
+
} finally {
|
|
39621
|
+
if (_d) throw _e;
|
|
39622
|
+
}
|
|
39392
39623
|
}
|
|
39393
39624
|
|
|
39394
|
-
|
|
39395
|
-
|
|
39396
|
-
timeSinceLastInvoke = time - lastInvokeTime;
|
|
39625
|
+
return _arr;
|
|
39626
|
+
}
|
|
39397
39627
|
|
|
39398
|
-
|
|
39399
|
-
|
|
39400
|
-
|
|
39401
|
-
|
|
39402
|
-
|
|
39403
|
-
|
|
39628
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
39629
|
+
if (!o) return;
|
|
39630
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
39631
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
39632
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
39633
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
39634
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
39635
|
+
}
|
|
39404
39636
|
|
|
39405
|
-
|
|
39406
|
-
|
|
39407
|
-
if (shouldInvoke(time)) {
|
|
39408
|
-
return trailingEdge(time);
|
|
39409
|
-
}
|
|
39410
|
-
// Restart the timer.
|
|
39411
|
-
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
39412
|
-
}
|
|
39637
|
+
function _arrayLikeToArray(arr, len) {
|
|
39638
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
39413
39639
|
|
|
39414
|
-
|
|
39415
|
-
timerId = undefined;
|
|
39640
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
39416
39641
|
|
|
39417
|
-
|
|
39418
|
-
|
|
39419
|
-
if (trailing && lastArgs) {
|
|
39420
|
-
return invokeFunc(time);
|
|
39421
|
-
}
|
|
39422
|
-
lastArgs = lastThis = undefined;
|
|
39423
|
-
return result;
|
|
39424
|
-
}
|
|
39642
|
+
return arr2;
|
|
39643
|
+
}
|
|
39425
39644
|
|
|
39426
|
-
|
|
39427
|
-
|
|
39428
|
-
|
|
39429
|
-
}
|
|
39430
|
-
lastInvokeTime = 0;
|
|
39431
|
-
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
39432
|
-
}
|
|
39645
|
+
function _nonIterableRest() {
|
|
39646
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
39647
|
+
}
|
|
39433
39648
|
|
|
39434
|
-
|
|
39435
|
-
|
|
39649
|
+
function _defineProperty(obj, key, value) {
|
|
39650
|
+
if (key in obj) {
|
|
39651
|
+
Object.defineProperty(obj, key, {
|
|
39652
|
+
value: value,
|
|
39653
|
+
enumerable: true,
|
|
39654
|
+
configurable: true,
|
|
39655
|
+
writable: true
|
|
39656
|
+
});
|
|
39657
|
+
} else {
|
|
39658
|
+
obj[key] = value;
|
|
39436
39659
|
}
|
|
39437
39660
|
|
|
39438
|
-
|
|
39439
|
-
|
|
39440
|
-
isInvoking = shouldInvoke(time);
|
|
39441
|
-
|
|
39442
|
-
lastArgs = arguments;
|
|
39443
|
-
lastThis = this;
|
|
39444
|
-
lastCallTime = time;
|
|
39445
|
-
|
|
39446
|
-
if (isInvoking) {
|
|
39447
|
-
if (timerId === undefined) {
|
|
39448
|
-
return leadingEdge(lastCallTime);
|
|
39449
|
-
}
|
|
39450
|
-
if (maxing) {
|
|
39451
|
-
// Handle invocations in a tight loop.
|
|
39452
|
-
timerId = setTimeout(timerExpired, wait);
|
|
39453
|
-
return invokeFunc(lastCallTime);
|
|
39454
|
-
}
|
|
39455
|
-
}
|
|
39456
|
-
if (timerId === undefined) {
|
|
39457
|
-
timerId = setTimeout(timerExpired, wait);
|
|
39458
|
-
}
|
|
39459
|
-
return result;
|
|
39460
|
-
}
|
|
39461
|
-
debounced.cancel = cancel;
|
|
39462
|
-
debounced.flush = flush;
|
|
39463
|
-
return debounced;
|
|
39464
|
-
}
|
|
39465
|
-
|
|
39466
|
-
/**
|
|
39467
|
-
* Checks if `value` is the
|
|
39468
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
39469
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
39470
|
-
*
|
|
39471
|
-
* @static
|
|
39472
|
-
* @memberOf _
|
|
39473
|
-
* @since 0.1.0
|
|
39474
|
-
* @category Lang
|
|
39475
|
-
* @param {*} value The value to check.
|
|
39476
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
39477
|
-
* @example
|
|
39478
|
-
*
|
|
39479
|
-
* _.isObject({});
|
|
39480
|
-
* // => true
|
|
39481
|
-
*
|
|
39482
|
-
* _.isObject([1, 2, 3]);
|
|
39483
|
-
* // => true
|
|
39484
|
-
*
|
|
39485
|
-
* _.isObject(_.noop);
|
|
39486
|
-
* // => true
|
|
39487
|
-
*
|
|
39488
|
-
* _.isObject(null);
|
|
39489
|
-
* // => false
|
|
39490
|
-
*/
|
|
39491
|
-
function isObject$2(value) {
|
|
39492
|
-
var type = typeof value;
|
|
39493
|
-
return !!value && (type == 'object' || type == 'function');
|
|
39494
|
-
}
|
|
39495
|
-
|
|
39496
|
-
/**
|
|
39497
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
39498
|
-
* and has a `typeof` result of "object".
|
|
39499
|
-
*
|
|
39500
|
-
* @static
|
|
39501
|
-
* @memberOf _
|
|
39502
|
-
* @since 4.0.0
|
|
39503
|
-
* @category Lang
|
|
39504
|
-
* @param {*} value The value to check.
|
|
39505
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
39506
|
-
* @example
|
|
39507
|
-
*
|
|
39508
|
-
* _.isObjectLike({});
|
|
39509
|
-
* // => true
|
|
39510
|
-
*
|
|
39511
|
-
* _.isObjectLike([1, 2, 3]);
|
|
39512
|
-
* // => true
|
|
39513
|
-
*
|
|
39514
|
-
* _.isObjectLike(_.noop);
|
|
39515
|
-
* // => false
|
|
39516
|
-
*
|
|
39517
|
-
* _.isObjectLike(null);
|
|
39518
|
-
* // => false
|
|
39519
|
-
*/
|
|
39520
|
-
function isObjectLike(value) {
|
|
39521
|
-
return !!value && typeof value == 'object';
|
|
39522
|
-
}
|
|
39523
|
-
|
|
39524
|
-
/**
|
|
39525
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
39526
|
-
*
|
|
39527
|
-
* @static
|
|
39528
|
-
* @memberOf _
|
|
39529
|
-
* @since 4.0.0
|
|
39530
|
-
* @category Lang
|
|
39531
|
-
* @param {*} value The value to check.
|
|
39532
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
39533
|
-
* @example
|
|
39534
|
-
*
|
|
39535
|
-
* _.isSymbol(Symbol.iterator);
|
|
39536
|
-
* // => true
|
|
39537
|
-
*
|
|
39538
|
-
* _.isSymbol('abc');
|
|
39539
|
-
* // => false
|
|
39540
|
-
*/
|
|
39541
|
-
function isSymbol(value) {
|
|
39542
|
-
return typeof value == 'symbol' ||
|
|
39543
|
-
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
|
39544
|
-
}
|
|
39545
|
-
|
|
39546
|
-
/**
|
|
39547
|
-
* Converts `value` to a number.
|
|
39548
|
-
*
|
|
39549
|
-
* @static
|
|
39550
|
-
* @memberOf _
|
|
39551
|
-
* @since 4.0.0
|
|
39552
|
-
* @category Lang
|
|
39553
|
-
* @param {*} value The value to process.
|
|
39554
|
-
* @returns {number} Returns the number.
|
|
39555
|
-
* @example
|
|
39556
|
-
*
|
|
39557
|
-
* _.toNumber(3.2);
|
|
39558
|
-
* // => 3.2
|
|
39559
|
-
*
|
|
39560
|
-
* _.toNumber(Number.MIN_VALUE);
|
|
39561
|
-
* // => 5e-324
|
|
39562
|
-
*
|
|
39563
|
-
* _.toNumber(Infinity);
|
|
39564
|
-
* // => Infinity
|
|
39565
|
-
*
|
|
39566
|
-
* _.toNumber('3.2');
|
|
39567
|
-
* // => 3.2
|
|
39568
|
-
*/
|
|
39569
|
-
function toNumber(value) {
|
|
39570
|
-
if (typeof value == 'number') {
|
|
39571
|
-
return value;
|
|
39572
|
-
}
|
|
39573
|
-
if (isSymbol(value)) {
|
|
39574
|
-
return NAN;
|
|
39575
|
-
}
|
|
39576
|
-
if (isObject$2(value)) {
|
|
39577
|
-
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
39578
|
-
value = isObject$2(other) ? (other + '') : other;
|
|
39579
|
-
}
|
|
39580
|
-
if (typeof value != 'string') {
|
|
39581
|
-
return value === 0 ? value : +value;
|
|
39582
|
-
}
|
|
39583
|
-
value = value.replace(reTrim, '');
|
|
39584
|
-
var isBinary = reIsBinary.test(value);
|
|
39585
|
-
return (isBinary || reIsOctal.test(value))
|
|
39586
|
-
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
39587
|
-
: (reIsBadHex.test(value) ? NAN : +value);
|
|
39588
|
-
}
|
|
39589
|
-
|
|
39590
|
-
var lodash_debounce = debounce;
|
|
39591
|
-
|
|
39592
|
-
const debounce$1 = /*@__PURE__*/getDefaultExportFromCjs(lodash_debounce);
|
|
39593
|
-
|
|
39594
|
-
function useUnmount(func) {
|
|
39595
|
-
const funcRef = useRef(func);
|
|
39596
|
-
funcRef.current = func;
|
|
39597
|
-
useEffect(
|
|
39598
|
-
() => () => {
|
|
39599
|
-
funcRef.current();
|
|
39600
|
-
},
|
|
39601
|
-
[]
|
|
39602
|
-
);
|
|
39603
|
-
}
|
|
39604
|
-
|
|
39605
|
-
// src/useDebounceCallback/useDebounceCallback.ts
|
|
39606
|
-
function useDebounceCallback(func, delay = 500, options) {
|
|
39607
|
-
const debouncedFunc = useRef();
|
|
39608
|
-
useUnmount(() => {
|
|
39609
|
-
if (debouncedFunc.current) {
|
|
39610
|
-
debouncedFunc.current.cancel();
|
|
39611
|
-
}
|
|
39612
|
-
});
|
|
39613
|
-
const debounced = useMemo(() => {
|
|
39614
|
-
const debouncedFuncInstance = debounce$1(func, delay, options);
|
|
39615
|
-
const wrappedFunc = (...args) => {
|
|
39616
|
-
return debouncedFuncInstance(...args);
|
|
39617
|
-
};
|
|
39618
|
-
wrappedFunc.cancel = () => {
|
|
39619
|
-
debouncedFuncInstance.cancel();
|
|
39620
|
-
};
|
|
39621
|
-
wrappedFunc.isPending = () => {
|
|
39622
|
-
return !!debouncedFunc.current;
|
|
39623
|
-
};
|
|
39624
|
-
wrappedFunc.flush = () => {
|
|
39625
|
-
return debouncedFuncInstance.flush();
|
|
39626
|
-
};
|
|
39627
|
-
return wrappedFunc;
|
|
39628
|
-
}, [func, delay, options]);
|
|
39629
|
-
useEffect(() => {
|
|
39630
|
-
debouncedFunc.current = debounce$1(func, delay, options);
|
|
39631
|
-
}, [func, delay, options]);
|
|
39632
|
-
return debounced;
|
|
39633
|
-
}
|
|
39634
|
-
|
|
39635
|
-
function floorToDecimal(num, decimalPlaces) {
|
|
39636
|
-
const factor = 10 ** decimalPlaces;
|
|
39637
|
-
return Math.floor(num * factor) / factor;
|
|
39638
|
-
}
|
|
39639
|
-
const parseQuotaValue = (key, val) => {
|
|
39640
|
-
let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
|
|
39641
|
-
if (key === "cpu") {
|
|
39642
|
-
if (val.endsWith("m")) {
|
|
39643
|
-
numericValue /= 1e3;
|
|
39644
|
-
}
|
|
39645
|
-
return floorToDecimal(numericValue, 1);
|
|
39646
|
-
}
|
|
39647
|
-
if (val.endsWith("m")) {
|
|
39648
|
-
numericValue /= 1e3;
|
|
39649
|
-
} else if (val.endsWith("k")) {
|
|
39650
|
-
numericValue /= 1e6;
|
|
39651
|
-
} else if (val.endsWith("M")) {
|
|
39652
|
-
numericValue /= 1e3;
|
|
39653
|
-
} else if (val.endsWith("G")) {
|
|
39654
|
-
numericValue /= 1;
|
|
39655
|
-
} else if (val.endsWith("T")) {
|
|
39656
|
-
numericValue *= 1e3;
|
|
39657
|
-
} else if (val.endsWith("Ki")) {
|
|
39658
|
-
numericValue /= 1024;
|
|
39659
|
-
numericValue /= 1e6;
|
|
39660
|
-
} else if (val.endsWith("Mi")) {
|
|
39661
|
-
numericValue /= 1e3;
|
|
39662
|
-
numericValue /= 1e3;
|
|
39663
|
-
} else if (/^\d+(\.\d+)?$/.test(val)) {
|
|
39664
|
-
numericValue /= 1e9;
|
|
39665
|
-
} else {
|
|
39666
|
-
throw new Error("Invalid value");
|
|
39667
|
-
}
|
|
39668
|
-
return floorToDecimal(numericValue, 1);
|
|
39669
|
-
};
|
|
39670
|
-
const parseQuotaValueCpu = (val) => {
|
|
39671
|
-
if (typeof val === "string") {
|
|
39672
|
-
let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
|
|
39673
|
-
if (val.endsWith("m")) {
|
|
39674
|
-
numericValue /= 1e3;
|
|
39675
|
-
}
|
|
39676
|
-
return floorToDecimal(numericValue, 1);
|
|
39677
|
-
}
|
|
39678
|
-
return 0;
|
|
39679
|
-
};
|
|
39680
|
-
const parseQuotaValueMemoryAndStorage = (val) => {
|
|
39681
|
-
if (typeof val === "string") {
|
|
39682
|
-
let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
|
|
39683
|
-
if (val.endsWith("k")) {
|
|
39684
|
-
numericValue /= 1e6;
|
|
39685
|
-
} else if (val.endsWith("m")) {
|
|
39686
|
-
numericValue /= 1e3;
|
|
39687
|
-
} else if (val.endsWith("M")) {
|
|
39688
|
-
numericValue /= 1e3;
|
|
39689
|
-
} else if (val.endsWith("G")) {
|
|
39690
|
-
numericValue /= 1;
|
|
39691
|
-
} else if (val.endsWith("T")) {
|
|
39692
|
-
numericValue *= 1e3;
|
|
39693
|
-
} else if (val.endsWith("P")) {
|
|
39694
|
-
numericValue *= 1e6;
|
|
39695
|
-
} else if (val.endsWith("E")) {
|
|
39696
|
-
numericValue *= 1e9;
|
|
39697
|
-
} else if (val.endsWith("Ki")) {
|
|
39698
|
-
numericValue *= 1024 / 1e9;
|
|
39699
|
-
} else if (val.endsWith("Mi")) {
|
|
39700
|
-
numericValue /= 1048.576;
|
|
39701
|
-
} else if (val.endsWith("Gi")) {
|
|
39702
|
-
numericValue *= 1.073741824;
|
|
39703
|
-
} else if (val.endsWith("Ti")) {
|
|
39704
|
-
numericValue *= 1.099511628;
|
|
39705
|
-
} else if (val.endsWith("Pi")) {
|
|
39706
|
-
numericValue *= 1.125899907;
|
|
39707
|
-
} else if (val.endsWith("Ei")) {
|
|
39708
|
-
numericValue *= 1.152921505;
|
|
39709
|
-
} else if (val === "0") {
|
|
39710
|
-
return 0;
|
|
39711
|
-
} else {
|
|
39712
|
-
throw new Error("Invalid value");
|
|
39713
|
-
}
|
|
39714
|
-
return floorToDecimal(numericValue, 1);
|
|
39715
|
-
}
|
|
39716
|
-
return 0;
|
|
39717
|
-
};
|
|
39718
|
-
|
|
39719
|
-
const findAllPathsForObject = (obj, targetKey, targetValue, currentPath = []) => {
|
|
39720
|
-
let paths = [];
|
|
39721
|
-
if (typeof obj !== "object" || obj === null) {
|
|
39722
|
-
return paths;
|
|
39723
|
-
}
|
|
39724
|
-
if (obj[targetKey] === targetValue) {
|
|
39725
|
-
paths.push([...currentPath]);
|
|
39726
|
-
}
|
|
39727
|
-
for (const key in obj) {
|
|
39728
|
-
if (obj.hasOwnProperty(key)) {
|
|
39729
|
-
const value = obj[key];
|
|
39730
|
-
if (typeof value === "object" && value !== null) {
|
|
39731
|
-
const newPath = [...currentPath, key];
|
|
39732
|
-
const subPaths = findAllPathsForObject(value, targetKey, targetValue, newPath);
|
|
39733
|
-
paths = paths.concat(subPaths);
|
|
39734
|
-
}
|
|
39735
|
-
}
|
|
39736
|
-
}
|
|
39737
|
-
return paths;
|
|
39738
|
-
};
|
|
39739
|
-
const normalizeValuesForQuotasToNumber = (object, properties) => {
|
|
39740
|
-
const newObject = _$1.cloneDeep(object);
|
|
39741
|
-
const cpuPaths = findAllPathsForObject(properties, "type", "rangeInputCpu");
|
|
39742
|
-
const memoryPaths = findAllPathsForObject(properties, "type", "rangeInputMemory");
|
|
39743
|
-
memoryPaths.forEach((path) => {
|
|
39744
|
-
const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
|
|
39745
|
-
const value = _$1.get(newObject, cleanPath);
|
|
39746
|
-
if (value || value === 0) {
|
|
39747
|
-
_$1.set(newObject, cleanPath, parseQuotaValueMemoryAndStorage(value));
|
|
39748
|
-
}
|
|
39749
|
-
});
|
|
39750
|
-
cpuPaths.forEach((path) => {
|
|
39751
|
-
const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
|
|
39752
|
-
const value = _$1.get(newObject, cleanPath);
|
|
39753
|
-
if (value || value === 0) {
|
|
39754
|
-
_$1.set(newObject, cleanPath, parseQuotaValueCpu(value));
|
|
39755
|
-
}
|
|
39756
|
-
});
|
|
39757
|
-
return newObject;
|
|
39758
|
-
};
|
|
39759
|
-
|
|
39760
|
-
const getAllPathsFromObj = (obj, prefix = []) => {
|
|
39761
|
-
const entries = Array.isArray(obj) ? obj.map((value, index) => [index, value]) : Object.entries(obj);
|
|
39762
|
-
return entries.flatMap(([key, value]) => {
|
|
39763
|
-
const currentPath = [...prefix, key];
|
|
39764
|
-
return typeof value === "object" && value !== null ? [currentPath, ...getAllPathsFromObj(value, currentPath)] : [currentPath];
|
|
39765
|
-
});
|
|
39766
|
-
};
|
|
39767
|
-
|
|
39768
|
-
const getPrefixSubarrays = (arr) => {
|
|
39769
|
-
return arr.map((_, index) => arr.slice(0, index + 1));
|
|
39770
|
-
};
|
|
39771
|
-
|
|
39772
|
-
const deepMerge = (a, b) => {
|
|
39773
|
-
const result = { ...a };
|
|
39774
|
-
for (const key of Object.keys(b)) {
|
|
39775
|
-
const aVal = a[key];
|
|
39776
|
-
const bVal = b[key];
|
|
39777
|
-
if (aVal !== null && bVal !== null && typeof aVal === "object" && typeof bVal === "object" && !Array.isArray(aVal) && !Array.isArray(bVal)) {
|
|
39778
|
-
result[key] = deepMerge(aVal, bVal);
|
|
39779
|
-
} else {
|
|
39780
|
-
result[key] = bVal;
|
|
39781
|
-
}
|
|
39782
|
-
}
|
|
39783
|
-
return result;
|
|
39784
|
-
};
|
|
39785
|
-
|
|
39786
|
-
function _defineProperty$1(obj, key, value) {
|
|
39787
|
-
if (key in obj) {
|
|
39788
|
-
Object.defineProperty(obj, key, {
|
|
39789
|
-
value: value,
|
|
39790
|
-
enumerable: true,
|
|
39791
|
-
configurable: true,
|
|
39792
|
-
writable: true
|
|
39793
|
-
});
|
|
39794
|
-
} else {
|
|
39795
|
-
obj[key] = value;
|
|
39796
|
-
}
|
|
39797
|
-
|
|
39798
|
-
return obj;
|
|
39799
|
-
}
|
|
39800
|
-
|
|
39801
|
-
function ownKeys$1(object, enumerableOnly) {
|
|
39802
|
-
var keys = Object.keys(object);
|
|
39803
|
-
|
|
39804
|
-
if (Object.getOwnPropertySymbols) {
|
|
39805
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
39806
|
-
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
39807
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
39808
|
-
});
|
|
39809
|
-
keys.push.apply(keys, symbols);
|
|
39810
|
-
}
|
|
39811
|
-
|
|
39812
|
-
return keys;
|
|
39813
|
-
}
|
|
39814
|
-
|
|
39815
|
-
function _objectSpread2$1(target) {
|
|
39816
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
39817
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
39818
|
-
|
|
39819
|
-
if (i % 2) {
|
|
39820
|
-
ownKeys$1(Object(source), true).forEach(function (key) {
|
|
39821
|
-
_defineProperty$1(target, key, source[key]);
|
|
39822
|
-
});
|
|
39823
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
39824
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
39825
|
-
} else {
|
|
39826
|
-
ownKeys$1(Object(source)).forEach(function (key) {
|
|
39827
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
39828
|
-
});
|
|
39829
|
-
}
|
|
39830
|
-
}
|
|
39831
|
-
|
|
39832
|
-
return target;
|
|
39833
|
-
}
|
|
39834
|
-
|
|
39835
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
39836
|
-
if (source == null) return {};
|
|
39837
|
-
var target = {};
|
|
39838
|
-
var sourceKeys = Object.keys(source);
|
|
39839
|
-
var key, i;
|
|
39840
|
-
|
|
39841
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
39842
|
-
key = sourceKeys[i];
|
|
39843
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
39844
|
-
target[key] = source[key];
|
|
39845
|
-
}
|
|
39846
|
-
|
|
39847
|
-
return target;
|
|
39848
|
-
}
|
|
39849
|
-
|
|
39850
|
-
function _objectWithoutProperties(source, excluded) {
|
|
39851
|
-
if (source == null) return {};
|
|
39852
|
-
|
|
39853
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
39854
|
-
|
|
39855
|
-
var key, i;
|
|
39856
|
-
|
|
39857
|
-
if (Object.getOwnPropertySymbols) {
|
|
39858
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
39859
|
-
|
|
39860
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
39861
|
-
key = sourceSymbolKeys[i];
|
|
39862
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
39863
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
39864
|
-
target[key] = source[key];
|
|
39865
|
-
}
|
|
39866
|
-
}
|
|
39867
|
-
|
|
39868
|
-
return target;
|
|
39869
|
-
}
|
|
39870
|
-
|
|
39871
|
-
function _slicedToArray(arr, i) {
|
|
39872
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
39873
|
-
}
|
|
39874
|
-
|
|
39875
|
-
function _arrayWithHoles(arr) {
|
|
39876
|
-
if (Array.isArray(arr)) return arr;
|
|
39877
|
-
}
|
|
39878
|
-
|
|
39879
|
-
function _iterableToArrayLimit(arr, i) {
|
|
39880
|
-
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
39881
|
-
var _arr = [];
|
|
39882
|
-
var _n = true;
|
|
39883
|
-
var _d = false;
|
|
39884
|
-
var _e = undefined;
|
|
39885
|
-
|
|
39886
|
-
try {
|
|
39887
|
-
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
39888
|
-
_arr.push(_s.value);
|
|
39889
|
-
|
|
39890
|
-
if (i && _arr.length === i) break;
|
|
39891
|
-
}
|
|
39892
|
-
} catch (err) {
|
|
39893
|
-
_d = true;
|
|
39894
|
-
_e = err;
|
|
39895
|
-
} finally {
|
|
39896
|
-
try {
|
|
39897
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
39898
|
-
} finally {
|
|
39899
|
-
if (_d) throw _e;
|
|
39900
|
-
}
|
|
39901
|
-
}
|
|
39902
|
-
|
|
39903
|
-
return _arr;
|
|
39904
|
-
}
|
|
39905
|
-
|
|
39906
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
39907
|
-
if (!o) return;
|
|
39908
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
39909
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
39910
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
39911
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
39912
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
39913
|
-
}
|
|
39914
|
-
|
|
39915
|
-
function _arrayLikeToArray(arr, len) {
|
|
39916
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
39917
|
-
|
|
39918
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
39919
|
-
|
|
39920
|
-
return arr2;
|
|
39921
|
-
}
|
|
39922
|
-
|
|
39923
|
-
function _nonIterableRest() {
|
|
39924
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
39925
|
-
}
|
|
39926
|
-
|
|
39927
|
-
function _defineProperty(obj, key, value) {
|
|
39928
|
-
if (key in obj) {
|
|
39929
|
-
Object.defineProperty(obj, key, {
|
|
39930
|
-
value: value,
|
|
39931
|
-
enumerable: true,
|
|
39932
|
-
configurable: true,
|
|
39933
|
-
writable: true
|
|
39934
|
-
});
|
|
39935
|
-
} else {
|
|
39936
|
-
obj[key] = value;
|
|
39937
|
-
}
|
|
39938
|
-
|
|
39939
|
-
return obj;
|
|
39940
|
-
}
|
|
39661
|
+
return obj;
|
|
39662
|
+
}
|
|
39941
39663
|
|
|
39942
39664
|
function ownKeys(object, enumerableOnly) {
|
|
39943
39665
|
var keys = Object.keys(object);
|
|
@@ -40003,7 +39725,7 @@ function curry$1(fn) {
|
|
|
40003
39725
|
};
|
|
40004
39726
|
}
|
|
40005
39727
|
|
|
40006
|
-
function isObject$
|
|
39728
|
+
function isObject$2(value) {
|
|
40007
39729
|
return {}.toString.call(value).includes('Object');
|
|
40008
39730
|
}
|
|
40009
39731
|
|
|
@@ -40020,7 +39742,7 @@ function hasOwnProperty(object, property) {
|
|
|
40020
39742
|
}
|
|
40021
39743
|
|
|
40022
39744
|
function validateChanges(initial, changes) {
|
|
40023
|
-
if (!isObject$
|
|
39745
|
+
if (!isObject$2(changes)) errorHandler$1('changeType');
|
|
40024
39746
|
if (Object.keys(changes).some(function (field) {
|
|
40025
39747
|
return !hasOwnProperty(initial, field);
|
|
40026
39748
|
})) errorHandler$1('changeField');
|
|
@@ -40032,15 +39754,15 @@ function validateSelector(selector) {
|
|
|
40032
39754
|
}
|
|
40033
39755
|
|
|
40034
39756
|
function validateHandler(handler) {
|
|
40035
|
-
if (!(isFunction(handler) || isObject$
|
|
40036
|
-
if (isObject$
|
|
39757
|
+
if (!(isFunction(handler) || isObject$2(handler))) errorHandler$1('handlerType');
|
|
39758
|
+
if (isObject$2(handler) && Object.values(handler).some(function (_handler) {
|
|
40037
39759
|
return !isFunction(_handler);
|
|
40038
39760
|
})) errorHandler$1('handlersType');
|
|
40039
39761
|
}
|
|
40040
39762
|
|
|
40041
39763
|
function validateInitial(initial) {
|
|
40042
39764
|
if (!initial) errorHandler$1('initialIsRequired');
|
|
40043
|
-
if (!isObject$
|
|
39765
|
+
if (!isObject$2(initial)) errorHandler$1('initialType');
|
|
40044
39766
|
if (isEmpty$1(initial)) errorHandler$1('initialContent');
|
|
40045
39767
|
}
|
|
40046
39768
|
|
|
@@ -40140,7 +39862,7 @@ function curry(fn) {
|
|
|
40140
39862
|
};
|
|
40141
39863
|
}
|
|
40142
39864
|
|
|
40143
|
-
function isObject(value) {
|
|
39865
|
+
function isObject$1(value) {
|
|
40144
39866
|
return {}.toString.call(value).includes('Object');
|
|
40145
39867
|
}
|
|
40146
39868
|
|
|
@@ -40152,7 +39874,7 @@ function isObject(value) {
|
|
|
40152
39874
|
|
|
40153
39875
|
function validateConfig(config) {
|
|
40154
39876
|
if (!config) errorHandler('configIsRequired');
|
|
40155
|
-
if (!isObject(config)) errorHandler('configType');
|
|
39877
|
+
if (!isObject$1(config)) errorHandler('configType');
|
|
40156
39878
|
|
|
40157
39879
|
if (config.urls) {
|
|
40158
39880
|
informAboutDeprecation();
|
|
@@ -47288,120 +47010,6 @@ function stringify(value, replacer, options) {
|
|
|
47288
47010
|
}
|
|
47289
47011
|
|
|
47290
47012
|
const BorderRadiusContainer$1 = styled.div`
|
|
47291
|
-
height: 100%;
|
|
47292
|
-
border: 1px solid ${({ $colorBorder }) => $colorBorder};
|
|
47293
|
-
border-radius: 8px;
|
|
47294
|
-
padding: 2px;
|
|
47295
|
-
|
|
47296
|
-
.monaco-editor,
|
|
47297
|
-
.overflow-guard {
|
|
47298
|
-
border-radius: 8px;
|
|
47299
|
-
}
|
|
47300
|
-
`;
|
|
47301
|
-
const Styled$k = {
|
|
47302
|
-
BorderRadiusContainer: BorderRadiusContainer$1
|
|
47303
|
-
};
|
|
47304
|
-
|
|
47305
|
-
const YamlEditor = ({ theme: theme$1, currentValues, onChange, editorUri }) => {
|
|
47306
|
-
const { token } = theme.useToken();
|
|
47307
|
-
const [yamlData, setYamlData] = useState("");
|
|
47308
|
-
const editorRef = useRef(null);
|
|
47309
|
-
const monacoRef = useRef(null);
|
|
47310
|
-
const isFocusedRef = useRef(false);
|
|
47311
|
-
const pendingExternalYamlRef = useRef(null);
|
|
47312
|
-
const isApplyingExternalUpdateRef = useRef(false);
|
|
47313
|
-
useEffect(() => {
|
|
47314
|
-
const next = stringify(currentValues, {
|
|
47315
|
-
// Use literal block scalar for multiline strings
|
|
47316
|
-
blockQuote: "literal",
|
|
47317
|
-
// Preserve line breaks
|
|
47318
|
-
lineWidth: 0,
|
|
47319
|
-
// Use double quotes for strings that need escaping
|
|
47320
|
-
doubleQuotedAsJSON: false
|
|
47321
|
-
});
|
|
47322
|
-
if (isFocusedRef.current) {
|
|
47323
|
-
pendingExternalYamlRef.current = next ?? "";
|
|
47324
|
-
return;
|
|
47325
|
-
}
|
|
47326
|
-
setYamlData(next ?? "");
|
|
47327
|
-
}, [currentValues]);
|
|
47328
|
-
useEffect(() => {
|
|
47329
|
-
const editor = editorRef.current;
|
|
47330
|
-
const monaco = monacoRef.current;
|
|
47331
|
-
if (editor && monaco) {
|
|
47332
|
-
if (isFocusedRef.current) return;
|
|
47333
|
-
const uri = monaco.Uri.parse(editorUri);
|
|
47334
|
-
let model = editor.getModel() || monaco.editor.getModel(uri);
|
|
47335
|
-
if (!model) {
|
|
47336
|
-
model = monaco.editor.createModel(yamlData ?? "", "yaml", uri);
|
|
47337
|
-
}
|
|
47338
|
-
if (model) {
|
|
47339
|
-
monaco.editor.setModelLanguage(model, "yaml");
|
|
47340
|
-
const current = model.getValue();
|
|
47341
|
-
if ((yamlData ?? "") !== current) {
|
|
47342
|
-
isApplyingExternalUpdateRef.current = true;
|
|
47343
|
-
model.setValue(yamlData ?? "");
|
|
47344
|
-
}
|
|
47345
|
-
}
|
|
47346
|
-
}
|
|
47347
|
-
}, [yamlData, editorUri]);
|
|
47348
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$k.BorderRadiusContainer, { $colorBorder: token.colorBorder, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47349
|
-
Ft,
|
|
47350
|
-
{
|
|
47351
|
-
language: "yaml",
|
|
47352
|
-
path: editorUri,
|
|
47353
|
-
keepCurrentModel: true,
|
|
47354
|
-
width: "100%",
|
|
47355
|
-
height: "100%",
|
|
47356
|
-
defaultValue: yamlData ?? "",
|
|
47357
|
-
onMount: (editor, m) => {
|
|
47358
|
-
editorRef.current = editor;
|
|
47359
|
-
monacoRef.current = m;
|
|
47360
|
-
try {
|
|
47361
|
-
isFocusedRef.current = !!editor.hasTextFocus?.();
|
|
47362
|
-
} catch {
|
|
47363
|
-
isFocusedRef.current = false;
|
|
47364
|
-
}
|
|
47365
|
-
editor.onDidFocusEditorText(() => {
|
|
47366
|
-
isFocusedRef.current = true;
|
|
47367
|
-
});
|
|
47368
|
-
editor.onDidBlurEditorText(() => {
|
|
47369
|
-
isFocusedRef.current = false;
|
|
47370
|
-
if (pendingExternalYamlRef.current !== null) {
|
|
47371
|
-
setYamlData(pendingExternalYamlRef.current);
|
|
47372
|
-
pendingExternalYamlRef.current = null;
|
|
47373
|
-
}
|
|
47374
|
-
});
|
|
47375
|
-
const uri = m.Uri.parse("inmemory://openapi-ui/form.yaml");
|
|
47376
|
-
let model = editor.getModel() || m.editor.getModel(uri);
|
|
47377
|
-
if (!model) {
|
|
47378
|
-
model = m.editor.createModel(yamlData ?? "", "yaml", uri);
|
|
47379
|
-
}
|
|
47380
|
-
if (model) {
|
|
47381
|
-
m.editor.setModelLanguage(model, "yaml");
|
|
47382
|
-
}
|
|
47383
|
-
},
|
|
47384
|
-
onChange: (value) => {
|
|
47385
|
-
if (isApplyingExternalUpdateRef.current) {
|
|
47386
|
-
isApplyingExternalUpdateRef.current = false;
|
|
47387
|
-
setYamlData(value || "");
|
|
47388
|
-
return;
|
|
47389
|
-
}
|
|
47390
|
-
try {
|
|
47391
|
-
onChange(parse(value || ""));
|
|
47392
|
-
} catch {
|
|
47393
|
-
}
|
|
47394
|
-
setYamlData(value || "");
|
|
47395
|
-
},
|
|
47396
|
-
theme: theme$1 === "dark" ? "vs-dark" : theme$1 === void 0 ? "vs-dark" : "vs",
|
|
47397
|
-
options: {
|
|
47398
|
-
theme: theme$1 === "dark" ? "vs-dark" : theme$1 === void 0 ? "vs-dark" : "vs"
|
|
47399
|
-
}
|
|
47400
|
-
}
|
|
47401
|
-
) });
|
|
47402
|
-
};
|
|
47403
|
-
|
|
47404
|
-
const BorderRadiusContainer = styled.div`
|
|
47405
47013
|
height: ${({ $designNewLayoutHeight }) => $designNewLayoutHeight ? `${$designNewLayoutHeight}px` : "75vh"};
|
|
47406
47014
|
border: 1px solid ${({ $colorBorder }) => $colorBorder};
|
|
47407
47015
|
border-radius: 8px;
|
|
@@ -47425,8 +47033,8 @@ const BigText$1 = styled.div`
|
|
|
47425
47033
|
font-size: 16px;
|
|
47426
47034
|
line-height: 24px;
|
|
47427
47035
|
`;
|
|
47428
|
-
const Styled$
|
|
47429
|
-
BorderRadiusContainer,
|
|
47036
|
+
const Styled$k = {
|
|
47037
|
+
BorderRadiusContainer: BorderRadiusContainer$1,
|
|
47430
47038
|
ControlsRowContainer: ControlsRowContainer$1,
|
|
47431
47039
|
BigText: BigText$1
|
|
47432
47040
|
};
|
|
@@ -47549,7 +47157,7 @@ const YamlEditorSingleton = ({
|
|
|
47549
47157
|
};
|
|
47550
47158
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
47551
47159
|
contextHolder,
|
|
47552
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Styled$
|
|
47160
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Styled$k.BorderRadiusContainer, { $designNewLayoutHeight: designNewLayoutHeight, $colorBorder: token.colorBorder, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47553
47161
|
Ft,
|
|
47554
47162
|
{
|
|
47555
47163
|
defaultLanguage: "yaml",
|
|
@@ -47568,7 +47176,7 @@ const YamlEditorSingleton = ({
|
|
|
47568
47176
|
}
|
|
47569
47177
|
}
|
|
47570
47178
|
) }),
|
|
47571
|
-
!readOnly && /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$
|
|
47179
|
+
!readOnly && /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$k.ControlsRowContainer, { $bgColor: token.colorPrimaryBg, $designNewLayout: designNewLayout, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { gap: designNewLayout ? 10 : 16, align: "center", children: [
|
|
47572
47180
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "primary", onClick: onSubmit, loading: isLoading, children: "Submit" }),
|
|
47573
47181
|
backlink && /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: () => navigate(backlink), children: "Cancel" }),
|
|
47574
47182
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: handleReload, children: "Reload" })
|
|
@@ -47579,7 +47187,7 @@ const YamlEditorSingleton = ({
|
|
|
47579
47187
|
open: !!error,
|
|
47580
47188
|
onOk: () => setError(void 0),
|
|
47581
47189
|
onCancel: () => setError(void 0),
|
|
47582
|
-
title: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography.Text, { type: "danger", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$
|
|
47190
|
+
title: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography.Text, { type: "danger", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$k.BigText, { children: "Error!" }) }),
|
|
47583
47191
|
cancelButtonProps: { style: { display: "none" } },
|
|
47584
47192
|
children: [
|
|
47585
47193
|
"An error has occurred: ",
|
|
@@ -47590,6 +47198,692 @@ const YamlEditorSingleton = ({
|
|
|
47590
47198
|
] });
|
|
47591
47199
|
};
|
|
47592
47200
|
|
|
47201
|
+
/**
|
|
47202
|
+
* lodash (Custom Build) <https://lodash.com/>
|
|
47203
|
+
* Build: `lodash modularize exports="npm" -o ./`
|
|
47204
|
+
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
47205
|
+
* Released under MIT license <https://lodash.com/license>
|
|
47206
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
47207
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
47208
|
+
*/
|
|
47209
|
+
|
|
47210
|
+
/** Used as the `TypeError` message for "Functions" methods. */
|
|
47211
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
47212
|
+
|
|
47213
|
+
/** Used as references for various `Number` constants. */
|
|
47214
|
+
var NAN = 0 / 0;
|
|
47215
|
+
|
|
47216
|
+
/** `Object#toString` result references. */
|
|
47217
|
+
var symbolTag = '[object Symbol]';
|
|
47218
|
+
|
|
47219
|
+
/** Used to match leading and trailing whitespace. */
|
|
47220
|
+
var reTrim = /^\s+|\s+$/g;
|
|
47221
|
+
|
|
47222
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
47223
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
47224
|
+
|
|
47225
|
+
/** Used to detect binary string values. */
|
|
47226
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
47227
|
+
|
|
47228
|
+
/** Used to detect octal string values. */
|
|
47229
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
47230
|
+
|
|
47231
|
+
/** Built-in method references without a dependency on `root`. */
|
|
47232
|
+
var freeParseInt = parseInt;
|
|
47233
|
+
|
|
47234
|
+
/** Detect free variable `global` from Node.js. */
|
|
47235
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
47236
|
+
|
|
47237
|
+
/** Detect free variable `self`. */
|
|
47238
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
47239
|
+
|
|
47240
|
+
/** Used as a reference to the global object. */
|
|
47241
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
|
47242
|
+
|
|
47243
|
+
/** Used for built-in method references. */
|
|
47244
|
+
var objectProto = Object.prototype;
|
|
47245
|
+
|
|
47246
|
+
/**
|
|
47247
|
+
* Used to resolve the
|
|
47248
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
47249
|
+
* of values.
|
|
47250
|
+
*/
|
|
47251
|
+
var objectToString = objectProto.toString;
|
|
47252
|
+
|
|
47253
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
47254
|
+
var nativeMax = Math.max,
|
|
47255
|
+
nativeMin = Math.min;
|
|
47256
|
+
|
|
47257
|
+
/**
|
|
47258
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
47259
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
47260
|
+
*
|
|
47261
|
+
* @static
|
|
47262
|
+
* @memberOf _
|
|
47263
|
+
* @since 2.4.0
|
|
47264
|
+
* @category Date
|
|
47265
|
+
* @returns {number} Returns the timestamp.
|
|
47266
|
+
* @example
|
|
47267
|
+
*
|
|
47268
|
+
* _.defer(function(stamp) {
|
|
47269
|
+
* console.log(_.now() - stamp);
|
|
47270
|
+
* }, _.now());
|
|
47271
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
47272
|
+
*/
|
|
47273
|
+
var now = function() {
|
|
47274
|
+
return root.Date.now();
|
|
47275
|
+
};
|
|
47276
|
+
|
|
47277
|
+
/**
|
|
47278
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
47279
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
47280
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
47281
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
47282
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
47283
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
47284
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
47285
|
+
* calls to the debounced function return the result of the last `func`
|
|
47286
|
+
* invocation.
|
|
47287
|
+
*
|
|
47288
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
47289
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
47290
|
+
* is invoked more than once during the `wait` timeout.
|
|
47291
|
+
*
|
|
47292
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
47293
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
47294
|
+
*
|
|
47295
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
47296
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
47297
|
+
*
|
|
47298
|
+
* @static
|
|
47299
|
+
* @memberOf _
|
|
47300
|
+
* @since 0.1.0
|
|
47301
|
+
* @category Function
|
|
47302
|
+
* @param {Function} func The function to debounce.
|
|
47303
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
47304
|
+
* @param {Object} [options={}] The options object.
|
|
47305
|
+
* @param {boolean} [options.leading=false]
|
|
47306
|
+
* Specify invoking on the leading edge of the timeout.
|
|
47307
|
+
* @param {number} [options.maxWait]
|
|
47308
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
47309
|
+
* @param {boolean} [options.trailing=true]
|
|
47310
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
47311
|
+
* @returns {Function} Returns the new debounced function.
|
|
47312
|
+
* @example
|
|
47313
|
+
*
|
|
47314
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
47315
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
47316
|
+
*
|
|
47317
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
47318
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
47319
|
+
* 'leading': true,
|
|
47320
|
+
* 'trailing': false
|
|
47321
|
+
* }));
|
|
47322
|
+
*
|
|
47323
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
47324
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
47325
|
+
* var source = new EventSource('/stream');
|
|
47326
|
+
* jQuery(source).on('message', debounced);
|
|
47327
|
+
*
|
|
47328
|
+
* // Cancel the trailing debounced invocation.
|
|
47329
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
47330
|
+
*/
|
|
47331
|
+
function debounce(func, wait, options) {
|
|
47332
|
+
var lastArgs,
|
|
47333
|
+
lastThis,
|
|
47334
|
+
maxWait,
|
|
47335
|
+
result,
|
|
47336
|
+
timerId,
|
|
47337
|
+
lastCallTime,
|
|
47338
|
+
lastInvokeTime = 0,
|
|
47339
|
+
leading = false,
|
|
47340
|
+
maxing = false,
|
|
47341
|
+
trailing = true;
|
|
47342
|
+
|
|
47343
|
+
if (typeof func != 'function') {
|
|
47344
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
47345
|
+
}
|
|
47346
|
+
wait = toNumber(wait) || 0;
|
|
47347
|
+
if (isObject(options)) {
|
|
47348
|
+
leading = !!options.leading;
|
|
47349
|
+
maxing = 'maxWait' in options;
|
|
47350
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
47351
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
47352
|
+
}
|
|
47353
|
+
|
|
47354
|
+
function invokeFunc(time) {
|
|
47355
|
+
var args = lastArgs,
|
|
47356
|
+
thisArg = lastThis;
|
|
47357
|
+
|
|
47358
|
+
lastArgs = lastThis = undefined;
|
|
47359
|
+
lastInvokeTime = time;
|
|
47360
|
+
result = func.apply(thisArg, args);
|
|
47361
|
+
return result;
|
|
47362
|
+
}
|
|
47363
|
+
|
|
47364
|
+
function leadingEdge(time) {
|
|
47365
|
+
// Reset any `maxWait` timer.
|
|
47366
|
+
lastInvokeTime = time;
|
|
47367
|
+
// Start the timer for the trailing edge.
|
|
47368
|
+
timerId = setTimeout(timerExpired, wait);
|
|
47369
|
+
// Invoke the leading edge.
|
|
47370
|
+
return leading ? invokeFunc(time) : result;
|
|
47371
|
+
}
|
|
47372
|
+
|
|
47373
|
+
function remainingWait(time) {
|
|
47374
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
47375
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
47376
|
+
result = wait - timeSinceLastCall;
|
|
47377
|
+
|
|
47378
|
+
return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
|
|
47379
|
+
}
|
|
47380
|
+
|
|
47381
|
+
function shouldInvoke(time) {
|
|
47382
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
47383
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
47384
|
+
|
|
47385
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
47386
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
47387
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
47388
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
47389
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
47390
|
+
}
|
|
47391
|
+
|
|
47392
|
+
function timerExpired() {
|
|
47393
|
+
var time = now();
|
|
47394
|
+
if (shouldInvoke(time)) {
|
|
47395
|
+
return trailingEdge(time);
|
|
47396
|
+
}
|
|
47397
|
+
// Restart the timer.
|
|
47398
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
47399
|
+
}
|
|
47400
|
+
|
|
47401
|
+
function trailingEdge(time) {
|
|
47402
|
+
timerId = undefined;
|
|
47403
|
+
|
|
47404
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
47405
|
+
// debounced at least once.
|
|
47406
|
+
if (trailing && lastArgs) {
|
|
47407
|
+
return invokeFunc(time);
|
|
47408
|
+
}
|
|
47409
|
+
lastArgs = lastThis = undefined;
|
|
47410
|
+
return result;
|
|
47411
|
+
}
|
|
47412
|
+
|
|
47413
|
+
function cancel() {
|
|
47414
|
+
if (timerId !== undefined) {
|
|
47415
|
+
clearTimeout(timerId);
|
|
47416
|
+
}
|
|
47417
|
+
lastInvokeTime = 0;
|
|
47418
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
47419
|
+
}
|
|
47420
|
+
|
|
47421
|
+
function flush() {
|
|
47422
|
+
return timerId === undefined ? result : trailingEdge(now());
|
|
47423
|
+
}
|
|
47424
|
+
|
|
47425
|
+
function debounced() {
|
|
47426
|
+
var time = now(),
|
|
47427
|
+
isInvoking = shouldInvoke(time);
|
|
47428
|
+
|
|
47429
|
+
lastArgs = arguments;
|
|
47430
|
+
lastThis = this;
|
|
47431
|
+
lastCallTime = time;
|
|
47432
|
+
|
|
47433
|
+
if (isInvoking) {
|
|
47434
|
+
if (timerId === undefined) {
|
|
47435
|
+
return leadingEdge(lastCallTime);
|
|
47436
|
+
}
|
|
47437
|
+
if (maxing) {
|
|
47438
|
+
// Handle invocations in a tight loop.
|
|
47439
|
+
timerId = setTimeout(timerExpired, wait);
|
|
47440
|
+
return invokeFunc(lastCallTime);
|
|
47441
|
+
}
|
|
47442
|
+
}
|
|
47443
|
+
if (timerId === undefined) {
|
|
47444
|
+
timerId = setTimeout(timerExpired, wait);
|
|
47445
|
+
}
|
|
47446
|
+
return result;
|
|
47447
|
+
}
|
|
47448
|
+
debounced.cancel = cancel;
|
|
47449
|
+
debounced.flush = flush;
|
|
47450
|
+
return debounced;
|
|
47451
|
+
}
|
|
47452
|
+
|
|
47453
|
+
/**
|
|
47454
|
+
* Checks if `value` is the
|
|
47455
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
47456
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
47457
|
+
*
|
|
47458
|
+
* @static
|
|
47459
|
+
* @memberOf _
|
|
47460
|
+
* @since 0.1.0
|
|
47461
|
+
* @category Lang
|
|
47462
|
+
* @param {*} value The value to check.
|
|
47463
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
47464
|
+
* @example
|
|
47465
|
+
*
|
|
47466
|
+
* _.isObject({});
|
|
47467
|
+
* // => true
|
|
47468
|
+
*
|
|
47469
|
+
* _.isObject([1, 2, 3]);
|
|
47470
|
+
* // => true
|
|
47471
|
+
*
|
|
47472
|
+
* _.isObject(_.noop);
|
|
47473
|
+
* // => true
|
|
47474
|
+
*
|
|
47475
|
+
* _.isObject(null);
|
|
47476
|
+
* // => false
|
|
47477
|
+
*/
|
|
47478
|
+
function isObject(value) {
|
|
47479
|
+
var type = typeof value;
|
|
47480
|
+
return !!value && (type == 'object' || type == 'function');
|
|
47481
|
+
}
|
|
47482
|
+
|
|
47483
|
+
/**
|
|
47484
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
47485
|
+
* and has a `typeof` result of "object".
|
|
47486
|
+
*
|
|
47487
|
+
* @static
|
|
47488
|
+
* @memberOf _
|
|
47489
|
+
* @since 4.0.0
|
|
47490
|
+
* @category Lang
|
|
47491
|
+
* @param {*} value The value to check.
|
|
47492
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
47493
|
+
* @example
|
|
47494
|
+
*
|
|
47495
|
+
* _.isObjectLike({});
|
|
47496
|
+
* // => true
|
|
47497
|
+
*
|
|
47498
|
+
* _.isObjectLike([1, 2, 3]);
|
|
47499
|
+
* // => true
|
|
47500
|
+
*
|
|
47501
|
+
* _.isObjectLike(_.noop);
|
|
47502
|
+
* // => false
|
|
47503
|
+
*
|
|
47504
|
+
* _.isObjectLike(null);
|
|
47505
|
+
* // => false
|
|
47506
|
+
*/
|
|
47507
|
+
function isObjectLike(value) {
|
|
47508
|
+
return !!value && typeof value == 'object';
|
|
47509
|
+
}
|
|
47510
|
+
|
|
47511
|
+
/**
|
|
47512
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
47513
|
+
*
|
|
47514
|
+
* @static
|
|
47515
|
+
* @memberOf _
|
|
47516
|
+
* @since 4.0.0
|
|
47517
|
+
* @category Lang
|
|
47518
|
+
* @param {*} value The value to check.
|
|
47519
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
47520
|
+
* @example
|
|
47521
|
+
*
|
|
47522
|
+
* _.isSymbol(Symbol.iterator);
|
|
47523
|
+
* // => true
|
|
47524
|
+
*
|
|
47525
|
+
* _.isSymbol('abc');
|
|
47526
|
+
* // => false
|
|
47527
|
+
*/
|
|
47528
|
+
function isSymbol(value) {
|
|
47529
|
+
return typeof value == 'symbol' ||
|
|
47530
|
+
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
|
47531
|
+
}
|
|
47532
|
+
|
|
47533
|
+
/**
|
|
47534
|
+
* Converts `value` to a number.
|
|
47535
|
+
*
|
|
47536
|
+
* @static
|
|
47537
|
+
* @memberOf _
|
|
47538
|
+
* @since 4.0.0
|
|
47539
|
+
* @category Lang
|
|
47540
|
+
* @param {*} value The value to process.
|
|
47541
|
+
* @returns {number} Returns the number.
|
|
47542
|
+
* @example
|
|
47543
|
+
*
|
|
47544
|
+
* _.toNumber(3.2);
|
|
47545
|
+
* // => 3.2
|
|
47546
|
+
*
|
|
47547
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
47548
|
+
* // => 5e-324
|
|
47549
|
+
*
|
|
47550
|
+
* _.toNumber(Infinity);
|
|
47551
|
+
* // => Infinity
|
|
47552
|
+
*
|
|
47553
|
+
* _.toNumber('3.2');
|
|
47554
|
+
* // => 3.2
|
|
47555
|
+
*/
|
|
47556
|
+
function toNumber(value) {
|
|
47557
|
+
if (typeof value == 'number') {
|
|
47558
|
+
return value;
|
|
47559
|
+
}
|
|
47560
|
+
if (isSymbol(value)) {
|
|
47561
|
+
return NAN;
|
|
47562
|
+
}
|
|
47563
|
+
if (isObject(value)) {
|
|
47564
|
+
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
47565
|
+
value = isObject(other) ? (other + '') : other;
|
|
47566
|
+
}
|
|
47567
|
+
if (typeof value != 'string') {
|
|
47568
|
+
return value === 0 ? value : +value;
|
|
47569
|
+
}
|
|
47570
|
+
value = value.replace(reTrim, '');
|
|
47571
|
+
var isBinary = reIsBinary.test(value);
|
|
47572
|
+
return (isBinary || reIsOctal.test(value))
|
|
47573
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
47574
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
|
47575
|
+
}
|
|
47576
|
+
|
|
47577
|
+
var lodash_debounce = debounce;
|
|
47578
|
+
|
|
47579
|
+
const debounce$1 = /*@__PURE__*/getDefaultExportFromCjs(lodash_debounce);
|
|
47580
|
+
|
|
47581
|
+
function useUnmount(func) {
|
|
47582
|
+
const funcRef = useRef(func);
|
|
47583
|
+
funcRef.current = func;
|
|
47584
|
+
useEffect(
|
|
47585
|
+
() => () => {
|
|
47586
|
+
funcRef.current();
|
|
47587
|
+
},
|
|
47588
|
+
[]
|
|
47589
|
+
);
|
|
47590
|
+
}
|
|
47591
|
+
|
|
47592
|
+
// src/useDebounceCallback/useDebounceCallback.ts
|
|
47593
|
+
function useDebounceCallback(func, delay = 500, options) {
|
|
47594
|
+
const debouncedFunc = useRef();
|
|
47595
|
+
useUnmount(() => {
|
|
47596
|
+
if (debouncedFunc.current) {
|
|
47597
|
+
debouncedFunc.current.cancel();
|
|
47598
|
+
}
|
|
47599
|
+
});
|
|
47600
|
+
const debounced = useMemo(() => {
|
|
47601
|
+
const debouncedFuncInstance = debounce$1(func, delay, options);
|
|
47602
|
+
const wrappedFunc = (...args) => {
|
|
47603
|
+
return debouncedFuncInstance(...args);
|
|
47604
|
+
};
|
|
47605
|
+
wrappedFunc.cancel = () => {
|
|
47606
|
+
debouncedFuncInstance.cancel();
|
|
47607
|
+
};
|
|
47608
|
+
wrappedFunc.isPending = () => {
|
|
47609
|
+
return !!debouncedFunc.current;
|
|
47610
|
+
};
|
|
47611
|
+
wrappedFunc.flush = () => {
|
|
47612
|
+
return debouncedFuncInstance.flush();
|
|
47613
|
+
};
|
|
47614
|
+
return wrappedFunc;
|
|
47615
|
+
}, [func, delay, options]);
|
|
47616
|
+
useEffect(() => {
|
|
47617
|
+
debouncedFunc.current = debounce$1(func, delay, options);
|
|
47618
|
+
}, [func, delay, options]);
|
|
47619
|
+
return debounced;
|
|
47620
|
+
}
|
|
47621
|
+
|
|
47622
|
+
function floorToDecimal(num, decimalPlaces) {
|
|
47623
|
+
const factor = 10 ** decimalPlaces;
|
|
47624
|
+
return Math.floor(num * factor) / factor;
|
|
47625
|
+
}
|
|
47626
|
+
const parseQuotaValue = (key, val) => {
|
|
47627
|
+
let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
|
|
47628
|
+
if (key === "cpu") {
|
|
47629
|
+
if (val.endsWith("m")) {
|
|
47630
|
+
numericValue /= 1e3;
|
|
47631
|
+
}
|
|
47632
|
+
return floorToDecimal(numericValue, 1);
|
|
47633
|
+
}
|
|
47634
|
+
if (val.endsWith("m")) {
|
|
47635
|
+
numericValue /= 1e3;
|
|
47636
|
+
} else if (val.endsWith("k")) {
|
|
47637
|
+
numericValue /= 1e6;
|
|
47638
|
+
} else if (val.endsWith("M")) {
|
|
47639
|
+
numericValue /= 1e3;
|
|
47640
|
+
} else if (val.endsWith("G")) {
|
|
47641
|
+
numericValue /= 1;
|
|
47642
|
+
} else if (val.endsWith("T")) {
|
|
47643
|
+
numericValue *= 1e3;
|
|
47644
|
+
} else if (val.endsWith("Ki")) {
|
|
47645
|
+
numericValue /= 1024;
|
|
47646
|
+
numericValue /= 1e6;
|
|
47647
|
+
} else if (val.endsWith("Mi")) {
|
|
47648
|
+
numericValue /= 1e3;
|
|
47649
|
+
numericValue /= 1e3;
|
|
47650
|
+
} else if (/^\d+(\.\d+)?$/.test(val)) {
|
|
47651
|
+
numericValue /= 1e9;
|
|
47652
|
+
} else {
|
|
47653
|
+
throw new Error("Invalid value");
|
|
47654
|
+
}
|
|
47655
|
+
return floorToDecimal(numericValue, 1);
|
|
47656
|
+
};
|
|
47657
|
+
const parseQuotaValueCpu = (val) => {
|
|
47658
|
+
if (typeof val === "string") {
|
|
47659
|
+
let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
|
|
47660
|
+
if (val.endsWith("m")) {
|
|
47661
|
+
numericValue /= 1e3;
|
|
47662
|
+
}
|
|
47663
|
+
return floorToDecimal(numericValue, 1);
|
|
47664
|
+
}
|
|
47665
|
+
return 0;
|
|
47666
|
+
};
|
|
47667
|
+
const parseQuotaValueMemoryAndStorage = (val) => {
|
|
47668
|
+
if (typeof val === "string") {
|
|
47669
|
+
let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
|
|
47670
|
+
if (val.endsWith("k")) {
|
|
47671
|
+
numericValue /= 1e6;
|
|
47672
|
+
} else if (val.endsWith("m")) {
|
|
47673
|
+
numericValue /= 1e3;
|
|
47674
|
+
} else if (val.endsWith("M")) {
|
|
47675
|
+
numericValue /= 1e3;
|
|
47676
|
+
} else if (val.endsWith("G")) {
|
|
47677
|
+
numericValue /= 1;
|
|
47678
|
+
} else if (val.endsWith("T")) {
|
|
47679
|
+
numericValue *= 1e3;
|
|
47680
|
+
} else if (val.endsWith("P")) {
|
|
47681
|
+
numericValue *= 1e6;
|
|
47682
|
+
} else if (val.endsWith("E")) {
|
|
47683
|
+
numericValue *= 1e9;
|
|
47684
|
+
} else if (val.endsWith("Ki")) {
|
|
47685
|
+
numericValue *= 1024 / 1e9;
|
|
47686
|
+
} else if (val.endsWith("Mi")) {
|
|
47687
|
+
numericValue /= 1048.576;
|
|
47688
|
+
} else if (val.endsWith("Gi")) {
|
|
47689
|
+
numericValue *= 1.073741824;
|
|
47690
|
+
} else if (val.endsWith("Ti")) {
|
|
47691
|
+
numericValue *= 1.099511628;
|
|
47692
|
+
} else if (val.endsWith("Pi")) {
|
|
47693
|
+
numericValue *= 1.125899907;
|
|
47694
|
+
} else if (val.endsWith("Ei")) {
|
|
47695
|
+
numericValue *= 1.152921505;
|
|
47696
|
+
} else if (val === "0") {
|
|
47697
|
+
return 0;
|
|
47698
|
+
} else {
|
|
47699
|
+
throw new Error("Invalid value");
|
|
47700
|
+
}
|
|
47701
|
+
return floorToDecimal(numericValue, 1);
|
|
47702
|
+
}
|
|
47703
|
+
return 0;
|
|
47704
|
+
};
|
|
47705
|
+
|
|
47706
|
+
const findAllPathsForObject = (obj, targetKey, targetValue, currentPath = []) => {
|
|
47707
|
+
let paths = [];
|
|
47708
|
+
if (typeof obj !== "object" || obj === null) {
|
|
47709
|
+
return paths;
|
|
47710
|
+
}
|
|
47711
|
+
if (obj[targetKey] === targetValue) {
|
|
47712
|
+
paths.push([...currentPath]);
|
|
47713
|
+
}
|
|
47714
|
+
for (const key in obj) {
|
|
47715
|
+
if (obj.hasOwnProperty(key)) {
|
|
47716
|
+
const value = obj[key];
|
|
47717
|
+
if (typeof value === "object" && value !== null) {
|
|
47718
|
+
const newPath = [...currentPath, key];
|
|
47719
|
+
const subPaths = findAllPathsForObject(value, targetKey, targetValue, newPath);
|
|
47720
|
+
paths = paths.concat(subPaths);
|
|
47721
|
+
}
|
|
47722
|
+
}
|
|
47723
|
+
}
|
|
47724
|
+
return paths;
|
|
47725
|
+
};
|
|
47726
|
+
const normalizeValuesForQuotasToNumber = (object, properties) => {
|
|
47727
|
+
const newObject = _$1.cloneDeep(object);
|
|
47728
|
+
const cpuPaths = findAllPathsForObject(properties, "type", "rangeInputCpu");
|
|
47729
|
+
const memoryPaths = findAllPathsForObject(properties, "type", "rangeInputMemory");
|
|
47730
|
+
memoryPaths.forEach((path) => {
|
|
47731
|
+
const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
|
|
47732
|
+
const value = _$1.get(newObject, cleanPath);
|
|
47733
|
+
if (value || value === 0) {
|
|
47734
|
+
_$1.set(newObject, cleanPath, parseQuotaValueMemoryAndStorage(value));
|
|
47735
|
+
}
|
|
47736
|
+
});
|
|
47737
|
+
cpuPaths.forEach((path) => {
|
|
47738
|
+
const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
|
|
47739
|
+
const value = _$1.get(newObject, cleanPath);
|
|
47740
|
+
if (value || value === 0) {
|
|
47741
|
+
_$1.set(newObject, cleanPath, parseQuotaValueCpu(value));
|
|
47742
|
+
}
|
|
47743
|
+
});
|
|
47744
|
+
return newObject;
|
|
47745
|
+
};
|
|
47746
|
+
|
|
47747
|
+
const getAllPathsFromObj = (obj, prefix = []) => {
|
|
47748
|
+
const entries = Array.isArray(obj) ? obj.map((value, index) => [index, value]) : Object.entries(obj);
|
|
47749
|
+
return entries.flatMap(([key, value]) => {
|
|
47750
|
+
const currentPath = [...prefix, key];
|
|
47751
|
+
return typeof value === "object" && value !== null ? [currentPath, ...getAllPathsFromObj(value, currentPath)] : [currentPath];
|
|
47752
|
+
});
|
|
47753
|
+
};
|
|
47754
|
+
|
|
47755
|
+
const getPrefixSubarrays = (arr) => {
|
|
47756
|
+
return arr.map((_, index) => arr.slice(0, index + 1));
|
|
47757
|
+
};
|
|
47758
|
+
|
|
47759
|
+
const deepMerge = (a, b) => {
|
|
47760
|
+
const result = { ...a };
|
|
47761
|
+
for (const key of Object.keys(b)) {
|
|
47762
|
+
const aVal = a[key];
|
|
47763
|
+
const bVal = b[key];
|
|
47764
|
+
if (aVal !== null && bVal !== null && typeof aVal === "object" && typeof bVal === "object" && !Array.isArray(aVal) && !Array.isArray(bVal)) {
|
|
47765
|
+
result[key] = deepMerge(aVal, bVal);
|
|
47766
|
+
} else {
|
|
47767
|
+
result[key] = bVal;
|
|
47768
|
+
}
|
|
47769
|
+
}
|
|
47770
|
+
return result;
|
|
47771
|
+
};
|
|
47772
|
+
|
|
47773
|
+
const BorderRadiusContainer = styled.div`
|
|
47774
|
+
height: 100%;
|
|
47775
|
+
border: 1px solid ${({ $colorBorder }) => $colorBorder};
|
|
47776
|
+
border-radius: 8px;
|
|
47777
|
+
padding: 2px;
|
|
47778
|
+
|
|
47779
|
+
.monaco-editor,
|
|
47780
|
+
.overflow-guard {
|
|
47781
|
+
border-radius: 8px;
|
|
47782
|
+
}
|
|
47783
|
+
`;
|
|
47784
|
+
const Styled$j = {
|
|
47785
|
+
BorderRadiusContainer
|
|
47786
|
+
};
|
|
47787
|
+
|
|
47788
|
+
const YamlEditor = ({ theme: theme$1, currentValues, onChange, editorUri }) => {
|
|
47789
|
+
const { token } = theme.useToken();
|
|
47790
|
+
const [yamlData, setYamlData] = useState("");
|
|
47791
|
+
const editorRef = useRef(null);
|
|
47792
|
+
const monacoRef = useRef(null);
|
|
47793
|
+
const isFocusedRef = useRef(false);
|
|
47794
|
+
const pendingExternalYamlRef = useRef(null);
|
|
47795
|
+
const isApplyingExternalUpdateRef = useRef(false);
|
|
47796
|
+
useEffect(() => {
|
|
47797
|
+
const next = stringify(currentValues, {
|
|
47798
|
+
// Use literal block scalar for multiline strings
|
|
47799
|
+
blockQuote: "literal",
|
|
47800
|
+
// Preserve line breaks
|
|
47801
|
+
lineWidth: 0,
|
|
47802
|
+
// Use double quotes for strings that need escaping
|
|
47803
|
+
doubleQuotedAsJSON: false
|
|
47804
|
+
});
|
|
47805
|
+
if (isFocusedRef.current) {
|
|
47806
|
+
pendingExternalYamlRef.current = next ?? "";
|
|
47807
|
+
return;
|
|
47808
|
+
}
|
|
47809
|
+
setYamlData(next ?? "");
|
|
47810
|
+
}, [currentValues]);
|
|
47811
|
+
useEffect(() => {
|
|
47812
|
+
const editor = editorRef.current;
|
|
47813
|
+
const monaco = monacoRef.current;
|
|
47814
|
+
if (editor && monaco) {
|
|
47815
|
+
if (isFocusedRef.current) return;
|
|
47816
|
+
const uri = monaco.Uri.parse(editorUri);
|
|
47817
|
+
let model = editor.getModel() || monaco.editor.getModel(uri);
|
|
47818
|
+
if (!model) {
|
|
47819
|
+
model = monaco.editor.createModel(yamlData ?? "", "yaml", uri);
|
|
47820
|
+
}
|
|
47821
|
+
if (model) {
|
|
47822
|
+
monaco.editor.setModelLanguage(model, "yaml");
|
|
47823
|
+
const current = model.getValue();
|
|
47824
|
+
if ((yamlData ?? "") !== current) {
|
|
47825
|
+
isApplyingExternalUpdateRef.current = true;
|
|
47826
|
+
model.setValue(yamlData ?? "");
|
|
47827
|
+
}
|
|
47828
|
+
}
|
|
47829
|
+
}
|
|
47830
|
+
}, [yamlData, editorUri]);
|
|
47831
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$j.BorderRadiusContainer, { $colorBorder: token.colorBorder, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47832
|
+
Ft,
|
|
47833
|
+
{
|
|
47834
|
+
language: "yaml",
|
|
47835
|
+
path: editorUri,
|
|
47836
|
+
keepCurrentModel: true,
|
|
47837
|
+
width: "100%",
|
|
47838
|
+
height: "100%",
|
|
47839
|
+
defaultValue: yamlData ?? "",
|
|
47840
|
+
onMount: (editor, m) => {
|
|
47841
|
+
editorRef.current = editor;
|
|
47842
|
+
monacoRef.current = m;
|
|
47843
|
+
try {
|
|
47844
|
+
isFocusedRef.current = !!editor.hasTextFocus?.();
|
|
47845
|
+
} catch {
|
|
47846
|
+
isFocusedRef.current = false;
|
|
47847
|
+
}
|
|
47848
|
+
editor.onDidFocusEditorText(() => {
|
|
47849
|
+
isFocusedRef.current = true;
|
|
47850
|
+
});
|
|
47851
|
+
editor.onDidBlurEditorText(() => {
|
|
47852
|
+
isFocusedRef.current = false;
|
|
47853
|
+
if (pendingExternalYamlRef.current !== null) {
|
|
47854
|
+
setYamlData(pendingExternalYamlRef.current);
|
|
47855
|
+
pendingExternalYamlRef.current = null;
|
|
47856
|
+
}
|
|
47857
|
+
});
|
|
47858
|
+
const uri = m.Uri.parse("inmemory://openapi-ui/form.yaml");
|
|
47859
|
+
let model = editor.getModel() || m.editor.getModel(uri);
|
|
47860
|
+
if (!model) {
|
|
47861
|
+
model = m.editor.createModel(yamlData ?? "", "yaml", uri);
|
|
47862
|
+
}
|
|
47863
|
+
if (model) {
|
|
47864
|
+
m.editor.setModelLanguage(model, "yaml");
|
|
47865
|
+
}
|
|
47866
|
+
},
|
|
47867
|
+
onChange: (value) => {
|
|
47868
|
+
if (isApplyingExternalUpdateRef.current) {
|
|
47869
|
+
isApplyingExternalUpdateRef.current = false;
|
|
47870
|
+
setYamlData(value || "");
|
|
47871
|
+
return;
|
|
47872
|
+
}
|
|
47873
|
+
try {
|
|
47874
|
+
onChange(parse(value || ""));
|
|
47875
|
+
} catch {
|
|
47876
|
+
}
|
|
47877
|
+
setYamlData(value || "");
|
|
47878
|
+
},
|
|
47879
|
+
theme: theme$1 === "dark" ? "vs-dark" : theme$1 === void 0 ? "vs-dark" : "vs",
|
|
47880
|
+
options: {
|
|
47881
|
+
theme: theme$1 === "dark" ? "vs-dark" : theme$1 === void 0 ? "vs-dark" : "vs"
|
|
47882
|
+
}
|
|
47883
|
+
}
|
|
47884
|
+
) });
|
|
47885
|
+
};
|
|
47886
|
+
|
|
47593
47887
|
const getStringByName = (name) => {
|
|
47594
47888
|
if (typeof name === "string") {
|
|
47595
47889
|
return name;
|