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